Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/LICENSE
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/LICENSE	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/LICENSE	(working copy)
@@ -1,26 +1,29 @@
-Copyright (c) 2012, Artur Adib <aadib@mozilla.com>
-All rights reserved.
+BSD 3-Clause License
 
-You may use this project under the terms of the New BSD license as follows:
+Copyright (c) 2012, Artur Adib <arturadib@gmail.com>
+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 Artur Adib nor the
-      names of the 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 ARTUR ADIB 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.
+
+* 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 the copyright holder 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 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.
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/README.md
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/README.md	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/README.md	(working copy)
@@ -1,177 +1,365 @@
-# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)
+# ShellJS - Unix shell commands for Node.js
 
-ShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!
+[![Build Status](https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fshelljs%2Fshelljs%2Fbadge%3Fref%3Dmaster&style=flat-square)](https://actions-badge.atrox.dev/shelljs/shelljs/goto?ref=master)
+[![Codecov](https://img.shields.io/codecov/c/github/shelljs/shelljs/master.svg?style=flat-square&label=coverage)](https://codecov.io/gh/shelljs/shelljs)
+[![npm version](https://img.shields.io/npm/v/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
+[![npm downloads](https://img.shields.io/npm/dm/shelljs.svg?style=flat-square)](https://www.npmjs.com/package/shelljs)
+
+ShellJS is a portable **(Windows/Linux/macOS)** implementation of Unix shell
+commands on top of the Node.js API. You can use it to eliminate your shell
+script's dependency on Unix while still keeping its familiar and powerful
+commands. You can also install it globally so you can run it from outside Node
+projects - say goodbye to those gnarly Bash scripts!
 
-The project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:
+ShellJS is proudly tested on every node release since <!-- start minVersion -->`v8`<!-- stop minVersion -->!
+
+The project is unit-tested and battle-tested in projects like:
 
-+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader
 + [Firebug](http://getfirebug.com/) - Firefox's infamous debugger
-+ [JSHint](http://jshint.com) - Most popular JavaScript linter
++ [JSHint](http://jshint.com) & [ESLint](http://eslint.org/) - popular JavaScript linters
 + [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers
 + [Yeoman](http://yeoman.io/) - Web application stack and development tool
 + [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation
++ And [many more](https://npmjs.org/browse/depended/shelljs).
 
-and [many more](https://npmjs.org/browse/depended/shelljs).
+If you have feedback, suggestions, or need help, feel free to post in our [issue
+tracker](https://github.com/shelljs/shelljs/issues).
 
-## Installing
+Think ShellJS is cool? Check out some related projects in our [Wiki
+page](https://github.com/shelljs/shelljs/wiki)!
 
-Via npm:
+Upgrading from an older version? Check out our [breaking
+changes](https://github.com/shelljs/shelljs/wiki/Breaking-Changes) page to see
+what changes to watch out for while upgrading.
 
-```bash
-$ npm install [-g] shelljs
-```
+## Command line use
 
-If the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to
-run ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:
+If you just want cross platform UNIX commands, checkout our new project
+[shelljs/shx](https://github.com/shelljs/shx), a utility to expose `shelljs` to
+the command line.
 
-```bash
-$ shjs my_script
+For example:
+
+```
+$ shx mkdir -p foo
+$ shx touch foo/bar.txt
+$ shx rm -rf foo
 ```
 
-You can also just copy `shell.js` into your project's directory, and `require()` accordingly.
+## Plugin API
 
+ShellJS now supports third-party plugins! You can learn more about using plugins
+and writing your own ShellJS commands in [the
+wiki](https://github.com/shelljs/shelljs/wiki/Using-ShellJS-Plugins).
 
-## Examples
+## A quick note about the docs
 
-### JavaScript
+For documentation on all the latest features, check out our
+[README](https://github.com/shelljs/shelljs). To read docs that are consistent
+with the latest release, check out [the npm
+page](https://www.npmjs.com/package/shelljs).
+
+## Installing
+
+Via npm:
+
+```bash
+$ npm install [-g] shelljs
+```
+
+## Examples
 
 ```javascript
-require('shelljs/global');
+var shell = require('shelljs');
 
-if (!which('git')) {
-  echo('Sorry, this script requires git');
-  exit(1);
+if (!shell.which('git')) {
+  shell.echo('Sorry, this script requires git');
+  shell.exit(1);
 }
 
 // Copy files to release dir
-mkdir('-p', 'out/Release');
-cp('-R', 'stuff/*', 'out/Release');
+shell.rm('-rf', 'out/Release');
+shell.cp('-R', 'stuff/', 'out/Release');
 
 // Replace macros in each .js file
-cd('lib');
-ls('*.js').forEach(function(file) {
-  sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
-  sed('-i', /.*REMOVE_THIS_LINE.*\n/, '', file);
-  sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat('macro.js'), file);
+shell.cd('lib');
+shell.ls('*.js').forEach(function (file) {
+  shell.sed('-i', 'BUILD_VERSION', 'v0.1.2', file);
+  shell.sed('-i', /^.*REMOVE_THIS_LINE.*$/, '', file);
+  shell.sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, shell.cat('macro.js'), file);
 });
-cd('..');
+shell.cd('..');
 
 // Run external tool synchronously
-if (exec('git commit -am "Auto-commit"').code !== 0) {
-  echo('Error: Git commit failed');
-  exit(1);
+if (shell.exec('git commit -am "Auto-commit"').code !== 0) {
+  shell.echo('Error: Git commit failed');
+  shell.exit(1);
 }
 ```
 
-### CoffeeScript
+## Exclude options
 
-```coffeescript
-require 'shelljs/global'
+If you need to pass a parameter that looks like an option, you can do so like:
 
-if not which 'git'
-  echo 'Sorry, this script requires git'
-  exit 1
-
-# Copy files to release dir
-mkdir '-p', 'out/Release'
-cp '-R', 'stuff/*', 'out/Release'
-
-# Replace macros in each .js file
-cd 'lib'
-for file in ls '*.js'
-  sed '-i', 'BUILD_VERSION', 'v0.1.2', file
-  sed '-i', /.*REMOVE_THIS_LINE.*\n/, '', file
-  sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\n/, cat 'macro.js', file
-cd '..'
-
-# Run external tool synchronously
-if (exec 'git commit -am "Auto-commit"').code != 0
-  echo 'Error: Git commit failed'
-  exit 1
+```js
+shell.grep('--', '-v', 'path/to/file'); // Search for "-v", no grep options
+
+shell.cp('-R', '-dir', 'outdir'); // If already using an option, you're done
 ```
 
 ## Global vs. Local
 
-The example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.
+We no longer recommend using a global-import for ShellJS (i.e.
+`require('shelljs/global')`). While still supported for convenience, this
+pollutes the global namespace, and should therefore only be used with caution.
 
-Example:
+Instead, we recommend a local import (standard for npm packages):
 
 ```javascript
 var shell = require('shelljs');
 shell.echo('hello world');
 ```
 
-## Make tool
+Alternatively, we also support importing as a module with:
 
-A convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.
+```javascript
+import shell from 'shelljs';
+shell.echo('hello world');
+```
+
+<!-- DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED -->
+
+
+## Command reference
 
-Example (CoffeeScript):
 
-```coffeescript
-require 'shelljs/make'
+All commands run synchronously, unless otherwise stated.
+All commands accept standard bash globbing characters (`*`, `?`, etc.),
+compatible with the [node `glob` module](https://github.com/isaacs/node-glob).
+
+For less-commonly used commands and features, please check out our [wiki
+page](https://github.com/shelljs/shelljs/wiki).
+
+
+### cat([options,] file [, file ...])
+### cat([options,] file_array)
+
+Available options:
 
-target.all = ->
-  target.bundle()
-  target.docs()
++ `-n`: number all output lines
 
-target.bundle = ->
-  cd __dirname
-  mkdir 'build'
-  cd 'lib'
-  (cat '*.js').to '../build/output.js'
+Examples:
 
-target.docs = ->
-  cd __dirname
-  mkdir 'docs'
-  cd 'lib'
-  for file in ls '*.js'
-    text = grep '//@', file     # extract special comments
-    text.replace '//@', ''      # remove comment tags
-    text.to 'docs/my_docs.md'
+```javascript
+var str = cat('file*.txt');
+var str = cat('file1', 'file2');
+var str = cat(['file1', 'file2']); // same as above
 ```
 
-To run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.
+Returns a [ShellString](#shellstringstr) containing the given file, or a
+concatenated string containing the files if more than one file is given (a
+new line character is introduced between each file).
 
 
+### cd([dir])
 
-<!-- 
+Changes to directory `dir` for the duration of the script. Changes to home
+directory if no argument is supplied. Returns a
+[ShellString](#shellstringstr) to indicate success or failure.
 
-  DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED
 
--->
+### chmod([options,] octal_mode || octal_string, file)
+### chmod([options,] symbolic_mode, file)
 
+Available options:
 
-## Command reference
++ `-v`: output a diagnostic for every file processed
++ `-c`: like verbose, but report only when a change is made
++ `-R`: change files and directories recursively
 
+Examples:
 
-All commands run synchronously, unless otherwise stated.
+```javascript
+chmod(755, '/Users/brandon');
+chmod('755', '/Users/brandon'); // same as above
+chmod('u+x', '/Users/brandon');
+chmod('-R', 'a-w', '/Users/brandon');
+```
 
+Alters the permissions of a file or directory by either specifying the
+absolute permissions in octal form or expressing the changes in symbols.
+This command tries to mimic the POSIX behavior as much as possible.
+Notable exceptions:
 
-### cd('dir')
-Changes to directory `dir` for the duration of the script
++ In symbolic modes, `a-r` and `-r` are identical.  No consideration is
+  given to the `umask`.
++ There is no "quiet" option, since default behavior is to run silent.
++ Windows OS uses a very different permission model than POSIX. `chmod()`
+  does its best on Windows, but there are limits to how file permissions can
+  be set. Note that WSL (Windows subsystem for Linux) **does** follow POSIX,
+  so cross-platform compatibility should not be a concern there.
 
-### pwd()
-Returns the current directory.
+Returns a [ShellString](#shellstringstr) indicating success or failure.
+
+
+### cp([options,] source [, source ...], dest)
+### cp([options,] source_array, dest)
 
-### ls([options ,] path [,path ...])
-### ls([options ,] path_array)
 Available options:
 
-+ `-R`: recursive
-+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
++ `-f`: force (default behavior)
++ `-n`: no-clobber
++ `-u`: only copy if `source` is newer than `dest`
++ `-r`, `-R`: recursive
++ `-L`: follow symlinks
++ `-P`: don't follow symlinks
++ `-p`: preserve file mode, ownership, and timestamps
 
 Examples:
 
 ```javascript
-ls('projs/*.js');
-ls('-R', '/users/me', '/tmp');
-ls('-R', ['/users/me', '/tmp']); // same as above
+cp('file1', 'dir1');
+cp('-R', 'path/to/dir/', '~/newCopy/');
+cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
+cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
 ```
 
-Returns array of files in the given path, or in current directory if no path provided.
+Copies files. Returns a [ShellString](#shellstringstr) indicating success
+or failure.
+
+
+### pushd([options,] [dir | '-N' | '+N'])
+
+Available options:
+
++ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
++ `-q`: Suppresses output to the console.
 
-### find(path [,path ...])
+Arguments:
+
++ `dir`: Sets the current working directory to the top of the stack, then executes the equivalent of `cd dir`.
++ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
++ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+
+Examples:
+
+```javascript
+// process.cwd() === '/usr'
+pushd('/etc'); // Returns /etc /usr
+pushd('+1');   // Returns /usr /etc
+```
+
+Save the current directory on the top of the directory stack and then `cd` to `dir`. With no arguments, `pushd` exchanges the top two directories. Returns an array of paths in the stack.
+
+
+### popd([options,] ['-N' | '+N'])
+
+Available options:
+
++ `-n`: Suppress the normal directory change when removing directories from the stack, so that only the stack is manipulated.
++ `-q`: Supresses output to the console.
+
+Arguments:
+
++ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
++ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
+
+Examples:
+
+```javascript
+echo(process.cwd()); // '/usr'
+pushd('/etc');       // '/etc /usr'
+echo(process.cwd()); // '/etc'
+popd();              // '/usr'
+echo(process.cwd()); // '/usr'
+```
+
+When no arguments are given, `popd` removes the top directory from the stack and performs a `cd` to the new top directory. The elements are numbered from 0, starting at the first directory listed with dirs (i.e., `popd` is equivalent to `popd +0`). Returns an array of paths in the stack.
+
+
+### dirs([options | '+N' | '-N'])
+
+Available options:
+
++ `-c`: Clears the directory stack by deleting all of the elements.
++ `-q`: Supresses output to the console.
+
+Arguments:
+
++ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
++ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
+
+Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if `+N` or `-N` was specified.
+
+See also: `pushd`, `popd`
+
+
+### echo([options,] string [, string ...])
+
+Available options:
+
++ `-e`: interpret backslash escapes (default)
++ `-n`: remove trailing newline from output
+
+Examples:
+
+```javascript
+echo('hello world');
+var str = echo('hello world');
+echo('-n', 'no newline at end');
+```
+
+Prints `string` to stdout, and returns a [ShellString](#shellstringstr).
+
+
+### exec(command [, options] [, callback])
+
+Available options:
+
++ `async`: Asynchronous execution. If a callback is provided, it will be set to
+  `true`, regardless of the passed value (default: `false`).
++ `fatal`: Exit upon error (default: `false`).
++ `silent`: Do not echo program output to console (default: `false`).
++ `encoding`: Character encoding to use. Affects the values returned to stdout and stderr, and
+  what is written to stdout and stderr when not in silent mode (default: `'utf8'`).
++ and any option available to Node.js's
+  [`child_process.exec()`](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback)
+
+Examples:
+
+```javascript
+var version = exec('node --version', {silent:true}).stdout;
+
+var child = exec('some_long_running_process', {async:true});
+child.stdout.on('data', function(data) {
+  /* ... do something with data ... */
+});
+
+exec('some_long_running_process', function(code, stdout, stderr) {
+  console.log('Exit code:', code);
+  console.log('Program output:', stdout);
+  console.log('Program stderr:', stderr);
+});
+```
+
+Executes the given `command` _synchronously_, unless otherwise specified.
+When in synchronous mode, this returns a [ShellString](#shellstringstr).
+Otherwise, this returns the child process object, and the `callback`
+receives the arguments `(code, stdout, stderr)`.
+
+Not seeing the behavior you want? `exec()` runs everything through `sh`
+by default (or `cmd.exe` on Windows), which differs from `bash`. If you
+need bash-specific behavior, try out the `{shell: 'path/to/bash'}` option.
+
+**Security note:** as `shell.exec()` executes an arbitrary string in the
+system shell, it is **critical** to properly sanitize user input to avoid
+**command injection**. For more context, consult the [Security
+Guidelines](https://github.com/shelljs/shelljs/wiki/Security-guidelines).
+
+
+### find(path [, path ...])
 ### find(path_array)
+
 Examples:
 
 ```javascript
@@ -180,66 +368,111 @@
 find('.').filter(function(file) { return file.match(/\.js$/); });
 ```
 
-Returns array of all files (however deep) in the given paths.
+Returns a [ShellString](#shellstringstr) (with array-like properties) of all
+files (however deep) in the given paths.
 
 The main difference from `ls('-R', path)` is that the resulting file names
-include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
+include the base directories (e.g., `lib/resources/file1` instead of just `file1`).
+
+
+### grep([options,] regex_filter, file [, file ...])
+### grep([options,] regex_filter, file_array)
 
-### cp([options ,] source [,source ...], dest)
-### cp([options ,] source_array, dest)
 Available options:
 
-+ `-f`: force
-+ `-r, -R`: recursive
++ `-v`: Invert `regex_filter` (only print non-matching lines).
++ `-l`: Print only filenames of matching files.
++ `-i`: Ignore case.
++ `-n`: Print line numbers.
 
 Examples:
 
 ```javascript
-cp('file1', 'dir1');
-cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
-cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
+grep('-v', 'GLOBAL_VARIABLE', '*.js');
+grep('GLOBAL_VARIABLE', '*.js');
 ```
 
-Copies files. The wildcard `*` is accepted.
+Reads input string from given files and returns a
+[ShellString](#shellstringstr) containing all lines of the @ file that match
+the given `regex_filter`.
+
+
+### head([{'-n': \<num\>},] file [, file ...])
+### head([{'-n': \<num\>},] file_array)
+
+Available options:
+
++ `-n <num>`: Show the first `<num>` lines of the files
+
+Examples:
+
+```javascript
+var str = head({'-n': 1}, 'file*.txt');
+var str = head('file1', 'file2');
+var str = head(['file1', 'file2']); // same as above
+```
+
+Read the start of a `file`. Returns a [ShellString](#shellstringstr).
+
+
+### ln([options,] source, dest)
 
-### rm([options ,] file [, file ...])
-### rm([options ,] file_array)
 Available options:
 
++ `-s`: symlink
 + `-f`: force
-+ `-r, -R`: recursive
 
 Examples:
 
 ```javascript
-rm('-rf', '/tmp/*');
-rm('some_file.txt', 'another_file.txt');
-rm(['some_file.txt', 'another_file.txt']); // same as above
+ln('file', 'newlink');
+ln('-sf', 'file', 'existing');
 ```
 
-Removes files. The wildcard `*` is accepted.
+Links `source` to `dest`. Use `-f` to force the link, should `dest` already
+exist. Returns a [ShellString](#shellstringstr) indicating success or
+failure.
+
+
+### ls([options,] [path, ...])
+### ls([options,] path_array)
 
-### mv(source [, source ...], dest')
-### mv(source_array, dest')
 Available options:
 
-+ `f`: force
++ `-R`: recursive
++ `-A`: all files (include files beginning with `.`, except for `.` and `..`)
++ `-L`: follow symlinks
++ `-d`: list directories themselves, not their contents
++ `-l`: provides more details for each file. Specifically, each file is
+        represented by a structured object with separate fields for file
+        metadata (see
+        [`fs.Stats`](https://nodejs.org/api/fs.html#fs_class_fs_stats)). The
+        return value also overrides `.toString()` to resemble `ls -l`'s
+        output format for human readability, but programmatic usage should
+        depend on the stable object format rather than the `.toString()`
+        representation.
 
 Examples:
 
 ```javascript
-mv('-f', 'file', 'dir/');
-mv('file1', 'file2', 'dir/');
-mv(['file1', 'file2'], 'dir/'); // same as above
+ls('projs/*.js');
+ls('projs/**/*.js'); // Find all js files recursively in projs
+ls('-R', '/users/me', '/tmp');
+ls('-R', ['/users/me', '/tmp']); // same as above
+ls('-l', 'file.txt'); // { name: 'file.txt', mode: 33188, nlink: 1, ...}
 ```
 
-Moves files. The wildcard `*` is accepted.
+Returns a [ShellString](#shellstringstr) (with array-like properties) of all
+the files in the given `path`, or files in the current directory if no
+`path` is  provided.
+
+
+### mkdir([options,] dir [, dir ...])
+### mkdir([options,] dir_array)
 
-### mkdir([options ,] dir [, dir ...])
-### mkdir([options ,] dir_array)
 Available options:
 
-+ `p`: full path (will create intermediate dirs if necessary)
++ `-p`: full path (and create intermediate directories, if necessary)
 
 Examples:
 
@@ -248,266 +481,417 @@
 mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
 ```
 
-Creates directories.
+Creates directories. Returns a [ShellString](#shellstringstr) indicating
+success or failure.
 
-### test(expression)
-Available expression primaries:
 
-+ `'-b', 'path'`: true if path is a block device
-+ `'-c', 'path'`: true if path is a character device
-+ `'-d', 'path'`: true if path is a directory
-+ `'-e', 'path'`: true if path exists
-+ `'-f', 'path'`: true if path is a regular file
-+ `'-L', 'path'`: true if path is a symboilc link
-+ `'-p', 'path'`: true if path is a pipe (FIFO)
-+ `'-S', 'path'`: true if path is a socket
+### mv([options ,] source [, source ...], dest')
+### mv([options ,] source_array, dest')
+
+Available options:
+
++ `-f`: force (default behavior)
++ `-n`: no-clobber
 
 Examples:
 
 ```javascript
-if (test('-d', path)) { /* do something with dir */ };
-if (!test('-f', path)) continue; // skip if it's a regular file
+mv('-n', 'file', 'dir/');
+mv('file1', 'file2', 'dir/');
+mv(['file1', 'file2'], 'dir/'); // same as above
 ```
 
-Evaluates expression using the available primaries and returns corresponding value.
+Moves `source` file(s) to `dest`. Returns a [ShellString](#shellstringstr)
+indicating success or failure.
 
-### cat(file [, file ...])
-### cat(file_array)
+
+### pwd()
+
+Returns the current directory as a [ShellString](#shellstringstr).
+
+
+### rm([options,] file [, file ...])
+### rm([options,] file_array)
+
+Available options:
+
++ `-f`: force
++ `-r, -R`: recursive
 
 Examples:
 
 ```javascript
-var str = cat('file*.txt');
-var str = cat('file1', 'file2');
-var str = cat(['file1', 'file2']); // same as above
+rm('-rf', '/tmp/*');
+rm('some_file.txt', 'another_file.txt');
+rm(['some_file.txt', 'another_file.txt']); // same as above
 ```
 
-Returns a string containing the given file, or a concatenated string
-containing the files if more than one file is given (a new line character is
-introduced between each file). Wildcard `*` accepted.
+Removes files. Returns a [ShellString](#shellstringstr) indicating success
+or failure.
+
+
+### sed([options,] search_regex, replacement, file [, file ...])
+### sed([options,] search_regex, replacement, file_array)
 
-### 'string'.to(file)
+Available options:
+
++ `-i`: Replace contents of `file` in-place. _Note that no backups will be created!_
 
 Examples:
 
 ```javascript
-cat('input.txt').to('output.txt');
+sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
+```
+
+Reads an input string from `file`s, line by line, and performs a JavaScript `replace()` on
+each of the lines from the input string using the given `search_regex` and `replacement` string or
+function. Returns the new [ShellString](#shellstringstr) after replacement.
+
+Note:
+
+Like unix `sed`, ShellJS `sed` supports capture groups. Capture groups are specified
+using the `$n` syntax:
+
+```javascript
+sed(/(\w+)\s(\w+)/, '$2, $1', 'file.txt');
 ```
 
-Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
-those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
+Also, like unix `sed`, ShellJS `sed` runs replacements on each line from the input file
+(split by '\n') separately, so `search_regex`es that span more than one line (or inlclude '\n')
+will not match anything and nothing will be replaced.
+
+
+### set(options)
 
-### sed([options ,] search_regex, replace_str, file)
 Available options:
 
-+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
++ `+/-e`: exit upon error (`config.fatal`)
++ `+/-v`: verbose: show all commands (`config.verbose`)
++ `+/-f`: disable filename expansion (globbing)
 
 Examples:
 
 ```javascript
-sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
-sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
+set('-e'); // exit upon first error
+set('+e'); // this undoes a "set('-e')"
 ```
 
-Reads an input string from `file` and performs a JavaScript `replace()` on the input
-using the given search regex and replacement string. Returns the new string after replacement.
+Sets global configuration variables.
+
+
+### sort([options,] file [, file ...])
+### sort([options,] file_array)
 
-### grep([options ,] regex_filter, file [, file ...])
-### grep([options ,] regex_filter, file_array)
 Available options:
 
-+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
++ `-r`: Reverse the results
++ `-n`: Compare according to numerical value
 
 Examples:
 
 ```javascript
-grep('-v', 'GLOBAL_VARIABLE', '*.js');
-grep('GLOBAL_VARIABLE', '*.js');
+sort('foo.txt', 'bar.txt');
+sort('-r', 'foo.txt');
 ```
 
-Reads input string from given files and returns a string containing all lines of the
-file that match the given `regex_filter`. Wildcard `*` accepted.
+Return the contents of the `file`s, sorted line-by-line as a
+[ShellString](#shellstringstr). Sorting multiple files mixes their content
+(just as unix `sort` does).
 
-### which(command)
+
+### tail([{'-n': \<num\>},] file [, file ...])
+### tail([{'-n': \<num\>},] file_array)
+
+Available options:
+
++ `-n <num>`: Show the last `<num>` lines of `file`s
 
 Examples:
 
 ```javascript
-var nodeExec = which('node');
+var str = tail({'-n': 1}, 'file*.txt');
+var str = tail('file1', 'file2');
+var str = tail(['file1', 'file2']); // same as above
 ```
 
-Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
-Returns string containing the absolute path to the command.
+Read the end of a `file`. Returns a [ShellString](#shellstringstr).
+
 
-### echo(string [,string ...])
+### tempdir()
 
 Examples:
 
 ```javascript
-echo('hello world');
-var str = echo('hello world');
+var tmp = tempdir(); // "/tmp" for most *nix platforms
 ```
 
-Prints string to stdout, and returns string with additional utility methods
-like `.to()`.
+Searches and returns string containing a writeable, platform-dependent temporary directory.
+Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
 
-### dirs([options | '+N' | '-N'])
 
-Available options:
+### test(expression)
 
-+ `-c`: Clears the directory stack by deleting all of the elements.
+Available expression primaries:
 
-Arguments:
++ `'-b', 'path'`: true if path is a block device
++ `'-c', 'path'`: true if path is a character device
++ `'-d', 'path'`: true if path is a directory
++ `'-e', 'path'`: true if path exists
++ `'-f', 'path'`: true if path is a regular file
++ `'-L', 'path'`: true if path is a symbolic link
++ `'-p', 'path'`: true if path is a pipe (FIFO)
++ `'-S', 'path'`: true if path is a socket
 
-+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
-+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
+Examples:
 
-Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
+```javascript
+if (test('-d', path)) { /* do something with dir */ };
+if (!test('-f', path)) continue; // skip if it's not a regular file
+```
 
-See also: pushd, popd
+Evaluates `expression` using the available primaries and returns
+corresponding boolean value.
 
-### pushd([options,] [dir | '-N' | '+N'])
 
-Available options:
+### ShellString.prototype.to(file)
 
-+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
+Examples:
 
-Arguments:
+```javascript
+cat('input.txt').to('output.txt');
+```
 
-+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
-+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
-+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
+Analogous to the redirection operator `>` in Unix, but works with
+`ShellStrings` (such as those returned by `cat`, `grep`, etc.). _Like Unix
+redirections, `to()` will overwrite any existing file!_ Returns the same
+[ShellString](#shellstringstr) this operated on, to support chaining.
+
+
+### ShellString.prototype.toEnd(file)
 
 Examples:
 
 ```javascript
-// process.cwd() === '/usr'
-pushd('/etc'); // Returns /etc /usr
-pushd('+1');   // Returns /usr /etc
+cat('input.txt').toEnd('output.txt');
 ```
 
-Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
+Analogous to the redirect-and-append operator `>>` in Unix, but works with
+`ShellStrings` (such as those returned by `cat`, `grep`, etc.). Returns the
+same [ShellString](#shellstringstr) this operated on, to support chaining.
 
-### popd([options,] ['-N' | '+N'])
+
+### touch([options,] file [, file ...])
+### touch([options,] file_array)
 
 Available options:
 
-+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
++ `-a`: Change only the access time
++ `-c`: Do not create any files
++ `-m`: Change only the modification time
++ `{'-d': someDate}`, `{date: someDate}`: Use a `Date` instance (ex. `someDate`)
+  instead of current time
++ `{'-r': file}`, `{reference: file}`: Use `file`'s times instead of current
+  time
 
-Arguments:
+Examples:
 
-+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
-+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
+```javascript
+touch('source.js');
+touch('-c', 'path/to/file.js');
+touch({ '-r': 'referenceFile.txt' }, 'path/to/file.js');
+touch({ '-d': new Date('December 17, 1995 03:24:00'), '-m': true }, 'path/to/file.js');
+touch({ date: new Date('December 17, 1995 03:24:00') }, 'path/to/file.js');
+```
+
+Update the access and modification times of each file to the current time.
+A file argument that does not exist is created empty, unless `-c` is supplied.
+This is a partial implementation of
+[`touch(1)`](http://linux.die.net/man/1/touch). Returns a
+[ShellString](#shellstringstr) indicating success or failure.
+
+
+### uniq([options,] [input, [output]])
+
+Available options:
+
++ `-i`: Ignore case while comparing
++ `-c`: Prefix lines by the number of occurrences
++ `-d`: Only print duplicate lines, one for each group of identical lines
 
 Examples:
 
 ```javascript
-echo(process.cwd()); // '/usr'
-pushd('/etc');       // '/etc /usr'
-echo(process.cwd()); // '/etc'
-popd();              // '/usr'
-echo(process.cwd()); // '/usr'
+uniq('foo.txt');
+uniq('-i', 'foo.txt');
+uniq('-cd', 'foo.txt', 'bar.txt');
 ```
 
-When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
+Filter adjacent matching lines from `input`. Returns a
+[ShellString](#shellstringstr).
+
+
+### which(command)
+
+Examples:
+
+```javascript
+var nodeExec = which('node');
+```
+
+Searches for `command` in the system's `PATH`. On Windows, this uses the
+`PATHEXT` variable to append the extension if it's not already executable.
+Returns a [ShellString](#shellstringstr) containing the absolute path to
+`command`.
+
 
 ### exit(code)
-Exits the current process with the given exit code.
 
-### env['VAR_NAME']
-Object containing environment variables (both getter and setter). Shortcut to process.env.
+Exits the current process with the given exit `code`.
 
-### exec(command [, options] [, callback])
-Available options (all `false` by default):
+### error()
+
+Tests if error occurred in the last command. Returns a truthy value if an
+error returned, or a falsy value otherwise.
+
+**Note**: do not rely on the
+return value to be an error message. If you need the last error message, use
+the `.stderr` attribute from the last command's return value instead.
 
-+ `async`: Asynchronous execution. Defaults to true if a callback is provided.
-+ `silent`: Do not echo program output to console.
+
+### errorCode()
+
+Returns the error code from the last command.
+
+
+### ShellString(str)
 
 Examples:
 
 ```javascript
-var version = exec('node --version', {silent:true}).output;
+var foo = new ShellString('hello world');
+```
 
-var child = exec('some_long_running_process', {async:true});
-child.stdout.on('data', function(data) {
-  /* ... do something with data ... */
-});
+This is a dedicated type returned by most ShellJS methods, which wraps a
+string (or array) value. This has all the string (or array) methods, but
+also exposes extra methods: [`.to()`](#shellstringprototypetofile),
+[`.toEnd()`](#shellstringprototypetoendfile), and all the pipe-able methods
+(ex. `.cat()`, `.grep()`, etc.). This can be easily converted into a string
+by calling `.toString()`.
 
-exec('some_long_running_process', function(code, output) {
-  console.log('Exit code:', code);
-  console.log('Program output:', output);
-});
-```
+This type also exposes the corresponding command's stdout, stderr, and
+return status code via the `.stdout` (string), `.stderr` (string), and
+`.code` (number) properties respectively.
 
-Executes the given `command` _synchronously_, unless otherwise specified.
-When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
-`output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and
-the `callback` gets the arguments `(code, output)`.
-
-**Note:** For long-lived processes, it's best to run `exec()` asynchronously as
-the current synchronous implementation uses a lot of CPU. This should be getting
-fixed soon.
 
-### chmod(octal_mode || octal_string, file)
-### chmod(symbolic_mode, file)
+### env['VAR_NAME']
 
-Available options:
+Object containing environment variables (both getter and setter). Shortcut
+to `process.env`.
 
-+ `-v`: output a diagnostic for every file processed
-+ `-c`: like verbose but report only when a change is made
-+ `-R`: change files and directories recursively
+### Pipes
 
 Examples:
 
 ```javascript
-chmod(755, '/Users/brandon');
-chmod('755', '/Users/brandon'); // same as above 
-chmod('u+x', '/Users/brandon');
+grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
+echo('files with o\'s in the name:\n' + ls().grep('o'));
+cat('test.js').exec('node'); // pipe to exec() call
 ```
 
-Alters the permissions of a file or directory by either specifying the
-absolute permissions in octal form or expressing the changes in symbols.
-This command tries to mimic the POSIX behavior as much as possible.
-Notable exceptions:
-
-+ In symbolic modes, 'a-r' and '-r' are identical.  No consideration is
-  given to the umask.
-+ There is no "quiet" option since default behavior is to run silent.
+Commands can send their output to another command in a pipe-like fashion.
+`sed`, `grep`, `cat`, `exec`, `to`, and `toEnd` can appear on the right-hand
+side of a pipe. Pipes can be chained.
 
 ## Configuration
 
 
 ### config.silent
+
 Example:
 
 ```javascript
-var silentState = config.silent; // save old silent state
-config.silent = true;
+var sh = require('shelljs');
+var silentState = sh.config.silent; // save old silent state
+sh.config.silent = true;
 /* ... */
-config.silent = silentState; // restore old silent state
+sh.config.silent = silentState; // restore old silent state
 ```
 
 Suppresses all command output if `true`, except for `echo()` calls.
 Default is `false`.
 
 ### config.fatal
+
 Example:
 
 ```javascript
-config.fatal = true;
-cp('this_file_does_not_exist', '/dev/null'); // dies here
+require('shelljs/global');
+config.fatal = true; // or set('-e');
+cp('this_file_does_not_exist', '/dev/null'); // throws Error here
 /* more commands... */
 ```
 
-If `true` the script will die on errors. Default is `false`.
+If `true`, the script will throw a Javascript error when any shell.js
+command encounters an error. Default is `false`. This is analogous to
+Bash's `set -e`.
 
-## Non-Unix commands
+### config.verbose
 
+Example:
 
-### tempdir()
-Searches and returns string containing a writeable, platform-dependent temporary directory.
-Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
+```javascript
+config.verbose = true; // or set('-v');
+cd('dir/');
+rm('-rf', 'foo.txt', 'bar.txt');
+exec('echo hello');
+```
 
-### error()
-Tests if error occurred in the last command. Returns `null` if no error occurred,
-otherwise returns string explaining the error
+Will print each command as follows:
+
+```
+cd dir/
+rm -rf foo.txt bar.txt
+exec echo hello
+```
+
+### config.globOptions
+
+Example:
+
+```javascript
+config.globOptions = {nodir: true};
+```
+
+Use this value for calls to `glob.sync()` instead of the default options.
+
+### config.reset()
+
+Example:
+
+```javascript
+var shell = require('shelljs');
+// Make changes to shell.config, and do stuff...
+/* ... */
+shell.config.reset(); // reset to original state
+// Do more stuff, but with original settings
+/* ... */
+```
+
+Reset `shell.config` to the defaults:
+
+```javascript
+{
+  fatal: false,
+  globOptions: {},
+  maxdepth: 255,
+  noglob: false,
+  silent: false,
+  verbose: false,
+}
+```
+
+## Team
+
+| [![Nate Fischer](https://avatars.githubusercontent.com/u/5801521?s=130)](https://github.com/nfischer) | [![Brandon Freitag](https://avatars1.githubusercontent.com/u/5988055?v=3&s=130)](http://github.com/freitagbr) |
+|:---:|:---:|
+| [Nate Fischer](https://github.com/nfischer) | [Brandon Freitag](http://github.com/freitagbr) |
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/bin/shjs
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/bin/shjs	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/bin/shjs	(working copy)
@@ -1,12 +1,23 @@
 #!/usr/bin/env node
+
+if (require.main !== module) {
+  throw new Error('Executable-only module should not be required');
+}
+
+// we must import global ShellJS methods after the require.main check to prevent the global
+// namespace from being polluted if the error is caught
 require('../global');
 
-if (process.argv.length < 3) {
-  console.log('ShellJS: missing argument (script name)');
+function exitWithErrorMessage(msg) {
+  console.log(msg);
   console.log();
   process.exit(1);
 }
 
+if (process.argv.length < 3) {
+  exitWithErrorMessage('ShellJS: missing argument (script name)');
+}
+
 var args,
   scriptName = process.argv[2];
 env['NODE_PATH'] = __dirname + '/../..';
@@ -19,9 +30,7 @@
 }
 
 if (!test('-f', scriptName)) {
-  console.log('ShellJS: script not found ('+scriptName+')');
-  console.log();
-  process.exit(1);
+  exitWithErrorMessage('ShellJS: script not found ('+scriptName+')');
 }
 
 args = process.argv.slice(3);
@@ -32,20 +41,8 @@
   }
 }
 
-if (scriptName.match(/\.coffee$/)) {
-  //
-  // CoffeeScript
-  //
-  if (which('coffee')) {
-    exec('coffee ' + scriptName + ' ' + args.join(' '), { async: true });
-  } else {
-    console.log('ShellJS: CoffeeScript interpreter not found');
-    console.log();
-    process.exit(1);
-  }
-} else {
-  //
-  // JavaScript
-  //
-  exec('node ' + scriptName + ' ' + args.join(' '), { async: true });
-}
+var path = require('path');
+var extensions = require('interpret').extensions;
+var rechoir = require('rechoir');
+rechoir.prepare(extensions, scriptName);
+require(require.resolve(path.resolve(process.cwd(), scriptName)));
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/global.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/global.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/global.js	(working copy)
@@ -1,3 +1,12 @@
+/* eslint no-extend-native: 0 */
 var shell = require('./shell.js');
-for (var cmd in shell)
+var common = require('./src/common');
+Object.keys(shell).forEach(function (cmd) {
   global[cmd] = shell[cmd];
+});
+
+var _to = require('./src/to');
+String.prototype.to = common.wrap('to', _to);
+
+var _toEnd = require('./src/toEnd');
+String.prototype.toEnd = common.wrap('toEnd', _toEnd);
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/make.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/make.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/make.js	(working copy)
@@ -1,48 +1,57 @@
 require('./global');
-config.fatal = true;
 
+global.config.fatal = true;
 global.target = {};
 
+var args = process.argv.slice(2),
+  targetArgs,
+  dashesLoc = args.indexOf('--');
+
+// split args, everything after -- if only for targets
+if (dashesLoc > -1) {
+  targetArgs = args.slice(dashesLoc + 1, args.length);
+  args = args.slice(0, dashesLoc);
+}
+
 // This ensures we only execute the script targets after the entire script has
 // been evaluated
-var args = process.argv.slice(2);
 setTimeout(function() {
   var t;
 
   if (args.length === 1 && args[0] === '--help') {
     console.log('Available targets:');
-    for (t in target)
+    for (t in global.target)
       console.log('  ' + t);
     return;
   }
 
   // Wrap targets to prevent duplicate execution
-  for (t in target) {
+  for (t in global.target) {
     (function(t, oldTarget){
 
       // Wrap it
-      target[t] = function(force) {
-        if (oldTarget.done && !force)
-          return;
-        oldTarget.done = true;
-        return oldTarget.apply(oldTarget, arguments);
+      global.target[t] = function() {
+        if (!oldTarget.done){
+          oldTarget.done = true;
+          oldTarget.result = oldTarget.apply(oldTarget, arguments);
+        }
+        return oldTarget.result;
       };
 
-    })(t, target[t]);
+    })(t, global.target[t]);
   }
 
   // Execute desired targets
   if (args.length > 0) {
     args.forEach(function(arg) {
-      if (arg in target)
-        target[arg]();
+      if (arg in global.target)
+        global.target[arg](targetArgs);
       else {
         console.log('no such target: ' + arg);
-        exit(1);
       }
     });
-  } else if ('all' in target) {
-    target.all();
+  } else if ('all' in global.target) {
+    global.target.all(targetArgs);
   }
 
 }, 0);
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/package.json
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/package.json	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/package.json	(working copy)
@@ -1,12 +1,10 @@
 {
   "name": "shelljs",
-  "version": "0.1.4",
-  "author": {
-    "name": "Artur Adib",
-    "email": "aadib@mozilla.com"
-  },
+  "version": "0.8.3",
   "description": "Portable Unix shell commands for Node.js",
   "keywords": [
+    "shelljs",
+    "bash",
     "unix",
     "shell",
     "makefile",
@@ -14,35 +12,68 @@
     "jake",
     "synchronous"
   ],
+  "contributors": [
+    "Nate Fischer <ntfschr@gmail.com> (https://github.com/nfischer)",
+    "Brandon Freitag <freitagbr@gmail.com> (https://github.com/freitagbr)"
+  ],
   "repository": {
     "type": "git",
-    "url": "git://github.com/arturadib/shelljs.git"
+    "url": "git://github.com/shelljs/shelljs.git"
   },
-  "homepage": "http://github.com/arturadib/shelljs",
+  "license": "BSD-3-Clause",
+  "homepage": "http://github.com/shelljs/shelljs",
   "main": "./shell.js",
+  "files": [
+    "commands.js",
+    "global.js",
+    "make.js",
+    "plugin.js",
+    "shell.js",
+    "bin",
+    "src"
+  ],
   "scripts": {
-    "test": "node scripts/run-tests"
+    "check-node-support": "node scripts/check-node-support",
+    "posttest": "npm run lint",
+    "test": "ava test/*.js",
+    "test-with-coverage": "nyc --reporter=text --reporter=lcov ava test/*.js",
+    "gendocs": "node scripts/generate-docs",
+    "lint": "eslint .",
+    "after-travis": "travis-check-changes",
+    "changelog": "shelljs-changelog",
+    "release:major": "shelljs-release major",
+    "release:minor": "shelljs-release minor",
+    "release:patch": "shelljs-release patch"
   },
   "bin": {
     "shjs": "./bin/shjs"
   },
-  "dependencies": {},
+  "dependencies": {
+    "execa": "^1.0.0",
+    "glob": "^7.0.0",
+    "interpret": "^1.0.0",
+    "rechoir": "^0.6.2"
+  },
+  "ava": {
+    "serial": true,
+    "powerAssert": false
+  },
   "devDependencies": {
-    "jshint": "~1.1.0"
+    "ava": "^1.4.1",
+    "chalk": "^1.1.3",
+    "coffee-script": "^1.12.7",
+    "eslint": "^5.16.0",
+    "eslint-config-airbnb-base": "^13.1.0",
+    "eslint-plugin-import": "^2.17.3",
+    "js-yaml": "^3.14.1",
+    "nyc": "^14.1.1",
+    "shelljs-changelog": "^0.2.6",
+    "shelljs-release": "^0.5.2",
+    "shx": "^0.3.4",
+    "travis-check-changes": "^0.4.0"
   },
   "optionalDependencies": {},
   "engines": {
-    "node": "*"
-  },
-  "readme": "# ShellJS - Unix shell commands for Node.js [![Build Status](https://secure.travis-ci.org/arturadib/shelljs.png)](http://travis-ci.org/arturadib/shelljs)\n\nShellJS is a portable **(Windows/Linux/OS X)** implementation of Unix shell commands on top of the Node.js API. You can use it to eliminate your shell script's dependency on Unix while still keeping its familiar and powerful commands. You can also install it globally so you can run it from outside Node projects - say goodbye to those gnarly Bash scripts!\n\nThe project is [unit-tested](http://travis-ci.org/arturadib/shelljs) and battled-tested in projects like:\n\n+ [PDF.js](http://github.com/mozilla/pdf.js) - Firefox's next-gen PDF reader\n+ [Firebug](http://getfirebug.com/) - Firefox's infamous debugger\n+ [JSHint](http://jshint.com) - Most popular JavaScript linter\n+ [Zepto](http://zeptojs.com) - jQuery-compatible JavaScript library for modern browsers\n+ [Yeoman](http://yeoman.io/) - Web application stack and development tool\n+ [Deployd.com](http://deployd.com) - Open source PaaS for quick API backend generation\n\nand [many more](https://npmjs.org/browse/depended/shelljs).\n\n## Installing\n\nVia npm:\n\n```bash\n$ npm install [-g] shelljs\n```\n\nIf the global option `-g` is specified, the binary `shjs` will be installed. This makes it possible to\nrun ShellJS scripts much like any shell script from the command line, i.e. without requiring a `node_modules` folder:\n\n```bash\n$ shjs my_script\n```\n\nYou can also just copy `shell.js` into your project's directory, and `require()` accordingly.\n\n\n## Examples\n\n### JavaScript\n\n```javascript\nrequire('shelljs/global');\n\nif (!which('git')) {\n  echo('Sorry, this script requires git');\n  exit(1);\n}\n\n// Copy files to release dir\nmkdir('-p', 'out/Release');\ncp('-R', 'stuff/*', 'out/Release');\n\n// Replace macros in each .js file\ncd('lib');\nls('*.js').forEach(function(file) {\n  sed('-i', 'BUILD_VERSION', 'v0.1.2', file);\n  sed('-i', /.*REMOVE_THIS_LINE.*\\n/, '', file);\n  sed('-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat('macro.js'), file);\n});\ncd('..');\n\n// Run external tool synchronously\nif (exec('git commit -am \"Auto-commit\"').code !== 0) {\n  echo('Error: Git commit failed');\n  exit(1);\n}\n```\n\n### CoffeeScript\n\n```coffeescript\nrequire 'shelljs/global'\n\nif not which 'git'\n  echo 'Sorry, this script requires git'\n  exit 1\n\n# Copy files to release dir\nmkdir '-p', 'out/Release'\ncp '-R', 'stuff/*', 'out/Release'\n\n# Replace macros in each .js file\ncd 'lib'\nfor file in ls '*.js'\n  sed '-i', 'BUILD_VERSION', 'v0.1.2', file\n  sed '-i', /.*REMOVE_THIS_LINE.*\\n/, '', file\n  sed '-i', /.*REPLACE_LINE_WITH_MACRO.*\\n/, cat 'macro.js', file\ncd '..'\n\n# Run external tool synchronously\nif (exec 'git commit -am \"Auto-commit\"').code != 0\n  echo 'Error: Git commit failed'\n  exit 1\n```\n\n## Global vs. Local\n\nThe example above uses the convenience script `shelljs/global` to reduce verbosity. If polluting your global namespace is not desirable, simply require `shelljs`.\n\nExample:\n\n```javascript\nvar shell = require('shelljs');\nshell.echo('hello world');\n```\n\n## Make tool\n\nA convenience script `shelljs/make` is also provided to mimic the behavior of a Unix Makefile. In this case all shell objects are global, and command line arguments will cause the script to execute only the corresponding function in the global `target` object. To avoid redundant calls, target functions are executed only once per script.\n\nExample (CoffeeScript):\n\n```coffeescript\nrequire 'shelljs/make'\n\ntarget.all = ->\n  target.bundle()\n  target.docs()\n\ntarget.bundle = ->\n  cd __dirname\n  mkdir 'build'\n  cd 'lib'\n  (cat '*.js').to '../build/output.js'\n\ntarget.docs = ->\n  cd __dirname\n  mkdir 'docs'\n  cd 'lib'\n  for file in ls '*.js'\n    text = grep '//@', file     # extract special comments\n    text.replace '//@', ''      # remove comment tags\n    text.to 'docs/my_docs.md'\n```\n\nTo run the target `all`, call the above script without arguments: `$ node make`. To run the target `docs`: `$ node make docs`, and so on.\n\n\n\n<!-- \n\n  DO NOT MODIFY BEYOND THIS POINT - IT'S AUTOMATICALLY GENERATED\n\n-->\n\n\n## Command reference\n\n\nAll commands run synchronously, unless otherwise stated.\n\n\n### cd('dir')\nChanges to directory `dir` for the duration of the script\n\n### pwd()\nReturns the current directory.\n\n### ls([options ,] path [,path ...])\n### ls([options ,] path_array)\nAvailable options:\n\n+ `-R`: recursive\n+ `-A`: all files (include files beginning with `.`, except for `.` and `..`)\n\nExamples:\n\n```javascript\nls('projs/*.js');\nls('-R', '/users/me', '/tmp');\nls('-R', ['/users/me', '/tmp']); // same as above\n```\n\nReturns array of files in the given path, or in current directory if no path provided.\n\n### find(path [,path ...])\n### find(path_array)\nExamples:\n\n```javascript\nfind('src', 'lib');\nfind(['src', 'lib']); // same as above\nfind('.').filter(function(file) { return file.match(/\\.js$/); });\n```\n\nReturns array of all files (however deep) in the given paths.\n\nThe main difference from `ls('-R', path)` is that the resulting file names\ninclude the base directories, e.g. `lib/resources/file1` instead of just `file1`.\n\n### cp([options ,] source [,source ...], dest)\n### cp([options ,] source_array, dest)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\ncp('file1', 'dir1');\ncp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');\ncp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above\n```\n\nCopies files. The wildcard `*` is accepted.\n\n### rm([options ,] file [, file ...])\n### rm([options ,] file_array)\nAvailable options:\n\n+ `-f`: force\n+ `-r, -R`: recursive\n\nExamples:\n\n```javascript\nrm('-rf', '/tmp/*');\nrm('some_file.txt', 'another_file.txt');\nrm(['some_file.txt', 'another_file.txt']); // same as above\n```\n\nRemoves files. The wildcard `*` is accepted.\n\n### mv(source [, source ...], dest')\n### mv(source_array, dest')\nAvailable options:\n\n+ `f`: force\n\nExamples:\n\n```javascript\nmv('-f', 'file', 'dir/');\nmv('file1', 'file2', 'dir/');\nmv(['file1', 'file2'], 'dir/'); // same as above\n```\n\nMoves files. The wildcard `*` is accepted.\n\n### mkdir([options ,] dir [, dir ...])\n### mkdir([options ,] dir_array)\nAvailable options:\n\n+ `p`: full path (will create intermediate dirs if necessary)\n\nExamples:\n\n```javascript\nmkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');\nmkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above\n```\n\nCreates directories.\n\n### test(expression)\nAvailable expression primaries:\n\n+ `'-b', 'path'`: true if path is a block device\n+ `'-c', 'path'`: true if path is a character device\n+ `'-d', 'path'`: true if path is a directory\n+ `'-e', 'path'`: true if path exists\n+ `'-f', 'path'`: true if path is a regular file\n+ `'-L', 'path'`: true if path is a symboilc link\n+ `'-p', 'path'`: true if path is a pipe (FIFO)\n+ `'-S', 'path'`: true if path is a socket\n\nExamples:\n\n```javascript\nif (test('-d', path)) { /* do something with dir */ };\nif (!test('-f', path)) continue; // skip if it's a regular file\n```\n\nEvaluates expression using the available primaries and returns corresponding value.\n\n### cat(file [, file ...])\n### cat(file_array)\n\nExamples:\n\n```javascript\nvar str = cat('file*.txt');\nvar str = cat('file1', 'file2');\nvar str = cat(['file1', 'file2']); // same as above\n```\n\nReturns a string containing the given file, or a concatenated string\ncontaining the files if more than one file is given (a new line character is\nintroduced between each file). Wildcard `*` accepted.\n\n### 'string'.to(file)\n\nExamples:\n\n```javascript\ncat('input.txt').to('output.txt');\n```\n\nAnalogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as\nthose returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_\n\n### sed([options ,] search_regex, replace_str, file)\nAvailable options:\n\n+ `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_\n\nExamples:\n\n```javascript\nsed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');\nsed(/.*DELETE_THIS_LINE.*\\n/, '', 'source.js');\n```\n\nReads an input string from `file` and performs a JavaScript `replace()` on the input\nusing the given search regex and replacement string. Returns the new string after replacement.\n\n### grep([options ,] regex_filter, file [, file ...])\n### grep([options ,] regex_filter, file_array)\nAvailable options:\n\n+ `-v`: Inverse the sense of the regex and print the lines not matching the criteria.\n\nExamples:\n\n```javascript\ngrep('-v', 'GLOBAL_VARIABLE', '*.js');\ngrep('GLOBAL_VARIABLE', '*.js');\n```\n\nReads input string from given files and returns a string containing all lines of the\nfile that match the given `regex_filter`. Wildcard `*` accepted.\n\n### which(command)\n\nExamples:\n\n```javascript\nvar nodeExec = which('node');\n```\n\nSearches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.\nReturns string containing the absolute path to the command.\n\n### echo(string [,string ...])\n\nExamples:\n\n```javascript\necho('hello world');\nvar str = echo('hello world');\n```\n\nPrints string to stdout, and returns string with additional utility methods\nlike `.to()`.\n\n### dirs([options | '+N' | '-N'])\n\nAvailable options:\n\n+ `-c`: Clears the directory stack by deleting all of the elements.\n\nArguments:\n\n+ `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.\n+ `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.\n\nDisplay the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.\n\nSee also: pushd, popd\n\n### pushd([options,] [dir | '-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.\n+ `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n+ `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.\n\nExamples:\n\n```javascript\n// process.cwd() === '/usr'\npushd('/etc'); // Returns /etc /usr\npushd('+1');   // Returns /usr /etc\n```\n\nSave the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.\n\n### popd([options,] ['-N' | '+N'])\n\nAvailable options:\n\n+ `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.\n\nArguments:\n\n+ `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.\n+ `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.\n\nExamples:\n\n```javascript\necho(process.cwd()); // '/usr'\npushd('/etc');       // '/etc /usr'\necho(process.cwd()); // '/etc'\npopd();              // '/usr'\necho(process.cwd()); // '/usr'\n```\n\nWhen no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.\n\n### exit(code)\nExits the current process with the given exit code.\n\n### env['VAR_NAME']\nObject containing environment variables (both getter and setter). Shortcut to process.env.\n\n### exec(command [, options] [, callback])\nAvailable options (all `false` by default):\n\n+ `async`: Asynchronous execution. Defaults to true if a callback is provided.\n+ `silent`: Do not echo program output to console.\n\nExamples:\n\n```javascript\nvar version = exec('node --version', {silent:true}).output;\n\nvar child = exec('some_long_running_process', {async:true});\nchild.stdout.on('data', function(data) {\n  /* ... do something with data ... */\n});\n\nexec('some_long_running_process', function(code, output) {\n  console.log('Exit code:', code);\n  console.log('Program output:', output);\n});\n```\n\nExecutes the given `command` _synchronously_, unless otherwise specified.\nWhen in synchronous mode returns the object `{ code:..., output:... }`, containing the program's\n`output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and\nthe `callback` gets the arguments `(code, output)`.\n\n**Note:** For long-lived processes, it's best to run `exec()` asynchronously as\nthe current synchronous implementation uses a lot of CPU. This should be getting\nfixed soon.\n\n### chmod(octal_mode || octal_string, file)\n### chmod(symbolic_mode, file)\n\nAvailable options:\n\n+ `-v`: output a diagnostic for every file processed\n+ `-c`: like verbose but report only when a change is made\n+ `-R`: change files and directories recursively\n\nExamples:\n\n```javascript\nchmod(755, '/Users/brandon');\nchmod('755', '/Users/brandon'); // same as above \nchmod('u+x', '/Users/brandon');\n```\n\nAlters the permissions of a file or directory by either specifying the\nabsolute permissions in octal form or expressing the changes in symbols.\nThis command tries to mimic the POSIX behavior as much as possible.\nNotable exceptions:\n\n+ In symbolic modes, 'a-r' and '-r' are identical.  No consideration is\n  given to the umask.\n+ There is no \"quiet\" option since default behavior is to run silent.\n\n## Configuration\n\n\n### config.silent\nExample:\n\n```javascript\nvar silentState = config.silent; // save old silent state\nconfig.silent = true;\n/* ... */\nconfig.silent = silentState; // restore old silent state\n```\n\nSuppresses all command output if `true`, except for `echo()` calls.\nDefault is `false`.\n\n### config.fatal\nExample:\n\n```javascript\nconfig.fatal = true;\ncp('this_file_does_not_exist', '/dev/null'); // dies here\n/* more commands... */\n```\n\nIf `true` the script will die on errors. Default is `false`.\n\n## Non-Unix commands\n\n\n### tempdir()\nSearches and returns string containing a writeable, platform-dependent temporary directory.\nFollows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).\n\n### error()\nTests if error occurred in the last command. Returns `null` if no error occurred,\notherwise returns string explaining the error\n",
-  "readmeFilename": "README.md",
-  "bugs": {
-    "url": "https://github.com/arturadib/shelljs/issues"
-  },
-  "_id": "shelljs@0.1.4",
-  "dist": {
-    "shasum": "b1fe29c348ae710d29040cdf8d7d7926ac10b3ad"
-  },
-  "_from": "shelljs@0.1.x",
-  "_resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.1.4.tgz"
+    "node": ">=8"
+  }
 }
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/shell.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/shell.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/shell.js	(working copy)
@@ -3,1899 +3,170 @@
 // Unix shell commands on top of Node's API
 //
 // Copyright (c) 2012 Artur Adib
-// http://github.com/arturadib/shelljs
+// http://github.com/shelljs/shelljs
 //
 
-var fs = require('fs'),
-    path = require('path'),
-    util = require('util'),
-    vm = require('vm'),
-    child = require('child_process'),
-    os = require('os');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-var config = {
-  silent: false,
-  fatal: false
-};
-
-var state = {
-      error: null,
-      currentCmd: 'shell.js',
-      tempDir: null
-    },
-    platform = os.type().match(/^Win/) ? 'win' : 'unix';
-
+var common = require('./src/common');
 
 //@
 //@ All commands run synchronously, unless otherwise stated.
+//@ All commands accept standard bash globbing characters (`*`, `?`, etc.),
+//@ compatible with the [node `glob` module](https://github.com/isaacs/node-glob).
 //@
-
-
-//@
-//@ ### cd('dir')
-//@ Changes to directory `dir` for the duration of the script
-function _cd(options, dir) {
-  if (!dir)
-    error('directory not specified');
-
-  if (!fs.existsSync(dir))
-    error('no such file or directory: ' + dir);
-
-  if (!fs.statSync(dir).isDirectory())
-    error('not a directory: ' + dir);
-
-  process.chdir(dir);
-}
-exports.cd = wrap('cd', _cd);
-
-//@
-//@ ### pwd()
-//@ Returns the current directory.
-function _pwd(options) {
-  var pwd = path.resolve(process.cwd());
-  return ShellString(pwd);
-}
-exports.pwd = wrap('pwd', _pwd);
-
-
-//@
-//@ ### ls([options ,] path [,path ...])
-//@ ### ls([options ,] path_array)
-//@ Available options:
+//@ For less-commonly used commands and features, please check out our [wiki
+//@ page](https://github.com/shelljs/shelljs/wiki).
 //@
-//@ + `-R`: recursive
-//@ + `-A`: all files (include files beginning with `.`, except for `.` and `..`)
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ ls('projs/*.js');
-//@ ls('-R', '/users/me', '/tmp');
-//@ ls('-R', ['/users/me', '/tmp']); // same as above
-//@ ```
-//@
-//@ Returns array of files in the given path, or in current directory if no path provided.
-function _ls(options, paths) {
-  options = parseOptions(options, {
-    'R': 'recursive',
-    'A': 'all',
-    'a': 'all_deprecated'
-  });
-
-  if (options.all_deprecated) {
-    // We won't support the -a option as it's hard to image why it's useful
-    // (it includes '.' and '..' in addition to '.*' files)
-    // For backwards compatibility we'll dump a deprecated message and proceed as before
-    log('ls: Option -a is deprecated. Use -A instead');
-    options.all = true;
-  }
-
-  if (!paths)
-    paths = ['.'];
-  else if (typeof paths === 'object')
-    paths = paths; // assume array
-  else if (typeof paths === 'string')
-    paths = [].slice.call(arguments, 1);
-
-  var list = [];
-
-  // Conditionally pushes file to list - returns true if pushed, false otherwise
-  // (e.g. prevents hidden files to be included unless explicitly told so)
-  function pushFile(file, query) {
-    // hidden file?
-    if (path.basename(file)[0] === '.') {
-      // not explicitly asking for hidden files?
-      if (!options.all && !(path.basename(query)[0] === '.' && path.basename(query).length > 1))
-        return false;
-    }
-
-    if (platform === 'win')
-      file = file.replace(/\\/g, '/');
-
-    list.push(file);
-    return true;
-  }
-
-  paths.forEach(function(p) {
-    if (fs.existsSync(p)) {
-      var stats = fs.statSync(p);
-      // Simple file?
-      if (stats.isFile()) {
-        pushFile(p, p);
-        return; // continue
-      }
 
-      // Simple dir?
-      if (stats.isDirectory()) {
-        // Iterate over p contents
-        fs.readdirSync(p).forEach(function(file) {
-          if (!pushFile(file, p))
-            return;
-
-          // Recursive?
-          if (options.recursive) {
-            var oldDir = _pwd();
-            _cd('', p);
-            if (fs.statSync(file).isDirectory())
-              list = list.concat(_ls('-R'+(options.all?'A':''), file+'/*'));
-            _cd('', oldDir);
-          }
-        });
-        return; // continue
-      }
-    }
-
-    // p does not exist - possible wildcard present
-
-    var basename = path.basename(p);
-    var dirname = path.dirname(p);
-    // Wildcard present on an existing dir? (e.g. '/tmp/*.js')
-    if (basename.search(/\*/) > -1 && fs.existsSync(dirname) && fs.statSync(dirname).isDirectory) {
-      // Escape special regular expression chars
-      var regexp = basename.replace(/(\^|\$|\(|\)|<|>|\[|\]|\{|\}|\.|\+|\?)/g, '\\$1');
-      // Translates wildcard into regex
-      regexp = '^' + regexp.replace(/\*/g, '.*') + '$';
-      // Iterate over directory contents
-      fs.readdirSync(dirname).forEach(function(file) {
-        if (file.match(new RegExp(regexp))) {
-          if (!pushFile(path.normalize(dirname+'/'+file), basename))
-            return;
-
-          // Recursive?
-          if (options.recursive) {
-            var pp = dirname + '/' + file;
-            if (fs.lstatSync(pp).isDirectory())
-              list = list.concat(_ls('-R'+(options.all?'A':''), pp+'/*'));
-          } // recursive
-        } // if file matches
-      }); // forEach
-      return;
-    }
-
-    error('no such file or directory: ' + p, true);
-  });
-
-  return list;
-}
-exports.ls = wrap('ls', _ls);
-
-
-//@
-//@ ### find(path [,path ...])
-//@ ### find(path_array)
-//@ Examples:
-//@
-//@ ```javascript
-//@ find('src', 'lib');
-//@ find(['src', 'lib']); // same as above
-//@ find('.').filter(function(file) { return file.match(/\.js$/); });
-//@ ```
-//@
-//@ Returns array of all files (however deep) in the given paths.
-//@
-//@ The main difference from `ls('-R', path)` is that the resulting file names
-//@ include the base directories, e.g. `lib/resources/file1` instead of just `file1`.
-function _find(options, paths) {
-  if (!paths)
-    error('no path specified');
-  else if (typeof paths === 'object')
-    paths = paths; // assume array
-  else if (typeof paths === 'string')
-    paths = [].slice.call(arguments, 1);
-
-  var list = [];
-
-  function pushFile(file) {
-    if (platform === 'win')
-      file = file.replace(/\\/g, '/');
-    list.push(file);
-  }
-
-  // why not simply do ls('-R', paths)? because the output wouldn't give the base dirs
-  // to get the base dir in the output, we need instead ls('-R', 'dir/*') for every directory
-
-  paths.forEach(function(file) {
-    pushFile(file);
-
-    if (fs.statSync(file).isDirectory()) {
-      _ls('-RA', file+'/*').forEach(function(subfile) {
-        pushFile(subfile);
-      });
-    }
-  });
-
-  return list;
-}
-exports.find = wrap('find', _find);
+// Include the docs for all the default commands
+//@commands
 
+// Load all default commands
+require('./commands').forEach(function (command) {
+  require('./src/' + command);
+});
 
 //@
-//@ ### cp([options ,] source [,source ...], dest)
-//@ ### cp([options ,] source_array, dest)
-//@ Available options:
-//@
-//@ + `-f`: force
-//@ + `-r, -R`: recursive
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ cp('file1', 'dir1');
-//@ cp('-Rf', '/tmp/*', '/usr/local/*', '/home/tmp');
-//@ cp('-Rf', ['/tmp/*', '/usr/local/*'], '/home/tmp'); // same as above
-//@ ```
+//@ ### exit(code)
 //@
-//@ Copies files. The wildcard `*` is accepted.
-function _cp(options, sources, dest) {
-  options = parseOptions(options, {
-    'f': 'force',
-    'R': 'recursive',
-    'r': 'recursive'
-  });
-
-  // Get sources, dest
-  if (arguments.length < 3) {
-    error('missing <source> and/or <dest>');
-  } else if (arguments.length > 3) {
-    sources = [].slice.call(arguments, 1, arguments.length - 1);
-    dest = arguments[arguments.length - 1];
-  } else if (typeof sources === 'string') {
-    sources = [sources];
-  } else if ('length' in sources) {
-    sources = sources; // no-op for array
-  } else {
-    error('invalid arguments');
-  }
-
-  var exists = fs.existsSync(dest),
-      stats = exists && fs.statSync(dest);
-
-  // Dest is not existing dir, but multiple sources given
-  if ((!exists || !stats.isDirectory()) && sources.length > 1)
-    error('dest is not a directory (too many sources)');
-
-  // Dest is an existing file, but no -f given
-  if (exists && stats.isFile() && !options.force)
-    error('dest file already exists: ' + dest);
-
-  if (options.recursive) {
-    // Recursive allows the shortcut syntax "sourcedir/" for "sourcedir/*"
-    // (see Github issue #15)
-    sources.forEach(function(src, i) {
-      if (src[src.length - 1] === '/')
-        sources[i] += '*';
+//@ Exits the current process with the given exit `code`.
+exports.exit = function exit(code) {
+  if (code) {
+    common.error('exit', {
+      continue: true,
+      code: code,
+      prefix: '',
+      silent: true,
+      fatal: false,
     });
-
-    // Create dest
-    try {
-      fs.mkdirSync(dest, parseInt('0777', 8));
-    } catch (e) {
-      // like Unix's cp, keep going even if we can't create dest dir
-    }
-  }
-
-  sources = expand(sources);
-
-  sources.forEach(function(src) {
-    if (!fs.existsSync(src)) {
-      error('no such file or directory: '+src, true);
-      return; // skip file
-    }
-
-    // If here, src exists
-    if (fs.statSync(src).isDirectory()) {
-      if (!options.recursive) {
-        // Non-Recursive
-        log(src + ' is a directory (not copied)');
-      } else {
-        // Recursive
-        // 'cp /a/source dest' should create 'source' in 'dest'
-        var newDest = path.join(dest, path.basename(src)),
-            checkDir = fs.statSync(src);
-        try {
-          fs.mkdirSync(newDest, checkDir.mode);
-        } catch (e) {
-          //if the directory already exists, that's okay
-          if (e.code !== 'EEXIST') throw e;
-        }
-
-        cpdirSyncRecursive(src, newDest, {force: options.force});
-      }
-      return; // done with dir
-    }
-
-    // If here, src is a file
-
-    // When copying to '/path/dir':
-    //    thisDest = '/path/dir/file1'
-    var thisDest = dest;
-    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
-      thisDest = path.normalize(dest + '/' + path.basename(src));
-
-    if (fs.existsSync(thisDest) && !options.force) {
-      error('dest file already exists: ' + thisDest, true);
-      return; // skip file
-    }
-
-    copyFileSync(src, thisDest);
-  }); // forEach(src)
-}
-exports.cp = wrap('cp', _cp);
-
-//@
-//@ ### rm([options ,] file [, file ...])
-//@ ### rm([options ,] file_array)
-//@ Available options:
-//@
-//@ + `-f`: force
-//@ + `-r, -R`: recursive
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ rm('-rf', '/tmp/*');
-//@ rm('some_file.txt', 'another_file.txt');
-//@ rm(['some_file.txt', 'another_file.txt']); // same as above
-//@ ```
-//@
-//@ Removes files. The wildcard `*` is accepted.
-function _rm(options, files) {
-  options = parseOptions(options, {
-    'f': 'force',
-    'r': 'recursive',
-    'R': 'recursive'
-  });
-  if (!files)
-    error('no paths given');
-
-  if (typeof files === 'string')
-    files = [].slice.call(arguments, 1);
-  // if it's array leave it as it is
-
-  files = expand(files);
-
-  files.forEach(function(file) {
-    if (!fs.existsSync(file)) {
-      // Path does not exist, no force flag given
-      if (!options.force)
-        error('no such file or directory: '+file, true);
-
-      return; // skip file
-    }
-
-    // If here, path exists
-
-    var stats = fs.statSync(file);
-    // Remove simple file
-    if (stats.isFile()) {
-
-      // Do not check for file writing permissions
-      if (options.force) {
-        _unlinkSync(file);
-        return;
-      }
-
-      if (isWriteable(file))
-        _unlinkSync(file);
-      else
-        error('permission denied: '+file, true);
-
-      return;
-    } // simple file
-
-    // Path is an existing directory, but no -r flag given
-    if (stats.isDirectory() && !options.recursive) {
-      error('path is a directory', true);
-      return; // skip path
-    }
-
-    // Recursively remove existing directory
-    if (stats.isDirectory() && options.recursive) {
-      rmdirSyncRecursive(file, options.force);
-    }
-  }); // forEach(file)
-} // rm
-exports.rm = wrap('rm', _rm);
-
-//@
-//@ ### mv(source [, source ...], dest')
-//@ ### mv(source_array, dest')
-//@ Available options:
-//@
-//@ + `f`: force
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ mv('-f', 'file', 'dir/');
-//@ mv('file1', 'file2', 'dir/');
-//@ mv(['file1', 'file2'], 'dir/'); // same as above
-//@ ```
-//@
-//@ Moves files. The wildcard `*` is accepted.
-function _mv(options, sources, dest) {
-  options = parseOptions(options, {
-    'f': 'force'
-  });
-
-  // Get sources, dest
-  if (arguments.length < 3) {
-    error('missing <source> and/or <dest>');
-  } else if (arguments.length > 3) {
-    sources = [].slice.call(arguments, 1, arguments.length - 1);
-    dest = arguments[arguments.length - 1];
-  } else if (typeof sources === 'string') {
-    sources = [sources];
-  } else if ('length' in sources) {
-    sources = sources; // no-op for array
+    process.exit(code);
   } else {
-    error('invalid arguments');
+    process.exit();
   }
+};
 
-  sources = expand(sources);
-
-  var exists = fs.existsSync(dest),
-      stats = exists && fs.statSync(dest);
-
-  // Dest is not existing dir, but multiple sources given
-  if ((!exists || !stats.isDirectory()) && sources.length > 1)
-    error('dest is not a directory (too many sources)');
-
-  // Dest is an existing file, but no -f given
-  if (exists && stats.isFile() && !options.force)
-    error('dest file already exists: ' + dest);
-
-  sources.forEach(function(src) {
-    if (!fs.existsSync(src)) {
-      error('no such file or directory: '+src, true);
-      return; // skip file
-    }
-
-    // If here, src exists
-
-    // When copying to '/path/dir':
-    //    thisDest = '/path/dir/file1'
-    var thisDest = dest;
-    if (fs.existsSync(dest) && fs.statSync(dest).isDirectory())
-      thisDest = path.normalize(dest + '/' + path.basename(src));
-
-    if (fs.existsSync(thisDest) && !options.force) {
-      error('dest file already exists: ' + thisDest, true);
-      return; // skip file
-    }
-
-    if (path.resolve(src) === path.dirname(path.resolve(thisDest))) {
-      error('cannot move to self: '+src, true);
-      return; // skip file
-    }
-
-    fs.renameSync(src, thisDest);
-  }); // forEach(src)
-} // mv
-exports.mv = wrap('mv', _mv);
-
-//@
-//@ ### mkdir([options ,] dir [, dir ...])
-//@ ### mkdir([options ,] dir_array)
-//@ Available options:
-//@
-//@ + `p`: full path (will create intermediate dirs if necessary)
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ mkdir('-p', '/tmp/a/b/c/d', '/tmp/e/f/g');
-//@ mkdir('-p', ['/tmp/a/b/c/d', '/tmp/e/f/g']); // same as above
-//@ ```
-//@
-//@ Creates directories.
-function _mkdir(options, dirs) {
-  options = parseOptions(options, {
-    'p': 'fullpath'
-  });
-  if (!dirs)
-    error('no paths given');
-
-  if (typeof dirs === 'string')
-    dirs = [].slice.call(arguments, 1);
-  // if it's array leave it as it is
-
-  dirs.forEach(function(dir) {
-    if (fs.existsSync(dir)) {
-      if (!options.fullpath)
-          error('path already exists: ' + dir, true);
-      return; // skip dir
-    }
-
-    // Base dir does not exist, and no -p option given
-    var baseDir = path.dirname(dir);
-    if (!fs.existsSync(baseDir) && !options.fullpath) {
-      error('no such file or directory: ' + baseDir, true);
-      return; // skip dir
-    }
-
-    if (options.fullpath)
-      mkdirSyncRecursive(dir);
-    else
-      fs.mkdirSync(dir, parseInt('0777', 8));
-  });
-} // mkdir
-exports.mkdir = wrap('mkdir', _mkdir);
-
-//@
-//@ ### test(expression)
-//@ Available expression primaries:
-//@
-//@ + `'-b', 'path'`: true if path is a block device
-//@ + `'-c', 'path'`: true if path is a character device
-//@ + `'-d', 'path'`: true if path is a directory
-//@ + `'-e', 'path'`: true if path exists
-//@ + `'-f', 'path'`: true if path is a regular file
-//@ + `'-L', 'path'`: true if path is a symboilc link
-//@ + `'-p', 'path'`: true if path is a pipe (FIFO)
-//@ + `'-S', 'path'`: true if path is a socket
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ if (test('-d', path)) { /* do something with dir */ };
-//@ if (!test('-f', path)) continue; // skip if it's a regular file
-//@ ```
-//@
-//@ Evaluates expression using the available primaries and returns corresponding value.
-function _test(options, path) {
-  if (!path)
-    error('no path given');
-
-  // hack - only works with unary primaries
-  options = parseOptions(options, {
-    'b': 'block',
-    'c': 'character',
-    'd': 'directory',
-    'e': 'exists',
-    'f': 'file',
-    'L': 'link',
-    'p': 'pipe',
-    'S': 'socket'
-  });
-
-  var canInterpret = false;
-  for (var key in options)
-    if (options[key] === true) {
-      canInterpret = true;
-      break;
-    }
-
-  if (!canInterpret)
-    error('could not interpret expression');
-
-  if (options.link) {
-    try {
-      return fs.lstatSync(path).isSymbolicLink();
-    } catch(e) {
-      return false;
-    }
-  }
-
-  if (!fs.existsSync(path))
-    return false;
-
-  if (options.exists)
-    return true;
-
-  var stats = fs.statSync(path);
-
-  if (options.block)
-    return stats.isBlockDevice();
-
-  if (options.character)
-    return stats.isCharacterDevice();
-
-  if (options.directory)
-    return stats.isDirectory();
-
-  if (options.file)
-    return stats.isFile();
-
-  if (options.pipe)
-    return stats.isFIFO();
-
-  if (options.socket)
-    return stats.isSocket();
-} // test
-exports.test = wrap('test', _test);
-
-
-//@
-//@ ### cat(file [, file ...])
-//@ ### cat(file_array)
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ var str = cat('file*.txt');
-//@ var str = cat('file1', 'file2');
-//@ var str = cat(['file1', 'file2']); // same as above
-//@ ```
-//@
-//@ Returns a string containing the given file, or a concatenated string
-//@ containing the files if more than one file is given (a new line character is
-//@ introduced between each file). Wildcard `*` accepted.
-function _cat(options, files) {
-  var cat = '';
-
-  if (!files)
-    error('no paths given');
-
-  if (typeof files === 'string')
-    files = [].slice.call(arguments, 1);
-  // if it's array leave it as it is
-
-  files = expand(files);
-
-  files.forEach(function(file) {
-    if (!fs.existsSync(file))
-      error('no such file or directory: ' + file);
-
-    cat += fs.readFileSync(file, 'utf8') + '\n';
-  });
+//@include ./src/error.js
+exports.error = require('./src/error');
 
-  if (cat[cat.length-1] === '\n')
-    cat = cat.substring(0, cat.length-1);
+//@include ./src/errorCode.js
+exports.errorCode = require('./src/errorCode');
 
-  return ShellString(cat);
-}
-exports.cat = wrap('cat', _cat);
+//@include ./src/common.js
+exports.ShellString = common.ShellString;
 
 //@
-//@ ### 'string'.to(file)
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ cat('input.txt').to('output.txt');
-//@ ```
+//@ ### env['VAR_NAME']
 //@
-//@ Analogous to the redirection operator `>` in Unix, but works with JavaScript strings (such as
-//@ those returned by `cat`, `grep`, etc). _Like Unix redirections, `to()` will overwrite any existing file!_
-function _to(options, file) {
-  if (!file)
-    error('wrong arguments');
-
-  if (!fs.existsSync( path.dirname(file) ))
-      error('no such file or directory: ' + path.dirname(file));
-
-  try {
-    fs.writeFileSync(file, this.toString(), 'utf8');
-  } catch(e) {
-    error('could not write to file (code '+e.code+'): '+file, true);
-  }
-}
-// In the future, when Proxies are default, we can add methods like `.to()` to primitive strings.
-// For now, this is a dummy function to bookmark places we need such strings
-function ShellString(str) {
-  return str;
-}
-String.prototype.to = wrap('to', _to);
+//@ Object containing environment variables (both getter and setter). Shortcut
+//@ to `process.env`.
+exports.env = process.env;
 
 //@
-//@ ### sed([options ,] search_regex, replace_str, file)
-//@ Available options:
-//@
-//@ + `-i`: Replace contents of 'file' in-place. _Note that no backups will be created!_
+//@ ### Pipes
 //@
 //@ Examples:
 //@
 //@ ```javascript
-//@ sed('-i', 'PROGRAM_VERSION', 'v0.1.3', 'source.js');
-//@ sed(/.*DELETE_THIS_LINE.*\n/, '', 'source.js');
+//@ grep('foo', 'file1.txt', 'file2.txt').sed(/o/g, 'a').to('output.txt');
+//@ echo('files with o\'s in the name:\n' + ls().grep('o'));
+//@ cat('test.js').exec('node'); // pipe to exec() call
 //@ ```
 //@
-//@ Reads an input string from `file` and performs a JavaScript `replace()` on the input
-//@ using the given search regex and replacement string. Returns the new string after replacement.
-function _sed(options, regex, replacement, file) {
-  options = parseOptions(options, {
-    'i': 'inplace'
-  });
-
-  if (typeof replacement === 'string')
-    replacement = replacement; // no-op
-  else if (typeof replacement === 'number')
-    replacement = replacement.toString(); // fallback
-  else
-    error('invalid replacement string');
-
-  if (!file)
-    error('no file given');
+//@ Commands can send their output to another command in a pipe-like fashion.
+//@ `sed`, `grep`, `cat`, `exec`, `to`, and `toEnd` can appear on the right-hand
+//@ side of a pipe. Pipes can be chained.
 
-  if (!fs.existsSync(file))
-    error('no such file or directory: ' + file);
-
-  var result = fs.readFileSync(file, 'utf8').replace(regex, replacement);
-  if (options.inplace)
-    fs.writeFileSync(file, result, 'utf8');
-
-  return ShellString(result);
-}
-exports.sed = wrap('sed', _sed);
-
-//@
-//@ ### grep([options ,] regex_filter, file [, file ...])
-//@ ### grep([options ,] regex_filter, file_array)
-//@ Available options:
 //@
-//@ + `-v`: Inverse the sense of the regex and print the lines not matching the criteria.
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ grep('-v', 'GLOBAL_VARIABLE', '*.js');
-//@ grep('GLOBAL_VARIABLE', '*.js');
-//@ ```
+//@ ## Configuration
 //@
-//@ Reads input string from given files and returns a string containing all lines of the
-//@ file that match the given `regex_filter`. Wildcard `*` accepted.
-function _grep(options, regex, files) {
-  options = parseOptions(options, {
-    'v': 'inverse'
-  });
-
-  if (!files)
-    error('no paths given');
-
-  if (typeof files === 'string')
-    files = [].slice.call(arguments, 2);
-  // if it's array leave it as it is
-
-  files = expand(files);
-
-  var grep = '';
-  files.forEach(function(file) {
-    if (!fs.existsSync(file)) {
-      error('no such file or directory: ' + file, true);
-      return;
-    }
-
-    var contents = fs.readFileSync(file, 'utf8'),
-        lines = contents.split(/\r*\n/);
-    lines.forEach(function(line) {
-      var matched = line.match(regex);
-      if ((options.inverse && !matched) || (!options.inverse && matched))
-        grep += line + '\n';
-    });
-  });
-
-  return ShellString(grep);
-}
-exports.grep = wrap('grep', _grep);
 
+exports.config = common.config;
 
 //@
-//@ ### which(command)
+//@ ### config.silent
 //@
-//@ Examples:
+//@ Example:
 //@
 //@ ```javascript
-//@ var nodeExec = which('node');
+//@ var sh = require('shelljs');
+//@ var silentState = sh.config.silent; // save old silent state
+//@ sh.config.silent = true;
+//@ /* ... */
+//@ sh.config.silent = silentState; // restore old silent state
 //@ ```
 //@
-//@ Searches for `command` in the system's PATH. On Windows looks for `.exe`, `.cmd`, and `.bat` extensions.
-//@ Returns string containing the absolute path to the command.
-function _which(options, cmd) {
-  if (!cmd)
-    error('must specify command');
-
-  var pathEnv = process.env.path || process.env.Path || process.env.PATH,
-      pathArray = splitPath(pathEnv),
-      where = null;
-
-  // No relative/absolute paths provided?
-  if (cmd.search(/\//) === -1) {
-    // Search for command in PATH
-    pathArray.forEach(function(dir) {
-      if (where)
-        return; // already found it
-
-      var attempt = path.resolve(dir + '/' + cmd);
-      if (fs.existsSync(attempt)) {
-        where = attempt;
-        return;
-      }
-
-      if (platform === 'win') {
-        var baseAttempt = attempt;
-        attempt = baseAttempt + '.exe';
-        if (fs.existsSync(attempt)) {
-          where = attempt;
-          return;
-        }
-        attempt = baseAttempt + '.cmd';
-        if (fs.existsSync(attempt)) {
-          where = attempt;
-          return;
-        }
-        attempt = baseAttempt + '.bat';
-        if (fs.existsSync(attempt)) {
-          where = attempt;
-          return;
-        }
-      } // if 'win'
-    });
-  }
-
-  // Command not found anywhere?
-  if (!fs.existsSync(cmd) && !where)
-    return null;
-
-  where = where || path.resolve(cmd);
-
-  return ShellString(where);
-}
-exports.which = wrap('which', _which);
+//@ Suppresses all command output if `true`, except for `echo()` calls.
+//@ Default is `false`.
 
 //@
-//@ ### echo(string [,string ...])
+//@ ### config.fatal
 //@
-//@ Examples:
+//@ Example:
 //@
 //@ ```javascript
-//@ echo('hello world');
-//@ var str = echo('hello world');
+//@ require('shelljs/global');
+//@ config.fatal = true; // or set('-e');
+//@ cp('this_file_does_not_exist', '/dev/null'); // throws Error here
+//@ /* more commands... */
 //@ ```
 //@
-//@ Prints string to stdout, and returns string with additional utility methods
-//@ like `.to()`.
-function _echo() {
-  var messages = [].slice.call(arguments, 0);
-  console.log.apply(this, messages);
-  return ShellString(messages.join(' '));
-}
-exports.echo = _echo; // don't wrap() as it could parse '-options'
-
-// Pushd/popd/dirs internals
-var _dirStack = [];
-
-function _isStackIndex(index) {
-  return (/^[\-+]\d+$/).test(index);
-}
-
-function _parseStackIndex(index) {
-  if (_isStackIndex(index)) {
-    if (Math.abs(index) < _dirStack.length + 1) { // +1 for pwd
-      return (/^-/).test(index) ? Number(index) - 1 : Number(index);
-    } else {
-      error(index + ': directory stack index out of range');
-    }
-  } else {
-    error(index + ': invalid number');
-  }
-}
-
-function _actualDirStack() {
-  return [process.cwd()].concat(_dirStack);
-}
-
-//@
-//@ ### dirs([options | '+N' | '-N'])
-//@
-//@ Available options:
-//@
-//@ + `-c`: Clears the directory stack by deleting all of the elements.
-//@
-//@ Arguments:
-//@
-//@ + `+N`: Displays the Nth directory (counting from the left of the list printed by dirs when invoked without options), starting with zero.
-//@ + `-N`: Displays the Nth directory (counting from the right of the list printed by dirs when invoked without options), starting with zero.
-//@
-//@ Display the list of currently remembered directories. Returns an array of paths in the stack, or a single path if +N or -N was specified.
-//@
-//@ See also: pushd, popd
-function _dirs(options, index) {
-  if (_isStackIndex(options)) {
-    index = options;
-    options = '';
-  }
-
-  options = parseOptions(options, {
-    'c' : 'clear'
-  });
-
-  if (options['clear']) {
-    _dirStack = [];
-    return _dirStack;
-  }
-
-  var stack = _actualDirStack();
-
-  if (index) {
-    index = _parseStackIndex(index);
-
-    if (index < 0) {
-      index = stack.length + index;
-    }
-
-    log(stack[index]);
-    return stack[index];
-  }
-
-  log(stack.join(' '));
+//@ If `true`, the script will throw a Javascript error when any shell.js
+//@ command encounters an error. Default is `false`. This is analogous to
+//@ Bash's `set -e`.
 
-  return stack;
-}
-exports.dirs = wrap("dirs", _dirs);
-
-//@
-//@ ### pushd([options,] [dir | '-N' | '+N'])
-//@
-//@ Available options:
-//@
-//@ + `-n`: Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated.
 //@
-//@ Arguments:
+//@ ### config.verbose
 //@
-//@ + `dir`: Makes the current working directory be the top of the stack, and then executes the equivalent of `cd dir`.
-//@ + `+N`: Brings the Nth directory (counting from the left of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
-//@ + `-N`: Brings the Nth directory (counting from the right of the list printed by dirs, starting with zero) to the top of the list by rotating the stack.
-//@
-//@ Examples:
+//@ Example:
 //@
 //@ ```javascript
-//@ // process.cwd() === '/usr'
-//@ pushd('/etc'); // Returns /etc /usr
-//@ pushd('+1');   // Returns /usr /etc
+//@ config.verbose = true; // or set('-v');
+//@ cd('dir/');
+//@ rm('-rf', 'foo.txt', 'bar.txt');
+//@ exec('echo hello');
 //@ ```
 //@
-//@ Save the current directory on the top of the directory stack and then cd to `dir`. With no arguments, pushd exchanges the top two directories. Returns an array of paths in the stack.
-function _pushd(options, dir) {
-  if (_isStackIndex(options)) {
-    dir = options;
-    options = '';
-  }
-
-  options = parseOptions(options, {
-    'n' : 'no-cd'
-  });
-
-  var dirs = _actualDirStack();
-
-  if (dir === '+0') {
-    return dirs; // +0 is a noop
-  } else if (!dir) {
-    if (dirs.length > 1) {
-      dirs = dirs.splice(1, 1).concat(dirs);
-    } else {
-      return error('no other directory');
-    }
-  } else if (_isStackIndex(dir)) {
-    var n = _parseStackIndex(dir);
-    dirs = dirs.slice(n).concat(dirs.slice(0, n));
-  } else {
-    if (options['no-cd']) {
-      dirs.splice(1, 0, dir);
-    } else {
-      dirs.unshift(dir);
-    }
-  }
-
-  if (options['no-cd']) {
-    dirs = dirs.slice(1);
-  } else {
-    dir = path.resolve(dirs.shift());
-    _cd('', dir);
-  }
-
-  _dirStack = dirs;
-  return _dirs('');
-}
-exports.pushd = wrap('pushd', _pushd);
-
-//@
-//@ ### popd([options,] ['-N' | '+N'])
-//@
-//@ Available options:
+//@ Will print each command as follows:
 //@
-//@ + `-n`: Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated.
-//@
-//@ Arguments:
-//@
-//@ + `+N`: Removes the Nth directory (counting from the left of the list printed by dirs), starting with zero.
-//@ + `-N`: Removes the Nth directory (counting from the right of the list printed by dirs), starting with zero.
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ echo(process.cwd()); // '/usr'
-//@ pushd('/etc');       // '/etc /usr'
-//@ echo(process.cwd()); // '/etc'
-//@ popd();              // '/usr'
-//@ echo(process.cwd()); // '/usr'
 //@ ```
-//@
-//@ When no arguments are given, popd removes the top directory from the stack and performs a cd to the new top directory. The elements are numbered from 0 starting at the first directory listed with dirs; i.e., popd is equivalent to popd +0. Returns an array of paths in the stack.
-function _popd(options, index) {
-  if (_isStackIndex(options)) {
-    index = options;
-    options = '';
-  }
-
-  options = parseOptions(options, {
-    'n' : 'no-cd'
-  });
-
-  if (!_dirStack.length) {
-    return error('directory stack empty');
-  }
-
-  index = _parseStackIndex(index || '+0');
-
-  if (options['no-cd'] || index > 0 || _dirStack.length + index === 0) {
-    index = index > 0 ? index - 1 : index;
-    _dirStack.splice(index, 1);
-  } else {
-    var dir = path.resolve(_dirStack.shift());
-    _cd('', dir);
-  }
-
-  return _dirs('');
-}
-exports.popd = wrap("popd", _popd);
-
-//@
-//@ ### exit(code)
-//@ Exits the current process with the given exit code.
-exports.exit = process.exit;
-
-//@
-//@ ### env['VAR_NAME']
-//@ Object containing environment variables (both getter and setter). Shortcut to process.env.
-exports.env = process.env;
-
-//@
-//@ ### exec(command [, options] [, callback])
-//@ Available options (all `false` by default):
-//@
-//@ + `async`: Asynchronous execution. Defaults to true if a callback is provided.
-//@ + `silent`: Do not echo program output to console.
-//@
-//@ Examples:
-//@
-//@ ```javascript
-//@ var version = exec('node --version', {silent:true}).output;
-//@
-//@ var child = exec('some_long_running_process', {async:true});
-//@ child.stdout.on('data', function(data) {
-//@   /* ... do something with data ... */
-//@ });
-//@
-//@ exec('some_long_running_process', function(code, output) {
-//@   console.log('Exit code:', code);
-//@   console.log('Program output:', output);
-//@ });
+//@ cd dir/
+//@ rm -rf foo.txt bar.txt
+//@ exec echo hello
 //@ ```
-//@
-//@ Executes the given `command` _synchronously_, unless otherwise specified.
-//@ When in synchronous mode returns the object `{ code:..., output:... }`, containing the program's
-//@ `output` (stdout + stderr)  and its exit `code`. Otherwise returns the child process object, and
-//@ the `callback` gets the arguments `(code, output)`.
-//@
-//@ **Note:** For long-lived processes, it's best to run `exec()` asynchronously as
-//@ the current synchronous implementation uses a lot of CPU. This should be getting
-//@ fixed soon.
-function _exec(command, options, callback) {
-  if (!command)
-    error('must specify command');
-
-  // Callback is defined instead of options.
-  if (typeof options === 'function') {
-    callback = options;
-    options = { async: true };
-  }
-
-  // Callback is defined with options.
-  if (typeof options === 'object' && typeof callback === 'function') {
-    options.async = true;
-  }
-
-  options = extend({
-    silent: config.silent,
-    async: false
-  }, options);
-
-  if (options.async)
-    return execAsync(command, options, callback);
-  else
-    return execSync(command, options);
-}
-exports.exec = wrap('exec', _exec, {notUnix:true});
-
-var PERMS = (function (base) {
-  return {
-    OTHER_EXEC  : base.EXEC,
-    OTHER_WRITE : base.WRITE,
-    OTHER_READ  : base.READ,
-
-    GROUP_EXEC  : base.EXEC  << 3,
-    GROUP_WRITE : base.WRITE << 3,
-    GROUP_READ  : base.READ << 3,
-
-    OWNER_EXEC  : base.EXEC << 6,
-    OWNER_WRITE : base.WRITE << 6,
-    OWNER_READ  : base.READ << 6,
-
-    // Literal octal numbers are apparently not allowed in "strict" javascript.  Using parseInt is
-    // the preferred way, else a jshint warning is thrown.
-    STICKY      : parseInt('01000', 8),
-    SETGID      : parseInt('02000', 8),
-    SETUID      : parseInt('04000', 8),
-
-    TYPE_MASK   : parseInt('0770000', 8)
-  };
-})({
-  EXEC  : 1,
-  WRITE : 2,
-  READ  : 4
-});
-
 
 //@
-//@ ### chmod(octal_mode || octal_string, file)
-//@ ### chmod(symbolic_mode, file)
+//@ ### config.globOptions
 //@
-//@ Available options:
-//@
-//@ + `-v`: output a diagnostic for every file processed//@
-//@ + `-c`: like verbose but report only when a change is made//@
-//@ + `-R`: change files and directories recursively//@
-//@
-//@ Examples:
+//@ Example:
 //@
 //@ ```javascript
-//@ chmod(755, '/Users/brandon');
-//@ chmod('755', '/Users/brandon'); // same as above
-//@ chmod('u+x', '/Users/brandon');
+//@ config.globOptions = {nodir: true};
 //@ ```
 //@
-//@ Alters the permissions of a file or directory by either specifying the
-//@ absolute permissions in octal form or expressing the changes in symbols.
-//@ This command tries to mimic the POSIX behavior as much as possible.
-//@ Notable exceptions:
-//@
-//@ + In symbolic modes, 'a-r' and '-r' are identical.  No consideration is
-//@   given to the umask.
-//@ + There is no "quiet" option since default behavior is to run silent.
-function _chmod(options, mode, filePattern) {
-  if (!filePattern) {
-    if (options.length > 0 && options.charAt(0) === '-') {
-      // Special case where the specified file permissions started with - to subtract perms, which
-      // get picked up by the option parser as command flags.
-      // If we are down by one argument and options starts with -, shift everything over.
-      filePattern = mode;
-      mode = options;
-      options = '';
-    }
-    else {
-      error('You must specify a file.');
-    }
-  }
-
-  options = parseOptions(options, {
-    'R': 'recursive',
-    'c': 'changes',
-    'v': 'verbose'
-  });
-
-  if (typeof filePattern === 'string') {
-    filePattern = [ filePattern ];
-  }
-
-  var files;
-
-  if (options.recursive) {
-    files = [];
-    expand(filePattern).forEach(function addFile(expandedFile) {
-      var stat = fs.lstatSync(expandedFile);
-
-      if (!stat.isSymbolicLink()) {
-        files.push(expandedFile);
-
-        if (stat.isDirectory()) {  // intentionally does not follow symlinks.
-          fs.readdirSync(expandedFile).forEach(function (child) {
-            addFile(expandedFile + '/' + child);
-          });
-        }
-      }
-    });
-  }
-  else {
-    files = expand(filePattern);
-  }
-
-  files.forEach(function innerChmod(file) {
-    file = path.resolve(file);
-    if (!fs.existsSync(file)) {
-      error('File not found: ' + file);
-    }
-
-    // When recursing, don't follow symlinks.
-    if (options.recursive && fs.lstatSync(file).isSymbolicLink()) {
-      return;
-    }
-
-    var perms = fs.statSync(file).mode;
-    var type = perms & PERMS.TYPE_MASK;
-
-    var newPerms = perms;
-
-    if (isNaN(parseInt(mode, 8))) {
-      // parse options
-      mode.split(',').forEach(function (symbolicMode) {
-        /*jshint regexdash:true */
-        var pattern = /([ugoa]*)([=\+-])([rwxXst]*)/i;
-        var matches = pattern.exec(symbolicMode);
-
-        if (matches) {
-          var applyTo = matches[1];
-          var operator = matches[2];
-          var change = matches[3];
-
-          var changeOwner = applyTo.indexOf('u') != -1 || applyTo === 'a' || applyTo === '';
-          var changeGroup = applyTo.indexOf('g') != -1 || applyTo === 'a' || applyTo === '';
-          var changeOther = applyTo.indexOf('o') != -1 || applyTo === 'a' || applyTo === '';
-
-          var changeRead   = change.indexOf('r') != -1;
-          var changeWrite  = change.indexOf('w') != -1;
-          var changeExec   = change.indexOf('x') != -1;
-          var changeSticky = change.indexOf('t') != -1;
-          var changeSetuid = change.indexOf('s') != -1;
-
-          var mask = 0;
-          if (changeOwner) {
-            mask |= (changeRead ? PERMS.OWNER_READ : 0) + (changeWrite ? PERMS.OWNER_WRITE : 0) + (changeExec ? PERMS.OWNER_EXEC : 0) + (changeSetuid ? PERMS.SETUID : 0);
-          }
-          if (changeGroup) {
-            mask |= (changeRead ? PERMS.GROUP_READ : 0) + (changeWrite ? PERMS.GROUP_WRITE : 0) + (changeExec ? PERMS.GROUP_EXEC : 0) + (changeSetuid ? PERMS.SETGID : 0);
-          }
-          if (changeOther) {
-            mask |= (changeRead ? PERMS.OTHER_READ : 0) + (changeWrite ? PERMS.OTHER_WRITE : 0) + (changeExec ? PERMS.OTHER_EXEC : 0);
-          }
-
-          // Sticky bit is special - it's not tied to user, group or other.
-          if (changeSticky) {
-            mask |= PERMS.STICKY;
-          }
-
-          switch (operator) {
-            case '+':
-              newPerms |= mask;
-              break;
-
-            case '-':
-              newPerms &= ~mask;
-              break;
-
-            case '=':
-              newPerms = type + mask;
-
-              // According to POSIX, when using = to explicitly set the permissions, setuid and setgid can never be cleared.
-              if (fs.statSync(file).isDirectory()) {
-                newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
-              }
-              break;
-          }
-
-          if (options.verbose) {
-            log(file + ' -> ' + newPerms.toString(8));
-          }
-
-          if (perms != newPerms) {
-            if (!options.verbose && options.changes) {
-              log(file + ' -> ' + newPerms.toString(8));
-            }
-            fs.chmodSync(file, newPerms);
-          }
-        }
-        else {
-          error('Invalid symbolic mode change: ' + symbolicMode);
-        }
-      });
-    }
-    else {
-      // they gave us a full number
-      newPerms = type + parseInt(mode, 8);
-
-      // POSIX rules are that setuid and setgid can only be added using numeric form, but not cleared.
-      if (fs.statSync(file).isDirectory()) {
-        newPerms |= (PERMS.SETUID + PERMS.SETGID) & perms;
-      }
-
-      fs.chmodSync(file, newPerms);
-    }
-  });
-}
-exports.chmod = wrap('chmod', _chmod);
-
+//@ Use this value for calls to `glob.sync()` instead of the default options.
 
 //@
-//@ ## Configuration
+//@ ### config.reset()
 //@
-
-
-
-exports.config = config;
-
-//@
-//@ ### config.silent
 //@ Example:
 //@
 //@ ```javascript
-//@ var silentState = config.silent; // save old silent state
-//@ config.silent = true;
+//@ var shell = require('shelljs');
+//@ // Make changes to shell.config, and do stuff...
+//@ /* ... */
+//@ shell.config.reset(); // reset to original state
+//@ // Do more stuff, but with original settings
 //@ /* ... */
-//@ config.silent = silentState; // restore old silent state
 //@ ```
 //@
-//@ Suppresses all command output if `true`, except for `echo()` calls.
-//@ Default is `false`.
-
-//@
-//@ ### config.fatal
-//@ Example:
+//@ Reset `shell.config` to the defaults:
 //@
 //@ ```javascript
-//@ config.fatal = true;
-//@ cp('this_file_does_not_exist', '/dev/null'); // dies here
-//@ /* more commands... */
+//@ {
+//@   fatal: false,
+//@   globOptions: {},
+//@   maxdepth: 255,
+//@   noglob: false,
+//@   silent: false,
+//@   verbose: false,
+//@ }
 //@ ```
-//@
-//@ If `true` the script will die on errors. Default is `false`.
-
-
-
-
-//@
-//@ ## Non-Unix commands
-//@
-
-
-
-
-
-
-//@
-//@ ### tempdir()
-//@ Searches and returns string containing a writeable, platform-dependent temporary directory.
-//@ Follows Python's [tempfile algorithm](http://docs.python.org/library/tempfile.html#tempfile.tempdir).
-exports.tempdir = wrap('tempdir', tempDir);
-
-
-//@
-//@ ### error()
-//@ Tests if error occurred in the last command. Returns `null` if no error occurred,
-//@ otherwise returns string explaining the error
-exports.error = function() {
-  return state.error;
-};
-
-
-
-
-
-////////////////////////////////////////////////////////////////////////////////////////////////
-//
-// Auxiliary functions (internal use only)
-//
-
-function log() {
-  if (!config.silent)
-    console.log.apply(this, arguments);
-}
-
-function deprecate(what, msg) {
-  console.log('*** ShellJS.'+what+': This function is deprecated.', msg);
-}
-
-function write(msg) {
-  if (!config.silent)
-    process.stdout.write(msg);
-}
-
-// Shows error message. Throws unless _continue or config.fatal are true
-function error(msg, _continue) {
-  if (state.error === null)
-    state.error = '';
-  state.error += state.currentCmd + ': ' + msg + '\n';
-
-  log(state.error);
-
-  if (config.fatal)
-    process.exit(1);
-
-  if (!_continue)
-    throw '';
-}
-
-// Returns {'alice': true, 'bob': false} when passed:
-//   parseOptions('-a', {'a':'alice', 'b':'bob'});
-function parseOptions(str, map) {
-  if (!map)
-    error('parseOptions() internal error: no map given');
-
-  // All options are false by default
-  var options = {};
-  for (var letter in map)
-    options[map[letter]] = false;
-
-  if (!str)
-    return options; // defaults
-
-  if (typeof str !== 'string')
-    error('parseOptions() internal error: wrong str');
-
-  // e.g. match[1] = 'Rf' for str = '-Rf'
-  var match = str.match(/^\-(.+)/);
-  if (!match)
-    return options;
-
-  // e.g. chars = ['R', 'f']
-  var chars = match[1].split('');
-
-  chars.forEach(function(c) {
-    if (c in map)
-      options[map[c]] = true;
-    else
-      error('option not recognized: '+c);
-  });
-
-  return options;
-}
-
-// Common wrapper for all Unix-like commands
-function wrap(cmd, fn, options) {
-  return function() {
-    var retValue = null;
-
-    state.currentCmd = cmd;
-    state.error = null;
-
-    try {
-      var args = [].slice.call(arguments, 0);
-
-      if (options && options.notUnix) {
-        retValue = fn.apply(this, args);
-      } else {
-        if (args.length === 0 || typeof args[0] !== 'string' || args[0][0] !== '-')
-          args.unshift(''); // only add dummy option if '-option' not already present
-        retValue = fn.apply(this, args);
-      }
-    } catch (e) {
-      if (!state.error) {
-        // If state.error hasn't been set it's an error thrown by Node, not us - probably a bug...
-        console.log('shell.js: internal error');
-        console.log(e.stack || e);
-        process.exit(1);
-      }
-      if (config.fatal)
-        throw e;
-    }
-
-    state.currentCmd = 'shell.js';
-    return retValue;
-  };
-} // wrap
-
-// Buffered file copy, synchronous
-// (Using readFileSync() + writeFileSync() could easily cause a memory overflow
-//  with large files)
-function copyFileSync(srcFile, destFile) {
-  if (!fs.existsSync(srcFile))
-    error('copyFileSync: no such file or directory: ' + srcFile);
-
-  var BUF_LENGTH = 64*1024,
-      buf = new Buffer(BUF_LENGTH),
-      bytesRead = BUF_LENGTH,
-      pos = 0,
-      fdr = null,
-      fdw = null;
-
-  try {
-    fdr = fs.openSync(srcFile, 'r');
-  } catch(e) {
-    error('copyFileSync: could not read src file ('+srcFile+')');
-  }
-
-  try {
-    fdw = fs.openSync(destFile, 'w');
-  } catch(e) {
-    error('copyFileSync: could not write to dest file (code='+e.code+'):'+destFile);
-  }
-
-  while (bytesRead === BUF_LENGTH) {
-    bytesRead = fs.readSync(fdr, buf, 0, BUF_LENGTH, pos);
-    fs.writeSync(fdw, buf, 0, bytesRead);
-    pos += bytesRead;
-  }
-
-  fs.closeSync(fdr);
-  fs.closeSync(fdw);
-}
-
-// Recursively copies 'sourceDir' into 'destDir'
-// Adapted from https://github.com/ryanmcgrath/wrench-js
-//
-// Copyright (c) 2010 Ryan McGrath
-// Copyright (c) 2012 Artur Adib
-//
-// Licensed under the MIT License
-// http://www.opensource.org/licenses/mit-license.php
-function cpdirSyncRecursive(sourceDir, destDir, opts) {
-  if (!opts) opts = {};
-
-  /* Create the directory where all our junk is moving to; read the mode of the source directory and mirror it */
-  var checkDir = fs.statSync(sourceDir);
-  try {
-    fs.mkdirSync(destDir, checkDir.mode);
-  } catch (e) {
-    //if the directory already exists, that's okay
-    if (e.code !== 'EEXIST') throw e;
-  }
-
-  var files = fs.readdirSync(sourceDir);
-
-  for(var i = 0; i < files.length; i++) {
-    var currFile = fs.lstatSync(sourceDir + "/" + files[i]);
-
-    if (currFile.isDirectory()) {
-      /* recursion this thing right on back. */
-      cpdirSyncRecursive(sourceDir + "/" + files[i], destDir + "/" + files[i], opts);
-    } else if (currFile.isSymbolicLink()) {
-      var symlinkFull = fs.readlinkSync(sourceDir + "/" + files[i]);
-      fs.symlinkSync(symlinkFull, destDir + "/" + files[i]);
-    } else {
-      /* At this point, we've hit a file actually worth copying... so copy it on over. */
-      if (fs.existsSync(destDir + "/" + files[i]) && !opts.force) {
-        log('skipping existing file: ' + files[i]);
-      } else {
-        copyFileSync(sourceDir + "/" + files[i], destDir + "/" + files[i]);
-      }
-    }
-
-  } // for files
-} // cpdirSyncRecursive
-
-// Recursively removes 'dir'
-// Adapted from https://github.com/ryanmcgrath/wrench-js
-//
-// Copyright (c) 2010 Ryan McGrath
-// Copyright (c) 2012 Artur Adib
-//
-// Licensed under the MIT License
-// http://www.opensource.org/licenses/mit-license.php
-function rmdirSyncRecursive(dir, force) {
-  var files;
-
-  files = fs.readdirSync(dir);
-
-  // Loop through and delete everything in the sub-tree after checking it
-  for(var i = 0; i < files.length; i++) {
-    var file = dir + "/" + files[i],
-        currFile = fs.lstatSync(file);
-
-    if(currFile.isDirectory()) { // Recursive function back to the beginning
-      rmdirSyncRecursive(file, force);
-    }
-
-    else if(currFile.isSymbolicLink()) { // Unlink symlinks
-      if (force || isWriteable(file)) {
-        try {
-          _unlinkSync(file);
-        } catch (e) {
-          error('could not remove file (code '+e.code+'): ' + file, true);
-        }
-      }
-    }
-
-    else // Assume it's a file - perhaps a try/catch belongs here?
-      if (force || isWriteable(file)) {
-        try {
-          _unlinkSync(file);
-        } catch (e) {
-          error('could not remove file (code '+e.code+'): ' + file, true);
-        }
-      }
-  }
-
-  // Now that we know everything in the sub-tree has been deleted, we can delete the main directory.
-  // Huzzah for the shopkeep.
-
-  var result;
-  try {
-    result = fs.rmdirSync(dir);
-  } catch(e) {
-    error('could not remove directory (code '+e.code+'): ' + dir, true);
-  }
-
-  return result;
-} // rmdirSyncRecursive
-
-// Recursively creates 'dir'
-function mkdirSyncRecursive(dir) {
-  var baseDir = path.dirname(dir);
-
-  // Base dir exists, no recursion necessary
-  if (fs.existsSync(baseDir)) {
-    fs.mkdirSync(dir, parseInt('0777', 8));
-    return;
-  }
-
-  // Base dir does not exist, go recursive
-  mkdirSyncRecursive(baseDir);
-
-  // Base dir created, can create dir
-  fs.mkdirSync(dir, parseInt('0777', 8));
-}
-
-// e.g. 'shelljs_a5f185d0443ca...'
-function randomFileName() {
-  function randomHash(count) {
-    if (count === 1)
-      return parseInt(16*Math.random(), 10).toString(16);
-    else {
-      var hash = '';
-      for (var i=0; i<count; i++)
-        hash += randomHash(1);
-      return hash;
-    }
-  }
-
-  return 'shelljs_'+randomHash(20);
-}
-
-// Returns false if 'dir' is not a writeable directory, 'dir' otherwise
-function writeableDir(dir) {
-  if (!dir || !fs.existsSync(dir))
-    return false;
-
-  if (!fs.statSync(dir).isDirectory())
-    return false;
-
-  var testFile = dir+'/'+randomFileName();
-  try {
-    fs.writeFileSync(testFile, ' ');
-    _unlinkSync(testFile);
-    return dir;
-  } catch (e) {
-    return false;
-  }
-}
-
-// Cross-platform method for getting an available temporary directory.
-// Follows the algorithm of Python's tempfile.tempdir
-// http://docs.python.org/library/tempfile.html#tempfile.tempdir
-function tempDir() {
-  if (state.tempDir)
-    return state.tempDir; // from cache
-
-  state.tempDir = writeableDir(process.env['TMPDIR']) ||
-                  writeableDir(process.env['TEMP']) ||
-                  writeableDir(process.env['TMP']) ||
-                  writeableDir(process.env['Wimp$ScrapDir']) || // RiscOS
-                  writeableDir('C:\\TEMP') || // Windows
-                  writeableDir('C:\\TMP') || // Windows
-                  writeableDir('\\TEMP') || // Windows
-                  writeableDir('\\TMP') || // Windows
-                  writeableDir('/tmp') ||
-                  writeableDir('/var/tmp') ||
-                  writeableDir('/usr/tmp') ||
-                  writeableDir('.'); // last resort
-
-  return state.tempDir;
-}
-
-// Wrapper around exec() to enable echoing output to console in real time
-function execAsync(cmd, opts, callback) {
-  var output = '';
-
-  var options = extend({
-    silent: config.silent
-  }, opts);
-
-  var c = child.exec(cmd, {env: process.env, maxBuffer: 20*1024*1024}, function(err) {
-    if (callback)
-      callback(err ? err.code : 0, output);
-  });
-
-  c.stdout.on('data', function(data) {
-    output += data;
-    if (!options.silent)
-      process.stdout.write(data);
-  });
-
-  c.stderr.on('data', function(data) {
-    output += data;
-    if (!options.silent)
-      process.stdout.write(data);
-  });
-
-  return c;
-}
-
-// Hack to run child_process.exec() synchronously (sync avoids callback hell)
-// Uses a custom wait loop that checks for a flag file, created when the child process is done.
-// (Can't do a wait loop that checks for internal Node variables/messages as
-// Node is single-threaded; callbacks and other internal state changes are done in the
-// event loop).
-function execSync(cmd, opts) {
-  var stdoutFile = path.resolve(tempDir()+'/'+randomFileName()),
-      codeFile = path.resolve(tempDir()+'/'+randomFileName()),
-      scriptFile = path.resolve(tempDir()+'/'+randomFileName()),
-      sleepFile = path.resolve(tempDir()+'/'+randomFileName());
-
-  var options = extend({
-    silent: config.silent
-  }, opts);
-
-  var previousStdoutContent = '';
-  // Echoes stdout changes from running process, if not silent
-  function updateStdout() {
-    if (options.silent || !fs.existsSync(stdoutFile))
-      return;
-
-    var stdoutContent = fs.readFileSync(stdoutFile, 'utf8');
-    // No changes since last time?
-    if (stdoutContent.length <= previousStdoutContent.length)
-      return;
-
-    process.stdout.write(stdoutContent.substr(previousStdoutContent.length));
-    previousStdoutContent = stdoutContent;
-  }
-
-  function escape(str) {
-    return (str+'').replace(/([\\"'])/g, "\\$1").replace(/\0/g, "\\0");
-  }
-
-  cmd += ' > '+stdoutFile+' 2>&1'; // works on both win/unix
-
-  var script =
-   "var child = require('child_process')," +
-   "     fs = require('fs');" +
-   "child.exec('"+escape(cmd)+"', {env: process.env, maxBuffer: 20*1024*1024}, function(err) {" +
-   "  fs.writeFileSync('"+escape(codeFile)+"', err ? err.code.toString() : '0');" +
-   "});";
-
-  if (fs.existsSync(scriptFile)) _unlinkSync(scriptFile);
-  if (fs.existsSync(stdoutFile)) _unlinkSync(stdoutFile);
-  if (fs.existsSync(codeFile)) _unlinkSync(codeFile);
-
-  fs.writeFileSync(scriptFile, script);
-  child.exec('"'+process.execPath+'" '+scriptFile, {
-    env: process.env,
-    cwd: exports.pwd(),
-    maxBuffer: 20*1024*1024
-  });
-
-  // The wait loop
-  // sleepFile is used as a dummy I/O op to mitigate unnecessary CPU usage
-  // (tried many I/O sync ops, writeFileSync() seems to be only one that is effective in reducing
-  // CPU usage, though apparently not so much on Windows)
-  while (!fs.existsSync(codeFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
-  while (!fs.existsSync(stdoutFile)) { updateStdout(); fs.writeFileSync(sleepFile, 'a'); }
-
-  // At this point codeFile exists, but it's not necessarily flushed yet.
-  // Keep reading it until it is.
-  var code = parseInt('', 10);
-  while (isNaN(code)) {
-    code = parseInt(fs.readFileSync(codeFile, 'utf8'), 10);
-  }
-
-  var stdout = fs.readFileSync(stdoutFile, 'utf8');
-
-  // No biggie if we can't erase the files now -- they're in a temp dir anyway
-  try { _unlinkSync(scriptFile); } catch(e) {}
-  try { _unlinkSync(stdoutFile); } catch(e) {}
-  try { _unlinkSync(codeFile); } catch(e) {}
-  try { _unlinkSync(sleepFile); } catch(e) {}
-
-  // True if successful, false if not
-  var obj = {
-    code: code,
-    output: stdout
-  };
-  return obj;
-} // execSync()
-
-// Expands wildcards with matching file names. For a given array of file names 'list', returns
-// another array containing all file names as per ls(list[i]).
-// For example:
-//   expand(['file*.js']) = ['file1.js', 'file2.js', ...]
-//   (if the files 'file1.js', 'file2.js', etc, exist in the current dir)
-function expand(list) {
-  var expanded = [];
-  list.forEach(function(listEl) {
-    // Wildcard present?
-    if (listEl.search(/\*/) > -1) {
-      _ls('', listEl).forEach(function(file) {
-        expanded.push(file);
-      });
-    } else {
-      expanded.push(listEl);
-    }
-  });
-  return expanded;
-}
-
-// Cross-platform method for splitting environment PATH variables
-function splitPath(p) {
-  if (!p)
-    return [];
-
-  if (platform === 'win')
-    return p.split(';');
-  else
-    return p.split(':');
-}
-
-// extend(target_obj, source_obj1 [, source_obj2 ...])
-// Shallow extend, e.g.:
-//    extend({A:1}, {b:2}, {c:3}) returns {A:1, b:2, c:3}
-function extend(target) {
-  var sources = [].slice.call(arguments, 1);
-  sources.forEach(function(source) {
-    for (var key in source)
-      target[key] = source[key];
-  });
-
-  return target;
-}
-
-// Normalizes _unlinkSync() across platforms to match Unix behavior, i.e.
-// file can be unlinked even if it's read-only, see joyent/node#3006
-function _unlinkSync(file) {
-  try {
-    fs.unlinkSync(file);
-  } catch(e) {
-    // Try to override file permission
-    if (e.code === 'EPERM') {
-      fs.chmodSync(file, '0666');
-      fs.unlinkSync(file);
-    } else {
-      throw e;
-    }
-  }
-}
-
-// Hack to determine if file has write permissions for current user
-// Avoids having to check user, group, etc, but it's probably slow
-function isWriteable(file) {
-  var writePermission = true;
-  try {
-    var __fd = fs.openSync(file, 'a');
-    fs.closeSync(__fd);
-  } catch(e) {
-    writePermission = false;
-  }
-
-  return writePermission;
-}
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cat.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cat.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cat.js	(working copy)
@@ -1,57 +1,119 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
 
 shell.config.silent = true;
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-// save current dir
-var cur = shell.pwd();
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
 //
 // Invalids
 //
 
-shell.cat();
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.cat('/adsfasdf'); // file does not exist
-assert.ok(shell.error());
+test('no paths given', t => {
+  const result = shell.cat();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cat: no paths given');
+});
+
+test('nonexistent file', t => {
+  t.falsy(fs.existsSync('/asdfasdf')); // sanity check
+  const result = shell.cat('/asdfasdf'); // file does not exist
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cat: no such file or directory: /asdfasdf');
+});
+
+test('directory', t => {
+  const result = shell.cat('test/resources/cat');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cat: test/resources/cat: Is a directory');
+});
 
 //
 // Valids
 //
 
-// simple
-var result = shell.cat('resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1');
-
-// multiple files
-var result = shell.cat('resources/file2', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test2\ntest1');
-
-// multiple files, array syntax
-var result = shell.cat(['resources/file2', 'resources/file1']);
-assert.equal(shell.error(), null);
-assert.equal(result, 'test2\ntest1');
-
-var result = shell.cat('resources/file*.txt');
-assert.equal(shell.error(), null);
-assert.ok(result.search('test1') > -1); // file order might be random
-assert.ok(result.search('test2') > -1);
+test('simple', t => {
+  const result = shell.cat('test/resources/cat/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'test1\n');
+});
+
+test('multiple files', t => {
+  const result = shell.cat('test/resources/cat/file2', 'test/resources/cat/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'test2\ntest1\n');
+});
+
+test('multiple files, array syntax', t => {
+  const result = shell.cat(['test/resources/cat/file2', 'test/resources/cat/file1']);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'test2\ntest1\n');
+});
+
+test('glob', t => {
+  const result = shell.cat('test/resources/file*.txt');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.search('test1') > -1); // file order might be random
+  t.truthy(result.search('test2') > -1);
+});
+
+test('without EOF', t => {
+  const result = shell.cat('test/resources/cat/file3');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'test3');
+});
+
+test('empty', t => {
+  const result = shell.cat('test/resources/cat/file5');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '');
+});
+
+//
+// With numbers
+//
 
-shell.exit(123);
+test('simple with numbers', t => {
+  const result = shell.cat('-n', 'test/resources/cat/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '     1\ttest1\n');
+});
+
+test('simple twelve lines file with numbers', t => {
+  const result = shell.cat('-n', 'test/resources/cat/file4');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '     1\ttest4-01\n     2\ttest4-02\n     3\ttest4-03\n     4\ttest4-04\n     5\ttest4-05\n     6\ttest4-06\n     7\ttest4-07\n     8\ttest4-08\n     9\ttest4-09\n    10\ttest4-10\n    11\ttest4-11\n    12\ttest4-12\n');
+});
+
+test('multiple with numbers', t => {
+  const result = shell.cat('-n', 'test/resources/cat/file2', 'test/resources/cat/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '     1\ttest2\n     2\ttest1\n');
+});
+
+test('simple numbers without EOF', t => {
+  const result = shell.cat('-n', 'test/resources/cat/file3');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '     1\ttest3');
+});
+
+test('multiple numbers without EOF', t => {
+  const result = shell.cat('-n', 'test/resources/cat/file3', 'test/resources/cat/file2', 'test/resources/cat/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '     1\ttest3test2\n     2\ttest1\n');
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cd.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cd.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cd.js	(working copy)
@@ -1,64 +1,105 @@
-var shell = require('..');
-
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-// save current dir
-var cur = shell.pwd();
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
+import fs from 'fs';
+import os from 'os';
+import path from 'path';
+
+import test from 'ava';
+
+import shell from '..';
+import utils from './utils/utils';
+
+const cur = shell.pwd().toString();
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  process.chdir(cur);
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  process.chdir(cur);
+  shell.rm('-rf', t.context.tmp);
+});
 
 //
 // Invalids
 //
 
-shell.cd();
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.cd('/adsfasdf'); // dir does not exist
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('resources/file1'), true); // sanity check
-shell.cd('resources/file1'); // file, not dir
-assert.ok(shell.error());
+test('nonexistent directory', t => {
+  t.falsy(fs.existsSync('/asdfasdf'));
+  const result = shell.cd('/asdfasdf'); // dir does not exist
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cd: no such file or directory: /asdfasdf');
+});
+
+test('file not dir', t => {
+  t.truthy(fs.existsSync('test/resources/file1')); // sanity check
+  const result = shell.cd('test/resources/file1'); // file, not dir
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cd: not a directory: test/resources/file1');
+});
+
+test('no previous dir', t => {
+  const result = shell.cd('-'); // Haven't changed yet, so there is no previous directory
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cd: could not find previous directory');
+});
 
 //
 // Valids
 //
 
-shell.cd(cur);
-shell.cd('tmp');
-assert.equal(shell.error(), null);
-assert.equal(path.basename(process.cwd()), 'tmp');
-
-shell.cd(cur);
-shell.cd('/');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), path.resolve('/'));
-
-// cd + other commands
-
-shell.cd(cur);
-shell.rm('-f', 'tmp/*');
-assert.equal(fs.existsSync('tmp/file1'), false);
-shell.cd('resources');
-assert.equal(shell.error(), null);
-shell.cp('file1', '../tmp');
-assert.equal(shell.error(), null);
-shell.cd('../tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), true);
-
-shell.exit(123);
+test('relative path', t => {
+  const result = shell.cd(t.context.tmp);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(path.basename(process.cwd()), t.context.tmp);
+});
+
+test('absolute path', t => {
+  const result = shell.cd('/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(process.cwd(), path.resolve('/'));
+});
+
+test('previous directory (-)', t => {
+  shell.cd('/');
+  const result = shell.cd('-');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(process.cwd(), path.resolve(cur.toString()));
+});
+
+test('cd + other commands', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1`));
+  let result = shell.cd('test/resources');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  result = shell.cp('file1', `../../${t.context.tmp}`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  result = shell.cd(`../../${t.context.tmp}`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync('file1'));
+});
+
+test('Tilde expansion', t => {
+  shell.cd('~');
+  t.is(process.cwd(), os.homedir());
+  shell.cd('..');
+  t.not(process.cwd(), os.homedir());
+  shell.cd('~'); // Change back to home
+  t.is(process.cwd(), os.homedir());
+});
+
+test('Goes to home directory if no arguments are passed', t => {
+  const result = shell.cd();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(process.cwd(), os.homedir());
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/chmod.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/chmod.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/chmod.js	(working copy)
@@ -1,81 +1,359 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-shell.config.silent = true;
+import shell from '..';
+import common from '../src/common';
+import utils from './utils/utils';
+
+let TMP;
+const BITMASK = parseInt('777', 8);
+
+test.before(() => {
+  TMP = utils.getTempDir();
+  shell.cp('-r', 'test/resources', TMP);
+  shell.config.silent = true;
+});
+
+test.after(() => {
+  shell.rm('-rf', TMP);
+});
 
 //
 // Invalids
 //
 
-shell.chmod('blah');  // missing args
-assert.ok(shell.error());
-shell.chmod('893', 'resources/chmod');  // invalid permissions - mode must be in octal
-assert.ok(shell.error());
-
-//
-// Valids
-//
-
-// Test files - the bitmasking is to ignore the upper bits.
-shell.chmod('755', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('755', 8));
-shell.chmod('644', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-shell.chmod('o+x', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('007', 8), parseInt('005', 8));
-shell.chmod('644', 'resources/chmod/file1');
-
-shell.chmod('+x', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('755', 8));
-shell.chmod('644', 'resources/chmod/file1');
-
-// Test setuid
-shell.chmod('u+s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('4000', 8), parseInt('4000', 8));
-shell.chmod('u-s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-// according to POSIX standards at http://linux.die.net/man/1/chmod,
-// setuid is never cleared from a directory unless explicitly asked for.
-shell.chmod('u+s', 'resources/chmod/c');
-shell.chmod('755', 'resources/chmod/c');
-assert.equal(fs.statSync('resources/chmod/c').mode & parseInt('4000', 8), parseInt('4000', 8));
-shell.chmod('u-s', 'resources/chmod/c');
-
-// Test setgid
-shell.chmod('g+s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('2000', 8), parseInt('2000', 8));
-shell.chmod('g-s', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-
-// Test sticky bit
-shell.chmod('+t', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('1000', 8), parseInt('1000', 8));
-shell.chmod('-t', 'resources/chmod/file1');
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('777', 8), parseInt('644', 8));
-assert.equal(fs.statSync('resources/chmod/file1').mode & parseInt('1000', 8), 0);
-
-// Test directories
-shell.chmod('a-w', 'resources/chmod/b/a/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('555', 8));
-shell.chmod('755', 'resources/chmod/b/a/b');
-
-// Test recursion
-shell.chmod('-R', 'a+w', 'resources/chmod/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('777', 8));
-shell.chmod('-R', '755', 'resources/chmod/b');
-assert.equal(fs.statSync('resources/chmod/b/a/b').mode & parseInt('777', 8), parseInt('755', 8));
-
-// Test symbolic links w/ recursion  - WARNING: *nix only
-fs.symlinkSync('resources/chmod/b/a', 'resources/chmod/a/b/c/link', 'dir');
-shell.chmod('-R', 'u-w', 'resources/chmod/a/b');
-assert.equal(fs.statSync('resources/chmod/a/b/c').mode & parseInt('700', 8), parseInt('500', 8));
-assert.equal(fs.statSync('resources/chmod/b/a').mode & parseInt('700', 8), parseInt('700', 8));
-shell.chmod('-R', 'u+w', 'resources/chmod/a/b');
-fs.unlinkSync('resources/chmod/a/b/c/link');
-
-shell.exit(123);
\ No newline at end of file
+test('invalid permissions', t => {
+  let result = shell.chmod('blah');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  result = shell.chmod('893', `${TMP}/chmod`); // invalid permissions - mode must be in octal
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+});
+
+test('Basic usage with octal codes', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('755', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('755', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('644', 8)
+    );
+  });
+});
+
+test('symbolic mode', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('o+x', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('007', 8),
+      parseInt('005', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('symbolic mode, without group', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('+x', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('755', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('Test setuid', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('u+s', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('4000', 8),
+      parseInt('4000', 8)
+    );
+    result = shell.chmod('u-s', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('644', 8)
+    );
+
+    // according to POSIX standards at http://linux.die.net/man/1/chmod,
+    // setuid is never cleared from a directory unless explicitly asked for.
+    result = shell.chmod('u+s', `${TMP}/chmod/c`);
+
+    t.is(result.code, 0);
+    result = shell.chmod('755', `${TMP}/chmod/c`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/c`).mode & parseInt('4000', 8),
+      parseInt('4000', 8)
+    );
+    result = shell.chmod('u-s', `${TMP}/chmod/c`);
+    t.is(result.code, 0);
+  });
+});
+
+test('Test setgid', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('g+s', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('2000', 8),
+      parseInt('2000', 8)
+    );
+    result = shell.chmod('g-s', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('644', 8)
+    );
+  });
+});
+
+test('Test sticky bit', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('+t', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('1000', 8),
+      parseInt('1000', 8)
+    );
+    result = shell.chmod('-t', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & BITMASK,
+      parseInt('644', 8)
+    );
+    t.is(common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('1000', 8), 0);
+  });
+});
+
+test('Test directories', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('a-w', `${TMP}/chmod/b/a/b`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/b/a/b`).mode & BITMASK,
+      parseInt('555', 8)
+    );
+    result = shell.chmod('755', `${TMP}/chmod/b/a/b`);
+    t.is(result.code, 0);
+  });
+});
+
+test('Test recursion', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('-R', 'a+w', `${TMP}/chmod/b`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/b/a/b`).mode & BITMASK,
+      BITMASK
+    );
+    result = shell.chmod('-R', '755', `${TMP}/chmod/b`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/b/a/b`).mode & BITMASK,
+      parseInt('755', 8)
+    );
+  });
+});
+
+test('Test symbolic links w/ recursion  - WARNING: *nix only', t => {
+  utils.skipOnWin(t, () => {
+    fs.symlinkSync(`${TMP}/chmod/b/a`, `${TMP}/chmod/a/b/c/link`, 'dir');
+    let result = shell.chmod('-R', 'u-w', `${TMP}/chmod/a/b`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/a/b/c`).mode & parseInt('700', 8),
+      parseInt('500', 8)
+    );
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/b/a`).mode & parseInt('700', 8),
+      parseInt('700', 8)
+    );
+    result = shell.chmod('-R', 'u+w', `${TMP}/chmod/a/b`);
+    t.is(result.code, 0);
+    fs.unlinkSync(`${TMP}/chmod/a/b/c/link`);
+  });
+});
+
+test('Test combinations', t => {
+  let result = shell.chmod('a-rwx', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('000', 8),
+    parseInt('000', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('multiple symbolic modes', t => {
+  let result = shell.chmod('a-rwx,u+r', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('400', 8),
+    parseInt('400', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('multiple symbolic modes #2', t => {
+  let result = shell.chmod('a-rwx,u+rw', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('600', 8),
+    parseInt('600', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('multiple symbolic modes #3', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('a-rwx,u+rwx', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('700', 8),
+      parseInt('700', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('u+rw', t => {
+  let result = shell.chmod('000', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  result = shell.chmod('u+rw', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('600', 8),
+    parseInt('600', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('u+wx', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('000', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    result = shell.chmod('u+wx', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('300', 8),
+      parseInt('300', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('Multiple symbolic modes at once', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('000', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    result = shell.chmod('u+r,g+w,o+x', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('421', 8),
+      parseInt('421', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('u+rw,g+wx', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.chmod('000', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    result = shell.chmod('u+rw,g+wx', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('630', 8),
+      parseInt('630', 8)
+    );
+    result = shell.chmod('644', `${TMP}/chmod/file1`);
+    t.is(result.code, 0);
+  });
+});
+
+test('u-x,g+rw', t => {
+  let result = shell.chmod('700', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  result = shell.chmod('u-x,g+rw', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('660', 8),
+    parseInt('660', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('a-rwx,u+rw', t => {
+  let result = shell.chmod('a-rwx,u+rw', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('600', 8),
+    parseInt('600', 8)
+  );
+  result = shell.chmod('a-rwx,u+rw', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+  t.is(
+    common.statFollowLinks(`${TMP}/chmod/file1`).mode & parseInt('600', 8),
+    parseInt('600', 8)
+  );
+  result = shell.chmod('644', `${TMP}/chmod/file1`);
+  t.is(result.code, 0);
+});
+
+test('Numeric modes', t => {
+  let result = shell.chmod('744', `${TMP}/chmod/xdir`);
+  t.is(result.code, 0);
+  result = shell.chmod('644', `${TMP}/chmod/xdir/file`);
+  t.is(result.code, 0);
+  result = shell.chmod('744', `${TMP}/chmod/xdir/deep`);
+  t.is(result.code, 0);
+  result = shell.chmod('644', `${TMP}/chmod/xdir/deep/file`);
+  t.is(result.code, 0);
+  result = shell.chmod('-R', 'a+X', `${TMP}/chmod/xdir`);
+  t.is(result.code, 0);
+});
+
+test('Make sure chmod succeeds for a variety of octal codes', t => {
+  utils.skipOnWin(t, () => {
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/xdir`).mode & parseInt('755', 8),
+      parseInt('755', 8)
+    );
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/xdir/file`).mode & parseInt('644', 8),
+      parseInt('644', 8)
+    );
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/xdir/deep`).mode & parseInt('755', 8),
+      parseInt('755', 8)
+    );
+    t.is(
+      common.statFollowLinks(`${TMP}/chmod/xdir/deep/file`).mode & parseInt('644', 8),
+      parseInt('644', 8)
+    );
+  });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/config.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/config.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/config.js	(working copy)
@@ -1,50 +1,75 @@
-var shell = require('..');
+import test from 'ava';
 
-var assert = require('assert'),
-    child = require('child_process');
+import shell from '..';
+import common from '../src/common';
+import utils from './utils/utils';
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
+//
+// Valids
+//
 
 //
 // config.silent
 //
 
-assert.equal(shell.config.silent, false); // default
+test('config.silent is false by default', t => {
+  t.falsy(shell.config.silent);
+});
 
-shell.config.silent = true;
-assert.equal(shell.config.silent, true);
+test('config.silent can be set to true', t => {
+  shell.config.silent = true;
+  t.truthy(shell.config.silent);
+});
 
-shell.config.silent = false;
-assert.equal(shell.config.silent, false);
+test('config.silent can be set to false', t => {
+  shell.config.silent = false;
+  t.falsy(shell.config.silent);
+});
 
 //
 // config.fatal
 //
 
-assert.equal(shell.config.fatal, false); // default
+test.cb('config.fatal = false', t => {
+  t.falsy(shell.config.fatal);
+  const script = 'require(\'./global.js\'); config.silent=true; config.fatal=false; cp("this_file_doesnt_exist", "."); echo("got here");';
+  utils.runScript(script, (err, stdout) => {
+    t.truthy(stdout.match('got here'));
+    t.end();
+  });
+});
+
+test.cb('config.fatal = true', t => {
+  const script = 'require(\'./global.js\'); config.silent=true; config.fatal=true; cp("this_file_doesnt_exist", "."); echo("got here");';
+  utils.runScript(script, (err, stdout) => {
+    t.falsy(stdout.match('got here'));
+    t.end();
+  });
+});
 
 //
-// config.fatal = false
+// config.globOptions
 //
-shell.mkdir('-p', 'tmp');
-var file = 'tmp/tempscript'+Math.random()+'.js',
-    script = 'require(\'../../global.js\'); config.silent=true; config.fatal=false; cp("this_file_doesnt_exist", "."); echo("got here");';
-script.to(file);
-child.exec('node '+file, function(err, stdout, stderr) {
-  assert.ok(stdout.match('got here'));
-
-  //
-  // config.fatal = true
-  //
-  shell.mkdir('-p', 'tmp');
-  var file = 'tmp/tempscript'+Math.random()+'.js',
-      script = 'require(\'../../global.js\'); config.silent=true; config.fatal=true; cp("this_file_doesnt_exist", "."); echo("got here");';
-  script.to(file);
-  child.exec('node '+file, function(err, stdout, stderr) {
-    assert.ok(!stdout.match('got here'));
 
-    shell.exit(123);
-  });
+test('Expands to directories by default', t => {
+  const result = common.expand(['test/resources/*a*']);
+  t.is(result.length, 5);
+  t.truthy(result.indexOf('test/resources/a.txt') > -1);
+  t.truthy(result.indexOf('test/resources/badlink') > -1);
+  t.truthy(result.indexOf('test/resources/cat') > -1);
+  t.truthy(result.indexOf('test/resources/head') > -1);
+  t.truthy(result.indexOf('test/resources/external') > -1);
 });
+
+test(
+  'Check to make sure options get passed through (nodir is an example)',
+  t => {
+    shell.config.globOptions = { nodir: true };
+    const result = common.expand(['test/resources/*a*']);
+    t.is(result.length, 2);
+    t.truthy(result.indexOf('test/resources/a.txt') > -1);
+    t.truthy(result.indexOf('test/resources/badlink') > -1);
+    t.truthy(result.indexOf('test/resources/cat') < 0);
+    t.truthy(result.indexOf('test/resources/external') < 0);
+  }
+);
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cp.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cp.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/cp.js	(working copy)
@@ -1,143 +1,921 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
-
-shell.config.silent = true;
-
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
+import shell from '..';
+import common from '../src/common';
+import utils from './utils/utils';
+
+const oldMaxDepth = shell.config.maxdepth;
+const CWD = process.cwd();
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  process.chdir(CWD);
+  shell.rm('-rf', t.context.tmp);
+  shell.config.maxdepth = oldMaxDepth;
+});
 
 //
 // Invalids
 //
 
-shell.cp();
-assert.ok(shell.error());
-
-shell.cp('file1');
-assert.ok(shell.error());
-
-shell.cp('-f');
-assert.ok(shell.error());
-
-shell.rm('-rf', 'tmp/*');
-shell.cp('-@', 'resources/file1', 'tmp/file1'); // option not supported, files OK
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file1'), false);
-
-shell.cp('-Z', 'asdfasdf', 'tmp/file2'); // option not supported, files NOT OK
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file2'), false);
-
-shell.cp('asdfasdf', 'tmp'); // source does not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 1);
-assert.equal(fs.existsSync('tmp/asdfasdf'), false);
-
-shell.cp('asdfasdf1', 'asdfasdf2', 'tmp'); // sources do not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 2);
-assert.equal(fs.existsSync('tmp/asdfasdf1'), false);
-assert.equal(fs.existsSync('tmp/asdfasdf2'), false);
-
-shell.cp('asdfasdf1', 'asdfasdf2', 'resources/file1'); // too many sources (dest is file)
-assert.ok(shell.error());
-
-shell.cp('resources/file1', 'resources/file2'); // dest already exists
-assert.ok(shell.error());
-
-shell.cp('resources/file1', 'resources/file2', 'tmp/a_file'); // too many sources
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/a_file'), false);
+test('no args', t => {
+  const result = shell.cp();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cp: missing <source> and/or <dest>');
+});
+
+test('no destination', t => {
+  const result = shell.cp('file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cp: missing <source> and/or <dest>');
+});
+
+test('only an option', t => {
+  const result = shell.cp('-f');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cp: missing <source> and/or <dest>');
+});
+
+test('invalid option', t => {
+  const result = shell.cp('-@', 'test/resources/file1', `${t.context.tmp}/file1`);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.is(result.stderr, 'cp: option not recognized: @');
+});
+
+test('invalid option #2', t => {
+  const result = shell.cp('-Z', 'asdfasdf', `${t.context.tmp}/file2`);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2`));
+  t.is(result.stderr, 'cp: option not recognized: Z');
+});
+
+test('source does not exist', t => {
+  const result = shell.cp('asdfasdf', t.context.tmp);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(utils.numLines(result.stderr), 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/asdfasdf`));
+  t.is(result.stderr, 'cp: no such file or directory: asdfasdf');
+});
+
+test('multiple sources do not exist', t => {
+  const result = shell.cp('asdfasdf1', 'asdfasdf2', t.context.tmp);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(utils.numLines(result.stderr), 2);
+  t.falsy(fs.existsSync(`${t.context.tmp}/asdfasdf1`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/asdfasdf2`));
+  t.is(
+    result.stderr,
+    'cp: no such file or directory: asdfasdf1\ncp: no such file or directory: asdfasdf2'
+  );
+});
+
+test('too many sources', t => {
+  const result = shell.cp('asdfasdf1', 'asdfasdf2', 'test/resources/file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'cp: dest is not a directory (too many sources)');
+});
+
+test('too many sources #2', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources/file2', `${t.context.tmp}/a_file`);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/a_file`));
+  t.is(result.stderr, 'cp: dest is not a directory (too many sources)');
+});
+
+test('empty string source', t => {
+  const result = shell.cp('', 'dest');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, "cp: no such file or directory: ''");
+});
 
 //
 // Valids
 //
 
-// simple - to dir
-shell.cp('resources/file1', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-
-// simple - to file
-shell.cp('resources/file2', 'tmp/file2');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-// simple - file list
-shell.rm('-rf', 'tmp/*');
-shell.cp('resources/file1', 'resources/file2', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-// simple - file list, array syntax
-shell.rm('-rf', 'tmp/*');
-shell.cp(['resources/file1', 'resources/file2'], 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-shell.cp('resources/file2', 'tmp/file3');
-assert.equal(fs.existsSync('tmp/file3'), true);
-shell.cp('-f', 'resources/file2', 'tmp/file3'); // file exists, but -f specified
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file3'), true);
-
-// wildcard
-shell.rm('tmp/file1', 'tmp/file2');
-shell.cp('resources/file*', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-
-//recursive, nothing exists
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp/cp') + '');
-
-//recursive, nothing exists, source ends in '/' (see Github issue #15)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp/', 'tmp/');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/cp') + '', shell.ls('-R', 'tmp') + '');
-
-//recursive, everything exists, no force flag
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-shell.cp('-R', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null); // crash test only
-
-//recursive, everything exists, with force flag
-shell.rm('-rf', 'tmp/*');
-shell.cp('-R', 'resources/cp', 'tmp');
-'changing things around'.to('tmp/cp/dir_a/z');
-assert.notEqual(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // before cp
-shell.cp('-Rf', 'resources/cp', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(shell.cat('resources/cp/dir_a/z'), shell.cat('tmp/cp/dir_a/z')); // after cp
-
-//recursive, creates dest dir since it's only one level deep (see Github issue #44)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-r', 'resources/issue44/*', 'tmp/dir2');
-assert.equal(shell.error(), null);
-assert.equal(shell.ls('-R', 'resources/issue44') + '', shell.ls('-R', 'tmp/dir2') + '');
-assert.equal(shell.cat('resources/issue44/main.js'), shell.cat('tmp/dir2/main.js'));
-
-//recursive, does *not* create dest dir since it's too deep (see Github issue #44)
-shell.rm('-rf', 'tmp/*');
-shell.cp('-r', 'resources/issue44/*', 'tmp/dir2/dir3');
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/dir2'), false);
-
-shell.exit(123);
+test('dest already exists', t => {
+  const oldContents = shell.cat('test/resources/file2').toString();
+  const result = shell.cp('-n', 'test/resources/file1', 'test/resources/file2');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stderr, '');
+  t.is(shell.cat('test/resources/file2').toString(), oldContents);
+});
+
+test('-nR does not overwrite an existing file at the destination', t => {
+  // Create tmp/new/cp/a
+  const dest = `${t.context.tmp}/new/cp`;
+  shell.mkdir('-p', dest);
+  const oldContents = 'original content';
+  shell.ShellString(oldContents).to(`${dest}/a`);
+
+  // Attempt to overwrite /tmp/new/cp/ with test/resources/cp/
+  const result = shell.cp('-nR', 'test/resources/cp/', `${t.context.tmp}/new/`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(result.stderr);
+  t.is(shell.cat(`${dest}/a`).toString(), oldContents);
+});
+
+test('-n does not overwrite an existing file if the destination is a directory', t => {
+  const oldContents = 'original content';
+  shell.cp('test/resources/file1', `${t.context.tmp}`);
+  new shell.ShellString(oldContents).to(`${t.context.tmp}/file1`);
+  const result = shell.cp('-n', 'test/resources/file1', `${t.context.tmp}`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(result.stderr);
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), oldContents);
+});
+
+test('-f by default', t => {
+  shell.cp('test/resources/file2', 'test/resources/copyfile2');
+  const result = shell.cp('test/resources/file1', 'test/resources/file2'); // dest already exists
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(result.stderr);
+  t.is(shell.cat('test/resources/file1').toString(), shell.cat('test/resources/file2').toString()); // after cp
+  shell.mv('test/resources/copyfile2', 'test/resources/file2'); // restore
+  t.falsy(shell.error());
+});
+
+test('-f (explicitly)', t => {
+  shell.cp('test/resources/file2', 'test/resources/copyfile2');
+  const result = shell.cp('-f', 'test/resources/file1', 'test/resources/file2'); // dest already exists
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.is(shell.cat('test/resources/file1').toString(), shell.cat('test/resources/file2').toString()); // after cp
+  shell.mv('test/resources/copyfile2', 'test/resources/file2'); // restore
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('simple - to dir', t => {
+  const result = shell.cp('test/resources/file1', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+});
+
+test('simple - to file', t => {
+  const result = shell.cp('test/resources/file2', `${t.context.tmp}/file2`);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+});
+
+test('simple - file list', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources/file2', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+});
+
+test('simple - file list, array syntax', t => {
+  const result = shell.cp(['test/resources/file1', 'test/resources/file2'], t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+});
+
+test('-f option', t => {
+  shell.cp('test/resources/file2', `${t.context.tmp}/file3`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file3`));
+  const result = shell.cp('-f', 'test/resources/file2', `${t.context.tmp}/file3`); // file exists, but -f specified
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file3`));
+});
+
+test('glob', t => {
+  const result = shell.cp('test/resources/file?', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1.js`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2.js`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1.txt`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2.txt`));
+});
+
+test('wildcard', t => {
+  shell.rm(`${t.context.tmp}/file1`, `${t.context.tmp}/file2`);
+  const result = shell.cp('test/resources/file*', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1.js`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2.js`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1.txt`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2.txt`));
+});
+
+test('recursive, with regular files', t => {
+  const result = shell.cp('-R', 'test/resources/file1', 'test/resources/file2', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2`));
+});
+
+test('omit directory if missing recursive flag', t => {
+  const result = shell.cp('test/resources/cp', t.context.tmp);
+  t.is(shell.error(), "cp: omitting directory 'test/resources/cp'");
+  t.is(result.stderr, "cp: omitting directory 'test/resources/cp'");
+  t.is(result.code, 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2`));
+});
+
+test('recursive, nothing exists', t => {
+  const result = shell.cp('-R', 'test/resources/cp', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.is(shell.ls('-R', 'test/resources/cp').toString(), shell.ls('-R', `${t.context.tmp}/cp`).toString());
+});
+
+test('recursive, nothing exists, source ends in "/"', t => {
+  // Github issue #15
+  const result = shell.cp('-R', 'test/resources/cp/', `${t.context.tmp}/`);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.is(shell.ls('-R', 'test/resources/cp').toString(), shell.ls('-R', `${t.context.tmp}/cp`).toString());
+});
+
+test('recursive, globbing regular files with extension', t => {
+  // Github issue #376
+  const result = shell.cp('-R', 'test/resources/file*.txt', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1.txt`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2.txt`));
+});
+
+test('recursive, copying one regular file', t => {
+  // Github issue #376
+  const result = shell.cp('-R', 'test/resources/file1.txt', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1.txt`));
+  t.falsy(common.statFollowLinks(`${t.context.tmp}/file1.txt`).isDirectory()); // don't let it be a dir
+});
+
+test('recursive, everything exists, no force flag', t => {
+  const result = shell.cp('-R', 'test/resources/cp', t.context.tmp);
+  t.falsy(shell.error()); // crash test only
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+});
+
+test('-R implies to not follow links', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-R', 'test/resources/cp/*', t.context.tmp);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/links/sym.lnk`).isSymbolicLink()); // this one is a link
+    t.falsy((common.statNoFollowLinks(`${t.context.tmp}/fakeLinks/sym.lnk`).isSymbolicLink())); // this one isn't
+    t.not(
+      shell.cat(`${t.context.tmp}/links/sym.lnk`).toString(),
+      shell.cat(`${t.context.tmp}/fakeLinks/sym.lnk`).toString()
+    );
+    const result = shell.cp('-R', `${t.context.tmp}/links/*`, `${t.context.tmp}/fakeLinks`);
+    t.falsy(shell.error());
+    t.falsy(result.stderr);
+    t.is(result.code, 0);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/links/sym.lnk`).isSymbolicLink()); // this one is a link
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/fakeLinks/sym.lnk`).isSymbolicLink()); // this one is now a link
+    t.is(
+      shell.cat(`${t.context.tmp}/links/sym.lnk`).toString(),
+      shell.cat(`${t.context.tmp}/fakeLinks/sym.lnk`).toString()
+    );
+  });
+});
+
+test('Missing -R implies -L', t => {
+  utils.skipOnWin(t, () => {
+    // Recursive, everything exists, overwrite a real file *by following a link*
+    // Because missing the -R implies -L.
+    shell.cp('-R', 'test/resources/cp/*', t.context.tmp);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/links/sym.lnk`).isSymbolicLink()); // this one is a link
+    t.falsy((common.statNoFollowLinks(`${t.context.tmp}/fakeLinks/sym.lnk`).isSymbolicLink())); // this one isn't
+    t.not(
+      shell.cat(`${t.context.tmp}/links/sym.lnk`).toString(),
+      shell.cat(`${t.context.tmp}/fakeLinks/sym.lnk`).toString()
+    );
+    const result = shell.cp(`${t.context.tmp}/links/*`, `${t.context.tmp}/fakeLinks`); // don't use -R
+    t.falsy(shell.error());
+    t.falsy(result.stderr);
+    t.is(result.code, 0);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/links/sym.lnk`).isSymbolicLink()); // this one is a link
+    t.falsy(common.statNoFollowLinks(`${t.context.tmp}/fakeLinks/sym.lnk`).isSymbolicLink()); // this one is still not a link
+    // But it still follows the link
+    t.is(
+      shell.cat(`${t.context.tmp}/links/sym.lnk`).toString(),
+      shell.cat(`${t.context.tmp}/fakeLinks/sym.lnk`).toString()
+    );
+  });
+});
+
+test('recursive, everything exists, with force flag', t => {
+  let result = shell.cp('-R', 'test/resources/cp', t.context.tmp);
+  shell.ShellString('changing things around').to(`${t.context.tmp}/cp/dir_a/z`);
+  t.not(shell.cat('test/resources/cp/dir_a/z').toString(), shell.cat(`${t.context.tmp}/cp/dir_a/z`).toString()); // before cp
+  result = shell.cp('-Rf', 'test/resources/cp', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.is(shell.cat('test/resources/cp/dir_a/z').toString(), shell.cat(`${t.context.tmp}/cp/dir_a/z`).toString()); // after cp
+});
+
+test("recursive, creates dest dir since it's only one level deep", t => {
+  // Github issue #44
+  const result = shell.cp('-r', 'test/resources/issue44', `${t.context.tmp}/dir2`);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.is(shell.ls('-R', 'test/resources/issue44').toString(), shell.ls('-R', `${t.context.tmp}/dir2`).toString());
+  t.is(
+      shell.cat('test/resources/issue44/main.js').toString(),
+      shell.cat(`${t.context.tmp}/dir2/main.js`).toString()
+    );
+});
+
+test("recursive, does *not* create dest dir since it's too deep", t => {
+  // Github issue #44
+  const result = shell.cp('-r', 'test/resources/issue44', `${t.context.tmp}/dir2/dir3`);
+  t.truthy(shell.error());
+  t.is(
+    result.stderr,
+    `cp: cannot create directory '${t.context.tmp}/dir2/dir3': No such file or directory`
+  );
+  t.is(result.code, 1);
+  t.falsy(fs.existsSync(`${t.context.tmp}/dir2`));
+});
+
+test('recursive, copies entire directory', t => {
+  const result = shell.cp('-r', 'test/resources/cp/dir_a', `${t.context.tmp}/dest`);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/dest/z`));
+});
+
+test('recursive, with trailing slash, does the exact same', t => {
+  const result = shell.cp('-r', 'test/resources/cp/dir_a/', `${t.context.tmp}/dest`);
+  t.is(result.code, 0);
+  t.falsy(shell.error());
+  t.truthy(fs.existsSync(`${t.context.tmp}/dest/z`));
+});
+
+test('preserve mode bits by default for file', t => {
+  utils.skipOnWin(t, () => {
+    const execBit = parseInt('001', 8);
+    t.is(common.statFollowLinks('test/resources/cp-mode-bits/executable').mode & execBit, execBit);
+    shell.cp('test/resources/cp-mode-bits/executable', `${t.context.tmp}/executable`);
+    t.is(
+      common.statFollowLinks('test/resources/cp-mode-bits/executable').mode,
+      common.statFollowLinks(`${t.context.tmp}/executable`).mode
+    );
+  });
+});
+
+test('Make sure hidden files are copied recursively', t => {
+  shell.rm('-rf', t.context.tmp);
+  const result = shell.cp('-r', 'test/resources/ls/', t.context.tmp);
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/.hidden_file`));
+});
+
+test('no-recursive will copy regular files only', t => {
+  const result = shell.cp(
+    'test/resources/file1.txt', 'test/resources/file2.txt', 'test/resources/cp',
+    'test/resources/ls/', t.context.tmp
+  );
+
+  t.is(result.code, 1);
+  t.truthy(shell.error());
+  t.falsy(fs.existsSync(`${t.context.tmp}/.hidden_file`)); // doesn't copy dir contents
+  t.falsy(fs.existsSync(`${t.context.tmp}/ls`)); // doesn't copy dir itself
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`)); // doesn't copy dir contents
+  t.falsy(fs.existsSync(`${t.context.tmp}/cp`)); // doesn't copy dir itself
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1.txt`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/file2.txt`));
+});
+
+test('-R implies -P', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-R', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+  });
+});
+
+test('-Ru respects the -u flag recursively (don\'t update newer file)', t => {
+  // Setup code
+  const dir = `${t.context.tmp}/cp-Ru`;
+  const sourceDir = `${dir}/original`;
+  const sourceFile = `${sourceDir}/file`;
+  const destDir = `${dir}/new`;
+  const nestedDestDir = `${dir}/new/original`;
+  const destFile = `${nestedDestDir}/file`;
+  [sourceDir, destDir, nestedDestDir].forEach(d => shell.mkdir('-p', d));
+  shell.ShellString('Source File Contents\n').to(sourceFile);
+  shell.ShellString('Destination File Contents\n').to(destFile);
+  const oldModifyTimeMs = 12345000;
+  const newModifyTimeMs = 67890000;
+  // End setup
+
+  // Set the source file to be OLDER than the destination file
+  shell.touch({ '-m': true, '-d': new Date(oldModifyTimeMs) }, sourceFile);
+  shell.touch({ '-m': true, '-d': new Date(newModifyTimeMs) }, destFile);
+  shell.cp('-Ru', sourceDir, destDir);
+  // Check that dest has not been updated
+  t.is(shell.cat(destFile).stdout, 'Destination File Contents\n');
+});
+
+test('-Ru respects the -u flag recursively (update older file)', t => {
+  // Setup code
+  const dir = `${t.context.tmp}/cp-Ru`;
+  const sourceDir = `${dir}/original`;
+  const sourceFile = `${sourceDir}/file`;
+  const destDir = `${dir}/new`;
+  const nestedDestDir = `${dir}/new/original`;
+  const destFile = `${nestedDestDir}/file`;
+  [sourceDir, destDir, nestedDestDir].forEach(d => shell.mkdir('-p', d));
+  shell.ShellString('Source File Contents\n').to(sourceFile);
+  shell.ShellString('Destination File Contents\n').to(destFile);
+  const oldModifyTimeMs = 12345000;
+  const newModifyTimeMs = 67890000;
+  // End setup
+
+  // Set the source file to be NEWER than the destination file
+  shell.touch({ '-m': true, '-d': new Date(newModifyTimeMs) }, sourceFile);
+  shell.touch({ '-m': true, '-d': new Date(oldModifyTimeMs) }, destFile);
+  shell.cp('-Ru', sourceDir, destDir);
+  // Check that dest has been overwritten
+  t.is(shell.cat(destFile).stdout, 'Source File Contents\n');
+});
+
+test('using -P explicitly works', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-P', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+  });
+});
+
+test('using -PR on a link to a folder does not follow the link', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-PR', 'test/resources/cp/symFolder', t.context.tmp);
+    t.truthy(common.statNoFollowLinks(`${t.context.tmp}/symFolder`).isSymbolicLink());
+  });
+});
+
+test('-L overrides -P for copying directory', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-LPR', 'test/resources/cp/symFolder', t.context.tmp);
+    t.falsy(common.statNoFollowLinks(`${t.context.tmp}/symFolder`).isSymbolicLink());
+    t.falsy(common.statNoFollowLinks(`${t.context.tmp}/symFolder/sym.lnk`).isSymbolicLink());
+  });
+});
+
+test('Recursive, copies entire directory with no symlinks and -L option does not cause change in behavior', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.cp('-rL', 'test/resources/cp/dir_a', `${t.context.tmp}/dest`);
+    t.falsy(shell.error());
+    t.falsy(result.stderr);
+    t.is(result.code, 0);
+    t.truthy(fs.existsSync(`${t.context.tmp}/dest/z`));
+  });
+});
+
+test('-u flag won\'t overwrite newer files', t => {
+  shell.touch(`${t.context.tmp}/file1.js`);
+  shell.cp('-u', 'test/resources/file1.js', t.context.tmp);
+  t.falsy(shell.error());
+  t.not(shell.cat('test/resources/file1.js').toString(), shell.cat(`${t.context.tmp}/file1.js`).toString());
+});
+
+test('-u flag does overwrite older files', t => {
+  shell.touch({ '-d': new Date(10) }, `${t.context.tmp}/file1.js`); // really old file
+  shell.cp('-u', 'test/resources/file1.js', t.context.tmp);
+  t.falsy(shell.error());
+  t.is(shell.cat('test/resources/file1.js').toString(), shell.cat(`${t.context.tmp}/file1.js`).toString());
+});
+
+test('-u flag works even if it\'s not overwriting a file', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1.js`));
+  shell.cp('-u', 'test/resources/file1.js', t.context.tmp);
+  t.falsy(shell.error());
+  t.is(shell.cat('test/resources/file1.js').toString(), shell.cat(`${t.context.tmp}/file1.js`).toString());
+});
+
+test('-u flag works correctly recursively', t => {
+  shell.mkdir(`${t.context.tmp}/foo`);
+  [1, 2, 3].forEach(num => {
+    new shell.ShellString('old\n').to(`${t.context.tmp}/foo/file${num}`);
+    shell.touch({ '-d': new Date(10) }, `${t.context.tmp}/foo/file${num}`);
+  });
+  shell.mkdir(`${t.context.tmp}/bar`);
+  [1, 2, 3].forEach(num => {
+    new shell.ShellString('new\n').to(`${t.context.tmp}/bar/file${num}`);
+    shell.touch({ '-d': new Date(1000) }, `${t.context.tmp}/bar/file${num}`);
+  });
+  // put one new one in the foo directory
+  new shell.ShellString('newest\n').to(`${t.context.tmp}/foo/file3`);
+  shell.touch({ '-d': new Date(10000) }, `${t.context.tmp}/foo/file3`);
+  shell.cp('-u', `${t.context.tmp}/foo/*`, `${t.context.tmp}/bar`);
+  t.falsy(shell.error());
+  t.is(shell.cat(`${t.context.tmp}/bar/*`).toString(), 'new\nnew\nnewest\n');
+});
+
+test('using -R on a link to a folder *does* follow the link', t => {
+  shell.cp('-R', 'test/resources/cp/symFolder', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/symFolder`).isSymbolicLink());
+});
+
+test('Without -R, -L is implied', t => {
+  shell.cp('test/resources/cp/links/sym.lnk', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+});
+
+test('-L explicitly works', t => {
+  shell.cp('-L', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+});
+
+test('using -LR does not imply -P', t => {
+  shell.cp('-LR', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+});
+
+test('using -LR also works recursively on directories containing links', t => {
+  shell.cp('-LR', 'test/resources/cp/links', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/links/sym.lnk`).isSymbolicLink());
+});
+
+test('-L always overrides a -P', t => {
+  shell.cp('-LP', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+  shell.cp('-LPR', 'test/resources/cp/links/sym.lnk', t.context.tmp);
+  t.falsy(common.statNoFollowLinks(`${t.context.tmp}/sym.lnk`).isSymbolicLink());
+});
+
+test('Make sure max depth does not limit shallow directory structures', t => {
+  shell.config.maxdepth = 3;
+  const TMP = t.context.tmp;
+  shell.mkdir(`${TMP}/foo`);
+  for (let k = 0; k < 5; k++) {
+    shell.mkdir(`${TMP}/foo/dir${k}`);
+  }
+  shell.cp('-r', `${TMP}/foo`, `${TMP}/bar`);
+  t.is(shell.ls(`${TMP}/foo`).stdout, shell.ls(`${TMP}/bar`).stdout);
+});
+
+test('Test max depth.', t => {
+  shell.config.maxdepth = 32;
+  let directory = '';
+  for (let i = 1; i < 40; i++) {
+    directory += '/' + i;
+  }
+  let directory32deep = '';
+  for (let i = 1; i < 32; i++) {
+    directory32deep += '/' + i;
+  }
+  shell.mkdir('-p', `${t.context.tmp}/0${directory}`);
+  shell.cp('-r', `${t.context.tmp}/0`, `${t.context.tmp}/copytestdepth`);
+  // Check full directory exists.
+  t.truthy(shell.test('-d', `${t.context.tmp}/0/${directory}`));
+  // Check full copy of directory does not exist.
+  t.falsy(shell.test('-d', `${t.context.tmp}/copytestdepth${directory}`));
+  // Check last directory to exist is below maxdepth.
+  t.truthy(shell.test('-d', `${t.context.tmp}/copytestdepth${directory32deep}`));
+  t.falsy(shell.test('-d', `${t.context.tmp}/copytestdepth${directory32deep}/32`));
+  utils.skipOnWinForEPERM(shell.ln.bind(shell, '-s', `${t.context.tmp}/0`, `${t.context.tmp}/symlinktest`), () => {
+    if (!shell.test('-L', `${t.context.tmp}/symlinktest`)) {
+      t.fail();
+    }
+
+    // Create symlinks to check for cycle.
+    shell.cd(`${t.context.tmp}/0/1/2/3/4`);
+    t.falsy(shell.error());
+    shell.ln('-s', '../../../2', 'link');
+    t.falsy(shell.error());
+    shell.ln('-s', './5/6/7', 'link1');
+    t.falsy(shell.error());
+    shell.cd('../../../../../..');
+    t.falsy(shell.error());
+    t.truthy(shell.test('-d', t.context.tmp));
+
+    shell.cp('-r', `${t.context.tmp}/0/1`, `${t.context.tmp}/copytestdepth`);
+    t.falsy(shell.error());
+    t.truthy(shell.test('-d', `${t.context.tmp}/copytestdepth/1/2/3/4/link/3/4/link/3/4`));
+  });
+});
+
+test('cp -L follows symlinks', t => {
+  utils.skipOnWinForEPERM(shell.ln.bind(shell, '-s', `${t.context.tmp}/0`, `${t.context.tmp}/symlinktest`), () => {
+    shell.mkdir('-p', `${t.context.tmp}/sub`);
+    shell.mkdir('-p', `${t.context.tmp}/new`);
+    shell.cp('-f', 'test/resources/file1.txt', `${t.context.tmp}/sub/file.txt`);
+    shell.cd(`${t.context.tmp}/sub`);
+    shell.ln('-s', 'file.txt', 'foo.lnk');
+    shell.ln('-s', 'file.txt', 'sym.lnk');
+    shell.cd('..');
+    shell.cp('-L', 'sub/*', 'new/');
+    shell.cd('new');
+
+    shell.cp('-f', '../../test/resources/file2.txt', 'file.txt');
+    t.is(shell.cat('file.txt').toString(), 'test2\n');
+    // Ensure other files have not changed.
+    t.is(shell.cat('foo.lnk').toString(), 'test1\n');
+    t.is(shell.cat('sym.lnk').toString(), 'test1\n');
+    t.falsy(shell.test('-L', 'foo.lnk'));
+    t.falsy(shell.test('-L', 'sym.lnk'));
+    shell.cd('../..');
+  });
+});
+
+test('Test with recursive option and symlinks.', t => {
+  utils.skipOnWinForEPERM(shell.ln.bind(shell, '-s', `${t.context.tmp}/0`, `${t.context.tmp}/symlinktest`), () => {
+    shell.mkdir('-p', `${t.context.tmp}/sub/sub1`);
+    shell.cp('-f', 'test/resources/file1.txt', `${t.context.tmp}/sub/file.txt`);
+    shell.cp('-f', 'test/resources/file1.txt', `${t.context.tmp}/sub/sub1/file.txt`);
+    shell.cd(`${t.context.tmp}/sub`);
+    shell.ln('-s', 'file.txt', 'foo.lnk');
+    shell.ln('-s', 'file.txt', 'sym.lnk');
+    shell.cd('sub1');
+    shell.ln('-s', '../file.txt', 'foo.lnk');
+    shell.ln('-s', '../file.txt', 'sym.lnk');
+
+    // Ensure file reads from proper source
+    t.is(shell.cat('file.txt').toString(), 'test1\n');
+    t.is(shell.cat('foo.lnk').toString(), 'test1\n');
+    t.is(shell.cat('sym.lnk').toString(), 'test1\n');
+    t.truthy(shell.test('-L', 'foo.lnk'));
+    t.truthy(shell.test('-L', 'sym.lnk'));
+    shell.cd('../..');
+    shell.cp('-rL', 'sub/', 'new/');
+    shell.cd('new');
+
+    // Ensure copies of files are symlinks by updating file contents.
+    shell.cp('-f', '../../test/resources/file2.txt', 'file.txt');
+    t.is(shell.cat('file.txt').toString(), 'test2\n');
+    // Ensure other files have not changed.
+    t.is(shell.cat('foo.lnk').toString(), 'test1\n');
+    t.is(shell.cat('sym.lnk').toString(), 'test1\n');
+
+    // Ensure the links are converted to files.
+    t.falsy(shell.test('-L', 'foo.lnk'));
+    t.falsy(shell.test('-L', 'sym.lnk'));
+
+    // Ensure other files have not changed.
+    shell.cd('sub1');
+    shell.cp('-f', '../../../test/resources/file2.txt', 'file.txt');
+    t.is(shell.cat('file.txt').toString(), 'test2\n');
+    t.is(shell.cat('foo.lnk').toString(), 'test1\n');
+    t.is(shell.cat('sym.lnk').toString(), 'test1\n');
+
+    // Ensure the links are converted to files
+    t.falsy(shell.test('-L', 'foo.lnk'));
+    t.falsy(shell.test('-L', 'sym.lnk'));
+  });
+});
+
+test('recursive, with a non-normalized path', t => {
+  const result = shell.cp('-R', 'test/resources/../resources/./cp', t.context.tmp);
+  t.falsy(shell.error()); // crash test only
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+});
+
+test('copy file to same path', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources/file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, "cp: 'test/resources/file1' and 'test/resources/file1' are the same file");
+});
+
+test('copy file to same directory', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, "cp: 'test/resources/file1' and 'test/resources/file1' are the same file");
+});
+
+test('copy mutliple files to same location', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources/file2', 'test/resources');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(
+    result.stderr,
+    "cp: 'test/resources/file1' and 'test/resources/file1' are the same file\n" +
+    "cp: 'test/resources/file2' and 'test/resources/file2' are the same file"
+  );
+});
+
+test('should not overwrite recently created files', t => {
+  const result = shell.cp('test/resources/file1', 'test/resources/cp/file1', t.context.tmp);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+
+  // Ensure First file is copied
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), 'test1');
+  t.is(
+    result.stderr,
+    `cp: will not overwrite just-created '${t.context.tmp}/file1' with 'test/resources/cp/file1'`
+  );
+});
+
+
+test('should not overwrite recently created files (in recursive Mode)', t => {
+  const result = shell.cp('-R', 'test/resources/file1', 'test/resources/cp/file1', t.context.tmp);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+
+  // Ensure First file is copied
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), 'test1');
+  t.is(
+    result.stderr,
+    `cp: will not overwrite just-created '${t.context.tmp}/file1' with 'test/resources/cp/file1'`
+  );
+});
+
+test('should not overwrite recently created files (not give error no-force mode)', t => {
+  const result = shell.cp('-n', 'test/resources/file1', 'test/resources/cp/file1', t.context.tmp);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+
+  // Ensure First file is copied
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), 'test1');
+});
+
+// cp -R should be able to copy a readonly src (issue #98).
+// On Windows, chmod acts VERY differently so skip these tests for now
+test('cp -R should be able to copy a readonly src. issue #98; (Non window platforms only)', t => {
+  utils.skipOnWin(t, () => {
+    shell.cp('-r', 'test/resources/cp', t.context.tmp);
+    shell.chmod('555', `${t.context.tmp}/cp/`);
+    shell.chmod('555', `${t.context.tmp}/cp/dir_a`);
+    shell.chmod('555', `${t.context.tmp}/cp/dir_b`);
+    shell.chmod('555', `${t.context.tmp}/cp/a`);
+
+    const result = shell.cp('-r', `${t.context.tmp}/cp`, `${t.context.tmp}/cp_cp`);
+    t.falsy(shell.error());
+    t.falsy(result.stderr);
+    t.is(result.code, 0);
+
+    t.is(shell.ls('-R', `${t.context.tmp}/cp`) + '', shell.ls('-R', `${t.context.tmp}/cp_cp`) + '');
+    t.is(fs.statSync(`${t.context.tmp}/cp_cp`).mode & parseInt('777', 8), parseInt('555', 8));
+    t.is(fs.statSync(`${t.context.tmp}/cp_cp/dir_a`).mode & parseInt('777', 8), parseInt('555', 8));
+    t.is(fs.statSync(`${t.context.tmp}/cp_cp/a`).mode & parseInt('777', 8), parseInt('555', 8));
+
+    shell.chmod('-R', '755', t.context.tmp);
+  });
+});
+
+test('cp -p should preserve mode, ownership, and timestamp (regular file)', t => {
+  // Setup: copy to srcFile and modify mode and timestamp
+  const srcFile = `${t.context.tmp}/srcFile`;
+  shell.cp('test/resources/cp/file1', srcFile);
+  // Make this a round number of seconds, since the underlying system may not
+  // have millisecond precision.
+  const newModifyTimeMs = 12345000;
+  const newAccessTimeMs = 67890000;
+  shell.touch({ '-d': new Date(newModifyTimeMs), '-m': true }, srcFile);
+  shell.touch({ '-d': new Date(newAccessTimeMs), '-a': true }, srcFile);
+  const mode = '444';
+  shell.chmod(mode, srcFile);
+
+  // Now re-copy with '-p' and verify metadata.
+  const result = shell.cp('-p', srcFile, `${t.context.tmp}/preservedFile1`);
+  const stat = common.statFollowLinks(srcFile);
+  const statOfResult = common.statFollowLinks(`${t.context.tmp}/preservedFile1`);
+
+  t.is(result.code, 0);
+
+  // Original file should be unchanged:
+  t.is(stat.mtime.getTime(), newModifyTimeMs);
+  // cp appears to update the atime, but only of the srcFile
+  t.is(stat.mode.toString(8), '100' + mode);
+
+  // New file should keep same attributes
+  t.is(statOfResult.mtime.getTime(), newModifyTimeMs);
+  t.is(statOfResult.atime.getTime(), newAccessTimeMs);
+  t.is(statOfResult.mode.toString(8), '100' + mode);
+
+  t.is(stat.uid, statOfResult.uid);
+  t.is(stat.gid, statOfResult.gid);
+});
+
+test('cp -p should preserve mode, ownership, and timestamp (directory)', t => {
+  // Setup: copy to srcFile and modify mode and timestamp
+  const srcDir = `${t.context.tmp}/srcDir`;
+  const srcFile = `${srcDir}/srcFile`;
+  shell.mkdir(srcDir);
+  shell.cp('test/resources/cp/file1', srcFile);
+  // Make this a round number of seconds, since the underlying system may not
+  // have millisecond precision.
+  const newModifyTimeMs = 12345000;
+  const newAccessTimeMs = 67890000;
+  shell.touch({ '-d': new Date(newModifyTimeMs), '-m': true }, srcFile);
+  shell.touch({ '-d': new Date(newAccessTimeMs), '-a': true }, srcFile);
+  fs.utimesSync(srcDir, new Date(newAccessTimeMs), new Date(newModifyTimeMs));
+  const mode = '444';
+  shell.chmod(mode, srcFile);
+
+  // Now re-copy (the whole dir) with '-p' and verify metadata of file contents.
+  const result = shell.cp('-pr', srcDir, `${t.context.tmp}/preservedDir`);
+  const stat = common.statFollowLinks(srcFile);
+  const statDir = common.statFollowLinks(srcDir);
+  const statOfResult = common.statFollowLinks(`${t.context.tmp}/preservedDir/srcFile`);
+  const statOfResultDir = common.statFollowLinks(`${t.context.tmp}/preservedDir`);
+
+  t.is(result.code, 0);
+
+  // Both original file and original dir should be unchanged:
+  t.is(statDir.mtime.getTime(), newModifyTimeMs);
+  t.is(stat.mtime.getTime(), newModifyTimeMs);
+  // cp appears to update the atime, but only of the srcFile & srcDir
+  t.is(stat.mode.toString(8), '100' + mode);
+
+  // Both new file and new dir should keep same attributes
+  t.is(statOfResultDir.mtime.getTime(), newModifyTimeMs);
+  t.is(statOfResultDir.atime.getTime(), newAccessTimeMs);
+  t.is(statOfResult.mtime.getTime(), newModifyTimeMs);
+  t.is(statOfResult.atime.getTime(), newAccessTimeMs);
+  t.is(statOfResult.mode.toString(8), '100' + mode);
+
+  t.is(stat.uid, statOfResult.uid);
+  t.is(stat.gid, statOfResult.gid);
+});
+
+test('cp -p should preserve mode, ownership, and timestamp (symlink)', t => {
+  // Skip in Windows because symlinks require elevated permissions.
+  utils.skipOnWin(t, () => {
+    // Setup: copy to srcFile, create srcLink, and modify mode and timestamp
+    shell.cp('test/resources/cp/file1', `${t.context.tmp}/srcFile`);
+    const srcLink = `${t.context.tmp}/srcLink`;
+    shell.ln('-s', 'srcFile', `${t.context.tmp}/srcLink`);
+    // Make this a round number of seconds, since the underlying system may not
+    // have millisecond precision.
+    const newModifyTimeMs = 12345000;
+    const newAccessTimeMs = 67890000;
+    shell.touch({ '-d': new Date(newModifyTimeMs), '-m': true }, srcLink);
+    shell.touch({ '-d': new Date(newAccessTimeMs), '-a': true }, srcLink);
+    const mode = '444';
+    shell.chmod(mode, srcLink);
+
+    // Now re-copy with '-p' and verify metadata.
+    const result = shell.cp('-p', srcLink, `${t.context.tmp}/preservedLink`);
+    const stat = common.statFollowLinks(srcLink);
+    const statOfResult = common.statFollowLinks(`${t.context.tmp}/preservedLink`);
+
+    t.is(result.code, 0);
+
+    // Original file should be unchanged:
+    t.is(stat.mtime.getTime(), newModifyTimeMs);
+    // cp appears to update the atime, but only of the srcFile
+    t.is(stat.mode.toString(8), '100' + mode);
+
+    // New file should keep same attributes
+    t.is(statOfResult.mtime.getTime(), newModifyTimeMs);
+    t.is(statOfResult.atime.getTime(), newAccessTimeMs);
+    t.is(statOfResult.mode.toString(8), '100' + mode);
+
+    t.is(stat.uid, statOfResult.uid);
+    t.is(stat.gid, statOfResult.gid);
+  });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/dirs.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/dirs.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/dirs.js	(working copy)
@@ -1,37 +1,39 @@
-var shell = require('..');
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
 
-shell.config.silent = true;
-
-var root = path.resolve();
-
-shell.pushd('resources/pushd');
-shell.pushd('a');
-
-var trail = [
-  path.resolve(root, 'resources/pushd/a'),
-  path.resolve(root, 'resources/pushd'),
-  root
+test.beforeEach(() => {
+  shell.config.resetForTesting();
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+});
+
+//
+// Valids
+//
+
+const trail = [
+  path.resolve(path.resolve(), 'test/resources/pushd/a'),
+  path.resolve(path.resolve(), 'test/resources/pushd'),
+  path.resolve(),
 ];
 
-assert.deepEqual(shell.dirs(), trail);
-
-// Single items
-assert.equal(shell.dirs('+0'), trail[0]);
-assert.equal(shell.dirs('+1'), trail[1]);
-assert.equal(shell.dirs('+2'), trail[2]);
-assert.equal(shell.dirs('-0'), trail[2]);
-assert.equal(shell.dirs('-1'), trail[1]);
-assert.equal(shell.dirs('-2'), trail[0]);
-
-// Clearing items
-assert.deepEqual(shell.dirs('-c'), []);
-assert(!shell.error());
-
-shell.exit(123);
\ No newline at end of file
+test('no arguments', t => {
+  t.deepEqual(shell.dirs(), trail);
+});
+
+test('Single items', t => {
+  t.is(shell.dirs('+0'), trail[0]);
+  t.is(shell.dirs('+1'), trail[1]);
+  t.is(shell.dirs('+2'), trail[2]);
+  t.is(shell.dirs('-0'), trail[2]);
+  t.is(shell.dirs('-1'), trail[1]);
+  t.is(shell.dirs('-2'), trail[0]);
+});
+
+test('Clearing items', t => {
+  t.deepEqual(shell.dirs('-c'), []);
+  t.falsy(shell.error());
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/echo.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/echo.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/echo.js	(working copy)
@@ -1,50 +1,151 @@
-var shell = require('..');
+import test from 'ava';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs'),
-    child = require('child_process');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
+import mocks from './utils/mocks';
 
 shell.config.silent = true;
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  mocks.init();
+});
 
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+  mocks.restore();
+});
 
 //
 // Valids
 //
 
+test('simple test with defaults', t => {
+  const result = shell.echo('hello', 'world');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, 'hello world\n');
+  t.is(stderr, '');
+});
 
-// From here on we use child.exec() to intercept the stdout
+test('allow arguments to begin with a hyphen', t => {
+  // Github issue #20
+  const result = shell.echo('-asdf', '111');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 1);
+  t.is(stdout, '-asdf 111\n');
+  t.is(stderr, '');
+});
 
+test("using null as an explicit argument doesn't crash the function", t => {
+  const result = shell.echo(null);
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, 'null\n');
+  t.is(stderr, '');
+});
 
-// simple test with defaults
-shell.mkdir('-p', 'tmp');
-var file = 'tmp/tempscript'+Math.random()+'.js',
-    script = 'require(\'../../global.js\'); echo("-asdf", "111");'; // test '-' bug (see issue #20)
-script.to(file);
-child.exec('node '+file, function(err, stdout, stderr) {
-  assert.ok(stdout === '-asdf 111\n' || stdout === '-asdf 111\nundefined\n'); // 'undefined' for v0.4
-
-  // simple test with silent(true)
-  shell.mkdir('-p', 'tmp');
-  var file = 'tmp/tempscript'+Math.random()+'.js',
-      script = 'require(\'../../global.js\'); config.silent=true; echo(555);';
-  script.to(file);
-  child.exec('node '+file, function(err, stdout, stderr) {
-    assert.ok(stdout === '555\n' || stdout === '555\nundefined\n'); // 'undefined' for v0.4
-
-    theEnd();
-  });
-});
-
-function theEnd() {
-  shell.exit(123);
-}
+test('-e option', t => {
+  const result = shell.echo('-e', '\tmessage');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, '\tmessage\n');
+  t.is(stderr, '');
+});
+
+test('piping to a file', t => {
+  // Github issue #476
+  shell.mkdir(t.context.tmp);
+  const tmp = `${t.context.tmp}/echo.txt`;
+  const resultA = shell.echo('A').toEnd(tmp);
+  t.falsy(shell.error());
+  t.is(resultA.code, 0);
+  const resultB = shell.echo('B').toEnd(tmp);
+  t.falsy(shell.error());
+  t.is(resultB.code, 0);
+  const result = shell.cat(tmp);
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(stdout, 'A\nB\n');
+  t.is(stderr, '');
+  t.is(result.toString(), 'A\nB\n');
+});
+
+test('-n option', t => {
+  const result = shell.echo('-n', 'message');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, 'message');
+  t.is(stderr, '');
+});
+
+test('-ne option', t => {
+  const result = shell.echo('-ne', 'message');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, 'message');
+  t.is(stderr, '');
+});
+
+test('-en option', t => {
+  const result = shell.echo('-en', 'message');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, 'message');
+  t.is(stderr, '');
+});
+
+test('-en option with escaped characters', t => {
+  const result = shell.echo('-en', '\tmessage\n');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(stdout, '\tmessage\n');
+  t.is(stderr, '');
+});
+
+test('piping to a file with -n', t => {
+  // Github issue #476
+  shell.mkdir(t.context.tmp);
+  const tmp = `${t.context.tmp}/echo.txt`;
+  const resultA = shell.echo('-n', 'A').toEnd(tmp);
+  t.falsy(shell.error());
+  t.is(resultA.code, 0);
+  const resultB = shell.echo('-n', 'B').toEnd(tmp);
+  t.falsy(shell.error());
+  t.is(resultB.code, 0);
+  const result = shell.cat(tmp);
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(stdout, 'AB');
+  t.is(stderr, '');
+  t.is(result.toString(), 'AB');
+});
+
+test('stderr with unrecognized options is empty', t => {
+  const result = shell.echo('-asdf');
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.falsy(shell.error());
+  t.is(result.code, 1);
+  t.falsy(result.stderr);
+  t.is(stdout, '-asdf\n');
+  t.is(stderr, '');
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/env.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/env.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/env.js	(working copy)
@@ -1,19 +1,18 @@
-var shell = require('..');
+import test from 'ava';
 
-var assert = require('assert');
+import shell from '..';
 
 shell.config.silent = true;
 
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
 //
 // Valids
 //
 
-assert.equal(shell.env['PATH'], process.env['PATH']);
-
-shell.env['SHELLJS_TEST'] = 'hello world';
-assert.equal(shell.env['SHELLJS_TEST'], process.env['SHELLJS_TEST']);
-
-shell.exit(123);
+test('existing variables', t => {
+  t.is(shell.env.PATH, process.env.PATH);
+});
+
+test('variables are exported', t => {
+  shell.env.SHELLJS_TEST = 'hello world';
+  t.is(shell.env.SHELLJS_TEST, process.env.SHELLJS_TEST);
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/exec.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/exec.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/exec.js	(working copy)
@@ -1,27 +1,73 @@
-var shell = require('..');
-
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs'),
-    util = require('util'),
-    child = require('child_process');
+import os from 'os';
+import path from 'path';
+import util from 'util';
+
+import test from 'ava';
+
+import shell from '..';
+import utils from './utils/utils';
+import mocks from './utils/mocks';
 
+const CWD = process.cwd();
+const ORIG_EXEC_PATH = shell.config.execPath;
 shell.config.silent = true;
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
+test.beforeEach(() => {
+  mocks.init();
+});
+
+test.afterEach.always(() => {
+  process.chdir(CWD);
+  shell.config.execPath = ORIG_EXEC_PATH;
+  mocks.restore();
+});
 
 //
 // Invalids
 //
 
-shell.exec();
-assert.ok(shell.error());
+test('no args', t => {
+  shell.exec();
+  t.truthy(shell.error());
+});
+
+test('unknown command', t => {
+  const result = shell.exec('asdfasdf'); // could not find command
+  t.truthy(result.code > 0);
+});
+
+test('config.fatal and unknown command', t => {
+  const oldFatal = shell.config.fatal;
+  shell.config.fatal = true;
+  t.throws(() => {
+    shell.exec('asdfasdf'); // could not find command
+  }, /asdfasdf/); // name of command should be in error message
+  shell.config.fatal = oldFatal;
+});
 
-var result = shell.exec('asdfasdf'); // could not find command
-assert.ok(result.code > 0);
+test('options.fatal = true and unknown command', t => {
+  const oldFatal = shell.config.fatal;
+  shell.config.fatal = false;
+  t.throws(() => {
+    shell.exec('asdfasdf', { fatal: true }); // could not find command
+  }, /asdfasdf/); // name of command should be in error message
+  shell.config.fatal = oldFatal; // TODO(nfischer): this setting won't get reset if the assertion above fails
+});
 
+test('exec exits gracefully if we cannot find the execPath', t => {
+  shell.config.execPath = null;
+  shell.exec('echo foo');
+  t.regex(
+    shell.error(),
+    /Unable to find a path to the node binary\. Please manually set config\.execPath/
+  );
+});
+
+test('cannot require exec-child.js', t => {
+  t.throws(() => {
+    require('../src/exec-child');
+  }, /This file should not be required/);
+});
 
 //
 // Valids
@@ -31,79 +77,194 @@
 // sync
 //
 
-// check if stdout goes to output
-var result = shell.exec('node -e \"console.log(1234);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n' || result.output === '1234\nundefined\n'); // 'undefined' for v0.4
-
-// check if stderr goes to output
-var result = shell.exec('node -e \"console.error(1234);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n' || result.output === '1234\nundefined\n'); // 'undefined' for v0.4
-
-// check if stdout + stderr go to output
-var result = shell.exec('node -e \"console.error(1234); console.log(666);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.ok(result.output === '1234\n666\n' || result.output === '1234\n666\nundefined\n');  // 'undefined' for v0.4
-
-// check exit code
-var result = shell.exec('node -e \"process.exit(12);\"');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 12);
-
-// interaction with cd
-shell.cd('resources/external');
-var result = shell.exec('node node_script.js');
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.equal(result.output, 'node_script_1234\n');
-shell.cd('../..');
-
-// check quotes escaping
-var result = shell.exec( util.format('node -e "console.log(%s);"', "\\\"\\'+\\'_\\'+\\'\\\"") );
-assert.equal(shell.error(), null);
-assert.equal(result.code, 0);
-assert.equal(result.output, "'+'_'+'\n");
+test('check if stdout goes to output', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(1234);"`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, '1234\n');
+});
+
+test('check if stderr goes to output', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.error(1234);"`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, '');
+  t.is(result.stderr, '1234\n');
+});
 
-//
-// async
-//
+test('check if stdout + stderr go to output', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.error(1234); console.log(666);"`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, '666\n');
+  t.is(result.stderr, '1234\n');
+});
+
+test('check if stdout + stderr should not be printed to console if silent', t => {
+  shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.error(1234); console.log(666); process.exit(12);"`, { silent: true });
+  const stdout = mocks.stdout();
+  const stderr = mocks.stderr();
+  t.is(stdout, '');
+  t.is(stderr, '');
+});
+
+test('check exit code', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "process.exit(12);"`);
+  t.truthy(shell.error());
+  t.is(result.code, 12);
+});
 
-// no callback
-var c = shell.exec('node -e \"console.log(1234)\"', {async:true});
-assert.equal(shell.error(), null);
-assert.ok('stdout' in c, 'async exec returns child process object');
+test('interaction with cd', t => {
+  shell.cd('test/resources/external');
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} node_script.js`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, 'node_script_1234\n');
+});
+
+test('check quotes escaping', t => {
+  const result = shell.exec(util.format(JSON.stringify(shell.config.execPath) + ' -e "console.log(%s);"', "\\\"\\'+\\'_\\'+\\'\\\""));
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, "'+'_'+'\n");
+});
+
+test('set cwd', t => {
+  const cmdString = process.platform === 'win32' ? 'cd' : 'pwd';
+  const result = shell.exec(cmdString, { cwd: '..' });
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, path.resolve('..') + os.EOL);
+});
+
+test('set maxBuffer (very small)', t => {
+  const result = shell.exec('echo 1234567890'); // default maxBuffer is ok
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, '1234567890' + os.EOL);
+  const result2 = shell.exec('echo 1234567890', { maxBuffer: 6 });
+  t.truthy(shell.error());
+  t.is(result2.code, 1);
+  t.is(result2.stdout, '1234567890' + os.EOL);
+  const maxBufferErrorPattern = /.*\bmaxBuffer\b.*\bexceeded\b.*/;
+  t.regex(result2.stderr, maxBufferErrorPattern);
+});
+
+test('set timeout option', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} test/resources/exec/slow.js 100`); // default timeout is ok
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  shell.exec(`${JSON.stringify(shell.config.execPath)} test/resources/exec/slow.js 2000`, { timeout: 1000 }); // times out
+  t.truthy(shell.error());
+});
+
+test('check process.env works', t => {
+  t.falsy(shell.env.FOO);
+  shell.env.FOO = 'Hello world';
+  const result = shell.exec(process.platform !== 'win32' ? 'echo $FOO' : 'echo %FOO%');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.stdout, 'Hello world' + os.EOL);
+  t.is(result.stderr, '');
+});
+
+test('set shell option (TODO: add tests for Windows)', t => {
+  utils.skipOnWin(t, () => {
+    let result = shell.exec('echo $0');
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+    t.is(result.stdout, '/bin/sh\n'); // sh by default
+    const bashPath = shell.which('bash').trim();
+    if (bashPath) {
+      result = shell.exec('echo $0', { shell: '/bin/bash' });
+      t.falsy(shell.error());
+      t.is(result.code, 0);
+      t.is(result.stdout, '/bin/bash\n');
+    }
+  });
+});
+
+test('exec returns a ShellString', t => {
+  const result = shell.exec('echo foo');
+  t.is(typeof result, 'object');
+  t.truthy(result instanceof String);
+  t.is(typeof result.stdout, 'string');
+  t.is(result.toString(), result.stdout);
+});
+
+test('encoding option works', t => {
+  const result = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(1234);"`, { encoding: 'buffer' });
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(Buffer.isBuffer(result.stdout));
+  t.truthy(Buffer.isBuffer(result.stderr));
+  t.is(result.stdout.toString(), '1234\n');
+  t.is(result.stderr.toString(), '');
+});
+
+test('options.fatal = false and unknown command', t => {
+  const oldFatal = shell.config.fatal;
+  shell.config.fatal = true;
+  const result = shell.exec('asdfasdf', { fatal: false }); // could not find command
+  shell.config.fatal = oldFatal;
+  t.truthy(shell.error());
+  t.truthy(result.code);
+});
 
 //
-// callback as 2nd argument
+// async
 //
-shell.exec('node -e \"console.log(5678);\"', function(code, output) {
-  assert.equal(code, 0);
-  assert.ok(output === '5678\n' || output === '5678\nundefined\n');  // 'undefined' for v0.4
-
-  //
-  // callback as 3rd argument
-  //
-  shell.exec('node -e \"console.log(5566);\"', {async:true}, function(code, output) {
-    assert.equal(code, 0);
-    assert.ok(output === '5566\n' || output === '5566\nundefined\n');  // 'undefined' for v0.4
 
-    //
-    // callback as 3rd argument (slient:true)
-    //
-    shell.exec('node -e \"console.log(5678);\"', {silent:true}, function(code, output) {
-      assert.equal(code, 0);
-      assert.ok(output === '5678\n' || output === '5678\nundefined\n');  // 'undefined' for v0.4
+test.cb('no callback', t => {
+  const c = shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(1234)"`, { async: true });
+  t.falsy(shell.error());
+  t.truthy('stdout' in c, 'async exec returns child process object');
+  t.end();
+});
 
-      shell.exit(123);
+test.cb('callback as 2nd argument', t => {
+  shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(5678);"`, (code, stdout, stderr) => {
+    t.is(code, 0);
+    t.is(stdout, '5678\n');
+    t.is(stderr, '');
+    t.end();
+  });
+});
 
-    });
+test.cb('callback as end argument', t => {
+  shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(5566);"`, { async: true }, (code, stdout, stderr) => {
+    t.is(code, 0);
+    t.is(stdout, '5566\n');
+    t.is(stderr, '');
+    t.end();
+  });
+});
 
+test.cb('callback as 3rd argument (silent:true)', t => {
+  shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(5678);"`, { silent: true }, (code, stdout, stderr) => {
+    t.is(code, 0);
+    t.is(stdout, '5678\n');
+    t.is(stderr, '');
+    t.end();
   });
+});
 
+test.cb('command that fails', t => {
+  shell.exec('shx cp onlyOneCpArgument.txt', { silent: true }, (code, stdout, stderr) => {
+    t.is(code, 1);
+    t.is(stdout, '');
+    t.is(stderr, 'cp: missing <source> and/or <dest>\n');
+    t.end();
+  });
 });
 
-assert.equal(shell.error(), null);
+test.cb('encoding option works with async', t => {
+  shell.exec(`${JSON.stringify(shell.config.execPath)} -e "console.log(5566);"`, { async: true, encoding: 'buffer' }, (code, stdout, stderr) => {
+    t.is(code, 0);
+    t.truthy(Buffer.isBuffer(stdout));
+    t.truthy(Buffer.isBuffer(stderr));
+    t.is(stdout.toString(), '5566\n');
+    t.is(stderr.toString(), '');
+    t.end();
+  });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/find.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/find.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/find.js	(working copy)
@@ -1,56 +1,76 @@
-var shell = require('..');
+import test from 'ava';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import shell from '..';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+const CWD = process.cwd();
 
-shell.config.silent = true;
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
+test.beforeEach(() => {
+  shell.config.resetForTesting();
+  process.chdir(CWD);
+});
 
 //
 // Invalids
 //
 
-var result = shell.find(); // no paths given
-assert.ok(shell.error());
+test('no args', t => {
+  const result = shell.find();
+  t.is(result.code, 1);
+  t.truthy(shell.error());
+});
 
 //
 // Valids
 //
 
-// current path
-shell.cd('resources/find');
-var result = shell.find('.');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('.hidden') > -1, true);
-assert.equal(result.indexOf('dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.length, 11);
-shell.cd('../..');
-
-// simple path
-var result = shell.find('resources/find');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/.hidden') > -1, true);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.length, 11);
-
-// multiple paths - comma
-var result = shell.find('resources/find/dir1', 'resources/find/dir2');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.indexOf('resources/find/dir2/a_dir1') > -1, true);
-assert.equal(result.length, 6);
-
-// multiple paths - array
-var result = shell.find(['resources/find/dir1', 'resources/find/dir2']);
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/find/dir1/dir11/a_dir11') > -1, true);
-assert.equal(result.indexOf('resources/find/dir2/a_dir1') > -1, true);
-assert.equal(result.length, 6);
-
-shell.exit(123);
+test('current path', t => {
+  shell.cd('test/resources/find');
+  const result = shell.find('.');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('.hidden') > -1);
+  t.truthy(result.indexOf('dir1/dir11/a_dir11') > -1);
+  t.is(result.length, 12);
+  shell.cd('../..');
+});
+
+test('simple path', t => {
+  const result = shell.find('test/resources/find');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/find/.hidden') > -1);
+  t.truthy(result.indexOf('test/resources/find/dir1/dir11/a_dir11') > -1);
+  t.is(result.length, 12);
+});
+
+test('multiple paths - comma', t => {
+  const result = shell.find('test/resources/find/dir1', 'test/resources/find/dir2');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/find/dir1/dir11/a_dir11') > -1);
+  t.truthy(result.indexOf('test/resources/find/dir2/a_dir1') > -1);
+  t.is(result.length, 6);
+});
+
+test('multiple paths - array', t => {
+  const result = shell.find(['test/resources/find/dir1', 'test/resources/find/dir2']);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/find/dir1/dir11/a_dir11') > -1);
+  t.truthy(result.indexOf('test/resources/find/dir2/a_dir1') > -1);
+  t.is(result.length, 6);
+});
+
+test('nonexistent path', t => {
+  const result = shell.find('test/resources/find/nonexistent');
+  t.is(shell.error(), 'find: no such file or directory: test/resources/find/nonexistent');
+  t.is(result.code, 1);
+});
+
+test('-L flag, folder is symlinked', t => {
+  const result = shell.find('-L', 'test/resources/find');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/find/dir2_link/a_dir1') > -1);
+  t.is(result.length, 13);
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/grep.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/grep.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/grep.js	(working copy)
@@ -1,59 +1,176 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
-shell.config.silent = true;
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.cp('-r', 'test/resources', t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+});
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-shell.grep();
-assert.ok(shell.error());
-
-shell.grep(/asdf/g); // too few args
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.grep(/asdf/g, '/asdfasdf'); // no such file
-assert.ok(shell.error());
+test('no args', t => {
+  const result = shell.grep();
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(shell.errorCode(), 2);
+});
+
+test('too few args', t => {
+  const result = shell.grep(/asdf/g); // too few args
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+});
+
+test('no such file', t => {
+  t.falsy(fs.existsSync('/asdfasdf')); // sanity check
+  const result = shell.grep(/asdf/g, '/asdfasdf'); // no such file
+  t.truthy(shell.error());
+  t.is(result.stderr, 'grep: no such file or directory: /asdfasdf');
+  t.is(result.code, 2);
+});
+
+test('if at least one file is missing, this should be an error', t => {
+  t.falsy(fs.existsSync('asdfasdf')); // sanity check
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`)); // sanity check
+  const result = shell.grep(/asdf/g, `${t.context.tmp}/file1`, 'asdfasdf');
+  t.truthy(shell.error());
+  t.is(result.stderr, 'grep: no such file or directory: asdfasdf');
+  t.is(result.code, 2);
+});
+
+test("multiple files, one doesn't exist, one doesn't match", t => {
+  const result = shell.grep(/oogabooga/, 'test/resources/file1.txt',
+    'test/resources/filedoesnotexist.txt');
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+});
 
 //
 // Valids
 //
 
-var result = shell.grep('line', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result.split('\n').length - 1, 4);
-
-var result = shell.grep('-v', 'line', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result.split('\n').length - 1, 8);
-
-var result = shell.grep('line one', 'resources/a.txt');
-assert.equal(shell.error(), null);
-assert.equal(result, 'This is line one\n');
-
-// multiple files
-var result = shell.grep(/test/, 'resources/file1.txt', 'resources/file2.txt');
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1\ntest2\n');
-
-// multiple files, array syntax
-var result = shell.grep(/test/, ['resources/file1.txt', 'resources/file2.txt']);
-assert.equal(shell.error(), null);
-assert.equal(result, 'test1\ntest2\n');
-
-shell.exit(123);
+test('basic', t => {
+  const result = shell.grep('line', 'test/resources/a.txt');
+  t.falsy(shell.error());
+  t.is(result.split('\n').length - 1, 4);
+});
+
+test('-v option', t => {
+  const result = shell.grep('-v', 'line', 'test/resources/a.txt');
+  t.falsy(shell.error());
+  t.is(result.split('\n').length - 1, 8);
+});
+
+test('matches one line', t => {
+  const result = shell.grep('line one', 'test/resources/a.txt');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'This is line one\n');
+});
+
+test('multiple files', t => {
+  const result = shell.grep(/test/, 'test/resources/file1.txt',
+    'test/resources/file2.txt');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'test1\ntest2\n');
+});
+
+test('multiple files, array syntax', t => {
+  const result = shell.grep(/test/, ['test/resources/file1.txt',
+    'test/resources/file2.txt']);
+  t.falsy(shell.error());
+  t.is(result.toString(), 'test1\ntest2\n');
+});
+
+test('multiple files, glob syntax, * for file name', t => {
+  const result = shell.grep(/test/, 'test/resources/file*.txt');
+  t.falsy(shell.error());
+  t.truthy(result.toString(), 'test1\ntest2\n');
+});
+
+test('multiple files, glob syntax, * for directory name', t => {
+  const result = shell.grep(/test/, 'test/r*/file*.txt');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'test1\ntest2\n');
+});
+
+test('multiple files, double-star glob', t => {
+  const result = shell.grep(/test/, 'test/resources/**/file*.js');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'test\ntest\ntest\ntest\n');
+});
+
+test('one file, * in regex', t => {
+  const result = shell.grep(/alpha*beta/, 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'alphaaaaaaabeta\nalphbeta\n');
+});
+
+test('one file, * in string-regex', t => {
+  const result = shell.grep('alpha*beta', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'alphaaaaaaabeta\nalphbeta\n');
+});
+
+test('one file, * in regex, make sure * is not globbed', t => {
+  const result = shell.grep(/l*\.js/, 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'this line ends in.js\nlllllllllllllllll.js\n');
+});
+
+test('one file, * in string-regex, make sure * is not globbed', t => {
+  const result = shell.grep('l*\\.js', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.toString(), 'this line ends in.js\nlllllllllllllllll.js\n');
+});
+
+test("one file, pattern doesn't match", t => {
+  const result = shell.grep('notfoundstring', 'test/resources/grep/file');
+  t.truthy(shell.error());
+  t.is(result.toString(), '');
+  t.is(result.stdout, '');
+  // TODO(#900): "grep: " isn't really the correct stderr output, but we need a
+  // non-empty string so `shell.error()` is truthy.
+  t.is(result.stderr, 'grep: ');
+  t.is(result.code, 1);
+});
+
+test('-l option', t => {
+  const result = shell.grep('-l', 'test1', 'test/resources/file1', 'test/resources/file2',
+    'test/resources/file1.txt');
+  t.falsy(shell.error());
+  t.truthy(result.match(/file1(\n|$)/));
+  t.truthy(result.match(/file1.txt/));
+  t.falsy(result.match(/file2.txt/));
+  t.is(result.split('\n').length - 1, 2);
+});
+
+test('-i option', t => {
+  const result = shell.grep('-i', 'test', 'test/resources/grep/case1', 'test/resources/grep/case1.txt',
+    'test/resources/grep/case1.js');
+  t.falsy(shell.error());
+  t.is(result.split('\n').length - 1, 3);
+});
+
+test('-n option', t => {
+  const result = shell.grep('-n', /alpha*beta/, 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.toString(), '1:alphaaaaaaabeta\n3:alphbeta\n');
+});
+
+test('the pattern looks like an option', t => {
+  const result = shell.grep('--', '-v', 'test/resources/grep/file2');
+  t.falsy(shell.error());
+  t.is(result.toString(), '-v\n-vv\n');
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/ls.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/ls.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/ls.js	(working copy)
@@ -1,202 +1,535 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import common from '../src/common';
+import utils from './utils/utils';
+
+const CWD = process.cwd();
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  process.chdir(CWD);
+  shell.rm('-rf', t.context.tmp);
+});
 
-shell.config.silent = true;
-
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-var result = shell.ls('/asdfasdf'); // no such file or dir
-assert.ok(shell.error());
-assert.equal(result.length, 0);
+test('no such file or dir', t => {
+  t.falsy(fs.existsSync('/asdfasdf'));
+  const result = shell.ls('/asdfasdf'); // no such file or dir
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.length, 0);
+});
 
 //
 // Valids
 //
 
-var result = shell.ls();
-assert.equal(shell.error(), null);
-
-var result = shell.ls('/');
-assert.equal(shell.error(), null);
-
-// no args
-shell.cd('resources/ls');
-var result = shell.ls();
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.length, 6);
-shell.cd('../..');
-
-// simple arg
-var result = shell.ls('resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.length, 6);
-
-// no args, 'all' option
-shell.cd('resources/ls');
-var result = shell.ls('-A');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('.hidden_file') > -1, true);
-assert.equal(result.indexOf('.hidden_dir') > -1, true);
-assert.equal(result.length, 8);
-shell.cd('../..');
-
-// no args, 'all' option
-shell.cd('resources/ls');
-var result = shell.ls('-a'); // (deprecated) backwards compatibility test
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('file1') > -1, true);
-assert.equal(result.indexOf('file2') > -1, true);
-assert.equal(result.indexOf('file1.js') > -1, true);
-assert.equal(result.indexOf('file2.js') > -1, true);
-assert.equal(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('.hidden_file') > -1, true);
-assert.equal(result.indexOf('.hidden_dir') > -1, true);
-assert.equal(result.length, 8);
-shell.cd('../..');
-
-// wildcard, simple
-var result = shell.ls('resources/ls/*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/file1') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2') > -1, true);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir') > -1, true);
-assert.equal(result.length, 6);
-
-// wildcard, hidden only
-var result = shell.ls('resources/ls/.*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/.hidden_file') > -1, true);
-assert.equal(result.indexOf('resources/ls/.hidden_dir') > -1, true);
-assert.equal(result.length, 2);
-
-// wildcard, mid-file
-var result = shell.ls('resources/ls/f*le*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 5);
-assert.equal(result.indexOf('resources/ls/file1') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2') > -1, true);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-
-// wildcard, mid-file with dot (should escape dot for regex)
-var result = shell.ls('resources/ls/f*le*.js');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 2);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-
-// wildcard, should not do partial matches
-var result = shell.ls('resources/ls/*.j'); // shouldn't get .js
-assert.equal(shell.error(), null);
-assert.equal(result.length, 0);
-
-// wildcard, all files with extension
-var result = shell.ls('resources/ls/*.*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 3);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1, true);
-
-// wildcard, with additional path
-var result = shell.ls('resources/ls/f*le*.js', 'resources/ls/a_dir');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('b_dir') > -1, true); // no wildcard == no path prefix
-assert.equal(result.indexOf('nada') > -1, true); // no wildcard == no path prefix
-
-// wildcard for both paths
-var result = shell.ls('resources/ls/f*le*.js', 'resources/ls/a_dir/*');
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/nada') > -1, true);
-
-// wildcard for both paths, array
-var result = shell.ls(['resources/ls/f*le*.js', 'resources/ls/a_dir/*']);
-assert.equal(shell.error(), null);
-assert.equal(result.length, 4);
-assert.equal(result.indexOf('resources/ls/file1.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/file2.js') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/nada') > -1, true);
-
-// recursive, no path
-shell.cd('resources/ls');
-var result = shell.ls('-R');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-shell.cd('../..');
-
-// recusive, path given
-var result = shell.ls('-R', 'resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-
-// recusive, path given - 'all' flag
-var result = shell.ls('-RA', 'resources/ls');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('a_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('a_dir/b_dir/z') > -1, true);
-assert.equal(result.indexOf('a_dir/.hidden_dir/nada') > -1, true);
-assert.equal(result.length, 14);
-
-// recursive, wildcard
-var result = shell.ls('-R', 'resources/ls/*');
-assert.equal(shell.error(), null);
-assert.equal(result.indexOf('resources/ls/a_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir') > -1, true);
-assert.equal(result.indexOf('resources/ls/a_dir/b_dir/z') > -1, true);
-assert.equal(result.length, 9);
-
-shell.exit(123);
+test('it\'s ok to use no arguments', t => {
+  const result = shell.ls();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(shell.errorCode(), 0);
+});
+
+test('root directory', t => {
+  const result = shell.ls('/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('no args provides the correct result', t => {
+  shell.cd('test/resources/ls');
+  const result = shell.ls();
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('file1') > -1);
+  t.truthy(result.indexOf('file2') > -1);
+  t.truthy(result.indexOf('file1.js') > -1);
+  t.truthy(result.indexOf('file2.js') > -1);
+  t.truthy(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.is(result.length, 6);
+});
+
+test('simple arg', t => {
+  const result = shell.ls('test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('file1') > -1);
+  t.truthy(result.indexOf('file2') > -1);
+  t.truthy(result.indexOf('file1.js') > -1);
+  t.truthy(result.indexOf('file2.js') > -1);
+  t.truthy(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.is(result.length, 6);
+});
+
+test('simple arg, with a trailing slash', t => {
+  const result = shell.ls('test/resources/ls/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('file1') > -1);
+  t.truthy(result.indexOf('file2') > -1);
+  t.truthy(result.indexOf('file1.js') > -1);
+  t.truthy(result.indexOf('file2.js') > -1);
+  t.truthy(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.is(result.length, 6);
+});
+
+test('simple arg, a file', t => {
+  const result = shell.ls('test/resources/ls/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.is(result.length, 1);
+});
+
+test('no args, -A option', t => {
+  shell.cd('test/resources/ls');
+  const result = shell.ls('-A');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('file1') > -1);
+  t.truthy(result.indexOf('file2') > -1);
+  t.truthy(result.indexOf('file1.js') > -1);
+  t.truthy(result.indexOf('file2.js') > -1);
+  t.truthy(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('.hidden_file') > -1);
+  t.truthy(result.indexOf('.hidden_dir') > -1);
+  t.is(result.length, 8);
+});
+
+test('no args, deprecated -a option', t => {
+  shell.cd('test/resources/ls');
+  const result = shell.ls('-a'); // (deprecated) backwards compatibility test
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('file1') > -1);
+  t.truthy(result.indexOf('file2') > -1);
+  t.truthy(result.indexOf('file1.js') > -1);
+  t.truthy(result.indexOf('file2.js') > -1);
+  t.truthy(result.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('.hidden_file') > -1);
+  t.truthy(result.indexOf('.hidden_dir') > -1);
+  t.is(result.length, 8);
+});
+
+test('wildcard, very simple', t => {
+  const result = shell.ls('test/resources/cat/*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/cat/file1') > -1);
+  t.truthy(result.indexOf('test/resources/cat/file2') > -1);
+  t.truthy(result.indexOf('test/resources/cat/file3') > -1);
+  t.truthy(result.indexOf('test/resources/cat/file4') > -1);
+  t.truthy(result.indexOf('test/resources/cat/file5') > -1);
+  t.is(result.length, 5);
+});
+
+test('wildcard, simple', t => {
+  const result = shell.ls('test/resources/ls/*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(
+    result.indexOf('test/resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+  t.is(result.indexOf('test/resources/ls/a_dir'), -1); // this shouldn't be there
+  t.truthy(result.indexOf('nada') > -1);
+  t.truthy(result.indexOf('b_dir') > -1);
+  t.is(result.length, 7);
+});
+
+test('wildcard, simple, with -d', t => {
+  const result = shell.ls('-d', 'test/resources/ls/*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(
+    result.indexOf('test/resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+  t.truthy(result.indexOf('test/resources/ls/a_dir') > -1);
+  t.is(result.length, 6);
+});
+
+test('wildcard, hidden only', t => {
+  const result = shell.ls('-d', 'test/resources/ls/.*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/.hidden_file') > -1);
+  t.truthy(result.indexOf('test/resources/ls/.hidden_dir') > -1);
+  t.is(result.length, 2);
+});
+
+test('wildcard, mid-file', t => {
+  const result = shell.ls('test/resources/ls/f*le*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 5);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(
+    result.indexOf('test/resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+});
+
+test('wildcard, mid-file with dot (should escape dot for regex)', t => {
+  const result = shell.ls('test/resources/ls/f*le*.js');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 2);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+});
+
+test('one file that exists, one that doesn\'t', t => {
+  const result = shell.ls('test/resources/ls/file1.js', 'test/resources/ls/thisdoesntexist');
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.length, 1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+});
+
+test('one file that exists, one that doesn\'t (other order)', t => {
+  const result = shell.ls('test/resources/ls/thisdoesntexist', 'test/resources/ls/file1.js');
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.length, 1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+});
+
+test('wildcard, should not do partial matches', t => {
+  const result = shell.ls('test/resources/ls/*.j'); // shouldn't get .js
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.length, 0);
+});
+
+test('wildcard, all files with extension', t => {
+  const result = shell.ls('test/resources/ls/*.*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 3);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(
+    result.indexOf('test/resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+});
+
+test('wildcard, with additional path', t => {
+  const result = shell.ls('test/resources/ls/f*le*.js', 'test/resources/ls/a_dir');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 4);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(result.indexOf('b_dir') > -1); // no wildcard == no path prefix
+  t.truthy(result.indexOf('nada') > -1); // no wildcard == no path prefix
+});
+
+test('wildcard for both paths', t => {
+  const result = shell.ls('test/resources/ls/f*le*.js', 'test/resources/ls/a_dir/*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 4);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(result.indexOf('z') > -1);
+  t.truthy(result.indexOf('test/resources/ls/a_dir/nada') > -1);
+});
+
+test('wildcard for both paths, array', t => {
+  const result = shell.ls(['test/resources/ls/f*le*.js', 'test/resources/ls/a_dir/*']);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 4);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(result.indexOf('z') > -1);
+  t.truthy(result.indexOf('test/resources/ls/a_dir/nada') > -1);
+});
+
+test('recursive, no path', t => {
+  shell.cd('test/resources/ls');
+  const result = shell.ls('-R');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir/z') > -1);
+  t.is(result.length, 9);
+});
+
+test('recursive, path given', t => {
+  const result = shell.ls('-R', 'test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir/z') > -1);
+  t.is(result.length, 9);
+});
+
+test('-RA flag, path given', t => {
+  const result = shell.ls('-RA', 'test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir/z') > -1);
+  t.truthy(result.indexOf('a_dir/.hidden_dir/nada') > -1);
+  t.is(result.length, 14);
+});
+
+test('-RA flag, symlinks are not followed', t => {
+  const result = shell.ls('-RA', 'test/resources/rm');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('a_dir/a_file') > -1);
+  t.truthy(result.indexOf('link_to_a_dir') > -1);
+  t.is(result.indexOf('link_to_a_dir/a_file'), -1);
+  t.truthy(result.indexOf('fake.lnk') > -1);
+  t.is(result.length, 4);
+});
+
+test('-RAL flag, follows symlinks', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.ls('-RAL', 'test/resources/rm');
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+    t.truthy(result.indexOf('a_dir') > -1);
+    t.truthy(result.indexOf('a_dir/a_file') > -1);
+    t.truthy(result.indexOf('link_to_a_dir') > -1);
+    t.truthy(result.indexOf('link_to_a_dir/a_file') > -1);
+    t.truthy(result.indexOf('fake.lnk') > -1);
+    t.is(result.length, 5);
+  });
+});
+
+test('-L flag, path is symlink', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.ls('-L', 'test/resources/rm/link_to_a_dir');
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+    t.truthy(result.indexOf('a_file') > -1);
+    t.is(result.length, 1);
+  });
+});
+
+test('follow links to directories by default', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.ls('test/resources/rm/link_to_a_dir');
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+    t.truthy(result.indexOf('a_file') > -1);
+    t.is(result.length, 1);
+  });
+});
+
+test('-Rd works like -d', t => {
+  const result = shell.ls('-Rd', 'test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.length, 1);
+});
+
+test('directory option, single arg', t => {
+  const result = shell.ls('-d', 'test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 1);
+});
+
+test('directory option, single arg with trailing \'/\'', t => {
+  const result = shell.ls('-d', 'test/resources/ls/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.length, 1);
+});
+
+test('directory option, multiple args', t => {
+  const result = shell.ls('-d', 'test/resources/ls/a_dir', 'test/resources/ls/file1');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/a_dir') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.is(result.length, 2);
+});
+
+test('directory option, globbed arg', t => {
+  const result = shell.ls('-d', 'test/resources/ls/*');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/ls/a_dir') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file1.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2.js') > -1);
+  t.truthy(result.indexOf('test/resources/ls/file2') > -1);
+  t.truthy(
+    result.indexOf('test/resources/ls/filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+  t.is(result.length, 6);
+});
+
+test('long option, single file', t => {
+  let result = shell.ls('-l', 'test/resources/ls/file1');
+  t.is(result.length, 1);
+  result = result[0];
+  t.falsy(shell.error());
+  t.truthy(result.name, 'file1');
+  t.is(result.nlink, 1);
+  t.is(result.size, 5);
+  t.truthy(result.mode); // check that these keys exist
+  utils.skipOnWin(t, () => {
+    t.truthy(result.uid);
+    t.truthy(result.gid);
+  });
+  t.truthy(result.mtime); // check that these keys exist
+  t.truthy(result.atime); // check that these keys exist
+  t.truthy(result.ctime); // check that these keys exist
+  t.truthy(result.toString().match(/^(\d+ +){5}.*$/));
+});
+
+test('long option, glob files', t => {
+  let result = shell.ls('-l', 'test/resources/ls/f*le1');
+  t.is(result.length, 1);
+  result = result[0];
+  t.falsy(shell.error());
+  t.truthy(result.name, 'file1');
+  t.is(result.nlink, 1);
+  t.is(result.size, 5);
+  t.truthy(result.mode); // check that these keys exist
+  utils.skipOnWin(t, () => {
+    t.truthy(result.uid);
+    t.truthy(result.gid);
+  });
+  t.truthy(result.mtime); // check that these keys exist
+  t.truthy(result.atime); // check that these keys exist
+  t.truthy(result.ctime); // check that these keys exist
+  t.truthy(result.toString().match(/^(\d+ +){5}.*$/));
+});
+
+test('long option, directory', t => {
+  let result = shell.ls('-l', 'test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  const idx = result.map(r => r.name).indexOf('file1');
+  t.truthy(idx >= 0);
+  t.is(result.length, 6);
+  result = result[idx];
+  t.is(result.name, 'file1');
+  t.is(result.nlink, 1);
+  t.is(result.size, 5);
+  t.truthy(result.mode); // check that these keys exist
+  utils.skipOnWin(t, () => {
+    t.truthy(result.uid);
+    t.truthy(result.gid);
+  });
+  t.truthy(result.mtime); // check that these keys exist
+  t.truthy(result.atime); // check that these keys exist
+  t.truthy(result.ctime); // check that these keys exist
+  t.truthy(result.toString().match(/^(\d+ +){5}.*$/));
+});
+
+test('long option, directory, recursive (and windows converts slashes)', t => {
+  let result = shell.ls('-lR', 'test/resources/ls/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  const idx = result.map(r => r.name).indexOf('a_dir/b_dir');
+  t.is(result.length, 9);
+  t.truthy(idx >= 0);
+  result = result[idx];
+  t.is(result.name, result.name);
+  t.truthy(common.statFollowLinks('test/resources/ls/a_dir/b_dir').isDirectory());
+  t.is(typeof result.nlink, 'number'); // This can vary between the local machine and travis
+  t.is(typeof result.size, 'number'); // This can vary between different file systems
+  t.truthy(result.mode); // check that these keys exist
+  utils.skipOnWin(t, () => {
+    t.truthy(result.uid);
+    t.truthy(result.gid);
+  });
+  t.truthy(result.mtime); // check that these keys exist
+  t.truthy(result.atime); // check that these keys exist
+  t.truthy(result.ctime); // check that these keys exist
+  t.truthy(result.toString().match(/^(\d+ +){5}.*$/));
+});
+
+test('still lists broken links', t => {
+  const result = shell.ls('test/resources/badlink');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('test/resources/badlink') > -1);
+  t.is(result.length, 1);
+});
+
+test('Test new ShellString-like attributes', t => {
+  const result = shell.ls('test/resources/ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.stdout.indexOf('file1') > -1);
+  t.truthy(result.stdout.indexOf('file2') > -1);
+  t.truthy(result.stdout.indexOf('file1.js') > -1);
+  t.truthy(result.stdout.indexOf('file2.js') > -1);
+  t.truthy(
+    result.stdout.indexOf('filename(with)[chars$]^that.must+be-escaped') > -1
+  );
+  t.truthy(result.stdout.indexOf('a_dir') > -1);
+  t.is(typeof result.stdout, 'string');
+  t.truthy(result.to);
+  t.truthy(result.toEnd);
+  result.to(`${t.context.tmp}/testingToOutput.txt`);
+  t.is(shell.cat(`${t.context.tmp}/testingToOutput.txt`).toString(), result.stdout);
+  shell.rm(`${t.context.tmp}/testingToOutput.txt`);
+});
+
+test('No trailing newline for ls() on empty directories', t => {
+  shell.mkdir('foo');
+  t.falsy(shell.error());
+  const result = shell.ls('foo');
+  t.falsy(shell.error());
+  t.is(result.stdout, '');
+  shell.rm('-r', 'foo');
+  t.falsy(shell.error());
+});
+
+test('Check stderr field', t => {
+  t.falsy(fs.existsSync('/asdfasdf')); // sanity check
+  const result = shell.ls('test/resources/ls/file1', '/asdfasdf');
+  t.truthy(shell.error());
+  t.is('ls: no such file or directory: /asdfasdf', result.stderr);
+});
+
+test('non-normalized paths are still ok with -R', t => {
+  const result = shell.ls('-R', 'test/resources/./ls/../ls');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(result.indexOf('a_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir') > -1);
+  t.truthy(result.indexOf('a_dir/b_dir/z') > -1);
+  t.is(result.length, 9);
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mkdir.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mkdir.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mkdir.js	(working copy)
@@ -1,79 +1,205 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import common from '../src/common';
+import utils from './utils/utils';
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+});
 
-shell.config.silent = true;
-
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-shell.mkdir();
-assert.ok(shell.error());
-
-var mtime = fs.statSync('tmp').mtime.toString();
-shell.mkdir('tmp'); // dir already exists
-assert.ok(shell.error());
-assert.equal(fs.statSync('tmp').mtime.toString(), mtime); // didn't mess with dir
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.mkdir('/asdfasdf/asdfasdf'); // root path does not exist
-assert.ok(shell.error());
-assert.equal(fs.existsSync('/asdfasdf'), false);
+test('no args', t => {
+  const result = shell.mkdir();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: no paths given');
+});
+
+test('dir already exists', t => {
+  const mtime = common.statFollowLinks(t.context.tmp).mtime.toString();
+  const result = shell.mkdir(t.context.tmp); // dir already exists
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, `mkdir: path already exists: ${t.context.tmp}`);
+  t.is(common.statFollowLinks(t.context.tmp).mtime.toString(), mtime); // didn't mess with dir
+});
+
+test('Can\'t overwrite a broken link', t => {
+  const mtime = common.statNoFollowLinks('test/resources/badlink').mtime.toString();
+  const result = shell.mkdir('test/resources/badlink');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: path already exists: test/resources/badlink');
+  t.is(common.statNoFollowLinks('test/resources/badlink').mtime.toString(), mtime); // didn't mess with file
+});
+
+test('root path does not exist', t => {
+  t.falsy(fs.existsSync('/asdfasdf')); // sanity check
+  const result = shell.mkdir('/asdfasdf/foobar'); // root path does not exist
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: no such file or directory: /asdfasdf');
+  t.falsy(fs.existsSync('/asdfasdf'));
+  t.falsy(fs.existsSync('/asdfasdf/foobar'));
+});
+
+test('try to overwrite file', t => {
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+  const result = shell.mkdir('test/resources/file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: path already exists: test/resources/file1');
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+});
+
+test('try to overwrite file, with -p', t => {
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+  const result = shell.mkdir('-p', 'test/resources/file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: cannot create directory test/resources/file1: File exists');
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+});
+
+test('try to make a subdirectory of a file', t => {
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+  const result = shell.mkdir('test/resources/file1/subdir');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mkdir: cannot create directory test/resources/file1/subdir: Not a directory');
+  t.truthy(common.statFollowLinks('test/resources/file1').isFile());
+  t.falsy(fs.existsSync('test/resources/file1/subdir'));
+});
+
+test('Check for invalid permissions', t => {
+  utils.skipOnWin(t, () => {
+    // This test case only works on unix, but should work on Windows as well
+    const dirName = 'nowritedir';
+    shell.mkdir(dirName);
+    t.falsy(shell.error());
+    shell.chmod('-w', dirName);
+    const result = shell.mkdir(dirName + '/foo');
+    t.is(result.code, 1);
+    t.is(
+      result.stderr,
+      'mkdir: cannot create directory nowritedir/foo: Permission denied'
+    );
+    t.truthy(shell.error());
+    t.falsy(fs.existsSync(dirName + '/foo'));
+    shell.rm('-rf', dirName); // clean up
+  });
+});
 
 //
 // Valids
 //
 
-assert.equal(fs.existsSync('tmp/t1'), false);
-shell.mkdir('tmp/t1'); // simple dir
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/t1'), true);
-
-assert.equal(fs.existsSync('tmp/t2'), false);
-assert.equal(fs.existsSync('tmp/t3'), false);
-shell.mkdir('tmp/t2', 'tmp/t3'); // multiple dirs
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/t2'), true);
-assert.equal(fs.existsSync('tmp/t3'), true);
-
-assert.equal(fs.existsSync('tmp/t1'), true);
-assert.equal(fs.existsSync('tmp/t4'), false);
-shell.mkdir('tmp/t1', 'tmp/t4'); // one dir exists, one doesn't
-assert.equal(numLines(shell.error()), 1);
-assert.equal(fs.existsSync('tmp/t1'), true);
-assert.equal(fs.existsSync('tmp/t4'), true);
-
-assert.equal(fs.existsSync('tmp/a'), false);
-shell.mkdir('-p', 'tmp/a/b/c');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-shell.rm('-Rf', 'tmp/a'); // revert
-
-// multiple dirs
-shell.mkdir('-p', 'tmp/zzza', 'tmp/zzzb', 'tmp/zzzc');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/zzza'), true);
-assert.equal(fs.existsSync('tmp/zzzb'), true);
-assert.equal(fs.existsSync('tmp/zzzc'), true);
-
-// multiple dirs, array syntax
-shell.mkdir('-p', ['tmp/yyya', 'tmp/yyyb', 'tmp/yyyc']);
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/yyya'), true);
-assert.equal(fs.existsSync('tmp/yyyb'), true);
-assert.equal(fs.existsSync('tmp/yyyc'), true);
-
-shell.exit(123);
+test('basic usage', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/t1`));
+  const result = shell.mkdir(`${t.context.tmp}/t1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/t1`));
+});
+
+test('multiple dirs', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/t2`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/t3`));
+  const result = shell.mkdir(`${t.context.tmp}/t2`, `${t.context.tmp}/t3`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/t2`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/t3`));
+});
+
+test('one dir exists, the other does not', t => {
+  shell.mkdir(`${t.context.tmp}/t1`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/t1`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/t4`));
+  const result = shell.mkdir(`${t.context.tmp}/t1`, `${t.context.tmp}/t4`);
+  t.is(result.code, 1);
+  t.is(utils.numLines(shell.error()), 1);
+  t.truthy(fs.existsSync(`${t.context.tmp}/t1`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/t4`));
+});
+
+test('-p flag', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`));
+  const result = shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  shell.rm('-Rf', `${t.context.tmp}/a`); // revert
+});
+
+test('-p flag: multiple dirs', t => {
+  const result = shell.mkdir('-p', `${t.context.tmp}/zzza`,
+    `${t.context.tmp}/zzzb`, `${t.context.tmp}/zzzc`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/zzza`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/zzzb`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/zzzc`));
+});
+
+test('-p flag: multiple dirs, array syntax', t => {
+  const result = shell.mkdir('-p', [`${t.context.tmp}/yyya`,
+    `${t.context.tmp}/yyyb`, `${t.context.tmp}/yyyc`]);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/yyya`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/yyyb`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/yyyc`));
+});
+
+test('-p flag: subdirectory already exists', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/d1`));
+  shell.mkdir('-p', `${t.context.tmp}/d1/d2/d3`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/d1/d2/d3`));
+  const result = shell.mkdir('-p', `${t.context.tmp}/d1/d2`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/d1/d2/d3`));
+});
+
+test('-p flag: create directory in subdirectory', t => {
+  t.falsy(fs.existsSync(`${t.context.tmp}/d1`));
+  shell.mkdir('-p', `${t.context.tmp}/d1/d2`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/d1/d2`));
+  const result = shell.mkdir('-p', `${t.context.tmp}/d1/d2/d3`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/d1/d2/d3`));
+});
+
+test('globbed dir', t => {
+  let result = shell.mkdir('-p', `${t.context.tmp}/mydir`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/mydir`));
+  result = shell.mkdir('-p', `${t.context.tmp}/m*ir`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/mydir`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/m*ir`)); // doesn't create literal name
+});
+
+test('non-normalized paths are still ok with -p', t => {
+  const result = shell.mkdir('-p', `${t.context.tmp}/asdf/../asdf/./`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.truthy(fs.existsSync(`${t.context.tmp}/asdf`));
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mv.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mv.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/mv.js	(working copy)
@@ -1,130 +1,235 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
-shell.config.silent = true;
+const CWD = process.cwd();
+const numLines = utils.numLines;
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.cp('-r', 'test/resources', t.context.tmp);
+  shell.cd(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  process.chdir(CWD);
+  shell.rm('-rf', t.context.tmp);
+});
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
-// Prepare tmp/
-shell.cp('resources/*', 'tmp');
 
 //
 // Invalids
 //
 
-shell.mv();
-assert.ok(shell.error());
-
-shell.mv('file1');
-assert.ok(shell.error());
-
-shell.mv('-f');
-assert.ok(shell.error());
-
-shell.mv('-Z', 'tmp/file1', 'tmp/file1'); // option not supported
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file1'), true);
-
-shell.mv('asdfasdf', 'tmp'); // source does not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 1);
-assert.equal(fs.existsSync('tmp/asdfasdf'), false);
-
-shell.mv('asdfasdf1', 'asdfasdf2', 'tmp'); // sources do not exist
-assert.ok(shell.error());
-assert.equal(numLines(shell.error()), 2);
-assert.equal(fs.existsSync('tmp/asdfasdf1'), false);
-assert.equal(fs.existsSync('tmp/asdfasdf2'), false);
-
-shell.mv('asdfasdf1', 'asdfasdf2', 'tmp/file1'); // too many sources (dest is file)
-assert.ok(shell.error());
-
-shell.mv('tmp/file1', 'tmp/file2'); // dest already exists
-assert.ok(shell.error());
-
-shell.mv('tmp/file1', 'tmp/file2', 'tmp/a_file'); // too many sources (exist, but dest is file)
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/a_file'), false);
-
-shell.mv('tmp/file*', 'tmp/file1'); // can't use wildcard when dest is file
-assert.ok(shell.error());
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-assert.equal(fs.existsSync('tmp/file1.js'), true);
-assert.equal(fs.existsSync('tmp/file2.js'), true);
+test('no args', t => {
+  const result = shell.mv();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: missing <source> and/or <dest>');
+});
+
+test('one arg', t => {
+  const result = shell.mv('file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: missing <source> and/or <dest>');
+});
+
+test('option only', t => {
+  const result = shell.mv('-f');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: missing <source> and/or <dest>');
+});
+
+test('option not supported', t => {
+  t.truthy(fs.existsSync('file1')); // precondition
+  const result = shell.mv('-Z', 'file1', 'file1');
+  t.truthy(shell.error());
+  t.truthy(fs.existsSync('file1'));
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: option not recognized: Z');
+});
+
+test('source does not exist', t => {
+  const result = shell.mv('asdfasdf', '..');
+  t.truthy(shell.error());
+  t.is(numLines(shell.error()), 1);
+  t.falsy(fs.existsSync('../asdfasdf'));
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: no such file or directory: asdfasdf');
+});
+
+test('sources do not exist', t => {
+  const result = shell.mv('asdfasdf1', 'asdfasdf2', '..');
+  t.truthy(shell.error());
+  t.is(numLines(shell.error()), 2);
+  t.falsy(fs.existsSync('../asdfasdf1'));
+  t.falsy(fs.existsSync('../asdfasdf2'));
+  t.is(result.code, 1);
+  t.is(
+    result.stderr,
+    'mv: no such file or directory: asdfasdf1\nmv: no such file or directory: asdfasdf2'
+  );
+});
+
+test('too many sources (dest is file)', t => {
+  const result = shell.mv('asdfasdf1', 'asdfasdf2', 'file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest is not a directory (too many sources)');
+});
+
+test('-n is no-force/no-clobber', t => {
+  const result = shell.mv('-n', 'file1', 'file2');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest file already exists: file2');
+});
+
+test('-n option with a directory as the destination', t => {
+  shell.cp('file1', 'cp'); // copy it so we're sure it's already there
+  const result = shell.mv('-n', 'file1', 'cp');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest file already exists: cp/file1');
+});
+
+test('-f is the default behavior', t => {
+  const result = shell.mv('file1', 'file2'); // dest already exists (but that's ok)
+  t.falsy(shell.error());
+  t.falsy(result.stderr);
+  t.is(result.code, 0);
+});
+
+test('-fn is the same as -n', t => {
+  const result = shell.mv('-fn', 'file1', 'file2');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest file already exists: file2');
+});
+
+test('too many sources (exist, but dest is file)', t => {
+  const result = shell.mv('file1', 'file2', 'a_file');
+  t.truthy(shell.error());
+  t.falsy(fs.existsSync('a_file'));
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest is not a directory (too many sources)');
+});
+
+test('can\'t use wildcard when dest is file', t => {
+  const result = shell.mv('file*', 'file1');
+  t.truthy(shell.error());
+  t.truthy(fs.existsSync('file1'));
+  t.truthy(fs.existsSync('file2'));
+  t.truthy(fs.existsSync('file1.js'));
+  t.truthy(fs.existsSync('file2.js'));
+  t.is(result.code, 1);
+  t.is(result.stderr, 'mv: dest is not a directory (too many sources)');
+});
 
 //
 // Valids
 //
 
-shell.cd('tmp');
-
-// handles self OK
-shell.mkdir('tmp2');
-shell.mv('*', 'tmp2'); // has to handle self (tmp2 --> tmp2) without throwing error
-assert.ok(shell.error()); // there's an error, but not fatal
-assert.equal(fs.existsSync('tmp2/file1'), true); // moved OK
-shell.mv('tmp2/*', '.'); // revert
-assert.equal(fs.existsSync('file1'), true); // moved OK
-
-shell.mv('file1', 'file3'); // one source
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), false);
-assert.equal(fs.existsSync('file3'), true);
-shell.mv('file3', 'file1'); // revert
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), true);
-
-// two sources
-shell.rm('-rf', 't');
-shell.mkdir('-p', 't');
-shell.mv('file1', 'file2', 't');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), false);
-assert.equal(fs.existsSync('file2'), false);
-assert.equal(fs.existsSync('t/file1'), true);
-assert.equal(fs.existsSync('t/file2'), true);
-shell.mv('t/*', '.'); // revert
-assert.equal(fs.existsSync('file1'), true);
-assert.equal(fs.existsSync('file2'), true);
-
-// two sources, array style
-shell.rm('-rf', 't');
-shell.mkdir('-p', 't');
-shell.mv(['file1', 'file2'], 't'); // two sources
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), false);
-assert.equal(fs.existsSync('file2'), false);
-assert.equal(fs.existsSync('t/file1'), true);
-assert.equal(fs.existsSync('t/file2'), true);
-shell.mv('t/*', '.'); // revert
-assert.equal(fs.existsSync('file1'), true);
-assert.equal(fs.existsSync('file2'), true);
-
-shell.mv('file*.js', 't'); // wildcard
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1.js'), false);
-assert.equal(fs.existsSync('file2.js'), false);
-assert.equal(fs.existsSync('t/file1.js'), true);
-assert.equal(fs.existsSync('t/file2.js'), true);
-shell.mv('t/*', '.'); // revert
-assert.equal(fs.existsSync('file1.js'), true);
-assert.equal(fs.existsSync('file2.js'), true);
-
-shell.mv('-f', 'file1', 'file2'); // dest exists, but -f given
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('file1'), false);
-assert.equal(fs.existsSync('file2'), true);
-
-shell.exit(123);
+test('handles self OK', t => {
+  const tmp2 = `${t.context.tmp}-2`;
+  shell.mkdir(tmp2);
+  let result = shell.mv('*', tmp2); // has to handle self (tmp2 --> tmp2) without throwing error
+  t.truthy(shell.error()); // there's an error, but not fatal
+  t.truthy(fs.existsSync(`${tmp2}/file1`)); // moved OK
+  t.is(result.code, 1);
+  result = shell.mv(`${tmp2}/*`, '.'); // revert
+  t.truthy(fs.existsSync('file1')); // moved OK
+  t.is(result.code, 0);
+});
+
+test('one source', t => {
+  let result = shell.mv('file1', 'file3');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync('file1'));
+  t.truthy(fs.existsSync('file3'));
+  result = shell.mv('file3', 'file1'); // revert
+  t.falsy(shell.error());
+  t.truthy(fs.existsSync('file1'));
+  t.is(result.code, 0);
+});
+
+test('two sources', t => {
+  const result = shell.mv('file1', 'file2', 'cp');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync('file1'));
+  t.falsy(fs.existsSync('file2'));
+  t.truthy(fs.existsSync('cp/file1'));
+  t.truthy(fs.existsSync('cp/file2'));
+});
+
+test('two sources, array style', t => {
+  shell.rm('-rf', 't');
+  shell.mkdir('-p', 't');
+  let result = shell.mv(['file1', 'file2'], 't'); // two sources
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync('file1'));
+  t.falsy(fs.existsSync('file2'));
+  t.truthy(fs.existsSync('t/file1'));
+  t.truthy(fs.existsSync('t/file2'));
+  result = shell.mv('t/*', '.'); // revert
+  t.truthy(fs.existsSync('file1'));
+  t.truthy(fs.existsSync('file2'));
+});
+
+test('wildcard', t => {
+  shell.mkdir('-p', 't');
+  let result = shell.mv('file*.js', 't'); // wildcard
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync('file1.js'));
+  t.falsy(fs.existsSync('file2.js'));
+  t.truthy(fs.existsSync('t/file1.js'));
+  t.truthy(fs.existsSync('t/file2.js'));
+  result = shell.mv('t/*', '.'); // revert
+  t.truthy(fs.existsSync('file1.js'));
+  t.truthy(fs.existsSync('file2.js'));
+});
+
+test('dest exists, but -f given', t => {
+  const result = shell.mv('-f', 'file1', 'file2');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync('file1'));
+  t.truthy(fs.existsSync('file2'));
+});
+
+test('should not overwrite recently created files', t => {
+  shell.mkdir('-p', 't');
+  const result = shell.mv('file1', 'cp/file1', 't/');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+
+  // Ensure First file is copied
+  t.is(shell.cat('t/file1').toString(), 'test1');
+  t.is(
+    result.stderr,
+    "mv: will not overwrite just-created 't/file1' with 'cp/file1'"
+  );
+  t.truthy(fs.existsSync('cp/file1'));
+});
+
+
+test('should not overwrite recently created files (not give error no-force mode)', t => {
+  shell.mkdir('-p', 't');
+  const result = shell.mv('-n', 'file1', 'cp/file1', 't/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+
+  // Ensure First file is moved
+  t.is(shell.cat('t/file1').toString(), 'test1');
+  t.truthy(fs.existsSync('cp/file1'));
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/popd.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/popd.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/popd.js	(working copy)
@@ -1,118 +1,155 @@
-var shell = require('..');
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import mocks from './utils/mocks';
 
-shell.config.silent = true;
-
-var root = path.resolve(), trail;
+const rootDir = path.resolve();
 
 function reset() {
-    shell.dirs('-c');
-    shell.cd(root);
+  shell.dirs('-c');
+  shell.cd(rootDir);
 }
 
-// Valid
-shell.pushd('resources/pushd');
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ root ]);
-
-shell.pushd('resources/pushd');
-shell.pushd('a');
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-shell.pushd('b');
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-shell.pushd('b');
-shell.pushd('c');
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(trail.length, 1);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ root ]);
-
-// Valid by index
-shell.pushd('resources/pushd');
-trail = shell.popd('+0');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ root ]);
-
-shell.pushd('resources/pushd');
-trail = shell.popd('+1');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ path.resolve(root, 'resources/pushd') ]);
-
-reset(); shell.pushd('resources/pushd');
-trail = shell.popd('-0');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ path.resolve(root, 'resources/pushd') ]);
-
-reset(); shell.pushd('resources/pushd');
-trail = shell.popd('-1');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ root ]);
-
-
-reset(); shell.pushd('resources/pushd');
-trail = shell.popd('-n');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [ path.resolve(root, 'resources/pushd') ]);
-
-// Invalid
-trail = shell.popd();
-assert.ok(shell.error('popd: directory stack empty\n'));
-
-// Test that the root dir is not stored
-shell.cd('resources/pushd');
-shell.pushd('b');
-trail = shell.popd();
-assert.equal(shell.error(), null);
-assert.equal(trail[0], path.resolve(root, 'resources/pushd'));
-assert.equal(process.cwd(), trail[0]);
-shell.popd();
-assert.ok(shell.error(), null);
-
-shell.cd(root);
-
-shell.exit(123);
\ No newline at end of file
+test.beforeEach(() => {
+  shell.config.resetForTesting();
+  reset();
+});
+
+
+test.after.always(() => {
+  reset();
+});
+
+//
+// Valids
+//
+
+test('basic usage', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd();
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [rootDir]);
+});
+
+test('two directories on the stack', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  const trail = shell.popd();
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('three directories on the stack', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('b');
+  shell.pushd('c');
+  const trail = shell.popd();
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Valid by index', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd('+0');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [rootDir]);
+});
+
+test('Using +1 option', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd('+1');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [path.resolve(rootDir, 'test/resources/pushd')]);
+});
+
+test('Using -0 option', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd('-0');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [path.resolve(rootDir, 'test/resources/pushd')]);
+});
+
+test('Using -1 option', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd('-1');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [rootDir]);
+});
+
+test('Using -n option', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.popd('-n');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [path.resolve(rootDir, 'test/resources/pushd')]);
+});
+
+test('Popping an empty stack', t => {
+  shell.popd();
+  t.truthy(shell.error('popd: directory stack empty\n'));
+});
+
+test('Test that rootDir is not stored', t => {
+  shell.cd('test/resources/pushd');
+  shell.pushd('b');
+  const trail = shell.popd();
+  t.falsy(shell.error());
+  t.is(trail[0], path.resolve(rootDir, 'test/resources/pushd'));
+  t.is(process.cwd(), trail[0]);
+  shell.popd(); // no more in the stack
+  t.truthy(shell.error());
+});
+
+test('quiet mode off', t => {
+  try {
+    shell.pushd('test/resources/pushd');
+    shell.config.silent = false;
+    mocks.init();
+    const trail = shell.popd();
+    const stdout = mocks.stdout();
+    const stderr = mocks.stderr();
+    t.falsy(shell.error());
+    t.is(stdout, '');
+    t.is(stderr, `${rootDir}\n`);
+    t.is(process.cwd(), trail[0]);
+    t.deepEqual(trail, [rootDir]);
+  } finally {
+    shell.config.silent = true;
+    mocks.restore();
+  }
+});
+
+test('quiet mode on', t => {
+  try {
+    shell.pushd('test/resources/pushd');
+    shell.config.silent = false;
+    mocks.init();
+    const trail = shell.popd('-q');
+    const stdout = mocks.stdout();
+    const stderr = mocks.stderr();
+    t.falsy(shell.error());
+    t.is(stdout, '');
+    t.is(stderr, '');
+    t.is(process.cwd(), trail[0]);
+    t.deepEqual(trail, [rootDir]);
+  } finally {
+    shell.config.silent = true;
+    mocks.restore();
+  }
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pushd.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pushd.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pushd.js	(working copy)
@@ -1,228 +1,373 @@
-var shell = require('..');
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import mocks from './utils/mocks';
 
-shell.config.silent = true;
-
-var root = path.resolve(), trail;
+const rootDir = path.resolve();
 
 function reset() {
-    shell.dirs('-c');
-    shell.cd(root);
+  shell.dirs('-c');
+  shell.cd(rootDir);
 }
 
-// Push valid directories
-trail = shell.pushd('resources/pushd');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.pushd('a');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.pushd('../b');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.pushd('c');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-// Push stuff around with positive indices
-trail = shell.pushd('+0');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.pushd('+1');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root,
-    path.resolve(root, 'resources/pushd/b/c')
-]);
-
-trail = shell.pushd('+2');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd'),
-    root,
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a')
-]);
-
-trail = shell.pushd('+3');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root,
-    path.resolve(root, 'resources/pushd/b/c')
-]);
-
-trail = shell.pushd('+4');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-// Push stuff around with negative indices
-trail = shell.pushd('-0');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    root,
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd')
-]);
-
-trail = shell.pushd('-1');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root,
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b')
-]);
-
-trail = shell.pushd('-2');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    root,
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd')
-]);
-
-trail = shell.pushd('-3');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-trail = shell.pushd('-4');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    path.resolve(root, 'resources/pushd/b/c'),
-    path.resolve(root, 'resources/pushd/b'),
-    path.resolve(root, 'resources/pushd/a'),
-    path.resolve(root, 'resources/pushd'),
-    root
-]);
-
-// Push without changing directory or resolving paths
-reset(); trail = shell.pushd('-n', 'resources/pushd');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    root,
-    'resources/pushd'
-]);
-
-trail = shell.pushd('-n', 'resources/pushd/a');
-assert.equal(shell.error(), null);
-assert.equal(process.cwd(), trail[0]);
-assert.deepEqual(trail, [
-    root,
-    'resources/pushd/a',
-    'resources/pushd'
-]);
-
-// Push invalid directory
-shell.pushd('does/not/exist');
-assert.equal(shell.error(), 'pushd: no such file or directory: ' + path.resolve('.', 'does/not/exist') + '\n');
-assert.equal(process.cwd(), trail[0]);
-
-// Push without arguments should swap top two directories when stack length is 2
-reset(); trail = shell.pushd('resources/pushd');
-assert.equal(shell.error(), null);
-assert.equal(trail.length, 2);
-assert.equal(path.relative(root, trail[0]), 'resources/pushd');
-assert.equal(trail[1], root);
-assert.equal(process.cwd(), trail[0]);
-trail = shell.pushd();
-assert.equal(shell.error(), null);
-assert.equal(trail.length, 2);
-assert.equal(trail[0], root);
-assert.equal(path.relative(root, trail[1]), 'resources/pushd');
-assert.equal(process.cwd(), trail[0]);
-
-// Push without arguments should swap top two directories when stack length is > 2
-trail = shell.pushd('resources/pushd/a');
-assert.equal(shell.error(), null);
-assert.equal(trail.length, 3);
-assert.equal(path.relative(root, trail[0]), 'resources/pushd/a');
-assert.equal(trail[1], root);
-assert.equal(path.relative(root, trail[2]), 'resources/pushd');
-assert.equal(process.cwd(), trail[0]);
-
-trail = shell.pushd();
-assert.equal(shell.error(), null);
-assert.equal(trail.length, 3);
-assert.equal(trail[0], root);
-assert.equal(path.relative(root, trail[1]), 'resources/pushd/a');
-assert.equal(path.relative(root, trail[2]), 'resources/pushd');
-assert.equal(process.cwd(), trail[0]);
-
-// Push without arguments invalid when stack is empty
-reset(); shell.pushd();
-assert.equal(shell.error(), 'pushd: no other directory\n');
-
-shell.exit(123);
\ No newline at end of file
+test.beforeEach(() => {
+  shell.config.resetForTesting();
+  reset();
+});
+
+test.after.always(() => {
+  reset();
+});
+
+//
+// Valids
+//
+
+test('Push valid directories', t => {
+  const trail = shell.pushd('test/resources/pushd');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Two directories', t => {
+  shell.pushd('test/resources/pushd');
+  const trail = shell.pushd('a');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Three directories', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  const trail = shell.pushd('../b');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Four directories', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  const trail = shell.pushd('c');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Push stuff around with positive indices', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('+0');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('+1 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('+1');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+  ]);
+});
+
+test('+2 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('+2');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+  ]);
+});
+
+test('+3 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('+3');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+  ]);
+});
+
+test('+4 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('+4');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+  ]);
+});
+
+test('Push stuff around with negative indices', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('-0');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+  ]);
+});
+
+test('-1 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('-1');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+  ]);
+});
+
+test('-2 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('-2');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+  ]);
+});
+
+test('-3 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('-3');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+  ]);
+});
+
+test('-4 option', t => {
+  shell.pushd('test/resources/pushd');
+  shell.pushd('a');
+  shell.pushd('../b');
+  shell.pushd('c');
+  const trail = shell.pushd('-4');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    path.resolve(rootDir, 'test/resources/pushd/b/c'),
+    path.resolve(rootDir, 'test/resources/pushd/b'),
+    path.resolve(rootDir, 'test/resources/pushd/a'),
+    path.resolve(rootDir, 'test/resources/pushd'),
+    rootDir,
+  ]);
+});
+
+test('Push without changing directory or resolving paths', t => {
+  const trail = shell.pushd('-n', 'test/resources/pushd');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    rootDir,
+    'test/resources/pushd',
+  ]);
+});
+
+test('Using the -n option with a non-empty stack', t => {
+  shell.pushd('-n', 'test/resources/pushd');
+  const trail = shell.pushd('-n', 'test/resources/pushd/a');
+  t.falsy(shell.error());
+  t.is(process.cwd(), trail[0]);
+  t.deepEqual(trail, [
+    rootDir,
+    'test/resources/pushd/a',
+    'test/resources/pushd',
+  ]);
+});
+
+test('Push invalid directory', t => {
+  const oldCwd = process.cwd();
+  shell.pushd('does/not/exist');
+  t.is(
+    shell.error(),
+    `pushd: no such file or directory: ${path.resolve('.', 'does/not/exist')
+      .replace(/\\/g, '/')}`
+  );
+  t.is(process.cwd(), oldCwd);
+});
+
+test(
+  'Push without args swaps top two directories when stack length is 2',
+  t => {
+    let trail = shell.pushd('test/resources/pushd');
+    t.falsy(shell.error());
+    t.is(trail.length, 2);
+    t.is(path.relative(rootDir, trail[0]), path.join('test/resources', 'pushd'));
+    t.is(trail[1], rootDir);
+    t.is(process.cwd(), trail[0]);
+    trail = shell.pushd();
+    t.falsy(shell.error());
+    t.is(trail.length, 2);
+    t.is(trail[0], rootDir);
+    t.is(path.relative(rootDir, trail[1]), path.join('test/resources', 'pushd'));
+    t.is(process.cwd(), trail[0]);
+  }
+);
+
+test(
+  'Push without args swaps top two directories for larger stacks',
+  t => {
+    shell.pushd('test/resources/pushd');
+    shell.pushd();
+    const trail = shell.pushd('test/resources/pushd/a');
+    t.falsy(shell.error());
+    t.is(trail.length, 3);
+    t.is(path.relative(rootDir, trail[0]), path.join('test/resources', 'pushd', 'a'));
+    t.is(trail[1], rootDir);
+    t.is(path.relative(rootDir, trail[2]), path.join('test/resources', 'pushd'));
+    t.is(process.cwd(), trail[0]);
+  }
+);
+
+test('Pushing with no args', t => {
+  shell.pushd('-n', 'test/resources/pushd');
+  shell.pushd('test/resources/pushd/a');
+  const trail = shell.pushd();
+  t.falsy(shell.error());
+  t.is(trail.length, 3);
+  t.is(trail[0], rootDir);
+  t.is(path.relative(rootDir, trail[1]), path.join('test/resources', 'pushd', 'a'));
+  t.is(path.relative(rootDir, trail[2]), path.join('test/resources', 'pushd'));
+  t.is(process.cwd(), trail[0]);
+});
+
+test('Push without arguments invalid when stack is empty', t => {
+  shell.pushd();
+  t.is(shell.error(), 'pushd: no other directory');
+});
+
+test('quiet mode off', t => {
+  try {
+    shell.config.silent = false;
+    mocks.init();
+    const trail = shell.pushd('test/resources/pushd');
+    const stdout = mocks.stdout();
+    const stderr = mocks.stderr();
+    t.falsy(shell.error());
+    t.is(stdout, '');
+    t.is(stderr, `${path.resolve(rootDir, 'test/resources/pushd')} ${rootDir}\n`);
+    t.is(process.cwd(), trail[0]);
+    t.deepEqual(trail, [
+      path.resolve(rootDir, 'test/resources/pushd'),
+      rootDir,
+    ]);
+  } finally {
+    shell.config.silent = true;
+    mocks.restore();
+  }
+});
+
+test('quiet mode on', t => {
+  try {
+    shell.config.silent = false;
+    mocks.init();
+    const trail = shell.pushd('-q', 'test/resources/pushd');
+    const stdout = mocks.stdout();
+    const stderr = mocks.stderr();
+    t.falsy(shell.error());
+    t.is(stdout, '');
+    t.is(stderr, '');
+    t.is(process.cwd(), trail[0]);
+    t.deepEqual(trail, [
+      path.resolve(rootDir, 'test/resources/pushd'),
+      rootDir,
+    ]);
+  } finally {
+    shell.config.silent = true;
+    mocks.restore();
+  }
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pwd.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pwd.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/pwd.js	(working copy)
@@ -1,28 +1,41 @@
-var shell = require('..');
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path');
+import test from 'ava';
 
-shell.config.silent = true;
+import shell from '..';
+import utils from './utils/utils';
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
+const cur = process.cwd();
+
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  process.chdir(cur);
+  shell.rm('-rf', t.context.tmp);
+});
 
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Valids
 //
 
-var _pwd = shell.pwd();
-assert.equal(shell.error(), null);
-assert.equal(_pwd, path.resolve('.'));
-
-shell.cd('tmp');
-var _pwd = shell.pwd();
-assert.equal(shell.error(), null);
-assert.equal(path.basename(_pwd), 'tmp');
-
-shell.exit(123);
+test('initial directory', t => {
+  const cwd = shell.pwd();
+  t.falsy(shell.error());
+  t.is(cwd.code, 0);
+  t.falsy(cwd.stderr);
+  t.is(cwd.toString(), path.resolve('.'));
+});
+
+test('after changing directory', t => {
+  shell.cd(t.context.tmp);
+  const cwd = shell.pwd();
+  t.is(cwd.code, 0);
+  t.falsy(cwd.stderr);
+  t.falsy(shell.error());
+  t.is(path.basename(cwd.toString()), t.context.tmp);
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/rm.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/rm.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/rm.js	(working copy)
@@ -1,183 +1,310 @@
-var shell = require('..');
+import fs from 'fs';
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
-shell.config.silent = true;
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.cp('-r', 'test/resources', t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+});
 
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-shell.rm();
-assert.ok(shell.error());
-
-shell.rm('asdfasdf'); // file does not exist
-assert.ok(shell.error());
-
-shell.rm('-f'); // no file
-assert.ok(shell.error());
-
-shell.rm('-@', 'resources/file1'); // invalid option
-assert.ok(shell.error());
-assert.equal(fs.existsSync('resources/file1'), true);
+test('no args', t => {
+  const result = shell.rm();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'rm: no paths given');
+});
+
+test('file does not exist', t => {
+  const result = shell.rm('asdfasdf');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'rm: no such file or directory: asdfasdf');
+});
+
+test('cannot delete a directoy without recursive flag', t => {
+  const result = shell.rm(`${t.context.tmp}/rm`);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'rm: path is a directory');
+});
+
+test('only an option', t => {
+  const result = shell.rm('-f');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.is(result.stderr, 'rm: no paths given');
+});
+
+test('invalid option', t => {
+  const result = shell.rm('-@', 'test/resources/file1');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.truthy(fs.existsSync('test/resources/file1'));
+  t.is(result.stderr, 'rm: option not recognized: @');
+});
 
 //
 // Valids
 //
 
-// file does not exist, but -f specified
-shell.rm('-f', 'asdfasdf');
-assert.equal(shell.error(), null);
-
-// simple rm
-shell.cp('-f', 'resources/file1', 'tmp/file1');
-assert.equal(fs.existsSync('tmp/file1'), true);
-shell.rm('tmp/file1');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), false);
-
-// recursive dir removal - small-caps '-r'
-shell.mkdir('-p', 'tmp/a/b/c');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-shell.rm('-rf', 'tmp/a');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/a'), false);
-
-// recursive dir removal - capital '-R'
-shell.mkdir('-p', 'tmp/a/b/c');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-shell.rm('-Rf', 'tmp/a');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/a'), false);
-
-// recursive dir removal - absolute path
-shell.mkdir('-p', 'tmp/a/b/c');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-shell.rm('-Rf', path.resolve('./tmp/a'));
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/a'), false);
-
-// wildcard
-shell.cp('-f', 'resources/file*', 'tmp');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), true);
-assert.equal(fs.existsSync('tmp/file2'), true);
-assert.equal(fs.existsSync('tmp/file1.js'), true);
-assert.equal(fs.existsSync('tmp/file2.js'), true);
-shell.rm('tmp/file*');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync('tmp/file1'), false);
-assert.equal(fs.existsSync('tmp/file2'), false);
-assert.equal(fs.existsSync('tmp/file1.js'), false);
-assert.equal(fs.existsSync('tmp/file2.js'), false);
-
-// recursive dir removal
-shell.mkdir('-p', 'tmp/a/b/c');
-shell.mkdir('-p', 'tmp/b');
-shell.mkdir('-p', 'tmp/c');
-shell.mkdir('-p', 'tmp/.hidden');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-assert.equal(fs.existsSync('tmp/b'), true);
-assert.equal(fs.existsSync('tmp/c'), true);
-assert.equal(fs.existsSync('tmp/.hidden'), true);
-shell.rm('-rf', 'tmp/*'); 
-assert.equal(shell.error(), null);
-var contents = fs.readdirSync('tmp');
-assert.equal(contents.length, 1);
-assert.equal(contents[0], '.hidden'); // shouldn't remove hiddden if no .* given
-
-// recursive dir removal
-shell.mkdir('-p', 'tmp/a/b/c');
-shell.mkdir('-p', 'tmp/b');
-shell.mkdir('-p', 'tmp/c');
-shell.mkdir('-p', 'tmp/.hidden');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-assert.equal(fs.existsSync('tmp/b'), true);
-assert.equal(fs.existsSync('tmp/c'), true);
-assert.equal(fs.existsSync('tmp/.hidden'), true);
-shell.rm('-rf', 'tmp/*', 'tmp/.*');
-assert.equal(shell.error(), null);
-var contents = fs.readdirSync('tmp');
-assert.equal(contents.length, 0);
-
-// recursive dir removal - array-syntax
-shell.mkdir('-p', 'tmp/a/b/c');
-shell.mkdir('-p', 'tmp/b');
-shell.mkdir('-p', 'tmp/c');
-shell.mkdir('-p', 'tmp/.hidden');
-assert.equal(fs.existsSync('tmp/a/b/c'), true);
-assert.equal(fs.existsSync('tmp/b'), true);
-assert.equal(fs.existsSync('tmp/c'), true);
-assert.equal(fs.existsSync('tmp/.hidden'), true);
-shell.rm('-rf', ['tmp/*', 'tmp/.*']);
-assert.equal(shell.error(), null);
-var contents = fs.readdirSync('tmp');
-assert.equal(contents.length, 0);
-
-// removal of a read-only file (unforced)
-shell.mkdir('-p', 'tmp/readonly');
-'asdf'.to('tmp/readonly/file1');
-fs.chmodSync('tmp/readonly/file1', '0444'); // -r--r--r--
-shell.rm('tmp/readonly/file1');
-assert.equal(fs.existsSync('tmp/readonly/file1'), true); // bash's rm always asks before removing read-only files
-                                                         // here we just assume "no"
-
-// removal of a read-only file (forced)
-shell.mkdir('-p', 'tmp/readonly');
-'asdf'.to('tmp/readonly/file2');
-fs.chmodSync('tmp/readonly/file2', '0444'); // -r--r--r--
-shell.rm('-f', 'tmp/readonly/file2');
-assert.equal(fs.existsSync('tmp/readonly/file2'), false);
-
-// removal of a tree containing read-only files (unforced)
-shell.mkdir('-p', 'tmp/tree2');
-'asdf'.to('tmp/tree2/file1');
-'asdf'.to('tmp/tree2/file2');
-fs.chmodSync('tmp/tree2/file1', '0444'); // -r--r--r--
-shell.rm('-r', 'tmp/tree2');
-assert.equal(fs.existsSync('tmp/tree2/file1'), true);
-assert.equal(fs.existsSync('tmp/tree2/file2'), false);
-
-// removal of a tree containing read-only files (forced)
-shell.mkdir('-p', 'tmp/tree');
-'asdf'.to('tmp/tree/file1');
-'asdf'.to('tmp/tree/file2');
-fs.chmodSync('tmp/tree/file1', '0444'); // -r--r--r--
-shell.rm('-rf', 'tmp/tree');
-assert.equal(fs.existsSync('tmp/tree'), false);
-
-// removal of a sub-tree containing read-only and hidden files - rm('dir/*')
-shell.mkdir('-p', 'tmp/tree3');
-shell.mkdir('-p', 'tmp/tree3/subtree');
-shell.mkdir('-p', 'tmp/tree3/.hidden');
-'asdf'.to('tmp/tree3/subtree/file');
-'asdf'.to('tmp/tree3/.hidden/file');
-'asdf'.to('tmp/tree3/file');
-fs.chmodSync('tmp/tree3/file', '0444'); // -r--r--r--
-fs.chmodSync('tmp/tree3/subtree/file', '0444'); // -r--r--r--
-fs.chmodSync('tmp/tree3/.hidden/file', '0444'); // -r--r--r--
-shell.rm('-rf', 'tmp/tree3/*', 'tmp/tree3/.*'); // erase dir contents
-assert.equal(shell.ls('tmp/tree3').length, 0);
-
-// removal of a sub-tree containing read-only and hidden files - rm('dir')
-shell.mkdir('-p', 'tmp/tree4');
-shell.mkdir('-p', 'tmp/tree4/subtree');
-shell.mkdir('-p', 'tmp/tree4/.hidden');
-'asdf'.to('tmp/tree4/subtree/file');
-'asdf'.to('tmp/tree4/.hidden/file');
-'asdf'.to('tmp/tree4/file');
-fs.chmodSync('tmp/tree4/file', '0444'); // -r--r--r--
-fs.chmodSync('tmp/tree4/subtree/file', '0444'); // -r--r--r--
-fs.chmodSync('tmp/tree4/.hidden/file', '0444'); // -r--r--r--
-shell.rm('-rf', 'tmp/tree4'); // erase dir contents
-assert.equal(fs.existsSync('tmp/tree4'), false);
-
-shell.exit(123);
+test('file does not exist, but -f specified', t => {
+  const result = shell.rm('-f', 'asdfasdf');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('directory does not exist, but -fr specified', t => {
+  const result = shell.rm('-fr', 'fake_dir/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('directory does not exist, but *only -f* specified', t => {
+  const result = shell.rm('-f', 'fake_dir/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('file (in fake dir) does not exist, but -f specified', t => {
+  const result = shell.rm('-f', 'fake_dir/asdfasdf');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('dir (in fake dir) does not exist, but -fr specified', t => {
+  const result = shell.rm('-fr', 'fake_dir/sub/');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+});
+
+test('simple rm', t => {
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`));
+  const result = shell.rm(`${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1`));
+});
+
+test('recursive dir removal: -r option', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  const result = shell.rm('-rf', `${t.context.tmp}/a`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`));
+});
+
+test('-R option does the same thing', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  const result = shell.rm('-Rf', `${t.context.tmp}/a`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`));
+});
+
+test('recursive dir removal - absolute path', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  const result = shell.rm('-Rf', path.resolve(`./${t.context.tmp}/a`));
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`));
+});
+
+test('wildcard', t => {
+  const result = shell.rm(`${t.context.tmp}/file*`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file1.js`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/file2.js`));
+});
+
+test('recursive dir removal', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  shell.mkdir('-p', `${t.context.tmp}/b`);
+  shell.mkdir('-p', `${t.context.tmp}/c`);
+  shell.mkdir('-p', `${t.context.tmp}/.hidden`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/b`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/.hidden`));
+  const result = shell.rm('-rf', `${t.context.tmp}/*`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  const contents = fs.readdirSync(t.context.tmp);
+  t.is(contents.length, 1);
+  t.is(contents[0], '.hidden'); // shouldn't remove hidden if no .* given
+});
+
+test('recursive dir removal #2', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  shell.mkdir('-p', `${t.context.tmp}/b`);
+  shell.mkdir('-p', `${t.context.tmp}/c`);
+  shell.mkdir('-p', `${t.context.tmp}/.hidden`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/b`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/.hidden`));
+  const result = shell.rm('-rf', `${t.context.tmp}/*`, `${t.context.tmp}/.*`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  const contents = fs.readdirSync(t.context.tmp);
+  t.is(contents.length, 0);
+});
+
+test('recursive dir removal - array-syntax', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  shell.mkdir('-p', `${t.context.tmp}/b`);
+  shell.mkdir('-p', `${t.context.tmp}/c`);
+  shell.mkdir('-p', `${t.context.tmp}/.hidden`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/b`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/c`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/.hidden`));
+  const result = shell.rm('-rf', [`${t.context.tmp}/*`, `${t.context.tmp}/.*`]);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  const contents = fs.readdirSync(t.context.tmp);
+  t.is(contents.length, 0);
+});
+
+test('removal of a read-only file (unforced)', t => {
+  shell.mkdir('-p', `${t.context.tmp}/readonly`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/readonly/file1`);
+  fs.chmodSync(`${t.context.tmp}/readonly/file1`, '0444'); // -r--r--r--
+  shell.rm(`${t.context.tmp}/readonly/file1`);
+  t.truthy(shell.error());
+  t.truthy(fs.existsSync(`${t.context.tmp}/readonly/file1`)); // bash's rm always asks before removing read-only files
+  // here we just assume "no"
+});
+
+test('removal of a read-only file (forced)', t => {
+  shell.mkdir('-p', `${t.context.tmp}/readonly`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/readonly/file2`);
+  fs.chmodSync(`${t.context.tmp}/readonly/file2`, '0444'); // -r--r--r--
+  shell.rm('-f', `${t.context.tmp}/readonly/file2`);
+  t.falsy(shell.error());
+  t.falsy(fs.existsSync(`${t.context.tmp}/readonly/file2`));
+});
+
+test('removal of a tree containing read-only files (unforced)', t => {
+  shell.mkdir('-p', `${t.context.tmp}/tree2`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/tree2/file1`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/tree2/file2`);
+  fs.chmodSync(`${t.context.tmp}/tree2/file1`, '0444'); // -r--r--r--
+  shell.rm('-r', `${t.context.tmp}/tree2`);
+  t.truthy(shell.error());
+  t.truthy(fs.existsSync(`${t.context.tmp}/tree2/file1`));
+  t.falsy(fs.existsSync(`${t.context.tmp}/tree2/file2`));
+});
+
+test('removal of a tree containing read-only files (forced)', t => {
+  shell.mkdir('-p', `${t.context.tmp}/tree`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/tree/file1`);
+  shell.ShellString('asdf').to(`${t.context.tmp}/tree/file2`);
+  fs.chmodSync(`${t.context.tmp}/tree/file1`, '0444'); // -r--r--r--
+  shell.rm('-rf', `${t.context.tmp}/tree`);
+  t.falsy(shell.error());
+  t.falsy(fs.existsSync(`${t.context.tmp}/tree`));
+});
+
+test(
+  'removal of a sub-tree containing read-only and hidden files - glob',
+  t => {
+    shell.mkdir('-p', `${t.context.tmp}/tree3`);
+    shell.mkdir('-p', `${t.context.tmp}/tree3/subtree`);
+    shell.mkdir('-p', `${t.context.tmp}/tree3/.hidden`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree3/subtree/file`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree3/.hidden/file`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree3/file`);
+    fs.chmodSync(`${t.context.tmp}/tree3/file`, '0444'); // -r--r--r--
+    fs.chmodSync(`${t.context.tmp}/tree3/subtree/file`, '0444'); // -r--r--r--
+    fs.chmodSync(`${t.context.tmp}/tree3/.hidden/file`, '0444'); // -r--r--r--
+    shell.rm('-rf', `${t.context.tmp}/tree3/*`, `${t.context.tmp}/tree3/.*`); // erase dir contents
+    t.is(shell.ls(`${t.context.tmp}/tree3`).length, 0);
+  }
+);
+
+test(
+  'removal of a sub-tree containing read-only and hidden files - without glob',
+  t => {
+    shell.mkdir('-p', `${t.context.tmp}/tree4`);
+    shell.mkdir('-p', `${t.context.tmp}/tree4/subtree`);
+    shell.mkdir('-p', `${t.context.tmp}/tree4/.hidden`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree4/subtree/file`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree4/.hidden/file`);
+    shell.ShellString('asdf').to(`${t.context.tmp}/tree4/file`);
+    fs.chmodSync(`${t.context.tmp}/tree4/file`, '0444'); // -r--r--r--
+    fs.chmodSync(`${t.context.tmp}/tree4/subtree/file`, '0444'); // -r--r--r--
+    fs.chmodSync(`${t.context.tmp}/tree4/.hidden/file`, '0444'); // -r--r--r--
+    shell.rm('-rf', `${t.context.tmp}/tree4`); // erase dir contents
+    t.falsy(fs.existsSync(`${t.context.tmp}/tree4`));
+  }
+);
+
+test('remove symbolic link to a dir', t => {
+  const result = shell.rm(`${t.context.tmp}/rm/link_to_a_dir`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/rm/link_to_a_dir`));
+  t.truthy(fs.existsSync(`${t.context.tmp}/rm/a_dir`));
+});
+
+test('rm -rf on a symbolic link to a dir deletes its contents', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.rm('-rf', `${t.context.tmp}/rm/link_to_a_dir/`);
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+
+    // Both the link and original dir should remain, but contents are deleted
+    t.truthy(fs.existsSync(`${t.context.tmp}/rm/link_to_a_dir`));
+    t.truthy(fs.existsSync(`${t.context.tmp}/rm/a_dir`));
+    t.falsy(fs.existsSync(`${t.context.tmp}/rm/a_dir/a_file`));
+  });
+});
+
+test('remove broken symbolic link', t => {
+  utils.skipOnWin(t, () => {
+    t.truthy(shell.test('-L', `${t.context.tmp}/rm/fake.lnk`));
+    const result = shell.rm(`${t.context.tmp}/rm/fake.lnk`);
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+    t.falsy(shell.test('-L', `${t.context.tmp}/rm/fake.lnk`));
+    t.falsy(fs.existsSync(`${t.context.tmp}/rm/fake.lnk`));
+  });
+});
+
+test('recursive dir removal, for non-normalized path', t => {
+  shell.mkdir('-p', `${t.context.tmp}/a/b/c`);
+  t.truthy(fs.existsSync(`${t.context.tmp}/a/b/c`));
+  const result = shell.rm('-rf', `${t.context.tmp}/a/.././a`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.falsy(fs.existsSync(`${t.context.tmp}/a`));
+});
+
+test('remove fifo', t => {
+  utils.skipOnWin(t, () => {
+    const fifo = utils.mkfifo(t.context.tmp);
+    const result = shell.rm(fifo);
+    t.falsy(shell.error());
+    t.is(result.code, 0);
+  });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/sed.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/sed.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/sed.js	(working copy)
@@ -1,58 +1,182 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
-shell.config.silent = true;
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.cp('-r', 'test/resources', t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+});
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-shell.sed();
-assert.ok(shell.error());
-
-shell.sed(/asdf/g); // too few args
-assert.ok(shell.error());
-
-shell.sed(/asdf/g, 'nada'); // too few args
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-shell.sed(/asdf/g, 'nada', '/asdfasdf'); // no such file
-assert.ok(shell.error());
+test('no arguments', t => {
+  const result = shell.sed();
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+  t.truthy(result.stderr);
+});
+
+test('only one argument', t => {
+  const result = shell.sed(/asdf/g);
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+});
+
+test('only two arguments', t => {
+  const result = shell.sed(/asdf/g, 'nada');
+  t.truthy(shell.error());
+  t.is(result.code, 1);
+});
+
+test('no such file', t => {
+  t.falsy(fs.existsSync('asdfasdf')); // sanity check
+  const result = shell.sed(/asdf/g, 'nada', 'asdfasdf');
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.stderr, 'sed: no such file or directory: asdfasdf');
+});
+
+// TODO(nate): flaky test
+test('if at least one file is missing, this should be an error', t => {
+  t.falsy(fs.existsSync('asdfasdf')); // sanity check
+  t.truthy(fs.existsSync(`${t.context.tmp}/file1`)); // sanity check
+  const result = shell.sed(/asdf/g, 'nada', `${t.context.tmp}/file1`, 'asdfasdf');
+  t.truthy(shell.error());
+  t.is(result.code, 2);
+  t.is(result.stderr, 'sed: no such file or directory: asdfasdf');
+});
 
 //
 // Valids
 //
 
-shell.cp('-f', 'resources/file1', 'tmp/file1');
-var result = shell.sed('test1', 'hello', 'tmp/file1'); // search string
-assert.equal(shell.error(), null);
-assert.equal(result, 'hello');
-
-var result = shell.sed(/test1/, 'hello', 'tmp/file1'); // search regex
-assert.equal(shell.error(), null);
-assert.equal(result, 'hello');
-
-var result = shell.sed(/test1/, 1234, 'tmp/file1'); // numeric replacement
-assert.equal(shell.error(), null);
-assert.equal(result, '1234');
-
-var result = shell.sed('-i', /test1/, 'hello', 'tmp/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'hello');
-assert.equal(shell.cat('tmp/file1'), 'hello');
-
-shell.exit(123);
+test('search with a string', t => {
+  const result = shell.sed('test1', 'hello', `${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'hello');
+});
+
+test('search with a regex', t => {
+  const result = shell.sed(/test1/, 'hello', `${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'hello');
+});
+
+test('replace with a number instead of a string', t => {
+  const result = shell.sed(/test1/, 1234, `${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '1234');
+});
+
+test('replace using a function', t => {
+  const replaceFun = match => match.toUpperCase() + match;
+  const result = shell.sed(/test1/, replaceFun, `${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'TEST1test1');
+});
+
+test('-i option', t => {
+  const result = shell.sed('-i', /test1/, 'hello', `${t.context.tmp}/file1`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '');
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), 'hello');
+});
+
+test('make sure * in regex is not globbed', t => {
+  const result = shell.sed(/alpha*beta/, 'hello', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(
+    result.toString(),
+    'hello\nhowareyou\nhello\nthis line ends in.js\nlllllllllllllllll.js\n'
+  );
+});
+
+test('make sure * in string-regex is not globbed', t => {
+  const result = shell.sed('alpha*beta', 'hello', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(
+    result.toString(),
+    'hello\nhowareyou\nhello\nthis line ends in.js\nlllllllllllllllll.js\n'
+  );
+});
+
+test('make sure * in regex is not globbed (matches something)', t => {
+  const result = shell.sed(/l*\.js/, '', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(
+    result.toString(),
+    'alphaaaaaaabeta\nhowareyou\nalphbeta\nthis line ends in\n\n'
+  );
+});
+
+test('make sure * in string-regex is not globbed (matches something)', t => {
+  const result = shell.sed('l*\\.js', '', 'test/resources/grep/file');
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(
+    result.toString(),
+    'alphaaaaaaabeta\nhowareyou\nalphbeta\nthis line ends in\n\n'
+  );
+});
+
+test('multiple file names', t => {
+  const result = shell.sed('test', 'hello', `${t.context.tmp}/file1`,
+    `${t.context.tmp}/file2`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'hello1\nhello2');
+});
+
+test('array of file names (and try it out with a simple regex)', t => {
+  const result = shell.sed(/t.*st/, 'hello', [`${t.context.tmp}/file1`,
+    `${t.context.tmp}/file2`]);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), 'hello1\nhello2');
+});
+
+test('multiple file names, with in-place-replacement', t => {
+  const result = shell.sed('-i', 'test', 'hello', [`${t.context.tmp}/file1`,
+    `${t.context.tmp}/file2`]);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '');
+  t.is(shell.cat(`${t.context.tmp}/file1`).toString(), 'hello1');
+  t.is(shell.cat(`${t.context.tmp}/file2`).toString(), 'hello2');
+});
+
+test('glob file names, with in-place-replacement', t => {
+  t.is(shell.cat(`${t.context.tmp}/file1.txt`).toString(), 'test1\n');
+  t.is(shell.cat(`${t.context.tmp}/file2.txt`).toString(), 'test2\n');
+  const result = shell.sed('-i', 'test', 'hello', `${t.context.tmp}/file*.txt`);
+  t.falsy(shell.error());
+  t.is(result.code, 0);
+  t.is(result.toString(), '');
+  t.is(shell.cat(`${t.context.tmp}/file1.txt`).toString(), 'hello1\n');
+  t.is(shell.cat(`${t.context.tmp}/file2.txt`).toString(), 'hello2\n');
+});
+
+test('empty file', t => {
+  const result = shell.sed('widget', 'wizzle', 'test/resources/sed/empty.txt');
+  t.is(result.code, 0);
+  t.is(result.toString(), '');
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/tempdir.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/tempdir.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/tempdir.js	(working copy)
@@ -1,27 +1,31 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import { isCached, clearCache } from '../src/tempdir';
 
 shell.config.silent = true;
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Valids
 //
 
-var tmp = shell.tempdir();
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync(tmp), true);
-
-shell.exit(123);
+test('basic usage', t => {
+  const tmp = shell.tempdir();
+  t.falsy(shell.error());
+  t.truthy(fs.existsSync(tmp));
+
+  // It's a directory
+  t.truthy(shell.test('-d', tmp));
+});
+
+test('cache', t => {
+  clearCache(); // In case this runs after any test which relies on tempdir().
+  t.falsy(isCached());
+  const tmp1 = shell.tempdir();
+  t.truthy(isCached());
+  const tmp2 = shell.tempdir();
+  t.is(tmp1, tmp2);
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/test.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/test.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/test.js	(working copy)
@@ -1,91 +1,131 @@
-var shell = require('..');
+import test from 'ava';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
-
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
 shell.config.silent = true;
 
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
 //
 // Invalids
 //
 
-var result = shell.test(); // no expression given
-assert.ok(shell.error());
-
-var result = shell.test('asdf'); // bad expression
-assert.ok(shell.error());
-
-var result = shell.test('f', 'resources/file1'); // bad expression
-assert.ok(shell.error());
-
-var result = shell.test('-f'); // no file
-assert.ok(shell.error());
+test('no expression given', t => {
+  shell.test();
+  t.truthy(shell.error());
+});
+
+test('bad expression', t => {
+  shell.test('asdf');
+  t.truthy(shell.error());
+});
+
+test('bad expression #2', t => {
+  shell.test('f', 'test/resources/file1');
+  t.truthy(shell.error());
+});
+
+test('no file', t => {
+  shell.test('-f');
+  t.truthy(shell.error());
+});
 
 //
 // Valids
 //
 
-//exists
-var result = shell.test('-e', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-e', 'resources/404');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-//directory
-var result = shell.test('-d', 'resources');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-f', 'resources');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-var result = shell.test('-L', 'resources');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-//file
-var result = shell.test('-d', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-var result = shell.test('-f', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-L', 'resources/file1');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-//link
-var result = shell.test('-d', 'resources/link');
-assert.equal(shell.error(), null);
-assert.equal(result, false);
-
-var result = shell.test('-f', 'resources/link');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-L', 'resources/link');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-L', 'resources/badlink');
-assert.equal(shell.error(), null);
-assert.equal(result, true);//true
-
-var result = shell.test('-L', 'resources/404');
-assert.equal(shell.error(), null);
-assert.equal(result, false);//false
 
-shell.exit(123);
+test('-e option succeeds for files', t => {
+  const result = shell.test('-e', 'test/resources/file1');
+  t.falsy(shell.error());
+  t.truthy(result);
+});
+
+test('-e option fails if it does not exist', t => {
+  const result = shell.test('-e', 'test/resources/404');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+test('-d option succeeds for a directory', t => {
+  const result = shell.test('-d', 'test/resources');
+  t.falsy(shell.error());
+  t.truthy(result);
+});
+
+test('-f option fails for a directory', t => {
+  const result = shell.test('-f', 'test/resources');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+test('-L option fails for a directory', t => {
+  const result = shell.test('-L', 'test/resources');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+test('-d option fails for a file', t => {
+  const result = shell.test('-d', 'test/resources/file1');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+test('-f option succeeds for a file', t => {
+  const result = shell.test('-f', 'test/resources/file1');
+  t.falsy(shell.error());
+  t.truthy(result);
+});
+
+test('-L option fails for a file', t => {
+  const result = shell.test('-L', 'test/resources/file1');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+test('test command is not globbed', t => {
+  // regression #529
+  const result = shell.test('-f', 'test/resources/**/*.js');
+  t.falsy(shell.error());
+  t.falsy(result);
+});
+
+// TODO(nate): figure out a way to test links on Windows
+test('-d option fails for a link', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.test('-d', 'test/resources/link');
+    t.falsy(shell.error());
+    t.falsy(result);
+  });
+});
+
+test('-f option succeeds for a link', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.test('-f', 'test/resources/link');
+    t.falsy(shell.error());
+    t.truthy(result);
+  });
+});
+
+test('-L option succeeds for a symlink', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.test('-L', 'test/resources/link');
+    t.falsy(shell.error());
+    t.truthy(result);
+  });
+});
+
+test('-L option works for broken symlinks', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.test('-L', 'test/resources/badlink');
+    t.falsy(shell.error());
+    t.truthy(result);
+  });
+});
+
+test('-L option fails for missing files', t => {
+  utils.skipOnWin(t, () => {
+    const result = shell.test('-L', 'test/resources/404');
+    t.falsy(shell.error());
+    t.falsy(result);
+  });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/to.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/to.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/to.js	(working copy)
@@ -1,39 +1,60 @@
-var shell = require('..');
+import fs from 'fs';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
-shell.config.silent = true;
+test.beforeEach(t => {
+  t.context.tmp = utils.getTempDir();
+  shell.config.resetForTesting();
+  shell.mkdir(t.context.tmp);
+});
+
+test.afterEach.always(t => {
+  shell.rm('-rf', t.context.tmp);
+});
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
 
 //
 // Invalids
 //
 
-'hello world'.to();
-assert.ok(shell.error());
-
-assert.equal(fs.existsSync('/asdfasdf'), false); // sanity check
-'hello world'.to('/asdfasdf/file');
-assert.ok(shell.error());
+test('Normal strings don\'t have \'.to()\' anymore', t => {
+  const str = 'hello world';
+  t.is(str.to, undefined);
+});
+
+test('no file argument', t => {
+  shell.ShellString('hello world').to();
+  t.truthy(shell.error());
+});
+
+test('cannot write to a non-existent directory', t => {
+  t.falsy(fs.existsSync('/asdfasdf')); // sanity check
+  shell.ShellString('hello world').to('/asdfasdf/file');
+  t.truthy(shell.error());
+});
 
 //
 // Valids
 //
 
-'hello world'.to('tmp/to1');
-var result = shell.cat('tmp/to1');
-assert.equal(shell.error(), null);
-assert.equal(result, 'hello world');
-
-shell.exit(123);
+test('can be chained', t => {
+  shell.ShellString('hello world').to(`${t.context.tmp}/to1`).to(`${t.context.tmp}/to2`);
+  let result = shell.cat(`${t.context.tmp}/to1`);
+  t.falsy(shell.error());
+  t.is(result.toString(), 'hello world');
+  result = shell.cat(`${t.context.tmp}/to2`);
+  t.falsy(shell.error());
+  t.is(result.toString(), 'hello world');
+});
+
+test('With a glob', t => {
+  shell.touch(`${t.context.tmp}/to1`);
+  shell.ShellString('goodbye').to(`${t.context.tmp}/t*1`);
+  t.falsy(fs.existsSync(`${t.context.tmp}/t*1`), 'globs are not interpreted literally');
+  const result = shell.cat(`${t.context.tmp}/to1`);
+  t.falsy(shell.error());
+  t.is(result.toString(), 'goodbye');
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/which.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/which.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-jshint/node_modules/jshint/node_modules/shelljs/test/which.js	(working copy)
@@ -1,38 +1,96 @@
-var shell = require('..');
+import fs from 'fs';
+import path from 'path';
 
-var assert = require('assert'),
-    path = require('path'),
-    fs = require('fs');
+import test from 'ava';
 
-// Node shims for < v0.7
-fs.existsSync = fs.existsSync || path.existsSync;
+import shell from '..';
+import utils from './utils/utils';
 
 shell.config.silent = true;
 
-function numLines(str) {
-  return typeof str === 'string' ? str.match(/\n/g).length : 0;
-}
-
-shell.rm('-rf', 'tmp');
-shell.mkdir('tmp');
-
 //
 // Invalids
 //
 
-shell.which();
-assert.ok(shell.error());
-
-var result = shell.which('asdfasdfasdfasdfasdf'); // what are the odds...
-assert.equal(shell.error(), null);
-assert.equal(result, null);
+test('no args', t => {
+  shell.which();
+  t.truthy(shell.error());
+});
+
+test('command does not exist in the path', t => {
+  const result = shell.which('asdfasdfasdfasdfasdf'); // what are the odds...
+  t.falsy(shell.error());
+  t.falsy(result);
+});
 
 //
 // Valids
 //
 
-var result = shell.which('node');
-assert.equal(shell.error(), null);
-assert.equal(fs.existsSync(result), true);
+// TODO(nate): make sure this does not have a false negative if 'git' is missing
+test('basic usage', t => {
+  const git = shell.which('git');
+  t.is(git.code, 0);
+  t.falsy(git.stderr);
+  t.falsy(shell.error());
+  t.truthy(fs.existsSync(git.toString()));
+});
+
+test('Windows can search with or without a .exe extension', t => {
+  utils.skipOnUnix(t, () => {
+    // This should be equivalent on Windows
+    const node = shell.which('node');
+    const nodeExe = shell.which('node.exe');
+    t.falsy(shell.error());
+    // If the paths are equal, then this file *should* exist, since that's
+    // already been checked.
+    t.is(node.toString(), nodeExe.toString());
+  });
+});
+
+test('Searching with -a flag returns an array', t => {
+  const commandName = 'node'; // Should be an existing command
+  const result = shell.which('-a', commandName);
+  t.falsy(shell.error());
+  t.truthy(result);
+  t.not(result.length, 0);
+});
+
+test('Searching with -a flag for not existing command returns an empty array', t => {
+  const notExist = '6ef25c13209cb28ae465852508cc3a8f3dcdc71bc7bcf8c38379ba38me';
+  const result = shell.which('-a', notExist);
+  t.falsy(shell.error());
+  t.is(result.length, 0);
+});
+
+test('Searching with -a flag returns an array with first item equals to the regular search', t => {
+  const commandName = 'node'; // Should be an existing command
+  const resultForWhich = shell.which(commandName);
+  const resultForWhichA = shell.which('-a', commandName);
+  t.falsy(shell.error());
+  t.truthy(resultForWhich);
+  t.truthy(resultForWhichA);
+  t.is(resultForWhich.toString(), resultForWhichA[0]);
+});
+
+test('None executable files does not appear in the result list', t => {
+  const commandName = 'node'; // Should be an existing command
+  const extraPath = path.resolve(__dirname, 'resources', 'which');
+  const matchingFile = path.resolve(extraPath, commandName);
+  const pathEnv = process.env.PATH;
+
+  // make sure that file is exists (will throw error otherwise)
+  t.truthy(fs.existsSync(matchingFile));
+
+  process.env.PATH = extraPath + path.delimiter + process.env.PATH;
+  const resultForWhich = shell.which(commandName);
+  const resultForWhichA = shell.which('-a', commandName);
+  t.falsy(shell.error());
+  t.truthy(resultForWhich);
+  t.truthy(resultForWhichA);
+  t.truthy(resultForWhichA.length);
+  t.not(resultForWhich.toString(), matchingFile);
+  t.is(resultForWhichA.indexOf(matchingFile), -1);
 
-shell.exit(123);
+  process.env.PATH = pathEnv;
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/LICENSE
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/LICENSE	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/LICENSE	(working copy)
@@ -1,6 +1,6 @@
 UglifyJS is released under the BSD license:
 
-Copyright 2012-2013 (c) Mihai Bazon <mihai.bazon@gmail.com>
+Copyright 2012-2019 (c) Mihai Bazon <mihai.bazon@gmail.com>
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/README.md
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/README.md	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/README.md	(working copy)
@@ -1,14 +1,14 @@
-UglifyJS 2
+UglifyJS 3
 ==========
-[![Build Status](https://travis-ci.org/mishoo/UglifyJS2.svg)](https://travis-ci.org/mishoo/UglifyJS2)
 
-UglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit.
+UglifyJS is a JavaScript parser, minifier, compressor and beautifier toolkit.
 
-This page documents the command line utility.  For
-[API and internals documentation see my website](http://lisperator.net/uglifyjs/).
-There's also an
-[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox,
-Chrome and probably Safari).
+#### Note:
+- `uglify-js` supports JavaScript and most language features in ECMAScript.
+- For more exotic parts of ECMAScript, process your source file with transpilers
+  like [Babel](https://babeljs.io/) before passing onto `uglify-js`.
+- `uglify-js@3` has a simplified [API](#api-reference) and [CLI](#command-line-usage)
+  that is not backwards compatible with [`uglify-js@2`](https://github.com/mishoo/UglifyJS/tree/v2.x).
 
 Install
 -------
@@ -24,142 +24,168 @@
 
     npm install uglify-js
 
-From Git:
-
-    git clone git://github.com/mishoo/UglifyJS2.git
-    cd UglifyJS2
-    npm link .
-
-Usage
------
+# Command line usage
 
     uglifyjs [input files] [options]
 
-UglifyJS2 can take multiple input files.  It's recommended that you pass the
+UglifyJS can take multiple input files.  It's recommended that you pass the
 input files first, then pass the options.  UglifyJS will parse input files
 in sequence and apply any compression options.  The files are parsed in the
 same global scope, that is, a reference from a file to some
 variable/function declared in another file will be matched properly.
 
-If you want to read from STDIN instead, pass a single dash instead of input
-files.
+If no input file is specified, UglifyJS will read from STDIN.
 
 If you wish to pass your options before the input files, separate the two with
 a double dash to prevent input files being used as option arguments:
 
     uglifyjs --compress --mangle -- input.js
 
-The available options are:
+### Command line options
 
 ```
-  --source-map                  Specify an output file where to generate source
-                                map.
-  --source-map-root             The path to the original source to be included
-                                in the source map.
-  --source-map-url              The path to the source map to be added in //#
-                                sourceMappingURL.  Defaults to the value passed
-                                with --source-map.
-  --source-map-include-sources  Pass this flag if you want to include the
-                                content of source files in the source map as
-                                sourcesContent property.
-  --in-source-map               Input source map, useful if you're compressing
-                                JS that was generated from some other original
-                                code.
-  --screw-ie8                   Pass this flag if you don't care about full
-                                compliance with Internet Explorer 6-8 quirks
-                                (by default UglifyJS will try to be IE-proof).
-  --expr                        Parse a single expression, rather than a
-                                program (for parsing JSON)
-  -p, --prefix                  Skip prefix for original filenames that appear
-                                in source maps. For example -p 3 will drop 3
-                                directories from file names and ensure they are
-                                relative paths. You can also specify -p
-                                relative, which will make UglifyJS figure out
-                                itself the relative paths between original
-                                sources, the source map and the output file.
-  -o, --output                  Output file (default STDOUT).
-  -b, --beautify                Beautify output/specify output options.
-  -m, --mangle                  Mangle names/pass mangler options.
-  -r, --reserved                Reserved names to exclude from mangling.
-  -c, --compress                Enable compressor/pass compressor options. Pass
-                                options like -c
-                                hoist_vars=false,if_return=false. Use -c with
-                                no argument to use the default compression
-                                options.
-  -d, --define                  Global definitions
-  -e, --enclose                 Embed everything in a big function, with a
-                                configurable parameter/argument list.
-  --comments                    Preserve copyright comments in the output. By
+    -h, --help                  Print usage information.
+                                `--help options` for details on available options.
+    -V, --version               Print version number.
+    -p, --parse <options>       Specify parser options:
+                                `acorn`  Use Acorn for parsing.
+                                `bare_returns`  Allow return outside of functions.
+                                                Useful when minifying CommonJS
+                                                modules and Userscripts that may
+                                                be anonymous function wrapped (IIFE)
+                                                by the .user.js engine `caller`.
+                                `spidermonkey`  Assume input files are SpiderMonkey
+                                                AST format (as JSON).
+    -c, --compress [options]    Enable compressor/specify compressor options:
+                                `pure_funcs`  List of functions that can be safely
+                                              removed when their return values are
+                                              not used.
+    -m, --mangle [options]      Mangle names/specify mangler options:
+                                `reserved`  List of names that should not be mangled.
+    --mangle-props [options]    Mangle properties/specify mangler options:
+                                `builtins`  Mangle property names that overlaps
+                                            with standard JavaScript globals.
+                                `debug`  Add debug prefix and suffix.
+                                `domprops`  Mangle property names that overlaps
+                                            with DOM properties.
+                                `keep_quoted`  Only mangle unquoted properties.
+                                `regex`  Only mangle matched property names.
+                                `reserved`  List of names that should not be mangled.
+    -b, --beautify [options]    Beautify output/specify output options:
+                                `beautify`  Enabled with `--beautify` by default.
+                                `preamble`  Preamble to prepend to the output. You
+                                            can use this to insert a comment, for
+                                            example for licensing information.
+                                            This will not be parsed, but the source
+                                            map will adjust for its presence.
+                                `quote_style`  Quote style:
+                                               0 - auto
+                                               1 - single
+                                               2 - double
+                                               3 - original
+                                `wrap_iife`  Wrap IIFEs in parentheses. Note: you may
+                                             want to disable `negate_iife` under
+                                             compressor options.
+    -O, --output-opts [options] Specify output options (`beautify` disabled by default).
+    -o, --output <file>         Output file path (default STDOUT). Specify `ast` or
+                                `spidermonkey` to write UglifyJS or SpiderMonkey AST
+                                as JSON to STDOUT respectively.
+    --annotations               Process and preserve comment annotations.
+                                (`/*@__PURE__*/` or `/*#__PURE__*/`)
+    --no-annotations            Ignore and discard comment annotations.
+    --comments [filter]         Preserve copyright comments in the output. By
                                 default this works like Google Closure, keeping
                                 JSDoc-style comments that contain "@license" or
                                 "@preserve". You can optionally pass one of the
                                 following arguments to this flag:
                                 - "all" to keep all comments
-                                - a valid JS regexp (needs to start with a
-                                slash) to keep only comments that match.
+                                - a valid JS RegExp like `/foo/` or `/^!/` to
+                                keep only matching comments.
                                 Note that currently not *all* comments can be
                                 kept when compression is on, because of dead
                                 code removal or cascading statements into
                                 sequences.
-  --preamble                    Preamble to prepend to the output.  You can use
-                                this to insert a comment, for example for
-                                licensing information.  This will not be
-                                parsed, but the source map will adjust for its
-                                presence.
-  --stats                       Display operations run time on STDERR.
-  --acorn                       Use Acorn for parsing.
-  --spidermonkey                Assume input files are SpiderMonkey AST format
-                                (as JSON).
-  --self                        Build itself (UglifyJS2) as a library (implies
-                                --wrap=UglifyJS --export-all)
-  --wrap                        Embed everything in a big function, making the
+    --config-file <file>        Read `minify()` options from JSON file.
+    -d, --define <expr>[=value] Global definitions.
+    -e, --enclose [arg[:value]] Embed everything in a big function, with configurable
+                                argument(s) & value(s).
+    --expression                Parse a single expression, rather than a program
+                                (for parsing JSON).
+    --ie                        Support non-standard Internet Explorer.
+                                Equivalent to setting `ie: true` in `minify()`
+                                for `compress`, `mangle` and `output` options.
+                                By default UglifyJS will not try to be IE-proof.
+    --keep-fargs                Do not mangle/drop function arguments.
+    --keep-fnames               Do not mangle/drop function names.  Useful for
+                                code relying on Function.prototype.name.
+    --module                    Process input as ES module (implies --toplevel)
+    --name-cache <file>         File to hold mangled name mappings.
+    --self                      Build UglifyJS as a library (implies --wrap UglifyJS)
+    --source-map [options]      Enable source map/specify source map options:
+                                `base`  Path to compute relative paths from input files.
+                                `content`  Input source map, useful if you're compressing
+                                           JS that was generated from some other original
+                                           code. Specify "inline" if the source map is
+                                           included within the sources.
+                                `filename`  Filename and/or location of the output source
+                                            (sets `file` attribute in source map).
+                                `includeSources`  Pass this flag if you want to include
+                                                  the content of source files in the
+                                                  source map as sourcesContent property.
+                                `names` Include symbol names in the source map.
+                                `root`  Path to the original source to be included in
+                                        the source map.
+                                `url`  If specified, path to the source map to append in
+                                       `//# sourceMappingURL`.
+    --timings                   Display operations run time on STDERR.
+    --toplevel                  Compress and/or mangle variables in top level scope.
+    --v8                        Support non-standard Chrome & Node.js
+                                Equivalent to setting `v8: true` in `minify()`
+                                for `mangle` and `output` options.
+                                By default UglifyJS will not try to be v8-proof.
+    --verbose                   Print diagnostic messages.
+    --warn                      Print warning messages.
+    --webkit                    Support non-standard Safari/Webkit.
+                                Equivalent to setting `webkit: true` in `minify()`
+                                for `compress`, `mangle` and `output` options.
+                                By default UglifyJS will not try to be Safari-proof.
+    --wrap <name>               Embed everything in a big function, making the
                                 “exports” and “global” variables available. You
                                 need to pass an argument to this option to
                                 specify the name that your module will take
                                 when included in, say, a browser.
-  --export-all                  Only used when --wrap, this tells UglifyJS to
-                                add code to automatically export all globals.
-  --lint                        Display some scope warnings
-  -v, --verbose                 Verbose
-  -V, --version                 Print version number and exit.
-  --noerr                       Don't throw an error for unknown options in -c,
-                                -b or -m.
-  --bare-returns                Allow return outside of functions.  Useful when
-                                minifying CommonJS modules.
-  --keep-fnames                 Do not mangle/drop function names.  Useful for
-                                code relying on Function.prototype.name.
-  --reserved-file               File containing reserved names
-  --reserve-domprops            Make (most?) DOM properties reserved for
-                                --mangle-props
-  --mangle-props                Mangle property names
-  --mangle-regex                Only mangle property names matching the regex
-  --name-cache                  File to hold mangled names mappings
 ```
 
 Specify `--output` (`-o`) to declare the output file.  Otherwise the output
 goes to STDOUT.
 
-## Source map options
+## CLI source map options
 
-UglifyJS2 can generate a source map file, which is highly useful for
+UglifyJS can generate a source map file, which is highly useful for
 debugging your compressed JavaScript.  To get a source map, pass
-`--source-map output.js.map` (full path to the file where you want the
-source map dumped).
+`--source-map --output output.js` (source map will be written out to
+`output.js.map`).
+
+Additional options:
+
+- `--source-map "filename='<NAME>'"` to specify the name of the source map. The value of
+  `filename` is only used to set `file` attribute (see [the spec][sm-spec])
+  in source map file.
+
+- `--source-map "root='<URL>'"` to pass the URL where the original files can be found.
 
-Additionally you might need `--source-map-root` to pass the URL where the
-original files can be found.  In case you are passing full paths to input
-files to UglifyJS, you can use `--prefix` (`-p`) to specify the number of
-directories to drop from the path prefix when declaring files in the source
-map.
+- `--source-map "names=false"` to omit symbol names if you want to reduce size
+  of the source map file.
+
+- `--source-map "url='<URL>'"` to specify the URL where the source map can be found.
+  Otherwise UglifyJS assumes HTTP `X-SourceMap` is being used and will omit the
+  `//# sourceMappingURL=` directive.
 
 For example:
 
-    uglifyjs /home/doe/work/foo/src/js/file1.js \
-             /home/doe/work/foo/src/js/file2.js \
-             -o foo.min.js \
-             --source-map foo.min.js.map \
-             --source-map-root http://foo.com/src \
-             -p 5 -c -m
+    uglifyjs js/file1.js js/file2.js \
+             -o foo.min.js -c -m \
+             --source-map "root='http://foo.com/src',url='foo.min.js.map'"
 
 The above will compress and mangle `file1.js` and `file2.js`, will drop the
 output in `foo.min.js` and the source map in `foo.min.js.map`.  The source
@@ -178,94 +204,111 @@
 compressed JS by mapping every token in the compiled JS to its original
 location.
 
-To use this feature you need to pass `--in-source-map
-/path/to/input/source.map`.  Normally the input source map should also point
-to the file containing the generated JS, so if that's correct you can omit
-input files from the command line.
+To use this feature pass `--source-map "content='/path/to/input/source.map'"`
+or `--source-map "content=inline"` if the source map is included inline with
+the sources.
 
-## Mangler options
+## CLI compress options
 
-To enable the mangler you need to pass `--mangle` (`-m`).  The following
-(comma-separated) options are supported:
+You need to pass `--compress` (`-c`) to enable the compressor.  Optionally
+you can pass a comma-separated list of [compress options](#compress-options).
 
-- `sort` — to assign shorter names to most frequently used variables.  This
-  saves a few hundred bytes on jQuery before gzip, but the output is
-  _bigger_ after gzip (and seems to happen for other libraries I tried it
-  on) therefore it's not enabled by default.
+Options are in the form `foo=bar`, or just `foo` (the latter implies
+a boolean option that you want to set `true`; it's effectively a
+shortcut for `foo=true`).
 
-- `toplevel` — mangle names declared in the toplevel scope (disabled by
-  default).
+Example:
 
-- `eval` — mangle names visible in scopes where `eval` or `with` are used
-  (disabled by default).
+    uglifyjs file.js -c toplevel,sequences=false
 
-When mangling is enabled but you want to prevent certain names from being
-mangled, you can declare those names with `--reserved` (`-r`) — pass a
-comma-separated list of names.  For example:
+## CLI mangle options
 
-    uglifyjs ... -m -r '$,require,exports'
+To enable the mangler you need to pass `--mangle` (`-m`).  The following
+(comma-separated) options are supported:
+
+- `eval` (default: `false`) — mangle names visible in scopes where `eval` or
+  `with` are used.
+
+- `reserved` (default: `[]`) — when mangling is enabled but you want to
+  prevent certain names from being mangled, you can declare those names with
+  `--mangle reserved` — pass a comma-separated list of names.  For example:
 
-to prevent the `require`, `exports` and `$` names from being changed.
+      uglifyjs ... -m reserved=['$','require','exports']
 
-### Mangling property names (`--mangle-props`)
+  to prevent the `require`, `exports` and `$` names from being changed.
 
-**Note:** this will probably break your code.  Mangling property names is a
-separate step, different from variable name mangling.  Pass
-`--mangle-props`.  It will mangle all properties that are seen in some
-object literal, or that are assigned to.  For example:
+### CLI mangling property names (`--mangle-props`)
 
-```js
+**Note:** THIS WILL PROBABLY BREAK YOUR CODE.  Mangling property names
+is a separate step, different from variable name mangling.  Pass
+`--mangle-props` to enable it.  It will mangle all properties in the
+input code with the exception of built in DOM properties and properties
+in core JavaScript classes.  For example:
+
+```javascript
+// example.js
 var x = {
-  foo: 1
+    baz_: 0,
+    foo_: 1,
+    calc: function() {
+        return this.foo_ + this.baz_;
+    }
 };
+x.bar_ = 2;
+x["baz_"] = 3;
+console.log(x.calc());
+```
+Mangle all properties (except for JavaScript `builtins`):
+```bash
+$ uglifyjs example.js -c -m --mangle-props
+```
+```javascript
+var x={o:0,_:1,l:function(){return this._+this.o}};x.t=2,x.o=3,console.log(x.l());
+```
+Mangle all properties except for `reserved` properties:
+```bash
+$ uglifyjs example.js -c -m --mangle-props reserved=[foo_,bar_]
+```
+```javascript
+var x={o:0,foo_:1,_:function(){return this.foo_+this.o}};x.bar_=2,x.o=3,console.log(x._());
+```
+Mangle all properties matching a `regex`:
+```bash
+$ uglifyjs example.js -c -m --mangle-props regex=/_$/
+```
+```javascript
+var x={o:0,_:1,calc:function(){return this._+this.o}};x.l=2,x.o=3,console.log(x.calc());
+```
 
-x.bar = 2;
-x["baz"] = 3;
-x[condition ? "moo" : "boo"] = 4;
-console.log(x.something());
-```
-
-In the above code, `foo`, `bar`, `baz`, `moo` and `boo` will be replaced
-with single characters, while `something()` will be left as is.
-
-In order for this to be of any use, we should avoid mangling standard JS
-names.  For instance, if your code would contain `x.length = 10`, then
-`length` becomes a candidate for mangling and it will be mangled throughout
-the code, regardless if it's being used as part of your own objects or
-accessing an array's length.  To avoid that, you can use `--reserved-file`
-to pass a filename that should contain the names to be excluded from
-mangling.  This file can be used both for excluding variable names and
-property names.  It could look like this, for example:
-
-```js
-{
-  "vars": [ "define", "require", ... ],
-  "props": [ "length", "prototype", ... ]
-}
+Combining mangle properties options:
+```bash
+$ uglifyjs example.js -c -m --mangle-props regex=/_$/,reserved=[bar_]
+```
+```javascript
+var x={o:0,_:1,calc:function(){return this._+this.o}};x.bar_=2,x.o=3,console.log(x.calc());
 ```
 
-`--reserved-file` can be an array of file names (either a single
-comma-separated argument, or you can pass multiple `--reserved-file`
-arguments) — in this case it will exclude names from all those files.
+In order for this to be of any use, we avoid mangling standard JS names by
+default (`--mangle-props builtins` to override).
 
 A default exclusion file is provided in `tools/domprops.json` which should
 cover most standard JS and DOM properties defined in various browsers.  Pass
-`--reserve-domprops` to read that in.
+`--mangle-props domprops` to disable this feature.
 
-You can also use a regular expression to define which property names should be
-mangled.  For example, `--mangle-regex="/^_/"` will only mangle property names
-that start with an underscore.
+A regular expression can be used to define which property names should be
+mangled.  For example, `--mangle-props regex=/^_/` will only mangle property
+names that start with an underscore.
 
 When you compress multiple files using this option, in order for them to
 work together in the end we need to ensure somehow that one property gets
-mangled to the same name in all of them.  For this, pass `--name-cache
-filename.json` and UglifyJS will maintain these mappings in a file which can
-then be reused.  It should be initially empty.  Example:
-
-```
-rm -f /tmp/cache.json  # start fresh
-uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js
-uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js
+mangled to the same name in all of them.  For this, pass `--name-cache filename.json`
+and UglifyJS will maintain these mappings in a file which can then be reused.
+It should be initially empty.  Example:
+
+```bash
+$ rm -f /tmp/cache.json  # start fresh
+$ uglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js
+$ uglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js
 ```
 
 Now, `part1.js` and `part2.js` will be consistent with each other in terms
@@ -274,65 +317,455 @@
 Using the name cache is not necessary if you compress all your files in a
 single call to UglifyJS.
 
-## Compressor options
+### Mangling unquoted names (`--mangle-props keep_quoted`)
 
-You need to pass `--compress` (`-c`) to enable the compressor.  Optionally
-you can pass a comma-separated list of options.  Options are in the form
-`foo=bar`, or just `foo` (the latter implies a boolean option that you want
-to set `true`; it's effectively a shortcut for `foo=true`).
+Using quoted property name (`o["foo"]`) reserves the property name (`foo`)
+so that it is not mangled throughout the entire script even when used in an
+unquoted style (`o.foo`). Example:
 
-- `sequences` -- join consecutive simple statements using the comma operator
+```javascript
+// stuff.js
+var o = {
+    "foo": 1,
+    bar: 3,
+};
+o.foo += o.bar;
+console.log(o.foo);
+```
+```bash
+$ uglifyjs stuff.js --mangle-props keep_quoted -c -m
+```
+```javascript
+var o={foo:1,o:3};o.foo+=o.o,console.log(o.foo);
+```
 
-- `properties` -- rewrite property access using the dot notation, for
-  example `foo["bar"] → foo.bar`
+If the minified output will be processed again by UglifyJS, consider specifying
+`keep_quoted_props` so the same property names are preserved:
+
+```bash
+$ uglifyjs stuff.js --mangle-props keep_quoted -c -m -O keep_quoted_props
+```
+```javascript
+var o={"foo":1,o:3};o.foo+=o.o,console.log(o.foo);
+```
+
+### Debugging property name mangling
+
+You can also pass `--mangle-props debug` in order to mangle property names
+without completely obscuring them. For example the property `o.foo`
+would mangle to `o._$foo$_` with this option. This allows property mangling
+of a large codebase while still being able to debug the code and identify
+where mangling is breaking things.
+
+```bash
+$ uglifyjs stuff.js --mangle-props debug -c -m
+```
+```javascript
+var o={_$foo$_:1,_$bar$_:3};o._$foo$_+=o._$bar$_,console.log(o._$foo$_);
+```
+
+You can also pass a custom suffix using `--mangle-props debug=XYZ`. This would then
+mangle `o.foo` to `o._$foo$XYZ_`. You can change this each time you compile a
+script to identify how a property got mangled. One technique is to pass a
+random number on every compile to simulate mangling changing with different
+inputs (e.g. as you update the input script with new properties), and to help
+identify mistakes like writing mangled keys to storage.
+
+
+# API Reference
+
+Assuming installation via NPM, you can load UglifyJS in your application
+like this:
+```javascript
+var UglifyJS = require("uglify-js");
+```
+
+There is a single high level function, **`minify(code, options)`**,
+which will perform all minification [phases](#minify-options) in a configurable
+manner. By default `minify()` will enable the options [`compress`](#compress-options)
+and [`mangle`](#mangle-options). Example:
+```javascript
+var code = "function add(first, second) { return first + second; }";
+var result = UglifyJS.minify(code);
+console.log(result.error); // runtime error, or `undefined` if no error
+console.log(result.code);  // minified output: function add(n,d){return n+d}
+```
+
+You can `minify` more than one JavaScript file at a time by using an object
+for the first argument where the keys are file names and the values are source
+code:
+```javascript
+var code = {
+    "file1.js": "function add(first, second) { return first + second; }",
+    "file2.js": "console.log(add(1 + 2, 3 + 4));"
+};
+var result = UglifyJS.minify(code);
+console.log(result.code);
+// function add(d,n){return d+n}console.log(add(3,7));
+```
+
+The `toplevel` option:
+```javascript
+var code = {
+    "file1.js": "function add(first, second) { return first + second; }",
+    "file2.js": "console.log(add(1 + 2, 3 + 4));"
+};
+var options = { toplevel: true };
+var result = UglifyJS.minify(code, options);
+console.log(result.code);
+// console.log(3+7);
+```
+
+The `nameCache` option:
+```javascript
+var options = {
+    mangle: {
+        toplevel: true,
+    },
+    nameCache: {}
+};
+var result1 = UglifyJS.minify({
+    "file1.js": "function add(first, second) { return first + second; }"
+}, options);
+var result2 = UglifyJS.minify({
+    "file2.js": "console.log(add(1 + 2, 3 + 4));"
+}, options);
+console.log(result1.code);
+// function n(n,r){return n+r}
+console.log(result2.code);
+// console.log(n(3,7));
+```
+
+You may persist the name cache to the file system in the following way:
+```javascript
+var cacheFileName = "/tmp/cache.json";
+var options = {
+    mangle: {
+        properties: true,
+    },
+    nameCache: JSON.parse(fs.readFileSync(cacheFileName, "utf8"))
+};
+fs.writeFileSync("part1.js", UglifyJS.minify({
+    "file1.js": fs.readFileSync("file1.js", "utf8"),
+    "file2.js": fs.readFileSync("file2.js", "utf8")
+}, options).code, "utf8");
+fs.writeFileSync("part2.js", UglifyJS.minify({
+    "file3.js": fs.readFileSync("file3.js", "utf8"),
+    "file4.js": fs.readFileSync("file4.js", "utf8")
+}, options).code, "utf8");
+fs.writeFileSync(cacheFileName, JSON.stringify(options.nameCache), "utf8");
+```
+
+An example of a combination of `minify()` options:
+```javascript
+var code = {
+    "file1.js": "function add(first, second) { return first + second; }",
+    "file2.js": "console.log(add(1 + 2, 3 + 4));"
+};
+var options = {
+    toplevel: true,
+    compress: {
+        global_defs: {
+            "@console.log": "alert"
+        },
+        passes: 2
+    },
+    output: {
+        beautify: false,
+        preamble: "/* uglified */"
+    }
+};
+var result = UglifyJS.minify(code, options);
+console.log(result.code);
+// /* uglified */
+// alert(10);"
+```
+
+To produce warnings:
+```javascript
+var code = "function f(){ var u; return 2 + 3; }";
+var options = { warnings: true };
+var result = UglifyJS.minify(code, options);
+console.log(result.error);    // runtime error, `undefined` in this case
+console.log(result.warnings); // [ 'Dropping unused variable u [0:1,18]' ]
+console.log(result.code);     // function f(){return 5}
+```
+
+An error example:
+```javascript
+var result = UglifyJS.minify({"foo.js" : "if (0) else console.log(1);"});
+console.log(JSON.stringify(result.error));
+// {"message":"Unexpected token: keyword (else)","filename":"foo.js","line":1,"col":7,"pos":7}
+```
+Note: unlike `uglify-js@2.x`, the `3.x` API does not throw errors. To
+achieve a similar effect one could do the following:
+```javascript
+var result = UglifyJS.minify(code, options);
+if (result.error) throw result.error;
+```
+
+## Minify options
+
+- `annotations` — pass `false` to ignore all comment annotations and elide them
+  from output. Useful when, for instance, external tools incorrectly applied
+  `/*@__PURE__*/` or `/*#__PURE__*/`. Pass `true` to both compress and retain
+  comment annotations in output to allow for further processing downstream.
+
+- `compress` (default: `{}`) — pass `false` to skip compressing entirely.
+  Pass an object to specify custom [compress options](#compress-options).
 
-- `dead_code` -- remove unreachable code
+- `expression` (default: `false`) — parse as a single expression, e.g. JSON.
 
-- `drop_debugger` -- remove `debugger;` statements
+- `ie` (default: `false`) — enable workarounds for Internet Explorer bugs.
 
-- `unsafe` (default: false) -- apply "unsafe" transformations (discussion below)
+- `keep_fargs` (default: `false`) — pass `true` to prevent discarding or mangling
+  of function arguments.
 
-- `conditionals` -- apply optimizations for `if`-s and conditional
+- `keep_fnames` (default: `false`) — pass `true` to prevent discarding or mangling
+  of function names.  Useful for code relying on `Function.prototype.name`.
+
+- `mangle` (default: `true`) — pass `false` to skip mangling names, or pass
+  an object to specify [mangle options](#mangle-options) (see below).
+
+  - `mangle.properties` (default: `false`) — a subcategory of the mangle option.
+    Pass an object to specify custom [mangle property options](#mangle-properties-options).
+
+- `module` (default: `false`) — set to `true` if you wish to process input as
+  ES module, i.e. implicit `"use strict";` and support for top-level `await`,
+  alongside with `toplevel` enabled.
+
+- `nameCache` (default: `null`) — pass an empty object `{}` or a previously
+  used `nameCache` object if you wish to cache mangled variable and
+  property names across multiple invocations of `minify()`. Note: this is
+  a read/write property. `minify()` will read the name cache state of this
+  object and update it during minification so that it may be
+  reused or externally persisted by the user.
+
+- `output` (default: `null`) — pass an object if you wish to specify
+  additional [output options](#output-options).  The defaults are optimized
+  for best compression.
+
+- `parse` (default: `{}`) — pass an object if you wish to specify some
+  additional [parse options](#parse-options).
+
+- `sourceMap` (default: `false`) — pass an object if you wish to specify
+  [source map options](#source-map-options).
+
+- `toplevel` (default: `false`) — set to `true` if you wish to enable top level
+  variable and function name mangling and to drop unused variables and functions.
+
+- `v8` (default: `false`) — enable workarounds for Chrome & Node.js bugs.
+
+- `warnings` (default: `false`) — pass `true` to return compressor warnings
+  in `result.warnings`. Use the value `"verbose"` for more detailed warnings.
+
+- `webkit` (default: `false`) — enable workarounds for Safari/WebKit bugs.
+  PhantomJS users should set this option to `true`.
+
+## Minify options structure
+
+```javascript
+{
+    parse: {
+        // parse options
+    },
+    compress: {
+        // compress options
+    },
+    mangle: {
+        // mangle options
+
+        properties: {
+            // mangle property options
+        }
+    },
+    output: {
+        // output options
+    },
+    sourceMap: {
+        // source map options
+    },
+    nameCache: null, // or specify a name cache object
+    toplevel: false,
+    warnings: false,
+}
+```
+
+### Source map options
+
+To generate a source map:
+```javascript
+var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, {
+    sourceMap: {
+        filename: "out.js",
+        url: "out.js.map"
+    }
+});
+console.log(result.code); // minified output
+console.log(result.map);  // source map
+```
+
+Note that the source map is not saved in a file, it's just returned in
+`result.map`.  The value passed for `sourceMap.url` is only used to set
+`//# sourceMappingURL=out.js.map` in `result.code`. The value of
+`filename` is only used to set `file` attribute (see [the spec][sm-spec])
+in source map file.
+
+You can set option `sourceMap.url` to be `"inline"` and source map will
+be appended to code.
+
+You can also specify sourceRoot property to be included in source map:
+```javascript
+var result = UglifyJS.minify({"file1.js": "var a = function() {};"}, {
+    sourceMap: {
+        root: "http://example.com/src",
+        url: "out.js.map"
+    }
+});
+```
+
+If you're compressing compiled JavaScript and have a source map for it, you
+can use `sourceMap.content`:
+```javascript
+var result = UglifyJS.minify({"compiled.js": "compiled code"}, {
+    sourceMap: {
+        content: "content from compiled.js.map",
+        url: "minified.js.map"
+    }
+});
+// same as before, it returns `code` and `map`
+```
+
+If you're using the `X-SourceMap` header instead, you can just omit `sourceMap.url`.
+
+If you wish to reduce file size of the source map, set option `sourceMap.names`
+to be `false` and all symbol names will be omitted.
+
+## Parse options
+
+- `bare_returns` (default: `false`) — support top level `return` statements
+
+- `html5_comments` (default: `true`) — process HTML comment as workaround for
+  browsers which do not recognize `<script>` tags
+
+- `module` (default: `false`) — set to `true` if you wish to process input as
+  ES module, i.e. implicit `"use strict";` and support for top-level `await`.
+
+- `shebang` (default: `true`) — support `#!command` as the first line
+
+## Compress options
+
+- `annotations` (default: `true`) — Pass `false` to disable potentially dropping
+  functions marked as "pure".  A function call is marked as "pure" if a comment
+  annotation `/*@__PURE__*/` or `/*#__PURE__*/` immediately precedes the call. For
+  example: `/*@__PURE__*/foo();`
+
+- `arguments` (default: `true`) — replace `arguments[index]` with function
+  parameter name whenever possible.
+
+- `arrows` (default: `true`) — apply optimizations to arrow functions
+
+- `assignments` (default: `true`) — apply optimizations to assignment expressions
+
+- `awaits` (default: `true`) — apply optimizations to `await` expressions
+
+- `booleans` (default: `true`) — various optimizations for boolean context,
+  for example `!!a ? b : c → a ? b : c`
+
+- `collapse_vars` (default: `true`) — Collapse single-use non-constant variables,
+  side effects permitting.
+
+- `comparisons` (default: `true`) — apply certain optimizations to binary nodes,
+  e.g. `!(a <= b) → a > b`, attempts to negate binary nodes, e.g.
+  `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.
+
+- `conditionals` (default: `true`) — apply optimizations for `if`-s and conditional
   expressions
 
-- `comparisons` -- apply certain optimizations to binary nodes, for example:
-  `!(a <= b) → a > b` (only when `unsafe`), attempts to negate binary nodes,
-  e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.
+- `dead_code` (default: `true`) — remove unreachable code
+
+- `default_values` (default: `true`) — drop overshadowed default values
+
+- `directives` (default: `true`) — remove redundant or non-standard directives
+
+- `drop_console` (default: `false`) — Pass `true` to discard calls to
+  `console.*` functions. If you wish to drop a specific function call
+  such as `console.info` and/or retain side effects from function arguments
+  after dropping the function call then use `pure_funcs` instead.
+
+- `drop_debugger` (default: `true`) — remove `debugger;` statements
+
+- `evaluate` (default: `true`) — Evaluate expression for shorter constant
+  representation. Pass `"eager"` to always replace function calls whenever
+  possible, or a positive integer to specify an upper bound for each individual
+  evaluation in number of characters.
+
+- `expression` (default: `false`) — Pass `true` to preserve completion values
+  from terminal statements without `return`, e.g. in bookmarklets.
 
-- `evaluate` -- attempt to evaluate constant expressions
+- `functions` (default: `true`) — convert declarations from `var` to `function`
+  whenever possible.
 
-- `booleans` -- various optimizations for boolean context, for example `!!a
-  ? b : c → a ? b : c`
+- `global_defs` (default: `{}`) — see [conditional compilation](#conditional-compilation)
 
-- `loops` -- optimizations for `do`, `while` and `for` loops when we can
-  statically determine the condition
+- `hoist_exports` (default: `true`) — hoist `export` statements to facilitate
+  various `compress` and `mangle` optimizations.
 
-- `unused` -- drop unreferenced functions and variables
+- `hoist_funs` (default: `false`) — hoist function declarations
 
-- `hoist_funs` -- hoist function declarations
+- `hoist_props` (default: `true`) — hoist properties from constant object and
+  array literals into regular variables subject to a set of constraints. For example:
+  `var o={p:1, q:2}; f(o.p, o.q);` is converted to `f(1, 2);`. Note: `hoist_props`
+  works best with `toplevel` and `mangle` enabled, alongside with `compress` option
+  `passes` set to `2` or higher.
 
-- `hoist_vars` (default: false) -- hoist `var` declarations (this is `false`
+- `hoist_vars` (default: `false`) — hoist `var` declarations (this is `false`
   by default because it seems to increase the size of the output in general)
 
-- `if_return` -- optimizations for if/return and if/continue
+- `if_return` (default: `true`) — optimizations for if/return and if/continue
 
-- `join_vars` -- join consecutive `var` statements
+- `imports` (default: `true`) — drop unreferenced import symbols when used with `unused`
 
-- `cascade` -- small optimization for sequences, transform `x, x` into `x`
-  and `x = something(), x` into `x = something()`
+- `inline` (default: `true`) — inline calls to function with simple/`return` statement:
+  - `false` — same as `0`
+  - `0` — disabled inlining
+  - `1` — inline simple functions
+  - `2` — inline functions with arguments
+  - `3` — inline functions with arguments and variables
+  - `4` — inline functions with arguments, variables and statements
+  - `true` — same as `4`
 
-- `warnings` -- display warnings when dropping unreachable code or unused
-  declarations etc.
+- `join_vars` (default: `true`) — join consecutive `var` statements
 
-- `negate_iife` -- negate "Immediately-Called Function Expressions"
-  where the return value is discarded, to avoid the parens that the
+- `keep_fargs` (default: `false`) — discard unused function arguments except
+  when unsafe to do so, e.g. code which relies on `Function.prototype.length`.
+  Pass `true` to always retain function arguments.
+
+- `keep_infinity` (default: `false`) — Pass `true` to prevent `Infinity` from
+  being compressed into `1/0`, which may cause performance issues on Chrome.
+
+- `loops` (default: `true`) — optimizations for `do`, `while` and `for` loops
+  when we can statically determine the condition.
+
+- `merge_vars` (default: `true`) — combine and reuse variables.
+
+- `module` (default: `false`) — set to `true` if you wish to process input as
+  ES module, i.e. implicit `"use strict";` alongside with `toplevel` enabled.
+
+- `negate_iife` (default: `true`) — negate "Immediately-Called Function Expressions"
+  where the return value is discarded, to avoid the parentheses that the
   code generator would insert.
 
-- `pure_getters` -- the default is `false`.  If you pass `true` for
-  this, UglifyJS will assume that object property access
-  (e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects.
+- `objects` (default: `true`) — compact duplicate keys in object literals.
+
+- `passes` (default: `1`) — The maximum number of times to run compress.
+  In some cases more than one pass leads to further compressed code.  Keep in
+  mind more passes will take more time.
+
+- `properties` (default: `true`) — rewrite property access using the dot notation, for
+  example `foo["bar"] → foo.bar`
 
-- `pure_funcs` -- default `null`.  You can pass an array of names and
+- `pure_funcs` (default: `null`) — You can pass an array of names and
   UglifyJS will assume that those functions do not produce side
   effects.  DANGER: will not check if the name is redefined in scope.
   An example case here, for instance `var q = Math.floor(a/b)`.  If
@@ -341,110 +774,231 @@
   pass `pure_funcs: [ 'Math.floor' ]` to let it know that this
   function won't produce any side effect, in which case the whole
   statement would get discarded.  The current implementation adds some
-  overhead (compression will be slower).
+  overhead (compression will be slower). Make sure symbols under `pure_funcs`
+  are also under `mangle.reserved` to avoid mangling.
 
-- `drop_console` -- default `false`.  Pass `true` to discard calls to
-  `console.*` functions.
+- `pure_getters` (default: `"strict"`) — If you pass `true` for
+  this, UglifyJS will assume that object property access
+  (e.g. `foo.bar` or `foo["bar"]`) doesn't have any side effects.
+  Specify `"strict"` to treat `foo.bar` as side-effect-free only when
+  `foo` is certain to not throw, i.e. not `null` or `undefined`.
 
-- `keep_fargs` -- default `false`.  Pass `true` to prevent the
-  compressor from discarding unused function arguments.  You need this
-  for code which relies on `Function.length`.
+- `reduce_funcs` (default: `true`) — Allows single-use functions to be
+  inlined as function expressions when permissible allowing further
+  optimization.  Enabled by default.  Option depends on `reduce_vars`
+  being enabled.  Some code runs faster in the Chrome V8 engine if this
+  option is disabled.  Does not negatively impact other major browsers.
 
-### The `unsafe` option
+- `reduce_vars` (default: `true`) — Improve optimization on variables assigned with and
+  used as constant values.
 
-It enables some transformations that *might* break code logic in certain
-contrived cases, but should be fine for most code.  You might want to try it
-on your own code, it should reduce the minified size.  Here's what happens
-when this flag is on:
+- `rests` (default: `true`) — apply optimizations to rest parameters
 
-- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]`
-- `new Object()` → `{}`
-- `String(exp)` or `exp.toString()` → `"" + exp`
-- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`
-- `typeof foo == "undefined"` → `foo === void 0`
-- `void 0` → `undefined` (if there is a variable named "undefined" in
-  scope; we do it because the variable name will be mangled, typically
+- `sequences` (default: `true`) — join consecutive simple statements using the
+  comma operator.  May be set to a positive integer to specify the maximum number
+  of consecutive comma sequences that will be generated. If this option is set to
+  `true` then the default `sequences` limit is `200`. Set option to `false` or `0`
+  to disable. The smallest `sequences` length is `2`. A `sequences` value of `1`
+  is grandfathered to be equivalent to `true` and as such means `200`. On rare
+  occasions the default sequences limit leads to very slow compress times in which
+  case a value of `20` or less is recommended.
+
+- `side_effects` (default: `true`) — drop extraneous code which does not affect
+  outcome of runtime execution.
+
+- `spreads` (default: `true`) — flatten spread expressions.
+
+- `strings` (default: `true`) — compact string concatenations.
+
+- `switches` (default: `true`) — de-duplicate and remove unreachable `switch` branches
+
+- `templates` (default: `true`) — compact template literals by embedding expressions
+  and/or converting to string literals, e.g. `` `foo ${42}` → "foo 42"``
+
+- `top_retain` (default: `null`) — prevent specific toplevel functions and
+  variables from `unused` removal (can be array, comma-separated, RegExp or
+  function. Implies `toplevel`)
+
+- `toplevel` (default: `false`) — drop unreferenced functions (`"funcs"`) and/or
+  variables (`"vars"`) in the top level scope (`false` by default, `true` to drop
+  both unreferenced functions and variables)
+
+- `typeofs` (default: `true`) — compress `typeof` expressions, e.g.
+  `typeof foo == "undefined" → void 0 === foo`
+
+- `unsafe` (default: `false`) — apply "unsafe" transformations (discussion below)
+
+- `unsafe_comps` (default: `false`) — assume operands cannot be (coerced to) `NaN`
+  in numeric comparisons, e.g. `a <= b`. In addition, expressions involving `in`
+  or `instanceof` would never throw.
+
+- `unsafe_Function` (default: `false`) — compress and mangle `Function(args, code)`
+  when both `args` and `code` are string literals.
+
+- `unsafe_math` (default: `false`) — optimize numerical expressions like
+  `2 * x * 3` into `6 * x`, which may give imprecise floating point results.
+
+- `unsafe_proto` (default: `false`) — optimize expressions like
+  `Array.prototype.slice.call(a)` into `[].slice.call(a)`
+
+- `unsafe_regexp` (default: `false`) — enable substitutions of variables with
+  `RegExp` values the same way as if they are constants.
+
+- `unsafe_undefined` (default: `false`) — substitute `void 0` if there is a
+  variable named `undefined` in scope (variable name will be mangled, typically
   reduced to a single character)
-- discards unused function arguments (affects `function.length`)
 
-### Conditional compilation
+- `unused` (default: `true`) — drop unreferenced functions and variables (simple
+  direct variable assignments do not count as references unless set to `"keep_assign"`)
+
+- `varify` (default: `true`) — convert block-scoped declarations into `var`
+  whenever safe to do so
+
+- `yields` (default: `true`) — apply optimizations to `yield` expressions
+
+## Mangle options
+
+- `eval` (default: `false`) — Pass `true` to mangle names visible in scopes
+  where `eval` or `with` are used.
+
+- `reserved` (default: `[]`) — Pass an array of identifiers that should be
+  excluded from mangling. Example: `["foo", "bar"]`.
+
+- `toplevel` (default: `false`) — Pass `true` to mangle names declared in the
+  top level scope.
+
+Examples:
 
-You can use the `--define` (`-d`) switch in order to declare global
-variables that UglifyJS will assume to be constants (unless defined in
-scope).  For example if you pass `--define DEBUG=false` then, coupled with
-dead code removal UglifyJS will discard the following from the output:
 ```javascript
-if (DEBUG) {
-	console.log("debug stuff");
+// test.js
+var globalVar;
+function funcName(firstLongName, anotherLongName) {
+    var myVariable = firstLongName +  anotherLongName;
 }
 ```
+```javascript
+var code = fs.readFileSync("test.js", "utf8");
 
-UglifyJS will warn about the condition being always false and about dropping
-unreachable code; for now there is no option to turn off only this specific
-warning, you can pass `warnings=false` to turn off *all* warnings.
+UglifyJS.minify(code).code;
+// 'function funcName(a,n){}var globalVar;'
 
-Another way of doing that is to declare your globals as constants in a
-separate file and include it into the build.  For example you can have a
-`build/defines.js` file with the following:
-```javascript
-const DEBUG = false;
-const PRODUCTION = true;
-// etc.
+UglifyJS.minify(code, { mangle: { reserved: ['firstLongName'] } }).code;
+// 'function funcName(firstLongName,a){}var globalVar;'
+
+UglifyJS.minify(code, { mangle: { toplevel: true } }).code;
+// 'function n(n,a){}var a;'
 ```
 
-and build your code like this:
+### Mangle properties options
 
-    uglifyjs build/defines.js js/foo.js js/bar.js... -c
+- `builtins` (default: `false`) — Use `true` to allow the mangling of built-in
+  properties of JavaScript API. Not recommended to override this setting.
 
-UglifyJS will notice the constants and, since they cannot be altered, it
-will evaluate references to them to the value itself and drop unreachable
-code as usual.  The possible downside of this approach is that the build
-will contain the `const` declarations.
+- `debug` (default: `false`) — Mangle names with the original name still present.
+  Pass an empty string `""` to enable, or a non-empty string to set the debug suffix.
+
+- `domprops` (default: `false`) — Use `true` to allow the mangling of properties
+  commonly found in Document Object Model. Not recommended to override this setting.
+
+- `keep_fargs` (default: `false`) — Use `true` to prevent mangling of function
+  arguments.
+
+- `keep_quoted` (default: `false`) — Only mangle unquoted property names.
+
+- `regex` (default: `null`) — Pass a RegExp literal to only mangle property
+  names matching the regular expression.
+
+- `reserved` (default: `[]`) — Do not mangle property names listed in the
+  `reserved` array.
 
-<a name="codegen-options"></a>
-## Beautifier options
+## Output options
 
 The code generator tries to output shortest code possible by default.  In
 case you want beautified output, pass `--beautify` (`-b`).  Optionally you
 can pass additional arguments that control the code output:
 
-- `beautify` (default `true`) -- whether to actually beautify the output.
+- `annotations` (default: `false`) — pass `true` to retain comment annotations
+  `/*@__PURE__*/` or `/*#__PURE__*/`, otherwise they will be discarded even if
+  `comments` is set.
+
+- `ascii_only` (default: `false`) — escape Unicode characters in strings and
+  regexps (affects directives with non-ascii characters becoming invalid)
+
+- `beautify` (default: `true`) — whether to actually beautify the output.
   Passing `-b` will set this to true, but you might need to pass `-b` even
   when you want to generate minified code, in order to specify additional
   arguments, so you can use `-b beautify=false` to override it.
-- `indent-level` (default 4)
-- `indent-start` (default 0) -- prefix all lines by that many spaces
-- `quote-keys` (default `false`) -- pass `true` to quote all keys in literal
-  objects
-- `space-colon` (default `true`) -- insert a space after the colon signs
-- `ascii-only` (default `false`) -- escape Unicode characters in strings and
-  regexps
-- `inline-script` (default `false`) -- escape the slash in occurrences of
-  `</script` in strings
-- `width` (default 80) -- only takes effect when beautification is on, this
-  specifies an (orientative) line width that the beautifier will try to
-  obey.  It refers to the width of the line text (excluding indentation).
-  It doesn't work very well currently, but it does make the code generated
-  by UglifyJS more readable.
-- `max-line-len` (default 32000) -- maximum line length (for uglified code)
-- `bracketize` (default `false`) -- always insert brackets in `if`, `for`,
+
+- `braces` (default: `false`) — always insert braces in `if`, `for`,
   `do`, `while` or `with` statements, even if their body is a single
   statement.
-- `semicolons` (default `true`) -- separate statements with semicolons.  If
-  you pass `false` then whenever possible we will use a newline instead of a
-  semicolon, leading to more readable output of uglified code (size before
-  gzip could be smaller; size after gzip insignificantly larger).
-- `preamble` (default `null`) -- when passed it must be a string and
+
+- `comments` (default: `false`) — pass `true` or `"all"` to preserve all
+  comments, `"some"` to preserve multi-line comments that contain `@cc_on`,
+  `@license`, or `@preserve` (case-insensitive), a regular expression string
+  (e.g. `/^!/`), or a function which returns `boolean`, e.g.
+  ```javascript
+  function(node, comment) {
+      return comment.value.indexOf("@type " + node.TYPE) >= 0;
+  }
+  ```
+
+- `extendscript` (default: `false`) — enable workarounds for Adobe ExtendScript
+  bugs
+
+- `galio` (default: `false`) — enable workarounds for ANT Galio bugs
+
+- `indent_level` (default: `4`) — indent by specified number of spaces or the
+  exact whitespace sequence supplied, e.g. `"\t"`.
+
+- `indent_start` (default: `0`) — prefix all lines by whitespace sequence
+  specified in the same format as `indent_level`.
+
+- `inline_script` (default: `true`) — escape HTML comments and the slash in
+  occurrences of `</script>` in strings
+
+- `keep_quoted_props` (default: `false`) — when turned on, prevents stripping
+  quotes from property names in object literals.
+
+- `max_line_len` (default: `false`) — maximum line length (for uglified code)
+
+- `preamble` (default: `null`) — when passed it must be a string and
   it will be prepended to the output literally.  The source map will
   adjust for this text.  Can be used to insert a comment containing
   licensing information, for example.
-- `quote_style` (default `0`) -- preferred quote style for strings (affects
+
+- `preserve_line` (default: `false`) — pass `true` to retain line numbering on
+  a best effort basis.
+
+- `quote_keys` (default: `false`) — pass `true` to quote all keys in literal
+  objects
+
+- `quote_style` (default: `0`) — preferred quote style for strings (affects
   quoted property names and directives as well):
-  - `0` -- prefers double quotes, switches to single quotes when there are
-    more double quotes in the string itself.
-  - `1` -- always use single quotes
-  - `2` -- always use double quotes
-  - `3` -- always use the original quotes
+  - `0` — prefers double quotes, switches to single quotes when there are
+    more double quotes in the string itself. `0` is best for gzip size.
+  - `1` — always use single quotes
+  - `2` — always use double quotes
+  - `3` — always use the original quotes
+
+- `semicolons` (default: `true`) — separate statements with semicolons.  If
+  you pass `false` then whenever possible we will use a newline instead of a
+  semicolon, leading to more readable output of uglified code (size before
+  gzip could be smaller; size after gzip insignificantly larger).
+
+- `shebang` (default: `true`) — preserve shebang `#!` in preamble (bash scripts)
+
+- `width` (default: `80`) — only takes effect when beautification is on, this
+  specifies an (orientative) line width that the beautifier will try to
+  obey.  It refers to the width of the line text (excluding indentation).
+  It doesn't work very well currently, but it does make the code generated
+  by UglifyJS more readable.
+
+- `wrap_iife` (default: `false`) — pass `true` to wrap immediately invoked
+  function expressions. See
+  [#640](https://github.com/mishoo/UglifyJS/issues/640) for more details.
+
+# Miscellaneous
 
 ### Keeping copyright notices or other comments
 
@@ -452,18 +1006,18 @@
 default it will keep JSDoc-style comments that contain "@preserve",
 "@license" or "@cc_on" (conditional compilation for IE).  You can pass
 `--comments all` to keep all the comments, or a valid JavaScript regexp to
-keep only comments that match this regexp.  For example `--comments
-'/foo|bar/'` will keep only comments that contain "foo" or "bar".
+keep only comments that match this regexp.  For example `--comments /^!/`
+will keep comments like `/*! Copyright Notice */`.
 
 Note, however, that there might be situations where comments are lost.  For
 example:
 ```javascript
 function f() {
-	/** @preserve Foo Bar */
-	function g() {
-	  // this function is never called
-	}
-	return something();
+    /** @preserve Foo Bar */
+    function g() {
+        // this function is never called
+    }
+    return something();
 }
 ```
 
@@ -474,311 +1028,451 @@
 The safest comments where to place copyright information (or other info that
 needs to be kept in the output) are comments attached to toplevel nodes.
 
-## Support for the SpiderMonkey AST
+### The `unsafe` `compress` option
 
-UglifyJS2 has its own abstract syntax tree format; for
-[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)
-we can't easily change to using the SpiderMonkey AST internally.  However,
-UglifyJS now has a converter which can import a SpiderMonkey AST.
-
-For example [Acorn][acorn] is a super-fast parser that produces a
-SpiderMonkey AST.  It has a small CLI utility that parses one file and dumps
-the AST in JSON on the standard output.  To use UglifyJS to mangle and
-compress that:
-
-    acorn file.js | uglifyjs --spidermonkey -m -c
-
-The `--spidermonkey` option tells UglifyJS that all input files are not
-JavaScript, but JS code described in SpiderMonkey AST in JSON.  Therefore we
-don't use our own parser in this case, but just transform that AST into our
-internal AST.
-
-### Use Acorn for parsing
-
-More for fun, I added the `--acorn` option which will use Acorn to do all
-the parsing.  If you pass this option, UglifyJS will `require("acorn")`.
-
-Acorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but
-converting the SpiderMonkey tree that Acorn produces takes another 150ms so
-in total it's a bit more than just using UglifyJS's own parser.
-
-### Using UglifyJS to transform SpiderMonkey AST
+It enables some transformations that *might* break code logic in certain
+contrived cases, but should be fine for most code.  You might want to try it
+on your own code, it should reduce the minified size.  Here's what happens
+when this flag is on:
 
-Now you can use UglifyJS as any other intermediate tool for transforming
-JavaScript ASTs in SpiderMonkey format.
+- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]`
+- `new Object()` → `{}`
+- `String(exp)` or `exp.toString()` → `"" + exp`
+- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`
 
-Example:
+### Conditional compilation
 
+You can use the `--define` (`-d`) switch in order to declare global
+variables that UglifyJS will assume to be constants (unless defined in
+scope).  For example if you pass `--define DEBUG=false` then, coupled with
+dead code removal UglifyJS will discard the following from the output:
 ```javascript
-function uglify(ast, options, mangle) {
-  // Conversion from SpiderMonkey AST to internal format
-  var uAST = UglifyJS.AST_Node.from_mozilla_ast(ast);
-
-  // Compression
-  uAST.figure_out_scope();
-  uAST = uAST.transform(UglifyJS.Compressor(options));
-
-  // Mangling (optional)
-  if (mangle) {
-    uAST.figure_out_scope();
-    uAST.compute_char_frequency();
-    uAST.mangle_names();
-  }
-
-  // Back-conversion to SpiderMonkey AST
-  return uAST.to_mozilla_ast();
+if (DEBUG) {
+    console.log("debug stuff");
 }
 ```
 
-Check out
-[original blog post](http://rreverser.com/using-mozilla-ast-with-uglifyjs/)
-for details.
+You can specify nested constants in the form of `--define env.DEBUG=false`.
 
-API Reference
--------------
+UglifyJS will warn about the condition being always false and about dropping
+unreachable code; for now there is no option to turn off only this specific
+warning, you can pass `warnings=false` to turn off *all* warnings.
 
-Assuming installation via NPM, you can load UglifyJS in your application
-like this:
+Another way of doing that is to declare your globals as constants in a
+separate file and include it into the build.  For example you can have a
+`build/defines.js` file with the following:
 ```javascript
-var UglifyJS = require("uglify-js");
+var DEBUG = false;
+var PRODUCTION = true;
+// etc.
 ```
 
-It exports a lot of names, but I'll discuss here the basics that are needed
-for parsing, mangling and compressing a piece of code.  The sequence is (1)
-parse, (2) compress, (3) mangle, (4) generate output code.
-
-### The simple way
+and build your code like this:
 
-There's a single toplevel function which combines all the steps.  If you
-don't need additional customization, you might want to go with `minify`.
-Example:
-```javascript
-var result = UglifyJS.minify("/path/to/file.js");
-console.log(result.code); // minified output
-// if you need to pass code instead of file name
-var result = UglifyJS.minify("var b = function () {};", {fromString: true});
-```
+    uglifyjs build/defines.js js/foo.js js/bar.js... -c
 
-You can also compress multiple files:
-```javascript
-var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ]);
-console.log(result.code);
-```
+UglifyJS will notice the constants and, since they cannot be altered, it
+will evaluate references to them to the value itself and drop unreachable
+code as usual.  The build will contain the `const` declarations if you use
+them. If you are targeting < ES6 environments which does not support `const`,
+using `var` with `reduce_vars` (enabled by default) should suffice.
 
-To generate a source map:
-```javascript
-var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], {
-	outSourceMap: "out.js.map"
-});
-console.log(result.code); // minified output
-console.log(result.map);
-```
+### Conditional compilation API
 
-Note that the source map is not saved in a file, it's just returned in
-`result.map`.  The value passed for `outSourceMap` is only used to set the
-`file` attribute in the source map (see [the spec][sm-spec]).
+You can also use conditional compilation via the programmatic API. With the difference that the
+property name is `global_defs` and is a compressor property:
 
-You can also specify sourceRoot property to be included in source map:
 ```javascript
-var result = UglifyJS.minify([ "file1.js", "file2.js", "file3.js" ], {
-	outSourceMap: "out.js.map",
-	sourceRoot: "http://example.com/src"
+var result = UglifyJS.minify(fs.readFileSync("input.js", "utf8"), {
+    compress: {
+        dead_code: true,
+        global_defs: {
+            DEBUG: false
+        }
+    }
 });
 ```
 
-If you're compressing compiled JavaScript and have a source map for it, you
-can use the `inSourceMap` argument:
+To replace an identifier with an arbitrary non-constant expression it is
+necessary to prefix the `global_defs` key with `"@"` to instruct UglifyJS
+to parse the value as an expression:
 ```javascript
-var result = UglifyJS.minify("compiled.js", {
-	inSourceMap: "compiled.js.map",
-	outSourceMap: "minified.js.map"
-});
-// same as before, it returns `code` and `map`
+UglifyJS.minify("alert('hello');", {
+    compress: {
+        global_defs: {
+            "@alert": "console.log"
+        }
+    }
+}).code;
+// returns: 'console.log("hello");'
 ```
 
-If your input source map is not in a file, you can pass it in as an object
-using the `inSourceMap` argument:
-
+Otherwise it would be replaced as string literal:
 ```javascript
-var result = UglifyJS.minify("compiled.js", {
-	inSourceMap: JSON.parse(my_source_map_string),
-	outSourceMap: "minified.js.map"
-});
+UglifyJS.minify("alert('hello');", {
+    compress: {
+        global_defs: {
+            "alert": "console.log"
+        }
+    }
+}).code;
+// returns: '"console.log"("hello");'
 ```
 
-The `inSourceMap` is only used if you also request `outSourceMap` (it makes
-no sense otherwise).
-
-Other options:
-
-- `warnings` (default `false`) — pass `true` to display compressor warnings.
-
-- `fromString` (default `false`) — if you pass `true` then you can pass
-  JavaScript source code, rather than file names.
-
-- `mangle` — pass `false` to skip mangling names.
-
-- `output` (default `null`) — pass an object if you wish to specify
-  additional [output options][codegen].  The defaults are optimized
-  for best compression.
-
-- `compress` (default `{}`) — pass `false` to skip compressing entirely.
-  Pass an object to specify custom [compressor options][compressor].
-
-We could add more options to `UglifyJS.minify` — if you need additional
-functionality please suggest!
-
-### The hard way
-
-Following there's more detailed API info, in case the `minify` function is
-too simple for your needs.
-
-#### The parser
+### Using native Uglify AST with `minify()`
 ```javascript
-var toplevel_ast = UglifyJS.parse(code, options);
-```
-
-`options` is optional and if present it must be an object.  The following
-properties are available:
+// example: parse only, produce native Uglify AST
 
-- `strict` — disable automatic semicolon insertion and support for trailing
-  comma in arrays and objects
-- `filename` — the name of the file where this code is coming from
-- `toplevel` — a `toplevel` node (as returned by a previous invocation of
-  `parse`)
-
-The last two options are useful when you'd like to minify multiple files and
-get a single file as the output and a proper source map.  Our CLI tool does
-something like this:
-```javascript
-var toplevel = null;
-files.forEach(function(file){
-	var code = fs.readFileSync(file, "utf8");
-	toplevel = UglifyJS.parse(code, {
-		filename: file,
-		toplevel: toplevel
-	});
+var result = UglifyJS.minify(code, {
+    parse: {},
+    compress: false,
+    mangle: false,
+    output: {
+        ast: true,
+        code: false  // optional - faster if false
+    }
 });
-```
 
-After this, we have in `toplevel` a big AST containing all our files, with
-each token having proper information about where it came from.
-
-#### Scope information
-
-UglifyJS contains a scope analyzer that you need to call manually before
-compressing or mangling.  Basically it augments various nodes in the AST
-with information about where is a name defined, how many times is a name
-referenced, if it is a global or not, if a function is using `eval` or the
-`with` statement etc.  I will discuss this some place else, for now what's
-important to know is that you need to call the following before doing
-anything with the tree:
-```javascript
-toplevel.figure_out_scope()
+// result.ast contains native Uglify AST
 ```
+```javascript
+// example: accept native Uglify AST input and then compress and mangle
+//          to produce both code and native AST.
 
-#### Compression
+var result = UglifyJS.minify(ast, {
+    compress: {},
+    mangle: {},
+    output: {
+        ast: true,
+        code: true  // optional - faster if false
+    }
+});
 
-Like this:
-```javascript
-var compressor = UglifyJS.Compressor(options);
-var compressed_ast = toplevel.transform(compressor);
+// result.ast contains native Uglify AST
+// result.code contains the minified code in string form.
 ```
 
-The `options` can be missing.  Available options are discussed above in
-“Compressor options”.  Defaults should lead to best compression in most
-scripts.
+### Working with Uglify AST
 
-The compressor is destructive, so don't rely that `toplevel` remains the
-original tree.
+Transversal and transformation of the native AST can be performed through
+[`TreeWalker`](https://github.com/mishoo/UglifyJS/blob/master/lib/ast.js) and
+[`TreeTransformer`](https://github.com/mishoo/UglifyJS/blob/master/lib/transform.js)
+respectively.
 
-#### Mangling
-
-After compression it is a good idea to call again `figure_out_scope` (since
-the compressor might drop unused variables / unreachable code and this might
-change the number of identifiers or their position).  Optionally, you can
-call a trick that helps after Gzip (counting character frequency in
-non-mangleable words).  Example:
-```javascript
-compressed_ast.figure_out_scope();
-compressed_ast.compute_char_frequency();
-compressed_ast.mangle_names();
-```
+### ESTree / SpiderMonkey AST
 
-#### Generating output
+UglifyJS has its own abstract syntax tree format; for
+[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)
+we can't easily change to using the SpiderMonkey AST internally.  However,
+UglifyJS now has a converter which can import a SpiderMonkey AST.
 
-AST nodes have a `print` method that takes an output stream.  Essentially,
-to generate code you do this:
-```javascript
-var stream = UglifyJS.OutputStream(options);
-compressed_ast.print(stream);
-var code = stream.toString(); // this is your minified code
-```
+For example [Acorn][acorn] is a super-fast parser that produces a
+SpiderMonkey AST.  It has a small CLI utility that parses one file and dumps
+the AST in JSON on the standard output.  To use UglifyJS to mangle and
+compress that:
 
-or, for a shortcut you can do:
-```javascript
-var code = compressed_ast.print_to_string(options);
-```
+    acorn file.js | uglifyjs -p spidermonkey -m -c
 
-As usual, `options` is optional.  The output stream accepts a lot of options,
-most of them documented above in section “Beautifier options”.  The two
-which we care about here are `source_map` and `comments`.
+The `-p spidermonkey` option tells UglifyJS that all input files are not
+JavaScript, but JS code described in SpiderMonkey AST in JSON.  Therefore we
+don't use our own parser in this case, but just transform that AST into our
+internal AST.
 
-#### Keeping comments in the output
+### Use Acorn for parsing
 
-In order to keep certain comments in the output you need to pass the
-`comments` option.  Pass a RegExp or a function.  If you pass a RegExp, only
-those comments whose body matches the regexp will be kept.  Note that body
-means without the initial `//` or `/*`.  If you pass a function, it will be
-called for every comment in the tree and will receive two arguments: the
-node that the comment is attached to, and the comment token itself.
+More for fun, I added the `-p acorn` option which will use Acorn to do all
+the parsing.  If you pass this option, UglifyJS will `require("acorn")`.
 
-The comment token has these properties:
+Acorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but
+converting the SpiderMonkey tree that Acorn produces takes another 150ms so
+in total it's a bit more than just using UglifyJS's own parser.
 
-- `type`: "comment1" for single-line comments or "comment2" for multi-line
-  comments
-- `value`: the comment body
-- `pos` and `endpos`: the start/end positions (zero-based indexes) in the
-  original code where this comment appears
-- `line` and `col`: the line and column where this comment appears in the
-  original code
-- `file` — the file name of the original file
-- `nlb` — true if there was a newline before this comment in the original
-  code, or if this comment contains a newline.
+[acorn]: https://github.com/ternjs/acorn
+[sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k
 
-Your function should return `true` to keep the comment, or a falsy value
-otherwise.
+### Uglify Fast Minify Mode
 
-#### Generating a source mapping
+It's not well known, but whitespace removal and symbol mangling accounts
+for 95% of the size reduction in minified code for most JavaScript - not
+elaborate code transforms. One can simply disable `compress` to speed up
+Uglify builds by 3 to 5 times.
 
-You need to pass the `source_map` argument when calling `print`.  It needs
-to be a `SourceMap` object (which is a thin wrapper on top of the
-[source-map][source-map] library).
+| d3.js | minify size | gzip size | minify time (seconds) |
+| --- | ---: | ---: | ---: |
+| original | 511,371 | 119,932 | - |
+| uglify-js@3.13.0 mangle=false, compress=false | 363,988 | 95,695 | 0.56 |
+| uglify-js@3.13.0 mangle=true, compress=false | 253,305 | 81,281 | 0.99 |
+| uglify-js@3.13.0 mangle=true, compress=true | 244,436 | 79,854 | 5.30 |
 
-Example:
+To enable fast minify mode from the CLI use:
+```
+uglifyjs file.js -m
+```
+To enable fast minify mode with the API use:
 ```javascript
-var source_map = UglifyJS.SourceMap(source_map_options);
-var stream = UglifyJS.OutputStream({
-	...
-	source_map: source_map
-});
-compressed_ast.print(stream);
-
-var code = stream.toString();
-var map = source_map.toString(); // json output for your source map
+UglifyJS.minify(code, { compress: false, mangle: true });
 ```
 
-The `source_map_options` (optional) can contain the following properties:
+### Source maps and debugging
 
-- `file`: the name of the JavaScript output file that this mapping refers to
-- `root`: the `sourceRoot` property (see the [spec][sm-spec])
-- `orig`: the "original source map", handy when you compress generated JS
-  and want to map the minified output back to the original code where it
-  came from.  It can be simply a string in JSON, or a JSON object containing
-  the original source map.
-
-  [acorn]: https://github.com/marijnh/acorn
-  [source-map]: https://github.com/mozilla/source-map
-  [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
-  [codegen]: http://lisperator.net/uglifyjs/codegen
-  [compressor]: http://lisperator.net/uglifyjs/compress
+Various `compress` transforms that simplify, rearrange, inline and remove code
+are known to have an adverse effect on debugging with source maps. This is
+expected as code is optimized and mappings are often simply not possible as
+some code no longer exists. For highest fidelity in source map debugging
+disable the Uglify `compress` option and just use `mangle`.
+
+### Compiler assumptions
+
+To allow for better optimizations, the compiler makes various assumptions:
+
+- The code does not rely on preserving its runtime performance characteristics.
+  Typically uglified code will run faster due to less instructions and easier
+  inlining, but may be slower on rare occasions for a specific platform, e.g.
+  see [`reduce_funcs`](#compress-options).
+- `.toString()` and `.valueOf()` don't have side effects, and for built-in
+  objects they have not been overridden.
+- `undefined`, `NaN` and `Infinity` have not been externally redefined.
+- `arguments.callee`, `arguments.caller` and `Function.prototype.caller` are not used.
+- The code doesn't expect the contents of `Function.prototype.toString()` or
+  `Error.prototype.stack` to be anything in particular.
+- Getting and setting properties on a plain object does not cause other side effects
+  (using `.watch()` or `Proxy`).
+- Object properties can be added, removed and modified (not prevented with
+  `Object.defineProperty()`, `Object.defineProperties()`, `Object.freeze()`,
+  `Object.preventExtensions()` or `Object.seal()`).
+- If array destructuring is present, index-like properties in `Array.prototype`
+  have not been overridden:
+  ```javascript
+  Object.prototype[0] = 42;
+  var [ a ] = [];
+  var { 0: b } = {};
+  // 42 undefined
+  console.log([][0], a);
+  // 42 42
+  console.log({}[0], b);
+  ```
+- Earlier versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  ({
+      p: 42,
+      get p() {},
+  });
+  // SyntaxError: Object literal may not have data and accessor property with
+  //              the same name
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Iteration order of keys over an object which contains spread syntax in later
+  versions of Chrome and Node.js may be altered.
+- When `toplevel` is enabled, UglifyJS effectively assumes input code is wrapped
+  within `function(){ ... }`, thus forbids aliasing of declared global variables:
+  ```javascript
+  A = "FAIL";
+  var B = "FAIL";
+  // can be `global`, `self`, `window` etc.
+  var top = function() {
+      return this;
+  }();
+  // "PASS"
+  top.A = "PASS";
+  console.log(A);
+  // "FAIL" after compress and/or mangle
+  top.B = "PASS";
+  console.log(B);
+  ```
+- Use of `arguments` alongside destructuring as function parameters, e.g.
+  `function({}, arguments) {}` will result in `SyntaxError` in earlier versions
+  of Chrome and Node.js - UglifyJS may modify the input which in turn may
+  suppress those errors.
+- Earlier versions of Chrome and Node.js will throw `ReferenceError` with the
+  following:
+  ```javascript
+  var a;
+  try {
+      throw 42;
+  } catch ({
+      [a]: b,
+      // ReferenceError: a is not defined
+  }) {
+      let a;
+  }
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  a => {
+      let a;
+  };
+  // SyntaxError: Identifier 'a' has already been declared
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  try {
+      // ...
+  } catch ({ message: a }) {
+      var a;
+  }
+  // SyntaxError: Identifier 'a' has already been declared
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of Chrome and Node.js will throw `ReferenceError` with the
+  following:
+  ```javascript
+  console.log(((a, b = function() {
+      return a;
+      // ReferenceError: a is not defined
+  }()) => b)());
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some arithmetic operations with `BigInt` may throw `TypeError`:
+  ```javascript
+  1n + 1;
+  // TypeError: can't convert BigInt to number
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of JavaScript will throw `SyntaxError` with the
+  following:
+  ```javascript
+  console.log(String.raw`\uFo`);
+  // SyntaxError: Invalid Unicode escape sequence
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of JavaScript will throw `SyntaxError` with the
+  following:
+  ```javascript
+  try {} catch (e) {
+      for (var e of []);
+  }
+  // SyntaxError: Identifier 'e' has already been declared
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  console.log({
+      ...{
+          set 42(v) {},
+          42: "PASS",
+      },
+  });
+  // Expected: { '42': 'PASS' }
+  // Actual:   { '42': undefined }
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  var await;
+  class A {
+      static p = await;
+  }
+  // SyntaxError: Unexpected reserved word
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  var async;
+  for (async of []);
+  // SyntaxError: The left-hand side of a for-of loop may not be 'async'.
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  console.log({
+      ...console,
+      get 42() {
+          return "FAIL";
+      },
+      [42]: "PASS",
+  }[42], {
+      ...console,
+      get 42() {
+          return "FAIL";
+      },
+      42: "PASS",
+  }[42]);
+  // Expected: "PASS PASS"
+  // Actual:   "PASS FAIL"
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Earlier versions of JavaScript will throw `TypeError` with the following:
+  ```javascript
+  (function() {
+      {
+          const a = "foo";
+      }
+      {
+          const a = "bar";
+      }
+  })();
+  // TypeError: const 'a' has already been declared
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  try {
+      class A {
+          static 42;
+          static get 42() {}
+      }
+      console.log("PASS");
+  } catch (e) {
+      console.log("FAIL");
+  }
+  // Expected: "PASS"
+  // Actual:   "FAIL"
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Some versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  (async function(a) {
+      (function() {
+          var b = await => console.log("PASS");
+          b();
+      })();
+  })().catch(console.error);
+  // Expected: "PASS"
+  // Actual:   SyntaxError: Unexpected reserved word
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of Chrome and Node.js will give incorrect results with the
+  following:
+  ```javascript
+  try {
+      f();
+      function f() {
+          throw 42;
+      }
+  } catch (e) {
+      console.log(typeof f, e);
+  }
+  // Expected: "function 42"
+  // Actual:   "undefined 42"
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Later versions of JavaScript will throw `SyntaxError` with the following:
+  ```javascript
+  "use strict";
+  console.log(function f() {
+      return f = "PASS";
+  }());
+  // Expected: "PASS"
+  // Actual:   TypeError: invalid assignment to const 'f'
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Adobe ExtendScript will give incorrect results with the following:
+  ```javascript
+  alert(true ? "PASS" : false ? "FAIL" : null);
+  // Expected: "PASS"
+  // Actual:   "FAIL"
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
+- Adobe ExtendScript will give incorrect results with the following:
+  ```javascript
+  alert(42 ? null ? "FAIL" : "PASS" : "FAIL");
+  // Expected: "PASS"
+  // Actual:   SyntaxError: Expected: :
+  ```
+  UglifyJS may modify the input which in turn may suppress those errors.
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/bin/uglifyjs
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/bin/uglifyjs	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/bin/uglifyjs	(working copy)
@@ -3,558 +3,603 @@
 
 "use strict";
 
-var UglifyJS = require("../tools/node");
-var sys = require("util");
-var yargs = require("yargs");
+require("../tools/tty");
+
 var fs = require("fs");
+var info = require("../package.json");
 var path = require("path");
-var async = require("async");
-var acorn;
-var ARGS = yargs
-    .usage("$0 input1.js [input2.js ...] [options]\n\
-Use a single dash to read input from the standard input.\
-\n\n\
-NOTE: by default there is no mangling/compression.\n\
-Without [options] it will simply parse input files and dump the AST\n\
-with whitespace and comments discarded.  To achieve compression and\n\
-mangling you need to use `-c` and `-m`.\
-")
-    .describe("source-map", "Specify an output file where to generate source map.")
-    .describe("source-map-root", "The path to the original source to be included in the source map.")
-    .describe("source-map-url", "The path to the source map to be added in //# sourceMappingURL.  Defaults to the value passed with --source-map.")
-    .describe("source-map-include-sources", "Pass this flag if you want to include the content of source files in the source map as sourcesContent property.")
-    .describe("in-source-map", "Input source map, useful if you're compressing JS that was generated from some other original code.")
-    .describe("screw-ie8", "Pass this flag if you don't care about full compliance with Internet Explorer 6-8 quirks (by default UglifyJS will try to be IE-proof).")
-    .describe("expr", "Parse a single expression, rather than a program (for parsing JSON)")
-    .describe("p", "Skip prefix for original filenames that appear in source maps. \
-For example -p 3 will drop 3 directories from file names and ensure they are relative paths. \
-You can also specify -p relative, which will make UglifyJS figure out itself the relative paths between original sources, \
-the source map and the output file.")
-    .describe("o", "Output file (default STDOUT).")
-    .describe("b", "Beautify output/specify output options.")
-    .describe("m", "Mangle names/pass mangler options.")
-    .describe("r", "Reserved names to exclude from mangling.")
-    .describe("c", "Enable compressor/pass compressor options. \
-Pass options like -c hoist_vars=false,if_return=false. \
-Use -c with no argument to use the default compression options.")
-    .describe("d", "Global definitions")
-    .describe("e", "Embed everything in a big function, with a configurable parameter/argument list.")
-
-    .describe("comments", "Preserve copyright comments in the output. \
-By default this works like Google Closure, keeping JSDoc-style comments that contain \"@license\" or \"@preserve\". \
-You can optionally pass one of the following arguments to this flag:\n\
-- \"all\" to keep all comments\n\
-- a valid JS regexp (needs to start with a slash) to keep only comments that match.\n\
-\
-Note that currently not *all* comments can be kept when compression is on, \
-because of dead code removal or cascading statements into sequences.")
-
-    .describe("preamble", "Preamble to prepend to the output.  You can use this to insert a \
-comment, for example for licensing information.  This will not be \
-parsed, but the source map will adjust for its presence.")
-
-    .describe("stats", "Display operations run time on STDERR.")
-    .describe("acorn", "Use Acorn for parsing.")
-    .describe("spidermonkey", "Assume input files are SpiderMonkey AST format (as JSON).")
-    .describe("self", "Build itself (UglifyJS2) as a library (implies --wrap=UglifyJS --export-all)")
-    .describe("wrap", "Embed everything in a big function, making the “exports” and “global” variables available. \
-You need to pass an argument to this option to specify the name that your module will take when included in, say, a browser.")
-    .describe("export-all", "Only used when --wrap, this tells UglifyJS to add code to automatically export all globals.")
-    .describe("lint", "Display some scope warnings")
-    .describe("v", "Verbose")
-    .describe("V", "Print version number and exit.")
-    .describe("noerr", "Don't throw an error for unknown options in -c, -b or -m.")
-    .describe("bare-returns", "Allow return outside of functions.  Useful when minifying CommonJS modules.")
-    .describe("keep-fnames", "Do not mangle/drop function names.  Useful for code relying on Function.prototype.name.")
-    .describe("quotes", "Quote style (0 - auto, 1 - single, 2 - double, 3 - original)")
-    .describe("reserved-file", "File containing reserved names")
-    .describe("reserve-domprops", "Make (most?) DOM properties reserved for --mangle-props")
-    .describe("mangle-props", "Mangle property names")
-    .describe("mangle-regex", "Only mangle property names matching the regex")
-    .describe("name-cache", "File to hold mangled names mappings")
-
-    .alias("p", "prefix")
-    .alias("o", "output")
-    .alias("v", "verbose")
-    .alias("b", "beautify")
-    .alias("m", "mangle")
-    .alias("c", "compress")
-    .alias("d", "define")
-    .alias("r", "reserved")
-    .alias("V", "version")
-    .alias("e", "enclose")
-    .alias("q", "quotes")
-
-    .string("source-map")
-    .string("source-map-root")
-    .string("source-map-url")
-    .string("b")
-    .string("beautify")
-    .string("m")
-    .string("mangle")
-    .string("c")
-    .string("compress")
-    .string("d")
-    .string("define")
-    .string("e")
-    .string("enclose")
-    .string("comments")
-    .string("wrap")
-    .string("p")
-    .string("prefix")
-    .string("name-cache")
-    .array("reserved-file")
-
-    .boolean("expr")
-    .boolean("source-map-include-sources")
-    .boolean("screw-ie8")
-    .boolean("export-all")
-    .boolean("self")
-    .boolean("v")
-    .boolean("verbose")
-    .boolean("stats")
-    .boolean("acorn")
-    .boolean("spidermonkey")
-    .boolean("lint")
-    .boolean("V")
-    .boolean("version")
-    .boolean("noerr")
-    .boolean("bare-returns")
-    .boolean("keep-fnames")
-    .boolean("mangle-props")
-    .boolean("reserve-domprops")
-
-    .wrap(80)
-
-    .argv
-;
-
-normalize(ARGS);
-
-if (ARGS.noerr) {
-    UglifyJS.DefaultsError.croak = function(msg, defs) {
-        print_error("WARN: " + msg);
-    };
-}
-
-if (ARGS.version || ARGS.V) {
-    var json = require("../package.json");
-    print(json.name + ' ' + json.version);
-    process.exit(0);
-}
-
-if (ARGS.ast_help) {
-    var desc = UglifyJS.describe_ast();
-    print(typeof desc == "string" ? desc : JSON.stringify(desc, null, 2));
-    process.exit(0);
-}
-
-if (ARGS.h || ARGS.help) {
-    print(yargs.help());
-    process.exit(0);
-}
-
-if (ARGS.acorn) {
-    acorn = require("acorn");
-}
-
-var COMPRESS = getOptions("c", true);
-var MANGLE = getOptions("m", true);
-var BEAUTIFY = getOptions("b", true);
-var RESERVED = null;
-
-if (ARGS.reserved_file) ARGS.reserved_file.forEach(function(filename){
-    RESERVED = UglifyJS.readReservedFile(filename, RESERVED);
-});
-
-if (ARGS.reserve_domprops) {
-    RESERVED = UglifyJS.readDefaultReservedFile(RESERVED);
-}
-
-if (ARGS.d) {
-    if (COMPRESS) COMPRESS.global_defs = getOptions("d");
-}
-
-if (ARGS.r) {
-    if (MANGLE) MANGLE.except = ARGS.r.replace(/^\s+|\s+$/g).split(/\s*,+\s*/);
-}
-
-if (RESERVED && MANGLE) {
-    if (!MANGLE.except) MANGLE.except = RESERVED.vars;
-    else MANGLE.except = MANGLE.except.concat(RESERVED.vars);
-}
-
-function readNameCache(key) {
-    return UglifyJS.readNameCache(ARGS.name_cache, key);
-}
-
-function writeNameCache(key, cache) {
-    return UglifyJS.writeNameCache(ARGS.name_cache, key, cache);
-}
-
-function extractRegex(str) {
-  if (/^\/.*\/[a-zA-Z]*$/.test(str)) {
-    var regex_pos = str.lastIndexOf("/");
-    return new RegExp(str.substr(1, regex_pos - 1), str.substr(regex_pos + 1));
-  } else {
-    throw new Error("Invalid regular expression: " + str);
-  }
-}
+var UglifyJS = require("../tools/node");
 
-if (ARGS.quotes === true) {
-    ARGS.quotes = 3;
-}
+var skip_keys = [ "cname", "fixed", "in_arg", "inlined", "length_read", "parent_scope", "redef", "scope", "unused" ];
+var truthy_keys = [ "optional", "pure", "terminal", "uses_arguments", "uses_eval", "uses_with" ];
 
-var OUTPUT_OPTIONS = {
-    beautify    : BEAUTIFY ? true : false,
-    preamble    : ARGS.preamble || null,
-    quote_style : ARGS.quotes != null ? ARGS.quotes : 0
+var files = {};
+var options = {};
+var short_forms = {
+    b: "beautify",
+    c: "compress",
+    d: "define",
+    e: "enclose",
+    h: "help",
+    m: "mangle",
+    o: "output",
+    O: "output-opts",
+    p: "parse",
+    v: "version",
+    V: "version",
 };
+var args = process.argv.slice(2);
+var paths = [];
+var output, nameCache;
+var specified = {};
+while (args.length) {
+    var arg = args.shift();
+    if (arg[0] != "-") {
+        paths.push(arg);
+    } else if (arg == "--") {
+        paths = paths.concat(args);
+        break;
+    } else if (arg[1] == "-") {
+        process_option(arg.slice(2));
+    } else [].forEach.call(arg.slice(1), function(letter, index, arg) {
+        if (!(letter in short_forms)) fatal("invalid option -" + letter);
+        process_option(short_forms[letter], index + 1 < arg.length);
+    });
+}
 
-if (ARGS.screw_ie8) {
-    if (COMPRESS) COMPRESS.screw_ie8 = true;
-    if (MANGLE) MANGLE.screw_ie8 = true;
-    OUTPUT_OPTIONS.screw_ie8 = true;
-}
-
-if (ARGS.keep_fnames) {
-    if (COMPRESS) COMPRESS.keep_fnames = true;
-    if (MANGLE) MANGLE.keep_fnames = true;
-}
-
-if (BEAUTIFY)
-    UglifyJS.merge(OUTPUT_OPTIONS, BEAUTIFY);
-
-if (ARGS.comments != null) {
-    if (/^\/.*\/[a-zA-Z]*$/.test(ARGS.comments)) {
-        try {
-            OUTPUT_OPTIONS.comments = extractRegex(ARGS.comments);
-        } catch (e) {
-            print_error("ERROR: Invalid --comments: " + e.message);
-        }
-    } else if (ARGS.comments == "all") {
-        OUTPUT_OPTIONS.comments = true;
-    } else {
-        OUTPUT_OPTIONS.comments = function(node, comment) {
-            var text = comment.value;
-            var type = comment.type;
-            if (type == "comment2") {
-                // multiline comment
-                return /@preserve|@license|@cc_on/i.test(text);
+function process_option(name, no_value) {
+    specified[name] = true;
+    switch (name) {
+      case "help":
+        switch (read_value()) {
+          case "ast":
+            print(UglifyJS.describe_ast());
+            break;
+          case "options":
+            var text = [];
+            var toplevels = [];
+            var padding = "";
+            var defaults = UglifyJS.default_options();
+            for (var name in defaults) {
+                var option = defaults[name];
+                if (option && typeof option == "object") {
+                    text.push("--" + ({
+                        output: "beautify",
+                        sourceMap: "source-map",
+                    }[name] || name) + " options:");
+                    text.push(format_object(option));
+                    text.push("");
+                } else {
+                    if (padding.length < name.length) padding = Array(name.length + 1).join(" ");
+                    toplevels.push([ {
+                        keep_fargs: "keep-fargs",
+                        keep_fnames: "keep-fnames",
+                        nameCache: "name-cache",
+                    }[name] || name, option ]);
+                }
             }
+            toplevels.forEach(function(tokens) {
+                text.push("--" + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]);
+            });
+            print(text.join("\n"));
+            break;
+          default:
+            print([
+                "Usage: uglifyjs [files...] [options]",
+                "",
+                "Options:",
+                "  -h, --help                               Print usage information.",
+                "                                           `--help options` for details on available options.",
+                "  -v, -V, --version                        Print version number.",
+                "  -p, --parse <options>                    Specify parser options.",
+                "  -c, --compress [options]                 Enable compressor/specify compressor options.",
+                "  -m, --mangle [options]                   Mangle names/specify mangler options.",
+                "  --mangle-props [options]                 Mangle properties/specify mangler options.",
+                "  -b, --beautify [options]                 Beautify output/specify output options.",
+                "  -O, --output-opts <options>              Output options (beautify disabled).",
+                "  -o, --output <file>                      Output file (default STDOUT).",
+                "  --annotations                            Process and preserve comment annotations.",
+                "  --no-annotations                         Ignore and discard comment annotations.",
+                "  --comments [filter]                      Preserve copyright comments in the output.",
+                "  --config-file <file>                     Read minify() options from JSON file.",
+                "  -d, --define <expr>[=value]              Global definitions.",
+                "  -e, --enclose [arg[,...][:value[,...]]]  Embed everything in a big function, with configurable argument(s) & value(s).",
+                "  --expression                             Parse a single expression, rather than a program.",
+                "  --ie                                     Support non-standard Internet Explorer.",
+                "  --keep-fargs                             Do not mangle/drop function arguments.",
+                "  --keep-fnames                            Do not mangle/drop function names. Useful for code relying on Function.prototype.name.",
+                "  --module                                 Process input as ES module (implies --toplevel)",
+                "  --name-cache <file>                      File to hold mangled name mappings.",
+                "  --rename                                 Force symbol expansion.",
+                "  --no-rename                              Disable symbol expansion.",
+                "  --self                                   Build UglifyJS as a library (implies --wrap UglifyJS)",
+                "  --source-map [options]                   Enable source map/specify source map options.",
+                "  --timings                                Display operations run time on STDERR.",
+                "  --toplevel                               Compress and/or mangle variables in toplevel scope.",
+                "  --v8                                     Support non-standard Chrome & Node.js.",
+                "  --validate                               Perform validation during AST manipulations.",
+                "  --verbose                                Print diagnostic messages.",
+                "  --warn                                   Print warning messages.",
+                "  --webkit                                 Support non-standard Safari/Webkit.",
+                "  --wrap <name>                            Embed everything as a function with “exports” corresponding to “name” globally.",
+                "",
+                "(internal debug use only)",
+                "  --in-situ                                Warning: replaces original source files with minified output.",
+                "  --reduce-test                            Reduce a standalone test case (assumes cloned repository).",
+            ].join("\n"));
         }
+        process.exit();
+      case "version":
+        print(info.name + " " + info.version);
+        process.exit();
+      case "config-file":
+        var config = JSON.parse(read_file(read_value(true)));
+        if (config.mangle && config.mangle.properties && config.mangle.properties.regex) {
+            config.mangle.properties.regex = UglifyJS.parse(config.mangle.properties.regex, {
+                expression: true,
+            }).value;
+        }
+        for (var key in config) if (!(key in options)) options[key] = config[key];
+        break;
+      case "compress":
+      case "mangle":
+        options[name] = parse_js(read_value(), options[name]);
+        break;
+      case "source-map":
+        options.sourceMap = parse_js(read_value(), options.sourceMap);
+        break;
+      case "enclose":
+        options[name] = read_value();
+        break;
+      case "annotations":
+      case "expression":
+      case "ie":
+      case "ie8":
+      case "module":
+      case "timings":
+      case "toplevel":
+      case "v8":
+      case "validate":
+      case "webkit":
+        options[name] = true;
+        break;
+      case "no-annotations":
+        options.annotations = false;
+        break;
+      case "keep-fargs":
+        options.keep_fargs = true;
+        break;
+      case "keep-fnames":
+        options.keep_fnames = true;
+        break;
+      case "wrap":
+        options[name] = read_value(true);
+        break;
+      case "verbose":
+        options.warnings = "verbose";
+        break;
+      case "warn":
+        if (!options.warnings) options.warnings = true;
+        break;
+      case "beautify":
+        options.output = parse_js(read_value(), options.output);
+        if (!("beautify" in options.output)) options.output.beautify = true;
+        break;
+      case "output-opts":
+        options.output = parse_js(read_value(true), options.output);
+        break;
+      case "comments":
+        if (typeof options.output != "object") options.output = {};
+        options.output.comments = read_value();
+        if (options.output.comments === true) options.output.comments = "some";
+        break;
+      case "define":
+        if (typeof options.compress != "object") options.compress = {};
+        options.compress.global_defs = parse_js(read_value(true), options.compress.global_defs, "define");
+        break;
+      case "mangle-props":
+        if (typeof options.mangle != "object") options.mangle = {};
+        options.mangle.properties = parse_js(read_value(), options.mangle.properties);
+        break;
+      case "name-cache":
+        nameCache = read_value(true);
+        options.nameCache = JSON.parse(read_file(nameCache, "{}"));
+        break;
+      case "output":
+        output = read_value(true);
+        break;
+      case "parse":
+        options.parse = parse_js(read_value(true), options.parse);
+        break;
+      case "rename":
+        options.rename = true;
+        break;
+      case "no-rename":
+        options.rename = false;
+        break;
+      case "in-situ":
+      case "reduce-test":
+      case "self":
+        break;
+      default:
+        fatal("invalid option --" + name);
+    }
+
+    function read_value(required) {
+        if (no_value || !args.length || args[0][0] == "-") {
+            if (required) fatal("missing option argument for --" + name);
+            return true;
+        }
+        return args.shift();
     }
 }
-
-var files = ARGS._.slice();
-
-if (ARGS.self) {
-    if (files.length > 0) {
-        print_error("WARN: Ignoring input files since --self was passed");
-    }
-    files = UglifyJS.FILES;
-    if (!ARGS.wrap) ARGS.wrap = "UglifyJS";
-    ARGS.export_all = true;
-}
-
-var ORIG_MAP = ARGS.in_source_map;
-
-if (ORIG_MAP) {
-    ORIG_MAP = JSON.parse(fs.readFileSync(ORIG_MAP));
-    if (files.length == 0) {
-        print_error("INFO: Using file from the input source map: " + ORIG_MAP.file);
-        files = [ ORIG_MAP.file ];
-    }
-    if (ARGS.source_map_root == null) {
-        ARGS.source_map_root = ORIG_MAP.sourceRoot;
-    }
-}
-
-if (files.length == 0) {
-    files = [ "-" ];
+if (!output && options.sourceMap && options.sourceMap.url != "inline") fatal("cannot write source map to STDOUT");
+if (specified["beautify"] && specified["output-opts"]) fatal("--beautify cannot be used with --output-opts");
+[ "compress", "mangle" ].forEach(function(name) {
+    if (!(name in options)) options[name] = false;
+});
+if (/^ast|spidermonkey$/.test(output)) {
+    if (typeof options.output != "object") options.output = {};
+    options.output.ast = true;
+    options.output.code = false;
+}
+if (options.parse && (options.parse.acorn || options.parse.spidermonkey)
+    && options.sourceMap && options.sourceMap.content == "inline") {
+    fatal("inline source map only works with built-in parser");
+}
+if (options.warnings) {
+    UglifyJS.AST_Node.log_function(print_error, options.warnings == "verbose");
+    delete options.warnings;
 }
-
-if (files.indexOf("-") >= 0 && ARGS.source_map) {
-    print_error("ERROR: Source map doesn't work with input from STDIN");
-    process.exit(1);
+var convert_path = function(name) {
+    return name;
+};
+if (typeof options.sourceMap == "object" && "base" in options.sourceMap) {
+    convert_path = function() {
+        var base = options.sourceMap.base;
+        delete options.sourceMap.base;
+        return function(name) {
+            return path.relative(base, name);
+        };
+    }();
+}
+if (specified["self"]) {
+    if (paths.length) UglifyJS.AST_Node.warn("Ignoring input files since --self was passed");
+    if (!options.wrap) options.wrap = "UglifyJS";
+    paths = UglifyJS.FILES;
+} else if (paths.length) {
+    paths = simple_glob(paths);
+}
+if (specified["in-situ"]) {
+    if (output && output != "spidermonkey" || specified["reduce-test"] || specified["self"]) {
+        fatal("incompatible options specified");
+    }
+    paths.forEach(function(name) {
+        print(name);
+        if (/^ast|spidermonkey$/.test(name)) fatal("invalid file name specified");
+        files = {};
+        files[convert_path(name)] = read_file(name);
+        output = name;
+        run();
+    });
+} else if (paths.length) {
+    paths.forEach(function(name) {
+        files[convert_path(name)] = read_file(name);
+    });
+    run();
+} else {
+    var timerId = process.stdin.isTTY && process.argv.length < 3 && setTimeout(function() {
+        print_error("Waiting for input... (use `--help` to print usage information)");
+    }, 1500);
+    var chunks = [];
+    process.stdin.setEncoding("utf8");
+    process.stdin.once("data", function() {
+        clearTimeout(timerId);
+    }).on("data", function(chunk) {
+        chunks.push(chunk);
+    }).on("end", function() {
+        files = { STDIN: chunks.join("") };
+        run();
+    });
+    process.stdin.resume();
 }
 
-if (files.filter(function(el){ return el == "-" }).length > 1) {
-    print_error("ERROR: Can read a single file from STDIN (two or more dashes specified)");
-    process.exit(1);
+function convert_ast(fn) {
+    return UglifyJS.AST_Node.from_mozilla_ast(Object.keys(files).reduce(fn, null));
 }
 
-var STATS = {};
-var OUTPUT_FILE = ARGS.o;
-var TOPLEVEL = null;
-var P_RELATIVE = ARGS.p && ARGS.p == "relative";
-var SOURCES_CONTENT = {};
-
-var SOURCE_MAP = ARGS.source_map ? UglifyJS.SourceMap({
-    file: P_RELATIVE ? path.relative(path.dirname(ARGS.source_map), OUTPUT_FILE) : OUTPUT_FILE,
-    root: ARGS.source_map_root,
-    orig: ORIG_MAP,
-}) : null;
-
-OUTPUT_OPTIONS.source_map = SOURCE_MAP;
-
-try {
-    var output = UglifyJS.OutputStream(OUTPUT_OPTIONS);
-    var compressor = COMPRESS && UglifyJS.Compressor(COMPRESS);
-} catch(ex) {
-    if (ex instanceof UglifyJS.DefaultsError) {
-        print_error(ex.msg);
-        print_error("Supported options:");
-        print_error(sys.inspect(ex.defs));
-        process.exit(1);
+function run() {
+    var content = options.sourceMap && options.sourceMap.content;
+    if (content && content != "inline") {
+        UglifyJS.AST_Node.info("Using input source map: {content}", {
+            content : content,
+        });
+        options.sourceMap.content = read_file(content, content);
     }
-}
-
-async.eachLimit(files, 1, function (file, cb) {
-    read_whole_file(file, function (err, code) {
-        if (err) {
-            print_error("ERROR: can't read file: " + file);
-            process.exit(1);
+    try {
+        if (options.parse) {
+            if (options.parse.acorn) {
+                var annotations = Object.create(null);
+                files = convert_ast(function(toplevel, name) {
+                    var content = files[name];
+                    var list = annotations[name] = [];
+                    var prev = -1;
+                    return require("acorn").parse(content, {
+                        allowHashBang: true,
+                        ecmaVersion: "latest",
+                        locations: true,
+                        onComment: function(block, text, start, end) {
+                            var match = /[@#]__PURE__/.exec(text);
+                            if (!match) {
+                                if (start != prev) return;
+                                match = [ list[prev] ];
+                            }
+                            while (/\s/.test(content[end])) end++;
+                            list[end] = match[0];
+                            prev = end;
+                        },
+                        preserveParens: true,
+                        program: toplevel,
+                        sourceFile: name,
+                        sourceType: "module",
+                    });
+                });
+                files.walk(new UglifyJS.TreeWalker(function(node) {
+                    if (!(node instanceof UglifyJS.AST_Call)) return;
+                    var list = annotations[node.start.file];
+                    var pure = list[node.start.pos];
+                    if (!pure) {
+                        var tokens = node.start.parens;
+                        if (tokens) for (var i = 0; !pure && i < tokens.length; i++) {
+                            pure = list[tokens[i].pos];
+                        }
+                    }
+                    if (pure) node.pure = pure;
+                }));
+            } else if (options.parse.spidermonkey) {
+                files = convert_ast(function(toplevel, name) {
+                    var obj = JSON.parse(files[name]);
+                    if (!toplevel) return obj;
+                    toplevel.body = toplevel.body.concat(obj.body);
+                    return toplevel;
+                });
+            }
         }
-        if (ARGS.p != null) {
-            if (P_RELATIVE) {
-                file = path.relative(path.dirname(ARGS.source_map), file).replace(/\\/g, '/');
-            } else {
-                var p = parseInt(ARGS.p, 10);
-                if (!isNaN(p)) {
-                    file = file.replace(/^\/+/, "").split(/\/+/).slice(ARGS.p).join("/");
+    } catch (ex) {
+        fatal(ex);
+    }
+    var result;
+    if (specified["reduce-test"]) {
+        // load on demand - assumes cloned repository
+        var reduce_test = require("../test/reduce");
+        if (Object.keys(files).length != 1) fatal("can only test on a single file");
+        result = reduce_test(files[Object.keys(files)[0]], options, {
+            log: print_error,
+            verbose: true,
+        });
+    } else {
+        result = UglifyJS.minify(files, options);
+    }
+    if (result.error) {
+        var ex = result.error;
+        if (ex.name == "SyntaxError") {
+            print_error("Parse error at " + ex.filename + ":" + ex.line + "," + ex.col);
+            var file = files[ex.filename];
+            if (file) {
+                var col = ex.col;
+                var lines = file.split(/\r?\n/);
+                var line = lines[ex.line - 1];
+                if (!line && !col) {
+                    line = lines[ex.line - 2];
+                    col = line.length;
+                }
+                if (line) {
+                    var limit = 70;
+                    if (col > limit) {
+                        line = line.slice(col - limit);
+                        col = limit;
+                    }
+                    print_error(line.slice(0, 80));
+                    print_error(line.slice(0, col).replace(/\S/g, " ") + "^");
                 }
             }
+        } else if (ex.defs) {
+            print_error("Supported options:");
+            print_error(format_object(ex.defs));
         }
-        SOURCES_CONTENT[file] = code;
-        time_it("parse", function(){
-            if (ARGS.spidermonkey) {
-                var program = JSON.parse(code);
-                if (!TOPLEVEL) TOPLEVEL = program;
-                else TOPLEVEL.body = TOPLEVEL.body.concat(program.body);
-            }
-            else if (ARGS.acorn) {
-                TOPLEVEL = acorn.parse(code, {
-                    locations     : true,
-                    sourceFile    : file,
-                    program       : TOPLEVEL
+        fatal(ex);
+    } else if (output == "ast") {
+        if (!options.compress && !options.mangle) {
+            var toplevel = result.ast;
+            if (!(toplevel instanceof UglifyJS.AST_Toplevel)) {
+                if (!(toplevel instanceof UglifyJS.AST_Statement)) toplevel = new UglifyJS.AST_SimpleStatement({
+                    body: toplevel,
+                });
+                toplevel = new UglifyJS.AST_Toplevel({
+                    body: [ toplevel ],
                 });
             }
-            else {
-                try {
-                    TOPLEVEL = UglifyJS.parse(code, {
-                        filename     : file,
-                        toplevel     : TOPLEVEL,
-                        expression   : ARGS.expr,
-                        bare_returns : ARGS.bare_returns,
-                    });
-                } catch(ex) {
-                    if (ex instanceof UglifyJS.JS_Parse_Error) {
-                        print_error("Parse error at " + file + ":" + ex.line + "," + ex.col);
-                        print_error(ex.message);
-                        print_error(ex.stack);
-                        process.exit(1);
-                    }
-                    throw ex;
-                }
-            };
-        });
-        cb();
-    });
-}, function () {
-    if (ARGS.acorn || ARGS.spidermonkey) time_it("convert_ast", function(){
-        TOPLEVEL = UglifyJS.AST_Node.from_mozilla_ast(TOPLEVEL);
-    });
-
-    if (ARGS.wrap != null) {
-        TOPLEVEL = TOPLEVEL.wrap_commonjs(ARGS.wrap, ARGS.export_all);
-    }
-
-    if (ARGS.enclose != null) {
-        var arg_parameter_list = ARGS.enclose;
-        if (arg_parameter_list === true) {
-            arg_parameter_list = [];
-        }
-        else if (!(arg_parameter_list instanceof Array)) {
-            arg_parameter_list = [arg_parameter_list];
-        }
-        TOPLEVEL = TOPLEVEL.wrap_enclose(arg_parameter_list);
-    }
-
-    if (ARGS.mangle_props || ARGS.name_cache) (function(){
-        var reserved = RESERVED ? RESERVED.props : null;
-        var cache = readNameCache("props");
-        var regex;
-
-        try {
-          regex = ARGS.mangle_regex ? extractRegex(ARGS.mangle_regex) : null;
-        } catch (e) {
-            print_error("ERROR: Invalid --mangle-regex: " + e.message);
-            process.exit(1);
+            toplevel.figure_out_scope({});
         }
-
-        TOPLEVEL = UglifyJS.mangle_properties(TOPLEVEL, {
-            reserved   : reserved,
-            cache      : cache,
-            only_cache : !ARGS.mangle_props,
-            regex      : regex
-        });
-        writeNameCache("props", cache);
-    })();
-
-    var SCOPE_IS_NEEDED = COMPRESS || MANGLE || ARGS.lint;
-    var TL_CACHE = readNameCache("vars");
-
-    if (SCOPE_IS_NEEDED) {
-        time_it("scope", function(){
-            TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
-            if (ARGS.lint) {
-                TOPLEVEL.scope_warnings();
+        print(JSON.stringify(result.ast, function(key, value) {
+            if (value) switch (key) {
+              case "enclosed":
+                return value.length ? value.map(symdef) : undefined;
+              case "functions":
+              case "globals":
+              case "variables":
+                return value.size() ? value.map(symdef) : undefined;
+              case "thedef":
+                return symdef(value);
             }
-        });
-    }
-
-    if (COMPRESS) {
-        time_it("squeeze", function(){
-            TOPLEVEL = TOPLEVEL.transform(compressor);
-        });
-    }
-
-    if (SCOPE_IS_NEEDED) {
-        time_it("scope", function(){
-            TOPLEVEL.figure_out_scope({ screw_ie8: ARGS.screw_ie8, cache: TL_CACHE });
-            if (MANGLE && !TL_CACHE) {
-                TOPLEVEL.compute_char_frequency(MANGLE);
+            if (skip_property(key, value)) return;
+            if (value instanceof UglifyJS.AST_Token) return;
+            if (value instanceof UglifyJS.Dictionary) return;
+            if (value instanceof UglifyJS.AST_Node) {
+                var result = {
+                    _class: "AST_" + value.TYPE
+                };
+                value.CTOR.PROPS.forEach(function(prop) {
+                    result[prop] = value[prop];
+                });
+                return result;
             }
-        });
-    }
-
-    if (MANGLE) time_it("mangle", function(){
-        MANGLE.cache = TL_CACHE;
-        TOPLEVEL.mangle_names(MANGLE);
-    });
-
-    writeNameCache("vars", TL_CACHE);
-
-    if (ARGS.source_map_include_sources) {
-        for (var file in SOURCES_CONTENT) {
-            if (SOURCES_CONTENT.hasOwnProperty(file)) {
-                SOURCE_MAP.get().setSourceContent(file, SOURCES_CONTENT[file]);
+            return value;
+        }, 2));
+    } else if (output == "spidermonkey") {
+        print(JSON.stringify(result.ast.to_mozilla_ast(), null, 2));
+    } else if (output) {
+        var code;
+        if (result.ast) {
+            var opts = {};
+            for (var name in options.output) {
+                if (!/^ast|code$/.test(name)) opts[name] = options.output[name];
             }
+            code = UglifyJS.AST_Node.from_mozilla_ast(result.ast.to_mozilla_ast()).print_to_string(opts);
+        } else {
+            code = result.code;
         }
+        fs.writeFileSync(output, code);
+        if (result.map) fs.writeFileSync(output + ".map", result.map);
+    } else {
+        print(result.code);
     }
-
-    time_it("generate", function(){
-        TOPLEVEL.print(output);
-    });
-
-    output = output.get();
-
-    if (SOURCE_MAP) {
-        fs.writeFileSync(ARGS.source_map, SOURCE_MAP, "utf8");
-        var source_map_url = ARGS.source_map_url || (
-            P_RELATIVE
-                ? path.relative(path.dirname(OUTPUT_FILE), ARGS.source_map)
-                : ARGS.source_map
-        );
-        output += "\n//# sourceMappingURL=" + source_map_url;
+    if (nameCache) fs.writeFileSync(nameCache, JSON.stringify(options.nameCache));
+    if (result.timings) for (var phase in result.timings) {
+        print_error("- " + phase + ": " + result.timings[phase].toFixed(3) + "s");
     }
+}
 
-    if (OUTPUT_FILE) {
-        fs.writeFileSync(OUTPUT_FILE, output, "utf8");
+function fatal(message) {
+    if (message instanceof Error) {
+        message = message.stack.replace(/^\S*?Error:/, "ERROR:")
     } else {
-        print(output);
+        message = "ERROR: " + message;
     }
+    print_error(message);
+    process.exit(1);
+}
 
-    if (ARGS.stats) {
-        print_error(UglifyJS.string_template("Timing information (compressed {count} files):", {
-            count: files.length
-        }));
-        for (var i in STATS) if (STATS.hasOwnProperty(i)) {
-            print_error(UglifyJS.string_template("- {name}: {time}s", {
-                name: i,
-                time: (STATS[i] / 1000).toFixed(3)
-            }));
+// A file glob function that only supports "*" and "?" wildcards in the basename.
+// Example: "foo/bar/*baz??.*.js"
+// Argument `paths` must be an array of strings.
+// Returns an array of strings. Garbage in, garbage out.
+function simple_glob(paths) {
+    return paths.reduce(function(paths, glob) {
+        if (/\*|\?/.test(glob)) {
+            var dir = path.dirname(glob);
+            try {
+                var entries = fs.readdirSync(dir).filter(function(name) {
+                    try {
+                        return fs.statSync(path.join(dir, name)).isFile();
+                    } catch (ex) {
+                        return false;
+                    }
+                });
+            } catch (ex) {}
+            if (entries) {
+                var pattern = "^" + path.basename(glob)
+                    .replace(/[.+^$[\]\\(){}]/g, "\\$&")
+                    .replace(/\*/g, "[^/\\\\]*")
+                    .replace(/\?/g, "[^/\\\\]") + "$";
+                var mod = process.platform === "win32" ? "i" : "";
+                var rx = new RegExp(pattern, mod);
+                var results = entries.filter(function(name) {
+                    return rx.test(name);
+                }).sort().map(function(name) {
+                    return path.join(dir, name);
+                });
+                if (results.length) {
+                    [].push.apply(paths, results);
+                    return paths;
+                }
+            }
         }
-    }
-});
-
-/* -----[ functions ]----- */
-
-function normalize(o) {
-    for (var i in o) if (o.hasOwnProperty(i) && /-/.test(i)) {
-        o[i.replace(/-/g, "_")] = o[i];
-        delete o[i];
+        paths.push(glob);
+        return paths;
+    }, []);
+}
+
+function read_file(path, default_value) {
+    try {
+        return fs.readFileSync(path, "utf8");
+    } catch (ex) {
+        if (ex.code == "ENOENT" && default_value != null) return default_value;
+        fatal(ex);
     }
 }
 
-function getOptions(x, constants) {
-    x = ARGS[x];
-    if (x == null) return null;
-    var ret = {};
-    if (x !== "") {
-        var ast;
-        try {
-            ast = UglifyJS.parse(x, { expression: true });
-        } catch(ex) {
-            if (ex instanceof UglifyJS.JS_Parse_Error) {
-                print_error("Error parsing arguments in: " + x);
-                process.exit(1);
-            }
-        }
-        ast.walk(new UglifyJS.TreeWalker(function(node){
-            if (node instanceof UglifyJS.AST_Seq) return; // descend
+function parse_js(value, options, flag) {
+    if (!options || typeof options != "object") options = Object.create(null);
+    if (typeof value == "string") try {
+        UglifyJS.parse(value, {
+            expression: true
+        }).walk(new UglifyJS.TreeWalker(function(node) {
             if (node instanceof UglifyJS.AST_Assign) {
-                var name = node.left.print_to_string({ beautify: false }).replace(/-/g, "_");
+                var name = node.left.print_to_string();
                 var value = node.right;
-                if (constants)
-                    value = new Function("return (" + value.print_to_string() + ")")();
-                ret[name] = value;
-                return true;    // no descend
-            }
-            if (node instanceof UglifyJS.AST_Symbol || node instanceof UglifyJS.AST_Binary) {
-                var name = node.print_to_string({ beautify: false }).replace(/-/g, "_");
-                ret[name] = true;
-                return true;    // no descend
-            }
-            print_error(node.TYPE)
-            print_error("Error parsing arguments in: " + x);
-            process.exit(1);
+                if (flag) {
+                    options[name] = value;
+                } else if (value instanceof UglifyJS.AST_Array) {
+                    options[name] = value.elements.map(to_string);
+                } else {
+                    options[name] = to_string(value);
+                }
+                return true;
+            }
+            if (node instanceof UglifyJS.AST_Symbol || node instanceof UglifyJS.AST_PropAccess) {
+                var name = node.print_to_string();
+                options[name] = true;
+                return true;
+            }
+            if (!(node instanceof UglifyJS.AST_Sequence)) throw node;
+
+            function to_string(value) {
+                return value instanceof UglifyJS.AST_Constant ? value.value : value.print_to_string({
+                    quote_keys: true
+                });
+            }
         }));
+    } catch (ex) {
+        if (flag) {
+            fatal("cannot parse arguments for '" + flag + "': " + value);
+        } else {
+            options[value] = null;
+        }
     }
-    return ret;
+    return options;
 }
 
-function read_whole_file(filename, cb) {
-    if (filename == "-") {
-        var chunks = [];
-        process.stdin.setEncoding('utf-8');
-        process.stdin.on('data', function (chunk) {
-            chunks.push(chunk);
-        }).on('end', function () {
-            cb(null, chunks.join(""));
-        });
-        process.openStdin();
-    } else {
-        fs.readFile(filename, "utf-8", cb);
-    }
+function skip_property(key, value) {
+    return skip_keys.indexOf(key) >= 0
+        // only skip truthy_keys if their value is falsy
+        || truthy_keys.indexOf(key) >= 0 && !value;
 }
 
-function time_it(name, cont) {
-    var t1 = new Date().getTime();
-    var ret = cont();
-    if (ARGS.stats) {
-        var spent = new Date().getTime() - t1;
-        if (STATS[name]) STATS[name] += spent;
-        else STATS[name] = spent;
-    }
+function symdef(def) {
+    var ret = (1e6 + def.id) + " " + def.name;
+    if (def.mangled_name) ret += " " + def.mangled_name;
     return ret;
 }
 
+function format_object(obj) {
+    var lines = [];
+    var padding = "";
+    Object.keys(obj).map(function(name) {
+        if (padding.length < name.length) padding = Array(name.length + 1).join(" ");
+        return [ name, JSON.stringify(obj[name]) ];
+    }).forEach(function(tokens) {
+        lines.push("  " + tokens[0] + padding.slice(tokens[0].length - 2) + tokens[1]);
+    });
+    return lines.join("\n");
+}
+
 function print_error(msg) {
-    console.error("%s", msg);
+    process.stderr.write(msg);
+    process.stderr.write("\n");
 }
 
 function print(txt) {
-    console.log("%s", txt);
+    process.stdout.write(txt);
+    process.stdout.write("\n");
 }
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/ast.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/ast.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/ast.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -44,189 +44,443 @@
 "use strict";
 
 function DEFNODE(type, props, methods, base) {
-    if (arguments.length < 4) base = AST_Node;
-    if (!props) props = [];
-    else props = props.split(/\s+/);
+    if (typeof base === "undefined") base = AST_Node;
+    props = props ? props.split(/\s+/) : [];
     var self_props = props;
-    if (base && base.PROPS)
-        props = props.concat(base.PROPS);
-    var code = "return function AST_" + type + "(props){ if (props) { ";
-    for (var i = props.length; --i >= 0;) {
-        code += "this." + props[i] + " = props." + props[i] + ";";
-    }
-    var proto = base && new base;
-    if (proto && proto.initialize || (methods && methods.initialize))
-        code += "this.initialize();";
-    code += "}}";
-    var ctor = new Function(code)();
-    if (proto) {
-        ctor.prototype = proto;
+    if (base && base.PROPS) props = props.concat(base.PROPS);
+    var code = [
+        "return function AST_", type, "(props){",
+        // not essential, but speeds up compress by a few percent
+        "this._bits=0;",
+        "if(props){",
+    ];
+    props.forEach(function(prop) {
+        code.push("this.", prop, "=props.", prop, ";");
+    });
+    code.push("}");
+    var proto = Object.create(base && base.prototype);
+    if (methods.initialize || proto.initialize) code.push("this.initialize();");
+    code.push("};");
+    var ctor = new Function(code.join(""))();
+    ctor.prototype = proto;
+    ctor.prototype.CTOR = ctor;
+    ctor.prototype.TYPE = ctor.TYPE = type;
+    if (base) {
         ctor.BASE = base;
+        base.SUBCLASSES.push(ctor);
     }
-    if (base) base.SUBCLASSES.push(ctor);
-    ctor.prototype.CTOR = ctor;
-    ctor.PROPS = props || null;
+    ctor.DEFMETHOD = function(name, method) {
+        this.prototype[name] = method;
+    };
+    ctor.PROPS = props;
     ctor.SELF_PROPS = self_props;
     ctor.SUBCLASSES = [];
-    if (type) {
-        ctor.prototype.TYPE = ctor.TYPE = type;
-    }
-    if (methods) for (i in methods) if (methods.hasOwnProperty(i)) {
-        if (/^\$/.test(i)) {
-            ctor[i.substr(1)] = methods[i];
+    for (var name in methods) if (HOP(methods, name)) {
+        if (/^\$/.test(name)) {
+            ctor[name.substr(1)] = methods[name];
         } else {
-            ctor.prototype[i] = methods[i];
+            ctor.DEFMETHOD(name, methods[name]);
         }
     }
-    ctor.DEFMETHOD = function(name, method) {
-        this.prototype[name] = method;
-    };
+    if (typeof exports !== "undefined") exports["AST_" + type] = ctor;
     return ctor;
-};
+}
 
-var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos nlb comments_before file", {
+var AST_Token = DEFNODE("Token", "type value line col pos endline endcol endpos nlb comments_before comments_after file raw", {
 }, null);
 
 var AST_Node = DEFNODE("Node", "start end", {
-    clone: function() {
+    _clone: function(deep) {
+        if (deep) {
+            var self = this.clone();
+            return self.transform(new TreeTransformer(function(node) {
+                if (node !== self) {
+                    return node.clone(true);
+                }
+            }));
+        }
         return new this.CTOR(this);
     },
+    clone: function(deep) {
+        return this._clone(deep);
+    },
     $documentation: "Base class of all AST nodes",
     $propdoc: {
         start: "[AST_Token] The first token of this node",
         end: "[AST_Token] The last token of this node"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this);
+    equals: function(node) {
+        return this.TYPE == node.TYPE && this._equals(node);
     },
     walk: function(visitor) {
-        return this._walk(visitor); // not sure the indirection will be any help
-    }
+        visitor.visit(this);
+    },
+    _validate: function() {
+        if (this.TYPE == "Node") throw new Error("should not instantiate AST_Node");
+    },
+    validate: function() {
+        var ctor = this.CTOR;
+        do {
+            ctor.prototype._validate.call(this);
+        } while (ctor = ctor.BASE);
+    },
+    validate_ast: function() {
+        var marker = {};
+        this.walk(new TreeWalker(function(node) {
+            if (node.validate_visited === marker) {
+                throw new Error(string_template("cannot reuse AST_{TYPE} from [{start}]", node));
+            }
+            node.validate_visited = marker;
+        }));
+    },
 }, null);
 
-AST_Node.warn_function = null;
-AST_Node.warn = function(txt, props) {
-    if (AST_Node.warn_function)
-        AST_Node.warn_function(string_template(txt, props));
+DEF_BITPROPS(AST_Node, [
+    // AST_Node
+    "_optimized",
+    "_squeezed",
+    // AST_Call
+    "call_only",
+    // AST_Lambda
+    "collapse_scanning",
+    // AST_SymbolRef
+    "defined",
+    "evaluating",
+    "falsy",
+    // AST_SymbolRef
+    "in_arg",
+    // AST_Return
+    "in_bool",
+    // AST_SymbolRef
+    "is_undefined",
+    // AST_LambdaExpression
+    // AST_LambdaDefinition
+    "inlined",
+    // AST_Lambda
+    "length_read",
+    // AST_Yield
+    "nested",
+    // AST_Lambda
+    "new",
+    // AST_Call
+    // AST_PropAccess
+    "optional",
+    // AST_ClassProperty
+    "private",
+    // AST_Call
+    "pure",
+    // AST_Assign
+    "redundant",
+    // AST_Node
+    "single_use",
+    // AST_ClassProperty
+    "static",
+    // AST_Call
+    // AST_PropAccess
+    "terminal",
+    "truthy",
+    // AST_Scope
+    "uses_eval",
+    // AST_Scope
+    "uses_with",
+]);
+
+(AST_Node.log_function = function(fn, verbose) {
+    if (typeof fn != "function") {
+        AST_Node.info = AST_Node.warn = noop;
+        return;
+    }
+    var printed = Object.create(null);
+    AST_Node.info = verbose ? function(text, props) {
+        log("INFO: " + string_template(text, props));
+    } : noop;
+    AST_Node.warn = function(text, props) {
+        log("WARN: " + string_template(text, props));
+    };
+
+    function log(msg) {
+        if (printed[msg]) return;
+        printed[msg] = true;
+        fn(msg);
+    }
+})();
+
+var restore_transforms = [];
+AST_Node.enable_validation = function() {
+    AST_Node.disable_validation();
+    (function validate_transform(ctor) {
+        ctor.SUBCLASSES.forEach(validate_transform);
+        if (!HOP(ctor.prototype, "transform")) return;
+        var transform = ctor.prototype.transform;
+        ctor.prototype.transform = function(tw, in_list) {
+            var node = transform.call(this, tw, in_list);
+            if (node instanceof AST_Node) {
+                node.validate();
+            } else if (!(node === null || in_list && List.is_op(node))) {
+                throw new Error("invalid transformed value: " + node);
+            }
+            return node;
+        };
+        restore_transforms.push(function() {
+            ctor.prototype.transform = transform;
+        });
+    })(this);
+};
+
+AST_Node.disable_validation = function() {
+    var restore;
+    while (restore = restore_transforms.pop()) restore();
 };
 
+function all_equals(k, l) {
+    return k.length == l.length && all(k, function(m, i) {
+        return m.equals(l[i]);
+    });
+}
+
+function list_equals(s, t) {
+    return s.length == t.length && all(s, function(u, i) {
+        return u == t[i];
+    });
+}
+
+function prop_equals(u, v) {
+    if (u === v) return true;
+    if (u == null) return v == null;
+    return u instanceof AST_Node && v instanceof AST_Node && u.equals(v);
+}
+
 /* -----[ statements ]----- */
 
 var AST_Statement = DEFNODE("Statement", null, {
     $documentation: "Base class of all statements",
+    _validate: function() {
+        if (this.TYPE == "Statement") throw new Error("should not instantiate AST_Statement");
+    },
 });
 
 var AST_Debugger = DEFNODE("Debugger", null, {
     $documentation: "Represents a debugger statement",
+    _equals: return_true,
 }, AST_Statement);
 
-var AST_Directive = DEFNODE("Directive", "value scope quote", {
+var AST_Directive = DEFNODE("Directive", "quote value", {
     $documentation: "Represents a directive, like \"use strict\";",
     $propdoc: {
+        quote: "[string?] the original quote character",
         value: "[string] The value of this directive as a plain string (it's not an AST_String!)",
-        scope: "[AST_Scope/S] The scope that this directive affects",
-        quote: "[string] the original quote character"
+    },
+    _equals: function(node) {
+        return this.value == node.value;
+    },
+    _validate: function() {
+        if (this.quote != null) {
+            if (typeof this.quote != "string") throw new Error("quote must be string");
+            if (!/^["']$/.test(this.quote)) throw new Error("invalid quote: " + this.quote);
+        }
+        if (typeof this.value != "string") throw new Error("value must be string");
     },
 }, AST_Statement);
 
+var AST_EmptyStatement = DEFNODE("EmptyStatement", null, {
+    $documentation: "The empty statement (empty block or simply a semicolon)",
+    _equals: return_true,
+}, AST_Statement);
+
+function is_statement(node) {
+    return node instanceof AST_Statement
+        && !(node instanceof AST_ClassExpression)
+        && !(node instanceof AST_LambdaExpression);
+}
+
+function validate_expression(value, prop, multiple, allow_spread, allow_hole) {
+    multiple = multiple ? "contain" : "be";
+    if (!(value instanceof AST_Node)) throw new Error(prop + " must " + multiple + " AST_Node");
+    if (value instanceof AST_DefaultValue) throw new Error(prop + " cannot " + multiple + " AST_DefaultValue");
+    if (value instanceof AST_Destructured) throw new Error(prop + " cannot " + multiple + " AST_Destructured");
+    if (value instanceof AST_Hole && !allow_hole) throw new Error(prop + " cannot " + multiple + " AST_Hole");
+    if (value instanceof AST_Spread && !allow_spread) throw new Error(prop + " cannot " + multiple + " AST_Spread");
+    if (is_statement(value)) throw new Error(prop + " cannot " + multiple + " AST_Statement");
+    if (value instanceof AST_SymbolDeclaration) {
+        throw new Error(prop + " cannot " + multiple + " AST_SymbolDeclaration");
+    }
+}
+
+function must_be_expression(node, prop) {
+    validate_expression(node[prop], prop);
+}
+
 var AST_SimpleStatement = DEFNODE("SimpleStatement", "body", {
     $documentation: "A statement consisting of an expression, i.e. a = 1 + 2",
     $propdoc: {
-        body: "[AST_Node] an expression node (should not be instanceof AST_Statement)"
+        body: "[AST_Node] an expression node (should not be instanceof AST_Statement)",
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.body._walk(visitor);
+    _equals: function(node) {
+        return this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.body.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "body");
+    },
+}, AST_Statement);
+
+var AST_BlockScope = DEFNODE("BlockScope", "_var_names enclosed functions make_def parent_scope variables", {
+    $documentation: "Base class for all statements introducing a lexical scope",
+    $propdoc: {
+        enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any inner scopes",
+        functions: "[Dictionary/S] like `variables`, but only lists function declarations",
+        parent_scope: "[AST_Scope?/S] link to the parent scope",
+        variables: "[Dictionary/S] a map of name ---> SymbolDef for all variables/functions defined in this scope",
+    },
+    clone: function(deep) {
+        var node = this._clone(deep);
+        if (this.enclosed) node.enclosed = this.enclosed.slice();
+        if (this.functions) node.functions = this.functions.clone();
+        if (this.variables) node.variables = this.variables.clone();
+        return node;
+    },
+    pinned: function() {
+        return this.resolve().pinned();
+    },
+    resolve: function() {
+        return this.parent_scope.resolve();
+    },
+    _validate: function() {
+        if (this.TYPE == "BlockScope") throw new Error("should not instantiate AST_BlockScope");
+        if (this.parent_scope == null) return;
+        if (!(this.parent_scope instanceof AST_BlockScope)) throw new Error("parent_scope must be AST_BlockScope");
+        if (!(this.resolve() instanceof AST_Scope)) throw new Error("must be contained within AST_Scope");
+    },
 }, AST_Statement);
 
 function walk_body(node, visitor) {
-    if (node.body instanceof AST_Statement) {
-        node.body._walk(visitor);
-    }
-    else node.body.forEach(function(stat){
-        stat._walk(visitor);
+    node.body.forEach(function(node) {
+        node.walk(visitor);
     });
-};
+}
 
 var AST_Block = DEFNODE("Block", "body", {
-    $documentation: "A body of statements (usually bracketed)",
+    $documentation: "A body of statements (usually braced)",
     $propdoc: {
         body: "[AST_Statement*] an array of statements"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            walk_body(this, visitor);
+    _equals: function(node) {
+        return all_equals(this.body, node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            walk_body(node, visitor);
         });
-    }
-}, AST_Statement);
+    },
+    _validate: function() {
+        if (this.TYPE == "Block") throw new Error("should not instantiate AST_Block");
+        this.body.forEach(function(node) {
+            if (!is_statement(node)) throw new Error("body must contain AST_Statement");
+        });
+    },
+}, AST_BlockScope);
 
 var AST_BlockStatement = DEFNODE("BlockStatement", null, {
     $documentation: "A block statement",
 }, AST_Block);
 
-var AST_EmptyStatement = DEFNODE("EmptyStatement", null, {
-    $documentation: "The empty statement (empty block or simply a semicolon)",
-    _walk: function(visitor) {
-        return visitor._visit(this);
-    }
-}, AST_Statement);
-
 var AST_StatementWithBody = DEFNODE("StatementWithBody", "body", {
     $documentation: "Base class for all statements that contain one nested body: `For`, `ForIn`, `Do`, `While`, `With`",
     $propdoc: {
         body: "[AST_Statement] the body; this should always be present, even if it's an AST_EmptyStatement"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.body._walk(visitor);
-        });
-    }
-}, AST_Statement);
+    _validate: function() {
+        if (this.TYPE == "StatementWithBody") throw new Error("should not instantiate AST_StatementWithBody");
+        if (!is_statement(this.body)) throw new Error("body must be AST_Statement");
+    },
+}, AST_BlockScope);
 
 var AST_LabeledStatement = DEFNODE("LabeledStatement", "label", {
     $documentation: "Statement with a label",
     $propdoc: {
         label: "[AST_Label] a label definition"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.label._walk(visitor);
-            this.body._walk(visitor);
-        });
-    }
+    _equals: function(node) {
+        return this.label.equals(node.label)
+            && this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.label.walk(visitor);
+            node.body.walk(visitor);
+        });
+    },
+    clone: function(deep) {
+        var node = this._clone(deep);
+        if (deep) {
+            var label = node.label;
+            var def = this.label;
+            node.walk(new TreeWalker(function(node) {
+                if (node instanceof AST_LoopControl) {
+                    if (!node.label || node.label.thedef !== def) return;
+                    node.label.thedef = label;
+                    label.references.push(node);
+                    return true;
+                }
+                if (node instanceof AST_Scope) return true;
+            }));
+        }
+        return node;
+    },
+    _validate: function() {
+        if (!(this.label instanceof AST_Label)) throw new Error("label must be AST_Label");
+    },
 }, AST_StatementWithBody);
 
 var AST_IterationStatement = DEFNODE("IterationStatement", null, {
-    $documentation: "Internal class.  All loops inherit from it."
+    $documentation: "Internal class.  All loops inherit from it.",
+    _validate: function() {
+        if (this.TYPE == "IterationStatement") throw new Error("should not instantiate AST_IterationStatement");
+    },
 }, AST_StatementWithBody);
 
 var AST_DWLoop = DEFNODE("DWLoop", "condition", {
     $documentation: "Base class for do/while statements",
     $propdoc: {
         condition: "[AST_Node] the loop condition.  Should not be instanceof AST_Statement"
-    }
+    },
+    _equals: function(node) {
+        return this.body.equals(node.body)
+            && this.condition.equals(node.condition);
+    },
+    _validate: function() {
+        if (this.TYPE == "DWLoop") throw new Error("should not instantiate AST_DWLoop");
+        must_be_expression(this, "condition");
+    },
 }, AST_IterationStatement);
 
 var AST_Do = DEFNODE("Do", null, {
     $documentation: "A `do` statement",
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.body._walk(visitor);
-            this.condition._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.body.walk(visitor);
+            node.condition.walk(visitor);
         });
-    }
+    },
 }, AST_DWLoop);
 
 var AST_While = DEFNODE("While", null, {
     $documentation: "A `while` statement",
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.condition._walk(visitor);
-            this.body._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.condition.walk(visitor);
+            node.body.walk(visitor);
         });
-    }
+    },
 }, AST_DWLoop);
 
 var AST_For = DEFNODE("For", "init condition step", {
@@ -236,163 +490,539 @@
         condition: "[AST_Node?] the `for` termination clause, or null if empty",
         step: "[AST_Node?] the `for` update clause, or null if empty"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            if (this.init) this.init._walk(visitor);
-            if (this.condition) this.condition._walk(visitor);
-            if (this.step) this.step._walk(visitor);
-            this.body._walk(visitor);
+    _equals: function(node) {
+        return prop_equals(this.init, node.init)
+            && prop_equals(this.condition, node.condition)
+            && prop_equals(this.step, node.step)
+            && this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.init) node.init.walk(visitor);
+            if (node.condition) node.condition.walk(visitor);
+            if (node.step) node.step.walk(visitor);
+            node.body.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.init != null) {
+            if (!(this.init instanceof AST_Node)) throw new Error("init must be AST_Node");
+            if (is_statement(this.init) && !(this.init instanceof AST_Definitions)) {
+                throw new Error("init cannot be AST_Statement");
+            }
+        }
+        if (this.condition != null) must_be_expression(this, "condition");
+        if (this.step != null) must_be_expression(this, "step");
+    },
 }, AST_IterationStatement);
 
-var AST_ForIn = DEFNODE("ForIn", "init name object", {
-    $documentation: "A `for ... in` statement",
+var AST_ForEnumeration = DEFNODE("ForEnumeration", "init object", {
+    $documentation: "Base class for enumeration loops, i.e. `for ... in`, `for ... of` & `for await ... of`",
     $propdoc: {
-        init: "[AST_Node] the `for/in` initialization code",
-        name: "[AST_SymbolRef?] the loop variable, only if `init` is AST_Var",
-        object: "[AST_Node] the object that we're looping through"
-    },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.init._walk(visitor);
-            this.object._walk(visitor);
-            this.body._walk(visitor);
+        init: "[AST_Node] the assignment target during iteration",
+        object: "[AST_Node] the object to iterate over"
+    },
+    _equals: function(node) {
+        return this.init.equals(node.init)
+            && this.object.equals(node.object)
+            && this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.init.walk(visitor);
+            node.object.walk(visitor);
+            node.body.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "ForEnumeration") throw new Error("should not instantiate AST_ForEnumeration");
+        if (this.init instanceof AST_Definitions) {
+            if (this.init.definitions.length != 1) throw new Error("init must have single declaration");
+        } else {
+            validate_destructured(this.init, function(node) {
+                if (!(node instanceof AST_PropAccess || node instanceof AST_SymbolRef)) {
+                    throw new Error("init must be assignable: " + node.TYPE);
+                }
+            });
+        }
+        must_be_expression(this, "object");
+    },
 }, AST_IterationStatement);
 
+var AST_ForIn = DEFNODE("ForIn", null, {
+    $documentation: "A `for ... in` statement",
+}, AST_ForEnumeration);
+
+var AST_ForOf = DEFNODE("ForOf", null, {
+    $documentation: "A `for ... of` statement",
+}, AST_ForEnumeration);
+
+var AST_ForAwaitOf = DEFNODE("ForAwaitOf", null, {
+    $documentation: "A `for await ... of` statement",
+}, AST_ForOf);
+
 var AST_With = DEFNODE("With", "expression", {
     $documentation: "A `with` statement",
     $propdoc: {
         expression: "[AST_Node] the `with` expression"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
-            this.body._walk(visitor);
+    _equals: function(node) {
+        return this.expression.equals(node.expression)
+            && this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+            node.body.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+    },
 }, AST_StatementWithBody);
 
 /* -----[ scope and functions ]----- */
 
-var AST_Scope = DEFNODE("Scope", "directives variables functions uses_with uses_eval parent_scope enclosed cname", {
-    $documentation: "Base class for all statements introducing a lexical scope",
+var AST_Scope = DEFNODE("Scope", "fn_defs may_call_this uses_eval uses_with", {
+    $documentation: "Base class for all statements introducing a lambda scope",
     $propdoc: {
-        directives: "[string*/S] an array of directives declared in this scope",
-        variables: "[Object/S] a map of name -> SymbolDef for all variables/functions defined in this scope",
-        functions: "[Object/S] like `variables`, but only lists function declarations",
-        uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
         uses_eval: "[boolean/S] tells whether this scope contains a direct call to the global `eval`",
-        parent_scope: "[AST_Scope?/S] link to the parent scope",
-        enclosed: "[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",
-        cname: "[integer/S] current index for mangling variables (used internally by the mangler)",
+        uses_with: "[boolean/S] tells whether this scope uses the `with` statement",
+    },
+    pinned: function() {
+        return this.uses_eval || this.uses_with;
+    },
+    resolve: return_this,
+    _validate: function() {
+        if (this.TYPE == "Scope") throw new Error("should not instantiate AST_Scope");
     },
 }, AST_Block);
 
 var AST_Toplevel = DEFNODE("Toplevel", "globals", {
     $documentation: "The toplevel scope",
     $propdoc: {
-        globals: "[Object/S] a map of name -> SymbolDef for all undeclared names",
+        globals: "[Dictionary/S] a map of name ---> SymbolDef for all undeclared names",
     },
-    wrap_enclose: function(arg_parameter_pairs) {
-        var self = this;
-        var args = [];
-        var parameters = [];
-
-        arg_parameter_pairs.forEach(function(pair) {
-            var splitAt = pair.lastIndexOf(":");
-
-            args.push(pair.substr(0, splitAt));
-            parameters.push(pair.substr(splitAt + 1));
-        });
-
-        var wrapped_tl = "(function(" + parameters.join(",") + "){ '$ORIG'; })(" + args.join(",") + ")";
-        wrapped_tl = parse(wrapped_tl);
-        wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){
+    wrap: function(name) {
+        var body = this.body;
+        return parse([
+            "(function(exports){'$ORIG';})(typeof ",
+            name,
+            "=='undefined'?(",
+            name,
+            "={}):",
+            name,
+            ");"
+        ].join(""), {
+            filename: "wrap=" + JSON.stringify(name)
+        }).transform(new TreeTransformer(function(node) {
             if (node instanceof AST_Directive && node.value == "$ORIG") {
-                return MAP.splice(self.body);
+                return List.splice(body);
             }
         }));
-        return wrapped_tl;
     },
-    wrap_commonjs: function(name, export_all) {
-        var self = this;
-        var to_export = [];
-        if (export_all) {
-            self.figure_out_scope();
-            self.walk(new TreeWalker(function(node){
-                if (node instanceof AST_SymbolDeclaration && node.definition().global) {
-                    if (!find_if(function(n){ return n.name == node.name }, to_export))
-                        to_export.push(node);
-                }
-            }));
-        }
-        var wrapped_tl = "(function(exports, global){ global['" + name + "'] = exports; '$ORIG'; '$EXPORTS'; }({}, (function(){return this}())))";
-        wrapped_tl = parse(wrapped_tl);
-        wrapped_tl = wrapped_tl.transform(new TreeTransformer(function before(node){
-            if (node instanceof AST_SimpleStatement) {
-                node = node.body;
-                if (node instanceof AST_String) switch (node.getValue()) {
-                  case "$ORIG":
-                    return MAP.splice(self.body);
-                  case "$EXPORTS":
-                    var body = [];
-                    to_export.forEach(function(sym){
-                        body.push(new AST_SimpleStatement({
-                            body: new AST_Assign({
-                                left: new AST_Sub({
-                                    expression: new AST_SymbolRef({ name: "exports" }),
-                                    property: new AST_String({ value: sym.name }),
-                                }),
-                                operator: "=",
-                                right: new AST_SymbolRef(sym),
-                            }),
-                        }));
-                    });
-                    return MAP.splice(body);
-                }
+    enclose: function(args_values) {
+        if (typeof args_values != "string") args_values = "";
+        var index = args_values.indexOf(":");
+        if (index < 0) index = args_values.length;
+        var body = this.body;
+        return parse([
+            "(function(",
+            args_values.slice(0, index),
+            '){"$ORIG"})(',
+            args_values.slice(index + 1),
+            ")"
+        ].join(""), {
+            filename: "enclose=" + JSON.stringify(args_values)
+        }).transform(new TreeTransformer(function(node) {
+            if (node instanceof AST_Directive && node.value == "$ORIG") {
+                return List.splice(body);
             }
         }));
-        return wrapped_tl;
     }
 }, AST_Scope);
 
-var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments", {
+var AST_ClassInitBlock = DEFNODE("ClassInitBlock", null, {
+    $documentation: "Value for `class` static initialization blocks",
+}, AST_Scope);
+
+var AST_Lambda = DEFNODE("Lambda", "argnames length_read rest safe_ids uses_arguments", {
     $documentation: "Base class for functions",
     $propdoc: {
-        name: "[AST_SymbolDeclaration?] the name of this function",
-        argnames: "[AST_SymbolFunarg*] array of function arguments",
-        uses_arguments: "[boolean/S] tells whether this function accesses the arguments array"
-    },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            if (this.name) this.name._walk(visitor);
-            this.argnames.forEach(function(arg){
-                arg._walk(visitor);
+        argnames: "[(AST_DefaultValue|AST_Destructured|AST_SymbolFunarg)*] array of function arguments and/or destructured literals",
+        length_read: "[boolean/S] whether length property of this function is accessed",
+        rest: "[(AST_Destructured|AST_SymbolFunarg)?] rest parameter, or null if absent",
+        uses_arguments: "[boolean|number/S] whether this function accesses the arguments array",
+    },
+    each_argname: function(visit) {
+        var tw = new TreeWalker(function(node) {
+            if (node instanceof AST_DefaultValue) {
+                node.name.walk(tw);
+                return true;
+            }
+            if (node instanceof AST_DestructuredKeyVal) {
+                node.value.walk(tw);
+                return true;
+            }
+            if (node instanceof AST_SymbolFunarg) visit(node);
+        });
+        this.argnames.forEach(function(argname) {
+            argname.walk(tw);
+        });
+        if (this.rest) this.rest.walk(tw);
+    },
+    _equals: function(node) {
+        return prop_equals(this.rest, node.rest)
+            && prop_equals(this.name, node.name)
+            && prop_equals(this.value, node.value)
+            && all_equals(this.argnames, node.argnames)
+            && all_equals(this.body, node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.name) node.name.walk(visitor);
+            node.argnames.forEach(function(argname) {
+                argname.walk(visitor);
             });
-            walk_body(this, visitor);
+            if (node.rest) node.rest.walk(visitor);
+            walk_body(node, visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "Lambda") throw new Error("should not instantiate AST_Lambda");
+        this.argnames.forEach(function(node) {
+            validate_destructured(node, function(node) {
+                if (!(node instanceof AST_SymbolFunarg)) throw new Error("argnames must be AST_SymbolFunarg[]");
+            }, true);
+        });
+        if (this.rest != null) validate_destructured(this.rest, function(node) {
+            if (!(node instanceof AST_SymbolFunarg)) throw new Error("rest must be AST_SymbolFunarg");
+        });
+    },
 }, AST_Scope);
 
 var AST_Accessor = DEFNODE("Accessor", null, {
-    $documentation: "A setter/getter function.  The `name` property is always null."
+    $documentation: "A getter/setter function",
+    _validate: function() {
+        if (this.name != null) throw new Error("name must be null");
+    },
 }, AST_Lambda);
 
-var AST_Function = DEFNODE("Function", null, {
-    $documentation: "A function expression"
+var AST_LambdaExpression = DEFNODE("LambdaExpression", "inlined", {
+    $documentation: "Base class for function expressions",
+    $propdoc: {
+        inlined: "[boolean/S] whether this function has been inlined",
+    },
+    _validate: function() {
+        if (this.TYPE == "LambdaExpression") throw new Error("should not instantiate AST_LambdaExpression");
+    },
 }, AST_Lambda);
 
-var AST_Defun = DEFNODE("Defun", null, {
-    $documentation: "A function definition"
+function is_arrow(node) {
+    return node instanceof AST_Arrow || node instanceof AST_AsyncArrow;
+}
+
+function is_async(node) {
+    return node instanceof AST_AsyncArrow
+        || node instanceof AST_AsyncDefun
+        || node instanceof AST_AsyncFunction
+        || node instanceof AST_AsyncGeneratorDefun
+        || node instanceof AST_AsyncGeneratorFunction;
+}
+
+function is_generator(node) {
+    return node instanceof AST_AsyncGeneratorDefun
+        || node instanceof AST_AsyncGeneratorFunction
+        || node instanceof AST_GeneratorDefun
+        || node instanceof AST_GeneratorFunction;
+}
+
+function walk_lambda(node, tw) {
+    if (is_arrow(node) && node.value) {
+        node.value.walk(tw);
+    } else {
+        walk_body(node, tw);
+    }
+}
+
+var AST_Arrow = DEFNODE("Arrow", "value", {
+    $documentation: "An arrow function expression",
+    $propdoc: {
+        value: "[AST_Node?] simple return expression, or null if using function body.",
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.argnames.forEach(function(argname) {
+                argname.walk(visitor);
+            });
+            if (node.rest) node.rest.walk(visitor);
+            if (node.value) {
+                node.value.walk(visitor);
+            } else {
+                walk_body(node, visitor);
+            }
+        });
+    },
+    _validate: function() {
+        if (this.name != null) throw new Error("name must be null");
+        if (this.uses_arguments) throw new Error("uses_arguments must be false");
+        if (this.value != null) {
+            must_be_expression(this, "value");
+            if (this.body.length) throw new Error("body must be empty if value exists");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_AsyncArrow = DEFNODE("AsyncArrow", "value", {
+    $documentation: "An asynchronous arrow function expression",
+    $propdoc: {
+        value: "[AST_Node?] simple return expression, or null if using function body.",
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.argnames.forEach(function(argname) {
+                argname.walk(visitor);
+            });
+            if (node.rest) node.rest.walk(visitor);
+            if (node.value) {
+                node.value.walk(visitor);
+            } else {
+                walk_body(node, visitor);
+            }
+        });
+    },
+    _validate: function() {
+        if (this.name != null) throw new Error("name must be null");
+        if (this.uses_arguments) throw new Error("uses_arguments must be false");
+        if (this.value != null) {
+            must_be_expression(this, "value");
+            if (this.body.length) throw new Error("body must be empty if value exists");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_AsyncFunction = DEFNODE("AsyncFunction", "name", {
+    $documentation: "An asynchronous function expression",
+    $propdoc: {
+        name: "[AST_SymbolLambda?] the name of this function, or null if not specified",
+    },
+    _validate: function() {
+        if (this.name != null) {
+            if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_AsyncGeneratorFunction = DEFNODE("AsyncGeneratorFunction", "name", {
+    $documentation: "An asynchronous generator function expression",
+    $propdoc: {
+        name: "[AST_SymbolLambda?] the name of this function, or null if not specified",
+    },
+    _validate: function() {
+        if (this.name != null) {
+            if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_Function = DEFNODE("Function", "name", {
+    $documentation: "A function expression",
+    $propdoc: {
+        name: "[AST_SymbolLambda?] the name of this function, or null if not specified",
+    },
+    _validate: function() {
+        if (this.name != null) {
+            if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_GeneratorFunction = DEFNODE("GeneratorFunction", "name", {
+    $documentation: "A generator function expression",
+    $propdoc: {
+        name: "[AST_SymbolLambda?] the name of this function, or null if not specified",
+    },
+    _validate: function() {
+        if (this.name != null) {
+            if (!(this.name instanceof AST_SymbolLambda)) throw new Error("name must be AST_SymbolLambda");
+        }
+    },
+}, AST_LambdaExpression);
+
+var AST_LambdaDefinition = DEFNODE("LambdaDefinition", "inlined name", {
+    $documentation: "Base class for function definitions",
+    $propdoc: {
+        inlined: "[boolean/S] whether this function has been inlined",
+        name: "[AST_SymbolDefun] the name of this function",
+    },
+    _validate: function() {
+        if (this.TYPE == "LambdaDefinition") throw new Error("should not instantiate AST_LambdaDefinition");
+        if (!(this.name instanceof AST_SymbolDefun)) throw new Error("name must be AST_SymbolDefun");
+    },
 }, AST_Lambda);
 
+var AST_AsyncDefun = DEFNODE("AsyncDefun", null, {
+    $documentation: "An asynchronous function definition",
+}, AST_LambdaDefinition);
+
+var AST_AsyncGeneratorDefun = DEFNODE("AsyncGeneratorDefun", null, {
+    $documentation: "An asynchronous generator function definition",
+}, AST_LambdaDefinition);
+
+var AST_Defun = DEFNODE("Defun", null, {
+    $documentation: "A function definition",
+}, AST_LambdaDefinition);
+
+var AST_GeneratorDefun = DEFNODE("GeneratorDefun", null, {
+    $documentation: "A generator function definition",
+}, AST_LambdaDefinition);
+
+/* -----[ classes ]----- */
+
+var AST_Class = DEFNODE("Class", "extends name properties", {
+    $documentation: "Base class for class literals",
+    $propdoc: {
+        extends: "[AST_Node?] the super class, or null if not specified",
+        properties: "[AST_ClassProperty*] array of class properties",
+    },
+    _equals: function(node) {
+        return prop_equals(this.name, node.name)
+            && prop_equals(this.extends, node.extends)
+            && all_equals(this.properties, node.properties);
+    },
+    resolve: function(def_class) {
+        return def_class ? this : this.parent_scope.resolve();
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.name) node.name.walk(visitor);
+            if (node.extends) node.extends.walk(visitor);
+            node.properties.forEach(function(prop) {
+                prop.walk(visitor);
+            });
+        });
+    },
+    _validate: function() {
+        if (this.TYPE == "Class") throw new Error("should not instantiate AST_Class");
+        if (this.extends != null) must_be_expression(this, "extends");
+        this.properties.forEach(function(node) {
+            if (!(node instanceof AST_ClassProperty)) throw new Error("properties must contain AST_ClassProperty");
+        });
+    },
+}, AST_BlockScope);
+
+var AST_DefClass = DEFNODE("DefClass", null, {
+    $documentation: "A class definition",
+    $propdoc: {
+        name: "[AST_SymbolDefClass] the name of this class",
+    },
+    _validate: function() {
+        if (!(this.name instanceof AST_SymbolDefClass)) throw new Error("name must be AST_SymbolDefClass");
+    },
+}, AST_Class);
+
+var AST_ClassExpression = DEFNODE("ClassExpression", null, {
+    $documentation: "A class expression",
+    $propdoc: {
+        name: "[AST_SymbolClass?] the name of this class, or null if not specified",
+    },
+    _validate: function() {
+        if (this.name != null) {
+            if (!(this.name instanceof AST_SymbolClass)) throw new Error("name must be AST_SymbolClass");
+        }
+    },
+}, AST_Class);
+
+var AST_ClassProperty = DEFNODE("ClassProperty", "key private static value", {
+    $documentation: "Base class for `class` properties",
+    $propdoc: {
+        key: "[string|AST_Node?] property name (AST_Node for computed property, null for initialization block)",
+        private: "[boolean] whether this is a private property",
+        static: "[boolean] whether this is a static property",
+        value: "[AST_Node?] property value (AST_Accessor for getters/setters, AST_LambdaExpression for methods, null if not specified for fields)",
+    },
+    _equals: function(node) {
+        return !this.private == !node.private
+            && !this.static == !node.static
+            && prop_equals(this.key, node.key)
+            && prop_equals(this.value, node.value);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.key instanceof AST_Node) node.key.walk(visitor);
+            if (node.value) node.value.walk(visitor);
+        });
+    },
+    _validate: function() {
+        if (this.TYPE == "ClassProperty") throw new Error("should not instantiate AST_ClassProperty");
+        if (this instanceof AST_ClassInit) {
+            if (this.key != null) throw new Error("key must be null");
+        } else if (typeof this.key != "string") {
+            if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node");
+            must_be_expression(this, "key");
+        }
+        if(this.value != null) {
+            if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node");
+        }
+    },
+});
+
+var AST_ClassField = DEFNODE("ClassField", null, {
+    $documentation: "A `class` field",
+    _validate: function() {
+        if(this.value != null) must_be_expression(this, "value");
+    },
+}, AST_ClassProperty);
+
+var AST_ClassGetter = DEFNODE("ClassGetter", null, {
+    $documentation: "A `class` getter",
+    _validate: function() {
+        if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor");
+    },
+}, AST_ClassProperty);
+
+var AST_ClassSetter = DEFNODE("ClassSetter", null, {
+    $documentation: "A `class` setter",
+    _validate: function() {
+        if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor");
+    },
+}, AST_ClassProperty);
+
+var AST_ClassMethod = DEFNODE("ClassMethod", null, {
+    $documentation: "A `class` method",
+    _validate: function() {
+        if (!(this.value instanceof AST_LambdaExpression)) throw new Error("value must be AST_LambdaExpression");
+        if (is_arrow(this.value)) throw new Error("value cannot be AST_Arrow or AST_AsyncArrow");
+        if (this.value.name != null) throw new Error("name of class method's lambda must be null");
+    },
+}, AST_ClassProperty);
+
+var AST_ClassInit = DEFNODE("ClassInit", null, {
+    $documentation: "A `class` static initialization block",
+    _validate: function() {
+        if (!this.static) throw new Error("static must be true");
+        if (!(this.value instanceof AST_ClassInitBlock)) throw new Error("value must be AST_ClassInitBlock");
+    },
+    initialize: function() {
+        this.static = true;
+    },
+}, AST_ClassProperty);
+
 /* -----[ JUMPS ]----- */
 
 var AST_Jump = DEFNODE("Jump", null, {
-    $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)"
+    $documentation: "Base class for “jumps” (for now that's `return`, `throw`, `break` and `continue`)",
+    _validate: function() {
+        if (this.TYPE == "Jump") throw new Error("should not instantiate AST_Jump");
+    },
 }, AST_Statement);
 
 var AST_Exit = DEFNODE("Exit", "value", {
@@ -400,19 +1030,32 @@
     $propdoc: {
         value: "[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, this.value && function(){
-            this.value._walk(visitor);
+    _equals: function(node) {
+        return prop_equals(this.value, node.value);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.value) node.value.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "Exit") throw new Error("should not instantiate AST_Exit");
+    },
 }, AST_Jump);
 
 var AST_Return = DEFNODE("Return", null, {
-    $documentation: "A `return` statement"
+    $documentation: "A `return` statement",
+    _validate: function() {
+        if (this.value != null) must_be_expression(this, "value");
+    },
 }, AST_Exit);
 
 var AST_Throw = DEFNODE("Throw", null, {
-    $documentation: "A `throw` statement"
+    $documentation: "A `throw` statement",
+    _validate: function() {
+        must_be_expression(this, "value");
+    },
 }, AST_Exit);
 
 var AST_LoopControl = DEFNODE("LoopControl", "label", {
@@ -420,11 +1063,21 @@
     $propdoc: {
         label: "[AST_LabelRef?] the label, or null if none",
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, this.label && function(){
-            this.label._walk(visitor);
+    _equals: function(node) {
+        return prop_equals(this.label, node.label);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.label) node.label.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "LoopControl") throw new Error("should not instantiate AST_LoopControl");
+        if (this.label != null) {
+            if (!(this.label instanceof AST_LabelRef)) throw new Error("label must be AST_LabelRef");
+        }
+    },
 }, AST_Jump);
 
 var AST_Break = DEFNODE("Break", null, {
@@ -443,13 +1096,25 @@
         condition: "[AST_Node] the `if` condition",
         alternative: "[AST_Statement?] the `else` part, or null if not present"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.condition._walk(visitor);
-            this.body._walk(visitor);
-            if (this.alternative) this.alternative._walk(visitor);
+    _equals: function(node) {
+        return this.body.equals(node.body)
+            && this.condition.equals(node.condition)
+            && prop_equals(this.alternative, node.alternative);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.condition.walk(visitor);
+            node.body.walk(visitor);
+            if (node.alternative) node.alternative.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "condition");
+        if (this.alternative != null) {
+            if (!is_statement(this.alternative)) throw new Error("alternative must be AST_Statement");
+        }
+    },
 }, AST_StatementWithBody);
 
 /* -----[ SWITCH ]----- */
@@ -459,16 +1124,30 @@
     $propdoc: {
         expression: "[AST_Node] the `switch` “discriminant”"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
-            walk_body(this, visitor);
+    _equals: function(node) {
+        return this.expression.equals(node.expression)
+            && all_equals(this.body, node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+            walk_body(node, visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+        this.body.forEach(function(node) {
+            if (!(node instanceof AST_SwitchBranch)) throw new Error("body must be AST_SwitchBranch[]");
+        });
+    },
 }, AST_Block);
 
 var AST_SwitchBranch = DEFNODE("SwitchBranch", null, {
     $documentation: "Base class for `switch` branches",
+    _validate: function() {
+        if (this.TYPE == "SwitchBranch") throw new Error("should not instantiate AST_SwitchBranch");
+    },
 }, AST_Block);
 
 var AST_Default = DEFNODE("Default", null, {
@@ -480,12 +1159,20 @@
     $propdoc: {
         expression: "[AST_Node] the `case` expression"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
-            walk_body(this, visitor);
+    _equals: function(node) {
+        return this.expression.equals(node.expression)
+            && all_equals(this.body, node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+            walk_body(node, visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+    },
 }, AST_SwitchBranch);
 
 /* -----[ EXCEPTIONS ]----- */
@@ -496,189 +1183,461 @@
         bcatch: "[AST_Catch?] the catch block, or null if not present",
         bfinally: "[AST_Finally?] the finally block, or null if not present"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            walk_body(this, visitor);
-            if (this.bcatch) this.bcatch._walk(visitor);
-            if (this.bfinally) this.bfinally._walk(visitor);
+    _equals: function(node) {
+        return all_equals(this.body, node.body)
+            && prop_equals(this.bcatch, node.bcatch)
+            && prop_equals(this.bfinally, node.bfinally);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            walk_body(node, visitor);
+            if (node.bcatch) node.bcatch.walk(visitor);
+            if (node.bfinally) node.bfinally.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.bcatch != null) {
+            if (!(this.bcatch instanceof AST_Catch)) throw new Error("bcatch must be AST_Catch");
+        }
+        if (this.bfinally != null) {
+            if (!(this.bfinally instanceof AST_Finally)) throw new Error("bfinally must be AST_Finally");
+        }
+    },
 }, AST_Block);
 
 var AST_Catch = DEFNODE("Catch", "argname", {
     $documentation: "A `catch` node; only makes sense as part of a `try` statement",
     $propdoc: {
-        argname: "[AST_SymbolCatch] symbol for the exception"
+        argname: "[(AST_Destructured|AST_SymbolCatch)?] symbol for the exception, or null if not present",
+    },
+    _equals: function(node) {
+        return prop_equals(this.argname, node.argname)
+            && all_equals(this.body, node.body);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.argname._walk(visitor);
-            walk_body(this, visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.argname) node.argname.walk(visitor);
+            walk_body(node, visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.argname != null) validate_destructured(this.argname, function(node) {
+            if (!(node instanceof AST_SymbolCatch)) throw new Error("argname must be AST_SymbolCatch");
+        });
+    },
 }, AST_Block);
 
 var AST_Finally = DEFNODE("Finally", null, {
     $documentation: "A `finally` node; only makes sense as part of a `try` statement"
 }, AST_Block);
 
-/* -----[ VAR/CONST ]----- */
+/* -----[ VAR ]----- */
 
 var AST_Definitions = DEFNODE("Definitions", "definitions", {
-    $documentation: "Base class for `var` or `const` nodes (variable declarations/initializations)",
+    $documentation: "Base class for `var` nodes (variable declarations/initializations)",
     $propdoc: {
         definitions: "[AST_VarDef*] array of variable definitions"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.definitions.forEach(function(def){
-                def._walk(visitor);
+    _equals: function(node) {
+        return all_equals(this.definitions, node.definitions);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.definitions.forEach(function(defn) {
+                defn.walk(visitor);
             });
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "Definitions") throw new Error("should not instantiate AST_Definitions");
+        if (this.definitions.length < 1) throw new Error("must have at least one definition");
+    },
 }, AST_Statement);
 
-var AST_Var = DEFNODE("Var", null, {
-    $documentation: "A `var` statement"
+var AST_Const = DEFNODE("Const", null, {
+    $documentation: "A `const` statement",
+    _validate: function() {
+        this.definitions.forEach(function(node) {
+            if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]");
+            validate_destructured(node.name, function(node) {
+                if (!(node instanceof AST_SymbolConst)) throw new Error("name must be AST_SymbolConst");
+            });
+        });
+    },
 }, AST_Definitions);
 
-var AST_Const = DEFNODE("Const", null, {
-    $documentation: "A `const` statement"
+var AST_Let = DEFNODE("Let", null, {
+    $documentation: "A `let` statement",
+    _validate: function() {
+        this.definitions.forEach(function(node) {
+            if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]");
+            validate_destructured(node.name, function(node) {
+                if (!(node instanceof AST_SymbolLet)) throw new Error("name must be AST_SymbolLet");
+            });
+        });
+    },
+}, AST_Definitions);
+
+var AST_Var = DEFNODE("Var", null, {
+    $documentation: "A `var` statement",
+    _validate: function() {
+        this.definitions.forEach(function(node) {
+            if (!(node instanceof AST_VarDef)) throw new Error("definitions must be AST_VarDef[]");
+            validate_destructured(node.name, function(node) {
+                if (!(node instanceof AST_SymbolVar)) throw new Error("name must be AST_SymbolVar");
+            });
+        });
+    },
 }, AST_Definitions);
 
 var AST_VarDef = DEFNODE("VarDef", "name value", {
     $documentation: "A variable declaration; only appears in a AST_Definitions node",
     $propdoc: {
-        name: "[AST_SymbolVar|AST_SymbolConst] name of the variable",
-        value: "[AST_Node?] initializer, or null of there's no initializer"
+        name: "[AST_Destructured|AST_SymbolVar] name of the variable",
+        value: "[AST_Node?] initializer, or null of there's no initializer",
+    },
+    _equals: function(node) {
+        return this.name.equals(node.name)
+            && prop_equals(this.value, node.value);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.name._walk(visitor);
-            if (this.value) this.value._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.name.walk(visitor);
+            if (node.value) node.value.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.value != null) must_be_expression(this, "value");
+    },
 });
 
 /* -----[ OTHER ]----- */
 
-var AST_Call = DEFNODE("Call", "expression args", {
+var AST_ExportDeclaration = DEFNODE("ExportDeclaration", "body", {
+    $documentation: "An `export` statement",
+    $propdoc: {
+        body: "[AST_DefClass|AST_Definitions|AST_LambdaDefinition] the statement to export",
+    },
+    _equals: function(node) {
+        return this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.body.walk(visitor);
+        });
+    },
+    _validate: function() {
+        if (!(this.body instanceof AST_DefClass
+            || this.body instanceof AST_Definitions
+            || this.body instanceof AST_LambdaDefinition)) {
+            throw new Error("body must be AST_DefClass, AST_Definitions or AST_LambdaDefinition");
+        }
+    },
+}, AST_Statement);
+
+var AST_ExportDefault = DEFNODE("ExportDefault", "body", {
+    $documentation: "An `export default` statement",
+    $propdoc: {
+        body: "[AST_Node] the default export",
+    },
+    _equals: function(node) {
+        return this.body.equals(node.body);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.body.walk(visitor);
+        });
+    },
+    _validate: function() {
+        if (!(this.body instanceof AST_DefClass || this.body instanceof AST_LambdaDefinition)) {
+            must_be_expression(this, "body");
+        }
+    },
+}, AST_Statement);
+
+var AST_ExportForeign = DEFNODE("ExportForeign", "aliases keys path", {
+    $documentation: "An `export ... from '...'` statement",
+    $propdoc: {
+        aliases: "[AST_String*] array of aliases to export",
+        keys: "[AST_String*] array of keys to import",
+        path: "[AST_String] the path to import module",
+    },
+    _equals: function(node) {
+        return this.path.equals(node.path)
+            && all_equals(this.aliases, node.aliases)
+            && all_equals(this.keys, node.keys);
+    },
+    _validate: function() {
+        if (this.aliases.length != this.keys.length) {
+            throw new Error("aliases:key length mismatch: " + this.aliases.length + " != " + this.keys.length);
+        }
+        this.aliases.forEach(function(name) {
+            if (!(name instanceof AST_String)) throw new Error("aliases must contain AST_String");
+        });
+        this.keys.forEach(function(name) {
+            if (!(name instanceof AST_String)) throw new Error("keys must contain AST_String");
+        });
+        if (!(this.path instanceof AST_String)) throw new Error("path must be AST_String");
+    },
+}, AST_Statement);
+
+var AST_ExportReferences = DEFNODE("ExportReferences", "properties", {
+    $documentation: "An `export { ... }` statement",
+    $propdoc: {
+        properties: "[AST_SymbolExport*] array of aliases to export",
+    },
+    _equals: function(node) {
+        return all_equals(this.properties, node.properties);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.properties.forEach(function(prop) {
+                prop.walk(visitor);
+            });
+        });
+    },
+    _validate: function() {
+        this.properties.forEach(function(prop) {
+            if (!(prop instanceof AST_SymbolExport)) throw new Error("properties must contain AST_SymbolExport");
+        });
+    },
+}, AST_Statement);
+
+var AST_Import = DEFNODE("Import", "all default path properties", {
+    $documentation: "An `import` statement",
+    $propdoc: {
+        all: "[AST_SymbolImport?] the imported namespace, or null if not specified",
+        default: "[AST_SymbolImport?] the alias for default `export`, or null if not specified",
+        path: "[AST_String] the path to import module",
+        properties: "[(AST_SymbolImport*)?] array of aliases, or null if not specified",
+    },
+    _equals: function(node) {
+        return this.path.equals(node.path)
+            && prop_equals(this.all, node.all)
+            && prop_equals(this.default, node.default)
+            && !this.properties == !node.properties
+            && (!this.properties || all_equals(this.properties, node.properties));
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.all) node.all.walk(visitor);
+            if (node.default) node.default.walk(visitor);
+            if (node.properties) node.properties.forEach(function(prop) {
+                prop.walk(visitor);
+            });
+        });
+    },
+    _validate: function() {
+        if (this.all != null) {
+            if (!(this.all instanceof AST_SymbolImport)) throw new Error("all must be AST_SymbolImport");
+            if (this.properties != null) throw new Error("cannot import both * and {} in the same statement");
+        }
+        if (this.default != null) {
+            if (!(this.default instanceof AST_SymbolImport)) throw new Error("default must be AST_SymbolImport");
+            if (this.default.key.value !== "") throw new Error("invalid default key: " + this.default.key.value);
+        }
+        if (!(this.path instanceof AST_String)) throw new Error("path must be AST_String");
+        if (this.properties != null) this.properties.forEach(function(node) {
+            if (!(node instanceof AST_SymbolImport)) throw new Error("properties must contain AST_SymbolImport");
+        });
+    },
+}, AST_Statement);
+
+var AST_DefaultValue = DEFNODE("DefaultValue", "name value", {
+    $documentation: "A default value declaration",
+    $propdoc: {
+        name: "[AST_Destructured|AST_SymbolDeclaration] name of the variable",
+        value: "[AST_Node] value to assign if variable is `undefined`",
+    },
+    _equals: function(node) {
+        return this.name.equals(node.name)
+            && this.value.equals(node.value);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.name.walk(visitor);
+            node.value.walk(visitor);
+        });
+    },
+    _validate: function() {
+        must_be_expression(this, "value");
+    },
+});
+
+function must_be_expressions(node, prop, allow_spread, allow_hole) {
+    node[prop].forEach(function(node) {
+        validate_expression(node, prop, true, allow_spread, allow_hole);
+    });
+}
+
+var AST_Call = DEFNODE("Call", "args expression optional pure terminal", {
     $documentation: "A function call expression",
     $propdoc: {
+        args: "[AST_Node*] array of arguments",
         expression: "[AST_Node] expression to invoke as function",
-        args: "[AST_Node*] array of arguments"
+        optional: "[boolean] whether the expression is optional chaining",
+        pure: "[boolean/S] marker for side-effect-free call expression",
+        terminal: "[boolean] whether the chain has ended",
+    },
+    _equals: function(node) {
+        return !this.optional == !node.optional
+            && this.expression.equals(node.expression)
+            && all_equals(this.args, node.args);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
-            this.args.forEach(function(arg){
-                arg._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+            node.args.forEach(function(arg) {
+                arg.walk(visitor);
             });
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+        must_be_expressions(this, "args", true);
+    },
 });
 
 var AST_New = DEFNODE("New", null, {
-    $documentation: "An object instantiation.  Derives from a function call since it has exactly the same properties"
+    $documentation: "An object instantiation.  Derives from a function call since it has exactly the same properties",
+    _validate: function() {
+        if (this.optional) throw new Error("optional must be false");
+        if (this.terminal) throw new Error("terminal must be false");
+    },
 }, AST_Call);
 
-var AST_Seq = DEFNODE("Seq", "car cdr", {
-    $documentation: "A sequence expression (two comma-separated expressions)",
+var AST_Sequence = DEFNODE("Sequence", "expressions", {
+    $documentation: "A sequence expression (comma-separated expressions)",
     $propdoc: {
-        car: "[AST_Node] first element in sequence",
-        cdr: "[AST_Node] second element in sequence"
+        expressions: "[AST_Node*] array of expressions (at least two)",
+    },
+    _equals: function(node) {
+        return all_equals(this.expressions, node.expressions);
     },
-    $cons: function(x, y) {
-        var seq = new AST_Seq(x);
-        seq.car = x;
-        seq.cdr = y;
-        return seq;
-    },
-    $from_array: function(array) {
-        if (array.length == 0) return null;
-        if (array.length == 1) return array[0].clone();
-        var list = null;
-        for (var i = array.length; --i >= 0;) {
-            list = AST_Seq.cons(array[i], list);
-        }
-        var p = list;
-        while (p) {
-            if (p.cdr && !p.cdr.cdr) {
-                p.cdr = p.cdr.car;
-                break;
-            }
-            p = p.cdr;
-        }
-        return list;
-    },
-    to_array: function() {
-        var p = this, a = [];
-        while (p) {
-            a.push(p.car);
-            if (p.cdr && !(p.cdr instanceof AST_Seq)) {
-                a.push(p.cdr);
-                break;
-            }
-            p = p.cdr;
-        }
-        return a;
-    },
-    add: function(node) {
-        var p = this;
-        while (p) {
-            if (!(p.cdr instanceof AST_Seq)) {
-                var cell = AST_Seq.cons(p.cdr, node);
-                return p.cdr = cell;
-            }
-            p = p.cdr;
-        }
-    },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.car._walk(visitor);
-            if (this.cdr) this.cdr._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expressions.forEach(function(expr) {
+                expr.walk(visitor);
+            });
         });
-    }
+    },
+    _validate: function() {
+        if (this.expressions.length < 2) throw new Error("expressions must contain multiple elements");
+        must_be_expressions(this, "expressions");
+    },
 });
 
-var AST_PropAccess = DEFNODE("PropAccess", "expression property", {
+function root_expr(prop) {
+    while (prop instanceof AST_PropAccess) prop = prop.expression;
+    return prop;
+}
+
+var AST_PropAccess = DEFNODE("PropAccess", "expression optional property terminal", {
     $documentation: "Base class for property access expressions, i.e. `a.foo` or `a[\"foo\"]`",
     $propdoc: {
         expression: "[AST_Node] the “container” expression",
-        property: "[AST_Node|string] the property to access.  For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node"
-    }
+        optional: "[boolean] whether the expression is optional chaining",
+        property: "[AST_Node|string] the property to access.  For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node",
+        terminal: "[boolean] whether the chain has ended",
+    },
+    _equals: function(node) {
+        return !this.optional == !node.optional
+            && prop_equals(this.property, node.property)
+            && this.expression.equals(node.expression);
+    },
+    get_property: function() {
+        var p = this.property;
+        if (p instanceof AST_Constant) return p.value;
+        if (p instanceof AST_UnaryPrefix && p.operator == "void" && p.expression instanceof AST_Constant) return;
+        return p;
+    },
+    _validate: function() {
+        if (this.TYPE == "PropAccess") throw new Error("should not instantiate AST_PropAccess");
+        must_be_expression(this, "expression");
+    },
 });
 
-var AST_Dot = DEFNODE("Dot", null, {
+var AST_Dot = DEFNODE("Dot", "quoted", {
     $documentation: "A dotted property access expression",
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
+    $propdoc: {
+        quoted: "[boolean] whether property is transformed from a quoted string",
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (typeof this.property != "string") throw new Error("property must be string");
+    },
 }, AST_PropAccess);
 
 var AST_Sub = DEFNODE("Sub", null, {
     $documentation: "Index-style property access, i.e. `a[\"foo\"]`",
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
-            this.property._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+            node.property.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "property");
+    },
 }, AST_PropAccess);
 
+var AST_Spread = DEFNODE("Spread", "expression", {
+    $documentation: "Spread expression in array/object literals or function calls",
+    $propdoc: {
+        expression: "[AST_Node] expression to be expanded",
+    },
+    _equals: function(node) {
+        return this.expression.equals(node.expression);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+        });
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+    },
+});
+
 var AST_Unary = DEFNODE("Unary", "operator expression", {
     $documentation: "Base class for unary expressions",
     $propdoc: {
         operator: "[string] the operator",
-        expression: "[AST_Node] expression that this unary operator applies to"
+        expression: "[AST_Node] expression that this unary operator applies to",
+    },
+    _equals: function(node) {
+        return this.operator == node.operator
+            && this.expression.equals(node.expression);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.expression._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "Unary") throw new Error("should not instantiate AST_Unary");
+        if (typeof this.operator != "string") throw new Error("operator must be string");
+        must_be_expression(this, "expression");
+    },
 });
 
 var AST_UnaryPrefix = DEFNODE("UnaryPrefix", null, {
@@ -689,19 +1648,30 @@
     $documentation: "Unary postfix expression, i.e. `i++`"
 }, AST_Unary);
 
-var AST_Binary = DEFNODE("Binary", "left operator right", {
+var AST_Binary = DEFNODE("Binary", "operator left right", {
     $documentation: "Binary expression, i.e. `a + b`",
     $propdoc: {
         left: "[AST_Node] left-hand side expression",
         operator: "[string] the operator",
         right: "[AST_Node] right-hand side expression"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.left._walk(visitor);
-            this.right._walk(visitor);
+    _equals: function(node) {
+        return this.operator == node.operator
+            && this.left.equals(node.left)
+            && this.right.equals(node.right);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.left.walk(visitor);
+            node.right.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (!(this instanceof AST_Assign)) must_be_expression(this, "left");
+        if (typeof this.operator != "string") throw new Error("operator must be string");
+        must_be_expression(this, "right");
+    },
 });
 
 var AST_Conditional = DEFNODE("Conditional", "condition consequent alternative", {
@@ -711,19 +1681,91 @@
         consequent: "[AST_Node]",
         alternative: "[AST_Node]"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.condition._walk(visitor);
-            this.consequent._walk(visitor);
-            this.alternative._walk(visitor);
+    _equals: function(node) {
+        return this.condition.equals(node.condition)
+            && this.consequent.equals(node.consequent)
+            && this.alternative.equals(node.alternative);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.condition.walk(visitor);
+            node.consequent.walk(visitor);
+            node.alternative.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        must_be_expression(this, "condition");
+        must_be_expression(this, "consequent");
+        must_be_expression(this, "alternative");
+    },
 });
 
 var AST_Assign = DEFNODE("Assign", null, {
     $documentation: "An assignment expression — `a = b + 5`",
+    _validate: function() {
+        if (this.operator.indexOf("=") < 0) throw new Error('operator must contain "="');
+        if (this.left instanceof AST_Destructured) {
+            if (this.operator != "=") throw new Error("invalid destructuring operator: " + this.operator);
+            validate_destructured(this.left, function(node) {
+                if (!(node instanceof AST_PropAccess || node instanceof AST_SymbolRef)) {
+                    throw new Error("left must be assignable: " + node.TYPE);
+                }
+            });
+        } else if (!(this.left instanceof AST_Infinity
+            || this.left instanceof AST_NaN
+            || this.left instanceof AST_PropAccess && !this.left.optional
+            || this.left instanceof AST_SymbolRef
+            || this.left instanceof AST_Undefined)) {
+            throw new Error("left must be assignable");
+        }
+    },
 }, AST_Binary);
 
+var AST_Await = DEFNODE("Await", "expression", {
+    $documentation: "An await expression",
+    $propdoc: {
+        expression: "[AST_Node] expression with Promise to resolve on",
+    },
+    _equals: function(node) {
+        return this.expression.equals(node.expression);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.expression.walk(visitor);
+        });
+    },
+    _validate: function() {
+        must_be_expression(this, "expression");
+    },
+});
+
+var AST_Yield = DEFNODE("Yield", "expression nested", {
+    $documentation: "A yield expression",
+    $propdoc: {
+        expression: "[AST_Node?] return value for iterator, or null if undefined",
+        nested: "[boolean] whether to iterate over expression as generator",
+    },
+    _equals: function(node) {
+        return !this.nested == !node.nested
+            && prop_equals(this.expression, node.expression);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.expression) node.expression.walk(visitor);
+        });
+    },
+    _validate: function() {
+        if (this.expression != null) {
+            must_be_expression(this, "expression");
+        } else if (this.nested) {
+            throw new Error("yield* must contain expression");
+        }
+    },
+});
+
 /* -----[ LITERALS ]----- */
 
 var AST_Array = DEFNODE("Array", "elements", {
@@ -731,86 +1773,246 @@
     $propdoc: {
         elements: "[AST_Node*] array of elements"
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.elements.forEach(function(el){
-                el._walk(visitor);
+    _equals: function(node) {
+        return all_equals(this.elements, node.elements);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.elements.forEach(function(element) {
+                element.walk(visitor);
             });
         });
+    },
+    _validate: function() {
+        must_be_expressions(this, "elements", true, true);
+    },
+});
+
+var AST_Destructured = DEFNODE("Destructured", "rest", {
+    $documentation: "Base class for destructured literal",
+    $propdoc: {
+        rest: "[(AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef)?] rest parameter, or null if absent",
+    },
+    _validate: function() {
+        if (this.TYPE == "Destructured") throw new Error("should not instantiate AST_Destructured");
+    },
+});
+
+function validate_destructured(node, check, allow_default) {
+    if (node instanceof AST_DefaultValue && allow_default) return validate_destructured(node.name, check);
+    if (node instanceof AST_Destructured) {
+        if (node.rest != null) validate_destructured(node.rest, check);
+        if (node instanceof AST_DestructuredArray) return node.elements.forEach(function(node) {
+            if (!(node instanceof AST_Hole)) validate_destructured(node, check, true);
+        });
+        if (node instanceof AST_DestructuredObject) return node.properties.forEach(function(prop) {
+            validate_destructured(prop.value, check, true);
+        });
     }
+    check(node);
+}
+
+var AST_DestructuredArray = DEFNODE("DestructuredArray", "elements", {
+    $documentation: "A destructured array literal",
+    $propdoc: {
+        elements: "[(AST_DefaultValue|AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef)*] array of elements",
+    },
+    _equals: function(node) {
+        return prop_equals(this.rest, node.rest)
+            && all_equals(this.elements, node.elements);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.elements.forEach(function(element) {
+                element.walk(visitor);
+            });
+            if (node.rest) node.rest.walk(visitor);
+        });
+    },
+}, AST_Destructured);
+
+var AST_DestructuredKeyVal = DEFNODE("DestructuredKeyVal", "key value", {
+    $documentation: "A key: value destructured property",
+    $propdoc: {
+        key: "[string|AST_Node] property name.  For computed property this is an AST_Node.",
+        value: "[AST_DefaultValue|AST_Destructured|AST_SymbolDeclaration|AST_SymbolRef] property value",
+    },
+    _equals: function(node) {
+        return prop_equals(this.key, node.key)
+            && this.value.equals(node.value);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.key instanceof AST_Node) node.key.walk(visitor);
+            node.value.walk(visitor);
+        });
+    },
+    _validate: function() {
+        if (typeof this.key != "string") {
+            if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node");
+            must_be_expression(this, "key");
+        }
+        if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node");
+    },
 });
 
+var AST_DestructuredObject = DEFNODE("DestructuredObject", "properties", {
+    $documentation: "A destructured object literal",
+    $propdoc: {
+        properties: "[AST_DestructuredKeyVal*] array of properties",
+    },
+    _equals: function(node) {
+        return prop_equals(this.rest, node.rest)
+            && all_equals(this.properties, node.properties);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.properties.forEach(function(prop) {
+                prop.walk(visitor);
+            });
+            if (node.rest) node.rest.walk(visitor);
+        });
+    },
+    _validate: function() {
+        this.properties.forEach(function(node) {
+            if (!(node instanceof AST_DestructuredKeyVal)) throw new Error("properties must be AST_DestructuredKeyVal[]");
+        });
+    },
+}, AST_Destructured);
+
 var AST_Object = DEFNODE("Object", "properties", {
     $documentation: "An object literal",
     $propdoc: {
-        properties: "[AST_ObjectProperty*] array of properties"
+        properties: "[(AST_ObjectProperty|AST_Spread)*] array of properties"
+    },
+    _equals: function(node) {
+        return all_equals(this.properties, node.properties);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.properties.forEach(function(prop){
-                prop._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            node.properties.forEach(function(prop) {
+                prop.walk(visitor);
             });
         });
-    }
+    },
+    _validate: function() {
+        this.properties.forEach(function(node) {
+            if (!(node instanceof AST_ObjectProperty || node instanceof AST_Spread)) {
+                throw new Error("properties must contain AST_ObjectProperty and/or AST_Spread only");
+            }
+        });
+    },
 });
 
 var AST_ObjectProperty = DEFNODE("ObjectProperty", "key value", {
     $documentation: "Base class for literal object properties",
     $propdoc: {
-        key: "[string] the property name converted to a string for ObjectKeyVal.  For setters and getters this is an arbitrary AST_Node.",
-        value: "[AST_Node] property value.  For setters and getters this is an AST_Function."
+        key: "[string|AST_Node] property name.  For computed property this is an AST_Node.",
+        value: "[AST_Node] property value.  For getters and setters this is an AST_Accessor.",
+    },
+    _equals: function(node) {
+        return prop_equals(this.key, node.key)
+            && this.value.equals(node.value);
     },
-    _walk: function(visitor) {
-        return visitor._visit(this, function(){
-            this.value._walk(visitor);
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.key instanceof AST_Node) node.key.walk(visitor);
+            node.value.walk(visitor);
         });
-    }
+    },
+    _validate: function() {
+        if (this.TYPE == "ObjectProperty") throw new Error("should not instantiate AST_ObjectProperty");
+        if (typeof this.key != "string") {
+            if (!(this.key instanceof AST_Node)) throw new Error("key must be string or AST_Node");
+            must_be_expression(this, "key");
+        }
+        if (!(this.value instanceof AST_Node)) throw new Error("value must be AST_Node");
+    },
 });
 
-var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", "quote", {
+var AST_ObjectKeyVal = DEFNODE("ObjectKeyVal", null, {
     $documentation: "A key: value object property",
-    $propdoc: {
-        quote: "[string] the original quote character"
-    }
+    _validate: function() {
+        must_be_expression(this, "value");
+    },
 }, AST_ObjectProperty);
 
+var AST_ObjectMethod = DEFNODE("ObjectMethod", null, {
+    $documentation: "A key(){} object property",
+    _validate: function() {
+        if (!(this.value instanceof AST_LambdaExpression)) throw new Error("value must be AST_LambdaExpression");
+        if (is_arrow(this.value)) throw new Error("value cannot be AST_Arrow or AST_AsyncArrow");
+        if (this.value.name != null) throw new Error("name of object method's lambda must be null");
+    },
+}, AST_ObjectKeyVal);
+
 var AST_ObjectSetter = DEFNODE("ObjectSetter", null, {
     $documentation: "An object setter property",
+    _validate: function() {
+        if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor");
+    },
 }, AST_ObjectProperty);
 
 var AST_ObjectGetter = DEFNODE("ObjectGetter", null, {
     $documentation: "An object getter property",
+    _validate: function() {
+        if (!(this.value instanceof AST_Accessor)) throw new Error("value must be AST_Accessor");
+    },
 }, AST_ObjectProperty);
 
 var AST_Symbol = DEFNODE("Symbol", "scope name thedef", {
+    $documentation: "Base class for all symbols",
     $propdoc: {
         name: "[string] name of this symbol",
         scope: "[AST_Scope/S] the current scope (not necessarily the definition scope)",
         thedef: "[SymbolDef/S] the definition of this symbol"
     },
-    $documentation: "Base class for all symbols",
+    _equals: function(node) {
+        return this.thedef ? this.thedef === node.thedef : this.name == node.name;
+    },
+    _validate: function() {
+        if (this.TYPE == "Symbol") throw new Error("should not instantiate AST_Symbol");
+        if (typeof this.name != "string") throw new Error("name must be string");
+    },
 });
 
-var AST_SymbolAccessor = DEFNODE("SymbolAccessor", null, {
-    $documentation: "The name of a property accessor (setter/getter function)"
+var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
+    $documentation: "A declaration symbol (symbol in var, function name or argument, symbol in catch)",
 }, AST_Symbol);
 
-var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
-    $documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
+var AST_SymbolConst = DEFNODE("SymbolConst", null, {
+    $documentation: "Symbol defining a constant",
+}, AST_SymbolDeclaration);
+
+var AST_SymbolImport = DEFNODE("SymbolImport", "key", {
+    $documentation: "Symbol defined by an `import` statement",
     $propdoc: {
-        init: "[AST_Node*/S] array of initializers for this declaration."
-    }
-}, AST_Symbol);
+        key: "[AST_String] the original `export` name",
+    },
+    _equals: function(node) {
+        return this.name == node.name
+            && this.key.equals(node.key);
+    },
+    _validate: function() {
+        if (!(this.key instanceof AST_String)) throw new Error("key must be AST_String");
+    },
+}, AST_SymbolConst);
 
-var AST_SymbolVar = DEFNODE("SymbolVar", null, {
-    $documentation: "Symbol defining a variable",
+var AST_SymbolLet = DEFNODE("SymbolLet", null, {
+    $documentation: "Symbol defining a lexical-scoped variable",
 }, AST_SymbolDeclaration);
 
-var AST_SymbolConst = DEFNODE("SymbolConst", null, {
-    $documentation: "A constant declaration"
+var AST_SymbolVar = DEFNODE("SymbolVar", null, {
+    $documentation: "Symbol defining a variable",
 }, AST_SymbolDeclaration);
 
-var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, {
+var AST_SymbolFunarg = DEFNODE("SymbolFunarg", "unused", {
     $documentation: "Symbol naming a function argument",
 }, AST_SymbolVar);
 
@@ -822,6 +2024,14 @@
     $documentation: "Symbol naming a function expression",
 }, AST_SymbolDeclaration);
 
+var AST_SymbolDefClass = DEFNODE("SymbolDefClass", null, {
+    $documentation: "Symbol defining a class",
+}, AST_SymbolConst);
+
+var AST_SymbolClass = DEFNODE("SymbolClass", null, {
+    $documentation: "Symbol naming a class expression",
+}, AST_SymbolConst);
+
 var AST_SymbolCatch = DEFNODE("SymbolCatch", null, {
     $documentation: "Symbol naming the exception in catch",
 }, AST_SymbolDeclaration);
@@ -834,162 +2044,313 @@
     initialize: function() {
         this.references = [];
         this.thedef = this;
-    }
+    },
 }, AST_Symbol);
 
-var AST_SymbolRef = DEFNODE("SymbolRef", null, {
+var AST_SymbolRef = DEFNODE("SymbolRef", "fixed in_arg redef", {
     $documentation: "Reference to some symbol (not definition/declaration)",
 }, AST_Symbol);
 
+var AST_SymbolExport = DEFNODE("SymbolExport", "alias", {
+    $documentation: "Reference in an `export` statement",
+    $propdoc: {
+        alias: "[AST_String] the `export` alias",
+    },
+    _equals: function(node) {
+        return this.name == node.name
+            && this.alias.equals(node.alias);
+    },
+    _validate: function() {
+        if (!(this.alias instanceof AST_String)) throw new Error("alias must be AST_String");
+    },
+}, AST_SymbolRef);
+
 var AST_LabelRef = DEFNODE("LabelRef", null, {
     $documentation: "Reference to a label symbol",
 }, AST_Symbol);
 
+var AST_ObjectIdentity = DEFNODE("ObjectIdentity", null, {
+    $documentation: "Base class for `super` & `this`",
+    _equals: return_true,
+    _validate: function() {
+        if (this.TYPE == "ObjectIdentity") throw new Error("should not instantiate AST_ObjectIdentity");
+    },
+}, AST_Symbol);
+
+var AST_Super = DEFNODE("Super", null, {
+    $documentation: "The `super` symbol",
+    _validate: function() {
+        if (this.name !== "super") throw new Error('name must be "super"');
+    },
+}, AST_ObjectIdentity);
+
 var AST_This = DEFNODE("This", null, {
     $documentation: "The `this` symbol",
-}, AST_Symbol);
+    _validate: function() {
+        if (this.TYPE == "This" && this.name !== "this") throw new Error('name must be "this"');
+    },
+}, AST_ObjectIdentity);
+
+var AST_NewTarget = DEFNODE("NewTarget", null, {
+    $documentation: "The `new.target` symbol",
+    initialize: function() {
+        this.name = "new.target";
+    },
+    _validate: function() {
+        if (this.name !== "new.target") throw new Error('name must be "new.target": ' + this.name);
+    },
+}, AST_This);
+
+var AST_Template = DEFNODE("Template", "expressions strings tag", {
+    $documentation: "A template literal, i.e. tag`str1${expr1}...strN${exprN}strN+1`",
+    $propdoc: {
+        expressions: "[AST_Node*] the placeholder expressions",
+        strings: "[string*] the raw text segments",
+        tag: "[AST_Node?] tag function, or null if absent",
+    },
+    _equals: function(node) {
+        return prop_equals(this.tag, node.tag)
+            && list_equals(this.strings, node.strings)
+            && all_equals(this.expressions, node.expressions);
+    },
+    walk: function(visitor) {
+        var node = this;
+        visitor.visit(node, function() {
+            if (node.tag) node.tag.walk(visitor);
+            node.expressions.forEach(function(expr) {
+                expr.walk(visitor);
+            });
+        });
+    },
+    _validate: function() {
+        if (this.expressions.length + 1 != this.strings.length) {
+            throw new Error("malformed template with " + this.expressions.length + " placeholder(s) but " + this.strings.length + " text segment(s)");
+        }
+        must_be_expressions(this, "expressions");
+        this.strings.forEach(function(string) {
+            if (typeof string != "string") throw new Error("strings must contain string");
+        });
+        if (this.tag != null) must_be_expression(this, "tag");
+    },
+});
 
 var AST_Constant = DEFNODE("Constant", null, {
     $documentation: "Base class for all constants",
-    getValue: function() {
-        return this.value;
-    }
+    _equals: function(node) {
+        return this.value === node.value;
+    },
+    _validate: function() {
+        if (this.TYPE == "Constant") throw new Error("should not instantiate AST_Constant");
+    },
 });
 
-var AST_String = DEFNODE("String", "value quote", {
+var AST_String = DEFNODE("String", "quote value", {
     $documentation: "A string literal",
     $propdoc: {
+        quote: "[string?] the original quote character",
         value: "[string] the contents of this string",
-        quote: "[string] the original quote character"
-    }
+    },
+    _validate: function() {
+        if (this.quote != null) {
+            if (typeof this.quote != "string") throw new Error("quote must be string");
+            if (!/^["']$/.test(this.quote)) throw new Error("invalid quote: " + this.quote);
+        }
+        if (typeof this.value != "string") throw new Error("value must be string");
+    },
 }, AST_Constant);
 
 var AST_Number = DEFNODE("Number", "value", {
     $documentation: "A number literal",
     $propdoc: {
-        value: "[number] the numeric value"
-    }
+        value: "[number] the numeric value",
+    },
+    _validate: function() {
+        if (typeof this.value != "number") throw new Error("value must be number");
+        if (!isFinite(this.value)) throw new Error("value must be finite");
+        if (this.value < 0) throw new Error("value cannot be negative");
+    },
+}, AST_Constant);
+
+var AST_BigInt = DEFNODE("BigInt", "value", {
+    $documentation: "A BigInt literal",
+    $propdoc: {
+        value: "[string] the numeric representation",
+    },
+    _validate: function() {
+        if (typeof this.value != "string") throw new Error("value must be string");
+        if (this.value[0] == "-") throw new Error("value cannot be negative");
+    },
 }, AST_Constant);
 
 var AST_RegExp = DEFNODE("RegExp", "value", {
     $documentation: "A regexp literal",
     $propdoc: {
         value: "[RegExp] the actual regexp"
-    }
+    },
+    _equals: function(node) {
+        return "" + this.value == "" + node.value;
+    },
+    _validate: function() {
+        if (!(this.value instanceof RegExp)) throw new Error("value must be RegExp");
+    },
 }, AST_Constant);
 
 var AST_Atom = DEFNODE("Atom", null, {
     $documentation: "Base class for atoms",
+    _equals: return_true,
+    _validate: function() {
+        if (this.TYPE == "Atom") throw new Error("should not instantiate AST_Atom");
+    },
 }, AST_Constant);
 
 var AST_Null = DEFNODE("Null", null, {
     $documentation: "The `null` atom",
-    value: null
+    value: null,
 }, AST_Atom);
 
 var AST_NaN = DEFNODE("NaN", null, {
     $documentation: "The impossible value",
-    value: 0/0
+    value: 0/0,
 }, AST_Atom);
 
 var AST_Undefined = DEFNODE("Undefined", null, {
     $documentation: "The `undefined` value",
-    value: (function(){}())
+    value: function(){}(),
 }, AST_Atom);
 
 var AST_Hole = DEFNODE("Hole", null, {
     $documentation: "A hole in an array",
-    value: (function(){}())
+    value: function(){}(),
 }, AST_Atom);
 
 var AST_Infinity = DEFNODE("Infinity", null, {
     $documentation: "The `Infinity` value",
-    value: 1/0
+    value: 1/0,
 }, AST_Atom);
 
 var AST_Boolean = DEFNODE("Boolean", null, {
     $documentation: "Base class for booleans",
+    _validate: function() {
+        if (this.TYPE == "Boolean") throw new Error("should not instantiate AST_Boolean");
+    },
 }, AST_Atom);
 
 var AST_False = DEFNODE("False", null, {
     $documentation: "The `false` atom",
-    value: false
+    value: false,
 }, AST_Boolean);
 
 var AST_True = DEFNODE("True", null, {
     $documentation: "The `true` atom",
-    value: true
+    value: true,
 }, AST_Boolean);
 
 /* -----[ TreeWalker ]----- */
 
 function TreeWalker(callback) {
-    this.visit = callback;
+    this.callback = callback;
+    this.directives = Object.create(null);
     this.stack = [];
-};
+}
 TreeWalker.prototype = {
-    _visit: function(node, descend) {
-        this.stack.push(node);
-        var ret = this.visit(node, descend ? function(){
-            descend.call(node);
-        } : noop);
-        if (!ret && descend) {
-            descend.call(node);
-        }
-        this.stack.pop();
-        return ret;
+    visit: function(node, descend) {
+        this.push(node);
+        var done = this.callback(node, descend || noop);
+        if (!done && descend) descend();
+        this.pop();
     },
     parent: function(n) {
         return this.stack[this.stack.length - 2 - (n || 0)];
     },
-    push: function (node) {
+    push: function(node) {
+        var value;
+        if (node instanceof AST_Class) {
+            this.directives = Object.create(this.directives);
+            value = "use strict";
+        } else if (node instanceof AST_Directive) {
+            value = node.value;
+        } else if (node instanceof AST_Lambda) {
+            this.directives = Object.create(this.directives);
+        }
+        if (value && !this.directives[value]) this.directives[value] = node;
         this.stack.push(node);
     },
     pop: function() {
-        return this.stack.pop();
+        var node = this.stack.pop();
+        if (node instanceof AST_Class || node instanceof AST_Lambda) {
+            this.directives = Object.getPrototypeOf(this.directives);
+        }
     },
     self: function() {
         return this.stack[this.stack.length - 1];
     },
     find_parent: function(type) {
         var stack = this.stack;
-        for (var i = stack.length; --i >= 0;) {
+        for (var i = stack.length - 1; --i >= 0;) {
             var x = stack[i];
             if (x instanceof type) return x;
         }
     },
     has_directive: function(type) {
-        return this.find_parent(AST_Scope).has_directive(type);
-    },
-    in_boolean_context: function() {
-        var stack = this.stack;
-        var i = stack.length, self = stack[--i];
-        while (i > 0) {
-            var p = stack[--i];
-            if ((p instanceof AST_If           && p.condition === self) ||
-                (p instanceof AST_Conditional  && p.condition === self) ||
-                (p instanceof AST_DWLoop       && p.condition === self) ||
-                (p instanceof AST_For          && p.condition === self) ||
-                (p instanceof AST_UnaryPrefix  && p.operator == "!" && p.expression === self))
-            {
-                return true;
+        var dir = this.directives[type];
+        if (dir) return dir;
+        var node = this.stack[this.stack.length - 1];
+        if (node instanceof AST_Scope) {
+            for (var i = 0; i < node.body.length; ++i) {
+                var st = node.body[i];
+                if (!(st instanceof AST_Directive)) break;
+                if (st.value == type) return st;
             }
-            if (!(p instanceof AST_Binary && (p.operator == "&&" || p.operator == "||")))
-                return false;
-            self = p;
         }
     },
-    loopcontrol_target: function(label) {
+    loopcontrol_target: function(node) {
         var stack = this.stack;
-        if (label) for (var i = stack.length; --i >= 0;) {
+        if (node.label) for (var i = stack.length; --i >= 0;) {
             var x = stack[i];
-            if (x instanceof AST_LabeledStatement && x.label.name == label.name) {
+            if (x instanceof AST_LabeledStatement && x.label.name == node.label.name)
                 return x.body;
-            }
         } else for (var i = stack.length; --i >= 0;) {
             var x = stack[i];
-            if (x instanceof AST_Switch || x instanceof AST_IterationStatement)
+            if (x instanceof AST_IterationStatement
+                || node instanceof AST_Break && x instanceof AST_Switch)
                 return x;
         }
+    },
+    in_boolean_context: function() {
+        for (var drop = true, level = 0, parent, self = this.self(); parent = this.parent(level++); self = parent) {
+            if (parent instanceof AST_Binary) switch (parent.operator) {
+              case "&&":
+              case "||":
+                if (parent.left === self) drop = false;
+                continue;
+              default:
+                return false;
+            }
+            if (parent instanceof AST_Conditional) {
+                if (parent.condition === self) return true;
+                continue;
+            }
+            if (parent instanceof AST_DWLoop) return parent.condition === self;
+            if (parent instanceof AST_For) return parent.condition === self;
+            if (parent instanceof AST_If) return parent.condition === self;
+            if (parent instanceof AST_Return) {
+                if (parent.in_bool) return true;
+                while (parent = this.parent(level++)) {
+                    if (parent instanceof AST_Lambda) {
+                        if (parent.name) return false;
+                        parent = this.parent(level++);
+                        if (parent.TYPE != "Call") return false;
+                        break;
+                    }
+                }
+            }
+            if (parent instanceof AST_Sequence) {
+                if (parent.tail_node() === self) continue;
+                return drop ? "d" : true;
+            }
+            if (parent instanceof AST_SimpleStatement) return drop ? "d" : true;
+            if (parent instanceof AST_UnaryPrefix) return parent.operator == "!";
+            return false;
+        }
     }
 };
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/compress.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/compress.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/compress.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -48,810 +48,5603 @@
         return new Compressor(options, false_by_default);
     TreeTransformer.call(this, this.before, this.after);
     this.options = defaults(options, {
-        sequences     : !false_by_default,
-        properties    : !false_by_default,
-        dead_code     : !false_by_default,
-        drop_debugger : !false_by_default,
-        unsafe        : false,
-        unsafe_comps  : false,
-        conditionals  : !false_by_default,
-        comparisons   : !false_by_default,
-        evaluate      : !false_by_default,
-        booleans      : !false_by_default,
-        loops         : !false_by_default,
-        unused        : !false_by_default,
-        hoist_funs    : !false_by_default,
-        keep_fargs    : false,
-        keep_fnames   : false,
-        hoist_vars    : false,
-        if_return     : !false_by_default,
-        join_vars     : !false_by_default,
-        cascade       : !false_by_default,
-        side_effects  : !false_by_default,
-        pure_getters  : false,
-        pure_funcs    : null,
-        negate_iife   : !false_by_default,
-        screw_ie8     : false,
-        drop_console  : false,
-        angular       : false,
-
-        warnings      : true,
-        global_defs   : {}
+        annotations     : !false_by_default,
+        arguments       : !false_by_default,
+        arrows          : !false_by_default,
+        assignments     : !false_by_default,
+        awaits          : !false_by_default,
+        booleans        : !false_by_default,
+        collapse_vars   : !false_by_default,
+        comparisons     : !false_by_default,
+        conditionals    : !false_by_default,
+        dead_code       : !false_by_default,
+        default_values  : !false_by_default,
+        directives      : !false_by_default,
+        drop_console    : false,
+        drop_debugger   : !false_by_default,
+        evaluate        : !false_by_default,
+        expression      : false,
+        functions       : !false_by_default,
+        global_defs     : false,
+        hoist_exports   : !false_by_default,
+        hoist_funs      : false,
+        hoist_props     : !false_by_default,
+        hoist_vars      : false,
+        ie              : false,
+        if_return       : !false_by_default,
+        imports         : !false_by_default,
+        inline          : !false_by_default,
+        join_vars       : !false_by_default,
+        keep_fargs      : false_by_default,
+        keep_fnames     : false,
+        keep_infinity   : false,
+        loops           : !false_by_default,
+        merge_vars      : !false_by_default,
+        module          : false,
+        negate_iife     : !false_by_default,
+        objects         : !false_by_default,
+        optional_chains : !false_by_default,
+        passes          : 1,
+        properties      : !false_by_default,
+        pure_funcs      : null,
+        pure_getters    : !false_by_default && "strict",
+        reduce_funcs    : !false_by_default,
+        reduce_vars     : !false_by_default,
+        rests           : !false_by_default,
+        sequences       : !false_by_default,
+        side_effects    : !false_by_default,
+        spreads         : !false_by_default,
+        strings         : !false_by_default,
+        switches        : !false_by_default,
+        templates       : !false_by_default,
+        top_retain      : null,
+        toplevel        : !!(options && (options["module"] || options["top_retain"])),
+        typeofs         : !false_by_default,
+        unsafe          : false,
+        unsafe_comps    : false,
+        unsafe_Function : false,
+        unsafe_math     : false,
+        unsafe_proto    : false,
+        unsafe_regexp   : false,
+        unsafe_undefined: false,
+        unused          : !false_by_default,
+        varify          : !false_by_default,
+        webkit          : false,
+        yields          : !false_by_default,
     }, true);
+    var evaluate = this.options["evaluate"];
+    this.eval_threshold = /eager/.test(evaluate) ? 1 / 0 : +evaluate;
+    var global_defs = this.options["global_defs"];
+    if (typeof global_defs == "object") for (var key in global_defs) {
+        if (/^@/.test(key) && HOP(global_defs, key)) {
+            global_defs[key.slice(1)] = parse(global_defs[key], { expression: true });
+        }
+    }
+    if (this.options["inline"] === true) this.options["inline"] = 4;
+    this.drop_fargs = this.options["keep_fargs"] ? return_false : function(lambda, parent) {
+        if (lambda.length_read) return false;
+        var name = lambda.name;
+        if (!name) return parent && parent.TYPE == "Call" && parent.expression === lambda;
+        if (name.fixed_value() !== lambda) return false;
+        var def = name.definition();
+        if (def.direct_access) return false;
+        var escaped = def.escaped;
+        return escaped && escaped.depth != 1;
+    };
+    if (this.options["module"]) this.directives["use strict"] = true;
+    var pure_funcs = this.options["pure_funcs"];
+    if (typeof pure_funcs == "function") {
+        this.pure_funcs = pure_funcs;
+    } else if (typeof pure_funcs == "string") {
+        this.pure_funcs = function(node) {
+            var expr;
+            if (node instanceof AST_Call) {
+                expr = node.expression;
+            } else if (node instanceof AST_Template) {
+                expr = node.tag;
+            }
+            return !(expr && pure_funcs === expr.print_to_string());
+        };
+    } else if (Array.isArray(pure_funcs)) {
+        this.pure_funcs = function(node) {
+            var expr;
+            if (node instanceof AST_Call) {
+                expr = node.expression;
+            } else if (node instanceof AST_Template) {
+                expr = node.tag;
+            }
+            return !(expr && member(expr.print_to_string(), pure_funcs));
+        };
+    } else {
+        this.pure_funcs = return_true;
+    }
+    var sequences = this.options["sequences"];
+    this.sequences_limit = sequences == 1 ? 800 : sequences | 0;
+    var top_retain = this.options["top_retain"];
+    if (top_retain instanceof RegExp) {
+        this.top_retain = function(def) {
+            return top_retain.test(def.name);
+        };
+    } else if (typeof top_retain == "function") {
+        this.top_retain = top_retain;
+    } else if (top_retain) {
+        if (typeof top_retain == "string") {
+            top_retain = top_retain.split(/,/);
+        }
+        this.top_retain = function(def) {
+            return member(def.name, top_retain);
+        };
+    }
+    var toplevel = this.options["toplevel"];
+    this.toplevel = typeof toplevel == "string" ? {
+        funcs: /funcs/.test(toplevel),
+        vars: /vars/.test(toplevel)
+    } : {
+        funcs: toplevel,
+        vars: toplevel
+    };
+}
+
+Compressor.prototype = new TreeTransformer(function(node, descend, in_list) {
+    if (node._squeezed) return node;
+    var is_scope = node instanceof AST_Scope;
+    if (is_scope) {
+        if (this.option("arrows") && is_arrow(node) && node.value) {
+            node.body = [ node.first_statement() ];
+            node.value = null;
+        }
+        node.hoist_properties(this);
+        node.hoist_declarations(this);
+        node.process_returns(this);
+    }
+    // Before https://github.com/mishoo/UglifyJS/pull/1602 AST_Node.optimize()
+    // would call AST_Node.transform() if a different instance of AST_Node is
+    // produced after OPT().
+    // This corrupts TreeWalker.stack, which cause AST look-ups to malfunction.
+    // Migrate and defer all children's AST_Node.transform() to below, which
+    // will now happen after this parent AST_Node has been properly substituted
+    // thus gives a consistent AST snapshot.
+    descend(node, this);
+    // Existing code relies on how AST_Node.optimize() worked, and omitting the
+    // following replacement call would result in degraded efficiency of both
+    // output and performance.
+    descend(node, this);
+    var opt = node.optimize(this);
+    if (is_scope && opt === node && !this.has_directive("use asm") && !opt.pinned()) {
+        opt.drop_unused(this);
+        if (opt.merge_variables(this)) opt.drop_unused(this);
+        descend(opt, this);
+    }
+    if (opt === node) opt._squeezed = true;
+    return opt;
+});
+Compressor.prototype.option = function(key) {
+    return this.options[key];
 };
+Compressor.prototype.exposed = function(def) {
+    if (def.exported) return true;
+    if (def.undeclared) return true;
+    if (!(def.global || def.scope.resolve() instanceof AST_Toplevel)) return false;
+    var toplevel = this.toplevel;
+    return !all(def.orig, function(sym) {
+        return toplevel[sym instanceof AST_SymbolDefun ? "funcs" : "vars"];
+    });
+};
+Compressor.prototype.compress = function(node) {
+    node = node.resolve_defines(this);
+    node.hoist_exports(this);
+    if (this.option("expression")) node.process_expression(true);
+    var merge_vars = this.options.merge_vars;
+    var passes = +this.options.passes || 1;
+    var min_count = 1 / 0;
+    var stopping = false;
+    var mangle = { ie: this.option("ie") };
+    for (var pass = 0; pass < passes; pass++) {
+        node.figure_out_scope(mangle);
+        if (pass > 0 || this.option("reduce_vars"))
+            node.reset_opt_flags(this);
+        this.options.merge_vars = merge_vars && (stopping || pass == passes - 1);
+        node = node.transform(this);
+        if (passes > 1) {
+            var count = 0;
+            node.walk(new TreeWalker(function() {
+                count++;
+            }));
+            AST_Node.info("pass {pass}: last_count: {min_count}, count: {count}", {
+                pass: pass,
+                min_count: min_count,
+                count: count,
+            });
+            if (count < min_count) {
+                min_count = count;
+                stopping = false;
+            } else if (stopping) {
+                break;
+            } else {
+                stopping = true;
+            }
+        }
+    }
+    if (this.option("expression")) node.process_expression(false);
+    return node;
+};
+
+(function(OPT) {
+    OPT(AST_Node, function(self, compressor) {
+        return self;
+    });
 
-Compressor.prototype = new TreeTransformer;
-merge(Compressor.prototype, {
-    option: function(key) { return this.options[key] },
-    warn: function() {
-        if (this.options.warnings)
-            AST_Node.warn.apply(AST_Node, arguments);
-    },
-    before: function(node, descend, in_list) {
-        if (node._squeezed) return node;
-        var was_scope = false;
-        if (node instanceof AST_Scope) {
-            node = node.hoist_declarations(this);
-            was_scope = true;
-        }
-        descend(node, this);
-        node = node.optimize(this);
-        if (was_scope && node instanceof AST_Scope) {
-            node.drop_unused(this);
-            descend(node, this);
+    AST_Toplevel.DEFMETHOD("hoist_exports", function(compressor) {
+        if (!compressor.option("hoist_exports")) return;
+        var body = this.body, props = [];
+        for (var i = 0; i < body.length; i++) {
+            var stat = body[i];
+            if (stat instanceof AST_ExportDeclaration) {
+                body[i] = stat = stat.body;
+                if (stat instanceof AST_Definitions) {
+                    stat.definitions.forEach(function(defn) {
+                        defn.name.match_symbol(export_symbol, true);
+                    });
+                } else {
+                    export_symbol(stat.name);
+                }
+            } else if (stat instanceof AST_ExportReferences) {
+                body.splice(i--, 1);
+                [].push.apply(props, stat.properties);
+            }
+        }
+        if (props.length) body.push(make_node(AST_ExportReferences, this, { properties: props }));
+
+        function export_symbol(sym) {
+            if (!(sym instanceof AST_SymbolDeclaration)) return;
+            var node = make_node(AST_SymbolExport, sym);
+            node.alias = make_node(AST_String, node, { value: node.name });
+            props.push(node);
         }
-        node._squeezed = true;
+    });
+
+    AST_Scope.DEFMETHOD("process_expression", function(insert, transform) {
+        var self = this;
+        var tt = new TreeTransformer(function(node) {
+            if (insert) {
+                if (node instanceof AST_Directive) node = make_node(AST_SimpleStatement, node, {
+                    body: make_node(AST_String, node),
+                });
+                if (node instanceof AST_SimpleStatement) {
+                    return transform ? transform(node) : make_node(AST_Return, node, { value: node.body });
+                }
+            } else if (node instanceof AST_Return) {
+                if (transform) return transform(node);
+                var value = node.value;
+                if (value instanceof AST_String) return make_node(AST_Directive, value);
+                return make_node(AST_SimpleStatement, node, {
+                    body: value || make_node(AST_UnaryPrefix, node, {
+                        operator: "void",
+                        expression: make_node(AST_Number, node, { value: 0 }),
+                    }),
+                });
+            }
+            if (node instanceof AST_Block) {
+                if (node instanceof AST_Lambda) {
+                    if (node !== self) return node;
+                } else if (insert === "awaits" && node instanceof AST_Try) {
+                    if (node.bfinally) return node;
+                }
+                for (var index = node.body.length; --index >= 0;) {
+                    var stat = node.body[index];
+                    if (!is_declaration(stat, true)) {
+                        node.body[index] = stat.transform(tt);
+                        break;
+                    }
+                }
+            } else if (node instanceof AST_If) {
+                node.body = node.body.transform(tt);
+                if (node.alternative) node.alternative = node.alternative.transform(tt);
+            } else if (node instanceof AST_With) {
+                node.body = node.body.transform(tt);
+            }
+            return node;
+        });
+        self.transform(tt);
+    });
+    AST_Toplevel.DEFMETHOD("unwrap_expression", function() {
+        var self = this;
+        switch (self.body.length) {
+          case 0:
+            return make_node(AST_UnaryPrefix, self, {
+                operator: "void",
+                expression: make_node(AST_Number, self, { value: 0 }),
+            });
+          case 1:
+            var stat = self.body[0];
+            if (stat instanceof AST_Directive) return make_node(AST_String, stat);
+            if (stat instanceof AST_SimpleStatement) return stat.body;
+          default:
+            return make_node(AST_Call, self, {
+                expression: make_node(AST_Function, self, {
+                    argnames: [],
+                    body: self.body,
+                }).init_vars(self),
+                args: [],
+            });
+        }
+    });
+    AST_Node.DEFMETHOD("wrap_expression", function() {
+        var self = this;
+        if (!is_statement(self)) self = make_node(AST_SimpleStatement, self, { body: self });
+        if (!(self instanceof AST_Toplevel)) self = make_node(AST_Toplevel, self, { body: [ self ] });
+        return self;
+    });
+
+    function read_property(obj, node) {
+        var key = node.get_property();
+        if (key instanceof AST_Node) return;
+        var value;
+        if (obj instanceof AST_Array) {
+            var elements = obj.elements;
+            if (key == "length") return make_node_from_constant(elements.length, obj);
+            if (typeof key == "number" && key in elements) value = elements[key];
+        } else if (obj instanceof AST_Lambda) {
+            if (key == "length") {
+                obj.length_read = true;
+                return make_node_from_constant(obj.argnames.length, obj);
+            }
+        } else if (obj instanceof AST_Object) {
+            key = "" + key;
+            var props = obj.properties;
+            for (var i = props.length; --i >= 0;) {
+                var prop = props[i];
+                if (!can_hoist_property(prop)) return;
+                if (!value && props[i].key === key) value = props[i].value;
+            }
+        }
+        return value instanceof AST_SymbolRef && value.fixed_value() || value;
+    }
+
+    function is_read_only_fn(value, name) {
+        if (value instanceof AST_Boolean) return native_fns.Boolean[name];
+        if (value instanceof AST_Number) return native_fns.Number[name];
+        if (value instanceof AST_String) return native_fns.String[name];
+        if (name == "valueOf") return false;
+        if (value instanceof AST_Array) return native_fns.Array[name];
+        if (value instanceof AST_Lambda) return native_fns.Function[name];
+        if (value instanceof AST_Object) return native_fns.Object[name];
+        if (value instanceof AST_RegExp) return native_fns.RegExp[name] && !value.value.global;
+    }
+
+    function is_modified(compressor, tw, node, value, level, immutable, recursive) {
+        var parent = tw.parent(level);
+        if (compressor.option("unsafe") && parent instanceof AST_Dot && is_read_only_fn(value, parent.property)) {
+            return;
+        }
+        var lhs = is_lhs(node, parent);
+        if (lhs) return lhs;
+        if (level == 0 && value && value.is_constant()) return;
+        if (parent instanceof AST_Array) return is_modified(compressor, tw, parent, parent, level + 1);
+        if (parent instanceof AST_Assign) switch (parent.operator) {
+          case "=":
+            return is_modified(compressor, tw, parent, value, level + 1, immutable, recursive);
+          case "&&=":
+          case "||=":
+          case "??=":
+            return is_modified(compressor, tw, parent, parent, level + 1);
+          default:
+            return;
+        }
+        if (parent instanceof AST_Binary) {
+            if (!lazy_op[parent.operator]) return;
+            return is_modified(compressor, tw, parent, parent, level + 1);
+        }
+        if (parent instanceof AST_Call) {
+            return !immutable
+                && parent.expression === node
+                && !parent.is_expr_pure(compressor)
+                && (!(value instanceof AST_LambdaExpression) || !(parent instanceof AST_New) && value.contains_this());
+        }
+        if (parent instanceof AST_Conditional) {
+            if (parent.condition === node) return;
+            return is_modified(compressor, tw, parent, parent, level + 1);
+        }
+        if (parent instanceof AST_ForEnumeration) return parent.init === node;
+        if (parent instanceof AST_ObjectKeyVal) {
+            if (parent.value !== node) return;
+            var obj = tw.parent(level + 1);
+            return is_modified(compressor, tw, obj, obj, level + 2);
+        }
+        if (parent instanceof AST_PropAccess) {
+            if (parent.expression !== node) return;
+            var prop = read_property(value, parent);
+            return (!immutable || recursive) && is_modified(compressor, tw, parent, prop, level + 1);
+        }
+        if (parent instanceof AST_Sequence) {
+            if (parent.tail_node() !== node) return;
+            return is_modified(compressor, tw, parent, value, level + 1, immutable, recursive);
+        }
+    }
+
+    function is_lambda(node) {
+        return node instanceof AST_Class || node instanceof AST_Lambda;
+    }
+
+    function safe_for_extends(node) {
+        return node instanceof AST_Class || node instanceof AST_Defun || node instanceof AST_Function;
+    }
+
+    function is_arguments(def) {
+        return def.name == "arguments" && def.scope.uses_arguments;
+    }
+
+    function cross_scope(def, sym) {
+        do {
+            if (def === sym) return false;
+            if (sym instanceof AST_Scope) return true;
+        } while (sym = sym.parent_scope);
+    }
+
+    function can_drop_symbol(ref, compressor, keep_lambda) {
+        var def = ref.redef || ref.definition();
+        if (ref.in_arg && is_funarg(def)) return false;
+        return all(def.orig, function(sym) {
+            if (sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet) {
+                if (sym instanceof AST_SymbolImport) return true;
+                return compressor && can_varify(compressor, sym);
+            }
+            return !(keep_lambda && sym instanceof AST_SymbolLambda);
+        });
+    }
+
+    function has_escaped(d, scope, node, parent) {
+        if (parent instanceof AST_Assign) return parent.operator == "=" && parent.right === node;
+        if (parent instanceof AST_Call) return parent.expression !== node || parent instanceof AST_New;
+        if (parent instanceof AST_ClassField) return parent.value === node && !parent.static;
+        if (parent instanceof AST_Exit) return parent.value === node && scope.resolve() !== d.scope.resolve();
+        if (parent instanceof AST_VarDef) return parent.value === node;
+    }
+
+    function make_ref(ref, fixed) {
+        var node = make_node(AST_SymbolRef, ref);
+        node.fixed = fixed || make_node(AST_Undefined, ref);
         return node;
     }
-});
 
-(function(){
+    function replace_ref(resolve, fixed) {
+        return function(node) {
+            var ref = resolve(node);
+            var node = make_ref(ref, fixed);
+            var def = ref.definition();
+            def.references.push(node);
+            def.replaced++;
+            return node;
+        };
+    }
+
+    var RE_POSITIVE_INTEGER = /^(0|[1-9][0-9]*)$/;
+    (function(def) {
+        def(AST_Node, noop);
+
+        function reset_def(tw, compressor, def) {
+            def.assignments = 0;
+            def.bool_return = 0;
+            def.drop_return = 0;
+            def.cross_loop = false;
+            def.direct_access = false;
+            def.escaped = [];
+            def.fixed = !def.const_redefs
+                && !def.scope.pinned()
+                && !compressor.exposed(def)
+                && !(def.init instanceof AST_LambdaExpression && def.init !== def.scope)
+                && def.init;
+            def.reassigned = 0;
+            def.recursive_refs = 0;
+            def.references = [];
+            def.single_use = undefined;
+        }
+
+        function reset_block_variables(tw, compressor, scope) {
+            scope.variables.each(function(def) {
+                reset_def(tw, compressor, def);
+            });
+        }
 
-    function OPT(node, optimizer) {
-        node.DEFMETHOD("optimize", function(compressor){
-            var self = this;
-            if (self._optimized) return self;
-            var opt = optimizer(self, compressor);
-            opt._optimized = true;
-            if (opt === self) return opt;
-            return opt.transform(compressor);
+        function reset_variables(tw, compressor, scope) {
+            scope.fn_defs = [];
+            scope.variables.each(function(def) {
+                reset_def(tw, compressor, def);
+                var init = def.init;
+                if (init instanceof AST_LambdaDefinition) {
+                    scope.fn_defs.push(init);
+                    init.safe_ids = null;
+                }
+                if (def.fixed === null) {
+                    def.safe_ids = tw.safe_ids;
+                    mark(tw, def);
+                } else if (def.fixed) {
+                    tw.loop_ids[def.id] = tw.in_loop;
+                    mark(tw, def);
+                }
+            });
+            scope.may_call_this = function() {
+                scope.may_call_this = scope.contains_this() ? return_true : return_false;
+            };
+            if (scope.uses_arguments) scope.each_argname(function(node) {
+                node.definition().last_ref = false;
+            });
+            if (compressor.option("ie")) scope.variables.each(function(def) {
+                var d = def.orig[0].definition();
+                if (d !== def) d.fixed = false;
+            });
+        }
+
+        function safe_to_visit(tw, fn) {
+            var marker = fn.safe_ids;
+            return marker === undefined || marker === tw.safe_ids;
+        }
+
+        function walk_fn_def(tw, fn) {
+            var was_scanning = tw.fn_scanning;
+            tw.fn_scanning = fn;
+            fn.walk(tw);
+            tw.fn_scanning = was_scanning;
+        }
+
+        function revisit_fn_def(tw, fn) {
+            fn.enclosed.forEach(function(d) {
+                if (fn.variables.get(d.name) === d) return;
+                if (safe_to_read(tw, d)) return;
+                d.single_use = false;
+                var fixed = d.fixed;
+                if (typeof fixed == "function") fixed = fixed();
+                if (fixed instanceof AST_Lambda && fixed.safe_ids !== undefined) return;
+                d.fixed = false;
+            });
+        }
+
+        function mark_fn_def(tw, def, fn) {
+            var marker = fn.safe_ids;
+            if (marker === undefined) return;
+            if (marker === false) return;
+            if (fn.parent_scope.resolve().may_call_this === return_true) {
+                if (member(fn, tw.fn_visited)) revisit_fn_def(tw, fn);
+            } else if (marker) {
+                var visited = member(fn, tw.fn_visited);
+                if (marker === tw.safe_ids) {
+                    if (!visited) walk_fn_def(tw, fn);
+                } else if (visited) {
+                    revisit_fn_def(tw, fn);
+                } else {
+                    fn.safe_ids = false;
+                }
+            } else if (tw.fn_scanning && tw.fn_scanning !== def.scope.resolve()) {
+                fn.safe_ids = false;
+            } else {
+                fn.safe_ids = tw.safe_ids;
+                walk_fn_def(tw, fn);
+            }
+        }
+
+        function pop_scope(tw, scope) {
+            var fn_defs = scope.fn_defs;
+            var tangled = scope.may_call_this === return_true ? fn_defs : fn_defs.filter(function(fn) {
+                if (fn.safe_ids === false) return true;
+                fn.safe_ids = tw.safe_ids;
+                walk_fn_def(tw, fn);
+                return false;
+            });
+            pop(tw);
+            tangled.forEach(function(fn) {
+                fn.safe_ids = tw.safe_ids;
+                walk_fn_def(tw, fn);
+            });
+            fn_defs.forEach(function(fn) {
+                fn.safe_ids = undefined;
+            });
+            scope.fn_defs = undefined;
+            scope.may_call_this = undefined;
+        }
+
+        function push(tw, sequential) {
+            var safe_ids = Object.create(tw.safe_ids);
+            if (!sequential) safe_ids.seq = {};
+            tw.safe_ids = safe_ids;
+        }
+
+        function pop(tw) {
+            tw.safe_ids = Object.getPrototypeOf(tw.safe_ids);
+        }
+
+        function mark(tw, def) {
+            tw.safe_ids[def.id] = {};
+        }
+
+        function push_ref(def, ref) {
+            def.references.push(ref);
+            if (def.last_ref !== false) def.last_ref = ref;
+        }
+
+        function safe_to_read(tw, def) {
+            if (def.single_use == "m") return false;
+            var safe = tw.safe_ids[def.id];
+            if (safe) {
+                var in_order = HOP(tw.safe_ids, def.id);
+                if (!in_order) {
+                    var seq = tw.safe_ids.seq;
+                    if (!safe.read) {
+                        safe.read = seq;
+                    } else if (safe.read !== seq) {
+                        safe.read = true;
+                    }
+                }
+                if (def.fixed == null) {
+                    if (is_arguments(def)) return false;
+                    if (def.global && def.name == "arguments") return false;
+                    tw.loop_ids[def.id] = null;
+                    def.fixed = make_node(AST_Undefined, def.orig[0]);
+                    if (in_order) def.safe_ids = undefined;
+                    return true;
+                }
+                return !safe.assign || safe.assign === tw.safe_ids;
+            }
+            return def.fixed instanceof AST_LambdaDefinition;
+        }
+
+        function safe_to_assign(tw, def, declare) {
+            if (!declare) {
+                if (is_funarg(def) && def.scope.uses_arguments && !tw.has_directive("use strict")) return false;
+                if (!all(def.orig, function(sym) {
+                    return !(sym instanceof AST_SymbolConst);
+                })) return false;
+            }
+            if (def.fixed === undefined) return declare || all(def.orig, function(sym) {
+                return !(sym instanceof AST_SymbolLet);
+            });
+            if (def.fixed === false || def.fixed === 0) return false;
+            var safe = tw.safe_ids[def.id];
+            if (def.safe_ids) {
+                def.safe_ids[def.id] = false;
+                def.safe_ids = undefined;
+                return def.fixed === null || HOP(tw.safe_ids, def.id) && !safe.read;
+            }
+            if (!HOP(tw.safe_ids, def.id)) {
+                if (!safe) return false;
+                if (safe.read || tw.in_loop) {
+                    var scope = tw.find_parent(AST_BlockScope);
+                    if (scope instanceof AST_Class) return false;
+                    if (def.scope.resolve() !== scope.resolve()) return false;
+                }
+                safe.assign = safe.assign && safe.assign !== tw.safe_ids ? true : tw.safe_ids;
+            }
+            if (def.fixed != null && safe.read) {
+                if (safe.read !== tw.safe_ids.seq) return false;
+                if (tw.loop_ids[def.id] !== tw.in_loop) return false;
+            }
+            return safe_to_read(tw, def) && all(def.orig, function(sym) {
+                return !(sym instanceof AST_SymbolLambda);
+            });
+        }
+
+        function ref_once(compressor, def) {
+            return compressor.option("unused")
+                && !def.scope.pinned()
+                && def.single_use !== false
+                && def.references.length - def.recursive_refs == 1
+                && !(is_funarg(def) && def.scope.uses_arguments);
+        }
+
+        function is_immutable(value) {
+            if (!value) return false;
+            if (value instanceof AST_Assign) {
+                var op = value.operator;
+                return op == "=" ? is_immutable(value.right) : !lazy_op[op.slice(0, -1)];
+            }
+            if (value instanceof AST_Sequence) return is_immutable(value.tail_node());
+            return value.is_constant() || is_lambda(value) || value instanceof AST_ObjectIdentity;
+        }
+
+        function value_in_use(node, parent) {
+            if (parent instanceof AST_Array) return true;
+            if (parent instanceof AST_Binary) return lazy_op[parent.operator];
+            if (parent instanceof AST_Conditional) return parent.condition !== node;
+            if (parent instanceof AST_Sequence) return parent.tail_node() === node;
+            if (parent instanceof AST_Spread) return true;
+        }
+
+        function mark_escaped(tw, d, scope, node, value, level, depth) {
+            var parent = tw.parent(level);
+            if (value && value.is_constant()) return;
+            if (has_escaped(d, scope, node, parent)) {
+                d.escaped.push(parent);
+                if (depth > 1 && !(value && value.is_constant_expression(scope))) depth = 1;
+                if (!d.escaped.depth || d.escaped.depth > depth) d.escaped.depth = depth;
+                if (d.scope.resolve() !== scope.resolve()) d.escaped.cross_scope = true;
+                if (d.fixed) d.fixed.escaped = d.escaped;
+                return;
+            } else if (value_in_use(node, parent)) {
+                mark_escaped(tw, d, scope, parent, parent, level + 1, depth);
+            } else if (parent instanceof AST_ObjectKeyVal && parent.value === node) {
+                var obj = tw.parent(level + 1);
+                mark_escaped(tw, d, scope, obj, obj, level + 2, depth);
+            } else if (parent instanceof AST_PropAccess && parent.expression === node) {
+                value = read_property(value, parent);
+                mark_escaped(tw, d, scope, parent, value, level + 1, depth + 1);
+                if (value) return;
+            }
+            if (level > 0) return;
+            if (parent instanceof AST_Call && parent.expression === node) return;
+            if (parent instanceof AST_Sequence && parent.tail_node() !== node) return;
+            if (parent instanceof AST_SimpleStatement) return;
+            if (parent instanceof AST_Unary && !unary_side_effects[parent.operator]) return;
+            d.direct_access = true;
+            if (d.fixed) d.fixed.direct_access = true;
+        }
+
+        function mark_assignment_to_arguments(node) {
+            if (!(node instanceof AST_Sub)) return;
+            var expr = node.expression;
+            if (!(expr instanceof AST_SymbolRef)) return;
+            var def = expr.definition();
+            if (!is_arguments(def)) return;
+            var key = node.property;
+            if (key.is_constant()) key = key.value;
+            if (!(key instanceof AST_Node) && !RE_POSITIVE_INTEGER.test(key)) return;
+            def.reassigned++;
+            (key instanceof AST_Node ? def.scope.argnames : [ def.scope.argnames[key] ]).forEach(function(argname) {
+                if (argname instanceof AST_SymbolFunarg) argname.definition().fixed = false;
+            });
+        }
+
+        function make_fixed(save, fn) {
+            var prev_save, prev_value;
+            return function() {
+                var current = save();
+                if (prev_save !== current) {
+                    prev_save = current;
+                    prev_value = fn(current);
+                }
+                return prev_value;
+            };
+        }
+
+        function make_fixed_default(compressor, node, save) {
+            var prev_save, prev_seq;
+            return function() {
+                if (prev_seq === node) return node;
+                var current = save();
+                var ev = fuzzy_eval(compressor, current, true);
+                if (ev instanceof AST_Node) {
+                    prev_seq = node;
+                } else if (prev_save !== current) {
+                    prev_save = current;
+                    prev_seq = ev === undefined ? make_sequence(node, [ current, node.value ]) : current;
+                }
+                return prev_seq;
+            };
+        }
+
+        function scan_declaration(tw, compressor, lhs, fixed, visit) {
+            var scanner = new TreeWalker(function(node) {
+                if (node instanceof AST_DefaultValue) {
+                    reset_flags(node);
+                    push(tw, true);
+                    node.value.walk(tw);
+                    pop(tw);
+                    var save = fixed;
+                    if (save) fixed = make_fixed_default(compressor, node, save);
+                    node.name.walk(scanner);
+                    fixed = save;
+                    return true;
+                }
+                if (node instanceof AST_DestructuredArray) {
+                    reset_flags(node);
+                    var save = fixed;
+                    node.elements.forEach(function(node, index) {
+                        if (node instanceof AST_Hole) return reset_flags(node);
+                        if (save) fixed = make_fixed(save, function(value) {
+                            return make_node(AST_Sub, node, {
+                                expression: value,
+                                property: make_node(AST_Number, node, { value: index }),
+                            });
+                        });
+                        node.walk(scanner);
+                    });
+                    if (node.rest) {
+                        var fixed_node;
+                        if (save) fixed = compressor.option("rests") && make_fixed(save, function(value) {
+                            if (!(value instanceof AST_Array)) return node;
+                            for (var i = 0, len = node.elements.length; i < len; i++) {
+                                if (value.elements[i] instanceof AST_Spread) return node;
+                            }
+                            if (!fixed_node) fixed_node = make_node(AST_Array, node, {});
+                            fixed_node.elements = value.elements.slice(len);
+                            return fixed_node;
+                        });
+                        node.rest.walk(scanner);
+                    }
+                    fixed = save;
+                    return true;
+                }
+                if (node instanceof AST_DestructuredObject) {
+                    reset_flags(node);
+                    var save = fixed;
+                    node.properties.forEach(function(node) {
+                        reset_flags(node);
+                        if (node.key instanceof AST_Node) {
+                            push(tw);
+                            node.key.walk(tw);
+                            pop(tw);
+                        }
+                        if (save) fixed = make_fixed(save, function(value) {
+                            var key = node.key;
+                            var type = AST_Sub;
+                            if (typeof key == "string") {
+                                if (is_identifier_string(key)) {
+                                    type = AST_Dot;
+                                } else {
+                                    key = make_node_from_constant(key, node);
+                                }
+                            }
+                            return make_node(type, node, {
+                                expression: value,
+                                property: key,
+                            });
+                        });
+                        node.value.walk(scanner);
+                    });
+                    if (node.rest) {
+                        fixed = false;
+                        node.rest.walk(scanner);
+                    }
+                    fixed = save;
+                    return true;
+                }
+                visit(node, fixed, function() {
+                    var save_len = tw.stack.length;
+                    for (var i = 0, len = scanner.stack.length - 1; i < len; i++) {
+                        tw.stack.push(scanner.stack[i]);
+                    }
+                    node.walk(tw);
+                    tw.stack.length = save_len;
+                });
+                return true;
+            });
+            lhs.walk(scanner);
+        }
+
+        function reduce_iife(tw, descend, compressor) {
+            var fn = this;
+            fn.inlined = false;
+            var iife = tw.parent();
+            var sequential = !is_async(fn) && !is_generator(fn);
+            var hit = !sequential;
+            var aborts = false;
+            fn.walk(new TreeWalker(function(node) {
+                if (hit) return aborts = true;
+                if (node instanceof AST_Return) return hit = true;
+                if (node instanceof AST_Scope && node !== fn) return true;
+            }));
+            if (aborts) push(tw, sequential);
+            reset_variables(tw, compressor, fn);
+            // Virtually turn IIFE parameters into variable definitions:
+            //   (function(a,b) {...})(c,d) ---> (function() {var a=c,b=d; ...})()
+            // So existing transformation rules can work on them.
+            var safe = !fn.uses_arguments || tw.has_directive("use strict");
+            fn.argnames.forEach(function(argname, i) {
+                var value = iife.args[i];
+                scan_declaration(tw, compressor, argname, function() {
+                    var j = fn.argnames.indexOf(argname);
+                    var arg = j < 0 ? value : iife.args[j];
+                    if (arg instanceof AST_Sequence && arg.expressions.length < 2) arg = arg.expressions[0];
+                    return arg || make_node(AST_Undefined, iife);
+                }, visit);
+            });
+            var rest = fn.rest, fixed_node;
+            if (rest) scan_declaration(tw, compressor, rest, compressor.option("rests") && function() {
+                if (fn.rest !== rest) return rest;
+                if (!fixed_node) fixed_node = make_node(AST_Array, fn, {});
+                fixed_node.elements = iife.args.slice(fn.argnames.length);
+                return fixed_node;
+            }, visit);
+            walk_lambda(fn, tw);
+            var safe_ids = tw.safe_ids;
+            pop_scope(tw, fn);
+            if (!aborts) tw.safe_ids = safe_ids;
+            return true;
+
+            function visit(node, fixed) {
+                var d = node.definition();
+                if (fixed && safe && d.fixed === undefined) {
+                    mark(tw, d);
+                    tw.loop_ids[d.id] = tw.in_loop;
+                    d.fixed = fixed;
+                    d.fixed.assigns = [ node ];
+                } else {
+                    d.fixed = false;
+                }
+            }
+        }
+
+        def(AST_Assign, function(tw, descend, compressor) {
+            var node = this;
+            var left = node.left;
+            var right = node.right;
+            var ld = left instanceof AST_SymbolRef && left.definition();
+            var scan = ld || left instanceof AST_Destructured;
+            switch (node.operator) {
+              case "=":
+                if (left.equals(right) && !left.has_side_effects(compressor)) {
+                    right.walk(tw);
+                    walk_prop(left);
+                    node.redundant = true;
+                    return true;
+                }
+                if (ld && right instanceof AST_LambdaExpression) {
+                    walk_assign();
+                    right.parent_scope.resolve().fn_defs.push(right);
+                    right.safe_ids = null;
+                    if (!ld.fixed || !node.write_only) mark_fn_def(tw, ld, right);
+                    return true;
+                }
+                if (scan) {
+                    right.walk(tw);
+                    walk_assign();
+                    return true;
+                }
+                mark_assignment_to_arguments(left);
+                return;
+              case "&&=":
+              case "||=":
+              case "??=":
+                var lazy = true;
+              default:
+                if (!scan) {
+                    mark_assignment_to_arguments(left);
+                    return walk_lazy();
+                }
+                ld.assignments++;
+                var fixed = ld.fixed;
+                if (is_modified(compressor, tw, node, node, 0)) {
+                    ld.fixed = false;
+                    return walk_lazy();
+                }
+                var safe = safe_to_read(tw, ld);
+                if (lazy) push(tw, true);
+                right.walk(tw);
+                if (lazy) pop(tw);
+                if (safe && !left.in_arg && safe_to_assign(tw, ld)) {
+                    push_ref(ld, left);
+                    mark(tw, ld);
+                    if (ld.single_use) ld.single_use = false;
+                    left.fixed = ld.fixed = function() {
+                        return make_node(AST_Binary, node, {
+                            operator: node.operator.slice(0, -1),
+                            left: make_ref(left, fixed),
+                            right: node.right,
+                        });
+                    };
+                    left.fixed.assigns = !fixed || !fixed.assigns ? [ ld.orig[0] ] : fixed.assigns.slice();
+                    left.fixed.assigns.push(node);
+                    left.fixed.to_binary = replace_ref(function(node) {
+                        return node.left;
+                    }, fixed);
+                } else {
+                    left.walk(tw);
+                    ld.fixed = false;
+                }
+                return true;
+            }
+
+            function walk_prop(lhs) {
+                reset_flags(lhs);
+                if (lhs instanceof AST_Dot) {
+                    walk_prop(lhs.expression);
+                } else if (lhs instanceof AST_Sub) {
+                    walk_prop(lhs.expression);
+                    lhs.property.walk(tw);
+                } else if (lhs instanceof AST_SymbolRef) {
+                    var d = lhs.definition();
+                    push_ref(d, lhs);
+                    if (d.fixed) {
+                        lhs.fixed = d.fixed;
+                        if (lhs.fixed.assigns) {
+                            lhs.fixed.assigns.push(node);
+                        } else {
+                            lhs.fixed.assigns = [ node ];
+                        }
+                    }
+                } else {
+                    lhs.walk(tw);
+                }
+            }
+
+            function walk_assign() {
+                var recursive = ld && recursive_ref(tw, ld);
+                var modified = is_modified(compressor, tw, node, right, 0, is_immutable(right), recursive);
+                scan_declaration(tw, compressor, left, function() {
+                    return node.right;
+                }, function(sym, fixed, walk) {
+                    if (!(sym instanceof AST_SymbolRef)) {
+                        mark_assignment_to_arguments(sym);
+                        walk();
+                        return;
+                    }
+                    var d = sym.definition();
+                    d.assignments++;
+                    if (!fixed || sym.in_arg || !safe_to_assign(tw, d)) {
+                        walk();
+                        d.fixed = false;
+                    } else {
+                        push_ref(d, sym);
+                        mark(tw, d);
+                        if (left instanceof AST_Destructured
+                            || d.orig.length == 1 && d.orig[0] instanceof AST_SymbolDefun) {
+                            d.single_use = false;
+                        }
+                        tw.loop_ids[d.id] = tw.in_loop;
+                        d.fixed = modified ? 0 : fixed;
+                        sym.fixed = fixed;
+                        sym.fixed.assigns = [ node ];
+                        mark_escaped(tw, d, sym.scope, node, right, 0, 1);
+                    }
+                });
+            }
+
+            function walk_lazy() {
+                if (!lazy) return;
+                left.walk(tw);
+                push(tw, true);
+                right.walk(tw);
+                pop(tw);
+                return true;
+            }
         });
-    };
+        def(AST_Binary, function(tw) {
+            if (!lazy_op[this.operator]) return;
+            this.left.walk(tw);
+            push(tw, true);
+            this.right.walk(tw);
+            pop(tw);
+            return true;
+        });
+        def(AST_BlockScope, function(tw, descend, compressor) {
+            reset_block_variables(tw, compressor, this);
+        });
+        def(AST_Call, function(tw, descend) {
+            var node = this;
+            var exp = node.expression;
+            if (exp instanceof AST_LambdaExpression) {
+                var iife = is_iife_single(node);
+                node.args.forEach(function(arg) {
+                    arg.walk(tw);
+                    if (arg instanceof AST_Spread) iife = false;
+                });
+                if (iife) exp.reduce_vars = reduce_iife;
+                exp.walk(tw);
+                if (iife) delete exp.reduce_vars;
+                return true;
+            }
+            if (node.TYPE == "Call") switch (tw.in_boolean_context()) {
+              case "d":
+                var drop = true;
+              case true:
+                mark_refs(exp, drop);
+            }
+            exp.walk(tw);
+            var optional = node.optional;
+            if (optional) push(tw, true);
+            node.args.forEach(function(arg) {
+                arg.walk(tw);
+            });
+            if (optional) pop(tw);
+            var fixed = exp instanceof AST_SymbolRef && exp.fixed_value();
+            if (fixed instanceof AST_Lambda) {
+                mark_fn_def(tw, exp.definition(), fixed);
+            } else {
+                tw.find_parent(AST_Scope).may_call_this();
+            }
+            return true;
 
-    OPT(AST_Node, function(self, compressor){
-        return self;
-    });
+            function mark_refs(node, drop) {
+                if (node instanceof AST_Assign) {
+                    if (node.operator != "=") return;
+                    mark_refs(node.left, drop);
+                    mark_refs(node.right, drop);
+                } else if (node instanceof AST_Binary) {
+                    if (!lazy_op[node.operator]) return;
+                    mark_refs(node.left, drop);
+                    mark_refs(node.right, drop);
+                } else if (node instanceof AST_Conditional) {
+                    mark_refs(node.consequent, drop);
+                    mark_refs(node.alternative, drop);
+                } else if (node instanceof AST_SymbolRef) {
+                    var def = node.definition();
+                    def.bool_return++;
+                    if (drop) def.drop_return++;
+                }
+            }
+        });
+        def(AST_Class, function(tw, descend, compressor) {
+            var node = this;
+            reset_block_variables(tw, compressor, node);
+            if (node.extends) node.extends.walk(tw);
+            var props = node.properties.filter(function(prop) {
+                reset_flags(prop);
+                if (prop.key instanceof AST_Node) {
+                    tw.push(prop);
+                    prop.key.walk(tw);
+                    tw.pop();
+                }
+                return prop.value;
+            });
+            if (node.name) {
+                var d = node.name.definition();
+                var parent = tw.parent();
+                if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) d.single_use = false;
+                if (safe_to_assign(tw, d, true)) {
+                    mark(tw, d);
+                    tw.loop_ids[d.id] = tw.in_loop;
+                    d.fixed = function() {
+                        return node;
+                    };
+                    d.fixed.assigns = [ node ];
+                    if (!is_safe_lexical(d)) d.single_use = false;
+                } else {
+                    d.fixed = false;
+                }
+            }
+            props.forEach(function(prop) {
+                tw.push(prop);
+                if (!prop.static || is_static_field_or_init(prop) && prop.value.contains_this()) {
+                    push(tw);
+                    prop.value.walk(tw);
+                    pop(tw);
+                } else {
+                    prop.value.walk(tw);
+                }
+                tw.pop();
+            });
+            return true;
+        });
+        def(AST_ClassInitBlock, function(tw, descend, compressor) {
+            var node = this;
+            push(tw, true);
+            reset_variables(tw, compressor, node);
+            descend();
+            pop_scope(tw, node);
+            return true;
+        });
+        def(AST_Conditional, function(tw) {
+            this.condition.walk(tw);
+            push(tw, true);
+            this.consequent.walk(tw);
+            pop(tw);
+            push(tw, true);
+            this.alternative.walk(tw);
+            pop(tw);
+            return true;
+        });
+        def(AST_DefaultValue, function(tw) {
+            push(tw, true);
+            this.value.walk(tw);
+            pop(tw);
+            this.name.walk(tw);
+            return true;
+        });
+        def(AST_Do, function(tw) {
+            var save_loop = tw.in_loop;
+            tw.in_loop = this;
+            push(tw);
+            this.body.walk(tw);
+            if (has_loop_control(this, tw.parent())) {
+                pop(tw);
+                push(tw);
+            }
+            this.condition.walk(tw);
+            pop(tw);
+            tw.in_loop = save_loop;
+            return true;
+        });
+        def(AST_For, function(tw, descend, compressor) {
+            var node = this;
+            reset_block_variables(tw, compressor, node);
+            if (node.init) node.init.walk(tw);
+            var save_loop = tw.in_loop;
+            tw.in_loop = node;
+            push(tw);
+            if (node.condition) node.condition.walk(tw);
+            node.body.walk(tw);
+            if (node.step) {
+                if (has_loop_control(node, tw.parent())) {
+                    pop(tw);
+                    push(tw);
+                }
+                node.step.walk(tw);
+            }
+            pop(tw);
+            tw.in_loop = save_loop;
+            return true;
+        });
+        def(AST_ForEnumeration, function(tw, descend, compressor) {
+            var node = this;
+            reset_block_variables(tw, compressor, node);
+            node.object.walk(tw);
+            var save_loop = tw.in_loop;
+            tw.in_loop = node;
+            push(tw);
+            var init = node.init;
+            if (init instanceof AST_Definitions) {
+                init.definitions[0].name.mark_symbol(function(node) {
+                    if (node instanceof AST_SymbolDeclaration) {
+                        var def = node.definition();
+                        def.assignments++;
+                        def.fixed = false;
+                    }
+                }, tw);
+            } else if (init instanceof AST_Destructured || init instanceof AST_SymbolRef) {
+                init.mark_symbol(function(node) {
+                    if (node instanceof AST_SymbolRef) {
+                        var def = node.definition();
+                        push_ref(def, node);
+                        def.assignments++;
+                        if (!node.is_immutable()) def.fixed = false;
+                    }
+                }, tw);
+            } else {
+                init.walk(tw);
+            }
+            node.body.walk(tw);
+            pop(tw);
+            tw.in_loop = save_loop;
+            return true;
+        });
+        def(AST_If, function(tw) {
+            this.condition.walk(tw);
+            push(tw, true);
+            this.body.walk(tw);
+            pop(tw);
+            if (this.alternative) {
+                push(tw, true);
+                this.alternative.walk(tw);
+                pop(tw);
+            }
+            return true;
+        });
+        def(AST_LabeledStatement, function(tw) {
+            push(tw, true);
+            this.body.walk(tw);
+            pop(tw);
+            return true;
+        });
+        def(AST_Lambda, function(tw, descend, compressor) {
+            var fn = this;
+            if (!safe_to_visit(tw, fn)) return true;
+            if (!push_uniq(tw.fn_visited, fn)) return true;
+            fn.inlined = false;
+            push(tw);
+            reset_variables(tw, compressor, fn);
+            descend();
+            pop_scope(tw, fn);
+            if (fn.name) mark_escaped(tw, fn.name.definition(), fn, fn.name, fn, 0, 1);
+            return true;
+        });
+        def(AST_LambdaDefinition, function(tw, descend, compressor) {
+            var fn = this;
+            var def = fn.name.definition();
+            var parent = tw.parent();
+            if (parent instanceof AST_ExportDeclaration || parent instanceof AST_ExportDefault) def.single_use = false;
+            if (!safe_to_visit(tw, fn)) return true;
+            if (!push_uniq(tw.fn_visited, fn)) return true;
+            fn.inlined = false;
+            push(tw);
+            reset_variables(tw, compressor, fn);
+            descend();
+            pop_scope(tw, fn);
+            return true;
+        });
+        def(AST_Sub, function(tw) {
+            if (!this.optional) return;
+            this.expression.walk(tw);
+            push(tw, true);
+            this.property.walk(tw);
+            pop(tw);
+            return true;
+        });
+        def(AST_Switch, function(tw, descend, compressor) {
+            var node = this;
+            reset_block_variables(tw, compressor, node);
+            node.expression.walk(tw);
+            var first = true;
+            node.body.forEach(function(branch) {
+                if (branch instanceof AST_Default) return;
+                branch.expression.walk(tw);
+                if (first) {
+                    first = false;
+                    push(tw, true);
+                }
+            })
+            if (!first) pop(tw);
+            walk_body(node, tw);
+            return true;
+        });
+        def(AST_SwitchBranch, function(tw) {
+            push(tw, true);
+            walk_body(this, tw);
+            pop(tw);
+            return true;
+        });
+        def(AST_SymbolCatch, function() {
+            this.definition().fixed = false;
+        });
+        def(AST_SymbolImport, function() {
+            this.definition().fixed = false;
+        });
+        def(AST_SymbolRef, function(tw, descend, compressor) {
+            var ref = this;
+            var d = ref.definition();
+            var fixed = d.fixed || d.last_ref && d.last_ref.fixed;
+            push_ref(d, ref);
+            if (d.references.length == 1 && !d.fixed && d.orig[0] instanceof AST_SymbolDefun) {
+                tw.loop_ids[d.id] = tw.in_loop;
+            }
+            var recursive = recursive_ref(tw, d);
+            if (recursive) recursive.enclosed.forEach(function(def) {
+                if (d === def) return;
+                if (def.scope.resolve() === recursive) return;
+                var assigns = def.fixed && def.fixed.assigns;
+                if (!assigns) return;
+                if (assigns[assigns.length - 1] instanceof AST_VarDef) return;
+                var safe = tw.safe_ids[def.id];
+                if (!safe) return;
+                safe.assign = true;
+            });
+            if (d.single_use == "m" && d.fixed) {
+                d.fixed = 0;
+                d.single_use = false;
+            }
+            switch (d.fixed) {
+              case 0:
+                if (!safe_to_read(tw, d)) d.fixed = false;
+              case false:
+                var redef = d.redefined();
+                if (redef && cross_scope(d.scope, ref.scope)) redef.single_use = false;
+                break;
+              case undefined:
+                d.fixed = false;
+                break;
+              default:
+                if (!safe_to_read(tw, d)) {
+                    d.fixed = false;
+                    break;
+                }
+                if (ref.in_arg && d.orig[0] instanceof AST_SymbolLambda) ref.fixed = d.scope;
+                var value = ref.fixed_value();
+                if (recursive) {
+                    d.recursive_refs++;
+                } else if (value && ref_once(compressor, d)) {
+                    d.in_loop = tw.loop_ids[d.id] !== tw.in_loop;
+                    d.single_use = is_lambda(value)
+                            && !value.pinned()
+                            && (!d.in_loop || tw.parent() instanceof AST_Call)
+                        || !d.in_loop
+                            && d.scope === ref.scope.resolve()
+                            && value.is_constant_expression();
+                } else {
+                    d.single_use = false;
+                }
+                if (is_modified(compressor, tw, ref, value, 0, is_immutable(value), recursive)) {
+                    if (d.single_use) {
+                        d.single_use = "m";
+                    } else {
+                        d.fixed = 0;
+                    }
+                }
+                if (d.fixed && tw.loop_ids[d.id] !== tw.in_loop) d.cross_loop = true;
+                mark_escaped(tw, d, ref.scope, ref, value, 0, 1);
+                break;
+            }
+            if (!ref.fixed) ref.fixed = d.fixed === 0 ? fixed : d.fixed;
+            var parent;
+            if (value instanceof AST_Lambda
+                && !((parent = tw.parent()) instanceof AST_Call && parent.expression === ref)) {
+                mark_fn_def(tw, d, value);
+            }
+        });
+        def(AST_Template, function(tw, descend) {
+            var node = this;
+            var tag = node.tag;
+            if (!tag) return;
+            if (tag instanceof AST_LambdaExpression) {
+                node.expressions.forEach(function(exp) {
+                    exp.walk(tw);
+                });
+                tag.walk(tw);
+                return true;
+            }
+            tag.walk(tw);
+            node.expressions.forEach(function(exp) {
+                exp.walk(tw);
+            });
+            var fixed = tag instanceof AST_SymbolRef && tag.fixed_value();
+            if (fixed instanceof AST_Lambda) {
+                mark_fn_def(tw, tag.definition(), fixed);
+            } else {
+                tw.find_parent(AST_Scope).may_call_this();
+            }
+            return true;
+        });
+        def(AST_Toplevel, function(tw, descend, compressor) {
+            var node = this;
+            node.globals.each(function(def) {
+                reset_def(tw, compressor, def);
+            });
+            push(tw, true);
+            reset_variables(tw, compressor, node);
+            descend();
+            pop_scope(tw, node);
+            return true;
+        });
+        def(AST_Try, function(tw, descend, compressor) {
+            var node = this;
+            reset_block_variables(tw, compressor, node);
+            push(tw, true);
+            walk_body(node, tw);
+            pop(tw);
+            if (node.bcatch) {
+                push(tw, true);
+                node.bcatch.walk(tw);
+                pop(tw);
+            }
+            if (node.bfinally) node.bfinally.walk(tw);
+            return true;
+        });
+        def(AST_Unary, function(tw, descend) {
+            var node = this;
+            if (!UNARY_POSTFIX[node.operator]) return;
+            var exp = node.expression;
+            if (!(exp instanceof AST_SymbolRef)) {
+                mark_assignment_to_arguments(exp);
+                return;
+            }
+            var d = exp.definition();
+            d.assignments++;
+            var fixed = d.fixed;
+            if (safe_to_read(tw, d) && !exp.in_arg && safe_to_assign(tw, d)) {
+                push_ref(d, exp);
+                mark(tw, d);
+                if (d.single_use) d.single_use = false;
+                d.fixed = function() {
+                    return make_node(AST_Binary, node, {
+                        operator: node.operator.slice(0, -1),
+                        left: make_node(AST_UnaryPrefix, node, {
+                            operator: "+",
+                            expression: make_ref(exp, fixed),
+                        }),
+                        right: make_node(AST_Number, node, { value: 1 }),
+                    });
+                };
+                d.fixed.assigns = fixed && fixed.assigns ? fixed.assigns.slice() : [];
+                d.fixed.assigns.push(node);
+                if (node instanceof AST_UnaryPrefix) {
+                    exp.fixed = d.fixed;
+                } else {
+                    exp.fixed = function() {
+                        return make_node(AST_UnaryPrefix, node, {
+                            operator: "+",
+                            expression: make_ref(exp, fixed),
+                        });
+                    };
+                    exp.fixed.assigns = fixed && fixed.assigns;
+                    exp.fixed.to_prefix = replace_ref(function(node) {
+                        return node.expression;
+                    }, d.fixed);
+                }
+            } else {
+                exp.walk(tw);
+                d.fixed = false;
+            }
+            return true;
+        });
+        def(AST_VarDef, function(tw, descend, compressor) {
+            var node = this;
+            var value = node.value;
+            if (value instanceof AST_LambdaExpression && node.name instanceof AST_SymbolDeclaration) {
+                walk_defn();
+                value.parent_scope.resolve().fn_defs.push(value);
+                value.safe_ids = null;
+                var ld = node.name.definition();
+                if (!ld.fixed) mark_fn_def(tw, ld, value);
+            } else if (value) {
+                value.walk(tw);
+                walk_defn();
+            } else if (tw.parent() instanceof AST_Let) {
+                walk_defn();
+            }
+            return true;
+
+            function walk_defn() {
+                scan_declaration(tw, compressor, node.name, function() {
+                    return node.value || make_node(AST_Undefined, node);
+                }, function(name, fixed) {
+                    var d = name.definition();
+                    if (fixed && safe_to_assign(tw, d, true)) {
+                        mark(tw, d);
+                        tw.loop_ids[d.id] = tw.in_loop;
+                        d.fixed = fixed;
+                        d.fixed.assigns = [ node ];
+                        if (name instanceof AST_SymbolConst && d.redefined()
+                            || !(can_drop_symbol(name) || is_safe_lexical(d))) {
+                            d.single_use = false;
+                        }
+                    } else {
+                        d.fixed = false;
+                    }
+                });
+            }
+        });
+        def(AST_While, function(tw, descend) {
+            var save_loop = tw.in_loop;
+            tw.in_loop = this;
+            push(tw);
+            descend();
+            pop(tw);
+            tw.in_loop = save_loop;
+            return true;
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("reduce_vars", func);
+    });
+
+    function reset_flags(node) {
+        node._squeezed = false;
+        node._optimized = false;
+        if (node instanceof AST_BlockScope) node._var_names = undefined;
+        if (node instanceof AST_SymbolRef) node.fixed = undefined;
+    }
+
+    AST_Toplevel.DEFMETHOD("reset_opt_flags", function(compressor) {
+        var tw = new TreeWalker(compressor.option("reduce_vars") ? function(node, descend) {
+            reset_flags(node);
+            return node.reduce_vars(tw, descend, compressor);
+        } : reset_flags);
+        // Flow control for visiting lambda definitions
+        tw.fn_scanning = null;
+        tw.fn_visited = [];
+        // Record the loop body in which `AST_SymbolDeclaration` is first encountered
+        tw.in_loop = null;
+        tw.loop_ids = Object.create(null);
+        // Stack of look-up tables to keep track of whether a `SymbolDef` has been
+        // properly assigned before use:
+        // - `push()` & `pop()` when visiting conditional branches
+        // - backup & restore via `save_ids` when visiting out-of-order sections
+        tw.safe_ids = Object.create(null);
+        tw.safe_ids.seq = {};
+        this.walk(tw);
+    });
+
+    AST_Symbol.DEFMETHOD("fixed_value", function(ref_only) {
+        var def = this.definition();
+        var fixed = def.fixed;
+        if (fixed) {
+            if (this.fixed) fixed = this.fixed;
+            return (fixed instanceof AST_Node ? fixed : fixed()).tail_node();
+        }
+        fixed = fixed === 0 && this.fixed;
+        if (!fixed) return fixed;
+        var value = (fixed instanceof AST_Node ? fixed : fixed()).tail_node();
+        if (ref_only && def.escaped.depth != 1 && is_object(value, true)) return value;
+        if (value.is_constant()) return value;
+    });
+
+    AST_SymbolRef.DEFMETHOD("is_immutable", function() {
+        var def = this.redef || this.definition();
+        if (!(def.orig[0] instanceof AST_SymbolLambda)) return false;
+        if (def.orig.length == 1) return true;
+        if (!this.in_arg) return false;
+        return !(def.orig[1] instanceof AST_SymbolFunarg);
+    });
+
+    AST_Node.DEFMETHOD("convert_symbol", noop);
+    function convert_destructured(type, process) {
+        return this.transform(new TreeTransformer(function(node, descend) {
+            if (node instanceof AST_DefaultValue) {
+                node = node.clone();
+                node.name = node.name.transform(this);
+                return node;
+            }
+            if (node instanceof AST_Destructured) {
+                node = node.clone();
+                descend(node, this);
+                return node;
+            }
+            if (node instanceof AST_DestructuredKeyVal) {
+                node = node.clone();
+                node.value = node.value.transform(this);
+                return node;
+            }
+            return node.convert_symbol(type, process);
+        }));
+    }
+    AST_DefaultValue.DEFMETHOD("convert_symbol", convert_destructured);
+    AST_Destructured.DEFMETHOD("convert_symbol", convert_destructured);
+    function convert_symbol(type, process) {
+        var node = make_node(type, this);
+        return process(node, this) || node;
+    }
+    AST_SymbolDeclaration.DEFMETHOD("convert_symbol", convert_symbol);
+    AST_SymbolRef.DEFMETHOD("convert_symbol", convert_symbol);
+
+    function process_to_assign(ref) {
+        var def = ref.definition();
+        def.assignments++;
+        def.references.push(ref);
+    }
+
+    function mark_destructured(process, tw) {
+        var marker = new TreeWalker(function(node) {
+            if (node instanceof AST_DefaultValue) {
+                node.value.walk(tw);
+                node.name.walk(marker);
+                return true;
+            }
+            if (node instanceof AST_DestructuredKeyVal) {
+                if (node.key instanceof AST_Node) node.key.walk(tw);
+                node.value.walk(marker);
+                return true;
+            }
+            return process(node);
+        });
+        this.walk(marker);
+    }
+    AST_DefaultValue.DEFMETHOD("mark_symbol", mark_destructured);
+    AST_Destructured.DEFMETHOD("mark_symbol", mark_destructured);
+    function mark_symbol(process) {
+        return process(this);
+    }
+    AST_SymbolDeclaration.DEFMETHOD("mark_symbol", mark_symbol);
+    AST_SymbolRef.DEFMETHOD("mark_symbol", mark_symbol);
 
-    AST_Node.DEFMETHOD("equivalent_to", function(node){
-        // XXX: this is a rather expensive way to test two node's equivalence:
-        return this.print_to_string() == node.print_to_string();
+    AST_Node.DEFMETHOD("match_symbol", function(predicate) {
+        return predicate(this);
     });
+    function match_destructured(predicate, ignore_side_effects) {
+        var found = false;
+        var tw = new TreeWalker(function(node) {
+            if (found) return true;
+            if (node instanceof AST_DefaultValue) {
+                if (!ignore_side_effects) return found = true;
+                node.name.walk(tw);
+                return true;
+            }
+            if (node instanceof AST_DestructuredKeyVal) {
+                if (!ignore_side_effects && node.key instanceof AST_Node) return found = true;
+                node.value.walk(tw);
+                return true;
+            }
+            if (predicate(node)) return found = true;
+        });
+        this.walk(tw);
+        return found;
+    }
+    AST_DefaultValue.DEFMETHOD("match_symbol", match_destructured);
+    AST_Destructured.DEFMETHOD("match_symbol", match_destructured);
+
+    function in_async_generator(scope) {
+        return scope instanceof AST_AsyncGeneratorDefun || scope instanceof AST_AsyncGeneratorFunction;
+    }
+
+    function find_scope(compressor) {
+        var level = 0, node = compressor.self();
+        do {
+            if (node.variables) return node;
+        } while (node = compressor.parent(level++));
+    }
+
+    function find_try(compressor, level, node, scope, may_throw, sync) {
+        for (var parent; parent = compressor.parent(level++); node = parent) {
+            if (parent === scope) return false;
+            if (sync && parent instanceof AST_Lambda) {
+                if (parent.name || is_async(parent) || is_generator(parent)) return true;
+            } else if (parent instanceof AST_Try) {
+                if (parent.bfinally && parent.bfinally !== node) return true;
+                if (may_throw && parent.bcatch && parent.bcatch !== node) return true;
+            }
+        }
+        return false;
+    }
+
+    var identifier_atom = makePredicate("Infinity NaN undefined");
+    function is_lhs_read_only(lhs, compressor) {
+        if (lhs instanceof AST_Atom) return true;
+        if (lhs instanceof AST_ObjectIdentity) return true;
+        if (lhs instanceof AST_PropAccess) {
+            if (lhs.property === "__proto__") return true;
+            lhs = lhs.expression;
+            if (lhs instanceof AST_SymbolRef) {
+                if (lhs.is_immutable()) return false;
+                lhs = lhs.fixed_value();
+            }
+            if (!lhs) return true;
+            if (lhs.tail_node().is_constant()) return true;
+            return is_lhs_read_only(lhs, compressor);
+        }
+        if (lhs instanceof AST_SymbolRef) {
+            if (lhs.is_immutable()) return true;
+            var def = lhs.definition();
+            return compressor.exposed(def) && identifier_atom[def.name];
+        }
+        return false;
+    }
 
     function make_node(ctor, orig, props) {
-        if (!props) props = {};
-        if (orig) {
-            if (!props.start) props.start = orig.start;
-            if (!props.end) props.end = orig.end;
+        if (props) {
+            props.start = orig.start;
+            props.end = orig.end;
+        } else {
+            props = orig;
         }
         return new ctor(props);
-    };
+    }
 
-    function make_node_from_constant(compressor, val, orig) {
-        // XXX: WIP.
-        // if (val instanceof AST_Node) return val.transform(new TreeTransformer(null, function(node){
-        //     if (node instanceof AST_SymbolRef) {
-        //         var scope = compressor.find_parent(AST_Scope);
-        //         var def = scope.find_variable(node);
-        //         node.thedef = def;
-        //         return node;
-        //     }
-        // })).transform(compressor);
+    function make_sequence(orig, expressions) {
+        if (expressions.length == 1) return expressions[0];
+        return make_node(AST_Sequence, orig, { expressions: expressions.reduce(merge_sequence, []) });
+    }
 
-        if (val instanceof AST_Node) return val.transform(compressor);
+    function make_node_from_constant(val, orig) {
         switch (typeof val) {
           case "string":
-            return make_node(AST_String, orig, {
-                value: val
-            }).optimize(compressor);
+            return make_node(AST_String, orig, { value: val });
           case "number":
-            return make_node(isNaN(val) ? AST_NaN : AST_Number, orig, {
-                value: val
-            }).optimize(compressor);
+            if (isNaN(val)) return make_node(AST_NaN, orig);
+            if (isFinite(val)) {
+                return 1 / val < 0 ? make_node(AST_UnaryPrefix, orig, {
+                    operator: "-",
+                    expression: make_node(AST_Number, orig, { value: -val }),
+                }) : make_node(AST_Number, orig, { value: val });
+            }
+            return val < 0 ? make_node(AST_UnaryPrefix, orig, {
+                operator: "-",
+                expression: make_node(AST_Infinity, orig),
+            }) : make_node(AST_Infinity, orig);
           case "boolean":
-            return make_node(val ? AST_True : AST_False, orig).optimize(compressor);
+            return make_node(val ? AST_True : AST_False, orig);
           case "undefined":
-            return make_node(AST_Undefined, orig).optimize(compressor);
+            return make_node(AST_Undefined, orig);
           default:
             if (val === null) {
-                return make_node(AST_Null, orig, { value: null }).optimize(compressor);
+                return make_node(AST_Null, orig);
             }
             if (val instanceof RegExp) {
-                return make_node(AST_RegExp, orig, { value: val }).optimize(compressor);
+                return make_node(AST_RegExp, orig, { value: val });
             }
-            throw new Error(string_template("Can't handle constant of type: {type}", {
-                type: typeof val
-            }));
+            throw new Error(string_template("Can't handle constant of type: {type}", { type: typeof val }));
         }
-    };
+    }
+
+    function needs_unbinding(val) {
+        return val instanceof AST_PropAccess
+            || is_undeclared_ref(val) && val.name == "eval";
+    }
+
+    // we shouldn't compress (1,func)(something) to
+    // func(something) because that changes the meaning of
+    // the func (becomes lexical instead of global).
+    function maintain_this_binding(parent, orig, val) {
+        var wrap = false;
+        if (parent.TYPE == "Call") {
+            wrap = parent.expression === orig && needs_unbinding(val);
+        } else if (parent instanceof AST_Template) {
+            wrap = parent.tag === orig && needs_unbinding(val);
+        } else if (parent instanceof AST_UnaryPrefix) {
+            wrap = parent.operator == "delete"
+                || parent.operator == "typeof" && is_undeclared_ref(val);
+        }
+        return wrap ? make_sequence(orig, [ make_node(AST_Number, orig, { value: 0 }), val ]) : val;
+    }
+
+    function merge_expression(base, target) {
+        var fixed_by_id = new Dictionary();
+        base.walk(new TreeWalker(function(node) {
+            if (!(node instanceof AST_SymbolRef)) return;
+            var def = node.definition();
+            var fixed = node.fixed;
+            if (!fixed || !fixed_by_id.has(def.id)) {
+                fixed_by_id.set(def.id, fixed);
+            } else if (fixed_by_id.get(def.id) !== fixed) {
+                fixed_by_id.set(def.id, false);
+            }
+        }));
+        if (fixed_by_id.size() > 0) target.walk(new TreeWalker(function(node) {
+            if (!(node instanceof AST_SymbolRef)) return;
+            var def = node.definition();
+            var fixed = node.fixed;
+            if (!fixed || !fixed_by_id.has(def.id)) return;
+            if (fixed_by_id.get(def.id) !== fixed) node.fixed = false;
+        }));
+        return target;
+    }
+
+    function merge_sequence(array, node) {
+        if (node instanceof AST_Sequence) {
+            [].push.apply(array, node.expressions);
+        } else {
+            array.push(node);
+        }
+        return array;
+    }
+
+    function is_lexical_definition(stat) {
+        return stat instanceof AST_Const || stat instanceof AST_DefClass || stat instanceof AST_Let;
+    }
+
+    function safe_to_trim(stat) {
+        if (stat instanceof AST_LambdaDefinition) {
+            var def = stat.name.definition();
+            var scope = stat.name.scope;
+            return def.scope === scope || all(def.references, function(ref) {
+                var s = ref.scope;
+                do {
+                    if (s === scope) return true;
+                } while (s = s.parent_scope);
+            });
+        }
+        return !is_lexical_definition(stat);
+    }
 
     function as_statement_array(thing) {
         if (thing === null) return [];
-        if (thing instanceof AST_BlockStatement) return thing.body;
+        if (thing instanceof AST_BlockStatement) return all(thing.body, safe_to_trim) ? thing.body : [ thing ];
         if (thing instanceof AST_EmptyStatement) return [];
-        if (thing instanceof AST_Statement) return [ thing ];
+        if (is_statement(thing)) return [ thing ];
         throw new Error("Can't convert thing to statement array");
-    };
+    }
 
     function is_empty(thing) {
         if (thing === null) return true;
         if (thing instanceof AST_EmptyStatement) return true;
         if (thing instanceof AST_BlockStatement) return thing.body.length == 0;
         return false;
-    };
+    }
+
+    function has_declarations_only(block) {
+        return all(block.body, function(stat) {
+            return is_empty(stat)
+                || stat instanceof AST_Defun
+                || stat instanceof AST_Var && declarations_only(stat);
+        });
+    }
 
     function loop_body(x) {
-        if (x instanceof AST_Switch) return x;
-        if (x instanceof AST_For || x instanceof AST_ForIn || x instanceof AST_DWLoop) {
-            return (x.body instanceof AST_BlockStatement ? x.body : x);
+        if (x instanceof AST_IterationStatement) {
+            return x.body instanceof AST_BlockStatement ? x.body : x;
         }
         return x;
-    };
+    }
+
+    function is_iife_call(node) {
+        if (node.TYPE != "Call") return false;
+        do {
+            node = node.expression;
+        } while (node instanceof AST_PropAccess);
+        return node instanceof AST_LambdaExpression ? !is_arrow(node) : is_iife_call(node);
+    }
+
+    function is_iife_single(call) {
+        var exp = call.expression;
+        if (exp.name) return false;
+        if (!(call instanceof AST_New)) return true;
+        var found = false;
+        exp.walk(new TreeWalker(function(node) {
+            if (found) return true;
+            if (node instanceof AST_NewTarget) return found = true;
+            if (node instanceof AST_Scope && node !== exp) return true;
+        }));
+        return !found;
+    }
+
+    function is_undeclared_ref(node) {
+        return node instanceof AST_SymbolRef && node.definition().undeclared;
+    }
+
+    var global_names = makePredicate("Array Boolean clearInterval clearTimeout console Date decodeURI decodeURIComponent encodeURI encodeURIComponent Error escape eval EvalError Function isFinite isNaN JSON Map Math Number parseFloat parseInt RangeError ReferenceError RegExp Object Set setInterval setTimeout String SyntaxError TypeError unescape URIError WeakMap WeakSet");
+    AST_SymbolRef.DEFMETHOD("is_declared", function(compressor) {
+        return this.defined
+            || !this.definition().undeclared
+            || compressor.option("unsafe") && global_names[this.name];
+    });
+
+    function is_static_field_or_init(prop) {
+        return prop.static && prop.value && (prop instanceof AST_ClassField || prop instanceof AST_ClassInit);
+    }
+
+    function declarations_only(node) {
+        return all(node.definitions, function(var_def) {
+            return !var_def.value;
+        });
+    }
+
+    function is_declaration(stat, lexical) {
+        if (stat instanceof AST_DefClass) return lexical && !stat.extends && all(stat.properties, function(prop) {
+            if (prop.key instanceof AST_Node) return false;
+            return !is_static_field_or_init(prop);
+        });
+        if (stat instanceof AST_Definitions) return (lexical || stat instanceof AST_Var) && declarations_only(stat);
+        if (stat instanceof AST_ExportDeclaration) return is_declaration(stat.body, lexical);
+        if (stat instanceof AST_ExportDefault) return is_declaration(stat.body, lexical);
+        return stat instanceof AST_LambdaDefinition;
+    }
+
+    function is_last_statement(body, stat) {
+        var index = body.lastIndexOf(stat);
+        if (index < 0) return false;
+        while (++index < body.length) {
+            if (!is_declaration(body[index], true)) return false;
+        }
+        return true;
+    }
+
+    // Certain combination of unused name + side effect leads to invalid AST:
+    //    https://github.com/mishoo/UglifyJS/issues/44
+    //    https://github.com/mishoo/UglifyJS/issues/1838
+    //    https://github.com/mishoo/UglifyJS/issues/3371
+    // We fix it at this stage by moving the `var` outside the `for`.
+    function patch_for_init(node, in_list) {
+        var block;
+        if (node.init instanceof AST_BlockStatement) {
+            block = node.init;
+            node.init = block.body.pop();
+            block.body.push(node);
+        }
+        if (node.init instanceof AST_Defun) {
+            if (!block) block = make_node(AST_BlockStatement, node, { body: [ node ] });
+            block.body.splice(-1, 0, node.init);
+            node.init = null;
+        } else if (node.init instanceof AST_SimpleStatement) {
+            node.init = node.init.body;
+        } else if (is_empty(node.init)) {
+            node.init = null;
+        }
+        if (!block) return;
+        return in_list ? List.splice(block.body) : block;
+    }
 
     function tighten_body(statements, compressor) {
-        var CHANGED;
+        var in_lambda = last_of(compressor, function(node) {
+            return node instanceof AST_Lambda;
+        });
+        var block_scope, iife_in_try, in_iife_single, in_loop, in_try, scope;
+        find_loop_scope_try();
+        var changed, last_changed, max_iter = 10;
         do {
-            CHANGED = false;
-            if (compressor.option("angular")) {
-                statements = process_for_angular(statements);
-            }
-            statements = eliminate_spurious_blocks(statements);
+            last_changed = changed;
+            changed = 0;
+            if (eliminate_spurious_blocks(statements)) changed = 1;
+            if (!changed && last_changed == 1) break;
             if (compressor.option("dead_code")) {
-                statements = eliminate_dead_code(statements, compressor);
+                if (eliminate_dead_code(statements, compressor)) changed = 2;
+                if (!changed && last_changed == 2) break;
             }
             if (compressor.option("if_return")) {
-                statements = handle_if_return(statements, compressor);
+                if (handle_if_return(statements, compressor)) changed = 3;
+                if (!changed && last_changed == 3) break;
             }
-            if (compressor.option("sequences")) {
-                statements = sequencesize(statements, compressor);
+            if (compressor.option("awaits") && compressor.option("side_effects")) {
+                if (trim_awaits(statements, compressor)) changed = 4;
+                if (!changed && last_changed == 4) break;
+            }
+            if (compressor.option("inline") >= 4) {
+                if (inline_iife(statements, compressor)) changed = 5;
+                if (!changed && last_changed == 5) break;
+            }
+            if (compressor.sequences_limit > 0) {
+                if (sequencesize(statements, compressor)) changed = 6;
+                if (!changed && last_changed == 6) break;
+                if (sequencesize_2(statements, compressor)) changed = 7;
+                if (!changed && last_changed == 7) break;
             }
             if (compressor.option("join_vars")) {
-                statements = join_consecutive_vars(statements, compressor);
+                if (join_consecutive_vars(statements)) changed = 8;
+                if (!changed && last_changed == 8) break;
+            }
+            if (compressor.option("collapse_vars")) {
+                if (collapse(statements, compressor)) changed = 9;
             }
-        } while (CHANGED);
+        } while (changed && max_iter-- > 0);
+        return statements;
 
-        if (compressor.option("negate_iife")) {
-            negate_iifes(statements, compressor);
+        function last_of(compressor, predicate) {
+            var block = compressor.self(), level = 0, stat;
+            do {
+                if (block instanceof AST_Catch) {
+                    block = compressor.parent(level++);
+                } else if (block instanceof AST_LabeledStatement) {
+                    block = block.body;
+                } else if (block instanceof AST_SwitchBranch) {
+                    var branches = compressor.parent(level);
+                    if (branches.body[branches.body.length - 1] === block || has_break(block.body)) {
+                        level++;
+                        block = branches;
+                    }
+                }
+                do {
+                    stat = block;
+                    if (predicate(stat)) return stat;
+                    block = compressor.parent(level++);
+                } while (block instanceof AST_If);
+            } while (stat
+                && (block instanceof AST_BlockStatement
+                    || block instanceof AST_Catch
+                    || block instanceof AST_Scope
+                    || block instanceof AST_SwitchBranch
+                    || block instanceof AST_Try)
+                && is_last_statement(block.body, stat));
+
+            function has_break(stats) {
+                for (var i = stats.length; --i >= 0;) {
+                    if (stats[i] instanceof AST_Break) return true;
+                }
+                return false;
+            }
         }
 
-        return statements;
+        function find_loop_scope_try() {
+            var node = compressor.self(), level = 0;
+            do {
+                if (!block_scope && node.variables) block_scope = node;
+                if (node instanceof AST_Catch) {
+                    if (compressor.parent(level).bfinally) {
+                        if (!in_try) in_try = {};
+                        in_try.bfinally = true;
+                    }
+                    level++;
+                } else if (node instanceof AST_Finally) {
+                    level++;
+                } else if (node instanceof AST_IterationStatement) {
+                    in_loop = true;
+                } else if (node instanceof AST_Scope) {
+                    scope = node;
+                    break;
+                } else if (node instanceof AST_Try) {
+                    if (!in_try) in_try = {};
+                    if (node.bcatch) in_try.bcatch = true;
+                    if (node.bfinally) in_try.bfinally = true;
+                }
+            } while (node = compressor.parent(level++));
+        }
+
+        // Search from right to left for assignment-like expressions:
+        // - `var a = x;`
+        // - `a = x;`
+        // - `++a`
+        // For each candidate, scan from left to right for first usage, then try
+        // to fold assignment into the site for compression.
+        // Will not attempt to collapse assignments into or past code blocks
+        // which are not sequentially executed, e.g. loops and conditionals.
+        function collapse(statements, compressor) {
+            if (scope.pinned()) return;
+            var args;
+            var assignments = new Dictionary();
+            var candidates = [];
+            var changed = false;
+            var declare_only = new Dictionary();
+            var force_single;
+            var stat_index = statements.length;
+            var scanner = new TreeTransformer(function(node, descend) {
+                if (abort) return node;
+                // Skip nodes before `candidate` as quickly as possible
+                if (!hit) {
+                    if (node !== hit_stack[hit_index]) return node;
+                    hit_index++;
+                    if (hit_index < hit_stack.length) return handle_custom_scan_order(node, scanner);
+                    hit = true;
+                    stop_after = (value_def ? find_stop_value : find_stop)(node, 0);
+                    if (stop_after === node) abort = true;
+                    return node;
+                }
+                var parent = scanner.parent();
+                // Stop only if candidate is found within conditional branches
+                if (!stop_if_hit && in_conditional(node, parent)) {
+                    stop_if_hit = parent;
+                }
+                // Cascade compound assignments
+                if (compound && scan_lhs && can_replace && !stop_if_hit
+                    && node instanceof AST_Assign && node.operator != "=" && node.left.equals(lhs)) {
+                    replaced++;
+                    changed = true;
+                    AST_Node.info("Cascading {this} [{start}]", node);
+                    can_replace = false;
+                    lvalues = get_lvalues(lhs);
+                    node.right.transform(scanner);
+                    clear_write_only(candidate);
+                    var folded;
+                    if (abort) {
+                        folded = candidate;
+                    } else {
+                        abort = true;
+                        folded = make_node(AST_Binary, candidate, {
+                            operator: compound,
+                            left: lhs.fixed && lhs.definition().fixed ? lhs.fixed.to_binary(candidate) : lhs,
+                            right: rvalue,
+                        });
+                    }
+                    return make_node(AST_Assign, node, {
+                        operator: "=",
+                        left: node.left,
+                        right: make_node(AST_Binary, node, {
+                            operator: node.operator.slice(0, -1),
+                            left: folded,
+                            right: node.right,
+                        }),
+                    });
+                }
+                // Stop immediately if these node types are encountered
+                if (should_stop(node, parent)) {
+                    abort = true;
+                    return node;
+                }
+                // Skip transient nodes caused by single-use variable replacement
+                if (node.single_use) return node;
+                // Replace variable with assignment when found
+                var hit_rhs;
+                if (!(node instanceof AST_SymbolDeclaration)
+                    && (scan_lhs && lhs.equals(node)
+                        || scan_rhs && (hit_rhs = scan_rhs(node, this)))) {
+                    if (!can_replace || stop_if_hit && (hit_rhs || !lhs_local || !replace_all)) {
+                        if (!hit_rhs && !value_def) abort = true;
+                        return node;
+                    }
+                    if (is_lhs(node, parent)) {
+                        if (value_def && !hit_rhs) assign_used = true;
+                        return node;
+                    }
+                    if (!hit_rhs && verify_ref && node.fixed !== lhs.fixed) {
+                        abort = true;
+                        return node;
+                    }
+                    if (value_def) {
+                        if (stop_if_hit && assign_pos == 0) assign_pos = remaining - replaced;
+                        if (!hit_rhs) replaced++;
+                        return node;
+                    }
+                    replaced++;
+                    changed = abort = true;
+                    AST_Node.info("Collapsing {this} [{start}]", node);
+                    if (candidate.TYPE == "Binary") {
+                        update_symbols(candidate, node);
+                        return make_node(AST_Assign, candidate, {
+                            operator: "=",
+                            left: candidate.right.left,
+                            right: candidate.operator == "&&" ? make_node(AST_Conditional, candidate, {
+                                condition: candidate.left,
+                                consequent: candidate.right.right,
+                                alternative: node,
+                            }) : make_node(AST_Conditional, candidate, {
+                                condition: candidate.left,
+                                consequent: node,
+                                alternative: candidate.right.right,
+                            }),
+                        });
+                    }
+                    if (candidate instanceof AST_UnaryPostfix) return make_node(AST_UnaryPrefix, candidate, {
+                        operator: candidate.operator,
+                        expression: lhs.fixed && lhs.definition().fixed ? lhs.fixed.to_prefix(candidate) : lhs,
+                    });
+                    if (candidate instanceof AST_UnaryPrefix) {
+                        clear_write_only(candidate);
+                        return candidate;
+                    }
+                    update_symbols(rvalue, node);
+                    if (candidate instanceof AST_VarDef) {
+                        var def = candidate.name.definition();
+                        if (def.references.length - def.replaced == 1 && !compressor.exposed(def)) {
+                            def.replaced++;
+                            return maintain_this_binding(parent, node, rvalue);
+                        }
+                        return make_node(AST_Assign, candidate, {
+                            operator: "=",
+                            left: node,
+                            right: rvalue,
+                        });
+                    }
+                    clear_write_only(rvalue);
+                    var assign = candidate.clone();
+                    assign.right = rvalue;
+                    return assign;
+                }
+                // Stop signals related to AST_SymbolRef
+                if (should_stop_ref(node, parent)) {
+                    abort = true;
+                    return node;
+                }
+                // These node types have child nodes that execute sequentially,
+                // but are otherwise not safe to scan into or beyond them.
+                if (is_last_node(node, parent) || may_throw(node)) {
+                    stop_after = node;
+                    if (node instanceof AST_Scope) abort = true;
+                }
+                // Scan but don't replace inside getter/setter
+                if (node instanceof AST_Accessor) {
+                    var replace = can_replace;
+                    can_replace = false;
+                    descend(node, scanner);
+                    can_replace = replace;
+                    return signal_abort(node);
+                }
+                // Scan but don't replace inside destructuring expression
+                if (node instanceof AST_Destructured) {
+                    var replace = can_replace;
+                    can_replace = false;
+                    descend(node, scanner);
+                    can_replace = replace;
+                    return signal_abort(node);
+                }
+                // Scan but don't replace inside default value
+                if (node instanceof AST_DefaultValue) {
+                    node.name = node.name.transform(scanner);
+                    var replace = can_replace;
+                    can_replace = false;
+                    node.value = node.value.transform(scanner);
+                    can_replace = replace;
+                    return signal_abort(node);
+                }
+                // Scan but don't replace inside block scope with colliding variable
+                if (node instanceof AST_BlockScope
+                    && !(node instanceof AST_Scope)
+                    && !(node.variables && node.variables.all(function(def) {
+                        return !enclosed.has(def.name) && !lvalues.has(def.name);
+                    }))) {
+                    var replace = can_replace;
+                    can_replace = false;
+                    if (!handle_custom_scan_order(node, scanner)) descend(node, scanner);
+                    can_replace = replace;
+                    return signal_abort(node);
+                }
+                if (handle_custom_scan_order(node, scanner)) return signal_abort(node);
+            }, signal_abort);
+            var multi_replacer = new TreeTransformer(function(node) {
+                if (abort) return node;
+                // Skip nodes before `candidate` as quickly as possible
+                if (!hit) {
+                    if (node !== hit_stack[hit_index]) return node;
+                    hit_index++;
+                    switch (hit_stack.length - hit_index) {
+                      case 0:
+                        hit = true;
+                        if (assign_used) return node;
+                        if (node !== candidate) return node;
+                        if (node instanceof AST_VarDef) return node;
+                        def.replaced++;
+                        var parent = multi_replacer.parent();
+                        if (parent instanceof AST_Sequence && parent.tail_node() !== node) {
+                            value_def.replaced++;
+                            if (rvalue === rhs_value) return List.skip;
+                            return make_sequence(rhs_value, rhs_value.expressions.slice(0, -1));
+                        }
+                        return rvalue;
+                      case 1:
+                        if (!assign_used && node.body === candidate) {
+                            hit = true;
+                            def.replaced++;
+                            value_def.replaced++;
+                            return null;
+                        }
+                      default:
+                        return handle_custom_scan_order(node, multi_replacer);
+                    }
+                }
+                // Replace variable when found
+                if (node instanceof AST_SymbolRef && node.definition() === def) {
+                    if (is_lhs(node, multi_replacer.parent())) return node;
+                    if (!--replaced) abort = true;
+                    AST_Node.info("Replacing {this} [{start}]", node);
+                    var ref = rvalue.clone();
+                    ref.scope = node.scope;
+                    ref.reference();
+                    if (replaced == assign_pos) {
+                        abort = true;
+                        return make_node(AST_Assign, candidate, {
+                            operator: "=",
+                            left: node,
+                            right: ref,
+                        });
+                    }
+                    def.replaced++;
+                    return ref;
+                }
+                // Skip (non-executed) functions and (leading) default case in switch statements
+                if (node instanceof AST_Default || node instanceof AST_Scope) return node;
+            }, function(node) {
+                return patch_sequence(node, multi_replacer);
+            });
+            while (--stat_index >= 0) {
+                // Treat parameters as collapsible in IIFE, i.e.
+                //   function(a, b){ ... }(x());
+                // would be translated into equivalent assignments:
+                //   var a = x(), b = undefined;
+                if (stat_index == 0 && compressor.option("unused")) extract_args();
+                // Find collapsible assignments
+                var hit_stack = [];
+                extract_candidates(statements[stat_index]);
+                while (candidates.length > 0) {
+                    hit_stack = candidates.pop();
+                    var hit_index = 0;
+                    var candidate = hit_stack[hit_stack.length - 1];
+                    var assign_pos = -1;
+                    var assign_used = false;
+                    var verify_ref = false;
+                    var remaining;
+                    var value_def = null;
+                    var stop_after = null;
+                    var stop_if_hit = null;
+                    var lhs = get_lhs(candidate);
+                    var side_effects = lhs && lhs.has_side_effects(compressor);
+                    var scan_lhs = lhs && (!side_effects || lhs instanceof AST_SymbolRef)
+                            && !is_lhs_read_only(lhs, compressor);
+                    var scan_rhs = foldable(candidate);
+                    if (!scan_lhs && !scan_rhs) continue;
+                    var compound = candidate instanceof AST_Assign && candidate.operator.slice(0, -1);
+                    var funarg = candidate.name instanceof AST_SymbolFunarg;
+                    var may_throw = return_false;
+                    if (candidate.may_throw(compressor)) {
+                        if (funarg && is_async(scope)) continue;
+                        may_throw = in_try ? function(node) {
+                            return node.has_side_effects(compressor);
+                        } : side_effects_external;
+                    }
+                    var read_toplevel = false;
+                    var modify_toplevel = false;
+                    // Locate symbols which may execute code outside of scanning range
+                    var enclosed = new Dictionary();
+                    var well_defined = true;
+                    var lvalues = get_lvalues(candidate);
+                    var lhs_local = is_lhs_local(lhs);
+                    var rhs_value = get_rvalue(candidate);
+                    var rvalue = rhs_value;
+                    if (!side_effects) {
+                        if (!compound && rvalue instanceof AST_Sequence) rvalue = rvalue.tail_node();
+                        side_effects = value_has_side_effects();
+                    }
+                    var check_destructured = in_try || !lhs_local ? function(node) {
+                        return node instanceof AST_Destructured;
+                    } : return_false;
+                    var replace_all = replace_all_symbols(candidate);
+                    var hit = funarg;
+                    var abort = false;
+                    var replaced = 0;
+                    var can_replace = !args || !hit;
+                    if (!can_replace) {
+                        for (var j = candidate.arg_index + 1; !abort && j < args.length; j++) {
+                            if (args[j]) args[j].transform(scanner);
+                        }
+                        can_replace = true;
+                    }
+                    for (var i = stat_index; !abort && i < statements.length; i++) {
+                        statements[i].transform(scanner);
+                    }
+                    if (value_def) {
+                        if (!replaced || remaining > replaced + assign_used) {
+                            candidates.push(hit_stack);
+                            force_single = true;
+                            continue;
+                        }
+                        if (replaced == assign_pos) assign_used = true;
+                        var def = lhs.definition();
+                        abort = false;
+                        hit_index = 0;
+                        hit = funarg;
+                        for (var i = stat_index; !abort && i < statements.length; i++) {
+                            if (!statements[i].transform(multi_replacer)) statements.splice(i--, 1);
+                        }
+                        replaced = candidate instanceof AST_VarDef
+                            && candidate === hit_stack[hit_stack.length - 1]
+                            && def.references.length == def.replaced
+                            && !compressor.exposed(def);
+                        value_def.last_ref = false;
+                        value_def.single_use = false;
+                        changed = true;
+                    }
+                    if (replaced) remove_candidate(candidate);
+                }
+            }
+            return changed;
+
+            function signal_abort(node) {
+                if (abort) return node;
+                if (stop_after === node) abort = true;
+                if (stop_if_hit === node) stop_if_hit = null;
+                return node;
+            }
+
+            function handle_custom_scan_order(node, tt) {
+                if (!(node instanceof AST_BlockScope)) return;
+                // Skip (non-executed) functions
+                if (node instanceof AST_Scope) return node;
+                // Scan computed keys, static fields & initializers in class
+                if (node instanceof AST_Class) {
+                    if (node.name) node.name = node.name.transform(tt);
+                    if (!abort && node.extends) node.extends = node.extends.transform(tt);
+                    var fields = [], stats = [];
+                    for (var i = 0; !abort && i < node.properties.length; i++) {
+                        var prop = node.properties[i];
+                        if (prop.key instanceof AST_Node) prop.key = prop.key.transform(tt);
+                        if (!prop.static) continue;
+                        if (prop instanceof AST_ClassField) {
+                            if (prop.value) fields.push(prop);
+                        } else if (prop instanceof AST_ClassInit) {
+                            [].push.apply(stats, prop.value.body);
+                        }
+                    }
+                    for (var i = 0; !abort && i < stats.length; i++) {
+                        stats[i].transform(tt);
+                    }
+                    for (var i = 0; !abort && i < fields.length; i++) {
+                        var prop = fields[i];
+                        prop.value = prop.value.transform(tt);
+                    }
+                    return node;
+                }
+                // Scan object only in a for-in/of statement
+                if (node instanceof AST_ForEnumeration) {
+                    node.object = node.object.transform(tt);
+                    abort = true;
+                    return node;
+                }
+                // Scan first case expression only in a switch statement
+                if (node instanceof AST_Switch) {
+                    node.expression = node.expression.transform(tt);
+                    for (var i = 0; !abort && i < node.body.length; i++) {
+                        var branch = node.body[i];
+                        if (branch instanceof AST_Case) {
+                            if (!hit) {
+                                if (branch !== hit_stack[hit_index]) continue;
+                                hit_index++;
+                            }
+                            branch.expression = branch.expression.transform(tt);
+                            if (!replace_all) break;
+                            scan_rhs = false;
+                        }
+                    }
+                    abort = true;
+                    return node;
+                }
+            }
 
-        function process_for_angular(statements) {
-            function has_inject(comment) {
-                return /@ngInject/.test(comment.value);
+            function is_direct_assignment(node, parent) {
+                if (parent instanceof AST_Assign) return parent.operator == "=" && parent.left === node;
+                if (parent instanceof AST_DefaultValue) return parent.name === node;
+                if (parent instanceof AST_DestructuredArray) return true;
+                if (parent instanceof AST_DestructuredKeyVal) return parent.value === node;
+            }
+
+            function should_stop(node, parent) {
+                if (node === rvalue) return true;
+                if (parent instanceof AST_For) {
+                    if (node !== parent.init) return true;
+                }
+                if (node instanceof AST_Assign) {
+                    return node.operator != "=" && lhs.equals(node.left);
+                }
+                if (node instanceof AST_Call) {
+                    if (!(lhs instanceof AST_PropAccess)) return false;
+                    if (!lhs.equals(node.expression)) return false;
+                    return !(rvalue instanceof AST_LambdaExpression && !rvalue.contains_this());
+                }
+                if (node instanceof AST_Class) return !compressor.has_directive("use strict");
+                if (node instanceof AST_Debugger) return true;
+                if (node instanceof AST_Defun) return funarg && lhs.name === node.name.name;
+                if (node instanceof AST_DestructuredKeyVal) return node.key instanceof AST_Node;
+                if (node instanceof AST_DWLoop) return true;
+                if (node instanceof AST_LoopControl) return true;
+                if (node instanceof AST_Try) return true;
+                if (node instanceof AST_With) return true;
+                return false;
+            }
+
+            function should_stop_ref(node, parent) {
+                if (!(node instanceof AST_SymbolRef)) return false;
+                if (node.is_declared(compressor)) {
+                    if (node.fixed_value()) return false;
+                    if (can_drop_symbol(node)) {
+                        return !(parent instanceof AST_PropAccess && parent.expression === node)
+                            && is_arguments(node.definition());
+                    }
+                } else if (is_direct_assignment(node, parent)) {
+                    return false;
+                }
+                if (!replace_all) return true;
+                scan_rhs = false;
+                return false;
+            }
+
+            function in_conditional(node, parent) {
+                if (parent instanceof AST_Assign) return parent.left !== node && lazy_op[parent.operator.slice(0, -1)];
+                if (parent instanceof AST_Binary) return parent.left !== node && lazy_op[parent.operator];
+                if (parent instanceof AST_Call) return parent.optional && parent.expression !== node;
+                if (parent instanceof AST_Case) return parent.expression !== node;
+                if (parent instanceof AST_Conditional) return parent.condition !== node;
+                if (parent instanceof AST_If) return parent.condition !== node;
+                if (parent instanceof AST_Sub) return parent.optional && parent.expression !== node;
+            }
+
+            function is_last_node(node, parent) {
+                if (node instanceof AST_Await) return true;
+                if (node.TYPE == "Binary") return !can_drop_op(node.operator, node.right, compressor);
+                if (node instanceof AST_Call) {
+                    var def, fn = node.expression;
+                    if (fn instanceof AST_SymbolRef) {
+                        def = fn.definition();
+                        fn = fn.fixed_value();
+                    }
+                    if (!(fn instanceof AST_Lambda)) return !node.is_expr_pure(compressor);
+                    if (def && recursive_ref(compressor, def, fn)) return true;
+                    if (fn.collapse_scanning) return false;
+                    fn.collapse_scanning = true;
+                    var replace = can_replace;
+                    can_replace = false;
+                    var after = stop_after;
+                    var if_hit = stop_if_hit;
+                    for (var i = 0; !abort && i < fn.argnames.length; i++) {
+                        if (arg_may_throw(reject, fn.argnames[i], node.args[i])) abort = true;
+                    }
+                    if (!abort) {
+                        if (fn.rest && arg_may_throw(reject, fn.rest, make_node(AST_Array, node, {
+                            elements: node.args.slice(i),
+                        }))) {
+                            abort = true;
+                        } else if (is_arrow(fn) && fn.value) {
+                            fn.value.transform(scanner);
+                        } else for (var i = 0; !abort && i < fn.body.length; i++) {
+                            var stat = fn.body[i];
+                            if (stat instanceof AST_Return) {
+                                if (stat.value) stat.value.transform(scanner);
+                                break;
+                            }
+                            stat.transform(scanner);
+                        }
+                    }
+                    stop_if_hit = if_hit;
+                    stop_after = after;
+                    can_replace = replace;
+                    fn.collapse_scanning = false;
+                    if (!abort) return false;
+                    abort = false;
+                    return true;
+                }
+                if (node instanceof AST_Class) {
+                    if (!in_try) return false;
+                    var base = node.extends;
+                    if (!base) return false;
+                    if (base instanceof AST_SymbolRef) base = base.fixed_value();
+                    return !safe_for_extends(base);
+                }
+                if (node instanceof AST_Exit) {
+                    if (in_try) {
+                        if (in_try.bfinally) return true;
+                        if (in_try.bcatch && node instanceof AST_Throw) return true;
+                    }
+                    return side_effects || lhs instanceof AST_PropAccess || may_modify(lhs);
+                }
+                if (node instanceof AST_Function) {
+                    return compressor.option("ie") && node.name && lvalues.has(node.name.name);
+                }
+                if (node instanceof AST_ObjectIdentity) return symbol_in_lvalues(node, parent);
+                if (node instanceof AST_PropAccess) {
+                    if (side_effects) return true;
+                    var exp = node.expression;
+                    if (exp instanceof AST_SymbolRef && is_arguments(exp.definition())) return true;
+                    if (compressor.option("unsafe")) {
+                        if (is_undeclared_ref(exp) && global_names[exp.name]) return false;
+                        if (is_static_fn(exp)) return false;
+                    }
+                    if (!well_defined) return true;
+                    if (value_def) return false;
+                    if (!in_try && lhs_local) return false;
+                    if (node.optional) return false;
+                    return exp.may_throw_on_access(compressor);
+                }
+                if (node instanceof AST_Spread) return true;
+                if (node instanceof AST_SymbolRef) {
+                    if (symbol_in_lvalues(node, parent)) return !is_direct_assignment(node, parent);
+                    if (side_effects && may_modify(node)) return true;
+                    var def = node.definition();
+                    return (in_try || def.scope.resolve() !== scope) && !can_drop_symbol(node);
+                }
+                if (node instanceof AST_Template) return !node.is_expr_pure(compressor);
+                if (node instanceof AST_VarDef) {
+                    if (check_destructured(node.name)) return true;
+                    return (node.value || parent instanceof AST_Let) && node.name.match_symbol(function(node) {
+                        return node instanceof AST_SymbolDeclaration
+                            && (lvalues.has(node.name) || side_effects && may_modify(node));
+                    }, true);
+                }
+                if (node instanceof AST_Yield) return true;
+                var sym = is_lhs(node.left, node);
+                if (!sym) return false;
+                if (sym instanceof AST_PropAccess) return true;
+                if (check_destructured(sym)) return true;
+                return sym.match_symbol(function(node) {
+                    return node instanceof AST_SymbolRef
+                        && (lvalues.has(node.name) || read_toplevel && compressor.exposed(node.definition()));
+                }, true);
+
+                function reject(node) {
+                    node.transform(scanner);
+                    return abort;
+                }
+            }
+
+            function arg_may_throw(reject, node, value) {
+                if (node instanceof AST_DefaultValue) {
+                    return reject(node.value)
+                        || arg_may_throw(reject, node.name, node.value)
+                        || !is_undefined(value) && arg_may_throw(reject, node.name, value);
+                }
+                if (!value) return !(node instanceof AST_Symbol);
+                if (node instanceof AST_Destructured) {
+                    if (node.rest && arg_may_throw(reject, node.rest)) return true;
+                    if (node instanceof AST_DestructuredArray) {
+                        if (value instanceof AST_Array) return !all(node.elements, function(element, index) {
+                            return !arg_may_throw(reject, element, value[index]);
+                        });
+                        if (!value.is_string(compressor)) return true;
+                        return !all(node.elements, function(element) {
+                            return !arg_may_throw(reject, element);
+                        });
+                    }
+                    if (node instanceof AST_DestructuredObject) {
+                        if (value.may_throw_on_access(compressor)) return true;
+                        return !all(node.properties, function(prop) {
+                            if (prop.key instanceof AST_Node && reject(prop.key)) return false;
+                            return !arg_may_throw(reject, prop.value);
+                        });
+                    }
+                }
             }
-            function make_arguments_names_list(func) {
-                return func.argnames.map(function(sym){
-                    return make_node(AST_String, sym, { value: sym.name });
+
+            function extract_args() {
+                if (in_iife_single === false) return;
+                var iife = compressor.parent(), fn = compressor.self();
+                if (in_iife_single === undefined) {
+                    if (!(fn instanceof AST_LambdaExpression)
+                        || is_generator(fn)
+                        || fn.uses_arguments
+                        || fn.pinned()
+                        || !(iife instanceof AST_Call)
+                        || iife.expression !== fn
+                        || !all(iife.args, function(arg) {
+                            return !(arg instanceof AST_Spread);
+                        })) {
+                        in_iife_single = false;
+                        return;
+                    }
+                    if (!is_iife_single(iife)) return;
+                    in_iife_single = true;
+                }
+                var fn_strict = fn.in_strict_mode(compressor)
+                    && !fn.parent_scope.resolve(true).in_strict_mode(compressor);
+                var has_await;
+                if (is_async(fn)) {
+                    has_await = function(node) {
+                        return node instanceof AST_Symbol && node.name == "await";
+                    };
+                    iife_in_try = true;
+                } else {
+                    has_await = function(node) {
+                        return node instanceof AST_Await && !tw.find_parent(AST_Scope);
+                    };
+                    if (iife_in_try === undefined) iife_in_try = find_try(compressor, 1, iife, null, true, true);
+                }
+                var arg_scope = null;
+                var tw = new TreeWalker(function(node, descend) {
+                    if (!arg) return true;
+                    if (has_await(node) || node instanceof AST_Yield) {
+                        arg = null;
+                        return true;
+                    }
+                    if (node instanceof AST_ObjectIdentity) {
+                        if (fn_strict || !arg_scope) arg = null;
+                        return true;
+                    }
+                    if (node instanceof AST_SymbolRef) {
+                        var def;
+                        if (node.in_arg && !is_safe_lexical(node.definition())
+                            || (def = fn.variables.get(node.name)) && def !== node.definition()) {
+                            arg = null;
+                        }
+                        return true;
+                    }
+                    if (node instanceof AST_Scope && !is_arrow(node)) {
+                        var save_scope = arg_scope;
+                        arg_scope = node;
+                        descend();
+                        arg_scope = save_scope;
+                        return true;
+                    }
                 });
+                args = iife.args.slice();
+                var len = args.length;
+                var names = new Dictionary();
+                for (var i = fn.argnames.length; --i >= 0;) {
+                    var sym = fn.argnames[i];
+                    var arg = args[i];
+                    var value = null;
+                    if (sym instanceof AST_DefaultValue) {
+                        value = sym.value;
+                        sym = sym.name;
+                        args[len + i] = value;
+                    }
+                    if (sym instanceof AST_Destructured) {
+                        if (iife_in_try && arg_may_throw(function(node) {
+                            return node.has_side_effects(compressor);
+                        }, sym, arg)) {
+                            candidates.length = 0;
+                            break;
+                        }
+                        args[len + i] = fn.argnames[i];
+                        continue;
+                    }
+                    if (names.has(sym.name)) continue;
+                    names.set(sym.name, true);
+                    if (value) arg = is_undefined(arg) ? value : null;
+                    if (!arg && !value) {
+                        arg = make_node(AST_Undefined, sym).transform(compressor);
+                    } else if (arg instanceof AST_Lambda && arg.pinned()) {
+                        arg = null;
+                    } else if (arg) {
+                        arg.walk(tw);
+                    }
+                    if (!arg) continue;
+                    var candidate = make_node(AST_VarDef, sym, {
+                        name: sym,
+                        value: arg,
+                    });
+                    candidate.name_index = i;
+                    candidate.arg_index = value ? len + i : i;
+                    candidates.unshift([ candidate ]);
+                }
+                if (fn.rest) args.push(fn.rest);
+            }
+
+            function extract_candidates(expr, unused) {
+                hit_stack.push(expr);
+                if (expr instanceof AST_Array) {
+                    expr.elements.forEach(function(node) {
+                        extract_candidates(node, unused);
+                    });
+                } else if (expr instanceof AST_Assign) {
+                    var lhs = expr.left;
+                    if (!(lhs instanceof AST_Destructured)) candidates.push(hit_stack.slice());
+                    extract_candidates(lhs);
+                    extract_candidates(expr.right);
+                    if (lhs instanceof AST_SymbolRef && expr.operator == "=") {
+                        assignments.set(lhs.name, (assignments.get(lhs.name) || 0) + 1);
+                    }
+                } else if (expr instanceof AST_Await) {
+                    extract_candidates(expr.expression, unused);
+                } else if (expr instanceof AST_Binary) {
+                    var lazy = lazy_op[expr.operator];
+                    if (unused
+                        && lazy
+                        && expr.operator != "??"
+                        && expr.right instanceof AST_Assign
+                        && expr.right.operator == "="
+                        && !(expr.right.left instanceof AST_Destructured)) {
+                        candidates.push(hit_stack.slice());
+                    }
+                    extract_candidates(expr.left, !lazy && unused);
+                    extract_candidates(expr.right, unused);
+                } else if (expr instanceof AST_Call) {
+                    extract_candidates(expr.expression);
+                    expr.args.forEach(extract_candidates);
+                } else if (expr instanceof AST_Case) {
+                    extract_candidates(expr.expression);
+                } else if (expr instanceof AST_Conditional) {
+                    extract_candidates(expr.condition);
+                    extract_candidates(expr.consequent, unused);
+                    extract_candidates(expr.alternative, unused);
+                } else if (expr instanceof AST_Definitions) {
+                    expr.definitions.forEach(extract_candidates);
+                } else if (expr instanceof AST_Dot) {
+                    extract_candidates(expr.expression);
+                } else if (expr instanceof AST_DWLoop) {
+                    extract_candidates(expr.condition);
+                    if (!(expr.body instanceof AST_Block)) {
+                        extract_candidates(expr.body);
+                    }
+                } else if (expr instanceof AST_Exit) {
+                    if (expr.value) extract_candidates(expr.value);
+                } else if (expr instanceof AST_For) {
+                    if (expr.init) extract_candidates(expr.init, true);
+                    if (expr.condition) extract_candidates(expr.condition);
+                    if (expr.step) extract_candidates(expr.step, true);
+                    if (!(expr.body instanceof AST_Block)) {
+                        extract_candidates(expr.body);
+                    }
+                } else if (expr instanceof AST_ForEnumeration) {
+                    extract_candidates(expr.object);
+                    if (!(expr.body instanceof AST_Block)) {
+                        extract_candidates(expr.body);
+                    }
+                } else if (expr instanceof AST_If) {
+                    extract_candidates(expr.condition);
+                    if (!(expr.body instanceof AST_Block)) {
+                        extract_candidates(expr.body);
+                    }
+                    if (expr.alternative && !(expr.alternative instanceof AST_Block)) {
+                        extract_candidates(expr.alternative);
+                    }
+                } else if (expr instanceof AST_Object) {
+                    expr.properties.forEach(function(prop) {
+                        hit_stack.push(prop);
+                        if (prop.key instanceof AST_Node) extract_candidates(prop.key);
+                        if (prop instanceof AST_ObjectKeyVal) extract_candidates(prop.value, unused);
+                        hit_stack.pop();
+                    });
+                } else if (expr instanceof AST_Sequence) {
+                    var end = expr.expressions.length - (unused ? 0 : 1);
+                    expr.expressions.forEach(function(node, index) {
+                        extract_candidates(node, index < end);
+                    });
+                } else if (expr instanceof AST_SimpleStatement) {
+                    extract_candidates(expr.body, true);
+                } else if (expr instanceof AST_Spread) {
+                    extract_candidates(expr.expression);
+                } else if (expr instanceof AST_Sub) {
+                    extract_candidates(expr.expression);
+                    extract_candidates(expr.property);
+                } else if (expr instanceof AST_Switch) {
+                    extract_candidates(expr.expression);
+                    expr.body.forEach(extract_candidates);
+                } else if (expr instanceof AST_Unary) {
+                    if (UNARY_POSTFIX[expr.operator]) {
+                        candidates.push(hit_stack.slice());
+                    } else {
+                        extract_candidates(expr.expression);
+                    }
+                } else if (expr instanceof AST_VarDef) {
+                    if (expr.name instanceof AST_SymbolVar) {
+                        if (expr.value) {
+                            var def = expr.name.definition();
+                            if (def.references.length > def.replaced) {
+                                candidates.push(hit_stack.slice());
+                            }
+                        } else {
+                            declare_only.set(expr.name.name, (declare_only.get(expr.name.name) || 0) + 1);
+                        }
+                    }
+                    if (expr.value) extract_candidates(expr.value);
+                } else if (expr instanceof AST_Yield) {
+                    if (expr.expression) extract_candidates(expr.expression);
+                }
+                hit_stack.pop();
+            }
+
+            function find_stop(node, level) {
+                var parent = scanner.parent(level);
+                if (parent instanceof AST_Array) return node;
+                if (parent instanceof AST_Assign) return node;
+                if (parent instanceof AST_Await) return node;
+                if (parent instanceof AST_Binary) return node;
+                if (parent instanceof AST_Call) return node;
+                if (parent instanceof AST_Case) return node;
+                if (parent instanceof AST_Conditional) return node;
+                if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Exit) return node;
+                if (parent instanceof AST_If) return node;
+                if (parent instanceof AST_IterationStatement) return node;
+                if (parent instanceof AST_ObjectProperty) return node;
+                if (parent instanceof AST_PropAccess) return node;
+                if (parent instanceof AST_Sequence) {
+                    return (parent.tail_node() === node ? find_stop : find_stop_unused)(parent, level + 1);
+                }
+                if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Spread) return node;
+                if (parent instanceof AST_Switch) return node;
+                if (parent instanceof AST_Unary) return node;
+                if (parent instanceof AST_VarDef) return node;
+                if (parent instanceof AST_Yield) return node;
+                return null;
+            }
+
+            function find_stop_logical(parent, op, level) {
+                var node;
+                do {
+                    node = parent;
+                    parent = scanner.parent(++level);
+                } while (parent instanceof AST_Assign && parent.operator.slice(0, -1) == op
+                    || parent instanceof AST_Binary && parent.operator == op);
+                return node;
+            }
+
+            function find_stop_expr(expr, cont, node, parent, level) {
+                var replace = can_replace;
+                can_replace = false;
+                var after = stop_after;
+                var if_hit = stop_if_hit;
+                var stack = scanner.stack;
+                scanner.stack = [ parent ];
+                expr.transform(scanner);
+                scanner.stack = stack;
+                stop_if_hit = if_hit;
+                stop_after = after;
+                can_replace = replace;
+                if (abort) {
+                    abort = false;
+                    return node;
+                }
+                return cont(parent, level + 1);
+            }
+
+            function find_stop_value(node, level) {
+                var parent = scanner.parent(level);
+                if (parent instanceof AST_Array) return find_stop_value(parent, level + 1);
+                if (parent instanceof AST_Assign) {
+                    if (may_throw(parent)) return node;
+                    if (parent.left.match_symbol(function(ref) {
+                        return ref instanceof AST_SymbolRef && (lhs.name == ref.name || value_def.name == ref.name);
+                    })) return node;
+                    var op;
+                    if (parent.left === node || !lazy_op[op = parent.operator.slice(0, -1)]) {
+                        return find_stop_value(parent, level + 1);
+                    }
+                    return find_stop_logical(parent, op, level);
+                }
+                if (parent instanceof AST_Await) return find_stop_value(parent, level + 1);
+                if (parent instanceof AST_Binary) {
+                    var op;
+                    if (parent.left === node || !lazy_op[op = parent.operator]) {
+                        return find_stop_value(parent, level + 1);
+                    }
+                    return find_stop_logical(parent, op, level);
+                }
+                if (parent instanceof AST_Call) return parent;
+                if (parent instanceof AST_Case) {
+                    if (parent.expression !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_Conditional) {
+                    if (parent.condition !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Do) return node;
+                if (parent instanceof AST_Exit) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_For) {
+                    if (parent.init !== node && parent.condition !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_ForEnumeration) {
+                    if (parent.init !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_If) {
+                    if (parent.condition !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_ObjectProperty) {
+                    var obj = scanner.parent(level + 1);
+                    return all(obj.properties, function(prop) {
+                        return prop instanceof AST_ObjectKeyVal;
+                    }) ? find_stop_value(obj, level + 2) : obj;
+                }
+                if (parent instanceof AST_PropAccess) {
+                    var exp = parent.expression;
+                    return exp === node ? find_stop_value(parent, level + 1) : node;
+                }
+                if (parent instanceof AST_Sequence) {
+                    return (parent.tail_node() === node ? find_stop_value : find_stop_unused)(parent, level + 1);
+                }
+                if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Spread) return find_stop_value(parent, level + 1);
+                if (parent instanceof AST_Switch) {
+                    if (parent.expression !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_Unary) {
+                    if (parent.operator == "delete") return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_VarDef) return parent.name.match_symbol(function(sym) {
+                    return sym instanceof AST_SymbolDeclaration && (lhs.name == sym.name || value_def.name == sym.name);
+                }) ? node : find_stop_value(parent, level + 1);
+                if (parent instanceof AST_While) {
+                    if (parent.condition !== node) return node;
+                    return find_stop_value(parent, level + 1);
+                }
+                if (parent instanceof AST_Yield) return find_stop_value(parent, level + 1);
+                return null;
+            }
+
+            function find_stop_unused(node, level) {
+                var parent = scanner.parent(level);
+                if (is_last_node(node, parent)) return node;
+                if (in_conditional(node, parent)) return node;
+                if (parent instanceof AST_Array) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Assign) return check_assignment(parent.left);
+                if (parent instanceof AST_Await) return node;
+                if (parent instanceof AST_Binary) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Call) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Case) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Conditional) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Definitions) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Exit) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_If) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_IterationStatement) return node;
+                if (parent instanceof AST_ObjectProperty) {
+                    var obj = scanner.parent(level + 1);
+                    return all(obj.properties, function(prop) {
+                        return prop instanceof AST_ObjectKeyVal;
+                    }) ? find_stop_unused(obj, level + 2) : obj;
+                }
+                if (parent instanceof AST_PropAccess) {
+                    var exp = parent.expression;
+                    if (exp === node) return find_stop_unused(parent, level + 1);
+                    return find_stop_expr(exp, find_stop_unused, node, parent, level);
+                }
+                if (parent instanceof AST_Sequence) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_SimpleStatement) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Spread) return node;
+                if (parent instanceof AST_Switch) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_Unary) return find_stop_unused(parent, level + 1);
+                if (parent instanceof AST_VarDef) return check_assignment(parent.name);
+                if (parent instanceof AST_Yield) return node;
+                return null;
+
+                function check_assignment(lhs) {
+                    if (may_throw(parent)) return node;
+                    if (lhs !== node && lhs instanceof AST_Destructured) {
+                        return find_stop_expr(lhs, find_stop_unused, node, parent, level);
+                    }
+                    return find_stop_unused(parent, level + 1);
+                }
+            }
+
+            function mangleable_var(rhs) {
+                if (force_single) {
+                    force_single = false;
+                    return;
+                }
+                if (remaining < 1) return;
+                rhs = rhs.tail_node();
+                var value = rhs instanceof AST_Assign && rhs.operator == "=" ? rhs.left : rhs;
+                if (!(value instanceof AST_SymbolRef)) return;
+                var def = value.definition();
+                if (def.undeclared) return;
+                if (is_arguments(def)) return;
+                if (value !== rhs) {
+                    if (is_lhs_read_only(value, compressor)) return;
+                    var referenced = def.references.length - def.replaced;
+                    if (referenced < 2) return;
+                    var expr = candidate.clone();
+                    expr[expr instanceof AST_Assign ? "right" : "value"] = value;
+                    if (candidate.name_index >= 0) {
+                        expr.name_index = candidate.name_index;
+                        expr.arg_index = candidate.arg_index;
+                    }
+                    candidate = expr;
+                }
+                return value_def = def;
+            }
+
+            function remaining_refs(def) {
+                return def.references.length - def.replaced - (assignments.get(def.name) || 0);
+            }
+
+            function get_lhs(expr) {
+                if (expr instanceof AST_Assign) {
+                    var lhs = expr.left;
+                    if (!(lhs instanceof AST_SymbolRef)) return lhs;
+                    var def = lhs.definition();
+                    if (scope.uses_arguments && is_funarg(def)) return lhs;
+                    if (compressor.exposed(def)) return lhs;
+                    remaining = remaining_refs(def);
+                    if (def.fixed && lhs.fixed) {
+                        var matches = def.references.filter(function(ref) {
+                            return ref.fixed === lhs.fixed;
+                        }).length - 1;
+                        if (matches < remaining) {
+                            remaining = matches;
+                            assign_pos = 0;
+                            verify_ref = true;
+                        }
+                    }
+                    if (expr.operator == "=") mangleable_var(expr.right);
+                    return lhs;
+                }
+                if (expr instanceof AST_Binary) return expr.right.left;
+                if (expr instanceof AST_Unary) return expr.expression;
+                if (expr instanceof AST_VarDef) {
+                    var lhs = expr.name;
+                    var def = lhs.definition();
+                    if (def.const_redefs) return;
+                    if (!member(lhs, def.orig)) return;
+                    if (scope.uses_arguments && is_funarg(def)) return;
+                    var declared = def.orig.length - def.eliminated - (declare_only.get(def.name) || 0);
+                    remaining = remaining_refs(def);
+                    if (def.fixed) remaining = Math.min(remaining, def.references.filter(function(ref) {
+                        if (!ref.fixed) return true;
+                        if (!ref.fixed.assigns) return true;
+                        var assign = ref.fixed.assigns[0];
+                        return assign === lhs || get_rvalue(assign) === expr.value;
+                    }).length);
+                    if (declared > 1 && !(lhs instanceof AST_SymbolFunarg)) {
+                        mangleable_var(expr.value);
+                        return make_node(AST_SymbolRef, lhs);
+                    }
+                    if (mangleable_var(expr.value) || remaining == 1 && !compressor.exposed(def)) {
+                        return make_node(AST_SymbolRef, lhs);
+                    }
+                    return;
+                }
             }
-            function make_array(orig, elements) {
-                return make_node(AST_Array, orig, { elements: elements });
+
+            function get_rvalue(expr) {
+                if (expr instanceof AST_Assign) return expr.right;
+                if (expr instanceof AST_Binary) {
+                    var node = expr.clone();
+                    node.right = expr.right.right;
+                    return node;
+                }
+                if (expr instanceof AST_VarDef) return expr.value;
             }
-            function make_injector(func, name) {
-                return make_node(AST_SimpleStatement, func, {
-                    body: make_node(AST_Assign, func, {
-                        operator: "=",
-                        left: make_node(AST_Dot, name, {
-                            expression: make_node(AST_SymbolRef, name, name),
-                            property: "$inject"
-                        }),
-                        right: make_array(func, make_arguments_names_list(func))
-                    })
+
+            function invariant(expr) {
+                if (expr instanceof AST_Array) return false;
+                if (expr instanceof AST_Binary && lazy_op[expr.operator]) {
+                    return invariant(expr.left) && invariant(expr.right);
+                }
+                if (expr instanceof AST_Call) return false;
+                if (expr instanceof AST_Conditional) {
+                    return invariant(expr.consequent) && invariant(expr.alternative);
+                }
+                if (expr instanceof AST_Object) return false;
+                return !expr.has_side_effects(compressor);
+            }
+
+            function foldable(expr) {
+                if (expr instanceof AST_Assign && expr.right.single_use) return;
+                var lhs_ids = Object.create(null);
+                var marker = new TreeWalker(function(node) {
+                    if (node instanceof AST_SymbolRef) lhs_ids[node.definition().id] = true;
                 });
+                while (expr instanceof AST_Assign && expr.operator == "=") {
+                    expr.left.walk(marker);
+                    expr = expr.right;
+                }
+                if (expr instanceof AST_ObjectIdentity) return rhs_exact_match;
+                if (expr instanceof AST_SymbolRef) {
+                    var value = expr.evaluate(compressor);
+                    if (value === expr) return rhs_exact_match;
+                    return rhs_fuzzy_match(value, rhs_exact_match);
+                }
+                if (expr.is_truthy()) return rhs_fuzzy_match(true, return_false);
+                if (expr.is_constant()) {
+                    var ev = expr.evaluate(compressor);
+                    if (!(ev instanceof AST_Node)) return rhs_fuzzy_match(ev, rhs_exact_match);
+                }
+                if (!(lhs instanceof AST_SymbolRef)) return false;
+                if (!invariant(expr)) return false;
+                var circular;
+                expr.walk(new TreeWalker(function(node) {
+                    if (circular) return true;
+                    if (node instanceof AST_SymbolRef && lhs_ids[node.definition().id]) circular = true;
+                }));
+                return !circular && rhs_exact_match;
+
+                function rhs_exact_match(node) {
+                    return expr.equals(node);
+                }
             }
-            function check_expression(body) {
-                if (body && body.args) {
-                    // if this is a function call check all of arguments passed
-                    body.args.forEach(function(argument, index, array) {
-                        var comments = argument.start.comments_before;
-                        // if the argument is function preceded by @ngInject
-                        if (argument instanceof AST_Lambda && comments.length && has_inject(comments[0])) {
-                            // replace the function with an array of names of its parameters and function at the end
-                            array[index] = make_array(argument, make_arguments_names_list(argument).concat(argument));
-                        }
-                    });
-                    // if this is chained call check previous one recursively
-                    if (body.expression && body.expression.expression) {
-                        check_expression(body.expression.expression);
+
+            function rhs_fuzzy_match(value, fallback) {
+                return function(node, tw) {
+                    if (tw.in_boolean_context()) {
+                        if (value && node.is_truthy() && !node.has_side_effects(compressor)) {
+                            return true;
+                        }
+                        if (node.is_constant()) {
+                            var ev = node.evaluate(compressor);
+                            if (!(ev instanceof AST_Node)) return !ev == !value;
+                        }
                     }
+                    return fallback(node);
+                };
+            }
+
+            function clear_write_only(assign) {
+                while (assign.write_only) {
+                    assign.write_only = false;
+                    if (!(assign instanceof AST_Assign)) break;
+                    assign = assign.right;
                 }
             }
-            return statements.reduce(function(a, stat){
-                a.push(stat);
-
-                if (stat.body && stat.body.args) {
-                    check_expression(stat.body);
-                } else {
-                    var token = stat.start;
-                    var comments = token.comments_before;
-                    if (comments && comments.length > 0) {
-                        var last = comments.pop();
-                        if (has_inject(last)) {
-                            // case 1: defun
-                            if (stat instanceof AST_Defun) {
-                                a.push(make_injector(stat, stat.name));
-                            }
-                            else if (stat instanceof AST_Definitions) {
-                                stat.definitions.forEach(function(def) {
-                                    if (def.value && def.value instanceof AST_Lambda) {
-                                        a.push(make_injector(def.value, def.name));
-                                    }
-                                });
+
+            function update_symbols(value, node) {
+                var scope = node.scope || find_scope(scanner) || block_scope;
+                value.walk(new TreeWalker(function(node) {
+                    if (node instanceof AST_BlockScope) return true;
+                    if (node instanceof AST_Symbol) node.scope = scope;
+                }));
+            }
+
+            function may_be_global(node) {
+                if (node instanceof AST_SymbolRef) {
+                    node = node.fixed_value();
+                    if (!node) return true;
+                }
+                if (node instanceof AST_Assign) return node.operator == "=" && may_be_global(node.right);
+                return node instanceof AST_PropAccess || node instanceof AST_ObjectIdentity;
+            }
+
+            function get_lvalues(expr) {
+                var lvalues = new Dictionary();
+                if (expr instanceof AST_VarDef) {
+                    if (!expr.name.definition().fixed) well_defined = false;
+                    lvalues.add(expr.name.name, lhs);
+                }
+                var find_arguments = scope.uses_arguments && !compressor.has_directive("use strict");
+                var scan_toplevel = scope instanceof AST_Toplevel;
+                var tw = new TreeWalker(function(node) {
+                    var value;
+                    if (node instanceof AST_SymbolRef) {
+                        value = node.fixed_value();
+                        if (!value) {
+                            value = node;
+                            var def = node.definition();
+                            var escaped = node.fixed && node.fixed.escaped || def.escaped;
+                            if (!def.undeclared
+                                && (def.assignments || !escaped || escaped.cross_scope)
+                                && (has_escaped(def, node.scope, node, tw.parent()) || !same_scope(def))) {
+                                well_defined = false;
+                            }
+                        }
+                    } else if (node instanceof AST_ObjectIdentity) {
+                        value = node;
+                    }
+                    if (value) {
+                        lvalues.add(node.name, is_modified(compressor, tw, node, value, 0));
+                    } else if (node instanceof AST_Lambda) {
+                        for (var level = 0, parent, child = node; parent = tw.parent(level++); child = parent) {
+                            if (parent instanceof AST_Assign) {
+                                if (parent.left === child) break;
+                                if (parent.operator == "=") continue;
+                                if (lazy_op[parent.operator.slice(0, -1)]) continue;
+                                break;
+                            }
+                            if (parent instanceof AST_Binary) {
+                                if (lazy_op[parent.operator]) continue;
+                                break;
+                            }
+                            if (parent instanceof AST_Call) return;
+                            if (parent instanceof AST_Scope) return;
+                            if (parent instanceof AST_Sequence) {
+                                if (parent.tail_node() === child) continue;
+                                break;
+                            }
+                            if (parent instanceof AST_Template) {
+                                if (parent.tag) return;
+                                break;
                             }
-                            else {
-                                compressor.warn("Unknown statement marked with @ngInject [{file}:{line},{col}]", token);
+                        }
+                        node.enclosed.forEach(function(def) {
+                            if (def.scope !== node) enclosed.set(def.name, true);
+                        });
+                        return true;
+                    } else if (find_arguments && node instanceof AST_Sub) {
+                        scope.each_argname(function(argname) {
+                            if (!compressor.option("reduce_vars") || argname.definition().assignments) {
+                                if (!argname.definition().fixed) well_defined = false;
+                                lvalues.add(argname.name, true);
                             }
+                        });
+                        find_arguments = false;
+                    }
+                    if (!scan_toplevel) return;
+                    if (node.TYPE == "Call") {
+                        if (modify_toplevel) return;
+                        var exp = node.expression;
+                        if (exp instanceof AST_PropAccess) return;
+                        if (exp instanceof AST_LambdaExpression && !exp.contains_this()) return;
+                        modify_toplevel = true;
+                    } else if (node instanceof AST_PropAccess && may_be_global(node.expression)) {
+                        if (node === lhs && !(expr instanceof AST_Unary)) {
+                            modify_toplevel = true;
+                        } else {
+                            read_toplevel = true;
                         }
                     }
+                });
+                expr.walk(tw);
+                return lvalues;
+            }
+
+            function remove_candidate(expr) {
+                var value = rvalue === rhs_value ? null : make_sequence(rhs_value, rhs_value.expressions.slice(0, -1));
+                var index = expr.name_index;
+                if (index >= 0) {
+                    var args, argname = scope.argnames[index];
+                    if (argname instanceof AST_DefaultValue) {
+                        scope.argnames[index] = argname = argname.clone();
+                        argname.value = value || make_node(AST_Number, argname, { value: 0 });
+                    } else if ((args = compressor.parent().args)[index]) {
+                        scope.argnames[index] = argname.clone();
+                        args[index] = value || make_node(AST_Number, args[index], { value: 0 });
+                    }
+                    return;
+                }
+                var end = hit_stack.length - 1;
+                var last = hit_stack[end];
+                if (last instanceof AST_VarDef || hit_stack[end - 1].body === last) end--;
+                var tt = new TreeTransformer(function(node, descend, in_list) {
+                    if (hit) return node;
+                    if (node !== hit_stack[hit_index]) return node;
+                    hit_index++;
+                    if (hit_index <= end) return handle_custom_scan_order(node, tt);
+                    hit = true;
+                    if (node instanceof AST_Definitions) {
+                        declare_only.set(last.name.name, (declare_only.get(last.name.name) || 0) + 1);
+                        if (value_def) value_def.replaced++;
+                        var defns = node.definitions;
+                        var index = defns.indexOf(last);
+                        var defn = last.clone();
+                        defn.value = null;
+                        if (!value) {
+                            node.definitions[index] = defn;
+                            return node;
+                        }
+                        var body = [ make_node(AST_SimpleStatement, value, { body: value }) ];
+                        if (index > 0) {
+                            var head = node.clone();
+                            head.definitions = defns.slice(0, index);
+                            body.unshift(head);
+                            node = node.clone();
+                            node.definitions = defns.slice(index);
+                        }
+                        body.push(node);
+                        node.definitions[0] = defn;
+                        return in_list ? List.splice(body) : make_node(AST_BlockStatement, node, { body: body });
+                    }
+                    if (!value) return in_list ? List.skip : null;
+                    return is_statement(node) ? make_node(AST_SimpleStatement, value, { body: value }) : value;
+                }, function(node, in_list) {
+                    if (node instanceof AST_For) return patch_for_init(node, in_list);
+                    return patch_sequence(node, tt);
+                });
+                abort = false;
+                hit = false;
+                hit_index = 0;
+                if (!(statements[stat_index] = statements[stat_index].transform(tt))) statements.splice(stat_index, 1);
+            }
+
+            function patch_sequence(node, tt) {
+                if (node instanceof AST_Sequence) switch (node.expressions.length) {
+                  case 0: return null;
+                  case 1: return maintain_this_binding(tt.parent(), node, node.expressions[0]);
                 }
+            }
 
-                return a;
-            }, []);
+            function is_lhs_local(lhs) {
+                var sym = root_expr(lhs);
+                if (!(sym instanceof AST_SymbolRef)) return false;
+                if (sym.definition().scope.resolve() !== scope) return false;
+                if (!in_loop) return true;
+                if (compound) return false;
+                if (candidate instanceof AST_Unary) return false;
+                var lvalue = lvalues.get(sym.name);
+                return !lvalue || lvalue[0] === lhs;
+            }
+
+            function value_has_side_effects() {
+                if (candidate instanceof AST_Unary) return false;
+                return rvalue.has_side_effects(compressor);
+            }
+
+            function replace_all_symbols(expr) {
+                if (expr instanceof AST_Unary) return false;
+                if (side_effects) return false;
+                if (value_def) return true;
+                if (!(lhs instanceof AST_SymbolRef)) return false;
+                var referenced;
+                if (expr instanceof AST_VarDef) {
+                    referenced = 1;
+                } else if (expr.operator == "=") {
+                    referenced = 2;
+                } else {
+                    return false;
+                }
+                var def = lhs.definition();
+                if (def.references.length - def.replaced == referenced) return true;
+                if (!def.fixed) return false;
+                if (!lhs.fixed) return false;
+                var assigns = lhs.fixed.assigns;
+                var matched = 0;
+                if (!all(def.references, function(ref, index) {
+                    var fixed = ref.fixed;
+                    if (!fixed) return false;
+                    if (fixed.to_binary || fixed.to_prefix) return false;
+                    if (fixed === lhs.fixed) {
+                        matched++;
+                        return true;
+                    }
+                    return assigns && fixed.assigns && assigns[0] !== fixed.assigns[0];
+                })) return false;
+                if (matched != referenced) return false;
+                verify_ref = true;
+                return true;
+            }
+
+            function symbol_in_lvalues(sym, parent) {
+                var lvalue = lvalues.get(sym.name);
+                if (!lvalue || all(lvalue, function(lhs) {
+                    return !lhs;
+                })) return;
+                if (lvalue[0] !== lhs) return true;
+                scan_rhs = false;
+            }
+
+            function may_modify(sym) {
+                var def = sym.definition();
+                if (def.orig.length == 1 && def.orig[0] instanceof AST_SymbolDefun) return false;
+                if (def.scope.resolve() !== scope) return true;
+                if (modify_toplevel && compressor.exposed(def)) return true;
+                return !all(def.references, function(ref) {
+                    return ref.scope.resolve(true) === scope;
+                });
+            }
+
+            function side_effects_external(node, lhs) {
+                if (node instanceof AST_Assign) return side_effects_external(node.left, true);
+                if (node instanceof AST_Unary) return side_effects_external(node.expression, true);
+                if (node instanceof AST_VarDef) return node.value && side_effects_external(node.value);
+                if (lhs) {
+                    if (node instanceof AST_Dot) return side_effects_external(node.expression, true);
+                    if (node instanceof AST_Sub) return side_effects_external(node.expression, true);
+                    if (node instanceof AST_SymbolRef) return node.definition().scope.resolve() !== scope;
+                }
+                return false;
+            }
         }
 
         function eliminate_spurious_blocks(statements) {
-            var seen_dirs = [];
-            return statements.reduce(function(a, stat){
+            var changed = false, seen_dirs = [];
+            for (var i = 0; i < statements.length;) {
+                var stat = statements[i];
                 if (stat instanceof AST_BlockStatement) {
-                    CHANGED = true;
-                    a.push.apply(a, eliminate_spurious_blocks(stat.body));
-                } else if (stat instanceof AST_EmptyStatement) {
-                    CHANGED = true;
-                } else if (stat instanceof AST_Directive) {
-                    if (seen_dirs.indexOf(stat.value) < 0) {
-                        a.push(stat);
-                        seen_dirs.push(stat.value);
-                    } else {
-                        CHANGED = true;
-                    }
-                } else {
-                    a.push(stat);
+                    if (all(stat.body, safe_to_trim)) {
+                        changed = true;
+                        eliminate_spurious_blocks(stat.body);
+                        [].splice.apply(statements, [i, 1].concat(stat.body));
+                        i += stat.body.length;
+                        continue;
+                    }
+                }
+                if (stat instanceof AST_Directive) {
+                    if (member(stat.value, seen_dirs)) {
+                        changed = true;
+                        statements.splice(i, 1);
+                        continue;
+                    }
+                    seen_dirs.push(stat.value);
+                }
+                if (stat instanceof AST_EmptyStatement) {
+                    changed = true;
+                    statements.splice(i, 1);
+                    continue;
                 }
-                return a;
-            }, []);
-        };
+                i++;
+            }
+            return changed;
+        }
 
         function handle_if_return(statements, compressor) {
+            var changed = false;
+            var parent = compressor.parent();
             var self = compressor.self();
-            var in_lambda = self instanceof AST_Lambda;
-            var ret = [];
-            loop: for (var i = statements.length; --i >= 0;) {
+            var declare_only, jump, merge_jump;
+            var in_iife = in_lambda && parent && parent.TYPE == "Call" && parent.expression === self;
+            var chain_if_returns = in_lambda && compressor.option("conditionals") && compressor.option("sequences");
+            var drop_return_void = !(in_try && in_try.bfinally && in_async_generator(scope));
+            var multiple_if_returns = has_multiple_if_returns(statements);
+            for (var i = statements.length; --i >= 0;) {
                 var stat = statements[i];
-                switch (true) {
-                  case (in_lambda && stat instanceof AST_Return && !stat.value && ret.length == 0):
-                    CHANGED = true;
-                    // note, ret.length is probably always zero
-                    // because we drop unreachable code before this
-                    // step.  nevertheless, it's good to check.
-                    continue loop;
-                  case stat instanceof AST_If:
-                    if (stat.body instanceof AST_Return) {
-                        //---
-                        // pretty silly case, but:
-                        // if (foo()) return; return; ==> foo(); return;
-                        if (((in_lambda && ret.length == 0)
-                             || (ret[0] instanceof AST_Return && !ret[0].value))
-                            && !stat.body.value && !stat.alternative) {
-                            CHANGED = true;
-                            var cond = make_node(AST_SimpleStatement, stat.condition, {
-                                body: stat.condition
-                            });
-                            ret.unshift(cond);
-                            continue loop;
-                        }
-                        //---
-                        // if (foo()) return x; return y; ==> return foo() ? x : y;
-                        if (ret[0] instanceof AST_Return && stat.body.value && ret[0].value && !stat.alternative) {
-                            CHANGED = true;
-                            stat = stat.clone();
-                            stat.alternative = ret[0];
-                            ret[0] = stat.transform(compressor);
-                            continue loop;
-                        }
-                        //---
-                        // if (foo()) return x; [ return ; ] ==> return foo() ? x : undefined;
-                        if ((ret.length == 0 || ret[0] instanceof AST_Return) && stat.body.value && !stat.alternative && in_lambda) {
-                            CHANGED = true;
-                            stat = stat.clone();
-                            stat.alternative = ret[0] || make_node(AST_Return, stat, {
-                                value: make_node(AST_Undefined, stat)
-                            });
-                            ret[0] = stat.transform(compressor);
-                            continue loop;
-                        }
-                        //---
-                        // if (foo()) return; [ else x... ]; y... ==> if (!foo()) { x...; y... }
-                        if (!stat.body.value && in_lambda) {
-                            CHANGED = true;
-                            stat = stat.clone();
-                            stat.condition = stat.condition.negate(compressor);
-                            stat.body = make_node(AST_BlockStatement, stat, {
-                                body: as_statement_array(stat.alternative).concat(ret)
-                            });
-                            stat.alternative = null;
-                            ret = [ stat.transform(compressor) ];
-                            continue loop;
-                        }
-                        //---
-                        if (ret.length == 1 && in_lambda && ret[0] instanceof AST_SimpleStatement
-                            && (!stat.alternative || stat.alternative instanceof AST_SimpleStatement)) {
-                            CHANGED = true;
-                            ret.push(make_node(AST_Return, ret[0], {
-                                value: make_node(AST_Undefined, ret[0])
-                            }).transform(compressor));
-                            ret = as_statement_array(stat.alternative).concat(ret);
-                            ret.unshift(stat);
-                            continue loop;
+                var j = next_index(i);
+                var next = statements[j];
+
+                if (in_lambda && declare_only && !next && stat instanceof AST_Return
+                    && drop_return_void && !(self instanceof AST_SwitchBranch)) {
+                    var body = stat.value;
+                    if (!body) {
+                        changed = true;
+                        statements.splice(i, 1);
+                        continue;
+                    }
+                    var tail = body.tail_node();
+                    if (is_undefined(tail)) {
+                        changed = true;
+                        if (body instanceof AST_UnaryPrefix) {
+                            body = body.expression;
+                        } else if (tail instanceof AST_UnaryPrefix) {
+                            body = body.clone();
+                            body.expressions[body.expressions.length - 1] = tail.expression;
                         }
+                        statements[i] = make_node(AST_SimpleStatement, stat, { body: body });
+                        continue;
                     }
+                }
 
+                if (stat instanceof AST_If) {
                     var ab = aborts(stat.body);
-                    var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab.label) : null;
-                    if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda)
-                               || (ab instanceof AST_Continue && self === loop_body(lct))
-                               || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) {
-                        if (ab.label) {
-                            remove(ab.label.thedef.references, ab);
-                        }
-                        CHANGED = true;
-                        var body = as_statement_array(stat.body).slice(0, -1);
+                    // if (foo()) { bar(); return; } else baz(); moo(); ---> if (foo()) bar(); else { baz(); moo(); }
+                    if (can_merge_flow(ab)) {
+                        if (ab.label) remove(ab.label.thedef.references, ab);
+                        changed = true;
                         stat = stat.clone();
-                        stat.condition = stat.condition.negate(compressor);
                         stat.body = make_node(AST_BlockStatement, stat, {
-                            body: as_statement_array(stat.alternative).concat(ret)
+                            body: as_statement_array_with_return(stat.body, ab),
                         });
                         stat.alternative = make_node(AST_BlockStatement, stat, {
-                            body: body
+                            body: as_statement_array(stat.alternative).concat(extract_functions(merge_jump, jump)),
                         });
-                        ret = [ stat.transform(compressor) ];
-                        continue loop;
-                    }
-
-                    var ab = aborts(stat.alternative);
-                    var lct = ab instanceof AST_LoopControl ? compressor.loopcontrol_target(ab.label) : null;
-                    if (ab && ((ab instanceof AST_Return && !ab.value && in_lambda)
-                               || (ab instanceof AST_Continue && self === loop_body(lct))
-                               || (ab instanceof AST_Break && lct instanceof AST_BlockStatement && self === lct))) {
-                        if (ab.label) {
-                            remove(ab.label.thedef.references, ab);
+                        adjust_refs(ab.value, merge_jump);
+                        statements[i] = stat;
+                        statements[i] = stat.transform(compressor);
+                        continue;
+                    }
+                    // if (foo()) { bar(); return x; } return y; ---> if (!foo()) return y; bar(); return x;
+                    if (ab && !stat.alternative && next instanceof AST_Jump) {
+                        var cond = stat.condition;
+                        var preference = i + 1 == j && stat.body instanceof AST_BlockStatement;
+                        cond = best_of_expression(cond, cond.negate(compressor), preference);
+                        if (cond !== stat.condition) {
+                            changed = true;
+                            stat = stat.clone();
+                            stat.condition = cond;
+                            var body = stat.body;
+                            stat.body = make_node(AST_BlockStatement, next, {
+                                body: extract_functions(true, null, j + 1),
+                            });
+                            statements.splice(i, 1, stat, body);
+                            // proceed further only if `TreeWalker.stack` is in a consistent state
+                            //    https://github.com/mishoo/UglifyJS/issues/5595
+                            //    https://github.com/mishoo/UglifyJS/issues/5597
+                            if (!in_lambda || self instanceof AST_Block && self.body === statements) {
+                                statements[i] = stat.transform(compressor);
+                            }
+                            continue;
                         }
-                        CHANGED = true;
+                    }
+                    var alt = aborts(stat.alternative);
+                    // if (foo()) bar(); else { baz(); return; } moo(); ---> if (foo()) { bar(); moo(); } else baz();
+                    if (can_merge_flow(alt)) {
+                        if (alt.label) remove(alt.label.thedef.references, alt);
+                        changed = true;
                         stat = stat.clone();
                         stat.body = make_node(AST_BlockStatement, stat.body, {
-                            body: as_statement_array(stat.body).concat(ret)
+                            body: as_statement_array(stat.body).concat(extract_functions(merge_jump, jump)),
                         });
                         stat.alternative = make_node(AST_BlockStatement, stat.alternative, {
-                            body: as_statement_array(stat.alternative).slice(0, -1)
+                            body: as_statement_array_with_return(stat.alternative, alt),
+                        });
+                        adjust_refs(alt.value, merge_jump);
+                        statements[i] = stat;
+                        statements[i] = stat.transform(compressor);
+                        continue;
+                    }
+                    if (compressor.option("typeofs")) {
+                        if (ab && !alt) {
+                            var stats = make_node(AST_BlockStatement, self, { body: statements.slice(i + 1) });
+                            mark_locally_defined(stat.condition, null, stats);
+                        }
+                        if (!ab && alt) {
+                            var stats = make_node(AST_BlockStatement, self, { body: statements.slice(i + 1) });
+                            mark_locally_defined(stat.condition, stats);
+                        }
+                    }
+                }
+
+                if (stat instanceof AST_If && stat.body instanceof AST_Return) {
+                    var value = stat.body.value;
+                    var in_bool = stat.body.in_bool || next instanceof AST_Return && next.in_bool;
+                    // if (foo()) return x; return y; ---> return foo() ? x : y;
+                    if (!stat.alternative && next instanceof AST_Return
+                        && (drop_return_void || !value == !next.value)) {
+                        changed = true;
+                        stat = stat.clone();
+                        stat.alternative = make_node(AST_BlockStatement, next, {
+                            body: extract_functions(true, null, j + 1),
                         });
-                        ret = [ stat.transform(compressor) ];
-                        continue loop;
+                        statements[i] = stat;
+                        statements[i] = stat.transform(compressor);
+                        continue;
+                    }
+                    // if (foo()) return x; [ return ; ] ---> return foo() ? x : undefined;
+                    // if (foo()) return bar() ? x : void 0; ---> return foo() && bar() ? x : void 0;
+                    // if (foo()) return bar() ? void 0 : x; ---> return !foo() || bar() ? void 0 : x;
+                    if (in_lambda && declare_only && !next && !stat.alternative && (in_bool
+                        || value && multiple_if_returns
+                        || value instanceof AST_Conditional && (is_undefined(value.consequent, compressor)
+                            || is_undefined(value.alternative, compressor)))) {
+                        changed = true;
+                        stat = stat.clone();
+                        stat.alternative = make_node(AST_Return, stat, { value: null });
+                        statements[i] = stat;
+                        statements[i] = stat.transform(compressor);
+                        continue;
+                    }
+                    // if (a) return b; if (c) return d; e; ---> return a ? b : c ? d : void e;
+                    //
+                    // if sequences is not enabled, this can lead to an endless loop (issue #866).
+                    // however, with sequences on this helps producing slightly better output for
+                    // the example code.
+                    var prev, prev_stat;
+                    if (chain_if_returns && !stat.alternative
+                        && (!(prev_stat = statements[prev = prev_index(i)]) && in_iife
+                            || prev_stat instanceof AST_If && prev_stat.body instanceof AST_Return)
+                        && (!next ? !declare_only
+                            : next instanceof AST_SimpleStatement && next_index(j) == statements.length)) {
+                        changed = true;
+                        var exprs = [];
+                        stat = stat.clone();
+                        exprs.push(stat.condition);
+                        stat.condition = make_sequence(stat, exprs);
+                        stat.alternative = make_node(AST_BlockStatement, self, {
+                            body: extract_functions().concat(make_node(AST_Return, self, { value: null })),
+                        });
+                        statements[i] = stat.transform(compressor);
+                        i = prev + 1;
+                        continue;
+                    }
+                }
+
+                if (stat instanceof AST_Break || stat instanceof AST_Exit) {
+                    jump = stat;
+                    continue;
+                }
+
+                if (declare_only && jump && jump === next) eliminate_returns(stat);
+            }
+            return changed;
+
+            function has_multiple_if_returns(statements) {
+                var n = 0;
+                for (var i = statements.length; --i >= 0;) {
+                    var stat = statements[i];
+                    if (stat instanceof AST_If && stat.body instanceof AST_Return) {
+                        if (++n > 1) return true;
+                    }
+                }
+                return false;
+            }
+
+            function match_target(target) {
+                return last_of(compressor, function(node) {
+                    return node === target;
+                });
+            }
+
+            function match_return(ab, exact) {
+                if (!jump) return false;
+                if (jump.TYPE != ab.TYPE) return false;
+                var value = ab.value;
+                if (!value) return false;
+                var equals = jump.equals(ab);
+                if (!equals && value instanceof AST_Sequence) {
+                    value = value.tail_node();
+                    if (jump.value && jump.value.equals(value)) equals = 2;
+                }
+                if (!equals && !exact && jump.value instanceof AST_Sequence) {
+                    if (jump.value.tail_node().equals(value)) equals = 3;
+                }
+                return equals;
+            }
+
+            function can_drop_abort(ab) {
+                if (ab instanceof AST_Exit) {
+                    if (merge_jump = match_return(ab)) return true;
+                    if (!in_lambda) return false;
+                    if (!(ab instanceof AST_Return)) return false;
+                    var value = ab.value;
+                    if (value && !is_undefined(value.tail_node())) return false;
+                    if (!(self instanceof AST_SwitchBranch)) return true;
+                    if (!jump) return false;
+                    if (jump instanceof AST_Exit && jump.value) return false;
+                    merge_jump = 4;
+                    return true;
+                }
+                if (!(ab instanceof AST_LoopControl)) return false;
+                if (self instanceof AST_SwitchBranch) {
+                    if (jump instanceof AST_Exit) {
+                        if (!in_lambda) return false;
+                        if (jump.value) return false;
+                        merge_jump = true;
+                    } else if (jump) {
+                        if (compressor.loopcontrol_target(jump) !== parent) return false;
+                        merge_jump = true;
+                    } else if (jump === false) {
+                        return false;
+                    }
+                }
+                var lct = compressor.loopcontrol_target(ab);
+                if (ab instanceof AST_Continue) return match_target(loop_body(lct));
+                if (lct instanceof AST_IterationStatement) return false;
+                return match_target(lct);
+            }
+
+            function can_merge_flow(ab) {
+                merge_jump = false;
+                if (!can_drop_abort(ab)) return false;
+                for (var j = statements.length; --j > i;) {
+                    var stat = statements[j];
+                    if (stat instanceof AST_DefClass) {
+                        if (stat.name.definition().preinit) return false;
+                    } else if (stat instanceof AST_Const || stat instanceof AST_Let) {
+                        if (!all(stat.definitions, function(defn) {
+                            return !defn.name.match_symbol(function(node) {
+                                return node instanceof AST_SymbolDeclaration && node.definition().preinit;
+                            });
+                        })) return false;
+                    }
+                }
+                return true;
+            }
+
+            function extract_functions(mode, stop, end) {
+                var defuns = [];
+                var lexical = false;
+                var start = i + 1;
+                if (!mode) {
+                    end = statements.length;
+                    jump = null;
+                } else if (stop) {
+                    end = statements.lastIndexOf(stop);
+                } else {
+                    stop = statements[end];
+                    if (stop !== jump) jump = false;
+                }
+                var tail = statements.splice(start, end - start).filter(function(stat) {
+                    if (stat instanceof AST_LambdaDefinition) {
+                        defuns.push(stat);
+                        return false;
                     }
+                    if (is_lexical_definition(stat)) lexical = true;
+                    return true;
+                });
+                if (mode === 3) {
+                    tail.push(make_node(AST_SimpleStatement, stop.value, {
+                        body: make_sequence(stop.value, stop.value.expressions.slice(0, -1)),
+                    }));
+                    stop.value = stop.value.tail_node();
+                }
+                [].push.apply(lexical ? tail : statements, defuns);
+                return tail;
+            }
+
+            function trim_return(value, mode) {
+                if (value) switch (mode) {
+                  case 4:
+                    return value;
+                  case 3:
+                    if (!(value instanceof AST_Sequence)) break;
+                  case 2:
+                    return make_sequence(value, value.expressions.slice(0, -1));
+                }
+            }
 
-                    ret.unshift(stat);
+            function as_statement_array_with_return(node, ab) {
+                var body = as_statement_array(node);
+                var block = body, last;
+                while ((last = block[block.length - 1]) !== ab) {
+                    block = last.body;
+                }
+                block.pop();
+                var value = ab.value;
+                if (merge_jump) value = trim_return(value, merge_jump);
+                if (value) block.push(make_node(AST_SimpleStatement, value, { body: value }));
+                return body;
+            }
+
+            function adjust_refs(value, mode) {
+                if (!mode) return;
+                if (!value) return;
+                switch (mode) {
+                  case 4:
+                    return;
+                  case 3:
+                  case 2:
+                    value = value.tail_node();
+                }
+                merge_expression(value, jump.value);
+            }
+
+            function next_index(i) {
+                declare_only = true;
+                for (var j = i; ++j < statements.length;) {
+                    var stat = statements[j];
+                    if (is_declaration(stat)) continue;
+                    if (stat instanceof AST_Var) {
+                        declare_only = false;
+                        continue;
+                    }
                     break;
-                  default:
-                    ret.unshift(stat);
+                }
+                return j;
+            }
+
+            function prev_index(i) {
+                for (var j = i; --j >= 0;) {
+                    var stat = statements[j];
+                    if (stat instanceof AST_Var) continue;
+                    if (is_declaration(stat)) continue;
                     break;
                 }
+                return j;
             }
-            return ret;
-        };
+
+            function eliminate_returns(stat, keep_throws, in_block) {
+                if (stat instanceof AST_Exit) {
+                    var mode = !(keep_throws && stat instanceof AST_Throw) && match_return(stat, true);
+                    if (mode) {
+                        changed = true;
+                        var value = trim_return(stat.value, mode);
+                        if (value) return make_node(AST_SimpleStatement, value, { body: value });
+                        return in_block ? null : make_node(AST_EmptyStatement, stat);
+                    }
+                } else if (stat instanceof AST_If) {
+                    stat.body = eliminate_returns(stat.body, keep_throws);
+                    if (stat.alternative) stat.alternative = eliminate_returns(stat.alternative, keep_throws);
+                } else if (stat instanceof AST_LabeledStatement) {
+                    stat.body = eliminate_returns(stat.body, keep_throws);
+                } else if (stat instanceof AST_Try) {
+                    if (!stat.bfinally || !jump.value || jump.value.is_constant()) {
+                        if (stat.bcatch) eliminate_returns(stat.bcatch, keep_throws);
+                        var trimmed = eliminate_returns(stat.body.pop(), true, true);
+                        if (trimmed) stat.body.push(trimmed);
+                    }
+                } else if (stat instanceof AST_Block && !(stat instanceof AST_Scope || stat instanceof AST_Switch)) {
+                    var trimmed = eliminate_returns(stat.body.pop(), keep_throws, true);
+                    if (trimmed) stat.body.push(trimmed);
+                }
+                return stat;
+            }
+        }
 
         function eliminate_dead_code(statements, compressor) {
-            var has_quit = false;
-            var orig = statements.length;
+            var has_quit;
             var self = compressor.self();
-            statements = statements.reduce(function(a, stat){
-                if (has_quit) {
-                    extract_declarations_from_unreachable_code(compressor, stat, a);
-                } else {
-                    if (stat instanceof AST_LoopControl) {
-                        var lct = compressor.loopcontrol_target(stat.label);
-                        if ((stat instanceof AST_Break
-                             && lct instanceof AST_BlockStatement
-                             && loop_body(lct) === self) || (stat instanceof AST_Continue
-                                                             && loop_body(lct) === self)) {
-                            if (stat.label) {
-                                remove(stat.label.thedef.references, stat);
-                            }
-                        } else {
-                            a.push(stat);
-                        }
-                    } else {
-                        a.push(stat);
+            if (self instanceof AST_Catch) {
+                self = compressor.parent();
+            } else if (self instanceof AST_LabeledStatement) {
+                self = self.body;
+            }
+            for (var i = 0, n = 0, len = statements.length; i < len; i++) {
+                var stat = statements[i];
+                if (stat instanceof AST_LoopControl) {
+                    var lct = compressor.loopcontrol_target(stat);
+                    if (loop_body(lct) !== self
+                        || stat instanceof AST_Break && lct instanceof AST_IterationStatement) {
+                        statements[n++] = stat;
+                    } else if (stat.label) {
+                        remove(stat.label.thedef.references, stat);
                     }
-                    if (aborts(stat)) has_quit = true;
+                } else {
+                    statements[n++] = stat;
                 }
-                return a;
-            }, []);
-            CHANGED = statements.length != orig;
-            return statements;
-        };
+                if (aborts(stat)) {
+                    has_quit = statements.slice(i + 1);
+                    break;
+                }
+            }
+            statements.length = n;
+            if (has_quit) has_quit.forEach(function(stat) {
+                extract_declarations_from_unreachable_code(compressor, stat, statements);
+            });
+            return statements.length != len;
+        }
+
+        function trim_awaits(statements, compressor) {
+            if (!in_lambda || in_try && in_try.bfinally) return;
+            var changed = false;
+            for (var index = statements.length; --index >= 0;) {
+                var stat = statements[index];
+                if (!(stat instanceof AST_SimpleStatement)) break;
+                var node = stat.body;
+                if (!(node instanceof AST_Await)) break;
+                var exp = node.expression;
+                if (!needs_enqueuing(compressor, exp)) break;
+                changed = true;
+                exp = exp.drop_side_effect_free(compressor, true);
+                if (exp) {
+                    stat.body = exp;
+                    break;
+                }
+            }
+            statements.length = index + 1;
+            return changed;
+        }
+
+        function inline_iife(statements, compressor) {
+            var changed = false;
+            var index = statements.length - 1;
+            if (in_lambda && index >= 0) {
+                var no_return = in_try && in_try.bfinally && in_async_generator(scope);
+                var inlined = statements[index].try_inline(compressor, block_scope, no_return);
+                if (inlined) {
+                    statements[index--] = inlined;
+                    changed = true;
+                }
+            }
+            var loop = in_loop && in_try && in_try.bfinally ? "try" : in_loop;
+            for (; index >= 0; index--) {
+                var inlined = statements[index].try_inline(compressor, block_scope, true, loop);
+                if (!inlined) continue;
+                statements[index] = inlined;
+                changed = true;
+            }
+            return changed;
+        }
 
         function sequencesize(statements, compressor) {
-            if (statements.length < 2) return statements;
-            var seq = [], ret = [];
+            if (statements.length < 2) return;
+            var seq = [], n = 0;
             function push_seq() {
-                seq = AST_Seq.from_array(seq);
-                if (seq) ret.push(make_node(AST_SimpleStatement, seq, {
-                    body: seq
-                }));
+                if (!seq.length) return;
+                var body = make_sequence(seq[0], seq);
+                statements[n++] = make_node(AST_SimpleStatement, body, { body: body });
                 seq = [];
-            };
-            statements.forEach(function(stat){
-                if (stat instanceof AST_SimpleStatement && seq.length < 2000) seq.push(stat.body);
-                else push_seq(), ret.push(stat);
-            });
+            }
+            for (var i = 0, len = statements.length; i < len; i++) {
+                var stat = statements[i];
+                if (stat instanceof AST_SimpleStatement) {
+                    if (seq.length >= compressor.sequences_limit) push_seq();
+                    merge_sequence(seq, stat.body);
+                } else if (is_declaration(stat)) {
+                    statements[n++] = stat;
+                } else {
+                    push_seq();
+                    statements[n++] = stat;
+                }
+            }
             push_seq();
-            ret = sequencesize_2(ret, compressor);
-            CHANGED = ret.length != statements.length;
-            return ret;
-        };
+            statements.length = n;
+            return n != len;
+        }
 
-        function sequencesize_2(statements, compressor) {
-            function cons_seq(right) {
-                ret.pop();
-                var left = prev.body;
-                if (left instanceof AST_Seq) {
-                    left.add(right);
+        function to_simple_statement(block, decls) {
+            if (!(block instanceof AST_BlockStatement)) return block;
+            var stat = null;
+            for (var i = 0; i < block.body.length; i++) {
+                var line = block.body[i];
+                if (line instanceof AST_Var && declarations_only(line)) {
+                    decls.push(line);
+                } else if (stat || is_lexical_definition(line)) {
+                    return false;
                 } else {
-                    left = AST_Seq.cons(left, right);
+                    stat = line;
                 }
-                return left.transform(compressor);
-            };
-            var ret = [], prev = null;
-            statements.forEach(function(stat){
+            }
+            return stat;
+        }
+
+        function sequencesize_2(statements, compressor) {
+            var changed = false, n = 0, prev;
+            for (var i = 0; i < statements.length; i++) {
+                var stat = statements[i];
                 if (prev) {
-                    if (stat instanceof AST_For) {
-                        var opera = {};
-                        try {
-                            prev.body.walk(new TreeWalker(function(node){
-                                if (node instanceof AST_Binary && node.operator == "in")
-                                    throw opera;
+                    if (stat instanceof AST_Exit) {
+                        if (stat.value || !in_async_generator(scope)) {
+                            stat.value = cons_seq(stat.value || make_node(AST_Undefined, stat)).optimize(compressor);
+                        }
+                    } else if (stat instanceof AST_For) {
+                        if (!(stat.init instanceof AST_Definitions)) {
+                            var abort = false;
+                            prev.body.walk(new TreeWalker(function(node) {
+                                if (abort || node instanceof AST_Scope) return true;
+                                if (node instanceof AST_Binary && node.operator == "in") {
+                                    abort = true;
+                                    return true;
+                                }
                             }));
-                            if (stat.init && !(stat.init instanceof AST_Definitions)) {
-                                stat.init = cons_seq(stat.init);
-                            }
-                            else if (!stat.init) {
-                                stat.init = prev.body;
-                                ret.pop();
+                            if (!abort) {
+                                if (stat.init) stat.init = cons_seq(stat.init);
+                                else {
+                                    stat.init = prev.body;
+                                    n--;
+                                    changed = true;
+                                }
                             }
-                        } catch(ex) {
-                            if (ex !== opera) throw ex;
                         }
-                    }
-                    else if (stat instanceof AST_If) {
+                    } else if (stat instanceof AST_ForIn) {
+                        if (!is_lexical_definition(stat.init)) stat.object = cons_seq(stat.object);
+                    } else if (stat instanceof AST_If) {
                         stat.condition = cons_seq(stat.condition);
-                    }
-                    else if (stat instanceof AST_With) {
+                    } else if (stat instanceof AST_Switch) {
                         stat.expression = cons_seq(stat.expression);
-                    }
-                    else if (stat instanceof AST_Exit && stat.value) {
-                        stat.value = cons_seq(stat.value);
-                    }
-                    else if (stat instanceof AST_Exit) {
-                        stat.value = cons_seq(make_node(AST_Undefined, stat));
-                    }
-                    else if (stat instanceof AST_Switch) {
+                    } else if (stat instanceof AST_With) {
                         stat.expression = cons_seq(stat.expression);
                     }
                 }
-                ret.push(stat);
+                if (compressor.option("conditionals") && stat instanceof AST_If) {
+                    var decls = [];
+                    var body = to_simple_statement(stat.body, decls);
+                    var alt = to_simple_statement(stat.alternative, decls);
+                    if (body !== false && alt !== false && decls.length > 0) {
+                        var len = decls.length;
+                        decls.push(make_node(AST_If, stat, {
+                            condition: stat.condition,
+                            body: body || make_node(AST_EmptyStatement, stat.body),
+                            alternative: alt,
+                        }));
+                        decls.unshift(n, 1);
+                        [].splice.apply(statements, decls);
+                        i += len;
+                        n += len + 1;
+                        prev = null;
+                        changed = true;
+                        continue;
+                    }
+                }
+                statements[n++] = stat;
                 prev = stat instanceof AST_SimpleStatement ? stat : null;
-            });
-            return ret;
-        };
+            }
+            statements.length = n;
+            return changed;
+
+            function cons_seq(right) {
+                n--;
+                changed = true;
+                var left = prev.body;
+                return make_sequence(left, [ left, right ]);
+            }
+        }
 
-        function join_consecutive_vars(statements, compressor) {
-            var prev = null;
-            return statements.reduce(function(a, stat){
-                if (stat instanceof AST_Definitions && prev && prev.TYPE == stat.TYPE) {
-                    prev.definitions = prev.definitions.concat(stat.definitions);
-                    CHANGED = true;
-                }
-                else if (stat instanceof AST_For
-                         && prev instanceof AST_Definitions
-                         && (!stat.init || stat.init.TYPE == prev.TYPE)) {
-                    CHANGED = true;
-                    a.pop();
-                    if (stat.init) {
-                        stat.init.definitions = prev.definitions.concat(stat.init.definitions);
-                    } else {
-                        stat.init = prev;
-                    }
-                    a.push(stat);
-                    prev = stat;
-                }
-                else {
-                    prev = stat;
-                    a.push(stat);
+        function extract_exprs(body) {
+            if (body instanceof AST_Assign) return [ body ];
+            if (body instanceof AST_Sequence) return body.expressions.slice();
+        }
+
+        function join_assigns(defn, body, keep) {
+            var exprs = extract_exprs(body);
+            if (!exprs) return;
+            keep = keep || 0;
+            var trimmed = false;
+            for (var i = exprs.length - keep; --i >= 0;) {
+                var expr = exprs[i];
+                if (!can_trim(expr)) continue;
+                var tail;
+                if (expr.left instanceof AST_SymbolRef) {
+                    tail = exprs.slice(i + 1);
+                } else if (expr.left instanceof AST_PropAccess && can_trim(expr.left.expression)) {
+                    tail = exprs.slice(i + 1);
+                    var flattened = expr.clone();
+                    expr = expr.left.expression;
+                    flattened.left = flattened.left.clone();
+                    flattened.left.expression = expr.left.clone();
+                    tail.unshift(flattened);
+                } else {
+                    continue;
                 }
-                return a;
-            }, []);
-        };
+                if (tail.length == 0) continue;
+                if (!trim_assigns(expr.left, expr.right, tail)) continue;
+                trimmed = true;
+                exprs = exprs.slice(0, i).concat(expr, tail);
+            }
+            if (defn instanceof AST_Definitions) {
+                for (var i = defn.definitions.length; --i >= 0;) {
+                    var def = defn.definitions[i];
+                    if (!def.value) continue;
+                    if (trim_assigns(def.name, def.value, exprs)) trimmed = true;
+                    if (merge_conditional_assignments(def, exprs, keep)) trimmed = true;
+                    break;
+                }
+                if (defn instanceof AST_Var && join_var_assign(defn.definitions, exprs, keep)) trimmed = true;
+            }
+            return trimmed && exprs;
 
-        function negate_iifes(statements, compressor) {
-            statements.forEach(function(stat){
-                if (stat instanceof AST_SimpleStatement) {
-                    stat.body = (function transform(thing) {
-                        return thing.transform(new TreeTransformer(function(node){
-                            if (node instanceof AST_Call && node.expression instanceof AST_Function) {
-                                return make_node(AST_UnaryPrefix, node, {
-                                    operator: "!",
-                                    expression: node
-                                });
-                            }
-                            else if (node instanceof AST_Call) {
-                                node.expression = transform(node.expression);
-                            }
-                            else if (node instanceof AST_Seq) {
-                                node.car = transform(node.car);
+            function can_trim(node) {
+                return node instanceof AST_Assign && node.operator == "=";
+            }
+        }
+
+        function merge_assigns(prev, defn) {
+            if (!(prev instanceof AST_SimpleStatement)) return;
+            if (declarations_only(defn)) return;
+            var exprs = extract_exprs(prev.body);
+            if (!exprs) return;
+            var definitions = [];
+            if (!join_var_assign(definitions, exprs.reverse(), 0)) return;
+            defn.definitions = definitions.reverse().concat(defn.definitions);
+            return exprs.reverse();
+        }
+
+        function merge_conditional_assignments(var_def, exprs, keep) {
+            if (!compressor.option("conditionals")) return;
+            if (var_def.name instanceof AST_Destructured) return;
+            var trimmed = false;
+            var def = var_def.name.definition();
+            while (exprs.length > keep) {
+                var cond = to_conditional_assignment(compressor, def, var_def.value, exprs[0]);
+                if (!cond) break;
+                var_def.value = cond;
+                exprs.shift();
+                trimmed = true;
+            }
+            return trimmed;
+        }
+
+        function join_var_assign(definitions, exprs, keep) {
+            var trimmed = false;
+            while (exprs.length > keep) {
+                var expr = exprs[0];
+                if (!(expr instanceof AST_Assign)) break;
+                if (expr.operator != "=") break;
+                var lhs = expr.left;
+                if (!(lhs instanceof AST_SymbolRef)) break;
+                if (is_undeclared_ref(lhs)) break;
+                if (lhs.scope.resolve() !== scope) break;
+                var def = lhs.definition();
+                if (def.scope !== scope) break;
+                if (def.orig.length > def.eliminated + 1) break;
+                if (def.orig[0].TYPE != "SymbolVar") break;
+                var name = make_node(AST_SymbolVar, lhs);
+                definitions.push(make_node(AST_VarDef, expr, {
+                    name: name,
+                    value: expr.right,
+                }));
+                def.orig.push(name);
+                def.replaced++;
+                exprs.shift();
+                trimmed = true;
+            }
+            return trimmed;
+        }
+
+        function trim_assigns(name, value, exprs) {
+            var names = new Dictionary();
+            names.set(name.name, true);
+            while (value instanceof AST_Assign && value.operator == "=") {
+                if (value.left instanceof AST_SymbolRef) names.set(value.left.name, true);
+                value = value.right;
+            }
+            if (!(value instanceof AST_Object)) return;
+            var trimmed = false;
+            do {
+                if (!try_join(exprs[0])) break;
+                exprs.shift();
+                trimmed = true;
+            } while (exprs.length);
+            return trimmed;
+
+            function try_join(node) {
+                if (!(node instanceof AST_Assign)) return;
+                if (node.operator != "=") return;
+                if (!(node.left instanceof AST_PropAccess)) return;
+                var sym = node.left.expression;
+                if (!(sym instanceof AST_SymbolRef)) return;
+                if (!names.has(sym.name)) return;
+                if (!node.right.is_constant_expression(scope)) return;
+                var prop = node.left.property;
+                if (prop instanceof AST_Node) {
+                    if (try_join(prop)) prop = node.left.property = prop.right.clone();
+                    prop = prop.evaluate(compressor);
+                }
+                if (prop instanceof AST_Node) return;
+                prop = "" + prop;
+                var diff = prop == "__proto__" || compressor.has_directive("use strict") ? function(node) {
+                    var key = node.key;
+                    return typeof key == "string" && key != prop && key != "__proto__";
+                } : function(node) {
+                    var key = node.key;
+                    if (node instanceof AST_ObjectGetter || node instanceof AST_ObjectSetter) {
+                        return typeof key == "string" && key != prop;
+                    }
+                    return key !== "__proto__";
+                };
+                if (!all(value.properties, diff)) return;
+                value.properties.push(make_node(AST_ObjectKeyVal, node, {
+                    key: prop,
+                    value: node.right,
+                }));
+                return true;
+            }
+        }
+
+        function join_consecutive_vars(statements) {
+            var changed = false, defs;
+            for (var i = 0, j = -1; i < statements.length; i++) {
+                var stat = statements[i];
+                var prev = statements[j];
+                if (stat instanceof AST_Definitions) {
+                    if (prev && prev.TYPE == stat.TYPE) {
+                        prev.definitions = prev.definitions.concat(stat.definitions);
+                        changed = true;
+                    } else if (defs && defs.TYPE == stat.TYPE && declarations_only(stat)) {
+                        defs.definitions = defs.definitions.concat(stat.definitions);
+                        changed = true;
+                    } else if (stat instanceof AST_Var) {
+                        var exprs = merge_assigns(prev, stat);
+                        if (exprs) {
+                            if (exprs.length) {
+                                prev.body = make_sequence(prev, exprs);
+                                j++;
                             }
-                            else if (node instanceof AST_Conditional) {
-                                var expr = transform(node.condition);
-                                if (expr !== node.condition) {
-                                    // it has been negated, reverse
-                                    node.condition = expr;
-                                    var tmp = node.consequent;
-                                    node.consequent = node.alternative;
-                                    node.alternative = tmp;
-                                }
+                            changed = true;
+                        } else {
+                            j++;
+                        }
+                        statements[j] = defs = stat;
+                    } else {
+                        statements[++j] = stat;
+                    }
+                    continue;
+                } else if (stat instanceof AST_Exit) {
+                    stat.value = join_assigns_expr(stat.value);
+                } else if (stat instanceof AST_For) {
+                    var exprs = join_assigns(prev, stat.init);
+                    if (exprs) {
+                        changed = true;
+                        stat.init = exprs.length ? make_sequence(stat.init, exprs) : null;
+                    } else if (prev instanceof AST_Var && (!stat.init || stat.init.TYPE == prev.TYPE)) {
+                        if (stat.init) {
+                            prev.definitions = prev.definitions.concat(stat.init.definitions);
+                        }
+                        stat = stat.clone();
+                        defs = stat.init = prev;
+                        statements[j] = merge_defns(stat);
+                        changed = true;
+                        continue;
+                    } else if (defs && stat.init && defs.TYPE == stat.init.TYPE && declarations_only(stat.init)) {
+                        defs.definitions = defs.definitions.concat(stat.init.definitions);
+                        stat.init = null;
+                        changed = true;
+                    } else if (stat.init instanceof AST_Var) {
+                        defs = stat.init;
+                        exprs = merge_assigns(prev, stat.init);
+                        if (exprs) {
+                            changed = true;
+                            if (exprs.length == 0) {
+                                statements[j] = merge_defns(stat);
+                                continue;
                             }
-                            return node;
-                        }));
-                    })(stat.body);
-                }
-            });
-        };
-
-    };
+                            prev.body = make_sequence(prev, exprs);
+                        }
+                    }
+                } else if (stat instanceof AST_ForEnumeration) {
+                    if (defs && defs.TYPE == stat.init.TYPE) {
+                        var defns = defs.definitions.slice();
+                        stat.init = stat.init.definitions[0].name.convert_symbol(AST_SymbolRef, function(ref, name) {
+                            defns.push(make_node(AST_VarDef, name, {
+                                name: name,
+                                value: null,
+                            }));
+                            name.definition().references.push(ref);
+                        });
+                        defs.definitions = defns;
+                        changed = true;
+                    }
+                    stat.object = join_assigns_expr(stat.object);
+                } else if (stat instanceof AST_If) {
+                    stat.condition = join_assigns_expr(stat.condition);
+                } else if (stat instanceof AST_SimpleStatement) {
+                    var exprs = join_assigns(prev, stat.body), next;
+                    if (exprs) {
+                        changed = true;
+                        if (!exprs.length) continue;
+                        stat.body = make_sequence(stat.body, exprs);
+                    } else if (prev instanceof AST_Definitions
+                        && (next = statements[i + 1])
+                        && prev.TYPE == next.TYPE
+                        && (next = next.definitions[0]).value) {
+                        changed = true;
+                        next.value = make_sequence(stat, [ stat.body, next.value ]);
+                        continue;
+                    }
+                } else if (stat instanceof AST_Switch) {
+                    stat.expression = join_assigns_expr(stat.expression);
+                } else if (stat instanceof AST_With) {
+                    stat.expression = join_assigns_expr(stat.expression);
+                }
+                statements[++j] = defs ? merge_defns(stat) : stat;
+            }
+            statements.length = j + 1;
+            return changed;
+
+            function join_assigns_expr(value) {
+                var exprs = join_assigns(prev, value, 1);
+                if (!exprs) return value;
+                changed = true;
+                var tail = value.tail_node();
+                if (exprs[exprs.length - 1] !== tail) exprs.push(tail.left);
+                return make_sequence(value, exprs);
+            }
+
+            function merge_defns(stat) {
+                return stat.transform(new TreeTransformer(function(node, descend, in_list) {
+                    if (node instanceof AST_Definitions) {
+                        if (defs === node) return node;
+                        if (defs.TYPE != node.TYPE) return node;
+                        var parent = this.parent();
+                        if (parent instanceof AST_ForEnumeration && parent.init === node) return node;
+                        if (!declarations_only(node)) return node;
+                        defs.definitions = defs.definitions.concat(node.definitions);
+                        changed = true;
+                        if (parent instanceof AST_For && parent.init === node) return null;
+                        return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+                    }
+                    if (node instanceof AST_ExportDeclaration) return node;
+                    if (node instanceof AST_Scope) return node;
+                    if (!is_statement(node)) return node;
+                }));
+            }
+        }
+    }
 
     function extract_declarations_from_unreachable_code(compressor, stat, target) {
-        compressor.warn("Dropping unreachable code [{file}:{line},{col}]", stat.start);
-        stat.walk(new TreeWalker(function(node){
+        var block;
+        var dropped = false;
+        stat.walk(new TreeWalker(function(node, descend) {
+            if (node instanceof AST_DefClass) {
+                node.extends = null;
+                node.properties = [];
+                push(node);
+                return true;
+            }
             if (node instanceof AST_Definitions) {
-                compressor.warn("Declarations in unreachable code! [{file}:{line},{col}]", node.start);
-                node.remove_initializers();
-                target.push(node);
+                var defns = [];
+                if (node.remove_initializers(compressor, defns)) {
+                    AST_Node.warn("Dropping initialization in unreachable code [{start}]", node);
+                }
+                if (defns.length > 0) {
+                    node.definitions = defns;
+                    push(node);
+                }
                 return true;
             }
-            if (node instanceof AST_Defun) {
-                target.push(node);
+            if (node instanceof AST_LambdaDefinition) {
+                push(node);
                 return true;
             }
-            if (node instanceof AST_Scope) {
+            if (node instanceof AST_Scope) return true;
+            if (node instanceof AST_BlockScope) {
+                var save = block;
+                block = [];
+                descend();
+                if (block.required) {
+                    target.push(make_node(AST_BlockStatement, stat, { body: block }));
+                } else if (block.length) {
+                    [].push.apply(target, block);
+                }
+                block = save;
                 return true;
             }
+            if (!(node instanceof AST_LoopControl)) dropped = true;
         }));
-    };
+        if (dropped) AST_Node.warn("Dropping unreachable code [{start}]", stat);
+
+        function push(node) {
+            if (block) {
+                block.push(node);
+                if (!safe_to_trim(node)) block.required = true;
+            } else {
+                target.push(node);
+            }
+        }
+    }
+
+    function is_undefined(node, compressor) {
+        return node == null
+            || node.is_undefined
+            || node instanceof AST_Undefined
+            || node instanceof AST_UnaryPrefix
+                && node.operator == "void"
+                && !(compressor && node.expression.has_side_effects(compressor));
+    }
+
+    // in_strict_mode()
+    // return true if scope executes in Strict Mode
+    (function(def) {
+        def(AST_Class, return_true);
+        def(AST_Scope, function(compressor) {
+            var body = this.body;
+            for (var i = 0; i < body.length; i++) {
+                var stat = body[i];
+                if (!(stat instanceof AST_Directive)) break;
+                if (stat.value == "use strict") return true;
+            }
+            var parent = this.parent_scope;
+            if (!parent) return compressor.option("module");
+            return parent.resolve(true).in_strict_mode(compressor);
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("in_strict_mode", func);
+    });
+
+    // is_truthy()
+    // return true if `!!node === true`
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Array, return_true);
+        def(AST_Assign, function() {
+            return this.operator == "=" && this.right.is_truthy();
+        });
+        def(AST_Lambda, return_true);
+        def(AST_Object, return_true);
+        def(AST_RegExp, return_true);
+        def(AST_Sequence, function() {
+            return this.tail_node().is_truthy();
+        });
+        def(AST_SymbolRef, function() {
+            var fixed = this.fixed_value();
+            if (!fixed) return false;
+            this.is_truthy = return_false;
+            var result = fixed.is_truthy();
+            delete this.is_truthy;
+            return result;
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("is_truthy", func);
+    });
+
+    // is_negative_zero()
+    // return true if the node may represent -0
+    (function(def) {
+        def(AST_Node, return_true);
+        def(AST_Array, return_false);
+        function binary(op, left, right) {
+            switch (op) {
+              case "-":
+                return left.is_negative_zero()
+                    && (!(right instanceof AST_Constant) || right.value == 0);
+              case "&&":
+              case "||":
+                return left.is_negative_zero() || right.is_negative_zero();
+              case "*":
+              case "/":
+              case "%":
+              case "**":
+                return true;
+              default:
+                return false;
+            }
+        }
+        def(AST_Assign, function() {
+            var op = this.operator;
+            if (op == "=") return this.right.is_negative_zero();
+            return binary(op.slice(0, -1), this.left, this.right);
+        });
+        def(AST_Binary, function() {
+            return binary(this.operator, this.left, this.right);
+        });
+        def(AST_Constant, function() {
+            return this.value == 0 && 1 / this.value < 0;
+        });
+        def(AST_Lambda, return_false);
+        def(AST_Object, return_false);
+        def(AST_RegExp, return_false);
+        def(AST_Sequence, function() {
+            return this.tail_node().is_negative_zero();
+        });
+        def(AST_SymbolRef, function() {
+            var fixed = this.fixed_value();
+            if (!fixed) return true;
+            this.is_negative_zero = return_true;
+            var result = fixed.is_negative_zero();
+            delete this.is_negative_zero;
+            return result;
+        });
+        def(AST_UnaryPrefix, function() {
+            return this.operator == "+" && this.expression.is_negative_zero()
+                || this.operator == "-";
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("is_negative_zero", func);
+    });
+
+    // may_throw_on_access()
+    // returns true if this node may be null, undefined or contain `AST_Accessor`
+    (function(def) {
+        AST_Node.DEFMETHOD("may_throw_on_access", function(compressor, force) {
+            return !compressor.option("pure_getters") || this._dot_throw(compressor, force);
+        });
+        function is_strict(compressor, force) {
+            return force || /strict/.test(compressor.option("pure_getters"));
+        }
+        def(AST_Node, is_strict);
+        def(AST_Array, return_false);
+        def(AST_Assign, function(compressor) {
+            var op = this.operator;
+            var sym = this.left;
+            var rhs = this.right;
+            if (op != "=") {
+                return lazy_op[op.slice(0, -1)] && (sym._dot_throw(compressor) || rhs._dot_throw(compressor));
+            }
+            if (!rhs._dot_throw(compressor)) return false;
+            if (!(sym instanceof AST_SymbolRef)) return true;
+            if (rhs instanceof AST_Binary && rhs.operator == "||" && sym.name == rhs.left.name) {
+                return rhs.right._dot_throw(compressor);
+            }
+            return true;
+        });
+        def(AST_Binary, function(compressor) {
+            return lazy_op[this.operator] && (this.left._dot_throw(compressor) || this.right._dot_throw(compressor));
+        });
+        def(AST_Class, function(compressor, force) {
+            return is_strict(compressor, force) && !all(this.properties, function(prop) {
+                if (prop.private) return true;
+                if (!prop.static) return true;
+                return !(prop instanceof AST_ClassGetter || prop instanceof AST_ClassSetter);
+            });
+        });
+        def(AST_Conditional, function(compressor) {
+            return this.consequent._dot_throw(compressor) || this.alternative._dot_throw(compressor);
+        });
+        def(AST_Constant, return_false);
+        def(AST_Dot, function(compressor, force) {
+            if (!is_strict(compressor, force)) return false;
+            var exp = this.expression;
+            if (exp instanceof AST_SymbolRef) exp = exp.fixed_value();
+            return !(this.property == "prototype" && is_lambda(exp));
+        });
+        def(AST_Lambda, return_false);
+        def(AST_Null, return_true);
+        def(AST_Object, function(compressor, force) {
+            return is_strict(compressor, force) && !all(this.properties, function(prop) {
+                if (prop instanceof AST_ObjectGetter || prop instanceof AST_ObjectSetter) return false;
+                return !(prop.key === "__proto__" && prop.value._dot_throw(compressor, force));
+            });
+        });
+        def(AST_ObjectIdentity, function(compressor, force) {
+            return is_strict(compressor, force) && !this.scope.resolve().new;
+        });
+        def(AST_Sequence, function(compressor) {
+            return this.tail_node()._dot_throw(compressor);
+        });
+        def(AST_SymbolRef, function(compressor, force) {
+            if (this.is_undefined) return true;
+            if (!is_strict(compressor, force)) return false;
+            if (is_undeclared_ref(this) && this.is_declared(compressor)) return false;
+            if (this.is_immutable()) return false;
+            var def = this.definition();
+            if (is_arguments(def) && !def.scope.rest && all(def.scope.argnames, function(argname) {
+                return argname instanceof AST_SymbolFunarg;
+            })) return def.scope.uses_arguments > 2;
+            var fixed = this.fixed_value(true);
+            if (!fixed) return true;
+            this._dot_throw = return_true;
+            if (fixed._dot_throw(compressor)) {
+                delete this._dot_throw;
+                return true;
+            }
+            this._dot_throw = return_false;
+            return false;
+        });
+        def(AST_UnaryPrefix, function() {
+            return this.operator == "void";
+        });
+        def(AST_UnaryPostfix, return_false);
+        def(AST_Undefined, return_true);
+    })(function(node, func) {
+        node.DEFMETHOD("_dot_throw", func);
+    });
+
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Array, return_true);
+        function is_binary_defined(compressor, op, node) {
+            switch (op) {
+              case "&&":
+                return node.left.is_defined(compressor) && node.right.is_defined(compressor);
+              case "||":
+                return node.left.is_truthy() || node.right.is_defined(compressor);
+              case "??":
+                return node.left.is_defined(compressor) || node.right.is_defined(compressor);
+              default:
+                return true;
+            }
+        }
+        def(AST_Assign, function(compressor) {
+            var op = this.operator;
+            if (op == "=") return this.right.is_defined(compressor);
+            return is_binary_defined(compressor, op.slice(0, -1), this);
+        });
+        def(AST_Binary, function(compressor) {
+            return is_binary_defined(compressor, this.operator, this);
+        });
+        def(AST_Conditional, function(compressor) {
+            return this.consequent.is_defined(compressor) && this.alternative.is_defined(compressor);
+        });
+        def(AST_Constant, return_true);
+        def(AST_Hole, return_false);
+        def(AST_Lambda, return_true);
+        def(AST_Object, return_true);
+        def(AST_Sequence, function(compressor) {
+            return this.tail_node().is_defined(compressor);
+        });
+        def(AST_SymbolRef, function(compressor) {
+            if (this.is_undefined) return false;
+            if (is_undeclared_ref(this) && this.is_declared(compressor)) return true;
+            if (this.is_immutable()) return true;
+            var fixed = this.fixed_value();
+            if (!fixed) return false;
+            this.is_defined = return_false;
+            var result = fixed.is_defined(compressor);
+            delete this.is_defined;
+            return result;
+        });
+        def(AST_UnaryPrefix, function() {
+            return this.operator != "void";
+        });
+        def(AST_UnaryPostfix, return_true);
+        def(AST_Undefined, return_false);
+    })(function(node, func) {
+        node.DEFMETHOD("is_defined", func);
+    });
 
     /* -----[ boolean/negation helpers ]----- */
 
     // methods to determine whether an expression has a boolean result type
-    (function (def){
-        var unary_bool = [ "!", "delete" ];
-        var binary_bool = [ "in", "instanceof", "==", "!=", "===", "!==", "<", "<=", ">=", ">" ];
-        def(AST_Node, function(){ return false });
-        def(AST_UnaryPrefix, function(){
-            return member(this.operator, unary_bool);
-        });
-        def(AST_Binary, function(){
-            return member(this.operator, binary_bool) ||
-                ( (this.operator == "&&" || this.operator == "||") &&
-                  this.left.is_boolean() && this.right.is_boolean() );
-        });
-        def(AST_Conditional, function(){
-            return this.consequent.is_boolean() && this.alternative.is_boolean();
-        });
-        def(AST_Assign, function(){
-            return this.operator == "=" && this.right.is_boolean();
-        });
-        def(AST_Seq, function(){
-            return this.cdr.is_boolean();
-        });
-        def(AST_True, function(){ return true });
-        def(AST_False, function(){ return true });
-    })(function(node, func){
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Assign, function(compressor) {
+            return this.operator == "=" && this.right.is_boolean(compressor);
+        });
+        var binary = makePredicate("in instanceof == != === !== < <= >= >");
+        def(AST_Binary, function(compressor) {
+            return binary[this.operator] || lazy_op[this.operator]
+                && this.left.is_boolean(compressor)
+                && this.right.is_boolean(compressor);
+        });
+        def(AST_Boolean, return_true);
+        var fn = makePredicate("every hasOwnProperty isPrototypeOf propertyIsEnumerable some");
+        def(AST_Call, function(compressor) {
+            if (!compressor.option("unsafe")) return false;
+            var exp = this.expression;
+            return exp instanceof AST_Dot && (fn[exp.property]
+                || exp.property == "test" && exp.expression instanceof AST_RegExp);
+        });
+        def(AST_Conditional, function(compressor) {
+            return this.consequent.is_boolean(compressor) && this.alternative.is_boolean(compressor);
+        });
+        def(AST_New, return_false);
+        def(AST_Sequence, function(compressor) {
+            return this.tail_node().is_boolean(compressor);
+        });
+        def(AST_SymbolRef, function(compressor) {
+            var fixed = this.fixed_value();
+            if (!fixed) return false;
+            this.is_boolean = return_false;
+            var result = fixed.is_boolean(compressor);
+            delete this.is_boolean;
+            return result;
+        });
+        var unary = makePredicate("! delete");
+        def(AST_UnaryPrefix, function() {
+            return unary[this.operator];
+        });
+    })(function(node, func) {
         node.DEFMETHOD("is_boolean", func);
     });
 
+    // methods to determine if an expression has a numeric result type
+    (function(def) {
+        def(AST_Node, return_false);
+        var binary = makePredicate("- * / % ** & | ^ << >> >>>");
+        def(AST_Assign, function(compressor) {
+            return binary[this.operator.slice(0, -1)]
+                || this.operator == "=" && this.right.is_number(compressor);
+        });
+        def(AST_Binary, function(compressor) {
+            if (binary[this.operator]) return true;
+            if (this.operator != "+") return false;
+            return (this.left.is_boolean(compressor) || this.left.is_number(compressor))
+                && (this.right.is_boolean(compressor) || this.right.is_number(compressor));
+        });
+        var fn = makePredicate([
+            "charCodeAt",
+            "getDate",
+            "getDay",
+            "getFullYear",
+            "getHours",
+            "getMilliseconds",
+            "getMinutes",
+            "getMonth",
+            "getSeconds",
+            "getTime",
+            "getTimezoneOffset",
+            "getUTCDate",
+            "getUTCDay",
+            "getUTCFullYear",
+            "getUTCHours",
+            "getUTCMilliseconds",
+            "getUTCMinutes",
+            "getUTCMonth",
+            "getUTCSeconds",
+            "getYear",
+            "indexOf",
+            "lastIndexOf",
+            "localeCompare",
+            "push",
+            "search",
+            "setDate",
+            "setFullYear",
+            "setHours",
+            "setMilliseconds",
+            "setMinutes",
+            "setMonth",
+            "setSeconds",
+            "setTime",
+            "setUTCDate",
+            "setUTCFullYear",
+            "setUTCHours",
+            "setUTCMilliseconds",
+            "setUTCMinutes",
+            "setUTCMonth",
+            "setUTCSeconds",
+            "setYear",
+        ]);
+        def(AST_Call, function(compressor) {
+            if (!compressor.option("unsafe")) return false;
+            var exp = this.expression;
+            return exp instanceof AST_Dot && (fn[exp.property]
+                || is_undeclared_ref(exp.expression) && exp.expression.name == "Math");
+        });
+        def(AST_Conditional, function(compressor) {
+            return this.consequent.is_number(compressor) && this.alternative.is_number(compressor);
+        });
+        def(AST_New, return_false);
+        def(AST_Number, return_true);
+        def(AST_Sequence, function(compressor) {
+            return this.tail_node().is_number(compressor);
+        });
+        def(AST_SymbolRef, function(compressor, keep_unary) {
+            var fixed = this.fixed_value();
+            if (!fixed) return false;
+            if (keep_unary
+                && fixed instanceof AST_UnaryPrefix
+                && fixed.operator == "+"
+                && fixed.expression.equals(this)) {
+                return false;
+            }
+            this.is_number = return_false;
+            var result = fixed.is_number(compressor);
+            delete this.is_number;
+            return result;
+        });
+        var unary = makePredicate("+ - ~ ++ --");
+        def(AST_Unary, function() {
+            return unary[this.operator];
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("is_number", func);
+    });
+
     // methods to determine if an expression has a string result type
-    (function (def){
-        def(AST_Node, function(){ return false });
-        def(AST_String, function(){ return true });
-        def(AST_UnaryPrefix, function(){
-            return this.operator == "typeof";
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Assign, function(compressor) {
+            switch (this.operator) {
+              case "+=":
+                if (this.left.is_string(compressor)) return true;
+              case "=":
+                return this.right.is_string(compressor);
+            }
         });
-        def(AST_Binary, function(compressor){
+        def(AST_Binary, function(compressor) {
             return this.operator == "+" &&
                 (this.left.is_string(compressor) || this.right.is_string(compressor));
         });
-        def(AST_Assign, function(compressor){
-            return (this.operator == "=" || this.operator == "+=") && this.right.is_string(compressor);
-        });
-        def(AST_Seq, function(compressor){
-            return this.cdr.is_string(compressor);
+        var fn = makePredicate([
+            "charAt",
+            "substr",
+            "substring",
+            "toExponential",
+            "toFixed",
+            "toLowerCase",
+            "toPrecision",
+            "toString",
+            "toUpperCase",
+            "trim",
+        ]);
+        def(AST_Call, function(compressor) {
+            if (!compressor.option("unsafe")) return false;
+            var exp = this.expression;
+            return exp instanceof AST_Dot && fn[exp.property];
         });
-        def(AST_Conditional, function(compressor){
+        def(AST_Conditional, function(compressor) {
             return this.consequent.is_string(compressor) && this.alternative.is_string(compressor);
         });
-        def(AST_Call, function(compressor){
-            return compressor.option("unsafe")
-                && this.expression instanceof AST_SymbolRef
-                && this.expression.name == "String"
-                && this.expression.undeclared();
+        def(AST_Sequence, function(compressor) {
+            return this.tail_node().is_string(compressor);
+        });
+        def(AST_String, return_true);
+        def(AST_SymbolRef, function(compressor) {
+            var fixed = this.fixed_value();
+            if (!fixed) return false;
+            this.is_string = return_false;
+            var result = fixed.is_string(compressor);
+            delete this.is_string;
+            return result;
+        });
+        def(AST_Template, function(compressor) {
+            return !this.tag || is_raw_tag(compressor, this.tag);
         });
-    })(function(node, func){
+        def(AST_UnaryPrefix, function() {
+            return this.operator == "typeof";
+        });
+    })(function(node, func) {
         node.DEFMETHOD("is_string", func);
     });
 
-    function best_of(ast1, ast2) {
-        return ast1.print_to_string().length >
-            ast2.print_to_string().length
-            ? ast2 : ast1;
-    };
+    var lazy_op = makePredicate("&& || ??");
 
-    // methods to evaluate a constant expression
-    (function (def){
-        // The evaluate method returns an array with one or two
-        // elements.  If the node has been successfully reduced to a
-        // constant, then the second element tells us the value;
-        // otherwise the second element is missing.  The first element
-        // of the array is always an AST_Node descendant; if
-        // evaluation was successful it's a node that represents the
-        // constant; otherwise it's the original or a replacement node.
-        AST_Node.DEFMETHOD("evaluate", function(compressor){
-            if (!compressor.option("evaluate")) return [ this ];
-            try {
-                var val = this._eval(compressor);
-                return [ best_of(make_node_from_constant(compressor, val, this), this), val ];
-            } catch(ex) {
-                if (ex !== def) throw ex;
-                return [ this ];
-            }
-        });
-        def(AST_Statement, function(){
-            throw new Error(string_template("Cannot evaluate a statement [{file}:{line},{col}]", this.start));
-        });
-        def(AST_Function, function(){
-            // XXX: AST_Function inherits from AST_Scope, which itself
-            // inherits from AST_Statement; however, an AST_Function
-            // isn't really a statement.  This could byte in other
-            // places too. :-( Wish JS had multiple inheritance.
-            throw def;
+    (function(def) {
+        function to_node(value, orig) {
+            if (value instanceof AST_Node) return value.clone(true);
+            if (Array.isArray(value)) return make_node(AST_Array, orig, {
+                elements: value.map(function(value) {
+                    return to_node(value, orig);
+                })
+            });
+            if (value && typeof value == "object") {
+                var props = [];
+                for (var key in value) if (HOP(value, key)) {
+                    props.push(make_node(AST_ObjectKeyVal, orig, {
+                        key: key,
+                        value: to_node(value[key], orig),
+                    }));
+                }
+                return make_node(AST_Object, orig, { properties: props });
+            }
+            return make_node_from_constant(value, orig);
+        }
+
+        function warn(node) {
+            AST_Node.warn("global_defs {this} redefined [{start}]", node);
+        }
+
+        AST_Toplevel.DEFMETHOD("resolve_defines", function(compressor) {
+            if (!compressor.option("global_defs")) return this;
+            this.figure_out_scope({ ie: compressor.option("ie") });
+            return this.transform(new TreeTransformer(function(node) {
+                var def = node._find_defs(compressor, "");
+                if (!def) return;
+                var level = 0, child = node, parent;
+                while (parent = this.parent(level++)) {
+                    if (!(parent instanceof AST_PropAccess)) break;
+                    if (parent.expression !== child) break;
+                    child = parent;
+                }
+                if (is_lhs(child, parent)) {
+                    warn(node);
+                    return;
+                }
+                return def;
+            }));
+        });
+        def(AST_Node, noop);
+        def(AST_Dot, function(compressor, suffix) {
+            return this.expression._find_defs(compressor, "." + this.property + suffix);
+        });
+        def(AST_SymbolDeclaration, function(compressor) {
+            if (!this.definition().global) return;
+            if (HOP(compressor.option("global_defs"), this.name)) warn(this);
+        });
+        def(AST_SymbolRef, function(compressor, suffix) {
+            if (!this.definition().global) return;
+            var defines = compressor.option("global_defs");
+            var name = this.name + suffix;
+            if (HOP(defines, name)) return to_node(defines[name], this);
         });
-        function ev(node, compressor) {
-            if (!compressor) throw new Error("Compressor must be passed");
+    })(function(node, func) {
+        node.DEFMETHOD("_find_defs", func);
+    });
 
-            return node._eval(compressor);
-        };
-        def(AST_Node, function(){
-            throw def;          // not constant
+    function best_of_expression(ast1, ast2, threshold) {
+        var delta = ast2.print_to_string().length - ast1.print_to_string().length;
+        return delta < (threshold || 0) ? ast2 : ast1;
+    }
+
+    function best_of_statement(ast1, ast2, threshold) {
+        return best_of_expression(make_node(AST_SimpleStatement, ast1, {
+            body: ast1,
+        }), make_node(AST_SimpleStatement, ast2, {
+            body: ast2,
+        }), threshold).body;
+    }
+
+    function best_of(compressor, ast1, ast2, threshold) {
+        return (first_in_statement(compressor) ? best_of_statement : best_of_expression)(ast1, ast2, threshold);
+    }
+
+    function convert_to_predicate(obj) {
+        var map = Object.create(null);
+        Object.keys(obj).forEach(function(key) {
+            map[key] = makePredicate(obj[key]);
         });
-        def(AST_Constant, function(){
-            return this.getValue();
+        return map;
+    }
+
+    function skip_directives(body) {
+        for (var i = 0; i < body.length; i++) {
+            var stat = body[i];
+            if (!(stat instanceof AST_Directive)) return stat;
+        }
+    }
+
+    function arrow_first_statement() {
+        if (this.value) return make_node(AST_Return, this.value, { value: this.value });
+        return skip_directives(this.body);
+    }
+    AST_Arrow.DEFMETHOD("first_statement", arrow_first_statement);
+    AST_AsyncArrow.DEFMETHOD("first_statement", arrow_first_statement);
+    AST_Lambda.DEFMETHOD("first_statement", function() {
+        return skip_directives(this.body);
+    });
+
+    AST_Lambda.DEFMETHOD("length", function() {
+        var argnames = this.argnames;
+        for (var i = 0; i < argnames.length; i++) {
+            if (argnames[i] instanceof AST_DefaultValue) break;
+        }
+        return i;
+    });
+
+    function try_evaluate(compressor, node) {
+        var ev = node.evaluate(compressor);
+        if (ev === node) return node;
+        ev = make_node_from_constant(ev, node).optimize(compressor);
+        return best_of(compressor, node, ev, compressor.eval_threshold);
+    }
+
+    var object_fns = [
+        "constructor",
+        "toString",
+        "valueOf",
+    ];
+    var native_fns = convert_to_predicate({
+        Array: [
+            "indexOf",
+            "join",
+            "lastIndexOf",
+            "slice",
+        ].concat(object_fns),
+        Boolean: object_fns,
+        Function: object_fns,
+        Number: [
+            "toExponential",
+            "toFixed",
+            "toPrecision",
+        ].concat(object_fns),
+        Object: object_fns,
+        RegExp: [
+            "exec",
+            "test",
+        ].concat(object_fns),
+        String: [
+            "charAt",
+            "charCodeAt",
+            "concat",
+            "indexOf",
+            "italics",
+            "lastIndexOf",
+            "match",
+            "replace",
+            "search",
+            "slice",
+            "split",
+            "substr",
+            "substring",
+            "toLowerCase",
+            "toUpperCase",
+            "trim",
+        ].concat(object_fns),
+    });
+    var static_fns = convert_to_predicate({
+        Array: [
+            "isArray",
+        ],
+        Math: [
+            "abs",
+            "acos",
+            "asin",
+            "atan",
+            "ceil",
+            "cos",
+            "exp",
+            "floor",
+            "log",
+            "round",
+            "sin",
+            "sqrt",
+            "tan",
+            "atan2",
+            "pow",
+            "max",
+            "min",
+        ],
+        Number: [
+            "isFinite",
+            "isNaN",
+        ],
+        Object: [
+            "create",
+            "getOwnPropertyDescriptor",
+            "getOwnPropertyNames",
+            "getPrototypeOf",
+            "isExtensible",
+            "isFrozen",
+            "isSealed",
+            "keys",
+        ],
+        String: [
+            "fromCharCode",
+            "raw",
+        ],
+    });
+
+    function is_static_fn(node) {
+        if (!(node instanceof AST_Dot)) return false;
+        var expr = node.expression;
+        if (!is_undeclared_ref(expr)) return false;
+        var static_fn = static_fns[expr.name];
+        return static_fn && (static_fn[node.property] || expr.name == "Math" && node.property == "random");
+    }
+
+    // Accommodate when compress option evaluate=false
+    // as well as the common constant expressions !0 and -1
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Constant, return_true);
+        def(AST_RegExp, return_false);
+        var unaryPrefix = makePredicate("! ~ - + void");
+        def(AST_UnaryPrefix, function() {
+            return unaryPrefix[this.operator] && this.expression instanceof AST_Constant;
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("is_constant", func);
+    });
+
+    // methods to evaluate a constant expression
+    (function(def) {
+        // If the node has been successfully reduced to a constant,
+        // then its value is returned; otherwise the element itself
+        // is returned.
+        //
+        // They can be distinguished as constant value is never a
+        // descendant of AST_Node.
+        //
+        // When `ignore_side_effects` is `true`, inspect the constant value
+        // produced without worrying about any side effects caused by said
+        // expression.
+        AST_Node.DEFMETHOD("evaluate", function(compressor, ignore_side_effects) {
+            if (!compressor.option("evaluate")) return this;
+            var cached = [];
+            var val = this._eval(compressor, ignore_side_effects, cached, 1);
+            cached.forEach(function(node) {
+                delete node._eval;
+            });
+            if (ignore_side_effects) return val;
+            if (!val || val instanceof RegExp) return val;
+            if (typeof val == "function" || typeof val == "object") return this;
+            return val;
+        });
+        var scan_modified = new TreeWalker(function(node) {
+            if (node instanceof AST_Assign) modified(node.left);
+            if (node instanceof AST_ForEnumeration) modified(node.init);
+            if (node instanceof AST_Unary && UNARY_POSTFIX[node.operator]) modified(node.expression);
+        });
+        function modified(node) {
+            if (node instanceof AST_DestructuredArray) {
+                node.elements.forEach(modified);
+            } else if (node instanceof AST_DestructuredObject) {
+                node.properties.forEach(function(prop) {
+                    modified(prop.value);
+                });
+            } else if (node instanceof AST_PropAccess) {
+                modified(node.expression);
+            } else if (node instanceof AST_SymbolRef) {
+                node.definition().references.forEach(function(ref) {
+                    delete ref._eval;
+                });
+            }
+        }
+        def(AST_Statement, function() {
+            throw new Error(string_template("Cannot evaluate a statement [{start}]", this));
+        });
+        def(AST_Accessor, return_this);
+        def(AST_BigInt, return_this);
+        def(AST_Class, return_this);
+        def(AST_Node, return_this);
+        def(AST_Constant, function() {
+            return this.value;
+        });
+        def(AST_Assign, function(compressor, ignore_side_effects, cached, depth) {
+            var lhs = this.left;
+            if (!ignore_side_effects) {
+                if (!(lhs instanceof AST_SymbolRef)) return this;
+                if (!HOP(lhs, "_eval")) {
+                    if (!lhs.fixed) return this;
+                    var def = lhs.definition();
+                    if (!def.fixed) return this;
+                    if (def.undeclared) return this;
+                    if (def.last_ref !== lhs) return this;
+                    if (def.single_use == "m") return this;
+                    if (this.right.has_side_effects(compressor)) return this;
+                }
+            }
+            var op = this.operator;
+            var node;
+            if (!HOP(lhs, "_eval") && lhs instanceof AST_SymbolRef && lhs.fixed && lhs.definition().fixed) {
+                node = lhs;
+            } else if (op == "=") {
+                node = this.right;
+            } else {
+                node = make_node(AST_Binary, this, {
+                    operator: op.slice(0, -1),
+                    left: lhs,
+                    right: this.right,
+                });
+            }
+            lhs.walk(scan_modified);
+            var value = node._eval(compressor, ignore_side_effects, cached, depth);
+            if (typeof value == "object") return this;
+            modified(lhs);
+            return value;
+        });
+        def(AST_Sequence, function(compressor, ignore_side_effects, cached, depth) {
+            if (!ignore_side_effects) return this;
+            var exprs = this.expressions;
+            for (var i = 0, last = exprs.length - 1; i < last; i++) {
+                exprs[i].walk(scan_modified);
+            }
+            var tail = exprs[last];
+            var value = tail._eval(compressor, ignore_side_effects, cached, depth);
+            return value === tail ? this : value;
+        });
+        def(AST_Lambda, function(compressor) {
+            if (compressor.option("unsafe")) {
+                var fn = function() {};
+                fn.node = this;
+                fn.toString = function() {
+                    return "function(){}";
+                };
+                return fn;
+            }
+            return this;
+        });
+        def(AST_Array, function(compressor, ignore_side_effects, cached, depth) {
+            if (compressor.option("unsafe")) {
+                var elements = [];
+                for (var i = 0; i < this.elements.length; i++) {
+                    var element = this.elements[i];
+                    if (element instanceof AST_Hole) return this;
+                    var value = element._eval(compressor, ignore_side_effects, cached, depth);
+                    if (element === value) return this;
+                    elements.push(value);
+                }
+                return elements;
+            }
+            return this;
+        });
+        def(AST_Object, function(compressor, ignore_side_effects, cached, depth) {
+            if (compressor.option("unsafe")) {
+                var val = {};
+                for (var i = 0; i < this.properties.length; i++) {
+                    var prop = this.properties[i];
+                    if (!(prop instanceof AST_ObjectKeyVal)) return this;
+                    var key = prop.key;
+                    if (key instanceof AST_Node) {
+                        key = key._eval(compressor, ignore_side_effects, cached, depth);
+                        if (key === prop.key) return this;
+                    }
+                    switch (key) {
+                      case "__proto__":
+                      case "toString":
+                      case "valueOf":
+                        return this;
+                    }
+                    val[key] = prop.value._eval(compressor, ignore_side_effects, cached, depth);
+                    if (val[key] === prop.value) return this;
+                }
+                return val;
+            }
+            return this;
         });
-        def(AST_UnaryPrefix, function(compressor){
+        var non_converting_unary = makePredicate("! typeof void");
+        def(AST_UnaryPrefix, function(compressor, ignore_side_effects, cached, depth) {
             var e = this.expression;
-            switch (this.operator) {
-              case "!": return !ev(e, compressor);
+            var op = this.operator;
+            // Function would be evaluated to an array and so typeof would
+            // incorrectly return "object". Hence making is a special case.
+            if (compressor.option("typeofs")
+                && op == "typeof"
+                && (e instanceof AST_Lambda
+                    || e instanceof AST_SymbolRef
+                        && e.fixed_value() instanceof AST_Lambda)) {
+                return typeof function(){};
+            }
+            var def = e instanceof AST_SymbolRef && e.definition();
+            if (!non_converting_unary[op] && !(def && def.fixed)) depth++;
+            e.walk(scan_modified);
+            var v = e._eval(compressor, ignore_side_effects, cached, depth);
+            if (v === e) {
+                if (ignore_side_effects && op == "void") return;
+                return this;
+            }
+            switch (op) {
+              case "!": return !v;
               case "typeof":
-                // Function would be evaluated to an array and so typeof would
-                // incorrectly return 'object'. Hence making is a special case.
-                if (e instanceof AST_Function) return typeof function(){};
-
-                e = ev(e, compressor);
-
                 // typeof <RegExp> returns "object" or "function" on different platforms
                 // so cannot evaluate reliably
-                if (e instanceof RegExp) throw def;
-
-                return typeof e;
-              case "void": return void ev(e, compressor);
-              case "~": return ~ev(e, compressor);
-              case "-":
-                e = ev(e, compressor);
-                if (e === 0) throw def;
-                return -e;
-              case "+": return +ev(e, compressor);
+                if (v instanceof RegExp) return this;
+                return typeof v;
+              case "void": return;
+              case "~": return ~v;
+              case "-": return -v;
+              case "+": return +v;
+              case "++":
+              case "--":
+                if (!def) return this;
+                if (!ignore_side_effects) {
+                    if (def.undeclared) return this;
+                    if (def.last_ref !== e) return this;
+                }
+                if (HOP(e, "_eval")) v = +(op[0] + 1) + +v;
+                modified(e);
+                return v;
             }
-            throw def;
+            return this;
         });
-        def(AST_Binary, function(c){
-            var left = this.left, right = this.right;
+        def(AST_UnaryPostfix, function(compressor, ignore_side_effects, cached, depth) {
+            var e = this.expression;
+            if (!(e instanceof AST_SymbolRef)) {
+                if (!ignore_side_effects) return this;
+            } else if (!HOP(e, "_eval")) {
+                if (!e.fixed) return this;
+                if (!ignore_side_effects) {
+                    var def = e.definition();
+                    if (!def.fixed) return this;
+                    if (def.undeclared) return this;
+                    if (def.last_ref !== e) return this;
+                }
+            }
+            if (!(e instanceof AST_SymbolRef && e.definition().fixed)) depth++;
+            e.walk(scan_modified);
+            var v = e._eval(compressor, ignore_side_effects, cached, depth);
+            if (v === e) return this;
+            modified(e);
+            return +v;
+        });
+        var non_converting_binary = makePredicate("&& || === !==");
+        def(AST_Binary, function(compressor, ignore_side_effects, cached, depth) {
+            if (!non_converting_binary[this.operator]) depth++;
+            var left = this.left._eval(compressor, ignore_side_effects, cached, depth);
+            if (left === this.left) return this;
+            if (this.operator == (left ? "||" : "&&")) return left;
+            var rhs_ignore_side_effects = ignore_side_effects && !(left && typeof left == "object");
+            var right = this.right._eval(compressor, rhs_ignore_side_effects, cached, depth);
+            if (right === this.right) return this;
+            var result;
             switch (this.operator) {
-              case "&&"         : return ev(left, c) &&         ev(right, c);
-              case "||"         : return ev(left, c) ||         ev(right, c);
-              case "|"          : return ev(left, c) |          ev(right, c);
-              case "&"          : return ev(left, c) &          ev(right, c);
-              case "^"          : return ev(left, c) ^          ev(right, c);
-              case "+"          : return ev(left, c) +          ev(right, c);
-              case "*"          : return ev(left, c) *          ev(right, c);
-              case "/"          : return ev(left, c) /          ev(right, c);
-              case "%"          : return ev(left, c) %          ev(right, c);
-              case "-"          : return ev(left, c) -          ev(right, c);
-              case "<<"         : return ev(left, c) <<         ev(right, c);
-              case ">>"         : return ev(left, c) >>         ev(right, c);
-              case ">>>"        : return ev(left, c) >>>        ev(right, c);
-              case "=="         : return ev(left, c) ==         ev(right, c);
-              case "==="        : return ev(left, c) ===        ev(right, c);
-              case "!="         : return ev(left, c) !=         ev(right, c);
-              case "!=="        : return ev(left, c) !==        ev(right, c);
-              case "<"          : return ev(left, c) <          ev(right, c);
-              case "<="         : return ev(left, c) <=         ev(right, c);
-              case ">"          : return ev(left, c) >          ev(right, c);
-              case ">="         : return ev(left, c) >=         ev(right, c);
-              case "in"         : return ev(left, c) in         ev(right, c);
-              case "instanceof" : return ev(left, c) instanceof ev(right, c);
-            }
-            throw def;
-        });
-        def(AST_Conditional, function(compressor){
-            return ev(this.condition, compressor)
-                ? ev(this.consequent, compressor)
-                : ev(this.alternative, compressor);
-        });
-        def(AST_SymbolRef, function(compressor){
-            var d = this.definition();
-            if (d && d.constant && d.init) return ev(d.init, compressor);
-            throw def;
-        });
-        def(AST_Dot, function(compressor){
-            if (compressor.option("unsafe") && this.property == "length") {
-                var str = ev(this.expression, compressor);
-                if (typeof str == "string")
-                    return str.length;
+              case "&&" : result = left &&  right; break;
+              case "||" : result = left ||  right; break;
+              case "??" :
+                result = left == null ? right : left;
+                break;
+              case "|"  : result = left |   right; break;
+              case "&"  : result = left &   right; break;
+              case "^"  : result = left ^   right; break;
+              case "+"  : result = left +   right; break;
+              case "-"  : result = left -   right; break;
+              case "*"  : result = left *   right; break;
+              case "/"  : result = left /   right; break;
+              case "%"  : result = left %   right; break;
+              case "<<" : result = left <<  right; break;
+              case ">>" : result = left >>  right; break;
+              case ">>>": result = left >>> right; break;
+              case "==" : result = left ==  right; break;
+              case "===": result = left === right; break;
+              case "!=" : result = left !=  right; break;
+              case "!==": result = left !== right; break;
+              case "<"  : result = left <   right; break;
+              case "<=" : result = left <=  right; break;
+              case ">"  : result = left >   right; break;
+              case ">=" : result = left >=  right; break;
+              case "**":
+                result = Math.pow(left, right);
+                break;
+              case "in":
+                if (right && typeof right == "object" && HOP(right, left)) {
+                    result = true;
+                    break;
+                }
+              default:
+                return this;
+            }
+            if (isNaN(result)) return compressor.find_parent(AST_With) ? this : result;
+            if (compressor.option("unsafe_math")
+                && !ignore_side_effects
+                && result
+                && typeof result == "number"
+                && (this.operator == "+" || this.operator == "-")) {
+                var digits = Math.max(0, decimals(left), decimals(right));
+                // 53-bit significand ---> 15.95 decimal places
+                if (digits < 16) return +result.toFixed(digits);
+            }
+            return result;
+
+            function decimals(operand) {
+                var match = /(\.[0-9]*)?(e[^e]+)?$/.exec(+operand);
+                return (match[1] || ".").length - 1 - (match[2] || "").slice(1);
+            }
+        });
+        def(AST_Conditional, function(compressor, ignore_side_effects, cached, depth) {
+            var condition = this.condition._eval(compressor, ignore_side_effects, cached, depth);
+            if (condition === this.condition) return this;
+            var node = condition ? this.consequent : this.alternative;
+            var value = node._eval(compressor, ignore_side_effects, cached, depth);
+            return value === node ? this : value;
+        });
+        function verify_escaped(ref, depth) {
+            var escaped = ref.definition().escaped;
+            switch (escaped.length) {
+              case 0:
+                return true;
+              case 1:
+                var found = false;
+                escaped[0].walk(new TreeWalker(function(node) {
+                    if (found) return true;
+                    if (node === ref) return found = true;
+                    if (node instanceof AST_Scope) return true;
+                }));
+                return found;
+              default:
+                return depth <= escaped.depth;
+            }
+        }
+        def(AST_SymbolRef, function(compressor, ignore_side_effects, cached, depth) {
+            var fixed = this.fixed_value();
+            if (!fixed) return this;
+            var value;
+            if (HOP(fixed, "_eval")) {
+                value = fixed._eval();
+            } else {
+                this._eval = return_this;
+                value = fixed._eval(compressor, ignore_side_effects, cached, depth);
+                delete this._eval;
+                if (value === fixed) return this;
+                fixed._eval = function() {
+                    return value;
+                };
+                cached.push(fixed);
+            }
+            return value && typeof value == "object" && !verify_escaped(this, depth) ? this : value;
+        });
+        var global_objs = {
+            Array: Array,
+            Math: Math,
+            Number: Number,
+            Object: Object,
+            String: String,
+        };
+        var static_values = convert_to_predicate({
+            Math: [
+                "E",
+                "LN10",
+                "LN2",
+                "LOG2E",
+                "LOG10E",
+                "PI",
+                "SQRT1_2",
+                "SQRT2",
+            ],
+            Number: [
+                "MAX_VALUE",
+                "MIN_VALUE",
+                "NaN",
+                "NEGATIVE_INFINITY",
+                "POSITIVE_INFINITY",
+            ],
+        });
+        var regexp_props = makePredicate("global ignoreCase multiline source");
+        def(AST_PropAccess, function(compressor, ignore_side_effects, cached, depth) {
+            if (compressor.option("unsafe")) {
+                var val;
+                var exp = this.expression;
+                if (!is_undeclared_ref(exp)) {
+                    val = exp._eval(compressor, ignore_side_effects, cached, depth + 1);
+                    if (val == null || val === exp) return this;
+                }
+                var key = this.property;
+                if (key instanceof AST_Node) {
+                    key = key._eval(compressor, ignore_side_effects, cached, depth);
+                    if (key === this.property) return this;
+                }
+                if (val === undefined) {
+                    var static_value = static_values[exp.name];
+                    if (!static_value || !static_value[key]) return this;
+                    val = global_objs[exp.name];
+                } else if (val instanceof RegExp) {
+                    if (!regexp_props[key]) return this;
+                } else if (typeof val == "object") {
+                    if (!HOP(val, key)) return this;
+                } else if (typeof val == "function") switch (key) {
+                  case "name":
+                    return val.node.name ? val.node.name.name : "";
+                  case "length":
+                    return val.node.length();
+                  default:
+                    return this;
+                }
+                return val[key];
+            }
+            return this;
+        });
+        function eval_all(nodes, compressor, ignore_side_effects, cached, depth) {
+            var values = [];
+            for (var i = 0; i < nodes.length; i++) {
+                var node = nodes[i];
+                var value = node._eval(compressor, ignore_side_effects, cached, depth);
+                if (node === value) return;
+                values.push(value);
+            }
+            return values;
+        }
+        def(AST_Call, function(compressor, ignore_side_effects, cached, depth) {
+            var exp = this.expression;
+            var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp;
+            if (fn instanceof AST_Arrow || fn instanceof AST_Defun || fn instanceof AST_Function) {
+                if (fn.evaluating) return this;
+                if (fn.name && fn.name.definition().recursive_refs > 0) return this;
+                if (this.is_expr_pure(compressor)) return this;
+                var args = eval_all(this.args, compressor, ignore_side_effects, cached, depth);
+                if (!all(fn.argnames, function(sym, index) {
+                    if (sym instanceof AST_DefaultValue) {
+                        if (!args) return false;
+                        if (args[index] === undefined) {
+                            var value = sym.value._eval(compressor, ignore_side_effects, cached, depth);
+                            if (value === sym.value) return false;
+                            args[index] = value;
+                        }
+                        sym = sym.name;
+                    }
+                    return !(sym instanceof AST_Destructured);
+                })) return this;
+                if (fn.rest instanceof AST_Destructured) return this;
+                if (!args && !ignore_side_effects) return this;
+                var stat = fn.first_statement();
+                if (!(stat instanceof AST_Return)) {
+                    if (ignore_side_effects) {
+                        fn.walk(scan_modified);
+                        var found = false;
+                        fn.evaluating = true;
+                        walk_body(fn, new TreeWalker(function(node) {
+                            if (found) return true;
+                            if (node instanceof AST_Return) {
+                                if (node.value && node.value._eval(compressor, true, cached, depth) !== undefined) {
+                                    found = true;
+                                }
+                                return true;
+                            }
+                            if (node instanceof AST_Scope && node !== fn) return true;
+                        }));
+                        fn.evaluating = false;
+                        if (!found) return;
+                    }
+                    return this;
+                }
+                var val = stat.value;
+                if (!val) return;
+                var cached_args = [];
+                if (!args || all(fn.argnames, function(sym, i) {
+                    return assign(sym, args[i]);
+                }) && !(fn.rest && !assign(fn.rest, args.slice(fn.argnames.length))) || ignore_side_effects) {
+                    if (ignore_side_effects) fn.argnames.forEach(function(sym) {
+                        if (sym instanceof AST_DefaultValue) sym.value.walk(scan_modified);
+                    });
+                    fn.evaluating = true;
+                    val = val._eval(compressor, ignore_side_effects, cached, depth);
+                    fn.evaluating = false;
+                }
+                cached_args.forEach(function(node) {
+                    delete node._eval;
+                });
+                return val === stat.value ? this : val;
+            } else if (compressor.option("unsafe") && exp instanceof AST_PropAccess) {
+                var key = exp.property;
+                if (key instanceof AST_Node) {
+                    key = key._eval(compressor, ignore_side_effects, cached, depth);
+                    if (key === exp.property) return this;
+                }
+                var val;
+                var e = exp.expression;
+                if (is_undeclared_ref(e)) {
+                    var static_fn = static_fns[e.name];
+                    if (!static_fn || !static_fn[key]) return this;
+                    val = global_objs[e.name];
+                } else {
+                    val = e._eval(compressor, ignore_side_effects, cached, depth + 1);
+                    if (val == null || val === e) return this;
+                    var native_fn = native_fns[val.constructor.name];
+                    if (!native_fn || !native_fn[key]) return this;
+                    if (val instanceof RegExp && val.global && !(e instanceof AST_RegExp)) return this;
+                }
+                var args = eval_all(this.args, compressor, ignore_side_effects, cached, depth);
+                if (!args) return this;
+                if (key == "replace" && typeof args[1] == "function") return this;
+                try {
+                    return val[key].apply(val, args);
+                } catch (ex) {
+                    AST_Node.warn("Error evaluating {this} [{start}]", this);
+                } finally {
+                    if (val instanceof RegExp) val.lastIndex = 0;
+                }
+            }
+            return this;
+
+            function assign(sym, arg) {
+                if (sym instanceof AST_DefaultValue) sym = sym.name;
+                var def = sym.definition();
+                if (def.orig[def.orig.length - 1] !== sym) return false;
+                var value = arg;
+                def.references.forEach(function(node) {
+                    node._eval = function() {
+                        return value;
+                    };
+                    cached_args.push(node);
+                });
+                return true;
+            }
+        });
+        def(AST_New, return_this);
+        def(AST_Template, function(compressor, ignore_side_effects, cached, depth) {
+            if (!compressor.option("templates")) return this;
+            if (this.tag) {
+                if (!is_raw_tag(compressor, this.tag)) return this;
+                decode = function(str) {
+                    return str;
+                };
+            }
+            var exprs = eval_all(this.expressions, compressor, ignore_side_effects, cached, depth);
+            if (!exprs) return this;
+            var malformed = false;
+            var ret = decode(this.strings[0]);
+            for (var i = 0; i < exprs.length; i++) {
+                ret += exprs[i] + decode(this.strings[i + 1]);
+            }
+            if (!malformed) return ret;
+            this._eval = return_this;
+            return this;
+
+            function decode(str) {
+                str = decode_template(str);
+                if (typeof str != "string") malformed = true;
+                return str;
             }
-            throw def;
         });
-    })(function(node, func){
+    })(function(node, func) {
         node.DEFMETHOD("_eval", func);
     });
 
     // method to negate an expression
-    (function(def){
+    (function(def) {
         function basic_negation(exp) {
             return make_node(AST_UnaryPrefix, exp, {
                 operator: "!",
-                expression: exp
+                expression: exp,
             });
-        };
-        def(AST_Node, function(){
+        }
+        function best(orig, alt, first_in_statement) {
+            var negated = basic_negation(orig);
+            if (first_in_statement) return best_of_expression(negated, make_node(AST_SimpleStatement, alt, {
+                body: alt,
+            })) === negated ? negated : alt;
+            return best_of_expression(negated, alt);
+        }
+        def(AST_Node, function() {
             return basic_negation(this);
         });
-        def(AST_Statement, function(){
+        def(AST_Statement, function() {
             throw new Error("Cannot negate a statement");
         });
-        def(AST_Function, function(){
-            return basic_negation(this);
-        });
-        def(AST_UnaryPrefix, function(){
-            if (this.operator == "!")
-                return this.expression;
-            return basic_negation(this);
-        });
-        def(AST_Seq, function(compressor){
-            var self = this.clone();
-            self.cdr = self.cdr.negate(compressor);
-            return self;
-        });
-        def(AST_Conditional, function(compressor){
-            var self = this.clone();
-            self.consequent = self.consequent.negate(compressor);
-            self.alternative = self.alternative.negate(compressor);
-            return best_of(basic_negation(this), self);
-        });
-        def(AST_Binary, function(compressor){
+        def(AST_Binary, function(compressor, first_in_statement) {
             var self = this.clone(), op = this.operator;
             if (compressor.option("unsafe_comps")) {
                 switch (op) {
@@ -868,514 +5661,3607 @@
               case "!==": self.operator = "==="; return self;
               case "&&":
                 self.operator = "||";
-                self.left = self.left.negate(compressor);
+                self.left = self.left.negate(compressor, first_in_statement);
                 self.right = self.right.negate(compressor);
-                return best_of(basic_negation(this), self);
+                return best(this, self, first_in_statement);
               case "||":
                 self.operator = "&&";
-                self.left = self.left.negate(compressor);
+                self.left = self.left.negate(compressor, first_in_statement);
                 self.right = self.right.negate(compressor);
-                return best_of(basic_negation(this), self);
+                return best(this, self, first_in_statement);
             }
             return basic_negation(this);
         });
-    })(function(node, func){
-        node.DEFMETHOD("negate", function(compressor){
-            return func.call(this, compressor);
+        def(AST_ClassExpression, function() {
+            return basic_negation(this);
+        });
+        def(AST_Conditional, function(compressor, first_in_statement) {
+            var self = this.clone();
+            self.consequent = self.consequent.negate(compressor);
+            self.alternative = self.alternative.negate(compressor);
+            return best(this, self, first_in_statement);
+        });
+        def(AST_LambdaExpression, function() {
+            return basic_negation(this);
+        });
+        def(AST_Sequence, function(compressor) {
+            var expressions = this.expressions.slice();
+            expressions.push(expressions.pop().negate(compressor));
+            return make_sequence(this, expressions);
+        });
+        def(AST_UnaryPrefix, function() {
+            if (this.operator == "!")
+                return this.expression;
+            return basic_negation(this);
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("negate", function(compressor, first_in_statement) {
+            return func.call(this, compressor, first_in_statement);
         });
     });
 
-    // determine if expression has side effects
-    (function(def){
-        def(AST_Node, function(compressor){ return true });
-
-        def(AST_EmptyStatement, function(compressor){ return false });
-        def(AST_Constant, function(compressor){ return false });
-        def(AST_This, function(compressor){ return false });
-
-        def(AST_Call, function(compressor){
-            var pure = compressor.option("pure_funcs");
-            if (!pure) return true;
-            return pure.indexOf(this.expression.print_to_string()) < 0;
-        });
-
-        def(AST_Block, function(compressor){
-            for (var i = this.body.length; --i >= 0;) {
-                if (this.body[i].has_side_effects(compressor))
-                    return true;
-            }
-            return false;
+    var global_pure_fns = makePredicate("Boolean decodeURI decodeURIComponent Date encodeURI encodeURIComponent Error escape EvalError isFinite isNaN Number Object parseFloat parseInt RangeError ReferenceError String SyntaxError TypeError unescape URIError");
+    var global_pure_constructors = makePredicate("Map Set WeakMap WeakSet");
+    AST_Call.DEFMETHOD("is_expr_pure", function(compressor) {
+        if (compressor.option("unsafe")) {
+            var expr = this.expression;
+            if (is_undeclared_ref(expr)) {
+                if (global_pure_fns[expr.name]) return true;
+                if (this instanceof AST_New && global_pure_constructors[expr.name]) return true;
+            }
+            if (is_static_fn(expr)) return true;
+        }
+        return compressor.option("annotations") && this.pure || !compressor.pure_funcs(this);
+    });
+    AST_Template.DEFMETHOD("is_expr_pure", function(compressor) {
+        var tag = this.tag;
+        if (!tag) return true;
+        if (compressor.option("unsafe")) {
+            if (is_undeclared_ref(tag) && global_pure_fns[tag.name]) return true;
+            if (tag instanceof AST_Dot && is_undeclared_ref(tag.expression)) {
+                var static_fn = static_fns[tag.expression.name];
+                return static_fn && (static_fn[tag.property]
+                    || tag.expression.name == "Math" && tag.property == "random");
+            }
+        }
+        return !compressor.pure_funcs(this);
+    });
+    AST_Node.DEFMETHOD("is_call_pure", return_false);
+    AST_Call.DEFMETHOD("is_call_pure", function(compressor) {
+        if (!compressor.option("unsafe")) return false;
+        var dot = this.expression;
+        if (!(dot instanceof AST_Dot)) return false;
+        var exp = dot.expression;
+        var map;
+        var prop = dot.property;
+        if (exp instanceof AST_Array) {
+            map = native_fns.Array;
+        } else if (exp.is_boolean(compressor)) {
+            map = native_fns.Boolean;
+        } else if (exp.is_number(compressor)) {
+            map = native_fns.Number;
+        } else if (exp instanceof AST_RegExp) {
+            map = native_fns.RegExp;
+        } else if (exp.is_string(compressor)) {
+            map = native_fns.String;
+            if (prop == "replace") {
+                var arg = this.args[1];
+                if (arg && !arg.is_string(compressor)) return false;
+            }
+        } else if (!dot.may_throw_on_access(compressor)) {
+            map = native_fns.Object;
+        }
+        return map && map[prop];
+    });
+
+    // determine if object spread syntax may cause runtime exception
+    (function(def) {
+        def(AST_Node, return_false);
+        def(AST_Array, return_true);
+        def(AST_Assign, function() {
+            switch (this.operator) {
+              case "=":
+                return this.right.safe_to_spread();
+              case "&&=":
+              case "||=":
+              case "??=":
+                return this.left.safe_to_spread() && this.right.safe_to_spread();
+            }
+            return true;
+        });
+        def(AST_Binary, function() {
+            return !lazy_op[this.operator] || this.left.safe_to_spread() && this.right.safe_to_spread();
+        });
+        def(AST_Constant, return_true);
+        def(AST_Lambda, return_true);
+        def(AST_Object, function() {
+            return all(this.properties, function(prop) {
+                return !(prop instanceof AST_ObjectGetter || prop instanceof AST_Spread);
+            });
+        });
+        def(AST_Sequence, function() {
+            return this.tail_node().safe_to_spread();
         });
+        def(AST_SymbolRef, function() {
+            var fixed = this.fixed_value();
+            return fixed && fixed.safe_to_spread();
+        });
+        def(AST_Unary, return_true);
+    })(function(node, func) {
+        node.DEFMETHOD("safe_to_spread", func);
+    });
 
-        def(AST_SimpleStatement, function(compressor){
-            return this.body.has_side_effects(compressor);
+    // determine if expression has side effects
+    (function(def) {
+        function any(list, compressor, spread) {
+            return !all(list, spread ? function(node) {
+                return node instanceof AST_Spread ? !spread(node, compressor) : !node.has_side_effects(compressor);
+            } : function(node) {
+                return !node.has_side_effects(compressor);
+            });
+        }
+        function array_spread(node, compressor) {
+            var exp = node.expression;
+            return !exp.is_string(compressor) || exp.has_side_effects(compressor);
+        }
+        def(AST_Node, return_true);
+        def(AST_Array, function(compressor) {
+            return any(this.elements, compressor, array_spread);
+        });
+        def(AST_Assign, function(compressor) {
+            var lhs = this.left;
+            if (!(lhs instanceof AST_PropAccess)) return true;
+            var node = lhs.expression;
+            return !(node instanceof AST_ObjectIdentity)
+                || !node.scope.resolve().new
+                || lhs instanceof AST_Sub && lhs.property.has_side_effects(compressor)
+                || this.right.has_side_effects(compressor);
         });
-        def(AST_Defun, function(compressor){ return true });
-        def(AST_Function, function(compressor){ return false });
-        def(AST_Binary, function(compressor){
+        def(AST_Binary, function(compressor) {
             return this.left.has_side_effects(compressor)
-                || this.right.has_side_effects(compressor);
+                || this.right.has_side_effects(compressor)
+                || !can_drop_op(this.operator, this.right, compressor);
+        });
+        def(AST_Block, function(compressor) {
+            return any(this.body, compressor);
+        });
+        def(AST_Call, function(compressor) {
+            if (!this.is_expr_pure(compressor)
+                && (!this.is_call_pure(compressor) || this.expression.has_side_effects(compressor))) {
+                return true;
+            }
+            return any(this.args, compressor, array_spread);
+        });
+        def(AST_Case, function(compressor) {
+            return this.expression.has_side_effects(compressor)
+                || any(this.body, compressor);
+        });
+        def(AST_Class, function(compressor) {
+            var base = this.extends;
+            if (base) {
+                if (base instanceof AST_SymbolRef) base = base.fixed_value();
+                if (!safe_for_extends(base)) return true;
+            }
+            return any(this.properties, compressor);
         });
-        def(AST_Assign, function(compressor){ return true });
-        def(AST_Conditional, function(compressor){
+        def(AST_ClassProperty, function(compressor) {
+            return this.key instanceof AST_Node && this.key.has_side_effects(compressor)
+                || this.static && this.value && this.value.has_side_effects(compressor);
+        });
+        def(AST_Conditional, function(compressor) {
             return this.condition.has_side_effects(compressor)
                 || this.consequent.has_side_effects(compressor)
                 || this.alternative.has_side_effects(compressor);
         });
-        def(AST_Unary, function(compressor){
-            return this.operator == "delete"
-                || this.operator == "++"
-                || this.operator == "--"
+        def(AST_Constant, return_false);
+        def(AST_Definitions, function(compressor) {
+            return any(this.definitions, compressor);
+        });
+        def(AST_DestructuredArray, function(compressor) {
+            return any(this.elements, compressor);
+        });
+        def(AST_DestructuredKeyVal, function(compressor) {
+            return this.key instanceof AST_Node && this.key.has_side_effects(compressor)
+                || this.value.has_side_effects(compressor);
+        });
+        def(AST_DestructuredObject, function(compressor) {
+            return any(this.properties, compressor);
+        });
+        def(AST_Dot, function(compressor) {
+            return this.expression.may_throw_on_access(compressor)
                 || this.expression.has_side_effects(compressor);
         });
-        def(AST_SymbolRef, function(compressor){
-            return this.global() && this.undeclared();
+        def(AST_EmptyStatement, return_false);
+        def(AST_If, function(compressor) {
+            return this.condition.has_side_effects(compressor)
+                || this.body && this.body.has_side_effects(compressor)
+                || this.alternative && this.alternative.has_side_effects(compressor);
         });
-        def(AST_Object, function(compressor){
-            for (var i = this.properties.length; --i >= 0;)
-                if (this.properties[i].has_side_effects(compressor))
-                    return true;
-            return false;
+        def(AST_LabeledStatement, function(compressor) {
+            return this.body.has_side_effects(compressor);
         });
-        def(AST_ObjectProperty, function(compressor){
-            return this.value.has_side_effects(compressor);
+        def(AST_Lambda, return_false);
+        def(AST_Object, function(compressor) {
+            return any(this.properties, compressor, function(node, compressor) {
+                var exp = node.expression;
+                return !exp.safe_to_spread() || exp.has_side_effects(compressor);
+            });
         });
-        def(AST_Array, function(compressor){
-            for (var i = this.elements.length; --i >= 0;)
-                if (this.elements[i].has_side_effects(compressor))
-                    return true;
-            return false;
+        def(AST_ObjectIdentity, return_false);
+        def(AST_ObjectProperty, function(compressor) {
+            return this.key instanceof AST_Node && this.key.has_side_effects(compressor)
+                || this.value.has_side_effects(compressor);
         });
-        def(AST_Dot, function(compressor){
-            if (!compressor.option("pure_getters")) return true;
-            return this.expression.has_side_effects(compressor);
+        def(AST_Sequence, function(compressor) {
+            return any(this.expressions, compressor);
         });
-        def(AST_Sub, function(compressor){
-            if (!compressor.option("pure_getters")) return true;
-            return this.expression.has_side_effects(compressor)
+        def(AST_SimpleStatement, function(compressor) {
+            return this.body.has_side_effects(compressor);
+        });
+        def(AST_Sub, function(compressor) {
+            return this.expression.may_throw_on_access(compressor)
+                || this.expression.has_side_effects(compressor)
                 || this.property.has_side_effects(compressor);
         });
-        def(AST_PropAccess, function(compressor){
-            return !compressor.option("pure_getters");
+        def(AST_Switch, function(compressor) {
+            return this.expression.has_side_effects(compressor)
+                || any(this.body, compressor);
+        });
+        def(AST_SymbolDeclaration, return_false);
+        def(AST_SymbolRef, function(compressor) {
+            return !this.is_declared(compressor) || !can_drop_symbol(this, compressor);
+        });
+        def(AST_Template, function(compressor) {
+            return !this.is_expr_pure(compressor) || any(this.expressions, compressor);
+        });
+        def(AST_Try, function(compressor) {
+            return any(this.body, compressor)
+                || this.bcatch && this.bcatch.has_side_effects(compressor)
+                || this.bfinally && this.bfinally.has_side_effects(compressor);
         });
-        def(AST_Seq, function(compressor){
-            return this.car.has_side_effects(compressor)
-                || this.cdr.has_side_effects(compressor);
+        def(AST_Unary, function(compressor) {
+            return unary_side_effects[this.operator]
+                || this.expression.has_side_effects(compressor);
+        });
+        def(AST_VarDef, function() {
+            return this.value;
         });
-    })(function(node, func){
+    })(function(node, func) {
         node.DEFMETHOD("has_side_effects", func);
     });
 
+    // determine if expression may throw
+    (function(def) {
+        def(AST_Node, return_true);
+
+        def(AST_Constant, return_false);
+        def(AST_EmptyStatement, return_false);
+        def(AST_Lambda, return_false);
+        def(AST_ObjectIdentity, return_false);
+        def(AST_SymbolDeclaration, return_false);
+
+        function any(list, compressor) {
+            for (var i = list.length; --i >= 0;)
+                if (list[i].may_throw(compressor))
+                    return true;
+            return false;
+        }
+
+        function call_may_throw(exp, compressor) {
+            if (exp.may_throw(compressor)) return true;
+            if (exp instanceof AST_SymbolRef) exp = exp.fixed_value();
+            if (!(exp instanceof AST_Lambda)) return true;
+            if (any(exp.argnames, compressor)) return true;
+            if (any(exp.body, compressor)) return true;
+            return is_arrow(exp) && exp.value && exp.value.may_throw(compressor);
+        }
+
+        def(AST_Array, function(compressor) {
+            return any(this.elements, compressor);
+        });
+        def(AST_Assign, function(compressor) {
+            if (this.right.may_throw(compressor)) return true;
+            if (!compressor.has_directive("use strict")
+                && this.operator == "="
+                && this.left instanceof AST_SymbolRef) {
+                return false;
+            }
+            return this.left.may_throw(compressor);
+        });
+        def(AST_Await, function(compressor) {
+            return this.expression.may_throw(compressor);
+        });
+        def(AST_Binary, function(compressor) {
+            return this.left.may_throw(compressor)
+                || this.right.may_throw(compressor)
+                || !can_drop_op(this.operator, this.right, compressor);
+        });
+        def(AST_Block, function(compressor) {
+            return any(this.body, compressor);
+        });
+        def(AST_Call, function(compressor) {
+            if (any(this.args, compressor)) return true;
+            if (this.is_expr_pure(compressor)) return false;
+            this.may_throw = return_true;
+            var ret = call_may_throw(this.expression, compressor);
+            delete this.may_throw;
+            return ret;
+        });
+        def(AST_Case, function(compressor) {
+            return this.expression.may_throw(compressor)
+                || any(this.body, compressor);
+        });
+        def(AST_Conditional, function(compressor) {
+            return this.condition.may_throw(compressor)
+                || this.consequent.may_throw(compressor)
+                || this.alternative.may_throw(compressor);
+        });
+        def(AST_DefaultValue, function(compressor) {
+            return this.name.may_throw(compressor)
+                || this.value && this.value.may_throw(compressor);
+        });
+        def(AST_Definitions, function(compressor) {
+            return any(this.definitions, compressor);
+        });
+        def(AST_Dot, function(compressor) {
+            return !this.optional && this.expression.may_throw_on_access(compressor)
+                || this.expression.may_throw(compressor);
+        });
+        def(AST_ForEnumeration, function(compressor) {
+            if (this.init.may_throw(compressor)) return true;
+            var obj = this.object;
+            if (obj.may_throw(compressor)) return true;
+            obj = obj.tail_node();
+            if (!(obj instanceof AST_Array || obj.is_string(compressor))) return true;
+            return this.body.may_throw(compressor);
+        });
+        def(AST_If, function(compressor) {
+            return this.condition.may_throw(compressor)
+                || this.body && this.body.may_throw(compressor)
+                || this.alternative && this.alternative.may_throw(compressor);
+        });
+        def(AST_LabeledStatement, function(compressor) {
+            return this.body.may_throw(compressor);
+        });
+        def(AST_Object, function(compressor) {
+            return any(this.properties, compressor);
+        });
+        def(AST_ObjectProperty, function(compressor) {
+            return this.value.may_throw(compressor)
+                || this.key instanceof AST_Node && this.key.may_throw(compressor);
+        });
+        def(AST_Return, function(compressor) {
+            return this.value && this.value.may_throw(compressor);
+        });
+        def(AST_Sequence, function(compressor) {
+            return any(this.expressions, compressor);
+        });
+        def(AST_SimpleStatement, function(compressor) {
+            return this.body.may_throw(compressor);
+        });
+        def(AST_Sub, function(compressor) {
+            return !this.optional && this.expression.may_throw_on_access(compressor)
+                || this.expression.may_throw(compressor)
+                || this.property.may_throw(compressor);
+        });
+        def(AST_Switch, function(compressor) {
+            return this.expression.may_throw(compressor)
+                || any(this.body, compressor);
+        });
+        def(AST_SymbolRef, function(compressor) {
+            return !this.is_declared(compressor) || !can_drop_symbol(this, compressor);
+        });
+        def(AST_Template, function(compressor) {
+            if (any(this.expressions, compressor)) return true;
+            if (this.is_expr_pure(compressor)) return false;
+            if (!this.tag) return false;
+            this.may_throw = return_true;
+            var ret = call_may_throw(this.tag, compressor);
+            delete this.may_throw;
+            return ret;
+        });
+        def(AST_Try, function(compressor) {
+            return (this.bcatch ? this.bcatch.may_throw(compressor) : any(this.body, compressor))
+                || this.bfinally && this.bfinally.may_throw(compressor);
+        });
+        def(AST_Unary, function(compressor) {
+            return this.expression.may_throw(compressor)
+                && !(this.operator == "typeof" && this.expression instanceof AST_SymbolRef);
+        });
+        def(AST_VarDef, function(compressor) {
+            return this.name.may_throw(compressor)
+                || this.value && this.value.may_throw(compressor);
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("may_throw", func);
+    });
+
+    // determine if expression is constant
+    (function(def) {
+        function all_constant(list, scope) {
+            for (var i = list.length; --i >= 0;)
+                if (!list[i].is_constant_expression(scope))
+                    return false;
+            return true;
+        }
+        def(AST_Node, return_false);
+        def(AST_Array, function(scope) {
+            return all_constant(this.elements, scope);
+        });
+        def(AST_Binary, function(scope) {
+            return this.left.is_constant_expression(scope)
+                && this.right.is_constant_expression(scope)
+                && can_drop_op(this.operator, this.right);
+        });
+        def(AST_Class, function(scope) {
+            var base = this.extends;
+            if (base && !safe_for_extends(base)) return false;
+            return all_constant(this.properties, scope);
+        });
+        def(AST_ClassProperty, function(scope) {
+            return typeof this.key == "string" && (!this.value || this.value.is_constant_expression(scope));
+        });
+        def(AST_Constant, return_true);
+        def(AST_Lambda, function(scope) {
+            var self = this;
+            var result = true;
+            var scopes = [];
+            self.walk(new TreeWalker(function(node, descend) {
+                if (!result) return true;
+                if (node instanceof AST_BlockScope) {
+                    if (node === self) return;
+                    scopes.push(node);
+                    descend();
+                    scopes.pop();
+                    return true;
+                }
+                if (node instanceof AST_SymbolRef) {
+                    if (self.inlined || node.redef || node.in_arg) {
+                        result = false;
+                        return true;
+                    }
+                    if (self.variables.has(node.name)) return true;
+                    var def = node.definition();
+                    if (member(def.scope, scopes)) return true;
+                    if (scope && !def.redefined()) {
+                        var scope_def = scope.find_variable(node.name);
+                        if (scope_def ? scope_def === def : def.undeclared) {
+                            result = "f";
+                            return true;
+                        }
+                    }
+                    result = false;
+                    return true;
+                }
+                if (node instanceof AST_ObjectIdentity) {
+                    if (is_arrow(self) && all(scopes, function(s) {
+                        return !(s instanceof AST_Scope) || is_arrow(s);
+                    })) result = false;
+                    return true;
+                }
+            }));
+            return result;
+        });
+        def(AST_Object, function(scope) {
+            return all_constant(this.properties, scope);
+        });
+        def(AST_ObjectProperty, function(scope) {
+            return typeof this.key == "string" && this.value.is_constant_expression(scope);
+        });
+        def(AST_Unary, function(scope) {
+            return this.expression.is_constant_expression(scope);
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("is_constant_expression", func);
+    });
+
     // tell me if a statement aborts
     function aborts(thing) {
         return thing && thing.aborts();
-    };
-    (function(def){
-        def(AST_Statement, function(){ return null });
-        def(AST_Jump, function(){ return this });
-        function block_aborts(){
+    }
+    (function(def) {
+        def(AST_Statement, return_null);
+        def(AST_Jump, return_this);
+        function block_aborts() {
             var n = this.body.length;
             return n > 0 && aborts(this.body[n - 1]);
-        };
+        }
         def(AST_BlockStatement, block_aborts);
         def(AST_SwitchBranch, block_aborts);
-        def(AST_If, function(){
+        def(AST_If, function() {
             return this.alternative && aborts(this.body) && aborts(this.alternative) && this;
         });
-    })(function(node, func){
+    })(function(node, func) {
         node.DEFMETHOD("aborts", func);
     });
 
     /* -----[ optimizers ]----- */
 
-    OPT(AST_Directive, function(self, compressor){
-        if (self.scope.has_directive(self.value) !== self.scope) {
+    var directives = makePredicate(["use asm", "use strict"]);
+    OPT(AST_Directive, function(self, compressor) {
+        if (compressor.option("directives")
+            && (!directives[self.value] || compressor.has_directive(self.value) !== self)) {
             return make_node(AST_EmptyStatement, self);
         }
         return self;
     });
 
-    OPT(AST_Debugger, function(self, compressor){
+    OPT(AST_Debugger, function(self, compressor) {
         if (compressor.option("drop_debugger"))
             return make_node(AST_EmptyStatement, self);
         return self;
     });
 
-    OPT(AST_LabeledStatement, function(self, compressor){
-        if (self.body instanceof AST_Break
-            && compressor.loopcontrol_target(self.body.label) === self.body) {
-            return make_node(AST_EmptyStatement, self);
+    OPT(AST_LabeledStatement, function(self, compressor) {
+        if (self.body instanceof AST_If || self.body instanceof AST_Break) {
+            var body = tighten_body([ self.body ], compressor);
+            switch (body.length) {
+              case 0:
+                self.body = make_node(AST_EmptyStatement, self);
+                break;
+              case 1:
+                self.body = body[0];
+                break;
+              default:
+                self.body = make_node(AST_BlockStatement, self, { body: body });
+                break;
+            }
+        }
+        return compressor.option("unused") && self.label.references.length == 0 ? self.body : self;
+    });
+
+    OPT(AST_LoopControl, function(self, compressor) {
+        if (!compressor.option("dead_code")) return self;
+        var label = self.label;
+        if (label) {
+            var lct = compressor.loopcontrol_target(self);
+            self.label = null;
+            if (compressor.loopcontrol_target(self) === lct) {
+                remove(label.thedef.references, self);
+            } else {
+                self.label = label;
+            }
         }
-        return self.label.references.length == 0 ? self.body : self;
+        return self;
     });
 
-    OPT(AST_Block, function(self, compressor){
+    OPT(AST_Block, function(self, compressor) {
         self.body = tighten_body(self.body, compressor);
         return self;
     });
 
-    OPT(AST_BlockStatement, function(self, compressor){
+    function trim_block(node, parent, in_list) {
+        switch (node.body.length) {
+          case 0:
+            return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+          case 1:
+            var stat = node.body[0];
+            if (!safe_to_trim(stat)) return node;
+            if (parent instanceof AST_IterationStatement && stat instanceof AST_LambdaDefinition) return node;
+            return stat;
+        }
+        return node;
+    }
+
+    OPT(AST_BlockStatement, function(self, compressor) {
         self.body = tighten_body(self.body, compressor);
-        switch (self.body.length) {
-          case 1: return self.body[0];
-          case 0: return make_node(AST_EmptyStatement, self);
+        return trim_block(self, compressor.parent());
+    });
+
+    function drop_rest_farg(fn, compressor) {
+        if (!compressor.option("rests")) return;
+        if (fn.uses_arguments) return;
+        if (!(fn.rest instanceof AST_DestructuredArray)) return;
+        if (!compressor.drop_fargs(fn, compressor.parent())) return;
+        fn.argnames = fn.argnames.concat(fn.rest.elements);
+        fn.rest = fn.rest.rest;
+    }
+
+    OPT(AST_Lambda, function(self, compressor) {
+        drop_rest_farg(self, compressor);
+        self.body = tighten_body(self.body, compressor);
+        return self;
+    });
+
+    function opt_arrow(self, compressor) {
+        if (!compressor.option("arrows")) return self;
+        drop_rest_farg(self, compressor);
+        if (self.value) self.body = [ self.first_statement() ];
+        var body = tighten_body(self.body, compressor);
+        switch (body.length) {
+          case 1:
+            var stat = body[0];
+            if (stat instanceof AST_Return) {
+                self.body.length = 0;
+                self.value = stat.value;
+                break;
+            }
+          default:
+            self.body = body;
+            self.value = null;
+            break;
+        }
+        return self;
+    }
+    OPT(AST_Arrow, opt_arrow);
+    OPT(AST_AsyncArrow, opt_arrow);
+
+    OPT(AST_Function, function(self, compressor) {
+        drop_rest_farg(self, compressor);
+        self.body = tighten_body(self.body, compressor);
+        var parent = compressor.parent();
+        if (compressor.option("inline")) for (var i = 0; i < self.body.length; i++) {
+            var stat = self.body[i];
+            if (stat instanceof AST_Directive) continue;
+            if (stat instanceof AST_Return) {
+                if (i != self.body.length - 1) break;
+                var call = stat.value;
+                if (!call || call.TYPE != "Call") break;
+                if (call.is_expr_pure(compressor)) break;
+                var exp = call.expression, fn;
+                if (!(exp instanceof AST_SymbolRef)) {
+                    fn = exp;
+                } else if (self.name && self.name.definition() === exp.definition()) {
+                    break;
+                } else {
+                    fn = exp.fixed_value();
+                }
+                if (!(fn instanceof AST_Defun || fn instanceof AST_Function)) break;
+                if (fn.rest) break;
+                if (fn.uses_arguments) break;
+                if (fn === exp) {
+                    if (fn.parent_scope !== self) break;
+                    if (!all(fn.enclosed, function(def) {
+                        return def.scope !== self;
+                    })) break;
+                }
+                if ((fn !== exp || fn.name)
+                    && (parent instanceof AST_ClassMethod || parent instanceof AST_ObjectMethod)
+                    && parent.value === compressor.self()) break;
+                if (fn.contains_this()) break;
+                var len = fn.argnames.length;
+                if (len > 0 && compressor.option("inline") < 2) break;
+                if (len > self.argnames.length) break;
+                if (!all(self.argnames, function(argname) {
+                    return argname instanceof AST_SymbolFunarg;
+                })) break;
+                if (!all(call.args, function(arg) {
+                    return !(arg instanceof AST_Spread);
+                })) break;
+                for (var j = 0; j < len; j++) {
+                    var arg = call.args[j];
+                    if (!(arg instanceof AST_SymbolRef)) break;
+                    if (arg.definition() !== self.argnames[j].definition()) break;
+                }
+                if (j < len) break;
+                for (; j < call.args.length; j++) {
+                    if (call.args[j].has_side_effects(compressor)) break;
+                }
+                if (j < call.args.length) break;
+                if (len < self.argnames.length && !compressor.drop_fargs(self, parent)) {
+                    if (!compressor.drop_fargs(fn, call)) break;
+                    do {
+                        fn.argnames.push(fn.make_var(AST_SymbolFunarg, fn, "argument_" + len));
+                    } while (++len < self.argnames.length);
+                }
+                return exp;
+            }
+            break;
         }
         return self;
     });
 
-    AST_Scope.DEFMETHOD("drop_unused", function(compressor){
+    var NO_MERGE = makePredicate("arguments await yield");
+    AST_Scope.DEFMETHOD("merge_variables", function(compressor) {
+        if (!compressor.option("merge_vars")) return;
+        var in_arg = [], in_try, root, segment = {}, self = this;
+        var first = [], last = [], index = 0;
+        var declarations = new Dictionary();
+        var references = Object.create(null);
+        var prev = Object.create(null);
+        var tw = new TreeWalker(function(node, descend) {
+            if (node instanceof AST_Assign) {
+                var lhs = node.left;
+                var rhs = node.right;
+                if (lhs instanceof AST_Destructured) {
+                    rhs.walk(tw);
+                    walk_destructured(AST_SymbolRef, mark, lhs);
+                    return true;
+                }
+                if (lazy_op[node.operator.slice(0, -1)]) {
+                    lhs.walk(tw);
+                    push();
+                    rhs.walk(tw);
+                    if (lhs instanceof AST_SymbolRef) mark(lhs);
+                    pop();
+                    return true;
+                }
+                if (lhs instanceof AST_SymbolRef) {
+                    if (node.operator != "=") mark(lhs, true);
+                    rhs.walk(tw);
+                    mark(lhs);
+                    return true;
+                }
+                return;
+            }
+            if (node instanceof AST_Binary) {
+                if (!lazy_op[node.operator]) return;
+                walk_cond(node);
+                return true;
+            }
+            if (node instanceof AST_Break) {
+                var target = tw.loopcontrol_target(node);
+                if (!(target instanceof AST_IterationStatement)) insert(target);
+                return true;
+            }
+            if (node instanceof AST_Call) {
+                var exp = node.expression;
+                if (exp instanceof AST_LambdaExpression) {
+                    node.args.forEach(function(arg) {
+                        arg.walk(tw);
+                    });
+                    exp.walk(tw);
+                } else {
+                    descend();
+                    mark_expression(exp);
+                }
+                return true;
+            }
+            if (node instanceof AST_Class) {
+                if (node.name) node.name.walk(tw);
+                if (node.extends) node.extends.walk(tw);
+                node.properties.filter(function(prop) {
+                    if (prop.key instanceof AST_Node) prop.key.walk(tw);
+                    return prop.value;
+                }).forEach(function(prop) {
+                    if (prop.static) {
+                        prop.value.walk(tw);
+                    } else {
+                        push();
+                        segment.block = node;
+                        prop.value.walk(tw);
+                        pop();
+                    }
+                });
+                return true;
+            }
+            if (node instanceof AST_Conditional) {
+                walk_cond(node.condition, node.consequent, node.alternative);
+                return true;
+            }
+            if (node instanceof AST_Continue) {
+                var target = tw.loopcontrol_target(node);
+                if (target instanceof AST_Do) insert(target);
+                return true;
+            }
+            if (node instanceof AST_Do) {
+                push();
+                segment.block = node;
+                segment.loop = true;
+                var save = segment;
+                node.body.walk(tw);
+                if (segment.inserted === node) segment = save;
+                node.condition.walk(tw);
+                pop();
+                return true;
+            }
+            if (node instanceof AST_For) {
+                if (node.init) node.init.walk(tw);
+                push();
+                segment.block = node;
+                segment.loop = true;
+                if (node.condition) node.condition.walk(tw);
+                node.body.walk(tw);
+                if (node.step) node.step.walk(tw);
+                pop();
+                return true;
+            }
+            if (node instanceof AST_ForEnumeration) {
+                node.object.walk(tw);
+                push();
+                segment.block = node;
+                segment.loop = true;
+                node.init.walk(tw);
+                node.body.walk(tw);
+                pop();
+                return true;
+            }
+            if (node instanceof AST_If) {
+                walk_cond(node.condition, node.body, node.alternative);
+                return true;
+            }
+            if (node instanceof AST_LabeledStatement) {
+                push();
+                segment.block = node;
+                var save = segment;
+                node.body.walk(tw);
+                if (segment.inserted === node) segment = save;
+                pop();
+                return true;
+            }
+            if (node instanceof AST_Scope) {
+                push();
+                segment.block = node;
+                if (node === self) root = segment;
+                if (node instanceof AST_Lambda) {
+                    if (node.name) references[node.name.definition().id] = false;
+                    var marker = node.uses_arguments && !tw.has_directive("use strict") ? function(node) {
+                        references[node.definition().id] = false;
+                    } : function(node) {
+                        mark(node);
+                    };
+                    in_arg.push(node);
+                    node.argnames.forEach(function(argname) {
+                        walk_destructured(AST_SymbolFunarg, marker, argname);
+                    });
+                    if (node.rest) walk_destructured(AST_SymbolFunarg, marker, node.rest);
+                    in_arg.pop();
+                }
+                walk_lambda(node, tw);
+                pop();
+                return true;
+            }
+            if (node instanceof AST_Sub) {
+                var exp = node.expression;
+                if (node.optional) {
+                    exp.walk(tw);
+                    push();
+                    node.property.walk(tw);
+                    pop();
+                } else {
+                    descend();
+                }
+                mark_expression(exp);
+                return true;
+            }
+            if (node instanceof AST_Switch) {
+                node.expression.walk(tw);
+                var save = segment;
+                node.body.forEach(function(branch) {
+                    if (branch instanceof AST_Default) return;
+                    branch.expression.walk(tw);
+                    if (save === segment) push();
+                });
+                segment = save;
+                node.body.forEach(function(branch) {
+                    push();
+                    segment.block = node;
+                    var save = segment;
+                    walk_body(branch, tw);
+                    if (segment.inserted === node) segment = save;
+                    pop();
+                });
+                return true;
+            }
+            if (node instanceof AST_SymbolConst || node instanceof AST_SymbolLet) {
+                references[node.definition().id] = false;
+                return true;
+            }
+            if (node instanceof AST_SymbolRef) {
+                mark(node, true);
+                return true;
+            }
+            if (node instanceof AST_Try) {
+                var save_try = in_try;
+                in_try = node;
+                walk_body(node, tw);
+                if (node.bcatch) {
+                    if (node.bcatch.argname) node.bcatch.argname.mark_symbol(function(node) {
+                        if (node instanceof AST_SymbolCatch) {
+                            var def = node.definition();
+                            references[def.id] = false;
+                            if (def = def.redefined()) references[def.id] = false;
+                        }
+                    }, tw);
+                    if (node.bfinally || (in_try = save_try)) {
+                        walk_body(node.bcatch, tw);
+                    } else {
+                        push();
+                        walk_body(node.bcatch, tw);
+                        pop();
+                    }
+                }
+                in_try = save_try;
+                if (node.bfinally) node.bfinally.walk(tw);
+                return true;
+            }
+            if (node instanceof AST_Unary) {
+                if (!UNARY_POSTFIX[node.operator]) return;
+                var sym = node.expression;
+                if (!(sym instanceof AST_SymbolRef)) return;
+                mark(sym, true);
+                return true;
+            }
+            if (node instanceof AST_VarDef) {
+                var assigned = node.value;
+                if (assigned) {
+                    assigned.walk(tw);
+                } else {
+                    assigned = segment.block instanceof AST_ForEnumeration && segment.block.init === tw.parent();
+                }
+                walk_destructured(AST_SymbolDeclaration, assigned ? function(node) {
+                    if (node instanceof AST_SymbolVar) {
+                        mark(node);
+                    } else {
+                        node.walk(tw);
+                    }
+                } : function(node) {
+                    if (node instanceof AST_SymbolVar) {
+                        var id = node.definition().id;
+                        var refs = references[id];
+                        if (refs) {
+                            refs.push(node);
+                        } else if (!(id in references)) {
+                            declarations.add(id, node);
+                        }
+                    } else {
+                        node.walk(tw);
+                    }
+                }, node.name);
+                return true;
+            }
+            if (node instanceof AST_While) {
+                push();
+                segment.block = node;
+                segment.loop = true;
+                descend();
+                pop();
+                return true;
+            }
+
+            function mark_expression(exp) {
+                if (!compressor.option("ie")) return;
+                var sym = root_expr(exp);
+                if (sym instanceof AST_SymbolRef) sym.walk(tw);
+            }
+
+            function walk_cond(condition, consequent, alternative) {
+                var save = segment;
+                var segments = [ save, save ];
+                if (condition instanceof AST_Binary) switch (condition.operator) {
+                  case "&&":
+                    segments[0] = walk_cond(condition.left, condition.right)[0];
+                    break;
+                  case "||":
+                  case "??":
+                    segments[1] = walk_cond(condition.left, null, condition.right)[1];
+                    break;
+                  default:
+                    condition.walk(tw);
+                    break;
+                } else if (condition instanceof AST_Conditional) {
+                    walk_cond(condition.condition, condition.consequent, condition.alternative);
+                } else {
+                    condition.walk(tw);
+                }
+                segment = segments[0];
+                if (consequent) {
+                    push();
+                    consequent.walk(tw);
+                }
+                segments[0] = segment;
+                segment = segments[1];
+                if (alternative) {
+                    push();
+                    alternative.walk(tw);
+                }
+                segments[1] = segment;
+                segment = save;
+                return segments;
+            }
+        });
+        tw.directives = Object.create(compressor.directives);
+        self.walk(tw);
+        var changed = false;
+        var merged = Object.create(null);
+        while (first.length && last.length) {
+            var tail = last.shift();
+            if (!tail) continue;
+            var def = tail.definition;
+            var tail_refs = references[def.id];
+            if (!tail_refs) continue;
+            tail_refs = { end: tail_refs.end };
+            while (def.id in merged) def = merged[def.id];
+            tail_refs.start = references[def.id].start;
+            var skipped = [];
+            do {
+                var head = first.shift();
+                if (tail.index > head.index) continue;
+                var prev_def = head.definition;
+                if (!(prev_def.id in prev)) continue;
+                var head_refs = references[prev_def.id];
+                if (!head_refs) continue;
+                if (head_refs.start.block !== tail_refs.start.block
+                    || !mergeable(head_refs, tail_refs)
+                    || (head_refs.start.loop || !same_scope(def)) && !mergeable(tail_refs, head_refs)
+                    || compressor.option("webkit") && is_funarg(def) !== is_funarg(prev_def)
+                    || prev_def.const_redefs
+                    || !all(head_refs.scopes, function(scope) {
+                        return scope.find_variable(def.name) === def;
+                    })) {
+                    skipped.push(head);
+                    continue;
+                }
+                head_refs.forEach(function(sym) {
+                    sym.thedef = def;
+                    sym.name = def.name;
+                    if (sym instanceof AST_SymbolRef) {
+                        def.references.push(sym);
+                        prev_def.replaced++;
+                    } else {
+                        def.orig.push(sym);
+                        prev_def.eliminated++;
+                    }
+                });
+                if (!prev_def.fixed) def.fixed = false;
+                merged[prev_def.id] = def;
+                changed = true;
+                break;
+            } while (first.length);
+            if (skipped.length) first = skipped.concat(first);
+        }
+        return changed;
+
+        function push() {
+            segment = Object.create(segment);
+        }
+
+        function pop() {
+            segment = Object.getPrototypeOf(segment);
+        }
+
+        function walk_destructured(symbol_type, mark, lhs) {
+            var marker = new TreeWalker(function(node) {
+                if (node instanceof AST_Destructured) return;
+                if (node instanceof AST_DefaultValue) {
+                    push();
+                    node.value.walk(tw);
+                    pop();
+                    node.name.walk(marker);
+                } else if (node instanceof AST_DestructuredKeyVal) {
+                    if (!(node.key instanceof AST_Node)) {
+                        node.value.walk(marker);
+                    } else if (node.value instanceof AST_PropAccess) {
+                        push();
+                        segment.block = node;
+                        node.key.walk(tw);
+                        node.value.walk(marker);
+                        pop();
+                    } else {
+                        node.key.walk(tw);
+                        node.value.walk(marker);
+                    }
+                } else if (node instanceof symbol_type) {
+                    mark(node);
+                } else {
+                    node.walk(tw);
+                }
+                return true;
+            });
+            lhs.walk(marker);
+        }
+
+        function mark(sym, read) {
+            var def = sym.definition(), ldef;
+            if (read && !all(in_arg, function(fn) {
+                ldef = fn.variables.get(sym.name);
+                if (!ldef) return true;
+                if (!is_funarg(ldef)) return true;
+                return ldef !== def
+                    && !def.undeclared
+                    && fn.parent_scope.find_variable(sym.name) !== def;
+            })) return references[def.id] = references[ldef.id] = false;
+            var seg = segment;
+            if (in_try) {
+                push();
+                seg = segment;
+                pop();
+            }
+            if (def.id in references) {
+                var refs = references[def.id];
+                if (!refs) return;
+                if (refs.start.block !== seg.block) return references[def.id] = false;
+                push_ref(sym);
+                refs.end = seg;
+                if (def.id in prev) {
+                    last[prev[def.id]] = null;
+                } else if (!read) {
+                    return;
+                }
+            } else if ((ldef = self.variables.get(def.name)) !== def) {
+                if (ldef && root === seg) references[ldef.id] = false;
+                return references[def.id] = false;
+            } else if (compressor.exposed(def) || NO_MERGE[sym.name]) {
+                return references[def.id] = false;
+            } else {
+                var refs = declarations.get(def.id) || [];
+                refs.scopes = [];
+                push_ref(sym);
+                references[def.id] = refs;
+                if (!read) {
+                    refs.start = seg;
+                    return first.push({
+                        index: index++,
+                        definition: def,
+                    });
+                }
+                if (seg.block !== self) return references[def.id] = false;
+                refs.start = root;
+            }
+            prev[def.id] = last.length;
+            last.push({
+                index: index++,
+                definition: def,
+            });
+
+            function push_ref(sym) {
+                refs.push(sym);
+                push_uniq(refs.scopes, sym.scope);
+                var scope = find_scope(tw);
+                if (scope !== sym.scope) push_uniq(refs.scopes, scope);
+            }
+        }
+
+        function insert(target) {
+            var stack = [];
+            while (true) {
+                if (HOP(segment, "block")) {
+                    var block = segment.block;
+                    if (block instanceof AST_LabeledStatement) block = block.body;
+                    if (block === target) break;
+                }
+                stack.push(segment);
+                pop();
+            }
+            segment.inserted = segment.block;
+            push();
+            while (stack.length) {
+                var seg = stack.pop();
+                push();
+                if (HOP(seg, "block")) segment.block = seg.block;
+                if (HOP(seg, "loop")) segment.loop = seg.loop;
+            }
+        }
+
+        function must_visit(base, segment) {
+            return base === segment || base.isPrototypeOf(segment);
+        }
+
+        function mergeable(head, tail) {
+            return must_visit(head.start, head.end) || must_visit(head.start, tail.start);
+        }
+    });
+
+    function fill_holes(orig, elements) {
+        for (var i = elements.length; --i >= 0;) {
+            if (!elements[i]) elements[i] = make_node(AST_Hole, orig);
+        }
+    }
+
+    function to_class_expr(defcl, drop_name) {
+        var cl = make_node(AST_ClassExpression, defcl);
+        if (cl.name) cl.name = drop_name ? null : make_node(AST_SymbolClass, cl.name);
+        return cl;
+    }
+
+    function to_func_expr(defun, drop_name) {
+        var ctor;
+        switch (defun.CTOR) {
+          case AST_AsyncDefun:
+            ctor = AST_AsyncFunction;
+            break;
+          case AST_AsyncGeneratorDefun:
+            ctor = AST_AsyncGeneratorFunction;
+            break;
+          case AST_Defun:
+            ctor = AST_Function;
+            break;
+          case AST_GeneratorDefun:
+            ctor = AST_GeneratorFunction;
+            break;
+        }
+        var fn = make_node(ctor, defun);
+        fn.name = drop_name ? null : make_node(AST_SymbolLambda, defun.name);
+        return fn;
+    }
+
+    AST_Scope.DEFMETHOD("drop_unused", function(compressor) {
+        if (!compressor.option("unused")) return;
         var self = this;
-        if (compressor.option("unused")
-            && !(self instanceof AST_Toplevel)
-            && !self.uses_eval
-           ) {
-            var in_use = [];
-            var initializations = new Dictionary();
-            // pass 1: find out which symbols are directly used in
-            // this scope (not in nested scopes).
-            var scope = this;
-            var tw = new TreeWalker(function(node, descend){
-                if (node !== self) {
-                    if (node instanceof AST_Defun) {
-                        initializations.add(node.name.name, node);
-                        return true; // don't go in nested scopes
-                    }
-                    if (node instanceof AST_Definitions && scope === self) {
-                        node.definitions.forEach(function(def){
-                            if (def.value) {
-                                initializations.add(def.name.name, def.value);
-                                if (def.value.has_side_effects(compressor)) {
-                                    def.value.walk(tw);
+        var drop_funcs = !(self instanceof AST_Toplevel) || compressor.toplevel.funcs;
+        var drop_vars = !(self instanceof AST_Toplevel) || compressor.toplevel.vars;
+        var assign_as_unused = /keep_assign/.test(compressor.option("unused")) ? return_false : function(node, props) {
+            var sym, nested = false;
+            if (node instanceof AST_Assign) {
+                if (node.write_only || node.operator == "=") sym = extract_reference(node.left, props);
+            } else if (node instanceof AST_Unary) {
+                if (node.write_only) sym = extract_reference(node.expression, props);
+            }
+            if (!(sym instanceof AST_SymbolRef)) return;
+            var def = sym.definition();
+            if (export_defaults[def.id]) return;
+            if (compressor.exposed(def)) return;
+            if (!can_drop_symbol(sym, compressor, nested)) return;
+            return sym;
+
+            function extract_reference(node, props) {
+                if (node instanceof AST_PropAccess) {
+                    var expr = node.expression;
+                    if (!expr.may_throw_on_access(compressor, true)) {
+                        nested = true;
+                        if (props && node instanceof AST_Sub) props.unshift(node.property);
+                        return extract_reference(expr, props);
+                    }
+                } else if (node instanceof AST_Assign && node.operator == "=") {
+                    node.write_only = "p";
+                    var ref = extract_reference(node.right);
+                    if (!props) return ref;
+                    props.assign = node;
+                    return ref instanceof AST_SymbolRef ? ref : node.left;
+                }
+                return node;
+            }
+        };
+        var assign_in_use = Object.create(null);
+        var export_defaults = Object.create(null);
+        var find_variable = function(name) {
+            find_variable = compose(self, 0, noop);
+            return find_variable(name);
+
+            function compose(child, level, find) {
+                var parent = compressor.parent(level);
+                if (!parent) return find;
+                var in_arg = parent instanceof AST_Lambda && member(child, parent.argnames);
+                return compose(parent, level + 1, in_arg ? function(name) {
+                    var def = find(name);
+                    if (def) return def;
+                    def = parent.variables.get(name);
+                    if (def) {
+                        var sym = def.orig[0];
+                        if (sym instanceof AST_SymbolFunarg || sym instanceof AST_SymbolLambda) return def;
+                    }
+                } : parent.variables ? function(name) {
+                    return find(name) || parent.variables.get(name);
+                } : find);
+            }
+        };
+        var for_ins = Object.create(null);
+        var in_use = [];
+        var in_use_ids = Object.create(null); // avoid expensive linear scans of in_use
+        var lambda_ids = Object.create(null);
+        var value_read = Object.create(null);
+        var value_modified = Object.create(null);
+        var var_defs = Object.create(null);
+        if (self instanceof AST_Toplevel && compressor.top_retain) {
+            self.variables.each(function(def) {
+                if (compressor.top_retain(def) && !(def.id in in_use_ids)) {
+                    AST_Node.info("Retaining variable {name}", def);
+                    in_use_ids[def.id] = true;
+                    in_use.push(def);
+                }
+            });
+        }
+        var assignments = new Dictionary();
+        var initializations = new Dictionary();
+        // pass 1: find out which symbols are directly used in
+        // this scope (not in nested scopes).
+        var scope = this;
+        var tw = new TreeWalker(function(node, descend) {
+            if (node instanceof AST_Lambda && node.uses_arguments && !tw.has_directive("use strict")) {
+                node.each_argname(function(argname) {
+                    var def = argname.definition();
+                    if (!(def.id in in_use_ids)) {
+                        in_use_ids[def.id] = true;
+                        in_use.push(def);
+                    }
+                });
+            }
+            if (node === self) return;
+            if (scope === self) {
+                if (node instanceof AST_DefClass) {
+                    var def = node.name.definition();
+                    var drop = drop_funcs && !def.exported;
+                    if (!drop && !(def.id in in_use_ids)) {
+                        in_use_ids[def.id] = true;
+                        in_use.push(def);
+                    }
+                    var used = tw.parent() instanceof AST_ExportDefault;
+                    if (used) {
+                        export_defaults[def.id] = true;
+                    } else if (drop && !(def.id in lambda_ids)) {
+                        lambda_ids[def.id] = 1;
+                    }
+                    if (node.extends) node.extends.walk(tw);
+                    var values = [];
+                    node.properties.forEach(function(prop) {
+                        if (prop.key instanceof AST_Node) prop.key.walk(tw);
+                        var value = prop.value;
+                        if (!value) return;
+                        if (is_static_field_or_init(prop)) {
+                            if (!used && value.contains_this()) used = true;
+                            walk_class_prop(value);
+                        } else {
+                            values.push(value);
+                        }
+                    });
+                    values.forEach(drop && used ? walk_class_prop : function(value) {
+                        initializations.add(def.id, value);
+                    });
+                    return true;
+                }
+                if (node instanceof AST_LambdaDefinition) {
+                    var def = node.name.definition();
+                    var drop = drop_funcs && !def.exported;
+                    if (!drop && !(def.id in in_use_ids)) {
+                        in_use_ids[def.id] = true;
+                        in_use.push(def);
+                    }
+                    initializations.add(def.id, node);
+                    if (tw.parent() instanceof AST_ExportDefault) {
+                        export_defaults[def.id] = true;
+                        return scan_ref_scoped(node, descend, true);
+                    }
+                    if (drop && !(def.id in lambda_ids)) lambda_ids[def.id] = 1;
+                    return true;
+                }
+                if (node instanceof AST_Definitions) {
+                    node.definitions.forEach(function(defn) {
+                        var value = defn.value;
+                        var side_effects = value
+                            && (defn.name instanceof AST_Destructured || value.has_side_effects(compressor));
+                        var shared = side_effects && value.tail_node().operator == "=";
+                        defn.name.mark_symbol(function(name) {
+                            if (!(name instanceof AST_SymbolDeclaration)) return;
+                            var def = name.definition();
+                            var_defs[def.id] = (var_defs[def.id] || 0) + 1;
+                            if (node instanceof AST_Var && def.orig[0] instanceof AST_SymbolCatch) {
+                                var redef = def.redefined();
+                                if (redef) var_defs[redef.id] = (var_defs[redef.id] || 0) + 1;
+                            }
+                            if (!(def.id in in_use_ids) && (!drop_vars || def.exported
+                                || (node instanceof AST_Const ? def.redefined() : def.const_redefs)
+                                || !(node instanceof AST_Var || is_safe_lexical(def)))) {
+                                in_use_ids[def.id] = true;
+                                in_use.push(def);
+                            }
+                            if (value) {
+                                if (!side_effects) {
+                                    initializations.add(def.id, value);
+                                } else if (shared) {
+                                    verify_safe_usage(def, name, value_modified[def.id]);
                                 }
+                                assignments.add(def.id, defn);
                             }
-                        });
-                        return true;
+                            unmark_lambda(def);
+                            return true;
+                        }, tw);
+                        if (side_effects) value.walk(tw);
+                    });
+                    return true;
+                }
+                if (node instanceof AST_SymbolFunarg) {
+                    var def = node.definition();
+                    var_defs[def.id] = (var_defs[def.id] || 0) + 1;
+                    assignments.add(def.id, node);
+                    return true;
+                }
+                if (node instanceof AST_SymbolImport) {
+                    var def = node.definition();
+                    if (!(def.id in in_use_ids) && (!drop_vars || !is_safe_lexical(def))) {
+                        in_use_ids[def.id] = true;
+                        in_use.push(def);
                     }
-                    if (node instanceof AST_SymbolRef) {
-                        push_uniq(in_use, node.definition());
+                    return true;
+                }
+            }
+            return scan_ref_scoped(node, descend, true);
+
+            function walk_class_prop(value) {
+                var save_scope = scope;
+                scope = node;
+                value.walk(tw);
+                scope = save_scope;
+            }
+        });
+        tw.directives = Object.create(compressor.directives);
+        self.walk(tw);
+        var drop_fn_name = compressor.option("keep_fnames") ? return_false : compressor.option("ie") ? function(def) {
+            return !compressor.exposed(def) && def.references.length == def.replaced;
+        } : function(def) {
+            if (!(def.id in in_use_ids)) return true;
+            if (def.orig.length - def.eliminated < 2) return false;
+            // function argument will always overshadow its name
+            if (def.orig[1] instanceof AST_SymbolFunarg) return true;
+            // retain if referenced within destructured object of argument
+            return all(def.references, function(ref) {
+                return !ref.in_arg;
+            });
+        };
+        if (compressor.option("ie")) initializations.each(function(init, id) {
+            if (id in in_use_ids) return;
+            init.forEach(function(init) {
+                init.walk(new TreeWalker(function(node) {
+                    if (node instanceof AST_Function && node.name && !drop_fn_name(node.name.definition())) {
+                        node.walk(tw);
                         return true;
                     }
-                    if (node instanceof AST_Scope) {
-                        var save_scope = scope;
-                        scope = node;
-                        descend();
-                        scope = save_scope;
-                        return true;
+                    if (node instanceof AST_Scope) return true;
+                }));
+            });
+        });
+        // pass 2: for every used symbol we need to walk its
+        // initialization code to figure out if it uses other
+        // symbols (that may not be in_use).
+        tw = new TreeWalker(scan_ref_scoped);
+        for (var i = 0; i < in_use.length; i++) {
+            var init = initializations.get(in_use[i].id);
+            if (init) init.forEach(function(init) {
+                init.walk(tw);
+            });
+        }
+        Object.keys(assign_in_use).forEach(function(id) {
+            var assigns = assign_in_use[id];
+            if (!assigns) {
+                delete assign_in_use[id];
+                return;
+            }
+            assigns = assigns.reduce(function(in_use, assigns) {
+                assigns.forEach(function(assign) {
+                    push_uniq(in_use, assign);
+                });
+                return in_use;
+            }, []);
+            var in_use = (assignments.get(id) || []).filter(function(node) {
+                return find_if(node instanceof AST_Unary ? function(assign) {
+                    return assign === node;
+                } : function(assign) {
+                    if (assign === node) return true;
+                    if (assign instanceof AST_Unary) return false;
+                    return get_rvalue(assign) === get_rvalue(node);
+                }, assigns);
+            });
+            if (assigns.length == in_use.length) {
+                assign_in_use[id] = in_use;
+            } else {
+                delete assign_in_use[id];
+            }
+        });
+        // pass 3: we should drop declarations not in_use
+        var calls_to_drop_args = [];
+        var fns_with_marked_args = [];
+        var trimmer = new TreeTransformer(function(node) {
+            if (node instanceof AST_DefaultValue) return trim_default(trimmer, node);
+            if (node instanceof AST_Destructured && node.rest) node.rest = node.rest.transform(trimmer);
+            if (node instanceof AST_DestructuredArray) {
+                var trim = !node.rest;
+                for (var i = node.elements.length; --i >= 0;) {
+                    var element = node.elements[i].transform(trimmer);
+                    if (element) {
+                        node.elements[i] = element;
+                        trim = false;
+                    } else if (trim) {
+                        node.elements.pop();
+                    } else {
+                        node.elements[i] = make_node(AST_Hole, node.elements[i]);
                     }
                 }
-            });
-            self.walk(tw);
-            // pass 2: for every used symbol we need to walk its
-            // initialization code to figure out if it uses other
-            // symbols (that may not be in_use).
-            for (var i = 0; i < in_use.length; ++i) {
-                in_use[i].orig.forEach(function(decl){
-                    // undeclared globals will be instanceof AST_SymbolRef
-                    var init = initializations.get(decl.name);
-                    if (init) init.forEach(function(init){
-                        var tw = new TreeWalker(function(node){
-                            if (node instanceof AST_SymbolRef) {
-                                push_uniq(in_use, node.definition());
-                            }
-                        });
-                        init.walk(tw);
+                return node;
+            }
+            if (node instanceof AST_DestructuredObject) {
+                var properties = [];
+                node.properties.forEach(function(prop) {
+                    var retain = false;
+                    if (prop.key instanceof AST_Node) {
+                        prop.key = prop.key.transform(tt);
+                        retain = prop.key.has_side_effects(compressor);
+                    }
+                    if ((retain || node.rest) && is_decl(prop.value)) {
+                        prop.value = prop.value.transform(tt);
+                        properties.push(prop);
+                    } else {
+                        var value = prop.value.transform(trimmer);
+                        if (!value && node.rest) {
+                            if (prop.value instanceof AST_DestructuredArray) {
+                                value = make_node(AST_DestructuredArray, prop.value, { elements: [] });
+                            } else {
+                                value = make_node(AST_DestructuredObject, prop.value, { properties: [] });
+                            }
+                        }
+                        if (value) {
+                            prop.value = value;
+                            properties.push(prop);
+                        }
+                    }
+                });
+                node.properties = properties;
+                return node;
+            }
+            if (node instanceof AST_SymbolDeclaration) return trim_decl(node);
+        });
+        var tt = new TreeTransformer(function(node, descend, in_list) {
+            var parent = tt.parent();
+            if (drop_vars) {
+                var props = [], sym = assign_as_unused(node, props);
+                if (sym) {
+                    var value;
+                    if (can_drop_lhs(sym, node)) {
+                        if (node instanceof AST_Assign) {
+                            value = get_rhs(node);
+                            if (node.write_only === true) value = value.drop_side_effect_free(compressor);
+                        }
+                        if (!value) value = make_node(AST_Number, node, { value: 0 });
+                    }
+                    if (value) {
+                        if (props.assign) {
+                            var assign = props.assign.drop_side_effect_free(compressor);
+                            if (assign) {
+                                assign.write_only = true;
+                                props.unshift(assign);
+                            }
+                        }
+                        if (!(parent instanceof AST_Sequence)
+                            || parent.tail_node() === node
+                            || value.has_side_effects(compressor)) {
+                            props.push(value);
+                        }
+                        switch (props.length) {
+                          case 0:
+                            return List.skip;
+                          case 1:
+                            return maintain_this_binding(parent, node, props[0].transform(tt));
+                          default:
+                            return make_sequence(node, props.map(function(prop) {
+                                return prop.transform(tt);
+                            }));
+                        }
+                    }
+                } else if (node instanceof AST_UnaryPostfix
+                    && node.expression instanceof AST_SymbolRef
+                    && indexOf_assign(node.expression.definition(), node) < 0) {
+                    return make_node(AST_UnaryPrefix, node, {
+                        operator: "+",
+                        expression: node.expression,
                     });
+                }
+            }
+            if (node instanceof AST_Binary && node.operator == "instanceof") {
+                var sym = node.right;
+                if (!(sym instanceof AST_SymbolRef)) return;
+                if (sym.definition().id in in_use_ids) return;
+                var lhs = node.left.drop_side_effect_free(compressor);
+                var value = make_node(AST_False, node).optimize(compressor);
+                return lhs ? make_sequence(node, [ lhs, value ]) : value;
+            }
+            if (node instanceof AST_Call) {
+                calls_to_drop_args.push(node);
+                node.args = node.args.map(function(arg) {
+                    return arg.transform(tt);
                 });
+                node.expression = node.expression.transform(tt);
+                return node;
             }
-            // pass 3: we should drop declarations not in_use
-            var tt = new TreeTransformer(
-                function before(node, descend, in_list) {
-                    if (node instanceof AST_Lambda && !(node instanceof AST_Accessor)) {
-                        if (compressor.option("unsafe") && !compressor.option("keep_fargs")) {
-                            for (var a = node.argnames, i = a.length; --i >= 0;) {
-                                var sym = a[i];
-                                if (sym.unreferenced()) {
-                                    a.pop();
-                                    compressor.warn("Dropping unused function argument {name} [{file}:{line},{col}]", {
-                                        name : sym.name,
-                                        file : sym.start.file,
-                                        line : sym.start.line,
-                                        col  : sym.start.col
-                                    });
+            if (scope !== self) return;
+            if (drop_funcs && node !== self && node instanceof AST_DefClass) {
+                var def = node.name.definition();
+                if (!(def.id in in_use_ids)) {
+                    log(node.name, "Dropping unused class {name}");
+                    def.eliminated++;
+                    descend(node, tt);
+                    var trimmed = to_class_expr(node, true);
+                    if (parent instanceof AST_ExportDefault) return trimmed;
+                    trimmed = trimmed.drop_side_effect_free(compressor, true);
+                    if (trimmed) return make_node(AST_SimpleStatement, node, { body: trimmed });
+                    return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+                }
+            }
+            if (node instanceof AST_ClassExpression && node.name && drop_fn_name(node.name.definition())) {
+                node.name = null;
+            }
+            if (node instanceof AST_Lambda) {
+                if (drop_funcs && node !== self && node instanceof AST_LambdaDefinition) {
+                    var def = node.name.definition();
+                    if (!(def.id in in_use_ids)) {
+                        log(node.name, "Dropping unused function {name}");
+                        def.eliminated++;
+                        if (parent instanceof AST_ExportDefault) {
+                            descend_scope();
+                            return to_func_expr(node, true);
+                        }
+                        return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+                    }
+                }
+                descend_scope();
+                if (node instanceof AST_LambdaExpression && node.name && drop_fn_name(node.name.definition())) {
+                    node.name = null;
+                }
+                if (!(node instanceof AST_Accessor)) {
+                    var args, spread, trim = compressor.drop_fargs(node, parent);
+                    if (trim && parent instanceof AST_Call && parent.expression === node) {
+                        args = parent.args;
+                        for (spread = 0; spread < args.length; spread++) {
+                            if (args[spread] instanceof AST_Spread) break;
+                        }
+                    }
+                    var argnames = node.argnames;
+                    var rest = node.rest;
+                    var after = false, before = false;
+                    if (rest) {
+                        before = true;
+                        if (!args || spread < argnames.length || rest instanceof AST_SymbolFunarg) {
+                            rest = rest.transform(trimmer);
+                        } else {
+                            var trimmed = trim_destructured(rest, make_node(AST_Array, parent, {
+                                elements: args.slice(argnames.length),
+                            }), trim_decl, !node.uses_arguments, rest);
+                            rest = trimmed.name;
+                            args.length = argnames.length;
+                            if (trimmed.value.elements.length) [].push.apply(args, trimmed.value.elements);
+                        }
+                        if (rest instanceof AST_Destructured && !rest.rest) {
+                            if (rest instanceof AST_DestructuredArray) {
+                                if (rest.elements.length == 0) rest = null;
+                            } else if (rest.properties.length == 0) {
+                                rest = null;
+                            }
+                        }
+                        node.rest = rest;
+                        if (rest) {
+                            trim = false;
+                            after = true;
+                        }
+                    }
+                    var default_length = trim ? -1 : node.length();
+                    var trim_value = args && !node.uses_arguments && parent !== compressor.parent();
+                    for (var i = argnames.length; --i >= 0;) {
+                        var sym = argnames[i];
+                        if (sym instanceof AST_SymbolFunarg) {
+                            var def = sym.definition();
+                            if (def.id in in_use_ids) {
+                                trim = false;
+                                if (indexOf_assign(def, sym) < 0) sym.unused = null;
+                            } else if (trim) {
+                                log(sym, "Dropping unused function argument {name}");
+                                argnames.pop();
+                                def.eliminated++;
+                                sym.unused = true;
+                            } else {
+                                sym.unused = true;
+                            }
+                        } else {
+                            before = true;
+                            var funarg;
+                            if (!args || spread < i) {
+                                funarg = sym.transform(trimmer);
+                            } else {
+                                var trimmed = trim_destructured(sym, args[i], trim_decl, trim_value, sym);
+                                funarg = trimmed.name;
+                                if (trimmed.value) args[i] = trimmed.value;
+                            }
+                            if (funarg) {
+                                trim = false;
+                                argnames[i] = funarg;
+                                if (!after) after = !(funarg instanceof AST_SymbolFunarg);
+                            } else if (trim) {
+                                log_default(sym, "Dropping unused default argument {name}");
+                                argnames.pop();
+                            } else if (i > default_length) {
+                                log_default(sym, "Dropping unused default argument assignment {name}");
+                                if (sym.name instanceof AST_SymbolFunarg) {
+                                    sym.name.unused = true;
+                                } else {
+                                    after = true;
                                 }
-                                else break;
+                                argnames[i] = sym.name;
+                            } else {
+                                log_default(sym, "Dropping unused default argument value {name}");
+                                argnames[i] = sym = sym.clone();
+                                sym.value = make_node(AST_Number, sym, { value: 0 });
+                                after = true;
                             }
                         }
                     }
-                    if (node instanceof AST_Defun && node !== self) {
-                        if (!member(node.name.definition(), in_use)) {
-                            compressor.warn("Dropping unused function {name} [{file}:{line},{col}]", {
-                                name : node.name.name,
-                                file : node.name.start.file,
-                                line : node.name.start.line,
-                                col  : node.name.start.col
+                    if (before && !after && node.uses_arguments && !tt.has_directive("use strict")) {
+                        node.rest = make_node(AST_DestructuredArray, node, { elements: [] });
+                    }
+                    fns_with_marked_args.push(node);
+                }
+                return node;
+            }
+            if (node instanceof AST_Catch && node.argname instanceof AST_Destructured) {
+                node.argname.transform(trimmer);
+            }
+            if (node instanceof AST_Definitions && !(parent instanceof AST_ForEnumeration && parent.init === node)) {
+                // place uninitialized names at the start
+                var body = [], head = [], tail = [];
+                // for unused names whose initialization has
+                // side effects, we can cascade the init. code
+                // into the next one, or next statement.
+                var side_effects = [];
+                var duplicated = 0;
+                var is_var = node instanceof AST_Var;
+                node.definitions.forEach(function(def) {
+                    if (def.value) def.value = def.value.transform(tt);
+                    var value = def.value;
+                    if (def.name instanceof AST_Destructured) {
+                        var trimmed = trim_destructured(def.name, value, function(node) {
+                            if (!drop_vars) return node;
+                            if (node.definition().id in in_use_ids) return node;
+                            if (is_catch(node)) return node;
+                            if (is_var && !can_drop_symbol(node)) return node;
+                            return null;
+                        }, true);
+                        if (trimmed.name) {
+                            def = make_node(AST_VarDef, def, {
+                                name: trimmed.name,
+                                value: value = trimmed.value,
                             });
-                            return make_node(AST_EmptyStatement, node);
+                            flush();
+                        } else if (trimmed.value) {
+                            side_effects.push(trimmed.value);
                         }
-                        return node;
+                        return;
                     }
-                    if (node instanceof AST_Definitions && !(tt.parent() instanceof AST_ForIn)) {
-                        var def = node.definitions.filter(function(def){
-                            if (member(def.name.definition(), in_use)) return true;
-                            var w = {
-                                name : def.name.name,
-                                file : def.name.start.file,
-                                line : def.name.start.line,
-                                col  : def.name.start.col
-                            };
-                            if (def.value && def.value.has_side_effects(compressor)) {
-                                def._unused_side_effects = true;
-                                compressor.warn("Side effects in initialization of unused variable {name} [{file}:{line},{col}]", w);
-                                return true;
+                    var sym = def.name.definition();
+                    var drop_sym = is_var ? can_drop_symbol(def.name) : is_safe_lexical(sym);
+                    if (!drop_sym || !drop_vars || sym.id in in_use_ids) {
+                        var index;
+                        if (value && ((index = indexOf_assign(sym, def)) < 0 || self_assign(value.tail_node()))) {
+                            def = def.clone();
+                            value = value.drop_side_effect_free(compressor);
+                            if (value) AST_Node.warn("Side effects in definition of variable {name} [{start}]", def.name);
+                            if (node instanceof AST_Const) {
+                                def.value = value || make_node(AST_Number, def, { value: 0 });
+                            } else {
+                                def.value = null;
+                                if (value) side_effects.push(value);
                             }
-                            compressor.warn("Dropping unused variable {name} [{file}:{line},{col}]", w);
-                            return false;
-                        });
-                        // place uninitialized names at the start
-                        def = mergeSort(def, function(a, b){
-                            if (!a.value && b.value) return -1;
-                            if (!b.value && a.value) return 1;
-                            return 0;
-                        });
-                        // for unused names whose initialization has
-                        // side effects, we can cascade the init. code
-                        // into the next one, or next statement.
-                        var side_effects = [];
-                        for (var i = 0; i < def.length;) {
-                            var x = def[i];
-                            if (x._unused_side_effects) {
-                                side_effects.push(x.value);
-                                def.splice(i, 1);
+                            value = null;
+                            if (index >= 0) assign_in_use[sym.id][index] = def;
+                        }
+                        var old_def, fn;
+                        if (!value && !(node instanceof AST_Let)) {
+                            if (parent instanceof AST_ExportDeclaration) {
+                                flush();
+                            } else if (drop_sym && var_defs[sym.id] > 1) {
+                                AST_Node.info("Dropping declaration of variable {name} [{start}]", def.name);
+                                var_defs[sym.id]--;
+                                sym.eliminated++;
                             } else {
-                                if (side_effects.length > 0) {
-                                    side_effects.push(x.value);
-                                    x.value = AST_Seq.from_array(side_effects);
-                                    side_effects = [];
-                                }
-                                ++i;
+                                head.push(def);
+                            }
+                        } else if (compressor.option("functions")
+                            && !compressor.option("ie")
+                            && drop_sym
+                            && value
+                            && var_defs[sym.id] == 1
+                            && sym.assignments == 0
+                            && (fn = value.tail_node()) instanceof AST_LambdaExpression
+                            && !is_arguments(sym)
+                            && !is_arrow(fn)
+                            && assigned_once(fn, sym.references)
+                            && can_declare_defun(fn)
+                            && (old_def = rename_def(fn, def.name.name)) !== false) {
+                            AST_Node.warn("Declaring {name} as function [{start}]", def.name);
+                            var ctor;
+                            switch (fn.CTOR) {
+                              case AST_AsyncFunction:
+                                ctor = AST_AsyncDefun;
+                                break;
+                              case AST_AsyncGeneratorFunction:
+                                ctor = AST_AsyncGeneratorDefun;
+                                break;
+                              case AST_Function:
+                                ctor = AST_Defun;
+                                break;
+                              case AST_GeneratorFunction:
+                                ctor = AST_GeneratorDefun;
+                                break;
+                            }
+                            var defun = make_node(ctor, fn);
+                            defun.name = make_node(AST_SymbolDefun, def.name);
+                            var name_def = def.name.scope.resolve().def_function(defun.name);
+                            if (old_def) old_def.forEach(function(node) {
+                                node.name = name_def.name;
+                                node.thedef = name_def;
+                                node.reference();
+                            });
+                            body.push(defun);
+                            if (value !== fn) [].push.apply(side_effects, value.expressions.slice(0, -1));
+                        } else {
+                            if (drop_sym
+                                && var_defs[sym.id] > 1
+                                && !(parent instanceof AST_ExportDeclaration)
+                                && sym.orig.indexOf(def.name) > sym.eliminated) {
+                                var_defs[sym.id]--;
+                                duplicated++;
                             }
+                            flush();
+                        }
+                    } else if (is_catch(def.name)) {
+                        value = value && value.drop_side_effect_free(compressor);
+                        if (value) side_effects.push(value);
+                        if (var_defs[sym.id] > 1) {
+                            AST_Node.warn("Dropping duplicated declaration of variable {name} [{start}]", def.name);
+                            var_defs[sym.id]--;
+                            sym.eliminated++;
+                        } else {
+                            def.value = null;
+                            head.push(def);
+                        }
+                    } else {
+                        value = value && value.drop_side_effect_free(compressor);
+                        if (value) {
+                            AST_Node.warn("Side effects in initialization of unused variable {name} [{start}]", def.name);
+                            side_effects.push(value);
+                        } else {
+                            log(def.name, "Dropping unused variable {name}");
                         }
+                        sym.eliminated++;
+                    }
+
+                    function self_assign(ref) {
+                        return ref instanceof AST_SymbolRef && ref.definition() === sym;
+                    }
+
+                    function assigned_once(fn, refs) {
+                        if (refs.length == 0) return fn === def.name.fixed_value();
+                        return all(refs, function(ref) {
+                            return fn === ref.fixed_value();
+                        });
+                    }
+
+                    function can_declare_defun(fn) {
+                        if (!is_var || compressor.has_directive("use strict") || !(fn instanceof AST_Function)) {
+                            return parent instanceof AST_Scope;
+                        }
+                        return parent instanceof AST_Block
+                            || parent instanceof AST_For && parent.init === node
+                            || parent instanceof AST_If;
+                    }
+
+                    function rename_def(fn, name) {
+                        if (!fn.name) return null;
+                        var def = fn.name.definition();
+                        if (def.orig.length > 1) return null;
+                        if (def.assignments > 0) return false;
+                        if (def.name == name) return def;
+                        if (compressor.option("keep_fnames")) return false;
+                        var forbidden;
+                        switch (name) {
+                          case "await":
+                            forbidden = is_async;
+                            break;
+                          case "yield":
+                            forbidden = is_generator;
+                            break;
+                        }
+                        return all(def.references, function(ref) {
+                            var scope = ref.scope;
+                            if (scope.find_variable(name) !== sym) return false;
+                            if (forbidden) do {
+                                scope = scope.resolve();
+                                if (forbidden(scope)) return false;
+                            } while (scope !== fn && (scope = scope.parent_scope));
+                            return true;
+                        }) && def;
+                    }
+
+                    function is_catch(node) {
+                        var sym = node.definition();
+                        return sym.orig[0] instanceof AST_SymbolCatch && sym.scope.resolve() === node.scope.resolve();
+                    }
+
+                    function flush() {
                         if (side_effects.length > 0) {
-                            side_effects = make_node(AST_BlockStatement, node, {
-                                body: [ make_node(AST_SimpleStatement, node, {
-                                    body: AST_Seq.from_array(side_effects)
-                                }) ]
+                            if (tail.length == 0) {
+                                body.push(make_node(AST_SimpleStatement, node, {
+                                    body: make_sequence(node, side_effects),
+                                }));
+                            } else if (value) {
+                                side_effects.push(value);
+                                def.value = make_sequence(value, side_effects);
+                            } else {
+                                def.value = make_node(AST_UnaryPrefix, def, {
+                                    operator: "void",
+                                    expression: make_sequence(def, side_effects),
+                                });
+                            }
+                            side_effects = [];
+                        }
+                        tail.push(def);
+                    }
+                });
+                switch (head.length) {
+                  case 0:
+                    if (tail.length == 0) break;
+                    if (tail.length == duplicated) {
+                        [].unshift.apply(side_effects, tail.map(function(def) {
+                            AST_Node.info("Dropping duplicated definition of variable {name} [{start}]", def.name);
+                            var sym = def.name.definition();
+                            var ref = make_node(AST_SymbolRef, def.name);
+                            sym.references.push(ref);
+                            var assign = make_node(AST_Assign, def, {
+                                operator: "=",
+                                left: ref,
+                                right: def.value,
                             });
-                        } else {
-                            side_effects = null;
+                            var index = indexOf_assign(sym, def);
+                            if (index >= 0) assign_in_use[sym.id][index] = assign;
+                            sym.assignments++;
+                            sym.eliminated++;
+                            return assign;
+                        }));
+                        break;
+                    }
+                  case 1:
+                    if (tail.length == 0) {
+                        var id = head[0].name.definition().id;
+                        if (id in for_ins) {
+                            node.definitions = head;
+                            for_ins[id].init = node;
+                            break;
+                        }
+                    }
+                  default:
+                    var seq;
+                    if (tail.length > 0 && (seq = tail[0].value) instanceof AST_Sequence) {
+                        tail[0].value = seq.tail_node();
+                        body.push(make_node(AST_SimpleStatement, node, {
+                            body: make_sequence(seq, seq.expressions.slice(0, -1)),
+                        }));
+                    }
+                    node.definitions = head.concat(tail);
+                    body.push(node);
+                }
+                if (side_effects.length > 0) {
+                    body.push(make_node(AST_SimpleStatement, node, { body: make_sequence(node, side_effects) }));
+                }
+                return insert_statements(body, node, in_list);
+            }
+            if (node instanceof AST_Assign) {
+                descend(node, tt);
+                if (!(node.left instanceof AST_Destructured)) return node;
+                var trimmed = trim_destructured(node.left, node.right, function(node) {
+                    return node;
+                }, node.write_only === true);
+                if (trimmed.name) return make_node(AST_Assign, node, {
+                    operator: node.operator,
+                    left: trimmed.name,
+                    right: trimmed.value,
+                });
+                if (trimmed.value) return trimmed.value;
+                if (parent instanceof AST_Sequence && parent.tail_node() !== node) return List.skip;
+                return make_node(AST_Number, node, { value: 0 });
+            }
+            if (node instanceof AST_LabeledStatement && node.body instanceof AST_For) {
+                // Certain combination of unused name + side effect leads to invalid AST:
+                //    https://github.com/mishoo/UglifyJS/issues/1830
+                // We fix it at this stage by moving the label inwards, back to the `for`.
+                descend(node, tt);
+                if (node.body instanceof AST_BlockStatement) {
+                    var block = node.body;
+                    node.body = block.body.pop();
+                    block.body.push(node);
+                    return in_list ? List.splice(block.body) : block;
+                }
+                return node;
+            }
+            if (node instanceof AST_Scope) {
+                descend_scope();
+                return node;
+            }
+            if (node instanceof AST_SymbolImport) {
+                if (!compressor.option("imports") || node.definition().id in in_use_ids) return node;
+                return in_list ? List.skip : null;
+            }
+
+            function descend_scope() {
+                var save_scope = scope;
+                scope = node;
+                descend(node, tt);
+                scope = save_scope;
+            }
+        }, function(node, in_list) {
+            if (node instanceof AST_BlockStatement) return trim_block(node, tt.parent(), in_list);
+            if (node instanceof AST_ExportDeclaration) {
+                var block = node.body;
+                if (!(block instanceof AST_BlockStatement)) return;
+                node.body = block.body.pop();
+                block.body.push(node);
+                return in_list ? List.splice(block.body) : block;
+            }
+            if (node instanceof AST_For) return patch_for_init(node, in_list);
+            if (node instanceof AST_ForIn) {
+                if (!drop_vars || !compressor.option("loops")) return;
+                if (!is_empty(node.body)) return;
+                var sym = get_init_symbol(node);
+                if (!sym) return;
+                var def = sym.definition();
+                if (def.id in in_use_ids) return;
+                log(sym, "Dropping unused loop variable {name}");
+                if (for_ins[def.id] === node) delete for_ins[def.id];
+                var body = [];
+                var value = node.object.drop_side_effect_free(compressor);
+                if (value) {
+                    AST_Node.warn("Side effects in object of for-in loop [{start}]", value);
+                    body.push(make_node(AST_SimpleStatement, node, { body: value }));
+                }
+                if (node.init instanceof AST_Definitions && def.orig[0] instanceof AST_SymbolCatch) {
+                    body.push(node.init);
+                }
+                return insert_statements(body, node, in_list);
+            }
+            if (node instanceof AST_Import) {
+                if (node.properties && node.properties.length == 0) node.properties = null;
+                return node;
+            }
+            if (node instanceof AST_Sequence) {
+                if (node.expressions.length > 1) return;
+                return maintain_this_binding(tt.parent(), node, node.expressions[0]);
+            }
+        });
+        tt.push(compressor.parent());
+        tt.directives = Object.create(compressor.directives);
+        self.transform(tt);
+        if (self instanceof AST_Lambda
+            && self.body.length == 1
+            && self.body[0] instanceof AST_Directive
+            && self.body[0].value == "use strict") {
+            self.body.length = 0;
+        }
+        calls_to_drop_args.forEach(function(call) {
+            drop_unused_call_args(call, compressor, fns_with_marked_args);
+        });
+
+        function log(sym, text) {
+            AST_Node[sym.definition().references.length > 0 ? "info" : "warn"](text + " [{start}]", sym);
+        }
+
+        function log_default(node, text) {
+            if (node.name instanceof AST_SymbolFunarg) {
+                log(node.name, text);
+            } else {
+                AST_Node.info(text + " [{start}]", node);
+            }
+        }
+
+        function get_rvalue(expr) {
+            return expr[expr instanceof AST_Assign ? "right" : "value"];
+        }
+
+        function insert_statements(body, orig, in_list) {
+            switch (body.length) {
+              case 0:
+                return in_list ? List.skip : make_node(AST_EmptyStatement, orig);
+              case 1:
+                return body[0];
+              default:
+                return in_list ? List.splice(body) : make_node(AST_BlockStatement, orig, { body: body });
+            }
+        }
+
+        function track_assigns(def, node) {
+            if (def.scope.resolve() !== self) return false;
+            if (!def.fixed || !node.fixed) assign_in_use[def.id] = false;
+            return assign_in_use[def.id] !== false;
+        }
+
+        function add_assigns(def, node) {
+            if (!assign_in_use[def.id]) assign_in_use[def.id] = [];
+            if (node.fixed.assigns) push_uniq(assign_in_use[def.id], node.fixed.assigns);
+        }
+
+        function indexOf_assign(def, node) {
+            var nodes = assign_in_use[def.id];
+            return nodes && nodes.indexOf(node);
+        }
+
+        function unmark_lambda(def) {
+            if (lambda_ids[def.id] > 1 && !(def.id in in_use_ids)) {
+                in_use_ids[def.id] = true;
+                in_use.push(def);
+            }
+            lambda_ids[def.id] = 0;
+        }
+
+        function verify_safe_usage(def, read, modified) {
+            if (def.id in in_use_ids) return;
+            if (read && modified) {
+                in_use_ids[def.id] = read;
+                in_use.push(def);
+            } else {
+                value_read[def.id] = read;
+                value_modified[def.id] = modified;
+            }
+        }
+
+        function can_drop_lhs(sym, node) {
+            var def = sym.definition();
+            var in_use = in_use_ids[def.id];
+            if (!in_use) return true;
+            if (node[node instanceof AST_Assign ? "left" : "expression"] !== sym) return false;
+            return in_use === sym && def.references.length - def.replaced == 1 || indexOf_assign(def, node) < 0;
+        }
+
+        function get_rhs(assign) {
+            var rhs = assign.right;
+            if (!assign.write_only) return rhs;
+            if (!(rhs instanceof AST_Binary && lazy_op[rhs.operator])) return rhs;
+            if (!(rhs.left instanceof AST_SymbolRef)) return rhs;
+            if (!(assign.left instanceof AST_SymbolRef)) return rhs;
+            var def = assign.left.definition();
+            if (rhs.left.definition() !== def) return rhs;
+            if (rhs.right.has_side_effects(compressor)) return rhs;
+            if (track_assigns(def, rhs.left)) add_assigns(def, rhs.left);
+            return rhs.right;
+        }
+
+        function get_init_symbol(for_in) {
+            var init = for_in.init;
+            if (init instanceof AST_Definitions) {
+                init = init.definitions[0].name;
+                return init instanceof AST_SymbolDeclaration && init;
+            }
+            while (init instanceof AST_PropAccess) init = init.expression.tail_node();
+            if (init instanceof AST_SymbolRef) return init;
+        }
+
+        function scan_ref_scoped(node, descend, init) {
+            if (node instanceof AST_Assign && node.left instanceof AST_SymbolRef) {
+                var def = node.left.definition();
+                if (def.scope.resolve() === self) assignments.add(def.id, node);
+            }
+            if (node instanceof AST_SymbolRef && node.in_arg) var_defs[node.definition().id] = 0;
+            if (node instanceof AST_Unary && node.expression instanceof AST_SymbolRef) {
+                var def = node.expression.definition();
+                if (def.scope.resolve() === self) assignments.add(def.id, node);
+            }
+            var props = [], sym = assign_as_unused(node, props);
+            if (sym) {
+                var node_def = sym.definition();
+                if (node_def.scope.resolve() !== self && self.variables.get(sym.name) !== node_def) return;
+                if (is_arguments(node_def) && !all(self.argnames, function(argname) {
+                    return !argname.match_symbol(function(node) {
+                        if (node instanceof AST_SymbolFunarg) {
+                            var def = node.definition();
+                            return def.references.length > def.replaced;
                         }
-                        if (def.length == 0 && !side_effects) {
-                            return make_node(AST_EmptyStatement, node);
+                    }, true);
+                })) return;
+                if (node.write_only === "p" && node.right.may_throw_on_access(compressor, true)) return;
+                var assign = props.assign;
+                if (assign) {
+                    assign.write_only = true;
+                    assign.walk(tw);
+                }
+                props.forEach(function(prop) {
+                    prop.walk(tw);
+                });
+                if (node instanceof AST_Assign) {
+                    var right = get_rhs(node), shared = false;
+                    if (init && node.write_only === true && !right.has_side_effects(compressor)) {
+                        initializations.add(node_def.id, right);
+                    } else {
+                        right.walk(tw);
+                        shared = right.tail_node().operator == "=";
+                    }
+                    if (node.left === sym) {
+                        if (!node.write_only || shared) {
+                            verify_safe_usage(node_def, sym, value_modified[node_def.id]);
                         }
-                        if (def.length == 0) {
-                            return in_list ? MAP.splice(side_effects.body) : side_effects;
+                    } else {
+                        var fixed = sym.fixed_value();
+                        if (!fixed || !fixed.is_constant()) {
+                            verify_safe_usage(node_def, value_read[node_def.id], true);
                         }
-                        node.definitions = def;
-                        if (side_effects) {
-                            side_effects.body.unshift(node);
-                            return in_list ? MAP.splice(side_effects.body) : side_effects;
+                    }
+                }
+                if (track_assigns(node_def, sym) && is_lhs(sym, node) !== sym) add_assigns(node_def, sym);
+                unmark_lambda(node_def);
+                return true;
+            }
+            if (node instanceof AST_Binary) {
+                if (node.operator != "instanceof") return;
+                var sym = node.right;
+                if (!(sym instanceof AST_SymbolRef)) return;
+                var id = sym.definition().id;
+                if (!lambda_ids[id]) return;
+                node.left.walk(tw);
+                lambda_ids[id]++;
+                return true;
+            }
+            if (node instanceof AST_ForIn) {
+                if (node.init instanceof AST_SymbolRef && scope === self) {
+                    var id = node.init.definition().id;
+                    if (!(id in for_ins)) for_ins[id] = node;
+                }
+                if (!drop_vars || !compressor.option("loops")) return;
+                if (!is_empty(node.body)) return;
+                if (node.init.has_side_effects(compressor)) return;
+                var sym = get_init_symbol(node);
+                if (!sym) return;
+                var def = sym.definition();
+                if (def.scope.resolve() !== self) {
+                    var d = find_variable(sym.name);
+                    if (d === def || d && d.redefined() === def) return;
+                }
+                node.object.walk(tw);
+                return true;
+            }
+            if (node instanceof AST_SymbolRef) {
+                var node_def = node.definition();
+                if (!(node_def.id in in_use_ids)) {
+                    in_use_ids[node_def.id] = true;
+                    in_use.push(node_def);
+                }
+                if (cross_scope(node_def.scope, node.scope)) {
+                    var redef = node_def.redefined();
+                    if (redef && !(redef.id in in_use_ids)) {
+                        in_use_ids[redef.id] = true;
+                        in_use.push(redef);
+                    }
+                }
+                if (track_assigns(node_def, node)) add_assigns(node_def, node);
+                return true;
+            }
+            if (node instanceof AST_Scope) {
+                var save_scope = scope;
+                scope = node;
+                descend();
+                scope = save_scope;
+                return true;
+            }
+        }
+
+        function is_decl(node) {
+            return (node instanceof AST_DefaultValue ? node.name : node) instanceof AST_SymbolDeclaration;
+        }
+
+        function trim_decl(node) {
+            if (node.definition().id in in_use_ids) return node;
+            if (node instanceof AST_SymbolFunarg) node.unused = true;
+            return null;
+        }
+
+        function trim_default(trimmer, node) {
+            node.value = node.value.transform(tt);
+            var name = node.name.transform(trimmer);
+            if (!name) {
+                if (node.name instanceof AST_Destructured) return null;
+                var value = node.value.drop_side_effect_free(compressor);
+                if (!value) return null;
+                log(node.name, "Side effects in default value of unused variable {name}");
+                node = node.clone();
+                node.name.unused = null;
+                node.value = value;
+            }
+            return node;
+        }
+
+        function trim_destructured(node, value, process, drop, root) {
+            var trimmer = new TreeTransformer(function(node) {
+                if (node instanceof AST_DefaultValue) {
+                    if (!(compressor.option("default_values") && value && value.is_defined(compressor))) {
+                        var save_drop = drop;
+                        drop = false;
+                        var trimmed = trim_default(trimmer, node);
+                        drop = save_drop;
+                        if (!trimmed && drop && value) value = value.drop_side_effect_free(compressor);
+                        return trimmed;
+                    } else if (node === root) {
+                        root = node = node.name;
+                    } else {
+                        node = node.name;
+                    }
+                }
+                if (node instanceof AST_DestructuredArray) {
+                    var save_drop = drop;
+                    var save_value = value;
+                    if (value instanceof AST_SymbolRef) {
+                        drop = false;
+                        value = value.fixed_value();
+                    }
+                    var native, values;
+                    if (value instanceof AST_Array) {
+                        native = true;
+                        values = value.elements;
+                    } else {
+                        native = value && value.is_string(compressor);
+                        values = false;
+                    }
+                    var elements = [], newValues = drop && [], pos = 0;
+                    node.elements.forEach(function(element, index) {
+                        value = values && values[index];
+                        if (value instanceof AST_Hole) {
+                            value = null;
+                        } else if (value instanceof AST_Spread) {
+                            if (drop) {
+                                newValues.length = pos;
+                                fill_holes(save_value, newValues);
+                                [].push.apply(newValues, values.slice(index));
+                                save_value.elements = newValues;
+                            }
+                            value = values = false;
+                        }
+                        element = element.transform(trimmer);
+                        if (element) elements[pos] = element;
+                        if (drop && value) newValues[pos] = value;
+                        if (element || value || !drop || !values) pos++;
+                    });
+                    value = values && make_node(AST_Array, save_value, {
+                        elements: values.slice(node.elements.length),
+                    });
+                    if (node.rest) {
+                        var was_drop = drop;
+                        drop = false;
+                        node.rest = node.rest.transform(compressor.option("rests") ? trimmer : tt);
+                        drop = was_drop;
+                        if (node.rest) elements.length = pos;
+                    }
+                    if (drop) {
+                        if (value && !node.rest) value = value.drop_side_effect_free(compressor);
+                        if (value instanceof AST_Array) {
+                            value = value.elements;
+                        } else if (value instanceof AST_Sequence) {
+                            value = value.expressions;
+                        } else if (value) {
+                            value = [ value ];
+                        }
+                        if (value && value.length) {
+                            newValues.length = pos;
+                            [].push.apply(newValues, value);
                         }
-                        return node;
                     }
-                    if (node instanceof AST_For) {
-                        descend(node, this);
+                    value = save_value;
+                    drop = save_drop;
+                    if (values && newValues) {
+                        fill_holes(value, newValues);
+                        value = value.clone();
+                        value.elements = newValues;
+                    }
+                    if (!native) {
+                        elements.length = node.elements.length;
+                    } else if (!node.rest) switch (elements.length) {
+                      case 0:
+                        if (node === root) break;
+                        if (drop) value = value.drop_side_effect_free(compressor);
+                        return null;
+                      case 1:
+                        if (!drop) break;
+                        if (node === root) break;
+                        var sym = elements[0];
+                        if (sym.has_side_effects(compressor)) break;
+                        if (value.has_side_effects(compressor) && sym.match_symbol(function(node) {
+                            return node instanceof AST_PropAccess;
+                        })) break;
+                        value = make_node(AST_Sub, node, {
+                            expression: value,
+                            property: make_node(AST_Number, node, { value: 0 }),
+                        });
+                        return sym;
+                    }
+                    fill_holes(node, elements);
+                    node.elements = elements;
+                    return node;
+                }
+                if (node instanceof AST_DestructuredObject) {
+                    var save_drop = drop;
+                    var save_value = value;
+                    if (value instanceof AST_SymbolRef) {
+                        drop = false;
+                        value = value.fixed_value();
+                    }
+                    var prop_keys, prop_map, values;
+                    if (value instanceof AST_Object) {
+                        prop_keys = [];
+                        prop_map = new Dictionary();
+                        values = value.properties.map(function(prop, index) {
+                            prop = prop.clone();
+                            if (prop instanceof AST_Spread) {
+                                prop_map = false;
+                            } else {
+                                var key = prop.key;
+                                if (key instanceof AST_Node) key = key.evaluate(compressor, true);
+                                if (key instanceof AST_Node) {
+                                    prop_map = false;
+                                } else if (prop_map && !(prop instanceof AST_ObjectSetter)) {
+                                    prop_map.set(key, prop);
+                                }
+                                prop_keys[index] = key;
+                            }
+                            return prop;
+                        });
+                    }
+                    if (node.rest) {
+                        value = false;
+                        node.rest = node.rest.transform(compressor.option("rests") ? trimmer : tt);
+                    }
+                    var can_drop = new Dictionary();
+                    var drop_keys = drop && new Dictionary();
+                    var properties = [];
+                    node.properties.map(function(prop) {
+                        var key = prop.key;
+                        if (key instanceof AST_Node) {
+                            prop.key = key = key.transform(tt);
+                            key = key.evaluate(compressor, true);
+                        }
+                        if (key instanceof AST_Node) {
+                            drop_keys = false;
+                        } else {
+                            can_drop.set(key, !can_drop.has(key));
+                        }
+                        return key;
+                    }).forEach(function(key, index) {
+                        var prop = node.properties[index], trimmed;
+                        if (key instanceof AST_Node) {
+                            drop = false;
+                            value = false;
+                            trimmed = prop.value.transform(trimmer) || retain_lhs(prop.value);
+                        } else {
+                            drop = drop_keys && can_drop.get(key);
+                            var mapped = prop_map && prop_map.get(key);
+                            if (mapped) {
+                                value = mapped.value;
+                                if (value instanceof AST_Accessor) value = false;
+                            } else {
+                                value = false;
+                            }
+                            trimmed = prop.value.transform(trimmer);
+                            if (!trimmed) {
+                                if (node.rest || retain_key(prop)) trimmed = retain_lhs(prop.value);
+                                if (drop_keys && !drop_keys.has(key)) {
+                                    if (mapped) {
+                                        drop_keys.set(key, mapped);
+                                        if (value === null) {
+                                            prop_map.set(key, retain_key(mapped) && make_node(AST_ObjectKeyVal, mapped, {
+                                                key: mapped.key,
+                                                value: make_node(AST_Number, mapped, { value: 0 }),
+                                            }));
+                                        }
+                                    } else {
+                                        drop_keys.set(key, true);
+                                    }
+                                }
+                            } else if (drop_keys) {
+                                drop_keys.set(key, false);
+                            }
+                            if (value) mapped.value = value;
+                        }
+                        if (trimmed) {
+                            prop.value = trimmed;
+                            properties.push(prop);
+                        }
+                    });
+                    value = save_value;
+                    drop = save_drop;
+                    if (drop_keys && prop_keys) {
+                        value = value.clone();
+                        value.properties = List(values, function(prop, index) {
+                            if (prop instanceof AST_Spread) return prop;
+                            var key = prop_keys[index];
+                            if (key instanceof AST_Node) return prop;
+                            if (drop_keys.has(key)) {
+                                var mapped = drop_keys.get(key);
+                                if (!mapped) return prop;
+                                if (mapped === prop) return prop_map.get(key) || List.skip;
+                            } else if (node.rest) {
+                                return prop;
+                            }
+                            var trimmed = prop.value.drop_side_effect_free(compressor);
+                            if (trimmed) {
+                                prop.value = trimmed;
+                                return prop;
+                            }
+                            return retain_key(prop) ? make_node(AST_ObjectKeyVal, prop, {
+                                key: prop.key,
+                                value: make_node(AST_Number, prop, { value: 0 }),
+                            }) : List.skip;
+                        });
+                    }
+                    if (value && !node.rest) switch (properties.length) {
+                      case 0:
+                        if (node === root) break;
+                        if (value.may_throw_on_access(compressor, true)) break;
+                        if (drop) value = value.drop_side_effect_free(compressor);
+                        return null;
+                      case 1:
+                        if (!drop) break;
+                        if (node === root) break;
+                        var prop = properties[0];
+                        if (prop.key instanceof AST_Node) break;
+                        if (prop.value.has_side_effects(compressor)) break;
+                        if (value.has_side_effects(compressor) && prop.value.match_symbol(function(node) {
+                            return node instanceof AST_PropAccess;
+                        })) break;
+                        value = make_node(AST_Sub, node, {
+                            expression: value,
+                            property: make_node_from_constant(prop.key, prop),
+                        });
+                        return prop.value;
+                    }
+                    node.properties = properties;
+                    return node;
+                }
+                if (node instanceof AST_Hole) {
+                    node = null;
+                } else {
+                    node = process(node);
+                }
+                if (!node && drop && value) value = value.drop_side_effect_free(compressor);
+                return node;
+            });
+            return {
+                name: node.transform(trimmer),
+                value: value,
+            };
 
-                        if (node.init instanceof AST_BlockStatement) {
-                            // certain combination of unused name + side effect leads to:
-                            //    https://github.com/mishoo/UglifyJS2/issues/44
-                            // that's an invalid AST.
-                            // We fix it at this stage by moving the `var` outside the `for`.
-
-                            var body = node.init.body.slice(0, -1);
-                            node.init = node.init.body.slice(-1)[0].body;
-                            body.push(node);
+            function retain_key(prop) {
+                return prop.key instanceof AST_Node && prop.key.has_side_effects(compressor);
+            }
+
+            function clear_write_only(node) {
+                if (node instanceof AST_Assign) {
+                    node.write_only = false;
+                    clear_write_only(node.right);
+                } else if (node instanceof AST_Binary) {
+                    if (!lazy_op[node.operator]) return;
+                    clear_write_only(node.left);
+                    clear_write_only(node.right);
+                } else if (node instanceof AST_Conditional) {
+                    clear_write_only(node.consequent);
+                    clear_write_only(node.alternative);
+                } else if (node instanceof AST_Sequence) {
+                    clear_write_only(node.tail_node());
+                } else if (node instanceof AST_Unary) {
+                    node.write_only = false;
+                }
+            }
 
-                            return in_list ? MAP.splice(body) : make_node(AST_BlockStatement, node, {
-                                body: body
+            function retain_lhs(node) {
+                if (node instanceof AST_DefaultValue) return retain_lhs(node.name);
+                if (node instanceof AST_Destructured) {
+                    if (value === null) {
+                        value = make_node(AST_Number, node, { value: 0 });
+                    } else if (value) {
+                        if (value.may_throw_on_access(compressor, true)) {
+                            value = make_node(AST_Array, node, {
+                                elements: value instanceof AST_Sequence ? value.expressions : [ value ],
                             });
+                        } else {
+                            clear_write_only(value);
                         }
                     }
-                    if (node instanceof AST_Scope && node !== self)
-                        return node;
+                    return make_node(AST_DestructuredObject, node, { properties: [] });
                 }
-            );
-            self.transform(tt);
+                node.unused = null;
+                return node;
+            }
         }
     });
 
-    AST_Scope.DEFMETHOD("hoist_declarations", function(compressor){
+    AST_Scope.DEFMETHOD("hoist_declarations", function(compressor) {
+        if (compressor.has_directive("use asm")) return;
         var hoist_funs = compressor.option("hoist_funs");
         var hoist_vars = compressor.option("hoist_vars");
         var self = this;
-        if (hoist_funs || hoist_vars) {
-            var dirs = [];
-            var hoisted = [];
-            var vars = new Dictionary(), vars_found = 0, var_decl = 0;
+        if (hoist_vars) {
             // let's count var_decl first, we seem to waste a lot of
             // space if we hoist `var` when there's only one.
-            self.walk(new TreeWalker(function(node){
-                if (node instanceof AST_Scope && node !== self)
-                    return true;
+            var var_decl = 0;
+            self.walk(new TreeWalker(function(node) {
+                if (var_decl > 1) return true;
+                if (node instanceof AST_ExportDeclaration) return true;
+                if (node instanceof AST_Scope && node !== self) return true;
                 if (node instanceof AST_Var) {
-                    ++var_decl;
+                    var_decl++;
                     return true;
                 }
             }));
-            hoist_vars = hoist_vars && var_decl > 1;
-            var tt = new TreeTransformer(
-                function before(node) {
-                    if (node !== self) {
-                        if (node instanceof AST_Directive) {
-                            dirs.push(node);
-                            return make_node(AST_EmptyStatement, node);
-                        }
-                        if (node instanceof AST_Defun && hoist_funs) {
-                            hoisted.push(node);
-                            return make_node(AST_EmptyStatement, node);
-                        }
-                        if (node instanceof AST_Var && hoist_vars) {
-                            node.definitions.forEach(function(def){
-                                vars.set(def.name.name, def);
-                                ++vars_found;
-                            });
-                            var seq = node.to_assignments();
-                            var p = tt.parent();
-                            if (p instanceof AST_ForIn && p.init === node) {
-                                if (seq == null) return node.definitions[0].name;
-                                return seq;
-                            }
-                            if (p instanceof AST_For && p.init === node) {
-                                return seq;
-                            }
-                            if (!seq) return make_node(AST_EmptyStatement, node);
-                            return make_node(AST_SimpleStatement, node, {
-                                body: seq
-                            });
+            if (var_decl <= 1) hoist_vars = false;
+        }
+        if (!hoist_funs && !hoist_vars) return;
+        var consts = new Dictionary();
+        var dirs = [];
+        var hoisted = [];
+        var vars = new Dictionary();
+        var tt = new TreeTransformer(function(node, descend, in_list) {
+            if (node === self) return;
+            if (node instanceof AST_Directive) {
+                dirs.push(node);
+                return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+            }
+            if (node instanceof AST_LambdaDefinition) {
+                if (!hoist_funs) return node;
+                var p = tt.parent();
+                if (p instanceof AST_ExportDeclaration) return node;
+                if (p instanceof AST_ExportDefault) return node;
+                if (p !== self && compressor.has_directive("use strict")) return node;
+                hoisted.push(node);
+                return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+            }
+            if (node instanceof AST_Var) {
+                if (!hoist_vars) return node;
+                var p = tt.parent();
+                if (p instanceof AST_ExportDeclaration) return node;
+                if (!all(node.definitions, function(defn) {
+                    var sym = defn.name;
+                    return sym instanceof AST_SymbolVar
+                        && !consts.has(sym.name)
+                        && self.find_variable(sym.name) === sym.definition();
+                })) return node;
+                node.definitions.forEach(function(defn) {
+                    vars.set(defn.name.name, defn);
+                });
+                var seq = node.to_assignments();
+                if (p instanceof AST_ForEnumeration && p.init === node) {
+                    if (seq) return seq;
+                    var sym = node.definitions[0].name;
+                    return make_node(AST_SymbolRef, sym);
+                }
+                if (p instanceof AST_For && p.init === node) return seq;
+                if (!seq) return in_list ? List.skip : make_node(AST_EmptyStatement, node);
+                return make_node(AST_SimpleStatement, node, { body: seq });
+            }
+            if (node instanceof AST_Scope) return node;
+            if (node instanceof AST_SymbolConst) {
+                consts.set(node.name, true);
+                return node;
+            }
+        });
+        self.transform(tt);
+        if (vars.size() > 0) {
+            // collect only vars which don't show up in self's arguments list
+            var defns = [];
+            if (self instanceof AST_Lambda) self.each_argname(function(argname) {
+                if (all(argname.definition().references, function(ref) {
+                    return !ref.in_arg;
+                })) vars.del(argname.name);
+            });
+            vars.each(function(defn, name) {
+                defn = defn.clone();
+                defn.name = defn.name.clone();
+                defn.value = null;
+                defns.push(defn);
+                vars.set(name, defn);
+                defn.name.definition().orig.unshift(defn.name);
+            });
+            if (defns.length > 0) hoisted.push(make_node(AST_Var, self, { definitions: defns }));
+        }
+        self.body = dirs.concat(hoisted, self.body);
+    });
+
+    function scan_local_returns(fn, transform) {
+        fn.walk(new TreeWalker(function(node) {
+            if (node instanceof AST_Return) {
+                transform(node);
+                return true;
+            }
+            if (node instanceof AST_Scope && node !== fn) return true;
+        }));
+    }
+
+    function map_self_returns(fn) {
+        var map = Object.create(null);
+        scan_local_returns(fn, function(node) {
+            var value = node.value;
+            if (value) value = value.tail_node();
+            if (value instanceof AST_SymbolRef) {
+                var id = value.definition().id;
+                map[id] = (map[id] || 0) + 1;
+            }
+        });
+        return map;
+    }
+
+    function can_trim_returns(def, self_returns, compressor) {
+        if (compressor.exposed(def)) return false;
+        switch (def.references.length - def.replaced - (self_returns[def.id] || 0)) {
+          case def.drop_return:
+            return "d";
+          case def.bool_return:
+            return true;
+        }
+    }
+
+    function process_boolean_returns(fn, compressor) {
+        scan_local_returns(fn, function(node) {
+            node.in_bool = true;
+            var value = node.value;
+            if (value) {
+                var ev = fuzzy_eval(compressor, value);
+                if (!ev) {
+                    value = value.drop_side_effect_free(compressor);
+                    node.value = value ? make_sequence(node.value, [
+                        value,
+                        make_node(AST_Number, node.value, { value: 0 }),
+                    ]) : null;
+                } else if (!(ev instanceof AST_Node)) {
+                    value = value.drop_side_effect_free(compressor);
+                    node.value = value ? make_sequence(node.value, [
+                        value,
+                        make_node(AST_Number, node.value, { value: 1 }),
+                    ]) : make_node(AST_Number, node.value, { value: 1 });
+                }
+            }
+        });
+    }
+
+    AST_Scope.DEFMETHOD("process_returns", noop);
+    AST_Defun.DEFMETHOD("process_returns", function(compressor) {
+        if (!compressor.option("booleans")) return;
+        if (compressor.parent() instanceof AST_ExportDefault) return;
+        switch (can_trim_returns(this.name.definition(), map_self_returns(this), compressor)) {
+          case "d":
+            drop_returns(compressor, this, true);
+            break;
+          case true:
+            process_boolean_returns(this, compressor);
+            break;
+        }
+    });
+    AST_Function.DEFMETHOD("process_returns", function(compressor) {
+        if (!compressor.option("booleans")) return;
+        var drop = true;
+        var self_returns = map_self_returns(this);
+        if (this.name && !can_trim(this.name.definition())) return;
+        var parent = compressor.parent();
+        if (parent instanceof AST_Assign) {
+            if (parent.operator != "=") return;
+            var sym = parent.left;
+            if (!(sym instanceof AST_SymbolRef)) return;
+            if (!can_trim(sym.definition())) return;
+        } else if (parent instanceof AST_Call && parent.expression !== this) {
+            var exp = parent.expression;
+            if (exp instanceof AST_SymbolRef) exp = exp.fixed_value();
+            if (!(exp instanceof AST_Lambda)) return;
+            if (exp.uses_arguments || exp.pinned()) return;
+            var args = parent.args, sym;
+            for (var i = 0; i < args.length; i++) {
+                var arg = args[i];
+                if (arg === this) {
+                    sym = exp.argnames[i];
+                    if (!sym && exp.rest) return;
+                    break;
+                }
+                if (arg instanceof AST_Spread) return;
+            }
+            if (sym instanceof AST_DefaultValue) sym = sym.name;
+            if (sym instanceof AST_SymbolFunarg && !can_trim(sym.definition())) return;
+        } else if (parent.TYPE == "Call") {
+            compressor.pop();
+            var in_bool = compressor.in_boolean_context();
+            compressor.push(this);
+            switch (in_bool) {
+              case true:
+                drop = false;
+              case "d":
+                break;
+              default:
+                return;
+            }
+        } else return;
+        if (drop) {
+            drop_returns(compressor, this, true);
+        } else {
+            process_boolean_returns(this, compressor);
+        }
+
+        function can_trim(def) {
+            switch (can_trim_returns(def, self_returns, compressor)) {
+              case true:
+                drop = false;
+              case "d":
+                return true;
+            }
+        }
+    });
+
+    AST_BlockScope.DEFMETHOD("var_names", function() {
+        var var_names = this._var_names;
+        if (!var_names) {
+            this._var_names = var_names = new Dictionary();
+            this.enclosed.forEach(function(def) {
+                var_names.set(def.name, true);
+            });
+            this.variables.each(function(def, name) {
+                var_names.set(name, true);
+            });
+        }
+        return var_names;
+    });
+
+    AST_Scope.DEFMETHOD("make_var", function(type, orig, prefix) {
+        var scopes = [ this ];
+        if (orig instanceof AST_SymbolDeclaration) orig.definition().references.forEach(function(ref) {
+            var s = ref.scope;
+            do {
+                if (!push_uniq(scopes, s)) return;
+                s = s.parent_scope;
+            } while (s && s !== this);
+        });
+        prefix = prefix.replace(/^[^a-z_$]|[^a-z0-9_$]/gi, "_");
+        var name = prefix;
+        for (var i = 0; !all(scopes, function(scope) {
+            return !scope.var_names().has(name);
+        }); i++) name = prefix + "$" + i;
+        var sym = make_node(type, orig, {
+            name: name,
+            scope: this,
+        });
+        var def = this.def_variable(sym);
+        scopes.forEach(function(scope) {
+            scope.enclosed.push(def);
+            scope.var_names().set(name, true);
+        });
+        return sym;
+    });
+
+    AST_Scope.DEFMETHOD("hoist_properties", function(compressor) {
+        if (!compressor.option("hoist_props") || compressor.has_directive("use asm")) return;
+        var self = this;
+        if (is_arrow(self) && self.value) return;
+        var top_retain = self instanceof AST_Toplevel && compressor.top_retain || return_false;
+        var defs_by_id = Object.create(null);
+        var tt = new TreeTransformer(function(node, descend) {
+            if (node instanceof AST_Assign) {
+                if (node.operator != "=") return;
+                if (!node.write_only) return;
+                if (!can_hoist(node.left, node.right, 1)) return;
+                descend(node, tt);
+                var defs = new Dictionary();
+                var assignments = [];
+                var decls = [];
+                node.right.properties.forEach(function(prop) {
+                    var decl = make_sym(AST_SymbolVar, node.left, prop.key);
+                    decls.push(make_node(AST_VarDef, node, {
+                        name: decl,
+                        value: null,
+                    }));
+                    var sym = make_node(AST_SymbolRef, node, {
+                        name: decl.name,
+                        scope: self,
+                        thedef: decl.definition(),
+                    });
+                    sym.reference();
+                    assignments.push(make_node(AST_Assign, node, {
+                        operator: "=",
+                        left: sym,
+                        right: prop.value,
+                    }));
+                });
+                defs.value = node.right;
+                defs_by_id[node.left.definition().id] = defs;
+                self.body.splice(self.body.indexOf(tt.stack[1]) + 1, 0, make_node(AST_Var, node, {
+                    definitions: decls,
+                }));
+                return make_sequence(node, assignments);
+            }
+            if (node instanceof AST_Scope) {
+                if (node === self) return;
+                var parent = tt.parent();
+                if (parent.TYPE == "Call" && parent.expression === node) return;
+                return node;
+            }
+            if (node instanceof AST_VarDef) {
+                if (!can_hoist(node.name, node.value, 0)) return;
+                descend(node, tt);
+                var defs = new Dictionary();
+                var var_defs = [];
+                var decl = node.clone();
+                decl.value = node.name instanceof AST_SymbolConst ? make_node(AST_Number, node, { value: 0 }) : null;
+                var_defs.push(decl);
+                node.value.properties.forEach(function(prop) {
+                    var_defs.push(make_node(AST_VarDef, node, {
+                        name: make_sym(node.name.CTOR, node.name, prop.key),
+                        value: prop.value,
+                    }));
+                });
+                defs.value = node.value;
+                defs_by_id[node.name.definition().id] = defs;
+                return List.splice(var_defs);
+            }
+
+            function make_sym(type, sym, key) {
+                var new_var = self.make_var(type, sym, sym.name + "_" + key);
+                defs.set(key, new_var.definition());
+                return new_var;
+            }
+        });
+        self.transform(tt);
+        self.transform(new TreeTransformer(function(node, descend) {
+            if (node instanceof AST_PropAccess) {
+                if (!(node.expression instanceof AST_SymbolRef)) return;
+                var defs = defs_by_id[node.expression.definition().id];
+                if (!defs) return;
+                if (node.expression.fixed_value() !== defs.value) return;
+                var def = defs.get(node.get_property());
+                var sym = make_node(AST_SymbolRef, node, {
+                    name: def.name,
+                    scope: node.expression.scope,
+                    thedef: def,
+                });
+                sym.reference();
+                return sym;
+            }
+            if (node instanceof AST_SymbolRef) {
+                var defs = defs_by_id[node.definition().id];
+                if (!defs) return;
+                if (node.fixed_value() !== defs.value) return;
+                return make_node(AST_Object, node, { properties: [] });
+            }
+        }));
+
+        function can_hoist(sym, right, count) {
+            if (!(sym instanceof AST_Symbol)) return;
+            var def = sym.definition();
+            if (def.assignments != count) return;
+            if (def.references.length - def.replaced == count) return;
+            if (def.single_use) return;
+            if (self.find_variable(sym.name) !== def) return;
+            if (top_retain(def)) return;
+            if (sym.fixed_value() !== right) return;
+            var fixed = sym.fixed || def.fixed;
+            if (fixed.direct_access) return;
+            if (fixed.escaped && fixed.escaped.depth == 1) return;
+            return right instanceof AST_Object
+                && right.properties.length > 0
+                && can_drop_symbol(sym, compressor)
+                && all(right.properties, function(prop) {
+                    return can_hoist_property(prop) && prop.key !== "__proto__";
+                });
+        }
+    });
+
+    function fn_name_unused(fn, compressor) {
+        if (!fn.name || !compressor.option("ie")) return true;
+        var def = fn.name.definition();
+        if (compressor.exposed(def)) return false;
+        return all(def.references, function(sym) {
+            return !(sym instanceof AST_SymbolRef);
+        });
+    }
+
+    function drop_returns(compressor, exp, ignore_name) {
+        if (!(exp instanceof AST_Lambda)) return;
+        var arrow = is_arrow(exp);
+        var async = is_async(exp);
+        var changed = false;
+        var drop_body = false;
+        if (arrow && compressor.option("arrows")) {
+            if (!exp.value) {
+                drop_body = true;
+            } else if (!async || needs_enqueuing(compressor, exp.value)) {
+                var dropped = exp.value.drop_side_effect_free(compressor);
+                if (dropped !== exp.value) {
+                    changed = true;
+                    exp.value = dropped;
+                }
+            }
+        } else if (!is_generator(exp)) {
+            if (!ignore_name && exp.name) {
+                var def = exp.name.definition();
+                drop_body = def.references.length == def.replaced;
+            } else {
+                drop_body = true;
+            }
+        }
+        if (drop_body) {
+            exp.process_expression(false, function(node) {
+                var value = node.value;
+                if (value) {
+                    if (async && !needs_enqueuing(compressor, value)) return node;
+                    value = value.drop_side_effect_free(compressor, true);
+                }
+                changed = true;
+                if (!value) return make_node(AST_EmptyStatement, node);
+                return make_node(AST_SimpleStatement, node, { body: value });
+            });
+            scan_local_returns(exp, function(node) {
+                var value = node.value;
+                if (value) {
+                    if (async && !needs_enqueuing(compressor, value)) return;
+                    var dropped = value.drop_side_effect_free(compressor);
+                    if (dropped !== value) {
+                        changed = true;
+                        if (dropped && async && !needs_enqueuing(compressor, dropped)) {
+                            dropped = dropped.negate(compressor);
                         }
-                        if (node instanceof AST_Scope)
-                            return node; // to avoid descending in nested scopes
+                        node.value = dropped;
                     }
                 }
-            );
-            self = self.transform(tt);
-            if (vars_found > 0) {
-                // collect only vars which don't show up in self's arguments list
-                var defs = [];
-                vars.each(function(def, name){
-                    if (self instanceof AST_Lambda
-                        && find_if(function(x){ return x.name == def.name.name },
-                                   self.argnames)) {
-                        vars.del(name);
-                    } else {
-                        def = def.clone();
-                        def.value = null;
-                        defs.push(def);
-                        vars.set(name, def);
-                    }
-                });
-                if (defs.length > 0) {
-                    // try to merge in assignments
-                    for (var i = 0; i < self.body.length;) {
-                        if (self.body[i] instanceof AST_SimpleStatement) {
-                            var expr = self.body[i].body, sym, assign;
-                            if (expr instanceof AST_Assign
-                                && expr.operator == "="
-                                && (sym = expr.left) instanceof AST_Symbol
-                                && vars.has(sym.name))
-                            {
-                                var def = vars.get(sym.name);
-                                if (def.value) break;
-                                def.value = expr.right;
-                                remove(defs, def);
-                                defs.push(def);
-                                self.body.splice(i, 1);
-                                continue;
-                            }
-                            if (expr instanceof AST_Seq
-                                && (assign = expr.car) instanceof AST_Assign
-                                && assign.operator == "="
-                                && (sym = assign.left) instanceof AST_Symbol
-                                && vars.has(sym.name))
-                            {
-                                var def = vars.get(sym.name);
-                                if (def.value) break;
-                                def.value = assign.right;
-                                remove(defs, def);
-                                defs.push(def);
-                                self.body[i].body = expr.cdr;
-                                continue;
-                            }
-                        }
-                        if (self.body[i] instanceof AST_EmptyStatement) {
-                            self.body.splice(i, 1);
-                            continue;
-                        }
-                        if (self.body[i] instanceof AST_BlockStatement) {
-                            var tmp = [ i, 1 ].concat(self.body[i].body);
-                            self.body.splice.apply(self.body, tmp);
-                            continue;
-                        }
+            });
+        }
+        if (async && compressor.option("awaits")) {
+            if (drop_body) exp.process_expression("awaits", function(node) {
+                var body = node.body;
+                if (body instanceof AST_Await) {
+                    if (needs_enqueuing(compressor, body.expression)) {
+                        changed = true;
+                        body = body.expression.drop_side_effect_free(compressor, true);
+                        if (!body) return make_node(AST_EmptyStatement, node);
+                        node.body = body;
+                    }
+                } else if (body instanceof AST_Sequence) {
+                    var exprs = body.expressions;
+                    for (var i = exprs.length; --i >= 0;) {
+                        var tail = exprs[i];
+                        if (!(tail instanceof AST_Await)) break;
+                        var value = tail.expression;
+                        if (!needs_enqueuing(compressor, value)) break;
+                        changed = true;
+                        if (exprs[i] = value.drop_side_effect_free(compressor)) break;
+                    }
+                    switch (i) {
+                      case -1:
+                        return make_node(AST_EmptyStatement, node);
+                      case 0:
+                        node.body = exprs[0];
+                        break;
+                      default:
+                        exprs.length = i + 1;
                         break;
                     }
-                    defs = make_node(AST_Var, self, {
-                        definitions: defs
-                    });
-                    hoisted.push(defs);
-                };
+                }
+                return node;
+            });
+            var abort = !drop_body && exp.name || arrow && exp.value && !needs_enqueuing(compressor, exp.value);
+            var tw = new TreeWalker(function(node) {
+                if (abort) return true;
+                if (tw.parent() === exp && node.may_throw(compressor)) return abort = true;
+                if (node instanceof AST_Await) return abort = true;
+                if (node instanceof AST_ForAwaitOf) return abort = true;
+                if (node instanceof AST_Return) {
+                    if (node.value && !needs_enqueuing(compressor, node.value)) return abort = true;
+                    return;
+                }
+                if (node instanceof AST_Scope && node !== exp) return true;
+            });
+            exp.walk(tw);
+            if (!abort) {
+                var ctor;
+                switch (exp.CTOR) {
+                  case AST_AsyncArrow:
+                    ctor = AST_Arrow;
+                    break;
+                  case AST_AsyncFunction:
+                    ctor = AST_Function;
+                    break;
+                  case AST_AsyncGeneratorFunction:
+                    ctor = AST_GeneratorFunction;
+                    break;
+                }
+                return make_node(ctor, exp);
             }
-            self.body = dirs.concat(hoisted, self.body);
         }
-        return self;
+        return changed && exp.clone();
+    }
+
+    // drop_side_effect_free()
+    // remove side-effect-free parts which only affects return value
+    (function(def) {
+        // Drop side-effect-free elements from an array of expressions.
+        // Returns an array of expressions with side-effects or null
+        // if all elements were dropped. Note: original array may be
+        // returned if nothing changed.
+        function trim(nodes, compressor, first_in_statement, spread) {
+            var len = nodes.length;
+            var ret = [], changed = false;
+            for (var i = 0; i < len; i++) {
+                var node = nodes[i];
+                var trimmed;
+                if (spread && node instanceof AST_Spread) {
+                    trimmed = spread(node, compressor, first_in_statement);
+                } else {
+                    trimmed = node.drop_side_effect_free(compressor, first_in_statement);
+                }
+                if (trimmed !== node) changed = true;
+                if (trimmed) {
+                    ret.push(trimmed);
+                    first_in_statement = false;
+                }
+            }
+            return ret.length ? changed ? ret : nodes : null;
+        }
+        function array_spread(node, compressor, first_in_statement) {
+            var exp = node.expression;
+            if (!exp.is_string(compressor)) return node;
+            return exp.drop_side_effect_free(compressor, first_in_statement);
+        }
+        function convert_spread(node) {
+            return node instanceof AST_Spread ? make_node(AST_Array, node, { elements: [ node ] }) : node;
+        }
+        def(AST_Node, return_this);
+        def(AST_Accessor, return_null);
+        def(AST_Array, function(compressor, first_in_statement) {
+            var values = trim(this.elements, compressor, first_in_statement, array_spread);
+            if (!values) return null;
+            if (values === this.elements && all(values, function(node) {
+                return node instanceof AST_Spread;
+            })) return this;
+            return make_sequence(this, values.map(convert_spread));
+        });
+        def(AST_Assign, function(compressor) {
+            var left = this.left;
+            if (left instanceof AST_PropAccess) {
+                var expr = left.expression;
+                if (expr.may_throw_on_access(compressor, true)) return this;
+                if (compressor.has_directive("use strict") && expr.is_constant()) return this;
+            }
+            if (left.has_side_effects(compressor)) return this;
+            if (lazy_op[this.operator.slice(0, -1)]) return this;
+            this.write_only = true;
+            if (!root_expr(left).is_constant_expression(compressor.find_parent(AST_Scope))) return this;
+            return this.right.drop_side_effect_free(compressor);
+        });
+        def(AST_Await, function(compressor) {
+            if (!compressor.option("awaits")) return this;
+            var exp = this.expression;
+            if (!needs_enqueuing(compressor, exp)) return this;
+            if (exp instanceof AST_UnaryPrefix && exp.operator == "!") exp = exp.expression;
+            var dropped = exp.drop_side_effect_free(compressor);
+            if (dropped === exp) return this;
+            if (!dropped) {
+                dropped = make_node(AST_Number, exp, { value: 0 });
+            } else if (!needs_enqueuing(compressor, dropped)) {
+                dropped = dropped.negate(compressor);
+            }
+            var node = this.clone();
+            node.expression = dropped;
+            return node;
+        });
+        def(AST_Binary, function(compressor, first_in_statement) {
+            var left = this.left;
+            var right = this.right;
+            var op = this.operator;
+            if (!can_drop_op(op, right, compressor)) {
+                var lhs = left.drop_side_effect_free(compressor, first_in_statement);
+                if (lhs === left) return this;
+                var node = this.clone();
+                node.left = lhs || make_node(AST_Number, left, { value: 0 });
+                return node;
+            }
+            var rhs = right.drop_side_effect_free(compressor, first_in_statement);
+            if (!rhs) return left.drop_side_effect_free(compressor, first_in_statement);
+            if (lazy_op[op] && rhs.has_side_effects(compressor)) {
+                var node = this;
+                if (rhs !== right) {
+                    node = node.clone();
+                    node.right = rhs.drop_side_effect_free(compressor);
+                }
+                if (op == "??") return node;
+                var negated = node.clone();
+                negated.operator = op == "&&" ? "||" : "&&";
+                negated.left = left.negate(compressor, first_in_statement);
+                var negated_rhs = negated.right.tail_node();
+                if (negated_rhs instanceof AST_Binary && negated.operator == negated_rhs.operator) swap_chain(negated);
+                var best = first_in_statement ? best_of_statement : best_of_expression;
+                return op == "&&" ? best(node, negated) : best(negated, node);
+            }
+            var lhs = left.drop_side_effect_free(compressor, first_in_statement);
+            if (!lhs) return rhs;
+            rhs = rhs.drop_side_effect_free(compressor);
+            if (!rhs) return lhs;
+            return make_sequence(this, [ lhs, rhs ]);
+        });
+        function assign_this_only(fn, compressor) {
+            fn.new = true;
+            var result = all(fn.body, function(stat) {
+                return !stat.has_side_effects(compressor);
+            }) && all(fn.argnames, function(argname) {
+                return !argname.match_symbol(return_false);
+            }) && !(fn.rest && fn.rest.match_symbol(return_false));
+            fn.new = false;
+            return result;
+        }
+        def(AST_Call, function(compressor, first_in_statement) {
+            var self = this;
+            if (self.is_expr_pure(compressor)) {
+                if (self.pure) AST_Node.warn("Dropping __PURE__ call [{start}]", self);
+                var args = trim(self.args, compressor, first_in_statement, array_spread);
+                return args && make_sequence(self, args.map(convert_spread));
+            }
+            var exp = self.expression;
+            if (self.is_call_pure(compressor)) {
+                var exprs = self.args.slice();
+                exprs.unshift(exp.expression);
+                exprs = trim(exprs, compressor, first_in_statement, array_spread);
+                return exprs && make_sequence(self, exprs.map(convert_spread));
+            }
+            if (compressor.option("yields") && is_generator(exp)) {
+                var call = self.clone();
+                call.expression = make_node(AST_Function, exp);
+                call.expression.body = [];
+                var opt = call.transform(compressor);
+                if (opt !== call) return opt.drop_side_effect_free(compressor, first_in_statement);
+            }
+            var dropped = drop_returns(compressor, exp);
+            if (dropped) {
+                // always shallow clone to ensure stripping of negated IIFEs
+                self = self.clone();
+                self.expression = dropped;
+                // avoid extraneous traversal
+                if (exp._squeezed) self.expression._squeezed = true;
+            }
+            if (self instanceof AST_New) {
+                var fn = exp;
+                if (fn instanceof AST_SymbolRef) fn = fn.fixed_value();
+                if (fn instanceof AST_Lambda) {
+                    if (assign_this_only(fn, compressor)) {
+                        var exprs = self.args.slice();
+                        exprs.unshift(exp);
+                        exprs = trim(exprs, compressor, first_in_statement, array_spread);
+                        return exprs && make_sequence(self, exprs.map(convert_spread));
+                    }
+                    if (!fn.contains_this()) {
+                        self = make_node(AST_Call, self);
+                        self.expression = self.expression.clone();
+                        self.args = self.args.slice();
+                    }
+                }
+            }
+            self.call_only = true;
+            return self;
+        });
+        def(AST_ClassExpression, function(compressor, first_in_statement) {
+            var self = this;
+            var exprs = [], values = [], init = 0;
+            var props = self.properties;
+            for (var i = 0; i < props.length; i++) {
+                var prop = props[i];
+                if (prop.key instanceof AST_Node) exprs.push(prop.key);
+                if (!is_static_field_or_init(prop)) continue;
+                var value = prop.value;
+                if (!value.has_side_effects(compressor)) continue;
+                if (value.contains_this()) return self;
+                if (prop instanceof AST_ClassInit) {
+                    init++;
+                    values.push(prop);
+                } else {
+                    values.push(value);
+                }
+            }
+            var base = self.extends;
+            if (base) {
+                if (base instanceof AST_SymbolRef) base = base.fixed_value();
+                base = !safe_for_extends(base);
+                if (!base) exprs.unshift(self.extends);
+            }
+            exprs = trim(exprs, compressor, first_in_statement);
+            if (exprs) first_in_statement = false;
+            values = trim(values, compressor, first_in_statement);
+            if (!exprs) {
+                if (!base && !values && !self.name) return null;
+                exprs = [];
+            }
+            if (base || self.name || !compressor.has_directive("use strict")) {
+                var node = to_class_expr(self);
+                if (!base) node.extends = null;
+                node.properties = [];
+                if (values) {
+                    if (values.length == init) {
+                        if (exprs.length) values.unshift(make_node(AST_ClassField, self, {
+                            key: make_sequence(self, exprs),
+                            value: null,
+                        }));
+                        node.properties = values;
+                    } else node.properties.push(make_node(AST_ClassField, self, {
+                        static: true,
+                        key: exprs.length ? make_sequence(self, exprs) : "c",
+                        value: make_value(),
+                    }));
+                } else if (exprs.length) node.properties.push(make_node(AST_ClassMethod, self, {
+                    key: make_sequence(self, exprs),
+                    value: make_node(AST_Function, self, {
+                        argnames: [],
+                        body: [],
+                    }).init_vars(node),
+                }));
+                return node;
+            }
+            if (values) exprs.push(make_node(AST_Call, self, {
+                expression: make_node(AST_Arrow, self, {
+                    argnames: [],
+                    body: [],
+                    value: make_value(),
+                }).init_vars(self.parent_scope),
+                args: [],
+            }));
+            return make_sequence(self, exprs);
+
+            function make_value() {
+                return make_sequence(self, values.map(function(node) {
+                    if (!(node instanceof AST_ClassInit)) return node;
+                    var fn = make_node(AST_Arrow, node.value);
+                    fn.argnames = [];
+                    return make_node(AST_Call, node, {
+                        expression: fn,
+                        args: [],
+                    });
+                }));
+            }
+        });
+        def(AST_Conditional, function(compressor) {
+            var consequent = this.consequent.drop_side_effect_free(compressor);
+            var alternative = this.alternative.drop_side_effect_free(compressor);
+            if (consequent === this.consequent && alternative === this.alternative) return this;
+            var exprs;
+            if (compressor.option("ie")) {
+                exprs = [];
+                if (consequent instanceof AST_Function) {
+                    exprs.push(consequent);
+                    consequent = null;
+                }
+                if (alternative instanceof AST_Function) {
+                    exprs.push(alternative);
+                    alternative = null;
+                }
+            }
+            var node;
+            if (!consequent) {
+                node = alternative ? make_node(AST_Binary, this, {
+                    operator: "||",
+                    left: this.condition,
+                    right: alternative,
+                }) : this.condition.drop_side_effect_free(compressor);
+            } else if (!alternative) {
+                node = make_node(AST_Binary, this, {
+                    operator: "&&",
+                    left: this.condition,
+                    right: consequent,
+                });
+            } else {
+                node = this.clone();
+                node.consequent = consequent;
+                node.alternative = alternative;
+            }
+            if (!exprs) return node;
+            if (node) exprs.push(node);
+            return exprs.length == 0 ? null : make_sequence(this, exprs);
+        });
+        def(AST_Constant, return_null);
+        def(AST_Dot, function(compressor, first_in_statement) {
+            var expr = this.expression;
+            if (expr.may_throw_on_access(compressor)) return this;
+            return expr.drop_side_effect_free(compressor, first_in_statement);
+        });
+        def(AST_Function, function(compressor) {
+            return fn_name_unused(this, compressor) ? null : this;
+        });
+        def(AST_LambdaExpression, return_null);
+        def(AST_Object, function(compressor, first_in_statement) {
+            var exprs = [];
+            this.properties.forEach(function(prop) {
+                if (prop instanceof AST_Spread) {
+                    exprs.push(prop);
+                } else {
+                    if (prop.key instanceof AST_Node) exprs.push(prop.key);
+                    exprs.push(prop.value);
+                }
+            });
+            var values = trim(exprs, compressor, first_in_statement, function(node, compressor, first_in_statement) {
+                var exp = node.expression;
+                return exp.safe_to_spread() ? exp.drop_side_effect_free(compressor, first_in_statement) : node;
+            });
+            if (!values) return null;
+            if (values === exprs && !all(values, function(node) {
+                return !(node instanceof AST_Spread);
+            })) return this;
+            return make_sequence(this, values.map(function(node) {
+                return node instanceof AST_Spread ? make_node(AST_Object, node, { properties: [ node ] }) : node;
+            }));
+        });
+        def(AST_ObjectIdentity, return_null);
+        def(AST_Sequence, function(compressor, first_in_statement) {
+            var expressions = trim(this.expressions, compressor, first_in_statement);
+            if (!expressions) return null;
+            var end = expressions.length - 1;
+            var last = expressions[end];
+            if (compressor.option("awaits") && end > 0 && last instanceof AST_Await && last.expression.is_constant()) {
+                expressions = expressions.slice(0, -1);
+                end--;
+                var expr = expressions[end];
+                last.expression = needs_enqueuing(compressor, expr) ? expr : expr.negate(compressor);
+                expressions[end] = last;
+            }
+            var assign, cond, lhs;
+            if (compressor.option("conditionals")
+                && end > 0
+                && (assign = expressions[end - 1]) instanceof AST_Assign
+                && assign.operator == "="
+                && (lhs = assign.left) instanceof AST_SymbolRef
+                && (cond = to_conditional_assignment(compressor, lhs.definition(), assign.right, last))) {
+                assign = assign.clone();
+                assign.right = cond;
+                expressions = expressions.slice(0, -2);
+                expressions.push(assign.drop_side_effect_free(compressor, first_in_statement));
+            }
+            return expressions === this.expressions ? this : make_sequence(this, expressions);
+        });
+        def(AST_Sub, function(compressor, first_in_statement) {
+            var expr = this.expression;
+            if (expr.may_throw_on_access(compressor)) return this;
+            var prop = this.property;
+            expr = expr.drop_side_effect_free(compressor, first_in_statement);
+            if (!expr) return prop.drop_side_effect_free(compressor, first_in_statement);
+            prop = prop.drop_side_effect_free(compressor);
+            if (!prop) return expr;
+            return make_sequence(this, [ expr, prop ]);
+        });
+        def(AST_SymbolRef, function(compressor) {
+            return this.is_declared(compressor) && can_drop_symbol(this, compressor) ? null : this;
+        });
+        def(AST_Template, function(compressor, first_in_statement) {
+            var self = this;
+            if (self.is_expr_pure(compressor)) {
+                var expressions = self.expressions;
+                if (expressions.length == 0) return null;
+                return make_sequence(self, expressions).drop_side_effect_free(compressor, first_in_statement);
+            }
+            var tag = self.tag;
+            var dropped = drop_returns(compressor, tag);
+            if (dropped) {
+                // always shallow clone to signal internal changes
+                self = self.clone();
+                self.tag = dropped;
+                // avoid extraneous traversal
+                if (tag._squeezed) self.tag._squeezed = true;
+            }
+            return self;
+        });
+        def(AST_Unary, function(compressor, first_in_statement) {
+            var exp = this.expression;
+            if (unary_side_effects[this.operator]) {
+                this.write_only = !exp.has_side_effects(compressor);
+                return this;
+            }
+            if (this.operator == "typeof" && exp instanceof AST_SymbolRef && can_drop_symbol(exp, compressor)) {
+                return null;
+            }
+            var node = exp.drop_side_effect_free(compressor, first_in_statement);
+            if (first_in_statement && node && is_iife_call(node)) {
+                if (node === exp && this.operator == "!") return this;
+                return node.negate(compressor, first_in_statement);
+            }
+            return node;
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("drop_side_effect_free", func);
     });
 
-    OPT(AST_SimpleStatement, function(self, compressor){
+    OPT(AST_SimpleStatement, function(self, compressor) {
         if (compressor.option("side_effects")) {
-            if (!self.body.has_side_effects(compressor)) {
-                compressor.warn("Dropping side-effect-free statement [{file}:{line},{col}]", self.start);
+            var body = self.body;
+            var node = body.drop_side_effect_free(compressor, true);
+            if (!node) {
+                AST_Node.warn("Dropping side-effect-free statement [{start}]", self);
                 return make_node(AST_EmptyStatement, self);
             }
+            if (node !== body) {
+                return make_node(AST_SimpleStatement, self, { body: node });
+            }
         }
         return self;
     });
 
-    OPT(AST_DWLoop, function(self, compressor){
-        var cond = self.condition.evaluate(compressor);
-        self.condition = cond[0];
+    OPT(AST_While, function(self, compressor) {
+        return compressor.option("loops") ? make_node(AST_For, self).optimize(compressor) : self;
+    });
+
+    function has_loop_control(loop, parent, type) {
+        if (!type) type = AST_LoopControl;
+        var found = false;
+        var tw = new TreeWalker(function(node) {
+            if (found || node instanceof AST_Scope) return true;
+            if (node instanceof type && tw.loopcontrol_target(node) === loop) {
+                return found = true;
+            }
+        });
+        if (parent instanceof AST_LabeledStatement) tw.push(parent);
+        tw.push(loop);
+        loop.body.walk(tw);
+        return found;
+    }
+
+    OPT(AST_Do, function(self, compressor) {
         if (!compressor.option("loops")) return self;
-        if (cond.length > 1) {
-            if (cond[1]) {
-                return make_node(AST_For, self, {
-                    body: self.body
-                });
-            } else if (self instanceof AST_While) {
-                if (compressor.option("dead_code")) {
-                    var a = [];
-                    extract_declarations_from_unreachable_code(compressor, self.body, a);
-                    return make_node(AST_BlockStatement, self, { body: a });
+        var cond = fuzzy_eval(compressor, self.condition);
+        if (!(cond instanceof AST_Node)) {
+            if (cond && !has_loop_control(self, compressor.parent(), AST_Continue)) return make_node(AST_For, self, {
+                body: make_node(AST_BlockStatement, self.body, {
+                    body: [
+                        self.body,
+                        make_node(AST_SimpleStatement, self.condition, { body: self.condition }),
+                    ],
+                }),
+            }).optimize(compressor);
+            if (!has_loop_control(self, compressor.parent())) return make_node(AST_BlockStatement, self.body, {
+                body: [
+                    self.body,
+                    make_node(AST_SimpleStatement, self.condition, { body: self.condition }),
+                ],
+            }).optimize(compressor);
+        }
+        if (self.body instanceof AST_BlockStatement && !has_loop_control(self, compressor.parent(), AST_Continue)) {
+            var body = self.body.body;
+            for (var i = body.length; --i >= 0;) {
+                var stat = body[i];
+                if (stat instanceof AST_If
+                    && !stat.alternative
+                    && stat.body instanceof AST_Break
+                    && compressor.loopcontrol_target(stat.body) === self) {
+                    if (has_block_scope_refs(stat.condition)) break;
+                    self.condition = make_node(AST_Binary, self, {
+                        operator: "&&",
+                        left: stat.condition.negate(compressor),
+                        right: self.condition,
+                    });
+                    body.splice(i, 1);
+                } else if (stat instanceof AST_SimpleStatement) {
+                    if (has_block_scope_refs(stat.body)) break;
+                    self.condition = make_sequence(self, [
+                        stat.body,
+                        self.condition,
+                    ]);
+                    body.splice(i, 1);
+                } else if (!is_declaration(stat, true)) {
+                    break;
                 }
             }
+            self.body = trim_block(self.body, compressor.parent());
         }
+        if (self.body instanceof AST_EmptyStatement) return make_node(AST_For, self).optimize(compressor);
+        if (self.body instanceof AST_SimpleStatement) return make_node(AST_For, self, {
+            condition: make_sequence(self.condition, [
+                self.body.body,
+                self.condition,
+            ]),
+            body: make_node(AST_EmptyStatement, self),
+        }).optimize(compressor);
         return self;
+
+        function has_block_scope_refs(node) {
+            var found = false;
+            node.walk(new TreeWalker(function(node) {
+                if (found) return true;
+                if (node instanceof AST_SymbolRef) {
+                    if (!member(node.definition(), self.enclosed)) found = true;
+                    return true;
+                }
+            }));
+            return found;
+        }
     });
 
     function if_break_in_loop(self, compressor) {
-        function drop_it(rest) {
-            rest = as_statement_array(rest);
-            if (self.body instanceof AST_BlockStatement) {
-                self.body = self.body.clone();
-                self.body.body = rest.concat(self.body.body.slice(1));
-                self.body = self.body.transform(compressor);
-            } else {
-                self.body = make_node(AST_BlockStatement, self.body, {
-                    body: rest
-                }).transform(compressor);
+        var first = first_statement(self.body);
+        if (compressor.option("dead_code")
+            && (first instanceof AST_Break
+                || first instanceof AST_Continue && external_target(first)
+                || first instanceof AST_Exit)) {
+            var body = [];
+            if (is_statement(self.init)) {
+                body.push(self.init);
+            } else if (self.init) {
+                body.push(make_node(AST_SimpleStatement, self.init, { body: self.init }));
+            }
+            var retain = external_target(first) || first instanceof AST_Exit;
+            if (self.condition && retain) {
+                body.push(make_node(AST_If, self, {
+                    condition: self.condition,
+                    body: first,
+                    alternative: null,
+                }));
+            } else if (self.condition) {
+                body.push(make_node(AST_SimpleStatement, self.condition, { body: self.condition }));
+            } else if (retain) {
+                body.push(first);
             }
-            if_break_in_loop(self, compressor);
+            extract_declarations_from_unreachable_code(compressor, self.body, body);
+            return make_node(AST_BlockStatement, self, { body: body });
         }
-        var first = self.body instanceof AST_BlockStatement ? self.body.body[0] : self.body;
         if (first instanceof AST_If) {
-            if (first.body instanceof AST_Break
-                && compressor.loopcontrol_target(first.body.label) === self) {
+            var ab = first_statement(first.body);
+            if (ab instanceof AST_Break && !external_target(ab)) {
                 if (self.condition) {
                     self.condition = make_node(AST_Binary, self.condition, {
                         left: self.condition,
@@ -1385,10 +9271,12 @@
                 } else {
                     self.condition = first.condition.negate(compressor);
                 }
-                drop_it(first.alternative);
+                var body = as_statement_array(first.alternative);
+                extract_declarations_from_unreachable_code(compressor, first.body, body);
+                return drop_it(body);
             }
-            else if (first.alternative instanceof AST_Break
-                     && compressor.loopcontrol_target(first.alternative.label) === self) {
+            ab = first_statement(first.alternative);
+            if (ab instanceof AST_Break && !external_target(ab)) {
                 if (self.condition) {
                     self.condition = make_node(AST_Binary, self.condition, {
                         left: self.condition,
@@ -1398,812 +9286,2655 @@
                 } else {
                     self.condition = first.condition;
                 }
-                drop_it(first.body);
+                var body = as_statement_array(first.body);
+                extract_declarations_from_unreachable_code(compressor, first.alternative, body);
+                return drop_it(body);
             }
         }
-    };
+        return self;
 
-    OPT(AST_While, function(self, compressor) {
-        if (!compressor.option("loops")) return self;
-        self = AST_DWLoop.prototype.optimize.call(self, compressor);
-        if (self instanceof AST_While) {
-            if_break_in_loop(self, compressor);
-            self = make_node(AST_For, self, self).transform(compressor);
+        function first_statement(body) {
+            return body instanceof AST_BlockStatement ? body.body[0] : body;
+        }
+
+        function external_target(node) {
+            return compressor.loopcontrol_target(node) !== compressor.self();
         }
-        return self;
-    });
 
-    OPT(AST_For, function(self, compressor){
-        var cond = self.condition;
-        if (cond) {
-            cond = cond.evaluate(compressor);
-            self.condition = cond[0];
+        function drop_it(rest) {
+            if (self.body instanceof AST_BlockStatement) {
+                self.body = self.body.clone();
+                self.body.body = rest.concat(self.body.body.slice(1));
+                self.body = self.body.transform(compressor);
+            } else {
+                self.body = make_node(AST_BlockStatement, self.body, { body: rest }).transform(compressor);
+            }
+            return if_break_in_loop(self, compressor);
         }
+    }
+
+    OPT(AST_For, function(self, compressor) {
         if (!compressor.option("loops")) return self;
-        if (cond) {
-            if (cond.length > 1 && !cond[1]) {
+        if (compressor.option("side_effects")) {
+            if (self.init) self.init = self.init.drop_side_effect_free(compressor);
+            if (self.step) self.step = self.step.drop_side_effect_free(compressor);
+        }
+        if (self.condition) {
+            var cond = fuzzy_eval(compressor, self.condition);
+            if (!cond) {
                 if (compressor.option("dead_code")) {
-                    var a = [];
-                    if (self.init instanceof AST_Statement) {
-                        a.push(self.init);
-                    }
-                    else if (self.init) {
-                        a.push(make_node(AST_SimpleStatement, self.init, {
-                            body: self.init
-                        }));
-                    }
-                    extract_declarations_from_unreachable_code(compressor, self.body, a);
-                    return make_node(AST_BlockStatement, self, { body: a });
+                    var body = [];
+                    if (is_statement(self.init)) {
+                        body.push(self.init);
+                    } else if (self.init) {
+                        body.push(make_node(AST_SimpleStatement, self.init, { body: self.init }));
+                    }
+                    body.push(make_node(AST_SimpleStatement, self.condition, { body: self.condition }));
+                    extract_declarations_from_unreachable_code(compressor, self.body, body);
+                    return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
                 }
+            } else if (!(cond instanceof AST_Node)) {
+                self.body = make_node(AST_BlockStatement, self.body, {
+                    body: [
+                        make_node(AST_SimpleStatement, self.condition, { body: self.condition }),
+                        self.body,
+                    ],
+                });
+                self.condition = null;
+            }
+        }
+        return if_break_in_loop(self, compressor);
+    });
+
+    OPT(AST_ForEnumeration, function(self, compressor) {
+        if (compressor.option("varify") && is_lexical_definition(self.init)) {
+            var name = self.init.definitions[0].name;
+            if ((name instanceof AST_Destructured || name instanceof AST_SymbolLet)
+                && !name.match_symbol(function(node) {
+                    if (node instanceof AST_SymbolDeclaration) {
+                        var def = node.definition();
+                        return !same_scope(def) || may_overlap(compressor, def);
+                    }
+                }, true)) {
+                self.init = to_var(self.init, self.resolve());
             }
         }
-        if_break_in_loop(self, compressor);
         return self;
     });
 
-    OPT(AST_If, function(self, compressor){
+    function mark_locally_defined(condition, consequent, alternative) {
+        if (condition instanceof AST_Sequence) condition = condition.tail_node();
+        if (!(condition instanceof AST_Binary)) return;
+        if (!(condition.left instanceof AST_String)) {
+            switch (condition.operator) {
+              case "&&":
+                mark_locally_defined(condition.left, consequent);
+                mark_locally_defined(condition.right, consequent);
+                break;
+              case "||":
+                mark_locally_defined(negate(condition.left), alternative);
+                mark_locally_defined(negate(condition.right), alternative);
+                break;
+            }
+            return;
+        }
+        if (!(condition.right instanceof AST_UnaryPrefix)) return;
+        if (condition.right.operator != "typeof") return;
+        var sym = condition.right.expression;
+        if (!is_undeclared_ref(sym)) return;
+        var body;
+        var undef = condition.left.value == "undefined";
+        switch (condition.operator) {
+          case "==":
+            body = undef ? alternative : consequent;
+            break;
+          case "!=":
+            body = undef ? consequent : alternative;
+            break;
+          default:
+            return;
+        }
+        if (!body) return;
+        var abort = false;
+        var def = sym.definition();
+        var fn;
+        var refs = [];
+        var scanned = [];
+        var tw = new TreeWalker(function(node, descend) {
+            if (abort) return true;
+            if (node instanceof AST_Assign) {
+                var ref = node.left;
+                if (!(ref instanceof AST_SymbolRef && ref.definition() === def)) return;
+                node.right.walk(tw);
+                switch (node.operator) {
+                  case "=":
+                  case "&&=":
+                    abort = true;
+                }
+                return true;
+            }
+            if (node instanceof AST_Call) {
+                descend();
+                fn = node.expression.tail_node();
+                var save;
+                if (fn instanceof AST_SymbolRef) {
+                    fn = fn.fixed_value();
+                    save = refs.length;
+                }
+                if (!(fn instanceof AST_Lambda)) {
+                    abort = true;
+                } else if (push_uniq(scanned, fn)) {
+                    fn.walk(tw);
+                }
+                if (save >= 0) refs.length = save;
+                return true;
+            }
+            if (node instanceof AST_DWLoop) {
+                var save = refs.length;
+                descend();
+                if (abort) refs.length = save;
+                return true;
+            }
+            if (node instanceof AST_For) {
+                if (node.init) node.init.walk(tw);
+                var save = refs.length;
+                if (node.condition) node.condition.walk(tw);
+                node.body.walk(tw);
+                if (node.step) node.step.walk(tw);
+                if (abort) refs.length = save;
+                return true;
+            }
+            if (node instanceof AST_ForEnumeration) {
+                node.object.walk(tw);
+                var save = refs.length;
+                node.init.walk(tw);
+                node.body.walk(tw);
+                if (abort) refs.length = save;
+                return true;
+            }
+            if (node instanceof AST_Scope) {
+                if (node === fn) return;
+                return true;
+            }
+            if (node instanceof AST_SymbolRef) {
+                if (node.definition() === def) refs.push(node);
+                return true;
+            }
+        });
+        body.walk(tw);
+        refs.forEach(function(ref) {
+            ref.defined = true;
+        });
+
+        function negate(node) {
+            if (!(node instanceof AST_Binary)) return;
+            switch (node.operator) {
+              case "==":
+                node = node.clone();
+                node.operator = "!=";
+                return node;
+              case "!=":
+                node = node.clone();
+                node.operator = "==";
+                return node;
+            }
+        }
+    }
+
+    function fuzzy_eval(compressor, node, nullish) {
+        if (node.truthy) return true;
+        if (is_undefined(node)) return undefined;
+        if (node.falsy && !nullish) return false;
+        if (node.is_truthy()) return true;
+        return node.evaluate(compressor, true);
+    }
+
+    function mark_duplicate_condition(compressor, node) {
+        var child;
+        var level = 0;
+        var negated = false;
+        var parent = compressor.self();
+        if (!is_statement(parent)) while (true) {
+            child = parent;
+            parent = compressor.parent(level++);
+            if (parent instanceof AST_Binary) {
+                switch (child) {
+                  case parent.left:
+                    if (lazy_op[parent.operator]) continue;
+                    break;
+                  case parent.right:
+                    if (match(parent.left)) switch (parent.operator) {
+                      case "&&":
+                        node[negated ? "falsy" : "truthy"] = true;
+                        break;
+                      case "||":
+                      case "??":
+                        node[negated ? "truthy" : "falsy"] = true;
+                        break;
+                    }
+                    break;
+                }
+            } else if (parent instanceof AST_Conditional) {
+                var cond = parent.condition;
+                if (cond === child) continue;
+                if (match(cond)) switch (child) {
+                  case parent.consequent:
+                    node[negated ? "falsy" : "truthy"] = true;
+                    break;
+                  case parent.alternative:
+                    node[negated ? "truthy" : "falsy"] = true;
+                    break;
+                }
+            } else if (parent instanceof AST_Exit) {
+                break;
+            } else if (parent instanceof AST_If) {
+                break;
+            } else if (parent instanceof AST_Sequence) {
+                if (parent.expressions[0] === child) continue;
+            } else if (parent instanceof AST_SimpleStatement) {
+                break;
+            }
+            return;
+        }
+        while (true) {
+            child = parent;
+            parent = compressor.parent(level++);
+            if (parent instanceof AST_BlockStatement) {
+                if (parent.body[0] === child) continue;
+            } else if (parent instanceof AST_If) {
+                if (match(parent.condition)) switch (child) {
+                  case parent.body:
+                    node[negated ? "falsy" : "truthy"] = true;
+                    break;
+                  case parent.alternative:
+                    node[negated ? "truthy" : "falsy"] = true;
+                    break;
+                }
+            }
+            return;
+        }
+
+        function match(cond) {
+            if (node.equals(cond)) return true;
+            if (!(cond instanceof AST_UnaryPrefix)) return false;
+            if (cond.operator != "!") return false;
+            if (!node.equals(cond.expression)) return false;
+            negated = true;
+            return true;
+        }
+    }
+
+    OPT(AST_If, function(self, compressor) {
+        if (is_empty(self.alternative)) self.alternative = null;
+
         if (!compressor.option("conditionals")) return self;
+        if (compressor.option("booleans") && !self.condition.has_side_effects(compressor)) {
+            mark_duplicate_condition(compressor, self.condition);
+        }
         // if condition can be statically determined, warn and drop
         // one of the blocks.  note, statically determined implies
         // “has no side effects”; also it doesn't work for cases like
         // `x && true`, though it probably should.
-        var cond = self.condition.evaluate(compressor);
-        self.condition = cond[0];
-        if (cond.length > 1) {
-            if (cond[1]) {
-                compressor.warn("Condition always true [{file}:{line},{col}]", self.condition.start);
-                if (compressor.option("dead_code")) {
-                    var a = [];
-                    if (self.alternative) {
-                        extract_declarations_from_unreachable_code(compressor, self.alternative, a);
-                    }
-                    a.push(self.body);
-                    return make_node(AST_BlockStatement, self, { body: a }).transform(compressor);
-                }
-            } else {
-                compressor.warn("Condition always false [{file}:{line},{col}]", self.condition.start);
-                if (compressor.option("dead_code")) {
-                    var a = [];
-                    extract_declarations_from_unreachable_code(compressor, self.body, a);
-                    if (self.alternative) a.push(self.alternative);
-                    return make_node(AST_BlockStatement, self, { body: a }).transform(compressor);
-                }
+        if (compressor.option("dead_code")) {
+            var cond = fuzzy_eval(compressor, self.condition);
+            if (!cond) {
+                AST_Node.warn("Condition always false [{start}]", self.condition);
+                var body = [
+                    make_node(AST_SimpleStatement, self.condition, { body: self.condition }).transform(compressor),
+                ];
+                extract_declarations_from_unreachable_code(compressor, self.body, body);
+                if (self.alternative) body.push(self.alternative);
+                return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
+            } else if (!(cond instanceof AST_Node)) {
+                AST_Node.warn("Condition always true [{start}]", self.condition);
+                var body = [
+                    make_node(AST_SimpleStatement, self.condition, { body: self.condition }).transform(compressor),
+                    self.body,
+                ];
+                if (self.alternative) extract_declarations_from_unreachable_code(compressor, self.alternative, body);
+                return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
             }
         }
-        if (is_empty(self.alternative)) self.alternative = null;
         var negated = self.condition.negate(compressor);
-        var negated_is_best = best_of(self.condition, negated) === negated;
+        var self_condition_length = self.condition.print_to_string().length;
+        var negated_length = negated.print_to_string().length;
+        var negated_is_best = negated_length < self_condition_length;
         if (self.alternative && negated_is_best) {
             negated_is_best = false; // because we already do the switch here.
+            // no need to swap values of self_condition_length and negated_length
+            // here because they are only used in an equality comparison later on.
             self.condition = negated;
             var tmp = self.body;
-            self.body = self.alternative || make_node(AST_EmptyStatement);
-            self.alternative = tmp;
-        }
-        if (is_empty(self.body) && is_empty(self.alternative)) {
-            return make_node(AST_SimpleStatement, self.condition, {
-                body: self.condition
-            }).transform(compressor);
-        }
-        if (self.body instanceof AST_SimpleStatement
-            && self.alternative instanceof AST_SimpleStatement) {
-            return make_node(AST_SimpleStatement, self, {
-                body: make_node(AST_Conditional, self, {
-                    condition   : self.condition,
-                    consequent  : self.body.body,
-                    alternative : self.alternative.body
-                })
-            }).transform(compressor);
-        }
-        if (is_empty(self.alternative) && self.body instanceof AST_SimpleStatement) {
-            if (negated_is_best) return make_node(AST_SimpleStatement, self, {
-                body: make_node(AST_Binary, self, {
-                    operator : "||",
-                    left     : negated,
-                    right    : self.body.body
-                })
-            }).transform(compressor);
-            return make_node(AST_SimpleStatement, self, {
-                body: make_node(AST_Binary, self, {
-                    operator : "&&",
-                    left     : self.condition,
-                    right    : self.body.body
-                })
-            }).transform(compressor);
+            self.body = self.alternative;
+            self.alternative = is_empty(tmp) ? null : tmp;
         }
-        if (self.body instanceof AST_EmptyStatement
-            && self.alternative
-            && self.alternative instanceof AST_SimpleStatement) {
-            return make_node(AST_SimpleStatement, self, {
-                body: make_node(AST_Binary, self, {
-                    operator : "||",
-                    left     : self.condition,
-                    right    : self.alternative.body
-                })
-            }).transform(compressor);
+        var body_defuns = [];
+        var body_var_defs = [];
+        var body_refs = [];
+        var body_exprs = sequencesize(self.body, body_defuns, body_var_defs, body_refs);
+        var alt_defuns = [];
+        var alt_var_defs = [];
+        var alt_refs = [];
+        var alt_exprs = sequencesize(self.alternative, alt_defuns, alt_var_defs, alt_refs);
+        if (body_exprs instanceof AST_BlockStatement || alt_exprs instanceof AST_BlockStatement) {
+            var body = [], var_defs = [];
+            if (body_exprs) {
+                [].push.apply(body, body_defuns);
+                [].push.apply(var_defs, body_var_defs);
+                if (body_exprs instanceof AST_BlockStatement) {
+                    self.body = body_exprs;
+                } else if (body_exprs.length == 0) {
+                    self.body = make_node(AST_EmptyStatement, self.body);
+                } else {
+                    self.body = make_node(AST_SimpleStatement, self.body, {
+                        body: make_sequence(self.body, body_exprs),
+                    });
+                }
+                body_refs.forEach(process_to_assign);
+            }
+            if (alt_exprs) {
+                [].push.apply(body, alt_defuns);
+                [].push.apply(var_defs, alt_var_defs);
+                if (alt_exprs instanceof AST_BlockStatement) {
+                    self.alternative = alt_exprs;
+                } else if (alt_exprs.length == 0) {
+                    self.alternative = null;
+                } else {
+                    self.alternative = make_node(AST_SimpleStatement, self.alternative, {
+                        body: make_sequence(self.alternative, alt_exprs),
+                    });
+                }
+                alt_refs.forEach(process_to_assign);
+            }
+            if (var_defs.length > 0) body.push(make_node(AST_Var, self, { definitions: var_defs }));
+            if (body.length > 0) {
+                body.push(self.transform(compressor));
+                return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
+            }
+        } else if (body_exprs && alt_exprs) {
+            var body = body_defuns.concat(alt_defuns);
+            if (body_var_defs.length > 0 || alt_var_defs.length > 0) body.push(make_node(AST_Var, self, {
+                definitions: body_var_defs.concat(alt_var_defs),
+            }));
+            if (body_exprs.length == 0) {
+                body.push(make_node(AST_SimpleStatement, self.condition, {
+                    body: alt_exprs.length > 0 ? make_node(AST_Binary, self, {
+                        operator: "||",
+                        left: self.condition,
+                        right: make_sequence(self.alternative, alt_exprs),
+                    }).transform(compressor) : self.condition.clone(),
+                }).optimize(compressor));
+            } else if (alt_exprs.length == 0) {
+                if (self_condition_length === negated_length && !negated_is_best
+                    && self.condition instanceof AST_Binary && self.condition.operator == "||") {
+                    // although the code length of self.condition and negated are the same,
+                    // negated does not require additional surrounding parentheses.
+                    // see https://github.com/mishoo/UglifyJS/issues/979
+                    negated_is_best = true;
+                }
+                body.push(make_node(AST_SimpleStatement, self, {
+                    body: make_node(AST_Binary, self, {
+                        operator: negated_is_best ? "||" : "&&",
+                        left: negated_is_best ? negated : self.condition,
+                        right: make_sequence(self.body, body_exprs),
+                    }).transform(compressor),
+                }).optimize(compressor));
+            } else {
+                body.push(make_node(AST_SimpleStatement, self, {
+                    body: make_node(AST_Conditional, self, {
+                        condition: self.condition,
+                        consequent: make_sequence(self.body, body_exprs),
+                        alternative: make_sequence(self.alternative, alt_exprs),
+                    }),
+                }).optimize(compressor));
+            }
+            body_refs.forEach(process_to_assign);
+            alt_refs.forEach(process_to_assign);
+            return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
+        }
+        if (is_empty(self.body)) self = make_node(AST_If, self, {
+            condition: negated,
+            body: self.alternative,
+            alternative: null,
+        });
+        if (self.alternative instanceof AST_Exit && self.body.TYPE == self.alternative.TYPE) {
+            var cons_value = self.body.value;
+            var alt_value = self.alternative.value;
+            if (!cons_value && !alt_value) return make_node(AST_BlockStatement, self, {
+                body: [
+                    make_node(AST_SimpleStatement, self, { body: self.condition }),
+                    self.body,
+                ],
+            }).optimize(compressor);
+            if (cons_value && alt_value || !keep_return_void()) {
+                var exit = make_node(self.body.CTOR, self, {
+                    value: make_node(AST_Conditional, self, {
+                        condition: self.condition,
+                        consequent: cons_value || make_node(AST_Undefined, self.body).transform(compressor),
+                        alternative: alt_value || make_node(AST_Undefined, self.alternative).transform(compressor),
+                    }),
+                });
+                if (exit instanceof AST_Return) exit.in_bool = self.body.in_bool || self.alternative.in_bool;
+                return exit;
+            }
         }
-        if (self.body instanceof AST_Exit
-            && self.alternative instanceof AST_Exit
-            && self.body.TYPE == self.alternative.TYPE) {
-            return make_node(self.body.CTOR, self, {
-                value: make_node(AST_Conditional, self, {
-                    condition   : self.condition,
-                    consequent  : self.body.value || make_node(AST_Undefined, self.body).optimize(compressor),
-                    alternative : self.alternative.value || make_node(AST_Undefined, self.alternative).optimize(compressor)
-                })
-            }).transform(compressor);
+        if (self.body instanceof AST_If && !self.body.alternative && !self.alternative) {
+            self = make_node(AST_If, self, {
+                condition: make_node(AST_Binary, self.condition, {
+                    operator: "&&",
+                    left: self.condition,
+                    right: self.body.condition,
+                }),
+                body: self.body.body,
+                alternative: null,
+            });
         }
-        if (self.body instanceof AST_If
-            && !self.body.alternative
-            && !self.alternative) {
-            self.condition = make_node(AST_Binary, self.condition, {
-                operator: "&&",
-                left: self.condition,
-                right: self.body.condition
-            }).transform(compressor);
-            self.body = self.body.body;
-        }
-        if (aborts(self.body)) {
-            if (self.alternative) {
-                var alt = self.alternative;
-                self.alternative = null;
-                return make_node(AST_BlockStatement, self, {
-                    body: [ self, alt ]
-                }).transform(compressor);
-            }
+        if (aborts(self.body) && self.alternative) {
+            var alt = self.alternative;
+            self.alternative = null;
+            return make_node(AST_BlockStatement, self, { body: [ self, alt ] }).optimize(compressor);
         }
         if (aborts(self.alternative)) {
             var body = self.body;
             self.body = self.alternative;
             self.condition = negated_is_best ? negated : self.condition.negate(compressor);
             self.alternative = null;
-            return make_node(AST_BlockStatement, self, {
-                body: [ self, body ]
-            }).transform(compressor);
+            return make_node(AST_BlockStatement, self, { body: [ self, body ] }).optimize(compressor);
         }
+        if (self.alternative) {
+            var body_stats = as_array(self.body);
+            var body_index = last_index(body_stats);
+            var alt_stats = as_array(self.alternative);
+            var alt_index = last_index(alt_stats);
+            for (var stats = []; body_index >= 0 && alt_index >= 0;) {
+                var stat = body_stats[body_index];
+                var alt_stat = alt_stats[alt_index];
+                if (stat.equals(alt_stat)) {
+                    body_stats.splice(body_index--, 1);
+                    alt_stats.splice(alt_index--, 1);
+                    stats.unshift(merge_expression(stat, alt_stat));
+                } else {
+                    if (!(stat instanceof AST_SimpleStatement)) break;
+                    if (!(alt_stat instanceof AST_SimpleStatement)) break;
+                    var expr1 = stat.body.tail_node();
+                    var expr2 = alt_stat.body.tail_node();
+                    if (!expr1.equals(expr2)) break;
+                    body_index = pop_expr(body_stats, stat.body, body_index);
+                    alt_index = pop_expr(alt_stats, alt_stat.body, alt_index);
+                    stats.unshift(make_node(AST_SimpleStatement, expr1, { body: merge_expression(expr1, expr2) }));
+                }
+            }
+            if (stats.length > 0) {
+                self.body = body_stats.length > 0 ? make_node(AST_BlockStatement, self, {
+                    body: body_stats,
+                }) : make_node(AST_EmptyStatement, self);
+                self.alternative = alt_stats.length > 0 ? make_node(AST_BlockStatement, self, {
+                    body: alt_stats,
+                }) : null;
+                stats.unshift(self);
+                return make_node(AST_BlockStatement, self, { body: stats }).optimize(compressor);
+            }
+        }
+        if (compressor.option("typeofs")) mark_locally_defined(self.condition, self.body, self.alternative);
         return self;
-    });
 
-    OPT(AST_Switch, function(self, compressor){
-        if (self.body.length == 0 && compressor.option("conditionals")) {
-            return make_node(AST_SimpleStatement, self, {
-                body: self.expression
-            }).transform(compressor);
-        }
-        for(;;) {
-            var last_branch = self.body[self.body.length - 1];
-            if (last_branch) {
-                var stat = last_branch.body[last_branch.body.length - 1]; // last statement
-                if (stat instanceof AST_Break && loop_body(compressor.loopcontrol_target(stat.label)) === self)
-                    last_branch.body.pop();
-                if (last_branch instanceof AST_Default && last_branch.body.length == 0) {
-                    self.body.pop();
-                    continue;
+        function as_array(node) {
+            return node instanceof AST_BlockStatement ? node.body : [ node ];
+        }
+
+        function keep_return_void() {
+            var has_finally = false, level = 0, node = compressor.self();
+            do {
+                if (node instanceof AST_Catch) {
+                    if (compressor.parent(level).bfinally) has_finally = true;
+                    level++;
+                } else if (node instanceof AST_Finally) {
+                    level++;
+                } else if (node instanceof AST_Scope) {
+                    return has_finally && in_async_generator(node);
+                } else if (node instanceof AST_Try) {
+                    if (node.bfinally) has_finally = true;
                 }
+            } while (node = compressor.parent(level++));
+        }
+
+        function last_index(stats) {
+            for (var index = stats.length; --index >= 0;) {
+                if (!is_declaration(stats[index], true)) break;
             }
-            break;
+            return index;
         }
-        var exp = self.expression.evaluate(compressor);
-        out: if (exp.length == 2) try {
-            // constant expression
-            self.expression = exp[0];
-            if (!compressor.option("dead_code")) break out;
-            var value = exp[1];
-            var in_if = false;
-            var in_block = false;
-            var started = false;
-            var stopped = false;
-            var ruined = false;
-            var tt = new TreeTransformer(function(node, descend, in_list){
-                if (node instanceof AST_Lambda || node instanceof AST_SimpleStatement) {
-                    // no need to descend these node types
-                    return node;
+
+        function pop_expr(stats, body, index) {
+            if (body instanceof AST_Sequence) {
+                stats[index] = make_node(AST_SimpleStatement, body, {
+                    body: make_sequence(body, body.expressions.slice(0, -1)),
+                });
+            } else {
+                stats.splice(index--, 1);
+            }
+            return index;
+        }
+
+        function sequencesize(stat, defuns, var_defs, refs) {
+            if (stat == null) return [];
+            if (stat instanceof AST_BlockStatement) {
+                var exprs = [];
+                for (var i = 0; i < stat.body.length; i++) {
+                    var line = stat.body[i];
+                    if (line instanceof AST_EmptyStatement) continue;
+                    if (line instanceof AST_Exit) {
+                        if (i == 0) return;
+                        if (exprs.length > 0) {
+                            line = line.clone();
+                            exprs.push(line.value || make_node(AST_Undefined, line).transform(compressor));
+                            line.value = make_sequence(stat, exprs);
+                        }
+                        var block = stat.clone();
+                        block.body = block.body.slice(i + 1);
+                        block.body.unshift(line);
+                        return block;
+                    }
+                    if (line instanceof AST_LambdaDefinition) {
+                        defuns.push(line);
+                    } else if (line instanceof AST_SimpleStatement) {
+                        if (!compressor.option("sequences") && exprs.length > 0) return;
+                        exprs.push(line.body);
+                    } else if (line instanceof AST_Var) {
+                        if (!compressor.option("sequences") && exprs.length > 0) return;
+                        line.remove_initializers(compressor, var_defs);
+                        line.definitions.forEach(process_var_def);
+                    } else {
+                        return;
+                    }
                 }
-                else if (node instanceof AST_Switch && node === self) {
-                    node = node.clone();
-                    descend(node, this);
-                    return ruined ? node : make_node(AST_BlockStatement, node, {
-                        body: node.body.reduce(function(a, branch){
-                            return a.concat(branch.body);
-                        }, [])
-                    }).transform(compressor);
-                }
-                else if (node instanceof AST_If || node instanceof AST_Try) {
-                    var save = in_if;
-                    in_if = !in_block;
-                    descend(node, this);
-                    in_if = save;
-                    return node;
+                return exprs;
+            }
+            if (stat instanceof AST_LambdaDefinition) {
+                defuns.push(stat);
+                return [];
+            }
+            if (stat instanceof AST_EmptyStatement) return [];
+            if (stat instanceof AST_SimpleStatement) return [ stat.body ];
+            if (stat instanceof AST_Var) {
+                var exprs = [];
+                stat.remove_initializers(compressor, var_defs);
+                stat.definitions.forEach(process_var_def);
+                return exprs;
+            }
+
+            function process_var_def(var_def) {
+                if (!var_def.value) return;
+                exprs.push(make_node(AST_Assign, var_def, {
+                    operator: "=",
+                    left: var_def.name.convert_symbol(AST_SymbolRef, function(ref) {
+                        refs.push(ref);
+                    }),
+                    right: var_def.value,
+                }));
+            }
+        }
+    });
+
+    OPT(AST_Switch, function(self, compressor) {
+        if (!compressor.option("switches")) return self;
+        if (!compressor.option("dead_code")) return self;
+        var body = [];
+        var branch;
+        var decl = [];
+        var default_branch;
+        var exact_match;
+        var side_effects = [];
+        for (var i = 0, len = self.body.length; i < len; i++) {
+            branch = self.body[i];
+            if (branch instanceof AST_Default) {
+                var prev = body[body.length - 1];
+                if (default_branch || is_break(branch.body[0], compressor) && (!prev || aborts(prev))) {
+                    eliminate_branch(branch, prev);
+                    continue;
+                } else {
+                    default_branch = branch;
                 }
-                else if (node instanceof AST_StatementWithBody || node instanceof AST_Switch) {
-                    var save = in_block;
-                    in_block = true;
-                    descend(node, this);
-                    in_block = save;
-                    return node;
+            } else {
+                var exp = branch.expression;
+                var equals = make_node(AST_Binary, self, {
+                    operator: "===",
+                    left: self.expression,
+                    right: exp,
+                }).evaluate(compressor, true);
+                if (!equals) {
+                    if (exp.has_side_effects(compressor)) side_effects.push(exp);
+                    eliminate_branch(branch, body[body.length - 1]);
+                    continue;
                 }
-                else if (node instanceof AST_Break && this.loopcontrol_target(node.label) === self) {
-                    if (in_if) {
-                        ruined = true;
-                        return node;
+                if (!(equals instanceof AST_Node)) {
+                    if (default_branch) {
+                        var default_index = body.indexOf(default_branch);
+                        body.splice(default_index, 1);
+                        eliminate_branch(default_branch, body[default_index - 1]);
+                        default_branch = null;
                     }
-                    if (in_block) return node;
-                    stopped = true;
-                    return in_list ? MAP.skip : make_node(AST_EmptyStatement, node);
-                }
-                else if (node instanceof AST_SwitchBranch && this.parent() === self) {
-                    if (stopped) return MAP.skip;
-                    if (node instanceof AST_Case) {
-                        var exp = node.expression.evaluate(compressor);
-                        if (exp.length < 2) {
-                            // got a case with non-constant expression, baling out
-                            throw self;
-                        }
-                        if (exp[1] === value || started) {
-                            started = true;
-                            if (aborts(node)) stopped = true;
-                            descend(node, this);
-                            return node;
-                        }
-                        return MAP.skip;
+                    if (exp.has_side_effects(compressor)) {
+                        exact_match = branch;
+                    } else {
+                        default_branch = branch = make_node(AST_Default, branch);
                     }
-                    descend(node, this);
-                    return node;
+                    while (++i < len) eliminate_branch(self.body[i], branch);
+                }
+            }
+            if (i + 1 >= len || aborts(branch)) {
+                var prev = body[body.length - 1];
+                var statements = branch.body;
+                if (aborts(prev)) switch (prev.body.length - statements.length) {
+                  case 1:
+                    var stat = prev.body[prev.body.length - 1];
+                    if (!is_break(stat, compressor)) break;
+                    statements = statements.concat(stat);
+                  case 0:
+                    var prev_block = make_node(AST_BlockStatement, prev);
+                    var next_block = make_node(AST_BlockStatement, branch, { body: statements });
+                    if (prev_block.equals(next_block)) prev.body = [];
+                }
+            }
+            if (side_effects.length) {
+                if (branch instanceof AST_Default) {
+                    body.push(make_node(AST_Case, self, { expression: make_sequence(self, side_effects), body: [] }));
+                } else {
+                    side_effects.push(branch.expression);
+                    branch.expression = make_sequence(self, side_effects);
                 }
+                side_effects = [];
+            }
+            body.push(branch);
+        }
+        if (side_effects.length && !exact_match) {
+            body.push(make_node(AST_Case, self, { expression: make_sequence(self, side_effects), body: [] }));
+        }
+        while (branch = body[body.length - 1]) {
+            var stat = branch.body[branch.body.length - 1];
+            if (is_break(stat, compressor)) branch.body.pop();
+            if (branch === default_branch) {
+                if (!has_declarations_only(branch)) break;
+            } else if (branch.expression.has_side_effects(compressor)) {
+                break;
+            } else if (default_branch) {
+                if (!has_declarations_only(default_branch)) break;
+                if (body[body.length - 2] !== default_branch) break;
+                default_branch.body = default_branch.body.concat(branch.body);
+                branch.body = [];
+            } else if (!has_declarations_only(branch)) break;
+            eliminate_branch(branch);
+            if (body.pop() === default_branch) default_branch = null;
+        }
+        if (!branch) {
+            decl.push(make_node(AST_SimpleStatement, self.expression, { body: self.expression }));
+            if (side_effects.length) decl.push(make_node(AST_SimpleStatement, self, {
+                body: make_sequence(self, side_effects),
+            }));
+            return make_node(AST_BlockStatement, self, { body: decl }).optimize(compressor);
+        }
+        if (branch === default_branch) while (branch = body[body.length - 2]) {
+            if (branch instanceof AST_Default) break;
+            if (!has_declarations_only(branch)) break;
+            var exp = branch.expression;
+            if (exp.has_side_effects(compressor)) {
+                var prev = body[body.length - 3];
+                if (prev && !aborts(prev)) break;
+                default_branch.body.unshift(make_node(AST_SimpleStatement, self, { body: exp }));
+            }
+            eliminate_branch(branch);
+            body.splice(-2, 1);
+        }
+        body[0].body = decl.concat(body[0].body);
+        self.body = body;
+        if (compressor.option("conditionals")) switch (body.length) {
+          case 1:
+            if (!no_break(body[0])) break;
+            var exp = body[0].expression;
+            var statements = body[0].body.slice();
+            if (body[0] !== default_branch && body[0] !== exact_match) return make_node(AST_If, self, {
+                condition: make_node(AST_Binary, self, {
+                    operator: "===",
+                    left: self.expression,
+                    right: exp,
+                }),
+                body: make_node(AST_BlockStatement, self, { body: statements }),
+                alternative: null,
+            }).optimize(compressor);
+            if (exp) statements.unshift(make_node(AST_SimpleStatement, exp, { body: exp }));
+            statements.unshift(make_node(AST_SimpleStatement, self.expression, { body: self.expression }));
+            return make_node(AST_BlockStatement, self, { body: statements }).optimize(compressor);
+          case 2:
+            if (!member(default_branch, body) || !no_break(body[1])) break;
+            var statements = body[0].body.slice();
+            var exclusive = statements.length && is_break(statements[statements.length - 1], compressor);
+            if (exclusive) statements.pop();
+            if (!all(statements, no_break)) break;
+            var alternative = body[1].body.length && make_node(AST_BlockStatement, body[1]);
+            var node = make_node(AST_If, self, {
+                condition: make_node(AST_Binary, self, body[0] === default_branch ? {
+                    operator: "!==",
+                    left: self.expression,
+                    right: body[1].expression,
+                } : {
+                    operator: "===",
+                    left: self.expression,
+                    right: body[0].expression,
+                }),
+                body: make_node(AST_BlockStatement, body[0], { body: statements }),
+                alternative: exclusive && alternative || null,
             });
-            tt.stack = compressor.stack.slice(); // so that's able to see parent nodes
-            self = self.transform(tt);
-        } catch(ex) {
-            if (ex !== self) throw ex;
+            if (!exclusive && alternative) node = make_node(AST_BlockStatement, self, { body: [ node, alternative ] });
+            return node.optimize(compressor);
         }
         return self;
-    });
 
-    OPT(AST_Case, function(self, compressor){
-        self.body = tighten_body(self.body, compressor);
-        return self;
+        function is_break(node, tw) {
+            return node instanceof AST_Break && tw.loopcontrol_target(node) === self;
+        }
+
+        function no_break(node) {
+            var found = false;
+            var tw = new TreeWalker(function(node) {
+                if (found
+                    || node instanceof AST_Lambda
+                    || node instanceof AST_SimpleStatement) return true;
+                if (is_break(node, tw)) found = true;
+            });
+            tw.push(self);
+            node.walk(tw);
+            return !found;
+        }
+
+        function eliminate_branch(branch, prev) {
+            if (prev && !aborts(prev)) {
+                prev.body = prev.body.concat(branch.body);
+            } else {
+                extract_declarations_from_unreachable_code(compressor, branch, decl);
+            }
+        }
     });
 
-    OPT(AST_Try, function(self, compressor){
+    OPT(AST_Try, function(self, compressor) {
         self.body = tighten_body(self.body, compressor);
+        if (compressor.option("dead_code")) {
+            if (has_declarations_only(self)
+                && !(self.bcatch && self.bcatch.argname && self.bcatch.argname.match_symbol(function(node) {
+                    return node instanceof AST_SymbolCatch && !can_drop_symbol(node);
+                }, true))) {
+                var body = [];
+                if (self.bcatch) {
+                    extract_declarations_from_unreachable_code(compressor, self.bcatch, body);
+                    body.forEach(function(stat) {
+                        if (!(stat instanceof AST_Var)) return;
+                        stat.definitions.forEach(function(var_def) {
+                            var def = var_def.name.definition().redefined();
+                            if (!def) return;
+                            var_def.name = var_def.name.clone();
+                            var_def.name.thedef = def;
+                        });
+                    });
+                }
+                body.unshift(make_node(AST_BlockStatement, self).optimize(compressor));
+                if (self.bfinally) {
+                    body.push(make_node(AST_BlockStatement, self.bfinally).optimize(compressor));
+                }
+                return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
+            }
+            if (self.bfinally && has_declarations_only(self.bfinally)) {
+                var body = make_node(AST_BlockStatement, self.bfinally).optimize(compressor);
+                body = self.body.concat(body);
+                if (!self.bcatch) return make_node(AST_BlockStatement, self, { body: body }).optimize(compressor);
+                self.body = body;
+                self.bfinally = null;
+            }
+        }
         return self;
     });
 
-    AST_Definitions.DEFMETHOD("remove_initializers", function(){
-        this.definitions.forEach(function(def){ def.value = null });
-    });
+    function remove_initializers(make_value) {
+        return function(compressor, defns) {
+            var dropped = false;
+            this.definitions.forEach(function(defn) {
+                if (defn.value) dropped = true;
+                defn.name.match_symbol(function(node) {
+                    if (node instanceof AST_SymbolDeclaration) defns.push(make_node(AST_VarDef, node, {
+                        name: node,
+                        value: make_value(compressor, node),
+                    }));
+                }, true);
+            });
+            return dropped;
+        };
+    }
 
-    AST_Definitions.DEFMETHOD("to_assignments", function(){
-        var assignments = this.definitions.reduce(function(a, def){
-            if (def.value) {
-                var name = make_node(AST_SymbolRef, def.name, def.name);
-                a.push(make_node(AST_Assign, def, {
-                    operator : "=",
-                    left     : name,
-                    right    : def.value
-                }));
+    AST_Const.DEFMETHOD("remove_initializers", remove_initializers(function(compressor, node) {
+        return make_node(AST_Undefined, node).optimize(compressor);
+    }));
+    AST_Let.DEFMETHOD("remove_initializers", remove_initializers(return_null));
+    AST_Var.DEFMETHOD("remove_initializers", remove_initializers(return_null));
+
+    AST_Definitions.DEFMETHOD("to_assignments", function() {
+        var assignments = this.definitions.reduce(function(a, defn) {
+            var def = defn.name.definition();
+            var value = defn.value;
+            if (value) {
+                if (value instanceof AST_Sequence) value = value.clone();
+                var name = make_node(AST_SymbolRef, defn.name);
+                var assign = make_node(AST_Assign, defn, {
+                    operator: "=",
+                    left: name,
+                    right: value,
+                });
+                a.push(assign);
+                var fixed = function() {
+                    return assign.right;
+                };
+                fixed.assigns = [ assign ];
+                fixed.direct_access = def.direct_access;
+                fixed.escaped = def.escaped;
+                name.fixed = fixed;
+                def.references.forEach(function(ref) {
+                    if (!ref.fixed) return;
+                    var assigns = ref.fixed.assigns;
+                    if (!assigns) return;
+                    if (assigns[0] !== defn) return;
+                    if (assigns.length > 1 || ref.fixed.to_binary || ref.fixed.to_prefix) {
+                        assigns[0] = assign;
+                    } else {
+                        ref.fixed = fixed;
+                        if (def.fixed === ref.fixed) def.fixed = fixed;
+                    }
+                });
+                def.references.push(name);
             }
+            def.assignments++;
+            def.eliminated++;
+            def.single_use = false;
             return a;
         }, []);
         if (assignments.length == 0) return null;
-        return AST_Seq.from_array(assignments);
+        return make_sequence(this, assignments);
     });
 
-    OPT(AST_Definitions, function(self, compressor){
-        if (self.definitions.length == 0)
-            return make_node(AST_EmptyStatement, self);
-        return self;
-    });
+    function is_safe_lexical(def) {
+        return def.name != "arguments" && def.orig.length < (def.orig[0] instanceof AST_SymbolLambda ? 3 : 2);
+    }
+
+    function may_overlap(compressor, def) {
+        if (compressor.exposed(def)) return true;
+        var scope = def.scope.resolve();
+        for (var s = def.scope; s !== scope;) {
+            s = s.parent_scope;
+            if (s.var_names().has(def.name)) return true;
+        }
+    }
+
+    function to_var(stat, scope) {
+        return make_node(AST_Var, stat, {
+            definitions: stat.definitions.map(function(defn) {
+                return make_node(AST_VarDef, defn, {
+                    name: defn.name.convert_symbol(AST_SymbolVar, function(name, node) {
+                        var def = name.definition();
+                        def.orig[def.orig.indexOf(node)] = name;
+                        if (def.scope === scope) return;
+                        def.scope = scope;
+                        scope.variables.set(def.name, def);
+                        scope.enclosed.push(def);
+                        scope.var_names().set(def.name, true);
+                    }),
+                    value: defn.value,
+                });
+            }),
+        });
+    }
+
+    function can_varify(compressor, sym) {
+        var def = sym.definition();
+        return (def.fixed || def.fixed === 0)
+            && is_safe_lexical(def)
+            && same_scope(def)
+            && !may_overlap(compressor, def);
+    }
+
+    function varify(self, compressor) {
+        return compressor.option("varify") && all(self.definitions, function(defn) {
+            return !defn.name.match_symbol(function(node) {
+                if (node instanceof AST_SymbolDeclaration) return !can_varify(compressor, node);
+            }, true);
+        }) ? to_var(self, compressor.find_parent(AST_Scope)) : self;
+    }
+
+    OPT(AST_Const, varify);
+    OPT(AST_Let, varify);
 
-    OPT(AST_Function, function(self, compressor){
-        self = AST_Lambda.prototype.optimize.call(self, compressor);
-        if (compressor.option("unused") && !compressor.option("keep_fnames")) {
-            if (self.name && self.name.unreferenced()) {
-                self.name = null;
+    function trim_optional_chain(node, compressor) {
+        if (!compressor.option("optional_chains")) return;
+        if (node.terminal) do {
+            var expr = node.expression;
+            if (node.optional) {
+                var ev = fuzzy_eval(compressor, expr, true);
+                if (ev == null) return make_node(AST_UnaryPrefix, node, {
+                    operator: "void",
+                    expression: expr,
+                }).optimize(compressor);
+                if (!(ev instanceof AST_Node)) node.optional = false;
             }
+            node = expr;
+        } while ((node.TYPE == "Call" || node instanceof AST_PropAccess) && !node.terminal);
+    }
+
+    function lift_sequence_in_expression(node, compressor) {
+        var exp = node.expression;
+        if (!(exp instanceof AST_Sequence)) return node;
+        var x = exp.expressions.slice();
+        var e = node.clone();
+        e.expression = x.pop();
+        x.push(e);
+        return make_sequence(node, x);
+    }
+
+    function drop_unused_call_args(call, compressor, fns_with_marked_args) {
+        var exp = call.expression;
+        var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp;
+        if (!(fn instanceof AST_Lambda)) return;
+        if (fn.uses_arguments) return;
+        if (fn.pinned()) return;
+        if (fns_with_marked_args && fns_with_marked_args.indexOf(fn) < 0) return;
+        var args = call.args;
+        if (!all(args, function(arg) {
+            return !(arg instanceof AST_Spread);
+        })) return;
+        var argnames = fn.argnames;
+        var is_iife = fn === exp && !fn.name;
+        if (fn.rest) {
+            if (!(is_iife && compressor.option("rests"))) return;
+            var insert = argnames.length;
+            args = args.slice(0, insert);
+            while (args.length < insert) args.push(make_node(AST_Undefined, call).optimize(compressor));
+            args.push(make_node(AST_Array, call, { elements: call.args.slice(insert) }));
+            argnames = argnames.concat(fn.rest);
+            fn.rest = null;
+        } else {
+            args = args.slice();
+            argnames = argnames.slice();
+        }
+        var pos = 0, last = 0;
+        var drop_defaults = is_iife && compressor.option("default_values");
+        var drop_fargs = is_iife && compressor.drop_fargs(fn, call) ? function(argname, arg) {
+            if (!argname) return true;
+            if (argname instanceof AST_DestructuredArray) {
+                return argname.elements.length == 0 && !argname.rest && arg instanceof AST_Array;
+            }
+            if (argname instanceof AST_DestructuredObject) {
+                return argname.properties.length == 0 && !argname.rest && arg && !arg.may_throw_on_access(compressor);
+            }
+            return argname.unused;
+        } : return_false;
+        var side_effects = [];
+        for (var i = 0; i < args.length; i++) {
+            var argname = argnames[i];
+            if (drop_defaults && argname instanceof AST_DefaultValue && args[i].is_defined(compressor)) {
+                argnames[i] = argname = argname.name;
+            }
+            if (!argname || argname.unused !== undefined) {
+                var node = args[i].drop_side_effect_free(compressor);
+                if (drop_fargs(argname)) {
+                    if (argname) argnames.splice(i, 1);
+                    args.splice(i, 1);
+                    if (node) side_effects.push(node);
+                    i--;
+                    continue;
+                } else if (node) {
+                    side_effects.push(node);
+                    args[pos++] = make_sequence(call, side_effects);
+                    side_effects = [];
+                } else if (argname) {
+                    if (side_effects.length) {
+                        args[pos++] = make_sequence(call, side_effects);
+                        side_effects = [];
+                    } else {
+                        args[pos++] = make_node(AST_Number, args[i], { value: 0 });
+                        continue;
+                    }
+                }
+            } else if (drop_fargs(argname, args[i])) {
+                var node = args[i].drop_side_effect_free(compressor);
+                argnames.splice(i, 1);
+                args.splice(i, 1);
+                if (node) side_effects.push(node);
+                i--;
+                continue;
+            } else {
+                side_effects.push(args[i]);
+                args[pos++] = make_sequence(call, side_effects);
+                side_effects = [];
+            }
+            last = pos;
+        }
+        for (; i < argnames.length; i++) {
+            if (drop_fargs(argnames[i])) argnames.splice(i--, 1);
+        }
+        fn.argnames = argnames;
+        args.length = last;
+        call.args = args;
+        if (!side_effects.length) return;
+        var arg = make_sequence(call, side_effects);
+        args.push(args.length < argnames.length ? make_node(AST_UnaryPrefix, call, {
+            operator: "void",
+            expression: arg,
+        }) : arg);
+    }
+
+    function avoid_await_yield(compressor, parent_scope) {
+        if (!parent_scope) parent_scope = compressor.find_parent(AST_Scope);
+        var avoid = [];
+        if (is_async(parent_scope) || parent_scope instanceof AST_Toplevel && compressor.option("module")) {
+            avoid.push("await");
         }
-        return self;
-    });
+        if (is_generator(parent_scope)) avoid.push("yield");
+        return avoid.length && makePredicate(avoid);
+    }
+
+    function safe_from_await_yield(fn, avoid) {
+        if (!avoid) return true;
+        var safe = true;
+        var tw = new TreeWalker(function(node) {
+            if (!safe) return true;
+            if (node instanceof AST_Scope) {
+                if (node === fn) return;
+                if (is_arrow(node)) {
+                    for (var i = 0; safe && i < node.argnames.length; i++) node.argnames[i].walk(tw);
+                } else if (node instanceof AST_LambdaDefinition && avoid[node.name.name]) {
+                    safe = false;
+                }
+                return true;
+            }
+            if (node instanceof AST_Symbol && avoid[node.name] && node !== fn.name) safe = false;
+        });
+        fn.walk(tw);
+        return safe;
+    }
+
+    function safe_from_strict_mode(fn, compressor) {
+        return fn.in_strict_mode(compressor) || !compressor.has_directive("use strict");
+    }
 
-    OPT(AST_Call, function(self, compressor){
+    OPT(AST_Call, function(self, compressor) {
+        var exp = self.expression;
+        var terminated = trim_optional_chain(self, compressor);
+        if (terminated) return terminated;
+        if (compressor.option("sequences")) {
+            if (exp instanceof AST_PropAccess) {
+                var seq = lift_sequence_in_expression(exp, compressor);
+                if (seq !== exp) {
+                    var call = self.clone();
+                    call.expression = seq.expressions.pop();
+                    seq.expressions.push(call);
+                    return seq.optimize(compressor);
+                }
+            } else if (!needs_unbinding(exp.tail_node())) {
+                var seq = lift_sequence_in_expression(self, compressor);
+                if (seq !== self) return seq.optimize(compressor);
+            }
+        }
+        if (compressor.option("unused")) drop_unused_call_args(self, compressor);
         if (compressor.option("unsafe")) {
-            var exp = self.expression;
-            if (exp instanceof AST_SymbolRef && exp.undeclared()) {
-                switch (exp.name) {
-                  case "Array":
-                    if (self.args.length != 1) {
-                        return make_node(AST_Array, self, {
-                            elements: self.args
-                        }).transform(compressor);
-                    }
-                    break;
-                  case "Object":
-                    if (self.args.length == 0) {
-                        return make_node(AST_Object, self, {
-                            properties: []
+            if (is_undeclared_ref(exp)) switch (exp.name) {
+              case "Array":
+                // Array(n) ---> [ , , ... , ]
+                if (self.args.length == 1) {
+                    var first = self.args[0];
+                    if (first instanceof AST_Number) try {
+                        var length = first.value;
+                        if (length > 6) break;
+                        var elements = Array(length);
+                        for (var i = 0; i < length; i++) elements[i] = make_node(AST_Hole, self);
+                        return make_node(AST_Array, self, { elements: elements });
+                    } catch (ex) {
+                        AST_Node.warn("Invalid array length: {length} [{start}]", {
+                            length: length,
+                            start: self.start,
                         });
+                        break;
                     }
-                    break;
-                  case "String":
-                    if (self.args.length == 0) return make_node(AST_String, self, {
-                        value: ""
-                    });
-                    if (self.args.length <= 1) return make_node(AST_Binary, self, {
-                        left: self.args[0],
+                    if (!first.is_boolean(compressor) && !first.is_string(compressor)) break;
+                }
+                // Array(...) ---> [ ... ]
+                return make_node(AST_Array, self, { elements: self.args });
+              case "Object":
+                // Object() ---> {}
+                if (self.args.length == 0) return make_node(AST_Object, self, { properties: [] });
+                break;
+              case "String":
+                // String() ---> ""
+                if (self.args.length == 0) return make_node(AST_String, self, { value: "" });
+                // String(x) ---> "" + x
+                if (self.args.length == 1) return make_node(AST_Binary, self, {
+                    operator: "+",
+                    left: make_node(AST_String, self, { value: "" }),
+                    right: self.args[0],
+                }).optimize(compressor);
+                break;
+              case "Number":
+                // Number() ---> 0
+                if (self.args.length == 0) return make_node(AST_Number, self, { value: 0 });
+                // Number(x) ---> +("" + x)
+                if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, {
+                    operator: "+",
+                    expression: make_node(AST_Binary, self, {
                         operator: "+",
-                        right: make_node(AST_String, self, { value: "" })
-                    }).transform(compressor);
-                    break;
-                  case "Number":
-                    if (self.args.length == 0) return make_node(AST_Number, self, {
-                        value: 0
-                    });
-                    if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, {
+                        left: make_node(AST_String, self, { value: "" }),
+                        right: self.args[0],
+                    }),
+                }).optimize(compressor);
+                break;
+              case "Boolean":
+                // Boolean() ---> false
+                if (self.args.length == 0) return make_node(AST_False, self).optimize(compressor);
+                // Boolean(x) ---> !!x
+                if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, {
+                    operator: "!",
+                    expression: make_node(AST_UnaryPrefix, self, {
+                        operator: "!",
                         expression: self.args[0],
-                        operator: "+"
-                    }).transform(compressor);
-                  case "Boolean":
-                    if (self.args.length == 0) return make_node(AST_False, self);
-                    if (self.args.length == 1) return make_node(AST_UnaryPrefix, self, {
-                        expression: make_node(AST_UnaryPrefix, null, {
-                            expression: self.args[0],
-                            operator: "!"
-                        }),
-                        operator: "!"
-                    }).transform(compressor);
-                    break;
-                  case "Function":
-                    // new Function() => function(){}
-                    if (self.args.length == 0) return make_node(AST_Function, self, {
-                        argnames: [],
-                        body: []
-                    });
-                    if (all(self.args, function(x){ return x instanceof AST_String })) {
-                        // quite a corner-case, but we can handle it:
-                        //   https://github.com/mishoo/UglifyJS2/issues/203
-                        // if the code argument is a constant, then we can minify it.
-                        try {
-                            var code = "(function(" + self.args.slice(0, -1).map(function(arg){
-                                return arg.value;
-                            }).join(",") + "){" + self.args[self.args.length - 1].value + "})()";
-                            var ast = parse(code);
-                            ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") });
-                            var comp = new Compressor(compressor.options);
-                            ast = ast.transform(comp);
-                            ast.figure_out_scope({ screw_ie8: compressor.option("screw_ie8") });
-                            ast.mangle_names();
-                            var fun;
-                            try {
-                                ast.walk(new TreeWalker(function(node){
-                                    if (node instanceof AST_Lambda) {
-                                        fun = node;
-                                        throw ast;
-                                    }
-                                }));
-                            } catch(ex) {
-                                if (ex !== ast) throw ex;
-                            };
-                            if (!fun) return self;
-                            var args = fun.argnames.map(function(arg, i){
-                                return make_node(AST_String, self.args[i], {
-                                    value: arg.print_to_string()
-                                });
-                            });
-                            var code = OutputStream();
-                            AST_BlockStatement.prototype._codegen.call(fun, fun, code);
-                            code = code.toString().replace(/^\{|\}$/g, "");
-                            args.push(make_node(AST_String, self.args[self.args.length - 1], {
-                                value: code
-                            }));
-                            self.args = args;
-                            return self;
-                        } catch(ex) {
-                            if (ex instanceof JS_Parse_Error) {
-                                compressor.warn("Error parsing code passed to new Function [{file}:{line},{col}]", self.args[self.args.length - 1].start);
-                                compressor.warn(ex.toString());
-                            } else {
-                                console.log(ex);
-                                throw ex;
+                    }),
+                }).optimize(compressor);
+                break;
+              case "RegExp":
+                // attempt to convert RegExp(...) to literal
+                var params = [];
+                if (all(self.args, function(arg) {
+                    var value = arg.evaluate(compressor);
+                    params.unshift(value);
+                    return arg !== value;
+                })) try {
+                    return best_of(compressor, self, make_node(AST_RegExp, self, {
+                        value: RegExp.apply(RegExp, params),
+                    }));
+                } catch (ex) {
+                    AST_Node.warn("Error converting {this} [{start}]", self);
+                }
+                break;
+            } else if (exp instanceof AST_Dot) switch (exp.property) {
+              case "toString":
+                // x.toString() ---> "" + x
+                var expr = exp.expression;
+                if (self.args.length == 0 && !(expr.may_throw_on_access(compressor) || expr instanceof AST_Super)) {
+                    return make_node(AST_Binary, self, {
+                        operator: "+",
+                        left: make_node(AST_String, self, { value: "" }),
+                        right: expr,
+                    }).optimize(compressor);
+                }
+                break;
+              case "join":
+                if (exp.expression instanceof AST_Array && self.args.length < 2) EXIT: {
+                    var separator = self.args[0];
+                    // [].join() ---> ""
+                    // [].join(x) ---> (x, "")
+                    if (exp.expression.elements.length == 0 && !(separator instanceof AST_Spread)) {
+                        return separator ? make_sequence(self, [
+                            separator,
+                            make_node(AST_String, self, { value: "" }),
+                        ]).optimize(compressor) : make_node(AST_String, self, { value: "" });
+                    }
+                    if (separator) {
+                        separator = separator.evaluate(compressor);
+                        if (separator instanceof AST_Node) break EXIT; // not a constant
+                    }
+                    var elements = [];
+                    var consts = [];
+                    for (var i = 0; i < exp.expression.elements.length; i++) {
+                        var el = exp.expression.elements[i];
+                        var value = el.evaluate(compressor);
+                        if (value !== el) {
+                            consts.push(value);
+                        } else if (el instanceof AST_Spread) {
+                            break EXIT;
+                        } else {
+                            if (consts.length > 0) {
+                                elements.push(make_node(AST_String, self, { value: consts.join(separator) }));
+                                consts.length = 0;
                             }
+                            elements.push(el);
                         }
                     }
-                    break;
-                }
-            }
-            else if (exp instanceof AST_Dot && exp.property == "toString" && self.args.length == 0) {
-                return make_node(AST_Binary, self, {
-                    left: make_node(AST_String, self, { value: "" }),
-                    operator: "+",
-                    right: exp.expression
-                }).transform(compressor);
-            }
-            else if (exp instanceof AST_Dot && exp.expression instanceof AST_Array && exp.property == "join") EXIT: {
-                var separator = self.args.length == 0 ? "," : self.args[0].evaluate(compressor)[1];
-                if (separator == null) break EXIT; // not a constant
-                var elements = exp.expression.elements.reduce(function(a, el){
-                    el = el.evaluate(compressor);
-                    if (a.length == 0 || el.length == 1) {
-                        a.push(el);
-                    } else {
-                        var last = a[a.length - 1];
-                        if (last.length == 2) {
-                            // it's a constant
-                            var val = "" + last[1] + separator + el[1];
-                            a[a.length - 1] = [ make_node_from_constant(compressor, val, last[0]), val ];
+                    if (consts.length > 0) elements.push(make_node(AST_String, self, {
+                        value: consts.join(separator),
+                    }));
+                    // [ x ].join() ---> "" + x
+                    // [ x ].join(".") ---> "" + x
+                    // [ 1, 2, 3 ].join() ---> "1,2,3"
+                    // [ 1, 2, 3 ].join(".") ---> "1.2.3"
+                    if (elements.length == 1) {
+                        if (elements[0].is_string(compressor)) return elements[0];
+                        return make_node(AST_Binary, elements[0], {
+                            operator: "+",
+                            left: make_node(AST_String, self, { value: "" }),
+                            right: elements[0],
+                        });
+                    }
+                    // [ 1, 2, a, 3 ].join("") ---> "12" + a + "3"
+                    if (separator == "") {
+                        var first;
+                        if (elements[0].is_string(compressor) || elements[1].is_string(compressor)) {
+                            first = elements.shift();
                         } else {
-                            a.push(el);
+                            first = make_node(AST_String, self, { value: "" });
                         }
+                        return elements.reduce(function(prev, el) {
+                            return make_node(AST_Binary, el, {
+                                operator: "+",
+                                left: prev,
+                                right: el,
+                            });
+                        }, first).optimize(compressor);
                     }
-                    return a;
-                }, []);
-                if (elements.length == 0) return make_node(AST_String, self, { value: "" });
-                if (elements.length == 1) return elements[0][0];
-                if (separator == "") {
-                    var first;
-                    if (elements[0][0] instanceof AST_String
-                        || elements[1][0] instanceof AST_String) {
-                        first = elements.shift()[0];
-                    } else {
-                        first = make_node(AST_String, self, { value: "" });
-                    }
-                    return elements.reduce(function(prev, el){
-                        return make_node(AST_Binary, el[0], {
-                            operator : "+",
-                            left     : prev,
-                            right    : el[0],
-                        });
-                    }, first).transform(compressor);
-                }
-                // need this awkward cloning to not affect original element
-                // best_of will decide which one to get through.
-                var node = self.clone();
-                node.expression = node.expression.clone();
-                node.expression.expression = node.expression.expression.clone();
-                node.expression.expression.elements = elements.map(function(el){
-                    return el[0];
-                });
-                return best_of(self, node);
+                    // [ x, "foo", "bar", y ].join() ---> [ x, "foo,bar", y ].join()
+                    // [ x, "foo", "bar", y ].join("-") ---> [ x, "foo-bar", y ].join("-")
+                    // need this awkward cloning to not affect original element
+                    // best_of will decide which one to get through.
+                    var node = self.clone();
+                    node.expression = node.expression.clone();
+                    node.expression.expression = node.expression.expression.clone();
+                    node.expression.expression.elements = elements;
+                    return best_of(compressor, self, node);
+                }
+                break;
+              case "charAt":
+                if (self.args.length < 2) {
+                    var node = make_node(AST_Binary, self, {
+                        operator: "||",
+                        left: make_node(AST_Sub, self, {
+                            expression: exp.expression,
+                            property: self.args.length ? make_node(AST_Binary, self.args[0], {
+                                operator: "|",
+                                left: make_node(AST_Number, self, { value: 0 }),
+                                right: self.args[0],
+                            }) : make_node(AST_Number, self, { value: 0 }),
+                        }).optimize(compressor),
+                        right: make_node(AST_String, self, { value: "" }),
+                    });
+                    node.is_string = return_true;
+                    return node.optimize(compressor);
+                }
+                break;
+              case "apply":
+                if (self.args.length == 2 && self.args[1] instanceof AST_Array) {
+                    var args = self.args[1].elements.slice();
+                    args.unshift(self.args[0]);
+                    return make_node(AST_Call, self, {
+                        expression: make_node(AST_Dot, exp, {
+                            expression: exp.expression,
+                            property: "call",
+                        }),
+                        args: args,
+                    }).optimize(compressor);
+                }
+                break;
+              case "call":
+                var func = exp.expression;
+                if (func instanceof AST_SymbolRef) {
+                    func = func.fixed_value();
+                }
+                if (func instanceof AST_Lambda && !func.contains_this()) {
+                    return (self.args.length ? make_sequence(self, [
+                        self.args[0],
+                        make_node(AST_Call, self, {
+                            expression: exp.expression,
+                            args: self.args.slice(1),
+                        }),
+                    ]) : make_node(AST_Call, self, {
+                        expression: exp.expression,
+                        args: [],
+                    })).optimize(compressor);
+                }
+                break;
+            } else if (compressor.option("side_effects")
+                && exp instanceof AST_Call
+                && exp.args.length == 1
+                && is_undeclared_ref(exp.expression)
+                && exp.expression.name == "Object") {
+                var call = self.clone();
+                call.expression = maintain_this_binding(self, exp, exp.args[0]);
+                return call.optimize(compressor);
+            }
+        }
+        if (compressor.option("unsafe_Function")
+            && is_undeclared_ref(exp)
+            && exp.name == "Function") {
+            // new Function() ---> function(){}
+            if (self.args.length == 0) return make_node(AST_Function, self, {
+                argnames: [],
+                body: [],
+            }).init_vars(exp.scope);
+            if (all(self.args, function(x) {
+                return x instanceof AST_String;
+            })) {
+                // quite a corner-case, but we can handle it:
+                //   https://github.com/mishoo/UglifyJS/issues/203
+                // if the code argument is a constant, then we can minify it.
+                try {
+                    var code = "n(function(" + self.args.slice(0, -1).map(function(arg) {
+                        return arg.value;
+                    }).join() + "){" + self.args[self.args.length - 1].value + "})";
+                    var ast = parse(code);
+                    var mangle = { ie: compressor.option("ie") };
+                    ast.figure_out_scope(mangle);
+                    var comp = new Compressor(compressor.options);
+                    ast = ast.transform(comp);
+                    ast.figure_out_scope(mangle);
+                    ast.compute_char_frequency(mangle);
+                    ast.mangle_names(mangle);
+                    var fun;
+                    ast.walk(new TreeWalker(function(node) {
+                        if (fun) return true;
+                        if (node instanceof AST_Lambda) {
+                            fun = node;
+                            return true;
+                        }
+                    }));
+                    var code = OutputStream();
+                    AST_BlockStatement.prototype._codegen.call(fun, code);
+                    self.args = [
+                        make_node(AST_String, self, {
+                            value: fun.argnames.map(function(arg) {
+                                return arg.print_to_string();
+                            }).join(),
+                        }),
+                        make_node(AST_String, self.args[self.args.length - 1], {
+                            value: code.get().replace(/^\{|\}$/g, "")
+                        }),
+                    ];
+                    return self;
+                } catch (ex) {
+                    if (ex instanceof JS_Parse_Error) {
+                        AST_Node.warn("Error parsing code passed to new Function [{start}]", self.args[self.args.length - 1]);
+                        AST_Node.warn(ex.toString());
+                    } else {
+                        throw ex;
+                    }
+                }
             }
         }
-        if (compressor.option("side_effects")) {
-            if (self.expression instanceof AST_Function
-                && self.args.length == 0
-                && !AST_Block.prototype.has_side_effects.call(self.expression, compressor)) {
-                return make_node(AST_Undefined, self).transform(compressor);
+        var fn = exp instanceof AST_SymbolRef ? exp.fixed_value() : exp;
+        var parent = compressor.parent(), current = compressor.self();
+        var is_func = fn instanceof AST_Lambda
+            && (!is_async(fn) || compressor.option("awaits") && parent instanceof AST_Await)
+            && (!is_generator(fn) || compressor.option("yields") && current instanceof AST_Yield && current.nested);
+        var stat = is_func && fn.first_statement();
+        var has_default = 0, has_destructured = false;
+        var has_spread = !all(self.args, function(arg) {
+            return !(arg instanceof AST_Spread);
+        });
+        var can_drop = is_func && all(fn.argnames, function(argname, index) {
+            if (has_default == 1 && self.args[index] instanceof AST_Spread) has_default = 2;
+            if (argname instanceof AST_DefaultValue) {
+                if (!has_default) has_default = 1;
+                var arg = has_default == 1 && self.args[index];
+                if (!is_undefined(arg)) has_default = 2;
+                if (has_arg_refs(fn, argname.value)) return false;
+                argname = argname.name;
+            }
+            if (argname instanceof AST_Destructured) {
+                has_destructured = true;
+                if (has_arg_refs(fn, argname)) return false;
+            }
+            return true;
+        }) && !(fn.rest instanceof AST_Destructured && has_arg_refs(fn, fn.rest));
+        var can_inline = can_drop
+            && compressor.option("inline")
+            && !self.is_expr_pure(compressor)
+            && (exp === fn || safe_from_strict_mode(fn, compressor));
+        if (can_inline && stat instanceof AST_Return) {
+            var value = stat.value;
+            if (exp === fn
+                && !fn.name
+                && (!value || value.is_constant_expression())
+                && safe_from_await_yield(fn, avoid_await_yield(compressor))) {
+                return make_sequence(self, convert_args(value)).optimize(compressor);
+            }
+        }
+        if (is_func && !fn.contains_this()) {
+            var def, value, var_assigned = false;
+            if (can_inline
+                && !fn.uses_arguments
+                && !fn.pinned()
+                && !(fn.name && fn instanceof AST_LambdaExpression)
+                && (exp === fn || !recursive_ref(compressor, def = exp.definition(), fn)
+                    && fn.is_constant_expression(find_scope(compressor)))
+                && (value = can_flatten_body(stat))) {
+                var replacing = exp === fn || def.single_use && def.references.length - def.replaced == 1;
+                if (can_substitute_directly()) {
+                    var args = self.args.slice();
+                    var refs = [];
+                    var retValue = value.clone(true).transform(new TreeTransformer(function(node) {
+                        if (node instanceof AST_SymbolRef) {
+                            var def = node.definition();
+                            if (fn.variables.get(node.name) !== def) {
+                                refs.push(node);
+                                return node;
+                            }
+                            var index = resolve_index(def);
+                            var arg = args[index];
+                            if (!arg) return make_node(AST_Undefined, self);
+                            args[index] = null;
+                            var parent = this.parent();
+                            return parent ? maintain_this_binding(parent, node, arg) : arg;
+                        }
+                    }));
+                    var save_inlined = fn.inlined;
+                    if (exp !== fn) fn.inlined = true;
+                    var exprs = [];
+                    args.forEach(function(arg) {
+                        if (!arg) return;
+                        arg = arg.clone(true);
+                        arg.walk(new TreeWalker(function(node) {
+                            if (node instanceof AST_SymbolRef) refs.push(node);
+                        }));
+                        exprs.push(arg);
+                    }, []);
+                    exprs.push(retValue);
+                    var node = make_sequence(self, exprs).optimize(compressor);
+                    fn.inlined = save_inlined;
+                    node = maintain_this_binding(parent, current, node);
+                    if (replacing || best_of_expression(node, self) === node) {
+                        refs.forEach(function(ref) {
+                            ref.scope = exp === fn ? fn.parent_scope : exp.scope;
+                            ref.reference();
+                            var def = ref.definition();
+                            if (replacing) def.replaced++;
+                            def.single_use = false;
+                        });
+                        return node;
+                    } else if (!node.has_side_effects(compressor)) {
+                        self.drop_side_effect_free = function(compressor, first_in_statement) {
+                            var self = this;
+                            var exprs = self.args.slice();
+                            exprs.unshift(self.expression);
+                            return make_sequence(self, exprs).drop_side_effect_free(compressor, first_in_statement);
+                        };
+                    }
+                }
+                var arg_used, insert, in_loop, scope;
+                if (replacing && can_inject_symbols()) {
+                    fn._squeezed = true;
+                    if (exp !== fn) fn.parent_scope = exp.scope;
+                    var node = make_sequence(self, flatten_fn()).optimize(compressor);
+                    return maintain_this_binding(parent, current, node);
+                }
+            }
+            if (compressor.option("side_effects")
+                && can_drop
+                && all(fn.body, is_empty)
+                && (fn === exp ? fn_name_unused(fn, compressor) : !has_default && !has_destructured && !fn.rest)
+                && !(is_arrow(fn) && fn.value)
+                && safe_from_await_yield(fn, avoid_await_yield(compressor))) {
+                return make_sequence(self, convert_args()).optimize(compressor);
             }
         }
         if (compressor.option("drop_console")) {
-            if (self.expression instanceof AST_PropAccess) {
-                var name = self.expression.expression;
+            if (exp instanceof AST_PropAccess) {
+                var name = exp.expression;
                 while (name.expression) {
                     name = name.expression;
                 }
-                if (name instanceof AST_SymbolRef
-                    && name.name == "console"
-                    && name.undeclared()) {
-                    return make_node(AST_Undefined, self).transform(compressor);
+                if (is_undeclared_ref(name) && name.name == "console") {
+                    return make_node(AST_Undefined, self).optimize(compressor);
+                }
+            }
+        }
+        if (compressor.option("negate_iife") && parent instanceof AST_SimpleStatement && is_iife_call(current)) {
+            return self.negate(compressor, true);
+        }
+        return try_evaluate(compressor, self);
+
+        function make_void_lhs(orig) {
+            return make_node(AST_Sub, orig, {
+                expression: make_node(AST_Array, orig, { elements: [] }),
+                property: make_node(AST_Number, orig, { value: 0 }),
+            });
+        }
+
+        function convert_args(value) {
+            var args = self.args.slice();
+            var destructured = has_default > 1 || has_destructured || fn.rest;
+            if (destructured || has_spread) args = [ make_node(AST_Array, self, { elements: args }) ];
+            if (destructured) {
+                var tt = new TreeTransformer(function(node, descend) {
+                    if (node instanceof AST_DefaultValue) return make_node(AST_DefaultValue, node, {
+                        name: node.name.transform(tt) || make_void_lhs(node),
+                        value: node.value,
+                    });
+                    if (node instanceof AST_DestructuredArray) {
+                        var elements = [];
+                        node.elements.forEach(function(node, index) {
+                            node = node.transform(tt);
+                            if (node) elements[index] = node;
+                        });
+                        fill_holes(node, elements);
+                        return make_node(AST_DestructuredArray, node, { elements: elements });
+                    }
+                    if (node instanceof AST_DestructuredObject) {
+                        var properties = [], side_effects = [];
+                        node.properties.forEach(function(prop) {
+                            var key = prop.key;
+                            var value = prop.value.transform(tt);
+                            if (value) {
+                                if (side_effects.length) {
+                                    if (!(key instanceof AST_Node)) key = make_node_from_constant(key, prop);
+                                    side_effects.push(key);
+                                    key = make_sequence(node, side_effects);
+                                    side_effects = [];
+                                }
+                                properties.push(make_node(AST_DestructuredKeyVal, prop, {
+                                    key: key,
+                                    value: value,
+                                }));
+                            } else if (key instanceof AST_Node) {
+                                side_effects.push(key);
+                            }
+                        });
+                        if (side_effects.length) properties.push(make_node(AST_DestructuredKeyVal, node, {
+                            key: make_sequence(node, side_effects),
+                            value: make_void_lhs(node),
+                        }));
+                        return make_node(AST_DestructuredObject, node, { properties: properties });
+                    }
+                    if (node instanceof AST_SymbolFunarg) return null;
+                });
+                var lhs = [];
+                fn.argnames.forEach(function(argname, index) {
+                    argname = argname.transform(tt);
+                    if (argname) lhs[index] = argname;
+                });
+                var rest = fn.rest && fn.rest.transform(tt);
+                if (rest) lhs.length = fn.argnames.length;
+                fill_holes(fn, lhs);
+                args[0] = make_node(AST_Assign, self, {
+                    operator: "=",
+                    left: make_node(AST_DestructuredArray, fn, {
+                        elements: lhs,
+                        rest: rest,
+                    }),
+                    right: args[0],
+                });
+            } else fn.argnames.forEach(function(argname) {
+                if (argname instanceof AST_DefaultValue) args.push(argname.value);
+            });
+            args.push(value || make_node(AST_Undefined, self));
+            return args;
+        }
+
+        function noop_value() {
+            return self.call_only ? make_node(AST_Number, self, { value: 0 }) : make_node(AST_Undefined, self);
+        }
+
+        function return_value(stat) {
+            if (!stat) return noop_value();
+            if (stat instanceof AST_Return) return stat.value || noop_value();
+            if (stat instanceof AST_SimpleStatement) {
+                return self.call_only ? stat.body : make_node(AST_UnaryPrefix, stat, {
+                    operator: "void",
+                    expression: stat.body,
+                });
+            }
+        }
+
+        function can_flatten_body(stat) {
+            var len = fn.body.length;
+            if (len < 2) {
+                stat = return_value(stat);
+                if (stat) return stat;
+            }
+            if (compressor.option("inline") < 3) return false;
+            stat = null;
+            for (var i = 0; i < len; i++) {
+                var line = fn.body[i];
+                if (line instanceof AST_Var) {
+                    if (var_assigned) {
+                        if (!stat) continue;
+                        if (!(stat instanceof AST_SimpleStatement)) return false;
+                        if (!declarations_only(line)) stat = null;
+                    } else if (!declarations_only(line)) {
+                        if (stat && !(stat instanceof AST_SimpleStatement)) return false;
+                        stat = null;
+                        var_assigned = true;
+                    }
+                } else if (line instanceof AST_AsyncDefun
+                    || line instanceof AST_Defun
+                    || line instanceof AST_EmptyStatement) {
+                    continue;
+                } else if (stat) {
+                    return false;
+                } else {
+                    stat = line;
                 }
             }
+            return return_value(stat);
+        }
+
+        function resolve_index(def) {
+            for (var i = fn.argnames.length; --i >= 0;) {
+                if (fn.argnames[i].definition() === def) return i;
+            }
+        }
+
+        function can_substitute_directly() {
+            if (has_default || has_destructured || has_spread || var_assigned || fn.rest) return;
+            if (compressor.option("inline") < 2 && fn.argnames.length) return;
+            if (!fn.variables.all(function(def) {
+                return def.references.length - def.replaced < 2 && def.orig[0] instanceof AST_SymbolFunarg;
+            })) return;
+            var scope = compressor.find_parent(AST_Scope);
+            var abort = false;
+            var avoid = avoid_await_yield(compressor, scope);
+            var begin;
+            var in_order = [];
+            var side_effects = false;
+            var tw = new TreeWalker(function(node, descend) {
+                if (abort) return true;
+                if (node instanceof AST_Binary && lazy_op[node.operator]
+                    || node instanceof AST_Conditional) {
+                    in_order = null;
+                    return;
+                }
+                if (node instanceof AST_Scope) return abort = true;
+                if (avoid && node instanceof AST_Symbol && avoid[node.name]) return abort = true;
+                if (node instanceof AST_SymbolRef) {
+                    var def = node.definition();
+                    if (fn.variables.get(node.name) !== def) {
+                        in_order = null;
+                        return;
+                    }
+                    if (def.init instanceof AST_LambdaDefinition) return abort = true;
+                    if (is_lhs(node, tw.parent())) return abort = true;
+                    var index = resolve_index(def);
+                    if (!(begin < index)) begin = index;
+                    if (!in_order) return;
+                    if (side_effects) {
+                        in_order = null;
+                    } else {
+                        in_order.push(fn.argnames[index]);
+                    }
+                    return;
+                }
+                if (side_effects) return;
+                if (node instanceof AST_Assign && node.left instanceof AST_PropAccess) {
+                    node.left.expression.walk(tw);
+                    if (node.left instanceof AST_Sub) node.left.property.walk(tw);
+                    node.right.walk(tw);
+                    side_effects = true;
+                    return true;
+                }
+                if (node.has_side_effects(compressor)) {
+                    descend();
+                    side_effects = true;
+                    return true;
+                }
+            });
+            value.walk(tw);
+            if (abort) return;
+            var end = self.args.length;
+            if (in_order && fn.argnames.length >= end) {
+                end = fn.argnames.length;
+                while (end-- > begin && fn.argnames[end] === in_order.pop());
+                end++;
+            }
+            return end <= begin || all(self.args.slice(begin, end), side_effects && !in_order ? function(funarg) {
+                return funarg.is_constant_expression(scope);
+            } : function(funarg) {
+                return !funarg.has_side_effects(compressor);
+            });
+        }
+
+        function var_exists(defined, name) {
+            return defined.has(name) || identifier_atom[name] || scope.var_names().has(name);
+        }
+
+        function can_inject_args(defined, safe_to_inject) {
+            var abort = false;
+            fn.each_argname(function(arg) {
+                if (abort) return;
+                if (arg.unused) return;
+                if (!safe_to_inject || var_exists(defined, arg.name)) return abort = true;
+                arg_used.set(arg.name, true);
+                if (in_loop) in_loop.push(arg.definition());
+            });
+            return !abort;
+        }
+
+        function can_inject_vars(defined, safe_to_inject) {
+            for (var i = 0; i < fn.body.length; i++) {
+                var stat = fn.body[i];
+                if (stat instanceof AST_LambdaDefinition) {
+                    var name = stat.name;
+                    if (!safe_to_inject) return false;
+                    if (arg_used.has(name.name)) return false;
+                    if (var_exists(defined, name.name)) return false;
+                    if (!all(stat.enclosed, function(def) {
+                        return def.scope === scope || def.scope === stat || !defined.has(def.name);
+                    })) return false;
+                    if (in_loop) in_loop.push(name.definition());
+                    continue;
+                }
+                if (!(stat instanceof AST_Var)) continue;
+                if (!safe_to_inject) return false;
+                for (var j = stat.definitions.length; --j >= 0;) {
+                    var name = stat.definitions[j].name;
+                    if (var_exists(defined, name.name)) return false;
+                    if (in_loop) in_loop.push(name.definition());
+                }
+            }
+            return true;
+        }
+
+        function can_inject_symbols() {
+            var defined = new Dictionary();
+            var level = 0, child;
+            scope = current;
+            do {
+                if (scope.variables) scope.variables.each(function(def) {
+                    defined.set(def.name, true);
+                });
+                child = scope;
+                scope = compressor.parent(level++);
+                if (scope instanceof AST_ClassField) {
+                    if (!scope.static) return false;
+                } else if (scope instanceof AST_DWLoop) {
+                    in_loop = [];
+                } else if (scope instanceof AST_For) {
+                    if (scope.init === child) continue;
+                    in_loop = [];
+                } else if (scope instanceof AST_ForEnumeration) {
+                    if (scope.init === child) continue;
+                    if (scope.object === child) continue;
+                    in_loop = [];
+                }
+            } while (!(scope instanceof AST_Scope));
+            insert = scope.body.indexOf(child) + 1;
+            if (!insert) return false;
+            if (!safe_from_await_yield(fn, avoid_await_yield(compressor, scope))) return false;
+            var safe_to_inject = (exp !== fn || fn.parent_scope.resolve() === scope) && !scope.pinned();
+            if (scope instanceof AST_Toplevel) {
+                if (compressor.toplevel.vars) {
+                    defined.set("arguments", true);
+                } else {
+                    safe_to_inject = false;
+                }
+            }
+            arg_used = new Dictionary();
+            var inline = compressor.option("inline");
+            if (!can_inject_args(defined, inline >= 2 && safe_to_inject)) return false;
+            if (!can_inject_vars(defined, inline >= 3 && safe_to_inject)) return false;
+            return !in_loop || in_loop.length == 0 || !is_reachable(fn, in_loop);
+        }
+
+        function append_var(decls, expressions, name, value) {
+            var def = name.definition();
+            if (!scope.var_names().has(name.name)) {
+                scope.var_names().set(name.name, true);
+                decls.push(make_node(AST_VarDef, name, {
+                    name: name,
+                    value: null,
+                }));
+            }
+            scope.variables.set(name.name, def);
+            scope.enclosed.push(def);
+            if (!value) return;
+            var sym = make_node(AST_SymbolRef, name);
+            def.assignments++;
+            def.references.push(sym);
+            expressions.push(make_node(AST_Assign, self, {
+                operator: "=",
+                left: sym,
+                right: value,
+            }));
+        }
+
+        function flatten_args(decls, expressions) {
+            var len = fn.argnames.length;
+            for (var i = self.args.length; --i >= len;) {
+                expressions.push(self.args[i]);
+            }
+            var default_args = [];
+            for (i = len; --i >= 0;) {
+                var argname = fn.argnames[i];
+                var name;
+                if (argname instanceof AST_DefaultValue) {
+                    default_args.push(argname);
+                    name = argname.name;
+                } else {
+                    name = argname;
+                }
+                var value = self.args[i];
+                if (name.unused || scope.var_names().has(name.name)) {
+                    if (value) expressions.push(value);
+                } else {
+                    var symbol = make_node(AST_SymbolVar, name);
+                    var def = name.definition();
+                    def.orig.push(symbol);
+                    def.eliminated++;
+                    if (name.unused !== undefined) {
+                        append_var(decls, expressions, symbol);
+                        if (value) expressions.push(value);
+                    } else {
+                        if (!value && argname === name && (in_loop
+                            || name.name == "arguments" && !is_arrow(fn) && is_arrow(scope))) {
+                            value = make_node(AST_Undefined, self);
+                        }
+                        append_var(decls, expressions, symbol, value);
+                    }
+                }
+            }
+            decls.reverse();
+            expressions.reverse();
+            for (i = default_args.length; --i >= 0;) {
+                var node = default_args[i];
+                if (node.name.unused !== undefined) {
+                    expressions.push(node.value);
+                } else {
+                    var sym = make_node(AST_SymbolRef, node.name);
+                    node.name.definition().references.push(sym);
+                    expressions.push(make_node(AST_Assign, node, {
+                        operator: "=",
+                        left: sym,
+                        right: node.value,
+                    }));
+                }
+            }
+        }
+
+        function flatten_destructured(decls, expressions) {
+            expressions.push(make_node(AST_Assign, self, {
+                operator: "=",
+                left: make_node(AST_DestructuredArray, self, {
+                    elements: fn.argnames.map(function(argname) {
+                        if (argname.unused) return make_node(AST_Hole, argname);
+                        return argname.convert_symbol(AST_SymbolRef, process);
+                    }),
+                    rest: fn.rest && fn.rest.convert_symbol(AST_SymbolRef, process),
+                }),
+                right: make_node(AST_Array, self, { elements: self.args.slice() }),
+            }));
+
+            function process(ref, name) {
+                if (name.unused) return make_void_lhs(name);
+                var def = name.definition();
+                def.assignments++;
+                def.references.push(ref);
+                var symbol = make_node(AST_SymbolVar, name);
+                def.orig.push(symbol);
+                def.eliminated++;
+                append_var(decls, expressions, symbol);
+            }
+        }
+
+        function flatten_vars(decls, expressions) {
+            var args = [ insert, 0 ];
+            var decl_var = [], expr_fn = [], expr_var = [], expr_loop = [], exprs = [];
+            fn.body.filter(in_loop ? function(stat) {
+                if (!(stat instanceof AST_LambdaDefinition)) return true;
+                var name = make_node(AST_SymbolVar, flatten_var(stat.name));
+                var def = name.definition();
+                def.fixed = false;
+                def.orig.push(name);
+                def.eliminated++;
+                append_var(decls, expr_fn, name, to_func_expr(stat, true));
+                return false;
+            } : function(stat) {
+                if (!(stat instanceof AST_LambdaDefinition)) return true;
+                var def = stat.name.definition();
+                scope.functions.set(def.name, def);
+                scope.variables.set(def.name, def);
+                scope.enclosed.push(def);
+                scope.var_names().set(def.name, true);
+                args.push(stat);
+                return false;
+            }).forEach(function(stat) {
+                if (!(stat instanceof AST_Var)) {
+                    if (stat instanceof AST_SimpleStatement) exprs.push(stat.body);
+                    return;
+                }
+                for (var j = 0; j < stat.definitions.length; j++) {
+                    var var_def = stat.definitions[j];
+                    var name = flatten_var(var_def.name);
+                    var value = var_def.value;
+                    if (value && exprs.length > 0) {
+                        exprs.push(value);
+                        value = make_sequence(var_def, exprs);
+                        exprs = [];
+                    }
+                    append_var(decl_var, expr_var, name, value);
+                    if (!in_loop) continue;
+                    if (arg_used.has(name.name)) continue;
+                    if (name.definition().orig.length == 1 && fn.functions.has(name.name)) continue;
+                    expr_loop.push(init_ref(compressor, name));
+                }
+            });
+            [].push.apply(decls, decl_var);
+            [].push.apply(expressions, expr_loop);
+            [].push.apply(expressions, expr_fn);
+            [].push.apply(expressions, expr_var);
+            return args;
+        }
+
+        function flatten_fn() {
+            var decls = [];
+            var expressions = [];
+            if (has_default > 1 || has_destructured || has_spread || fn.rest) {
+                flatten_destructured(decls, expressions);
+            } else {
+                flatten_args(decls, expressions);
+            }
+            var args = flatten_vars(decls, expressions);
+            expressions.push(value);
+            if (decls.length) args.push(make_node(AST_Var, fn, { definitions: decls }));
+            [].splice.apply(scope.body, args);
+            fn.enclosed.forEach(function(def) {
+                if (scope.var_names().has(def.name)) return;
+                scope.enclosed.push(def);
+                scope.var_names().set(def.name, true);
+            });
+            return expressions;
         }
-        return self.evaluate(compressor)[0];
     });
 
-    OPT(AST_New, function(self, compressor){
+    OPT(AST_New, function(self, compressor) {
         if (compressor.option("unsafe")) {
             var exp = self.expression;
-            if (exp instanceof AST_SymbolRef && exp.undeclared()) {
-                switch (exp.name) {
-                  case "Object":
-                  case "RegExp":
-                  case "Function":
-                  case "Error":
-                  case "Array":
-                    return make_node(AST_Call, self, self).transform(compressor);
-                }
+            if (is_undeclared_ref(exp)) switch (exp.name) {
+              case "Array":
+              case "Error":
+              case "Function":
+              case "Object":
+              case "RegExp":
+                return make_node(AST_Call, self).transform(compressor);
             }
         }
+        if (compressor.option("sequences")) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (compressor.option("unused")) drop_unused_call_args(self, compressor);
         return self;
     });
 
-    OPT(AST_Seq, function(self, compressor){
-        if (!compressor.option("side_effects"))
+    // (a = b, x && a = c) ---> a = x ? c : b
+    // (a = b, x || a = c) ---> a = x ? b : c
+    function to_conditional_assignment(compressor, def, value, node) {
+        if (!(node instanceof AST_Binary)) return;
+        if (!(node.operator == "&&" || node.operator == "||")) return;
+        if (!(node.right instanceof AST_Assign)) return;
+        if (node.right.operator != "=") return;
+        if (!(node.right.left instanceof AST_SymbolRef)) return;
+        if (node.right.left.definition() !== def) return;
+        if (value.has_side_effects(compressor)) return;
+        if (!safe_from_assignment(node.left)) return;
+        if (!safe_from_assignment(node.right.right)) return;
+        def.replaced++;
+        return node.operator == "&&" ? make_node(AST_Conditional, node, {
+            condition: node.left,
+            consequent: node.right.right,
+            alternative: value,
+        }) : make_node(AST_Conditional, node, {
+            condition: node.left,
+            consequent: value,
+            alternative: node.right.right,
+        });
+
+        function safe_from_assignment(node) {
+            if (node.has_side_effects(compressor)) return;
+            var hit = false;
+            node.walk(new TreeWalker(function(node) {
+                if (hit) return true;
+                if (node instanceof AST_SymbolRef && node.definition() === def) return hit = true;
+            }));
+            return !hit;
+        }
+    }
+
+    OPT(AST_Sequence, function(self, compressor) {
+        var expressions = filter_for_side_effects();
+        var end = expressions.length - 1;
+        merge_assignments();
+        trim_right_for_undefined();
+        if (end == 0) {
+            self = maintain_this_binding(compressor.parent(), compressor.self(), expressions[0]);
+            if (!(self instanceof AST_Sequence)) self = self.optimize(compressor);
             return self;
-        if (!self.car.has_side_effects(compressor)) {
-            // we shouldn't compress (1,eval)(something) to
-            // eval(something) because that changes the meaning of
-            // eval (becomes lexical instead of global).
-            var p;
-            if (!(self.cdr instanceof AST_SymbolRef
-                  && self.cdr.name == "eval"
-                  && self.cdr.undeclared()
-                  && (p = compressor.parent()) instanceof AST_Call
-                  && p.expression === self)) {
-                return self.cdr;
-            }
-        }
-        if (compressor.option("cascade")) {
-            if (self.car instanceof AST_Assign
-                && !self.car.left.has_side_effects(compressor)) {
-                if (self.car.left.equivalent_to(self.cdr)) {
-                    return self.car;
-                }
-                if (self.cdr instanceof AST_Call
-                    && self.cdr.expression.equivalent_to(self.car.left)) {
-                    self.cdr.expression = self.car;
-                    return self.cdr;
-                }
-            }
-            if (!self.car.has_side_effects(compressor)
-                && !self.cdr.has_side_effects(compressor)
-                && self.car.equivalent_to(self.cdr)) {
-                return self.car;
-            }
-        }
-        if (self.cdr instanceof AST_UnaryPrefix
-            && self.cdr.operator == "void"
-            && !self.cdr.expression.has_side_effects(compressor)) {
-            self.cdr.expression = self.car;
-            return self.cdr;
         }
-        if (self.cdr instanceof AST_Undefined) {
-            return make_node(AST_UnaryPrefix, self, {
-                operator   : "void",
-                expression : self.car
+        self.expressions = expressions;
+        return self;
+
+        function filter_for_side_effects() {
+            if (!compressor.option("side_effects")) return self.expressions;
+            var expressions = [];
+            var first = first_in_statement(compressor);
+            var last = self.expressions.length - 1;
+            self.expressions.forEach(function(expr, index) {
+                if (index < last) expr = expr.drop_side_effect_free(compressor, first);
+                if (expr) {
+                    merge_sequence(expressions, expr);
+                    first = false;
+                }
             });
+            return expressions;
         }
-        return self;
-    });
 
-    AST_Unary.DEFMETHOD("lift_sequences", function(compressor){
-        if (compressor.option("sequences")) {
-            if (this.expression instanceof AST_Seq) {
-                var seq = this.expression;
-                var x = seq.to_array();
-                this.expression = x.pop();
-                x.push(this);
-                seq = AST_Seq.from_array(x).transform(compressor);
-                return seq;
+        function trim_right_for_undefined() {
+            if (!compressor.option("side_effects")) return;
+            while (end > 0 && is_undefined(expressions[end], compressor)) end--;
+            if (end < expressions.length - 1) {
+                expressions[end] = make_node(AST_UnaryPrefix, self, {
+                    operator: "void",
+                    expression: expressions[end],
+                });
+                expressions.length = end + 1;
+            }
+        }
+
+        function is_simple_assign(node) {
+            return node instanceof AST_Assign
+                && node.operator == "="
+                && node.left instanceof AST_SymbolRef
+                && node.left.definition();
+        }
+
+        function merge_assignments() {
+            for (var i = 1; i < end; i++) {
+                var prev = expressions[i - 1];
+                var def = is_simple_assign(prev);
+                if (!def) continue;
+                var expr = expressions[i];
+                if (compressor.option("conditionals")) {
+                    var cond = to_conditional_assignment(compressor, def, prev.right, expr);
+                    if (cond) {
+                        prev.right = cond;
+                        expressions.splice(i--, 1);
+                        end--;
+                        continue;
+                    }
+                }
+                if (compressor.option("dead_code")
+                    && is_simple_assign(expr) === def
+                    && expr.right.is_constant_expression(def.scope.resolve())) {
+                    expressions[--i] = prev.right;
+                }
             }
         }
-        return this;
     });
 
-    OPT(AST_UnaryPostfix, function(self, compressor){
-        return self.lift_sequences(compressor);
+    OPT(AST_UnaryPostfix, function(self, compressor) {
+        if (compressor.option("sequences")) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        return try_evaluate(compressor, self);
     });
 
-    OPT(AST_UnaryPrefix, function(self, compressor){
-        self = self.lift_sequences(compressor);
-        var e = self.expression;
-        if (compressor.option("booleans") && compressor.in_boolean_context()) {
-            switch (self.operator) {
-              case "!":
-                if (e instanceof AST_UnaryPrefix && e.operator == "!") {
-                    // !!foo ==> foo, if we're in boolean context
-                    return e.expression;
+    var SIGN_OPS = makePredicate("+ -");
+    var MULTIPLICATIVE_OPS = makePredicate("* / %");
+    OPT(AST_UnaryPrefix, function(self, compressor) {
+        var op = self.operator;
+        var exp = self.expression;
+        if (compressor.option("sequences") && can_lift()) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        switch (op) {
+          case "+":
+            if (!compressor.option("evaluate")) break;
+            if (!exp.is_number(compressor, true)) break;
+            var parent = compressor.parent();
+            if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") break;
+            return exp;
+          case "-":
+            if (exp instanceof AST_Infinity) exp = exp.transform(compressor);
+            // avoids infinite recursion of numerals
+            if (exp instanceof AST_Number || exp instanceof AST_Infinity) return self;
+            break;
+          case "!":
+            if (!compressor.option("booleans")) break;
+            if (exp.is_truthy()) return make_sequence(self, [ exp, make_node(AST_False, self) ]).optimize(compressor);
+            if (compressor.in_boolean_context()) {
+                // !!foo ---> foo, if we're in boolean context
+                if (exp instanceof AST_UnaryPrefix && exp.operator == "!") return exp.expression;
+                if (exp instanceof AST_Binary) {
+                    var first = first_in_statement(compressor);
+                    self = (first ? best_of_statement : best_of_expression)(self, exp.negate(compressor, first));
                 }
-                break;
-              case "typeof":
-                // typeof always returns a non-empty string, thus it's
-                // always true in booleans
-                compressor.warn("Boolean expression always true [{file}:{line},{col}]", self.start);
-                return make_node(AST_True, self);
             }
-            if (e instanceof AST_Binary && self.operator == "!") {
-                self = best_of(self, e.negate(compressor));
+            break;
+          case "delete":
+            if (!compressor.option("evaluate")) break;
+            if (may_not_delete(exp)) break;
+            return make_sequence(self, [ exp, make_node(AST_True, self) ]).optimize(compressor);
+          case "typeof":
+            if (!compressor.option("booleans")) break;
+            if (!compressor.in_boolean_context()) break;
+            // typeof always returns a non-empty string, thus always truthy
+            AST_Node.warn("Boolean expression always true [{start}]", self);
+            var exprs = [ make_node(AST_True, self) ];
+            if (!(exp instanceof AST_SymbolRef && can_drop_symbol(exp, compressor))) exprs.unshift(exp);
+            return make_sequence(self, exprs).optimize(compressor);
+          case "void":
+            if (!compressor.option("side_effects")) break;
+            exp = exp.drop_side_effect_free(compressor);
+            if (!exp) return make_node(AST_Undefined, self).optimize(compressor);
+            self.expression = exp;
+            return self;
+        }
+        if (compressor.option("evaluate")
+            && exp instanceof AST_Binary
+            && SIGN_OPS[op]
+            && MULTIPLICATIVE_OPS[exp.operator]
+            && (exp.left.is_constant() || !exp.right.has_side_effects(compressor))) {
+            return make_node(AST_Binary, self, {
+                operator: exp.operator,
+                left: make_node(AST_UnaryPrefix, exp.left, {
+                    operator: op,
+                    expression: exp.left,
+                }),
+                right: exp.right,
+            });
+        }
+        return try_evaluate(compressor, self);
+
+        function may_not_delete(node) {
+            return node instanceof AST_Infinity
+                || node instanceof AST_NaN
+                || node instanceof AST_NewTarget
+                || node instanceof AST_PropAccess
+                || node instanceof AST_SymbolRef
+                || node instanceof AST_Undefined;
+        }
+
+        function can_lift() {
+            switch (op) {
+              case "delete":
+                return !may_not_delete(exp.tail_node());
+              case "typeof":
+                return !is_undeclared_ref(exp.tail_node());
+              default:
+                return true;
             }
         }
-        return self.evaluate(compressor)[0];
     });
 
-    function has_side_effects_or_prop_access(node, compressor) {
-        var save_pure_getters = compressor.option("pure_getters");
-        compressor.options.pure_getters = false;
-        var ret = node.has_side_effects(compressor);
-        compressor.options.pure_getters = save_pure_getters;
-        return ret;
-    }
+    OPT(AST_Await, function(self, compressor) {
+        if (!compressor.option("awaits")) return self;
+        if (compressor.option("sequences")) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (compressor.option("side_effects")) {
+            var exp = self.expression;
+            if (exp instanceof AST_Await) return exp.optimize(compressor);
+            if (exp instanceof AST_UnaryPrefix && exp.expression instanceof AST_Await) return exp.optimize(compressor);
+            for (var level = 0, node = self, parent; parent = compressor.parent(level++); node = parent) {
+                if (is_arrow(parent)) {
+                    if (parent.value === node) return exp.optimize(compressor);
+                } else if (parent instanceof AST_Return) {
+                    var drop = true;
+                    do {
+                        node = parent;
+                        parent = compressor.parent(level++);
+                        if (parent instanceof AST_Try && (parent.bfinally || parent.bcatch) !== node) {
+                            drop = false;
+                            break;
+                        }
+                    } while (parent && !(parent instanceof AST_Scope));
+                    if (drop) return exp.optimize(compressor);
+                } else if (parent instanceof AST_Sequence) {
+                    if (parent.tail_node() === node) continue;
+                }
+                break;
+            }
+        }
+        return self;
+    });
 
-    AST_Binary.DEFMETHOD("lift_sequences", function(compressor){
+    OPT(AST_Yield, function(self, compressor) {
+        if (!compressor.option("yields")) return self;
         if (compressor.option("sequences")) {
-            if (this.left instanceof AST_Seq) {
-                var seq = this.left;
-                var x = seq.to_array();
-                this.left = x.pop();
-                x.push(this);
-                seq = AST_Seq.from_array(x).transform(compressor);
-                return seq;
-            }
-            if (this.right instanceof AST_Seq
-                && this instanceof AST_Assign
-                && !has_side_effects_or_prop_access(this.left, compressor)) {
-                var seq = this.right;
-                var x = seq.to_array();
-                this.right = x.pop();
-                x.push(this);
-                seq = AST_Seq.from_array(x).transform(compressor);
-                return seq;
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        var exp = self.expression;
+        if (self.nested && exp.TYPE == "Call") {
+            var inlined = exp.clone().optimize(compressor);
+            if (inlined.TYPE != "Call") return inlined;
+        }
+        return self;
+    });
+
+    AST_Binary.DEFMETHOD("lift_sequences", function(compressor) {
+        if (this.left instanceof AST_PropAccess) {
+            if (!(this.left.expression instanceof AST_Sequence)) return this;
+            var x = this.left.expression.expressions.slice();
+            var e = this.clone();
+            e.left = e.left.clone();
+            e.left.expression = x.pop();
+            x.push(e);
+            return make_sequence(this, x);
+        }
+        if (this.left instanceof AST_Sequence) {
+            var x = this.left.expressions.slice();
+            var e = this.clone();
+            e.left = x.pop();
+            x.push(e);
+            return make_sequence(this, x);
+        }
+        if (this.right instanceof AST_Sequence) {
+            if (this.left.has_side_effects(compressor)) return this;
+            var assign = this.operator == "=" && this.left instanceof AST_SymbolRef;
+            var x = this.right.expressions;
+            var last = x.length - 1;
+            for (var i = 0; i < last; i++) {
+                if (!assign && x[i].has_side_effects(compressor)) break;
+            }
+            if (i == last) {
+                x = x.slice();
+                var e = this.clone();
+                e.right = x.pop();
+                x.push(e);
+                return make_sequence(this, x);
+            }
+            if (i > 0) {
+                var e = this.clone();
+                e.right = make_sequence(this.right, x.slice(i));
+                x = x.slice(0, i);
+                x.push(e);
+                return make_sequence(this, x);
             }
         }
         return this;
     });
 
+    var indexFns = makePredicate("indexOf lastIndexOf");
     var commutativeOperators = makePredicate("== === != !== * & | ^");
+    function is_object(node, plain) {
+        if (node instanceof AST_Assign) return !plain && node.operator == "=" && is_object(node.right);
+        if (node instanceof AST_New) return !plain;
+        if (node instanceof AST_Sequence) return is_object(node.tail_node(), plain);
+        if (node instanceof AST_SymbolRef) return !plain && is_object(node.fixed_value());
+        return node instanceof AST_Array
+            || node instanceof AST_Class
+            || node instanceof AST_Lambda
+            || node instanceof AST_Object;
+    }
 
-    OPT(AST_Binary, function(self, compressor){
-        var reverse = compressor.has_directive("use asm") ? noop
-            : function(op, force) {
-                if (force || !(self.left.has_side_effects(compressor) || self.right.has_side_effects(compressor))) {
-                    if (op) self.operator = op;
-                    var tmp = self.left;
-                    self.left = self.right;
-                    self.right = tmp;
-                }
-            };
-        if (commutativeOperators(self.operator)) {
-            if (self.right instanceof AST_Constant
-                && !(self.left instanceof AST_Constant)) {
-                // if right is a constant, whatever side effects the
-                // left side might have could not influence the
-                // result.  hence, force switch.
+    function can_drop_op(op, rhs, compressor) {
+        switch (op) {
+          case "in":
+            return is_object(rhs) || compressor && compressor.option("unsafe_comps");
+          case "instanceof":
+            if (rhs instanceof AST_SymbolRef) rhs = rhs.fixed_value();
+            return is_lambda(rhs) || compressor && compressor.option("unsafe_comps");
+          default:
+            return true;
+        }
+    }
 
-                if (!(self.left instanceof AST_Binary
-                      && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) {
-                    reverse(null, true);
-                }
-            }
-            if (/^[!=]==?$/.test(self.operator)) {
-                if (self.left instanceof AST_SymbolRef && self.right instanceof AST_Conditional) {
-                    if (self.right.consequent instanceof AST_SymbolRef
-                        && self.right.consequent.definition() === self.left.definition()) {
-                        if (/^==/.test(self.operator)) return self.right.condition;
-                        if (/^!=/.test(self.operator)) return self.right.condition.negate(compressor);
-                    }
-                    if (self.right.alternative instanceof AST_SymbolRef
-                        && self.right.alternative.definition() === self.left.definition()) {
-                        if (/^==/.test(self.operator)) return self.right.condition.negate(compressor);
-                        if (/^!=/.test(self.operator)) return self.right.condition;
-                    }
-                }
-                if (self.right instanceof AST_SymbolRef && self.left instanceof AST_Conditional) {
-                    if (self.left.consequent instanceof AST_SymbolRef
-                        && self.left.consequent.definition() === self.right.definition()) {
-                        if (/^==/.test(self.operator)) return self.left.condition;
-                        if (/^!=/.test(self.operator)) return self.left.condition.negate(compressor);
-                    }
-                    if (self.left.alternative instanceof AST_SymbolRef
-                        && self.left.alternative.definition() === self.right.definition()) {
-                        if (/^==/.test(self.operator)) return self.left.condition.negate(compressor);
-                        if (/^!=/.test(self.operator)) return self.left.condition;
-                    }
-                }
+    function needs_enqueuing(compressor, node) {
+        if (node.is_constant()) return true;
+        if (node instanceof AST_Assign) return node.operator != "=" || needs_enqueuing(compressor, node.right);
+        if (node instanceof AST_Binary) {
+            return !lazy_op[node.operator]
+                || needs_enqueuing(compressor, node.left) && needs_enqueuing(compressor, node.right);
+        }
+        if (node instanceof AST_Call) return is_async(node.expression);
+        if (node instanceof AST_Conditional) {
+            return needs_enqueuing(compressor, node.consequent) && needs_enqueuing(compressor, node.alternative);
+        }
+        if (node instanceof AST_Sequence) return needs_enqueuing(compressor, node.tail_node());
+        if (node instanceof AST_SymbolRef) {
+            var fixed = node.fixed_value();
+            return fixed && needs_enqueuing(compressor, fixed);
+        }
+        if (node instanceof AST_Template) return !node.tag || is_raw_tag(compressor, node.tag);
+        if (node instanceof AST_Unary) return true;
+    }
+
+    function extract_lhs(node, compressor) {
+        if (node instanceof AST_Assign) return is_lhs_read_only(node.left, compressor) ? node : node.left;
+        if (node instanceof AST_Sequence) return extract_lhs(node.tail_node(), compressor);
+        if (node instanceof AST_UnaryPrefix && UNARY_POSTFIX[node.operator]) {
+            return is_lhs_read_only(node.expression, compressor) ? node : node.expression;
+        }
+        return node;
+    }
+
+    function repeatable(compressor, node) {
+        if (node instanceof AST_Dot) return repeatable(compressor, node.expression);
+        if (node instanceof AST_Sub) {
+            return repeatable(compressor, node.expression) && repeatable(compressor, node.property);
+        }
+        if (node instanceof AST_Symbol) return true;
+        return !node.has_side_effects(compressor);
+    }
+
+    function swap_chain(self, compressor) {
+        var rhs = self.right.tail_node();
+        if (rhs !== self.right) {
+            var exprs = self.right.expressions.slice(0, -1);
+            exprs.push(rhs.left);
+            rhs = rhs.clone();
+            rhs.left = make_sequence(self.right, exprs);
+            self.right = rhs;
+        }
+        self.left = make_node(AST_Binary, self, {
+            operator: self.operator,
+            left: self.left,
+            right: rhs.left,
+            start: self.left.start,
+            end: rhs.left.end,
+        });
+        self.right = rhs.right;
+        if (compressor) {
+            self.left = self.left.transform(compressor);
+        } else if (self.operator == rhs.left.operator) {
+            swap_chain(self.left);
+        }
+    }
+
+    OPT(AST_Binary, function(self, compressor) {
+        if (commutativeOperators[self.operator]
+            && self.right.is_constant()
+            && !self.left.is_constant()
+            && !(self.left instanceof AST_Binary
+                && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) {
+            // if right is a constant, whatever side effects the
+            // left side might have could not influence the
+            // result.  hence, force switch.
+            reverse();
+        }
+        if (compressor.option("sequences")) {
+            var seq = self.lift_sequences(compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (compressor.option("assignments") && lazy_op[self.operator]) {
+            var lhs = extract_lhs(self.left, compressor);
+            var right = self.right;
+            // a || (a = x) ---> a = a || x
+            // (a = x) && (a = y) ---> a = (a = x) && y
+            if (lhs instanceof AST_SymbolRef
+                && right instanceof AST_Assign
+                && right.operator == "="
+                && lhs.equals(right.left)) {
+                lhs = lhs.clone();
+                var assign = make_node(AST_Assign, self, {
+                    operator: "=",
+                    left: lhs,
+                    right: make_node(AST_Binary, self, {
+                        operator: self.operator,
+                        left: self.left,
+                        right: right.right,
+                    }),
+                });
+                if (lhs.fixed) {
+                    lhs.fixed = function() {
+                        return assign.right;
+                    };
+                    lhs.fixed.assigns = [ assign ];
+                }
+                var def = lhs.definition();
+                def.references.push(lhs);
+                def.replaced++;
+                return assign.optimize(compressor);
             }
         }
-        self = self.lift_sequences(compressor);
         if (compressor.option("comparisons")) switch (self.operator) {
           case "===":
           case "!==":
+            if (is_undefined(self.left, compressor) && self.right.is_defined(compressor)) {
+                AST_Node.warn("Expression always defined [{start}]", self);
+                return make_sequence(self, [
+                    self.right,
+                    make_node(self.operator == "===" ? AST_False : AST_True, self),
+                ]).optimize(compressor);
+            }
+            var is_strict_comparison = true;
             if ((self.left.is_string(compressor) && self.right.is_string(compressor)) ||
-                (self.left.is_boolean() && self.right.is_boolean())) {
-                self.operator = self.operator.substr(0, 2);
+                (self.left.is_number(compressor) && self.right.is_number(compressor)) ||
+                (self.left.is_boolean(compressor) && self.right.is_boolean(compressor)) ||
+                repeatable(compressor, self.left) && self.left.equals(self.right)) {
+                self.operator = self.operator.slice(0, 2);
             }
             // XXX: intentionally falling down to the next case
           case "==":
           case "!=":
-            if (self.left instanceof AST_String
+            // void 0 == x ---> null == x
+            if (!is_strict_comparison && is_undefined(self.left, compressor)) {
+                self.left = make_node(AST_Null, self.left);
+            }
+            // "undefined" == typeof x ---> undefined === x
+            else if (compressor.option("typeofs")
+                && self.left instanceof AST_String
                 && self.left.value == "undefined"
                 && self.right instanceof AST_UnaryPrefix
-                && self.right.operator == "typeof"
-                && compressor.option("unsafe")) {
-                if (!(self.right.expression instanceof AST_SymbolRef)
-                    || !self.right.expression.undeclared()) {
-                    self.right = self.right.expression;
+                && self.right.operator == "typeof") {
+                var expr = self.right.expression;
+                if (expr instanceof AST_SymbolRef ? expr.is_declared(compressor)
+                    : !(expr instanceof AST_PropAccess && compressor.option("ie"))) {
+                    self.right = expr;
                     self.left = make_node(AST_Undefined, self.left).optimize(compressor);
                     if (self.operator.length == 2) self.operator += "=";
                 }
             }
+            // obj !== obj ---> false
+            else if (self.left instanceof AST_SymbolRef
+                && self.right instanceof AST_SymbolRef
+                && self.left.definition() === self.right.definition()
+                && is_object(self.left)) {
+                return make_node(self.operator[0] == "=" ? AST_True : AST_False, self).optimize(compressor);
+            }
             break;
-        }
-        if (compressor.option("conditionals")) {
-            if (self.operator == "&&") {
-                var ll = self.left.evaluate(compressor);
-                var rr = self.right.evaluate(compressor);
-                if (ll.length > 1) {
-                    if (ll[1]) {
-                        compressor.warn("Condition left of && always true [{file}:{line},{col}]", self.start);
-                        return rr[0];
-                    } else {
-                        compressor.warn("Condition left of && always false [{file}:{line},{col}]", self.start);
-                        return ll[0];
-                    }
-                }
+          case "&&":
+          case "||":
+            // void 0 !== x && null !== x ---> null != x
+            // void 0 === x || null === x ---> null == x
+            var left = self.left;
+            if (!(left instanceof AST_Binary)) break;
+            if (left.operator != (self.operator == "&&" ? "!==" : "===")) break;
+            if (!(self.right instanceof AST_Binary)) break;
+            if (left.operator != self.right.operator) break;
+            if (is_undefined(left.left, compressor) && self.right.left instanceof AST_Null
+                || left.left instanceof AST_Null && is_undefined(self.right.left, compressor)) {
+                var expr = left.right;
+                if (expr instanceof AST_Assign && expr.operator == "=") expr = expr.left;
+                if (expr.has_side_effects(compressor)) break;
+                if (!expr.equals(self.right.right)) break;
+                left.operator = left.operator.slice(0, -1);
+                left.left = make_node(AST_Null, self);
+                return left;
             }
-            else if (self.operator == "||") {
-                var ll = self.left.evaluate(compressor);
-                var rr = self.right.evaluate(compressor);
-                if (ll.length > 1) {
-                    if (ll[1]) {
-                        compressor.warn("Condition left of || always true [{file}:{line},{col}]", self.start);
-                        return ll[0];
-                    } else {
-                        compressor.warn("Condition left of || always false [{file}:{line},{col}]", self.start);
-                        return rr[0];
-                    }
+            break;
+        }
+        var in_bool = false;
+        var parent = compressor.parent();
+        if (compressor.option("booleans")) {
+            var lhs = extract_lhs(self.left, compressor);
+            if (lazy_op[self.operator] && !lhs.has_side_effects(compressor)) {
+                // a || a ---> a
+                // (a = x) && a --> a = x
+                if (lhs.equals(self.right)) {
+                    return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor);
                 }
+                mark_duplicate_condition(compressor, lhs);
             }
+            in_bool = compressor.in_boolean_context();
         }
-        if (compressor.option("booleans") && compressor.in_boolean_context()) switch (self.operator) {
-          case "&&":
-            var ll = self.left.evaluate(compressor);
-            var rr = self.right.evaluate(compressor);
-            if ((ll.length > 1 && !ll[1]) || (rr.length > 1 && !rr[1])) {
-                compressor.warn("Boolean && always false [{file}:{line},{col}]", self.start);
-                if (self.left.has_side_effects(compressor)) {
-                    return make_node(AST_Seq, self, {
-                        car: self.left,
-                        cdr: make_node(AST_False)
-                    }).optimize(compressor);
+        if (in_bool) switch (self.operator) {
+          case "+":
+            var ev = self.left.evaluate(compressor, true);
+            if (ev && typeof ev == "string" || (ev = self.right.evaluate(compressor, true)) && typeof ev == "string") {
+                AST_Node.warn("+ in boolean context always true [{start}]", self);
+                var exprs = [];
+                if (self.left.evaluate(compressor) instanceof AST_Node) exprs.push(self.left);
+                if (self.right.evaluate(compressor) instanceof AST_Node) exprs.push(self.right);
+                if (exprs.length < 2) {
+                    exprs.push(make_node(AST_True, self));
+                    return make_sequence(self, exprs).optimize(compressor);
                 }
-                return make_node(AST_False, self);
-            }
-            if (ll.length > 1 && ll[1]) {
-                return rr[0];
-            }
-            if (rr.length > 1 && rr[1]) {
-                return ll[0];
+                self.truthy = true;
             }
             break;
-          case "||":
-            var ll = self.left.evaluate(compressor);
-            var rr = self.right.evaluate(compressor);
-            if ((ll.length > 1 && ll[1]) || (rr.length > 1 && rr[1])) {
-                compressor.warn("Boolean || always true [{file}:{line},{col}]", self.start);
-                if (self.left.has_side_effects(compressor)) {
-                    return make_node(AST_Seq, self, {
-                        car: self.left,
-                        cdr: make_node(AST_True)
-                    }).optimize(compressor);
-                }
-                return make_node(AST_True, self);
-            }
-            if (ll.length > 1 && !ll[1]) {
-                return rr[0];
-            }
-            if (rr.length > 1 && !rr[1]) {
-                return ll[0];
+          case "==":
+            if (self.left instanceof AST_String && self.left.value == "" && self.right.is_string(compressor)) {
+                return make_node(AST_UnaryPrefix, self, {
+                    operator: "!",
+                    expression: self.right,
+                }).optimize(compressor);
             }
             break;
-          case "+":
-            var ll = self.left.evaluate(compressor);
-            var rr = self.right.evaluate(compressor);
-            if ((ll.length > 1 && ll[0] instanceof AST_String && ll[1]) ||
-                (rr.length > 1 && rr[0] instanceof AST_String && rr[1])) {
-                compressor.warn("+ in boolean context always true [{file}:{line},{col}]", self.start);
-                return make_node(AST_True, self);
+          case "!=":
+            if (self.left instanceof AST_String && self.left.value == "" && self.right.is_string(compressor)) {
+                return self.right.optimize(compressor);
             }
             break;
         }
-        if (compressor.option("comparisons") && self.is_boolean()) {
-            if (!(compressor.parent() instanceof AST_Binary)
-                || compressor.parent() instanceof AST_Assign) {
+        if (compressor.option("comparisons") && self.is_boolean(compressor)) {
+            if (parent.TYPE != "Binary") {
                 var negated = make_node(AST_UnaryPrefix, self, {
                     operator: "!",
-                    expression: self.negate(compressor)
+                    expression: self.negate(compressor),
                 });
-                self = best_of(self, negated);
+                if (best_of(compressor, self, negated) === negated) return negated;
             }
             switch (self.operator) {
-              case "<": reverse(">"); break;
-              case "<=": reverse(">="); break;
+              case ">": reverse("<"); break;
+              case ">=": reverse("<="); break;
             }
         }
-        if (self.operator == "+" && self.right instanceof AST_String
-            && self.right.getValue() === "" && self.left instanceof AST_Binary
-            && self.left.operator == "+" && self.left.is_string(compressor)) {
-            return self.left;
+        if (compressor.option("conditionals") && lazy_op[self.operator]) {
+            if (self.left instanceof AST_Binary && self.operator == self.left.operator) {
+                var before = make_node(AST_Binary, self, {
+                    operator: self.operator,
+                    left: self.left.right,
+                    right: self.right,
+                });
+                var after = before.transform(compressor);
+                if (before !== after) {
+                    self.left = self.left.left;
+                    self.right = after;
+                }
+            }
+            // x && (y && z) ---> x && y && z
+            // w || (x, y || z) ---> w || (x, y) || z
+            var rhs = self.right.tail_node();
+            if (rhs instanceof AST_Binary && self.operator == rhs.operator) swap_chain(self, compressor);
+        }
+        if (compressor.option("strings") && self.operator == "+") {
+            // "foo" + 42 + "" ---> "foo" + 42
+            if (self.right instanceof AST_String
+                && self.right.value == ""
+                && self.left.is_string(compressor)) {
+                return self.left.optimize(compressor);
+            }
+            // "" + ("foo" + 42) ---> "foo" + 42
+            if (self.left instanceof AST_String
+                && self.left.value == ""
+                && self.right.is_string(compressor)) {
+                return self.right.optimize(compressor);
+            }
+            // "" + 42 + "foo" ---> 42 + "foo"
+            if (self.left instanceof AST_Binary
+                && self.left.operator == "+"
+                && self.left.left instanceof AST_String
+                && self.left.left.value == ""
+                && self.right.is_string(compressor)
+                && (self.left.right.is_constant() || !self.right.has_side_effects(compressor))) {
+                self.left = self.left.right;
+                return self.optimize(compressor);
+            }
+            // "x" + (y + "z") ---> "x" + y + "z"
+            // w + (x, "y" + z) ---> w + (x, "y") + z
+            var rhs = self.right.tail_node();
+            if (rhs instanceof AST_Binary
+                && self.operator == rhs.operator
+                && (self.left.is_string(compressor) && rhs.is_string(compressor)
+                    || rhs.left.is_string(compressor)
+                        && (self.left.is_constant() || !rhs.right.has_side_effects(compressor)))) {
+                swap_chain(self, compressor);
+            }
         }
         if (compressor.option("evaluate")) {
-            if (self.operator == "+") {
+            var associative = true;
+            switch (self.operator) {
+              case "&&":
+                var ll = fuzzy_eval(compressor, self.left);
+                if (!ll) {
+                    AST_Node.warn("Condition left of && always false [{start}]", self);
+                    return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor);
+                } else if (!(ll instanceof AST_Node)) {
+                    AST_Node.warn("Condition left of && always true [{start}]", self);
+                    return make_sequence(self, [ self.left, self.right ]).optimize(compressor);
+                }
+                if (!self.right.evaluate(compressor, true)) {
+                    if (in_bool && !(self.right.evaluate(compressor) instanceof AST_Node)) {
+                        AST_Node.warn("Boolean && always false [{start}]", self);
+                        return make_sequence(self, [ self.left, make_node(AST_False, self) ]).optimize(compressor);
+                    } else self.falsy = true;
+                } else if ((in_bool || parent.operator == "&&" && parent.left === compressor.self())
+                    && !(self.right.evaluate(compressor) instanceof AST_Node)) {
+                    AST_Node.warn("Dropping side-effect-free && [{start}]", self);
+                    return self.left.optimize(compressor);
+                }
+                // (x || false) && y ---> x ? y : false
+                if (self.left.operator == "||") {
+                    var lr = fuzzy_eval(compressor, self.left.right);
+                    if (!lr) return make_node(AST_Conditional, self, {
+                        condition: self.left.left,
+                        consequent: self.right,
+                        alternative: self.left.right,
+                    }).optimize(compressor);
+                }
+                break;
+              case "??":
+                var nullish = true;
+              case "||":
+                var ll = fuzzy_eval(compressor, self.left, nullish);
+                if (nullish ? ll == null : !ll) {
+                    AST_Node.warn("Condition left of {operator} always {value} [{start}]", {
+                        operator: self.operator,
+                        value: nullish ? "nullish" : "false",
+                        start: self.start,
+                    });
+                    return make_sequence(self, [ self.left, self.right ]).optimize(compressor);
+                } else if (!(ll instanceof AST_Node)) {
+                    AST_Node.warn("Condition left of {operator} always {value} [{start}]", {
+                        operator: self.operator,
+                        value: nullish ? "defined" : "true",
+                        start: self.start,
+                    });
+                    return maintain_this_binding(parent, compressor.self(), self.left).optimize(compressor);
+                }
+                var rr;
+                if (!nullish && (rr = self.right.evaluate(compressor, true)) && !(rr instanceof AST_Node)) {
+                    if (in_bool && !(self.right.evaluate(compressor) instanceof AST_Node)) {
+                        AST_Node.warn("Boolean || always true [{start}]", self);
+                        return make_sequence(self, [ self.left, make_node(AST_True, self) ]).optimize(compressor);
+                    } else self.truthy = true;
+                } else if ((in_bool || parent.operator == "||" && parent.left === compressor.self())
+                    && !self.right.evaluate(compressor)) {
+                    AST_Node.warn("Dropping side-effect-free {operator} [{start}]", self);
+                    return self.left.optimize(compressor);
+                }
+                // x && true || y ---> x ? true : y
+                if (!nullish && self.left.operator == "&&") {
+                    var lr = fuzzy_eval(compressor, self.left.right);
+                    if (lr && !(lr instanceof AST_Node)) return make_node(AST_Conditional, self, {
+                        condition: self.left.left,
+                        consequent: self.left.right,
+                        alternative: self.right,
+                    }).optimize(compressor);
+                }
+                break;
+              case "+":
+                // "foo" + ("bar" + x) ---> "foobar" + x
                 if (self.left instanceof AST_Constant
                     && self.right instanceof AST_Binary
                     && self.right.operator == "+"
@@ -2211,14 +11942,15 @@
                     && self.right.is_string(compressor)) {
                     self = make_node(AST_Binary, self, {
                         operator: "+",
-                        left: make_node(AST_String, null, {
-                            value: "" + self.left.getValue() + self.right.left.getValue(),
+                        left: make_node(AST_String, self.left, {
+                            value: "" + self.left.value + self.right.left.value,
                             start: self.left.start,
-                            end: self.right.left.end
+                            end: self.right.left.end,
                         }),
-                        right: self.right.right
+                        right: self.right.right,
                     });
                 }
+                // (x + "foo") + "bar" ---> x + "foobar"
                 if (self.right instanceof AST_Constant
                     && self.left instanceof AST_Binary
                     && self.left.operator == "+"
@@ -2227,289 +11959,2283 @@
                     self = make_node(AST_Binary, self, {
                         operator: "+",
                         left: self.left.left,
-                        right: make_node(AST_String, null, {
-                            value: "" + self.left.right.getValue() + self.right.getValue(),
+                        right: make_node(AST_String, self.right, {
+                            value: "" + self.left.right.value + self.right.value,
                             start: self.left.right.start,
-                            end: self.right.end
-                        })
+                            end: self.right.end,
+                        }),
                     });
                 }
-                if (self.left instanceof AST_Binary
-                    && self.left.operator == "+"
-                    && self.left.is_string(compressor)
-                    && self.left.right instanceof AST_Constant
-                    && self.right instanceof AST_Binary
-                    && self.right.operator == "+"
-                    && self.right.left instanceof AST_Constant
-                    && self.right.is_string(compressor)) {
+                // a + -b ---> a - b
+                if (self.right instanceof AST_UnaryPrefix
+                    && self.right.operator == "-"
+                    && self.left.is_number(compressor)) {
+                    self = make_node(AST_Binary, self, {
+                        operator: "-",
+                        left: self.left,
+                        right: self.right.expression,
+                    });
+                    break;
+                }
+                // -a + b ---> b - a
+                if (self.left instanceof AST_UnaryPrefix
+                    && self.left.operator == "-"
+                    && reversible()
+                    && self.right.is_number(compressor)) {
+                    self = make_node(AST_Binary, self, {
+                        operator: "-",
+                        left: self.right,
+                        right: self.left.expression,
+                    });
+                    break;
+                }
+                // (a + b) + 3 ---> 3 + (a + b)
+                if (compressor.option("unsafe_math")
+                    && self.left instanceof AST_Binary
+                    && PRECEDENCE[self.left.operator] == PRECEDENCE[self.operator]
+                    && self.right.is_constant()
+                    && (self.right.is_boolean(compressor) || self.right.is_number(compressor))
+                    && self.left.is_number(compressor)
+                    && !self.left.right.is_constant()
+                    && (self.left.left.is_boolean(compressor) || self.left.left.is_number(compressor))) {
+                    self = make_node(AST_Binary, self, {
+                        operator: self.left.operator,
+                        left: make_node(AST_Binary, self, {
+                            operator: self.operator,
+                            left: self.right,
+                            right: self.left.left,
+                        }),
+                        right: self.left.right,
+                    });
+                    break;
+                }
+              case "-":
+                // a - -b ---> a + b
+                if (self.right instanceof AST_UnaryPrefix
+                    && self.right.operator == "-"
+                    && self.left.is_number(compressor)
+                    && self.right.expression.is_number(compressor)) {
                     self = make_node(AST_Binary, self, {
                         operator: "+",
+                        left: self.left,
+                        right: self.right.expression,
+                    });
+                    break;
+                }
+              case "*":
+              case "/":
+                associative = compressor.option("unsafe_math");
+                // +a - b ---> a - b
+                // a - +b ---> a - b
+                if (self.operator != "+") [ "left", "right" ].forEach(function(operand) {
+                    var node = self[operand];
+                    if (node instanceof AST_UnaryPrefix && node.operator == "+") {
+                        var exp = node.expression;
+                        if (exp.is_boolean(compressor) || exp.is_number(compressor) || exp.is_string(compressor)) {
+                            self[operand] = exp;
+                        }
+                    }
+                });
+              case "&":
+              case "|":
+              case "^":
+                // a + +b ---> +b + a
+                if (self.operator != "-"
+                    && self.operator != "/"
+                    && (self.left.is_boolean(compressor) || self.left.is_number(compressor))
+                    && (self.right.is_boolean(compressor) || self.right.is_number(compressor))
+                    && reversible()
+                    && !(self.left instanceof AST_Binary
+                        && self.left.operator != self.operator
+                        && PRECEDENCE[self.left.operator] >= PRECEDENCE[self.operator])) {
+                    self = best_of(compressor, self, make_node(AST_Binary, self, {
+                        operator: self.operator,
+                        left: self.right,
+                        right: self.left,
+                    }), self.right instanceof AST_Constant && !(self.left instanceof AST_Constant));
+                }
+                if (!associative || !self.is_number(compressor)) break;
+                // a + (b + c) ---> (a + b) + c
+                if (self.right instanceof AST_Binary
+                    && self.right.operator != "%"
+                    && PRECEDENCE[self.right.operator] == PRECEDENCE[self.operator]
+                    && self.right.is_number(compressor)
+                    && (self.operator != "+"
+                        || self.right.left.is_boolean(compressor)
+                        || self.right.left.is_number(compressor))
+                    && (self.operator != "-" || !self.left.is_negative_zero())
+                    && (self.right.left.is_constant_expression()
+                        || !self.right.right.has_side_effects(compressor))
+                    && !is_modify_array(self.right.right)) {
+                    self = make_node(AST_Binary, self, {
+                        operator: align(self.operator, self.right.operator),
                         left: make_node(AST_Binary, self.left, {
-                            operator: "+",
-                            left: self.left.left,
-                            right: make_node(AST_String, null, {
-                                value: "" + self.left.right.getValue() + self.right.left.getValue(),
-                                start: self.left.right.start,
-                                end: self.right.left.end
-                            })
+                            operator: self.operator,
+                            left: self.left,
+                            right: self.right.left,
+                            start: self.left.start,
+                            end: self.right.left.end,
                         }),
-                        right: self.right.right
+                        right: self.right.right,
+                    });
+                    if (self.operator == "+"
+                        && !self.right.is_boolean(compressor)
+                        && !self.right.is_number(compressor)) {
+                        self.right = make_node(AST_UnaryPrefix, self.right, {
+                            operator: "+",
+                            expression: self.right,
+                        });
+                    }
+                }
+                // (2 * n) * 3 ---> 6 * n
+                // (n + 2) + 3 ---> n + 5
+                if (self.right instanceof AST_Constant
+                    && self.left instanceof AST_Binary
+                    && self.left.operator != "%"
+                    && PRECEDENCE[self.left.operator] == PRECEDENCE[self.operator]
+                    && self.left.is_number(compressor)) {
+                    if (self.left.left instanceof AST_Constant) {
+                        var lhs = make_binary(self.operator, self.left.left, self.right, {
+                            start: self.left.left.start,
+                            end: self.right.end,
+                        });
+                        self = make_binary(self.left.operator, try_evaluate(compressor, lhs), self.left.right, self);
+                    } else if (self.left.right instanceof AST_Constant) {
+                        var op = align(self.left.operator, self.operator);
+                        var rhs = try_evaluate(compressor, make_binary(op, self.left.right, self.right, self.left));
+                        if (rhs.is_constant()
+                            && !(self.left.operator == "-"
+                                && self.right.value != 0
+                                && +rhs.value == 0
+                                && self.left.left.is_negative_zero())) {
+                            self = make_binary(self.left.operator, self.left.left, rhs, self);
+                        }
+                    }
+                }
+                break;
+              case "instanceof":
+                if (is_lambda(self.right)) return make_sequence(self, [
+                    self,
+                    make_node(AST_False, self),
+                ]).optimize(compressor);
+                break;
+            }
+            if (!(parent instanceof AST_UnaryPrefix && parent.operator == "delete")) {
+                if (self.left instanceof AST_Number && !self.right.is_constant()) switch (self.operator) {
+                  // 0 + n ---> n
+                  case "+":
+                    if (self.left.value == 0) {
+                        if (self.right.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, {
+                            operator: "+",
+                            expression: self.right,
+                        }).optimize(compressor);
+                        if (self.right.is_number(compressor) && !self.right.is_negative_zero()) return self.right;
+                    }
+                    break;
+                  // 1 * n ---> n
+                  case "*":
+                    if (self.left.value == 1) return make_node(AST_UnaryPrefix, self, {
+                        operator: "+",
+                        expression: self.right,
+                    }).optimize(compressor);
+                    break;
+                }
+                if (self.right instanceof AST_Number && !self.left.is_constant()) switch (self.operator) {
+                  // n + 0 ---> n
+                  case "+":
+                    if (self.right.value == 0) {
+                        if (self.left.is_boolean(compressor)) return make_node(AST_UnaryPrefix, self, {
+                            operator: "+",
+                            expression: self.left,
+                        }).optimize(compressor);
+                        if (self.left.is_number(compressor) && !self.left.is_negative_zero()) return self.left;
+                    }
+                    break;
+                  // n - 0 ---> n
+                  case "-":
+                    if (self.right.value == 0) return make_node(AST_UnaryPrefix, self, {
+                        operator: "+",
+                        expression: self.left,
+                    }).optimize(compressor);
+                    break;
+                  // n / 1 ---> n
+                  case "/":
+                    if (self.right.value == 1) return make_node(AST_UnaryPrefix, self, {
+                        operator: "+",
+                        expression: self.left,
+                    }).optimize(compressor);
+                    break;
+                }
+            }
+        }
+        if (compressor.option("typeofs")) switch (self.operator) {
+          case "&&":
+            mark_locally_defined(self.left, self.right, null);
+            break;
+          case "||":
+            mark_locally_defined(self.left, null, self.right);
+            break;
+        }
+        if (compressor.option("unsafe")) {
+            var indexRight = is_indexFn(self.right);
+            if (in_bool
+                && indexRight
+                && (self.operator == "==" || self.operator == "!=")
+                && self.left instanceof AST_Number
+                && self.left.value == 0) {
+                return (self.operator == "==" ? make_node(AST_UnaryPrefix, self, {
+                    operator: "!",
+                    expression: self.right,
+                }) : self.right).optimize(compressor);
+            }
+            var indexLeft = is_indexFn(self.left);
+            if (compressor.option("comparisons") && is_indexOf_match_pattern()) {
+                var node = make_node(AST_UnaryPrefix, self, {
+                    operator: "!",
+                    expression: make_node(AST_UnaryPrefix, self, {
+                        operator: "~",
+                        expression: indexLeft ? self.left : self.right,
+                    }),
+                });
+                switch (self.operator) {
+                  case "<":
+                    if (indexLeft) break;
+                  case "<=":
+                  case "!=":
+                    node = make_node(AST_UnaryPrefix, self, {
+                        operator: "!",
+                        expression: node,
                     });
+                    break;
+                }
+                return node.optimize(compressor);
+            }
+        }
+        return try_evaluate(compressor, self);
+
+        function is_modify_array(node) {
+            var found = false;
+            node.walk(new TreeWalker(function(node) {
+                if (found) return true;
+                if (node instanceof AST_Assign) {
+                    if (node.left instanceof AST_PropAccess) return found = true;
+                } else if (node instanceof AST_Unary) {
+                    if (unary_side_effects[node.operator] && node.expression instanceof AST_PropAccess) {
+                        return found = true;
+                    }
                 }
+            }));
+            return found;
+        }
+
+        function align(ref, op) {
+            switch (ref) {
+              case "-":
+                return op == "+" ? "-" : "+";
+              case "/":
+                return op == "*" ? "/" : "*";
+              default:
+                return op;
             }
         }
-        // x && (y && z)  ==>  x && y && z
-        // x || (y || z)  ==>  x || y || z
-        if (self.right instanceof AST_Binary
-            && self.right.operator == self.operator
-            && (self.operator == "&&" || self.operator == "||"))
-        {
-            self.left = make_node(AST_Binary, self.left, {
-                operator : self.operator,
-                left     : self.left,
-                right    : self.right.left
+
+        function make_binary(op, left, right, orig) {
+            if (op == "+") {
+                if (!left.is_boolean(compressor) && !left.is_number(compressor)) {
+                    left = make_node(AST_UnaryPrefix, left, {
+                        operator: "+",
+                        expression: left,
+                    });
+                }
+                if (!right.is_boolean(compressor) && !right.is_number(compressor)) {
+                    right = make_node(AST_UnaryPrefix, right, {
+                        operator: "+",
+                        expression: right,
+                    });
+                }
+            }
+            return make_node(AST_Binary, orig, {
+                operator: op,
+                left: left,
+                right: right,
             });
-            self.right = self.right.right;
-            return self.transform(compressor);
         }
-        return self.evaluate(compressor)[0];
-    });
 
-    OPT(AST_SymbolRef, function(self, compressor){
-        if (self.undeclared()) {
-            var defines = compressor.option("global_defs");
-            if (defines && defines.hasOwnProperty(self.name)) {
-                return make_node_from_constant(compressor, defines[self.name], self);
+        function is_indexFn(node) {
+            return node.TYPE == "Call"
+                && node.expression instanceof AST_Dot
+                && indexFns[node.expression.property];
+        }
+
+        function is_indexOf_match_pattern() {
+            switch (self.operator) {
+              case "<=":
+                // 0 <= array.indexOf(string) ---> !!~array.indexOf(string)
+                return indexRight && self.left instanceof AST_Number && self.left.value == 0;
+              case "<":
+                // array.indexOf(string) < 0 ---> !~array.indexOf(string)
+                if (indexLeft && self.right instanceof AST_Number && self.right.value == 0) return true;
+                // -1 < array.indexOf(string) ---> !!~array.indexOf(string)
+              case "==":
+              case "!=":
+                // -1 == array.indexOf(string) ---> !~array.indexOf(string)
+                // -1 != array.indexOf(string) ---> !!~array.indexOf(string)
+                if (!indexRight) return false;
+                return self.left instanceof AST_Number && self.left.value == -1
+                    || self.left instanceof AST_UnaryPrefix && self.left.operator == "-"
+                        && self.left.expression instanceof AST_Number && self.left.expression.value == 1;
             }
+        }
+
+        function reversible() {
+            return self.left.is_constant()
+                || self.right.is_constant()
+                || !self.left.has_side_effects(compressor)
+                    && !self.right.has_side_effects(compressor);
+        }
+
+        function reverse(op) {
+            if (reversible()) {
+                if (op) self.operator = op;
+                var tmp = self.left;
+                self.left = self.right;
+                self.right = tmp;
+            }
+        }
+    });
+
+    OPT(AST_SymbolExport, function(self) {
+        return self;
+    });
+
+    function recursive_ref(compressor, def, fn) {
+        var level = 0, node = compressor.self();
+        do {
+            if (node === fn) return node;
+            if (is_lambda(node) && node.name && node.name.definition() === def) return node;
+        } while (node = compressor.parent(level++));
+    }
+
+    function same_scope(def) {
+        var scope = def.scope.resolve();
+        return all(def.references, function(ref) {
+            return scope === ref.scope.resolve();
+        });
+    }
+
+    OPT(AST_SymbolRef, function(self, compressor) {
+        if (!compressor.option("ie")
+            && is_undeclared_ref(self)
+            // testing against `self.scope.uses_with` is an optimization
+            && !(self.scope.resolve().uses_with && compressor.find_parent(AST_With))) {
             switch (self.name) {
               case "undefined":
-                return make_node(AST_Undefined, self);
+                return make_node(AST_Undefined, self).optimize(compressor);
               case "NaN":
-                return make_node(AST_NaN, self).transform(compressor);
+                return make_node(AST_NaN, self).optimize(compressor);
               case "Infinity":
-                return make_node(AST_Infinity, self).transform(compressor);
+                return make_node(AST_Infinity, self).optimize(compressor);
+            }
+        }
+        var parent = compressor.parent();
+        if (compressor.option("reduce_vars") && is_lhs(compressor.self(), parent) !== compressor.self()) {
+            var def = self.definition();
+            var fixed = self.fixed_value();
+            var single_use = def.single_use && !(parent instanceof AST_Call && parent.is_expr_pure(compressor));
+            if (single_use) {
+                if (is_lambda(fixed)) {
+                    if ((def.scope !== self.scope.resolve(true) || def.in_loop)
+                        && (!compressor.option("reduce_funcs") || def.escaped.depth == 1 || fixed.inlined)) {
+                        single_use = false;
+                    } else if (def.redefined()) {
+                        single_use = false;
+                    } else if (recursive_ref(compressor, def, fixed)) {
+                        single_use = false;
+                    } else if (fixed.name && fixed.name.definition() !== def) {
+                        single_use = false;
+                    } else if (fixed.parent_scope !== self.scope || is_funarg(def)) {
+                        if (!safe_from_strict_mode(fixed, compressor)) {
+                            single_use = false;
+                        } else if ((single_use = fixed.is_constant_expression(self.scope)) == "f") {
+                            var scope = self.scope;
+                            do {
+                                if (scope instanceof AST_LambdaDefinition || scope instanceof AST_LambdaExpression) {
+                                    scope.inlined = true;
+                                }
+                            } while (scope = scope.parent_scope);
+                        }
+                    } else if (fixed.name && (fixed.name.name == "await" && is_async(fixed)
+                        || fixed.name.name == "yield" && is_generator(fixed))) {
+                        single_use = false;
+                    } else if (fixed.has_side_effects(compressor)) {
+                        single_use = false;
+                    } else if (compressor.option("ie") && fixed instanceof AST_Class) {
+                        single_use = false;
+                    }
+                    if (single_use) fixed.parent_scope = self.scope;
+                } else if (!fixed
+                    || def.recursive_refs > 0
+                    || !fixed.is_constant_expression()
+                    || fixed.drop_side_effect_free(compressor)) {
+                    single_use = false;
+                }
+            }
+            if (single_use) {
+                def.single_use = false;
+                fixed._squeezed = true;
+                fixed.single_use = true;
+                if (fixed instanceof AST_DefClass) fixed = to_class_expr(fixed);
+                if (fixed instanceof AST_LambdaDefinition) fixed = to_func_expr(fixed);
+                if (is_lambda(fixed)) {
+                    var scopes = [];
+                    var scope = self.scope;
+                    do {
+                        scopes.push(scope);
+                        if (scope === def.scope) break;
+                    } while (scope = scope.parent_scope);
+                    fixed.enclosed.forEach(function(def) {
+                        if (fixed.variables.has(def.name)) return;
+                        for (var i = 0; i < scopes.length; i++) {
+                            var scope = scopes[i];
+                            if (!push_uniq(scope.enclosed, def)) return;
+                            scope.var_names().set(def.name, true);
+                        }
+                    });
+                }
+                var value;
+                if (def.recursive_refs > 0) {
+                    value = fixed.clone(true);
+                    var defun_def = value.name.definition();
+                    var lambda_def = value.variables.get(value.name.name);
+                    var name = lambda_def && lambda_def.orig[0];
+                    var def_fn_name, symbol_type;
+                    if (value instanceof AST_Class) {
+                        def_fn_name = "def_function";
+                        symbol_type = AST_SymbolClass;
+                    } else {
+                        def_fn_name = "def_variable";
+                        symbol_type = AST_SymbolLambda;
+                    }
+                    if (!(name instanceof symbol_type)) {
+                        name = make_node(symbol_type, value.name);
+                        name.scope = value;
+                        value.name = name;
+                        lambda_def = value[def_fn_name](name);
+                        lambda_def.recursive_refs = def.recursive_refs;
+                    }
+                    value.walk(new TreeWalker(function(node) {
+                        if (node instanceof AST_SymbolDeclaration) {
+                            if (node !== name) {
+                                var def = node.definition();
+                                def.orig.push(node);
+                                def.eliminated++;
+                            }
+                            return;
+                        }
+                        if (!(node instanceof AST_SymbolRef)) return;
+                        var def = node.definition();
+                        if (def === defun_def) {
+                            node.thedef = def = lambda_def;
+                        } else {
+                            def.single_use = false;
+                            var fn = node.fixed_value();
+                            if (is_lambda(fn)
+                                && fn.name
+                                && fn.name.definition() === def
+                                && def.scope === fn.name.scope
+                                && fixed.variables.get(fn.name.name) === def) {
+                                fn.name = fn.name.clone();
+                                node.thedef = def = value.variables.get(fn.name.name) || value[def_fn_name](fn.name);
+                            }
+                        }
+                        def.references.push(node);
+                    }));
+                } else {
+                    if (fixed instanceof AST_Scope) {
+                        compressor.push(fixed);
+                        value = fixed.optimize(compressor);
+                        compressor.pop();
+                    } else {
+                        value = fixed.optimize(compressor);
+                    }
+                    value = value.transform(new TreeTransformer(function(node, descend) {
+                        if (node instanceof AST_Scope) return node;
+                        node = node.clone();
+                        descend(node, this);
+                        return node;
+                    }));
+                }
+                def.replaced++;
+                return value;
+            }
+            var state;
+            if (fixed && (state = self.fixed || def.fixed).should_replace !== false) {
+                var ev, init;
+                if (fixed instanceof AST_This) {
+                    if (!is_funarg(def) && same_scope(def) && !cross_class(def)) init = fixed;
+                } else if ((ev = fixed.evaluate(compressor, true)) !== fixed
+                    && typeof ev != "function"
+                    && (ev === null
+                        || typeof ev != "object"
+                        || compressor.option("unsafe_regexp")
+                            && ev instanceof RegExp && !def.cross_loop && same_scope(def))) {
+                    init = make_node_from_constant(ev, fixed);
+                }
+                if (init) {
+                    if (state.should_replace === undefined) {
+                        var value_length = init.optimize(compressor).print_to_string().length;
+                        if (!has_symbol_ref(fixed)) {
+                            value_length = Math.min(value_length, fixed.print_to_string().length);
+                        }
+                        var name_length = def.name.length;
+                        if (compressor.option("unused") && !compressor.exposed(def)) {
+                            var refs = def.references.length - def.replaced - def.assignments;
+                            refs = Math.min(refs, def.references.filter(function(ref) {
+                                return ref.fixed === state;
+                            }).length);
+                            name_length += (name_length + 2 + value_length) / Math.max(1, refs);
+                        }
+                        state.should_replace = value_length - Math.floor(name_length) < compressor.eval_threshold;
+                    }
+                    if (state.should_replace) {
+                        var value;
+                        if (has_symbol_ref(fixed)) {
+                            value = init.optimize(compressor);
+                            if (value === init) value = value.clone(true);
+                        } else {
+                            value = best_of_expression(init.optimize(compressor), fixed);
+                            if (value === init || value === fixed) value = value.clone(true);
+                        }
+                        def.replaced++;
+                        return value;
+                    }
+                }
             }
         }
         return self;
+
+        function cross_class(def) {
+            var scope = self.scope;
+            while (scope !== def.scope) {
+                if (scope instanceof AST_Class) return true;
+                scope = scope.parent_scope;
+            }
+        }
+
+        function has_symbol_ref(value) {
+            var found;
+            value.walk(new TreeWalker(function(node) {
+                if (node instanceof AST_SymbolRef) found = true;
+                if (found) return true;
+            }));
+            return found;
+        }
     });
 
-    OPT(AST_Infinity, function (self, compressor) {
-        return make_node(AST_Binary, self, {
-            operator : '/',
-            left     : make_node(AST_Number, self, {value: 1}),
-            right    : make_node(AST_Number, self, {value: 0})
+    function is_raw_tag(compressor, tag) {
+        return compressor.option("unsafe")
+            && tag instanceof AST_Dot
+            && tag.property == "raw"
+            && is_undeclared_ref(tag.expression)
+            && tag.expression.name == "String";
+    }
+
+    function decode_template(str) {
+        var malformed = false;
+        str = str.replace(/\\(u\{[^{}]*\}?|u[\s\S]{0,4}|x[\s\S]{0,2}|[0-9]+|[\s\S])/g, function(match, seq) {
+            var ch = decode_escape_sequence(seq);
+            if (typeof ch == "string") return ch;
+            malformed = true;
         });
+        if (!malformed) return str;
+    }
+
+    OPT(AST_Template, function(self, compressor) {
+        if (!compressor.option("templates")) return self;
+        var tag = self.tag;
+        if (!tag || is_raw_tag(compressor, tag)) {
+            var exprs = [];
+            var strs = [];
+            for (var i = 0, status; i < self.strings.length; i++) {
+                var str = self.strings[i];
+                if (!tag) {
+                    var trimmed = decode_template(str);
+                    if (trimmed) str = escape_literal(trimmed);
+                }
+                if (i > 0) {
+                    var node = self.expressions[i - 1];
+                    var value = should_join(node);
+                    if (value) {
+                        var prev = strs[strs.length - 1];
+                        var joined = prev + value + str;
+                        var decoded;
+                        if (tag || typeof (decoded = decode_template(joined)) == status) {
+                            strs[strs.length - 1] = decoded ? escape_literal(decoded) : joined;
+                            continue;
+                        }
+                    }
+                    exprs.push(node);
+                }
+                strs.push(str);
+                if (!tag) status = typeof trimmed;
+            }
+            if (!tag && strs.length > 1) {
+                if (strs[strs.length - 1] == "") return make_node(AST_Binary, self, {
+                    operator: "+",
+                    left: make_node(AST_Template, self, {
+                        expressions: exprs.slice(0, -1),
+                        strings: strs.slice(0, -1),
+                    }).transform(compressor),
+                    right: exprs[exprs.length - 1],
+                }).optimize(compressor);
+                if (strs[0] == "") {
+                    var left = make_node(AST_Binary, self, {
+                        operator: "+",
+                        left: make_node(AST_String, self, { value: "" }),
+                        right: exprs[0],
+                    });
+                    for (var i = 1; strs[i] == "" && i < exprs.length; i++) {
+                        left = make_node(AST_Binary, self, {
+                            operator: "+",
+                            left: left,
+                            right: exprs[i],
+                        });
+                    }
+                    return best_of(compressor, self, make_node(AST_Binary, self, {
+                        operator: "+",
+                        left: left.transform(compressor),
+                        right: make_node(AST_Template, self, {
+                            expressions: exprs.slice(i),
+                            strings: strs.slice(i),
+                        }).transform(compressor),
+                    }).optimize(compressor));
+                }
+            }
+            self.expressions = exprs;
+            self.strings = strs;
+        }
+        return try_evaluate(compressor, self);
+
+        function escape_literal(str) {
+            return str.replace(/\r|\\|`|\${/g, function(s) {
+                return "\\" + (s == "\r" ? "r" : s);
+            });
+        }
+
+        function should_join(node) {
+            var ev = node.evaluate(compressor);
+            if (ev === node) return;
+            if (tag && /\r|\\|`/.test(ev)) return;
+            ev = escape_literal("" + ev);
+            if (ev.length > node.print_to_string().length + "${}".length) return;
+            return ev;
+        }
     });
 
-    OPT(AST_Undefined, function(self, compressor){
-        if (compressor.option("unsafe")) {
-            var scope = compressor.find_parent(AST_Scope);
-            var undef = scope.find_variable("undefined");
+    function is_atomic(lhs, self) {
+        return lhs instanceof AST_SymbolRef || lhs.TYPE === self.TYPE;
+    }
+
+    OPT(AST_Undefined, function(self, compressor) {
+        if (compressor.option("unsafe_undefined")) {
+            var undef = find_scope(compressor).find_variable("undefined");
             if (undef) {
                 var ref = make_node(AST_SymbolRef, self, {
-                    name   : "undefined",
-                    scope  : scope,
-                    thedef : undef
+                    name: "undefined",
+                    scope: undef.scope,
+                    thedef: undef,
                 });
-                ref.reference();
+                ref.is_undefined = true;
                 return ref;
             }
         }
-        return self;
+        var lhs = is_lhs(compressor.self(), compressor.parent());
+        if (lhs && is_atomic(lhs, self)) return self;
+        return make_node(AST_UnaryPrefix, self, {
+            operator: "void",
+            expression: make_node(AST_Number, self, { value: 0 }),
+        });
     });
 
-    var ASSIGN_OPS = [ '+', '-', '/', '*', '%', '>>', '<<', '>>>', '|', '^', '&' ];
-    OPT(AST_Assign, function(self, compressor){
-        self = self.lift_sequences(compressor);
-        if (self.operator == "="
-            && self.left instanceof AST_SymbolRef
-            && self.right instanceof AST_Binary
-            && self.right.left instanceof AST_SymbolRef
-            && self.right.left.name == self.left.name
-            && member(self.right.operator, ASSIGN_OPS)) {
-            self.operator = self.right.operator + "=";
-            self.right = self.right.right;
+    OPT(AST_Infinity, function(self, compressor) {
+        var lhs = is_lhs(compressor.self(), compressor.parent());
+        if (lhs && is_atomic(lhs, self)) return self;
+        if (compressor.option("keep_infinity") && !lhs && !find_scope(compressor).find_variable("Infinity")) {
+            return self;
         }
-        return self;
+        return make_node(AST_Binary, self, {
+            operator: "/",
+            left: make_node(AST_Number, self, { value: 1 }),
+            right: make_node(AST_Number, self, { value: 0 }),
+        });
     });
 
-    OPT(AST_Conditional, function(self, compressor){
-        if (!compressor.option("conditionals")) return self;
-        if (self.condition instanceof AST_Seq) {
-            var car = self.condition.car;
-            self.condition = self.condition.cdr;
-            return AST_Seq.cons(car, self);
-        }
-        var cond = self.condition.evaluate(compressor);
-        if (cond.length > 1) {
-            if (cond[1]) {
-                compressor.warn("Condition always true [{file}:{line},{col}]", self.start);
-                return self.consequent;
-            } else {
-                compressor.warn("Condition always false [{file}:{line},{col}]", self.start);
-                return self.alternative;
+    OPT(AST_NaN, function(self, compressor) {
+        var lhs = is_lhs(compressor.self(), compressor.parent());
+        if (lhs && is_atomic(lhs, self)) return self;
+        if (!lhs && !find_scope(compressor).find_variable("NaN")) return self;
+        return make_node(AST_Binary, self, {
+            operator: "/",
+            left: make_node(AST_Number, self, { value: 0 }),
+            right: make_node(AST_Number, self, { value: 0 }),
+        });
+    });
+
+    function is_reachable(self, defs) {
+        var reachable = false;
+        var find_ref = new TreeWalker(function(node) {
+            if (reachable) return true;
+            if (node instanceof AST_SymbolRef && member(node.definition(), defs)) return reachable = true;
+        });
+        var scan_scope = new TreeWalker(function(node) {
+            if (reachable) return true;
+            if (node instanceof AST_Lambda && node !== self) {
+                if (!(node.name || is_async(node) || is_generator(node))) {
+                    var parent = scan_scope.parent();
+                    if (parent instanceof AST_Call && parent.expression === node) return;
+                }
+                node.walk(find_ref);
+                return true;
+            }
+        });
+        self.walk(scan_scope);
+        return reachable;
+    }
+
+    var ASSIGN_OPS = makePredicate("+ - * / % >> << >>> | ^ &");
+    var ASSIGN_OPS_COMMUTATIVE = makePredicate("* | ^ &");
+    OPT(AST_Assign, function(self, compressor) {
+        if (compressor.option("dead_code")) {
+            if (self.left instanceof AST_PropAccess) {
+                if (self.operator == "=") {
+                    if (self.redundant) {
+                        var exprs = [ self.left.expression ];
+                        if (self.left instanceof AST_Sub) exprs.push(self.left.property);
+                        exprs.push(self.right);
+                        return make_sequence(self, exprs).optimize(compressor);
+                    }
+                    if (self.left.equals(self.right) && !self.left.has_side_effects(compressor)) {
+                        return self.right;
+                    }
+                    var exp = self.left.expression;
+                    if (exp instanceof AST_Lambda
+                        || !compressor.has_directive("use strict")
+                            && exp instanceof AST_Constant
+                            && !exp.may_throw_on_access(compressor)) {
+                        return self.left instanceof AST_Dot ? self.right : make_sequence(self, [
+                            self.left.property,
+                            self.right
+                        ]).optimize(compressor);
+                    }
+                }
+            } else if (self.left instanceof AST_SymbolRef && can_drop_symbol(self.left, compressor)) {
+                var parent;
+                if (self.operator == "=" && self.left.equals(self.right)
+                    && !((parent = compressor.parent()) instanceof AST_UnaryPrefix && parent.operator == "delete")) {
+                    return self.right;
+                }
+                if (self.left.is_immutable()) return strip_assignment();
+                var def = self.left.definition();
+                var scope = def.scope.resolve();
+                var local = scope === compressor.find_parent(AST_Lambda);
+                var level = 0, node;
+                parent = compressor.self();
+                if (!(scope.uses_arguments && is_funarg(def)) || compressor.has_directive("use strict")) do {
+                    node = parent;
+                    parent = compressor.parent(level++);
+                    if (parent instanceof AST_Assign) {
+                        if (parent.left instanceof AST_SymbolRef && parent.left.definition() === def) {
+                            if (in_try(level, parent, !local)) break;
+                            return strip_assignment(def);
+                        }
+                        if (parent.left.match_symbol(function(node) {
+                            if (node instanceof AST_PropAccess) return true;
+                        })) break;
+                        continue;
+                    }
+                    if (parent instanceof AST_Exit) {
+                        if (!local) break;
+                        if (in_try(level, parent)) break;
+                        if (is_reachable(scope, [ def ])) break;
+                        return strip_assignment(def);
+                    }
+                    if (parent instanceof AST_SimpleStatement) {
+                        if (!local) break;
+                        if (is_reachable(scope, [ def ])) break;
+                        var stat;
+                        do {
+                            stat = parent;
+                            parent = compressor.parent(level++);
+                            if (parent === scope && is_last_statement(parent.body, stat)) return strip_assignment(def);
+                        } while (is_tail_block(stat, parent));
+                        break;
+                    }
+                    if (parent instanceof AST_VarDef) {
+                        if (!(parent.name instanceof AST_SymbolDeclaration)) continue;
+                        if (parent.name.definition() !== def) continue;
+                        if (in_try(level, parent)) break;
+                        return strip_assignment(def);
+                    }
+                } while (is_tail(node, parent));
+            }
+        }
+        if (compressor.option("sequences")) {
+            var seq = self.lift_sequences(compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (compressor.option("assignments")) {
+            if (self.operator == "=" && self.left instanceof AST_SymbolRef && self.right instanceof AST_Binary) {
+                // x = expr1 OP expr2
+                if (self.right.left instanceof AST_SymbolRef
+                    && self.right.left.name == self.left.name
+                    && ASSIGN_OPS[self.right.operator]) {
+                    // x = x - 2 ---> x -= 2
+                    return make_compound(self.right.right);
+                }
+                if (self.right.right instanceof AST_SymbolRef
+                    && self.right.right.name == self.left.name
+                    && ASSIGN_OPS_COMMUTATIVE[self.right.operator]
+                    && !self.right.left.has_side_effects(compressor)) {
+                    // x = 2 & x ---> x &= 2
+                    return make_compound(self.right.left);
+                }
+            }
+            if ((self.operator == "-=" || self.operator == "+="
+                    && (self.left.is_boolean(compressor) || self.left.is_number(compressor)))
+                && self.right instanceof AST_Number
+                && self.right.value == 1) {
+                var op = self.operator.slice(0, -1);
+                return make_node(AST_UnaryPrefix, self, {
+                    operator: op + op,
+                    expression: self.left,
+                });
+            }
+        }
+        return try_evaluate(compressor, self);
+
+        function is_tail(node, parent) {
+            if (parent instanceof AST_Binary) switch (node) {
+              case parent.left:
+                return parent.right.is_constant_expression(scope);
+              case parent.right:
+                return true;
+              default:
+                return false;
+            }
+            if (parent instanceof AST_Conditional) switch (node) {
+              case parent.condition:
+                return parent.consequent.is_constant_expression(scope)
+                    && parent.alternative.is_constant_expression(scope);
+              case parent.consequent:
+              case parent.alternative:
+                return true;
+              default:
+                return false;
+            }
+            if (parent instanceof AST_Sequence) {
+                var exprs = parent.expressions;
+                var stop = exprs.indexOf(node);
+                if (stop < 0) return false;
+                for (var i = exprs.length; --i > stop;) {
+                    if (!exprs[i].is_constant_expression(scope)) return false;
+                }
+                return true;
             }
+            return parent instanceof AST_UnaryPrefix;
+        }
+
+        function is_tail_block(stat, parent) {
+            if (parent instanceof AST_BlockStatement) return is_last_statement(parent.body, stat);
+            if (parent instanceof AST_Catch) return is_last_statement(parent.body, stat);
+            if (parent instanceof AST_Finally) return is_last_statement(parent.body, stat);
+            if (parent instanceof AST_If) return parent.body === stat || parent.alternative === stat;
+            if (parent instanceof AST_Try) return parent.bfinally ? parent.bfinally === stat : parent.bcatch === stat;
+        }
+
+        function in_try(level, node, sync) {
+            var right = self.right;
+            self.right = make_node(AST_Null, right);
+            var may_throw = node.may_throw(compressor);
+            self.right = right;
+            return find_try(compressor, level, node, scope, may_throw, sync);
+        }
+
+        function make_compound(rhs) {
+            var fixed = self.left.fixed;
+            if (fixed) fixed.to_binary = replace_ref(function(node) {
+                return node.left;
+            }, fixed);
+            return make_node(AST_Assign, self, {
+                operator: self.right.operator + "=",
+                left: self.left,
+                right: rhs,
+            });
+        }
+
+        function strip_assignment(def) {
+            if (def) def.fixed = false;
+            return (self.operator != "=" ? make_node(AST_Binary, self, {
+                operator: self.operator.slice(0, -1),
+                left: self.left,
+                right: self.right,
+            }) : maintain_this_binding(compressor.parent(), self, self.right)).optimize(compressor);
+        }
+    });
+
+    OPT(AST_Conditional, function(self, compressor) {
+        if (compressor.option("sequences") && self.condition instanceof AST_Sequence) {
+            var expressions = self.condition.expressions.slice();
+            var node = self.clone();
+            node.condition = expressions.pop();
+            expressions.push(node);
+            return make_sequence(self, expressions).optimize(compressor);
         }
-        var negated = cond[0].negate(compressor);
-        if (best_of(cond[0], negated) === negated) {
+        if (!compressor.option("conditionals")) return self;
+        var condition = self.condition;
+        if (compressor.option("booleans") && !condition.has_side_effects(compressor)) {
+            mark_duplicate_condition(compressor, condition);
+        }
+        condition = fuzzy_eval(compressor, condition);
+        if (!condition) {
+            AST_Node.warn("Condition always false [{start}]", self);
+            return make_sequence(self, [ self.condition, self.alternative ]).optimize(compressor);
+        } else if (!(condition instanceof AST_Node)) {
+            AST_Node.warn("Condition always true [{start}]", self);
+            return make_sequence(self, [ self.condition, self.consequent ]).optimize(compressor);
+        }
+        var first = first_in_statement(compressor);
+        var negated = condition.negate(compressor, first);
+        if ((first ? best_of_statement : best_of_expression)(condition, negated) === negated) {
             self = make_node(AST_Conditional, self, {
                 condition: negated,
                 consequent: self.alternative,
-                alternative: self.consequent
+                alternative: self.consequent,
             });
+            negated = condition;
+            condition = self.condition;
         }
         var consequent = self.consequent;
         var alternative = self.alternative;
-        if (consequent instanceof AST_Assign
-            && alternative instanceof AST_Assign
-            && consequent.operator == alternative.operator
-            && consequent.left.equivalent_to(alternative.left)
-            && !consequent.left.has_side_effects(compressor)
-           ) {
-            /*
-             * Stuff like this:
-             * if (foo) exp = something; else exp = something_else;
-             * ==>
-             * exp = foo ? something : something_else;
-             */
-            return make_node(AST_Assign, self, {
-                operator: consequent.operator,
-                left: consequent.left,
-                right: make_node(AST_Conditional, self, {
-                    condition: self.condition,
-                    consequent: consequent.right,
-                    alternative: alternative.right
-                })
-            });
+        var cond_lhs = extract_lhs(condition, compressor);
+        if (repeatable(compressor, cond_lhs)) {
+            // x ? x : y ---> x || y
+            if (cond_lhs.equals(consequent)) return make_node(AST_Binary, self, {
+                operator: "||",
+                left: condition,
+                right: alternative,
+            }).optimize(compressor);
+            // x ? y : x ---> x && y
+            if (cond_lhs.equals(alternative)) return make_node(AST_Binary, self, {
+                operator: "&&",
+                left: condition,
+                right: consequent,
+            }).optimize(compressor);
         }
-        if (consequent instanceof AST_Call
-            && alternative.TYPE === consequent.TYPE
-            && consequent.args.length == alternative.args.length
-            && !consequent.expression.has_side_effects(compressor)
-            && consequent.expression.equivalent_to(alternative.expression)) {
-            if (consequent.args.length == 0) {
-                return make_node(AST_Seq, self, {
-                    car: self.condition,
-                    cdr: consequent
+        // if (foo) exp = something; else exp = something_else;
+        //                   |
+        //                   v
+        // exp = foo ? something : something_else;
+        var seq_tail = consequent.tail_node();
+        if (seq_tail instanceof AST_Assign) {
+            var is_eq = seq_tail.operator == "=";
+            var alt_tail = is_eq ? alternative.tail_node() : alternative;
+            if ((is_eq || consequent === seq_tail)
+                && alt_tail instanceof AST_Assign
+                && seq_tail.operator == alt_tail.operator
+                && seq_tail.left.equals(alt_tail.left)
+                && (is_eq && seq_tail.left instanceof AST_SymbolRef
+                    || !condition.has_side_effects(compressor)
+                        && can_shift_lhs_of_tail(consequent)
+                        && can_shift_lhs_of_tail(alternative))) {
+                return make_node(AST_Assign, self, {
+                    operator: seq_tail.operator,
+                    left: seq_tail.left,
+                    right: make_node(AST_Conditional, self, {
+                        condition: condition,
+                        consequent: pop_lhs(consequent),
+                        alternative: pop_lhs(alternative),
+                    }),
                 });
             }
-            if (consequent.args.length == 1) {
-                consequent.args[0] = make_node(AST_Conditional, self, {
-                    condition: self.condition,
-                    consequent: consequent.args[0],
-                    alternative: alternative.args[0]
-                });
-                return consequent;
-            }
         }
-        // x?y?z:a:a --> x&&y?z:a
-        if (consequent instanceof AST_Conditional
-            && consequent.alternative.equivalent_to(alternative)) {
+        var alt_tail = alternative.tail_node();
+        // x ? y : y ---> x, y
+        // x ? (a, c) : (b, c) ---> x ? a : b, c
+        if (seq_tail.equals(alt_tail)) return make_sequence(self, consequent.equals(alternative) ? [
+            condition,
+            consequent,
+        ] : [
+            make_node(AST_Conditional, self, {
+                condition: condition,
+                consequent: pop_seq(consequent),
+                alternative: pop_seq(alternative),
+            }),
+            alt_tail,
+        ]).optimize(compressor);
+        // x ? y.p : z.p ---> (x ? y : z).p
+        // x ? y(a) : z(a) ---> (x ? y : z)(a)
+        // x ? y.f(a) : z.f(a) ---> (x ? y : z).f(a)
+        var combined = combine_tail(consequent, alternative, true);
+        if (combined) return combined;
+        // x ? y(a) : y(b) ---> y(x ? a : b)
+        var arg_index;
+        if (consequent instanceof AST_Call
+            && alternative.TYPE == consequent.TYPE
+            && (arg_index = arg_diff(consequent, alternative)) >= 0
+            && consequent.expression.equals(alternative.expression)
+            && !condition.has_side_effects(compressor)
+            && !consequent.expression.has_side_effects(compressor)) {
+            var node = consequent.clone();
+            var arg = consequent.args[arg_index];
+            node.args[arg_index] = arg instanceof AST_Spread ? make_node(AST_Spread, self, {
+                expression: make_node(AST_Conditional, self, {
+                    condition: condition,
+                    consequent: arg.expression,
+                    alternative: alternative.args[arg_index].expression,
+                }),
+            }) : make_node(AST_Conditional, self, {
+                condition: condition,
+                consequent: arg,
+                alternative: alternative.args[arg_index],
+            });
+            return node;
+        }
+        // x ? (y ? a : b) : b ---> x && y ? a : b
+        if (seq_tail instanceof AST_Conditional
+            && seq_tail.alternative.equals(alternative)) {
             return make_node(AST_Conditional, self, {
                 condition: make_node(AST_Binary, self, {
-                    left: self.condition,
+                    left: condition,
                     operator: "&&",
-                    right: consequent.condition
+                    right: fuse(consequent, seq_tail, "condition"),
                 }),
-                consequent: consequent.consequent,
-                alternative: alternative
+                consequent: seq_tail.consequent,
+                alternative: merge_expression(seq_tail.alternative, alternative),
             });
         }
-        // x=y?1:1 --> x=1
-        if (consequent instanceof AST_Constant
-            && alternative instanceof AST_Constant
-            && consequent.equivalent_to(alternative)) {
-            if (self.condition.has_side_effects(compressor)) {
-                return AST_Seq.from_array([self.condition, make_node_from_constant(compressor, consequent.value, self)]);
-            } else {
-                return make_node_from_constant(compressor, consequent.value, self);
-
-            }
+        // x ? (y ? a : b) : a ---> !x || y ? a : b
+        if (seq_tail instanceof AST_Conditional
+            && seq_tail.consequent.equals(alternative)) {
+            return make_node(AST_Conditional, self, {
+                condition: make_node(AST_Binary, self, {
+                    left: negated,
+                    operator: "||",
+                    right: fuse(consequent, seq_tail, "condition"),
+                }),
+                consequent: merge_expression(seq_tail.consequent, alternative),
+                alternative: seq_tail.alternative,
+            });
         }
-        // x=y?true:false --> x=!!y
-        if (consequent instanceof AST_True
-            && alternative instanceof AST_False) {
-            self.condition = self.condition.negate(compressor);
-            return make_node(AST_UnaryPrefix, self.condition, {
-                operator: "!",
-                expression: self.condition
+        // x ? a : (y ? a : b) ---> x || y ? a : b
+        if (alt_tail instanceof AST_Conditional
+            && consequent.equals(alt_tail.consequent)) {
+            return make_node(AST_Conditional, self, {
+                condition: make_node(AST_Binary, self, {
+                    left: condition,
+                    operator: "||",
+                    right: fuse(alternative, alt_tail, "condition"),
+                }),
+                consequent: merge_expression(consequent, alt_tail.consequent),
+                alternative: alt_tail.alternative,
+            });
+        }
+        // x ? b : (y ? a : b) ---> !x && y ? a : b
+        if (alt_tail instanceof AST_Conditional
+            && consequent.equals(alt_tail.alternative)) {
+            return make_node(AST_Conditional, self, {
+                condition: make_node(AST_Binary, self, {
+                    left: negated,
+                    operator: "&&",
+                    right: fuse(alternative, alt_tail, "condition"),
+                }),
+                consequent: alt_tail.consequent,
+                alternative: merge_expression(consequent, alt_tail.alternative),
             });
         }
-        // x=y?false:true --> x=!y
-        if (consequent instanceof AST_False
-            && alternative instanceof AST_True) {
-            return self.condition.negate(compressor)
+        // x ? y && a : a ---> (!x || y) && a
+        if (seq_tail instanceof AST_Binary
+            && seq_tail.operator == "&&"
+            && seq_tail.right.equals(alternative)) {
+            return make_node(AST_Binary, self, {
+                operator: "&&",
+                left: make_node(AST_Binary, self, {
+                    operator: "||",
+                    left: negated,
+                    right: fuse(consequent, seq_tail, "left"),
+                }),
+                right: merge_expression(seq_tail.right, alternative),
+            }).optimize(compressor);
+        }
+        // x ? y || a : a ---> x && y || a
+        if (seq_tail instanceof AST_Binary
+            && seq_tail.operator == "||"
+            && seq_tail.right.equals(alternative)) {
+            return make_node(AST_Binary, self, {
+                operator: "||",
+                left: make_node(AST_Binary, self, {
+                    operator: "&&",
+                    left: condition,
+                    right: fuse(consequent, seq_tail, "left"),
+                }),
+                right: merge_expression(seq_tail.right, alternative),
+            }).optimize(compressor);
+        }
+        // x ? a : y && a ---> (x || y) && a
+        if (alt_tail instanceof AST_Binary
+            && alt_tail.operator == "&&"
+            && alt_tail.right.equals(consequent)) {
+            return make_node(AST_Binary, self, {
+                operator: "&&",
+                left: make_node(AST_Binary, self, {
+                    operator: "||",
+                    left: condition,
+                    right: fuse(alternative, alt_tail, "left"),
+                }),
+                right: merge_expression(consequent, alt_tail.right),
+            }).optimize(compressor);
+        }
+        // x ? a : y || a ---> !x && y || a
+        if (alt_tail instanceof AST_Binary
+            && alt_tail.operator == "||"
+            && alt_tail.right.equals(consequent)) {
+            return make_node(AST_Binary, self, {
+                operator: "||",
+                left: make_node(AST_Binary, self, {
+                    operator: "&&",
+                    left: negated,
+                    right: fuse(alternative, alt_tail, "left"),
+                }),
+                right: merge_expression(consequent, alt_tail.right),
+            }).optimize(compressor);
+        }
+        var in_bool = compressor.option("booleans") && compressor.in_boolean_context();
+        if (is_true(consequent)) {
+            // c ? true : false ---> !!c
+            if (is_false(alternative)) return booleanize(condition);
+            // c ? true : x ---> !!c || x
+            return make_node(AST_Binary, self, {
+                operator: "||",
+                left: booleanize(condition),
+                right: alternative,
+            }).optimize(compressor);
+        }
+        if (is_false(consequent)) {
+            // c ? false : true ---> !c
+            if (is_true(alternative)) return booleanize(condition.negate(compressor));
+            // c ? false : x ---> !c && x
+            return make_node(AST_Binary, self, {
+                operator: "&&",
+                left: booleanize(condition.negate(compressor)),
+                right: alternative,
+            }).optimize(compressor);
         }
+        // c ? x : true ---> !c || x
+        if (is_true(alternative)) return make_node(AST_Binary, self, {
+            operator: "||",
+            left: booleanize(condition.negate(compressor)),
+            right: consequent,
+        }).optimize(compressor);
+        // c ? x : false ---> !!c && x
+        if (is_false(alternative)) return make_node(AST_Binary, self, {
+            operator: "&&",
+            left: booleanize(condition),
+            right: consequent,
+        }).optimize(compressor);
+        if (compressor.option("typeofs")) mark_locally_defined(condition, consequent, alternative);
         return self;
-    });
 
-    OPT(AST_Boolean, function(self, compressor){
-        if (compressor.option("booleans")) {
-            var p = compressor.parent();
-            if (p instanceof AST_Binary && (p.operator == "=="
-                                            || p.operator == "!=")) {
-                compressor.warn("Non-strict equality against boolean: {operator} {value} [{file}:{line},{col}]", {
-                    operator : p.operator,
-                    value    : self.value,
-                    file     : p.start.file,
-                    line     : p.start.line,
-                    col      : p.start.col,
-                });
-                return make_node(AST_Number, self, {
-                    value: +self.value
-                });
-            }
-            return make_node(AST_UnaryPrefix, self, {
+        function booleanize(node) {
+            if (node.is_boolean(compressor)) return node;
+            // !!expression
+            return make_node(AST_UnaryPrefix, node, {
                 operator: "!",
-                expression: make_node(AST_Number, self, {
-                    value: 1 - self.value
-                })
+                expression: node.negate(compressor),
+            });
+        }
+
+        // AST_True or !0
+        function is_true(node) {
+            return node instanceof AST_True
+                || in_bool
+                    && node instanceof AST_Constant
+                    && node.value
+                || (node instanceof AST_UnaryPrefix
+                    && node.operator == "!"
+                    && node.expression instanceof AST_Constant
+                    && !node.expression.value);
+        }
+        // AST_False or !1 or void 0
+        function is_false(node) {
+            return node instanceof AST_False
+                || in_bool
+                    && (node instanceof AST_Constant
+                            && !node.value
+                        || node instanceof AST_UnaryPrefix
+                            && node.operator == "void"
+                            && !node.expression.has_side_effects(compressor))
+                || (node instanceof AST_UnaryPrefix
+                    && node.operator == "!"
+                    && node.expression instanceof AST_Constant
+                    && node.expression.value);
+        }
+
+        function arg_diff(consequent, alternative) {
+            var a = consequent.args;
+            var b = alternative.args;
+            var len = a.length;
+            if (len != b.length) return -2;
+            for (var i = 0; i < len; i++) {
+                if (!a[i].equals(b[i])) {
+                    if (a[i] instanceof AST_Spread !== b[i] instanceof AST_Spread) return -3;
+                    for (var j = i + 1; j < len; j++) {
+                        if (!a[j].equals(b[j])) return -2;
+                    }
+                    return i;
+                }
+            }
+            return -1;
+        }
+
+        function fuse(node, tail, prop) {
+            if (node === tail) return tail[prop];
+            var exprs = node.expressions.slice(0, -1);
+            exprs.push(tail[prop]);
+            return make_sequence(node, exprs);
+        }
+
+        function is_tail_equivalent(consequent, alternative) {
+            if (consequent.TYPE != alternative.TYPE) return;
+            if (consequent.optional != alternative.optional) return;
+            if (consequent instanceof AST_Call) {
+                if (arg_diff(consequent, alternative) != -1) return;
+                return consequent.TYPE != "Call"
+                    || !(consequent.expression instanceof AST_PropAccess
+                        || alternative.expression instanceof AST_PropAccess)
+                    || is_tail_equivalent(consequent.expression, alternative.expression);
+            }
+            if (!(consequent instanceof AST_PropAccess)) return;
+            var p = consequent.property;
+            var q = alternative.property;
+            return (p instanceof AST_Node ? p.equals(q) : p == q)
+                && !(consequent.expression instanceof AST_Super || alternative.expression instanceof AST_Super);
+        }
+
+        function combine_tail(consequent, alternative, top) {
+            var seq_tail = consequent.tail_node();
+            var alt_tail = alternative.tail_node();
+            if (!is_tail_equivalent(seq_tail, alt_tail)) return !top && make_node(AST_Conditional, self, {
+                condition: condition,
+                consequent: consequent,
+                alternative: alternative,
+            });
+            var node = seq_tail.clone();
+            var seq_expr = fuse(consequent, seq_tail, "expression");
+            var alt_expr = fuse(alternative, alt_tail, "expression");
+            var combined = combine_tail(seq_expr, alt_expr);
+            if (seq_tail.expression instanceof AST_Sequence) {
+                combined = maintain_this_binding(seq_tail, seq_tail.expression, combined);
+            }
+            node.expression = combined;
+            return node;
+        }
+
+        function can_shift_lhs_of_tail(node) {
+            return node === node.tail_node() || all(node.expressions.slice(0, -1), function(expr) {
+                return !expr.has_side_effects(compressor);
+            });
+        }
+
+        function pop_lhs(node) {
+            if (!(node instanceof AST_Sequence)) return node.right;
+            var exprs = node.expressions.slice();
+            exprs.push(exprs.pop().right);
+            return make_sequence(node, exprs);
+        }
+
+        function pop_seq(node) {
+            if (!(node instanceof AST_Sequence)) return make_node(AST_Number, node, { value: 0 });
+            return make_sequence(node, node.expressions.slice(0, -1));
+        }
+    });
+
+    OPT(AST_Boolean, function(self, compressor) {
+        if (!compressor.option("booleans")) return self;
+        if (compressor.in_boolean_context()) return make_node(AST_Number, self, { value: +self.value });
+        var p = compressor.parent();
+        if (p instanceof AST_Binary && (p.operator == "==" || p.operator == "!=")) {
+            AST_Node.warn("Non-strict equality against boolean: {operator} {value} [{start}]", {
+                operator: p.operator,
+                value: self.value,
+                start: p.start,
             });
+            return make_node(AST_Number, self, { value: +self.value });
+        }
+        return make_node(AST_UnaryPrefix, self, {
+            operator: "!",
+            expression: make_node(AST_Number, self, { value: 1 - self.value }),
+        });
+    });
+
+    OPT(AST_Spread, function(self, compressor) {
+        var exp = self.expression;
+        if (compressor.option("spreads") && exp instanceof AST_Array && !(compressor.parent() instanceof AST_Object)) {
+            return List.splice(exp.elements.map(function(node) {
+                return node instanceof AST_Hole ? make_node(AST_Undefined, node).optimize(compressor) : node;
+            }));
         }
         return self;
     });
 
-    OPT(AST_Sub, function(self, compressor){
+    function safe_to_flatten(value, compressor) {
+        if (!value) return false;
+        var parent = compressor.parent();
+        if (parent.TYPE != "Call") return true;
+        if (parent.expression !== compressor.self()) return true;
+        if (value instanceof AST_SymbolRef) {
+            value = value.fixed_value();
+            if (!value) return false;
+        }
+        return value instanceof AST_Lambda && !value.contains_this();
+    }
+
+    OPT(AST_Sub, function(self, compressor) {
+        var expr = self.expression;
         var prop = self.property;
-        if (prop instanceof AST_String && compressor.option("properties")) {
-            prop = prop.getValue();
-            if (RESERVED_WORDS(prop) ? compressor.option("screw_ie8") : is_identifier_string(prop)) {
-                return make_node(AST_Dot, self, {
-                    expression : self.expression,
-                    property   : prop
-                }).optimize(compressor);
+        var terminated = trim_optional_chain(self, compressor);
+        if (terminated) return terminated;
+        if (compressor.option("properties")) {
+            var key = prop.evaluate(compressor);
+            if (key !== prop) {
+                if (typeof key == "string") {
+                    if (key == "undefined") {
+                        key = undefined;
+                    } else {
+                        var value = parseFloat(key);
+                        if (value.toString() == key) {
+                            key = value;
+                        }
+                    }
+                }
+                prop = self.property = best_of_expression(prop, make_node_from_constant(key, prop).transform(compressor));
+                var property = "" + key;
+                if (is_identifier_string(property)
+                    && property.length <= prop.print_to_string().length + 1) {
+                    return make_node(AST_Dot, self, {
+                        optional: self.optional,
+                        expression: expr,
+                        property: property,
+                        quoted: true,
+                    }).optimize(compressor);
+                }
             }
-            var v = parseFloat(prop);
-            if (!isNaN(v) && v.toString() == prop) {
-                self.property = make_node(AST_Number, self.property, {
-                    value: v
+        }
+        var parent = compressor.parent();
+        var assigned = is_lhs(compressor.self(), parent);
+        var def, fn, fn_parent, index;
+        if (compressor.option("arguments")
+            && expr instanceof AST_SymbolRef
+            && is_arguments(def = expr.definition())
+            && !expr.in_arg
+            && prop instanceof AST_Number
+            && Math.floor(index = prop.value) == index
+            && (fn = def.scope) === find_lambda()
+            && fn.uses_arguments < (assigned ? 2 : 3)) {
+            if (parent instanceof AST_UnaryPrefix && parent.operator == "delete") {
+                if (!def.deleted) def.deleted = [];
+                def.deleted[index] = true;
+            }
+            var argname = fn.argnames[index];
+            if (def.deleted && def.deleted[index]) {
+                argname = null;
+            } else if (argname) {
+                var arg_def;
+                if (!(argname instanceof AST_SymbolFunarg)
+                    || argname.name == "await"
+                    || expr.scope.find_variable(argname.name) !== (arg_def = argname.definition())) {
+                    argname = null;
+                } else if (compressor.has_directive("use strict")
+                    || fn.name
+                    || fn.rest
+                    || !(fn_parent instanceof AST_Call
+                        && index < fn_parent.args.length
+                        && all(fn_parent.args.slice(0, index + 1), function(arg) {
+                            return !(arg instanceof AST_Spread);
+                        }))
+                    || !all(fn.argnames, function(argname) {
+                        return argname instanceof AST_SymbolFunarg;
+                    })) {
+                    if (has_reassigned() || arg_def.assignments || arg_def.orig.length > 1) argname = null;
+                }
+            } else if ((assigned || !has_reassigned())
+                && index < fn.argnames.length + 5
+                && compressor.drop_fargs(fn, fn_parent)
+                && !fn.rest) {
+                while (index >= fn.argnames.length) {
+                    argname = fn.make_var(AST_SymbolFunarg, fn, "argument_" + fn.argnames.length);
+                    fn.argnames.push(argname);
+                }
+            }
+            if (argname && find_if(function(node) {
+                return node.name === argname.name;
+            }, fn.argnames) === argname) {
+                if (assigned) def.reassigned--;
+                var sym = make_node(AST_SymbolRef, argname);
+                sym.reference();
+                argname.unused = undefined;
+                return sym;
+            }
+        }
+        if (assigned) return self;
+        if (compressor.option("sequences")
+            && parent.TYPE != "Call"
+            && !(parent instanceof AST_ForEnumeration && parent.init === self)) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (key !== prop) {
+            var sub = self.flatten_object(property, compressor);
+            if (sub) {
+                expr = self.expression = sub.expression;
+                prop = self.property = sub.property;
+            }
+        }
+        var elements;
+        if (compressor.option("properties")
+            && compressor.option("side_effects")
+            && prop instanceof AST_Number
+            && expr instanceof AST_Array
+            && all(elements = expr.elements, function(value) {
+                return !(value instanceof AST_Spread);
+            })) {
+            var index = prop.value;
+            var retValue = elements[index];
+            if (safe_to_flatten(retValue, compressor)) {
+                var is_hole = retValue instanceof AST_Hole;
+                var flatten = !is_hole;
+                var values = [];
+                for (var i = elements.length; --i > index;) {
+                    var value = elements[i].drop_side_effect_free(compressor);
+                    if (value) {
+                        values.unshift(value);
+                        if (flatten && value.has_side_effects(compressor)) flatten = false;
+                    }
+                }
+                if (!flatten) values.unshift(retValue);
+                while (--i >= 0) {
+                    var value = elements[i].drop_side_effect_free(compressor);
+                    if (value) {
+                        values.unshift(value);
+                    } else if (is_hole) {
+                        values.unshift(make_node(AST_Hole, elements[i]));
+                    } else {
+                        index--;
+                    }
+                }
+                if (flatten) {
+                    values.push(retValue);
+                    return make_sequence(self, values).optimize(compressor);
+                }
+                return make_node(AST_Sub, self, {
+                    expression: make_node(AST_Array, expr, { elements: values }),
+                    property: make_node(AST_Number, prop, { value: index }),
                 });
             }
         }
-        return self;
+        return try_evaluate(compressor, self);
+
+        function find_lambda() {
+            var i = 0, p;
+            while (p = compressor.parent(i++)) {
+                if (p instanceof AST_Lambda) {
+                    if (p instanceof AST_Accessor) return;
+                    if (is_arrow(p)) continue;
+                    fn_parent = compressor.parent(i);
+                    return p;
+                }
+            }
+        }
+
+        function has_reassigned() {
+            return !compressor.option("reduce_vars") || def.reassigned;
+        }
     });
 
-    OPT(AST_Dot, function(self, compressor){
-        var prop = self.property;
-        if (RESERVED_WORDS(prop) && !compressor.option("screw_ie8")) {
+    AST_LambdaExpression.DEFMETHOD("contains_super", function() {
+        var result = false;
+        var self = this;
+        self.walk(new TreeWalker(function(node) {
+            if (result) return true;
+            if (node instanceof AST_Super) return result = true;
+            if (node !== self && node instanceof AST_Scope && !is_arrow(node)) return true;
+        }));
+        return result;
+    });
+
+    // contains_this()
+    // returns false only if context bound by the specified scope (or scope
+    // containing the specified expression) is not referenced by `this`
+    (function(def) {
+        // scope of arrow function cannot bind to any context
+        def(AST_Arrow, return_false);
+        def(AST_AsyncArrow, return_false);
+        def(AST_Node, function() {
+            var result = false;
+            var self = this;
+            self.walk(new TreeWalker(function(node) {
+                if (result) return true;
+                if (node instanceof AST_This) return result = true;
+                if (node !== self && node instanceof AST_Scope && !is_arrow(node)) return true;
+            }));
+            return result;
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("contains_this", func);
+    });
+
+    function can_hoist_property(prop) {
+        return prop instanceof AST_ObjectKeyVal
+            && typeof prop.key == "string"
+            && !(prop instanceof AST_ObjectMethod && prop.value.contains_super());
+    }
+
+    AST_PropAccess.DEFMETHOD("flatten_object", function(key, compressor) {
+        if (!compressor.option("properties")) return;
+        if (key === "__proto__") return;
+        var self = this;
+        var expr = self.expression;
+        if (!(expr instanceof AST_Object)) return;
+        var props = expr.properties;
+        for (var i = props.length; --i >= 0;) {
+            var prop = props[i];
+            if (prop.key !== key) continue;
+            if (!all(props, can_hoist_property)) return;
+            if (!safe_to_flatten(prop.value, compressor)) return;
+            var call, scope, values = [];
+            for (var j = 0; j < props.length; j++) {
+                var value = props[j].value;
+                if (props[j] instanceof AST_ObjectMethod) {
+                    var arrow = !(value.uses_arguments || is_generator(value) || value.contains_this());
+                    if (arrow) {
+                        if (!scope) scope = compressor.find_parent(AST_Scope);
+                        var avoid = avoid_await_yield(compressor, scope);
+                        value.each_argname(function(argname) {
+                            if (avoid[argname.name]) arrow = false;
+                        });
+                    }
+                    var ctor;
+                    if (arrow) {
+                        ctor = is_async(value) ? AST_AsyncArrow : AST_Arrow;
+                    } else if (i != j
+                        || (call = compressor.parent()) instanceof AST_Call && call.expression === self) {
+                        ctor = value.CTOR;
+                    } else {
+                        return;
+                    }
+                    value = make_node(ctor, value);
+                }
+                values.push(value);
+            }
             return make_node(AST_Sub, self, {
-                expression : self.expression,
-                property   : make_node(AST_String, self, {
-                    value: prop
-                })
-            }).optimize(compressor);
+                expression: make_node(AST_Array, expr, { elements: values }),
+                property: make_node(AST_Number, self, { value: i }),
+            });
+        }
+    });
+
+    OPT(AST_Dot, function(self, compressor) {
+        if (self.property == "arguments" || self.property == "caller") {
+            AST_Node.warn("Function.prototype.{property} not supported [{start}]", self);
+        }
+        var parent = compressor.parent();
+        if (is_lhs(compressor.self(), parent)) return self;
+        var terminated = trim_optional_chain(self, compressor);
+        if (terminated) return terminated;
+        if (compressor.option("sequences")
+            && parent.TYPE != "Call"
+            && !(parent instanceof AST_ForEnumeration && parent.init === self)) {
+            var seq = lift_sequence_in_expression(self, compressor);
+            if (seq !== self) return seq.optimize(compressor);
+        }
+        if (compressor.option("unsafe_proto")
+            && self.expression instanceof AST_Dot
+            && self.expression.property == "prototype") {
+            var exp = self.expression.expression;
+            if (is_undeclared_ref(exp)) switch (exp.name) {
+              case "Array":
+                self.expression = make_node(AST_Array, self.expression, { elements: [] });
+                break;
+              case "Function":
+                self.expression = make_node(AST_Function, self.expression, {
+                    argnames: [],
+                    body: [],
+                }).init_vars(exp.scope);
+                break;
+              case "Number":
+                self.expression = make_node(AST_Number, self.expression, { value: 0 });
+                break;
+              case "Object":
+                self.expression = make_node(AST_Object, self.expression, { properties: [] });
+                break;
+              case "RegExp":
+                self.expression = make_node(AST_RegExp, self.expression, { value: /t/ });
+                break;
+              case "String":
+                self.expression = make_node(AST_String, self.expression, { value: "" });
+                break;
+            }
         }
-        return self.evaluate(compressor)[0];
+        var sub = self.flatten_object(self.property, compressor);
+        if (sub) return sub.optimize(compressor);
+        return try_evaluate(compressor, self);
     });
 
-    function literals_in_boolean_context(self, compressor) {
-        if (compressor.option("booleans") && compressor.in_boolean_context() && !self.has_side_effects(compressor)) {
-            return make_node(AST_True, self);
+    OPT(AST_DestructuredArray, function(self, compressor) {
+        if (compressor.option("rests") && self.rest instanceof AST_DestructuredArray) {
+            return make_node(AST_DestructuredArray, self, {
+                elements: self.elements.concat(self.rest.elements),
+                rest: self.rest.rest,
+            });
         }
         return self;
-    };
-    OPT(AST_Array, literals_in_boolean_context);
-    OPT(AST_Object, literals_in_boolean_context);
-    OPT(AST_RegExp, literals_in_boolean_context);
+    });
+
+    OPT(AST_DestructuredKeyVal, function(self, compressor) {
+        if (compressor.option("objects")) {
+            var key = self.key;
+            if (key instanceof AST_Node) {
+                key = key.evaluate(compressor);
+                if (key !== self.key) self.key = "" + key;
+            }
+        }
+        return self;
+    });
+
+    OPT(AST_Object, function(self, compressor) {
+        if (!compressor.option("objects")) return self;
+        var changed = false;
+        var found = false;
+        var generated = false;
+        var keep_duplicate = compressor.has_directive("use strict");
+        var keys = [];
+        var map = new Dictionary();
+        var values = [];
+        self.properties.forEach(function(prop) {
+            if (!(prop instanceof AST_Spread)) return process(prop);
+            found = true;
+            var exp = prop.expression;
+            if (compressor.option("spreads") && exp instanceof AST_Object && all(exp.properties, function(prop) {
+                if (prop instanceof AST_ObjectGetter) return false;
+                if (prop instanceof AST_Spread) return false;
+                if (prop.key !== "__proto__") return true;
+                if (prop instanceof AST_ObjectSetter) return true;
+                return !prop.value.has_side_effects(compressor);
+            })) {
+                changed = true;
+                exp.properties.forEach(function(prop) {
+                    var key = prop.key;
+                    var setter = prop instanceof AST_ObjectSetter;
+                    if (key === "__proto__") {
+                        if (!setter) return;
+                        key = make_node_from_constant(key, prop);
+                    }
+                    process(setter ? make_node(AST_ObjectKeyVal, prop, {
+                        key: key,
+                        value: make_node(AST_Undefined, prop).optimize(compressor),
+                    }) : prop);
+                });
+            } else {
+                generated = true;
+                flush();
+                values.push(prop);
+            }
+        });
+        flush();
+        if (!changed) return self;
+        if (found && generated && values.length == 1) {
+            var value = values[0];
+            if (value instanceof AST_ObjectProperty && value.key instanceof AST_Number) {
+                value.key = "" + value.key.value;
+            }
+        }
+        return make_node(AST_Object, self, { properties: values });
+
+        function flush() {
+            keys.forEach(function(key) {
+                var props = map.get(key);
+                switch (props.length) {
+                  case 0:
+                    return;
+                  case 1:
+                    return values.push(props[0]);
+                }
+                changed = true;
+                var tail = keep_duplicate && !generated && props.pop();
+                values.push(props.length == 1 ? props[0] : make_node(AST_ObjectKeyVal, self, {
+                    key: props[0].key,
+                    value: make_sequence(self, props.map(function(prop) {
+                        return prop.value;
+                    })),
+                }));
+                if (tail) values.push(tail);
+                props.length = 0;
+            });
+            keys = [];
+            map = new Dictionary();
+        }
+
+        function process(prop) {
+            var key = prop.key;
+            if (key instanceof AST_Node) {
+                found = true;
+                key = key.evaluate(compressor);
+                if (key === prop.key || key === "__proto__") {
+                    generated = true;
+                } else {
+                    key = prop.key = "" + key;
+                }
+            }
+            if (can_hoist_property(prop)) {
+                if (prop.value.has_side_effects(compressor)) flush();
+                keys.push(key);
+                map.add(key, prop);
+            } else {
+                flush();
+                values.push(prop);
+            }
+            if (found && !generated && typeof key == "string" && RE_POSITIVE_INTEGER.test(key)) {
+                generated = true;
+                if (map.has(key)) prop = map.get(key)[0];
+                prop.key = make_node(AST_Number, prop, { value: +key });
+            }
+        }
+    });
+
+    function flatten_var(name) {
+        var redef = name.definition().redefined();
+        if (redef) {
+            name = name.clone();
+            name.thedef = redef;
+        }
+        return name;
+    }
+
+    function has_arg_refs(fn, node) {
+        var found = false;
+        node.walk(new TreeWalker(function(node) {
+            if (found) return true;
+            if (node instanceof AST_SymbolRef && fn.variables.get(node.name) === node.definition()) {
+                return found = true;
+            }
+        }));
+        return found;
+    }
+
+    function insert_assign(def, assign) {
+        var visited = [];
+        def.references.forEach(function(ref) {
+            var fixed = ref.fixed;
+            if (!fixed || !push_uniq(visited, fixed)) return;
+            if (fixed.assigns) {
+                fixed.assigns.unshift(assign);
+            } else {
+                fixed.assigns = [ assign ];
+            }
+        });
+    }
+
+    function init_ref(compressor, name) {
+        var sym = make_node(AST_SymbolRef, name);
+        var assign = make_node(AST_Assign, name, {
+            operator: "=",
+            left: sym,
+            right: make_node(AST_Undefined, name).transform(compressor),
+        });
+        var def = name.definition();
+        if (def.fixed) {
+            sym.fixed = function() {
+                return assign.right;
+            };
+            sym.fixed.assigns = [ assign ];
+            insert_assign(def, assign);
+        }
+        def.assignments++;
+        def.references.push(sym);
+        return assign;
+    }
+
+    (function(def) {
+        def(AST_Node, noop);
+        def(AST_Assign, noop);
+        def(AST_Await, function(compressor, scope, no_return, in_loop) {
+            if (!compressor.option("awaits")) return;
+            var self = this;
+            var inlined = self.expression.try_inline(compressor, scope, no_return, in_loop, true);
+            if (!inlined) return;
+            if (!no_return) scan_local_returns(inlined, function(node) {
+                node.in_bool = false;
+                var value = node.value;
+                if (value instanceof AST_Await) return;
+                node.value = make_node(AST_Await, self, {
+                    expression: value || make_node(AST_Undefined, node).transform(compressor),
+                });
+            });
+            return aborts(inlined) ? inlined : make_node(AST_BlockStatement, self, {
+                body: [ inlined, make_node(AST_SimpleStatement, self, {
+                    body: make_node(AST_Await, self, { expression: make_node(AST_Number, self, { value: 0 })}),
+                }) ],
+            });
+        });
+        def(AST_Binary, function(compressor, scope, no_return, in_loop, in_await) {
+            if (no_return === undefined) return;
+            var self = this;
+            var op = self.operator;
+            if (!lazy_op[op]) return;
+            var inlined = self.right.try_inline(compressor, scope, no_return, in_loop, in_await);
+            if (!inlined) return;
+            return make_node(AST_If, self, {
+                condition: make_condition(self.left),
+                body: inlined,
+                alternative: no_return ? null : make_node(AST_Return, self, {
+                    value: make_node(AST_Undefined, self).transform(compressor),
+                }),
+            });
+
+            function make_condition(cond) {
+                switch (op) {
+                  case "&&":
+                    return cond;
+                  case "||":
+                    return cond.negate(compressor);
+                  case "??":
+                    return make_node(AST_Binary, self, {
+                        operator: "==",
+                        left: make_node(AST_Null, self),
+                        right: cond,
+                    });
+                }
+            }
+        });
+        def(AST_BlockStatement, function(compressor, scope, no_return, in_loop) {
+            if (no_return) return;
+            if (!this.variables) return;
+            var body = this.body;
+            var last = body.length - 1;
+            if (last < 0) return;
+            var inlined = body[last].try_inline(compressor, this, no_return, in_loop);
+            if (!inlined) return;
+            body[last] = inlined;
+            return this;
+        });
+        def(AST_Call, function(compressor, scope, no_return, in_loop, in_await) {
+            if (compressor.option("inline") < 4) return;
+            var call = this;
+            if (call.is_expr_pure(compressor)) return;
+            var fn = call.expression;
+            if (!(fn instanceof AST_LambdaExpression)) return;
+            if (fn.name) return;
+            if (fn.uses_arguments) return;
+            if (fn.pinned()) return;
+            if (is_generator(fn)) return;
+            var arrow = is_arrow(fn);
+            if (arrow && fn.value) return;
+            if (fn.body[0] instanceof AST_Directive) return;
+            if (fn.contains_this()) return;
+            if (!scope) scope = find_scope(compressor);
+            var defined = new Dictionary();
+            defined.set("NaN", true);
+            while (!(scope instanceof AST_Scope)) {
+                scope.variables.each(function(def) {
+                    defined.set(def.name, true);
+                });
+                scope = scope.parent_scope;
+            }
+            if (!member(scope, compressor.stack)) return;
+            if (scope.pinned() && fn.variables.size() > (arrow ? 0 : 1)) return;
+            if (scope instanceof AST_Toplevel) {
+                if (fn.variables.size() > (arrow ? 0 : 1)) {
+                    if (!compressor.toplevel.vars) return;
+                    if (fn.functions.size() > 0 && !compressor.toplevel.funcs) return;
+                }
+                defined.set("arguments", true);
+            }
+            var async = !in_await && is_async(fn);
+            if (async) {
+                if (!compressor.option("awaits")) return;
+                if (!is_async(scope)) return;
+                if (call.may_throw(compressor)) return;
+            }
+            var names = scope.var_names();
+            if (in_loop) in_loop = [];
+            if (!fn.variables.all(function(def, name) {
+                if (in_loop) in_loop.push(def);
+                if (!defined.has(name) && !names.has(name)) return true;
+                return !arrow && name == "arguments" && def.orig.length == 1;
+            })) return;
+            if (in_loop && in_loop.length > 0 && is_reachable(fn, in_loop)) return;
+            var simple_argnames = true;
+            if (!all(fn.argnames, function(argname) {
+                var abort = false;
+                var tw = new TreeWalker(function(node) {
+                    if (abort) return true;
+                    if (node instanceof AST_DefaultValue) {
+                        if (has_arg_refs(fn, node.value)) return abort = true;
+                        node.name.walk(tw);
+                        return true;
+                    }
+                    if (node instanceof AST_DestructuredKeyVal) {
+                        if (node.key instanceof AST_Node && has_arg_refs(fn, node.key)) return abort = true;
+                        node.value.walk(tw);
+                        return true;
+                    }
+                    if (node instanceof AST_SymbolFunarg && !all(node.definition().orig, function(sym) {
+                        return !(sym instanceof AST_SymbolDefun);
+                    })) return abort = true;
+                });
+                argname.walk(tw);
+                if (abort) return false;
+                if (!(argname instanceof AST_SymbolFunarg)) simple_argnames = false;
+                return true;
+            })) return;
+            if (fn.rest) {
+                if (has_arg_refs(fn, fn.rest)) return;
+                simple_argnames = false;
+            }
+            var verify_body;
+            if (no_return) {
+                verify_body = function(stat) {
+                    var abort = false;
+                    stat.walk(new TreeWalker(function(node) {
+                        if (abort) return true;
+                        if (async && (node instanceof AST_Await || node instanceof AST_ForAwaitOf)
+                            || node instanceof AST_Return) {
+                            return abort = true;
+                        }
+                        if (node instanceof AST_Scope) return true;
+                    }));
+                    return !abort;
+                };
+            } else if (in_await || is_async(fn) || in_async_generator(scope)) {
+                verify_body = function(stat) {
+                    var abort = false;
+                    var find_return = new TreeWalker(function(node) {
+                        if (abort) return true;
+                        if (node instanceof AST_Return) return abort = true;
+                        if (node instanceof AST_Scope) return true;
+                    });
+                    stat.walk(new TreeWalker(function(node) {
+                        if (abort) return true;
+                        if (node instanceof AST_Try) {
+                            if (node.bfinally && all(node.body, function(stat) {
+                                stat.walk(find_return);
+                                return !abort;
+                            }) && node.bcatch) node.bcatch.walk(find_return);
+                            return true;
+                        }
+                        if (node instanceof AST_Scope) return true;
+                    }));
+                    return !abort;
+                };
+            }
+            if (verify_body && !all(fn.body, verify_body)) return;
+            if (!safe_from_await_yield(fn, avoid_await_yield(compressor, scope))) return;
+            fn.functions.each(function(def, name) {
+                scope.functions.set(name, def);
+            });
+            var body = [];
+            fn.variables.each(function(def, name) {
+                if (!arrow && name == "arguments" && def.orig.length == 1) return;
+                names.set(name, true);
+                scope.enclosed.push(def);
+                scope.variables.set(name, def);
+                def.single_use = false;
+                if (!in_loop) return;
+                if (def.references.length == def.replaced) return;
+                if (def.orig.length == def.eliminated) return;
+                if (def.orig.length == 1 && fn.functions.has(name)) return;
+                if (!all(def.orig, function(sym) {
+                    if (sym instanceof AST_SymbolConst) return false;
+                    if (sym instanceof AST_SymbolFunarg) return !sym.unused && def.scope.resolve() !== fn;
+                    if (sym instanceof AST_SymbolLet) return false;
+                    return true;
+                })) return;
+                var sym = def.orig[0];
+                if (sym instanceof AST_SymbolCatch) return;
+                body.push(make_node(AST_SimpleStatement, sym, { body: init_ref(compressor, flatten_var(sym)) }));
+            });
+            var defs = Object.create(null), syms = new Dictionary();
+            if (simple_argnames && all(call.args, function(arg) {
+                return !(arg instanceof AST_Spread);
+            })) {
+                var values = call.args.slice();
+                fn.argnames.forEach(function(argname) {
+                    var value = values.shift();
+                    if (argname.unused) {
+                        if (value) body.push(make_node(AST_SimpleStatement, call, { body: value }));
+                        return;
+                    }
+                    var defn = make_node(AST_VarDef, call, {
+                        name: argname.convert_symbol(AST_SymbolVar, process),
+                        value: value || make_node(AST_Undefined, call).transform(compressor),
+                    });
+                    if (argname instanceof AST_SymbolFunarg) insert_assign(argname.definition(), defn);
+                    body.push(make_node(AST_Var, call, { definitions: [ defn ] }));
+                });
+                if (values.length) body.push(make_node(AST_SimpleStatement, call, {
+                    body: make_sequence(call, values),
+                }));
+            } else {
+                body.push(make_node(AST_Var, call, {
+                    definitions: [ make_node(AST_VarDef, call, {
+                        name: make_node(AST_DestructuredArray, call, {
+                            elements: fn.argnames.map(function(argname) {
+                                if (argname.unused) return make_node(AST_Hole, argname);
+                                return argname.convert_symbol(AST_SymbolVar, process);
+                            }),
+                            rest: fn.rest && fn.rest.convert_symbol(AST_SymbolVar, process),
+                        }),
+                        value: make_node(AST_Array, call, { elements: call.args.slice() }),
+                    }) ],
+                }));
+            }
+            syms.each(function(orig, id) {
+                var def = defs[id];
+                [].unshift.apply(def.orig, orig);
+                def.eliminated += orig.length;
+            });
+            [].push.apply(body, in_loop ? fn.body.filter(function(stat) {
+                if (!(stat instanceof AST_LambdaDefinition)) return true;
+                var name = make_node(AST_SymbolVar, flatten_var(stat.name));
+                var def = name.definition();
+                def.fixed = false;
+                def.orig.push(name);
+                def.eliminated++;
+                body.push(make_node(AST_Var, stat, {
+                    definitions: [ make_node(AST_VarDef, stat, {
+                        name: name,
+                        value: to_func_expr(stat, true),
+                    }) ],
+                }));
+                return false;
+            }) : fn.body);
+            var inlined = make_node(AST_BlockStatement, call, { body: body });
+            if (!no_return) {
+                if (async) scan_local_returns(inlined, function(node) {
+                    var value = node.value;
+                    if (is_undefined(value)) return;
+                    node.value = make_node(AST_Await, call, { expression: value });
+                });
+                body.push(make_node(AST_Return, call, {
+                    value: in_async_generator(scope) ? make_node(AST_Undefined, call).transform(compressor) : null,
+                }));
+            }
+            return inlined;
+
+            function process(sym, argname) {
+                var def = argname.definition();
+                defs[def.id] = def;
+                syms.add(def.id, sym);
+            }
+        });
+        def(AST_Conditional, function(compressor, scope, no_return, in_loop, in_await) {
+            var self = this;
+            var body = self.consequent.try_inline(compressor, scope, no_return, in_loop, in_await);
+            var alt = self.alternative.try_inline(compressor, scope, no_return, in_loop, in_await);
+            if (!body && !alt) return;
+            return make_node(AST_If, self, {
+                condition: self.condition,
+                body: body || make_body(self.consequent),
+                alternative: alt || make_body(self.alternative),
+            });
 
-})();
+            function make_body(value) {
+                if (no_return) return make_node(AST_SimpleStatement, value, { body: value });
+                return make_node(AST_Return, value, { value: value });
+            }
+        });
+        def(AST_For, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, true, true);
+            if (body) this.body = body;
+            var inlined = this.init;
+            if (inlined) {
+                inlined = inlined.try_inline(compressor, scope, true, in_loop);
+                if (inlined) {
+                    this.init = null;
+                    if (inlined instanceof AST_BlockStatement) {
+                        inlined.body.push(this);
+                        return inlined;
+                    }
+                    return make_node(AST_BlockStatement, inlined, { body: [ inlined, this ] });
+                }
+            }
+            return body && this;
+        });
+        def(AST_ForEnumeration, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, true, true);
+            if (body) this.body = body;
+            var obj = this.object;
+            if (obj instanceof AST_Sequence) {
+                var inlined = inline_sequence(compressor, scope, true, in_loop, false, obj, 1);
+                if (inlined) {
+                    this.object = obj.tail_node();
+                    inlined.body.push(this);
+                    return inlined;
+                }
+            }
+            return body && this;
+        });
+        def(AST_If, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, no_return, in_loop);
+            if (body) this.body = body;
+            var alt = this.alternative;
+            if (alt) {
+                alt = alt.try_inline(compressor, scope, no_return, in_loop);
+                if (alt) this.alternative = alt;
+            }
+            var cond = this.condition;
+            if (cond instanceof AST_Sequence) {
+                var inlined = inline_sequence(compressor, scope, true, in_loop, false, cond, 1);
+                if (inlined) {
+                    this.condition = cond.tail_node();
+                    inlined.body.push(this);
+                    return inlined;
+                }
+            }
+            return (body || alt) && this;
+        });
+        def(AST_IterationStatement, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, true, true);
+            if (!body) return;
+            this.body = body;
+            return this;
+        });
+        def(AST_LabeledStatement, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, no_return, in_loop);
+            if (!body) return;
+            if (this.body instanceof AST_IterationStatement && body instanceof AST_BlockStatement) {
+                var loop = body.body.pop();
+                this.body = loop;
+                body.body.push(this);
+                return body;
+            }
+            this.body = body;
+            return this;
+        });
+        def(AST_New, noop);
+        def(AST_Return, function(compressor, scope, no_return, in_loop) {
+            var value = this.value;
+            return value && value.try_inline(compressor, scope, undefined, in_loop === "try");
+        });
+        function inline_sequence(compressor, scope, no_return, in_loop, in_await, node, skip) {
+            var body = [], exprs = node.expressions, no_ret = no_return;
+            for (var i = exprs.length - (skip || 0), j = i; --i >= 0; no_ret = true, in_await = false) {
+                var inlined = exprs[i].try_inline(compressor, scope, no_ret, in_loop, in_await);
+                if (!inlined) continue;
+                flush();
+                body.push(inlined);
+            }
+            if (body.length == 0) return;
+            flush();
+            if (!no_return && body[0] instanceof AST_SimpleStatement) {
+                body[0] = make_node(AST_Return, node, { value: body[0].body });
+            }
+            return make_node(AST_BlockStatement, node, { body: body.reverse() });
+
+            function flush() {
+                if (j > i + 1) body.push(make_node(AST_SimpleStatement, node, {
+                    body: make_sequence(node, exprs.slice(i + 1, j)),
+                }));
+                j = i;
+            }
+        }
+        def(AST_Sequence, function(compressor, scope, no_return, in_loop, in_await) {
+            return inline_sequence(compressor, scope, no_return, in_loop, in_await, this);
+        });
+        def(AST_SimpleStatement, function(compressor, scope, no_return, in_loop) {
+            var body = this.body;
+            while (body instanceof AST_UnaryPrefix) {
+                var op = body.operator;
+                if (unary_side_effects[op]) break;
+                if (op == "void") break;
+                body = body.expression;
+            }
+            if (!no_return && !is_undefined(body)) body = make_node(AST_UnaryPrefix, this, {
+                operator: "void",
+                expression: body,
+            });
+            return body.try_inline(compressor, scope, no_return || false, in_loop);
+        });
+        def(AST_UnaryPrefix, function(compressor, scope, no_return, in_loop, in_await) {
+            var self = this;
+            var op = self.operator;
+            if (unary_side_effects[op]) return;
+            if (!no_return && op == "void") no_return = false;
+            var inlined = self.expression.try_inline(compressor, scope, no_return, in_loop, in_await);
+            if (!inlined) return;
+            if (!no_return) scan_local_returns(inlined, function(node) {
+                node.in_bool = false;
+                var value = node.value;
+                if (op == "void" && is_undefined(value)) return;
+                node.value = make_node(AST_UnaryPrefix, self, {
+                    operator: op,
+                    expression: value || make_node(AST_Undefined, node).transform(compressor),
+                });
+            });
+            return inlined;
+        });
+        def(AST_With, function(compressor, scope, no_return, in_loop) {
+            var body = this.body.try_inline(compressor, scope, no_return, in_loop);
+            if (body) this.body = body;
+            var exp = this.expression;
+            if (exp instanceof AST_Sequence) {
+                var inlined = inline_sequence(compressor, scope, true, in_loop, false, exp, 1);
+                if (inlined) {
+                    this.expression = exp.tail_node();
+                    inlined.body.push(this);
+                    return inlined;
+                }
+            }
+            return body && this;
+        });
+        def(AST_Yield, function(compressor, scope, no_return, in_loop) {
+            if (!compressor.option("yields")) return;
+            if (!this.nested) return;
+            var call = this.expression;
+            if (call.TYPE != "Call") return;
+            var fn = call.expression;
+            switch (fn.CTOR) {
+              case AST_AsyncGeneratorFunction:
+                fn = make_node(AST_AsyncFunction, fn);
+                break;
+              case AST_GeneratorFunction:
+                fn = make_node(AST_Function, fn);
+                break;
+              default:
+                return;
+            }
+            call = call.clone();
+            call.expression = fn;
+            return call.try_inline(compressor, scope, no_return, in_loop);
+        });
+    })(function(node, func) {
+        node.DEFMETHOD("try_inline", func);
+    });
+
+    OPT(AST_Return, function(self, compressor) {
+        var value = self.value;
+        if (value && compressor.option("side_effects")
+            && is_undefined(value, compressor)
+            && !in_async_generator(compressor.find_parent(AST_Scope))) {
+            self.value = null;
+        }
+        return self;
+    });
+})(function(node, optimizer) {
+    node.DEFMETHOD("optimize", function(compressor) {
+        var self = this;
+        if (self._optimized) return self;
+        if (compressor.has_directive("use asm")) return self;
+        var opt = optimizer(self, compressor);
+        opt._optimized = true;
+        return opt;
+    });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/mozilla-ast.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/mozilla-ast.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/mozilla-ast.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,22 +43,175 @@
 
 "use strict";
 
-(function(){
-
+(function() {
     var MOZ_TO_ME = {
-        ExpressionStatement: function(M) {
-            var expr = M.expression;
-            if (expr.type === "Literal" && typeof expr.value === "string") {
-                return new AST_Directive({
-                    start: my_start_token(M),
-                    end: my_end_token(M),
-                    value: expr.value
-                });
+        Program: function(M) {
+            return new AST_Toplevel({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                body: normalize_directives(M.body.map(from_moz)),
+            });
+        },
+        ArrowFunctionExpression: function(M) {
+            var argnames = [], rest = null;
+            M.params.forEach(function(param) {
+                if (param.type == "RestElement") {
+                    rest = from_moz(param.argument);
+                } else {
+                    argnames.push(from_moz(param));
+                }
+            });
+            var fn = new (M.async ? AST_AsyncArrow : AST_Arrow)({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                argnames: argnames,
+                rest: rest,
+            });
+            var node = from_moz(M.body);
+            if (node instanceof AST_BlockStatement) {
+                fn.body = normalize_directives(node.body);
+                fn.value = null;
+            } else {
+                fn.body = [];
+                fn.value = node;
+            }
+            return fn;
+        },
+        FunctionDeclaration: function(M) {
+            var ctor;
+            if (M.async) {
+                ctor = M.generator ? AST_AsyncGeneratorDefun : AST_AsyncDefun;
+            } else {
+                ctor = M.generator ? AST_GeneratorDefun : AST_Defun;
+            }
+            var argnames = [], rest = null;
+            M.params.forEach(function(param) {
+                if (param.type == "RestElement") {
+                    rest = from_moz(param.argument);
+                } else {
+                    argnames.push(from_moz(param));
+                }
+            });
+            return new ctor({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: from_moz(M.id),
+                argnames: argnames,
+                rest: rest,
+                body: normalize_directives(from_moz(M.body).body),
+            });
+        },
+        FunctionExpression: function(M) {
+            var ctor;
+            if (M.async) {
+                ctor = M.generator ? AST_AsyncGeneratorFunction : AST_AsyncFunction;
+            } else {
+                ctor = M.generator ? AST_GeneratorFunction : AST_Function;
+            }
+            var argnames = [], rest = null;
+            M.params.forEach(function(param) {
+                if (param.type == "RestElement") {
+                    rest = from_moz(param.argument);
+                } else {
+                    argnames.push(from_moz(param));
+                }
+            });
+            return new ctor({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: from_moz(M.id),
+                argnames: argnames,
+                rest: rest,
+                body: normalize_directives(from_moz(M.body).body),
+            });
+        },
+        ClassDeclaration: function(M) {
+            return new AST_DefClass({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: from_moz(M.id),
+                extends: from_moz(M.superClass),
+                properties: M.body.body.map(from_moz),
+            });
+        },
+        ClassExpression: function(M) {
+            return new AST_ClassExpression({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: from_moz(M.id),
+                extends: from_moz(M.superClass),
+                properties: M.body.body.map(from_moz),
+            });
+        },
+        MethodDefinition: function(M) {
+            var key = M.key, internal = false;
+            if (M.computed) {
+                key = from_moz(key);
+            } else if (key.type == "PrivateIdentifier") {
+                internal = true;
+                key = "#" + key.name;
+            } else {
+                key = read_name(key);
+            }
+            var ctor = AST_ClassMethod, value = from_moz(M.value);
+            switch (M.kind) {
+              case "get":
+                ctor = AST_ClassGetter;
+                value = new AST_Accessor(value);
+                break;
+              case "set":
+                ctor = AST_ClassSetter;
+                value = new AST_Accessor(value);
+                break;
+            }
+            return new ctor({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                key: key,
+                private: internal,
+                static: M.static,
+                value: value,
+            });
+        },
+        PropertyDefinition: function(M) {
+            var key = M.key, internal = false;
+            if (M.computed) {
+                key = from_moz(key);
+            } else if (key.type == "PrivateIdentifier") {
+                internal = true;
+                key = "#" + key.name;
+            } else {
+                key = read_name(key);
             }
-            return new AST_SimpleStatement({
+            return new AST_ClassField({
                 start: my_start_token(M),
                 end: my_end_token(M),
-                body: from_moz(expr)
+                key: key,
+                private: internal,
+                static: M.static,
+                value: from_moz(M.value),
+            });
+        },
+        StaticBlock: function(M) {
+            var start = my_start_token(M);
+            var end = my_end_token(M);
+            return new AST_ClassInit({
+                start: start,
+                end: end,
+                value: new AST_ClassInitBlock({
+                    start: start,
+                    end: end,
+                    body: normalize_directives(M.body.map(from_moz)),
+                }),
+            });
+        },
+        ForOfStatement: function(M) {
+            return new (M.await ? AST_ForAwaitOf : AST_ForOf)({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                init: from_moz(M.left),
+                object: from_moz(M.right),
+                body: from_moz(M.body),
             });
         },
         TryStatement: function(M) {
@@ -71,48 +224,87 @@
                 end      : my_end_token(M),
                 body     : from_moz(M.block).body,
                 bcatch   : from_moz(handlers[0]),
-                bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null
+                bfinally : M.finalizer ? new AST_Finally(from_moz(M.finalizer)) : null,
             });
         },
         Property: function(M) {
-            var key = M.key;
-            var name = key.type == "Identifier" ? key.name : key.value;
+            var key = M.computed ? from_moz(M.key) : read_name(M.key);
             var args = {
-                start    : my_start_token(key),
-                end      : my_end_token(M.value),
-                key      : name,
-                value    : from_moz(M.value)
+                start: my_start_token(M),
+                end: my_end_token(M),
+                key: key,
+                value: from_moz(M.value),
             };
-            switch (M.kind) {
-              case "init":
-                return new AST_ObjectKeyVal(args);
-              case "set":
-                args.value.name = from_moz(key);
-                return new AST_ObjectSetter(args);
-              case "get":
-                args.value.name = from_moz(key);
-                return new AST_ObjectGetter(args);
-            }
+            if (M.kind == "init") return new (M.method ? AST_ObjectMethod : AST_ObjectKeyVal)(args);
+            args.value = new AST_Accessor(args.value);
+            if (M.kind == "get") return new AST_ObjectGetter(args);
+            if (M.kind == "set") return new AST_ObjectSetter(args);
         },
-        ObjectExpression: function(M) {
-            return new AST_Object({
-                start      : my_start_token(M),
-                end        : my_end_token(M),
-                properties : M.properties.map(function(prop){
-                    prop.type = "Property";
-                    return from_moz(prop)
-                })
+        ArrayExpression: function(M) {
+            return new AST_Array({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                elements: M.elements.map(function(elem) {
+                    return elem === null ? new AST_Hole() : from_moz(elem);
+                }),
+            });
+        },
+        ArrayPattern: function(M) {
+            var elements = [], rest = null;
+            M.elements.forEach(function(el) {
+                if (el === null) {
+                    elements.push(new AST_Hole());
+                } else if (el.type == "RestElement") {
+                    rest = from_moz(el.argument);
+                } else {
+                    elements.push(from_moz(el));
+                }
+            });
+            return new AST_DestructuredArray({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                elements: elements,
+                rest: rest,
             });
         },
-        SequenceExpression: function(M) {
-            return AST_Seq.from_array(M.expressions.map(from_moz));
+        ObjectPattern: function(M) {
+            var props = [], rest = null;
+            M.properties.forEach(function(prop) {
+                if (prop.type == "RestElement") {
+                    rest = from_moz(prop.argument);
+                } else {
+                    props.push(new AST_DestructuredKeyVal(from_moz(prop)));
+                }
+            });
+            return new AST_DestructuredObject({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                properties: props,
+                rest: rest,
+            });
         },
         MemberExpression: function(M) {
             return new (M.computed ? AST_Sub : AST_Dot)({
-                start      : my_start_token(M),
-                end        : my_end_token(M),
-                property   : M.computed ? from_moz(M.property) : M.property.name,
-                expression : from_moz(M.object)
+                start: my_start_token(M),
+                end: my_end_token(M),
+                optional: M.optional,
+                expression: from_moz(M.object),
+                property: M.computed ? from_moz(M.property) : M.property.name,
+            });
+        },
+        MetaProperty: function(M) {
+            var expr = from_moz(M.meta);
+            var prop = read_name(M.property);
+            if (expr.name == "new" && prop == "target") return new AST_NewTarget({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: "new.target",
+            });
+            return new AST_Dot({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                expression: expr,
+                property: prop,
             });
         },
         SwitchCase: function(M) {
@@ -120,50 +312,286 @@
                 start      : my_start_token(M),
                 end        : my_end_token(M),
                 expression : from_moz(M.test),
-                body       : M.consequent.map(from_moz)
+                body       : M.consequent.map(from_moz),
+            });
+        },
+        ExportAllDeclaration: function(M) {
+            var start = my_start_token(M);
+            var end = my_end_token(M);
+            return new AST_ExportForeign({
+                start: start,
+                end: end,
+                aliases: [ M.exported ? from_moz_alias(M.exported) : new AST_String({
+                    start: start,
+                    value: "*",
+                    end: end,
+                }) ],
+                keys: [ new AST_String({
+                    start: start,
+                    value: "*",
+                    end: end,
+                }) ],
+                path: from_moz(M.source),
+            });
+        },
+        ExportDefaultDeclaration: function(M) {
+            var decl = from_moz(M.declaration);
+            if (!decl.name) switch (decl.CTOR) {
+              case AST_AsyncDefun:
+                decl = new AST_AsyncFunction(decl);
+                break;
+              case AST_AsyncGeneratorDefun:
+                decl = new AST_AsyncGeneratorFunction(decl);
+                break;
+              case AST_DefClass:
+                decl = new AST_ClassExpression(decl);
+                break;
+              case AST_Defun:
+                decl = new AST_Function(decl);
+                break;
+              case AST_GeneratorDefun:
+                decl = new AST_GeneratorFunction(decl);
+                break;
+            }
+            return new AST_ExportDefault({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                body: decl,
+            });
+        },
+        ExportNamedDeclaration: function(M) {
+            if (M.declaration) return new AST_ExportDeclaration({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                body: from_moz(M.declaration),
+            });
+            if (M.source) {
+                var aliases = [], keys = [];
+                M.specifiers.forEach(function(prop) {
+                    aliases.push(from_moz_alias(prop.exported));
+                    keys.push(from_moz_alias(prop.local));
+                });
+                return new AST_ExportForeign({
+                    start: my_start_token(M),
+                    end: my_end_token(M),
+                    aliases: aliases,
+                    keys: keys,
+                    path: from_moz(M.source),
+                });
+            }
+            return new AST_ExportReferences({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                properties: M.specifiers.map(function(prop) {
+                    var sym = new AST_SymbolExport(from_moz(prop.local));
+                    sym.alias = from_moz_alias(prop.exported);
+                    return sym;
+                }),
+            });
+        },
+        ImportDeclaration: function(M) {
+            var start = my_start_token(M);
+            var end = my_end_token(M);
+            var all = null, def = null, props = null;
+            M.specifiers.forEach(function(prop) {
+                var sym = new AST_SymbolImport(from_moz(prop.local));
+                switch (prop.type) {
+                  case "ImportDefaultSpecifier":
+                    def = sym;
+                    def.key = new AST_String({
+                        start: start,
+                        value: "",
+                        end: end,
+                    });
+                    break;
+                  case "ImportNamespaceSpecifier":
+                    all = sym;
+                    all.key = new AST_String({
+                        start: start,
+                        value: "*",
+                        end: end,
+                    });
+                    break;
+                  default:
+                    sym.key = from_moz_alias(prop.imported);
+                    if (!props) props = [];
+                    props.push(sym);
+                    break;
+                }
+            });
+            return new AST_Import({
+                start: start,
+                end: end,
+                all: all,
+                default: def,
+                properties: props,
+                path: from_moz(M.source),
+            });
+        },
+        ImportExpression: function(M) {
+            var start = my_start_token(M);
+            var arg = from_moz(M.source);
+            return new AST_Call({
+                start: start,
+                end: my_end_token(M),
+                expression: new AST_SymbolRef({
+                    start: start,
+                    end: arg.start,
+                    name: "import",
+                }),
+                args: [ arg ],
             });
         },
         VariableDeclaration: function(M) {
-            return new (M.kind === "const" ? AST_Const : AST_Var)({
-                start       : my_start_token(M),
-                end         : my_end_token(M),
-                definitions : M.declarations.map(from_moz)
+            return new ({
+                const: AST_Const,
+                let: AST_Let,
+            }[M.kind] || AST_Var)({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                definitions: M.declarations.map(from_moz),
             });
         },
         Literal: function(M) {
-            var val = M.value, args = {
-                start  : my_start_token(M),
-                end    : my_end_token(M)
+            var args = {
+                start: my_start_token(M),
+                end: my_end_token(M),
             };
+            if (M.bigint) {
+                args.value = M.bigint.toLowerCase() + "n";
+                return new AST_BigInt(args);
+            }
+            var val = M.value;
             if (val === null) return new AST_Null(args);
+            var rx = M.regex;
+            if (rx && rx.pattern) {
+                // RegExpLiteral as per ESTree AST spec
+                args.value = new RegExp(rx.pattern, rx.flags);
+                args.value.raw_source = rx.pattern;
+                return new AST_RegExp(args);
+            } else if (rx) {
+                // support legacy RegExp
+                args.value = M.regex && M.raw ? M.raw : val;
+                return new AST_RegExp(args);
+            }
             switch (typeof val) {
               case "string":
                 args.value = val;
                 return new AST_String(args);
               case "number":
-                args.value = val;
-                return new AST_Number(args);
+                if (isNaN(val)) return new AST_NaN(args);
+                var negate, node;
+                if (isFinite(val)) {
+                    negate = 1 / val < 0;
+                    args.value = negate ? -val : val;
+                    node = new AST_Number(args);
+                } else {
+                    negate = val < 0;
+                    node = new AST_Infinity(args);
+                }
+                return negate ? new AST_UnaryPrefix({
+                    start: args.start,
+                    end: args.end,
+                    operator: "-",
+                    expression: node,
+                }) : node;
               case "boolean":
                 return new (val ? AST_True : AST_False)(args);
-              default:
-                args.value = val;
-                return new AST_RegExp(args);
             }
         },
+        TemplateLiteral: function(M) {
+            return new AST_Template({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                expressions: M.expressions.map(from_moz),
+                strings: M.quasis.map(function(el) {
+                    return el.value.raw;
+                }),
+            });
+        },
+        TaggedTemplateExpression: function(M) {
+            var tmpl = from_moz(M.quasi);
+            tmpl.start = my_start_token(M);
+            tmpl.end = my_end_token(M);
+            tmpl.tag = from_moz(M.tag);
+            return tmpl;
+        },
         Identifier: function(M) {
-            var p = FROM_MOZ_STACK[FROM_MOZ_STACK.length - 2];
-            return new (  p.type == "LabeledStatement" ? AST_Label
-                        : p.type == "VariableDeclarator" && p.id === M ? (p.kind == "const" ? AST_SymbolConst : AST_SymbolVar)
-                        : p.type == "FunctionExpression" ? (p.id === M ? AST_SymbolLambda : AST_SymbolFunarg)
-                        : p.type == "FunctionDeclaration" ? (p.id === M ? AST_SymbolDefun : AST_SymbolFunarg)
-                        : p.type == "CatchClause" ? AST_SymbolCatch
-                        : p.type == "BreakStatement" || p.type == "ContinueStatement" ? AST_LabelRef
-                        : AST_SymbolRef)({
-                            start : my_start_token(M),
-                            end   : my_end_token(M),
-                            name  : M.name
-                        });
-        }
+            var p, level = FROM_MOZ_STACK.length - 1;
+            do {
+                p = FROM_MOZ_STACK[--level];
+            } while (p.type == "ArrayPattern"
+                || p.type == "AssignmentPattern" && p.left === FROM_MOZ_STACK[level + 1]
+                || p.type == "ObjectPattern"
+                || p.type == "Property" && p.value === FROM_MOZ_STACK[level + 1]
+                || p.type == "VariableDeclarator" && p.id === FROM_MOZ_STACK[level + 1]);
+            var ctor = AST_SymbolRef;
+            switch (p.type) {
+              case "ArrowFunctionExpression":
+                if (p.body !== FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolFunarg;
+                break;
+              case "BreakStatement":
+              case "ContinueStatement":
+                ctor = AST_LabelRef;
+                break;
+              case "CatchClause":
+                ctor = AST_SymbolCatch;
+                break;
+              case "ClassDeclaration":
+                if (p.id === FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolDefClass;
+                break;
+              case "ClassExpression":
+                if (p.id === FROM_MOZ_STACK[level + 1]) ctor = AST_SymbolClass;
+                break;
+              case "FunctionDeclaration":
+                ctor = p.id === FROM_MOZ_STACK[level + 1] ? AST_SymbolDefun : AST_SymbolFunarg;
+                break;
+              case "FunctionExpression":
+                ctor = p.id === FROM_MOZ_STACK[level + 1] ? AST_SymbolLambda : AST_SymbolFunarg;
+                break;
+              case "LabeledStatement":
+                ctor = AST_Label;
+                break;
+              case "VariableDeclaration":
+                ctor = {
+                    const: AST_SymbolConst,
+                    let: AST_SymbolLet,
+                }[p.kind] || AST_SymbolVar;
+                break;
+            }
+            return new ctor({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: M.name,
+            });
+        },
+        Super: function(M) {
+            return new AST_Super({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: "super",
+            });
+        },
+        ThisExpression: function(M) {
+            return new AST_This({
+                start: my_start_token(M),
+                end: my_end_token(M),
+                name: "this",
+            });
+        },
+        ParenthesizedExpression: function(M) {
+            var node = from_moz(M.expression);
+            if (!node.start.parens) node.start.parens = [];
+            node.start.parens.push(my_start_token(M));
+            if (!node.end.parens) node.end.parens = [];
+            node.end.parens.push(my_end_token(M));
+            return node;
+        },
+        ChainExpression: function(M) {
+            var node = from_moz(M.expression);
+            node.terminal = true;
+            return node;
+        },
     };
 
     MOZ_TO_ME.UpdateExpression =
@@ -178,8 +606,8 @@
         });
     };
 
-    map("Program", AST_Toplevel, "body@body");
     map("EmptyStatement", AST_EmptyStatement);
+    map("ExpressionStatement", AST_SimpleStatement, "expression>body");
     map("BlockStatement", AST_BlockStatement, "body@body");
     map("IfStatement", AST_If, "test>condition, consequent>body, alternate>alternative");
     map("LabeledStatement", AST_LabeledStatement, "label>label, body>body");
@@ -194,34 +622,155 @@
     map("ForStatement", AST_For, "init>init, test>condition, update>step, body>body");
     map("ForInStatement", AST_ForIn, "left>init, right>object, body>body");
     map("DebuggerStatement", AST_Debugger);
-    map("FunctionDeclaration", AST_Defun, "id>name, params@argnames, body%body");
     map("VariableDeclarator", AST_VarDef, "id>name, init>value");
     map("CatchClause", AST_Catch, "param>argname, body%body");
 
-    map("ThisExpression", AST_This);
-    map("ArrayExpression", AST_Array, "elements@elements");
-    map("FunctionExpression", AST_Function, "id>name, params@argnames, body%body");
     map("BinaryExpression", AST_Binary, "operator=operator, left>left, right>right");
     map("LogicalExpression", AST_Binary, "operator=operator, left>left, right>right");
     map("AssignmentExpression", AST_Assign, "operator=operator, left>left, right>right");
+    map("AssignmentPattern", AST_DefaultValue, "left>name, right>value");
     map("ConditionalExpression", AST_Conditional, "test>condition, consequent>consequent, alternate>alternative");
-    map("NewExpression", AST_New, "callee>expression, arguments@args");
-    map("CallExpression", AST_Call, "callee>expression, arguments@args");
+    map("NewExpression", AST_New, "callee>expression, arguments@args, pure=pure");
+    map("CallExpression", AST_Call, "callee>expression, arguments@args, optional=optional, pure=pure");
+    map("SequenceExpression", AST_Sequence, "expressions@expressions");
+    map("SpreadElement", AST_Spread, "argument>expression");
+    map("ObjectExpression", AST_Object, "properties@properties");
+    map("AwaitExpression", AST_Await, "argument>expression");
+    map("YieldExpression", AST_Yield, "argument>expression, delegate=nested");
 
-    def_to_moz(AST_Directive, function To_Moz_Directive(M) {
+    def_to_moz(AST_Toplevel, function To_Moz_Program(M) {
+        return to_moz_scope("Program", M);
+    });
+
+    def_to_moz(AST_LambdaDefinition, function To_Moz_FunctionDeclaration(M) {
+        var params = M.argnames.map(to_moz);
+        if (M.rest) params.push({
+            type: "RestElement",
+            argument: to_moz(M.rest),
+        });
         return {
-            type: "ExpressionStatement",
-            expression: {
+            type: "FunctionDeclaration",
+            id: to_moz(M.name),
+            async: is_async(M),
+            generator: is_generator(M),
+            params: params,
+            body: to_moz_scope("BlockStatement", M),
+        };
+    });
+
+    def_to_moz(AST_Lambda, function To_Moz_FunctionExpression(M) {
+        var params = M.argnames.map(to_moz);
+        if (M.rest) params.push({
+            type: "RestElement",
+            argument: to_moz(M.rest),
+        });
+        if (is_arrow(M)) return {
+            type: "ArrowFunctionExpression",
+            async: is_async(M),
+            params: params,
+            body: M.value ? to_moz(M.value) : to_moz_scope("BlockStatement", M),
+        };
+        return {
+            type: "FunctionExpression",
+            id: to_moz(M.name),
+            async: is_async(M),
+            generator: is_generator(M),
+            params: params,
+            body: to_moz_scope("BlockStatement", M),
+        };
+    });
+
+    def_to_moz(AST_DefClass, function To_Moz_ClassDeclaration(M) {
+        return {
+            type: "ClassDeclaration",
+            id: to_moz(M.name),
+            superClass: to_moz(M.extends),
+            body: {
+                type: "ClassBody",
+                body: M.properties.map(to_moz),
+            },
+        };
+    });
+
+    def_to_moz(AST_ClassExpression, function To_Moz_ClassExpression(M) {
+        return {
+            type: "ClassExpression",
+            id: to_moz(M.name),
+            superClass: to_moz(M.extends),
+            body: {
+                type: "ClassBody",
+                body: M.properties.map(to_moz),
+            },
+        };
+    });
+
+    function To_Moz_MethodDefinition(kind) {
+        return function(M) {
+            var computed = M.key instanceof AST_Node;
+            var key = computed ? to_moz(M.key) : M.private ? {
+                type: "PrivateIdentifier",
+                name: M.key.slice(1),
+            } : {
                 type: "Literal",
-                value: M.value
-            }
+                value: M.key,
+            };
+            return {
+                type: "MethodDefinition",
+                kind: kind,
+                computed: computed,
+                key: key,
+                static: M.static,
+                value: to_moz(M.value),
+            };
+        };
+    }
+    def_to_moz(AST_ClassGetter, To_Moz_MethodDefinition("get"));
+    def_to_moz(AST_ClassSetter, To_Moz_MethodDefinition("set"));
+    def_to_moz(AST_ClassMethod, To_Moz_MethodDefinition("method"));
+
+    def_to_moz(AST_ClassField, function To_Moz_PropertyDefinition(M) {
+        var computed = M.key instanceof AST_Node;
+        var key = computed ? to_moz(M.key) : M.private ? {
+            type: "PrivateIdentifier",
+            name: M.key.slice(1),
+        } : {
+            type: "Literal",
+            value: M.key,
         };
+        return {
+            type: "PropertyDefinition",
+            computed: computed,
+            key: key,
+            static: M.static,
+            value: to_moz(M.value),
+        };
+    });
+
+    def_to_moz(AST_ClassInit, function To_Moz_StaticBlock(M) {
+        return to_moz_scope("StaticBlock", M.value);
     });
 
-    def_to_moz(AST_SimpleStatement, function To_Moz_ExpressionStatement(M) {
+    function To_Moz_ForOfStatement(is_await) {
+        return function(M) {
+            return {
+                type: "ForOfStatement",
+                await: is_await,
+                left: to_moz(M.init),
+                right: to_moz(M.object),
+                body: to_moz(M.body),
+            };
+        };
+    }
+    def_to_moz(AST_ForAwaitOf, To_Moz_ForOfStatement(true));
+    def_to_moz(AST_ForOf, To_Moz_ForOfStatement(false));
+
+    def_to_moz(AST_Directive, function To_Moz_Directive(M) {
         return {
             type: "ExpressionStatement",
-            expression: to_moz(M.body)
+            expression: set_moz_loc(M, {
+                type: "Literal",
+                value: M.value,
+            }),
         };
     });
 
@@ -229,7 +778,7 @@
         return {
             type: "SwitchCase",
             test: to_moz(M.expression),
-            consequent: M.body.map(to_moz)
+            consequent: M.body.map(to_moz),
         };
     });
 
@@ -239,7 +788,7 @@
             block: to_moz_block(M),
             handler: to_moz(M.bcatch),
             guardedHandlers: [],
-            finalizer: to_moz(M.bfinally)
+            finalizer: to_moz(M.bfinally),
         };
     });
 
@@ -248,33 +797,114 @@
             type: "CatchClause",
             param: to_moz(M.argname),
             guard: null,
-            body: to_moz_block(M)
+            body: to_moz_block(M),
         };
     });
 
-    def_to_moz(AST_Definitions, function To_Moz_VariableDeclaration(M) {
+    def_to_moz(AST_ExportDeclaration, function To_Moz_ExportNamedDeclaration_declaration(M) {
         return {
-            type: "VariableDeclaration",
-            kind: M instanceof AST_Const ? "const" : "var",
-            declarations: M.definitions.map(to_moz)
+            type: "ExportNamedDeclaration",
+            declaration: to_moz(M.body),
         };
     });
 
-    def_to_moz(AST_Seq, function To_Moz_SequenceExpression(M) {
+    def_to_moz(AST_ExportDefault, function To_Moz_ExportDefaultDeclaration(M) {
         return {
-            type: "SequenceExpression",
-            expressions: M.to_array().map(to_moz)
+            type: "ExportDefaultDeclaration",
+            declaration: to_moz(M.body),
         };
     });
 
-    def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) {
-        var isComputed = M instanceof AST_Sub;
+    def_to_moz(AST_ExportForeign, function To_Moz_ExportAllDeclaration_ExportNamedDeclaration(M) {
+        if (M.keys[0].value == "*") return {
+            type: "ExportAllDeclaration",
+            exported: M.aliases[0].value == "*" ? null : to_moz_alias(M.aliases[0]),
+            source: to_moz(M.path),
+        };
+        var specifiers = [];
+        for (var i = 0; i < M.aliases.length; i++) {
+            specifiers.push(set_moz_loc({
+                start: M.keys[i].start,
+                end: M.aliases[i].end,
+            }, {
+                type: "ExportSpecifier",
+                local: to_moz_alias(M.keys[i]),
+                exported: to_moz_alias(M.aliases[i]),
+            }));
+        }
+        return {
+            type: "ExportNamedDeclaration",
+            specifiers: specifiers,
+            source: to_moz(M.path),
+        };
+    });
+
+    def_to_moz(AST_ExportReferences, function To_Moz_ExportNamedDeclaration_specifiers(M) {
+        return {
+            type: "ExportNamedDeclaration",
+            specifiers: M.properties.map(function(prop) {
+                return set_moz_loc({
+                    start: prop.start,
+                    end: prop.alias.end,
+                }, {
+                    type: "ExportSpecifier",
+                    local: to_moz(prop),
+                    exported: to_moz_alias(prop.alias),
+                });
+            }),
+        };
+    });
+
+    def_to_moz(AST_Import, function To_Moz_ImportDeclaration(M) {
+        var specifiers = M.properties ? M.properties.map(function(prop) {
+            return set_moz_loc({
+                start: prop.key.start,
+                end: prop.end,
+            }, {
+                type: "ImportSpecifier",
+                local: to_moz(prop),
+                imported: to_moz_alias(prop.key),
+            });
+        }) : [];
+        if (M.all) specifiers.unshift(set_moz_loc(M.all, {
+            type: "ImportNamespaceSpecifier",
+            local: to_moz(M.all),
+        }));
+        if (M.default) specifiers.unshift(set_moz_loc(M.default, {
+            type: "ImportDefaultSpecifier",
+            local: to_moz(M.default),
+        }));
+        return {
+            type: "ImportDeclaration",
+            specifiers: specifiers,
+            source: to_moz(M.path),
+        };
+    });
+
+    def_to_moz(AST_Definitions, function To_Moz_VariableDeclaration(M) {
         return {
+            type: "VariableDeclaration",
+            kind: M.TYPE.toLowerCase(),
+            declarations: M.definitions.map(to_moz),
+        };
+    });
+
+    def_to_moz(AST_PropAccess, function To_Moz_MemberExpression(M) {
+        var computed = M instanceof AST_Sub;
+        var expr = {
             type: "MemberExpression",
             object: to_moz(M.expression),
-            computed: isComputed,
-            property: isComputed ? to_moz(M.property) : {type: "Identifier", name: M.property}
+            computed: computed,
+            optional: M.optional,
+            property: computed ? to_moz(M.property) : {
+                type: "Identifier",
+                name: M.property,
+            },
         };
+        return M.terminal ? {
+            type: "ChainExpression",
+            expression: expr,
+        } : expr;
     });
 
     def_to_moz(AST_Unary, function To_Moz_Unary(M) {
@@ -295,34 +925,73 @@
         };
     });
 
-    def_to_moz(AST_Object, function To_Moz_ObjectExpression(M) {
+    def_to_moz(AST_Array, function To_Moz_ArrayExpression(M) {
+        return {
+            type: "ArrayExpression",
+            elements: M.elements.map(to_moz),
+        };
+    });
+
+    def_to_moz(AST_DestructuredArray, function To_Moz_ArrayPattern(M) {
+        var elements = M.elements.map(to_moz);
+        if (M.rest) elements.push({
+            type: "RestElement",
+            argument: to_moz(M.rest),
+        });
+        return {
+            type: "ArrayPattern",
+            elements: elements,
+        };
+    });
+
+    def_to_moz(AST_DestructuredKeyVal, function To_Moz_Property(M) {
+        var computed = M.key instanceof AST_Node;
+        var key = computed ? to_moz(M.key) : {
+            type: "Literal",
+            value: M.key,
+        };
+        return {
+            type: "Property",
+            kind: "init",
+            computed: computed,
+            key: key,
+            value: to_moz(M.value),
+        };
+    });
+
+    def_to_moz(AST_DestructuredObject, function To_Moz_ObjectPattern(M) {
+        var props = M.properties.map(to_moz);
+        if (M.rest) props.push({
+            type: "RestElement",
+            argument: to_moz(M.rest),
+        });
         return {
-            type: "ObjectExpression",
-            properties: M.properties.map(to_moz)
+            type: "ObjectPattern",
+            properties: props,
         };
     });
 
     def_to_moz(AST_ObjectProperty, function To_Moz_Property(M) {
-        var key = (
-            is_identifier(M.key)
-            ? {type: "Identifier", name: M.key}
-            : {type: "Literal", value: M.key}
-        );
+        var computed = M.key instanceof AST_Node;
+        var key = computed ? to_moz(M.key) : {
+            type: "Literal",
+            value: M.key,
+        };
         var kind;
         if (M instanceof AST_ObjectKeyVal) {
             kind = "init";
-        } else
-        if (M instanceof AST_ObjectGetter) {
+        } else if (M instanceof AST_ObjectGetter) {
             kind = "get";
-        } else
-        if (M instanceof AST_ObjectSetter) {
+        } else if (M instanceof AST_ObjectSetter) {
             kind = "set";
         }
         return {
             type: "Property",
             kind: kind,
+            computed: computed,
+            method: M instanceof AST_ObjectMethod,
             key: key,
-            value: to_moz(M.value)
+            value: to_moz(M.value),
         };
     });
 
@@ -330,45 +999,133 @@
         var def = M.definition();
         return {
             type: "Identifier",
-            name: def ? def.mangled_name || def.name : M.name
+            name: def && def.mangled_name || M.name,
+        };
+    });
+
+    def_to_moz(AST_Super, function To_Moz_Super() {
+        return { type: "Super" };
+    });
+
+    def_to_moz(AST_This, function To_Moz_ThisExpression() {
+        return { type: "ThisExpression" };
+    });
+
+    def_to_moz(AST_NewTarget, function To_Moz_MetaProperty() {
+        return {
+            type: "MetaProperty",
+            meta: {
+                type: "Identifier",
+                name: "new",
+            },
+            property: {
+                type: "Identifier",
+                name: "target",
+            },
+        };
+    });
+
+    def_to_moz(AST_RegExp, function To_Moz_RegExpLiteral(M) {
+        var flags = M.value.toString().match(/\/([gimuy]*)$/)[1];
+        var value = "/" + M.value.raw_source + "/" + flags;
+        return {
+            type: "Literal",
+            value: value,
+            raw: value,
+            regex: {
+                pattern: M.value.raw_source,
+                flags: flags,
+            },
         };
     });
 
-    def_to_moz(AST_Constant, function To_Moz_Literal(M) {
+    def_to_moz(AST_BigInt, function To_Moz_BigInt(M) {
         var value = M.value;
-        if (typeof value === 'number' && (value < 0 || (value === 0 && 1 / value < 0))) {
+        return {
+            type: "Literal",
+            bigint: value.slice(0, -1),
+            raw: value,
+        };
+    });
+
+    function To_Moz_Literal(M) {
+        var value = M.value;
+        if (typeof value === "number" && (value < 0 || (value === 0 && 1 / value < 0))) {
             return {
                 type: "UnaryExpression",
                 operator: "-",
                 prefix: true,
                 argument: {
                     type: "Literal",
-                    value: -value
-                }
+                    value: -value,
+                    raw: M.start.raw,
+                },
             };
         }
         return {
             type: "Literal",
-            value: value
+            value: value,
+            raw: M.start.raw,
         };
-    });
+    }
+    def_to_moz(AST_Boolean, To_Moz_Literal);
+    def_to_moz(AST_Constant, To_Moz_Literal);
+    def_to_moz(AST_Null, To_Moz_Literal);
 
     def_to_moz(AST_Atom, function To_Moz_Atom(M) {
         return {
             type: "Identifier",
-            name: String(M.value)
+            name: String(M.value),
         };
     });
 
-    AST_Boolean.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
-    AST_Null.DEFMETHOD("to_mozilla_ast", AST_Constant.prototype.to_mozilla_ast);
-    AST_Hole.DEFMETHOD("to_mozilla_ast", function To_Moz_ArrayHole() { return null });
+    def_to_moz(AST_Template, function To_Moz_TemplateLiteral_TaggedTemplateExpression(M) {
+        var last = M.strings.length - 1;
+        var tmpl = {
+            type: "TemplateLiteral",
+            expressions: M.expressions.map(to_moz),
+            quasis: M.strings.map(function(str, index) {
+                return {
+                    type: "TemplateElement",
+                    tail: index == last,
+                    value: { raw: str },
+                };
+            }),
+        };
+        if (!M.tag) return tmpl;
+        return {
+            type: "TaggedTemplateExpression",
+            tag: to_moz(M.tag),
+            quasi: tmpl,
+        };
+    });
 
     AST_Block.DEFMETHOD("to_mozilla_ast", AST_BlockStatement.prototype.to_mozilla_ast);
-    AST_Lambda.DEFMETHOD("to_mozilla_ast", AST_Function.prototype.to_mozilla_ast);
+    AST_Hole.DEFMETHOD("to_mozilla_ast", return_null);
+    AST_Node.DEFMETHOD("to_mozilla_ast", function() {
+        throw new Error("Cannot convert AST_" + this.TYPE);
+    });
 
     /* -----[ tools ]----- */
 
+    function normalize_directives(body) {
+        for (var i = 0; i < body.length; i++) {
+            var stat = body[i];
+            if (!(stat instanceof AST_SimpleStatement)) break;
+            var node = stat.body;
+            if (!(node instanceof AST_String)) break;
+            if (stat.start.pos !== node.start.pos) break;
+            body[i] = new AST_Directive(node);
+        }
+        return body;
+    }
+
+    function raw_token(moznode) {
+        if (moznode.type == "Literal") {
+            return moznode.raw != null ? moznode.raw : moznode.value + "";
+        }
+    }
+
     function my_start_token(moznode) {
         var loc = moznode.loc, start = loc && loc.start;
         var range = moznode.range;
@@ -379,9 +1136,10 @@
             pos     : range ? range[0] : moznode.start,
             endline : start && start.line,
             endcol  : start && start.column,
-            endpos  : range ? range[0] : moznode.start
+            endpos  : range ? range[0] : moznode.start,
+            raw     : raw_token(moznode),
         });
-    };
+    }
 
     function my_end_token(moznode) {
         var loc = moznode.loc, end = loc && loc.end;
@@ -393,83 +1151,111 @@
             pos     : range ? range[1] : moznode.end,
             endline : end && end.line,
             endcol  : end && end.column,
-            endpos  : range ? range[1] : moznode.end
+            endpos  : range ? range[1] : moznode.end,
+            raw     : raw_token(moznode),
         });
-    };
+    }
+
+    function read_name(M) {
+        return "" + M[M.type == "Identifier" ? "name" : "value"];
+    }
 
     function map(moztype, mytype, propmap) {
-        var moz_to_me = "function From_Moz_" + moztype + "(M){\n";
-        moz_to_me += "return new " + mytype.name + "({\n" +
-            "start: my_start_token(M),\n" +
-            "end: my_end_token(M)";
-
-        var me_to_moz = "function To_Moz_" + moztype + "(M){\n";
-        me_to_moz += "return {\n" +
-            "type: " + JSON.stringify(moztype);
+        var moz_to_me = [
+            "start: my_start_token(M)",
+            "end: my_end_token(M)",
+        ];
+        var me_to_moz = [
+            "type: " + JSON.stringify(moztype),
+        ];
 
-        if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop){
+        if (propmap) propmap.split(/\s*,\s*/).forEach(function(prop) {
             var m = /([a-z0-9$_]+)(=|@|>|%)([a-z0-9$_]+)/i.exec(prop);
             if (!m) throw new Error("Can't understand property map: " + prop);
             var moz = m[1], how = m[2], my = m[3];
-            moz_to_me += ",\n" + my + ": ";
-            me_to_moz += ",\n" + moz + ": ";
             switch (how) {
-                case "@":
-                    moz_to_me += "M." + moz + ".map(from_moz)";
-                    me_to_moz += "M." +  my + ".map(to_moz)";
-                    break;
-                case ">":
-                    moz_to_me += "from_moz(M." + moz + ")";
-                    me_to_moz += "to_moz(M." + my + ")";
-                    break;
-                case "=":
-                    moz_to_me += "M." + moz;
-                    me_to_moz += "M." + my;
-                    break;
-                case "%":
-                    moz_to_me += "from_moz(M." + moz + ").body";
-                    me_to_moz += "to_moz_block(M)";
-                    break;
-                default:
-                    throw new Error("Can't understand operator in propmap: " + prop);
+              case "@":
+                moz_to_me.push(my + ": M." + moz + ".map(from_moz)");
+                me_to_moz.push(moz + ": M." +  my + ".map(to_moz)");
+                break;
+              case ">":
+                moz_to_me.push(my + ": from_moz(M." + moz + ")");
+                me_to_moz.push(moz + ": to_moz(M." + my + ")");
+                break;
+              case "=":
+                moz_to_me.push(my + ": M." + moz);
+                me_to_moz.push(moz + ": M." + my);
+                break;
+              case "%":
+                moz_to_me.push(my + ": from_moz(M." + moz + ").body");
+                me_to_moz.push(moz + ": to_moz_block(M)");
+                break;
+              default:
+                throw new Error("Can't understand operator in propmap: " + prop);
             }
         });
 
-        moz_to_me += "\n})\n}";
-        me_to_moz += "\n}\n}";
-
-        //moz_to_me = parse(moz_to_me).print_to_string({ beautify: true });
-        //me_to_moz = parse(me_to_moz).print_to_string({ beautify: true });
-        //console.log(moz_to_me);
-
-        moz_to_me = new Function("my_start_token", "my_end_token", "from_moz", "return(" + moz_to_me + ")")(
-            my_start_token, my_end_token, from_moz
-        );
-        me_to_moz = new Function("to_moz", "to_moz_block", "return(" + me_to_moz + ")")(
-            to_moz, to_moz_block
-        );
-        MOZ_TO_ME[moztype] = moz_to_me;
-        def_to_moz(mytype, me_to_moz);
-    };
+        MOZ_TO_ME[moztype] = new Function("U2", "my_start_token", "my_end_token", "from_moz", [
+            "return function From_Moz_" + moztype + "(M) {",
+            "    return new U2.AST_" + mytype.TYPE + "({",
+            moz_to_me.join(",\n"),
+            "    });",
+            "};",
+        ].join("\n"))(exports, my_start_token, my_end_token, from_moz);
+        def_to_moz(mytype, new Function("to_moz", "to_moz_block", "to_moz_scope", [
+            "return function To_Moz_" + moztype + "(M) {",
+            "    return {",
+            me_to_moz.join(",\n"),
+            "    };",
+            "};",
+        ].join("\n"))(to_moz, to_moz_block, to_moz_scope));
+    }
 
     var FROM_MOZ_STACK = null;
 
-    function from_moz(node) {
-        FROM_MOZ_STACK.push(node);
-        var ret = node != null ? MOZ_TO_ME[node.type](node) : null;
+    function from_moz(moz) {
+        FROM_MOZ_STACK.push(moz);
+        var node = null;
+        if (moz) {
+            if (!HOP(MOZ_TO_ME, moz.type)) throw new Error("Unsupported type: " + moz.type);
+            node = MOZ_TO_ME[moz.type](moz);
+        }
         FROM_MOZ_STACK.pop();
-        return ret;
-    };
+        return node;
+    }
 
-    AST_Node.from_mozilla_ast = function(node){
+    function from_moz_alias(moz) {
+        return new AST_String({
+            start: my_start_token(moz),
+            value: read_name(moz),
+            end: my_end_token(moz),
+        });
+    }
+
+    AST_Node.from_mozilla_ast = function(node) {
         var save_stack = FROM_MOZ_STACK;
         FROM_MOZ_STACK = [];
         var ast = from_moz(node);
         FROM_MOZ_STACK = save_stack;
+        ast.walk(new TreeWalker(function(node) {
+            if (node instanceof AST_LabelRef) {
+                for (var level = 0, parent; parent = this.parent(level); level++) {
+                    if (parent instanceof AST_Scope) break;
+                    if (parent instanceof AST_LabeledStatement && parent.label.name == node.name) {
+                        node.thedef = parent.label;
+                        break;
+                    }
+                }
+                if (!node.thedef) {
+                    var s = node.start;
+                    js_error("Undefined label " + node.name, s.file, s.line, s.col, s.pos);
+                }
+            }
+        }));
         return ast;
     };
 
-    function set_moz_loc(mynode, moznode, myparent) {
+    function set_moz_loc(mynode, moznode) {
         var start = mynode.start;
         var end = mynode.end;
         if (start.pos != null && end.endpos != null) {
@@ -478,30 +1264,47 @@
         if (start.line) {
             moznode.loc = {
                 start: {line: start.line, column: start.col},
-                end: end.endline ? {line: end.endline, column: end.endcol} : null
+                end: end.endline ? {line: end.endline, column: end.endcol} : null,
             };
             if (start.file) {
                 moznode.loc.source = start.file;
             }
         }
         return moznode;
-    };
+    }
 
     function def_to_moz(mytype, handler) {
         mytype.DEFMETHOD("to_mozilla_ast", function() {
             return set_moz_loc(this, handler(this));
         });
-    };
+    }
 
     function to_moz(node) {
         return node != null ? node.to_mozilla_ast() : null;
-    };
+    }
+
+    function to_moz_alias(alias) {
+        return is_identifier_string(alias.value) ? set_moz_loc(alias, {
+            type: "Identifier",
+            name: alias.value,
+        }) : to_moz(alias);
+    }
 
     function to_moz_block(node) {
         return {
             type: "BlockStatement",
-            body: node.body.map(to_moz)
+            body: node.body.map(to_moz),
         };
-    };
+    }
 
+    function to_moz_scope(type, node) {
+        var body = node.body.map(to_moz);
+        if (node.body[0] instanceof AST_SimpleStatement && node.body[0].body instanceof AST_String) {
+            body.unshift(to_moz(new AST_EmptyStatement(node.body[0])));
+        }
+        return {
+            type: type,
+            body: body,
+        };
+    }
 })();
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/output.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/output.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/output.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,37 +43,107 @@
 
 "use strict";
 
-function OutputStream(options) {
+function is_some_comments(comment) {
+    // multiline comment
+    return comment.type == "comment2" && /@preserve|@license|@cc_on/i.test(comment.value);
+}
 
+function OutputStream(options) {
     options = defaults(options, {
-        indent_start     : 0,
-        indent_level     : 4,
-        quote_keys       : false,
-        space_colon      : true,
+        annotations      : false,
         ascii_only       : false,
-        unescape_regexps : false,
-        inline_script    : false,
-        width            : 80,
-        max_line_len     : 32000,
         beautify         : false,
-        source_map       : null,
-        bracketize       : false,
-        semicolons       : true,
+        braces           : false,
         comments         : false,
-        preserve_line    : false,
-        screw_ie8        : false,
+        extendscript     : false,
+        galio            : false,
+        ie               : false,
+        indent_level     : 4,
+        indent_start     : 0,
+        inline_script    : true,
+        keep_quoted_props: false,
+        max_line_len     : false,
         preamble         : null,
-        quote_style      : 0
+        preserve_line    : false,
+        quote_keys       : false,
+        quote_style      : 0,
+        semicolons       : true,
+        shebang          : true,
+        source_map       : null,
+        v8               : false,
+        webkit           : false,
+        width            : 80,
+        wrap_iife        : false,
     }, true);
 
-    var indentation = 0;
+    // Convert comment option to RegExp if necessary and set up comments filter
+    var comment_filter = return_false; // Default case, throw all comments away
+    if (options.comments) {
+        var comments = options.comments;
+        if (typeof options.comments === "string" && /^\/.*\/[a-zA-Z]*$/.test(options.comments)) {
+            var regex_pos = options.comments.lastIndexOf("/");
+            comments = new RegExp(
+                options.comments.substr(1, regex_pos - 1),
+                options.comments.substr(regex_pos + 1)
+            );
+        }
+        if (comments instanceof RegExp) {
+            comment_filter = function(comment) {
+                return comment.type != "comment5" && comments.test(comment.value);
+            };
+        } else if (typeof comments === "function") {
+            comment_filter = function(comment) {
+                return comment.type != "comment5" && comments(this, comment);
+            };
+        } else if (comments === "some") {
+            comment_filter = is_some_comments;
+        } else { // NOTE includes "all" option
+            comment_filter = return_true;
+        }
+    }
+
+    function make_indent(value) {
+        if (typeof value == "number") return new Array(value + 1).join(" ");
+        if (!value) return "";
+        if (!/^\s*$/.test(value)) throw new Error("unsupported indentation: " + JSON.stringify("" + value));
+        return value;
+    }
+
     var current_col = 0;
     var current_line = 1;
-    var current_pos = 0;
-    var OUTPUT = "";
+    var current_indent = make_indent(options.indent_start);
+    var full_indent = make_indent(options.indent_level);
+    var half_indent = full_indent.length + 1 >> 1;
+    var last;
+    var line_end = 0;
+    var line_fixed = true;
+    var mappings = options.source_map && [];
+    var mapping_name;
+    var mapping_token;
+    var might_need_space;
+    var might_need_semicolon;
+    var need_newline_indented = false;
+    var need_space = false;
+    var output;
+    var stack;
+    var stored = "";
+
+    function reset() {
+        last = "";
+        might_need_space = false;
+        might_need_semicolon = false;
+        stack = [];
+        var str = output;
+        output = "";
+        return str;
+    }
 
-    function to_ascii(str, identifier) {
-        return str.replace(/[\u0080-\uffff]/g, function(ch) {
+    reset();
+    var to_utf8 = options.ascii_only ? function(str, identifier) {
+        if (identifier) str = str.replace(/[\ud800-\udbff][\udc00-\udfff]/g, function(ch) {
+            return "\\u{" + (ch.charCodeAt(0) - 0xd7c0 << 10 | ch.charCodeAt(1) - 0xdc00).toString(16) + "}";
+        });
+        return str.replace(/[\u0000-\u001f\u007f-\uffff]/g, function(ch) {
             var code = ch.charCodeAt(0).toString(16);
             if (code.length <= 2 && !identifier) {
                 while (code.length < 2) code = "0" + code;
@@ -83,134 +153,218 @@
                 return "\\u" + code;
             }
         });
+    } : function(str) {
+        var s = "";
+        for (var i = 0, j = 0; i < str.length; i++) {
+            var code = str.charCodeAt(i);
+            if (is_surrogate_pair_head(code)) {
+                if (is_surrogate_pair_tail(str.charCodeAt(i + 1))) {
+                    i++;
+                    continue;
+                }
+            } else if (!is_surrogate_pair_tail(code)) {
+                continue;
+            }
+            s += str.slice(j, i) + "\\u" + code.toString(16);
+            j = i + 1;
+        }
+        return j == 0 ? str : s + str.slice(j);
+    };
+
+    function quote_single(str) {
+        return "'" + str.replace(/\x27/g, "\\'") + "'";
+    }
+
+    function quote_double(str) {
+        return '"' + str.replace(/\x22/g, '\\"') + '"';
+    }
+
+    var quote_string = [
+        null,
+        quote_single,
+        quote_double,
+        function(str, quote) {
+            return quote == "'" ? quote_single(str) : quote_double(str);
+        },
+    ][options.quote_style] || function(str, quote, dq, sq) {
+        return dq > sq ? quote_single(str) : quote_double(str);
     };
 
     function make_string(str, quote) {
         var dq = 0, sq = 0;
-        str = str.replace(/[\\\b\f\n\r\t\x22\x27\u2028\u2029\0\ufeff]/g, function(s){
+        str = str.replace(/[\\\b\f\n\r\v\t\x22\x27\u2028\u2029\0\ufeff]/g, function(s, i) {
             switch (s) {
+              case '"': ++dq; return '"';
+              case "'": ++sq; return "'";
               case "\\": return "\\\\";
-              case "\b": return "\\b";
-              case "\f": return "\\f";
               case "\n": return "\\n";
               case "\r": return "\\r";
+              case "\t": return "\\t";
+              case "\b": return "\\b";
+              case "\f": return "\\f";
+              case "\x0B": return options.ie ? "\\x0B" : "\\v";
               case "\u2028": return "\\u2028";
               case "\u2029": return "\\u2029";
-              case '"': ++dq; return '"';
-              case "'": ++sq; return "'";
-              case "\0": return "\\x00";
               case "\ufeff": return "\\ufeff";
+              case "\0":
+                  return /[0-9]/.test(str.charAt(i+1)) ? "\\x00" : "\\0";
             }
             return s;
         });
-        function quote_single() {
-            return "'" + str.replace(/\x27/g, "\\'") + "'";
-        }
-        function quote_double() {
-            return '"' + str.replace(/\x22/g, '\\"') + '"';
-        }
-        if (options.ascii_only) str = to_ascii(str);
-        switch (options.quote_style) {
-          case 1:
-            return quote_single();
-          case 2:
-            return quote_double();
-          case 3:
-            return quote == "'" ? quote_single() : quote_double();
-          default:
-            return dq > sq ? quote_single() : quote_double();
-        }
-    };
-
-    function encode_string(str, quote) {
-        var ret = make_string(str, quote);
-        if (options.inline_script)
-            ret = ret.replace(/<\x2fscript([>\/\t\n\f\r ])/gi, "<\\/script$1");
-        return ret;
-    };
+        return quote_string(to_utf8(str), quote, dq, sq);
+    }
 
-    function make_name(name) {
-        name = name.toString();
-        if (options.ascii_only)
-            name = to_ascii(name, true);
-        return name;
-    };
+    /* -----[ beautification/minification ]----- */
 
-    function make_indent(back) {
-        return repeat_string(" ", options.indent_start + indentation - back * options.indent_level);
-    };
+    var adjust_mappings = mappings ? function(line, col) {
+        mappings.forEach(function(mapping) {
+            mapping.line += line;
+            mapping.col += col;
+        });
+    } : noop;
 
-    /* -----[ beautification/minification ]----- */
+    var flush_mappings = mappings ? function() {
+        mappings.forEach(function(mapping) {
+            options.source_map.add(
+                mapping.token.file,
+                mapping.line, mapping.col,
+                mapping.token.line, mapping.token.col,
+                !mapping.name && mapping.token.type == "name" ? mapping.token.value : mapping.name
+            );
+        });
+        mappings = [];
+    } : noop;
 
-    var might_need_space = false;
-    var might_need_semicolon = false;
-    var last = null;
+    function insert_newlines(count) {
+        stored += output.slice(0, line_end);
+        output = output.slice(line_end);
+        var new_col = output.length;
+        adjust_mappings(count, new_col - current_col);
+        current_line += count;
+        current_col = new_col;
+        while (count--) stored += "\n";
+    }
 
-    function last_char() {
-        return last.charAt(last.length - 1);
-    };
+    var fix_line = options.max_line_len ? function(flush) {
+        if (line_fixed) {
+            if (current_col > options.max_line_len) {
+                AST_Node.warn("Output exceeds {max_line_len} characters", options);
+            }
+            return;
+        }
+        if (current_col > options.max_line_len) {
+            insert_newlines(1);
+            line_fixed = true;
+        }
+        if (line_fixed || flush) flush_mappings();
+    } : noop;
 
-    function maybe_newline() {
-        if (options.max_line_len && current_col > options.max_line_len)
-            print("\n");
-    };
+    var require_semicolon = makePredicate("( [ + * / - , .");
 
-    var requireSemicolonChars = makePredicate("( [ + * / - , .");
+    function require_space(prev, ch, str) {
+        return is_identifier_char(prev) && (is_identifier_char(ch) || ch == "\\")
+            || (ch == "/" && ch == prev)
+            || ((ch == "+" || ch == "-") && ch == last)
+            || last == "--" && ch == ">"
+            || last == "!" && str == "--"
+            || prev == "/" && (str == "in" || str == "instanceof");
+    }
 
-    function print(str) {
-        str = String(str);
+    var print = options.beautify
+        || options.comments
+        || options.max_line_len
+        || options.preserve_line
+        || options.shebang
+        || !options.semicolons
+        || options.source_map
+        || options.width ? function(str) {
         var ch = str.charAt(0);
+        if (need_newline_indented && ch) {
+            need_newline_indented = false;
+            if (ch != "\n") {
+                print("\n");
+                indent();
+            }
+        }
+        if (need_space && ch) {
+            need_space = false;
+            if (!/[\s;})]/.test(ch)) {
+                space();
+            }
+        }
+        var prev = last.slice(-1);
         if (might_need_semicolon) {
-            if ((!ch || ";}".indexOf(ch) < 0) && !/[;]$/.test(last)) {
-                if (options.semicolons || requireSemicolonChars(ch)) {
-                    OUTPUT += ";";
+            might_need_semicolon = false;
+            if (prev == ":" && ch == "}" || prev != ";" && (!ch || ";}".indexOf(ch) < 0)) {
+                var need_semicolon = require_semicolon[ch];
+                if (need_semicolon || options.semicolons) {
+                    output += ";";
                     current_col++;
-                    current_pos++;
+                    if (!line_fixed) {
+                        fix_line();
+                        if (line_fixed && !need_semicolon && output == ";") {
+                            output = "";
+                            current_col = 0;
+                        }
+                    }
+                    if (line_end == output.length - 1) line_end++;
                 } else {
-                    OUTPUT += "\n";
-                    current_pos++;
+                    fix_line();
+                    output += "\n";
                     current_line++;
                     current_col = 0;
+                    // reset the semicolon flag, since we didn't print one
+                    // now and might still have to later
+                    if (/^\s+$/.test(str)) might_need_semicolon = true;
                 }
-                if (!options.beautify)
-                    might_need_space = false;
-            }
-            might_need_semicolon = false;
-        }
-
-        if (!options.beautify && options.preserve_line && stack[stack.length - 1]) {
-            var target_line = stack[stack.length - 1].start.line;
-            while (current_line < target_line) {
-                OUTPUT += "\n";
-                current_pos++;
-                current_line++;
-                current_col = 0;
-                might_need_space = false;
+                if (!options.beautify) might_need_space = false;
             }
         }
 
         if (might_need_space) {
-            var prev = last_char();
-            if ((is_identifier_char(prev)
-                 && (is_identifier_char(ch) || ch == "\\"))
-                || (/^[\+\-\/]$/.test(ch) && ch == prev))
-            {
-                OUTPUT += " ";
+            if (require_space(prev, ch, str)) {
+                output += " ";
                 current_col++;
-                current_pos++;
             }
-            might_need_space = false;
+            if (prev != "<" || str != "!") might_need_space = false;
+        }
+
+        if (mapping_token) {
+            mappings.push({
+                token: mapping_token,
+                name: mapping_name,
+                line: current_line,
+                col: current_col,
+            });
+            mapping_token = false;
+            if (line_fixed) flush_mappings();
         }
+
+        output += str;
         var a = str.split(/\r?\n/), n = a.length - 1;
         current_line += n;
-        if (n == 0) {
-            current_col += a[n].length;
-        } else {
+        current_col += a[0].length;
+        if (n > 0) {
+            fix_line();
             current_col = a[n].length;
         }
-        current_pos += str.length;
         last = str;
-        OUTPUT += str;
+    } : function(str) {
+        var ch = str.charAt(0);
+        var prev = last.slice(-1);
+        if (might_need_semicolon) {
+            might_need_semicolon = false;
+            if (prev == ":" && ch == "}" || (!ch || ";}".indexOf(ch) < 0) && prev != ";") {
+                output += ";";
+                might_need_space = false;
+            }
+        }
+        if (might_need_space) {
+            if (require_space(prev, ch, str)) output += " ";
+            if (prev != "<" || str != "!") might_need_space = false;
+        }
+        output += str;
+        last = str;
     };
 
     var space = options.beautify ? function() {
@@ -220,23 +374,27 @@
     };
 
     var indent = options.beautify ? function(half) {
-        if (options.beautify) {
-            print(make_indent(half ? 0.5 : 0));
-        }
+        if (need_newline_indented) print("\n");
+        print(half ? current_indent.slice(0, -half_indent) : current_indent);
     } : noop;
 
-    var with_indent = options.beautify ? function(col, cont) {
-        if (col === true) col = next_indent();
-        var save_indentation = indentation;
-        indentation = col;
-        var ret = cont();
-        indentation = save_indentation;
-        return ret;
-    } : function(col, cont) { return cont() };
+    var with_indent = options.beautify ? function(cont) {
+        var save_indentation = current_indent;
+        current_indent += full_indent;
+        cont();
+        current_indent = save_indentation;
+    } : function(cont) { cont() };
+
+    var may_add_newline = options.max_line_len || options.preserve_line ? function() {
+        fix_line();
+        line_end = output.length;
+        line_fixed = false;
+    } : noop;
 
     var newline = options.beautify ? function() {
         print("\n");
-    } : maybe_newline;
+        line_end = output.length;
+    } : may_add_newline;
 
     var semicolon = options.beautify ? function() {
         print(";");
@@ -245,89 +403,173 @@
     };
 
     function force_semicolon() {
-        might_need_semicolon = false;
+        if (might_need_semicolon) print(";");
         print(";");
-    };
-
-    function next_indent() {
-        return indentation + options.indent_level;
-    };
+    }
 
-    function with_block(cont) {
-        var ret;
+    function with_block(cont, end) {
         print("{");
         newline();
-        with_indent(next_indent(), function(){
-            ret = cont();
-        });
+        with_indent(cont);
+        add_mapping(end);
         indent();
         print("}");
-        return ret;
-    };
+    }
 
     function with_parens(cont) {
         print("(");
-        //XXX: still nice to have that for argument lists
-        //var ret = with_indent(current_col, cont);
-        var ret = cont();
+        may_add_newline();
+        cont();
+        may_add_newline();
         print(")");
-        return ret;
-    };
+    }
 
     function with_square(cont) {
         print("[");
-        //var ret = with_indent(current_col, cont);
-        var ret = cont();
+        may_add_newline();
+        cont();
+        may_add_newline();
         print("]");
-        return ret;
-    };
+    }
 
     function comma() {
+        may_add_newline();
         print(",");
+        may_add_newline();
         space();
-    };
+    }
 
     function colon() {
         print(":");
-        if (options.space_colon) space();
-    };
+        space();
+    }
 
-    var add_mapping = options.source_map ? function(token, name) {
-        try {
-            if (token) options.source_map.add(
-                token.file || "?",
-                current_line, current_col,
-                token.line, token.col,
-                (!name && token.type == "name") ? token.value : name
-            );
-        } catch(ex) {
-            AST_Node.warn("Couldn't figure out mapping for {file}:{line},{col} → {cline},{ccol} [{name}]", {
-                file: token.file,
-                line: token.line,
-                col: token.col,
-                cline: current_line,
-                ccol: current_col,
-                name: name || ""
-            })
-        }
+    var add_mapping = mappings ? function(token, name) {
+        mapping_token = token;
+        mapping_name = name;
     } : noop;
 
     function get() {
-        return OUTPUT;
-    };
+        if (!line_fixed) fix_line(true);
+        return stored + output;
+    }
+
+    function has_nlb() {
+        return /(^|\n) *$/.test(output);
+    }
+
+    function pad_comment(token, force) {
+        if (need_newline_indented) return;
+        if (token.nlb && (force || !has_nlb())) {
+            need_newline_indented = true;
+        } else if (force) {
+            need_space = true;
+        }
+    }
+
+    function print_comment(comment) {
+        var value = comment.value.replace(/[@#]__PURE__/g, " ");
+        if (/^\s*$/.test(value) && !/^\s*$/.test(comment.value)) return false;
+        if (/comment[134]/.test(comment.type)) {
+            print("//" + value);
+            need_newline_indented = true;
+        } else if (comment.type == "comment2") {
+            print("/*" + value + "*/");
+        }
+        return true;
+    }
 
-    if (options.preamble) {
-        print(options.preamble.replace(/\r\n?|[\n\u2028\u2029]|\s*$/g, "\n"));
+    function should_merge_comments(node, parent) {
+        if (parent instanceof AST_Binary) return parent.left === node;
+        if (parent.TYPE == "Call") return parent.expression === node;
+        if (parent instanceof AST_Conditional) return parent.condition === node;
+        if (parent instanceof AST_Dot) return parent.expression === node;
+        if (parent instanceof AST_Exit) return true;
+        if (parent instanceof AST_Sequence) return parent.expressions[0] === node;
+        if (parent instanceof AST_Sub) return parent.expression === node;
+        if (parent instanceof AST_UnaryPostfix) return true;
+        if (parent instanceof AST_Yield) return true;
+    }
+
+    function prepend_comments(node) {
+        var self = this;
+        var scan;
+        if (node instanceof AST_Exit) {
+            scan = node.value;
+        } else if (node instanceof AST_Yield) {
+            scan = node.expression;
+        }
+        var comments = dump(node);
+        if (!comments) comments = [];
+
+        if (scan) {
+            var tw = new TreeWalker(function(node) {
+                if (!should_merge_comments(node, tw.parent())) return true;
+                var before = dump(node);
+                if (before) comments = comments.concat(before);
+            });
+            tw.push(node);
+            scan.walk(tw);
+        }
+
+        if (current_line == 1 && current_col == 0) {
+            if (comments.length > 0 && options.shebang && comments[0].type == "comment5") {
+                print("#!" + comments.shift().value + "\n");
+                indent();
+            }
+            var preamble = options.preamble;
+            if (preamble) print(preamble.replace(/\r\n?|\u2028|\u2029|(^|\S)\s*$/g, "$1\n"));
+        }
+
+        comments = comments.filter(comment_filter, node);
+        var printed = false;
+        comments.forEach(function(comment, index) {
+            pad_comment(comment, index);
+            if (print_comment(comment)) printed = true;
+        });
+        if (printed) pad_comment(node.start, true);
+
+        function dump(node) {
+            var token = node.start;
+            if (!token) {
+                if (!scan) return;
+                node.start = token = new AST_Token();
+            }
+            var comments = token.comments_before;
+            if (!comments) {
+                if (!scan) return;
+                token.comments_before = comments = [];
+            }
+            if (comments._dumped === self) return;
+            comments._dumped = self;
+            return comments;
+        }
+    }
+
+    function append_comments(node, tail) {
+        var self = this;
+        var token = node.end;
+        if (!token) return;
+        var comments = token[tail ? "comments_before" : "comments_after"];
+        if (!comments || comments._dumped === self) return;
+        if (!(node instanceof AST_Statement || all(comments, function(c) {
+            return !/comment[134]/.test(c.type);
+        }))) return;
+        comments._dumped = self;
+        comments.filter(comment_filter, node).forEach(function(comment, index) {
+            pad_comment(comment, index || !tail);
+            print_comment(comment);
+        });
     }
 
-    var stack = [];
     return {
         get             : get,
-        toString        : get,
+        reset           : reset,
         indent          : indent,
-        indentation     : function() { return indentation },
-        current_width   : function() { return current_col - indentation },
-        should_break    : function() { return options.width && this.current_width() >= options.width },
+        should_break    : options.beautify && options.width ? function() {
+            return current_col >= options.width;
+        } : return_false,
+        has_parens      : function() { return last.slice(-1) == "(" },
         newline         : newline,
         print           : print,
         space           : space,
@@ -336,46 +578,51 @@
         last            : function() { return last },
         semicolon       : semicolon,
         force_semicolon : force_semicolon,
-        to_ascii        : to_ascii,
-        print_name      : function(name) { print(make_name(name)) },
-        print_string    : function(str, quote) { print(encode_string(str, quote)) },
-        next_indent     : next_indent,
+        to_utf8         : to_utf8,
+        print_name      : function(name) { print(to_utf8(name.toString(), true)) },
+        print_string    : options.inline_script ? function(str, quote) {
+            str = make_string(str, quote).replace(/<\x2f(script)([>\/\t\n\f\r ])/gi, "<\\/$1$2");
+            print(str.replace(/\x3c!--/g, "\\x3c!--").replace(/--\x3e/g, "--\\x3e"));
+        } : function(str, quote) {
+            print(make_string(str, quote));
+        },
         with_indent     : with_indent,
         with_block      : with_block,
         with_parens     : with_parens,
         with_square     : with_square,
         add_mapping     : add_mapping,
         option          : function(opt) { return options[opt] },
-        line            : function() { return current_line },
-        col             : function() { return current_col },
-        pos             : function() { return current_pos },
+        prepend_comments: options.comments || options.shebang ? prepend_comments : noop,
+        append_comments : options.comments ? append_comments : noop,
         push_node       : function(node) { stack.push(node) },
-        pop_node        : function() { return stack.pop() },
-        stack           : function() { return stack },
+        pop_node        : options.preserve_line ? function() {
+            var node = stack.pop();
+            if (node.start && node.start.line > current_line) {
+                insert_newlines(node.start.line - current_line);
+            }
+        } : function() {
+            stack.pop();
+        },
         parent          : function(n) {
             return stack[stack.length - 2 - (n || 0)];
-        }
+        },
     };
-
-};
+}
 
 /* -----[ code generators ]----- */
 
-(function(){
+(function() {
 
     /* -----[ utils ]----- */
 
     function DEFPRINT(nodetype, generator) {
         nodetype.DEFMETHOD("_codegen", generator);
-    };
+    }
 
-    AST_Node.DEFMETHOD("print", function(stream, force_parens){
-        var self = this, generator = self._codegen;
-        function doit() {
-            self.add_comments(stream);
-            self.add_source_map(stream);
-            generator(self, stream);
-        }
+    var use_asm = false;
+
+    AST_Node.DEFMETHOD("print", function(stream, force_parens) {
+        var self = this;
         stream.push_node(self);
         if (force_parens || self.needs_parens(stream)) {
             stream.with_parens(doit);
@@ -383,305 +630,374 @@
             doit();
         }
         stream.pop_node();
-    });
-
-    AST_Node.DEFMETHOD("print_to_string", function(options){
-        var s = OutputStream(options);
-        this.print(s);
-        return s.get();
-    });
-
-    /* -----[ comments ]----- */
-
-    AST_Node.DEFMETHOD("add_comments", function(output){
-        var c = output.option("comments"), self = this;
-        if (c) {
-            var start = self.start;
-            if (start && !start._comments_dumped) {
-                start._comments_dumped = true;
-                var comments = start.comments_before || [];
-
-                // XXX: ugly fix for https://github.com/mishoo/UglifyJS2/issues/112
-                //               and https://github.com/mishoo/UglifyJS2/issues/372
-                if (self instanceof AST_Exit && self.value) {
-                    self.value.walk(new TreeWalker(function(node){
-                        if (node.start && node.start.comments_before) {
-                            comments = comments.concat(node.start.comments_before);
-                            node.start.comments_before = [];
-                        }
-                        if (node instanceof AST_Function ||
-                            node instanceof AST_Array ||
-                            node instanceof AST_Object)
-                        {
-                            return true; // don't go inside.
-                        }
-                    }));
-                }
-
-                if (c.test) {
-                    comments = comments.filter(function(comment){
-                        return c.test(comment.value);
-                    });
-                } else if (typeof c == "function") {
-                    comments = comments.filter(function(comment){
-                        return c(self, comment);
-                    });
-                }
 
-                // Keep single line comments after nlb, after nlb
-                if (!output.option("beautify") && comments.length > 0 &&
-                    /comment[134]/.test(comments[0].type) &&
-                    output.col() !== 0 && comments[0].nlb)
-                {
-                    output.print("\n");
-                }
-
-                comments.forEach(function(c){
-                    if (/comment[134]/.test(c.type)) {
-                        output.print("//" + c.value + "\n");
-                        output.indent();
-                    }
-                    else if (c.type == "comment2") {
-                        output.print("/*" + c.value + "*/");
-                        if (start.nlb) {
-                            output.print("\n");
-                            output.indent();
-                        } else {
-                            output.space();
-                        }
-                    }
-                });
-            }
+        function doit() {
+            stream.prepend_comments(self);
+            self.add_source_map(stream);
+            self._codegen(stream);
+            stream.append_comments(self);
         }
     });
+    var readonly = OutputStream({
+        inline_script: false,
+        shebang: false,
+        width: false,
+    });
+    AST_Node.DEFMETHOD("print_to_string", function(options) {
+        if (options) {
+            var stream = OutputStream(options);
+            this.print(stream);
+            return stream.get();
+        }
+        this.print(readonly);
+        return readonly.reset();
+    });
 
     /* -----[ PARENTHESES ]----- */
 
     function PARENS(nodetype, func) {
-        if (Array.isArray(nodetype)) {
-            nodetype.forEach(function(nodetype){
-                PARENS(nodetype, func);
-            });
-        } else {
-            nodetype.DEFMETHOD("needs_parens", func);
-        }
-    };
+        nodetype.DEFMETHOD("needs_parens", func);
+    }
 
-    PARENS(AST_Node, function(){
-        return false;
-    });
+    PARENS(AST_Node, return_false);
 
     // a function expression needs parens around it when it's provably
     // the first token to appear in a statement.
-    PARENS(AST_Function, function(output){
-        return first_in_statement(output);
-    });
+    function needs_parens_function(output) {
+        var p = output.parent();
+        if (!output.has_parens() && first_in_statement(output, false, true)) {
+            // export default function() {}
+            // export default (function foo() {});
+            // export default (function() {})(foo);
+            // export default (function() {})`foo`;
+            // export default (function() {}) ? foo : bar;
+            return this.name || !(p instanceof AST_ExportDefault);
+        }
+        if (output.option("webkit") && p instanceof AST_PropAccess && p.expression === this) return true;
+        if (output.option("wrap_iife") && p instanceof AST_Call && p.expression === this) return true;
+    }
+    PARENS(AST_AsyncFunction, needs_parens_function);
+    PARENS(AST_AsyncGeneratorFunction, needs_parens_function);
+    PARENS(AST_ClassExpression, needs_parens_function);
+    PARENS(AST_Function, needs_parens_function);
+    PARENS(AST_GeneratorFunction, needs_parens_function);
 
     // same goes for an object literal, because otherwise it would be
     // interpreted as a block of code.
-    PARENS(AST_Object, function(output){
-        return first_in_statement(output);
-    });
+    function needs_parens_obj(output) {
+        return !output.has_parens() && first_in_statement(output, true);
+    }
+    PARENS(AST_Object, needs_parens_obj);
 
-    PARENS([ AST_Unary, AST_Undefined ], function(output){
+    function needs_parens_unary(output) {
         var p = output.parent();
-        return p instanceof AST_PropAccess && p.expression === this;
-    });
+        // (-x) ** y
+        if (p instanceof AST_Binary) return p.operator == "**" && p.left === this;
+        // (await x)(y)
+        // new (await x)
+        if (p instanceof AST_Call) return p.expression === this;
+        // class extends (x++) {}
+        // class x extends (typeof y) {}
+        if (p instanceof AST_Class) return true;
+        // (x++)[y]
+        // (typeof x).y
+        // https://github.com/mishoo/UglifyJS/issues/115
+        if (p instanceof AST_PropAccess) return p.expression === this;
+        // (~x)`foo`
+        if (p instanceof AST_Template) return p.tag === this;
+    }
+    PARENS(AST_Await, needs_parens_unary);
+    PARENS(AST_Unary, needs_parens_unary);
 
-    PARENS(AST_Seq, function(output){
+    PARENS(AST_Sequence, function(output) {
         var p = output.parent();
-        return p instanceof AST_Call             // (foo, bar)() or foo(1, (2, 3), 4)
-            || p instanceof AST_Unary            // !(foo, bar, baz)
-            || p instanceof AST_Binary           // 1 + (2, 3) + 4 ==> 8
-            || p instanceof AST_VarDef           // var a = (1, 2), b = a + a; ==> b == 4
-            || p instanceof AST_PropAccess       // (1, {foo:2}).foo or (1, {foo:2})["foo"] ==> 2
-            || p instanceof AST_Array            // [ 1, (2, 3), 4 ] ==> [ 1, 3, 4 ]
-            || p instanceof AST_ObjectProperty   // { foo: (1, 2) }.foo ==> 2
-            || p instanceof AST_Conditional      /* (false, true) ? (a = 10, b = 20) : (c = 30)
-                                                  * ==> 20 (side effect, set a := 10 and b := 20) */
-        ;
+            // [ 1, (2, 3), 4 ] ---> [ 1, 3, 4 ]
+        return p instanceof AST_Array
+            // () ---> (foo, bar)
+            || is_arrow(p) && p.value === this
+            // await (foo, bar)
+            || p instanceof AST_Await
+            // 1 + (2, 3) + 4 ---> 8
+            || p instanceof AST_Binary
+            // new (foo, bar) or foo(1, (2, 3), 4)
+            || p instanceof AST_Call
+            // class extends (foo, bar) {}
+            // class foo extends (bar, baz) {}
+            || p instanceof AST_Class
+            // class { foo = (bar, baz) }
+            // class { [(foo, bar)]() {} }
+            || p instanceof AST_ClassProperty
+            // (false, true) ? (a = 10, b = 20) : (c = 30)
+            // ---> 20 (side effect, set a := 10 and b := 20)
+            || p instanceof AST_Conditional
+            // [ a = (1, 2) ] = [] ---> a == 2
+            || p instanceof AST_DefaultValue
+            // { [(1, 2)]: foo } = bar
+            // { 1: (2, foo) } = bar
+            || p instanceof AST_DestructuredKeyVal
+            // export default (foo, bar)
+            || p instanceof AST_ExportDefault
+            // for (foo of (bar, baz));
+            || p instanceof AST_ForOf
+            // { [(1, 2)]: 3 }[2] ---> 3
+            // { foo: (1, 2) }.foo ---> 2
+            || p instanceof AST_ObjectProperty
+            // (1, {foo:2}).foo or (1, {foo:2})["foo"] ---> 2
+            || p instanceof AST_PropAccess && p.expression === this
+            // ...(foo, bar, baz)
+            || p instanceof AST_Spread
+            // (foo, bar)`baz`
+            || p instanceof AST_Template && p.tag === this
+            // !(foo, bar, baz)
+            || p instanceof AST_Unary
+            // var a = (1, 2), b = a + a; ---> b == 4
+            || p instanceof AST_VarDef
+            // yield (foo, bar)
+            || p instanceof AST_Yield;
     });
 
-    PARENS(AST_Binary, function(output){
+    PARENS(AST_Binary, function(output) {
         var p = output.parent();
-        // (foo && bar)()
-        if (p instanceof AST_Call && p.expression === this)
-            return true;
-        // typeof (foo && bar)
-        if (p instanceof AST_Unary)
-            return true;
-        // (foo && bar)["prop"], (foo && bar).prop
-        if (p instanceof AST_PropAccess && p.expression === this)
-            return true;
-        // this deals with precedence: 3 * (2 + 1)
+        // await (foo && bar)
+        if (p instanceof AST_Await) return true;
+        // this deals with precedence:
+        //   3 * (2 + 1)
+        //   3 - (2 - 1)
+        //   (1 ** 2) ** 3
         if (p instanceof AST_Binary) {
             var po = p.operator, pp = PRECEDENCE[po];
             var so = this.operator, sp = PRECEDENCE[so];
-            if (pp > sp
-                || (pp == sp
-                    && this === p.right)) {
-                return true;
-            }
+            return pp > sp
+                || po == "??" && (so == "&&" || so == "||")
+                || (pp == sp && this === p[po == "**" ? "left" : "right"]);
         }
+        // (foo && bar)()
+        if (p instanceof AST_Call) return p.expression === this;
+        // class extends (foo && bar) {}
+        // class foo extends (bar || null) {}
+        if (p instanceof AST_Class) return true;
+        // (foo && bar)["prop"], (foo && bar).prop
+        if (p instanceof AST_PropAccess) return p.expression === this;
+        // (foo && bar)``
+        if (p instanceof AST_Template) return p.tag === this;
+        // typeof (foo && bar)
+        if (p instanceof AST_Unary) return true;
     });
 
-    PARENS(AST_PropAccess, function(output){
+    function need_chain_parens(node, parent) {
+        if (!node.terminal) return false;
+        if (!(parent instanceof AST_Call || parent instanceof AST_PropAccess)) return false;
+        return parent.expression === node;
+    }
+
+    PARENS(AST_PropAccess, function(output) {
+        var node = this;
         var p = output.parent();
-        if (p instanceof AST_New && p.expression === this) {
-            // i.e. new (foo.bar().baz)
-            //
-            // if there's one call into this subtree, then we need
-            // parens around it too, otherwise the call will be
-            // interpreted as passing the arguments to the upper New
-            // expression.
-            try {
-                this.walk(new TreeWalker(function(node){
-                    if (node instanceof AST_Call) throw p;
-                }));
-            } catch(ex) {
-                if (ex !== p) throw ex;
-                return true;
-            }
-        }
+        // i.e. new (foo().bar)
+        //
+        // if there's one call into this subtree, then we need
+        // parens around it too, otherwise the call will be
+        // interpreted as passing the arguments to the upper New
+        // expression.
+        if (p instanceof AST_New && p.expression === node && root_expr(node).TYPE == "Call") return true;
+        // (foo?.bar)()
+        // (foo?.bar).baz
+        // new (foo?.bar)()
+        return need_chain_parens(node, p);
     });
 
-    PARENS(AST_Call, function(output){
-        var p = output.parent(), p1;
-        if (p instanceof AST_New && p.expression === this)
-            return true;
-
-        // workaround for Safari bug.
+    PARENS(AST_Call, function(output) {
+        var node = this;
+        var p = output.parent();
+        if (p instanceof AST_New) return p.expression === node;
         // https://bugs.webkit.org/show_bug.cgi?id=123506
-        return this.expression instanceof AST_Function
+        if (output.option("webkit")
+            && node.expression instanceof AST_Function
             && p instanceof AST_PropAccess
-            && p.expression === this
-            && (p1 = output.parent(1)) instanceof AST_Assign
-            && p1.left === p;
+            && p.expression === node) {
+            var g = output.parent(1);
+            if (g instanceof AST_Assign && g.left === p) return true;
+        }
+        // (foo?.())()
+        // (foo?.()).bar
+        // new (foo?.())()
+        return need_chain_parens(node, p);
     });
 
-    PARENS(AST_New, function(output){
+    PARENS(AST_New, function(output) {
+        if (need_constructor_parens(this, output)) return false;
         var p = output.parent();
-        if (no_constructor_parens(this, output)
-            && (p instanceof AST_PropAccess // (new Date).getTime(), (new Date)["getTime"]()
-                || p instanceof AST_Call && p.expression === this)) // (new foo)(bar)
-            return true;
+        // (new foo)(bar)
+        if (p instanceof AST_Call) return p.expression === this;
+        // (new Date).getTime(), (new Date)["getTime"]()
+        if (p instanceof AST_PropAccess) return true;
+        // (new foo)`bar`
+        if (p instanceof AST_Template) return p.tag === this;
     });
 
-    PARENS(AST_Number, function(output){
+    PARENS(AST_Number, function(output) {
+        if (!output.option("galio")) return false;
+        // https://github.com/mishoo/UglifyJS/pull/1009
         var p = output.parent();
-        if (this.getValue() < 0 && p instanceof AST_PropAccess && p.expression === this)
-            return true;
+        return p instanceof AST_PropAccess && p.expression === this && /^0/.test(make_num(this.value));
     });
 
-    PARENS([ AST_Assign, AST_Conditional ], function (output){
+    function needs_parens_assign_cond(self, output) {
         var p = output.parent();
-        // !(a = false) → true
-        if (p instanceof AST_Unary)
-            return true;
+        // await (a = foo)
+        if (p instanceof AST_Await) return true;
         // 1 + (a = 2) + 3 → 6, side effect setting a = 2
-        if (p instanceof AST_Binary && !(p instanceof AST_Assign))
-            return true;
+        if (p instanceof AST_Binary) return !(p instanceof AST_Assign);
         // (a = func)() —or— new (a = Object)()
-        if (p instanceof AST_Call && p.expression === this)
-            return true;
+        if (p instanceof AST_Call) return p.expression === self;
+        // class extends (a = foo) {}
+        // class foo extends (bar ? baz : moo) {}
+        if (p instanceof AST_Class) return true;
         // (a = foo) ? bar : baz
-        if (p instanceof AST_Conditional && p.condition === this)
-            return true;
+        if (p instanceof AST_Conditional) return p.condition === self;
         // (a = foo)["prop"] —or— (a = foo).prop
-        if (p instanceof AST_PropAccess && p.expression === this)
-            return true;
+        if (p instanceof AST_PropAccess) return p.expression === self;
+        // (a = foo)`bar`
+        if (p instanceof AST_Template) return p.tag === self;
+        // !(a = false) → true
+        if (p instanceof AST_Unary) return true;
+    }
+    PARENS(AST_Arrow, function(output) {
+        return needs_parens_assign_cond(this, output);
+    });
+    PARENS(AST_Assign, function(output) {
+        if (needs_parens_assign_cond(this, output)) return true;
+        //  v8 parser bug   --->     workaround
+        // f([1], [a] = []) ---> f([1], ([a] = []))
+        if (output.option("v8")) return this.left instanceof AST_Destructured;
+        // ({ p: a } = o);
+        if (this.left instanceof AST_DestructuredObject) return needs_parens_obj(output);
+    });
+    PARENS(AST_AsyncArrow, function(output) {
+        return needs_parens_assign_cond(this, output);
+    });
+    PARENS(AST_Conditional, function(output) {
+        return needs_parens_assign_cond(this, output)
+            // https://github.com/mishoo/UglifyJS/issues/1144
+            || output.option("extendscript") && output.parent() instanceof AST_Conditional;
+    });
+    PARENS(AST_Yield, function(output) {
+        return needs_parens_assign_cond(this, output);
     });
 
     /* -----[ PRINTERS ]----- */
 
-    DEFPRINT(AST_Directive, function(self, output){
-        output.print_string(self.value, self.quote);
+    DEFPRINT(AST_Directive, function(output) {
+        var quote = this.quote;
+        var value = this.value;
+        switch (output.option("quote_style")) {
+          case 0:
+          case 2:
+            if (value.indexOf('"') == -1) quote = '"';
+            break;
+          case 1:
+            if (value.indexOf("'") == -1) quote = "'";
+            break;
+        }
+        output.print(quote + value + quote);
         output.semicolon();
     });
-    DEFPRINT(AST_Debugger, function(self, output){
+    DEFPRINT(AST_Debugger, function(output) {
         output.print("debugger");
         output.semicolon();
     });
 
     /* -----[ statements ]----- */
 
-    function display_body(body, is_toplevel, output) {
+    function display_body(body, is_toplevel, output, allow_directives) {
         var last = body.length - 1;
-        body.forEach(function(stmt, i){
-            if (!(stmt instanceof AST_EmptyStatement)) {
-                output.indent();
-                stmt.print(output);
-                if (!(i == last && is_toplevel)) {
-                    output.newline();
-                    if (is_toplevel) output.newline();
+        var in_directive = allow_directives;
+        var was_asm = use_asm;
+        body.forEach(function(stmt, i) {
+            if (in_directive) {
+                if (stmt instanceof AST_Directive) {
+                    if (stmt.value == "use asm") use_asm = true;
+                } else if (!(stmt instanceof AST_EmptyStatement)) {
+                    if (stmt instanceof AST_SimpleStatement && stmt.body instanceof AST_String) {
+                        output.force_semicolon();
+                    }
+                    in_directive = false;
                 }
             }
+            if (stmt instanceof AST_EmptyStatement) return;
+            output.indent();
+            stmt.print(output);
+            if (i == last && is_toplevel) return;
+            output.newline();
+            if (is_toplevel) output.newline();
         });
-    };
-
-    AST_StatementWithBody.DEFMETHOD("_do_print_body", function(output){
-        force_statement(this.body, output);
-    });
+        use_asm = was_asm;
+    }
 
-    DEFPRINT(AST_Statement, function(self, output){
-        self.body.print(output);
-        output.semicolon();
-    });
-    DEFPRINT(AST_Toplevel, function(self, output){
-        display_body(self.body, true, output);
+    DEFPRINT(AST_Toplevel, function(output) {
+        display_body(this.body, true, output, true);
         output.print("");
     });
-    DEFPRINT(AST_LabeledStatement, function(self, output){
-        self.label.print(output);
+    DEFPRINT(AST_LabeledStatement, function(output) {
+        this.label.print(output);
         output.colon();
-        self.body.print(output);
+        this.body.print(output);
     });
-    DEFPRINT(AST_SimpleStatement, function(self, output){
-        self.body.print(output);
+    DEFPRINT(AST_SimpleStatement, function(output) {
+        this.body.print(output);
         output.semicolon();
     });
-    function print_bracketed(body, output) {
-        if (body.length > 0) output.with_block(function(){
-            display_body(body, false, output);
+    function print_braced_empty(self, output) {
+        output.print("{");
+        output.with_indent(function() {
+            output.append_comments(self, true);
         });
-        else output.print("{}");
-    };
-    DEFPRINT(AST_BlockStatement, function(self, output){
-        print_bracketed(self.body, output);
+        output.print("}");
+    }
+    function print_braced(self, output, allow_directives) {
+        if (self.body.length > 0) {
+            output.with_block(function() {
+                display_body(self.body, false, output, allow_directives);
+            }, self.end);
+        } else print_braced_empty(self, output);
+    }
+    DEFPRINT(AST_BlockStatement, function(output) {
+        print_braced(this, output);
     });
-    DEFPRINT(AST_EmptyStatement, function(self, output){
+    DEFPRINT(AST_EmptyStatement, function(output) {
         output.semicolon();
     });
-    DEFPRINT(AST_Do, function(self, output){
+    DEFPRINT(AST_Do, function(output) {
+        var self = this;
         output.print("do");
-        output.space();
-        self._do_print_body(output);
+        make_block(self.body, output);
         output.space();
         output.print("while");
         output.space();
-        output.with_parens(function(){
+        output.with_parens(function() {
             self.condition.print(output);
         });
         output.semicolon();
     });
-    DEFPRINT(AST_While, function(self, output){
+    DEFPRINT(AST_While, function(output) {
+        var self = this;
         output.print("while");
         output.space();
-        output.with_parens(function(){
+        output.with_parens(function() {
             self.condition.print(output);
         });
-        output.space();
-        self._do_print_body(output);
+        force_statement(self.body, output);
     });
-    DEFPRINT(AST_For, function(self, output){
+    DEFPRINT(AST_For, function(output) {
+        var self = this;
         output.print("for");
         output.space();
-        output.with_parens(function(){
-            if (self.init && !(self.init instanceof AST_EmptyStatement)) {
+        output.with_parens(function() {
+            if (self.init) {
                 if (self.init instanceof AST_Definitions) {
                     self.init.print(output);
                 } else {
-                    parenthesize_for_noin(self.init, output, true);
+                    parenthesize_for_no_in(self.init, output, true);
                 }
                 output.print(";");
                 output.space();
@@ -699,112 +1015,295 @@
                 self.step.print(output);
             }
         });
-        output.space();
-        self._do_print_body(output);
+        force_statement(self.body, output);
     });
-    DEFPRINT(AST_ForIn, function(self, output){
-        output.print("for");
-        output.space();
-        output.with_parens(function(){
-            self.init.print(output);
+    function print_for_enum(prefix, infix) {
+        return function(output) {
+            var self = this;
+            output.print(prefix);
             output.space();
-            output.print("in");
-            output.space();
-            self.object.print(output);
-        });
-        output.space();
-        self._do_print_body(output);
-    });
-    DEFPRINT(AST_With, function(self, output){
+            output.with_parens(function() {
+                self.init.print(output);
+                output.space();
+                output.print(infix);
+                output.space();
+                self.object.print(output);
+            });
+            force_statement(self.body, output);
+        };
+    }
+    DEFPRINT(AST_ForAwaitOf, print_for_enum("for await", "of"));
+    DEFPRINT(AST_ForIn, print_for_enum("for", "in"));
+    DEFPRINT(AST_ForOf, print_for_enum("for", "of"));
+    DEFPRINT(AST_With, function(output) {
+        var self = this;
         output.print("with");
         output.space();
-        output.with_parens(function(){
+        output.with_parens(function() {
             self.expression.print(output);
         });
+        force_statement(self.body, output);
+    });
+    DEFPRINT(AST_ExportDeclaration, function(output) {
+        output.print("export");
         output.space();
-        self._do_print_body(output);
+        this.body.print(output);
     });
+    DEFPRINT(AST_ExportDefault, function(output) {
+        output.print("export");
+        output.space();
+        output.print("default");
+        output.space();
+        var body = this.body;
+        body.print(output);
+        if (body instanceof AST_ClassExpression) {
+            if (!body.name) return;
+        }
+        if (body instanceof AST_DefClass) return;
+        if (body instanceof AST_LambdaDefinition) return;
+        if (body instanceof AST_LambdaExpression) {
+            if (!body.name && !is_arrow(body)) return;
+        }
+        output.semicolon();
+    });
+    function print_alias(alias, output) {
+        var value = alias.value;
+        if (value == "*" || is_identifier_string(value)) {
+            output.print_name(value);
+        } else {
+            output.print_string(value, alias.quote);
+        }
+    }
+    DEFPRINT(AST_ExportForeign, function(output) {
+        var self = this;
+        output.print("export");
+        output.space();
+        var len = self.keys.length;
+        if (len == 0) {
+            print_braced_empty(self, output);
+        } else if (self.keys[0].value == "*") {
+            print_entry(0);
+        } else output.with_block(function() {
+            output.indent();
+            print_entry(0);
+            for (var i = 1; i < len; i++) {
+                output.print(",");
+                output.newline();
+                output.indent();
+                print_entry(i);
+            }
+            output.newline();
+        }, self.end);
+        output.space();
+        output.print("from");
+        output.space();
+        self.path.print(output);
+        output.semicolon();
 
-    /* -----[ functions ]----- */
-    AST_Lambda.DEFMETHOD("_do_print", function(output, nokeyword){
+        function print_entry(index) {
+            var alias = self.aliases[index];
+            var key = self.keys[index];
+            print_alias(key, output);
+            if (alias.value != key.value) {
+                output.space();
+                output.print("as");
+                output.space();
+                print_alias(alias, output);
+            }
+        }
+    });
+    DEFPRINT(AST_ExportReferences, function(output) {
+        var self = this;
+        output.print("export");
+        output.space();
+        print_properties(self, output);
+        output.semicolon();
+    });
+    DEFPRINT(AST_Import, function(output) {
         var self = this;
-        if (!nokeyword) {
-            output.print("function");
+        output.print("import");
+        output.space();
+        if (self.default) self.default.print(output);
+        if (self.all) {
+            if (self.default) output.comma();
+            self.all.print(output);
+        }
+        if (self.properties) {
+            if (self.default) output.comma();
+            print_properties(self, output);
         }
-        if (self.name) {
+        if (self.all || self.default || self.properties) {
+            output.space();
+            output.print("from");
             output.space();
-            self.name.print(output);
         }
-        output.with_parens(function(){
-            self.argnames.forEach(function(arg, i){
+        self.path.print(output);
+        output.semicolon();
+    });
+
+    /* -----[ functions ]----- */
+    function print_funargs(self, output) {
+        output.with_parens(function() {
+            self.argnames.forEach(function(arg, i) {
                 if (i) output.comma();
                 arg.print(output);
             });
+            if (self.rest) {
+                if (self.argnames.length) output.comma();
+                output.print("...");
+                self.rest.print(output);
+            }
         });
+    }
+    function print_arrow(self, output) {
+        var argname = self.argnames.length == 1 && !self.rest && self.argnames[0];
+        if (argname instanceof AST_SymbolFunarg && argname.name != "yield") {
+            argname.print(output);
+        } else {
+            print_funargs(self, output);
+        }
         output.space();
-        print_bracketed(self.body, output);
+        output.print("=>");
+        output.space();
+        if (self.value) {
+            self.value.print(output);
+        } else {
+            print_braced(self, output, true);
+        }
+    }
+    DEFPRINT(AST_Arrow, function(output) {
+        print_arrow(this, output);
     });
-    DEFPRINT(AST_Lambda, function(self, output){
-        self._do_print(output);
+    DEFPRINT(AST_AsyncArrow, function(output) {
+        output.print("async");
+        output.space();
+        print_arrow(this, output);
     });
-
-    /* -----[ exits ]----- */
-    AST_Exit.DEFMETHOD("_do_print", function(output, kind){
-        output.print(kind);
-        if (this.value) {
+    function print_lambda(self, output) {
+        if (self.name) {
             output.space();
-            this.value.print(output);
+            self.name.print(output);
         }
-        output.semicolon();
-    });
-    DEFPRINT(AST_Return, function(self, output){
-        self._do_print(output, "return");
-    });
-    DEFPRINT(AST_Throw, function(self, output){
-        self._do_print(output, "throw");
+        print_funargs(self, output);
+        output.space();
+        print_braced(self, output, true);
+    }
+    DEFPRINT(AST_Lambda, function(output) {
+        output.print("function");
+        print_lambda(this, output);
     });
+    function print_async(output) {
+        output.print("async");
+        output.space();
+        output.print("function");
+        print_lambda(this, output);
+    }
+    DEFPRINT(AST_AsyncDefun, print_async);
+    DEFPRINT(AST_AsyncFunction, print_async);
+    function print_async_generator(output) {
+        output.print("async");
+        output.space();
+        output.print("function*");
+        print_lambda(this, output);
+    }
+    DEFPRINT(AST_AsyncGeneratorDefun, print_async_generator);
+    DEFPRINT(AST_AsyncGeneratorFunction, print_async_generator);
+    function print_generator(output) {
+        output.print("function*");
+        print_lambda(this, output);
+    }
+    DEFPRINT(AST_GeneratorDefun, print_generator);
+    DEFPRINT(AST_GeneratorFunction, print_generator);
 
-    /* -----[ loop control ]----- */
-    AST_LoopControl.DEFMETHOD("_do_print", function(output, kind){
-        output.print(kind);
-        if (this.label) {
+    /* -----[ classes ]----- */
+    DEFPRINT(AST_Class, function(output) {
+        var self = this;
+        output.print("class");
+        if (self.name) {
             output.space();
-            this.label.print(output);
+            self.name.print(output);
+        }
+        if (self.extends) {
+            output.space();
+            output.print("extends");
+            output.space();
+            self.extends.print(output);
+        }
+        output.space();
+        print_properties(self, output, true);
+    });
+    DEFPRINT(AST_ClassField, function(output) {
+        var self = this;
+        if (self.static) {
+            output.print("static");
+            output.space();
+        }
+        print_property_key(self, output);
+        if (self.value) {
+            output.space();
+            output.print("=");
+            output.space();
+            self.value.print(output);
         }
         output.semicolon();
     });
-    DEFPRINT(AST_Break, function(self, output){
-        self._do_print(output, "break");
+    DEFPRINT(AST_ClassGetter, print_accessor("get"));
+    DEFPRINT(AST_ClassSetter, print_accessor("set"));
+    function print_method(self, output) {
+        var fn = self.value;
+        if (is_async(fn)) {
+            output.print("async");
+            output.space();
+        }
+        if (is_generator(fn)) output.print("*");
+        print_property_key(self, output);
+        print_lambda(self.value, output);
+    }
+    DEFPRINT(AST_ClassMethod, function(output) {
+        var self = this;
+        if (self.static) {
+            output.print("static");
+            output.space();
+        }
+        print_method(self, output);
     });
-    DEFPRINT(AST_Continue, function(self, output){
-        self._do_print(output, "continue");
+    DEFPRINT(AST_ClassInit, function(output) {
+        output.print("static");
+        output.space();
+        print_braced(this.value, output);
     });
 
+    /* -----[ jumps ]----- */
+    function print_jump(kind, prop) {
+        return function(output) {
+            output.print(kind);
+            var target = this[prop];
+            if (target) {
+                output.space();
+                target.print(output);
+            }
+            output.semicolon();
+        };
+    }
+    DEFPRINT(AST_Return, print_jump("return", "value"));
+    DEFPRINT(AST_Throw, print_jump("throw", "value"));
+    DEFPRINT(AST_Break, print_jump("break", "label"));
+    DEFPRINT(AST_Continue, print_jump("continue", "label"));
+
     /* -----[ if ]----- */
     function make_then(self, output) {
-        if (output.option("bracketize")) {
-            make_block(self.body, output);
-            return;
-        }
+        var b = self.body;
+        if (output.option("braces") && !(b instanceof AST_Const || b instanceof AST_Let)
+            || output.option("ie") && b instanceof AST_Do)
+            return make_block(b, output);
         // The squeezer replaces "block"-s that contain only a single
         // statement with the statement itself; technically, the AST
         // is correct, but this can create problems when we output an
         // IF having an ELSE clause where the THEN clause ends in an
         // IF *without* an ELSE block (then the outer ELSE would refer
         // to the inner IF).  This function checks for this case and
-        // adds the block brackets if needed.
-        if (!self.body)
-            return output.force_semicolon();
-        if (self.body instanceof AST_Do
-            && !output.option("screw_ie8")) {
-            // https://github.com/mishoo/UglifyJS/issues/#issue/57 IE
-            // croaks with "syntax error" on code like this: if (foo)
-            // do ... while(cond); else ...  we need block brackets
-            // around do/while
-            make_block(self.body, output);
-            return;
-        }
-        var b = self.body;
+        // adds the block braces if needed.
+        if (!b) return output.force_semicolon();
         while (true) {
             if (b instanceof AST_If) {
                 if (!b.alternative) {
@@ -812,76 +1311,81 @@
                     return;
                 }
                 b = b.alternative;
-            }
-            else if (b instanceof AST_StatementWithBody) {
+            } else if (b instanceof AST_StatementWithBody) {
                 b = b.body;
-            }
-            else break;
+            } else break;
         }
         force_statement(self.body, output);
-    };
-    DEFPRINT(AST_If, function(self, output){
+    }
+    DEFPRINT(AST_If, function(output) {
+        var self = this;
         output.print("if");
         output.space();
-        output.with_parens(function(){
+        output.with_parens(function() {
             self.condition.print(output);
         });
-        output.space();
         if (self.alternative) {
             make_then(self, output);
             output.space();
             output.print("else");
-            output.space();
-            force_statement(self.alternative, output);
+            if (self.alternative instanceof AST_If) {
+                output.space();
+                self.alternative.print(output);
+            } else {
+                force_statement(self.alternative, output);
+            }
         } else {
-            self._do_print_body(output);
+            force_statement(self.body, output);
         }
     });
 
     /* -----[ switch ]----- */
-    DEFPRINT(AST_Switch, function(self, output){
+    DEFPRINT(AST_Switch, function(output) {
+        var self = this;
         output.print("switch");
         output.space();
-        output.with_parens(function(){
+        output.with_parens(function() {
             self.expression.print(output);
         });
         output.space();
-        if (self.body.length > 0) output.with_block(function(){
-            self.body.forEach(function(stmt, i){
-                if (i) output.newline();
+        var last = self.body.length - 1;
+        if (last < 0) print_braced_empty(self, output);
+        else output.with_block(function() {
+            self.body.forEach(function(branch, i) {
                 output.indent(true);
-                stmt.print(output);
+                branch.print(output);
+                if (i < last && branch.body.length > 0)
+                    output.newline();
             });
-        });
-        else output.print("{}");
+        }, self.end);
     });
-    AST_SwitchBranch.DEFMETHOD("_do_print_body", function(output){
-        if (this.body.length > 0) {
+    function print_branch_body(self, output) {
+        output.newline();
+        self.body.forEach(function(stmt) {
+            output.indent();
+            stmt.print(output);
             output.newline();
-            this.body.forEach(function(stmt){
-                output.indent();
-                stmt.print(output);
-                output.newline();
-            });
-        }
-    });
-    DEFPRINT(AST_Default, function(self, output){
+        });
+    }
+    DEFPRINT(AST_Default, function(output) {
         output.print("default:");
-        self._do_print_body(output);
+        print_branch_body(this, output);
     });
-    DEFPRINT(AST_Case, function(self, output){
+    DEFPRINT(AST_Case, function(output) {
+        var self = this;
         output.print("case");
         output.space();
         self.expression.print(output);
         output.print(":");
-        self._do_print_body(output);
+        print_branch_body(self, output);
     });
 
     /* -----[ exceptions ]----- */
-    DEFPRINT(AST_Try, function(self, output){
+    DEFPRINT(AST_Try, function(output) {
+        var self = this;
         output.print("try");
         output.space();
-        print_bracketed(self.body, output);
+        print_braced(self, output);
         if (self.bcatch) {
             output.space();
             self.bcatch.print(output);
@@ -891,163 +1395,182 @@
             self.bfinally.print(output);
         }
     });
-    DEFPRINT(AST_Catch, function(self, output){
+    DEFPRINT(AST_Catch, function(output) {
+        var self = this;
         output.print("catch");
+        if (self.argname) {
+            output.space();
+            output.with_parens(function() {
+                self.argname.print(output);
+            });
+        }
         output.space();
-        output.with_parens(function(){
-            self.argname.print(output);
-        });
-        output.space();
-        print_bracketed(self.body, output);
+        print_braced(self, output);
     });
-    DEFPRINT(AST_Finally, function(self, output){
+    DEFPRINT(AST_Finally, function(output) {
         output.print("finally");
         output.space();
-        print_bracketed(self.body, output);
+        print_braced(this, output);
     });
 
-    /* -----[ var/const ]----- */
-    AST_Definitions.DEFMETHOD("_do_print", function(output, kind){
-        output.print(kind);
-        output.space();
-        this.definitions.forEach(function(def, i){
-            if (i) output.comma();
-            def.print(output);
-        });
-        var p = output.parent();
-        var in_for = p instanceof AST_For || p instanceof AST_ForIn;
-        var avoid_semicolon = in_for && p.init === this;
-        if (!avoid_semicolon)
-            output.semicolon();
-    });
-    DEFPRINT(AST_Var, function(self, output){
-        self._do_print(output, "var");
-    });
-    DEFPRINT(AST_Const, function(self, output){
-        self._do_print(output, "const");
-    });
-
-    function parenthesize_for_noin(node, output, noin) {
-        if (!noin) node.print(output);
-        else try {
-            // need to take some precautions here:
-            //    https://github.com/mishoo/UglifyJS2/issues/60
-            node.walk(new TreeWalker(function(node){
-                if (node instanceof AST_Binary && node.operator == "in")
-                    throw output;
-            }));
-            node.print(output);
-        } catch(ex) {
-            if (ex !== output) throw ex;
-            node.print(output, true);
-        }
-    };
+    function print_definitions(type) {
+        return function(output) {
+            var self = this;
+            output.print(type);
+            output.space();
+            self.definitions.forEach(function(def, i) {
+                if (i) output.comma();
+                def.print(output);
+            });
+            var p = output.parent();
+            if (!(p instanceof AST_IterationStatement && p.init === self)) output.semicolon();
+        };
+    }
+    DEFPRINT(AST_Const, print_definitions("const"));
+    DEFPRINT(AST_Let, print_definitions("let"));
+    DEFPRINT(AST_Var, print_definitions("var"));
+
+    function parenthesize_for_no_in(node, output, no_in) {
+        var parens = false;
+        // need to take some precautions here:
+        //    https://github.com/mishoo/UglifyJS/issues/60
+        if (no_in) node.walk(new TreeWalker(function(node) {
+            if (parens) return true;
+            if (node instanceof AST_Binary && node.operator == "in") return parens = true;
+            if (node instanceof AST_Scope && !(is_arrow(node) && node.value)) return true;
+        }));
+        node.print(output, parens);
+    }
 
-    DEFPRINT(AST_VarDef, function(self, output){
+    DEFPRINT(AST_VarDef, function(output) {
+        var self = this;
         self.name.print(output);
         if (self.value) {
             output.space();
             output.print("=");
             output.space();
             var p = output.parent(1);
-            var noin = p instanceof AST_For || p instanceof AST_ForIn;
-            parenthesize_for_noin(self.value, output, noin);
+            var no_in = p instanceof AST_For || p instanceof AST_ForEnumeration;
+            parenthesize_for_no_in(self.value, output, no_in);
         }
     });
 
+    DEFPRINT(AST_DefaultValue, function(output) {
+        var self = this;
+        self.name.print(output);
+        output.space();
+        output.print("=");
+        output.space();
+        self.value.print(output);
+    });
+
     /* -----[ other expressions ]----- */
-    DEFPRINT(AST_Call, function(self, output){
-        self.expression.print(output);
-        if (self instanceof AST_New && no_constructor_parens(self, output))
-            return;
-        output.with_parens(function(){
-            self.args.forEach(function(expr, i){
+    function print_annotation(self, output) {
+        if (!output.option("annotations")) return;
+        if (!self.pure) return;
+        var level = 0, parent = self, node;
+        do {
+            node = parent;
+            parent = output.parent(level++);
+            if (parent instanceof AST_Call && parent.expression === node) return;
+        } while (parent instanceof AST_PropAccess && parent.expression === node);
+        output.print("/*@__PURE__*/");
+    }
+    function print_call_args(self, output) {
+        output.with_parens(function() {
+            self.args.forEach(function(expr, i) {
                 if (i) output.comma();
                 expr.print(output);
             });
+            output.add_mapping(self.end);
         });
+    }
+    DEFPRINT(AST_Call, function(output) {
+        var self = this;
+        print_annotation(self, output);
+        self.expression.print(output);
+        if (self.optional) output.print("?.");
+        print_call_args(self, output);
     });
-    DEFPRINT(AST_New, function(self, output){
+    DEFPRINT(AST_New, function(output) {
+        var self = this;
+        print_annotation(self, output);
         output.print("new");
         output.space();
-        AST_Call.prototype._codegen(self, output);
+        self.expression.print(output);
+        if (need_constructor_parens(self, output)) print_call_args(self, output);
     });
-
-    AST_Seq.DEFMETHOD("_do_print", function(output){
-        this.car.print(output);
-        if (this.cdr) {
-            output.comma();
-            if (output.should_break()) {
-                output.newline();
-                output.indent();
+    DEFPRINT(AST_Sequence, function(output) {
+        this.expressions.forEach(function(node, index) {
+            if (index > 0) {
+                output.comma();
+                if (output.should_break()) {
+                    output.newline();
+                    output.indent();
+                }
             }
-            this.cdr.print(output);
-        }
-    });
-    DEFPRINT(AST_Seq, function(self, output){
-        self._do_print(output);
-        // var p = output.parent();
-        // if (p instanceof AST_Statement) {
-        //     output.with_indent(output.next_indent(), function(){
-        //         self._do_print(output);
-        //     });
-        // } else {
-        //     self._do_print(output);
-        // }
+            node.print(output);
+        });
     });
-    DEFPRINT(AST_Dot, function(self, output){
+    DEFPRINT(AST_Dot, function(output) {
+        var self = this;
         var expr = self.expression;
         expr.print(output);
-        if (expr instanceof AST_Number && expr.getValue() >= 0) {
-            if (!/[xa-f.]/i.test(output.last())) {
-                output.print(".");
-            }
+        var prop = self.property;
+        if (output.option("ie") && RESERVED_WORDS[prop] || self.quoted && output.option("keep_quoted_props")) {
+            if (self.optional) output.print("?.");
+            output.with_square(function() {
+                output.add_mapping(self.end);
+                output.print_string(prop);
+            });
+        } else {
+            if (expr instanceof AST_Number && !/[ex.)]/i.test(output.last())) output.print(".");
+            output.print(self.optional ? "?." : ".");
+            // the name after dot would be mapped about here.
+            output.add_mapping(self.end);
+            output.print_name(prop);
         }
-        output.print(".");
-        // the name after dot would be mapped about here.
-        output.add_mapping(self.end);
-        output.print_name(self.property);
     });
-    DEFPRINT(AST_Sub, function(self, output){
+    DEFPRINT(AST_Sub, function(output) {
+        var self = this;
         self.expression.print(output);
-        output.print("[");
-        self.property.print(output);
-        output.print("]");
+        if (self.optional) output.print("?.");
+        output.with_square(function() {
+            self.property.print(output);
+        });
     });
-    DEFPRINT(AST_UnaryPrefix, function(self, output){
-        var op = self.operator;
+    DEFPRINT(AST_Spread, function(output) {
+        output.print("...");
+        this.expression.print(output);
+    });
+    DEFPRINT(AST_UnaryPrefix, function(output) {
+        var op = this.operator;
+        var exp = this.expression;
         output.print(op);
         if (/^[a-z]/i.test(op)
             || (/[+-]$/.test(op)
-                && self.expression instanceof AST_UnaryPrefix
-                && /^[+-]/.test(self.expression.operator))) {
+                && exp instanceof AST_UnaryPrefix
+                && /^[+-]/.test(exp.operator))) {
             output.space();
         }
-        self.expression.print(output);
+        exp.print(output);
     });
-    DEFPRINT(AST_UnaryPostfix, function(self, output){
+    DEFPRINT(AST_UnaryPostfix, function(output) {
+        var self = this;
         self.expression.print(output);
+        output.add_mapping(self.end);
         output.print(self.operator);
     });
-    DEFPRINT(AST_Binary, function(self, output){
+    DEFPRINT(AST_Binary, function(output) {
+        var self = this;
         self.left.print(output);
         output.space();
         output.print(self.operator);
-        if (self.operator == "<"
-            && self.right instanceof AST_UnaryPrefix
-            && self.right.operator == "!"
-            && self.right.expression instanceof AST_UnaryPrefix
-            && self.right.expression.operator == "--") {
-            // space is mandatory to avoid outputting <!--
-            // http://javascript.spec.whatwg.org/#comment-syntax
-            output.print(" ");
-        } else {
-            // the space is optional depending on "beautify"
-            output.space();
-        }
+        output.space();
         self.right.print(output);
     });
-    DEFPRINT(AST_Conditional, function(self, output){
+    DEFPRINT(AST_Conditional, function(output) {
+        var self = this;
         self.condition.print(output);
         output.space();
         output.print("?");
@@ -1057,13 +1580,25 @@
         output.colon();
         self.alternative.print(output);
     });
+    DEFPRINT(AST_Await, function(output) {
+        output.print("await");
+        output.space();
+        this.expression.print(output);
+    });
+    DEFPRINT(AST_Yield, function(output) {
+        output.print(this.nested ? "yield*" : "yield");
+        if (this.expression) {
+            output.space();
+            this.expression.print(output);
+        }
+    });
 
     /* -----[ literals ]----- */
-    DEFPRINT(AST_Array, function(self, output){
-        output.with_square(function(){
-            var a = self.elements, len = a.length;
-            if (len > 0) output.space();
-            a.forEach(function(exp, i){
+    DEFPRINT(AST_Array, function(output) {
+        var a = this.elements, len = a.length;
+        output.with_square(len > 0 ? function() {
+            output.space();
+            a.forEach(function(exp, i) {
                 if (i) output.comma();
                 exp.print(output);
                 // If the final element is a hole, we need to make sure it
@@ -1072,12 +1607,55 @@
                 if (i === len - 1 && exp instanceof AST_Hole)
                   output.comma();
             });
-            if (len > 0) output.space();
-        });
+            output.space();
+        } : noop);
     });
-    DEFPRINT(AST_Object, function(self, output){
-        if (self.properties.length > 0) output.with_block(function(){
-            self.properties.forEach(function(prop, i){
+    DEFPRINT(AST_DestructuredArray, function(output) {
+        var a = this.elements, len = a.length, rest = this.rest;
+        output.with_square(len || rest ? function() {
+            output.space();
+            a.forEach(function(exp, i) {
+                if (i) output.comma();
+                exp.print(output);
+            });
+            if (rest) {
+                if (len) output.comma();
+                output.print("...");
+                rest.print(output);
+            } else if (a[len - 1] instanceof AST_Hole) {
+                // If the final element is a hole, we need to make sure it
+                // doesn't look like a trailing comma, by inserting an actual
+                // trailing comma.
+                output.comma();
+            }
+            output.space();
+        } : noop);
+    });
+    DEFPRINT(AST_DestructuredKeyVal, function(output) {
+        var self = this;
+        var key = print_property_key(self, output);
+        var value = self.value;
+        if (key) {
+            if (value instanceof AST_DefaultValue) {
+                if (value.name instanceof AST_Symbol && key == get_symbol_name(value.name)) {
+                    output.space();
+                    output.print("=");
+                    output.space();
+                    value.value.print(output);
+                    return;
+                }
+            } else if (value instanceof AST_Symbol) {
+                if (key == get_symbol_name(value)) return;
+            }
+        }
+        output.colon();
+        value.print(output);
+    });
+    DEFPRINT(AST_DestructuredObject, function(output) {
+        var self = this;
+        var props = self.properties, len = props.length, rest = self.rest;
+        if (len || rest) output.with_block(function() {
+            props.forEach(function(prop, i) {
                 if (i) {
                     output.print(",");
                     output.newline();
@@ -1085,160 +1663,195 @@
                 output.indent();
                 prop.print(output);
             });
+            if (rest) {
+                if (len) {
+                    output.print(",");
+                    output.newline();
+                }
+                output.indent();
+                output.print("...");
+                rest.print(output);
+            }
             output.newline();
-        });
-        else output.print("{}");
+        }, self.end);
+        else print_braced_empty(self, output);
+    });
+    function print_properties(self, output, no_comma) {
+        var props = self.properties;
+        if (props.length > 0) output.with_block(function() {
+            props.forEach(function(prop, i) {
+                if (i) {
+                    if (!no_comma) output.print(",");
+                    output.newline();
+                }
+                output.indent();
+                prop.print(output);
+            });
+            output.newline();
+        }, self.end);
+        else print_braced_empty(self, output);
+    }
+    DEFPRINT(AST_Object, function(output) {
+        print_properties(this, output);
     });
-    DEFPRINT(AST_ObjectKeyVal, function(self, output){
+
+    function print_property_key(self, output) {
         var key = self.key;
-        var quote = self.quote;
-        if (output.option("quote_keys")) {
-            output.print_string(key + "");
-        } else if ((typeof key == "number"
-                    || !output.option("beautify")
-                    && +key + "" == key)
-                   && parseFloat(key) >= 0) {
+        if (key instanceof AST_Node) return output.with_square(function() {
+            key.print(output);
+        });
+        var quote = self.start && self.start.quote;
+        if (output.option("quote_keys") || quote && output.option("keep_quoted_props")) {
+            output.print_string(key, quote);
+        } else if ("" + +key == key && key >= 0) {
             output.print(make_num(key));
-        } else if (RESERVED_WORDS(key) ? output.option("screw_ie8") : is_identifier_string(key)) {
+        } else if (self.private) {
             output.print_name(key);
+        } else if (RESERVED_WORDS[key] ? !output.option("ie") : is_identifier_string(key)) {
+            output.print_name(key);
+            return key;
         } else {
             output.print_string(key, quote);
         }
+    }
+    DEFPRINT(AST_ObjectKeyVal, function(output) {
+        var self = this;
+        print_property_key(self, output);
         output.colon();
         self.value.print(output);
     });
-    DEFPRINT(AST_ObjectSetter, function(self, output){
-        output.print("set");
-        output.space();
-        self.key.print(output);
-        self.value._do_print(output, true);
+    DEFPRINT(AST_ObjectMethod, function(output) {
+        print_method(this, output);
     });
-    DEFPRINT(AST_ObjectGetter, function(self, output){
-        output.print("get");
-        output.space();
-        self.key.print(output);
-        self.value._do_print(output, true);
+    function print_accessor(type) {
+        return function(output) {
+            var self = this;
+            if (self.static) {
+                output.print("static");
+                output.space();
+            }
+            output.print(type);
+            output.space();
+            print_property_key(self, output);
+            print_lambda(self.value, output);
+        };
+    }
+    DEFPRINT(AST_ObjectGetter, print_accessor("get"));
+    DEFPRINT(AST_ObjectSetter, print_accessor("set"));
+    function get_symbol_name(sym) {
+        var def = sym.definition();
+        return def && def.mangled_name || sym.name;
+    }
+    DEFPRINT(AST_Symbol, function(output) {
+        output.print_name(get_symbol_name(this));
     });
-    DEFPRINT(AST_Symbol, function(self, output){
-        var def = self.definition();
-        output.print_name(def ? def.mangled_name || def.name : self.name);
+    DEFPRINT(AST_SymbolExport, function(output) {
+        var self = this;
+        var name = get_symbol_name(self);
+        output.print_name(name);
+        var alias = self.alias;
+        if (alias.value != name) {
+            output.space();
+            output.print("as");
+            output.space();
+            print_alias(alias, output);
+        }
     });
-    DEFPRINT(AST_Undefined, function(self, output){
-        output.print("void 0");
+    DEFPRINT(AST_SymbolImport, function(output) {
+        var self = this;
+        var name = get_symbol_name(self);
+        var key = self.key;
+        if (key.value && key.value != name) {
+            print_alias(key, output);
+            output.space();
+            output.print("as");
+            output.space();
+        }
+        output.print_name(name);
     });
     DEFPRINT(AST_Hole, noop);
-    DEFPRINT(AST_Infinity, function(self, output){
-        output.print("Infinity");
-    });
-    DEFPRINT(AST_NaN, function(self, output){
-        output.print("NaN");
-    });
-    DEFPRINT(AST_This, function(self, output){
-        output.print("this");
+    DEFPRINT(AST_Template, function(output) {
+        var self = this;
+        if (self.tag) self.tag.print(output);
+        output.print("`");
+        for (var i = 0; i < self.expressions.length; i++) {
+            output.print(self.strings[i]);
+            output.print("${");
+            self.expressions[i].print(output);
+            output.print("}");
+        }
+        output.print(self.strings[i]);
+        output.print("`");
+    });
+    DEFPRINT(AST_Constant, function(output) {
+        output.print("" + this.value);
+    });
+    DEFPRINT(AST_String, function(output) {
+        output.print_string(this.value, this.quote);
+    });
+    DEFPRINT(AST_Number, function(output) {
+        var start = this.start;
+        if (use_asm && start && start.raw != null) {
+            output.print(start.raw);
+        } else {
+            output.print(make_num(this.value));
+        }
     });
-    DEFPRINT(AST_Constant, function(self, output){
-        output.print(self.getValue());
-    });
-    DEFPRINT(AST_String, function(self, output){
-        output.print_string(self.getValue(), self.quote);
-    });
-    DEFPRINT(AST_Number, function(self, output){
-        output.print(make_num(self.getValue()));
-    });
-
-    function regexp_safe_literal(code) {
-        return [
-            0x5c   , // \
-            0x2f   , // /
-            0x2e   , // .
-            0x2b   , // +
-            0x2a   , // *
-            0x3f   , // ?
-            0x28   , // (
-            0x29   , // )
-            0x5b   , // [
-            0x5d   , // ]
-            0x7b   , // {
-            0x7d   , // }
-            0x24   , // $
-            0x5e   , // ^
-            0x3a   , // :
-            0x7c   , // |
-            0x21   , // !
-            0x0a   , // \n
-            0x0d   , // \r
-            0x00   , // \0
-            0xfeff , // Unicode BOM
-            0x2028 , // unicode "line separator"
-            0x2029 , // unicode "paragraph separator"
-        ].indexOf(code) < 0;
-    };
 
-    DEFPRINT(AST_RegExp, function(self, output){
-        var str = self.getValue().toString();
-        if (output.option("ascii_only")) {
-            str = output.to_ascii(str);
-        } else if (output.option("unescape_regexps")) {
-            str = str.split("\\\\").map(function(str){
-                return str.replace(/\\u[0-9a-fA-F]{4}|\\x[0-9a-fA-F]{2}/g, function(s){
-                    var code = parseInt(s.substr(2), 16);
-                    return regexp_safe_literal(code) ? String.fromCharCode(code) : s;
-                });
-            }).join("\\\\");
+    DEFPRINT(AST_RegExp, function(output) {
+        var regexp = this.value;
+        var str = regexp.toString();
+        var end = str.lastIndexOf("/");
+        if (regexp.raw_source) {
+            str = "/" + regexp.raw_source + str.slice(end);
+        } else if (end == 1) {
+            str = "/(?:)" + str.slice(end);
+        } else if (str.indexOf("/", 1) < end) {
+            str = "/" + str.slice(1, end).replace(/\\\\|[^/]?\//g, function(match) {
+                return match[0] == "\\" ? match : match.slice(0, -1) + "\\/";
+            }) + str.slice(end);
         }
-        output.print(str);
-        var p = output.parent();
-        if (p instanceof AST_Binary && /^in/.test(p.operator) && p.left === self)
-            output.print(" ");
+        output.print(output.to_utf8(str).replace(/\\(?:\0(?![0-9])|[^\0])/g, function(match) {
+            switch (match[1]) {
+              case "\n": return "\\n";
+              case "\r": return "\\r";
+              case "\t": return "\t";
+              case "\b": return "\b";
+              case "\f": return "\f";
+              case "\0": return "\0";
+              case "\x0B": return "\v";
+              case "\u2028": return "\\u2028";
+              case "\u2029": return "\\u2029";
+              default: return match;
+            }
+        }).replace(/[\n\r\u2028\u2029]/g, function(c) {
+            switch (c) {
+              case "\n": return "\\n";
+              case "\r": return "\\r";
+              case "\u2028": return "\\u2028";
+              case "\u2029": return "\\u2029";
+            }
+        }));
     });
 
     function force_statement(stat, output) {
-        if (output.option("bracketize")) {
-            if (!stat || stat instanceof AST_EmptyStatement)
-                output.print("{}");
-            else if (stat instanceof AST_BlockStatement)
-                stat.print(output);
-            else output.with_block(function(){
-                output.indent();
-                stat.print(output);
-                output.newline();
-            });
+        if (output.option("braces") && !(stat instanceof AST_Const || stat instanceof AST_Let)) {
+            make_block(stat, output);
+        } else if (stat instanceof AST_EmptyStatement) {
+            output.force_semicolon();
         } else {
-            if (!stat || stat instanceof AST_EmptyStatement)
-                output.force_semicolon();
-            else
-                stat.print(output);
-        }
-    };
-
-    // return true if the node at the top of the stack (that means the
-    // innermost node in the current output) is lexically the first in
-    // a statement.
-    function first_in_statement(output) {
-        var a = output.stack(), i = a.length, node = a[--i], p = a[--i];
-        while (i > 0) {
-            if (p instanceof AST_Statement && p.body === node)
-                return true;
-            if ((p instanceof AST_Seq           && p.car === node        ) ||
-                (p instanceof AST_Call          && p.expression === node && !(p instanceof AST_New) ) ||
-                (p instanceof AST_Dot           && p.expression === node ) ||
-                (p instanceof AST_Sub           && p.expression === node ) ||
-                (p instanceof AST_Conditional   && p.condition === node  ) ||
-                (p instanceof AST_Binary        && p.left === node       ) ||
-                (p instanceof AST_UnaryPostfix  && p.expression === node ))
-            {
-                node = p;
-                p = a[--i];
-            } else {
-                return false;
-            }
+            output.space();
+            stat.print(output);
         }
-    };
+    }
 
     // self should be AST_New.  decide if we want to show parens or not.
-    function no_constructor_parens(self, output) {
-        return self.args.length == 0 && !output.option("beautify");
-    };
+    function need_constructor_parens(self, output) {
+        // Always print parentheses with arguments
+        if (self.args.length > 0) return true;
+
+        return output.option("beautify");
+    }
 
     function best_of(a) {
         var best = a[0], len = best.length;
@@ -1249,78 +1862,95 @@
             }
         }
         return best;
-    };
+    }
 
     function make_num(num) {
-        var str = num.toString(10), a = [ str.replace(/^0\./, ".").replace('e+', 'e') ], m;
+        var str = num.toString(10).replace(/^0\./, ".").replace("e+", "e");
+        var candidates = [ str ];
         if (Math.floor(num) === num) {
-            if (num >= 0) {
-                a.push("0x" + num.toString(16).toLowerCase(), // probably pointless
-                       "0" + num.toString(8)); // same.
+            if (num < 0) {
+                candidates.push("-0x" + (-num).toString(16).toLowerCase());
             } else {
-                a.push("-0x" + (-num).toString(16).toLowerCase(), // probably pointless
-                       "-0" + (-num).toString(8)); // same.
+                candidates.push("0x" + num.toString(16).toLowerCase());
             }
-            if ((m = /^(.*?)(0+)$/.exec(num))) {
-                a.push(m[1] + "e" + m[2].length);
-            }
-        } else if ((m = /^0?\.(0+)(.*)$/.exec(num))) {
-            a.push(m[2] + "e-" + (m[1].length + m[2].length),
-                   str.substr(str.indexOf(".")));
         }
-        return best_of(a);
-    };
+        var match, len, digits;
+        if (match = /^\.0+/.exec(str)) {
+            len = match[0].length;
+            digits = str.slice(len);
+            candidates.push(digits + "e-" + (digits.length + len - 1));
+        } else if (match = /[^0]0+$/.exec(str)) {
+            len = match[0].length - 1;
+            candidates.push(str.slice(0, -len) + "e" + len);
+        } else if (match = /^(\d)\.(\d+)e(-?\d+)$/.exec(str)) {
+            candidates.push(match[1] + match[2] + "e" + (match[3] - match[2].length));
+        }
+        return best_of(candidates);
+    }
 
     function make_block(stmt, output) {
-        if (stmt instanceof AST_BlockStatement) {
+        output.space();
+        if (stmt instanceof AST_EmptyStatement) {
+            print_braced_empty(stmt, output);
+        } else if (stmt instanceof AST_BlockStatement) {
             stmt.print(output);
-            return;
-        }
-        output.with_block(function(){
+        } else output.with_block(function() {
             output.indent();
             stmt.print(output);
             output.newline();
-        });
-    };
+        }, stmt.end);
+    }
 
     /* -----[ source map generators ]----- */
 
     function DEFMAP(nodetype, generator) {
-        nodetype.DEFMETHOD("add_source_map", function(stream){
-            generator(this, stream);
+        nodetype.forEach(function(nodetype) {
+            nodetype.DEFMETHOD("add_source_map", generator);
         });
-    };
-
-    // We could easily add info for ALL nodes, but it seems to me that
-    // would be quite wasteful, hence this noop in the base class.
-    DEFMAP(AST_Node, noop);
+    }
 
-    function basic_sourcemap_gen(self, output) {
-        output.add_mapping(self.start);
-    };
+    DEFMAP([
+        // We could easily add info for ALL nodes, but it seems to me that
+        // would be quite wasteful, hence this noop in the base class.
+        AST_Node,
+        // since the label symbol will mark it
+        AST_LabeledStatement,
+    ], noop);
 
     // XXX: I'm not exactly sure if we need it for all of these nodes,
     // or if we should add even more.
-
-    DEFMAP(AST_Directive, basic_sourcemap_gen);
-    DEFMAP(AST_Debugger, basic_sourcemap_gen);
-    DEFMAP(AST_Symbol, basic_sourcemap_gen);
-    DEFMAP(AST_Jump, basic_sourcemap_gen);
-    DEFMAP(AST_StatementWithBody, basic_sourcemap_gen);
-    DEFMAP(AST_LabeledStatement, noop); // since the label symbol will mark it
-    DEFMAP(AST_Lambda, basic_sourcemap_gen);
-    DEFMAP(AST_Switch, basic_sourcemap_gen);
-    DEFMAP(AST_SwitchBranch, basic_sourcemap_gen);
-    DEFMAP(AST_BlockStatement, basic_sourcemap_gen);
-    DEFMAP(AST_Toplevel, noop);
-    DEFMAP(AST_New, basic_sourcemap_gen);
-    DEFMAP(AST_Try, basic_sourcemap_gen);
-    DEFMAP(AST_Catch, basic_sourcemap_gen);
-    DEFMAP(AST_Finally, basic_sourcemap_gen);
-    DEFMAP(AST_Definitions, basic_sourcemap_gen);
-    DEFMAP(AST_Constant, basic_sourcemap_gen);
-    DEFMAP(AST_ObjectProperty, function(self, output){
-        output.add_mapping(self.start, self.key);
+    DEFMAP([
+        AST_Array,
+        AST_Await,
+        AST_BlockStatement,
+        AST_Catch,
+        AST_Constant,
+        AST_Debugger,
+        AST_Definitions,
+        AST_Destructured,
+        AST_Directive,
+        AST_Finally,
+        AST_Jump,
+        AST_Lambda,
+        AST_New,
+        AST_Object,
+        AST_Spread,
+        AST_StatementWithBody,
+        AST_Symbol,
+        AST_Switch,
+        AST_SwitchBranch,
+        AST_Try,
+        AST_UnaryPrefix,
+        AST_Yield,
+    ], function(output) {
+        output.add_mapping(this.start);
+    });
+
+    DEFMAP([
+        AST_ClassProperty,
+        AST_DestructuredKeyVal,
+        AST_ObjectProperty,
+    ], function(output) {
+        if (typeof this.key == "string") output.add_mapping(this.start, this.key);
     });
-
 })();
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/parse.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -44,22 +44,23 @@
 
 "use strict";
 
-var KEYWORDS = 'break case catch const continue debugger default delete do else finally for function if in instanceof new return switch throw try typeof var void while with';
-var KEYWORDS_ATOM = 'false null true';
-var RESERVED_WORDS = 'abstract boolean byte char class double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized this throws transient volatile yield'
-    + " " + KEYWORDS_ATOM + " " + KEYWORDS;
-var KEYWORDS_BEFORE_EXPRESSION = 'return new delete throw else case';
+var KEYWORDS = "break case catch class const continue debugger default delete do else extends finally for function if in instanceof new return switch throw try typeof var void while with";
+var KEYWORDS_ATOM = "false null true";
+var RESERVED_WORDS = [
+    "abstract async await boolean byte char double enum export final float goto implements import int interface let long native package private protected public short static super synchronized this throws transient volatile yield",
+    KEYWORDS_ATOM,
+    KEYWORDS,
+].join(" ");
+var KEYWORDS_BEFORE_EXPRESSION = "return new delete throw else case";
 
 KEYWORDS = makePredicate(KEYWORDS);
 RESERVED_WORDS = makePredicate(RESERVED_WORDS);
 KEYWORDS_BEFORE_EXPRESSION = makePredicate(KEYWORDS_BEFORE_EXPRESSION);
 KEYWORDS_ATOM = makePredicate(KEYWORDS_ATOM);
 
-var OPERATOR_CHARS = makePredicate(characters("+-*&%=<>!?|~^"));
-
-var RE_HEX_NUMBER = /^0x[0-9a-f]+$/i;
-var RE_OCT_NUMBER = /^0[0-7]+$/;
-var RE_DEC_NUMBER = /^\d*\.?\d*(?:e[+-]?\d*(?:\d\.?|\.?\d)\d*)?$/i;
+var RE_BIN_NUMBER = /^0b([01]+)$/i;
+var RE_HEX_NUMBER = /^0x([0-9a-f]+)$/i;
+var RE_OCT_NUMBER = /^0o?([0-7]+)$/i;
 
 var OPERATORS = makePredicate([
     "in",
@@ -80,6 +81,7 @@
     "*",
     "/",
     "%",
+    "**",
     ">>",
     "<<",
     ">>>",
@@ -98,94 +100,106 @@
     "/=",
     "*=",
     "%=",
+    "**=",
     ">>=",
     "<<=",
     ">>>=",
+    "&=",
     "|=",
     "^=",
-    "&=",
     "&&",
-    "||"
+    "||",
+    "??",
+    "&&=",
+    "||=",
+    "??=",
 ]);
 
-var WHITESPACE_CHARS = makePredicate(characters(" \u00a0\n\r\t\f\u000b\u200b\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\uFEFF"));
-
-var PUNC_BEFORE_EXPRESSION = makePredicate(characters("[{(,.;:"));
-
-var PUNC_CHARS = makePredicate(characters("[]{}(),;:"));
-
-var REGEXP_MODIFIERS = makePredicate(characters("gmsiy"));
+var NEWLINE_CHARS = "\n\r\u2028\u2029";
+var OPERATOR_CHARS = "+-*&%=<>!?|~^";
+var PUNC_OPENERS = "[{(";
+var PUNC_SEPARATORS = ",;:";
+var PUNC_CLOSERS = ")}]";
+var PUNC_AFTER_EXPRESSION = PUNC_SEPARATORS + PUNC_CLOSERS;
+var PUNC_BEFORE_EXPRESSION = PUNC_OPENERS + PUNC_SEPARATORS;
+var PUNC_CHARS = PUNC_BEFORE_EXPRESSION + "`" + PUNC_CLOSERS;
+var WHITESPACE_CHARS = NEWLINE_CHARS + " \u00a0\t\f\u000b\u200b\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\uFEFF";
+var NON_IDENTIFIER_CHARS = makePredicate(characters("./'\"#" + OPERATOR_CHARS + PUNC_CHARS + WHITESPACE_CHARS));
+
+NEWLINE_CHARS = makePredicate(characters(NEWLINE_CHARS));
+OPERATOR_CHARS = makePredicate(characters(OPERATOR_CHARS));
+PUNC_AFTER_EXPRESSION = makePredicate(characters(PUNC_AFTER_EXPRESSION));
+PUNC_BEFORE_EXPRESSION = makePredicate(characters(PUNC_BEFORE_EXPRESSION));
+PUNC_CHARS = makePredicate(characters(PUNC_CHARS));
+WHITESPACE_CHARS = makePredicate(characters(WHITESPACE_CHARS));
 
 /* -----[ Tokenizer ]----- */
 
-// regexps adapted from http://xregexp.com/plugins/#unicode
-var UNICODE = {
-    letter: new RegExp("[\\u0041-\\u005A\\u0061-\\u007A\\u00AA\\u00B5\\u00BA\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02C1\\u02C6-\\u02D1\\u02E0-\\u02E4\\u02EC\\u02EE\\u0370-\\u0374\\u0376\\u0377\\u037A-\\u037D\\u037F\\u0386\\u0388-\\u038A\\u038C\\u038E-\\u03A1\\u03A3-\\u03F5\\u03F7-\\u0481\\u048A-\\u052F\\u0531-\\u0556\\u0559\\u0561-\\u0587\\u05D0-\\u05EA\\u05F0-\\u05F2\\u0620-\\u064A\\u066E\\u066F\\u0671-\\u06D3\\u06D5\\u06E5\\u06E6\\u06EE\\u06EF\\u06FA-\\u06FC\\u06FF\\u0710\\u0712-\\u072F\\u074D-\\u07A5\\u07B1\\u07CA-\\u07EA\\u07F4\\u07F5\\u07FA\\u0800-\\u0815\\u081A\\u0824\\u0828\\u0840-\\u0858\\u08A0-\\u08B2\\u0904-\\u0939\\u093D\\u0950\\u0958-\\u0961\\u0971-\\u0980\\u0985-\\u098C\\u098F\\u0990\\u0993-\\u09A8\\u09AA-\\u09B0\\u09B2\\u09B6-\\u09B9\\u09BD\\u09CE\\u09DC\\u09DD\\u09DF-\\u09E1\\u09F0\\u09F1\\u0A05-\\u0A0A\\u0A0F\\u0A10\\u0A13-\\u0A28\\u0A2A-\\u0A30\\u0A32\\u0A33\\u0A35\\u0A36\\u0A38\\u0A39\\u0A59-\\u0A5C\\u0A5E\\u0A72-\\u0A74\\u0A85-\\u0A8D\\u0A8F-\\u0A91\\u0A93-\\u0AA8\\u0AAA-\\u0AB0\\u0AB2\\u0AB3\\u0AB5-\\u0AB9\\u0ABD\\u0AD0\\u0AE0\\u0AE1\\u0B05-\\u0B0C\\u0B0F\\u0B10\\u0B13-\\u0B28\\u0B2A-\\u0B30\\u0B32\\u0B33\\u0B35-\\u0B39\\u0B3D\\u0B5C\\u0B5D\\u0B5F-\\u0B61\\u0B71\\u0B83\\u0B85-\\u0B8A\\u0B8E-\\u0B90\\u0B92-\\u0B95\\u0B99\\u0B9A\\u0B9C\\u0B9E\\u0B9F\\u0BA3\\u0BA4\\u0BA8-\\u0BAA\\u0BAE-\\u0BB9\\u0BD0\\u0C05-\\u0C0C\\u0C0E-\\u0C10\\u0C12-\\u0C28\\u0C2A-\\u0C39\\u0C3D\\u0C58\\u0C59\\u0C60\\u0C61\\u0C85-\\u0C8C\\u0C8E-\\u0C90\\u0C92-\\u0CA8\\u0CAA-\\u0CB3\\u0CB5-\\u0CB9\\u0CBD\\u0CDE\\u0CE0\\u0CE1\\u0CF1\\u0CF2\\u0D05-\\u0D0C\\u0D0E-\\u0D10\\u0D12-\\u0D3A\\u0D3D\\u0D4E\\u0D60\\u0D61\\u0D7A-\\u0D7F\\u0D85-\\u0D96\\u0D9A-\\u0DB1\\u0DB3-\\u0DBB\\u0DBD\\u0DC0-\\u0DC6\\u0E01-\\u0E30\\u0E32\\u0E33\\u0E40-\\u0E46\\u0E81\\u0E82\\u0E84\\u0E87\\u0E88\\u0E8A\\u0E8D\\u0E94-\\u0E97\\u0E99-\\u0E9F\\u0EA1-\\u0EA3\\u0EA5\\u0EA7\\u0EAA\\u0EAB\\u0EAD-\\u0EB0\\u0EB2\\u0EB3\\u0EBD\\u0EC0-\\u0EC4\\u0EC6\\u0EDC-\\u0EDF\\u0F00\\u0F40-\\u0F47\\u0F49-\\u0F6C\\u0F88-\\u0F8C\\u1000-\\u102A\\u103F\\u1050-\\u1055\\u105A-\\u105D\\u1061\\u1065\\u1066\\u106E-\\u1070\\u1075-\\u1081\\u108E\\u10A0-\\u10C5\\u10C7\\u10CD\\u10D0-\\u10FA\\u10FC-\\u1248\\u124A-\\u124D\\u1250-\\u1256\\u1258\\u125A-\\u125D\\u1260-\\u1288\\u128A-\\u128D\\u1290-\\u12B0\\u12B2-\\u12B5\\u12B8-\\u12BE\\u12C0\\u12C2-\\u12C5\\u12C8-\\u12D6\\u12D8-\\u1310\\u1312-\\u1315\\u1318-\\u135A\\u1380-\\u138F\\u13A0-\\u13F4\\u1401-\\u166C\\u166F-\\u167F\\u1681-\\u169A\\u16A0-\\u16EA\\u16EE-\\u16F8\\u1700-\\u170C\\u170E-\\u1711\\u1720-\\u1731\\u1740-\\u1751\\u1760-\\u176C\\u176E-\\u1770\\u1780-\\u17B3\\u17D7\\u17DC\\u1820-\\u1877\\u1880-\\u18A8\\u18AA\\u18B0-\\u18F5\\u1900-\\u191E\\u1950-\\u196D\\u1970-\\u1974\\u1980-\\u19AB\\u19C1-\\u19C7\\u1A00-\\u1A16\\u1A20-\\u1A54\\u1AA7\\u1B05-\\u1B33\\u1B45-\\u1B4B\\u1B83-\\u1BA0\\u1BAE\\u1BAF\\u1BBA-\\u1BE5\\u1C00-\\u1C23\\u1C4D-\\u1C4F\\u1C5A-\\u1C7D\\u1CE9-\\u1CEC\\u1CEE-\\u1CF1\\u1CF5\\u1CF6\\u1D00-\\u1DBF\\u1E00-\\u1F15\\u1F18-\\u1F1D\\u1F20-\\u1F45\\u1F48-\\u1F4D\\u1F50-\\u1F57\\u1F59\\u1F5B\\u1F5D\\u1F5F-\\u1F7D\\u1F80-\\u1FB4\\u1FB6-\\u1FBC\\u1FBE\\u1FC2-\\u1FC4\\u1FC6-\\u1FCC\\u1FD0-\\u1FD3\\u1FD6-\\u1FDB\\u1FE0-\\u1FEC\\u1FF2-\\u1FF4\\u1FF6-\\u1FFC\\u2071\\u207F\\u2090-\\u209C\\u2102\\u2107\\u210A-\\u2113\\u2115\\u2119-\\u211D\\u2124\\u2126\\u2128\\u212A-\\u212D\\u212F-\\u2139\\u213C-\\u213F\\u2145-\\u2149\\u214E\\u2160-\\u2188\\u2C00-\\u2C2E\\u2C30-\\u2C5E\\u2C60-\\u2CE4\\u2CEB-\\u2CEE\\u2CF2\\u2CF3\\u2D00-\\u2D25\\u2D27\\u2D2D\\u2D30-\\u2D67\\u2D6F\\u2D80-\\u2D96\\u2DA0-\\u2DA6\\u2DA8-\\u2DAE\\u2DB0-\\u2DB6\\u2DB8-\\u2DBE\\u2DC0-\\u2DC6\\u2DC8-\\u2DCE\\u2DD0-\\u2DD6\\u2DD8-\\u2DDE\\u2E2F\\u3005-\\u3007\\u3021-\\u3029\\u3031-\\u3035\\u3038-\\u303C\\u3041-\\u3096\\u309D-\\u309F\\u30A1-\\u30FA\\u30FC-\\u30FF\\u3105-\\u312D\\u3131-\\u318E\\u31A0-\\u31BA\\u31F0-\\u31FF\\u3400-\\u4DB5\\u4E00-\\u9FCC\\uA000-\\uA48C\\uA4D0-\\uA4FD\\uA500-\\uA60C\\uA610-\\uA61F\\uA62A\\uA62B\\uA640-\\uA66E\\uA67F-\\uA69D\\uA6A0-\\uA6EF\\uA717-\\uA71F\\uA722-\\uA788\\uA78B-\\uA78E\\uA790-\\uA7AD\\uA7B0\\uA7B1\\uA7F7-\\uA801\\uA803-\\uA805\\uA807-\\uA80A\\uA80C-\\uA822\\uA840-\\uA873\\uA882-\\uA8B3\\uA8F2-\\uA8F7\\uA8FB\\uA90A-\\uA925\\uA930-\\uA946\\uA960-\\uA97C\\uA984-\\uA9B2\\uA9CF\\uA9E0-\\uA9E4\\uA9E6-\\uA9EF\\uA9FA-\\uA9FE\\uAA00-\\uAA28\\uAA40-\\uAA42\\uAA44-\\uAA4B\\uAA60-\\uAA76\\uAA7A\\uAA7E-\\uAAAF\\uAAB1\\uAAB5\\uAAB6\\uAAB9-\\uAABD\\uAAC0\\uAAC2\\uAADB-\\uAADD\\uAAE0-\\uAAEA\\uAAF2-\\uAAF4\\uAB01-\\uAB06\\uAB09-\\uAB0E\\uAB11-\\uAB16\\uAB20-\\uAB26\\uAB28-\\uAB2E\\uAB30-\\uAB5A\\uAB5C-\\uAB5F\\uAB64\\uAB65\\uABC0-\\uABE2\\uAC00-\\uD7A3\\uD7B0-\\uD7C6\\uD7CB-\\uD7FB\\uF900-\\uFA6D\\uFA70-\\uFAD9\\uFB00-\\uFB06\\uFB13-\\uFB17\\uFB1D\\uFB1F-\\uFB28\\uFB2A-\\uFB36\\uFB38-\\uFB3C\\uFB3E\\uFB40\\uFB41\\uFB43\\uFB44\\uFB46-\\uFBB1\\uFBD3-\\uFD3D\\uFD50-\\uFD8F\\uFD92-\\uFDC7\\uFDF0-\\uFDFB\\uFE70-\\uFE74\\uFE76-\\uFEFC\\uFF21-\\uFF3A\\uFF41-\\uFF5A\\uFF66-\\uFFBE\\uFFC2-\\uFFC7\\uFFCA-\\uFFCF\\uFFD2-\\uFFD7\\uFFDA-\\uFFDC]"),
-    digit: new RegExp("[\\u0030-\\u0039\\u0660-\\u0669\\u06F0-\\u06F9\\u07C0-\\u07C9\\u0966-\\u096F\\u09E6-\\u09EF\\u0A66-\\u0A6F\\u0AE6-\\u0AEF\\u0B66-\\u0B6F\\u0BE6-\\u0BEF\\u0C66-\\u0C6F\\u0CE6-\\u0CEF\\u0D66-\\u0D6F\\u0DE6-\\u0DEF\\u0E50-\\u0E59\\u0ED0-\\u0ED9\\u0F20-\\u0F29\\u1040-\\u1049\\u1090-\\u1099\\u17E0-\\u17E9\\u1810-\\u1819\\u1946-\\u194F\\u19D0-\\u19D9\\u1A80-\\u1A89\\u1A90-\\u1A99\\u1B50-\\u1B59\\u1BB0-\\u1BB9\\u1C40-\\u1C49\\u1C50-\\u1C59\\uA620-\\uA629\\uA8D0-\\uA8D9\\uA900-\\uA909\\uA9D0-\\uA9D9\\uA9F0-\\uA9F9\\uAA50-\\uAA59\\uABF0-\\uABF9\\uFF10-\\uFF19]"),
-    non_spacing_mark: new RegExp("[\\u0300-\\u036F\\u0483-\\u0487\\u0591-\\u05BD\\u05BF\\u05C1\\u05C2\\u05C4\\u05C5\\u05C7\\u0610-\\u061A\\u064B-\\u065E\\u0670\\u06D6-\\u06DC\\u06DF-\\u06E4\\u06E7\\u06E8\\u06EA-\\u06ED\\u0711\\u0730-\\u074A\\u07A6-\\u07B0\\u07EB-\\u07F3\\u0816-\\u0819\\u081B-\\u0823\\u0825-\\u0827\\u0829-\\u082D\\u0900-\\u0902\\u093C\\u0941-\\u0948\\u094D\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09BC\\u09C1-\\u09C4\\u09CD\\u09E2\\u09E3\\u0A01\\u0A02\\u0A3C\\u0A41\\u0A42\\u0A47\\u0A48\\u0A4B-\\u0A4D\\u0A51\\u0A70\\u0A71\\u0A75\\u0A81\\u0A82\\u0ABC\\u0AC1-\\u0AC5\\u0AC7\\u0AC8\\u0ACD\\u0AE2\\u0AE3\\u0B01\\u0B3C\\u0B3F\\u0B41-\\u0B44\\u0B4D\\u0B56\\u0B62\\u0B63\\u0B82\\u0BC0\\u0BCD\\u0C3E-\\u0C40\\u0C46-\\u0C48\\u0C4A-\\u0C4D\\u0C55\\u0C56\\u0C62\\u0C63\\u0CBC\\u0CBF\\u0CC6\\u0CCC\\u0CCD\\u0CE2\\u0CE3\\u0D41-\\u0D44\\u0D4D\\u0D62\\u0D63\\u0DCA\\u0DD2-\\u0DD4\\u0DD6\\u0E31\\u0E34-\\u0E3A\\u0E47-\\u0E4E\\u0EB1\\u0EB4-\\u0EB9\\u0EBB\\u0EBC\\u0EC8-\\u0ECD\\u0F18\\u0F19\\u0F35\\u0F37\\u0F39\\u0F71-\\u0F7E\\u0F80-\\u0F84\\u0F86\\u0F87\\u0F90-\\u0F97\\u0F99-\\u0FBC\\u0FC6\\u102D-\\u1030\\u1032-\\u1037\\u1039\\u103A\\u103D\\u103E\\u1058\\u1059\\u105E-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108D\\u109D\\u135F\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17B7-\\u17BD\\u17C6\\u17C9-\\u17D3\\u17DD\\u180B-\\u180D\\u18A9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193B\\u1A17\\u1A18\\u1A56\\u1A58-\\u1A5E\\u1A60\\u1A62\\u1A65-\\u1A6C\\u1A73-\\u1A7C\\u1A7F\\u1B00-\\u1B03\\u1B34\\u1B36-\\u1B3A\\u1B3C\\u1B42\\u1B6B-\\u1B73\\u1B80\\u1B81\\u1BA2-\\u1BA5\\u1BA8\\u1BA9\\u1C2C-\\u1C33\\u1C36\\u1C37\\u1CD0-\\u1CD2\\u1CD4-\\u1CE0\\u1CE2-\\u1CE8\\u1CED\\u1DC0-\\u1DE6\\u1DFD-\\u1DFF\\u20D0-\\u20DC\\u20E1\\u20E5-\\u20F0\\u2CEF-\\u2CF1\\u2DE0-\\u2DFF\\u302A-\\u302F\\u3099\\u309A\\uA66F\\uA67C\\uA67D\\uA6F0\\uA6F1\\uA802\\uA806\\uA80B\\uA825\\uA826\\uA8C4\\uA8E0-\\uA8F1\\uA926-\\uA92D\\uA947-\\uA951\\uA980-\\uA982\\uA9B3\\uA9B6-\\uA9B9\\uA9BC\\uAA29-\\uAA2E\\uAA31\\uAA32\\uAA35\\uAA36\\uAA43\\uAA4C\\uAAB0\\uAAB2-\\uAAB4\\uAAB7\\uAAB8\\uAABE\\uAABF\\uAAC1\\uABE5\\uABE8\\uABED\\uFB1E\\uFE00-\\uFE0F\\uFE20-\\uFE26]"),
-    space_combining_mark: new RegExp("[\\u0903\\u093E-\\u0940\\u0949-\\u094C\\u094E\\u0982\\u0983\\u09BE-\\u09C0\\u09C7\\u09C8\\u09CB\\u09CC\\u09D7\\u0A03\\u0A3E-\\u0A40\\u0A83\\u0ABE-\\u0AC0\\u0AC9\\u0ACB\\u0ACC\\u0B02\\u0B03\\u0B3E\\u0B40\\u0B47\\u0B48\\u0B4B\\u0B4C\\u0B57\\u0BBE\\u0BBF\\u0BC1\\u0BC2\\u0BC6-\\u0BC8\\u0BCA-\\u0BCC\\u0BD7\\u0C01-\\u0C03\\u0C41-\\u0C44\\u0C82\\u0C83\\u0CBE\\u0CC0-\\u0CC4\\u0CC7\\u0CC8\\u0CCA\\u0CCB\\u0CD5\\u0CD6\\u0D02\\u0D03\\u0D3E-\\u0D40\\u0D46-\\u0D48\\u0D4A-\\u0D4C\\u0D57\\u0D82\\u0D83\\u0DCF-\\u0DD1\\u0DD8-\\u0DDF\\u0DF2\\u0DF3\\u0F3E\\u0F3F\\u0F7F\\u102B\\u102C\\u1031\\u1038\\u103B\\u103C\\u1056\\u1057\\u1062-\\u1064\\u1067-\\u106D\\u1083\\u1084\\u1087-\\u108C\\u108F\\u109A-\\u109C\\u17B6\\u17BE-\\u17C5\\u17C7\\u17C8\\u1923-\\u1926\\u1929-\\u192B\\u1930\\u1931\\u1933-\\u1938\\u19B0-\\u19C0\\u19C8\\u19C9\\u1A19-\\u1A1B\\u1A55\\u1A57\\u1A61\\u1A63\\u1A64\\u1A6D-\\u1A72\\u1B04\\u1B35\\u1B3B\\u1B3D-\\u1B41\\u1B43\\u1B44\\u1B82\\u1BA1\\u1BA6\\u1BA7\\u1BAA\\u1C24-\\u1C2B\\u1C34\\u1C35\\u1CE1\\u1CF2\\uA823\\uA824\\uA827\\uA880\\uA881\\uA8B4-\\uA8C3\\uA952\\uA953\\uA983\\uA9B4\\uA9B5\\uA9BA\\uA9BB\\uA9BD-\\uA9C0\\uAA2F\\uAA30\\uAA33\\uAA34\\uAA4D\\uAA7B\\uABE3\\uABE4\\uABE6\\uABE7\\uABE9\\uABEA\\uABEC]"),
-    connector_punctuation: new RegExp("[\\u005F\\u203F\\u2040\\u2054\\uFE33\\uFE34\\uFE4D-\\uFE4F\\uFF3F]")
-};
-
-function is_letter(code) {
-    return (code >= 97 && code <= 122)
-        || (code >= 65 && code <= 90)
-        || (code >= 0xaa && UNICODE.letter.test(String.fromCharCode(code)));
-};
+function is_surrogate_pair_head(code) {
+    return code >= 0xd800 && code <= 0xdbff;
+}
+
+function is_surrogate_pair_tail(code) {
+    return code >= 0xdc00 && code <= 0xdfff;
+}
 
 function is_digit(code) {
     return code >= 48 && code <= 57;
-};
-
-function is_alphanumeric_char(code) {
-    return is_digit(code) || is_letter(code);
-};
-
-function is_unicode_digit(code) {
-    return UNICODE.digit.test(String.fromCharCode(code));
 }
 
-function is_unicode_combining_mark(ch) {
-    return UNICODE.non_spacing_mark.test(ch) || UNICODE.space_combining_mark.test(ch);
-};
-
-function is_unicode_connector_punctuation(ch) {
-    return UNICODE.connector_punctuation.test(ch);
-};
-
-function is_identifier(name) {
-    return !RESERVED_WORDS(name) && /^[a-z_$][a-z0-9_$]*$/i.test(name);
-};
-
-function is_identifier_start(code) {
-    return code == 36 || code == 95 || is_letter(code);
-};
-
 function is_identifier_char(ch) {
-    var code = ch.charCodeAt(0);
-    return is_identifier_start(code)
-        || is_digit(code)
-        || code == 8204 // \u200c: zero-width non-joiner <ZWNJ>
-        || code == 8205 // \u200d: zero-width joiner <ZWJ> (in my ECMA-262 PDF, this is also 200c)
-        || is_unicode_combining_mark(ch)
-        || is_unicode_connector_punctuation(ch)
-        || is_unicode_digit(code)
-    ;
-};
+    return !NON_IDENTIFIER_CHARS[ch];
+}
 
-function is_identifier_string(str){
+function is_identifier_string(str) {
     return /^[a-z_$][a-z0-9_$]*$/i.test(str);
-};
+}
 
-function parse_js_number(num) {
-    if (RE_HEX_NUMBER.test(num)) {
-        return parseInt(num.substr(2), 16);
-    } else if (RE_OCT_NUMBER.test(num)) {
-        return parseInt(num.substr(1), 8);
-    } else if (RE_DEC_NUMBER.test(num)) {
-        return parseFloat(num);
+function decode_escape_sequence(seq) {
+    switch (seq[0]) {
+      case "b": return "\b";
+      case "f": return "\f";
+      case "n": return "\n";
+      case "r": return "\r";
+      case "t": return "\t";
+      case "u":
+        var code;
+        if (seq[1] == "{" && seq.slice(-1) == "}") {
+            code = seq.slice(2, -1);
+        } else if (seq.length == 5) {
+            code = seq.slice(1);
+        } else {
+            return;
+        }
+        var num = parseInt(code, 16);
+        if (num < 0 || isNaN(num)) return;
+        if (num < 0x10000) return String.fromCharCode(num);
+        if (num > 0x10ffff) return;
+        return String.fromCharCode((num >> 10) + 0xd7c0) + String.fromCharCode((num & 0x03ff) + 0xdc00);
+      case "v": return "\u000b";
+      case "x":
+        if (seq.length != 3) return;
+        var num = parseInt(seq.slice(1), 16);
+        if (num < 0 || isNaN(num)) return;
+        return String.fromCharCode(num);
+      case "\r":
+      case "\n":
+        return "";
+      default:
+        if (seq == "0") return "\0";
+        if (seq[0] >= "0" && seq[0] <= "9") return;
+        return seq;
     }
-};
+}
+
+function parse_js_number(num) {
+    var match;
+    if (match = RE_BIN_NUMBER.exec(num)) return parseInt(match[1], 2);
+    if (match = RE_HEX_NUMBER.exec(num)) return parseInt(match[1], 16);
+    if (match = RE_OCT_NUMBER.exec(num)) return parseInt(match[1], 8);
+    var val = parseFloat(num);
+    if (val == num) return val;
+}
 
 function JS_Parse_Error(message, filename, line, col, pos) {
     this.message = message;
@@ -193,24 +207,23 @@
     this.line = line;
     this.col = col;
     this.pos = pos;
-    this.stack = new Error().stack;
-};
-
-JS_Parse_Error.prototype.toString = function() {
-    return this.message + " (line: " + this.line + ", col: " + this.col + ", pos: " + this.pos + ")" + "\n\n" + this.stack;
-};
+}
+JS_Parse_Error.prototype = Object.create(Error.prototype);
+JS_Parse_Error.prototype.constructor = JS_Parse_Error;
+JS_Parse_Error.prototype.name = "SyntaxError";
+configure_error_stack(JS_Parse_Error);
 
 function js_error(message, filename, line, col, pos) {
     throw new JS_Parse_Error(message, filename, line, col, pos);
-};
+}
 
 function is_token(token, type, val) {
     return token.type == type && (val == null || token.value == val);
-};
+}
 
 var EX_EOF = {};
 
-function tokenizer($TEXT, filename, html5_comments) {
+function tokenizer($TEXT, filename, html5_comments, shebang) {
 
     var S = {
         text            : $TEXT,
@@ -223,56 +236,95 @@
         tokcol          : 0,
         newline_before  : false,
         regex_allowed   : false,
-        comments_before : []
+        comments_before : [],
+        directives      : Object.create(null),
+        read_template   : with_eof_error("Unterminated template literal", function(strings) {
+            var s = "";
+            for (;;) {
+                var ch = read();
+                switch (ch) {
+                  case "\\":
+                    ch += read();
+                    break;
+                  case "`":
+                    strings.push(s);
+                    return;
+                  case "$":
+                    if (peek() == "{") {
+                        next();
+                        strings.push(s);
+                        S.regex_allowed = true;
+                        return true;
+                    }
+                }
+                s += ch;
+            }
+
+            function read() {
+                var ch = next(true, true);
+                return ch == "\r" ? "\n" : ch;
+            }
+        }),
     };
+    var prev_was_dot = false;
 
-    function peek() { return S.text.charAt(S.pos); };
+    function peek() {
+        return S.text.charAt(S.pos);
+    }
 
     function next(signal_eof, in_string) {
         var ch = S.text.charAt(S.pos++);
         if (signal_eof && !ch)
             throw EX_EOF;
-        if ("\r\n\u2028\u2029".indexOf(ch) >= 0) {
-            S.newline_before = S.newline_before || !in_string;
-            ++S.line;
+        if (NEWLINE_CHARS[ch]) {
             S.col = 0;
-            if (!in_string && ch == "\r" && peek() == "\n") {
-                // treat a \r\n sequence as a single \n
-                ++S.pos;
+            S.line++;
+            if (!in_string) S.newline_before = true;
+            if (ch == "\r" && peek() == "\n") {
+                // treat `\r\n` as `\n`
+                S.pos++;
                 ch = "\n";
             }
         } else {
-            ++S.col;
+            S.col++;
         }
         return ch;
-    };
+    }
 
     function forward(i) {
         while (i-- > 0) next();
-    };
+    }
 
     function looking_at(str) {
         return S.text.substr(S.pos, str.length) == str;
-    };
+    }
+
+    function find_eol() {
+        var text = S.text;
+        for (var i = S.pos; i < S.text.length; ++i) {
+            if (NEWLINE_CHARS[text[i]]) return i;
+        }
+        return -1;
+    }
 
     function find(what, signal_eof) {
         var pos = S.text.indexOf(what, S.pos);
         if (signal_eof && pos == -1) throw EX_EOF;
         return pos;
-    };
+    }
 
     function start_token() {
         S.tokline = S.line;
         S.tokcol = S.col;
         S.tokpos = S.pos;
-    };
+    }
 
-    var prev_was_dot = false;
     function token(type, value, is_comment) {
-        S.regex_allowed = ((type == "operator" && !UNARY_POSTFIX(value)) ||
-                           (type == "keyword" && KEYWORDS_BEFORE_EXPRESSION(value)) ||
-                           (type == "punc" && PUNC_BEFORE_EXPRESSION(value)));
-        prev_was_dot = (type == "punc" && value == ".");
+        S.regex_allowed = type == "operator" && !UNARY_POSTFIX[value]
+            || type == "keyword" && KEYWORDS_BEFORE_EXPRESSION[value]
+            || type == "punc" && PUNC_BEFORE_EXPRESSION[value];
+        if (type == "punc" && value == ".") prev_was_dot = true;
+        else if (!is_comment) prev_was_dot = false;
         var ret = {
             type    : type,
             value   : value,
@@ -285,117 +337,105 @@
             nlb     : S.newline_before,
             file    : filename
         };
+        if (/^(?:num|string|regexp)$/i.test(type)) {
+            ret.raw = $TEXT.substring(ret.pos, ret.endpos);
+        }
         if (!is_comment) {
             ret.comments_before = S.comments_before;
-            S.comments_before = [];
-            // make note of any newlines in the comments that came before
-            for (var i = 0, len = ret.comments_before.length; i < len; i++) {
-                ret.nlb = ret.nlb || ret.comments_before[i].nlb;
-            }
+            ret.comments_after = S.comments_before = [];
         }
         S.newline_before = false;
         return new AST_Token(ret);
-    };
+    }
 
     function skip_whitespace() {
-        var ch;
-        while (WHITESPACE_CHARS(ch = peek()) || ch == "\u2028" || ch == "\u2029")
+        while (WHITESPACE_CHARS[peek()])
             next();
-    };
+    }
 
     function read_while(pred) {
-        var ret = "", ch, i = 0;
-        while ((ch = peek()) && pred(ch, i++))
-            ret += next();
+        var ret = "", ch;
+        while ((ch = peek()) && pred(ch, ret)) ret += next();
         return ret;
-    };
+    }
 
     function parse_error(err) {
         js_error(err, filename, S.tokline, S.tokcol, S.tokpos);
-    };
+    }
+
+    function is_octal(num) {
+        return /^0[0-7_]+$/.test(num);
+    }
 
     function read_num(prefix) {
         var has_e = false, after_e = false, has_x = false, has_dot = prefix == ".";
-        var num = read_while(function(ch, i){
-            var code = ch.charCodeAt(0);
-            switch (code) {
-              case 120: case 88: // xX
+        var num = read_while(function(ch, str) {
+            switch (ch) {
+              case "x": case "X":
                 return has_x ? false : (has_x = true);
-              case 101: case 69: // eE
+              case "e": case "E":
                 return has_x ? true : has_e ? false : (has_e = after_e = true);
-              case 45: // -
-                return after_e || (i == 0 && !prefix);
-              case 43: // +
+              case "+": case "-":
                 return after_e;
-              case (after_e = false, 46): // .
-                return (!has_dot && !has_x && !has_e) ? (has_dot = true) : false;
+              case (after_e = false, "."):
+                return has_dot || has_e || has_x || is_octal(str) ? false : (has_dot = true);
             }
-            return is_alphanumeric_char(code);
+            return /[_0-9a-dfo]/i.test(ch);
         });
         if (prefix) num = prefix + num;
-        var valid = parse_js_number(num);
-        if (!isNaN(valid)) {
-            return token("num", valid);
+        if (is_octal(num)) {
+            if (next_token.has_directive("use strict")) parse_error("Legacy octal literals are not allowed in strict mode");
         } else {
-            parse_error("Invalid syntax: " + num);
+            num = num.replace(has_x ? /([1-9a-f]|.0)_(?=[0-9a-f])/gi : /([1-9]|.0)_(?=[0-9])/gi, "$1");
         }
-    };
+        var valid = parse_js_number(num);
+        if (isNaN(valid)) parse_error("Invalid syntax: " + num);
+        if (has_dot || has_e || peek() != "n") return token("num", valid);
+        return token("bigint", num.toLowerCase() + next());
+    }
 
     function read_escaped_char(in_string) {
-        var ch = next(true, in_string);
-        switch (ch.charCodeAt(0)) {
-          case 110 : return "\n";
-          case 114 : return "\r";
-          case 116 : return "\t";
-          case 98  : return "\b";
-          case 118 : return "\u000b"; // \v
-          case 102 : return "\f";
-          case 48  : return "\0";
-          case 120 : return String.fromCharCode(hex_bytes(2)); // \x
-          case 117 : return String.fromCharCode(hex_bytes(4)); // \u
-          case 10  : return ""; // newline
-          case 13  :            // \r
-            if (peek() == "\n") { // DOS newline
-                next(true, in_string);
-                return "";
-            }
-        }
-        return ch;
-    };
+        var seq = next(true, in_string);
+        if (seq >= "0" && seq <= "7") return read_octal_escape_sequence(seq);
+        if (seq == "u") {
+            var ch = next(true, in_string);
+            seq += ch;
+            if (ch != "{") {
+                seq += next(true, in_string) + next(true, in_string) + next(true, in_string);
+            } else do {
+                ch = next(true, in_string);
+                seq += ch;
+            } while (ch != "}");
+        } else if (seq == "x") {
+            seq += next(true, in_string) + next(true, in_string);
+        }
+        var str = decode_escape_sequence(seq);
+        if (typeof str != "string") parse_error("Invalid escape sequence: \\" + seq);
+        return str;
+    }
 
-    function hex_bytes(n) {
-        var num = 0;
-        for (; n > 0; --n) {
-            var digit = parseInt(next(true), 16);
-            if (isNaN(digit))
-                parse_error("Invalid hex-character pattern in string");
-            num = (num << 4) | digit;
+    function read_octal_escape_sequence(ch) {
+        // Read
+        var p = peek();
+        if (p >= "0" && p <= "7") {
+            ch += next(true);
+            if (ch[0] <= "3" && (p = peek()) >= "0" && p <= "7")
+                ch += next(true);
         }
-        return num;
-    };
 
-    var read_string = with_eof_error("Unterminated string constant", function(quote_char){
+        // Parse
+        if (ch === "0") return "\0";
+        if (ch.length > 0 && next_token.has_directive("use strict"))
+            parse_error("Legacy octal escape sequences are not allowed in strict mode");
+        return String.fromCharCode(parseInt(ch, 8));
+    }
+
+    var read_string = with_eof_error("Unterminated string constant", function(quote_char) {
         var quote = next(), ret = "";
         for (;;) {
             var ch = next(true, true);
-            if (ch == "\\") {
-                // read OctalEscapeSequence (XXX: deprecated if "strict mode")
-                // https://github.com/mishoo/UglifyJS/issues/178
-                var octal_len = 0, first = null;
-                ch = read_while(function(ch){
-                    if (ch >= "0" && ch <= "7") {
-                        if (!first) {
-                            first = ch;
-                            return ++octal_len;
-                        }
-                        else if (first <= "3" && octal_len <= 2) return ++octal_len;
-                        else if (first >= "4" && octal_len <= 1) return ++octal_len;
-                    }
-                    return false;
-                });
-                if (octal_len > 0) ch = String.fromCharCode(parseInt(ch, 8));
-                else ch = read_escaped_char(true);
-            }
+            if (ch == "\\") ch = read_escaped_char(true);
+            else if (NEWLINE_CHARS[ch]) parse_error("Unterminated string constant");
             else if (ch == quote) break;
             ret += ch;
         }
@@ -406,7 +446,7 @@
 
     function skip_line_comment(type) {
         var regex_allowed = S.regex_allowed;
-        var i = find("\n"), ret;
+        var i = find_eol(), ret;
         if (i == -1) {
             ret = S.text.substr(S.pos);
             S.pos = S.text.length;
@@ -417,36 +457,28 @@
         S.col = S.tokcol + (S.pos - S.tokpos);
         S.comments_before.push(token(type, ret, true));
         S.regex_allowed = regex_allowed;
-        return next_token();
-    };
+        return next_token;
+    }
 
-    var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function(){
+    var skip_multiline_comment = with_eof_error("Unterminated multiline comment", function() {
         var regex_allowed = S.regex_allowed;
         var i = find("*/", true);
-        var text = S.text.substring(S.pos, i);
-        var a = text.split("\n"), n = a.length;
+        var text = S.text.substring(S.pos, i).replace(/\r\n|\r|\u2028|\u2029/g, "\n");
         // update stream position
-        S.pos = i + 2;
-        S.line += n - 1;
-        if (n > 1) S.col = a[n - 1].length;
-        else S.col += a[n - 1].length;
-        S.col += 2;
-        var nlb = S.newline_before = S.newline_before || text.indexOf("\n") >= 0;
+        forward(text.length /* doesn't count \r\n as 2 char while S.pos - i does */ + 2);
         S.comments_before.push(token("comment2", text, true));
         S.regex_allowed = regex_allowed;
-        S.newline_before = nlb;
-        return next_token();
+        return next_token;
     });
 
     function read_name() {
-        var backslash = false, name = "", ch, escaped = false, hex;
-        while ((ch = peek()) != null) {
+        var backslash = false, ch, escaped = false, name = peek() == "#" ? next() : "";
+        while (ch = peek()) {
             if (!backslash) {
                 if (ch == "\\") escaped = backslash = true, next();
                 else if (is_identifier_char(ch)) name += next();
                 else break;
-            }
-            else {
+            } else {
                 if (ch != "u") parse_error("Expecting UnicodeEscapeSequence -- uXXXX");
                 ch = read_escaped_char();
                 if (!is_identifier_char(ch)) parse_error("Unicode char: " + ch.charCodeAt(0) + " is not valid in identifier");
@@ -454,48 +486,56 @@
                 backslash = false;
             }
         }
-        if (KEYWORDS(name) && escaped) {
-            hex = name.charCodeAt(0).toString(16).toUpperCase();
+        if (KEYWORDS[name] && escaped) {
+            var hex = name.charCodeAt(0).toString(16).toUpperCase();
             name = "\\u" + "0000".substr(hex.length) + hex + name.slice(1);
         }
         return name;
-    };
+    }
 
-    var read_regexp = with_eof_error("Unterminated regular expression", function(regexp){
+    var read_regexp = with_eof_error("Unterminated regular expression", function(source) {
         var prev_backslash = false, ch, in_class = false;
-        while ((ch = next(true))) if (prev_backslash) {
-            regexp += "\\" + ch;
+        while ((ch = next(true))) if (NEWLINE_CHARS[ch]) {
+            parse_error("Unexpected line terminator");
+        } else if (prev_backslash) {
+            source += "\\" + ch;
             prev_backslash = false;
         } else if (ch == "[") {
             in_class = true;
-            regexp += ch;
+            source += ch;
         } else if (ch == "]" && in_class) {
             in_class = false;
-            regexp += ch;
+            source += ch;
         } else if (ch == "/" && !in_class) {
             break;
         } else if (ch == "\\") {
             prev_backslash = true;
         } else {
-            regexp += ch;
+            source += ch;
         }
         var mods = read_name();
-        return token("regexp", new RegExp(regexp, mods));
+        try {
+            var regexp = new RegExp(source, mods);
+            regexp.raw_source = source;
+            return token("regexp", regexp);
+        } catch (e) {
+            parse_error(e.message);
+        }
     });
 
     function read_operator(prefix) {
         function grow(op) {
             if (!peek()) return op;
             var bigger = op + peek();
-            if (OPERATORS(bigger)) {
+            if (OPERATORS[bigger]) {
                 next();
                 return grow(bigger);
             } else {
                 return op;
             }
-        };
+        }
         return token("operator", grow(prefix || next()));
-    };
+    }
 
     function handle_slash() {
         next();
@@ -508,154 +548,174 @@
             return skip_multiline_comment();
         }
         return S.regex_allowed ? read_regexp("") : read_operator("/");
-    };
+    }
 
     function handle_dot() {
         next();
-        return is_digit(peek().charCodeAt(0))
-            ? read_num(".")
-            : token("punc", ".");
-    };
+        if (looking_at("..")) return token("operator", "." + next() + next());
+        return is_digit(peek().charCodeAt(0)) ? read_num(".") : token("punc", ".");
+    }
 
     function read_word() {
         var word = read_name();
         if (prev_was_dot) return token("name", word);
-        return KEYWORDS_ATOM(word) ? token("atom", word)
-            : !KEYWORDS(word) ? token("name", word)
-            : OPERATORS(word) ? token("operator", word)
+        return KEYWORDS_ATOM[word] ? token("atom", word)
+            : !KEYWORDS[word] ? token("name", word)
+            : OPERATORS[word] ? token("operator", word)
             : token("keyword", word);
-    };
+    }
 
     function with_eof_error(eof_error, cont) {
         return function(x) {
             try {
                 return cont(x);
-            } catch(ex) {
+            } catch (ex) {
                 if (ex === EX_EOF) parse_error(eof_error);
                 else throw ex;
             }
         };
-    };
+    }
 
     function next_token(force_regexp) {
         if (force_regexp != null)
             return read_regexp(force_regexp);
-        skip_whitespace();
-        start_token();
-        if (html5_comments) {
-            if (looking_at("<!--")) {
-                forward(4);
-                return skip_line_comment("comment3");
-            }
-            if (looking_at("-->") && S.newline_before) {
-                forward(3);
-                return skip_line_comment("comment4");
-            }
-        }
-        var ch = peek();
-        if (!ch) return token("eof");
-        var code = ch.charCodeAt(0);
-        switch (code) {
-          case 34: case 39: return read_string(ch);
-          case 46: return handle_dot();
-          case 47: return handle_slash();
-        }
-        if (is_digit(code)) return read_num();
-        if (PUNC_CHARS(ch)) return token("punc", next());
-        if (OPERATOR_CHARS(ch)) return read_operator();
-        if (code == 92 || is_identifier_start(code)) return read_word();
+        if (shebang && S.pos == 0 && looking_at("#!")) {
+            start_token();
+            forward(2);
+            skip_line_comment("comment5");
+        }
+        for (;;) {
+            skip_whitespace();
+            start_token();
+            if (html5_comments) {
+                if (looking_at("<!--")) {
+                    forward(4);
+                    skip_line_comment("comment3");
+                    continue;
+                }
+                if (looking_at("-->") && S.newline_before) {
+                    forward(3);
+                    skip_line_comment("comment4");
+                    continue;
+                }
+            }
+            var ch = peek();
+            if (!ch) return token("eof");
+            var code = ch.charCodeAt(0);
+            switch (code) {
+              case 34: case 39: return read_string(ch);
+              case 46: return handle_dot();
+              case 47:
+                var tok = handle_slash();
+                if (tok === next_token) continue;
+                return tok;
+            }
+            if (is_digit(code)) return read_num();
+            if (PUNC_CHARS[ch]) return token("punc", next());
+            if (looking_at("=>")) return token("punc", next() + next());
+            if (OPERATOR_CHARS[ch]) return read_operator();
+            if (code == 35 || code == 92 || !NON_IDENTIFIER_CHARS[ch]) return read_word();
+            break;
+        }
         parse_error("Unexpected character '" + ch + "'");
-    };
+    }
 
     next_token.context = function(nc) {
         if (nc) S = nc;
         return S;
     };
 
-    return next_token;
+    next_token.add_directive = function(directive) {
+        S.directives[directive] = true;
+    }
+
+    next_token.push_directives_stack = function() {
+        S.directives = Object.create(S.directives);
+    }
+
+    next_token.pop_directives_stack = function() {
+        S.directives = Object.getPrototypeOf(S.directives);
+    }
 
-};
+    next_token.has_directive = function(directive) {
+        return !!S.directives[directive];
+    }
+
+    return next_token;
+}
 
 /* -----[ Parser (constants) ]----- */
 
-var UNARY_PREFIX = makePredicate([
-    "typeof",
-    "void",
-    "delete",
-    "--",
-    "++",
-    "!",
-    "~",
-    "-",
-    "+"
-]);
+var UNARY_PREFIX = makePredicate("typeof void delete -- ++ ! ~ - +");
 
-var UNARY_POSTFIX = makePredicate([ "--", "++" ]);
+var UNARY_POSTFIX = makePredicate("-- ++");
 
-var ASSIGNMENT = makePredicate([ "=", "+=", "-=", "/=", "*=", "%=", ">>=", "<<=", ">>>=", "|=", "^=", "&=" ]);
+var ASSIGNMENT = makePredicate("= += -= /= *= %= **= >>= <<= >>>= &= |= ^= &&= ||= ??=");
 
-var PRECEDENCE = (function(a, ret){
-    for (var i = 0; i < a.length; ++i) {
-        var b = a[i];
-        for (var j = 0; j < b.length; ++j) {
-            ret[b[j]] = i + 1;
+var PRECEDENCE = function(a, ret) {
+    for (var i = 0; i < a.length;) {
+        var b = a[i++];
+        for (var j = 0; j < b.length; j++) {
+            ret[b[j]] = i;
         }
     }
     return ret;
-})(
-    [
-        ["||"],
-        ["&&"],
-        ["|"],
-        ["^"],
-        ["&"],
-        ["==", "===", "!=", "!=="],
-        ["<", ">", "<=", ">=", "in", "instanceof"],
-        [">>", "<<", ">>>"],
-        ["+", "-"],
-        ["*", "/", "%"]
-    ],
-    {}
-);
+}([
+    ["??"],
+    ["||"],
+    ["&&"],
+    ["|"],
+    ["^"],
+    ["&"],
+    ["==", "===", "!=", "!=="],
+    ["<", ">", "<=", ">=", "in", "instanceof"],
+    [">>", "<<", ">>>"],
+    ["+", "-"],
+    ["*", "/", "%"],
+    ["**"],
+], {});
 
-var STATEMENTS_WITH_LABELS = array_to_hash([ "for", "do", "while", "switch" ]);
-
-var ATOMIC_START_TOKEN = array_to_hash([ "atom", "num", "string", "regexp", "name" ]);
+var ATOMIC_START_TOKEN = makePredicate("atom bigint num regexp string");
 
 /* -----[ Parser ]----- */
 
 function parse($TEXT, options) {
-
     options = defaults(options, {
-        strict         : false,
-        filename       : null,
-        toplevel       : null,
+        bare_returns   : false,
         expression     : false,
+        filename       : null,
         html5_comments : true,
-        bare_returns   : false,
-    });
+        module         : false,
+        shebang        : true,
+        strict         : false,
+        toplevel       : null,
+    }, true);
 
     var S = {
-        input         : (typeof $TEXT == "string"
-                         ? tokenizer($TEXT, options.filename,
-                                     options.html5_comments)
-                         : $TEXT),
-        token         : null,
-        prev          : null,
-        peeked        : null,
-        in_function   : 0,
+        input         : typeof $TEXT == "string"
+                        ? tokenizer($TEXT, options.filename, options.html5_comments, options.shebang)
+                        : $TEXT,
+        in_async      : false,
         in_directives : true,
+        in_funarg     : -1,
+        in_function   : 0,
+        in_generator  : false,
         in_loop       : 0,
-        labels        : []
+        labels        : [],
+        peeked        : null,
+        prev          : null,
+        token         : null,
     };
 
     S.token = next();
 
     function is(type, value) {
         return is_token(S.token, type, value);
-    };
+    }
 
-    function peek() { return S.peeked || (S.peeked = S.input()); };
+    function peek() {
+        return S.peeked || (S.peeked = S.input());
+    }
 
     function next() {
         S.prev = S.token;
@@ -669,11 +729,11 @@
             S.token.type == "string" || is("punc", ";")
         );
         return S.token;
-    };
+    }
 
     function prev() {
         return S.prev;
-    };
+    }
 
     function croak(msg, line, col, pos) {
         var ctx = S.input.context();
@@ -682,86 +742,131 @@
                  line != null ? line : ctx.tokline,
                  col != null ? col : ctx.tokcol,
                  pos != null ? pos : ctx.tokpos);
-    };
+    }
 
     function token_error(token, msg) {
         croak(msg, token.line, token.col);
-    };
+    }
+
+    function token_to_string(type, value) {
+        return type + (value === undefined ? "" : " «" + value + "»");
+    }
 
     function unexpected(token) {
-        if (token == null)
-            token = S.token;
-        token_error(token, "Unexpected token: " + token.type + " (" + token.value + ")");
-    };
+        if (token == null) token = S.token;
+        token_error(token, "Unexpected token: " + token_to_string(token.type, token.value));
+    }
 
     function expect_token(type, val) {
-        if (is(type, val)) {
-            return next();
-        }
-        token_error(S.token, "Unexpected token " + S.token.type + " «" + S.token.value + "»" + ", expected " + type + " «" + val + "»");
-    };
+        if (is(type, val)) return next();
+        token_error(S.token, "Unexpected token: " + token_to_string(S.token.type, S.token.value) + ", expected: " + token_to_string(type, val));
+    }
+
+    function expect(punc) {
+        return expect_token("punc", punc);
+    }
 
-    function expect(punc) { return expect_token("punc", punc); };
+    function has_newline_before(token) {
+        return token.nlb || !all(token.comments_before, function(comment) {
+            return !comment.nlb;
+        });
+    }
 
     function can_insert_semicolon() {
-        return !options.strict && (
-            S.token.nlb || is("eof") || is("punc", "}")
-        );
-    };
+        return !options.strict
+            && (is("eof") || is("punc", "}") || has_newline_before(S.token));
+    }
 
-    function semicolon() {
+    function semicolon(optional) {
         if (is("punc", ";")) next();
-        else if (!can_insert_semicolon()) unexpected();
-    };
+        else if (!optional && !can_insert_semicolon()) expect(";");
+    }
 
-    function parenthesised() {
+    function parenthesized() {
         expect("(");
-        var exp = expression(true);
+        var exp = expression();
         expect(")");
         return exp;
-    };
+    }
 
     function embed_tokens(parser) {
         return function() {
             var start = S.token;
-            var expr = parser();
+            var expr = parser.apply(null, arguments);
             var end = prev();
             expr.start = start;
             expr.end = end;
             return expr;
         };
-    };
+    }
 
     function handle_regexp() {
         if (is("operator", "/") || is("operator", "/=")) {
             S.peeked = null;
             S.token = S.input(S.token.value.substr(1)); // force regexp
         }
-    };
+    }
 
-    var statement = embed_tokens(function() {
-        var tmp;
+    var statement = embed_tokens(function(toplevel) {
         handle_regexp();
         switch (S.token.type) {
           case "string":
-            var dir = S.in_directives, stat = simple_statement();
-            // XXXv2: decide how to fix directives
-            if (dir && stat.body instanceof AST_String && !is("punc", ",")) {
-                return new AST_Directive({
-                    start : stat.body.start,
-                    end   : stat.body.end,
-                    quote : stat.body.quote,
-                    value : stat.body.value,
-                });
+            var dir = S.in_directives;
+            var body = expression();
+            if (dir) {
+                if (body instanceof AST_String) {
+                    var value = body.start.raw.slice(1, -1);
+                    S.input.add_directive(value);
+                    body.value = value;
+                } else {
+                    S.in_directives = dir = false;
+                }
             }
-            return stat;
+            semicolon();
+            return dir ? new AST_Directive(body) : new AST_SimpleStatement({ body: body });
           case "num":
+          case "bigint":
           case "regexp":
           case "operator":
           case "atom":
             return simple_statement();
 
           case "name":
+            switch (S.token.value) {
+              case "async":
+                if (is_token(peek(), "keyword", "function")) {
+                    next();
+                    next();
+                    if (!is("operator", "*")) return function_(AST_AsyncDefun);
+                    next();
+                    return function_(AST_AsyncGeneratorDefun);
+                }
+                break;
+              case "await":
+                if (S.in_async) return simple_statement();
+                break;
+              case "export":
+                if (!toplevel && options.module !== "") unexpected();
+                next();
+                return export_();
+              case "import":
+                var token = peek();
+                if (token.type == "punc" && /^[(.]$/.test(token.value)) break;
+                if (!toplevel && options.module !== "") unexpected();
+                next();
+                return import_();
+              case "let":
+                if (is_vardefs()) {
+                    next();
+                    var node = let_();
+                    semicolon();
+                    return node;
+                }
+                break;
+              case "yield":
+                if (S.in_generator) return simple_statement();
+                break;
+            }
             return is_token(peek(), "punc", ":")
                 ? labeled_statement()
                 : simple_statement();
@@ -776,8 +881,10 @@
                 });
               case "[":
               case "(":
+              case "`":
                 return simple_statement();
               case ";":
+                S.in_directives = false;
                 next();
                 return new AST_EmptyStatement();
               default:
@@ -785,86 +892,119 @@
             }
 
           case "keyword":
-            switch (tmp = S.token.value, next(), tmp) {
+            switch (S.token.value) {
               case "break":
+                next();
                 return break_cont(AST_Break);
 
+              case "class":
+                next();
+                return class_(AST_DefClass);
+
+              case "const":
+                next();
+                var node = const_();
+                semicolon();
+                return node;
+
               case "continue":
+                next();
                 return break_cont(AST_Continue);
 
               case "debugger":
+                next();
                 semicolon();
                 return new AST_Debugger();
 
               case "do":
+                next();
+                var body = in_loop(statement);
+                expect_token("keyword", "while");
+                var condition = parenthesized();
+                semicolon(true);
                 return new AST_Do({
-                    body      : in_loop(statement),
-                    condition : (expect_token("keyword", "while"), tmp = parenthesised(), semicolon(), tmp)
+                    body      : body,
+                    condition : condition,
                 });
 
               case "while":
+                next();
                 return new AST_While({
-                    condition : parenthesised(),
-                    body      : in_loop(statement)
+                    condition : parenthesized(),
+                    body      : in_loop(statement),
                 });
 
               case "for":
+                next();
                 return for_();
 
               case "function":
-                return function_(AST_Defun);
+                next();
+                if (!is("operator", "*")) return function_(AST_Defun);
+                next();
+                return function_(AST_GeneratorDefun);
 
               case "if":
+                next();
                 return if_();
 
               case "return":
                 if (S.in_function == 0 && !options.bare_returns)
                     croak("'return' outside of function");
-                return new AST_Return({
-                    value: ( is("punc", ";")
-                             ? (next(), null)
-                             : can_insert_semicolon()
-                             ? null
-                             : (tmp = expression(true), semicolon(), tmp) )
-                });
+                next();
+                var value = null;
+                if (is("punc", ";")) {
+                    next();
+                } else if (!can_insert_semicolon()) {
+                    value = expression();
+                    semicolon();
+                }
+                return new AST_Return({ value: value });
 
               case "switch":
+                next();
                 return new AST_Switch({
-                    expression : parenthesised(),
-                    body       : in_loop(switch_body_)
+                    expression : parenthesized(),
+                    body       : in_loop(switch_body_),
                 });
 
               case "throw":
-                if (S.token.nlb)
+                next();
+                if (has_newline_before(S.token))
                     croak("Illegal newline after 'throw'");
-                return new AST_Throw({
-                    value: (tmp = expression(true), semicolon(), tmp)
-                });
+                var value = expression();
+                semicolon();
+                return new AST_Throw({ value: value });
 
               case "try":
+                next();
                 return try_();
 
               case "var":
-                return tmp = var_(), semicolon(), tmp;
-
-              case "const":
-                return tmp = const_(), semicolon(), tmp;
+                next();
+                var node = var_();
+                semicolon();
+                return node;
 
               case "with":
+                if (S.input.has_directive("use strict")) {
+                    croak("Strict mode may not include a with statement");
+                }
+                next();
                 return new AST_With({
-                    expression : parenthesised(),
-                    body       : statement()
+                    expression : parenthesized(),
+                    body       : statement(),
                 });
-
-              default:
-                unexpected();
             }
         }
+        unexpected();
     });
 
     function labeled_statement() {
         var label = as_symbol(AST_Label);
-        if (find_if(function(l){ return l.name == label.name }, S.labels)) {
+        if (!all(S.labels, function(l) {
+            return l.name != label.name;
+        })) {
             // ECMA-262, 12.12: An ECMAScript program is considered
             // syntactically incorrect if it contains a
             // LabelledStatement that is enclosed by a
@@ -878,21 +1018,21 @@
         if (!(stat instanceof AST_IterationStatement)) {
             // check for `continue` that refers to this label.
             // those should be reported as syntax errors.
-            // https://github.com/mishoo/UglifyJS2/issues/287
-            label.references.forEach(function(ref){
+            // https://github.com/mishoo/UglifyJS/issues/287
+            label.references.forEach(function(ref) {
                 if (ref instanceof AST_Continue) {
-                    ref = ref.label.start;
-                    croak("Continue label `" + label.name + "` refers to non-IterationStatement.",
-                          ref.line, ref.col, ref.pos);
+                    token_error(ref.label.start, "Continue label `" + label.name + "` must refer to IterationStatement");
                 }
             });
         }
         return new AST_LabeledStatement({ body: stat, label: label });
-    };
+    }
 
-    function simple_statement(tmp) {
-        return new AST_SimpleStatement({ body: (tmp = expression(true), semicolon(), tmp) });
-    };
+    function simple_statement() {
+        var body = expression();
+        semicolon();
+        return new AST_SimpleStatement({ body: body });
+    }
 
     function break_cont(type) {
         var label = null, ldef;
@@ -900,41 +1040,199 @@
             label = as_symbol(AST_LabelRef, true);
         }
         if (label != null) {
-            ldef = find_if(function(l){ return l.name == label.name }, S.labels);
-            if (!ldef)
-                croak("Undefined label " + label.name);
+            ldef = find_if(function(l) {
+                return l.name == label.name;
+            }, S.labels);
+            if (!ldef) token_error(label.start, "Undefined label " + label.name);
             label.thedef = ldef;
-        }
-        else if (S.in_loop == 0)
-            croak(type.TYPE + " not inside a loop or switch");
+        } else if (S.in_loop == 0) croak(type.TYPE + " not inside a loop or switch");
         semicolon();
         var stat = new type({ label: label });
         if (ldef) ldef.references.push(stat);
         return stat;
-    };
+    }
+
+    function has_modifier(name, no_nlb) {
+        if (!is("name", name)) return;
+        var token = peek();
+        if (!token) return;
+        if (is_token(token, "operator", "=")) return;
+        if (token.type == "punc" && /^[(;}]$/.test(token.value)) return;
+        if (no_nlb && has_newline_before(token)) return;
+        return next();
+    }
+
+    function class_(ctor) {
+        var was_async = S.in_async;
+        var was_gen = S.in_generator;
+        S.input.push_directives_stack();
+        S.input.add_directive("use strict");
+        var name;
+        if (ctor === AST_DefClass) {
+            name = as_symbol(AST_SymbolDefClass);
+        } else {
+            name = as_symbol(AST_SymbolClass, true);
+        }
+        var parent = null;
+        if (is("keyword", "extends")) {
+            next();
+            handle_regexp();
+            parent = expr_atom(true);
+        }
+        expect("{");
+        var props = [];
+        while (!is("punc", "}")) {
+            if (is("punc", ";")) {
+                next();
+                continue;
+            }
+            var start = S.token;
+            var fixed = !!has_modifier("static");
+            var async = has_modifier("async", true);
+            if (is("operator", "*")) {
+                next();
+                var internal = is("name") && /^#/.test(S.token.value);
+                var key = as_property_key();
+                var gen_start = S.token;
+                var gen = function_(async ? AST_AsyncGeneratorFunction : AST_GeneratorFunction);
+                gen.start = gen_start;
+                gen.end = prev();
+                props.push(new AST_ClassMethod({
+                    start: start,
+                    static: fixed,
+                    private: internal,
+                    key: key,
+                    value: gen,
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (fixed && is("punc", "{")) {
+                props.push(new AST_ClassInit({
+                    start: start,
+                    value: new AST_ClassInitBlock({
+                        start: start,
+                        body: block_(),
+                        end: prev(),
+                    }),
+                    end: prev(),
+                }));
+                continue;
+            }
+            var internal = is("name") && /^#/.test(S.token.value);
+            var key = as_property_key();
+            if (is("punc", "(")) {
+                var func_start = S.token;
+                var func = function_(async ? AST_AsyncFunction : AST_Function);
+                func.start = func_start;
+                func.end = prev();
+                props.push(new AST_ClassMethod({
+                    start: start,
+                    static: fixed,
+                    private: internal,
+                    key: key,
+                    value: func,
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (async) unexpected(async);
+            var value = null;
+            if (is("operator", "=")) {
+                next();
+                S.in_async = false;
+                S.in_generator = false;
+                value = maybe_assign();
+                S.in_generator = was_gen;
+                S.in_async = was_async;
+            } else if (!(is("punc", ";") || is("punc", "}"))) {
+                var type = null;
+                switch (key) {
+                  case "get":
+                    type = AST_ClassGetter;
+                    break;
+                  case "set":
+                    type = AST_ClassSetter;
+                    break;
+                }
+                if (type) {
+                    props.push(new type({
+                        start: start,
+                        static: fixed,
+                        private: is("name") && /^#/.test(S.token.value),
+                        key: as_property_key(),
+                        value: create_accessor(),
+                        end: prev(),
+                    }));
+                    continue;
+                }
+            }
+            semicolon();
+            props.push(new AST_ClassField({
+                start: start,
+                static: fixed,
+                private: internal,
+                key: key,
+                value: value,
+                end: prev(),
+            }));
+        }
+        next();
+        S.input.pop_directives_stack();
+        S.in_generator = was_gen;
+        S.in_async = was_async;
+        return new ctor({
+            extends: parent,
+            name: name,
+            properties: props,
+        });
+    }
 
     function for_() {
+        var await_token = is("name", "await") && next();
         expect("(");
         var init = null;
-        if (!is("punc", ";")) {
-            init = is("keyword", "var")
+        if (await_token || !is("punc", ";")) {
+            init = is("keyword", "const")
+                ? (next(), const_(true))
+                : is("name", "let") && is_vardefs()
+                ? (next(), let_(true))
+                : is("keyword", "var")
                 ? (next(), var_(true))
-                : expression(true, true);
-            if (is("operator", "in")) {
-                if (init instanceof AST_Var && init.definitions.length > 1)
-                    croak("Only one variable declaration allowed in for..in loop");
+                : expression(true);
+            var ctor;
+            if (await_token) {
+                expect_token("name", "of");
+                ctor = AST_ForAwaitOf;
+            } else if (is("operator", "in")) {
                 next();
-                return for_in(init);
+                ctor = AST_ForIn;
+            } else if (is("name", "of")) {
+                next();
+                ctor = AST_ForOf;
+            }
+            if (ctor) {
+                if (init instanceof AST_Definitions) {
+                    if (init.definitions.length > 1) {
+                        token_error(init.start, "Only one variable declaration allowed in for..in/of loop");
+                    }
+                    if (ctor !== AST_ForIn && init.definitions[0].value) {
+                        token_error(init.definitions[0].value.start, "No initializers allowed in for..of loop");
+                    }
+                } else if (!(is_assignable(init) || (init = to_destructured(init)) instanceof AST_Destructured)) {
+                    token_error(init.start, "Invalid left-hand side in for..in/of loop");
+                }
+                return for_enum(ctor, init);
             }
         }
         return regular_for(init);
-    };
+    }
 
     function regular_for(init) {
         expect(";");
-        var test = is("punc", ";") ? null : expression(true);
+        var test = is("punc", ";") ? null : expression();
         expect(";");
-        var step = is("punc", ")") ? null : expression(true);
+        var step = is("punc", ")") ? null : expression();
         expect(")");
         return new AST_For({
             init      : init,
@@ -942,100 +1240,444 @@
             step      : step,
             body      : in_loop(statement)
         });
-    };
+    }
 
-    function for_in(init) {
-        var lhs = init instanceof AST_Var ? init.definitions[0].name : null;
-        var obj = expression(true);
+    function for_enum(ctor, init) {
+        handle_regexp();
+        var obj = expression();
         expect(")");
-        return new AST_ForIn({
+        return new ctor({
             init   : init,
-            name   : lhs,
             object : obj,
             body   : in_loop(statement)
         });
-    };
+    }
+
+    function to_funarg(node) {
+        if (node instanceof AST_Array) {
+            var rest = null;
+            if (node.elements[node.elements.length - 1] instanceof AST_Spread) {
+                rest = to_funarg(node.elements.pop().expression);
+            }
+            return new AST_DestructuredArray({
+                start: node.start,
+                elements: node.elements.map(to_funarg),
+                rest: rest,
+                end: node.end,
+            });
+        }
+        if (node instanceof AST_Assign) return new AST_DefaultValue({
+            start: node.start,
+            name: to_funarg(node.left),
+            value: node.right,
+            end: node.end,
+        });
+        if (node instanceof AST_DefaultValue) {
+            node.name = to_funarg(node.name);
+            return node;
+        }
+        if (node instanceof AST_DestructuredArray) {
+            node.elements = node.elements.map(to_funarg);
+            if (node.rest) node.rest = to_funarg(node.rest);
+            return node;
+        }
+        if (node instanceof AST_DestructuredObject) {
+            node.properties.forEach(function(prop) {
+                prop.value = to_funarg(prop.value);
+            });
+            if (node.rest) node.rest = to_funarg(node.rest);
+            return node;
+        }
+        if (node instanceof AST_Hole) return node;
+        if (node instanceof AST_Object) {
+            var rest = null;
+            if (node.properties[node.properties.length - 1] instanceof AST_Spread) {
+                rest = to_funarg(node.properties.pop().expression);
+            }
+            return new AST_DestructuredObject({
+                start: node.start,
+                properties: node.properties.map(function(prop) {
+                    if (!(prop instanceof AST_ObjectKeyVal)) token_error(prop.start, "Invalid destructuring assignment");
+                    return new AST_DestructuredKeyVal({
+                        start: prop.start,
+                        key: prop.key,
+                        value: to_funarg(prop.value),
+                        end: prop.end,
+                    });
+                }),
+                rest: rest,
+                end: node.end,
+            });
+        }
+        if (node instanceof AST_SymbolFunarg) return node;
+        if (node instanceof AST_SymbolRef) return new AST_SymbolFunarg(node);
+        if (node instanceof AST_Yield) return new AST_SymbolFunarg({
+            start: node.start,
+            name: "yield",
+            end: node.end,
+        });
+        token_error(node.start, "Invalid arrow parameter");
+    }
+
+    function arrow(exprs, start, async) {
+        var was_async = S.in_async;
+        var was_gen = S.in_generator;
+        S.in_async = async;
+        S.in_generator = false;
+        var was_funarg = S.in_funarg;
+        S.in_funarg = S.in_function;
+        var argnames = exprs.map(to_funarg);
+        var rest = exprs.rest || null;
+        if (rest) rest = to_funarg(rest);
+        S.in_funarg = was_funarg;
+        expect("=>");
+        var body, value;
+        var loop = S.in_loop;
+        var labels = S.labels;
+        ++S.in_function;
+        S.input.push_directives_stack();
+        S.in_loop = 0;
+        S.labels = [];
+        if (is("punc", "{")) {
+            S.in_directives = true;
+            body = block_();
+            value = null;
+        } else {
+            body = [];
+            handle_regexp();
+            value = maybe_assign();
+        }
+        var is_strict = S.input.has_directive("use strict");
+        S.input.pop_directives_stack();
+        --S.in_function;
+        S.in_loop = loop;
+        S.labels = labels;
+        S.in_generator = was_gen;
+        S.in_async = was_async;
+        var node = new (async ? AST_AsyncArrow : AST_Arrow)({
+            start: start,
+            argnames: argnames,
+            rest: rest,
+            body: body,
+            value: value,
+            end: prev(),
+        });
+        if (is_strict) node.each_argname(strict_verify_symbol);
+        return node;
+    }
 
     var function_ = function(ctor) {
-        var in_statement = ctor === AST_Defun;
-        var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null;
-        if (in_statement && !name)
-            unexpected();
+        var was_async = S.in_async;
+        var was_gen = S.in_generator;
+        var name;
+        if (/Defun$/.test(ctor.TYPE)) {
+            name = as_symbol(AST_SymbolDefun);
+            S.in_async = /^Async/.test(ctor.TYPE);
+            S.in_generator = /Generator/.test(ctor.TYPE);
+        } else {
+            S.in_async = /^Async/.test(ctor.TYPE);
+            S.in_generator = /Generator/.test(ctor.TYPE);
+            name = as_symbol(AST_SymbolLambda, true);
+        }
+        if (name && ctor !== AST_Accessor && !(name instanceof AST_SymbolDeclaration))
+            unexpected(prev());
         expect("(");
-        return new ctor({
+        var was_funarg = S.in_funarg;
+        S.in_funarg = S.in_function;
+        var argnames = expr_list(")", !options.strict, false, function() {
+            return maybe_default(AST_SymbolFunarg);
+        });
+        S.in_funarg = was_funarg;
+        var loop = S.in_loop;
+        var labels = S.labels;
+        ++S.in_function;
+        S.in_directives = true;
+        S.input.push_directives_stack();
+        S.in_loop = 0;
+        S.labels = [];
+        var body = block_();
+        var is_strict = S.input.has_directive("use strict");
+        S.input.pop_directives_stack();
+        --S.in_function;
+        S.in_loop = loop;
+        S.labels = labels;
+        S.in_generator = was_gen;
+        S.in_async = was_async;
+        var node = new ctor({
             name: name,
-            argnames: (function(first, a){
-                while (!is("punc", ")")) {
-                    if (first) first = false; else expect(",");
-                    a.push(as_symbol(AST_SymbolFunarg));
-                }
-                next();
-                return a;
-            })(true, []),
-            body: (function(loop, labels){
-                ++S.in_function;
-                S.in_directives = true;
-                S.in_loop = 0;
-                S.labels = [];
-                var a = block_();
-                --S.in_function;
-                S.in_loop = loop;
-                S.labels = labels;
-                return a;
-            })(S.in_loop, S.labels)
+            argnames: argnames,
+            rest: argnames.rest || null,
+            body: body,
         });
+        if (is_strict) {
+            if (name) strict_verify_symbol(name);
+            node.each_argname(strict_verify_symbol);
+        }
+        return node;
     };
 
     function if_() {
-        var cond = parenthesised(), body = statement(), belse = null;
+        var cond = parenthesized(), body = statement(), alt = null;
         if (is("keyword", "else")) {
             next();
-            belse = statement();
+            alt = statement();
         }
         return new AST_If({
             condition   : cond,
             body        : body,
-            alternative : belse
+            alternative : alt,
         });
-    };
+    }
+
+    function is_alias() {
+        return is("name") || is("string") || is_identifier_string(S.token.value);
+    }
+
+    function make_string(token) {
+        return new AST_String({
+            start: token,
+            quote: token.quote,
+            value: token.value,
+            end: token,
+        });
+    }
+
+    function as_path() {
+        var path = S.token;
+        expect_token("string");
+        semicolon();
+        return make_string(path);
+    }
+
+    function export_() {
+        if (is("operator", "*")) {
+            var key = S.token;
+            var alias = key;
+            next();
+            if (is("name", "as")) {
+                next();
+                if (!is_alias()) expect_token("name");
+                alias = S.token;
+                next();
+            }
+            expect_token("name", "from");
+            return new AST_ExportForeign({
+                aliases: [ make_string(alias) ],
+                keys: [ make_string(key) ],
+                path: as_path(),
+            });
+        }
+        if (is("punc", "{")) {
+            next();
+            var aliases = [];
+            var keys = [];
+            while (is_alias()) {
+                var key = S.token;
+                next();
+                keys.push(key);
+                if (is("name", "as")) {
+                    next();
+                    if (!is_alias()) expect_token("name");
+                    aliases.push(S.token);
+                    next();
+                } else {
+                    aliases.push(key);
+                }
+                if (!is("punc", "}")) expect(",");
+            }
+            expect("}");
+            if (is("name", "from")) {
+                next();
+                return new AST_ExportForeign({
+                    aliases: aliases.map(make_string),
+                    keys: keys.map(make_string),
+                    path: as_path(),
+                });
+            }
+            semicolon();
+            return new AST_ExportReferences({
+                properties: keys.map(function(token, index) {
+                    if (!is_token(token, "name")) token_error(token, "Name expected");
+                    var sym = _make_symbol(AST_SymbolExport, token);
+                    sym.alias = make_string(aliases[index]);
+                    return sym;
+                }),
+            });
+        }
+        if (is("keyword", "default")) {
+            next();
+            var start = S.token;
+            var body = export_default_decl();
+            if (body) {
+                body.start = start;
+                body.end = prev();
+            } else {
+                handle_regexp();
+                body = expression();
+                semicolon();
+            }
+            return new AST_ExportDefault({ body: body });
+        }
+        return new AST_ExportDeclaration({ body: export_decl() });
+    }
+
+    function maybe_named(def, expr) {
+        if (expr.name) {
+            expr = new def(expr);
+            expr.name = new (def === AST_DefClass ? AST_SymbolDefClass : AST_SymbolDefun)(expr.name);
+        }
+        return expr;
+    }
+
+    function export_default_decl() {
+        if (is("name", "async")) {
+            if (!is_token(peek(), "keyword", "function")) return;
+            next();
+            next();
+            if (!is("operator", "*")) return maybe_named(AST_AsyncDefun, function_(AST_AsyncFunction));
+            next();
+            return maybe_named(AST_AsyncGeneratorDefun, function_(AST_AsyncGeneratorFunction));
+        } else if (is("keyword")) switch (S.token.value) {
+          case "class":
+            next();
+            return maybe_named(AST_DefClass, class_(AST_ClassExpression));
+          case "function":
+            next();
+            if (!is("operator", "*")) return maybe_named(AST_Defun, function_(AST_Function));
+            next();
+            return maybe_named(AST_GeneratorDefun, function_(AST_GeneratorFunction));
+        }
+    }
+
+    var export_decl = embed_tokens(function() {
+        if (is("name")) switch (S.token.value) {
+          case "async":
+            next();
+            expect_token("keyword", "function");
+            if (!is("operator", "*")) return function_(AST_AsyncDefun);
+            next();
+            return function_(AST_AsyncGeneratorDefun);
+          case "let":
+            next();
+            var node = let_();
+            semicolon();
+            return node;
+        } else if (is("keyword")) switch (S.token.value) {
+          case "class":
+            next();
+            return class_(AST_DefClass);
+          case "const":
+            next();
+            var node = const_();
+            semicolon();
+            return node;
+          case "function":
+            next();
+            if (!is("operator", "*")) return function_(AST_Defun);
+            next();
+            return function_(AST_GeneratorDefun);
+          case "var":
+            next();
+            var node = var_();
+            semicolon();
+            return node;
+        }
+        unexpected();
+    });
+
+    function import_() {
+        var all = null;
+        var def = as_symbol(AST_SymbolImport, true);
+        var props = null;
+        var cont;
+        if (def) {
+            def.key = new AST_String({
+                start: def.start,
+                value: "",
+                end: def.end,
+            });
+            if (cont = is("punc", ",")) next();
+        } else {
+            cont = !is("string");
+        }
+        if (cont) {
+            if (is("operator", "*")) {
+                var key = S.token;
+                next();
+                expect_token("name", "as");
+                all = as_symbol(AST_SymbolImport);
+                all.key = make_string(key);
+            } else {
+                expect("{");
+                props = [];
+                while (is_alias()) {
+                    var alias;
+                    if (is_token(peek(), "name", "as")) {
+                        var key = S.token;
+                        next();
+                        next();
+                        alias = as_symbol(AST_SymbolImport);
+                        alias.key = make_string(key);
+                    } else {
+                        alias = as_symbol(AST_SymbolImport);
+                        alias.key = new AST_String({
+                            start: alias.start,
+                            value: alias.name,
+                            end: alias.end,
+                        });
+                    }
+                    props.push(alias);
+                    if (!is("punc", "}")) expect(",");
+                }
+                expect("}");
+            }
+        }
+        if (all || def || props) expect_token("name", "from");
+        return new AST_Import({
+            all: all,
+            default: def,
+            path: as_path(),
+            properties: props,
+        });
+    }
 
     function block_() {
         expect("{");
         var a = [];
         while (!is("punc", "}")) {
-            if (is("eof")) unexpected();
+            if (is("eof")) expect("}");
             a.push(statement());
         }
         next();
         return a;
-    };
+    }
 
     function switch_body_() {
         expect("{");
-        var a = [], cur = null, branch = null, tmp;
+        var a = [], branch, cur, default_branch, tmp;
         while (!is("punc", "}")) {
-            if (is("eof")) unexpected();
+            if (is("eof")) expect("}");
             if (is("keyword", "case")) {
                 if (branch) branch.end = prev();
                 cur = [];
                 branch = new AST_Case({
                     start      : (tmp = S.token, next(), tmp),
-                    expression : expression(true),
+                    expression : expression(),
                     body       : cur
                 });
                 a.push(branch);
                 expect(":");
-            }
-            else if (is("keyword", "default")) {
+            } else if (is("keyword", "default")) {
                 if (branch) branch.end = prev();
+                if (default_branch) croak("More than one default clause in switch statement");
                 cur = [];
                 branch = new AST_Default({
                     start : (tmp = S.token, next(), expect(":"), tmp),
                     body  : cur
                 });
                 a.push(branch);
-            }
-            else {
+                default_branch = branch;
+            } else {
                 if (!cur) unexpected();
                 cur.push(statement());
             }
@@ -1043,16 +1685,19 @@
         if (branch) branch.end = prev();
         next();
         return a;
-    };
+    }
 
     function try_() {
         var body = block_(), bcatch = null, bfinally = null;
         if (is("keyword", "catch")) {
             var start = S.token;
             next();
-            expect("(");
-            var name = as_symbol(AST_SymbolCatch);
-            expect(")");
+            var name = null;
+            if (is("punc", "(")) {
+                next();
+                name = maybe_destructured(AST_SymbolCatch);
+                expect(")");
+            }
             bcatch = new AST_Catch({
                 start   : start,
                 argname : name,
@@ -1076,15 +1721,24 @@
             bcatch   : bcatch,
             bfinally : bfinally
         });
-    };
+    }
 
-    function vardefs(no_in, in_const) {
+    function vardefs(type, no_in) {
         var a = [];
         for (;;) {
+            var start = S.token;
+            var name = maybe_destructured(type);
+            var value = null;
+            if (is("operator", "=")) {
+                next();
+                value = maybe_assign(no_in);
+            } else if (!no_in && (type === AST_SymbolConst || name instanceof AST_Destructured)) {
+                croak("Missing initializer in declaration");
+            }
             a.push(new AST_VarDef({
-                start : S.token,
-                name  : as_symbol(in_const ? AST_SymbolConst : AST_SymbolVar),
-                value : is("operator", "=") ? (next(), expression(false, no_in)) : null,
+                start : start,
+                name  : name,
+                value : value,
                 end   : prev()
             }));
             if (!is("punc", ","))
@@ -1092,94 +1746,144 @@
             next();
         }
         return a;
+    }
+
+    function is_vardefs() {
+        var token = peek();
+        return is_token(token, "name") || is_token(token, "punc", "[") || is_token(token, "punc", "{");
+    }
+
+    var const_ = function(no_in) {
+        return new AST_Const({
+            start       : prev(),
+            definitions : vardefs(AST_SymbolConst, no_in),
+            end         : prev()
+        });
     };
 
-    var var_ = function(no_in) {
-        return new AST_Var({
+    var let_ = function(no_in) {
+        return new AST_Let({
             start       : prev(),
-            definitions : vardefs(no_in, false),
+            definitions : vardefs(AST_SymbolLet, no_in),
             end         : prev()
         });
     };
 
-    var const_ = function() {
-        return new AST_Const({
+    var var_ = function(no_in) {
+        return new AST_Var({
             start       : prev(),
-            definitions : vardefs(false, true),
+            definitions : vardefs(AST_SymbolVar, no_in),
             end         : prev()
         });
     };
 
-    var new_ = function() {
+    var new_ = function(allow_calls) {
         var start = S.token;
         expect_token("operator", "new");
-        var newexp = expr_atom(false), args;
-        if (is("punc", "(")) {
+        var call;
+        if (is("punc", ".") && is_token(peek(), "name", "target")) {
+            next();
             next();
-            args = expr_list(")");
+            call = new AST_NewTarget();
         } else {
-            args = [];
+            var exp = expr_atom(false), args;
+            if (is("punc", "(")) {
+                next();
+                args = expr_list(")", !options.strict);
+            } else {
+                args = [];
+            }
+            call = new AST_New({ expression: exp, args: args });
         }
-        return subscripts(new AST_New({
-            start      : start,
-            expression : newexp,
-            args       : args,
-            end        : prev()
-        }), true);
+        call.start = start;
+        call.end = prev();
+        return subscripts(call, allow_calls);
     };
 
     function as_atom_node() {
-        var tok = S.token, ret;
+        var ret, tok = S.token, value = tok.value;
         switch (tok.type) {
-          case "name":
-          case "keyword":
-            ret = _make_symbol(AST_SymbolRef);
-            break;
           case "num":
-            ret = new AST_Number({ start: tok, end: tok, value: tok.value });
+            if (isFinite(value)) {
+                ret = new AST_Number({ value: value });
+            } else {
+                ret = new AST_Infinity();
+                if (value < 0) ret = new AST_UnaryPrefix({ operator: "-", expression: ret });
+            }
+            break;
+          case "bigint":
+            ret = new AST_BigInt({ value: value });
             break;
           case "string":
-            ret = new AST_String({
-                start : tok,
-                end   : tok,
-                value : tok.value,
-                quote : tok.quote
-            });
+            ret = new AST_String({ value: value, quote: tok.quote });
             break;
           case "regexp":
-            ret = new AST_RegExp({ start: tok, end: tok, value: tok.value });
+            ret = new AST_RegExp({ value: value });
             break;
           case "atom":
-            switch (tok.value) {
+            switch (value) {
               case "false":
-                ret = new AST_False({ start: tok, end: tok });
+                ret = new AST_False();
                 break;
               case "true":
-                ret = new AST_True({ start: tok, end: tok });
+                ret = new AST_True();
                 break;
               case "null":
-                ret = new AST_Null({ start: tok, end: tok });
+                ret = new AST_Null();
                 break;
+              default:
+                unexpected();
             }
             break;
+          default:
+            unexpected();
         }
         next();
+        ret.start = ret.end = tok;
         return ret;
-    };
+    }
 
     var expr_atom = function(allow_calls) {
         if (is("operator", "new")) {
-            return new_();
+            return new_(allow_calls);
         }
         var start = S.token;
         if (is("punc")) {
             switch (start.value) {
+              case "`":
+                return subscripts(template(null), allow_calls);
               case "(":
                 next();
-                var ex = expression(true);
+                if (is("punc", ")")) {
+                    next();
+                    return arrow([], start);
+                }
+                var ex = expression(false, true);
+                var len = start.comments_before.length;
+                [].unshift.apply(ex.start.comments_before, start.comments_before);
+                start.comments_before.length = 0;
+                start.comments_before = ex.start.comments_before;
+                start.comments_before_length = len;
+                if (len == 0 && start.comments_before.length > 0) {
+                    var comment = start.comments_before[0];
+                    if (!comment.nlb) {
+                        comment.nlb = start.nlb;
+                        start.nlb = false;
+                    }
+                }
+                start.comments_after = ex.start.comments_after;
                 ex.start = start;
-                ex.end = S.token;
                 expect(")");
+                var end = prev();
+                end.comments_before = ex.end.comments_before;
+                end.comments_after.forEach(function(comment) {
+                    ex.end.comments_after.push(comment);
+                    if (comment.nlb) S.token.nlb = true;
+                });
+                end.comments_after.length = 0;
+                end.comments_after = ex.end.comments_after;
+                ex.end = end;
+                if (is("punc", "=>")) return arrow(ex instanceof AST_Sequence ? ex.expressions : [ ex ], start);
                 return subscripts(ex, allow_calls);
               case "[":
                 return subscripts(array_(), allow_calls);
@@ -1188,33 +1892,93 @@
             }
             unexpected();
         }
-        if (is("keyword", "function")) {
+        if (is("keyword")) switch (start.value) {
+          case "class":
+            next();
+            var clazz = class_(AST_ClassExpression);
+            clazz.start = start;
+            clazz.end = prev();
+            return subscripts(clazz, allow_calls);
+          case "function":
             next();
-            var func = function_(AST_Function);
+            var func;
+            if (is("operator", "*")) {
+                next();
+                func = function_(AST_GeneratorFunction);
+            } else {
+                func = function_(AST_Function);
+            }
             func.start = start;
             func.end = prev();
             return subscripts(func, allow_calls);
         }
+        if (is("name")) {
+            var sym = _make_symbol(AST_SymbolRef, start);
+            next();
+            if (sym.name == "async") {
+                if (is("keyword", "function")) {
+                    next();
+                    var func;
+                    if (is("operator", "*")) {
+                        next();
+                        func = function_(AST_AsyncGeneratorFunction);
+                    } else {
+                        func = function_(AST_AsyncFunction);
+                    }
+                    func.start = start;
+                    func.end = prev();
+                    return subscripts(func, allow_calls);
+                }
+                if (is("name") && is_token(peek(), "punc", "=>")) {
+                    start = S.token;
+                    sym = _make_symbol(AST_SymbolRef, start);
+                    next();
+                    return arrow([ sym ], start, true);
+                }
+                if (is("punc", "(")) {
+                    var call = subscripts(sym, allow_calls);
+                    if (!is("punc", "=>")) return call;
+                    var args = call.args;
+                    if (args[args.length - 1] instanceof AST_Spread) {
+                        args.rest = args.pop().expression;
+                    }
+                    return arrow(args, start, true);
+                }
+            }
+            return is("punc", "=>") ? arrow([ sym ], start) : subscripts(sym, allow_calls);
+        }
         if (ATOMIC_START_TOKEN[S.token.type]) {
             return subscripts(as_atom_node(), allow_calls);
         }
         unexpected();
     };
 
-    function expr_list(closing, allow_trailing_comma, allow_empty) {
+    function expr_list(closing, allow_trailing_comma, allow_empty, parser) {
+        if (!parser) parser = maybe_assign;
         var first = true, a = [];
         while (!is("punc", closing)) {
             if (first) first = false; else expect(",");
             if (allow_trailing_comma && is("punc", closing)) break;
-            if (is("punc", ",") && allow_empty) {
+            if (allow_empty && is("punc", ",")) {
                 a.push(new AST_Hole({ start: S.token, end: S.token }));
+            } else if (!is("operator", "...")) {
+                a.push(parser());
+            } else if (parser === maybe_assign) {
+                a.push(new AST_Spread({
+                    start: S.token,
+                    expression: (next(), parser()),
+                    end: prev(),
+                }));
             } else {
-                a.push(expression(false));
+                next();
+                a.rest = parser();
+                if (a.rest instanceof AST_DefaultValue) token_error(a.rest.start, "Invalid rest parameter");
+                break;
             }
         }
-        next();
+        expect(closing);
         return a;
-    };
+    }
 
     var array_ = embed_tokens(function() {
         expect("[");
@@ -1223,193 +1987,458 @@
         });
     });
 
+    var create_accessor = embed_tokens(function() {
+        return function_(AST_Accessor);
+    });
+
     var object_ = embed_tokens(function() {
         expect("{");
         var first = true, a = [];
         while (!is("punc", "}")) {
             if (first) first = false; else expect(",");
-            if (!options.strict && is("punc", "}"))
-                // allow trailing comma
-                break;
+            // allow trailing comma
+            if (!options.strict && is("punc", "}")) break;
             var start = S.token;
-            var type = start.type;
-            var name = as_property_name();
-            if (type == "name" && !is("punc", ":")) {
-                if (name == "get") {
-                    a.push(new AST_ObjectGetter({
-                        start : start,
-                        key   : as_atom_node(),
-                        value : function_(AST_Accessor),
-                        end   : prev()
-                    }));
-                    continue;
-                }
-                if (name == "set") {
-                    a.push(new AST_ObjectSetter({
-                        start : start,
-                        key   : as_atom_node(),
-                        value : function_(AST_Accessor),
-                        end   : prev()
-                    }));
-                    continue;
-                }
+            if (is("operator", "*")) {
+                next();
+                var key = as_property_key();
+                var gen_start = S.token;
+                var gen = function_(AST_GeneratorFunction);
+                gen.start = gen_start;
+                gen.end = prev();
+                a.push(new AST_ObjectMethod({
+                    start: start,
+                    key: key,
+                    value: gen,
+                    end: prev(),
+                }));
+                continue;
             }
-            expect(":");
-            a.push(new AST_ObjectKeyVal({
-                start : start,
-                quote : start.quote,
-                key   : name,
-                value : expression(false),
-                end   : prev()
-            }));
+            if (is("operator", "...")) {
+                next();
+                a.push(new AST_Spread({
+                    start: start,
+                    expression: maybe_assign(),
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (is_token(peek(), "operator", "=")) {
+                var name = as_symbol(AST_SymbolRef);
+                next();
+                a.push(new AST_ObjectKeyVal({
+                    start: start,
+                    key: start.value,
+                    value: new AST_Assign({
+                        start: start,
+                        left: name,
+                        operator: "=",
+                        right: maybe_assign(),
+                        end: prev(),
+                    }),
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (is_token(peek(), "punc", ",") || is_token(peek(), "punc", "}")) {
+                a.push(new AST_ObjectKeyVal({
+                    start: start,
+                    key: start.value,
+                    value: as_symbol(AST_SymbolRef),
+                    end: prev(),
+                }));
+                continue;
+            }
+            var key = as_property_key();
+            if (is("punc", "(")) {
+                var func_start = S.token;
+                var func = function_(AST_Function);
+                func.start = func_start;
+                func.end = prev();
+                a.push(new AST_ObjectMethod({
+                    start: start,
+                    key: key,
+                    value: func,
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (is("punc", ":")) {
+                next();
+                a.push(new AST_ObjectKeyVal({
+                    start: start,
+                    key: key,
+                    value: maybe_assign(),
+                    end: prev(),
+                }));
+                continue;
+            }
+            if (start.type == "name") switch (key) {
+              case "async":
+                var is_gen = is("operator", "*") && next();
+                key = as_property_key();
+                var func_start = S.token;
+                var func = function_(is_gen ? AST_AsyncGeneratorFunction : AST_AsyncFunction);
+                func.start = func_start;
+                func.end = prev();
+                a.push(new AST_ObjectMethod({
+                    start: start,
+                    key: key,
+                    value: func,
+                    end: prev(),
+                }));
+                continue;
+              case "get":
+                a.push(new AST_ObjectGetter({
+                    start: start,
+                    key: as_property_key(),
+                    value: create_accessor(),
+                    end: prev(),
+                }));
+                continue;
+              case "set":
+                a.push(new AST_ObjectSetter({
+                    start: start,
+                    key: as_property_key(),
+                    value: create_accessor(),
+                    end: prev(),
+                }));
+                continue;
+            }
+            unexpected();
         }
         next();
         return new AST_Object({ properties: a });
     });
 
-    function as_property_name() {
+    function as_property_key() {
         var tmp = S.token;
-        next();
         switch (tmp.type) {
+          case "operator":
+            if (!KEYWORDS[tmp.value]) unexpected();
           case "num":
           case "string":
           case "name":
-          case "operator":
           case "keyword":
           case "atom":
-            return tmp.value;
+            next();
+            return "" + tmp.value;
+          case "punc":
+            expect("[");
+            var key = maybe_assign();
+            expect("]");
+            return key;
           default:
             unexpected();
         }
-    };
+    }
 
     function as_name() {
-        var tmp = S.token;
-        next();
-        switch (tmp.type) {
-          case "name":
-          case "operator":
-          case "keyword":
-          case "atom":
-            return tmp.value;
-          default:
-            unexpected();
-        }
-    };
-
-    function _make_symbol(type) {
         var name = S.token.value;
-        return new (name == "this" ? AST_This : type)({
-            name  : String(name),
-            start : S.token,
-            end   : S.token
+        expect_token("name");
+        return name;
+    }
+
+    function _make_symbol(type, token) {
+        var name = token.value;
+        switch (name) {
+          case "await":
+            if (S.in_async) unexpected(token);
+            break;
+          case "super":
+            type = AST_Super;
+            break;
+          case "this":
+            type = AST_This;
+            break;
+          case "yield":
+            if (S.in_generator) unexpected(token);
+            break;
+        }
+        return new type({
+            name: "" + name,
+            start: token,
+            end: token,
         });
-    };
+    }
+
+    function strict_verify_symbol(sym) {
+        if (sym.name == "arguments" || sym.name == "eval" || sym.name == "let")
+            token_error(sym.start, "Unexpected " + sym.name + " in strict mode");
+    }
 
-    function as_symbol(type, noerror) {
+    function as_symbol(type, no_error) {
         if (!is("name")) {
-            if (!noerror) croak("Name expected");
+            if (!no_error) croak("Name expected");
             return null;
         }
-        var sym = _make_symbol(type);
+        var sym = _make_symbol(type, S.token);
+        if (S.input.has_directive("use strict") && sym instanceof AST_SymbolDeclaration) {
+            strict_verify_symbol(sym);
+        }
         next();
         return sym;
-    };
+    }
 
-    var subscripts = function(expr, allow_calls) {
-        var start = expr.start;
-        if (is("punc", ".")) {
+    function maybe_destructured(type) {
+        var start = S.token;
+        if (is("punc", "[")) {
             next();
-            return subscripts(new AST_Dot({
-                start      : start,
-                expression : expr,
-                property   : as_name(),
-                end        : prev()
-            }), allow_calls);
+            var elements = expr_list("]", !options.strict, true, function() {
+                return maybe_default(type);
+            });
+            return new AST_DestructuredArray({
+                start: start,
+                elements: elements,
+                rest: elements.rest || null,
+                end: prev(),
+            });
         }
-        if (is("punc", "[")) {
+        if (is("punc", "{")) {
             next();
-            var prop = expression(true);
-            expect("]");
-            return subscripts(new AST_Sub({
-                start      : start,
-                expression : expr,
-                property   : prop,
-                end        : prev()
-            }), allow_calls);
-        }
-        if (allow_calls && is("punc", "(")) {
-            next();
-            return subscripts(new AST_Call({
-                start      : start,
-                expression : expr,
-                args       : expr_list(")"),
-                end        : prev()
-            }), true);
+            var first = true, a = [], rest = null;
+            while (!is("punc", "}")) {
+                if (first) first = false; else expect(",");
+                // allow trailing comma
+                if (!options.strict && is("punc", "}")) break;
+                var key_start = S.token;
+                if (is("punc", "[") || is_token(peek(), "punc", ":")) {
+                    var key = as_property_key();
+                    expect(":");
+                    a.push(new AST_DestructuredKeyVal({
+                        start: key_start,
+                        key: key,
+                        value: maybe_default(type),
+                        end: prev(),
+                    }));
+                    continue;
+                }
+                if (is("operator", "...")) {
+                    next();
+                    rest = maybe_destructured(type);
+                    break;
+                }
+                var name = as_symbol(type);
+                if (is("operator", "=")) {
+                    next();
+                    name = new AST_DefaultValue({
+                        start: name.start,
+                        name: name,
+                        value: maybe_assign(),
+                        end: prev(),
+                    });
+                }
+                a.push(new AST_DestructuredKeyVal({
+                    start: key_start,
+                    key: key_start.value,
+                    value: name,
+                    end: prev(),
+                }));
+            }
+            expect("}");
+            return new AST_DestructuredObject({
+                start: start,
+                properties: a,
+                rest: rest,
+                end: prev(),
+            });
+        }
+        return as_symbol(type);
+    }
+
+    function maybe_default(type) {
+        var start = S.token;
+        var name = maybe_destructured(type);
+        if (!is("operator", "=")) return name;
+        next();
+        return new AST_DefaultValue({
+            start: start,
+            name: name,
+            value: maybe_assign(),
+            end: prev(),
+        });
+    }
+
+    function template(tag) {
+        var start = tag ? tag.start : S.token;
+        var read = S.input.context().read_template;
+        var strings = [];
+        var expressions = [];
+        while (read(strings)) {
+            next();
+            expressions.push(expression());
+            if (!is("punc", "}")) unexpected();
+        }
+        next();
+        return new AST_Template({
+            start: start,
+            expressions: expressions,
+            strings: strings,
+            tag: tag,
+            end: prev(),
+        });
+    }
+
+    function subscripts(expr, allow_calls) {
+        var start = expr.start;
+        var optional = null;
+        while (true) {
+            if (is("operator", "?") && is_token(peek(), "punc", ".")) {
+                next();
+                next();
+                optional = expr;
+            }
+            if (is("punc", "[")) {
+                next();
+                var prop = expression();
+                expect("]");
+                expr = new AST_Sub({
+                    start: start,
+                    optional: optional === expr,
+                    expression: expr,
+                    property: prop,
+                    end: prev(),
+                });
+            } else if (allow_calls && is("punc", "(")) {
+                next();
+                expr = new AST_Call({
+                    start: start,
+                    optional: optional === expr,
+                    expression: expr,
+                    args: expr_list(")", !options.strict),
+                    end: prev(),
+                });
+            } else if (optional === expr || is("punc", ".")) {
+                if (optional !== expr) next();
+                expr = new AST_Dot({
+                    start: start,
+                    optional: optional === expr,
+                    expression: expr,
+                    property: as_name(),
+                    end: prev(),
+                });
+            } else if (is("punc", "`")) {
+                if (optional) croak("Invalid template on optional chain");
+                expr = template(expr);
+            } else {
+                break;
+            }
+        }
+        if (optional) expr.terminal = true;
+        if (expr instanceof AST_Call && !expr.pure) {
+            var start = expr.start;
+            var comments = start.comments_before;
+            var i = HOP(start, "comments_before_length") ? start.comments_before_length : comments.length;
+            while (--i >= 0) {
+                if (/[@#]__PURE__/.test(comments[i].value)) {
+                    expr.pure = true;
+                    break;
+                }
+            }
         }
         return expr;
-    };
+    }
 
-    var maybe_unary = function(allow_calls) {
+    function maybe_unary(no_in) {
         var start = S.token;
-        if (is("operator") && UNARY_PREFIX(start.value)) {
+        if (S.in_async && is("name", "await")) {
+            if (S.in_funarg === S.in_function) croak("Invalid use of await in function argument");
+            S.input.context().regex_allowed = true;
+            next();
+            return new AST_Await({
+                start: start,
+                expression: maybe_unary(no_in),
+                end: prev(),
+            });
+        }
+        if (S.in_generator && is("name", "yield")) {
+            if (S.in_funarg === S.in_function) croak("Invalid use of yield in function argument");
+            S.input.context().regex_allowed = true;
+            next();
+            var exp = null;
+            var nested = false;
+            if (is("operator", "*")) {
+                next();
+                exp = maybe_assign(no_in);
+                nested = true;
+            } else if (is("punc") ? !PUNC_AFTER_EXPRESSION[S.token.value] : !can_insert_semicolon()) {
+                exp = maybe_assign(no_in);
+            }
+            return new AST_Yield({
+                start: start,
+                expression: exp,
+                nested: nested,
+                end: prev(),
+            });
+        }
+        if (is("operator") && UNARY_PREFIX[start.value]) {
             next();
             handle_regexp();
-            var ex = make_unary(AST_UnaryPrefix, start.value, maybe_unary(allow_calls));
+            var ex = make_unary(AST_UnaryPrefix, start, maybe_unary(no_in));
             ex.start = start;
             ex.end = prev();
             return ex;
         }
-        var val = expr_atom(allow_calls);
-        while (is("operator") && UNARY_POSTFIX(S.token.value) && !S.token.nlb) {
-            val = make_unary(AST_UnaryPostfix, S.token.value, val);
+        var val = expr_atom(true);
+        while (is("operator") && UNARY_POSTFIX[S.token.value] && !has_newline_before(S.token)) {
+            val = make_unary(AST_UnaryPostfix, S.token, val);
             val.start = start;
             val.end = S.token;
             next();
         }
         return val;
-    };
+    }
 
-    function make_unary(ctor, op, expr) {
-        if ((op == "++" || op == "--") && !is_assignable(expr))
-            croak("Invalid use of " + op + " operator");
+    function make_unary(ctor, token, expr) {
+        var op = token.value;
+        switch (op) {
+          case "++":
+          case "--":
+            if (!is_assignable(expr))
+                token_error(token, "Invalid use of " + op + " operator");
+            break;
+          case "delete":
+            if (expr instanceof AST_SymbolRef && S.input.has_directive("use strict"))
+                token_error(expr.start, "Calling delete on expression not allowed in strict mode");
+            break;
+        }
         return new ctor({ operator: op, expression: expr });
-    };
+    }
 
-    var expr_op = function(left, min_prec, no_in) {
+    var expr_op = function(left, min_precision, no_in) {
         var op = is("operator") ? S.token.value : null;
         if (op == "in" && no_in) op = null;
-        var prec = op != null ? PRECEDENCE[op] : null;
-        if (prec != null && prec > min_prec) {
+        var precision = op != null ? PRECEDENCE[op] : null;
+        if (precision != null && precision > min_precision) {
             next();
-            var right = expr_op(maybe_unary(true), prec, no_in);
+            var right = expr_op(maybe_unary(no_in), op == "**" ? precision - 1 : precision, no_in);
             return expr_op(new AST_Binary({
                 start    : left.start,
                 left     : left,
                 operator : op,
                 right    : right,
-                end      : right.end
-            }), min_prec, no_in);
+                end      : right.end,
+            }), min_precision, no_in);
         }
         return left;
     };
 
     function expr_ops(no_in) {
-        return expr_op(maybe_unary(true), 0, no_in);
-    };
+        return expr_op(maybe_unary(no_in), 0, no_in);
+    }
 
     var maybe_conditional = function(no_in) {
         var start = S.token;
         var expr = expr_ops(no_in);
         if (is("operator", "?")) {
             next();
-            var yes = expression(false);
+            var yes = maybe_assign();
             expect(":");
             return new AST_Conditional({
                 start       : start,
                 condition   : expr,
                 consequent  : yes,
-                alternative : expression(false, no_in),
+                alternative : maybe_assign(no_in),
                 end         : prev()
             });
         }
@@ -1417,16 +2446,72 @@
     };
 
     function is_assignable(expr) {
-        if (!options.strict) return true;
-        if (expr instanceof AST_This) return false;
-        return (expr instanceof AST_PropAccess || expr instanceof AST_Symbol);
-    };
+        return expr instanceof AST_PropAccess && !expr.optional || expr instanceof AST_SymbolRef;
+    }
+
+    function to_destructured(node) {
+        if (node instanceof AST_Array) {
+            var rest = null;
+            if (node.elements[node.elements.length - 1] instanceof AST_Spread) {
+                rest = to_destructured(node.elements.pop().expression);
+                if (!(rest instanceof AST_Destructured || is_assignable(rest))) return node;
+            }
+            var elements = node.elements.map(to_destructured);
+            return all(elements, function(node) {
+                return node instanceof AST_DefaultValue
+                    || node instanceof AST_Destructured
+                    || node instanceof AST_Hole
+                    || is_assignable(node);
+            }) ? new AST_DestructuredArray({
+                start: node.start,
+                elements: elements,
+                rest: rest,
+                end: node.end,
+            }) : node;
+        }
+        if (node instanceof AST_Assign) {
+            var name = to_destructured(node.left);
+            return name instanceof AST_Destructured || is_assignable(name) ? new AST_DefaultValue({
+                start: node.start,
+                name: name,
+                value: node.right,
+                end: node.end,
+            }) : node;
+        }
+        if (!(node instanceof AST_Object)) return node;
+        var rest = null;
+        if (node.properties[node.properties.length - 1] instanceof AST_Spread) {
+            rest = to_destructured(node.properties.pop().expression);
+            if (!(rest instanceof AST_Destructured || is_assignable(rest))) return node;
+        }
+        var props = [];
+        for (var i = 0; i < node.properties.length; i++) {
+            var prop = node.properties[i];
+            if (!(prop instanceof AST_ObjectKeyVal)) return node;
+            var value = to_destructured(prop.value);
+            if (!(value instanceof AST_DefaultValue || value instanceof AST_Destructured || is_assignable(value))) {
+                return node;
+            }
+            props.push(new AST_DestructuredKeyVal({
+                start: prop.start,
+                key: prop.key,
+                value: value,
+                end: prop.end,
+            }));
+        }
+        return new AST_DestructuredObject({
+            start: node.start,
+            properties: props,
+            rest: rest,
+            end: node.end,
+        });
+    }
 
-    var maybe_assign = function(no_in) {
+    function maybe_assign(no_in) {
         var start = S.token;
         var left = maybe_conditional(no_in), val = S.token.value;
-        if (is("operator") && ASSIGNMENT(val)) {
-            if (is_assignable(left)) {
+        if (is("operator") && ASSIGNMENT[val]) {
+            if (is_assignable(left) || val == "=" && (left = to_destructured(left)) instanceof AST_Destructured) {
                 next();
                 return new AST_Assign({
                     start    : start,
@@ -1439,40 +2524,55 @@
             croak("Invalid assignment");
         }
         return left;
-    };
+    }
 
-    var expression = function(commas, no_in) {
+    function expression(no_in, maybe_arrow) {
         var start = S.token;
-        var expr = maybe_assign(no_in);
-        if (commas && is("punc", ",")) {
+        var exprs = [];
+        while (true) {
+            if (maybe_arrow && is("operator", "...")) {
+                next();
+                exprs.rest = maybe_destructured(AST_SymbolFunarg);
+                break;
+            }
+            exprs.push(maybe_assign(no_in));
+            if (!is("punc", ",")) break;
             next();
-            return new AST_Seq({
-                start  : start,
-                car    : expr,
-                cdr    : expression(true, no_in),
-                end    : peek()
-            });
+            if (maybe_arrow && is("punc", ")") && is_token(peek(), "punc", "=>")) break;
         }
-        return expr;
-    };
+        return exprs.length == 1 && !exprs.rest ? exprs[0] : new AST_Sequence({
+            start: start,
+            expressions: exprs,
+            end: prev(),
+        });
+    }
 
     function in_loop(cont) {
         ++S.in_loop;
         var ret = cont();
         --S.in_loop;
         return ret;
-    };
+    }
 
     if (options.expression) {
-        return expression(true);
+        handle_regexp();
+        var exp = expression();
+        expect_token("eof");
+        return exp;
     }
 
-    return (function(){
+    return function() {
         var start = S.token;
         var body = [];
+        if (options.module) {
+            S.in_async = true;
+            S.input.add_directive("use strict");
+        }
+        S.input.push_directives_stack();
         while (!is("eof"))
-            body.push(statement());
-        var end = prev();
+            body.push(statement(true));
+        S.input.pop_directives_stack();
+        var end = prev() || start;
         var toplevel = options.toplevel;
         if (toplevel) {
             toplevel.body = toplevel.body.concat(body);
@@ -1481,6 +2581,5 @@
             toplevel = new AST_Toplevel({ start: start, body: body, end: end });
         }
         return toplevel;
-    })();
-
-};
+    }();
+}
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/propmangle.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/propmangle.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/propmangle.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,179 +43,286 @@
 
 "use strict";
 
-function find_builtins() {
-    var a = [];
-    [ Object, Array, Function, Number,
-      String, Boolean, Error, Math,
-      Date, RegExp
-    ].forEach(function(ctor){
+function get_builtins() {
+    var names = new Dictionary();
+    // constants
+    [
+        "NaN",
+        "null",
+        "true",
+        "false",
+        "Infinity",
+        "-Infinity",
+        "undefined",
+    ].forEach(add);
+    // global functions
+    [
+        "encodeURI",
+        "encodeURIComponent",
+        "escape",
+        "eval",
+        "decodeURI",
+        "decodeURIComponent",
+        "isFinite",
+        "isNaN",
+        "parseFloat",
+        "parseInt",
+        "unescape",
+    ].forEach(add);
+    // global constructors & objects
+    var global = Function("return this")();
+    [
+        "Array",
+        "ArrayBuffer",
+        "Atomics",
+        "BigInt",
+        "Boolean",
+        "console",
+        "DataView",
+        "Date",
+        "Error",
+        "Function",
+        "Int8Array",
+        "Intl",
+        "JSON",
+        "Map",
+        "Math",
+        "Number",
+        "Object",
+        "Promise",
+        "Proxy",
+        "Reflect",
+        "RegExp",
+        "Set",
+        "String",
+        "Symbol",
+        "WebAssembly",
+    ].forEach(function(name) {
+        add(name);
+        var ctor = global[name];
+        if (!ctor) return;
         Object.getOwnPropertyNames(ctor).map(add);
-        if (ctor.prototype) {
-            Object.getOwnPropertyNames(ctor.prototype).map(add);
+        if (typeof ctor != "function") return;
+        if (ctor.__proto__) Object.getOwnPropertyNames(ctor.__proto__).map(add);
+        if (ctor.prototype) Object.getOwnPropertyNames(ctor.prototype).map(add);
+        try {
+            Object.getOwnPropertyNames(new ctor()).map(add);
+        } catch (e) {
+            try {
+                Object.getOwnPropertyNames(ctor()).map(add);
+            } catch (e) {}
         }
     });
+    return (get_builtins = function() {
+        return names.clone();
+    })();
+
+    function add(name) {
+        names.set(name, true);
+    }
+}
+
+function reserve_quoted_keys(ast, reserved) {
+    ast.walk(new TreeWalker(function(node) {
+        if (node instanceof AST_ClassProperty
+            || node instanceof AST_DestructuredKeyVal
+            || node instanceof AST_ObjectProperty) {
+            if (node.key instanceof AST_Node) {
+                addStrings(node.key, add);
+            } else if (node.start && node.start.quote) {
+                add(node.key);
+            }
+        } else if (node instanceof AST_Dot) {
+            if (node.quoted) add(node.property);
+        } else if (node instanceof AST_Sub) {
+            addStrings(node.property, add);
+        }
+    }));
+
     function add(name) {
-        push_uniq(a, name);
+        push_uniq(reserved, name);
+    }
+}
+
+function addStrings(node, add) {
+    if (node instanceof AST_Conditional) {
+        addStrings(node.consequent, add);
+        addStrings(node.alternative, add);
+    } else if (node instanceof AST_Sequence) {
+        addStrings(node.tail_node(), add);
+    } else if (node instanceof AST_String) {
+        add(node.value);
     }
-    return a;
 }
 
 function mangle_properties(ast, options) {
     options = defaults(options, {
-        reserved : null,
-        cache : null,
-        only_cache : false,
-        regex : null
+        builtins: false,
+        cache: null,
+        debug: false,
+        domprops: false,
+        keep_quoted: false,
+        regex: null,
+        reserved: null,
+    }, true);
+
+    var reserved = options.builtins ? new Dictionary() : get_builtins();
+    if (!options.domprops && typeof domprops !== "undefined") domprops.forEach(function(name) {
+        reserved.set(name, true);
+    });
+    if (Array.isArray(options.reserved)) options.reserved.forEach(function(name) {
+        reserved.set(name, true);
     });
 
-    var reserved = options.reserved;
-    if (reserved == null)
-        reserved = find_builtins();
-
-    var cache = options.cache;
-    if (cache == null) {
-        cache = {
-            cname: -1,
-            props: new Dictionary()
-        };
+    var cname = -1;
+    var cache;
+    if (options.cache) {
+        cache = options.cache.props;
+        cache.each(function(name) {
+            reserved.set(name, true);
+        });
+    } else {
+        cache = new Dictionary();
     }
 
     var regex = options.regex;
 
-    var names_to_mangle = [];
+    // note debug is either false (disabled), or a string of the debug suffix to use (enabled).
+    // note debug may be enabled as an empty string, which is falsy. Also treat passing 'true'
+    // the same as passing an empty string.
+    var debug = options.debug !== false;
+    var debug_suffix;
+    if (debug) debug_suffix = options.debug === true ? "" : options.debug;
+
+    var names_to_mangle = new Dictionary();
+    var unmangleable = reserved.clone();
 
     // step 1: find candidates to mangle
-    ast.walk(new TreeWalker(function(node){
-        if (node instanceof AST_ObjectKeyVal) {
-            add(node.key);
-        }
-        else if (node instanceof AST_ObjectProperty) {
-            // setter or getter, since KeyVal is handled above
-            add(node.key.name);
-        }
-        else if (node instanceof AST_Dot) {
-            if (this.parent() instanceof AST_Assign) {
-                add(node.property);
-            }
-        }
-        else if (node instanceof AST_Sub) {
-            if (this.parent() instanceof AST_Assign) {
-                addStrings(node.property);
+    ast.walk(new TreeWalker(function(node) {
+        if (node.TYPE == "Call") {
+            var exp = node.expression;
+            if (exp instanceof AST_Dot) switch (exp.property) {
+              case "defineProperty":
+              case "getOwnPropertyDescriptor":
+                if (node.args.length < 2) break;
+                exp = exp.expression;
+                if (!(exp instanceof AST_SymbolRef)) break;
+                if (exp.name != "Object") break;
+                if (!exp.definition().undeclared) break;
+                addStrings(node.args[1], add);
+                break;
+              case "hasOwnProperty":
+                if (node.args.length < 1) break;
+                addStrings(node.args[0], add);
+                break;
+            }
+        } else if (node instanceof AST_ClassProperty
+            || node instanceof AST_DestructuredKeyVal
+            || node instanceof AST_ObjectProperty) {
+            if (node.key instanceof AST_Node) {
+                addStrings(node.key, add);
+            } else {
+                add(node.key);
             }
+        } else if (node instanceof AST_Dot) {
+            if (is_lhs(node, this.parent())) add(node.property);
+        } else if (node instanceof AST_Sub) {
+            if (is_lhs(node, this.parent())) addStrings(node.property, add);
         }
     }));
 
-    // step 2: transform the tree, renaming properties
-    return ast.transform(new TreeTransformer(function(node){
-        if (node instanceof AST_ObjectKeyVal) {
-            if (should_mangle(node.key)) {
+    // step 2: renaming properties
+    ast.walk(new TreeWalker(function(node) {
+        if (node instanceof AST_Binary) {
+            if (node.operator == "in") mangleStrings(node.left);
+        } else if (node.TYPE == "Call") {
+            var exp = node.expression;
+            if (exp instanceof AST_Dot) switch (exp.property) {
+              case "defineProperty":
+              case "getOwnPropertyDescriptor":
+                if (node.args.length < 2) break;
+                exp = exp.expression;
+                if (!(exp instanceof AST_SymbolRef)) break;
+                if (exp.name != "Object") break;
+                if (!exp.definition().undeclared) break;
+                mangleStrings(node.args[1]);
+                break;
+              case "hasOwnProperty":
+                if (node.args.length < 1) break;
+                mangleStrings(node.args[0]);
+                break;
+            }
+        } else if (node instanceof AST_ClassProperty
+            || node instanceof AST_DestructuredKeyVal
+            || node instanceof AST_ObjectProperty) {
+            if (node.key instanceof AST_Node) {
+                mangleStrings(node.key);
+            } else {
                 node.key = mangle(node.key);
             }
+        } else if (node instanceof AST_Dot) {
+            node.property = mangle(node.property);
+        } else if (node instanceof AST_Sub) {
+            if (!options.keep_quoted) mangleStrings(node.property);
         }
-        else if (node instanceof AST_ObjectProperty) {
-            // setter or getter
-            if (should_mangle(node.key.name)) {
-                node.key.name = mangle(node.key.name);
-            }
-        }
-        else if (node instanceof AST_Dot) {
-            if (should_mangle(node.property)) {
-                node.property = mangle(node.property);
-            }
-        }
-        else if (node instanceof AST_Sub) {
-            node.property = mangleStrings(node.property);
-        }
-        // else if (node instanceof AST_String) {
-        //     if (should_mangle(node.value)) {
-        //         AST_Node.warn(
-        //             "Found \"{prop}\" property candidate for mangling in an arbitrary string [{file}:{line},{col}]", {
-        //                 file : node.start.file,
-        //                 line : node.start.line,
-        //                 col  : node.start.col,
-        //                 prop : node.value
-        //             }
-        //         );
-        //     }
-        // }
     }));
 
     // only function declarations after this line
 
     function can_mangle(name) {
-        if (reserved.indexOf(name) >= 0) return false;
-        if (options.only_cache) {
-            return cache.props.has(name);
-        }
-        if (/^[0-9.]+$/.test(name)) return false;
+        if (unmangleable.has(name)) return false;
+        if (/^-?[0-9]+(\.[0-9]+)?(e[+-][0-9]+)?$/.test(name)) return false;
         return true;
     }
 
     function should_mangle(name) {
-        if (regex && !regex.test(name)) return false;
-        if (reserved.indexOf(name) >= 0) return false;
-        return cache.props.has(name)
-            || names_to_mangle.indexOf(name) >= 0;
+        if (reserved.has(name)) {
+            AST_Node.info("Preserving reserved property {this}", name);
+            return false;
+        }
+        if (regex && !regex.test(name)) {
+            AST_Node.info("Preserving excluded property {this}", name);
+            return false;
+        }
+        return cache.has(name) || names_to_mangle.has(name);
     }
 
     function add(name) {
-        if (can_mangle(name))
-            push_uniq(names_to_mangle, name);
+        if (can_mangle(name)) names_to_mangle.set(name, true);
+        if (!should_mangle(name)) unmangleable.set(name, true);
     }
 
     function mangle(name) {
-        var mangled = cache.props.get(name);
+        if (!should_mangle(name)) return name;
+        var mangled = cache.get(name);
         if (!mangled) {
-            do {
-                mangled = base54(++cache.cname);
+            if (debug) {
+                // debug mode: use a prefix and suffix to preserve readability, e.g. o.foo ---> o._$foo$NNN_.
+                var debug_mangled = "_$" + name + "$" + debug_suffix + "_";
+                if (can_mangle(debug_mangled)) mangled = debug_mangled;
+            }
+            // either debug mode is off, or it is on and we could not use the mangled name
+            if (!mangled) do {
+                mangled = base54(++cname);
             } while (!can_mangle(mangled));
-            cache.props.set(name, mangled);
+            if (/^#/.test(name)) mangled = "#" + mangled;
+            cache.set(name, mangled);
         }
+        AST_Node.info("Mapping property {name} to {mangled}", {
+            mangled: mangled,
+            name: name,
+        });
         return mangled;
     }
 
-    function addStrings(node) {
-        var out = {};
-        try {
-            (function walk(node){
-                node.walk(new TreeWalker(function(node){
-                    if (node instanceof AST_Seq) {
-                        walk(node.cdr);
-                        return true;
-                    }
-                    if (node instanceof AST_String) {
-                        add(node.value);
-                        return true;
-                    }
-                    if (node instanceof AST_Conditional) {
-                        walk(node.consequent);
-                        walk(node.alternative);
-                        return true;
-                    }
-                    throw out;
-                }));
-            })(node);
-        } catch(ex) {
-            if (ex !== out) throw ex;
-        }
-    }
-
     function mangleStrings(node) {
-        return node.transform(new TreeTransformer(function(node){
-            if (node instanceof AST_Seq) {
-                node.cdr = mangleStrings(node.cdr);
-            }
-            else if (node instanceof AST_String) {
-                if (should_mangle(node.value)) {
-                    node.value = mangle(node.value);
-                }
-            }
-            else if (node instanceof AST_Conditional) {
-                node.consequent = mangleStrings(node.consequent);
-                node.alternative = mangleStrings(node.alternative);
-            }
-            return node;
-        }));
+        if (node instanceof AST_Sequence) {
+            mangleStrings(node.tail_node());
+        } else if (node instanceof AST_String) {
+            node.value = mangle(node.value);
+        } else if (node instanceof AST_Conditional) {
+            mangleStrings(node.consequent);
+            mangleStrings(node.alternative);
+        }
     }
-
 }
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/scope.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/scope.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/scope.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,559 +43,824 @@
 
 "use strict";
 
-function SymbolDef(scope, index, orig) {
+function SymbolDef(id, scope, orig, init) {
+    this._bits = 0;
+    this.defun = undefined;
+    this.eliminated = 0;
+    this.id = id;
+    this.init = init;
+    this.mangled_name = null;
     this.name = orig.name;
     this.orig = [ orig ];
-    this.scope = scope;
     this.references = [];
-    this.global = false;
-    this.mangled_name = null;
-    this.undeclared = false;
-    this.constant = false;
-    this.index = index;
-};
+    this.replaced = 0;
+    this.safe_ids = undefined;
+    this.scope = scope;
+}
 
 SymbolDef.prototype = {
-    unmangleable: function(options) {
-        if (!options) options = {};
-
-        return (this.global && !options.toplevel)
-            || this.undeclared
-            || (!options.eval && (this.scope.uses_eval || this.scope.uses_with))
-            || (options.keep_fnames
-                && (this.orig[0] instanceof AST_SymbolLambda
-                    || this.orig[0] instanceof AST_SymbolDefun));
+    forEach: function(fn) {
+        this.orig.forEach(fn);
+        this.references.forEach(fn);
     },
     mangle: function(options) {
-        var cache = options.cache && options.cache.props;
-        if (this.global && cache && cache.has(this.name)) {
+        if (this.mangled_name) return;
+        var cache = this.global && options.cache && options.cache.props;
+        if (cache && cache.has(this.name)) {
             this.mangled_name = cache.get(this.name);
-        }
-        else if (!this.mangled_name && !this.unmangleable(options)) {
-            var s = this.scope;
-            if (!options.screw_ie8 && this.orig[0] instanceof AST_SymbolLambda)
-                s = s.parent_scope;
-            this.mangled_name = s.next_mangled(options, this);
-            if (this.global && cache) {
-                cache.set(this.name, this.mangled_name);
+        } else if (this.unmangleable(options)) {
+            names_in_use(this.scope, options).set(this.name, true);
+        } else {
+            var def = this.redefined();
+            if (def) {
+                this.mangled_name = def.mangled_name || def.name;
+            } else {
+                this.mangled_name = next_mangled_name(this, options);
             }
+            if (cache) cache.set(this.name, this.mangled_name);
         }
-    }
+    },
+    redefined: function() {
+        var self = this;
+        var scope = self.defun;
+        if (!scope) return;
+        var name = self.name;
+        var def = scope.variables.get(name)
+            || scope instanceof AST_Toplevel && scope.globals.get(name)
+            || self.orig[0] instanceof AST_SymbolConst && find_if(function(def) {
+                return def.name == name;
+            }, scope.enclosed);
+        if (def && def !== self) return def.redefined() || def;
+    },
+    unmangleable: function(options) {
+        if (this.exported) return true;
+        if (this.undeclared) return true;
+        if (!options.eval && this.scope.pinned()) return true;
+        if (options.keep_fargs && is_funarg(this)) return true;
+        if (options.keep_fnames) {
+            var sym = this.orig[0];
+            if (sym instanceof AST_SymbolClass) return true;
+            if (sym instanceof AST_SymbolDefClass) return true;
+            if (sym instanceof AST_SymbolDefun) return true;
+            if (sym instanceof AST_SymbolLambda) return true;
+        }
+        if (!options.toplevel && this.global) return true;
+        return false;
+    },
 };
 
-AST_Toplevel.DEFMETHOD("figure_out_scope", function(options){
+DEF_BITPROPS(SymbolDef, [
+    "const_redefs",
+    "cross_loop",
+    "direct_access",
+    "exported",
+    "global",
+    "undeclared",
+]);
+
+function is_funarg(def) {
+    return def.orig[0] instanceof AST_SymbolFunarg || def.orig[1] instanceof AST_SymbolFunarg;
+}
+
+var unary_side_effects = makePredicate("delete ++ --");
+
+function is_lhs(node, parent) {
+    if (parent instanceof AST_Assign) return parent.left === node && node;
+    if (parent instanceof AST_DefaultValue) return parent.name === node && node;
+    if (parent instanceof AST_Destructured) return node;
+    if (parent instanceof AST_DestructuredKeyVal) return node;
+    if (parent instanceof AST_ForEnumeration) return parent.init === node && node;
+    if (parent instanceof AST_Unary) return unary_side_effects[parent.operator] && parent.expression;
+}
+
+AST_Toplevel.DEFMETHOD("figure_out_scope", function(options) {
     options = defaults(options, {
-        screw_ie8: false,
-        cache: null
+        cache: null,
+        ie: false,
     });
 
     // pass 1: setup scope chaining and handle definitions
     var self = this;
-    var scope = self.parent_scope = null;
     var defun = null;
-    var nesting = 0;
-    var tw = new TreeWalker(function(node, descend){
-        if (options.screw_ie8 && node instanceof AST_Catch) {
-            var save_scope = scope;
-            scope = new AST_Scope(node);
-            scope.init_scope_vars(nesting);
-            scope.parent_scope = save_scope;
+    var exported = false;
+    var next_def_id = 0;
+    var scope = self.parent_scope = null;
+    var tw = new TreeWalker(function(node, descend) {
+        if (node instanceof AST_DefClass) {
+            var save_exported = exported;
+            exported = tw.parent() instanceof AST_ExportDeclaration;
+            node.name.walk(tw);
+            exported = save_exported;
+            walk_scope(function() {
+                if (node.extends) node.extends.walk(tw);
+                node.properties.forEach(function(prop) {
+                    prop.walk(tw);
+                });
+            });
+            return true;
+        }
+        if (node instanceof AST_Definitions) {
+            var save_exported = exported;
+            exported = tw.parent() instanceof AST_ExportDeclaration;
             descend();
-            scope = save_scope;
+            exported = save_exported;
             return true;
         }
-        if (node instanceof AST_Scope) {
-            node.init_scope_vars(nesting);
-            var save_scope = node.parent_scope = scope;
-            var save_defun = defun;
-            defun = scope = node;
-            ++nesting; descend(); --nesting;
-            scope = save_scope;
-            defun = save_defun;
-            return true;        // don't descend again in TreeWalker
+        if (node instanceof AST_LambdaDefinition) {
+            var save_exported = exported;
+            exported = tw.parent() instanceof AST_ExportDeclaration;
+            node.name.walk(tw);
+            exported = save_exported;
+            walk_scope(function() {
+                node.argnames.forEach(function(argname) {
+                    argname.walk(tw);
+                });
+                if (node.rest) node.rest.walk(tw);
+                walk_body(node, tw);
+            });
+            return true;
         }
-        if (node instanceof AST_Directive) {
-            node.scope = scope;
-            push_uniq(scope.directives, node.value);
+        if (node instanceof AST_SwitchBranch) {
+            node.init_vars(scope);
+            descend();
+            return true;
+        }
+        if (node instanceof AST_Try) {
+            walk_scope(function() {
+                walk_body(node, tw);
+            });
+            if (node.bcatch) node.bcatch.walk(tw);
+            if (node.bfinally) node.bfinally.walk(tw);
             return true;
         }
         if (node instanceof AST_With) {
-            for (var s = scope; s; s = s.parent_scope)
+            var s = scope;
+            do {
+                s = s.resolve();
+                if (s.uses_with) break;
                 s.uses_with = true;
-            return;
+            } while (s = s.parent_scope);
+            walk_scope(descend);
+            return true;
+        }
+        if (node instanceof AST_BlockScope) {
+            walk_scope(descend);
+            return true;
         }
         if (node instanceof AST_Symbol) {
             node.scope = scope;
         }
-        if (node instanceof AST_SymbolLambda) {
-            defun.def_function(node);
+        if (node instanceof AST_Label) {
+            node.thedef = node;
+            node.references = [];
+        }
+        if (node instanceof AST_SymbolCatch) {
+            scope.def_variable(node).defun = defun;
+        } else if (node instanceof AST_SymbolConst) {
+            var def = scope.def_variable(node);
+            def.defun = defun;
+            if (exported) def.exported = true;
+        } else if (node instanceof AST_SymbolDefun) {
+            var def = defun.def_function(node, tw.parent());
+            if (exported) def.exported = true;
+        } else if (node instanceof AST_SymbolFunarg) {
+            defun.def_variable(node);
+        } else if (node instanceof AST_SymbolLambda) {
+            var def = defun.def_function(node, node.name == "arguments" ? undefined : defun);
+            if (options.ie && node.name != "arguments") def.defun = defun.parent_scope.resolve();
+        } else if (node instanceof AST_SymbolLet) {
+            var def = scope.def_variable(node);
+            if (exported) def.exported = true;
+        } else if (node instanceof AST_SymbolVar) {
+            var def = defun.def_variable(node, node instanceof AST_SymbolImport ? undefined : null);
+            if (exported) def.exported = true;
         }
-        else if (node instanceof AST_SymbolDefun) {
-            // Careful here, the scope where this should be defined is
-            // the parent scope.  The reason is that we enter a new
-            // scope when we encounter the AST_Defun node (which is
-            // instanceof AST_Scope) but we get to the symbol a bit
-            // later.
-            (node.scope = defun.parent_scope).def_function(node);
-        }
-        else if (node instanceof AST_SymbolVar
-                 || node instanceof AST_SymbolConst) {
-            var def = defun.def_variable(node);
-            def.constant = node instanceof AST_SymbolConst;
-            def.init = tw.parent().value;
-        }
-        else if (node instanceof AST_SymbolCatch) {
-            (options.screw_ie8 ? scope : defun)
-                .def_variable(node);
+
+        function walk_scope(descend) {
+            node.init_vars(scope);
+            var save_defun = defun;
+            var save_scope = scope;
+            if (node instanceof AST_Scope) defun = node;
+            scope = node;
+            descend();
+            scope = save_scope;
+            defun = save_defun;
         }
     });
+    self.make_def = function(orig, init) {
+        return new SymbolDef(++next_def_id, this, orig, init);
+    };
     self.walk(tw);
 
     // pass 2: find back references and eval
-    var func = null;
-    var globals = self.globals = new Dictionary();
-    var tw = new TreeWalker(function(node, descend){
+    self.globals = new Dictionary();
+    var in_arg = [];
+    var tw = new TreeWalker(function(node) {
+        if (node instanceof AST_Catch) {
+            if (!(node.argname instanceof AST_Destructured)) return;
+            in_arg.push(node);
+            node.argname.walk(tw);
+            in_arg.pop();
+            walk_body(node, tw);
+            return true;
+        }
         if (node instanceof AST_Lambda) {
-            var prev_func = func;
-            func = node;
-            descend();
-            func = prev_func;
+            in_arg.push(node);
+            if (node.name) node.name.walk(tw);
+            node.argnames.forEach(function(argname) {
+                argname.walk(tw);
+            });
+            if (node.rest) node.rest.walk(tw);
+            in_arg.pop();
+            walk_lambda(node, tw);
+            return true;
+        }
+        if (node instanceof AST_LoopControl) {
+            if (node.label) node.label.thedef.references.push(node);
+            return true;
+        }
+        if (node instanceof AST_SymbolDeclaration) {
+            var def = node.definition();
+            def.preinit = def.references.length;
+            if (node instanceof AST_SymbolCatch) {
+                // ensure mangling works if `catch` reuses a scope variable
+                var redef = def.redefined();
+                if (redef) for (var s = node.scope; s; s = s.parent_scope) {
+                    if (!push_uniq(s.enclosed, redef)) break;
+                    if (s === redef.scope) break;
+                }
+            } else if (node instanceof AST_SymbolConst) {
+                // ensure compression works if `const` reuses a scope variable
+                var redef = def.redefined();
+                if (redef) redef.const_redefs = true;
+            } else if (def.scope !== node.scope && (node instanceof AST_SymbolDefun
+                || node instanceof AST_SymbolFunarg
+                || node instanceof AST_SymbolVar)) {
+                node.mark_enclosed(options);
+                var redef = node.scope.find_variable(node.name);
+                if (node.thedef !== redef) {
+                    node.thedef = redef;
+                    redef.orig.push(node);
+                    node.mark_enclosed(options);
+                }
+            }
+            if (node.name != "arguments") return true;
+            var parent = node instanceof AST_SymbolVar && tw.parent();
+            if (parent instanceof AST_VarDef && !parent.value) return true;
+            var sym = node.scope.resolve().find_variable("arguments");
+            if (sym && is_arguments(sym)) sym.scope.uses_arguments = 3;
             return true;
         }
         if (node instanceof AST_SymbolRef) {
             var name = node.name;
             var sym = node.scope.find_variable(name);
+            for (var i = in_arg.length; i > 0 && sym;) {
+                i = in_arg.lastIndexOf(sym.scope, i - 1);
+                if (i < 0) break;
+                var decl = sym.orig[0];
+                if (decl instanceof AST_SymbolCatch
+                    || decl instanceof AST_SymbolFunarg
+                    || decl instanceof AST_SymbolLambda) {
+                    node.in_arg = true;
+                    break;
+                }
+                sym = sym.scope.parent_scope.find_variable(name);
+            }
             if (!sym) {
-                var g;
-                if (globals.has(name)) {
-                    g = globals.get(name);
-                } else {
-                    g = new SymbolDef(self, globals.size(), node);
-                    g.undeclared = true;
-                    g.global = true;
-                    globals.set(name, g);
+                sym = self.def_global(node);
+            } else if (name == "arguments" && is_arguments(sym)) {
+                var parent = tw.parent();
+                if (is_lhs(node, parent)) {
+                    sym.scope.uses_arguments = 3;
+                } else if (sym.scope.uses_arguments < 2
+                    && !(parent instanceof AST_PropAccess && parent.expression === node)) {
+                    sym.scope.uses_arguments = 2;
+                } else if (!sym.scope.uses_arguments) {
+                    sym.scope.uses_arguments = true;
                 }
-                node.thedef = g;
-                if (name == "eval" && tw.parent() instanceof AST_Call) {
-                    for (var s = node.scope; s && !s.uses_eval; s = s.parent_scope)
+            }
+            if (name == "eval") {
+                var parent = tw.parent();
+                if (parent.TYPE == "Call" && parent.expression === node) {
+                    var s = node.scope;
+                    do {
+                        s = s.resolve();
+                        if (s.uses_eval) break;
                         s.uses_eval = true;
+                    } while (s = s.parent_scope);
+                } else if (sym.undeclared) {
+                    self.uses_eval = true;
                 }
-                if (func && name == "arguments") {
-                    func.uses_arguments = true;
-                }
-            } else {
-                node.thedef = sym;
             }
-            node.reference();
+            if (sym.init instanceof AST_LambdaDefinition && sym.scope !== sym.init.name.scope) {
+                var scope = node.scope;
+                do {
+                    if (scope === sym.init.name.scope) break;
+                } while (scope = scope.parent_scope);
+                if (!scope) sym.init = undefined;
+            }
+            node.thedef = sym;
+            node.reference(options);
             return true;
         }
     });
     self.walk(tw);
 
-    if (options.cache) {
-        this.cname = options.cache.cname;
+    // pass 3: fix up any scoping issue with IE8
+    if (options.ie) self.walk(new TreeWalker(function(node) {
+        if (node instanceof AST_SymbolCatch) {
+            var def = node.thedef;
+            var scope = def.defun;
+            if (def.name != "arguments" && scope.name instanceof AST_SymbolLambda && scope.name.name == def.name) {
+                scope = scope.parent_scope.resolve();
+            }
+            redefine(node, scope);
+            return true;
+        }
+        if (node instanceof AST_SymbolLambda) {
+            var def = node.thedef;
+            if (!redefine(node, node.scope.parent_scope.resolve())) {
+                def.defun = undefined;
+            } else if (typeof node.thedef.init !== "undefined") {
+                node.thedef.init = false;
+            } else if (def.init) {
+                node.thedef.init = def.init;
+            }
+            return true;
+        }
+    }));
+
+    function is_arguments(sym) {
+        return sym.orig[0] instanceof AST_SymbolFunarg
+            && !(sym.orig[1] instanceof AST_SymbolFunarg || sym.orig[2] instanceof AST_SymbolFunarg)
+            && !is_arrow(sym.scope);
     }
-});
 
-AST_Scope.DEFMETHOD("init_scope_vars", function(nesting){
-    this.directives = [];     // contains the directives defined in this scope, i.e. "use strict"
-    this.variables = new Dictionary(); // map name to AST_SymbolVar (variables defined in this scope; includes functions)
-    this.functions = new Dictionary(); // map name to AST_SymbolDefun (functions defined in this scope)
-    this.uses_with = false;   // will be set to true if this or some nested scope uses the `with` statement
-    this.uses_eval = false;   // will be set to true if this or nested scope uses the global `eval`
-    this.parent_scope = null; // the parent scope
-    this.enclosed = [];       // a list of variables from this or outer scope(s) that are referenced from this or inner scopes
-    this.cname = -1;          // the current index for mangling functions/variables
-    this.nesting = nesting;   // the nesting level of this scope (0 means toplevel)
+    function redefine(node, scope) {
+        var name = node.name;
+        var old_def = node.thedef;
+        if (!all(old_def.orig, function(sym) {
+            return !(sym instanceof AST_SymbolConst || sym instanceof AST_SymbolLet);
+        })) return false;
+        var new_def = scope.find_variable(name);
+        if (new_def) {
+            var redef = new_def.redefined();
+            if (redef) new_def = redef;
+        } else {
+            new_def = self.globals.get(name);
+        }
+        if (new_def) {
+            new_def.orig.push(node);
+        } else {
+            new_def = scope.def_variable(node);
+        }
+        if (new_def.undeclared) self.variables.set(name, new_def);
+        if (name == "arguments" && is_arguments(old_def) && node instanceof AST_SymbolLambda) return true;
+        old_def.defun = new_def.scope;
+        old_def.forEach(function(node) {
+            node.redef = old_def;
+            node.thedef = new_def;
+            node.reference(options);
+        });
+        return true;
+    }
 });
 
-AST_Scope.DEFMETHOD("strict", function(){
-    return this.has_directive("use strict");
+AST_Toplevel.DEFMETHOD("def_global", function(node) {
+    var globals = this.globals, name = node.name;
+    if (globals.has(name)) {
+        return globals.get(name);
+    } else {
+        var g = this.make_def(node);
+        g.undeclared = true;
+        g.global = true;
+        globals.set(name, g);
+        return g;
+    }
 });
 
-AST_Lambda.DEFMETHOD("init_scope_vars", function(){
-    AST_Scope.prototype.init_scope_vars.apply(this, arguments);
+function init_block_vars(scope, parent) {
+    scope.enclosed = [];                            // variables from this or outer scope(s) that are referenced from this or inner scopes
+    scope.parent_scope = parent;                    // the parent scope (null if this is the top level)
+    scope.functions = new Dictionary();             // map name to AST_SymbolDefun (functions defined in this scope)
+    scope.variables = new Dictionary();             // map name to AST_SymbolVar (variables defined in this scope; includes functions)
+    if (parent) scope.make_def = parent.make_def;   // top-level tracking of SymbolDef instances
+}
+
+function init_scope_vars(scope, parent) {
+    init_block_vars(scope, parent);
+    scope.uses_eval = false;                        // will be set to true if this or nested scope uses the global `eval`
+    scope.uses_with = false;                        // will be set to true if this or some nested scope uses the `with` statement
+}
+
+AST_BlockScope.DEFMETHOD("init_vars", function(parent_scope) {
+    init_block_vars(this, parent_scope);
+});
+AST_Scope.DEFMETHOD("init_vars", function(parent_scope) {
+    init_scope_vars(this, parent_scope);
+});
+AST_Arrow.DEFMETHOD("init_vars", function(parent_scope) {
+    init_scope_vars(this, parent_scope);
+    return this;
+});
+AST_AsyncArrow.DEFMETHOD("init_vars", function(parent_scope) {
+    init_scope_vars(this, parent_scope);
+});
+AST_Lambda.DEFMETHOD("init_vars", function(parent_scope) {
+    init_scope_vars(this, parent_scope);
     this.uses_arguments = false;
+    this.def_variable(new AST_SymbolFunarg({
+        name: "arguments",
+        scope: this,
+        start: this.start,
+        end: this.end,
+    }));
+    return this;
 });
 
-AST_SymbolRef.DEFMETHOD("reference", function() {
+AST_Symbol.DEFMETHOD("mark_enclosed", function(options) {
     var def = this.definition();
-    def.references.push(this);
-    var s = this.scope;
-    while (s) {
-        push_uniq(s.enclosed, def);
+    for (var s = this.scope; s; s = s.parent_scope) {
+        if (!push_uniq(s.enclosed, def)) break;
+        if (!options) {
+            s._var_names = undefined;
+        } else {
+            if (options.keep_fargs && s instanceof AST_Lambda) s.each_argname(function(arg) {
+                push_uniq(def.scope.enclosed, arg.definition());
+            });
+            if (options.keep_fnames) s.functions.each(function(d) {
+                push_uniq(def.scope.enclosed, d);
+            });
+        }
         if (s === def.scope) break;
-        s = s.parent_scope;
     }
-    this.frame = this.scope.nesting - def.scope.nesting;
 });
 
-AST_Scope.DEFMETHOD("find_variable", function(name){
-    if (name instanceof AST_Symbol) name = name.name;
-    return this.variables.get(name)
-        || (this.parent_scope && this.parent_scope.find_variable(name));
+AST_Symbol.DEFMETHOD("reference", function(options) {
+    this.definition().references.push(this);
+    this.mark_enclosed(options);
 });
 
-AST_Scope.DEFMETHOD("has_directive", function(value){
-    return this.parent_scope && this.parent_scope.has_directive(value)
-        || (this.directives.indexOf(value) >= 0 ? this : null);
+AST_BlockScope.DEFMETHOD("find_variable", function(name) {
+    return this.variables.get(name)
+        || this.parent_scope && this.parent_scope.find_variable(name);
 });
 
-AST_Scope.DEFMETHOD("def_function", function(symbol){
-    this.functions.set(symbol.name, this.def_variable(symbol));
+AST_BlockScope.DEFMETHOD("def_function", function(symbol, init) {
+    var def = this.def_variable(symbol, init);
+    if (!def.init || def.init instanceof AST_LambdaDefinition) def.init = init;
+    this.functions.set(symbol.name, def);
+    return def;
 });
 
-AST_Scope.DEFMETHOD("def_variable", function(symbol){
-    var def;
-    if (!this.variables.has(symbol.name)) {
-        def = new SymbolDef(this, this.variables.size(), symbol);
+AST_BlockScope.DEFMETHOD("def_variable", function(symbol, init) {
+    var def = this.variables.get(symbol.name);
+    if (def) {
+        def.orig.push(symbol);
+        if (def.init instanceof AST_LambdaExpression) def.init = init;
+    } else {
+        def = this.make_def(symbol, init);
         this.variables.set(symbol.name, def);
         def.global = !this.parent_scope;
-    } else {
-        def = this.variables.get(symbol.name);
-        def.orig.push(symbol);
     }
     return symbol.thedef = def;
 });
 
-AST_Scope.DEFMETHOD("next_mangled", function(options){
-    var ext = this.enclosed;
-    out: while (true) {
-        var m = base54(++this.cname);
-        if (!is_identifier(m)) continue; // skip over "do"
-
-        // https://github.com/mishoo/UglifyJS2/issues/242 -- do not
-        // shadow a name excepted from mangling.
-        if (options.except.indexOf(m) >= 0) continue;
-
-        // we must ensure that the mangled name does not shadow a name
-        // from some parent scope that is referenced in this or in
-        // inner scopes.
-        for (var i = ext.length; --i >= 0;) {
-            var sym = ext[i];
-            var name = sym.mangled_name || (sym.unmangleable(options) && sym.name);
-            if (m == name) continue out;
-        }
-        return m;
+function names_in_use(scope, options) {
+    var names = scope.names_in_use;
+    if (!names) {
+        scope.cname = -1;
+        scope.cname_holes = [];
+        scope.names_in_use = names = new Dictionary();
+        var cache = options.cache && options.cache.props;
+        scope.enclosed.forEach(function(def) {
+            if (def.unmangleable(options)) names.set(def.name, true);
+            if (def.global && cache && cache.has(def.name)) {
+                names.set(cache.get(def.name), true);
+            }
+        });
     }
-});
+    return names;
+}
 
-AST_Function.DEFMETHOD("next_mangled", function(options, def){
-    // #179, #326
-    // in Safari strict mode, something like (function x(x){...}) is a syntax error;
-    // a function expression's argument cannot shadow the function expression's name
-
-    var tricky_def = def.orig[0] instanceof AST_SymbolFunarg && this.name && this.name.definition();
+function next_mangled_name(def, options) {
+    var scope = def.scope;
+    var in_use = names_in_use(scope, options);
+    var holes = scope.cname_holes;
+    var names = new Dictionary();
+    var scopes = [ scope ];
+    def.forEach(function(sym) {
+        var scope = sym.scope;
+        do {
+            if (member(scope, scopes)) break;
+            names_in_use(scope, options).each(function(marker, name) {
+                names.set(name, marker);
+            });
+            scopes.push(scope);
+        } while (scope = scope.parent_scope);
+    });
+    var name;
+    for (var i = 0; i < holes.length; i++) {
+        name = base54(holes[i]);
+        if (names.has(name)) continue;
+        holes.splice(i, 1);
+        in_use.set(name, true);
+        return name;
+    }
     while (true) {
-        var name = AST_Lambda.prototype.next_mangled.call(this, options, def);
-        if (!(tricky_def && tricky_def.mangled_name == name))
-            return name;
+        name = base54(++scope.cname);
+        if (in_use.has(name) || RESERVED_WORDS[name] || options.reserved.has[name]) continue;
+        if (!names.has(name)) break;
+        holes.push(scope.cname);
     }
-});
+    in_use.set(name, true);
+    return name;
+}
 
-AST_Scope.DEFMETHOD("references", function(sym){
-    if (sym instanceof AST_Symbol) sym = sym.definition();
-    return this.enclosed.indexOf(sym) < 0 ? null : sym;
-});
-
-AST_Symbol.DEFMETHOD("unmangleable", function(options){
-    return this.definition().unmangleable(options);
-});
-
-// property accessors are not mangleable
-AST_SymbolAccessor.DEFMETHOD("unmangleable", function(){
-    return true;
+AST_Symbol.DEFMETHOD("unmangleable", function(options) {
+    var def = this.definition();
+    return !def || def.unmangleable(options);
 });
 
 // labels are always mangleable
-AST_Label.DEFMETHOD("unmangleable", function(){
-    return false;
-});
+AST_Label.DEFMETHOD("unmangleable", return_false);
 
-AST_Symbol.DEFMETHOD("unreferenced", function(){
-    return this.definition().references.length == 0
-        && !(this.scope.uses_eval || this.scope.uses_with);
-});
-
-AST_Symbol.DEFMETHOD("undeclared", function(){
-    return this.definition().undeclared;
-});
-
-AST_LabelRef.DEFMETHOD("undeclared", function(){
-    return false;
-});
-
-AST_Label.DEFMETHOD("undeclared", function(){
-    return false;
-});
-
-AST_Symbol.DEFMETHOD("definition", function(){
+AST_Symbol.DEFMETHOD("definition", function() {
     return this.thedef;
 });
 
-AST_Symbol.DEFMETHOD("global", function(){
-    return this.definition().global;
-});
-
-AST_Toplevel.DEFMETHOD("_default_mangler_options", function(options){
-    return defaults(options, {
-        except      : [],
+function _default_mangler_options(options) {
+    options = defaults(options, {
         eval        : false,
-        sort        : false,
+        ie          : false,
+        keep_fargs  : false,
+        keep_fnames : false,
+        reserved    : [],
         toplevel    : false,
-        screw_ie8   : false,
-        keep_fnames : false
+        v8          : false,
+        webkit      : false,
     });
-});
-
-AST_Toplevel.DEFMETHOD("mangle_names", function(options){
-    options = this._default_mangler_options(options);
-    // We only need to mangle declaration nodes.  Special logic wired
-    // into the code generator will display the mangled name if it's
-    // present (and for AST_SymbolRef-s it'll use the mangled name of
-    // the AST_SymbolDeclaration that it points to).
-    var lname = -1;
-    var to_mangle = [];
-
-    if (options.cache) {
-        this.globals.each(function(symbol){
-            if (options.except.indexOf(symbol.name) < 0) {
-                to_mangle.push(symbol);
-            }
+    if (!Array.isArray(options.reserved)) options.reserved = [];
+    // Never mangle `arguments`
+    push_uniq(options.reserved, "arguments");
+    options.reserved.has = makePredicate(options.reserved);
+    return options;
+}
+
+// We only need to mangle declaration nodes. Special logic wired into the code
+// generator will display the mangled name if it is present (and for
+// `AST_SymbolRef`s it will use the mangled name of the `AST_SymbolDeclaration`
+// that it points to).
+AST_Toplevel.DEFMETHOD("mangle_names", function(options) {
+    options = _default_mangler_options(options);
+    if (options.cache && options.cache.props) {
+        var mangled_names = names_in_use(this, options);
+        options.cache.props.each(function(mangled_name) {
+            mangled_names.set(mangled_name, true);
         });
     }
-
-    var tw = new TreeWalker(function(node, descend){
-        if (node instanceof AST_LabeledStatement) {
-            // lname is incremented when we get to the AST_Label
-            var save_nesting = lname;
-            descend();
-            lname = save_nesting;
-            return true;        // don't descend again in TreeWalker
-        }
-        if (node instanceof AST_Scope) {
-            var p = tw.parent(), a = [];
-            node.variables.each(function(symbol){
-                if (options.except.indexOf(symbol.name) < 0) {
-                    a.push(symbol);
-                }
-            });
-            if (options.sort) a.sort(function(a, b){
-                return b.references.length - a.references.length;
+    var cutoff = 36;
+    var lname = -1;
+    var redefined = [];
+    var tw = new TreeWalker(function(node, descend) {
+        var save_nesting;
+        if (node instanceof AST_BlockScope) {
+            // `lname` is incremented when we get to the `AST_Label`
+            if (node instanceof AST_LabeledStatement) save_nesting = lname;
+            if (options.webkit && node instanceof AST_IterationStatement && node.init instanceof AST_Let) {
+                node.init.definitions.forEach(function(defn) {
+                    defn.name.match_symbol(function(sym) {
+                        if (!(sym instanceof AST_SymbolLet)) return;
+                        var def = sym.definition();
+                        var scope = sym.scope.parent_scope;
+                        var redef = scope.def_variable(sym);
+                        sym.thedef = def;
+                        scope.to_mangle.push(redef);
+                        def.redefined = function() {
+                            return redef;
+                        };
+                    });
+                }, true);
+            }
+            var to_mangle = node.to_mangle = [];
+            node.variables.each(function(def) {
+                if (!defer_redef(def)) to_mangle.push(def);
             });
-            to_mangle.push.apply(to_mangle, a);
-            return;
+            descend();
+            if (options.cache && node instanceof AST_Toplevel) {
+                node.globals.each(mangle);
+            }
+            if (node instanceof AST_Defun && tw.has_directive("use asm")) {
+                var sym = new AST_SymbolRef(node.name);
+                sym.scope = node;
+                sym.reference(options);
+            }
+            if (to_mangle.length > cutoff) {
+                var indices = to_mangle.map(function(def, index) {
+                    return index;
+                }).sort(function(i, j) {
+                    return to_mangle[j].references.length - to_mangle[i].references.length || i - j;
+                });
+                to_mangle = indices.slice(0, cutoff).sort(function(i, j) {
+                    return i - j;
+                }).map(function(index) {
+                    return to_mangle[index];
+                }).concat(indices.slice(cutoff).sort(function(i, j) {
+                    return i - j;
+                }).map(function(index) {
+                    return to_mangle[index];
+                }));
+            }
+            to_mangle.forEach(mangle);
+            if (node instanceof AST_LabeledStatement && !(options.v8 && in_label(tw))) lname = save_nesting;
+            return true;
         }
         if (node instanceof AST_Label) {
             var name;
-            do name = base54(++lname); while (!is_identifier(name));
+            do {
+                name = base54(++lname);
+            } while (RESERVED_WORDS[name]);
             node.mangled_name = name;
             return true;
         }
-        if (options.screw_ie8 && node instanceof AST_SymbolCatch) {
-            to_mangle.push(node.definition());
-            return;
-        }
     });
     this.walk(tw);
-    to_mangle.forEach(function(def){ def.mangle(options) });
+    redefined.forEach(mangle);
+
+    function mangle(def) {
+        if (options.reserved.has[def.name]) return;
+        def.mangle(options);
+    }
+
+    function defer_redef(def) {
+        var sym = def.orig[0];
+        var redef = def.redefined();
+        if (!redef) {
+            if (!(sym instanceof AST_SymbolConst)) return false;
+            var scope = def.scope.resolve();
+            if (def.scope === scope) return false;
+            if (def.scope.parent_scope.find_variable(sym.name)) return false;
+            redef = scope.def_variable(sym);
+            scope.to_mangle.push(redef);
+        }
+        redefined.push(def);
+        def.references.forEach(reference);
+        if (sym instanceof AST_SymbolCatch || sym instanceof AST_SymbolConst) {
+            reference(sym);
+            def.redefined = function() {
+                return redef;
+            };
+        }
+        return true;
+
+        function reference(sym) {
+            sym.thedef = redef;
+            sym.reference(options);
+            sym.thedef = def;
+        }
+    }
 
-    if (options.cache) {
-        options.cache.cname = this.cname;
+    function in_label(tw) {
+        var level = 0, parent;
+        while (parent = tw.parent(level++)) {
+            if (parent instanceof AST_Block) return parent instanceof AST_Toplevel && !options.toplevel;
+            if (parent instanceof AST_LabeledStatement) return true;
+        }
     }
 });
 
-AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options){
-    options = this._default_mangler_options(options);
-    var tw = new TreeWalker(function(node){
-        if (node instanceof AST_Constant)
-            base54.consider(node.print_to_string());
-        else if (node instanceof AST_Return)
-            base54.consider("return");
-        else if (node instanceof AST_Throw)
-            base54.consider("throw");
-        else if (node instanceof AST_Continue)
-            base54.consider("continue");
-        else if (node instanceof AST_Break)
-            base54.consider("break");
-        else if (node instanceof AST_Debugger)
-            base54.consider("debugger");
-        else if (node instanceof AST_Directive)
-            base54.consider(node.value);
-        else if (node instanceof AST_While)
-            base54.consider("while");
-        else if (node instanceof AST_Do)
-            base54.consider("do while");
-        else if (node instanceof AST_If) {
-            base54.consider("if");
-            if (node.alternative) base54.consider("else");
-        }
-        else if (node instanceof AST_Var)
-            base54.consider("var");
-        else if (node instanceof AST_Const)
-            base54.consider("const");
-        else if (node instanceof AST_Lambda)
-            base54.consider("function");
-        else if (node instanceof AST_For)
-            base54.consider("for");
-        else if (node instanceof AST_ForIn)
-            base54.consider("for in");
-        else if (node instanceof AST_Switch)
-            base54.consider("switch");
-        else if (node instanceof AST_Case)
-            base54.consider("case");
-        else if (node instanceof AST_Default)
-            base54.consider("default");
-        else if (node instanceof AST_With)
-            base54.consider("with");
-        else if (node instanceof AST_ObjectSetter)
-            base54.consider("set" + node.key);
-        else if (node instanceof AST_ObjectGetter)
-            base54.consider("get" + node.key);
-        else if (node instanceof AST_ObjectKeyVal)
-            base54.consider(node.key);
-        else if (node instanceof AST_New)
-            base54.consider("new");
-        else if (node instanceof AST_This)
-            base54.consider("this");
-        else if (node instanceof AST_Try)
-            base54.consider("try");
-        else if (node instanceof AST_Catch)
-            base54.consider("catch");
-        else if (node instanceof AST_Finally)
-            base54.consider("finally");
-        else if (node instanceof AST_Symbol && node.unmangleable(options))
-            base54.consider(node.name);
-        else if (node instanceof AST_Unary || node instanceof AST_Binary)
-            base54.consider(node.operator);
-        else if (node instanceof AST_Dot)
-            base54.consider(node.property);
-    });
-    this.walk(tw);
+AST_Toplevel.DEFMETHOD("find_colliding_names", function(options) {
+    var cache = options.cache && options.cache.props;
+    var avoid = Object.create(RESERVED_WORDS);
+    options.reserved.forEach(to_avoid);
+    this.globals.each(add_def);
+    this.walk(new TreeWalker(function(node) {
+        if (node instanceof AST_BlockScope) node.variables.each(add_def);
+    }));
+    return avoid;
+
+    function to_avoid(name) {
+        avoid[name] = true;
+    }
+
+    function add_def(def) {
+        var name = def.name;
+        if (def.global && cache && cache.has(name)) name = cache.get(name);
+        else if (!def.unmangleable(options)) return;
+        to_avoid(name);
+    }
+});
+
+AST_Toplevel.DEFMETHOD("expand_names", function(options) {
+    base54.reset();
+    base54.sort();
+    options = _default_mangler_options(options);
+    var avoid = this.find_colliding_names(options);
+    var cname = 0;
+    this.globals.each(rename);
+    this.walk(new TreeWalker(function(node) {
+        if (node instanceof AST_BlockScope) node.variables.each(rename);
+    }));
+
+    function next_name() {
+        var name;
+        do {
+            name = base54(cname++);
+        } while (avoid[name]);
+        return name;
+    }
+
+    function rename(def) {
+        if (def.global && options.cache) return;
+        if (def.unmangleable(options)) return;
+        if (options.reserved.has[def.name]) return;
+        var redef = def.redefined();
+        var name = redef ? redef.rename || redef.name : next_name();
+        def.rename = name;
+        def.forEach(function(sym) {
+            if (sym.definition() === def) sym.name = name;
+        });
+    }
+});
+
+AST_Node.DEFMETHOD("tail_node", return_this);
+AST_Sequence.DEFMETHOD("tail_node", function() {
+    return this.expressions[this.expressions.length - 1];
+});
+
+AST_Toplevel.DEFMETHOD("compute_char_frequency", function(options) {
+    options = _default_mangler_options(options);
+    base54.reset();
+    var fn = AST_Symbol.prototype.add_source_map;
+    try {
+        AST_Symbol.prototype.add_source_map = function() {
+            if (!this.unmangleable(options)) base54.consider(this.name, -1);
+        };
+        if (options.properties) {
+            AST_Dot.prototype.add_source_map = function() {
+                base54.consider(this.property, -1);
+            };
+            AST_Sub.prototype.add_source_map = function() {
+                skip_string(this.property);
+            };
+        }
+        base54.consider(this.print_to_string(), 1);
+    } finally {
+        AST_Symbol.prototype.add_source_map = fn;
+        delete AST_Dot.prototype.add_source_map;
+        delete AST_Sub.prototype.add_source_map;
+    }
     base54.sort();
+
+    function skip_string(node) {
+        if (node instanceof AST_String) {
+            base54.consider(node.value, -1);
+        } else if (node instanceof AST_Conditional) {
+            skip_string(node.consequent);
+            skip_string(node.alternative);
+        } else if (node instanceof AST_Sequence) {
+            skip_string(node.tail_node());
+        }
+    }
 });
 
 var base54 = (function() {
-    var string = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_0123456789";
+    var freq = Object.create(null);
+    function init(chars) {
+        var array = [];
+        for (var i = 0; i < chars.length; i++) {
+            var ch = chars[i];
+            array.push(ch);
+            freq[ch] = -1e-2 * i;
+        }
+        return array;
+    }
+    var digits = init("0123456789");
+    var leading = init("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ$_");
     var chars, frequency;
     function reset() {
-        frequency = Object.create(null);
-        chars = string.split("").map(function(ch){ return ch.charCodeAt(0) });
-        chars.forEach(function(ch){ frequency[ch] = 0 });
+        chars = null;
+        frequency = Object.create(freq);
     }
-    base54.consider = function(str){
+    base54.consider = function(str, delta) {
         for (var i = str.length; --i >= 0;) {
-            var code = str.charCodeAt(i);
-            if (code in frequency) ++frequency[code];
+            frequency[str[i]] += delta;
         }
     };
+    function compare(a, b) {
+        return frequency[b] - frequency[a];
+    }
     base54.sort = function() {
-        chars = mergeSort(chars, function(a, b){
-            if (is_digit(a) && !is_digit(b)) return 1;
-            if (is_digit(b) && !is_digit(a)) return -1;
-            return frequency[b] - frequency[a];
-        });
+        chars = leading.sort(compare).concat(digits).sort(compare);
     };
     base54.reset = reset;
     reset();
-    base54.get = function(){ return chars };
-    base54.freq = function(){ return frequency };
     function base54(num) {
-        var ret = "", base = 54;
-        num++;
-        do {
-            num--;
-            ret += String.fromCharCode(chars[num % base]);
-            num = Math.floor(num / base);
-            base = 64;
-        } while (num > 0);
+        var ret = leading[num % 54];
+        for (num = Math.floor(num / 54); --num >= 0; num >>= 6) {
+            ret += chars[num & 0x3F];
+        }
         return ret;
-    };
+    }
     return base54;
 })();
-
-AST_Toplevel.DEFMETHOD("scope_warnings", function(options){
-    options = defaults(options, {
-        undeclared       : false, // this makes a lot of noise
-        unreferenced     : true,
-        assign_to_global : true,
-        func_arguments   : true,
-        nested_defuns    : true,
-        eval             : true
-    });
-    var tw = new TreeWalker(function(node){
-        if (options.undeclared
-            && node instanceof AST_SymbolRef
-            && node.undeclared())
-        {
-            // XXX: this also warns about JS standard names,
-            // i.e. Object, Array, parseInt etc.  Should add a list of
-            // exceptions.
-            AST_Node.warn("Undeclared symbol: {name} [{file}:{line},{col}]", {
-                name: node.name,
-                file: node.start.file,
-                line: node.start.line,
-                col: node.start.col
-            });
-        }
-        if (options.assign_to_global)
-        {
-            var sym = null;
-            if (node instanceof AST_Assign && node.left instanceof AST_SymbolRef)
-                sym = node.left;
-            else if (node instanceof AST_ForIn && node.init instanceof AST_SymbolRef)
-                sym = node.init;
-            if (sym
-                && (sym.undeclared()
-                    || (sym.global() && sym.scope !== sym.definition().scope))) {
-                AST_Node.warn("{msg}: {name} [{file}:{line},{col}]", {
-                    msg: sym.undeclared() ? "Accidental global?" : "Assignment to global",
-                    name: sym.name,
-                    file: sym.start.file,
-                    line: sym.start.line,
-                    col: sym.start.col
-                });
-            }
-        }
-        if (options.eval
-            && node instanceof AST_SymbolRef
-            && node.undeclared()
-            && node.name == "eval") {
-            AST_Node.warn("Eval is used [{file}:{line},{col}]", node.start);
-        }
-        if (options.unreferenced
-            && (node instanceof AST_SymbolDeclaration || node instanceof AST_Label)
-            && !(node instanceof AST_SymbolCatch)
-            && node.unreferenced()) {
-            AST_Node.warn("{type} {name} is declared but not referenced [{file}:{line},{col}]", {
-                type: node instanceof AST_Label ? "Label" : "Symbol",
-                name: node.name,
-                file: node.start.file,
-                line: node.start.line,
-                col: node.start.col
-            });
-        }
-        if (options.func_arguments
-            && node instanceof AST_Lambda
-            && node.uses_arguments) {
-            AST_Node.warn("arguments used in function {name} [{file}:{line},{col}]", {
-                name: node.name ? node.name.name : "anonymous",
-                file: node.start.file,
-                line: node.start.line,
-                col: node.start.col
-            });
-        }
-        if (options.nested_defuns
-            && node instanceof AST_Defun
-            && !(tw.parent() instanceof AST_Scope)) {
-            AST_Node.warn("Function {name} declared in nested statement \"{type}\" [{file}:{line},{col}]", {
-                name: node.name.name,
-                type: tw.parent().TYPE,
-                file: node.start.file,
-                line: node.start.line,
-                col: node.start.col
-            });
-        }
-    });
-    this.walk(tw);
-});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/sourcemap.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/sourcemap.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/sourcemap.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,50 +43,153 @@
 
 "use strict";
 
-// a small wrapper around fitzgen's source-map library
-function SourceMap(options) {
-    options = defaults(options, {
-        file : null,
-        root : null,
-        orig : null,
+var vlq_char = characters("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
+var vlq_bits = vlq_char.reduce(function(map, ch, bits) {
+    map[ch] = bits;
+    return map;
+}, Object.create(null));
+
+function vlq_decode(indices, str) {
+    var value = 0;
+    var shift = 0;
+    for (var i = 0, j = 0; i < str.length; i++) {
+        var bits = vlq_bits[str[i]];
+        value += (bits & 31) << shift;
+        if (bits & 32) {
+            shift += 5;
+        } else {
+            indices[j++] += value & 1 ? 0x80000000 | -(value >> 1) : value >> 1;
+            value = shift = 0;
+        }
+    }
+    return j;
+}
+
+function vlq_encode(num) {
+    var result = "";
+    num = Math.abs(num) << 1 | num >>> 31;
+    do {
+        var bits = num & 31;
+        if (num >>>= 5) bits |= 32;
+        result += vlq_char[bits];
+    } while (num);
+    return result;
+}
+
+function create_array_map() {
+    var map = new Dictionary();
+    var array = [];
+    array.index = function(name) {
+        var index = map.get(name);
+        if (!(index >= 0)) {
+            index = array.length;
+            array.push(name);
+            map.set(name, index);
+        }
+        return index;
+    };
+    return array;
+}
 
-        orig_line_diff : 0,
-        dest_line_diff : 0,
+function SourceMap(options) {
+    var sources = create_array_map();
+    var sources_content = options.includeSources && new Dictionary();
+    var names = create_array_map();
+    var mappings = "";
+    if (options.orig) Object.keys(options.orig).forEach(function(name) {
+        var map = options.orig[name];
+        var indices = [ 0, 0, 1, 0, 0 ];
+        options.orig[name] = {
+            names: map.names,
+            mappings: map.mappings.split(/;/).map(function(line) {
+                indices[0] = 0;
+                return line.split(/,/).map(function(segment) {
+                    return indices.slice(0, vlq_decode(indices, segment));
+                });
+            }),
+            sources: map.sources,
+        };
+        if (!sources_content || !map.sourcesContent) return;
+        for (var i = 0; i < map.sources.length; i++) {
+            var content = map.sourcesContent[i];
+            if (content) sources_content.set(map.sources[i], content);
+        }
     });
-    var orig_map = options.orig && new MOZ_SourceMap.SourceMapConsumer(options.orig);
-    var generator;
-    if (orig_map) {
-      generator = MOZ_SourceMap.SourceMapGenerator.fromSourceMap(orig_map);
-    } else {
-        generator = new MOZ_SourceMap.SourceMapGenerator({
-            file       : options.file,
-            sourceRoot : options.root
-        });
-    }
-    function add(source, gen_line, gen_col, orig_line, orig_col, name) {
-        if (orig_map) {
-            var info = orig_map.originalPositionFor({
-                line: orig_line,
-                column: orig_col
-            });
-            if (info.source === null) {
-                return;
-            }
-            source = info.source;
-            orig_line = info.line;
-            orig_col = info.column;
-            name = info.name || name;
-        }
-        generator.addMapping({
-            generated : { line: gen_line + options.dest_line_diff, column: gen_col },
-            original  : { line: orig_line + options.orig_line_diff, column: orig_col },
-            source    : source,
-            name      : name
-        });
-    }
+    var prev_source;
+    var generated_line = 1;
+    var generated_column = 0;
+    var source_index = 0;
+    var original_line = 1;
+    var original_column = 0;
+    var name_index = 0;
     return {
-        add        : add,
-        get        : function() { return generator },
-        toString   : function() { return JSON.stringify(generator.toJSON()); }
+        add: options.orig ? function(source, gen_line, gen_col, orig_line, orig_col, name) {
+            var map = options.orig[source];
+            if (map) {
+                var segments = map.mappings[orig_line - 1];
+                if (!segments) return;
+                var indices;
+                for (var i = 0; i < segments.length; i++) {
+                    var col = segments[i][0];
+                    if (orig_col >= col) indices = segments[i];
+                    if (orig_col <= col) break;
+                }
+                if (!indices || indices.length < 4) {
+                    source = null;
+                } else {
+                    source = map.sources[indices[1]];
+                    orig_line = indices[2];
+                    orig_col = indices[3];
+                    if (indices.length > 4) name = map.names[indices[4]];
+                }
+            }
+            add(source, gen_line, gen_col, orig_line, orig_col, name);
+        } : add,
+        setSourceContent: sources_content ? function(source, content) {
+            if (!sources_content.has(source)) {
+                sources_content.set(source, content);
+            }
+        } : noop,
+        toString: function() {
+            return JSON.stringify({
+                version: 3,
+                file: options.filename || undefined,
+                sourceRoot: options.root || undefined,
+                sources: sources,
+                sourcesContent: sources_content ? sources.map(function(source) {
+                    return sources_content.get(source) || null;
+                }) : undefined,
+                names: names,
+                mappings: mappings,
+            });
+        }
     };
-};
+
+    function add(source, gen_line, gen_col, orig_line, orig_col, name) {
+        if (prev_source == null && source == null) return;
+        prev_source = source;
+        if (generated_line < gen_line) {
+            generated_column = 0;
+            do {
+                mappings += ";";
+            } while (++generated_line < gen_line);
+        } else if (mappings) {
+            mappings += ",";
+        }
+        mappings += vlq_encode(gen_col - generated_column);
+        generated_column = gen_col;
+        if (source == null) return;
+        var src_idx = sources.index(source);
+        mappings += vlq_encode(src_idx - source_index);
+        source_index = src_idx;
+        mappings += vlq_encode(orig_line - original_line);
+        original_line = orig_line;
+        mappings += vlq_encode(orig_col - original_column);
+        original_column = orig_col;
+        if (options.names && name != null) {
+            var name_idx = names.index(name);
+            mappings += vlq_encode(name_idx - name_index);
+            name_index = name_idx;
+        }
+    }
+}
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/transform.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/transform.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/transform.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,8 +43,6 @@
 
 "use strict";
 
-// Tree transformer helpers.
-
 function TreeTransformer(before, after) {
     TreeWalker.call(this);
     this.before = before;
@@ -52,167 +50,201 @@
 }
 TreeTransformer.prototype = new TreeWalker;
 
-(function(undefined){
-
-    function _(node, descend) {
-        node.DEFMETHOD("transform", function(tw, in_list){
-            var x, y;
-            tw.push(this);
-            if (tw.before) x = tw.before(this, descend, in_list);
-            if (x === undefined) {
-                if (!tw.after) {
-                    x = this;
-                    descend(x, tw);
-                } else {
-                    tw.stack[tw.stack.length - 1] = x = this.clone();
-                    descend(x, tw);
-                    y = tw.after(x, in_list);
-                    if (y !== undefined) x = y;
-                }
-            }
-            tw.pop();
-            return x;
-        });
-    };
-
+(function(DEF) {
     function do_list(list, tw) {
-        return MAP(list, function(node){
+        return List(list, function(node) {
             return node.transform(tw, true);
         });
-    };
-
-    _(AST_Node, noop);
+    }
 
-    _(AST_LabeledStatement, function(self, tw){
+    DEF(AST_Node, noop);
+    DEF(AST_LabeledStatement, function(self, tw) {
         self.label = self.label.transform(tw);
         self.body = self.body.transform(tw);
     });
-
-    _(AST_SimpleStatement, function(self, tw){
+    DEF(AST_SimpleStatement, function(self, tw) {
         self.body = self.body.transform(tw);
     });
-
-    _(AST_Block, function(self, tw){
+    DEF(AST_Block, function(self, tw) {
         self.body = do_list(self.body, tw);
     });
-
-    _(AST_DWLoop, function(self, tw){
+    DEF(AST_Do, function(self, tw) {
+        self.body = self.body.transform(tw);
+        self.condition = self.condition.transform(tw);
+    });
+    DEF(AST_While, function(self, tw) {
         self.condition = self.condition.transform(tw);
         self.body = self.body.transform(tw);
     });
-
-    _(AST_For, function(self, tw){
+    DEF(AST_For, function(self, tw) {
         if (self.init) self.init = self.init.transform(tw);
         if (self.condition) self.condition = self.condition.transform(tw);
         if (self.step) self.step = self.step.transform(tw);
         self.body = self.body.transform(tw);
     });
-
-    _(AST_ForIn, function(self, tw){
+    DEF(AST_ForEnumeration, function(self, tw) {
         self.init = self.init.transform(tw);
         self.object = self.object.transform(tw);
         self.body = self.body.transform(tw);
     });
-
-    _(AST_With, function(self, tw){
+    DEF(AST_With, function(self, tw) {
         self.expression = self.expression.transform(tw);
         self.body = self.body.transform(tw);
     });
-
-    _(AST_Exit, function(self, tw){
+    DEF(AST_Exit, function(self, tw) {
         if (self.value) self.value = self.value.transform(tw);
     });
-
-    _(AST_LoopControl, function(self, tw){
+    DEF(AST_LoopControl, function(self, tw) {
         if (self.label) self.label = self.label.transform(tw);
     });
-
-    _(AST_If, function(self, tw){
+    DEF(AST_If, function(self, tw) {
         self.condition = self.condition.transform(tw);
         self.body = self.body.transform(tw);
         if (self.alternative) self.alternative = self.alternative.transform(tw);
     });
-
-    _(AST_Switch, function(self, tw){
+    DEF(AST_Switch, function(self, tw) {
         self.expression = self.expression.transform(tw);
         self.body = do_list(self.body, tw);
     });
-
-    _(AST_Case, function(self, tw){
+    DEF(AST_Case, function(self, tw) {
         self.expression = self.expression.transform(tw);
         self.body = do_list(self.body, tw);
     });
-
-    _(AST_Try, function(self, tw){
+    DEF(AST_Try, function(self, tw) {
         self.body = do_list(self.body, tw);
         if (self.bcatch) self.bcatch = self.bcatch.transform(tw);
         if (self.bfinally) self.bfinally = self.bfinally.transform(tw);
     });
-
-    _(AST_Catch, function(self, tw){
-        self.argname = self.argname.transform(tw);
+    DEF(AST_Catch, function(self, tw) {
+        if (self.argname) self.argname = self.argname.transform(tw);
         self.body = do_list(self.body, tw);
     });
-
-    _(AST_Definitions, function(self, tw){
+    DEF(AST_Definitions, function(self, tw) {
         self.definitions = do_list(self.definitions, tw);
     });
-
-    _(AST_VarDef, function(self, tw){
+    DEF(AST_VarDef, function(self, tw) {
         self.name = self.name.transform(tw);
         if (self.value) self.value = self.value.transform(tw);
     });
-
-    _(AST_Lambda, function(self, tw){
+    DEF(AST_DefaultValue, function(self, tw) {
+        self.name = self.name.transform(tw);
+        self.value = self.value.transform(tw);
+    });
+    DEF(AST_Lambda, function(self, tw) {
         if (self.name) self.name = self.name.transform(tw);
         self.argnames = do_list(self.argnames, tw);
+        if (self.rest) self.rest = self.rest.transform(tw);
         self.body = do_list(self.body, tw);
     });
-
-    _(AST_Call, function(self, tw){
+    function transform_arrow(self, tw) {
+        self.argnames = do_list(self.argnames, tw);
+        if (self.rest) self.rest = self.rest.transform(tw);
+        if (self.value) {
+            self.value = self.value.transform(tw);
+        } else {
+            self.body = do_list(self.body, tw);
+        }
+    }
+    DEF(AST_Arrow, transform_arrow);
+    DEF(AST_AsyncArrow, transform_arrow);
+    DEF(AST_Class, function(self, tw) {
+        if (self.name) self.name = self.name.transform(tw);
+        if (self.extends) self.extends = self.extends.transform(tw);
+        self.properties = do_list(self.properties, tw);
+    });
+    DEF(AST_ClassProperty, function(self, tw) {
+        if (self.key instanceof AST_Node) self.key = self.key.transform(tw);
+        if (self.value) self.value = self.value.transform(tw);
+    });
+    DEF(AST_Call, function(self, tw) {
         self.expression = self.expression.transform(tw);
         self.args = do_list(self.args, tw);
     });
-
-    _(AST_Seq, function(self, tw){
-        self.car = self.car.transform(tw);
-        self.cdr = self.cdr.transform(tw);
+    DEF(AST_Sequence, function(self, tw) {
+        self.expressions = do_list(self.expressions, tw);
     });
-
-    _(AST_Dot, function(self, tw){
+    DEF(AST_Await, function(self, tw) {
         self.expression = self.expression.transform(tw);
     });
-
-    _(AST_Sub, function(self, tw){
+    DEF(AST_Yield, function(self, tw) {
+        if (self.expression) self.expression = self.expression.transform(tw);
+    });
+    DEF(AST_Dot, function(self, tw) {
+        self.expression = self.expression.transform(tw);
+    });
+    DEF(AST_Sub, function(self, tw) {
         self.expression = self.expression.transform(tw);
         self.property = self.property.transform(tw);
     });
-
-    _(AST_Unary, function(self, tw){
+    DEF(AST_Spread, function(self, tw) {
         self.expression = self.expression.transform(tw);
     });
-
-    _(AST_Binary, function(self, tw){
+    DEF(AST_Unary, function(self, tw) {
+        self.expression = self.expression.transform(tw);
+    });
+    DEF(AST_Binary, function(self, tw) {
         self.left = self.left.transform(tw);
         self.right = self.right.transform(tw);
     });
-
-    _(AST_Conditional, function(self, tw){
+    DEF(AST_Conditional, function(self, tw) {
         self.condition = self.condition.transform(tw);
         self.consequent = self.consequent.transform(tw);
         self.alternative = self.alternative.transform(tw);
     });
-
-    _(AST_Array, function(self, tw){
+    DEF(AST_Array, function(self, tw) {
         self.elements = do_list(self.elements, tw);
     });
-
-    _(AST_Object, function(self, tw){
+    DEF(AST_DestructuredArray, function(self, tw) {
+        self.elements = do_list(self.elements, tw);
+        if (self.rest) self.rest = self.rest.transform(tw);
+    });
+    DEF(AST_DestructuredKeyVal, function(self, tw) {
+        if (self.key instanceof AST_Node) self.key = self.key.transform(tw);
+        self.value = self.value.transform(tw);
+    });
+    DEF(AST_DestructuredObject, function(self, tw) {
         self.properties = do_list(self.properties, tw);
+        if (self.rest) self.rest = self.rest.transform(tw);
     });
-
-    _(AST_ObjectProperty, function(self, tw){
+    DEF(AST_Object, function(self, tw) {
+        self.properties = do_list(self.properties, tw);
+    });
+    DEF(AST_ObjectProperty, function(self, tw) {
+        if (self.key instanceof AST_Node) self.key = self.key.transform(tw);
         self.value = self.value.transform(tw);
     });
-
-})();
+    DEF(AST_ExportDeclaration, function(self, tw) {
+        self.body = self.body.transform(tw);
+    });
+    DEF(AST_ExportDefault, function(self, tw) {
+        self.body = self.body.transform(tw);
+    });
+    DEF(AST_ExportReferences, function(self, tw) {
+        self.properties = do_list(self.properties, tw);
+    });
+    DEF(AST_Import, function(self, tw) {
+        if (self.all) self.all = self.all.transform(tw);
+        if (self.default) self.default = self.default.transform(tw);
+        if (self.properties) self.properties = do_list(self.properties, tw);
+    });
+    DEF(AST_Template, function(self, tw) {
+        if (self.tag) self.tag = self.tag.transform(tw);
+        self.expressions = do_list(self.expressions, tw);
+    });
+})(function(node, descend) {
+    node.DEFMETHOD("transform", function(tw, in_list) {
+        var x, y;
+        tw.push(this);
+        if (tw.before) x = tw.before(this, descend, in_list);
+        if (typeof x === "undefined") {
+            x = this;
+            descend(x, tw);
+            if (tw.after) {
+                y = tw.after(x, in_list);
+                if (typeof y !== "undefined") x = y;
+            }
+        }
+        tw.pop();
+        return x;
+    });
+});
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/utils.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/utils.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/lib/utils.js	(working copy)
@@ -1,7 +1,7 @@
 /***********************************************************************
 
   A JavaScript tokenizer / parser / beautifier / compressor.
-  https://github.com/mishoo/UglifyJS2
+  https://github.com/mishoo/UglifyJS
 
   -------------------------------- (C) ---------------------------------
 
@@ -43,268 +43,245 @@
 
 "use strict";
 
-function array_to_hash(a) {
-    var ret = Object.create(null);
-    for (var i = 0; i < a.length; ++i)
-        ret[a[i]] = true;
-    return ret;
-};
-
-function slice(a, start) {
-    return Array.prototype.slice.call(a, start || 0);
-};
-
 function characters(str) {
     return str.split("");
-};
+}
 
 function member(name, array) {
-    for (var i = array.length; --i >= 0;)
-        if (array[i] == name)
-            return true;
-    return false;
-};
+    return array.indexOf(name) >= 0;
+}
 
 function find_if(func, array) {
-    for (var i = 0, n = array.length; i < n; ++i) {
-        if (func(array[i]))
-            return array[i];
-    }
-};
+    for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i];
+}
 
-function repeat_string(str, i) {
-    if (i <= 0) return "";
-    if (i == 1) return str;
-    var d = repeat_string(str, i >> 1);
-    d += d;
-    if (i & 1) d += str;
-    return d;
-};
+function configure_error_stack(fn) {
+    Object.defineProperty(fn.prototype, "stack", {
+        get: function() {
+            var err = new Error(this.message);
+            err.name = this.name;
+            try {
+                throw err;
+            } catch (e) {
+                return e.stack;
+            }
+        }
+    });
+}
 
 function DefaultsError(msg, defs) {
-    Error.call(this, msg);
-    this.msg = msg;
+    this.message = msg;
     this.defs = defs;
-};
+}
 DefaultsError.prototype = Object.create(Error.prototype);
 DefaultsError.prototype.constructor = DefaultsError;
-
-DefaultsError.croak = function(msg, defs) {
-    throw new DefaultsError(msg, defs);
-};
+DefaultsError.prototype.name = "DefaultsError";
+configure_error_stack(DefaultsError);
 
 function defaults(args, defs, croak) {
-    if (args === true)
-        args = {};
-    var ret = args || {};
-    if (croak) for (var i in ret) if (ret.hasOwnProperty(i) && !defs.hasOwnProperty(i))
-        DefaultsError.croak("`" + i + "` is not a supported option", defs);
-    for (var i in defs) if (defs.hasOwnProperty(i)) {
-        ret[i] = (args && args.hasOwnProperty(i)) ? args[i] : defs[i];
+    if (croak) for (var i in args) {
+        if (HOP(args, i) && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs);
     }
-    return ret;
-};
-
-function merge(obj, ext) {
-    var count = 0;
-    for (var i in ext) if (ext.hasOwnProperty(i)) {
-        obj[i] = ext[i];
-        count++;
+    for (var i in args) {
+        if (HOP(args, i)) defs[i] = args[i];
     }
-    return count;
-};
+    return defs;
+}
 
-function noop() {};
+function noop() {}
+function return_false() { return false; }
+function return_true() { return true; }
+function return_this() { return this; }
+function return_null() { return null; }
 
-var MAP = (function(){
-    function MAP(a, f, backwards) {
-        var ret = [], top = [], i;
-        function doit() {
+var List = (function() {
+    function List(a, f) {
+        var ret = [];
+        for (var i = 0; i < a.length; i++) {
             var val = f(a[i], i);
-            var is_last = val instanceof Last;
-            if (is_last) val = val.v;
-            if (val instanceof AtTop) {
-                val = val.v;
-                if (val instanceof Splice) {
-                    top.push.apply(top, backwards ? val.v.slice().reverse() : val.v);
-                } else {
-                    top.push(val);
-                }
-            }
-            else if (val !== skip) {
-                if (val instanceof Splice) {
-                    ret.push.apply(ret, backwards ? val.v.slice().reverse() : val.v);
-                } else {
-                    ret.push(val);
-                }
-            }
-            return is_last;
-        };
-        if (a instanceof Array) {
-            if (backwards) {
-                for (i = a.length; --i >= 0;) if (doit()) break;
-                ret.reverse();
-                top.reverse();
+            if (val === skip) continue;
+            if (val instanceof Splice) {
+                ret.push.apply(ret, val.v);
             } else {
-                for (i = 0; i < a.length; ++i) if (doit()) break;
+                ret.push(val);
             }
         }
-        else {
-            for (i in a) if (a.hasOwnProperty(i)) if (doit()) break;
-        }
-        return top.concat(ret);
+        return ret;
+    }
+    List.is_op = function(val) {
+        return val === skip || val instanceof Splice;
     };
-    MAP.at_top = function(val) { return new AtTop(val) };
-    MAP.splice = function(val) { return new Splice(val) };
-    MAP.last = function(val) { return new Last(val) };
-    var skip = MAP.skip = {};
-    function AtTop(val) { this.v = val };
-    function Splice(val) { this.v = val };
-    function Last(val) { this.v = val };
-    return MAP;
+    List.splice = function(val) {
+        return new Splice(val);
+    };
+    var skip = List.skip = {};
+    function Splice(val) {
+        this.v = val;
+    }
+    return List;
 })();
 
 function push_uniq(array, el) {
-    if (array.indexOf(el) < 0)
-        array.push(el);
-};
+    if (array.indexOf(el) < 0) return array.push(el);
+}
 
 function string_template(text, props) {
-    return text.replace(/\{(.+?)\}/g, function(str, p){
-        return props[p];
+    return text.replace(/\{([^{}]+)\}/g, function(str, p) {
+        var value = p == "this" ? props : props[p];
+        if (value instanceof AST_Node) return value.print_to_string();
+        if (value instanceof AST_Token) return value.file + ":" + value.line + "," + value.col;
+        return value;
     });
-};
+}
 
 function remove(array, el) {
-    for (var i = array.length; --i >= 0;) {
-        if (array[i] === el) array.splice(i, 1);
-    }
-};
+    var index = array.indexOf(el);
+    if (index >= 0) array.splice(index, 1);
+}
 
-function mergeSort(array, cmp) {
-    if (array.length < 2) return array.slice();
-    function merge(a, b) {
-        var r = [], ai = 0, bi = 0, i = 0;
-        while (ai < a.length && bi < b.length) {
-            cmp(a[ai], b[bi]) <= 0
-                ? r[i++] = a[ai++]
-                : r[i++] = b[bi++];
-        }
-        if (ai < a.length) r.push.apply(r, a.slice(ai));
-        if (bi < b.length) r.push.apply(r, b.slice(bi));
-        return r;
-    };
-    function _ms(a) {
-        if (a.length <= 1)
-            return a;
-        var m = Math.floor(a.length / 2), left = a.slice(0, m), right = a.slice(m);
-        left = _ms(left);
-        right = _ms(right);
-        return merge(left, right);
-    };
-    return _ms(array);
-};
-
-function set_difference(a, b) {
-    return a.filter(function(el){
-        return b.indexOf(el) < 0;
-    });
-};
-
-function set_intersection(a, b) {
-    return a.filter(function(el){
-        return b.indexOf(el) >= 0;
-    });
-};
-
-// this function is taken from Acorn [1], written by Marijn Haverbeke
-// [1] https://github.com/marijnh/acorn
 function makePredicate(words) {
-    if (!(words instanceof Array)) words = words.split(" ");
-    var f = "", cats = [];
-    out: for (var i = 0; i < words.length; ++i) {
-        for (var j = 0; j < cats.length; ++j)
-            if (cats[j][0].length == words[i].length) {
-                cats[j].push(words[i]);
-                continue out;
-            }
-        cats.push([words[i]]);
-    }
-    function compareTo(arr) {
-        if (arr.length == 1) return f += "return str === " + JSON.stringify(arr[0]) + ";";
-        f += "switch(str){";
-        for (var i = 0; i < arr.length; ++i) f += "case " + JSON.stringify(arr[i]) + ":";
-        f += "return true}return false;";
-    }
-    // When there are more than three length categories, an outer
-    // switch first dispatches on the lengths, to save on comparisons.
-    if (cats.length > 3) {
-        cats.sort(function(a, b) {return b.length - a.length;});
-        f += "switch(str.length){";
-        for (var i = 0; i < cats.length; ++i) {
-            var cat = cats[i];
-            f += "case " + cat[0].length + ":";
-            compareTo(cat);
-        }
-        f += "}";
-        // Otherwise, simply generate a flat `switch` statement.
-    } else {
-        compareTo(words);
-    }
-    return new Function("str", f);
-};
+    if (!Array.isArray(words)) words = words.split(" ");
+    var map = Object.create(null);
+    words.forEach(function(word) {
+        map[word] = true;
+    });
+    return map;
+}
 
 function all(array, predicate) {
     for (var i = array.length; --i >= 0;)
-        if (!predicate(array[i]))
+        if (!predicate(array[i], i))
             return false;
     return true;
-};
+}
 
 function Dictionary() {
-    this._values = Object.create(null);
-    this._size = 0;
-};
+    this.values = Object.create(null);
+}
 Dictionary.prototype = {
     set: function(key, val) {
-        if (!this.has(key)) ++this._size;
-        this._values["$" + key] = val;
+        if (key == "__proto__") {
+            this.proto_value = val;
+        } else {
+            this.values[key] = val;
+        }
         return this;
     },
     add: function(key, val) {
-        if (this.has(key)) {
-            this.get(key).push(val);
+        var list = this.get(key);
+        if (list) {
+            list.push(val);
         } else {
             this.set(key, [ val ]);
         }
         return this;
     },
-    get: function(key) { return this._values["$" + key] },
+    get: function(key) {
+        return key == "__proto__" ? this.proto_value : this.values[key];
+    },
     del: function(key) {
-        if (this.has(key)) {
-            --this._size;
-            delete this._values["$" + key];
+        if (key == "__proto__") {
+            delete this.proto_value;
+        } else {
+            delete this.values[key];
         }
         return this;
     },
-    has: function(key) { return ("$" + key) in this._values },
+    has: function(key) {
+        return key == "__proto__" ? "proto_value" in this : key in this.values;
+    },
+    all: function(predicate) {
+        for (var i in this.values)
+            if (!predicate(this.values[i], i)) return false;
+        if ("proto_value" in this && !predicate(this.proto_value, "__proto__")) return false;
+        return true;
+    },
     each: function(f) {
-        for (var i in this._values)
-            f(this._values[i], i.substr(1));
+        for (var i in this.values)
+            f(this.values[i], i);
+        if ("proto_value" in this) f(this.proto_value, "__proto__");
     },
     size: function() {
-        return this._size;
+        return Object.keys(this.values).length + ("proto_value" in this);
     },
     map: function(f) {
         var ret = [];
-        for (var i in this._values)
-            ret.push(f(this._values[i], i.substr(1)));
+        for (var i in this.values)
+            ret.push(f(this.values[i], i));
+        if ("proto_value" in this) ret.push(f(this.proto_value, "__proto__"));
+        return ret;
+    },
+    clone: function() {
+        var ret = new Dictionary();
+        this.each(function(value, i) {
+            ret.set(i, value);
+        });
         return ret;
     },
-    toObject: function() { return this._values }
+    toObject: function() {
+        var obj = {};
+        this.each(function(value, i) {
+            obj["$" + i] = value;
+        });
+        return obj;
+    },
 };
 Dictionary.fromObject = function(obj) {
     var dict = new Dictionary();
-    dict._size = merge(dict._values, obj);
+    for (var i in obj)
+        if (HOP(obj, i)) dict.set(i.slice(1), obj[i]);
     return dict;
 };
+
+function HOP(obj, prop) {
+    return Object.prototype.hasOwnProperty.call(obj, prop);
+}
+
+// return true if the node at the top of the stack (that means the
+// innermost node in the current output) is lexically the first in
+// a statement.
+function first_in_statement(stack, arrow, export_default) {
+    var node = stack.parent(-1);
+    for (var i = 0, p; p = stack.parent(i++); node = p) {
+        if (is_arrow(p)) {
+            return arrow && p.value === node;
+        } else if (p instanceof AST_Binary) {
+            if (p.left === node) continue;
+        } else if (p.TYPE == "Call") {
+            if (p.expression === node) continue;
+        } else if (p instanceof AST_Conditional) {
+            if (p.condition === node) continue;
+        } else if (p instanceof AST_ExportDefault) {
+            return export_default;
+        } else if (p instanceof AST_PropAccess) {
+            if (p.expression === node) continue;
+        } else if (p instanceof AST_Sequence) {
+            if (p.expressions[0] === node) continue;
+        } else if (p instanceof AST_SimpleStatement) {
+            return true;
+        } else if (p instanceof AST_Template) {
+            if (p.tag === node) continue;
+        } else if (p instanceof AST_UnaryPostfix) {
+            if (p.expression === node) continue;
+        }
+        return false;
+    }
+}
+
+function DEF_BITPROPS(ctor, props) {
+    if (props.length > 31) throw new Error("Too many properties: " + props.length + "\n" + props.join(", "));
+    props.forEach(function(name, pos) {
+        var mask = 1 << pos;
+        Object.defineProperty(ctor.prototype, name, {
+            get: function() {
+                return !!(this._bits & mask);
+            },
+            set: function(val) {
+                if (val)
+                    this._bits |= mask;
+                else
+                    this._bits &= ~mask;
+            },
+        });
+    });
+}
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/package.json
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/package.json	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/package.json	(working copy)
@@ -1,31 +1,17 @@
 {
   "name": "uglify-js",
   "description": "JavaScript parser, mangler/compressor and beautifier toolkit",
-  "homepage": "http://lisperator.net/uglifyjs",
-  "author": {
-    "name": "Mihai Bazon",
-    "email": "mihai.bazon@gmail.com",
-    "url": "http://lisperator.net/"
-  },
-  "license": "BSD",
-  "version": "2.4.24",
+  "author": "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)",
+  "license": "BSD-2-Clause",
+  "version": "3.17.4",
   "engines": {
-    "node": ">=0.4.0"
+    "node": ">=0.8.0"
   },
   "maintainers": [
-    {
-      "name": "Mihai Bazon",
-      "email": "mihai.bazon@gmail.com",
-      "url": "http://lisperator.net/"
-    }
+    "Alex Lam <alexlamsl@gmail.com>",
+    "Mihai Bazon <mihai.bazon@gmail.com> (http://lisperator.net/)"
   ],
-  "repository": {
-    "type": "git",
-    "url": "https://github.com/mishoo/UglifyJS2.git"
-  },
-  "bugs": {
-    "url": "https://github.com/mishoo/UglifyJS2/issues"
-  },
+  "repository": "mishoo/UglifyJS",
   "main": "tools/node.js",
   "bin": {
     "uglifyjs": "bin/uglifyjs"
@@ -36,32 +22,35 @@
     "tools",
     "LICENSE"
   ],
-  "dependencies": {
-    "async": "~0.2.6",
-    "source-map": "0.1.34",
-    "uglify-to-browserify": "~1.0.0",
-    "yargs": "~3.5.4"
-  },
   "devDependencies": {
-    "acorn": "~0.6.0",
-    "escodegen": "~1.3.3",
-    "esfuzz": "~0.3.1",
-    "estraverse": "~1.5.1"
-  },
-  "browserify": {
-    "transform": [
-      "uglify-to-browserify"
-    ]
+    "acorn": "~8.7.1",
+    "semver": "~6.3.0"
   },
   "scripts": {
-    "test": "node test/run-tests.js"
-  },
-  "readme": "UglifyJS 2\n==========\n[![Build Status](https://travis-ci.org/mishoo/UglifyJS2.svg)](https://travis-ci.org/mishoo/UglifyJS2)\n\nUglifyJS is a JavaScript parser, minifier, compressor or beautifier toolkit.\n\nThis page documents the command line utility.  For\n[API and internals documentation see my website](http://lisperator.net/uglifyjs/).\nThere's also an\n[in-browser online demo](http://lisperator.net/uglifyjs/#demo) (for Firefox,\nChrome and probably Safari).\n\nInstall\n-------\n\nFirst make sure you have installed the latest version of [node.js](http://nodejs.org/)\n(You may need to restart your computer after this step).\n\nFrom NPM for use as a command line app:\n\n    npm install uglify-js -g\n\nFrom NPM for programmatic use:\n\n    npm install uglify-js\n\nFrom Git:\n\n    git clone git://github.com/mishoo/UglifyJS2.git\n    cd UglifyJS2\n    npm link .\n\nUsage\n-----\n\n    uglifyjs [input files] [options]\n\nUglifyJS2 can take multiple input files.  It's recommended that you pass the\ninput files first, then pass the options.  UglifyJS will parse input files\nin sequence and apply any compression options.  The files are parsed in the\nsame global scope, that is, a reference from a file to some\nvariable/function declared in another file will be matched properly.\n\nIf you want to read from STDIN instead, pass a single dash instead of input\nfiles.\n\nIf you wish to pass your options before the input files, separate the two with\na double dash to prevent input files being used as option arguments:\n\n    uglifyjs --compress --mangle -- input.js\n\nThe available options are:\n\n```\n  --source-map                  Specify an output file where to generate source\n                                map.\n  --source-map-root             The path to the original source to be included\n                                in the source map.\n  --source-map-url              The path to the source map to be added in //#\n                                sourceMappingURL.  Defaults to the value passed\n                                with --source-map.\n  --source-map-include-sources  Pass this flag if you want to include the\n                                content of source files in the source map as\n                                sourcesContent property.\n  --in-source-map               Input source map, useful if you're compressing\n                                JS that was generated from some other original\n                                code.\n  --screw-ie8                   Pass this flag if you don't care about full\n                                compliance with Internet Explorer 6-8 quirks\n                                (by default UglifyJS will try to be IE-proof).\n  --expr                        Parse a single expression, rather than a\n                                program (for parsing JSON)\n  -p, --prefix                  Skip prefix for original filenames that appear\n                                in source maps. For example -p 3 will drop 3\n                                directories from file names and ensure they are\n                                relative paths. You can also specify -p\n                                relative, which will make UglifyJS figure out\n                                itself the relative paths between original\n                                sources, the source map and the output file.\n  -o, --output                  Output file (default STDOUT).\n  -b, --beautify                Beautify output/specify output options.\n  -m, --mangle                  Mangle names/pass mangler options.\n  -r, --reserved                Reserved names to exclude from mangling.\n  -c, --compress                Enable compressor/pass compressor options. Pass\n                                options like -c\n                                hoist_vars=false,if_return=false. Use -c with\n                                no argument to use the default compression\n                                options.\n  -d, --define                  Global definitions\n  -e, --enclose                 Embed everything in a big function, with a\n                                configurable parameter/argument list.\n  --comments                    Preserve copyright comments in the output. By\n                                default this works like Google Closure, keeping\n                                JSDoc-style comments that contain \"@license\" or\n                                \"@preserve\". You can optionally pass one of the\n                                following arguments to this flag:\n                                - \"all\" to keep all comments\n                                - a valid JS regexp (needs to start with a\n                                slash) to keep only comments that match.\n                                Note that currently not *all* comments can be\n                                kept when compression is on, because of dead\n                                code removal or cascading statements into\n                                sequences.\n  --preamble                    Preamble to prepend to the output.  You can use\n                                this to insert a comment, for example for\n                                licensing information.  This will not be\n                                parsed, but the source map will adjust for its\n                                presence.\n  --stats                       Display operations run time on STDERR.\n  --acorn                       Use Acorn for parsing.\n  --spidermonkey                Assume input files are SpiderMonkey AST format\n                                (as JSON).\n  --self                        Build itself (UglifyJS2) as a library (implies\n                                --wrap=UglifyJS --export-all)\n  --wrap                        Embed everything in a big function, making the\n                                “exports” and “global” variables available. You\n                                need to pass an argument to this option to\n                                specify the name that your module will take\n                                when included in, say, a browser.\n  --export-all                  Only used when --wrap, this tells UglifyJS to\n                                add code to automatically export all globals.\n  --lint                        Display some scope warnings\n  -v, --verbose                 Verbose\n  -V, --version                 Print version number and exit.\n  --noerr                       Don't throw an error for unknown options in -c,\n                                -b or -m.\n  --bare-returns                Allow return outside of functions.  Useful when\n                                minifying CommonJS modules.\n  --keep-fnames                 Do not mangle/drop function names.  Useful for\n                                code relying on Function.prototype.name.\n  --reserved-file               File containing reserved names\n  --reserve-domprops            Make (most?) DOM properties reserved for\n                                --mangle-props\n  --mangle-props                Mangle property names\n  --mangle-regex                Only mangle property names matching the regex\n  --name-cache                  File to hold mangled names mappings\n```\n\nSpecify `--output` (`-o`) to declare the output file.  Otherwise the output\ngoes to STDOUT.\n\n## Source map options\n\nUglifyJS2 can generate a source map file, which is highly useful for\ndebugging your compressed JavaScript.  To get a source map, pass\n`--source-map output.js.map` (full path to the file where you want the\nsource map dumped).\n\nAdditionally you might need `--source-map-root` to pass the URL where the\noriginal files can be found.  In case you are passing full paths to input\nfiles to UglifyJS, you can use `--prefix` (`-p`) to specify the number of\ndirectories to drop from the path prefix when declaring files in the source\nmap.\n\nFor example:\n\n    uglifyjs /home/doe/work/foo/src/js/file1.js \\\n             /home/doe/work/foo/src/js/file2.js \\\n             -o foo.min.js \\\n             --source-map foo.min.js.map \\\n             --source-map-root http://foo.com/src \\\n             -p 5 -c -m\n\nThe above will compress and mangle `file1.js` and `file2.js`, will drop the\noutput in `foo.min.js` and the source map in `foo.min.js.map`.  The source\nmapping will refer to `http://foo.com/src/js/file1.js` and\n`http://foo.com/src/js/file2.js` (in fact it will list `http://foo.com/src`\nas the source map root, and the original files as `js/file1.js` and\n`js/file2.js`).\n\n### Composed source map\n\nWhen you're compressing JS code that was output by a compiler such as\nCoffeeScript, mapping to the JS code won't be too helpful.  Instead, you'd\nlike to map back to the original code (i.e. CoffeeScript).  UglifyJS has an\noption to take an input source map.  Assuming you have a mapping from\nCoffeeScript → compiled JS, UglifyJS can generate a map from CoffeeScript →\ncompressed JS by mapping every token in the compiled JS to its original\nlocation.\n\nTo use this feature you need to pass `--in-source-map\n/path/to/input/source.map`.  Normally the input source map should also point\nto the file containing the generated JS, so if that's correct you can omit\ninput files from the command line.\n\n## Mangler options\n\nTo enable the mangler you need to pass `--mangle` (`-m`).  The following\n(comma-separated) options are supported:\n\n- `sort` — to assign shorter names to most frequently used variables.  This\n  saves a few hundred bytes on jQuery before gzip, but the output is\n  _bigger_ after gzip (and seems to happen for other libraries I tried it\n  on) therefore it's not enabled by default.\n\n- `toplevel` — mangle names declared in the toplevel scope (disabled by\n  default).\n\n- `eval` — mangle names visible in scopes where `eval` or `with` are used\n  (disabled by default).\n\nWhen mangling is enabled but you want to prevent certain names from being\nmangled, you can declare those names with `--reserved` (`-r`) — pass a\ncomma-separated list of names.  For example:\n\n    uglifyjs ... -m -r '$,require,exports'\n\nto prevent the `require`, `exports` and `$` names from being changed.\n\n### Mangling property names (`--mangle-props`)\n\n**Note:** this will probably break your code.  Mangling property names is a\nseparate step, different from variable name mangling.  Pass\n`--mangle-props`.  It will mangle all properties that are seen in some\nobject literal, or that are assigned to.  For example:\n\n```js\nvar x = {\n  foo: 1\n};\n\nx.bar = 2;\nx[\"baz\"] = 3;\nx[condition ? \"moo\" : \"boo\"] = 4;\nconsole.log(x.something());\n```\n\nIn the above code, `foo`, `bar`, `baz`, `moo` and `boo` will be replaced\nwith single characters, while `something()` will be left as is.\n\nIn order for this to be of any use, we should avoid mangling standard JS\nnames.  For instance, if your code would contain `x.length = 10`, then\n`length` becomes a candidate for mangling and it will be mangled throughout\nthe code, regardless if it's being used as part of your own objects or\naccessing an array's length.  To avoid that, you can use `--reserved-file`\nto pass a filename that should contain the names to be excluded from\nmangling.  This file can be used both for excluding variable names and\nproperty names.  It could look like this, for example:\n\n```js\n{\n  \"vars\": [ \"define\", \"require\", ... ],\n  \"props\": [ \"length\", \"prototype\", ... ]\n}\n```\n\n`--reserved-file` can be an array of file names (either a single\ncomma-separated argument, or you can pass multiple `--reserved-file`\narguments) — in this case it will exclude names from all those files.\n\nA default exclusion file is provided in `tools/domprops.json` which should\ncover most standard JS and DOM properties defined in various browsers.  Pass\n`--reserve-domprops` to read that in.\n\nYou can also use a regular expression to define which property names should be\nmangled.  For example, `--mangle-regex=\"/^_/\"` will only mangle property names\nthat start with an underscore.\n\nWhen you compress multiple files using this option, in order for them to\nwork together in the end we need to ensure somehow that one property gets\nmangled to the same name in all of them.  For this, pass `--name-cache\nfilename.json` and UglifyJS will maintain these mappings in a file which can\nthen be reused.  It should be initially empty.  Example:\n\n```\nrm -f /tmp/cache.json  # start fresh\nuglifyjs file1.js file2.js --mangle-props --name-cache /tmp/cache.json -o part1.js\nuglifyjs file3.js file4.js --mangle-props --name-cache /tmp/cache.json -o part2.js\n```\n\nNow, `part1.js` and `part2.js` will be consistent with each other in terms\nof mangled property names.\n\nUsing the name cache is not necessary if you compress all your files in a\nsingle call to UglifyJS.\n\n## Compressor options\n\nYou need to pass `--compress` (`-c`) to enable the compressor.  Optionally\nyou can pass a comma-separated list of options.  Options are in the form\n`foo=bar`, or just `foo` (the latter implies a boolean option that you want\nto set `true`; it's effectively a shortcut for `foo=true`).\n\n- `sequences` -- join consecutive simple statements using the comma operator\n\n- `properties` -- rewrite property access using the dot notation, for\n  example `foo[\"bar\"] → foo.bar`\n\n- `dead_code` -- remove unreachable code\n\n- `drop_debugger` -- remove `debugger;` statements\n\n- `unsafe` (default: false) -- apply \"unsafe\" transformations (discussion below)\n\n- `conditionals` -- apply optimizations for `if`-s and conditional\n  expressions\n\n- `comparisons` -- apply certain optimizations to binary nodes, for example:\n  `!(a <= b) → a > b` (only when `unsafe`), attempts to negate binary nodes,\n  e.g. `a = !b && !c && !d && !e → a=!(b||c||d||e)` etc.\n\n- `evaluate` -- attempt to evaluate constant expressions\n\n- `booleans` -- various optimizations for boolean context, for example `!!a\n  ? b : c → a ? b : c`\n\n- `loops` -- optimizations for `do`, `while` and `for` loops when we can\n  statically determine the condition\n\n- `unused` -- drop unreferenced functions and variables\n\n- `hoist_funs` -- hoist function declarations\n\n- `hoist_vars` (default: false) -- hoist `var` declarations (this is `false`\n  by default because it seems to increase the size of the output in general)\n\n- `if_return` -- optimizations for if/return and if/continue\n\n- `join_vars` -- join consecutive `var` statements\n\n- `cascade` -- small optimization for sequences, transform `x, x` into `x`\n  and `x = something(), x` into `x = something()`\n\n- `warnings` -- display warnings when dropping unreachable code or unused\n  declarations etc.\n\n- `negate_iife` -- negate \"Immediately-Called Function Expressions\"\n  where the return value is discarded, to avoid the parens that the\n  code generator would insert.\n\n- `pure_getters` -- the default is `false`.  If you pass `true` for\n  this, UglifyJS will assume that object property access\n  (e.g. `foo.bar` or `foo[\"bar\"]`) doesn't have any side effects.\n\n- `pure_funcs` -- default `null`.  You can pass an array of names and\n  UglifyJS will assume that those functions do not produce side\n  effects.  DANGER: will not check if the name is redefined in scope.\n  An example case here, for instance `var q = Math.floor(a/b)`.  If\n  variable `q` is not used elsewhere, UglifyJS will drop it, but will\n  still keep the `Math.floor(a/b)`, not knowing what it does.  You can\n  pass `pure_funcs: [ 'Math.floor' ]` to let it know that this\n  function won't produce any side effect, in which case the whole\n  statement would get discarded.  The current implementation adds some\n  overhead (compression will be slower).\n\n- `drop_console` -- default `false`.  Pass `true` to discard calls to\n  `console.*` functions.\n\n- `keep_fargs` -- default `false`.  Pass `true` to prevent the\n  compressor from discarding unused function arguments.  You need this\n  for code which relies on `Function.length`.\n\n### The `unsafe` option\n\nIt enables some transformations that *might* break code logic in certain\ncontrived cases, but should be fine for most code.  You might want to try it\non your own code, it should reduce the minified size.  Here's what happens\nwhen this flag is on:\n\n- `new Array(1, 2, 3)` or `Array(1, 2, 3)` → `[ 1, 2, 3 ]`\n- `new Object()` → `{}`\n- `String(exp)` or `exp.toString()` → `\"\" + exp`\n- `new Object/RegExp/Function/Error/Array (...)` → we discard the `new`\n- `typeof foo == \"undefined\"` → `foo === void 0`\n- `void 0` → `undefined` (if there is a variable named \"undefined\" in\n  scope; we do it because the variable name will be mangled, typically\n  reduced to a single character)\n- discards unused function arguments (affects `function.length`)\n\n### Conditional compilation\n\nYou can use the `--define` (`-d`) switch in order to declare global\nvariables that UglifyJS will assume to be constants (unless defined in\nscope).  For example if you pass `--define DEBUG=false` then, coupled with\ndead code removal UglifyJS will discard the following from the output:\n```javascript\nif (DEBUG) {\n\tconsole.log(\"debug stuff\");\n}\n```\n\nUglifyJS will warn about the condition being always false and about dropping\nunreachable code; for now there is no option to turn off only this specific\nwarning, you can pass `warnings=false` to turn off *all* warnings.\n\nAnother way of doing that is to declare your globals as constants in a\nseparate file and include it into the build.  For example you can have a\n`build/defines.js` file with the following:\n```javascript\nconst DEBUG = false;\nconst PRODUCTION = true;\n// etc.\n```\n\nand build your code like this:\n\n    uglifyjs build/defines.js js/foo.js js/bar.js... -c\n\nUglifyJS will notice the constants and, since they cannot be altered, it\nwill evaluate references to them to the value itself and drop unreachable\ncode as usual.  The possible downside of this approach is that the build\nwill contain the `const` declarations.\n\n<a name=\"codegen-options\"></a>\n## Beautifier options\n\nThe code generator tries to output shortest code possible by default.  In\ncase you want beautified output, pass `--beautify` (`-b`).  Optionally you\ncan pass additional arguments that control the code output:\n\n- `beautify` (default `true`) -- whether to actually beautify the output.\n  Passing `-b` will set this to true, but you might need to pass `-b` even\n  when you want to generate minified code, in order to specify additional\n  arguments, so you can use `-b beautify=false` to override it.\n- `indent-level` (default 4)\n- `indent-start` (default 0) -- prefix all lines by that many spaces\n- `quote-keys` (default `false`) -- pass `true` to quote all keys in literal\n  objects\n- `space-colon` (default `true`) -- insert a space after the colon signs\n- `ascii-only` (default `false`) -- escape Unicode characters in strings and\n  regexps\n- `inline-script` (default `false`) -- escape the slash in occurrences of\n  `</script` in strings\n- `width` (default 80) -- only takes effect when beautification is on, this\n  specifies an (orientative) line width that the beautifier will try to\n  obey.  It refers to the width of the line text (excluding indentation).\n  It doesn't work very well currently, but it does make the code generated\n  by UglifyJS more readable.\n- `max-line-len` (default 32000) -- maximum line length (for uglified code)\n- `bracketize` (default `false`) -- always insert brackets in `if`, `for`,\n  `do`, `while` or `with` statements, even if their body is a single\n  statement.\n- `semicolons` (default `true`) -- separate statements with semicolons.  If\n  you pass `false` then whenever possible we will use a newline instead of a\n  semicolon, leading to more readable output of uglified code (size before\n  gzip could be smaller; size after gzip insignificantly larger).\n- `preamble` (default `null`) -- when passed it must be a string and\n  it will be prepended to the output literally.  The source map will\n  adjust for this text.  Can be used to insert a comment containing\n  licensing information, for example.\n- `quote_style` (default `0`) -- preferred quote style for strings (affects\n  quoted property names and directives as well):\n  - `0` -- prefers double quotes, switches to single quotes when there are\n    more double quotes in the string itself.\n  - `1` -- always use single quotes\n  - `2` -- always use double quotes\n  - `3` -- always use the original quotes\n\n### Keeping copyright notices or other comments\n\nYou can pass `--comments` to retain certain comments in the output.  By\ndefault it will keep JSDoc-style comments that contain \"@preserve\",\n\"@license\" or \"@cc_on\" (conditional compilation for IE).  You can pass\n`--comments all` to keep all the comments, or a valid JavaScript regexp to\nkeep only comments that match this regexp.  For example `--comments\n'/foo|bar/'` will keep only comments that contain \"foo\" or \"bar\".\n\nNote, however, that there might be situations where comments are lost.  For\nexample:\n```javascript\nfunction f() {\n\t/** @preserve Foo Bar */\n\tfunction g() {\n\t  // this function is never called\n\t}\n\treturn something();\n}\n```\n\nEven though it has \"@preserve\", the comment will be lost because the inner\nfunction `g` (which is the AST node to which the comment is attached to) is\ndiscarded by the compressor as not referenced.\n\nThe safest comments where to place copyright information (or other info that\nneeds to be kept in the output) are comments attached to toplevel nodes.\n\n## Support for the SpiderMonkey AST\n\nUglifyJS2 has its own abstract syntax tree format; for\n[practical reasons](http://lisperator.net/blog/uglifyjs-why-not-switching-to-spidermonkey-ast/)\nwe can't easily change to using the SpiderMonkey AST internally.  However,\nUglifyJS now has a converter which can import a SpiderMonkey AST.\n\nFor example [Acorn][acorn] is a super-fast parser that produces a\nSpiderMonkey AST.  It has a small CLI utility that parses one file and dumps\nthe AST in JSON on the standard output.  To use UglifyJS to mangle and\ncompress that:\n\n    acorn file.js | uglifyjs --spidermonkey -m -c\n\nThe `--spidermonkey` option tells UglifyJS that all input files are not\nJavaScript, but JS code described in SpiderMonkey AST in JSON.  Therefore we\ndon't use our own parser in this case, but just transform that AST into our\ninternal AST.\n\n### Use Acorn for parsing\n\nMore for fun, I added the `--acorn` option which will use Acorn to do all\nthe parsing.  If you pass this option, UglifyJS will `require(\"acorn\")`.\n\nAcorn is really fast (e.g. 250ms instead of 380ms on some 650K code), but\nconverting the SpiderMonkey tree that Acorn produces takes another 150ms so\nin total it's a bit more than just using UglifyJS's own parser.\n\n### Using UglifyJS to transform SpiderMonkey AST\n\nNow you can use UglifyJS as any other intermediate tool for transforming\nJavaScript ASTs in SpiderMonkey format.\n\nExample:\n\n```javascript\nfunction uglify(ast, options, mangle) {\n  // Conversion from SpiderMonkey AST to internal format\n  var uAST = UglifyJS.AST_Node.from_mozilla_ast(ast);\n\n  // Compression\n  uAST.figure_out_scope();\n  uAST = uAST.transform(UglifyJS.Compressor(options));\n\n  // Mangling (optional)\n  if (mangle) {\n    uAST.figure_out_scope();\n    uAST.compute_char_frequency();\n    uAST.mangle_names();\n  }\n\n  // Back-conversion to SpiderMonkey AST\n  return uAST.to_mozilla_ast();\n}\n```\n\nCheck out\n[original blog post](http://rreverser.com/using-mozilla-ast-with-uglifyjs/)\nfor details.\n\nAPI Reference\n-------------\n\nAssuming installation via NPM, you can load UglifyJS in your application\nlike this:\n```javascript\nvar UglifyJS = require(\"uglify-js\");\n```\n\nIt exports a lot of names, but I'll discuss here the basics that are needed\nfor parsing, mangling and compressing a piece of code.  The sequence is (1)\nparse, (2) compress, (3) mangle, (4) generate output code.\n\n### The simple way\n\nThere's a single toplevel function which combines all the steps.  If you\ndon't need additional customization, you might want to go with `minify`.\nExample:\n```javascript\nvar result = UglifyJS.minify(\"/path/to/file.js\");\nconsole.log(result.code); // minified output\n// if you need to pass code instead of file name\nvar result = UglifyJS.minify(\"var b = function () {};\", {fromString: true});\n```\n\nYou can also compress multiple files:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ]);\nconsole.log(result.code);\n```\n\nTo generate a source map:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n\toutSourceMap: \"out.js.map\"\n});\nconsole.log(result.code); // minified output\nconsole.log(result.map);\n```\n\nNote that the source map is not saved in a file, it's just returned in\n`result.map`.  The value passed for `outSourceMap` is only used to set the\n`file` attribute in the source map (see [the spec][sm-spec]).\n\nYou can also specify sourceRoot property to be included in source map:\n```javascript\nvar result = UglifyJS.minify([ \"file1.js\", \"file2.js\", \"file3.js\" ], {\n\toutSourceMap: \"out.js.map\",\n\tsourceRoot: \"http://example.com/src\"\n});\n```\n\nIf you're compressing compiled JavaScript and have a source map for it, you\ncan use the `inSourceMap` argument:\n```javascript\nvar result = UglifyJS.minify(\"compiled.js\", {\n\tinSourceMap: \"compiled.js.map\",\n\toutSourceMap: \"minified.js.map\"\n});\n// same as before, it returns `code` and `map`\n```\n\nIf your input source map is not in a file, you can pass it in as an object\nusing the `inSourceMap` argument:\n\n```javascript\nvar result = UglifyJS.minify(\"compiled.js\", {\n\tinSourceMap: JSON.parse(my_source_map_string),\n\toutSourceMap: \"minified.js.map\"\n});\n```\n\nThe `inSourceMap` is only used if you also request `outSourceMap` (it makes\nno sense otherwise).\n\nOther options:\n\n- `warnings` (default `false`) — pass `true` to display compressor warnings.\n\n- `fromString` (default `false`) — if you pass `true` then you can pass\n  JavaScript source code, rather than file names.\n\n- `mangle` — pass `false` to skip mangling names.\n\n- `output` (default `null`) — pass an object if you wish to specify\n  additional [output options][codegen].  The defaults are optimized\n  for best compression.\n\n- `compress` (default `{}`) — pass `false` to skip compressing entirely.\n  Pass an object to specify custom [compressor options][compressor].\n\nWe could add more options to `UglifyJS.minify` — if you need additional\nfunctionality please suggest!\n\n### The hard way\n\nFollowing there's more detailed API info, in case the `minify` function is\ntoo simple for your needs.\n\n#### The parser\n```javascript\nvar toplevel_ast = UglifyJS.parse(code, options);\n```\n\n`options` is optional and if present it must be an object.  The following\nproperties are available:\n\n- `strict` — disable automatic semicolon insertion and support for trailing\n  comma in arrays and objects\n- `filename` — the name of the file where this code is coming from\n- `toplevel` — a `toplevel` node (as returned by a previous invocation of\n  `parse`)\n\nThe last two options are useful when you'd like to minify multiple files and\nget a single file as the output and a proper source map.  Our CLI tool does\nsomething like this:\n```javascript\nvar toplevel = null;\nfiles.forEach(function(file){\n\tvar code = fs.readFileSync(file, \"utf8\");\n\ttoplevel = UglifyJS.parse(code, {\n\t\tfilename: file,\n\t\ttoplevel: toplevel\n\t});\n});\n```\n\nAfter this, we have in `toplevel` a big AST containing all our files, with\neach token having proper information about where it came from.\n\n#### Scope information\n\nUglifyJS contains a scope analyzer that you need to call manually before\ncompressing or mangling.  Basically it augments various nodes in the AST\nwith information about where is a name defined, how many times is a name\nreferenced, if it is a global or not, if a function is using `eval` or the\n`with` statement etc.  I will discuss this some place else, for now what's\nimportant to know is that you need to call the following before doing\nanything with the tree:\n```javascript\ntoplevel.figure_out_scope()\n```\n\n#### Compression\n\nLike this:\n```javascript\nvar compressor = UglifyJS.Compressor(options);\nvar compressed_ast = toplevel.transform(compressor);\n```\n\nThe `options` can be missing.  Available options are discussed above in\n“Compressor options”.  Defaults should lead to best compression in most\nscripts.\n\nThe compressor is destructive, so don't rely that `toplevel` remains the\noriginal tree.\n\n#### Mangling\n\nAfter compression it is a good idea to call again `figure_out_scope` (since\nthe compressor might drop unused variables / unreachable code and this might\nchange the number of identifiers or their position).  Optionally, you can\ncall a trick that helps after Gzip (counting character frequency in\nnon-mangleable words).  Example:\n```javascript\ncompressed_ast.figure_out_scope();\ncompressed_ast.compute_char_frequency();\ncompressed_ast.mangle_names();\n```\n\n#### Generating output\n\nAST nodes have a `print` method that takes an output stream.  Essentially,\nto generate code you do this:\n```javascript\nvar stream = UglifyJS.OutputStream(options);\ncompressed_ast.print(stream);\nvar code = stream.toString(); // this is your minified code\n```\n\nor, for a shortcut you can do:\n```javascript\nvar code = compressed_ast.print_to_string(options);\n```\n\nAs usual, `options` is optional.  The output stream accepts a lot of options,\nmost of them documented above in section “Beautifier options”.  The two\nwhich we care about here are `source_map` and `comments`.\n\n#### Keeping comments in the output\n\nIn order to keep certain comments in the output you need to pass the\n`comments` option.  Pass a RegExp or a function.  If you pass a RegExp, only\nthose comments whose body matches the regexp will be kept.  Note that body\nmeans without the initial `//` or `/*`.  If you pass a function, it will be\ncalled for every comment in the tree and will receive two arguments: the\nnode that the comment is attached to, and the comment token itself.\n\nThe comment token has these properties:\n\n- `type`: \"comment1\" for single-line comments or \"comment2\" for multi-line\n  comments\n- `value`: the comment body\n- `pos` and `endpos`: the start/end positions (zero-based indexes) in the\n  original code where this comment appears\n- `line` and `col`: the line and column where this comment appears in the\n  original code\n- `file` — the file name of the original file\n- `nlb` — true if there was a newline before this comment in the original\n  code, or if this comment contains a newline.\n\nYour function should return `true` to keep the comment, or a falsy value\notherwise.\n\n#### Generating a source mapping\n\nYou need to pass the `source_map` argument when calling `print`.  It needs\nto be a `SourceMap` object (which is a thin wrapper on top of the\n[source-map][source-map] library).\n\nExample:\n```javascript\nvar source_map = UglifyJS.SourceMap(source_map_options);\nvar stream = UglifyJS.OutputStream({\n\t...\n\tsource_map: source_map\n});\ncompressed_ast.print(stream);\n\nvar code = stream.toString();\nvar map = source_map.toString(); // json output for your source map\n```\n\nThe `source_map_options` (optional) can contain the following properties:\n\n- `file`: the name of the JavaScript output file that this mapping refers to\n- `root`: the `sourceRoot` property (see the [spec][sm-spec])\n- `orig`: the \"original source map\", handy when you compress generated JS\n  and want to map the minified output back to the original code where it\n  came from.  It can be simply a string in JSON, or a JSON object containing\n  the original source map.\n\n  [acorn]: https://github.com/marijnh/acorn\n  [source-map]: https://github.com/mozilla/source-map\n  [sm-spec]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit\n  [codegen]: http://lisperator.net/uglifyjs/codegen\n  [compressor]: http://lisperator.net/uglifyjs/compress\n",
-  "readmeFilename": "README.md",
-  "_id": "uglify-js@2.4.24",
-  "dist": {
-    "shasum": "6edaf63fd17bcb4525b242736fc3b6ba5fcc05fb"
+    "test": "node test/compress.js && node test/mocha.js"
   },
-  "_from": "uglify-js@~2.4.0",
-  "_resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.4.24.tgz"
+  "keywords": [
+    "cli",
+    "compress",
+    "compressor",
+    "ecma",
+    "ecmascript",
+    "es",
+    "es5",
+    "javascript",
+    "js",
+    "jsmin",
+    "min",
+    "minification",
+    "minifier",
+    "minify",
+    "optimize",
+    "optimizer",
+    "pack",
+    "packer",
+    "parse",
+    "parser",
+    "uglifier",
+    "uglify"
+  ]
 }
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/domprops.json
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/domprops.json	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/domprops.json	(working copy)
@@ -1,5603 +1,8325 @@
-{
-    "props": [
-        "$&",
-        "$'",
-        "$*",
-        "$+",
-        "$1",
-        "$2",
-        "$3",
-        "$4",
-        "$5",
-        "$6",
-        "$7",
-        "$8",
-        "$9",
-        "$_",
-        "$`",
-        "$input",
-        "@@iterator",
-        "ABORT_ERR",
-        "ACTIVE",
-        "ACTIVE_ATTRIBUTES",
-        "ACTIVE_TEXTURE",
-        "ACTIVE_UNIFORMS",
-        "ADDITION",
-        "ALIASED_LINE_WIDTH_RANGE",
-        "ALIASED_POINT_SIZE_RANGE",
-        "ALLOW_KEYBOARD_INPUT",
-        "ALLPASS",
-        "ALPHA",
-        "ALPHA_BITS",
-        "ALT_MASK",
-        "ALWAYS",
-        "ANY_TYPE",
-        "ANY_UNORDERED_NODE_TYPE",
-        "ARRAY_BUFFER",
-        "ARRAY_BUFFER_BINDING",
-        "ATTACHED_SHADERS",
-        "ATTRIBUTE_NODE",
-        "AT_TARGET",
-        "AddSearchProvider",
-        "AnalyserNode",
-        "AnimationEvent",
-        "AnonXMLHttpRequest",
-        "ApplicationCache",
-        "ApplicationCacheErrorEvent",
-        "Array",
-        "ArrayBuffer",
-        "Attr",
-        "Audio",
-        "AudioBuffer",
-        "AudioBufferSourceNode",
-        "AudioContext",
-        "AudioDestinationNode",
-        "AudioListener",
-        "AudioNode",
-        "AudioParam",
-        "AudioProcessingEvent",
-        "AudioStreamTrack",
-        "AutocompleteErrorEvent",
-        "BACK",
-        "BAD_BOUNDARYPOINTS_ERR",
-        "BANDPASS",
-        "BLEND",
-        "BLEND_COLOR",
-        "BLEND_DST_ALPHA",
-        "BLEND_DST_RGB",
-        "BLEND_EQUATION",
-        "BLEND_EQUATION_ALPHA",
-        "BLEND_EQUATION_RGB",
-        "BLEND_SRC_ALPHA",
-        "BLEND_SRC_RGB",
-        "BLUE_BITS",
-        "BLUR",
-        "BOOL",
-        "BOOLEAN_TYPE",
-        "BOOL_VEC2",
-        "BOOL_VEC3",
-        "BOOL_VEC4",
-        "BOTH",
-        "BROWSER_DEFAULT_WEBGL",
-        "BUBBLING_PHASE",
-        "BUFFER_SIZE",
-        "BUFFER_USAGE",
-        "BYTE",
-        "BYTES_PER_ELEMENT",
-        "BarProp",
-        "BaseHref",
-        "BatteryManager",
-        "BeforeLoadEvent",
-        "BeforeUnloadEvent",
-        "BiquadFilterNode",
-        "Blob",
-        "BlobEvent",
-        "Boolean",
-        "CAPTURING_PHASE",
-        "CCW",
-        "CDATASection",
-        "CDATA_SECTION_NODE",
-        "CHANGE",
-        "CHARSET_RULE",
-        "CHECKING",
-        "CLAMP_TO_EDGE",
-        "CLICK",
-        "CLOSED",
-        "CLOSING",
-        "COLOR_ATTACHMENT0",
-        "COLOR_BUFFER_BIT",
-        "COLOR_CLEAR_VALUE",
-        "COLOR_WRITEMASK",
-        "COMMENT_NODE",
-        "COMPILE_STATUS",
-        "COMPRESSED_RGBA_S3TC_DXT1_EXT",
-        "COMPRESSED_RGBA_S3TC_DXT3_EXT",
-        "COMPRESSED_RGBA_S3TC_DXT5_EXT",
-        "COMPRESSED_RGB_S3TC_DXT1_EXT",
-        "COMPRESSED_TEXTURE_FORMATS",
-        "CONNECTING",
-        "CONSTANT_ALPHA",
-        "CONSTANT_COLOR",
-        "CONSTRAINT_ERR",
-        "CONTEXT_LOST_WEBGL",
-        "CONTROL_MASK",
-        "COUNTER_STYLE_RULE",
-        "CSS",
-        "CSS2Properties",
-        "CSSCharsetRule",
-        "CSSConditionRule",
-        "CSSCounterStyleRule",
-        "CSSFontFaceRule",
-        "CSSFontFeatureValuesRule",
-        "CSSGroupingRule",
-        "CSSImportRule",
-        "CSSKeyframeRule",
-        "CSSKeyframesRule",
-        "CSSMediaRule",
-        "CSSMozDocumentRule",
-        "CSSNameSpaceRule",
-        "CSSPageRule",
-        "CSSPrimitiveValue",
-        "CSSRule",
-        "CSSRuleList",
-        "CSSStyleDeclaration",
-        "CSSStyleRule",
-        "CSSStyleSheet",
-        "CSSSupportsRule",
-        "CSSUnknownRule",
-        "CSSValue",
-        "CSSValueList",
-        "CSSVariablesDeclaration",
-        "CSSVariablesRule",
-        "CSSViewportRule",
-        "CSS_ATTR",
-        "CSS_CM",
-        "CSS_COUNTER",
-        "CSS_CUSTOM",
-        "CSS_DEG",
-        "CSS_DIMENSION",
-        "CSS_EMS",
-        "CSS_EXS",
-        "CSS_FILTER_BLUR",
-        "CSS_FILTER_BRIGHTNESS",
-        "CSS_FILTER_CONTRAST",
-        "CSS_FILTER_CUSTOM",
-        "CSS_FILTER_DROP_SHADOW",
-        "CSS_FILTER_GRAYSCALE",
-        "CSS_FILTER_HUE_ROTATE",
-        "CSS_FILTER_INVERT",
-        "CSS_FILTER_OPACITY",
-        "CSS_FILTER_REFERENCE",
-        "CSS_FILTER_SATURATE",
-        "CSS_FILTER_SEPIA",
-        "CSS_GRAD",
-        "CSS_HZ",
-        "CSS_IDENT",
-        "CSS_IN",
-        "CSS_INHERIT",
-        "CSS_KHZ",
-        "CSS_MATRIX",
-        "CSS_MATRIX3D",
-        "CSS_MM",
-        "CSS_MS",
-        "CSS_NUMBER",
-        "CSS_PC",
-        "CSS_PERCENTAGE",
-        "CSS_PERSPECTIVE",
-        "CSS_PRIMITIVE_VALUE",
-        "CSS_PT",
-        "CSS_PX",
-        "CSS_RAD",
-        "CSS_RECT",
-        "CSS_RGBCOLOR",
-        "CSS_ROTATE",
-        "CSS_ROTATE3D",
-        "CSS_ROTATEX",
-        "CSS_ROTATEY",
-        "CSS_ROTATEZ",
-        "CSS_S",
-        "CSS_SCALE",
-        "CSS_SCALE3D",
-        "CSS_SCALEX",
-        "CSS_SCALEY",
-        "CSS_SCALEZ",
-        "CSS_SKEW",
-        "CSS_SKEWX",
-        "CSS_SKEWY",
-        "CSS_STRING",
-        "CSS_TRANSLATE",
-        "CSS_TRANSLATE3D",
-        "CSS_TRANSLATEX",
-        "CSS_TRANSLATEY",
-        "CSS_TRANSLATEZ",
-        "CSS_UNKNOWN",
-        "CSS_URI",
-        "CSS_VALUE_LIST",
-        "CSS_VH",
-        "CSS_VMAX",
-        "CSS_VMIN",
-        "CSS_VW",
-        "CULL_FACE",
-        "CULL_FACE_MODE",
-        "CURRENT_PROGRAM",
-        "CURRENT_VERTEX_ATTRIB",
-        "CUSTOM",
-        "CW",
-        "CanvasGradient",
-        "CanvasPattern",
-        "CanvasRenderingContext2D",
-        "CaretPosition",
-        "ChannelMergerNode",
-        "ChannelSplitterNode",
-        "CharacterData",
-        "ClientRect",
-        "ClientRectList",
-        "Clipboard",
-        "ClipboardEvent",
-        "CloseEvent",
-        "Collator",
-        "CommandEvent",
-        "Comment",
-        "CompositionEvent",
-        "Console",
-        "Controllers",
-        "ConvolverNode",
-        "Counter",
-        "Crypto",
-        "CryptoKey",
-        "CustomEvent",
-        "DATABASE_ERR",
-        "DATA_CLONE_ERR",
-        "DATA_ERR",
-        "DBLCLICK",
-        "DECR",
-        "DECR_WRAP",
-        "DELETE_STATUS",
-        "DEPTH_ATTACHMENT",
-        "DEPTH_BITS",
-        "DEPTH_BUFFER_BIT",
-        "DEPTH_CLEAR_VALUE",
-        "DEPTH_COMPONENT",
-        "DEPTH_COMPONENT16",
-        "DEPTH_FUNC",
-        "DEPTH_RANGE",
-        "DEPTH_STENCIL",
-        "DEPTH_STENCIL_ATTACHMENT",
-        "DEPTH_TEST",
-        "DEPTH_WRITEMASK",
-        "DIRECTION_DOWN",
-        "DIRECTION_LEFT",
-        "DIRECTION_RIGHT",
-        "DIRECTION_UP",
-        "DISABLED",
-        "DISPATCH_REQUEST_ERR",
-        "DITHER",
-        "DOCUMENT_FRAGMENT_NODE",
-        "DOCUMENT_NODE",
-        "DOCUMENT_POSITION_CONTAINED_BY",
-        "DOCUMENT_POSITION_CONTAINS",
-        "DOCUMENT_POSITION_DISCONNECTED",
-        "DOCUMENT_POSITION_FOLLOWING",
-        "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC",
-        "DOCUMENT_POSITION_PRECEDING",
-        "DOCUMENT_TYPE_NODE",
-        "DOMCursor",
-        "DOMError",
-        "DOMException",
-        "DOMImplementation",
-        "DOMImplementationLS",
-        "DOMMatrix",
-        "DOMMatrixReadOnly",
-        "DOMParser",
-        "DOMPoint",
-        "DOMPointReadOnly",
-        "DOMQuad",
-        "DOMRect",
-        "DOMRectList",
-        "DOMRectReadOnly",
-        "DOMRequest",
-        "DOMSTRING_SIZE_ERR",
-        "DOMSettableTokenList",
-        "DOMStringList",
-        "DOMStringMap",
-        "DOMTokenList",
-        "DOMTransactionEvent",
-        "DOM_DELTA_LINE",
-        "DOM_DELTA_PAGE",
-        "DOM_DELTA_PIXEL",
-        "DOM_INPUT_METHOD_DROP",
-        "DOM_INPUT_METHOD_HANDWRITING",
-        "DOM_INPUT_METHOD_IME",
-        "DOM_INPUT_METHOD_KEYBOARD",
-        "DOM_INPUT_METHOD_MULTIMODAL",
-        "DOM_INPUT_METHOD_OPTION",
-        "DOM_INPUT_METHOD_PASTE",
-        "DOM_INPUT_METHOD_SCRIPT",
-        "DOM_INPUT_METHOD_UNKNOWN",
-        "DOM_INPUT_METHOD_VOICE",
-        "DOM_KEY_LOCATION_JOYSTICK",
-        "DOM_KEY_LOCATION_LEFT",
-        "DOM_KEY_LOCATION_MOBILE",
-        "DOM_KEY_LOCATION_NUMPAD",
-        "DOM_KEY_LOCATION_RIGHT",
-        "DOM_KEY_LOCATION_STANDARD",
-        "DOM_VK_0",
-        "DOM_VK_1",
-        "DOM_VK_2",
-        "DOM_VK_3",
-        "DOM_VK_4",
-        "DOM_VK_5",
-        "DOM_VK_6",
-        "DOM_VK_7",
-        "DOM_VK_8",
-        "DOM_VK_9",
-        "DOM_VK_A",
-        "DOM_VK_ACCEPT",
-        "DOM_VK_ADD",
-        "DOM_VK_ALT",
-        "DOM_VK_ALTGR",
-        "DOM_VK_AMPERSAND",
-        "DOM_VK_ASTERISK",
-        "DOM_VK_AT",
-        "DOM_VK_ATTN",
-        "DOM_VK_B",
-        "DOM_VK_BACKSPACE",
-        "DOM_VK_BACK_QUOTE",
-        "DOM_VK_BACK_SLASH",
-        "DOM_VK_BACK_SPACE",
-        "DOM_VK_C",
-        "DOM_VK_CANCEL",
-        "DOM_VK_CAPS_LOCK",
-        "DOM_VK_CIRCUMFLEX",
-        "DOM_VK_CLEAR",
-        "DOM_VK_CLOSE_BRACKET",
-        "DOM_VK_CLOSE_CURLY_BRACKET",
-        "DOM_VK_CLOSE_PAREN",
-        "DOM_VK_COLON",
-        "DOM_VK_COMMA",
-        "DOM_VK_CONTEXT_MENU",
-        "DOM_VK_CONTROL",
-        "DOM_VK_CONVERT",
-        "DOM_VK_CRSEL",
-        "DOM_VK_CTRL",
-        "DOM_VK_D",
-        "DOM_VK_DECIMAL",
-        "DOM_VK_DELETE",
-        "DOM_VK_DIVIDE",
-        "DOM_VK_DOLLAR",
-        "DOM_VK_DOUBLE_QUOTE",
-        "DOM_VK_DOWN",
-        "DOM_VK_E",
-        "DOM_VK_EISU",
-        "DOM_VK_END",
-        "DOM_VK_ENTER",
-        "DOM_VK_EQUALS",
-        "DOM_VK_EREOF",
-        "DOM_VK_ESCAPE",
-        "DOM_VK_EXCLAMATION",
-        "DOM_VK_EXECUTE",
-        "DOM_VK_EXSEL",
-        "DOM_VK_F",
-        "DOM_VK_F1",
-        "DOM_VK_F10",
-        "DOM_VK_F11",
-        "DOM_VK_F12",
-        "DOM_VK_F13",
-        "DOM_VK_F14",
-        "DOM_VK_F15",
-        "DOM_VK_F16",
-        "DOM_VK_F17",
-        "DOM_VK_F18",
-        "DOM_VK_F19",
-        "DOM_VK_F2",
-        "DOM_VK_F20",
-        "DOM_VK_F21",
-        "DOM_VK_F22",
-        "DOM_VK_F23",
-        "DOM_VK_F24",
-        "DOM_VK_F25",
-        "DOM_VK_F26",
-        "DOM_VK_F27",
-        "DOM_VK_F28",
-        "DOM_VK_F29",
-        "DOM_VK_F3",
-        "DOM_VK_F30",
-        "DOM_VK_F31",
-        "DOM_VK_F32",
-        "DOM_VK_F33",
-        "DOM_VK_F34",
-        "DOM_VK_F35",
-        "DOM_VK_F36",
-        "DOM_VK_F4",
-        "DOM_VK_F5",
-        "DOM_VK_F6",
-        "DOM_VK_F7",
-        "DOM_VK_F8",
-        "DOM_VK_F9",
-        "DOM_VK_FINAL",
-        "DOM_VK_FRONT",
-        "DOM_VK_G",
-        "DOM_VK_GREATER_THAN",
-        "DOM_VK_H",
-        "DOM_VK_HANGUL",
-        "DOM_VK_HANJA",
-        "DOM_VK_HASH",
-        "DOM_VK_HELP",
-        "DOM_VK_HK_TOGGLE",
-        "DOM_VK_HOME",
-        "DOM_VK_HYPHEN_MINUS",
-        "DOM_VK_I",
-        "DOM_VK_INSERT",
-        "DOM_VK_J",
-        "DOM_VK_JUNJA",
-        "DOM_VK_K",
-        "DOM_VK_KANA",
-        "DOM_VK_KANJI",
-        "DOM_VK_L",
-        "DOM_VK_LEFT",
-        "DOM_VK_LEFT_TAB",
-        "DOM_VK_LESS_THAN",
-        "DOM_VK_M",
-        "DOM_VK_META",
-        "DOM_VK_MODECHANGE",
-        "DOM_VK_MULTIPLY",
-        "DOM_VK_N",
-        "DOM_VK_NONCONVERT",
-        "DOM_VK_NUMPAD0",
-        "DOM_VK_NUMPAD1",
-        "DOM_VK_NUMPAD2",
-        "DOM_VK_NUMPAD3",
-        "DOM_VK_NUMPAD4",
-        "DOM_VK_NUMPAD5",
-        "DOM_VK_NUMPAD6",
-        "DOM_VK_NUMPAD7",
-        "DOM_VK_NUMPAD8",
-        "DOM_VK_NUMPAD9",
-        "DOM_VK_NUM_LOCK",
-        "DOM_VK_O",
-        "DOM_VK_OEM_1",
-        "DOM_VK_OEM_102",
-        "DOM_VK_OEM_2",
-        "DOM_VK_OEM_3",
-        "DOM_VK_OEM_4",
-        "DOM_VK_OEM_5",
-        "DOM_VK_OEM_6",
-        "DOM_VK_OEM_7",
-        "DOM_VK_OEM_8",
-        "DOM_VK_OEM_COMMA",
-        "DOM_VK_OEM_MINUS",
-        "DOM_VK_OEM_PERIOD",
-        "DOM_VK_OEM_PLUS",
-        "DOM_VK_OPEN_BRACKET",
-        "DOM_VK_OPEN_CURLY_BRACKET",
-        "DOM_VK_OPEN_PAREN",
-        "DOM_VK_P",
-        "DOM_VK_PA1",
-        "DOM_VK_PAGEDOWN",
-        "DOM_VK_PAGEUP",
-        "DOM_VK_PAGE_DOWN",
-        "DOM_VK_PAGE_UP",
-        "DOM_VK_PAUSE",
-        "DOM_VK_PERCENT",
-        "DOM_VK_PERIOD",
-        "DOM_VK_PIPE",
-        "DOM_VK_PLAY",
-        "DOM_VK_PLUS",
-        "DOM_VK_PRINT",
-        "DOM_VK_PRINTSCREEN",
-        "DOM_VK_PROCESSKEY",
-        "DOM_VK_PROPERITES",
-        "DOM_VK_Q",
-        "DOM_VK_QUESTION_MARK",
-        "DOM_VK_QUOTE",
-        "DOM_VK_R",
-        "DOM_VK_REDO",
-        "DOM_VK_RETURN",
-        "DOM_VK_RIGHT",
-        "DOM_VK_S",
-        "DOM_VK_SCROLL_LOCK",
-        "DOM_VK_SELECT",
-        "DOM_VK_SEMICOLON",
-        "DOM_VK_SEPARATOR",
-        "DOM_VK_SHIFT",
-        "DOM_VK_SLASH",
-        "DOM_VK_SLEEP",
-        "DOM_VK_SPACE",
-        "DOM_VK_SUBTRACT",
-        "DOM_VK_T",
-        "DOM_VK_TAB",
-        "DOM_VK_TILDE",
-        "DOM_VK_U",
-        "DOM_VK_UNDERSCORE",
-        "DOM_VK_UNDO",
-        "DOM_VK_UNICODE",
-        "DOM_VK_UP",
-        "DOM_VK_V",
-        "DOM_VK_VOLUME_DOWN",
-        "DOM_VK_VOLUME_MUTE",
-        "DOM_VK_VOLUME_UP",
-        "DOM_VK_W",
-        "DOM_VK_WIN",
-        "DOM_VK_WINDOW",
-        "DOM_VK_WIN_ICO_00",
-        "DOM_VK_WIN_ICO_CLEAR",
-        "DOM_VK_WIN_ICO_HELP",
-        "DOM_VK_WIN_OEM_ATTN",
-        "DOM_VK_WIN_OEM_AUTO",
-        "DOM_VK_WIN_OEM_BACKTAB",
-        "DOM_VK_WIN_OEM_CLEAR",
-        "DOM_VK_WIN_OEM_COPY",
-        "DOM_VK_WIN_OEM_CUSEL",
-        "DOM_VK_WIN_OEM_ENLW",
-        "DOM_VK_WIN_OEM_FINISH",
-        "DOM_VK_WIN_OEM_FJ_JISHO",
-        "DOM_VK_WIN_OEM_FJ_LOYA",
-        "DOM_VK_WIN_OEM_FJ_MASSHOU",
-        "DOM_VK_WIN_OEM_FJ_ROYA",
-        "DOM_VK_WIN_OEM_FJ_TOUROKU",
-        "DOM_VK_WIN_OEM_JUMP",
-        "DOM_VK_WIN_OEM_PA1",
-        "DOM_VK_WIN_OEM_PA2",
-        "DOM_VK_WIN_OEM_PA3",
-        "DOM_VK_WIN_OEM_RESET",
-        "DOM_VK_WIN_OEM_WSCTRL",
-        "DOM_VK_X",
-        "DOM_VK_XF86XK_ADD_FAVORITE",
-        "DOM_VK_XF86XK_APPLICATION_LEFT",
-        "DOM_VK_XF86XK_APPLICATION_RIGHT",
-        "DOM_VK_XF86XK_AUDIO_CYCLE_TRACK",
-        "DOM_VK_XF86XK_AUDIO_FORWARD",
-        "DOM_VK_XF86XK_AUDIO_LOWER_VOLUME",
-        "DOM_VK_XF86XK_AUDIO_MEDIA",
-        "DOM_VK_XF86XK_AUDIO_MUTE",
-        "DOM_VK_XF86XK_AUDIO_NEXT",
-        "DOM_VK_XF86XK_AUDIO_PAUSE",
-        "DOM_VK_XF86XK_AUDIO_PLAY",
-        "DOM_VK_XF86XK_AUDIO_PREV",
-        "DOM_VK_XF86XK_AUDIO_RAISE_VOLUME",
-        "DOM_VK_XF86XK_AUDIO_RANDOM_PLAY",
-        "DOM_VK_XF86XK_AUDIO_RECORD",
-        "DOM_VK_XF86XK_AUDIO_REPEAT",
-        "DOM_VK_XF86XK_AUDIO_REWIND",
-        "DOM_VK_XF86XK_AUDIO_STOP",
-        "DOM_VK_XF86XK_AWAY",
-        "DOM_VK_XF86XK_BACK",
-        "DOM_VK_XF86XK_BACK_FORWARD",
-        "DOM_VK_XF86XK_BATTERY",
-        "DOM_VK_XF86XK_BLUE",
-        "DOM_VK_XF86XK_BLUETOOTH",
-        "DOM_VK_XF86XK_BOOK",
-        "DOM_VK_XF86XK_BRIGHTNESS_ADJUST",
-        "DOM_VK_XF86XK_CALCULATOR",
-        "DOM_VK_XF86XK_CALENDAR",
-        "DOM_VK_XF86XK_CD",
-        "DOM_VK_XF86XK_CLOSE",
-        "DOM_VK_XF86XK_COMMUNITY",
-        "DOM_VK_XF86XK_CONTRAST_ADJUST",
-        "DOM_VK_XF86XK_COPY",
-        "DOM_VK_XF86XK_CUT",
-        "DOM_VK_XF86XK_CYCLE_ANGLE",
-        "DOM_VK_XF86XK_DISPLAY",
-        "DOM_VK_XF86XK_DOCUMENTS",
-        "DOM_VK_XF86XK_DOS",
-        "DOM_VK_XF86XK_EJECT",
-        "DOM_VK_XF86XK_EXCEL",
-        "DOM_VK_XF86XK_EXPLORER",
-        "DOM_VK_XF86XK_FAVORITES",
-        "DOM_VK_XF86XK_FINANCE",
-        "DOM_VK_XF86XK_FORWARD",
-        "DOM_VK_XF86XK_FRAME_BACK",
-        "DOM_VK_XF86XK_FRAME_FORWARD",
-        "DOM_VK_XF86XK_GAME",
-        "DOM_VK_XF86XK_GO",
-        "DOM_VK_XF86XK_GREEN",
-        "DOM_VK_XF86XK_HIBERNATE",
-        "DOM_VK_XF86XK_HISTORY",
-        "DOM_VK_XF86XK_HOME_PAGE",
-        "DOM_VK_XF86XK_HOT_LINKS",
-        "DOM_VK_XF86XK_I_TOUCH",
-        "DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN",
-        "DOM_VK_XF86XK_KBD_BRIGHTNESS_UP",
-        "DOM_VK_XF86XK_KBD_LIGHT_ON_OFF",
-        "DOM_VK_XF86XK_LAUNCH0",
-        "DOM_VK_XF86XK_LAUNCH1",
-        "DOM_VK_XF86XK_LAUNCH2",
-        "DOM_VK_XF86XK_LAUNCH3",
-        "DOM_VK_XF86XK_LAUNCH4",
-        "DOM_VK_XF86XK_LAUNCH5",
-        "DOM_VK_XF86XK_LAUNCH6",
-        "DOM_VK_XF86XK_LAUNCH7",
-        "DOM_VK_XF86XK_LAUNCH8",
-        "DOM_VK_XF86XK_LAUNCH9",
-        "DOM_VK_XF86XK_LAUNCH_A",
-        "DOM_VK_XF86XK_LAUNCH_B",
-        "DOM_VK_XF86XK_LAUNCH_C",
-        "DOM_VK_XF86XK_LAUNCH_D",
-        "DOM_VK_XF86XK_LAUNCH_E",
-        "DOM_VK_XF86XK_LAUNCH_F",
-        "DOM_VK_XF86XK_LIGHT_BULB",
-        "DOM_VK_XF86XK_LOG_OFF",
-        "DOM_VK_XF86XK_MAIL",
-        "DOM_VK_XF86XK_MAIL_FORWARD",
-        "DOM_VK_XF86XK_MARKET",
-        "DOM_VK_XF86XK_MEETING",
-        "DOM_VK_XF86XK_MEMO",
-        "DOM_VK_XF86XK_MENU_KB",
-        "DOM_VK_XF86XK_MENU_PB",
-        "DOM_VK_XF86XK_MESSENGER",
-        "DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN",
-        "DOM_VK_XF86XK_MON_BRIGHTNESS_UP",
-        "DOM_VK_XF86XK_MUSIC",
-        "DOM_VK_XF86XK_MY_COMPUTER",
-        "DOM_VK_XF86XK_MY_SITES",
-        "DOM_VK_XF86XK_NEW",
-        "DOM_VK_XF86XK_NEWS",
-        "DOM_VK_XF86XK_OFFICE_HOME",
-        "DOM_VK_XF86XK_OPEN",
-        "DOM_VK_XF86XK_OPEN_URL",
-        "DOM_VK_XF86XK_OPTION",
-        "DOM_VK_XF86XK_PASTE",
-        "DOM_VK_XF86XK_PHONE",
-        "DOM_VK_XF86XK_PICTURES",
-        "DOM_VK_XF86XK_POWER_DOWN",
-        "DOM_VK_XF86XK_POWER_OFF",
-        "DOM_VK_XF86XK_RED",
-        "DOM_VK_XF86XK_REFRESH",
-        "DOM_VK_XF86XK_RELOAD",
-        "DOM_VK_XF86XK_REPLY",
-        "DOM_VK_XF86XK_ROCKER_DOWN",
-        "DOM_VK_XF86XK_ROCKER_ENTER",
-        "DOM_VK_XF86XK_ROCKER_UP",
-        "DOM_VK_XF86XK_ROTATE_WINDOWS",
-        "DOM_VK_XF86XK_ROTATION_KB",
-        "DOM_VK_XF86XK_ROTATION_PB",
-        "DOM_VK_XF86XK_SAVE",
-        "DOM_VK_XF86XK_SCREEN_SAVER",
-        "DOM_VK_XF86XK_SCROLL_CLICK",
-        "DOM_VK_XF86XK_SCROLL_DOWN",
-        "DOM_VK_XF86XK_SCROLL_UP",
-        "DOM_VK_XF86XK_SEARCH",
-        "DOM_VK_XF86XK_SEND",
-        "DOM_VK_XF86XK_SHOP",
-        "DOM_VK_XF86XK_SPELL",
-        "DOM_VK_XF86XK_SPLIT_SCREEN",
-        "DOM_VK_XF86XK_STANDBY",
-        "DOM_VK_XF86XK_START",
-        "DOM_VK_XF86XK_STOP",
-        "DOM_VK_XF86XK_SUBTITLE",
-        "DOM_VK_XF86XK_SUPPORT",
-        "DOM_VK_XF86XK_SUSPEND",
-        "DOM_VK_XF86XK_TASK_PANE",
-        "DOM_VK_XF86XK_TERMINAL",
-        "DOM_VK_XF86XK_TIME",
-        "DOM_VK_XF86XK_TOOLS",
-        "DOM_VK_XF86XK_TOP_MENU",
-        "DOM_VK_XF86XK_TO_DO_LIST",
-        "DOM_VK_XF86XK_TRAVEL",
-        "DOM_VK_XF86XK_USER1KB",
-        "DOM_VK_XF86XK_USER2KB",
-        "DOM_VK_XF86XK_USER_PB",
-        "DOM_VK_XF86XK_UWB",
-        "DOM_VK_XF86XK_VENDOR_HOME",
-        "DOM_VK_XF86XK_VIDEO",
-        "DOM_VK_XF86XK_VIEW",
-        "DOM_VK_XF86XK_WAKE_UP",
-        "DOM_VK_XF86XK_WEB_CAM",
-        "DOM_VK_XF86XK_WHEEL_BUTTON",
-        "DOM_VK_XF86XK_WLAN",
-        "DOM_VK_XF86XK_WORD",
-        "DOM_VK_XF86XK_WWW",
-        "DOM_VK_XF86XK_XFER",
-        "DOM_VK_XF86XK_YELLOW",
-        "DOM_VK_XF86XK_ZOOM_IN",
-        "DOM_VK_XF86XK_ZOOM_OUT",
-        "DOM_VK_Y",
-        "DOM_VK_Z",
-        "DOM_VK_ZOOM",
-        "DONE",
-        "DONT_CARE",
-        "DOWNLOADING",
-        "DRAGDROP",
-        "DST_ALPHA",
-        "DST_COLOR",
-        "DYNAMIC_DRAW",
-        "DataChannel",
-        "DataTransfer",
-        "DataTransferItem",
-        "DataTransferItemList",
-        "DataView",
-        "Date",
-        "DateTimeFormat",
-        "DelayNode",
-        "DesktopNotification",
-        "DesktopNotificationCenter",
-        "DeviceLightEvent",
-        "DeviceMotionEvent",
-        "DeviceOrientationEvent",
-        "DeviceProximityEvent",
-        "DeviceStorage",
-        "DeviceStorageChangeEvent",
-        "Document",
-        "DocumentFragment",
-        "DocumentType",
-        "DragEvent",
-        "DynamicsCompressorNode",
-        "E",
-        "ELEMENT_ARRAY_BUFFER",
-        "ELEMENT_ARRAY_BUFFER_BINDING",
-        "ELEMENT_NODE",
-        "EMPTY",
-        "ENCODING_ERR",
-        "ENDED",
-        "END_TO_END",
-        "END_TO_START",
-        "ENTITY_NODE",
-        "ENTITY_REFERENCE_NODE",
-        "EPSILON",
-        "EQUAL",
-        "EQUALPOWER",
-        "ERROR",
-        "EXPONENTIAL_DISTANCE",
-        "Element",
-        "ElementQuery",
-        "Entity",
-        "EntityReference",
-        "Error",
-        "ErrorEvent",
-        "EvalError",
-        "Event",
-        "EventException",
-        "EventSource",
-        "EventTarget",
-        "External",
-        "FASTEST",
-        "FIDOSDK",
-        "FILTER_ACCEPT",
-        "FILTER_INTERRUPT",
-        "FILTER_REJECT",
-        "FILTER_SKIP",
-        "FINISHED_STATE",
-        "FIRST_ORDERED_NODE_TYPE",
-        "FLOAT",
-        "FLOAT_MAT2",
-        "FLOAT_MAT3",
-        "FLOAT_MAT4",
-        "FLOAT_VEC2",
-        "FLOAT_VEC3",
-        "FLOAT_VEC4",
-        "FOCUS",
-        "FONT_FACE_RULE",
-        "FONT_FEATURE_VALUES_RULE",
-        "FRAGMENT_SHADER",
-        "FRAGMENT_SHADER_DERIVATIVE_HINT_OES",
-        "FRAMEBUFFER",
-        "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",
-        "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",
-        "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",
-        "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",
-        "FRAMEBUFFER_BINDING",
-        "FRAMEBUFFER_COMPLETE",
-        "FRAMEBUFFER_INCOMPLETE_ATTACHMENT",
-        "FRAMEBUFFER_INCOMPLETE_DIMENSIONS",
-        "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
-        "FRAMEBUFFER_UNSUPPORTED",
-        "FRONT",
-        "FRONT_AND_BACK",
-        "FRONT_FACE",
-        "FUNC_ADD",
-        "FUNC_REVERSE_SUBTRACT",
-        "FUNC_SUBTRACT",
-        "Feed",
-        "FeedEntry",
-        "File",
-        "FileError",
-        "FileList",
-        "FileReader",
-        "FindInPage",
-        "Float32Array",
-        "Float64Array",
-        "FocusEvent",
-        "FontFace",
-        "FormData",
-        "Function",
-        "GENERATE_MIPMAP_HINT",
-        "GEQUAL",
-        "GREATER",
-        "GREEN_BITS",
-        "GainNode",
-        "Gamepad",
-        "GamepadButton",
-        "GamepadEvent",
-        "GestureEvent",
-        "HAVE_CURRENT_DATA",
-        "HAVE_ENOUGH_DATA",
-        "HAVE_FUTURE_DATA",
-        "HAVE_METADATA",
-        "HAVE_NOTHING",
-        "HEADERS_RECEIVED",
-        "HIDDEN",
-        "HIERARCHY_REQUEST_ERR",
-        "HIGHPASS",
-        "HIGHSHELF",
-        "HIGH_FLOAT",
-        "HIGH_INT",
-        "HORIZONTAL",
-        "HORIZONTAL_AXIS",
-        "HRTF",
-        "HTMLAllCollection",
-        "HTMLAnchorElement",
-        "HTMLAppletElement",
-        "HTMLAreaElement",
-        "HTMLAudioElement",
-        "HTMLBRElement",
-        "HTMLBaseElement",
-        "HTMLBaseFontElement",
-        "HTMLBlockquoteElement",
-        "HTMLBodyElement",
-        "HTMLButtonElement",
-        "HTMLCanvasElement",
-        "HTMLCollection",
-        "HTMLCommandElement",
-        "HTMLContentElement",
-        "HTMLDListElement",
-        "HTMLDataElement",
-        "HTMLDataListElement",
-        "HTMLDetailsElement",
-        "HTMLDialogElement",
-        "HTMLDirectoryElement",
-        "HTMLDivElement",
-        "HTMLDocument",
-        "HTMLElement",
-        "HTMLEmbedElement",
-        "HTMLFieldSetElement",
-        "HTMLFontElement",
-        "HTMLFormControlsCollection",
-        "HTMLFormElement",
-        "HTMLFrameElement",
-        "HTMLFrameSetElement",
-        "HTMLHRElement",
-        "HTMLHeadElement",
-        "HTMLHeadingElement",
-        "HTMLHtmlElement",
-        "HTMLIFrameElement",
-        "HTMLImageElement",
-        "HTMLInputElement",
-        "HTMLIsIndexElement",
-        "HTMLKeygenElement",
-        "HTMLLIElement",
-        "HTMLLabelElement",
-        "HTMLLegendElement",
-        "HTMLLinkElement",
-        "HTMLMapElement",
-        "HTMLMarqueeElement",
-        "HTMLMediaElement",
-        "HTMLMenuElement",
-        "HTMLMenuItemElement",
-        "HTMLMetaElement",
-        "HTMLMeterElement",
-        "HTMLModElement",
-        "HTMLOListElement",
-        "HTMLObjectElement",
-        "HTMLOptGroupElement",
-        "HTMLOptionElement",
-        "HTMLOptionsCollection",
-        "HTMLOutputElement",
-        "HTMLParagraphElement",
-        "HTMLParamElement",
-        "HTMLPictureElement",
-        "HTMLPreElement",
-        "HTMLProgressElement",
-        "HTMLPropertiesCollection",
-        "HTMLQuoteElement",
-        "HTMLScriptElement",
-        "HTMLSelectElement",
-        "HTMLShadowElement",
-        "HTMLSourceElement",
-        "HTMLSpanElement",
-        "HTMLStyleElement",
-        "HTMLTableCaptionElement",
-        "HTMLTableCellElement",
-        "HTMLTableColElement",
-        "HTMLTableElement",
-        "HTMLTableRowElement",
-        "HTMLTableSectionElement",
-        "HTMLTemplateElement",
-        "HTMLTextAreaElement",
-        "HTMLTimeElement",
-        "HTMLTitleElement",
-        "HTMLTrackElement",
-        "HTMLUListElement",
-        "HTMLUnknownElement",
-        "HTMLVideoElement",
-        "HashChangeEvent",
-        "Headers",
-        "History",
-        "ICE_CHECKING",
-        "ICE_CLOSED",
-        "ICE_COMPLETED",
-        "ICE_CONNECTED",
-        "ICE_FAILED",
-        "ICE_GATHERING",
-        "ICE_WAITING",
-        "IDBCursor",
-        "IDBCursorWithValue",
-        "IDBDatabase",
-        "IDBDatabaseException",
-        "IDBFactory",
-        "IDBFileHandle",
-        "IDBFileRequest",
-        "IDBIndex",
-        "IDBKeyRange",
-        "IDBMutableFile",
-        "IDBObjectStore",
-        "IDBOpenDBRequest",
-        "IDBRequest",
-        "IDBTransaction",
-        "IDBVersionChangeEvent",
-        "IDLE",
-        "IMPLEMENTATION_COLOR_READ_FORMAT",
-        "IMPLEMENTATION_COLOR_READ_TYPE",
-        "IMPORT_RULE",
-        "INCR",
-        "INCR_WRAP",
-        "INDEX_SIZE_ERR",
-        "INT",
-        "INT_VEC2",
-        "INT_VEC3",
-        "INT_VEC4",
-        "INUSE_ATTRIBUTE_ERR",
-        "INVALID_ACCESS_ERR",
-        "INVALID_CHARACTER_ERR",
-        "INVALID_ENUM",
-        "INVALID_EXPRESSION_ERR",
-        "INVALID_FRAMEBUFFER_OPERATION",
-        "INVALID_MODIFICATION_ERR",
-        "INVALID_NODE_TYPE_ERR",
-        "INVALID_OPERATION",
-        "INVALID_STATE_ERR",
-        "INVALID_VALUE",
-        "INVERSE_DISTANCE",
-        "INVERT",
-        "IceCandidate",
-        "Image",
-        "ImageBitmap",
-        "ImageData",
-        "Infinity",
-        "InputEvent",
-        "InputMethodContext",
-        "InstallTrigger",
-        "Int16Array",
-        "Int32Array",
-        "Int8Array",
-        "Intent",
-        "InternalError",
-        "Intl",
-        "IsSearchProviderInstalled",
-        "Iterator",
-        "JSON",
-        "KEEP",
-        "KEYDOWN",
-        "KEYFRAMES_RULE",
-        "KEYFRAME_RULE",
-        "KEYPRESS",
-        "KEYUP",
-        "KeyEvent",
-        "KeyboardEvent",
-        "LENGTHADJUST_SPACING",
-        "LENGTHADJUST_SPACINGANDGLYPHS",
-        "LENGTHADJUST_UNKNOWN",
-        "LEQUAL",
-        "LESS",
-        "LINEAR",
-        "LINEAR_DISTANCE",
-        "LINEAR_MIPMAP_LINEAR",
-        "LINEAR_MIPMAP_NEAREST",
-        "LINES",
-        "LINE_LOOP",
-        "LINE_STRIP",
-        "LINE_WIDTH",
-        "LINK_STATUS",
-        "LIVE",
-        "LN10",
-        "LN2",
-        "LOADED",
-        "LOADING",
-        "LOG10E",
-        "LOG2E",
-        "LOWPASS",
-        "LOWSHELF",
-        "LOW_FLOAT",
-        "LOW_INT",
-        "LSException",
-        "LSParserFilter",
-        "LUMINANCE",
-        "LUMINANCE_ALPHA",
-        "LocalMediaStream",
-        "Location",
-        "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
-        "MAX_CUBE_MAP_TEXTURE_SIZE",
-        "MAX_FRAGMENT_UNIFORM_VECTORS",
-        "MAX_RENDERBUFFER_SIZE",
-        "MAX_SAFE_INTEGER",
-        "MAX_TEXTURE_IMAGE_UNITS",
-        "MAX_TEXTURE_MAX_ANISOTROPY_EXT",
-        "MAX_TEXTURE_SIZE",
-        "MAX_VALUE",
-        "MAX_VARYING_VECTORS",
-        "MAX_VERTEX_ATTRIBS",
-        "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
-        "MAX_VERTEX_UNIFORM_VECTORS",
-        "MAX_VIEWPORT_DIMS",
-        "MEDIA_ERR_ABORTED",
-        "MEDIA_ERR_DECODE",
-        "MEDIA_ERR_ENCRYPTED",
-        "MEDIA_ERR_NETWORK",
-        "MEDIA_ERR_SRC_NOT_SUPPORTED",
-        "MEDIA_KEYERR_CLIENT",
-        "MEDIA_KEYERR_DOMAIN",
-        "MEDIA_KEYERR_HARDWARECHANGE",
-        "MEDIA_KEYERR_OUTPUT",
-        "MEDIA_KEYERR_SERVICE",
-        "MEDIA_KEYERR_UNKNOWN",
-        "MEDIA_RULE",
-        "MEDIUM_FLOAT",
-        "MEDIUM_INT",
-        "META_MASK",
-        "MIN_SAFE_INTEGER",
-        "MIN_VALUE",
-        "MIRRORED_REPEAT",
-        "MODE_ASYNCHRONOUS",
-        "MODE_SYNCHRONOUS",
-        "MODIFICATION",
-        "MOUSEDOWN",
-        "MOUSEDRAG",
-        "MOUSEMOVE",
-        "MOUSEOUT",
-        "MOUSEOVER",
-        "MOUSEUP",
-        "MOZ_KEYFRAMES_RULE",
-        "MOZ_KEYFRAME_RULE",
-        "MOZ_SOURCE_CURSOR",
-        "MOZ_SOURCE_ERASER",
-        "MOZ_SOURCE_KEYBOARD",
-        "MOZ_SOURCE_MOUSE",
-        "MOZ_SOURCE_PEN",
-        "MOZ_SOURCE_TOUCH",
-        "MOZ_SOURCE_UNKNOWN",
-        "MSGESTURE_FLAG_BEGIN",
-        "MSGESTURE_FLAG_CANCEL",
-        "MSGESTURE_FLAG_END",
-        "MSGESTURE_FLAG_INERTIA",
-        "MSGESTURE_FLAG_NONE",
-        "MSPOINTER_TYPE_MOUSE",
-        "MSPOINTER_TYPE_PEN",
-        "MSPOINTER_TYPE_TOUCH",
-        "MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE",
-        "MS_ASYNC_CALLBACK_STATUS_CANCEL",
-        "MS_ASYNC_CALLBACK_STATUS_CHOOSEANY",
-        "MS_ASYNC_CALLBACK_STATUS_ERROR",
-        "MS_ASYNC_CALLBACK_STATUS_JOIN",
-        "MS_ASYNC_OP_STATUS_CANCELED",
-        "MS_ASYNC_OP_STATUS_ERROR",
-        "MS_ASYNC_OP_STATUS_SUCCESS",
-        "MS_MANIPULATION_STATE_ACTIVE",
-        "MS_MANIPULATION_STATE_CANCELLED",
-        "MS_MANIPULATION_STATE_COMMITTED",
-        "MS_MANIPULATION_STATE_DRAGGING",
-        "MS_MANIPULATION_STATE_INERTIA",
-        "MS_MANIPULATION_STATE_PRESELECT",
-        "MS_MANIPULATION_STATE_SELECTING",
-        "MS_MANIPULATION_STATE_STOPPED",
-        "MS_MEDIA_ERR_ENCRYPTED",
-        "MS_MEDIA_KEYERR_CLIENT",
-        "MS_MEDIA_KEYERR_DOMAIN",
-        "MS_MEDIA_KEYERR_HARDWARECHANGE",
-        "MS_MEDIA_KEYERR_OUTPUT",
-        "MS_MEDIA_KEYERR_SERVICE",
-        "MS_MEDIA_KEYERR_UNKNOWN",
-        "Map",
-        "Math",
-        "MediaController",
-        "MediaDevices",
-        "MediaElementAudioSourceNode",
-        "MediaEncryptedEvent",
-        "MediaError",
-        "MediaKeyError",
-        "MediaKeyEvent",
-        "MediaKeyMessageEvent",
-        "MediaKeyNeededEvent",
-        "MediaKeySession",
-        "MediaKeyStatusMap",
-        "MediaKeySystemAccess",
-        "MediaKeys",
-        "MediaList",
-        "MediaQueryList",
-        "MediaQueryListEvent",
-        "MediaRecorder",
-        "MediaSource",
-        "MediaStream",
-        "MediaStreamAudioDestinationNode",
-        "MediaStreamAudioSourceNode",
-        "MediaStreamEvent",
-        "MediaStreamTrack",
-        "MediaStreamTrackEvent",
-        "MessageChannel",
-        "MessageEvent",
-        "MessagePort",
-        "Methods",
-        "MimeType",
-        "MimeTypeArray",
-        "MouseEvent",
-        "MouseScrollEvent",
-        "MozAnimation",
-        "MozAnimationDelay",
-        "MozAnimationDirection",
-        "MozAnimationDuration",
-        "MozAnimationFillMode",
-        "MozAnimationIterationCount",
-        "MozAnimationName",
-        "MozAnimationPlayState",
-        "MozAnimationTimingFunction",
-        "MozAppearance",
-        "MozBackfaceVisibility",
-        "MozBinding",
-        "MozBorderBottomColors",
-        "MozBorderEnd",
-        "MozBorderEndColor",
-        "MozBorderEndStyle",
-        "MozBorderEndWidth",
-        "MozBorderImage",
-        "MozBorderLeftColors",
-        "MozBorderRightColors",
-        "MozBorderStart",
-        "MozBorderStartColor",
-        "MozBorderStartStyle",
-        "MozBorderStartWidth",
-        "MozBorderTopColors",
-        "MozBoxAlign",
-        "MozBoxDirection",
-        "MozBoxFlex",
-        "MozBoxOrdinalGroup",
-        "MozBoxOrient",
-        "MozBoxPack",
-        "MozBoxSizing",
-        "MozCSSKeyframeRule",
-        "MozCSSKeyframesRule",
-        "MozColumnCount",
-        "MozColumnFill",
-        "MozColumnGap",
-        "MozColumnRule",
-        "MozColumnRuleColor",
-        "MozColumnRuleStyle",
-        "MozColumnRuleWidth",
-        "MozColumnWidth",
-        "MozColumns",
-        "MozContactChangeEvent",
-        "MozFloatEdge",
-        "MozFontFeatureSettings",
-        "MozFontLanguageOverride",
-        "MozForceBrokenImageIcon",
-        "MozHyphens",
-        "MozImageRegion",
-        "MozMarginEnd",
-        "MozMarginStart",
-        "MozMmsEvent",
-        "MozMmsMessage",
-        "MozMobileMessageThread",
-        "MozOSXFontSmoothing",
-        "MozOrient",
-        "MozOutlineRadius",
-        "MozOutlineRadiusBottomleft",
-        "MozOutlineRadiusBottomright",
-        "MozOutlineRadiusTopleft",
-        "MozOutlineRadiusTopright",
-        "MozPaddingEnd",
-        "MozPaddingStart",
-        "MozPerspective",
-        "MozPerspectiveOrigin",
-        "MozPowerManager",
-        "MozSettingsEvent",
-        "MozSmsEvent",
-        "MozSmsMessage",
-        "MozStackSizing",
-        "MozTabSize",
-        "MozTextAlignLast",
-        "MozTextDecorationColor",
-        "MozTextDecorationLine",
-        "MozTextDecorationStyle",
-        "MozTextSizeAdjust",
-        "MozTransform",
-        "MozTransformOrigin",
-        "MozTransformStyle",
-        "MozTransition",
-        "MozTransitionDelay",
-        "MozTransitionDuration",
-        "MozTransitionProperty",
-        "MozTransitionTimingFunction",
-        "MozUserFocus",
-        "MozUserInput",
-        "MozUserModify",
-        "MozUserSelect",
-        "MozWindowDragging",
-        "MozWindowShadow",
-        "MutationEvent",
-        "MutationObserver",
-        "MutationRecord",
-        "NAMESPACE_ERR",
-        "NAMESPACE_RULE",
-        "NEAREST",
-        "NEAREST_MIPMAP_LINEAR",
-        "NEAREST_MIPMAP_NEAREST",
-        "NEGATIVE_INFINITY",
-        "NETWORK_EMPTY",
-        "NETWORK_ERR",
-        "NETWORK_IDLE",
-        "NETWORK_LOADED",
-        "NETWORK_LOADING",
-        "NETWORK_NO_SOURCE",
-        "NEVER",
-        "NEW",
-        "NEXT",
-        "NEXT_NO_DUPLICATE",
-        "NICEST",
-        "NODE_AFTER",
-        "NODE_BEFORE",
-        "NODE_BEFORE_AND_AFTER",
-        "NODE_INSIDE",
-        "NONE",
-        "NON_TRANSIENT_ERR",
-        "NOTATION_NODE",
-        "NOTCH",
-        "NOTEQUAL",
-        "NOT_ALLOWED_ERR",
-        "NOT_FOUND_ERR",
-        "NOT_READABLE_ERR",
-        "NOT_SUPPORTED_ERR",
-        "NO_DATA_ALLOWED_ERR",
-        "NO_ERR",
-        "NO_ERROR",
-        "NO_MODIFICATION_ALLOWED_ERR",
-        "NUMBER_TYPE",
-        "NUM_COMPRESSED_TEXTURE_FORMATS",
-        "NaN",
-        "NamedNodeMap",
-        "Navigator",
-        "NearbyLinks",
-        "NetworkInformation",
-        "Node",
-        "NodeFilter",
-        "NodeIterator",
-        "NodeList",
-        "Notation",
-        "Notification",
-        "NotifyPaintEvent",
-        "Number",
-        "NumberFormat",
-        "OBSOLETE",
-        "ONE",
-        "ONE_MINUS_CONSTANT_ALPHA",
-        "ONE_MINUS_CONSTANT_COLOR",
-        "ONE_MINUS_DST_ALPHA",
-        "ONE_MINUS_DST_COLOR",
-        "ONE_MINUS_SRC_ALPHA",
-        "ONE_MINUS_SRC_COLOR",
-        "OPEN",
-        "OPENED",
-        "OPENING",
-        "ORDERED_NODE_ITERATOR_TYPE",
-        "ORDERED_NODE_SNAPSHOT_TYPE",
-        "OUT_OF_MEMORY",
-        "Object",
-        "OfflineAudioCompletionEvent",
-        "OfflineAudioContext",
-        "OfflineResourceList",
-        "Option",
-        "OscillatorNode",
-        "OverflowEvent",
-        "PACK_ALIGNMENT",
-        "PAGE_RULE",
-        "PARSE_ERR",
-        "PATHSEG_ARC_ABS",
-        "PATHSEG_ARC_REL",
-        "PATHSEG_CLOSEPATH",
-        "PATHSEG_CURVETO_CUBIC_ABS",
-        "PATHSEG_CURVETO_CUBIC_REL",
-        "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS",
-        "PATHSEG_CURVETO_CUBIC_SMOOTH_REL",
-        "PATHSEG_CURVETO_QUADRATIC_ABS",
-        "PATHSEG_CURVETO_QUADRATIC_REL",
-        "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS",
-        "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL",
-        "PATHSEG_LINETO_ABS",
-        "PATHSEG_LINETO_HORIZONTAL_ABS",
-        "PATHSEG_LINETO_HORIZONTAL_REL",
-        "PATHSEG_LINETO_REL",
-        "PATHSEG_LINETO_VERTICAL_ABS",
-        "PATHSEG_LINETO_VERTICAL_REL",
-        "PATHSEG_MOVETO_ABS",
-        "PATHSEG_MOVETO_REL",
-        "PATHSEG_UNKNOWN",
-        "PATH_EXISTS_ERR",
-        "PEAKING",
-        "PERMISSION_DENIED",
-        "PERSISTENT",
-        "PI",
-        "PLAYING_STATE",
-        "POINTS",
-        "POLYGON_OFFSET_FACTOR",
-        "POLYGON_OFFSET_FILL",
-        "POLYGON_OFFSET_UNITS",
-        "POSITION_UNAVAILABLE",
-        "POSITIVE_INFINITY",
-        "PREV",
-        "PREV_NO_DUPLICATE",
-        "PROCESSING_INSTRUCTION_NODE",
-        "PageChangeEvent",
-        "PageTransitionEvent",
-        "PaintRequest",
-        "PaintRequestList",
-        "PannerNode",
-        "Path2D",
-        "Performance",
-        "PerformanceEntry",
-        "PerformanceMark",
-        "PerformanceMeasure",
-        "PerformanceNavigation",
-        "PerformanceResourceTiming",
-        "PerformanceTiming",
-        "PeriodicWave",
-        "Plugin",
-        "PluginArray",
-        "PopStateEvent",
-        "PopupBlockedEvent",
-        "ProcessingInstruction",
-        "ProgressEvent",
-        "Promise",
-        "PropertyNodeList",
-        "Proxy",
-        "PushManager",
-        "PushSubscription",
-        "Q",
-        "QUOTA_ERR",
-        "QUOTA_EXCEEDED_ERR",
-        "QueryInterface",
-        "READ_ONLY",
-        "READ_ONLY_ERR",
-        "READ_WRITE",
-        "RED_BITS",
-        "REMOVAL",
-        "RENDERBUFFER",
-        "RENDERBUFFER_ALPHA_SIZE",
-        "RENDERBUFFER_BINDING",
-        "RENDERBUFFER_BLUE_SIZE",
-        "RENDERBUFFER_DEPTH_SIZE",
-        "RENDERBUFFER_GREEN_SIZE",
-        "RENDERBUFFER_HEIGHT",
-        "RENDERBUFFER_INTERNAL_FORMAT",
-        "RENDERBUFFER_RED_SIZE",
-        "RENDERBUFFER_STENCIL_SIZE",
-        "RENDERBUFFER_WIDTH",
-        "RENDERER",
-        "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC",
-        "RENDERING_INTENT_AUTO",
-        "RENDERING_INTENT_PERCEPTUAL",
-        "RENDERING_INTENT_RELATIVE_COLORIMETRIC",
-        "RENDERING_INTENT_SATURATION",
-        "RENDERING_INTENT_UNKNOWN",
-        "REPEAT",
-        "REPLACE",
-        "RGB",
-        "RGB565",
-        "RGB5_A1",
-        "RGBA",
-        "RGBA4",
-        "RGBColor",
-        "ROTATION_CLOCKWISE",
-        "ROTATION_COUNTERCLOCKWISE",
-        "RTCDataChannelEvent",
-        "RTCIceCandidate",
-        "RTCPeerConnectionIceEvent",
-        "RTCRtpReceiver",
-        "RTCRtpSender",
-        "RTCSessionDescription",
-        "RTCStatsReport",
-        "RadioNodeList",
-        "Range",
-        "RangeError",
-        "RangeException",
-        "RecordErrorEvent",
-        "Rect",
-        "ReferenceError",
-        "RegExp",
-        "Request",
-        "Response",
-        "SAMPLER_2D",
-        "SAMPLER_CUBE",
-        "SAMPLES",
-        "SAMPLE_ALPHA_TO_COVERAGE",
-        "SAMPLE_BUFFERS",
-        "SAMPLE_COVERAGE",
-        "SAMPLE_COVERAGE_INVERT",
-        "SAMPLE_COVERAGE_VALUE",
-        "SAWTOOTH",
-        "SCHEDULED_STATE",
-        "SCISSOR_BOX",
-        "SCISSOR_TEST",
-        "SCROLL_PAGE_DOWN",
-        "SCROLL_PAGE_UP",
-        "SDP_ANSWER",
-        "SDP_OFFER",
-        "SDP_PRANSWER",
-        "SECURITY_ERR",
-        "SELECT",
-        "SERIALIZE_ERR",
-        "SEVERITY_ERROR",
-        "SEVERITY_FATAL_ERROR",
-        "SEVERITY_WARNING",
-        "SHADER_COMPILER",
-        "SHADER_TYPE",
-        "SHADING_LANGUAGE_VERSION",
-        "SHIFT_MASK",
-        "SHORT",
-        "SHOWING",
-        "SHOW_ALL",
-        "SHOW_ATTRIBUTE",
-        "SHOW_CDATA_SECTION",
-        "SHOW_COMMENT",
-        "SHOW_DOCUMENT",
-        "SHOW_DOCUMENT_FRAGMENT",
-        "SHOW_DOCUMENT_TYPE",
-        "SHOW_ELEMENT",
-        "SHOW_ENTITY",
-        "SHOW_ENTITY_REFERENCE",
-        "SHOW_NOTATION",
-        "SHOW_PROCESSING_INSTRUCTION",
-        "SHOW_TEXT",
-        "SINE",
-        "SOUNDFIELD",
-        "SQLException",
-        "SQRT1_2",
-        "SQRT2",
-        "SQUARE",
-        "SRC_ALPHA",
-        "SRC_ALPHA_SATURATE",
-        "SRC_COLOR",
-        "START_TO_END",
-        "START_TO_START",
-        "STATIC_DRAW",
-        "STENCIL_ATTACHMENT",
-        "STENCIL_BACK_FAIL",
-        "STENCIL_BACK_FUNC",
-        "STENCIL_BACK_PASS_DEPTH_FAIL",
-        "STENCIL_BACK_PASS_DEPTH_PASS",
-        "STENCIL_BACK_REF",
-        "STENCIL_BACK_VALUE_MASK",
-        "STENCIL_BACK_WRITEMASK",
-        "STENCIL_BITS",
-        "STENCIL_BUFFER_BIT",
-        "STENCIL_CLEAR_VALUE",
-        "STENCIL_FAIL",
-        "STENCIL_FUNC",
-        "STENCIL_INDEX",
-        "STENCIL_INDEX8",
-        "STENCIL_PASS_DEPTH_FAIL",
-        "STENCIL_PASS_DEPTH_PASS",
-        "STENCIL_REF",
-        "STENCIL_TEST",
-        "STENCIL_VALUE_MASK",
-        "STENCIL_WRITEMASK",
-        "STREAM_DRAW",
-        "STRING_TYPE",
-        "STYLE_RULE",
-        "SUBPIXEL_BITS",
-        "SUPPORTS_RULE",
-        "SVGAElement",
-        "SVGAltGlyphDefElement",
-        "SVGAltGlyphElement",
-        "SVGAltGlyphItemElement",
-        "SVGAngle",
-        "SVGAnimateColorElement",
-        "SVGAnimateElement",
-        "SVGAnimateMotionElement",
-        "SVGAnimateTransformElement",
-        "SVGAnimatedAngle",
-        "SVGAnimatedBoolean",
-        "SVGAnimatedEnumeration",
-        "SVGAnimatedInteger",
-        "SVGAnimatedLength",
-        "SVGAnimatedLengthList",
-        "SVGAnimatedNumber",
-        "SVGAnimatedNumberList",
-        "SVGAnimatedPreserveAspectRatio",
-        "SVGAnimatedRect",
-        "SVGAnimatedString",
-        "SVGAnimatedTransformList",
-        "SVGAnimationElement",
-        "SVGCircleElement",
-        "SVGClipPathElement",
-        "SVGColor",
-        "SVGComponentTransferFunctionElement",
-        "SVGCursorElement",
-        "SVGDefsElement",
-        "SVGDescElement",
-        "SVGDiscardElement",
-        "SVGDocument",
-        "SVGElement",
-        "SVGElementInstance",
-        "SVGElementInstanceList",
-        "SVGEllipseElement",
-        "SVGException",
-        "SVGFEBlendElement",
-        "SVGFEColorMatrixElement",
-        "SVGFEComponentTransferElement",
-        "SVGFECompositeElement",
-        "SVGFEConvolveMatrixElement",
-        "SVGFEDiffuseLightingElement",
-        "SVGFEDisplacementMapElement",
-        "SVGFEDistantLightElement",
-        "SVGFEDropShadowElement",
-        "SVGFEFloodElement",
-        "SVGFEFuncAElement",
-        "SVGFEFuncBElement",
-        "SVGFEFuncGElement",
-        "SVGFEFuncRElement",
-        "SVGFEGaussianBlurElement",
-        "SVGFEImageElement",
-        "SVGFEMergeElement",
-        "SVGFEMergeNodeElement",
-        "SVGFEMorphologyElement",
-        "SVGFEOffsetElement",
-        "SVGFEPointLightElement",
-        "SVGFESpecularLightingElement",
-        "SVGFESpotLightElement",
-        "SVGFETileElement",
-        "SVGFETurbulenceElement",
-        "SVGFilterElement",
-        "SVGFontElement",
-        "SVGFontFaceElement",
-        "SVGFontFaceFormatElement",
-        "SVGFontFaceNameElement",
-        "SVGFontFaceSrcElement",
-        "SVGFontFaceUriElement",
-        "SVGForeignObjectElement",
-        "SVGGElement",
-        "SVGGeometryElement",
-        "SVGGlyphElement",
-        "SVGGlyphRefElement",
-        "SVGGradientElement",
-        "SVGGraphicsElement",
-        "SVGHKernElement",
-        "SVGImageElement",
-        "SVGLength",
-        "SVGLengthList",
-        "SVGLineElement",
-        "SVGLinearGradientElement",
-        "SVGMPathElement",
-        "SVGMarkerElement",
-        "SVGMaskElement",
-        "SVGMatrix",
-        "SVGMetadataElement",
-        "SVGMissingGlyphElement",
-        "SVGNumber",
-        "SVGNumberList",
-        "SVGPaint",
-        "SVGPathElement",
-        "SVGPathSeg",
-        "SVGPathSegArcAbs",
-        "SVGPathSegArcRel",
-        "SVGPathSegClosePath",
-        "SVGPathSegCurvetoCubicAbs",
-        "SVGPathSegCurvetoCubicRel",
-        "SVGPathSegCurvetoCubicSmoothAbs",
-        "SVGPathSegCurvetoCubicSmoothRel",
-        "SVGPathSegCurvetoQuadraticAbs",
-        "SVGPathSegCurvetoQuadraticRel",
-        "SVGPathSegCurvetoQuadraticSmoothAbs",
-        "SVGPathSegCurvetoQuadraticSmoothRel",
-        "SVGPathSegLinetoAbs",
-        "SVGPathSegLinetoHorizontalAbs",
-        "SVGPathSegLinetoHorizontalRel",
-        "SVGPathSegLinetoRel",
-        "SVGPathSegLinetoVerticalAbs",
-        "SVGPathSegLinetoVerticalRel",
-        "SVGPathSegList",
-        "SVGPathSegMovetoAbs",
-        "SVGPathSegMovetoRel",
-        "SVGPatternElement",
-        "SVGPoint",
-        "SVGPointList",
-        "SVGPolygonElement",
-        "SVGPolylineElement",
-        "SVGPreserveAspectRatio",
-        "SVGRadialGradientElement",
-        "SVGRect",
-        "SVGRectElement",
-        "SVGRenderingIntent",
-        "SVGSVGElement",
-        "SVGScriptElement",
-        "SVGSetElement",
-        "SVGStopElement",
-        "SVGStringList",
-        "SVGStyleElement",
-        "SVGSwitchElement",
-        "SVGSymbolElement",
-        "SVGTRefElement",
-        "SVGTSpanElement",
-        "SVGTextContentElement",
-        "SVGTextElement",
-        "SVGTextPathElement",
-        "SVGTextPositioningElement",
-        "SVGTitleElement",
-        "SVGTransform",
-        "SVGTransformList",
-        "SVGUnitTypes",
-        "SVGUseElement",
-        "SVGVKernElement",
-        "SVGViewElement",
-        "SVGViewSpec",
-        "SVGZoomAndPan",
-        "SVGZoomEvent",
-        "SVG_ANGLETYPE_DEG",
-        "SVG_ANGLETYPE_GRAD",
-        "SVG_ANGLETYPE_RAD",
-        "SVG_ANGLETYPE_UNKNOWN",
-        "SVG_ANGLETYPE_UNSPECIFIED",
-        "SVG_CHANNEL_A",
-        "SVG_CHANNEL_B",
-        "SVG_CHANNEL_G",
-        "SVG_CHANNEL_R",
-        "SVG_CHANNEL_UNKNOWN",
-        "SVG_COLORTYPE_CURRENTCOLOR",
-        "SVG_COLORTYPE_RGBCOLOR",
-        "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR",
-        "SVG_COLORTYPE_UNKNOWN",
-        "SVG_EDGEMODE_DUPLICATE",
-        "SVG_EDGEMODE_NONE",
-        "SVG_EDGEMODE_UNKNOWN",
-        "SVG_EDGEMODE_WRAP",
-        "SVG_FEBLEND_MODE_COLOR",
-        "SVG_FEBLEND_MODE_COLOR_BURN",
-        "SVG_FEBLEND_MODE_COLOR_DODGE",
-        "SVG_FEBLEND_MODE_DARKEN",
-        "SVG_FEBLEND_MODE_DIFFERENCE",
-        "SVG_FEBLEND_MODE_EXCLUSION",
-        "SVG_FEBLEND_MODE_HARD_LIGHT",
-        "SVG_FEBLEND_MODE_HUE",
-        "SVG_FEBLEND_MODE_LIGHTEN",
-        "SVG_FEBLEND_MODE_LUMINOSITY",
-        "SVG_FEBLEND_MODE_MULTIPLY",
-        "SVG_FEBLEND_MODE_NORMAL",
-        "SVG_FEBLEND_MODE_OVERLAY",
-        "SVG_FEBLEND_MODE_SATURATION",
-        "SVG_FEBLEND_MODE_SCREEN",
-        "SVG_FEBLEND_MODE_SOFT_LIGHT",
-        "SVG_FEBLEND_MODE_UNKNOWN",
-        "SVG_FECOLORMATRIX_TYPE_HUEROTATE",
-        "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA",
-        "SVG_FECOLORMATRIX_TYPE_MATRIX",
-        "SVG_FECOLORMATRIX_TYPE_SATURATE",
-        "SVG_FECOLORMATRIX_TYPE_UNKNOWN",
-        "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE",
-        "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA",
-        "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY",
-        "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR",
-        "SVG_FECOMPONENTTRANSFER_TYPE_TABLE",
-        "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN",
-        "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC",
-        "SVG_FECOMPOSITE_OPERATOR_ATOP",
-        "SVG_FECOMPOSITE_OPERATOR_IN",
-        "SVG_FECOMPOSITE_OPERATOR_OUT",
-        "SVG_FECOMPOSITE_OPERATOR_OVER",
-        "SVG_FECOMPOSITE_OPERATOR_UNKNOWN",
-        "SVG_FECOMPOSITE_OPERATOR_XOR",
-        "SVG_INVALID_VALUE_ERR",
-        "SVG_LENGTHTYPE_CM",
-        "SVG_LENGTHTYPE_EMS",
-        "SVG_LENGTHTYPE_EXS",
-        "SVG_LENGTHTYPE_IN",
-        "SVG_LENGTHTYPE_MM",
-        "SVG_LENGTHTYPE_NUMBER",
-        "SVG_LENGTHTYPE_PC",
-        "SVG_LENGTHTYPE_PERCENTAGE",
-        "SVG_LENGTHTYPE_PT",
-        "SVG_LENGTHTYPE_PX",
-        "SVG_LENGTHTYPE_UNKNOWN",
-        "SVG_MARKERUNITS_STROKEWIDTH",
-        "SVG_MARKERUNITS_UNKNOWN",
-        "SVG_MARKERUNITS_USERSPACEONUSE",
-        "SVG_MARKER_ORIENT_ANGLE",
-        "SVG_MARKER_ORIENT_AUTO",
-        "SVG_MARKER_ORIENT_UNKNOWN",
-        "SVG_MASKTYPE_ALPHA",
-        "SVG_MASKTYPE_LUMINANCE",
-        "SVG_MATRIX_NOT_INVERTABLE",
-        "SVG_MEETORSLICE_MEET",
-        "SVG_MEETORSLICE_SLICE",
-        "SVG_MEETORSLICE_UNKNOWN",
-        "SVG_MORPHOLOGY_OPERATOR_DILATE",
-        "SVG_MORPHOLOGY_OPERATOR_ERODE",
-        "SVG_MORPHOLOGY_OPERATOR_UNKNOWN",
-        "SVG_PAINTTYPE_CURRENTCOLOR",
-        "SVG_PAINTTYPE_NONE",
-        "SVG_PAINTTYPE_RGBCOLOR",
-        "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR",
-        "SVG_PAINTTYPE_UNKNOWN",
-        "SVG_PAINTTYPE_URI",
-        "SVG_PAINTTYPE_URI_CURRENTCOLOR",
-        "SVG_PAINTTYPE_URI_NONE",
-        "SVG_PAINTTYPE_URI_RGBCOLOR",
-        "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR",
-        "SVG_PRESERVEASPECTRATIO_NONE",
-        "SVG_PRESERVEASPECTRATIO_UNKNOWN",
-        "SVG_PRESERVEASPECTRATIO_XMAXYMAX",
-        "SVG_PRESERVEASPECTRATIO_XMAXYMID",
-        "SVG_PRESERVEASPECTRATIO_XMAXYMIN",
-        "SVG_PRESERVEASPECTRATIO_XMIDYMAX",
-        "SVG_PRESERVEASPECTRATIO_XMIDYMID",
-        "SVG_PRESERVEASPECTRATIO_XMIDYMIN",
-        "SVG_PRESERVEASPECTRATIO_XMINYMAX",
-        "SVG_PRESERVEASPECTRATIO_XMINYMID",
-        "SVG_PRESERVEASPECTRATIO_XMINYMIN",
-        "SVG_SPREADMETHOD_PAD",
-        "SVG_SPREADMETHOD_REFLECT",
-        "SVG_SPREADMETHOD_REPEAT",
-        "SVG_SPREADMETHOD_UNKNOWN",
-        "SVG_STITCHTYPE_NOSTITCH",
-        "SVG_STITCHTYPE_STITCH",
-        "SVG_STITCHTYPE_UNKNOWN",
-        "SVG_TRANSFORM_MATRIX",
-        "SVG_TRANSFORM_ROTATE",
-        "SVG_TRANSFORM_SCALE",
-        "SVG_TRANSFORM_SKEWX",
-        "SVG_TRANSFORM_SKEWY",
-        "SVG_TRANSFORM_TRANSLATE",
-        "SVG_TRANSFORM_UNKNOWN",
-        "SVG_TURBULENCE_TYPE_FRACTALNOISE",
-        "SVG_TURBULENCE_TYPE_TURBULENCE",
-        "SVG_TURBULENCE_TYPE_UNKNOWN",
-        "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX",
-        "SVG_UNIT_TYPE_UNKNOWN",
-        "SVG_UNIT_TYPE_USERSPACEONUSE",
-        "SVG_WRONG_TYPE_ERR",
-        "SVG_ZOOMANDPAN_DISABLE",
-        "SVG_ZOOMANDPAN_MAGNIFY",
-        "SVG_ZOOMANDPAN_UNKNOWN",
-        "SYNTAX_ERR",
-        "SavedPages",
-        "Screen",
-        "ScreenOrientation",
-        "Script",
-        "ScriptProcessorNode",
-        "ScrollAreaEvent",
-        "SecurityPolicyViolationEvent",
-        "Selection",
-        "ServiceWorker",
-        "ServiceWorkerContainer",
-        "ServiceWorkerRegistration",
-        "SessionDescription",
-        "Set",
-        "ShadowRoot",
-        "SharedWorker",
-        "SimpleGestureEvent",
-        "SpeechSynthesisEvent",
-        "SpeechSynthesisUtterance",
-        "StopIteration",
-        "Storage",
-        "StorageEvent",
-        "String",
-        "StyleSheet",
-        "StyleSheetList",
-        "SubtleCrypto",
-        "Symbol",
-        "SyntaxError",
-        "TEMPORARY",
-        "TEXTPATH_METHODTYPE_ALIGN",
-        "TEXTPATH_METHODTYPE_STRETCH",
-        "TEXTPATH_METHODTYPE_UNKNOWN",
-        "TEXTPATH_SPACINGTYPE_AUTO",
-        "TEXTPATH_SPACINGTYPE_EXACT",
-        "TEXTPATH_SPACINGTYPE_UNKNOWN",
-        "TEXTURE",
-        "TEXTURE0",
-        "TEXTURE1",
-        "TEXTURE10",
-        "TEXTURE11",
-        "TEXTURE12",
-        "TEXTURE13",
-        "TEXTURE14",
-        "TEXTURE15",
-        "TEXTURE16",
-        "TEXTURE17",
-        "TEXTURE18",
-        "TEXTURE19",
-        "TEXTURE2",
-        "TEXTURE20",
-        "TEXTURE21",
-        "TEXTURE22",
-        "TEXTURE23",
-        "TEXTURE24",
-        "TEXTURE25",
-        "TEXTURE26",
-        "TEXTURE27",
-        "TEXTURE28",
-        "TEXTURE29",
-        "TEXTURE3",
-        "TEXTURE30",
-        "TEXTURE31",
-        "TEXTURE4",
-        "TEXTURE5",
-        "TEXTURE6",
-        "TEXTURE7",
-        "TEXTURE8",
-        "TEXTURE9",
-        "TEXTURE_2D",
-        "TEXTURE_BINDING_2D",
-        "TEXTURE_BINDING_CUBE_MAP",
-        "TEXTURE_CUBE_MAP",
-        "TEXTURE_CUBE_MAP_NEGATIVE_X",
-        "TEXTURE_CUBE_MAP_NEGATIVE_Y",
-        "TEXTURE_CUBE_MAP_NEGATIVE_Z",
-        "TEXTURE_CUBE_MAP_POSITIVE_X",
-        "TEXTURE_CUBE_MAP_POSITIVE_Y",
-        "TEXTURE_CUBE_MAP_POSITIVE_Z",
-        "TEXTURE_MAG_FILTER",
-        "TEXTURE_MAX_ANISOTROPY_EXT",
-        "TEXTURE_MIN_FILTER",
-        "TEXTURE_WRAP_S",
-        "TEXTURE_WRAP_T",
-        "TEXT_NODE",
-        "TIMEOUT",
-        "TIMEOUT_ERR",
-        "TOO_LARGE_ERR",
-        "TRANSACTION_INACTIVE_ERR",
-        "TRIANGLE",
-        "TRIANGLES",
-        "TRIANGLE_FAN",
-        "TRIANGLE_STRIP",
-        "TYPE_BACK_FORWARD",
-        "TYPE_ERR",
-        "TYPE_MISMATCH_ERR",
-        "TYPE_NAVIGATE",
-        "TYPE_RELOAD",
-        "TYPE_RESERVED",
-        "Text",
-        "TextDecoder",
-        "TextEncoder",
-        "TextEvent",
-        "TextMetrics",
-        "TextTrack",
-        "TextTrackCue",
-        "TextTrackCueList",
-        "TextTrackList",
-        "TimeEvent",
-        "TimeRanges",
-        "Touch",
-        "TouchEvent",
-        "TouchList",
-        "TrackEvent",
-        "TransitionEvent",
-        "TreeWalker",
-        "TypeError",
-        "UIEvent",
-        "UNCACHED",
-        "UNKNOWN_ERR",
-        "UNKNOWN_RULE",
-        "UNMASKED_RENDERER_WEBGL",
-        "UNMASKED_VENDOR_WEBGL",
-        "UNORDERED_NODE_ITERATOR_TYPE",
-        "UNORDERED_NODE_SNAPSHOT_TYPE",
-        "UNPACK_ALIGNMENT",
-        "UNPACK_COLORSPACE_CONVERSION_WEBGL",
-        "UNPACK_FLIP_Y_WEBGL",
-        "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
-        "UNSCHEDULED_STATE",
-        "UNSENT",
-        "UNSIGNED_BYTE",
-        "UNSIGNED_INT",
-        "UNSIGNED_SHORT",
-        "UNSIGNED_SHORT_4_4_4_4",
-        "UNSIGNED_SHORT_5_5_5_1",
-        "UNSIGNED_SHORT_5_6_5",
-        "UNSPECIFIED_EVENT_TYPE_ERR",
-        "UPDATEREADY",
-        "URIError",
-        "URL",
-        "URLSearchParams",
-        "URLUnencoded",
-        "URL_MISMATCH_ERR",
-        "UTC",
-        "Uint16Array",
-        "Uint32Array",
-        "Uint8Array",
-        "Uint8ClampedArray",
-        "UserMessageHandler",
-        "UserMessageHandlersNamespace",
-        "UserProximityEvent",
-        "VALIDATE_STATUS",
-        "VALIDATION_ERR",
-        "VARIABLES_RULE",
-        "VENDOR",
-        "VERSION",
-        "VERSION_CHANGE",
-        "VERSION_ERR",
-        "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",
-        "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",
-        "VERTEX_ATTRIB_ARRAY_ENABLED",
-        "VERTEX_ATTRIB_ARRAY_NORMALIZED",
-        "VERTEX_ATTRIB_ARRAY_POINTER",
-        "VERTEX_ATTRIB_ARRAY_SIZE",
-        "VERTEX_ATTRIB_ARRAY_STRIDE",
-        "VERTEX_ATTRIB_ARRAY_TYPE",
-        "VERTEX_SHADER",
-        "VERTICAL",
-        "VERTICAL_AXIS",
-        "VER_ERR",
-        "VIEWPORT",
-        "VIEWPORT_RULE",
-        "VTTCue",
-        "VTTRegion",
-        "ValidityState",
-        "VideoStreamTrack",
-        "WEBKIT_FILTER_RULE",
-        "WEBKIT_KEYFRAMES_RULE",
-        "WEBKIT_KEYFRAME_RULE",
-        "WEBKIT_REGION_RULE",
-        "WRONG_DOCUMENT_ERR",
-        "WaveShaperNode",
-        "WeakMap",
-        "WeakSet",
-        "WebGLActiveInfo",
-        "WebGLBuffer",
-        "WebGLContextEvent",
-        "WebGLFramebuffer",
-        "WebGLProgram",
-        "WebGLRenderbuffer",
-        "WebGLRenderingContext",
-        "WebGLShader",
-        "WebGLShaderPrecisionFormat",
-        "WebGLTexture",
-        "WebGLUniformLocation",
-        "WebGLVertexArray",
-        "WebKitAnimationEvent",
-        "WebKitBlobBuilder",
-        "WebKitCSSFilterRule",
-        "WebKitCSSFilterValue",
-        "WebKitCSSKeyframeRule",
-        "WebKitCSSKeyframesRule",
-        "WebKitCSSMatrix",
-        "WebKitCSSRegionRule",
-        "WebKitCSSTransformValue",
-        "WebKitDataCue",
-        "WebKitGamepad",
-        "WebKitMediaKeyError",
-        "WebKitMediaKeyMessageEvent",
-        "WebKitMediaKeySession",
-        "WebKitMediaKeys",
-        "WebKitMediaSource",
-        "WebKitMutationObserver",
-        "WebKitNamespace",
-        "WebKitPlaybackTargetAvailabilityEvent",
-        "WebKitPoint",
-        "WebKitShadowRoot",
-        "WebKitSourceBuffer",
-        "WebKitSourceBufferList",
-        "WebKitTransitionEvent",
-        "WebSocket",
-        "WheelEvent",
-        "Window",
-        "Worker",
-        "XMLDocument",
-        "XMLHttpRequest",
-        "XMLHttpRequestEventTarget",
-        "XMLHttpRequestException",
-        "XMLHttpRequestProgressEvent",
-        "XMLHttpRequestUpload",
-        "XMLSerializer",
-        "XMLStylesheetProcessingInstruction",
-        "XPathEvaluator",
-        "XPathException",
-        "XPathExpression",
-        "XPathNSResolver",
-        "XPathResult",
-        "XSLTProcessor",
-        "ZERO",
-        "_XD0M_",
-        "_YD0M_",
-        "__defineGetter__",
-        "__defineSetter__",
-        "__lookupGetter__",
-        "__lookupSetter__",
-        "__opera",
-        "__proto__",
-        "_browserjsran",
-        "a",
-        "aLink",
-        "abbr",
-        "abort",
-        "abs",
-        "absolute",
-        "acceleration",
-        "accelerationIncludingGravity",
-        "accelerator",
-        "accept",
-        "acceptCharset",
-        "acceptNode",
-        "accessKey",
-        "accessKeyLabel",
-        "accuracy",
-        "acos",
-        "acosh",
-        "action",
-        "actionURL",
-        "active",
-        "activeCues",
-        "activeElement",
-        "activeSourceBuffers",
-        "activeSourceCount",
-        "activeTexture",
-        "add",
-        "addBehavior",
-        "addCandidate",
-        "addColorStop",
-        "addCue",
-        "addElement",
-        "addEventListener",
-        "addFilter",
-        "addFromString",
-        "addFromUri",
-        "addIceCandidate",
-        "addImport",
-        "addListener",
-        "addNamed",
-        "addPageRule",
-        "addPath",
-        "addPointer",
-        "addRange",
-        "addRegion",
-        "addRule",
-        "addSearchEngine",
-        "addSourceBuffer",
-        "addStream",
-        "addTextTrack",
-        "addTrack",
-        "addWakeLockListener",
-        "addedNodes",
-        "additionalName",
-        "additiveSymbols",
-        "addons",
-        "adoptNode",
-        "adr",
-        "advance",
-        "alert",
-        "algorithm",
-        "align",
-        "align-content",
-        "align-items",
-        "align-self",
-        "alignContent",
-        "alignItems",
-        "alignSelf",
-        "alignmentBaseline",
-        "alinkColor",
-        "all",
-        "allowFullscreen",
-        "allowedDirections",
-        "alpha",
-        "alt",
-        "altGraphKey",
-        "altHtml",
-        "altKey",
-        "altLeft",
-        "altitude",
-        "altitudeAccuracy",
-        "amplitude",
-        "ancestorOrigins",
-        "anchor",
-        "anchorNode",
-        "anchorOffset",
-        "anchors",
-        "angle",
-        "animVal",
-        "animate",
-        "animatedInstanceRoot",
-        "animatedNormalizedPathSegList",
-        "animatedPathSegList",
-        "animatedPoints",
-        "animation",
-        "animation-delay",
-        "animation-direction",
-        "animation-duration",
-        "animation-fill-mode",
-        "animation-iteration-count",
-        "animation-name",
-        "animation-play-state",
-        "animation-timing-function",
-        "animationDelay",
-        "animationDirection",
-        "animationDuration",
-        "animationFillMode",
-        "animationIterationCount",
-        "animationName",
-        "animationPlayState",
-        "animationStartTime",
-        "animationTimingFunction",
-        "animationsPaused",
-        "anniversary",
-        "app",
-        "appCodeName",
-        "appMinorVersion",
-        "appName",
-        "appNotifications",
-        "appVersion",
-        "append",
-        "appendBuffer",
-        "appendChild",
-        "appendData",
-        "appendItem",
-        "appendMedium",
-        "appendNamed",
-        "appendRule",
-        "appendStream",
-        "appendWindowEnd",
-        "appendWindowStart",
-        "applets",
-        "applicationCache",
-        "apply",
-        "applyElement",
-        "arc",
-        "arcTo",
-        "archive",
-        "areas",
-        "arguments",
-        "arrayBuffer",
-        "asin",
-        "asinh",
-        "assert",
-        "assign",
-        "async",
-        "atEnd",
-        "atan",
-        "atan2",
-        "atanh",
-        "atob",
-        "attachEvent",
-        "attachShader",
-        "attachments",
-        "attack",
-        "attrChange",
-        "attrName",
-        "attributeName",
-        "attributeNamespace",
-        "attributes",
-        "audioTracks",
-        "autoIncrement",
-        "autobuffer",
-        "autocapitalize",
-        "autocomplete",
-        "autocorrect",
-        "autofocus",
-        "autoplay",
-        "availHeight",
-        "availLeft",
-        "availTop",
-        "availWidth",
-        "availability",
-        "available",
-        "aversion",
-        "axes",
-        "axis",
-        "azimuth",
-        "b",
-        "back",
-        "backface-visibility",
-        "backfaceVisibility",
-        "background",
-        "background-attachment",
-        "background-blend-mode",
-        "background-clip",
-        "background-color",
-        "background-image",
-        "background-origin",
-        "background-position",
-        "background-repeat",
-        "background-size",
-        "backgroundAttachment",
-        "backgroundBlendMode",
-        "backgroundClip",
-        "backgroundColor",
-        "backgroundImage",
-        "backgroundOrigin",
-        "backgroundPosition",
-        "backgroundPositionX",
-        "backgroundPositionY",
-        "backgroundRepeat",
-        "backgroundSize",
-        "badInput",
-        "balance",
-        "baseFrequencyX",
-        "baseFrequencyY",
-        "baseNode",
-        "baseOffset",
-        "baseURI",
-        "baseVal",
-        "baselineShift",
-        "battery",
-        "bday",
-        "beginElement",
-        "beginElementAt",
-        "beginPath",
-        "behavior",
-        "behaviorCookie",
-        "behaviorPart",
-        "behaviorUrns",
-        "beta",
-        "bezierCurveTo",
-        "bgColor",
-        "bgProperties",
-        "bias",
-        "big",
-        "binaryType",
-        "bind",
-        "bindAttribLocation",
-        "bindBuffer",
-        "bindFramebuffer",
-        "bindRenderbuffer",
-        "bindTexture",
-        "blendColor",
-        "blendEquation",
-        "blendEquationSeparate",
-        "blendFunc",
-        "blendFuncSeparate",
-        "blink",
-        "blob",
-        "blockDirection",
-        "blue",
-        "blur",
-        "body",
-        "bodyUsed",
-        "bold",
-        "bookmarks",
-        "booleanValue",
-        "border",
-        "border-bottom",
-        "border-bottom-color",
-        "border-bottom-left-radius",
-        "border-bottom-right-radius",
-        "border-bottom-style",
-        "border-bottom-width",
-        "border-collapse",
-        "border-color",
-        "border-image",
-        "border-image-outset",
-        "border-image-repeat",
-        "border-image-slice",
-        "border-image-source",
-        "border-image-width",
-        "border-left",
-        "border-left-color",
-        "border-left-style",
-        "border-left-width",
-        "border-radius",
-        "border-right",
-        "border-right-color",
-        "border-right-style",
-        "border-right-width",
-        "border-spacing",
-        "border-style",
-        "border-top",
-        "border-top-color",
-        "border-top-left-radius",
-        "border-top-right-radius",
-        "border-top-style",
-        "border-top-width",
-        "border-width",
-        "borderBottom",
-        "borderBottomColor",
-        "borderBottomLeftRadius",
-        "borderBottomRightRadius",
-        "borderBottomStyle",
-        "borderBottomWidth",
-        "borderCollapse",
-        "borderColor",
-        "borderColorDark",
-        "borderColorLight",
-        "borderImage",
-        "borderImageOutset",
-        "borderImageRepeat",
-        "borderImageSlice",
-        "borderImageSource",
-        "borderImageWidth",
-        "borderLeft",
-        "borderLeftColor",
-        "borderLeftStyle",
-        "borderLeftWidth",
-        "borderRadius",
-        "borderRight",
-        "borderRightColor",
-        "borderRightStyle",
-        "borderRightWidth",
-        "borderSpacing",
-        "borderStyle",
-        "borderTop",
-        "borderTopColor",
-        "borderTopLeftRadius",
-        "borderTopRightRadius",
-        "borderTopStyle",
-        "borderTopWidth",
-        "borderWidth",
-        "bottom",
-        "bottomMargin",
-        "bound",
-        "boundElements",
-        "boundingClientRect",
-        "boundingHeight",
-        "boundingLeft",
-        "boundingTop",
-        "boundingWidth",
-        "bounds",
-        "box-decoration-break",
-        "box-shadow",
-        "box-sizing",
-        "boxDecorationBreak",
-        "boxShadow",
-        "boxSizing",
-        "breakAfter",
-        "breakBefore",
-        "breakInside",
-        "browserLanguage",
-        "btoa",
-        "bubbles",
-        "buffer",
-        "bufferData",
-        "bufferDepth",
-        "bufferSize",
-        "bufferSubData",
-        "buffered",
-        "bufferedAmount",
-        "buildID",
-        "buildNumber",
-        "button",
-        "buttonID",
-        "buttons",
-        "byteLength",
-        "byteOffset",
-        "c",
-        "call",
-        "caller",
-        "canBeFormatted",
-        "canBeMounted",
-        "canBeShared",
-        "canHaveChildren",
-        "canHaveHTML",
-        "canPlayType",
-        "cancel",
-        "cancelAnimationFrame",
-        "cancelBubble",
-        "cancelScheduledValues",
-        "cancelable",
-        "candidate",
-        "canvas",
-        "caption",
-        "caption-side",
-        "captionSide",
-        "captureEvents",
-        "captureStackTrace",
-        "caretPositionFromPoint",
-        "caretRangeFromPoint",
-        "cast",
-        "catch",
-        "category",
-        "cbrt",
-        "cd",
-        "ceil",
-        "cellIndex",
-        "cellPadding",
-        "cellSpacing",
-        "cells",
-        "ch",
-        "chOff",
-        "chain",
-        "challenge",
-        "changedTouches",
-        "channel",
-        "channelCount",
-        "channelCountMode",
-        "channelInterpretation",
-        "char",
-        "charAt",
-        "charCode",
-        "charCodeAt",
-        "charIndex",
-        "characterSet",
-        "charging",
-        "chargingTime",
-        "charset",
-        "checkEnclosure",
-        "checkFramebufferStatus",
-        "checkIntersection",
-        "checkValidity",
-        "checked",
-        "childElementCount",
-        "childNodes",
-        "children",
-        "chrome",
-        "ciphertext",
-        "cite",
-        "classList",
-        "className",
-        "classid",
-        "clear",
-        "clearAttributes",
-        "clearColor",
-        "clearData",
-        "clearDepth",
-        "clearImmediate",
-        "clearInterval",
-        "clearMarks",
-        "clearMeasures",
-        "clearParameters",
-        "clearRect",
-        "clearResourceTimings",
-        "clearShadow",
-        "clearStencil",
-        "clearTimeout",
-        "clearWatch",
-        "click",
-        "clickCount",
-        "clientHeight",
-        "clientInformation",
-        "clientLeft",
-        "clientRect",
-        "clientRects",
-        "clientTop",
-        "clientWidth",
-        "clientX",
-        "clientY",
-        "clip",
-        "clip-path",
-        "clip-rule",
-        "clipBottom",
-        "clipLeft",
-        "clipPath",
-        "clipPathUnits",
-        "clipRight",
-        "clipRule",
-        "clipTop",
-        "clipboardData",
-        "clone",
-        "cloneContents",
-        "cloneNode",
-        "cloneRange",
-        "close",
-        "closePath",
-        "closed",
-        "closest",
-        "clz",
-        "clz32",
-        "cmp",
-        "code",
-        "codeBase",
-        "codePointAt",
-        "codeType",
-        "colSpan",
-        "collapse",
-        "collapseToEnd",
-        "collapseToStart",
-        "collapsed",
-        "collect",
-        "colno",
-        "color",
-        "color-interpolation",
-        "color-interpolation-filters",
-        "colorDepth",
-        "colorInterpolation",
-        "colorInterpolationFilters",
-        "colorMask",
-        "colorType",
-        "cols",
-        "columnCount",
-        "columnFill",
-        "columnGap",
-        "columnNumber",
-        "columnRule",
-        "columnRuleColor",
-        "columnRuleStyle",
-        "columnRuleWidth",
-        "columnSpan",
-        "columnWidth",
-        "columns",
-        "command",
-        "commitPreferences",
-        "commonAncestorContainer",
-        "compact",
-        "compareBoundaryPoints",
-        "compareDocumentPosition",
-        "compareEndPoints",
-        "compareNode",
-        "comparePoint",
-        "compatMode",
-        "compatible",
-        "compile",
-        "compileShader",
-        "complete",
-        "componentFromPoint",
-        "compositionEndOffset",
-        "compositionStartOffset",
-        "compressedTexImage2D",
-        "compressedTexSubImage2D",
-        "concat",
-        "conditionText",
-        "coneInnerAngle",
-        "coneOuterAngle",
-        "coneOuterGain",
-        "confirm",
-        "confirmComposition",
-        "confirmSiteSpecificTrackingException",
-        "confirmWebWideTrackingException",
-        "connect",
-        "connectEnd",
-        "connectStart",
-        "connected",
-        "connection",
-        "connectionSpeed",
-        "console",
-        "consolidate",
-        "constrictionActive",
-        "constructor",
-        "contactID",
-        "contains",
-        "containsNode",
-        "content",
-        "contentDocument",
-        "contentEditable",
-        "contentOverflow",
-        "contentScriptType",
-        "contentStyleType",
-        "contentType",
-        "contentWindow",
-        "context",
-        "contextMenu",
-        "contextmenu",
-        "continue",
-        "continuous",
-        "control",
-        "controller",
-        "controls",
-        "convertToSpecifiedUnits",
-        "cookie",
-        "cookieEnabled",
-        "coords",
-        "copyFromChannel",
-        "copyTexImage2D",
-        "copyTexSubImage2D",
-        "copyToChannel",
-        "copyWithin",
-        "correspondingElement",
-        "correspondingUseElement",
-        "cos",
-        "cosh",
-        "count",
-        "counter-increment",
-        "counter-reset",
-        "counterIncrement",
-        "counterReset",
-        "cpuClass",
-        "cpuSleepAllowed",
-        "create",
-        "createAnalyser",
-        "createAnswer",
-        "createAttribute",
-        "createAttributeNS",
-        "createBiquadFilter",
-        "createBuffer",
-        "createBufferSource",
-        "createCDATASection",
-        "createCSSStyleSheet",
-        "createCaption",
-        "createChannelMerger",
-        "createChannelSplitter",
-        "createComment",
-        "createContextualFragment",
-        "createControlRange",
-        "createConvolver",
-        "createDTMFSender",
-        "createDataChannel",
-        "createDelay",
-        "createDelayNode",
-        "createDocument",
-        "createDocumentFragment",
-        "createDocumentType",
-        "createDynamicsCompressor",
-        "createElement",
-        "createElementNS",
-        "createEntityReference",
-        "createEvent",
-        "createEventObject",
-        "createExpression",
-        "createFramebuffer",
-        "createFunction",
-        "createGain",
-        "createGainNode",
-        "createHTMLDocument",
-        "createImageBitmap",
-        "createImageData",
-        "createIndex",
-        "createJavaScriptNode",
-        "createLinearGradient",
-        "createMediaElementSource",
-        "createMediaKeys",
-        "createMediaStreamDestination",
-        "createMediaStreamSource",
-        "createMutableFile",
-        "createNSResolver",
-        "createNodeIterator",
-        "createNotification",
-        "createObjectStore",
-        "createObjectURL",
-        "createOffer",
-        "createOscillator",
-        "createPanner",
-        "createPattern",
-        "createPeriodicWave",
-        "createPopup",
-        "createProcessingInstruction",
-        "createProgram",
-        "createRadialGradient",
-        "createRange",
-        "createRangeCollection",
-        "createRenderbuffer",
-        "createSVGAngle",
-        "createSVGLength",
-        "createSVGMatrix",
-        "createSVGNumber",
-        "createSVGPathSegArcAbs",
-        "createSVGPathSegArcRel",
-        "createSVGPathSegClosePath",
-        "createSVGPathSegCurvetoCubicAbs",
-        "createSVGPathSegCurvetoCubicRel",
-        "createSVGPathSegCurvetoCubicSmoothAbs",
-        "createSVGPathSegCurvetoCubicSmoothRel",
-        "createSVGPathSegCurvetoQuadraticAbs",
-        "createSVGPathSegCurvetoQuadraticRel",
-        "createSVGPathSegCurvetoQuadraticSmoothAbs",
-        "createSVGPathSegCurvetoQuadraticSmoothRel",
-        "createSVGPathSegLinetoAbs",
-        "createSVGPathSegLinetoHorizontalAbs",
-        "createSVGPathSegLinetoHorizontalRel",
-        "createSVGPathSegLinetoRel",
-        "createSVGPathSegLinetoVerticalAbs",
-        "createSVGPathSegLinetoVerticalRel",
-        "createSVGPathSegMovetoAbs",
-        "createSVGPathSegMovetoRel",
-        "createSVGPoint",
-        "createSVGRect",
-        "createSVGTransform",
-        "createSVGTransformFromMatrix",
-        "createScriptProcessor",
-        "createSession",
-        "createShader",
-        "createShadowRoot",
-        "createStereoPanner",
-        "createStyleSheet",
-        "createTBody",
-        "createTFoot",
-        "createTHead",
-        "createTextNode",
-        "createTextRange",
-        "createTexture",
-        "createTouch",
-        "createTouchList",
-        "createTreeWalker",
-        "createWaveShaper",
-        "creationTime",
-        "crossOrigin",
-        "crypto",
-        "csi",
-        "cssFloat",
-        "cssRules",
-        "cssText",
-        "cssValueType",
-        "ctrlKey",
-        "ctrlLeft",
-        "cues",
-        "cullFace",
-        "currentNode",
-        "currentPage",
-        "currentScale",
-        "currentScript",
-        "currentSrc",
-        "currentState",
-        "currentStyle",
-        "currentTarget",
-        "currentTime",
-        "currentTranslate",
-        "currentView",
-        "cursor",
-        "curve",
-        "customError",
-        "cx",
-        "cy",
-        "d",
-        "data",
-        "dataFld",
-        "dataFormatAs",
-        "dataPageSize",
-        "dataSrc",
-        "dataTransfer",
-        "database",
-        "dataset",
-        "dateTime",
-        "db",
-        "debug",
-        "debuggerEnabled",
-        "declare",
-        "decode",
-        "decodeAudioData",
-        "decodeURI",
-        "decodeURIComponent",
-        "decrypt",
-        "default",
-        "defaultCharset",
-        "defaultChecked",
-        "defaultMuted",
-        "defaultPlaybackRate",
-        "defaultPrevented",
-        "defaultSelected",
-        "defaultStatus",
-        "defaultURL",
-        "defaultValue",
-        "defaultView",
-        "defaultstatus",
-        "defer",
-        "defineMagicFunction",
-        "defineMagicVariable",
-        "defineProperties",
-        "defineProperty",
-        "delayTime",
-        "delete",
-        "deleteBuffer",
-        "deleteCaption",
-        "deleteCell",
-        "deleteContents",
-        "deleteData",
-        "deleteDatabase",
-        "deleteFramebuffer",
-        "deleteFromDocument",
-        "deleteIndex",
-        "deleteMedium",
-        "deleteObjectStore",
-        "deleteProgram",
-        "deleteRenderbuffer",
-        "deleteRow",
-        "deleteRule",
-        "deleteShader",
-        "deleteTFoot",
-        "deleteTHead",
-        "deleteTexture",
-        "deliverChangeRecords",
-        "delivery",
-        "deliveryInfo",
-        "deliveryStatus",
-        "deliveryTimestamp",
-        "delta",
-        "deltaMode",
-        "deltaX",
-        "deltaY",
-        "deltaZ",
-        "depthFunc",
-        "depthMask",
-        "depthRange",
-        "deriveBits",
-        "deriveKey",
-        "description",
-        "deselectAll",
-        "designMode",
-        "destination",
-        "destinationURL",
-        "detach",
-        "detachEvent",
-        "detachShader",
-        "detail",
-        "detune",
-        "devicePixelRatio",
-        "deviceXDPI",
-        "deviceYDPI",
-        "diffuseConstant",
-        "digest",
-        "dimensions",
-        "dir",
-        "dirName",
-        "direction",
-        "dirxml",
-        "disable",
-        "disableVertexAttribArray",
-        "disabled",
-        "dischargingTime",
-        "disconnect",
-        "dispatchEvent",
-        "display",
-        "distanceModel",
-        "divisor",
-        "djsapi",
-        "djsproxy",
-        "doImport",
-        "doNotTrack",
-        "doScroll",
-        "doctype",
-        "document",
-        "documentElement",
-        "documentMode",
-        "documentURI",
-        "dolphin",
-        "dolphinGameCenter",
-        "dolphininfo",
-        "dolphinmeta",
-        "domComplete",
-        "domContentLoadedEventEnd",
-        "domContentLoadedEventStart",
-        "domInteractive",
-        "domLoading",
-        "domain",
-        "domainLookupEnd",
-        "domainLookupStart",
-        "dominant-baseline",
-        "dominantBaseline",
-        "done",
-        "dopplerFactor",
-        "download",
-        "dragDrop",
-        "draggable",
-        "drawArrays",
-        "drawArraysInstancedANGLE",
-        "drawCustomFocusRing",
-        "drawElements",
-        "drawElementsInstancedANGLE",
-        "drawFocusIfNeeded",
-        "drawImage",
-        "drawImageFromRect",
-        "drawSystemFocusRing",
-        "drawingBufferHeight",
-        "drawingBufferWidth",
-        "dropEffect",
-        "droppedVideoFrames",
-        "dropzone",
-        "dump",
-        "duplicate",
-        "duration",
-        "dvname",
-        "dvnum",
-        "dx",
-        "dy",
-        "dynsrc",
-        "e",
-        "edgeMode",
-        "effectAllowed",
-        "elapsedTime",
-        "elementFromPoint",
-        "elements",
-        "elevation",
-        "ellipse",
-        "email",
-        "embeds",
-        "empty",
-        "empty-cells",
-        "emptyCells",
-        "enable",
-        "enableBackground",
-        "enableStyleSheetsForSet",
-        "enableVertexAttribArray",
-        "enabled",
-        "enabledPlugin",
-        "encode",
-        "encodeURI",
-        "encodeURIComponent",
-        "encoding",
-        "encrypt",
-        "enctype",
-        "end",
-        "endContainer",
-        "endElement",
-        "endElementAt",
-        "endOfStream",
-        "endOffset",
-        "endTime",
-        "ended",
-        "endsWith",
-        "entities",
-        "entries",
-        "entryType",
-        "enumerate",
-        "enumerateEditable",
-        "error",
-        "errorCode",
-        "escape",
-        "eval",
-        "evaluate",
-        "event",
-        "eventPhase",
-        "every",
-        "exception",
-        "exec",
-        "execCommand",
-        "execCommandShowHelp",
-        "execScript",
-        "exitFullscreen",
-        "exitPointerLock",
-        "exp",
-        "expand",
-        "expandEntityReferences",
-        "expando",
-        "expansion",
-        "expiryDate",
-        "explicitOriginalTarget",
-        "expm1",
-        "exponent",
-        "exponentialRampToValueAtTime",
-        "exportKey",
-        "extend",
-        "extensions",
-        "extentNode",
-        "extentOffset",
-        "external",
-        "externalResourcesRequired",
-        "extractContents",
-        "extractable",
-        "f",
-        "face",
-        "factoryReset",
-        "fallback",
-        "familyName",
-        "farthestViewportElement",
-        "fastSeek",
-        "fatal",
-        "fetch",
-        "fetchStart",
-        "fftSize",
-        "fgColor",
-        "fileCreatedDate",
-        "fileHandle",
-        "fileModifiedDate",
-        "fileName",
-        "fileSize",
-        "fileUpdatedDate",
-        "filename",
-        "files",
-        "fill",
-        "fill-opacity",
-        "fill-rule",
-        "fillOpacity",
-        "fillRect",
-        "fillRule",
-        "fillStyle",
-        "fillText",
-        "filter",
-        "filterResX",
-        "filterResY",
-        "filterUnits",
-        "filters",
-        "find",
-        "findIndex",
-        "findRule",
-        "findText",
-        "finish",
-        "fireEvent",
-        "firstChild",
-        "firstElementChild",
-        "firstPage",
-        "fixed",
-        "flex",
-        "flex-basis",
-        "flex-direction",
-        "flex-flow",
-        "flex-grow",
-        "flex-shrink",
-        "flex-wrap",
-        "flexBasis",
-        "flexDirection",
-        "flexFlow",
-        "flexGrow",
-        "flexShrink",
-        "flexWrap",
-        "flipX",
-        "flipY",
-        "float",
-        "flood-color",
-        "flood-opacity",
-        "floodColor",
-        "floodOpacity",
-        "floor",
-        "flush",
-        "focus",
-        "focusNode",
-        "focusOffset",
-        "font",
-        "font-family",
-        "font-feature-settings",
-        "font-kerning",
-        "font-language-override",
-        "font-size",
-        "font-size-adjust",
-        "font-stretch",
-        "font-style",
-        "font-synthesis",
-        "font-variant",
-        "font-variant-alternates",
-        "font-variant-caps",
-        "font-variant-east-asian",
-        "font-variant-ligatures",
-        "font-variant-numeric",
-        "font-variant-position",
-        "font-weight",
-        "fontFamily",
-        "fontFeatureSettings",
-        "fontKerning",
-        "fontLanguageOverride",
-        "fontSize",
-        "fontSizeAdjust",
-        "fontSmoothingEnabled",
-        "fontStretch",
-        "fontStyle",
-        "fontSynthesis",
-        "fontVariant",
-        "fontVariantAlternates",
-        "fontVariantCaps",
-        "fontVariantEastAsian",
-        "fontVariantLigatures",
-        "fontVariantNumeric",
-        "fontVariantPosition",
-        "fontWeight",
-        "fontcolor",
-        "fonts",
-        "fontsize",
-        "for",
-        "forEach",
-        "forceRedraw",
-        "form",
-        "formAction",
-        "formEnctype",
-        "formMethod",
-        "formNoValidate",
-        "formTarget",
-        "format",
-        "forms",
-        "forward",
-        "fr",
-        "frame",
-        "frameBorder",
-        "frameElement",
-        "frameSpacing",
-        "framebufferRenderbuffer",
-        "framebufferTexture2D",
-        "frames",
-        "freeSpace",
-        "freeze",
-        "frequency",
-        "frequencyBinCount",
-        "from",
-        "fromCharCode",
-        "fromCodePoint",
-        "fromElement",
-        "frontFace",
-        "fround",
-        "fullScreen",
-        "fullscreenElement",
-        "fullscreenEnabled",
-        "fx",
-        "fy",
-        "gain",
-        "gamepad",
-        "gamma",
-        "genderIdentity",
-        "generateKey",
-        "generateMipmap",
-        "generateRequest",
-        "geolocation",
-        "gestureObject",
-        "get",
-        "getActiveAttrib",
-        "getActiveUniform",
-        "getAdjacentText",
-        "getAll",
-        "getAllResponseHeaders",
-        "getAsFile",
-        "getAsString",
-        "getAttachedShaders",
-        "getAttribLocation",
-        "getAttribute",
-        "getAttributeNS",
-        "getAttributeNode",
-        "getAttributeNodeNS",
-        "getAudioTracks",
-        "getBBox",
-        "getBattery",
-        "getBlob",
-        "getBookmark",
-        "getBoundingClientRect",
-        "getBufferParameter",
-        "getByteFrequencyData",
-        "getByteTimeDomainData",
-        "getCSSCanvasContext",
-        "getCTM",
-        "getCandidateWindowClientRect",
-        "getChannelData",
-        "getCharNumAtPosition",
-        "getClientRect",
-        "getClientRects",
-        "getCompositionAlternatives",
-        "getComputedStyle",
-        "getComputedTextLength",
-        "getConfiguration",
-        "getContext",
-        "getContextAttributes",
-        "getCounterValue",
-        "getCueAsHTML",
-        "getCueById",
-        "getCurrentPosition",
-        "getCurrentTime",
-        "getData",
-        "getDatabaseNames",
-        "getDate",
-        "getDay",
-        "getDefaultComputedStyle",
-        "getDestinationInsertionPoints",
-        "getDistributedNodes",
-        "getEditable",
-        "getElementById",
-        "getElementsByClassName",
-        "getElementsByName",
-        "getElementsByTagName",
-        "getElementsByTagNameNS",
-        "getEnclosureList",
-        "getEndPositionOfChar",
-        "getEntries",
-        "getEntriesByName",
-        "getEntriesByType",
-        "getError",
-        "getExtension",
-        "getExtentOfChar",
-        "getFeature",
-        "getFile",
-        "getFloat32",
-        "getFloat64",
-        "getFloatFrequencyData",
-        "getFloatTimeDomainData",
-        "getFloatValue",
-        "getFramebufferAttachmentParameter",
-        "getFrequencyResponse",
-        "getFullYear",
-        "getGamepads",
-        "getHours",
-        "getImageData",
-        "getInt16",
-        "getInt32",
-        "getInt8",
-        "getIntersectionList",
-        "getItem",
-        "getItems",
-        "getKey",
-        "getLineDash",
-        "getLocalStreams",
-        "getMarks",
-        "getMatchedCSSRules",
-        "getMeasures",
-        "getMetadata",
-        "getMilliseconds",
-        "getMinutes",
-        "getModifierState",
-        "getMonth",
-        "getNamedItem",
-        "getNamedItemNS",
-        "getNotifier",
-        "getNumberOfChars",
-        "getOverrideHistoryNavigationMode",
-        "getOverrideStyle",
-        "getOwnPropertyDescriptor",
-        "getOwnPropertyNames",
-        "getOwnPropertySymbols",
-        "getParameter",
-        "getPathSegAtLength",
-        "getPointAtLength",
-        "getPreference",
-        "getPreferenceDefault",
-        "getPresentationAttribute",
-        "getPreventDefault",
-        "getProgramInfoLog",
-        "getProgramParameter",
-        "getPropertyCSSValue",
-        "getPropertyPriority",
-        "getPropertyShorthand",
-        "getPropertyValue",
-        "getPrototypeOf",
-        "getRGBColorValue",
-        "getRandomValues",
-        "getRangeAt",
-        "getReceivers",
-        "getRectValue",
-        "getRegistration",
-        "getRemoteStreams",
-        "getRenderbufferParameter",
-        "getResponseHeader",
-        "getRoot",
-        "getRotationOfChar",
-        "getSVGDocument",
-        "getScreenCTM",
-        "getSeconds",
-        "getSelection",
-        "getSenders",
-        "getShaderInfoLog",
-        "getShaderParameter",
-        "getShaderPrecisionFormat",
-        "getShaderSource",
-        "getSimpleDuration",
-        "getSiteIcons",
-        "getSources",
-        "getSpeculativeParserUrls",
-        "getStartPositionOfChar",
-        "getStartTime",
-        "getStats",
-        "getStorageUpdates",
-        "getStreamById",
-        "getStringValue",
-        "getSubStringLength",
-        "getSubscription",
-        "getSupportedExtensions",
-        "getTexParameter",
-        "getTime",
-        "getTimezoneOffset",
-        "getTotalLength",
-        "getTrackById",
-        "getTracks",
-        "getTransformToElement",
-        "getUTCDate",
-        "getUTCDay",
-        "getUTCFullYear",
-        "getUTCHours",
-        "getUTCMilliseconds",
-        "getUTCMinutes",
-        "getUTCMonth",
-        "getUTCSeconds",
-        "getUint16",
-        "getUint32",
-        "getUint8",
-        "getUniform",
-        "getUniformLocation",
-        "getUserMedia",
-        "getValues",
-        "getVarDate",
-        "getVariableValue",
-        "getVertexAttrib",
-        "getVertexAttribOffset",
-        "getVideoPlaybackQuality",
-        "getVideoTracks",
-        "getWakeLockState",
-        "getYear",
-        "givenName",
-        "global",
-        "globalAlpha",
-        "globalCompositeOperation",
-        "glyphOrientationHorizontal",
-        "glyphOrientationVertical",
-        "glyphRef",
-        "go",
-        "gradientTransform",
-        "gradientUnits",
-        "grammars",
-        "green",
-        "group",
-        "groupCollapsed",
-        "groupEnd",
-        "hardwareConcurrency",
-        "has",
-        "hasAttribute",
-        "hasAttributeNS",
-        "hasAttributes",
-        "hasChildNodes",
-        "hasComposition",
-        "hasExtension",
-        "hasFeature",
-        "hasFocus",
-        "hasLayout",
-        "hasOwnProperty",
-        "hash",
-        "head",
-        "headers",
-        "heading",
-        "height",
-        "hidden",
-        "hide",
-        "hideFocus",
-        "high",
-        "hint",
-        "history",
-        "honorificPrefix",
-        "honorificSuffix",
-        "horizontalOverflow",
-        "host",
-        "hostname",
-        "href",
-        "hreflang",
-        "hspace",
-        "html5TagCheckInerface",
-        "htmlFor",
-        "htmlText",
-        "httpEquiv",
-        "hwTimestamp",
-        "hypot",
-        "iccId",
-        "iceConnectionState",
-        "iceGatheringState",
-        "icon",
-        "id",
-        "identifier",
-        "identity",
-        "ignoreBOM",
-        "ignoreCase",
-        "image-orientation",
-        "image-rendering",
-        "imageOrientation",
-        "imageRendering",
-        "images",
-        "ime-mode",
-        "imeMode",
-        "implementation",
-        "importKey",
-        "importNode",
-        "importStylesheet",
-        "imports",
-        "impp",
-        "imul",
-        "in1",
-        "in2",
-        "inBandMetadataTrackDispatchType",
-        "inRange",
-        "includes",
-        "incremental",
-        "indeterminate",
-        "index",
-        "indexNames",
-        "indexOf",
-        "indexedDB",
-        "inertiaDestinationX",
-        "inertiaDestinationY",
-        "info",
-        "init",
-        "initAnimationEvent",
-        "initBeforeLoadEvent",
-        "initClipboardEvent",
-        "initCloseEvent",
-        "initCommandEvent",
-        "initCompositionEvent",
-        "initCustomEvent",
-        "initData",
-        "initDeviceMotionEvent",
-        "initDeviceOrientationEvent",
-        "initDragEvent",
-        "initErrorEvent",
-        "initEvent",
-        "initFocusEvent",
-        "initGestureEvent",
-        "initHashChangeEvent",
-        "initKeyEvent",
-        "initKeyboardEvent",
-        "initMSManipulationEvent",
-        "initMessageEvent",
-        "initMouseEvent",
-        "initMouseScrollEvent",
-        "initMouseWheelEvent",
-        "initMutationEvent",
-        "initNSMouseEvent",
-        "initOverflowEvent",
-        "initPageEvent",
-        "initPageTransitionEvent",
-        "initPointerEvent",
-        "initPopStateEvent",
-        "initProgressEvent",
-        "initScrollAreaEvent",
-        "initSimpleGestureEvent",
-        "initStorageEvent",
-        "initTextEvent",
-        "initTimeEvent",
-        "initTouchEvent",
-        "initTransitionEvent",
-        "initUIEvent",
-        "initWebKitAnimationEvent",
-        "initWebKitTransitionEvent",
-        "initWebKitWheelEvent",
-        "initWheelEvent",
-        "initialTime",
-        "initialize",
-        "initiatorType",
-        "inner",
-        "innerHTML",
-        "innerHeight",
-        "innerText",
-        "innerWidth",
-        "input",
-        "inputBuffer",
-        "inputEncoding",
-        "inputMethod",
-        "insertAdjacentElement",
-        "insertAdjacentHTML",
-        "insertAdjacentText",
-        "insertBefore",
-        "insertCell",
-        "insertData",
-        "insertItemBefore",
-        "insertNode",
-        "insertRow",
-        "insertRule",
-        "instanceRoot",
-        "intercept",
-        "interimResults",
-        "internalSubset",
-        "intersectsNode",
-        "interval",
-        "invalidIteratorState",
-        "inverse",
-        "invertSelf",
-        "is",
-        "is2D",
-        "isAlternate",
-        "isArray",
-        "isBingCurrentSearchDefault",
-        "isBuffer",
-        "isCandidateWindowVisible",
-        "isChar",
-        "isCollapsed",
-        "isComposing",
-        "isContentEditable",
-        "isContentHandlerRegistered",
-        "isContextLost",
-        "isDefaultNamespace",
-        "isDisabled",
-        "isEnabled",
-        "isEqual",
-        "isEqualNode",
-        "isExtensible",
-        "isFinite",
-        "isFramebuffer",
-        "isFrozen",
-        "isGenerator",
-        "isId",
-        "isInjected",
-        "isInteger",
-        "isMap",
-        "isMultiLine",
-        "isNaN",
-        "isOpen",
-        "isPointInFill",
-        "isPointInPath",
-        "isPointInRange",
-        "isPointInStroke",
-        "isPrefAlternate",
-        "isPrimary",
-        "isProgram",
-        "isPropertyImplicit",
-        "isProtocolHandlerRegistered",
-        "isPrototypeOf",
-        "isRenderbuffer",
-        "isSafeInteger",
-        "isSameNode",
-        "isSealed",
-        "isShader",
-        "isSupported",
-        "isTextEdit",
-        "isTexture",
-        "isTrusted",
-        "isTypeSupported",
-        "isView",
-        "isolation",
-        "italics",
-        "item",
-        "itemId",
-        "itemProp",
-        "itemRef",
-        "itemScope",
-        "itemType",
-        "itemValue",
-        "iterateNext",
-        "iterator",
-        "javaEnabled",
-        "jobTitle",
-        "join",
-        "json",
-        "justify-content",
-        "justifyContent",
-        "k1",
-        "k2",
-        "k3",
-        "k4",
-        "kernelMatrix",
-        "kernelUnitLengthX",
-        "kernelUnitLengthY",
-        "kerning",
-        "key",
-        "keyCode",
-        "keyFor",
-        "keyIdentifier",
-        "keyLightEnabled",
-        "keyLocation",
-        "keyPath",
-        "keySystem",
-        "keyText",
-        "keyUsage",
-        "keys",
-        "keytype",
-        "kind",
-        "knee",
-        "label",
-        "labels",
-        "lang",
-        "language",
-        "languages",
-        "largeArcFlag",
-        "lastChild",
-        "lastElementChild",
-        "lastEventId",
-        "lastIndex",
-        "lastIndexOf",
-        "lastMatch",
-        "lastMessageSubject",
-        "lastMessageType",
-        "lastModified",
-        "lastModifiedDate",
-        "lastPage",
-        "lastParen",
-        "lastState",
-        "lastStyleSheetSet",
-        "latitude",
-        "layerX",
-        "layerY",
-        "layoutFlow",
-        "layoutGrid",
-        "layoutGridChar",
-        "layoutGridLine",
-        "layoutGridMode",
-        "layoutGridType",
-        "lbound",
-        "left",
-        "leftContext",
-        "leftMargin",
-        "length",
-        "lengthAdjust",
-        "lengthComputable",
-        "letter-spacing",
-        "letterSpacing",
-        "level",
-        "lighting-color",
-        "lightingColor",
-        "limitingConeAngle",
-        "line",
-        "line-height",
-        "lineAlign",
-        "lineBreak",
-        "lineCap",
-        "lineDashOffset",
-        "lineHeight",
-        "lineJoin",
-        "lineNumber",
-        "lineTo",
-        "lineWidth",
-        "linearRampToValueAtTime",
-        "lineno",
-        "link",
-        "linkColor",
-        "linkProgram",
-        "links",
-        "list",
-        "list-style",
-        "list-style-image",
-        "list-style-position",
-        "list-style-type",
-        "listStyle",
-        "listStyleImage",
-        "listStylePosition",
-        "listStyleType",
-        "listener",
-        "load",
-        "loadEventEnd",
-        "loadEventStart",
-        "loadTimes",
-        "loaded",
-        "localDescription",
-        "localName",
-        "localStorage",
-        "locale",
-        "localeCompare",
-        "location",
-        "locationbar",
-        "lock",
-        "lockedFile",
-        "log",
-        "log10",
-        "log1p",
-        "log2",
-        "logicalXDPI",
-        "logicalYDPI",
-        "longDesc",
-        "longitude",
-        "lookupNamespaceURI",
-        "lookupPrefix",
-        "loop",
-        "loopEnd",
-        "loopStart",
-        "looping",
-        "low",
-        "lower",
-        "lowerBound",
-        "lowerOpen",
-        "lowsrc",
-        "m11",
-        "m12",
-        "m13",
-        "m14",
-        "m21",
-        "m22",
-        "m23",
-        "m24",
-        "m31",
-        "m32",
-        "m33",
-        "m34",
-        "m41",
-        "m42",
-        "m43",
-        "m44",
-        "manifest",
-        "map",
-        "mapping",
-        "margin",
-        "margin-bottom",
-        "margin-left",
-        "margin-right",
-        "margin-top",
-        "marginBottom",
-        "marginHeight",
-        "marginLeft",
-        "marginRight",
-        "marginTop",
-        "marginWidth",
-        "mark",
-        "marker",
-        "marker-end",
-        "marker-mid",
-        "marker-offset",
-        "marker-start",
-        "markerEnd",
-        "markerHeight",
-        "markerMid",
-        "markerOffset",
-        "markerStart",
-        "markerUnits",
-        "markerWidth",
-        "marks",
-        "mask",
-        "mask-type",
-        "maskContentUnits",
-        "maskType",
-        "maskUnits",
-        "match",
-        "matchMedia",
-        "matchMedium",
-        "matches",
-        "matrix",
-        "matrixTransform",
-        "max",
-        "max-height",
-        "max-width",
-        "maxAlternatives",
-        "maxChannelCount",
-        "maxConnectionsPerServer",
-        "maxDecibels",
-        "maxDistance",
-        "maxHeight",
-        "maxLength",
-        "maxTouchPoints",
-        "maxValue",
-        "maxWidth",
-        "measure",
-        "measureText",
-        "media",
-        "mediaDevices",
-        "mediaElement",
-        "mediaGroup",
-        "mediaKeys",
-        "mediaText",
-        "meetOrSlice",
-        "memory",
-        "menubar",
-        "mergeAttributes",
-        "message",
-        "messageClass",
-        "messageHandlers",
-        "metaKey",
-        "method",
-        "mimeType",
-        "mimeTypes",
-        "min",
-        "min-height",
-        "min-width",
-        "minDecibels",
-        "minHeight",
-        "minValue",
-        "minWidth",
-        "miterLimit",
-        "mix-blend-mode",
-        "mixBlendMode",
-        "mode",
-        "modify",
-        "mount",
-        "move",
-        "moveBy",
-        "moveEnd",
-        "moveFirst",
-        "moveFocusDown",
-        "moveFocusLeft",
-        "moveFocusRight",
-        "moveFocusUp",
-        "moveNext",
-        "moveRow",
-        "moveStart",
-        "moveTo",
-        "moveToBookmark",
-        "moveToElementText",
-        "moveToPoint",
-        "mozAdd",
-        "mozAnimationStartTime",
-        "mozAnon",
-        "mozApps",
-        "mozAudioCaptured",
-        "mozAudioChannelType",
-        "mozAutoplayEnabled",
-        "mozCancelAnimationFrame",
-        "mozCancelFullScreen",
-        "mozCancelRequestAnimationFrame",
-        "mozCaptureStream",
-        "mozCaptureStreamUntilEnded",
-        "mozClearDataAt",
-        "mozContact",
-        "mozContacts",
-        "mozCreateFileHandle",
-        "mozCurrentTransform",
-        "mozCurrentTransformInverse",
-        "mozCursor",
-        "mozDash",
-        "mozDashOffset",
-        "mozDecodedFrames",
-        "mozExitPointerLock",
-        "mozFillRule",
-        "mozFragmentEnd",
-        "mozFrameDelay",
-        "mozFullScreen",
-        "mozFullScreenElement",
-        "mozFullScreenEnabled",
-        "mozGetAll",
-        "mozGetAllKeys",
-        "mozGetAsFile",
-        "mozGetDataAt",
-        "mozGetMetadata",
-        "mozGetUserMedia",
-        "mozHasAudio",
-        "mozHasItem",
-        "mozHidden",
-        "mozImageSmoothingEnabled",
-        "mozIndexedDB",
-        "mozInnerScreenX",
-        "mozInnerScreenY",
-        "mozInputSource",
-        "mozIsTextField",
-        "mozItem",
-        "mozItemCount",
-        "mozItems",
-        "mozLength",
-        "mozLockOrientation",
-        "mozMatchesSelector",
-        "mozMovementX",
-        "mozMovementY",
-        "mozOpaque",
-        "mozOrientation",
-        "mozPaintCount",
-        "mozPaintedFrames",
-        "mozParsedFrames",
-        "mozPay",
-        "mozPointerLockElement",
-        "mozPresentedFrames",
-        "mozPreservesPitch",
-        "mozPressure",
-        "mozPrintCallback",
-        "mozRTCIceCandidate",
-        "mozRTCPeerConnection",
-        "mozRTCSessionDescription",
-        "mozRemove",
-        "mozRequestAnimationFrame",
-        "mozRequestFullScreen",
-        "mozRequestPointerLock",
-        "mozSetDataAt",
-        "mozSetImageElement",
-        "mozSourceNode",
-        "mozSrcObject",
-        "mozSystem",
-        "mozTCPSocket",
-        "mozTextStyle",
-        "mozTypesAt",
-        "mozUnlockOrientation",
-        "mozUserCancelled",
-        "mozVisibilityState",
-        "msAnimation",
-        "msAnimationDelay",
-        "msAnimationDirection",
-        "msAnimationDuration",
-        "msAnimationFillMode",
-        "msAnimationIterationCount",
-        "msAnimationName",
-        "msAnimationPlayState",
-        "msAnimationStartTime",
-        "msAnimationTimingFunction",
-        "msBackfaceVisibility",
-        "msBlockProgression",
-        "msCSSOMElementFloatMetrics",
-        "msCaching",
-        "msCachingEnabled",
-        "msCancelRequestAnimationFrame",
-        "msCapsLockWarningOff",
-        "msClearImmediate",
-        "msClose",
-        "msContentZoomChaining",
-        "msContentZoomFactor",
-        "msContentZoomLimit",
-        "msContentZoomLimitMax",
-        "msContentZoomLimitMin",
-        "msContentZoomSnap",
-        "msContentZoomSnapPoints",
-        "msContentZoomSnapType",
-        "msContentZooming",
-        "msConvertURL",
-        "msCrypto",
-        "msDoNotTrack",
-        "msElementsFromPoint",
-        "msElementsFromRect",
-        "msExitFullscreen",
-        "msExtendedCode",
-        "msFillRule",
-        "msFirstPaint",
-        "msFlex",
-        "msFlexAlign",
-        "msFlexDirection",
-        "msFlexFlow",
-        "msFlexItemAlign",
-        "msFlexLinePack",
-        "msFlexNegative",
-        "msFlexOrder",
-        "msFlexPack",
-        "msFlexPositive",
-        "msFlexPreferredSize",
-        "msFlexWrap",
-        "msFlowFrom",
-        "msFlowInto",
-        "msFontFeatureSettings",
-        "msFullscreenElement",
-        "msFullscreenEnabled",
-        "msGetInputContext",
-        "msGetRegionContent",
-        "msGetUntransformedBounds",
-        "msGraphicsTrustStatus",
-        "msGridColumn",
-        "msGridColumnAlign",
-        "msGridColumnSpan",
-        "msGridColumns",
-        "msGridRow",
-        "msGridRowAlign",
-        "msGridRowSpan",
-        "msGridRows",
-        "msHidden",
-        "msHighContrastAdjust",
-        "msHyphenateLimitChars",
-        "msHyphenateLimitLines",
-        "msHyphenateLimitZone",
-        "msHyphens",
-        "msImageSmoothingEnabled",
-        "msImeAlign",
-        "msIndexedDB",
-        "msInterpolationMode",
-        "msIsStaticHTML",
-        "msKeySystem",
-        "msKeys",
-        "msLaunchUri",
-        "msLockOrientation",
-        "msManipulationViewsEnabled",
-        "msMatchMedia",
-        "msMatchesSelector",
-        "msMaxTouchPoints",
-        "msOrientation",
-        "msOverflowStyle",
-        "msPerspective",
-        "msPerspectiveOrigin",
-        "msPlayToDisabled",
-        "msPlayToPreferredSourceUri",
-        "msPlayToPrimary",
-        "msPointerEnabled",
-        "msRegionOverflow",
-        "msReleasePointerCapture",
-        "msRequestAnimationFrame",
-        "msRequestFullscreen",
-        "msSaveBlob",
-        "msSaveOrOpenBlob",
-        "msScrollChaining",
-        "msScrollLimit",
-        "msScrollLimitXMax",
-        "msScrollLimitXMin",
-        "msScrollLimitYMax",
-        "msScrollLimitYMin",
-        "msScrollRails",
-        "msScrollSnapPointsX",
-        "msScrollSnapPointsY",
-        "msScrollSnapType",
-        "msScrollSnapX",
-        "msScrollSnapY",
-        "msScrollTranslation",
-        "msSetImmediate",
-        "msSetMediaKeys",
-        "msSetPointerCapture",
-        "msTextCombineHorizontal",
-        "msTextSizeAdjust",
-        "msToBlob",
-        "msTouchAction",
-        "msTouchSelect",
-        "msTraceAsyncCallbackCompleted",
-        "msTraceAsyncCallbackStarting",
-        "msTraceAsyncOperationCompleted",
-        "msTraceAsyncOperationStarting",
-        "msTransform",
-        "msTransformOrigin",
-        "msTransformStyle",
-        "msTransition",
-        "msTransitionDelay",
-        "msTransitionDuration",
-        "msTransitionProperty",
-        "msTransitionTimingFunction",
-        "msUnlockOrientation",
-        "msUpdateAsyncCallbackRelation",
-        "msUserSelect",
-        "msVisibilityState",
-        "msWrapFlow",
-        "msWrapMargin",
-        "msWrapThrough",
-        "msWriteProfilerMark",
-        "msZoom",
-        "msZoomTo",
-        "mt",
-        "multiEntry",
-        "multiSelectionObj",
-        "multiline",
-        "multiple",
-        "multiply",
-        "multiplySelf",
-        "mutableFile",
-        "muted",
-        "n",
-        "name",
-        "nameProp",
-        "namedItem",
-        "namedRecordset",
-        "names",
-        "namespaceURI",
-        "namespaces",
-        "naturalHeight",
-        "naturalWidth",
-        "navigate",
-        "navigation",
-        "navigationMode",
-        "navigationStart",
-        "navigator",
-        "near",
-        "nearestViewportElement",
-        "negative",
-        "netscape",
-        "networkState",
-        "newScale",
-        "newTranslate",
-        "newURL",
-        "newValue",
-        "newValueSpecifiedUnits",
-        "newVersion",
-        "newhome",
-        "next",
-        "nextElementSibling",
-        "nextNode",
-        "nextPage",
-        "nextSibling",
-        "nickname",
-        "noHref",
-        "noResize",
-        "noShade",
-        "noValidate",
-        "noWrap",
-        "nodeName",
-        "nodeType",
-        "nodeValue",
-        "normalize",
-        "normalizedPathSegList",
-        "notationName",
-        "notations",
-        "note",
-        "noteGrainOn",
-        "noteOff",
-        "noteOn",
-        "now",
-        "numOctaves",
-        "number",
-        "numberOfChannels",
-        "numberOfInputs",
-        "numberOfItems",
-        "numberOfOutputs",
-        "numberValue",
-        "oMatchesSelector",
-        "object",
-        "object-fit",
-        "object-position",
-        "objectFit",
-        "objectPosition",
-        "objectStore",
-        "objectStoreNames",
-        "observe",
-        "of",
-        "offscreenBuffering",
-        "offset",
-        "offsetHeight",
-        "offsetLeft",
-        "offsetNode",
-        "offsetParent",
-        "offsetTop",
-        "offsetWidth",
-        "offsetX",
-        "offsetY",
-        "ok",
-        "oldURL",
-        "oldValue",
-        "oldVersion",
-        "olderShadowRoot",
-        "onLine",
-        "onabort",
-        "onactivate",
-        "onactive",
-        "onaddstream",
-        "onaddtrack",
-        "onafterprint",
-        "onafterscriptexecute",
-        "onafterupdate",
-        "onaudioend",
-        "onaudioprocess",
-        "onaudiostart",
-        "onautocomplete",
-        "onautocompleteerror",
-        "onbeforeactivate",
-        "onbeforecopy",
-        "onbeforecut",
-        "onbeforedeactivate",
-        "onbeforeeditfocus",
-        "onbeforepaste",
-        "onbeforeprint",
-        "onbeforescriptexecute",
-        "onbeforeunload",
-        "onbeforeupdate",
-        "onblocked",
-        "onblur",
-        "onbounce",
-        "onboundary",
-        "oncached",
-        "oncancel",
-        "oncandidatewindowhide",
-        "oncandidatewindowshow",
-        "oncandidatewindowupdate",
-        "oncanplay",
-        "oncanplaythrough",
-        "oncellchange",
-        "onchange",
-        "onchargingchange",
-        "onchargingtimechange",
-        "onchecking",
-        "onclick",
-        "onclose",
-        "oncompassneedscalibration",
-        "oncomplete",
-        "oncontextmenu",
-        "oncontrolselect",
-        "oncopy",
-        "oncuechange",
-        "oncut",
-        "ondataavailable",
-        "ondatachannel",
-        "ondatasetchanged",
-        "ondatasetcomplete",
-        "ondblclick",
-        "ondeactivate",
-        "ondevicelight",
-        "ondevicemotion",
-        "ondeviceorientation",
-        "ondeviceproximity",
-        "ondischargingtimechange",
-        "ondisplay",
-        "ondownloading",
-        "ondrag",
-        "ondragend",
-        "ondragenter",
-        "ondragleave",
-        "ondragover",
-        "ondragstart",
-        "ondrop",
-        "ondurationchange",
-        "onemptied",
-        "onencrypted",
-        "onend",
-        "onended",
-        "onenter",
-        "onerror",
-        "onerrorupdate",
-        "onexit",
-        "onfilterchange",
-        "onfinish",
-        "onfocus",
-        "onfocusin",
-        "onfocusout",
-        "onfullscreenchange",
-        "onfullscreenerror",
-        "ongesturechange",
-        "ongestureend",
-        "ongesturestart",
-        "ongotpointercapture",
-        "onhashchange",
-        "onhelp",
-        "onicecandidate",
-        "oniceconnectionstatechange",
-        "oninactive",
-        "oninput",
-        "oninvalid",
-        "onkeydown",
-        "onkeypress",
-        "onkeyup",
-        "onlanguagechange",
-        "onlayoutcomplete",
-        "onlevelchange",
-        "onload",
-        "onloadeddata",
-        "onloadedmetadata",
-        "onloadend",
-        "onloadstart",
-        "onlosecapture",
-        "onlostpointercapture",
-        "only",
-        "onmark",
-        "onmessage",
-        "onmousedown",
-        "onmouseenter",
-        "onmouseleave",
-        "onmousemove",
-        "onmouseout",
-        "onmouseover",
-        "onmouseup",
-        "onmousewheel",
-        "onmove",
-        "onmoveend",
-        "onmovestart",
-        "onmozfullscreenchange",
-        "onmozfullscreenerror",
-        "onmozorientationchange",
-        "onmozpointerlockchange",
-        "onmozpointerlockerror",
-        "onmscontentzoom",
-        "onmsfullscreenchange",
-        "onmsfullscreenerror",
-        "onmsgesturechange",
-        "onmsgesturedoubletap",
-        "onmsgestureend",
-        "onmsgesturehold",
-        "onmsgesturestart",
-        "onmsgesturetap",
-        "onmsgotpointercapture",
-        "onmsinertiastart",
-        "onmslostpointercapture",
-        "onmsmanipulationstatechanged",
-        "onmsneedkey",
-        "onmsorientationchange",
-        "onmspointercancel",
-        "onmspointerdown",
-        "onmspointerenter",
-        "onmspointerhover",
-        "onmspointerleave",
-        "onmspointermove",
-        "onmspointerout",
-        "onmspointerover",
-        "onmspointerup",
-        "onmssitemodejumplistitemremoved",
-        "onmsthumbnailclick",
-        "onnegotiationneeded",
-        "onnomatch",
-        "onnoupdate",
-        "onobsolete",
-        "onoffline",
-        "ononline",
-        "onopen",
-        "onorientationchange",
-        "onpagechange",
-        "onpagehide",
-        "onpageshow",
-        "onpaste",
-        "onpause",
-        "onplay",
-        "onplaying",
-        "onpluginstreamstart",
-        "onpointercancel",
-        "onpointerdown",
-        "onpointerenter",
-        "onpointerleave",
-        "onpointerlockchange",
-        "onpointerlockerror",
-        "onpointermove",
-        "onpointerout",
-        "onpointerover",
-        "onpointerup",
-        "onpopstate",
-        "onprogress",
-        "onpropertychange",
-        "onratechange",
-        "onreadystatechange",
-        "onremovestream",
-        "onremovetrack",
-        "onreset",
-        "onresize",
-        "onresizeend",
-        "onresizestart",
-        "onresourcetimingbufferfull",
-        "onresult",
-        "onresume",
-        "onrowenter",
-        "onrowexit",
-        "onrowsdelete",
-        "onrowsinserted",
-        "onscroll",
-        "onsearch",
-        "onseeked",
-        "onseeking",
-        "onselect",
-        "onselectionchange",
-        "onselectstart",
-        "onshow",
-        "onsignalingstatechange",
-        "onsoundend",
-        "onsoundstart",
-        "onspeechend",
-        "onspeechstart",
-        "onstalled",
-        "onstart",
-        "onstatechange",
-        "onstop",
-        "onstorage",
-        "onstoragecommit",
-        "onsubmit",
-        "onsuccess",
-        "onsuspend",
-        "ontextinput",
-        "ontimeout",
-        "ontimeupdate",
-        "ontoggle",
-        "ontouchcancel",
-        "ontouchend",
-        "ontouchmove",
-        "ontouchstart",
-        "ontransitionend",
-        "onunload",
-        "onupdateready",
-        "onupgradeneeded",
-        "onuserproximity",
-        "onversionchange",
-        "onvoiceschanged",
-        "onvolumechange",
-        "onwaiting",
-        "onwarning",
-        "onwebkitanimationend",
-        "onwebkitanimationiteration",
-        "onwebkitanimationstart",
-        "onwebkitcurrentplaybacktargetiswirelesschanged",
-        "onwebkitfullscreenchange",
-        "onwebkitfullscreenerror",
-        "onwebkitkeyadded",
-        "onwebkitkeyerror",
-        "onwebkitkeymessage",
-        "onwebkitneedkey",
-        "onwebkitorientationchange",
-        "onwebkitplaybacktargetavailabilitychanged",
-        "onwebkitpointerlockchange",
-        "onwebkitpointerlockerror",
-        "onwebkitresourcetimingbufferfull",
-        "onwebkittransitionend",
-        "onwheel",
-        "onzoom",
-        "opacity",
-        "open",
-        "openCursor",
-        "openDatabase",
-        "openKeyCursor",
-        "opener",
-        "opera",
-        "operationType",
-        "operator",
-        "opr",
-        "optimum",
-        "options",
-        "order",
-        "orderX",
-        "orderY",
-        "ordered",
-        "org",
-        "orient",
-        "orientAngle",
-        "orientType",
-        "orientation",
-        "origin",
-        "originalTarget",
-        "orphans",
-        "oscpu",
-        "outerHTML",
-        "outerHeight",
-        "outerText",
-        "outerWidth",
-        "outline",
-        "outline-color",
-        "outline-offset",
-        "outline-style",
-        "outline-width",
-        "outlineColor",
-        "outlineOffset",
-        "outlineStyle",
-        "outlineWidth",
-        "outputBuffer",
-        "overflow",
-        "overflow-x",
-        "overflow-y",
-        "overflowX",
-        "overflowY",
-        "overrideMimeType",
-        "oversample",
-        "ownerDocument",
-        "ownerElement",
-        "ownerNode",
-        "ownerRule",
-        "ownerSVGElement",
-        "owningElement",
-        "p1",
-        "p2",
-        "p3",
-        "p4",
-        "pad",
-        "padding",
-        "padding-bottom",
-        "padding-left",
-        "padding-right",
-        "padding-top",
-        "paddingBottom",
-        "paddingLeft",
-        "paddingRight",
-        "paddingTop",
-        "page",
-        "page-break-after",
-        "page-break-before",
-        "page-break-inside",
-        "pageBreakAfter",
-        "pageBreakBefore",
-        "pageBreakInside",
-        "pageCount",
-        "pageX",
-        "pageXOffset",
-        "pageY",
-        "pageYOffset",
-        "pages",
-        "paint-order",
-        "paintOrder",
-        "paintRequests",
-        "paintType",
-        "palette",
-        "panningModel",
-        "parent",
-        "parentElement",
-        "parentNode",
-        "parentRule",
-        "parentStyleSheet",
-        "parentTextEdit",
-        "parentWindow",
-        "parse",
-        "parseFloat",
-        "parseFromString",
-        "parseInt",
-        "participants",
-        "password",
-        "pasteHTML",
-        "path",
-        "pathLength",
-        "pathSegList",
-        "pathSegType",
-        "pathSegTypeAsLetter",
-        "pathname",
-        "pattern",
-        "patternContentUnits",
-        "patternMismatch",
-        "patternTransform",
-        "patternUnits",
-        "pause",
-        "pauseAnimations",
-        "pauseOnExit",
-        "paused",
-        "pending",
-        "performance",
-        "permission",
-        "persisted",
-        "personalbar",
-        "perspective",
-        "perspective-origin",
-        "perspectiveOrigin",
-        "phoneticFamilyName",
-        "phoneticGivenName",
-        "photo",
-        "ping",
-        "pitch",
-        "pixelBottom",
-        "pixelDepth",
-        "pixelHeight",
-        "pixelLeft",
-        "pixelRight",
-        "pixelStorei",
-        "pixelTop",
-        "pixelUnitToMillimeterX",
-        "pixelUnitToMillimeterY",
-        "pixelWidth",
-        "placeholder",
-        "platform",
-        "play",
-        "playbackRate",
-        "playbackState",
-        "playbackTime",
-        "played",
-        "plugins",
-        "pluginspage",
-        "pname",
-        "pointer-events",
-        "pointerBeforeReferenceNode",
-        "pointerEnabled",
-        "pointerEvents",
-        "pointerId",
-        "pointerLockElement",
-        "pointerType",
-        "points",
-        "pointsAtX",
-        "pointsAtY",
-        "pointsAtZ",
-        "polygonOffset",
-        "pop",
-        "popupWindowFeatures",
-        "popupWindowName",
-        "popupWindowURI",
-        "port",
-        "port1",
-        "port2",
-        "ports",
-        "posBottom",
-        "posHeight",
-        "posLeft",
-        "posRight",
-        "posTop",
-        "posWidth",
-        "position",
-        "positionAlign",
-        "postError",
-        "postMessage",
-        "poster",
-        "pow",
-        "powerOff",
-        "preMultiplySelf",
-        "precision",
-        "preferredStyleSheetSet",
-        "preferredStylesheetSet",
-        "prefix",
-        "preload",
-        "preserveAlpha",
-        "preserveAspectRatio",
-        "preserveAspectRatioString",
-        "pressed",
-        "pressure",
-        "prevValue",
-        "preventDefault",
-        "preventExtensions",
-        "previousElementSibling",
-        "previousNode",
-        "previousPage",
-        "previousScale",
-        "previousSibling",
-        "previousTranslate",
-        "primaryKey",
-        "primitiveType",
-        "primitiveUnits",
-        "principals",
-        "print",
-        "privateKey",
-        "probablySupportsContext",
-        "process",
-        "processIceMessage",
-        "product",
-        "productSub",
-        "profile",
-        "profileEnd",
-        "profiles",
-        "prompt",
-        "properties",
-        "propertyIsEnumerable",
-        "propertyName",
-        "protocol",
-        "protocolLong",
-        "prototype",
-        "pseudoClass",
-        "pseudoElement",
-        "publicId",
-        "publicKey",
-        "published",
-        "push",
-        "pushNotification",
-        "pushState",
-        "put",
-        "putImageData",
-        "quadraticCurveTo",
-        "qualifier",
-        "queryCommandEnabled",
-        "queryCommandIndeterm",
-        "queryCommandState",
-        "queryCommandSupported",
-        "queryCommandText",
-        "queryCommandValue",
-        "querySelector",
-        "querySelectorAll",
-        "quote",
-        "quotes",
-        "r",
-        "r1",
-        "r2",
-        "race",
-        "radiogroup",
-        "radiusX",
-        "radiusY",
-        "random",
-        "range",
-        "rangeCount",
-        "rangeMax",
-        "rangeMin",
-        "rangeOffset",
-        "rangeOverflow",
-        "rangeParent",
-        "rangeUnderflow",
-        "rate",
-        "ratio",
-        "raw",
-        "read",
-        "readAsArrayBuffer",
-        "readAsBinaryString",
-        "readAsBlob",
-        "readAsDataURL",
-        "readAsText",
-        "readOnly",
-        "readPixels",
-        "readReportRequested",
-        "readyState",
-        "reason",
-        "reboot",
-        "receiver",
-        "receivers",
-        "recordNumber",
-        "recordset",
-        "rect",
-        "red",
-        "redirectCount",
-        "redirectEnd",
-        "redirectStart",
-        "reduce",
-        "reduceRight",
-        "reduction",
-        "refDistance",
-        "refX",
-        "refY",
-        "referenceNode",
-        "referrer",
-        "refresh",
-        "region",
-        "regionAnchorX",
-        "regionAnchorY",
-        "regionId",
-        "regions",
-        "register",
-        "registerContentHandler",
-        "registerElement",
-        "registerProtocolHandler",
-        "reject",
-        "rel",
-        "relList",
-        "relatedNode",
-        "relatedTarget",
-        "release",
-        "releaseCapture",
-        "releaseEvents",
-        "releasePointerCapture",
-        "releaseShaderCompiler",
-        "reliable",
-        "reload",
-        "remainingSpace",
-        "remoteDescription",
-        "remove",
-        "removeAllRanges",
-        "removeAttribute",
-        "removeAttributeNS",
-        "removeAttributeNode",
-        "removeBehavior",
-        "removeChild",
-        "removeCue",
-        "removeEventListener",
-        "removeFilter",
-        "removeImport",
-        "removeItem",
-        "removeListener",
-        "removeNamedItem",
-        "removeNamedItemNS",
-        "removeNode",
-        "removeParameter",
-        "removeProperty",
-        "removeRange",
-        "removeRegion",
-        "removeRule",
-        "removeSiteSpecificTrackingException",
-        "removeSourceBuffer",
-        "removeStream",
-        "removeTrack",
-        "removeVariable",
-        "removeWakeLockListener",
-        "removeWebWideTrackingException",
-        "removedNodes",
-        "renderbufferStorage",
-        "renderedBuffer",
-        "renderingMode",
-        "repeat",
-        "replace",
-        "replaceAdjacentText",
-        "replaceChild",
-        "replaceData",
-        "replaceId",
-        "replaceItem",
-        "replaceNode",
-        "replaceState",
-        "replaceTrack",
-        "replaceWholeText",
-        "reportValidity",
-        "requestAnimationFrame",
-        "requestAutocomplete",
-        "requestData",
-        "requestFullscreen",
-        "requestMediaKeySystemAccess",
-        "requestPermission",
-        "requestPointerLock",
-        "requestStart",
-        "requestingWindow",
-        "required",
-        "requiredExtensions",
-        "requiredFeatures",
-        "reset",
-        "resetTransform",
-        "resize",
-        "resizeBy",
-        "resizeTo",
-        "resolve",
-        "response",
-        "responseBody",
-        "responseEnd",
-        "responseStart",
-        "responseText",
-        "responseType",
-        "responseURL",
-        "responseXML",
-        "restore",
-        "result",
-        "resultType",
-        "resume",
-        "returnValue",
-        "rev",
-        "reverse",
-        "reversed",
-        "revocable",
-        "revokeObjectURL",
-        "rgbColor",
-        "right",
-        "rightContext",
-        "rightMargin",
-        "rolloffFactor",
-        "root",
-        "rootElement",
-        "rotate",
-        "rotateAxisAngle",
-        "rotateAxisAngleSelf",
-        "rotateFromVector",
-        "rotateFromVectorSelf",
-        "rotateSelf",
-        "rotation",
-        "rotationRate",
-        "round",
-        "rowIndex",
-        "rowSpan",
-        "rows",
-        "rubyAlign",
-        "rubyOverhang",
-        "rubyPosition",
-        "rules",
-        "runtime",
-        "runtimeStyle",
-        "rx",
-        "ry",
-        "safari",
-        "sampleCoverage",
-        "sampleRate",
-        "sandbox",
-        "save",
-        "scale",
-        "scale3d",
-        "scale3dSelf",
-        "scaleNonUniform",
-        "scaleNonUniformSelf",
-        "scaleSelf",
-        "scheme",
-        "scissor",
-        "scope",
-        "scopeName",
-        "scoped",
-        "screen",
-        "screenBrightness",
-        "screenEnabled",
-        "screenLeft",
-        "screenPixelToMillimeterX",
-        "screenPixelToMillimeterY",
-        "screenTop",
-        "screenX",
-        "screenY",
-        "scripts",
-        "scroll",
-        "scroll-behavior",
-        "scrollAmount",
-        "scrollBehavior",
-        "scrollBy",
-        "scrollByLines",
-        "scrollByPages",
-        "scrollDelay",
-        "scrollHeight",
-        "scrollIntoView",
-        "scrollIntoViewIfNeeded",
-        "scrollLeft",
-        "scrollLeftMax",
-        "scrollMaxX",
-        "scrollMaxY",
-        "scrollTo",
-        "scrollTop",
-        "scrollTopMax",
-        "scrollWidth",
-        "scrollX",
-        "scrollY",
-        "scrollbar3dLightColor",
-        "scrollbarArrowColor",
-        "scrollbarBaseColor",
-        "scrollbarDarkShadowColor",
-        "scrollbarFaceColor",
-        "scrollbarHighlightColor",
-        "scrollbarShadowColor",
-        "scrollbarTrackColor",
-        "scrollbars",
-        "scrolling",
-        "sdp",
-        "sdpMLineIndex",
-        "sdpMid",
-        "seal",
-        "search",
-        "searchBox",
-        "searchBoxJavaBridge_",
-        "searchParams",
-        "sectionRowIndex",
-        "secureConnectionStart",
-        "security",
-        "seed",
-        "seekable",
-        "seeking",
-        "select",
-        "selectAllChildren",
-        "selectNode",
-        "selectNodeContents",
-        "selectNodes",
-        "selectSingleNode",
-        "selectSubString",
-        "selected",
-        "selectedIndex",
-        "selectedOptions",
-        "selectedStyleSheetSet",
-        "selectedStylesheetSet",
-        "selection",
-        "selectionDirection",
-        "selectionEnd",
-        "selectionStart",
-        "selector",
-        "selectorText",
-        "self",
-        "send",
-        "sendAsBinary",
-        "sendBeacon",
-        "sender",
-        "sentTimestamp",
-        "separator",
-        "serializeToString",
-        "serviceWorker",
-        "sessionId",
-        "sessionStorage",
-        "set",
-        "setActive",
-        "setAlpha",
-        "setAttribute",
-        "setAttributeNS",
-        "setAttributeNode",
-        "setAttributeNodeNS",
-        "setBaseAndExtent",
-        "setBingCurrentSearchDefault",
-        "setCapture",
-        "setColor",
-        "setCompositeOperation",
-        "setCurrentTime",
-        "setCustomValidity",
-        "setData",
-        "setDate",
-        "setDragImage",
-        "setEnd",
-        "setEndAfter",
-        "setEndBefore",
-        "setEndPoint",
-        "setFillColor",
-        "setFilterRes",
-        "setFloat32",
-        "setFloat64",
-        "setFloatValue",
-        "setFullYear",
-        "setHours",
-        "setImmediate",
-        "setInt16",
-        "setInt32",
-        "setInt8",
-        "setInterval",
-        "setItem",
-        "setLineCap",
-        "setLineDash",
-        "setLineJoin",
-        "setLineWidth",
-        "setLocalDescription",
-        "setMatrix",
-        "setMatrixValue",
-        "setMediaKeys",
-        "setMilliseconds",
-        "setMinutes",
-        "setMiterLimit",
-        "setMonth",
-        "setNamedItem",
-        "setNamedItemNS",
-        "setNonUserCodeExceptions",
-        "setOrientToAngle",
-        "setOrientToAuto",
-        "setOrientation",
-        "setOverrideHistoryNavigationMode",
-        "setPaint",
-        "setParameter",
-        "setPeriodicWave",
-        "setPointerCapture",
-        "setPosition",
-        "setPreference",
-        "setProperty",
-        "setPrototypeOf",
-        "setRGBColor",
-        "setRGBColorICCColor",
-        "setRadius",
-        "setRangeText",
-        "setRemoteDescription",
-        "setRequestHeader",
-        "setResizable",
-        "setResourceTimingBufferSize",
-        "setRotate",
-        "setScale",
-        "setSeconds",
-        "setSelectionRange",
-        "setServerCertificate",
-        "setShadow",
-        "setSkewX",
-        "setSkewY",
-        "setStart",
-        "setStartAfter",
-        "setStartBefore",
-        "setStdDeviation",
-        "setStringValue",
-        "setStrokeColor",
-        "setSuggestResult",
-        "setTargetAtTime",
-        "setTargetValueAtTime",
-        "setTime",
-        "setTimeout",
-        "setTransform",
-        "setTranslate",
-        "setUTCDate",
-        "setUTCFullYear",
-        "setUTCHours",
-        "setUTCMilliseconds",
-        "setUTCMinutes",
-        "setUTCMonth",
-        "setUTCSeconds",
-        "setUint16",
-        "setUint32",
-        "setUint8",
-        "setUri",
-        "setValueAtTime",
-        "setValueCurveAtTime",
-        "setVariable",
-        "setVelocity",
-        "setVersion",
-        "setYear",
-        "settingName",
-        "settingValue",
-        "sex",
-        "shaderSource",
-        "shadowBlur",
-        "shadowColor",
-        "shadowOffsetX",
-        "shadowOffsetY",
-        "shadowRoot",
-        "shape",
-        "shape-rendering",
-        "shapeRendering",
-        "sheet",
-        "shift",
-        "shiftKey",
-        "shiftLeft",
-        "show",
-        "showHelp",
-        "showModal",
-        "showModalDialog",
-        "showModelessDialog",
-        "showNotification",
-        "sidebar",
-        "sign",
-        "signalingState",
-        "sin",
-        "singleNodeValue",
-        "sinh",
-        "size",
-        "sizeToContent",
-        "sizes",
-        "skewX",
-        "skewXSelf",
-        "skewY",
-        "skewYSelf",
-        "slice",
-        "slope",
-        "small",
-        "smil",
-        "smoothingTimeConstant",
-        "snapToLines",
-        "snapshotItem",
-        "snapshotLength",
-        "some",
-        "sort",
-        "source",
-        "sourceBuffer",
-        "sourceBuffers",
-        "sourceIndex",
-        "spacing",
-        "span",
-        "speakAs",
-        "speaking",
-        "specified",
-        "specularConstant",
-        "specularExponent",
-        "speechSynthesis",
-        "speed",
-        "speedOfSound",
-        "spellcheck",
-        "splice",
-        "split",
-        "splitText",
-        "spreadMethod",
-        "sqrt",
-        "src",
-        "srcElement",
-        "srcFilter",
-        "srcUrn",
-        "srcdoc",
-        "srclang",
-        "srcset",
-        "stack",
-        "stackTraceLimit",
-        "stacktrace",
-        "standalone",
-        "standby",
-        "start",
-        "startContainer",
-        "startIce",
-        "startOffset",
-        "startRendering",
-        "startTime",
-        "startsWith",
-        "state",
-        "status",
-        "statusMessage",
-        "statusText",
-        "statusbar",
-        "stdDeviationX",
-        "stdDeviationY",
-        "stencilFunc",
-        "stencilFuncSeparate",
-        "stencilMask",
-        "stencilMaskSeparate",
-        "stencilOp",
-        "stencilOpSeparate",
-        "step",
-        "stepDown",
-        "stepMismatch",
-        "stepUp",
-        "sticky",
-        "stitchTiles",
-        "stop",
-        "stop-color",
-        "stop-opacity",
-        "stopColor",
-        "stopImmediatePropagation",
-        "stopOpacity",
-        "stopPropagation",
-        "storageArea",
-        "storageName",
-        "storageStatus",
-        "storeSiteSpecificTrackingException",
-        "storeWebWideTrackingException",
-        "stpVersion",
-        "stream",
-        "strike",
-        "stringValue",
-        "stringify",
-        "stroke",
-        "stroke-dasharray",
-        "stroke-dashoffset",
-        "stroke-linecap",
-        "stroke-linejoin",
-        "stroke-miterlimit",
-        "stroke-opacity",
-        "stroke-width",
-        "strokeDasharray",
-        "strokeDashoffset",
-        "strokeLinecap",
-        "strokeLinejoin",
-        "strokeMiterlimit",
-        "strokeOpacity",
-        "strokeRect",
-        "strokeStyle",
-        "strokeText",
-        "strokeWidth",
-        "style",
-        "styleFloat",
-        "styleMedia",
-        "styleSheet",
-        "styleSheetSets",
-        "styleSheets",
-        "sub",
-        "subarray",
-        "subject",
-        "submit",
-        "subscribe",
-        "substr",
-        "substring",
-        "substringData",
-        "subtle",
-        "suffix",
-        "suffixes",
-        "summary",
-        "sup",
-        "supports",
-        "surfaceScale",
-        "surroundContents",
-        "suspend",
-        "suspendRedraw",
-        "swapCache",
-        "swapNode",
-        "sweepFlag",
-        "symbols",
-        "system",
-        "systemCode",
-        "systemId",
-        "systemLanguage",
-        "systemXDPI",
-        "systemYDPI",
-        "tBodies",
-        "tFoot",
-        "tHead",
-        "tabIndex",
-        "table",
-        "table-layout",
-        "tableLayout",
-        "tableValues",
-        "tag",
-        "tagName",
-        "tagUrn",
-        "tags",
-        "taintEnabled",
-        "takeRecords",
-        "tan",
-        "tanh",
-        "target",
-        "targetElement",
-        "targetTouches",
-        "targetX",
-        "targetY",
-        "tel",
-        "terminate",
-        "test",
-        "texImage2D",
-        "texParameterf",
-        "texParameteri",
-        "texSubImage2D",
-        "text",
-        "text-align",
-        "text-anchor",
-        "text-decoration",
-        "text-decoration-color",
-        "text-decoration-line",
-        "text-decoration-style",
-        "text-indent",
-        "text-overflow",
-        "text-rendering",
-        "text-shadow",
-        "text-transform",
-        "textAlign",
-        "textAlignLast",
-        "textAnchor",
-        "textAutospace",
-        "textBaseline",
-        "textContent",
-        "textDecoration",
-        "textDecorationBlink",
-        "textDecorationColor",
-        "textDecorationLine",
-        "textDecorationLineThrough",
-        "textDecorationNone",
-        "textDecorationOverline",
-        "textDecorationStyle",
-        "textDecorationUnderline",
-        "textIndent",
-        "textJustify",
-        "textJustifyTrim",
-        "textKashida",
-        "textKashidaSpace",
-        "textLength",
-        "textOverflow",
-        "textRendering",
-        "textShadow",
-        "textTracks",
-        "textTransform",
-        "textUnderlinePosition",
-        "then",
-        "threadId",
-        "threshold",
-        "tiltX",
-        "tiltY",
-        "time",
-        "timeEnd",
-        "timeStamp",
-        "timeout",
-        "timestamp",
-        "timestampOffset",
-        "timing",
-        "title",
-        "toArray",
-        "toBlob",
-        "toDataURL",
-        "toDateString",
-        "toElement",
-        "toExponential",
-        "toFixed",
-        "toFloat32Array",
-        "toFloat64Array",
-        "toGMTString",
-        "toISOString",
-        "toJSON",
-        "toLocaleDateString",
-        "toLocaleFormat",
-        "toLocaleLowerCase",
-        "toLocaleString",
-        "toLocaleTimeString",
-        "toLocaleUpperCase",
-        "toLowerCase",
-        "toMethod",
-        "toPrecision",
-        "toSdp",
-        "toSource",
-        "toStaticHTML",
-        "toString",
-        "toStringTag",
-        "toTimeString",
-        "toUTCString",
-        "toUpperCase",
-        "toggle",
-        "toggleLongPressEnabled",
-        "tooLong",
-        "toolbar",
-        "top",
-        "topMargin",
-        "total",
-        "totalFrameDelay",
-        "totalVideoFrames",
-        "touchAction",
-        "touches",
-        "trace",
-        "track",
-        "transaction",
-        "transactions",
-        "transform",
-        "transform-origin",
-        "transform-style",
-        "transformOrigin",
-        "transformPoint",
-        "transformString",
-        "transformStyle",
-        "transformToDocument",
-        "transformToFragment",
-        "transition",
-        "transition-delay",
-        "transition-duration",
-        "transition-property",
-        "transition-timing-function",
-        "transitionDelay",
-        "transitionDuration",
-        "transitionProperty",
-        "transitionTimingFunction",
-        "translate",
-        "translateSelf",
-        "translationX",
-        "translationY",
-        "trim",
-        "trimLeft",
-        "trimRight",
-        "trueSpeed",
-        "trunc",
-        "truncate",
-        "type",
-        "typeDetail",
-        "typeMismatch",
-        "typeMustMatch",
-        "types",
-        "ubound",
-        "undefined",
-        "unescape",
-        "uneval",
-        "unicode-bidi",
-        "unicodeBidi",
-        "uniform1f",
-        "uniform1fv",
-        "uniform1i",
-        "uniform1iv",
-        "uniform2f",
-        "uniform2fv",
-        "uniform2i",
-        "uniform2iv",
-        "uniform3f",
-        "uniform3fv",
-        "uniform3i",
-        "uniform3iv",
-        "uniform4f",
-        "uniform4fv",
-        "uniform4i",
-        "uniform4iv",
-        "uniformMatrix2fv",
-        "uniformMatrix3fv",
-        "uniformMatrix4fv",
-        "unique",
-        "uniqueID",
-        "uniqueNumber",
-        "unitType",
-        "units",
-        "unloadEventEnd",
-        "unloadEventStart",
-        "unlock",
-        "unmount",
-        "unobserve",
-        "unpause",
-        "unpauseAnimations",
-        "unreadCount",
-        "unregister",
-        "unregisterContentHandler",
-        "unregisterProtocolHandler",
-        "unscopables",
-        "unselectable",
-        "unshift",
-        "unsubscribe",
-        "unsuspendRedraw",
-        "unsuspendRedrawAll",
-        "unwatch",
-        "unwrapKey",
-        "update",
-        "updateCommands",
-        "updateIce",
-        "updateInterval",
-        "updateSettings",
-        "updated",
-        "updating",
-        "upload",
-        "upper",
-        "upperBound",
-        "upperOpen",
-        "uri",
-        "url",
-        "urn",
-        "urns",
-        "usages",
-        "useCurrentView",
-        "useMap",
-        "useProgram",
-        "usedSpace",
-        "userAgent",
-        "userLanguage",
-        "username",
-        "v8BreakIterator",
-        "vAlign",
-        "vLink",
-        "valid",
-        "validateProgram",
-        "validationMessage",
-        "validity",
-        "value",
-        "valueAsDate",
-        "valueAsNumber",
-        "valueAsString",
-        "valueInSpecifiedUnits",
-        "valueMissing",
-        "valueOf",
-        "valueText",
-        "valueType",
-        "values",
-        "vector-effect",
-        "vectorEffect",
-        "velocityAngular",
-        "velocityExpansion",
-        "velocityX",
-        "velocityY",
-        "vendor",
-        "vendorSub",
-        "verify",
-        "version",
-        "vertexAttrib1f",
-        "vertexAttrib1fv",
-        "vertexAttrib2f",
-        "vertexAttrib2fv",
-        "vertexAttrib3f",
-        "vertexAttrib3fv",
-        "vertexAttrib4f",
-        "vertexAttrib4fv",
-        "vertexAttribDivisorANGLE",
-        "vertexAttribPointer",
-        "vertical",
-        "vertical-align",
-        "verticalAlign",
-        "verticalOverflow",
-        "vibrate",
-        "videoHeight",
-        "videoTracks",
-        "videoWidth",
-        "view",
-        "viewBox",
-        "viewBoxString",
-        "viewTarget",
-        "viewTargetString",
-        "viewport",
-        "viewportAnchorX",
-        "viewportAnchorY",
-        "viewportElement",
-        "visibility",
-        "visibilityState",
-        "visible",
-        "vlinkColor",
-        "voice",
-        "volume",
-        "vrml",
-        "vspace",
-        "w",
-        "wand",
-        "warn",
-        "wasClean",
-        "watch",
-        "watchPosition",
-        "webdriver",
-        "webkitAddKey",
-        "webkitAnimation",
-        "webkitAnimationDelay",
-        "webkitAnimationDirection",
-        "webkitAnimationDuration",
-        "webkitAnimationFillMode",
-        "webkitAnimationIterationCount",
-        "webkitAnimationName",
-        "webkitAnimationPlayState",
-        "webkitAnimationTimingFunction",
-        "webkitAppearance",
-        "webkitAudioContext",
-        "webkitAudioDecodedByteCount",
-        "webkitAudioPannerNode",
-        "webkitBackfaceVisibility",
-        "webkitBackground",
-        "webkitBackgroundAttachment",
-        "webkitBackgroundClip",
-        "webkitBackgroundColor",
-        "webkitBackgroundImage",
-        "webkitBackgroundOrigin",
-        "webkitBackgroundPosition",
-        "webkitBackgroundPositionX",
-        "webkitBackgroundPositionY",
-        "webkitBackgroundRepeat",
-        "webkitBackgroundSize",
-        "webkitBackingStorePixelRatio",
-        "webkitBorderImage",
-        "webkitBorderImageOutset",
-        "webkitBorderImageRepeat",
-        "webkitBorderImageSlice",
-        "webkitBorderImageSource",
-        "webkitBorderImageWidth",
-        "webkitBoxAlign",
-        "webkitBoxDirection",
-        "webkitBoxFlex",
-        "webkitBoxOrdinalGroup",
-        "webkitBoxOrient",
-        "webkitBoxPack",
-        "webkitBoxSizing",
-        "webkitCancelAnimationFrame",
-        "webkitCancelFullScreen",
-        "webkitCancelKeyRequest",
-        "webkitCancelRequestAnimationFrame",
-        "webkitClearResourceTimings",
-        "webkitClosedCaptionsVisible",
-        "webkitConvertPointFromNodeToPage",
-        "webkitConvertPointFromPageToNode",
-        "webkitCreateShadowRoot",
-        "webkitCurrentFullScreenElement",
-        "webkitCurrentPlaybackTargetIsWireless",
-        "webkitDirectionInvertedFromDevice",
-        "webkitDisplayingFullscreen",
-        "webkitEnterFullScreen",
-        "webkitEnterFullscreen",
-        "webkitExitFullScreen",
-        "webkitExitFullscreen",
-        "webkitExitPointerLock",
-        "webkitFullScreenKeyboardInputAllowed",
-        "webkitFullscreenElement",
-        "webkitFullscreenEnabled",
-        "webkitGenerateKeyRequest",
-        "webkitGetAsEntry",
-        "webkitGetDatabaseNames",
-        "webkitGetEntries",
-        "webkitGetEntriesByName",
-        "webkitGetEntriesByType",
-        "webkitGetFlowByName",
-        "webkitGetGamepads",
-        "webkitGetImageDataHD",
-        "webkitGetNamedFlows",
-        "webkitGetRegionFlowRanges",
-        "webkitGetUserMedia",
-        "webkitHasClosedCaptions",
-        "webkitHidden",
-        "webkitIDBCursor",
-        "webkitIDBDatabase",
-        "webkitIDBDatabaseError",
-        "webkitIDBDatabaseException",
-        "webkitIDBFactory",
-        "webkitIDBIndex",
-        "webkitIDBKeyRange",
-        "webkitIDBObjectStore",
-        "webkitIDBRequest",
-        "webkitIDBTransaction",
-        "webkitImageSmoothingEnabled",
-        "webkitIndexedDB",
-        "webkitInitMessageEvent",
-        "webkitIsFullScreen",
-        "webkitKeys",
-        "webkitLineDashOffset",
-        "webkitLockOrientation",
-        "webkitMatchesSelector",
-        "webkitMediaStream",
-        "webkitNotifications",
-        "webkitOfflineAudioContext",
-        "webkitOrientation",
-        "webkitPeerConnection00",
-        "webkitPersistentStorage",
-        "webkitPointerLockElement",
-        "webkitPostMessage",
-        "webkitPreservesPitch",
-        "webkitPutImageDataHD",
-        "webkitRTCPeerConnection",
-        "webkitRegionOverset",
-        "webkitRequestAnimationFrame",
-        "webkitRequestFileSystem",
-        "webkitRequestFullScreen",
-        "webkitRequestFullscreen",
-        "webkitRequestPointerLock",
-        "webkitResolveLocalFileSystemURL",
-        "webkitSetMediaKeys",
-        "webkitSetResourceTimingBufferSize",
-        "webkitShadowRoot",
-        "webkitShowPlaybackTargetPicker",
-        "webkitSlice",
-        "webkitSpeechGrammar",
-        "webkitSpeechGrammarList",
-        "webkitSpeechRecognition",
-        "webkitSpeechRecognitionError",
-        "webkitSpeechRecognitionEvent",
-        "webkitStorageInfo",
-        "webkitSupportsFullscreen",
-        "webkitTemporaryStorage",
-        "webkitTextSizeAdjust",
-        "webkitTransform",
-        "webkitTransformOrigin",
-        "webkitTransition",
-        "webkitTransitionDelay",
-        "webkitTransitionDuration",
-        "webkitTransitionProperty",
-        "webkitTransitionTimingFunction",
-        "webkitURL",
-        "webkitUnlockOrientation",
-        "webkitUserSelect",
-        "webkitVideoDecodedByteCount",
-        "webkitVisibilityState",
-        "webkitWirelessVideoPlaybackDisabled",
-        "webkitdropzone",
-        "webstore",
-        "weight",
-        "whatToShow",
-        "wheelDelta",
-        "wheelDeltaX",
-        "wheelDeltaY",
-        "which",
-        "white-space",
-        "whiteSpace",
-        "wholeText",
-        "widows",
-        "width",
-        "will-change",
-        "willChange",
-        "willValidate",
-        "window",
-        "withCredentials",
-        "word-break",
-        "word-spacing",
-        "word-wrap",
-        "wordBreak",
-        "wordSpacing",
-        "wordWrap",
-        "wrap",
-        "wrapKey",
-        "write",
-        "writeln",
-        "writingMode",
-        "x",
-        "x1",
-        "x2",
-        "xChannelSelector",
-        "xmlEncoding",
-        "xmlStandalone",
-        "xmlVersion",
-        "xmlbase",
-        "xmllang",
-        "xmlspace",
-        "y",
-        "y1",
-        "y2",
-        "yChannelSelector",
-        "yandex",
-        "z",
-        "z-index",
-        "zIndex",
-        "zoom",
-        "zoomAndPan",
-        "zoomRectScreen"
-    ]
-}
+[
+    "$&",
+    "$'",
+    "$*",
+    "$+",
+    "$1",
+    "$2",
+    "$3",
+    "$4",
+    "$5",
+    "$6",
+    "$7",
+    "$8",
+    "$9",
+    "$_",
+    "$`",
+    "$input",
+    "-moz-animation",
+    "-moz-animation-delay",
+    "-moz-animation-direction",
+    "-moz-animation-duration",
+    "-moz-animation-fill-mode",
+    "-moz-animation-iteration-count",
+    "-moz-animation-name",
+    "-moz-animation-play-state",
+    "-moz-animation-timing-function",
+    "-moz-appearance",
+    "-moz-backface-visibility",
+    "-moz-binding",
+    "-moz-border-end",
+    "-moz-border-end-color",
+    "-moz-border-end-style",
+    "-moz-border-end-width",
+    "-moz-border-image",
+    "-moz-border-start",
+    "-moz-border-start-color",
+    "-moz-border-start-style",
+    "-moz-border-start-width",
+    "-moz-box-align",
+    "-moz-box-direction",
+    "-moz-box-flex",
+    "-moz-box-ordinal-group",
+    "-moz-box-orient",
+    "-moz-box-pack",
+    "-moz-box-sizing",
+    "-moz-column-count",
+    "-moz-column-fill",
+    "-moz-column-gap",
+    "-moz-column-rule",
+    "-moz-column-rule-color",
+    "-moz-column-rule-style",
+    "-moz-column-rule-width",
+    "-moz-column-width",
+    "-moz-columns",
+    "-moz-float-edge",
+    "-moz-font-feature-settings",
+    "-moz-font-language-override",
+    "-moz-force-broken-image-icon",
+    "-moz-hyphens",
+    "-moz-image-region",
+    "-moz-margin-end",
+    "-moz-margin-start",
+    "-moz-orient",
+    "-moz-outline-radius",
+    "-moz-outline-radius-bottomleft",
+    "-moz-outline-radius-bottomright",
+    "-moz-outline-radius-topleft",
+    "-moz-outline-radius-topright",
+    "-moz-padding-end",
+    "-moz-padding-start",
+    "-moz-perspective",
+    "-moz-perspective-origin",
+    "-moz-stack-sizing",
+    "-moz-tab-size",
+    "-moz-text-size-adjust",
+    "-moz-transform",
+    "-moz-transform-origin",
+    "-moz-transform-style",
+    "-moz-transition",
+    "-moz-transition-delay",
+    "-moz-transition-duration",
+    "-moz-transition-property",
+    "-moz-transition-timing-function",
+    "-moz-user-focus",
+    "-moz-user-input",
+    "-moz-user-modify",
+    "-moz-user-select",
+    "-moz-window-dragging",
+    "-webkit-align-content",
+    "-webkit-align-items",
+    "-webkit-align-self",
+    "-webkit-animation",
+    "-webkit-animation-delay",
+    "-webkit-animation-direction",
+    "-webkit-animation-duration",
+    "-webkit-animation-fill-mode",
+    "-webkit-animation-iteration-count",
+    "-webkit-animation-name",
+    "-webkit-animation-play-state",
+    "-webkit-animation-timing-function",
+    "-webkit-appearance",
+    "-webkit-backface-visibility",
+    "-webkit-background-clip",
+    "-webkit-background-origin",
+    "-webkit-background-size",
+    "-webkit-border-bottom-left-radius",
+    "-webkit-border-bottom-right-radius",
+    "-webkit-border-image",
+    "-webkit-border-radius",
+    "-webkit-border-top-left-radius",
+    "-webkit-border-top-right-radius",
+    "-webkit-box-align",
+    "-webkit-box-direction",
+    "-webkit-box-flex",
+    "-webkit-box-ordinal-group",
+    "-webkit-box-orient",
+    "-webkit-box-pack",
+    "-webkit-box-shadow",
+    "-webkit-box-sizing",
+    "-webkit-filter",
+    "-webkit-flex",
+    "-webkit-flex-basis",
+    "-webkit-flex-direction",
+    "-webkit-flex-flow",
+    "-webkit-flex-grow",
+    "-webkit-flex-shrink",
+    "-webkit-flex-wrap",
+    "-webkit-justify-content",
+    "-webkit-line-clamp",
+    "-webkit-mask",
+    "-webkit-mask-clip",
+    "-webkit-mask-composite",
+    "-webkit-mask-image",
+    "-webkit-mask-origin",
+    "-webkit-mask-position",
+    "-webkit-mask-position-x",
+    "-webkit-mask-position-y",
+    "-webkit-mask-repeat",
+    "-webkit-mask-size",
+    "-webkit-order",
+    "-webkit-perspective",
+    "-webkit-perspective-origin",
+    "-webkit-text-fill-color",
+    "-webkit-text-size-adjust",
+    "-webkit-text-stroke",
+    "-webkit-text-stroke-color",
+    "-webkit-text-stroke-width",
+    "-webkit-transform",
+    "-webkit-transform-origin",
+    "-webkit-transform-style",
+    "-webkit-transition",
+    "-webkit-transition-delay",
+    "-webkit-transition-duration",
+    "-webkit-transition-property",
+    "-webkit-transition-timing-function",
+    "-webkit-user-select",
+    "0",
+    "1",
+    "10",
+    "11",
+    "12",
+    "13",
+    "14",
+    "15",
+    "16",
+    "17",
+    "18",
+    "19",
+    "2",
+    "20",
+    "21",
+    "22",
+    "23",
+    "24",
+    "25",
+    "26",
+    "27",
+    "28",
+    "29",
+    "3",
+    "30",
+    "31",
+    "32",
+    "33",
+    "34",
+    "35",
+    "36",
+    "37",
+    "38",
+    "39",
+    "4",
+    "40",
+    "41",
+    "42",
+    "43",
+    "44",
+    "45",
+    "46",
+    "47",
+    "48",
+    "49",
+    "5",
+    "50",
+    "51",
+    "6",
+    "7",
+    "8",
+    "9",
+    "@@iterator",
+    "ABORT_ERR",
+    "ACTIVE",
+    "ACTIVE_ATTRIBUTES",
+    "ACTIVE_TEXTURE",
+    "ACTIVE_UNIFORMS",
+    "ACTIVE_UNIFORM_BLOCKS",
+    "ADDITION",
+    "ALIASED_LINE_WIDTH_RANGE",
+    "ALIASED_POINT_SIZE_RANGE",
+    "ALLOW_KEYBOARD_INPUT",
+    "ALLPASS",
+    "ALPHA",
+    "ALPHA_BITS",
+    "ALREADY_SIGNALED",
+    "ALT_MASK",
+    "ALWAYS",
+    "ANDROID",
+    "ANGLE_instanced_arrays",
+    "ANY_SAMPLES_PASSED",
+    "ANY_SAMPLES_PASSED_CONSERVATIVE",
+    "ANY_TYPE",
+    "ANY_UNORDERED_NODE_TYPE",
+    "APP_UPDATE",
+    "ARM",
+    "ARRAY_BUFFER",
+    "ARRAY_BUFFER_BINDING",
+    "ATTACHED_SHADERS",
+    "ATTRIBUTE_NODE",
+    "AT_TARGET",
+    "AbortController",
+    "AbortSignal",
+    "AbsoluteOrientationSensor",
+    "AbstractRange",
+    "Accelerometer",
+    "ActiveXObject",
+    "AddSearchProvider",
+    "AesGcmEncryptResult",
+    "AggregateError",
+    "AnalyserNode",
+    "Animation",
+    "AnimationEffect",
+    "AnimationEvent",
+    "AnimationPlaybackEvent",
+    "AnimationTimeline",
+    "AnonXMLHttpRequest",
+    "AppBannerPromptResult",
+    "ApplicationCache",
+    "ApplicationCacheErrorEvent",
+    "Array",
+    "ArrayBuffer",
+    "Atomics",
+    "Attr",
+    "Audio",
+    "AudioBuffer",
+    "AudioBufferSourceNode",
+    "AudioContext",
+    "AudioDestinationNode",
+    "AudioListener",
+    "AudioNode",
+    "AudioParam",
+    "AudioParamMap",
+    "AudioProcessingEvent",
+    "AudioScheduledSourceNode",
+    "AudioStreamTrack",
+    "AudioTrack",
+    "AudioTrackList",
+    "AudioWorklet",
+    "AudioWorkletNode",
+    "AuthenticatorAssertionResponse",
+    "AuthenticatorAttestationResponse",
+    "AuthenticatorResponse",
+    "AutocompleteErrorEvent",
+    "BACK",
+    "BAD_BOUNDARYPOINTS_ERR",
+    "BAD_REQUEST",
+    "BANDPASS",
+    "BLEND",
+    "BLEND_COLOR",
+    "BLEND_DST_ALPHA",
+    "BLEND_DST_RGB",
+    "BLEND_EQUATION",
+    "BLEND_EQUATION_ALPHA",
+    "BLEND_EQUATION_RGB",
+    "BLEND_SRC_ALPHA",
+    "BLEND_SRC_RGB",
+    "BLUE_BITS",
+    "BLUR",
+    "BOOL",
+    "BOOLEAN_TYPE",
+    "BOOL_VEC2",
+    "BOOL_VEC3",
+    "BOOL_VEC4",
+    "BOTH",
+    "BROWSER_DEFAULT_WEBGL",
+    "BUBBLING_PHASE",
+    "BUFFER_SIZE",
+    "BUFFER_USAGE",
+    "BYTE",
+    "BYTES_PER_ELEMENT",
+    "BackgroundFetchManager",
+    "BackgroundFetchRecord",
+    "BackgroundFetchRegistration",
+    "BarProp",
+    "BarcodeDetector",
+    "BaseAudioContext",
+    "BaseHref",
+    "BatteryManager",
+    "BeforeInstallPromptEvent",
+    "BeforeLoadEvent",
+    "BeforeUnloadEvent",
+    "BigInt",
+    "BigInt64Array",
+    "BigUint64Array",
+    "BiquadFilterNode",
+    "Blob",
+    "BlobEvent",
+    "Bluetooth",
+    "BluetoothCharacteristicProperties",
+    "BluetoothDevice",
+    "BluetoothRemoteGATTCharacteristic",
+    "BluetoothRemoteGATTDescriptor",
+    "BluetoothRemoteGATTServer",
+    "BluetoothRemoteGATTService",
+    "BluetoothUUID",
+    "BookmarkCollection",
+    "Boolean",
+    "BroadcastChannel",
+    "ByteLengthQueuingStrategy",
+    "CANNOT_RUN",
+    "CAPTURING_PHASE",
+    "CCW",
+    "CDATASection",
+    "CDATA_SECTION_NODE",
+    "CHANGE",
+    "CHARSET_RULE",
+    "CHECKING",
+    "CHROME_UPDATE",
+    "CLAMP_TO_EDGE",
+    "CLICK",
+    "CLOSED",
+    "CLOSING",
+    "COLOR",
+    "COLOR_ATTACHMENT0",
+    "COLOR_ATTACHMENT1",
+    "COLOR_ATTACHMENT10",
+    "COLOR_ATTACHMENT11",
+    "COLOR_ATTACHMENT12",
+    "COLOR_ATTACHMENT13",
+    "COLOR_ATTACHMENT14",
+    "COLOR_ATTACHMENT15",
+    "COLOR_ATTACHMENT2",
+    "COLOR_ATTACHMENT3",
+    "COLOR_ATTACHMENT4",
+    "COLOR_ATTACHMENT5",
+    "COLOR_ATTACHMENT6",
+    "COLOR_ATTACHMENT7",
+    "COLOR_ATTACHMENT8",
+    "COLOR_ATTACHMENT9",
+    "COLOR_BUFFER_BIT",
+    "COLOR_CLEAR_VALUE",
+    "COLOR_WRITEMASK",
+    "COMMENT_NODE",
+    "COMPARE_REF_TO_TEXTURE",
+    "COMPILE_STATUS",
+    "COMPRESSED_RGBA_S3TC_DXT1_EXT",
+    "COMPRESSED_RGBA_S3TC_DXT3_EXT",
+    "COMPRESSED_RGBA_S3TC_DXT5_EXT",
+    "COMPRESSED_RGB_S3TC_DXT1_EXT",
+    "COMPRESSED_TEXTURE_FORMATS",
+    "CONDITION_SATISFIED",
+    "CONFIGURATION_UNSUPPORTED",
+    "CONNECTING",
+    "CONSTANT_ALPHA",
+    "CONSTANT_COLOR",
+    "CONSTRAINT_ERR",
+    "CONTENT",
+    "CONTEXT_LOST_WEBGL",
+    "CONTROL_MASK",
+    "COPY_READ_BUFFER",
+    "COPY_READ_BUFFER_BINDING",
+    "COPY_WRITE_BUFFER",
+    "COPY_WRITE_BUFFER_BINDING",
+    "COUNTER_STYLE_RULE",
+    "CROS",
+    "CSS",
+    "CSS2Properties",
+    "CSSAnimation",
+    "CSSCharsetRule",
+    "CSSConditionRule",
+    "CSSCounterStyleRule",
+    "CSSFontFaceRule",
+    "CSSFontFeatureValuesRule",
+    "CSSGroupingRule",
+    "CSSImageValue",
+    "CSSImportRule",
+    "CSSKeyframeRule",
+    "CSSKeyframesRule",
+    "CSSKeywordValue",
+    "CSSMathInvert",
+    "CSSMathMax",
+    "CSSMathMin",
+    "CSSMathNegate",
+    "CSSMathProduct",
+    "CSSMathSum",
+    "CSSMathValue",
+    "CSSMatrixComponent",
+    "CSSMediaRule",
+    "CSSMozDocumentRule",
+    "CSSNameSpaceRule",
+    "CSSNamespaceRule",
+    "CSSNumericArray",
+    "CSSNumericValue",
+    "CSSPageRule",
+    "CSSPerspective",
+    "CSSPositionValue",
+    "CSSPrimitiveValue",
+    "CSSRotate",
+    "CSSRule",
+    "CSSRuleList",
+    "CSSScale",
+    "CSSSkew",
+    "CSSSkewX",
+    "CSSSkewY",
+    "CSSStyleDeclaration",
+    "CSSStyleRule",
+    "CSSStyleSheet",
+    "CSSStyleValue",
+    "CSSSupportsRule",
+    "CSSTransformComponent",
+    "CSSTransformValue",
+    "CSSTransition",
+    "CSSTranslate",
+    "CSSUnitValue",
+    "CSSUnknownRule",
+    "CSSUnparsedValue",
+    "CSSValue",
+    "CSSValueList",
+    "CSSVariableReferenceValue",
+    "CSSVariablesDeclaration",
+    "CSSVariablesRule",
+    "CSSViewportRule",
+    "CSS_ATTR",
+    "CSS_CM",
+    "CSS_COUNTER",
+    "CSS_CUSTOM",
+    "CSS_DEG",
+    "CSS_DIMENSION",
+    "CSS_EMS",
+    "CSS_EXS",
+    "CSS_FILTER_BLUR",
+    "CSS_FILTER_BRIGHTNESS",
+    "CSS_FILTER_CONTRAST",
+    "CSS_FILTER_CUSTOM",
+    "CSS_FILTER_DROP_SHADOW",
+    "CSS_FILTER_GRAYSCALE",
+    "CSS_FILTER_HUE_ROTATE",
+    "CSS_FILTER_INVERT",
+    "CSS_FILTER_OPACITY",
+    "CSS_FILTER_REFERENCE",
+    "CSS_FILTER_SATURATE",
+    "CSS_FILTER_SEPIA",
+    "CSS_GRAD",
+    "CSS_HZ",
+    "CSS_IDENT",
+    "CSS_IN",
+    "CSS_INHERIT",
+    "CSS_KHZ",
+    "CSS_MATRIX",
+    "CSS_MATRIX3D",
+    "CSS_MM",
+    "CSS_MS",
+    "CSS_NUMBER",
+    "CSS_PC",
+    "CSS_PERCENTAGE",
+    "CSS_PERSPECTIVE",
+    "CSS_PRIMITIVE_VALUE",
+    "CSS_PT",
+    "CSS_PX",
+    "CSS_RAD",
+    "CSS_RECT",
+    "CSS_RGBCOLOR",
+    "CSS_ROTATE",
+    "CSS_ROTATE3D",
+    "CSS_ROTATEX",
+    "CSS_ROTATEY",
+    "CSS_ROTATEZ",
+    "CSS_S",
+    "CSS_SCALE",
+    "CSS_SCALE3D",
+    "CSS_SCALEX",
+    "CSS_SCALEY",
+    "CSS_SCALEZ",
+    "CSS_SKEW",
+    "CSS_SKEWX",
+    "CSS_SKEWY",
+    "CSS_STRING",
+    "CSS_TRANSLATE",
+    "CSS_TRANSLATE3D",
+    "CSS_TRANSLATEX",
+    "CSS_TRANSLATEY",
+    "CSS_TRANSLATEZ",
+    "CSS_UNKNOWN",
+    "CSS_URI",
+    "CSS_VALUE_LIST",
+    "CSS_VH",
+    "CSS_VMAX",
+    "CSS_VMIN",
+    "CSS_VW",
+    "CULL_FACE",
+    "CULL_FACE_MODE",
+    "CURRENT_PROGRAM",
+    "CURRENT_QUERY",
+    "CURRENT_VERTEX_ATTRIB",
+    "CUSTOM",
+    "CW",
+    "Cache",
+    "CacheStorage",
+    "CanvasCaptureMediaStream",
+    "CanvasCaptureMediaStreamTrack",
+    "CanvasGradient",
+    "CanvasPattern",
+    "CanvasPixelArray",
+    "CanvasRenderingContext2D",
+    "CaretPosition",
+    "ChannelMergerNode",
+    "ChannelSplitterNode",
+    "CharacterData",
+    "Chrome PDF Plugin",
+    "Chrome PDF Viewer",
+    "ClientRect",
+    "ClientRectList",
+    "Clipboard",
+    "ClipboardEvent",
+    "ClipboardItem",
+    "CloseEvent",
+    "Collator",
+    "CollectGarbage",
+    "CommandEvent",
+    "Comment",
+    "CompileError",
+    "CompositionEvent",
+    "CompressionStream",
+    "Console",
+    "ConstantSourceNode",
+    "ControlRangeCollection",
+    "Controllers",
+    "ConvolverNode",
+    "Coordinates",
+    "CountQueuingStrategy",
+    "Counter",
+    "Credential",
+    "CredentialsContainer",
+    "Crypto",
+    "CryptoKey",
+    "CryptoOperation",
+    "CustomElementRegistry",
+    "CustomEvent",
+    "DATABASE_ERR",
+    "DATA_CLONE_ERR",
+    "DATA_ERR",
+    "DBLCLICK",
+    "DECR",
+    "DECR_WRAP",
+    "DELETE_STATUS",
+    "DEPTH",
+    "DEPTH24_STENCIL8",
+    "DEPTH32F_STENCIL8",
+    "DEPTH_ATTACHMENT",
+    "DEPTH_BITS",
+    "DEPTH_BUFFER_BIT",
+    "DEPTH_CLEAR_VALUE",
+    "DEPTH_COMPONENT",
+    "DEPTH_COMPONENT16",
+    "DEPTH_COMPONENT24",
+    "DEPTH_COMPONENT32F",
+    "DEPTH_FUNC",
+    "DEPTH_RANGE",
+    "DEPTH_STENCIL",
+    "DEPTH_STENCIL_ATTACHMENT",
+    "DEPTH_TEST",
+    "DEPTH_WRITEMASK",
+    "DEVICE_INELIGIBLE",
+    "DIRECTION_DOWN",
+    "DIRECTION_LEFT",
+    "DIRECTION_RIGHT",
+    "DIRECTION_UP",
+    "DISABLED",
+    "DISPATCH_REQUEST_ERR",
+    "DITHER",
+    "DOCUMENT_FRAGMENT_NODE",
+    "DOCUMENT_NODE",
+    "DOCUMENT_POSITION_CONTAINED_BY",
+    "DOCUMENT_POSITION_CONTAINS",
+    "DOCUMENT_POSITION_DISCONNECTED",
+    "DOCUMENT_POSITION_FOLLOWING",
+    "DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC",
+    "DOCUMENT_POSITION_PRECEDING",
+    "DOCUMENT_TYPE_NODE",
+    "DOMCursor",
+    "DOMError",
+    "DOMException",
+    "DOMImplementation",
+    "DOMImplementationLS",
+    "DOMMatrix",
+    "DOMMatrixReadOnly",
+    "DOMParser",
+    "DOMPoint",
+    "DOMPointReadOnly",
+    "DOMQuad",
+    "DOMRect",
+    "DOMRectList",
+    "DOMRectReadOnly",
+    "DOMRequest",
+    "DOMSTRING_SIZE_ERR",
+    "DOMSettableTokenList",
+    "DOMStringList",
+    "DOMStringMap",
+    "DOMTokenList",
+    "DOMTransactionEvent",
+    "DOM_DELTA_LINE",
+    "DOM_DELTA_PAGE",
+    "DOM_DELTA_PIXEL",
+    "DOM_INPUT_METHOD_DROP",
+    "DOM_INPUT_METHOD_HANDWRITING",
+    "DOM_INPUT_METHOD_IME",
+    "DOM_INPUT_METHOD_KEYBOARD",
+    "DOM_INPUT_METHOD_MULTIMODAL",
+    "DOM_INPUT_METHOD_OPTION",
+    "DOM_INPUT_METHOD_PASTE",
+    "DOM_INPUT_METHOD_SCRIPT",
+    "DOM_INPUT_METHOD_UNKNOWN",
+    "DOM_INPUT_METHOD_VOICE",
+    "DOM_KEY_LOCATION_JOYSTICK",
+    "DOM_KEY_LOCATION_LEFT",
+    "DOM_KEY_LOCATION_MOBILE",
+    "DOM_KEY_LOCATION_NUMPAD",
+    "DOM_KEY_LOCATION_RIGHT",
+    "DOM_KEY_LOCATION_STANDARD",
+    "DOM_VK_0",
+    "DOM_VK_1",
+    "DOM_VK_2",
+    "DOM_VK_3",
+    "DOM_VK_4",
+    "DOM_VK_5",
+    "DOM_VK_6",
+    "DOM_VK_7",
+    "DOM_VK_8",
+    "DOM_VK_9",
+    "DOM_VK_A",
+    "DOM_VK_ACCEPT",
+    "DOM_VK_ADD",
+    "DOM_VK_ALT",
+    "DOM_VK_ALTGR",
+    "DOM_VK_AMPERSAND",
+    "DOM_VK_ASTERISK",
+    "DOM_VK_AT",
+    "DOM_VK_ATTN",
+    "DOM_VK_B",
+    "DOM_VK_BACKSPACE",
+    "DOM_VK_BACK_QUOTE",
+    "DOM_VK_BACK_SLASH",
+    "DOM_VK_BACK_SPACE",
+    "DOM_VK_C",
+    "DOM_VK_CANCEL",
+    "DOM_VK_CAPS_LOCK",
+    "DOM_VK_CIRCUMFLEX",
+    "DOM_VK_CLEAR",
+    "DOM_VK_CLOSE_BRACKET",
+    "DOM_VK_CLOSE_CURLY_BRACKET",
+    "DOM_VK_CLOSE_PAREN",
+    "DOM_VK_COLON",
+    "DOM_VK_COMMA",
+    "DOM_VK_CONTEXT_MENU",
+    "DOM_VK_CONTROL",
+    "DOM_VK_CONVERT",
+    "DOM_VK_CRSEL",
+    "DOM_VK_CTRL",
+    "DOM_VK_D",
+    "DOM_VK_DECIMAL",
+    "DOM_VK_DELETE",
+    "DOM_VK_DIVIDE",
+    "DOM_VK_DOLLAR",
+    "DOM_VK_DOUBLE_QUOTE",
+    "DOM_VK_DOWN",
+    "DOM_VK_E",
+    "DOM_VK_EISU",
+    "DOM_VK_END",
+    "DOM_VK_ENTER",
+    "DOM_VK_EQUALS",
+    "DOM_VK_EREOF",
+    "DOM_VK_ESCAPE",
+    "DOM_VK_EXCLAMATION",
+    "DOM_VK_EXECUTE",
+    "DOM_VK_EXSEL",
+    "DOM_VK_F",
+    "DOM_VK_F1",
+    "DOM_VK_F10",
+    "DOM_VK_F11",
+    "DOM_VK_F12",
+    "DOM_VK_F13",
+    "DOM_VK_F14",
+    "DOM_VK_F15",
+    "DOM_VK_F16",
+    "DOM_VK_F17",
+    "DOM_VK_F18",
+    "DOM_VK_F19",
+    "DOM_VK_F2",
+    "DOM_VK_F20",
+    "DOM_VK_F21",
+    "DOM_VK_F22",
+    "DOM_VK_F23",
+    "DOM_VK_F24",
+    "DOM_VK_F25",
+    "DOM_VK_F26",
+    "DOM_VK_F27",
+    "DOM_VK_F28",
+    "DOM_VK_F29",
+    "DOM_VK_F3",
+    "DOM_VK_F30",
+    "DOM_VK_F31",
+    "DOM_VK_F32",
+    "DOM_VK_F33",
+    "DOM_VK_F34",
+    "DOM_VK_F35",
+    "DOM_VK_F36",
+    "DOM_VK_F4",
+    "DOM_VK_F5",
+    "DOM_VK_F6",
+    "DOM_VK_F7",
+    "DOM_VK_F8",
+    "DOM_VK_F9",
+    "DOM_VK_FINAL",
+    "DOM_VK_FRONT",
+    "DOM_VK_G",
+    "DOM_VK_GREATER_THAN",
+    "DOM_VK_H",
+    "DOM_VK_HANGUL",
+    "DOM_VK_HANJA",
+    "DOM_VK_HASH",
+    "DOM_VK_HELP",
+    "DOM_VK_HK_TOGGLE",
+    "DOM_VK_HOME",
+    "DOM_VK_HYPHEN_MINUS",
+    "DOM_VK_I",
+    "DOM_VK_INSERT",
+    "DOM_VK_J",
+    "DOM_VK_JUNJA",
+    "DOM_VK_K",
+    "DOM_VK_KANA",
+    "DOM_VK_KANJI",
+    "DOM_VK_L",
+    "DOM_VK_LEFT",
+    "DOM_VK_LEFT_TAB",
+    "DOM_VK_LESS_THAN",
+    "DOM_VK_M",
+    "DOM_VK_META",
+    "DOM_VK_MODECHANGE",
+    "DOM_VK_MULTIPLY",
+    "DOM_VK_N",
+    "DOM_VK_NONCONVERT",
+    "DOM_VK_NUMPAD0",
+    "DOM_VK_NUMPAD1",
+    "DOM_VK_NUMPAD2",
+    "DOM_VK_NUMPAD3",
+    "DOM_VK_NUMPAD4",
+    "DOM_VK_NUMPAD5",
+    "DOM_VK_NUMPAD6",
+    "DOM_VK_NUMPAD7",
+    "DOM_VK_NUMPAD8",
+    "DOM_VK_NUMPAD9",
+    "DOM_VK_NUM_LOCK",
+    "DOM_VK_O",
+    "DOM_VK_OEM_1",
+    "DOM_VK_OEM_102",
+    "DOM_VK_OEM_2",
+    "DOM_VK_OEM_3",
+    "DOM_VK_OEM_4",
+    "DOM_VK_OEM_5",
+    "DOM_VK_OEM_6",
+    "DOM_VK_OEM_7",
+    "DOM_VK_OEM_8",
+    "DOM_VK_OEM_COMMA",
+    "DOM_VK_OEM_MINUS",
+    "DOM_VK_OEM_PERIOD",
+    "DOM_VK_OEM_PLUS",
+    "DOM_VK_OPEN_BRACKET",
+    "DOM_VK_OPEN_CURLY_BRACKET",
+    "DOM_VK_OPEN_PAREN",
+    "DOM_VK_P",
+    "DOM_VK_PA1",
+    "DOM_VK_PAGEDOWN",
+    "DOM_VK_PAGEUP",
+    "DOM_VK_PAGE_DOWN",
+    "DOM_VK_PAGE_UP",
+    "DOM_VK_PAUSE",
+    "DOM_VK_PERCENT",
+    "DOM_VK_PERIOD",
+    "DOM_VK_PIPE",
+    "DOM_VK_PLAY",
+    "DOM_VK_PLUS",
+    "DOM_VK_PRINT",
+    "DOM_VK_PRINTSCREEN",
+    "DOM_VK_PROCESSKEY",
+    "DOM_VK_PROPERITES",
+    "DOM_VK_Q",
+    "DOM_VK_QUESTION_MARK",
+    "DOM_VK_QUOTE",
+    "DOM_VK_R",
+    "DOM_VK_REDO",
+    "DOM_VK_RETURN",
+    "DOM_VK_RIGHT",
+    "DOM_VK_S",
+    "DOM_VK_SCROLL_LOCK",
+    "DOM_VK_SELECT",
+    "DOM_VK_SEMICOLON",
+    "DOM_VK_SEPARATOR",
+    "DOM_VK_SHIFT",
+    "DOM_VK_SLASH",
+    "DOM_VK_SLEEP",
+    "DOM_VK_SPACE",
+    "DOM_VK_SUBTRACT",
+    "DOM_VK_T",
+    "DOM_VK_TAB",
+    "DOM_VK_TILDE",
+    "DOM_VK_U",
+    "DOM_VK_UNDERSCORE",
+    "DOM_VK_UNDO",
+    "DOM_VK_UNICODE",
+    "DOM_VK_UP",
+    "DOM_VK_V",
+    "DOM_VK_VOLUME_DOWN",
+    "DOM_VK_VOLUME_MUTE",
+    "DOM_VK_VOLUME_UP",
+    "DOM_VK_W",
+    "DOM_VK_WIN",
+    "DOM_VK_WINDOW",
+    "DOM_VK_WIN_ICO_00",
+    "DOM_VK_WIN_ICO_CLEAR",
+    "DOM_VK_WIN_ICO_HELP",
+    "DOM_VK_WIN_OEM_ATTN",
+    "DOM_VK_WIN_OEM_AUTO",
+    "DOM_VK_WIN_OEM_BACKTAB",
+    "DOM_VK_WIN_OEM_CLEAR",
+    "DOM_VK_WIN_OEM_COPY",
+    "DOM_VK_WIN_OEM_CUSEL",
+    "DOM_VK_WIN_OEM_ENLW",
+    "DOM_VK_WIN_OEM_FINISH",
+    "DOM_VK_WIN_OEM_FJ_JISHO",
+    "DOM_VK_WIN_OEM_FJ_LOYA",
+    "DOM_VK_WIN_OEM_FJ_MASSHOU",
+    "DOM_VK_WIN_OEM_FJ_ROYA",
+    "DOM_VK_WIN_OEM_FJ_TOUROKU",
+    "DOM_VK_WIN_OEM_JUMP",
+    "DOM_VK_WIN_OEM_PA1",
+    "DOM_VK_WIN_OEM_PA2",
+    "DOM_VK_WIN_OEM_PA3",
+    "DOM_VK_WIN_OEM_RESET",
+    "DOM_VK_WIN_OEM_WSCTRL",
+    "DOM_VK_X",
+    "DOM_VK_XF86XK_ADD_FAVORITE",
+    "DOM_VK_XF86XK_APPLICATION_LEFT",
+    "DOM_VK_XF86XK_APPLICATION_RIGHT",
+    "DOM_VK_XF86XK_AUDIO_CYCLE_TRACK",
+    "DOM_VK_XF86XK_AUDIO_FORWARD",
+    "DOM_VK_XF86XK_AUDIO_LOWER_VOLUME",
+    "DOM_VK_XF86XK_AUDIO_MEDIA",
+    "DOM_VK_XF86XK_AUDIO_MUTE",
+    "DOM_VK_XF86XK_AUDIO_NEXT",
+    "DOM_VK_XF86XK_AUDIO_PAUSE",
+    "DOM_VK_XF86XK_AUDIO_PLAY",
+    "DOM_VK_XF86XK_AUDIO_PREV",
+    "DOM_VK_XF86XK_AUDIO_RAISE_VOLUME",
+    "DOM_VK_XF86XK_AUDIO_RANDOM_PLAY",
+    "DOM_VK_XF86XK_AUDIO_RECORD",
+    "DOM_VK_XF86XK_AUDIO_REPEAT",
+    "DOM_VK_XF86XK_AUDIO_REWIND",
+    "DOM_VK_XF86XK_AUDIO_STOP",
+    "DOM_VK_XF86XK_AWAY",
+    "DOM_VK_XF86XK_BACK",
+    "DOM_VK_XF86XK_BACK_FORWARD",
+    "DOM_VK_XF86XK_BATTERY",
+    "DOM_VK_XF86XK_BLUE",
+    "DOM_VK_XF86XK_BLUETOOTH",
+    "DOM_VK_XF86XK_BOOK",
+    "DOM_VK_XF86XK_BRIGHTNESS_ADJUST",
+    "DOM_VK_XF86XK_CALCULATOR",
+    "DOM_VK_XF86XK_CALENDAR",
+    "DOM_VK_XF86XK_CD",
+    "DOM_VK_XF86XK_CLOSE",
+    "DOM_VK_XF86XK_COMMUNITY",
+    "DOM_VK_XF86XK_CONTRAST_ADJUST",
+    "DOM_VK_XF86XK_COPY",
+    "DOM_VK_XF86XK_CUT",
+    "DOM_VK_XF86XK_CYCLE_ANGLE",
+    "DOM_VK_XF86XK_DISPLAY",
+    "DOM_VK_XF86XK_DOCUMENTS",
+    "DOM_VK_XF86XK_DOS",
+    "DOM_VK_XF86XK_EJECT",
+    "DOM_VK_XF86XK_EXCEL",
+    "DOM_VK_XF86XK_EXPLORER",
+    "DOM_VK_XF86XK_FAVORITES",
+    "DOM_VK_XF86XK_FINANCE",
+    "DOM_VK_XF86XK_FORWARD",
+    "DOM_VK_XF86XK_FRAME_BACK",
+    "DOM_VK_XF86XK_FRAME_FORWARD",
+    "DOM_VK_XF86XK_GAME",
+    "DOM_VK_XF86XK_GO",
+    "DOM_VK_XF86XK_GREEN",
+    "DOM_VK_XF86XK_HIBERNATE",
+    "DOM_VK_XF86XK_HISTORY",
+    "DOM_VK_XF86XK_HOME_PAGE",
+    "DOM_VK_XF86XK_HOT_LINKS",
+    "DOM_VK_XF86XK_I_TOUCH",
+    "DOM_VK_XF86XK_KBD_BRIGHTNESS_DOWN",
+    "DOM_VK_XF86XK_KBD_BRIGHTNESS_UP",
+    "DOM_VK_XF86XK_KBD_LIGHT_ON_OFF",
+    "DOM_VK_XF86XK_LAUNCH0",
+    "DOM_VK_XF86XK_LAUNCH1",
+    "DOM_VK_XF86XK_LAUNCH2",
+    "DOM_VK_XF86XK_LAUNCH3",
+    "DOM_VK_XF86XK_LAUNCH4",
+    "DOM_VK_XF86XK_LAUNCH5",
+    "DOM_VK_XF86XK_LAUNCH6",
+    "DOM_VK_XF86XK_LAUNCH7",
+    "DOM_VK_XF86XK_LAUNCH8",
+    "DOM_VK_XF86XK_LAUNCH9",
+    "DOM_VK_XF86XK_LAUNCH_A",
+    "DOM_VK_XF86XK_LAUNCH_B",
+    "DOM_VK_XF86XK_LAUNCH_C",
+    "DOM_VK_XF86XK_LAUNCH_D",
+    "DOM_VK_XF86XK_LAUNCH_E",
+    "DOM_VK_XF86XK_LAUNCH_F",
+    "DOM_VK_XF86XK_LIGHT_BULB",
+    "DOM_VK_XF86XK_LOG_OFF",
+    "DOM_VK_XF86XK_MAIL",
+    "DOM_VK_XF86XK_MAIL_FORWARD",
+    "DOM_VK_XF86XK_MARKET",
+    "DOM_VK_XF86XK_MEETING",
+    "DOM_VK_XF86XK_MEMO",
+    "DOM_VK_XF86XK_MENU_KB",
+    "DOM_VK_XF86XK_MENU_PB",
+    "DOM_VK_XF86XK_MESSENGER",
+    "DOM_VK_XF86XK_MON_BRIGHTNESS_DOWN",
+    "DOM_VK_XF86XK_MON_BRIGHTNESS_UP",
+    "DOM_VK_XF86XK_MUSIC",
+    "DOM_VK_XF86XK_MY_COMPUTER",
+    "DOM_VK_XF86XK_MY_SITES",
+    "DOM_VK_XF86XK_NEW",
+    "DOM_VK_XF86XK_NEWS",
+    "DOM_VK_XF86XK_OFFICE_HOME",
+    "DOM_VK_XF86XK_OPEN",
+    "DOM_VK_XF86XK_OPEN_URL",
+    "DOM_VK_XF86XK_OPTION",
+    "DOM_VK_XF86XK_PASTE",
+    "DOM_VK_XF86XK_PHONE",
+    "DOM_VK_XF86XK_PICTURES",
+    "DOM_VK_XF86XK_POWER_DOWN",
+    "DOM_VK_XF86XK_POWER_OFF",
+    "DOM_VK_XF86XK_RED",
+    "DOM_VK_XF86XK_REFRESH",
+    "DOM_VK_XF86XK_RELOAD",
+    "DOM_VK_XF86XK_REPLY",
+    "DOM_VK_XF86XK_ROCKER_DOWN",
+    "DOM_VK_XF86XK_ROCKER_ENTER",
+    "DOM_VK_XF86XK_ROCKER_UP",
+    "DOM_VK_XF86XK_ROTATE_WINDOWS",
+    "DOM_VK_XF86XK_ROTATION_KB",
+    "DOM_VK_XF86XK_ROTATION_PB",
+    "DOM_VK_XF86XK_SAVE",
+    "DOM_VK_XF86XK_SCREEN_SAVER",
+    "DOM_VK_XF86XK_SCROLL_CLICK",
+    "DOM_VK_XF86XK_SCROLL_DOWN",
+    "DOM_VK_XF86XK_SCROLL_UP",
+    "DOM_VK_XF86XK_SEARCH",
+    "DOM_VK_XF86XK_SEND",
+    "DOM_VK_XF86XK_SHOP",
+    "DOM_VK_XF86XK_SPELL",
+    "DOM_VK_XF86XK_SPLIT_SCREEN",
+    "DOM_VK_XF86XK_STANDBY",
+    "DOM_VK_XF86XK_START",
+    "DOM_VK_XF86XK_STOP",
+    "DOM_VK_XF86XK_SUBTITLE",
+    "DOM_VK_XF86XK_SUPPORT",
+    "DOM_VK_XF86XK_SUSPEND",
+    "DOM_VK_XF86XK_TASK_PANE",
+    "DOM_VK_XF86XK_TERMINAL",
+    "DOM_VK_XF86XK_TIME",
+    "DOM_VK_XF86XK_TOOLS",
+    "DOM_VK_XF86XK_TOP_MENU",
+    "DOM_VK_XF86XK_TO_DO_LIST",
+    "DOM_VK_XF86XK_TRAVEL",
+    "DOM_VK_XF86XK_USER1KB",
+    "DOM_VK_XF86XK_USER2KB",
+    "DOM_VK_XF86XK_USER_PB",
+    "DOM_VK_XF86XK_UWB",
+    "DOM_VK_XF86XK_VENDOR_HOME",
+    "DOM_VK_XF86XK_VIDEO",
+    "DOM_VK_XF86XK_VIEW",
+    "DOM_VK_XF86XK_WAKE_UP",
+    "DOM_VK_XF86XK_WEB_CAM",
+    "DOM_VK_XF86XK_WHEEL_BUTTON",
+    "DOM_VK_XF86XK_WLAN",
+    "DOM_VK_XF86XK_WORD",
+    "DOM_VK_XF86XK_WWW",
+    "DOM_VK_XF86XK_XFER",
+    "DOM_VK_XF86XK_YELLOW",
+    "DOM_VK_XF86XK_ZOOM_IN",
+    "DOM_VK_XF86XK_ZOOM_OUT",
+    "DOM_VK_Y",
+    "DOM_VK_Z",
+    "DOM_VK_ZOOM",
+    "DONE",
+    "DONT_CARE",
+    "DOWNLOADING",
+    "DRAGDROP",
+    "DRAW_BUFFER0",
+    "DRAW_BUFFER1",
+    "DRAW_BUFFER10",
+    "DRAW_BUFFER11",
+    "DRAW_BUFFER12",
+    "DRAW_BUFFER13",
+    "DRAW_BUFFER14",
+    "DRAW_BUFFER15",
+    "DRAW_BUFFER2",
+    "DRAW_BUFFER3",
+    "DRAW_BUFFER4",
+    "DRAW_BUFFER5",
+    "DRAW_BUFFER6",
+    "DRAW_BUFFER7",
+    "DRAW_BUFFER8",
+    "DRAW_BUFFER9",
+    "DRAW_FRAMEBUFFER",
+    "DRAW_FRAMEBUFFER_BINDING",
+    "DST_ALPHA",
+    "DST_COLOR",
+    "DYNAMIC_COPY",
+    "DYNAMIC_DRAW",
+    "DYNAMIC_READ",
+    "DataChannel",
+    "DataCue",
+    "DataTransfer",
+    "DataTransferItem",
+    "DataTransferItemList",
+    "DataView",
+    "Database",
+    "Date",
+    "DateTimeFormat",
+    "Debug",
+    "DecompressionStream",
+    "Default Browser Helper",
+    "DelayNode",
+    "DesktopNotification",
+    "DesktopNotificationCenter",
+    "DeviceAcceleration",
+    "DeviceLightEvent",
+    "DeviceMotionEvent",
+    "DeviceMotionEventAcceleration",
+    "DeviceMotionEventRotationRate",
+    "DeviceOrientationEvent",
+    "DeviceProximityEvent",
+    "DeviceRotationRate",
+    "DeviceStorage",
+    "DeviceStorageChangeEvent",
+    "Directory",
+    "DisplayNames",
+    "Document",
+    "DocumentFragment",
+    "DocumentTimeline",
+    "DocumentType",
+    "DragEvent",
+    "DynamicsCompressorNode",
+    "E",
+    "ELEMENT_ARRAY_BUFFER",
+    "ELEMENT_ARRAY_BUFFER_BINDING",
+    "ELEMENT_NODE",
+    "EMPTY",
+    "ENCODING_ERR",
+    "ENDED",
+    "END_TO_END",
+    "END_TO_START",
+    "ENTITY_NODE",
+    "ENTITY_REFERENCE_NODE",
+    "EPSILON",
+    "EQUAL",
+    "EQUALPOWER",
+    "ERROR",
+    "EXPONENTIAL_DISTANCE",
+    "EXT_texture_filter_anisotropic",
+    "Element",
+    "ElementInternals",
+    "ElementQuery",
+    "EnterPictureInPictureEvent",
+    "Entity",
+    "EntityReference",
+    "Enumerator",
+    "Error",
+    "ErrorEvent",
+    "EvalError",
+    "Event",
+    "EventException",
+    "EventSource",
+    "EventTarget",
+    "External",
+    "FASTEST",
+    "FIDOSDK",
+    "FILTER_ACCEPT",
+    "FILTER_INTERRUPT",
+    "FILTER_REJECT",
+    "FILTER_SKIP",
+    "FINISHED_STATE",
+    "FIRST_ORDERED_NODE_TYPE",
+    "FLOAT",
+    "FLOAT_32_UNSIGNED_INT_24_8_REV",
+    "FLOAT_MAT2",
+    "FLOAT_MAT2x3",
+    "FLOAT_MAT2x4",
+    "FLOAT_MAT3",
+    "FLOAT_MAT3x2",
+    "FLOAT_MAT3x4",
+    "FLOAT_MAT4",
+    "FLOAT_MAT4x2",
+    "FLOAT_MAT4x3",
+    "FLOAT_VEC2",
+    "FLOAT_VEC3",
+    "FLOAT_VEC4",
+    "FOCUS",
+    "FONT_FACE_RULE",
+    "FONT_FEATURE_VALUES_RULE",
+    "FRAGMENT_SHADER",
+    "FRAGMENT_SHADER_DERIVATIVE_HINT",
+    "FRAGMENT_SHADER_DERIVATIVE_HINT_OES",
+    "FRAMEBUFFER",
+    "FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_BLUE_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING",
+    "FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE",
+    "FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_GREEN_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_OBJECT_NAME",
+    "FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE",
+    "FRAMEBUFFER_ATTACHMENT_RED_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE",
+    "FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE",
+    "FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER",
+    "FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL",
+    "FRAMEBUFFER_BINDING",
+    "FRAMEBUFFER_COMPLETE",
+    "FRAMEBUFFER_DEFAULT",
+    "FRAMEBUFFER_INCOMPLETE_ATTACHMENT",
+    "FRAMEBUFFER_INCOMPLETE_DIMENSIONS",
+    "FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT",
+    "FRAMEBUFFER_INCOMPLETE_MULTISAMPLE",
+    "FRAMEBUFFER_UNSUPPORTED",
+    "FRONT",
+    "FRONT_AND_BACK",
+    "FRONT_FACE",
+    "FUNC_ADD",
+    "FUNC_REVERSE_SUBTRACT",
+    "FUNC_SUBTRACT",
+    "FeaturePolicy",
+    "FederatedCredential",
+    "Feed",
+    "FeedEntry",
+    "File",
+    "FileError",
+    "FileList",
+    "FileReader",
+    "FileSystem",
+    "FileSystemDirectoryEntry",
+    "FileSystemDirectoryReader",
+    "FileSystemEntry",
+    "FileSystemFileEntry",
+    "FinalizationRegistry",
+    "FindInPage",
+    "Float32Array",
+    "Float64Array",
+    "FocusEvent",
+    "FontFace",
+    "FontFaceSet",
+    "FontFaceSetLoadEvent",
+    "FormData",
+    "FormDataEvent",
+    "FragmentDirective",
+    "Function",
+    "GENERATE_MIPMAP_HINT",
+    "GEQUAL",
+    "GREATER",
+    "GREEN_BITS",
+    "GainNode",
+    "Gamepad",
+    "GamepadButton",
+    "GamepadEvent",
+    "GamepadHapticActuator",
+    "GamepadPose",
+    "Geolocation",
+    "GeolocationCoordinates",
+    "GeolocationPosition",
+    "GeolocationPositionError",
+    "GestureEvent",
+    "Global",
+    "Gyroscope",
+    "HALF_FLOAT",
+    "HAVE_CURRENT_DATA",
+    "HAVE_ENOUGH_DATA",
+    "HAVE_FUTURE_DATA",
+    "HAVE_METADATA",
+    "HAVE_NOTHING",
+    "HEADERS_RECEIVED",
+    "HIDDEN",
+    "HIERARCHY_REQUEST_ERR",
+    "HIGHPASS",
+    "HIGHSHELF",
+    "HIGH_FLOAT",
+    "HIGH_INT",
+    "HORIZONTAL",
+    "HORIZONTAL_AXIS",
+    "HRTF",
+    "HTMLAllCollection",
+    "HTMLAnchorElement",
+    "HTMLAppletElement",
+    "HTMLAreaElement",
+    "HTMLAreasCollection",
+    "HTMLAudioElement",
+    "HTMLBGSoundElement",
+    "HTMLBRElement",
+    "HTMLBaseElement",
+    "HTMLBaseFontElement",
+    "HTMLBlockElement",
+    "HTMLBlockquoteElement",
+    "HTMLBodyElement",
+    "HTMLButtonElement",
+    "HTMLCanvasElement",
+    "HTMLCollection",
+    "HTMLCommandElement",
+    "HTMLContentElement",
+    "HTMLDDElement",
+    "HTMLDListElement",
+    "HTMLDTElement",
+    "HTMLDataElement",
+    "HTMLDataListElement",
+    "HTMLDetailsElement",
+    "HTMLDialogElement",
+    "HTMLDirectoryElement",
+    "HTMLDivElement",
+    "HTMLDocument",
+    "HTMLElement",
+    "HTMLEmbedElement",
+    "HTMLFieldSetElement",
+    "HTMLFontElement",
+    "HTMLFormControlsCollection",
+    "HTMLFormElement",
+    "HTMLFrameElement",
+    "HTMLFrameSetElement",
+    "HTMLHRElement",
+    "HTMLHeadElement",
+    "HTMLHeadingElement",
+    "HTMLHtmlElement",
+    "HTMLIFrameElement",
+    "HTMLImageElement",
+    "HTMLInputElement",
+    "HTMLIsIndexElement",
+    "HTMLKeygenElement",
+    "HTMLLIElement",
+    "HTMLLabelElement",
+    "HTMLLegendElement",
+    "HTMLLinkElement",
+    "HTMLMapElement",
+    "HTMLMarqueeElement",
+    "HTMLMediaElement",
+    "HTMLMenuElement",
+    "HTMLMenuItemElement",
+    "HTMLMetaElement",
+    "HTMLMeterElement",
+    "HTMLModElement",
+    "HTMLNextIdElement",
+    "HTMLOListElement",
+    "HTMLObjectElement",
+    "HTMLOptGroupElement",
+    "HTMLOptionElement",
+    "HTMLOptionsCollection",
+    "HTMLOutputElement",
+    "HTMLParagraphElement",
+    "HTMLParamElement",
+    "HTMLPhraseElement",
+    "HTMLPictureElement",
+    "HTMLPreElement",
+    "HTMLProgressElement",
+    "HTMLPropertiesCollection",
+    "HTMLQuoteElement",
+    "HTMLScriptElement",
+    "HTMLSelectElement",
+    "HTMLShadowElement",
+    "HTMLSlotElement",
+    "HTMLSourceElement",
+    "HTMLSpanElement",
+    "HTMLStyleElement",
+    "HTMLTableCaptionElement",
+    "HTMLTableCellElement",
+    "HTMLTableColElement",
+    "HTMLTableDataCellElement",
+    "HTMLTableElement",
+    "HTMLTableHeaderCellElement",
+    "HTMLTableRowElement",
+    "HTMLTableSectionElement",
+    "HTMLTemplateElement",
+    "HTMLTextAreaElement",
+    "HTMLTimeElement",
+    "HTMLTitleElement",
+    "HTMLTrackElement",
+    "HTMLUListElement",
+    "HTMLUnknownElement",
+    "HTMLVideoElement",
+    "HashChangeEvent",
+    "Headers",
+    "History",
+    "Hz",
+    "ICE_CHECKING",
+    "ICE_CLOSED",
+    "ICE_COMPLETED",
+    "ICE_CONNECTED",
+    "ICE_FAILED",
+    "ICE_GATHERING",
+    "ICE_WAITING",
+    "IDBCursor",
+    "IDBCursorWithValue",
+    "IDBDatabase",
+    "IDBDatabaseException",
+    "IDBFactory",
+    "IDBFileHandle",
+    "IDBFileRequest",
+    "IDBIndex",
+    "IDBKeyRange",
+    "IDBMutableFile",
+    "IDBObjectStore",
+    "IDBOpenDBRequest",
+    "IDBRequest",
+    "IDBTransaction",
+    "IDBVersionChangeEvent",
+    "IDLE",
+    "IIRFilterNode",
+    "IMPLEMENTATION_COLOR_READ_FORMAT",
+    "IMPLEMENTATION_COLOR_READ_TYPE",
+    "IMPORT_RULE",
+    "INCR",
+    "INCR_WRAP",
+    "INDEX_SIZE_ERR",
+    "INSTALL",
+    "INSTALLED",
+    "INT",
+    "INTERLEAVED_ATTRIBS",
+    "INT_2_10_10_10_REV",
+    "INT_SAMPLER_2D",
+    "INT_SAMPLER_2D_ARRAY",
+    "INT_SAMPLER_3D",
+    "INT_SAMPLER_CUBE",
+    "INT_VEC2",
+    "INT_VEC3",
+    "INT_VEC4",
+    "INUSE_ATTRIBUTE_ERR",
+    "INVALID_ACCESS_ERR",
+    "INVALID_CHARACTER_ERR",
+    "INVALID_ENUM",
+    "INVALID_EXPRESSION_ERR",
+    "INVALID_FRAMEBUFFER_OPERATION",
+    "INVALID_INDEX",
+    "INVALID_MODIFICATION_ERR",
+    "INVALID_NODE_TYPE_ERR",
+    "INVALID_OPERATION",
+    "INVALID_STATE_ERR",
+    "INVALID_VALUE",
+    "INVERSE_DISTANCE",
+    "INVERT",
+    "IceCandidate",
+    "IdleDeadline",
+    "Image",
+    "ImageBitmap",
+    "ImageBitmapRenderingContext",
+    "ImageCapture",
+    "ImageData",
+    "Infinity",
+    "InputDeviceCapabilities",
+    "InputDeviceInfo",
+    "InputEvent",
+    "InputMethodContext",
+    "InstallState",
+    "InstallTrigger",
+    "Instance",
+    "Int16Array",
+    "Int32Array",
+    "Int8Array",
+    "Intent",
+    "InternalError",
+    "IntersectionObserver",
+    "IntersectionObserverEntry",
+    "Intl",
+    "IsSearchProviderInstalled",
+    "Iterator",
+    "JSON",
+    "Java Deployment Toolkit 7.0.250.17",
+    "Java(TM) Platform SE 7 U25",
+    "KEEP",
+    "KEYDOWN",
+    "KEYFRAMES_RULE",
+    "KEYFRAME_RULE",
+    "KEYPRESS",
+    "KEYUP",
+    "Key",
+    "KeyEvent",
+    "KeyOperation",
+    "KeyPair",
+    "Keyboard",
+    "KeyboardEvent",
+    "KeyboardLayoutMap",
+    "KeyframeEffect",
+    "LENGTHADJUST_SPACING",
+    "LENGTHADJUST_SPACINGANDGLYPHS",
+    "LENGTHADJUST_UNKNOWN",
+    "LEQUAL",
+    "LESS",
+    "LINEAR",
+    "LINEAR_DISTANCE",
+    "LINEAR_MIPMAP_LINEAR",
+    "LINEAR_MIPMAP_NEAREST",
+    "LINES",
+    "LINE_LOOP",
+    "LINE_STRIP",
+    "LINE_WIDTH",
+    "LINK_STATUS",
+    "LINUX",
+    "LIVE",
+    "LN10",
+    "LN2",
+    "LOADED",
+    "LOADING",
+    "LOCALE",
+    "LOG10E",
+    "LOG2E",
+    "LOWPASS",
+    "LOWSHELF",
+    "LOW_FLOAT",
+    "LOW_INT",
+    "LSException",
+    "LSParserFilter",
+    "LUMINANCE",
+    "LUMINANCE_ALPHA",
+    "LargestContentfulPaint",
+    "LayoutShift",
+    "LayoutShiftAttribution",
+    "LinearAccelerationSensor",
+    "LinkError",
+    "ListFormat",
+    "LocalMediaStream",
+    "Locale",
+    "Location",
+    "Lock",
+    "LockManager",
+    "MAC",
+    "MAX",
+    "MAX_3D_TEXTURE_SIZE",
+    "MAX_ARRAY_TEXTURE_LAYERS",
+    "MAX_CLIENT_WAIT_TIMEOUT_WEBGL",
+    "MAX_COLOR_ATTACHMENTS",
+    "MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS",
+    "MAX_COMBINED_TEXTURE_IMAGE_UNITS",
+    "MAX_COMBINED_UNIFORM_BLOCKS",
+    "MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS",
+    "MAX_CUBE_MAP_TEXTURE_SIZE",
+    "MAX_DRAW_BUFFERS",
+    "MAX_ELEMENTS_INDICES",
+    "MAX_ELEMENTS_VERTICES",
+    "MAX_ELEMENT_INDEX",
+    "MAX_FRAGMENT_INPUT_COMPONENTS",
+    "MAX_FRAGMENT_UNIFORM_BLOCKS",
+    "MAX_FRAGMENT_UNIFORM_COMPONENTS",
+    "MAX_FRAGMENT_UNIFORM_VECTORS",
+    "MAX_PROGRAM_TEXEL_OFFSET",
+    "MAX_RENDERBUFFER_SIZE",
+    "MAX_SAFE_INTEGER",
+    "MAX_SAMPLES",
+    "MAX_SERVER_WAIT_TIMEOUT",
+    "MAX_TEXTURE_IMAGE_UNITS",
+    "MAX_TEXTURE_LOD_BIAS",
+    "MAX_TEXTURE_MAX_ANISOTROPY_EXT",
+    "MAX_TEXTURE_SIZE",
+    "MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS",
+    "MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS",
+    "MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS",
+    "MAX_UNIFORM_BLOCK_SIZE",
+    "MAX_UNIFORM_BUFFER_BINDINGS",
+    "MAX_VALUE",
+    "MAX_VARYING_COMPONENTS",
+    "MAX_VARYING_VECTORS",
+    "MAX_VERTEX_ATTRIBS",
+    "MAX_VERTEX_OUTPUT_COMPONENTS",
+    "MAX_VERTEX_TEXTURE_IMAGE_UNITS",
+    "MAX_VERTEX_UNIFORM_BLOCKS",
+    "MAX_VERTEX_UNIFORM_COMPONENTS",
+    "MAX_VERTEX_UNIFORM_VECTORS",
+    "MAX_VIEWPORT_DIMS",
+    "MEDIA_ERR_ABORTED",
+    "MEDIA_ERR_DECODE",
+    "MEDIA_ERR_ENCRYPTED",
+    "MEDIA_ERR_NETWORK",
+    "MEDIA_ERR_SRC_NOT_SUPPORTED",
+    "MEDIA_KEYERR_CLIENT",
+    "MEDIA_KEYERR_DOMAIN",
+    "MEDIA_KEYERR_HARDWARECHANGE",
+    "MEDIA_KEYERR_OUTPUT",
+    "MEDIA_KEYERR_SERVICE",
+    "MEDIA_KEYERR_UNKNOWN",
+    "MEDIA_RULE",
+    "MEDIUM_FLOAT",
+    "MEDIUM_INT",
+    "META_MASK",
+    "MIDIAccess",
+    "MIDIConnectionEvent",
+    "MIDIInput",
+    "MIDIInputMap",
+    "MIDIMessageEvent",
+    "MIDIOutput",
+    "MIDIOutputMap",
+    "MIDIPort",
+    "MIN",
+    "MIN_PROGRAM_TEXEL_OFFSET",
+    "MIN_SAFE_INTEGER",
+    "MIN_VALUE",
+    "MIRRORED_REPEAT",
+    "MODE_ASYNCHRONOUS",
+    "MODE_SYNCHRONOUS",
+    "MODIFICATION",
+    "MOUSEDOWN",
+    "MOUSEDRAG",
+    "MOUSEMOVE",
+    "MOUSEOUT",
+    "MOUSEOVER",
+    "MOUSEUP",
+    "MOZ_KEYFRAMES_RULE",
+    "MOZ_KEYFRAME_RULE",
+    "MOZ_SOURCE_CURSOR",
+    "MOZ_SOURCE_ERASER",
+    "MOZ_SOURCE_KEYBOARD",
+    "MOZ_SOURCE_MOUSE",
+    "MOZ_SOURCE_PEN",
+    "MOZ_SOURCE_TOUCH",
+    "MOZ_SOURCE_UNKNOWN",
+    "MSBehaviorUrnsCollection",
+    "MSBlobBuilder",
+    "MSCSSMatrix",
+    "MSCSSProperties",
+    "MSCSSRuleList",
+    "MSCompatibleInfo",
+    "MSCompatibleInfoCollection",
+    "MSCurrentStyleCSSProperties",
+    "MSEventObj",
+    "MSGESTURE_FLAG_BEGIN",
+    "MSGESTURE_FLAG_CANCEL",
+    "MSGESTURE_FLAG_END",
+    "MSGESTURE_FLAG_INERTIA",
+    "MSGESTURE_FLAG_NONE",
+    "MSGesture",
+    "MSGestureEvent",
+    "MSGraphicsTrust",
+    "MSInputMethodContext",
+    "MSManipulationEvent",
+    "MSMediaKeyError",
+    "MSMediaKeyMessageEvent",
+    "MSMediaKeyNeededEvent",
+    "MSMediaKeySession",
+    "MSMediaKeys",
+    "MSMimeTypesCollection",
+    "MSPOINTER_TYPE_MOUSE",
+    "MSPOINTER_TYPE_PEN",
+    "MSPOINTER_TYPE_TOUCH",
+    "MSPluginsCollection",
+    "MSPointerEvent",
+    "MSRangeCollection",
+    "MSSiteModeEvent",
+    "MSStream",
+    "MSStreamReader",
+    "MSStyleCSSProperties",
+    "MS_ASYNC_CALLBACK_STATUS_ASSIGN_DELEGATE",
+    "MS_ASYNC_CALLBACK_STATUS_CANCEL",
+    "MS_ASYNC_CALLBACK_STATUS_CHOOSEANY",
+    "MS_ASYNC_CALLBACK_STATUS_ERROR",
+    "MS_ASYNC_CALLBACK_STATUS_JOIN",
+    "MS_ASYNC_OP_STATUS_CANCELED",
+    "MS_ASYNC_OP_STATUS_ERROR",
+    "MS_ASYNC_OP_STATUS_SUCCESS",
+    "MS_MANIPULATION_STATE_ACTIVE",
+    "MS_MANIPULATION_STATE_CANCELLED",
+    "MS_MANIPULATION_STATE_COMMITTED",
+    "MS_MANIPULATION_STATE_DRAGGING",
+    "MS_MANIPULATION_STATE_INERTIA",
+    "MS_MANIPULATION_STATE_PRESELECT",
+    "MS_MANIPULATION_STATE_SELECTING",
+    "MS_MANIPULATION_STATE_STOPPED",
+    "MS_MEDIA_ERR_ENCRYPTED",
+    "MS_MEDIA_KEYERR_CLIENT",
+    "MS_MEDIA_KEYERR_DOMAIN",
+    "MS_MEDIA_KEYERR_HARDWARECHANGE",
+    "MS_MEDIA_KEYERR_OUTPUT",
+    "MS_MEDIA_KEYERR_SERVICE",
+    "MS_MEDIA_KEYERR_UNKNOWN",
+    "Map",
+    "Math",
+    "MathMLElement",
+    "MediaCapabilities",
+    "MediaCapabilitiesInfo",
+    "MediaController",
+    "MediaDeviceInfo",
+    "MediaDevices",
+    "MediaElementAudioSourceNode",
+    "MediaEncryptedEvent",
+    "MediaError",
+    "MediaKeyError",
+    "MediaKeyEvent",
+    "MediaKeyMessageEvent",
+    "MediaKeyNeededEvent",
+    "MediaKeySession",
+    "MediaKeyStatusMap",
+    "MediaKeySystemAccess",
+    "MediaKeys",
+    "MediaList",
+    "MediaMetadata",
+    "MediaQueryList",
+    "MediaQueryListEvent",
+    "MediaRecorder",
+    "MediaRecorderErrorEvent",
+    "MediaSession",
+    "MediaSettingsRange",
+    "MediaSource",
+    "MediaStream",
+    "MediaStreamAudioDestinationNode",
+    "MediaStreamAudioSourceNode",
+    "MediaStreamEvent",
+    "MediaStreamTrack",
+    "MediaStreamTrackAudioSourceNode",
+    "MediaStreamTrackEvent",
+    "Memory",
+    "MessageChannel",
+    "MessageEvent",
+    "MessagePort",
+    "Methods",
+    "Microsoft® DRM",
+    "MimeType",
+    "MimeTypeArray",
+    "Module",
+    "MouseEvent",
+    "MouseScrollEvent",
+    "MouseWheelEvent",
+    "MozAnimation",
+    "MozAnimationDelay",
+    "MozAnimationDirection",
+    "MozAnimationDuration",
+    "MozAnimationFillMode",
+    "MozAnimationIterationCount",
+    "MozAnimationName",
+    "MozAnimationPlayState",
+    "MozAnimationTimingFunction",
+    "MozAppearance",
+    "MozBackfaceVisibility",
+    "MozBinding",
+    "MozBorderBottomColors",
+    "MozBorderEnd",
+    "MozBorderEndColor",
+    "MozBorderEndStyle",
+    "MozBorderEndWidth",
+    "MozBorderImage",
+    "MozBorderLeftColors",
+    "MozBorderRightColors",
+    "MozBorderStart",
+    "MozBorderStartColor",
+    "MozBorderStartStyle",
+    "MozBorderStartWidth",
+    "MozBorderTopColors",
+    "MozBoxAlign",
+    "MozBoxDirection",
+    "MozBoxFlex",
+    "MozBoxOrdinalGroup",
+    "MozBoxOrient",
+    "MozBoxPack",
+    "MozBoxSizing",
+    "MozCSSKeyframeRule",
+    "MozCSSKeyframesRule",
+    "MozColumnCount",
+    "MozColumnFill",
+    "MozColumnGap",
+    "MozColumnRule",
+    "MozColumnRuleColor",
+    "MozColumnRuleStyle",
+    "MozColumnRuleWidth",
+    "MozColumnWidth",
+    "MozColumns",
+    "MozContactChangeEvent",
+    "MozFloatEdge",
+    "MozFontFeatureSettings",
+    "MozFontLanguageOverride",
+    "MozForceBrokenImageIcon",
+    "MozHyphens",
+    "MozImageRegion",
+    "MozMarginEnd",
+    "MozMarginStart",
+    "MozMmsEvent",
+    "MozMmsMessage",
+    "MozMobileMessageThread",
+    "MozOSXFontSmoothing",
+    "MozOrient",
+    "MozOutlineRadius",
+    "MozOutlineRadiusBottomleft",
+    "MozOutlineRadiusBottomright",
+    "MozOutlineRadiusTopleft",
+    "MozOutlineRadiusTopright",
+    "MozPaddingEnd",
+    "MozPaddingStart",
+    "MozPerspective",
+    "MozPerspectiveOrigin",
+    "MozPowerManager",
+    "MozSettingsEvent",
+    "MozSmsEvent",
+    "MozSmsMessage",
+    "MozStackSizing",
+    "MozTabSize",
+    "MozTextAlignLast",
+    "MozTextDecorationColor",
+    "MozTextDecorationLine",
+    "MozTextDecorationStyle",
+    "MozTextSizeAdjust",
+    "MozTransform",
+    "MozTransformOrigin",
+    "MozTransformStyle",
+    "MozTransition",
+    "MozTransitionDelay",
+    "MozTransitionDuration",
+    "MozTransitionProperty",
+    "MozTransitionTimingFunction",
+    "MozUserFocus",
+    "MozUserInput",
+    "MozUserModify",
+    "MozUserSelect",
+    "MozWindowDragging",
+    "MozWindowShadow",
+    "MutationEvent",
+    "MutationObserver",
+    "MutationRecord",
+    "NAMESPACE_ERR",
+    "NAMESPACE_RULE",
+    "NEAREST",
+    "NEAREST_MIPMAP_LINEAR",
+    "NEAREST_MIPMAP_NEAREST",
+    "NEGATIVE_INFINITY",
+    "NETWORK_EMPTY",
+    "NETWORK_ERR",
+    "NETWORK_IDLE",
+    "NETWORK_LOADED",
+    "NETWORK_LOADING",
+    "NETWORK_NO_SOURCE",
+    "NEVER",
+    "NEW",
+    "NEXT",
+    "NEXT_NO_DUPLICATE",
+    "NICEST",
+    "NODE_AFTER",
+    "NODE_BEFORE",
+    "NODE_BEFORE_AND_AFTER",
+    "NODE_INSIDE",
+    "NONE",
+    "NON_TRANSIENT_ERR",
+    "NOTATION_NODE",
+    "NOTCH",
+    "NOTEQUAL",
+    "NOT_ALLOWED_ERR",
+    "NOT_FOUND_ERR",
+    "NOT_INSTALLED",
+    "NOT_READABLE_ERR",
+    "NOT_SUPPORTED_ERR",
+    "NO_DATA_ALLOWED_ERR",
+    "NO_ERR",
+    "NO_ERROR",
+    "NO_MODIFICATION_ALLOWED_ERR",
+    "NO_UPDATE",
+    "NUMBER_TYPE",
+    "NUM_COMPRESSED_TEXTURE_FORMATS",
+    "NaN",
+    "NamedNodeMap",
+    "Native Client",
+    "NavigationPreloadManager",
+    "Navigator",
+    "NearbyLinks",
+    "NetworkInformation",
+    "Node",
+    "NodeFilter",
+    "NodeIterator",
+    "NodeList",
+    "Notation",
+    "Notification",
+    "NotifyPaintEvent",
+    "Number",
+    "NumberFormat",
+    "OBJECT_TYPE",
+    "OBSOLETE",
+    "OES_element_index_uint",
+    "OES_standard_derivatives",
+    "OES_texture_float",
+    "OES_texture_float_linear",
+    "OK",
+    "ONE",
+    "ONE_MINUS_CONSTANT_ALPHA",
+    "ONE_MINUS_CONSTANT_COLOR",
+    "ONE_MINUS_DST_ALPHA",
+    "ONE_MINUS_DST_COLOR",
+    "ONE_MINUS_SRC_ALPHA",
+    "ONE_MINUS_SRC_COLOR",
+    "OPEN",
+    "OPENBSD",
+    "OPENED",
+    "OPENING",
+    "ORDERED_NODE_ITERATOR_TYPE",
+    "ORDERED_NODE_SNAPSHOT_TYPE",
+    "OS_UPDATE",
+    "OTHER_ERROR",
+    "OUT_OF_MEMORY",
+    "Object",
+    "OfflineAudioCompletionEvent",
+    "OfflineAudioContext",
+    "OfflineResourceList",
+    "OffscreenCanvas",
+    "OffscreenCanvasRenderingContext2D",
+    "OnInstalledReason",
+    "OnRestartRequiredReason",
+    "Option",
+    "OrientationSensor",
+    "OscillatorNode",
+    "OverconstrainedError",
+    "OverconstrainedErrorEvent",
+    "OverflowEvent",
+    "PACKAGE",
+    "PACK_ALIGNMENT",
+    "PACK_ROW_LENGTH",
+    "PACK_SKIP_PIXELS",
+    "PACK_SKIP_ROWS",
+    "PAGE_RULE",
+    "PARSE_ERR",
+    "PATHSEG_ARC_ABS",
+    "PATHSEG_ARC_REL",
+    "PATHSEG_CLOSEPATH",
+    "PATHSEG_CURVETO_CUBIC_ABS",
+    "PATHSEG_CURVETO_CUBIC_REL",
+    "PATHSEG_CURVETO_CUBIC_SMOOTH_ABS",
+    "PATHSEG_CURVETO_CUBIC_SMOOTH_REL",
+    "PATHSEG_CURVETO_QUADRATIC_ABS",
+    "PATHSEG_CURVETO_QUADRATIC_REL",
+    "PATHSEG_CURVETO_QUADRATIC_SMOOTH_ABS",
+    "PATHSEG_CURVETO_QUADRATIC_SMOOTH_REL",
+    "PATHSEG_LINETO_ABS",
+    "PATHSEG_LINETO_HORIZONTAL_ABS",
+    "PATHSEG_LINETO_HORIZONTAL_REL",
+    "PATHSEG_LINETO_REL",
+    "PATHSEG_LINETO_VERTICAL_ABS",
+    "PATHSEG_LINETO_VERTICAL_REL",
+    "PATHSEG_MOVETO_ABS",
+    "PATHSEG_MOVETO_REL",
+    "PATHSEG_UNKNOWN",
+    "PATH_EXISTS_ERR",
+    "PEAKING",
+    "PERIODIC",
+    "PERMISSION_DENIED",
+    "PERSISTENT",
+    "PI",
+    "PIXEL_PACK_BUFFER",
+    "PIXEL_PACK_BUFFER_BINDING",
+    "PIXEL_UNPACK_BUFFER",
+    "PIXEL_UNPACK_BUFFER_BINDING",
+    "PLAYING_STATE",
+    "POINTS",
+    "POLYGON_OFFSET_FACTOR",
+    "POLYGON_OFFSET_FILL",
+    "POLYGON_OFFSET_UNITS",
+    "POSITION_UNAVAILABLE",
+    "POSITIVE_INFINITY",
+    "PREV",
+    "PREV_NO_DUPLICATE",
+    "PROCESSING_INSTRUCTION_NODE",
+    "PageChangeEvent",
+    "PageTransitionEvent",
+    "PaintRequest",
+    "PaintRequestList",
+    "PannerNode",
+    "PasswordCredential",
+    "Path2D",
+    "PaymentAddress",
+    "PaymentInstruments",
+    "PaymentManager",
+    "PaymentMethodChangeEvent",
+    "PaymentRequest",
+    "PaymentRequestUpdateEvent",
+    "PaymentResponse",
+    "Performance",
+    "PerformanceElementTiming",
+    "PerformanceEntry",
+    "PerformanceEventTiming",
+    "PerformanceLongTaskTiming",
+    "PerformanceMark",
+    "PerformanceMeasure",
+    "PerformanceNavigation",
+    "PerformanceNavigationTiming",
+    "PerformanceObserver",
+    "PerformanceObserverEntryList",
+    "PerformancePaintTiming",
+    "PerformanceResourceTiming",
+    "PerformanceServerTiming",
+    "PerformanceTiming",
+    "PeriodicSyncManager",
+    "PeriodicWave",
+    "PermissionStatus",
+    "Permissions",
+    "PhotoCapabilities",
+    "PictureInPictureWindow",
+    "PlatformArch",
+    "PlatformNaclArch",
+    "PlatformOs",
+    "Plugin",
+    "PluginArray",
+    "PluralRules",
+    "PointerEvent",
+    "PopStateEvent",
+    "PopupBlockedEvent",
+    "Position",
+    "PositionError",
+    "Presentation",
+    "PresentationAvailability",
+    "PresentationConnection",
+    "PresentationConnectionAvailableEvent",
+    "PresentationConnectionCloseEvent",
+    "PresentationConnectionList",
+    "PresentationReceiver",
+    "PresentationRequest",
+    "ProcessingInstruction",
+    "ProgressEvent",
+    "Promise",
+    "PromiseRejectionEvent",
+    "PropertyNodeList",
+    "Proxy",
+    "PublicKeyCredential",
+    "PushManager",
+    "PushSubscription",
+    "PushSubscriptionOptions",
+    "Q",
+    "QUERY_RESULT",
+    "QUERY_RESULT_AVAILABLE",
+    "QUOTA_ERR",
+    "QUOTA_EXCEEDED_ERR",
+    "QueryInterface",
+    "R11F_G11F_B10F",
+    "R16F",
+    "R16I",
+    "R16UI",
+    "R32F",
+    "R32I",
+    "R32UI",
+    "R8",
+    "R8I",
+    "R8UI",
+    "R8_SNORM",
+    "RASTERIZER_DISCARD",
+    "READY_TO_RUN",
+    "READ_BUFFER",
+    "READ_FRAMEBUFFER",
+    "READ_FRAMEBUFFER_BINDING",
+    "READ_ONLY",
+    "READ_ONLY_ERR",
+    "READ_WRITE",
+    "RED",
+    "RED_BITS",
+    "RED_INTEGER",
+    "REMOVAL",
+    "RENDERBUFFER",
+    "RENDERBUFFER_ALPHA_SIZE",
+    "RENDERBUFFER_BINDING",
+    "RENDERBUFFER_BLUE_SIZE",
+    "RENDERBUFFER_DEPTH_SIZE",
+    "RENDERBUFFER_GREEN_SIZE",
+    "RENDERBUFFER_HEIGHT",
+    "RENDERBUFFER_INTERNAL_FORMAT",
+    "RENDERBUFFER_RED_SIZE",
+    "RENDERBUFFER_SAMPLES",
+    "RENDERBUFFER_STENCIL_SIZE",
+    "RENDERBUFFER_WIDTH",
+    "RENDERER",
+    "RENDERING_INTENT_ABSOLUTE_COLORIMETRIC",
+    "RENDERING_INTENT_AUTO",
+    "RENDERING_INTENT_PERCEPTUAL",
+    "RENDERING_INTENT_RELATIVE_COLORIMETRIC",
+    "RENDERING_INTENT_SATURATION",
+    "RENDERING_INTENT_UNKNOWN",
+    "REPEAT",
+    "REPLACE",
+    "RG",
+    "RG16F",
+    "RG16I",
+    "RG16UI",
+    "RG32F",
+    "RG32I",
+    "RG32UI",
+    "RG8",
+    "RG8I",
+    "RG8UI",
+    "RG8_SNORM",
+    "RGB",
+    "RGB10_A2",
+    "RGB10_A2UI",
+    "RGB16F",
+    "RGB16I",
+    "RGB16UI",
+    "RGB32F",
+    "RGB32I",
+    "RGB32UI",
+    "RGB565",
+    "RGB5_A1",
+    "RGB8",
+    "RGB8I",
+    "RGB8UI",
+    "RGB8_SNORM",
+    "RGB9_E5",
+    "RGBA",
+    "RGBA16F",
+    "RGBA16I",
+    "RGBA16UI",
+    "RGBA32F",
+    "RGBA32I",
+    "RGBA32UI",
+    "RGBA4",
+    "RGBA8",
+    "RGBA8I",
+    "RGBA8UI",
+    "RGBA8_SNORM",
+    "RGBA_INTEGER",
+    "RGBColor",
+    "RGB_INTEGER",
+    "RG_INTEGER",
+    "ROTATION_CLOCKWISE",
+    "ROTATION_COUNTERCLOCKWISE",
+    "RTCCertificate",
+    "RTCDTMFSender",
+    "RTCDTMFToneChangeEvent",
+    "RTCDataChannel",
+    "RTCDataChannelEvent",
+    "RTCDtlsTransport",
+    "RTCError",
+    "RTCErrorEvent",
+    "RTCIceCandidate",
+    "RTCIceTransport",
+    "RTCPeerConnection",
+    "RTCPeerConnectionIceErrorEvent",
+    "RTCPeerConnectionIceEvent",
+    "RTCRtpReceiver",
+    "RTCRtpSender",
+    "RTCRtpTransceiver",
+    "RTCSctpTransport",
+    "RTCSessionDescription",
+    "RTCStatsReport",
+    "RTCTrackEvent",
+    "RUNNING",
+    "RadioNodeList",
+    "Range",
+    "RangeError",
+    "RangeException",
+    "ReadableByteStream",
+    "ReadableStream",
+    "ReadableStreamDefaultReader",
+    "RecordErrorEvent",
+    "Rect",
+    "ReferenceError",
+    "Reflect",
+    "RegExp",
+    "RelativeOrientationSensor",
+    "RelativeTimeFormat",
+    "RemotePlayback",
+    "ReportingObserver",
+    "Request",
+    "RequestUpdateCheckStatus",
+    "ResizeObserver",
+    "ResizeObserverEntry",
+    "ResizeObserverSize",
+    "Response",
+    "RunningState",
+    "RuntimeError",
+    "SAMPLER_2D",
+    "SAMPLER_2D_ARRAY",
+    "SAMPLER_2D_ARRAY_SHADOW",
+    "SAMPLER_2D_SHADOW",
+    "SAMPLER_3D",
+    "SAMPLER_BINDING",
+    "SAMPLER_CUBE",
+    "SAMPLER_CUBE_SHADOW",
+    "SAMPLES",
+    "SAMPLE_ALPHA_TO_COVERAGE",
+    "SAMPLE_BUFFERS",
+    "SAMPLE_COVERAGE",
+    "SAMPLE_COVERAGE_INVERT",
+    "SAMPLE_COVERAGE_VALUE",
+    "SAWTOOTH",
+    "SCHEDULED_STATE",
+    "SCISSOR_BOX",
+    "SCISSOR_TEST",
+    "SCROLL_PAGE_DOWN",
+    "SCROLL_PAGE_UP",
+    "SDP_ANSWER",
+    "SDP_OFFER",
+    "SDP_PRANSWER",
+    "SECURITY_ERR",
+    "SELECT",
+    "SEPARATE_ATTRIBS",
+    "SERIALIZE_ERR",
+    "SEVERITY_ERROR",
+    "SEVERITY_FATAL_ERROR",
+    "SEVERITY_WARNING",
+    "SHADER_COMPILER",
+    "SHADER_TYPE",
+    "SHADING_LANGUAGE_VERSION",
+    "SHARED_MODULE_UPDATE",
+    "SHIFT_MASK",
+    "SHORT",
+    "SHOWING",
+    "SHOW_ALL",
+    "SHOW_ATTRIBUTE",
+    "SHOW_CDATA_SECTION",
+    "SHOW_COMMENT",
+    "SHOW_DOCUMENT",
+    "SHOW_DOCUMENT_FRAGMENT",
+    "SHOW_DOCUMENT_TYPE",
+    "SHOW_ELEMENT",
+    "SHOW_ENTITY",
+    "SHOW_ENTITY_REFERENCE",
+    "SHOW_NOTATION",
+    "SHOW_PROCESSING_INSTRUCTION",
+    "SHOW_TEXT",
+    "SIGNALED",
+    "SIGNED_NORMALIZED",
+    "SINE",
+    "SKIN",
+    "SOUNDFIELD",
+    "SQLError",
+    "SQLException",
+    "SQLResultSet",
+    "SQLResultSetRowList",
+    "SQLTransaction",
+    "SQRT1_2",
+    "SQRT2",
+    "SQUARE",
+    "SRC_ALPHA",
+    "SRC_ALPHA_SATURATE",
+    "SRC_COLOR",
+    "SRGB",
+    "SRGB8",
+    "SRGB8_ALPHA8",
+    "START_TO_END",
+    "START_TO_START",
+    "STATIC_COPY",
+    "STATIC_DRAW",
+    "STATIC_READ",
+    "STENCIL",
+    "STENCIL_ATTACHMENT",
+    "STENCIL_BACK_FAIL",
+    "STENCIL_BACK_FUNC",
+    "STENCIL_BACK_PASS_DEPTH_FAIL",
+    "STENCIL_BACK_PASS_DEPTH_PASS",
+    "STENCIL_BACK_REF",
+    "STENCIL_BACK_VALUE_MASK",
+    "STENCIL_BACK_WRITEMASK",
+    "STENCIL_BITS",
+    "STENCIL_BUFFER_BIT",
+    "STENCIL_CLEAR_VALUE",
+    "STENCIL_FAIL",
+    "STENCIL_FUNC",
+    "STENCIL_INDEX",
+    "STENCIL_INDEX8",
+    "STENCIL_PASS_DEPTH_FAIL",
+    "STENCIL_PASS_DEPTH_PASS",
+    "STENCIL_REF",
+    "STENCIL_TEST",
+    "STENCIL_VALUE_MASK",
+    "STENCIL_WRITEMASK",
+    "STREAM_COPY",
+    "STREAM_DRAW",
+    "STREAM_READ",
+    "STRING_TYPE",
+    "STYLE_RULE",
+    "SUBPIXEL_BITS",
+    "SUPPORTS_RULE",
+    "SVGAElement",
+    "SVGAltGlyphDefElement",
+    "SVGAltGlyphElement",
+    "SVGAltGlyphItemElement",
+    "SVGAngle",
+    "SVGAnimateColorElement",
+    "SVGAnimateElement",
+    "SVGAnimateMotionElement",
+    "SVGAnimateTransformElement",
+    "SVGAnimatedAngle",
+    "SVGAnimatedBoolean",
+    "SVGAnimatedEnumeration",
+    "SVGAnimatedInteger",
+    "SVGAnimatedLength",
+    "SVGAnimatedLengthList",
+    "SVGAnimatedNumber",
+    "SVGAnimatedNumberList",
+    "SVGAnimatedPreserveAspectRatio",
+    "SVGAnimatedRect",
+    "SVGAnimatedString",
+    "SVGAnimatedTransformList",
+    "SVGAnimationElement",
+    "SVGCircleElement",
+    "SVGClipPathElement",
+    "SVGColor",
+    "SVGComponentTransferFunctionElement",
+    "SVGCursorElement",
+    "SVGDefsElement",
+    "SVGDescElement",
+    "SVGDiscardElement",
+    "SVGDocument",
+    "SVGElement",
+    "SVGElementInstance",
+    "SVGElementInstanceList",
+    "SVGEllipseElement",
+    "SVGException",
+    "SVGFEBlendElement",
+    "SVGFEColorMatrixElement",
+    "SVGFEComponentTransferElement",
+    "SVGFECompositeElement",
+    "SVGFEConvolveMatrixElement",
+    "SVGFEDiffuseLightingElement",
+    "SVGFEDisplacementMapElement",
+    "SVGFEDistantLightElement",
+    "SVGFEDropShadowElement",
+    "SVGFEFloodElement",
+    "SVGFEFuncAElement",
+    "SVGFEFuncBElement",
+    "SVGFEFuncGElement",
+    "SVGFEFuncRElement",
+    "SVGFEGaussianBlurElement",
+    "SVGFEImageElement",
+    "SVGFEMergeElement",
+    "SVGFEMergeNodeElement",
+    "SVGFEMorphologyElement",
+    "SVGFEOffsetElement",
+    "SVGFEPointLightElement",
+    "SVGFESpecularLightingElement",
+    "SVGFESpotLightElement",
+    "SVGFETileElement",
+    "SVGFETurbulenceElement",
+    "SVGFilterElement",
+    "SVGFontElement",
+    "SVGFontFaceElement",
+    "SVGFontFaceFormatElement",
+    "SVGFontFaceNameElement",
+    "SVGFontFaceSrcElement",
+    "SVGFontFaceUriElement",
+    "SVGForeignObjectElement",
+    "SVGGElement",
+    "SVGGeometryElement",
+    "SVGGlyphElement",
+    "SVGGlyphRefElement",
+    "SVGGradientElement",
+    "SVGGraphicsElement",
+    "SVGHKernElement",
+    "SVGImageElement",
+    "SVGLength",
+    "SVGLengthList",
+    "SVGLineElement",
+    "SVGLinearGradientElement",
+    "SVGMPathElement",
+    "SVGMarkerElement",
+    "SVGMaskElement",
+    "SVGMatrix",
+    "SVGMetadataElement",
+    "SVGMissingGlyphElement",
+    "SVGNumber",
+    "SVGNumberList",
+    "SVGPaint",
+    "SVGPathElement",
+    "SVGPathSeg",
+    "SVGPathSegArcAbs",
+    "SVGPathSegArcRel",
+    "SVGPathSegClosePath",
+    "SVGPathSegCurvetoCubicAbs",
+    "SVGPathSegCurvetoCubicRel",
+    "SVGPathSegCurvetoCubicSmoothAbs",
+    "SVGPathSegCurvetoCubicSmoothRel",
+    "SVGPathSegCurvetoQuadraticAbs",
+    "SVGPathSegCurvetoQuadraticRel",
+    "SVGPathSegCurvetoQuadraticSmoothAbs",
+    "SVGPathSegCurvetoQuadraticSmoothRel",
+    "SVGPathSegLinetoAbs",
+    "SVGPathSegLinetoHorizontalAbs",
+    "SVGPathSegLinetoHorizontalRel",
+    "SVGPathSegLinetoRel",
+    "SVGPathSegLinetoVerticalAbs",
+    "SVGPathSegLinetoVerticalRel",
+    "SVGPathSegList",
+    "SVGPathSegMovetoAbs",
+    "SVGPathSegMovetoRel",
+    "SVGPatternElement",
+    "SVGPoint",
+    "SVGPointList",
+    "SVGPolygonElement",
+    "SVGPolylineElement",
+    "SVGPreserveAspectRatio",
+    "SVGRadialGradientElement",
+    "SVGRect",
+    "SVGRectElement",
+    "SVGRenderingIntent",
+    "SVGSVGElement",
+    "SVGScriptElement",
+    "SVGSetElement",
+    "SVGStopElement",
+    "SVGStringList",
+    "SVGStyleElement",
+    "SVGSwitchElement",
+    "SVGSymbolElement",
+    "SVGTRefElement",
+    "SVGTSpanElement",
+    "SVGTextContentElement",
+    "SVGTextElement",
+    "SVGTextPathElement",
+    "SVGTextPositioningElement",
+    "SVGTitleElement",
+    "SVGTransform",
+    "SVGTransformList",
+    "SVGUnitTypes",
+    "SVGUseElement",
+    "SVGVKernElement",
+    "SVGViewElement",
+    "SVGViewSpec",
+    "SVGZoomAndPan",
+    "SVGZoomEvent",
+    "SVG_ANGLETYPE_DEG",
+    "SVG_ANGLETYPE_GRAD",
+    "SVG_ANGLETYPE_RAD",
+    "SVG_ANGLETYPE_UNKNOWN",
+    "SVG_ANGLETYPE_UNSPECIFIED",
+    "SVG_CHANNEL_A",
+    "SVG_CHANNEL_B",
+    "SVG_CHANNEL_G",
+    "SVG_CHANNEL_R",
+    "SVG_CHANNEL_UNKNOWN",
+    "SVG_COLORTYPE_CURRENTCOLOR",
+    "SVG_COLORTYPE_RGBCOLOR",
+    "SVG_COLORTYPE_RGBCOLOR_ICCCOLOR",
+    "SVG_COLORTYPE_UNKNOWN",
+    "SVG_EDGEMODE_DUPLICATE",
+    "SVG_EDGEMODE_NONE",
+    "SVG_EDGEMODE_UNKNOWN",
+    "SVG_EDGEMODE_WRAP",
+    "SVG_FEBLEND_MODE_COLOR",
+    "SVG_FEBLEND_MODE_COLOR_BURN",
+    "SVG_FEBLEND_MODE_COLOR_DODGE",
+    "SVG_FEBLEND_MODE_DARKEN",
+    "SVG_FEBLEND_MODE_DIFFERENCE",
+    "SVG_FEBLEND_MODE_EXCLUSION",
+    "SVG_FEBLEND_MODE_HARD_LIGHT",
+    "SVG_FEBLEND_MODE_HUE",
+    "SVG_FEBLEND_MODE_LIGHTEN",
+    "SVG_FEBLEND_MODE_LUMINOSITY",
+    "SVG_FEBLEND_MODE_MULTIPLY",
+    "SVG_FEBLEND_MODE_NORMAL",
+    "SVG_FEBLEND_MODE_OVERLAY",
+    "SVG_FEBLEND_MODE_SATURATION",
+    "SVG_FEBLEND_MODE_SCREEN",
+    "SVG_FEBLEND_MODE_SOFT_LIGHT",
+    "SVG_FEBLEND_MODE_UNKNOWN",
+    "SVG_FECOLORMATRIX_TYPE_HUEROTATE",
+    "SVG_FECOLORMATRIX_TYPE_LUMINANCETOALPHA",
+    "SVG_FECOLORMATRIX_TYPE_MATRIX",
+    "SVG_FECOLORMATRIX_TYPE_SATURATE",
+    "SVG_FECOLORMATRIX_TYPE_UNKNOWN",
+    "SVG_FECOMPONENTTRANSFER_TYPE_DISCRETE",
+    "SVG_FECOMPONENTTRANSFER_TYPE_GAMMA",
+    "SVG_FECOMPONENTTRANSFER_TYPE_IDENTITY",
+    "SVG_FECOMPONENTTRANSFER_TYPE_LINEAR",
+    "SVG_FECOMPONENTTRANSFER_TYPE_TABLE",
+    "SVG_FECOMPONENTTRANSFER_TYPE_UNKNOWN",
+    "SVG_FECOMPOSITE_OPERATOR_ARITHMETIC",
+    "SVG_FECOMPOSITE_OPERATOR_ATOP",
+    "SVG_FECOMPOSITE_OPERATOR_IN",
+    "SVG_FECOMPOSITE_OPERATOR_OUT",
+    "SVG_FECOMPOSITE_OPERATOR_OVER",
+    "SVG_FECOMPOSITE_OPERATOR_UNKNOWN",
+    "SVG_FECOMPOSITE_OPERATOR_XOR",
+    "SVG_INVALID_VALUE_ERR",
+    "SVG_LENGTHTYPE_CM",
+    "SVG_LENGTHTYPE_EMS",
+    "SVG_LENGTHTYPE_EXS",
+    "SVG_LENGTHTYPE_IN",
+    "SVG_LENGTHTYPE_MM",
+    "SVG_LENGTHTYPE_NUMBER",
+    "SVG_LENGTHTYPE_PC",
+    "SVG_LENGTHTYPE_PERCENTAGE",
+    "SVG_LENGTHTYPE_PT",
+    "SVG_LENGTHTYPE_PX",
+    "SVG_LENGTHTYPE_UNKNOWN",
+    "SVG_MARKERUNITS_STROKEWIDTH",
+    "SVG_MARKERUNITS_UNKNOWN",
+    "SVG_MARKERUNITS_USERSPACEONUSE",
+    "SVG_MARKER_ORIENT_ANGLE",
+    "SVG_MARKER_ORIENT_AUTO",
+    "SVG_MARKER_ORIENT_UNKNOWN",
+    "SVG_MASKTYPE_ALPHA",
+    "SVG_MASKTYPE_LUMINANCE",
+    "SVG_MATRIX_NOT_INVERTABLE",
+    "SVG_MEETORSLICE_MEET",
+    "SVG_MEETORSLICE_SLICE",
+    "SVG_MEETORSLICE_UNKNOWN",
+    "SVG_MORPHOLOGY_OPERATOR_DILATE",
+    "SVG_MORPHOLOGY_OPERATOR_ERODE",
+    "SVG_MORPHOLOGY_OPERATOR_UNKNOWN",
+    "SVG_PAINTTYPE_CURRENTCOLOR",
+    "SVG_PAINTTYPE_NONE",
+    "SVG_PAINTTYPE_RGBCOLOR",
+    "SVG_PAINTTYPE_RGBCOLOR_ICCCOLOR",
+    "SVG_PAINTTYPE_UNKNOWN",
+    "SVG_PAINTTYPE_URI",
+    "SVG_PAINTTYPE_URI_CURRENTCOLOR",
+    "SVG_PAINTTYPE_URI_NONE",
+    "SVG_PAINTTYPE_URI_RGBCOLOR",
+    "SVG_PAINTTYPE_URI_RGBCOLOR_ICCCOLOR",
+    "SVG_PRESERVEASPECTRATIO_NONE",
+    "SVG_PRESERVEASPECTRATIO_UNKNOWN",
+    "SVG_PRESERVEASPECTRATIO_XMAXYMAX",
+    "SVG_PRESERVEASPECTRATIO_XMAXYMID",
+    "SVG_PRESERVEASPECTRATIO_XMAXYMIN",
+    "SVG_PRESERVEASPECTRATIO_XMIDYMAX",
+    "SVG_PRESERVEASPECTRATIO_XMIDYMID",
+    "SVG_PRESERVEASPECTRATIO_XMIDYMIN",
+    "SVG_PRESERVEASPECTRATIO_XMINYMAX",
+    "SVG_PRESERVEASPECTRATIO_XMINYMID",
+    "SVG_PRESERVEASPECTRATIO_XMINYMIN",
+    "SVG_SPREADMETHOD_PAD",
+    "SVG_SPREADMETHOD_REFLECT",
+    "SVG_SPREADMETHOD_REPEAT",
+    "SVG_SPREADMETHOD_UNKNOWN",
+    "SVG_STITCHTYPE_NOSTITCH",
+    "SVG_STITCHTYPE_STITCH",
+    "SVG_STITCHTYPE_UNKNOWN",
+    "SVG_TRANSFORM_MATRIX",
+    "SVG_TRANSFORM_ROTATE",
+    "SVG_TRANSFORM_SCALE",
+    "SVG_TRANSFORM_SKEWX",
+    "SVG_TRANSFORM_SKEWY",
+    "SVG_TRANSFORM_TRANSLATE",
+    "SVG_TRANSFORM_UNKNOWN",
+    "SVG_TURBULENCE_TYPE_FRACTALNOISE",
+    "SVG_TURBULENCE_TYPE_TURBULENCE",
+    "SVG_TURBULENCE_TYPE_UNKNOWN",
+    "SVG_UNIT_TYPE_OBJECTBOUNDINGBOX",
+    "SVG_UNIT_TYPE_UNKNOWN",
+    "SVG_UNIT_TYPE_USERSPACEONUSE",
+    "SVG_WRONG_TYPE_ERR",
+    "SVG_ZOOMANDPAN_DISABLE",
+    "SVG_ZOOMANDPAN_MAGNIFY",
+    "SVG_ZOOMANDPAN_UNKNOWN",
+    "SYNC_CONDITION",
+    "SYNC_FENCE",
+    "SYNC_FLAGS",
+    "SYNC_FLUSH_COMMANDS_BIT",
+    "SYNC_GPU_COMMANDS_COMPLETE",
+    "SYNC_STATUS",
+    "SYNTAX_ERR",
+    "SavedPages",
+    "Screen",
+    "ScreenOrientation",
+    "Script",
+    "ScriptEngine",
+    "ScriptEngineBuildVersion",
+    "ScriptEngineMajorVersion",
+    "ScriptEngineMinorVersion",
+    "ScriptProcessorNode",
+    "ScrollAreaEvent",
+    "SecurityPolicyViolationEvent",
+    "Selection",
+    "Sensor",
+    "SensorErrorEvent",
+    "ServiceWorker",
+    "ServiceWorkerContainer",
+    "ServiceWorkerMessageEvent",
+    "ServiceWorkerRegistration",
+    "SessionDescription",
+    "Set",
+    "ShadowRoot",
+    "SharedArrayBuffer",
+    "SharedWorker",
+    "SimpleGestureEvent",
+    "SourceBuffer",
+    "SourceBufferList",
+    "SpeechSynthesis",
+    "SpeechSynthesisErrorEvent",
+    "SpeechSynthesisEvent",
+    "SpeechSynthesisUtterance",
+    "SpeechSynthesisVoice",
+    "StaticRange",
+    "StereoPannerNode",
+    "StopIteration",
+    "Storage",
+    "StorageEvent",
+    "StorageManager",
+    "String",
+    "StyleMedia",
+    "StylePropertyMap",
+    "StylePropertyMapReadOnly",
+    "StyleSheet",
+    "StyleSheetList",
+    "StyleSheetPageList",
+    "SubmitEvent",
+    "SubtleCrypto",
+    "Symbol",
+    "SyncManager",
+    "SyntaxError",
+    "TEMPORARY",
+    "TEXTPATH_METHODTYPE_ALIGN",
+    "TEXTPATH_METHODTYPE_STRETCH",
+    "TEXTPATH_METHODTYPE_UNKNOWN",
+    "TEXTPATH_SPACINGTYPE_AUTO",
+    "TEXTPATH_SPACINGTYPE_EXACT",
+    "TEXTPATH_SPACINGTYPE_UNKNOWN",
+    "TEXTURE",
+    "TEXTURE0",
+    "TEXTURE1",
+    "TEXTURE10",
+    "TEXTURE11",
+    "TEXTURE12",
+    "TEXTURE13",
+    "TEXTURE14",
+    "TEXTURE15",
+    "TEXTURE16",
+    "TEXTURE17",
+    "TEXTURE18",
+    "TEXTURE19",
+    "TEXTURE2",
+    "TEXTURE20",
+    "TEXTURE21",
+    "TEXTURE22",
+    "TEXTURE23",
+    "TEXTURE24",
+    "TEXTURE25",
+    "TEXTURE26",
+    "TEXTURE27",
+    "TEXTURE28",
+    "TEXTURE29",
+    "TEXTURE3",
+    "TEXTURE30",
+    "TEXTURE31",
+    "TEXTURE4",
+    "TEXTURE5",
+    "TEXTURE6",
+    "TEXTURE7",
+    "TEXTURE8",
+    "TEXTURE9",
+    "TEXTURE_2D",
+    "TEXTURE_2D_ARRAY",
+    "TEXTURE_3D",
+    "TEXTURE_BASE_LEVEL",
+    "TEXTURE_BINDING_2D",
+    "TEXTURE_BINDING_2D_ARRAY",
+    "TEXTURE_BINDING_3D",
+    "TEXTURE_BINDING_CUBE_MAP",
+    "TEXTURE_COMPARE_FUNC",
+    "TEXTURE_COMPARE_MODE",
+    "TEXTURE_CUBE_MAP",
+    "TEXTURE_CUBE_MAP_NEGATIVE_X",
+    "TEXTURE_CUBE_MAP_NEGATIVE_Y",
+    "TEXTURE_CUBE_MAP_NEGATIVE_Z",
+    "TEXTURE_CUBE_MAP_POSITIVE_X",
+    "TEXTURE_CUBE_MAP_POSITIVE_Y",
+    "TEXTURE_CUBE_MAP_POSITIVE_Z",
+    "TEXTURE_IMMUTABLE_FORMAT",
+    "TEXTURE_IMMUTABLE_LEVELS",
+    "TEXTURE_MAG_FILTER",
+    "TEXTURE_MAX_ANISOTROPY_EXT",
+    "TEXTURE_MAX_LEVEL",
+    "TEXTURE_MAX_LOD",
+    "TEXTURE_MIN_FILTER",
+    "TEXTURE_MIN_LOD",
+    "TEXTURE_WRAP_R",
+    "TEXTURE_WRAP_S",
+    "TEXTURE_WRAP_T",
+    "TEXT_NODE",
+    "THROTTLED",
+    "TIMEOUT",
+    "TIMEOUT_ERR",
+    "TIMEOUT_EXPIRED",
+    "TIMEOUT_IGNORED",
+    "TOO_LARGE_ERR",
+    "TRANSACTION_INACTIVE_ERR",
+    "TRANSFORM_FEEDBACK",
+    "TRANSFORM_FEEDBACK_ACTIVE",
+    "TRANSFORM_FEEDBACK_BINDING",
+    "TRANSFORM_FEEDBACK_BUFFER",
+    "TRANSFORM_FEEDBACK_BUFFER_BINDING",
+    "TRANSFORM_FEEDBACK_BUFFER_MODE",
+    "TRANSFORM_FEEDBACK_BUFFER_SIZE",
+    "TRANSFORM_FEEDBACK_BUFFER_START",
+    "TRANSFORM_FEEDBACK_PAUSED",
+    "TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN",
+    "TRANSFORM_FEEDBACK_VARYINGS",
+    "TRIANGLE",
+    "TRIANGLES",
+    "TRIANGLE_FAN",
+    "TRIANGLE_STRIP",
+    "TYPE_BACK_FORWARD",
+    "TYPE_ERR",
+    "TYPE_MISMATCH_ERR",
+    "TYPE_NAVIGATE",
+    "TYPE_RELOAD",
+    "TYPE_RESERVED",
+    "Table",
+    "TaskAttributionTiming",
+    "Text",
+    "TextDecoder",
+    "TextDecoderStream",
+    "TextEncoder",
+    "TextEncoderStream",
+    "TextEvent",
+    "TextMetrics",
+    "TextRange",
+    "TextRangeCollection",
+    "TextTrack",
+    "TextTrackCue",
+    "TextTrackCueList",
+    "TextTrackList",
+    "TimeEvent",
+    "TimeRanges",
+    "Touch",
+    "TouchEvent",
+    "TouchList",
+    "TrackEvent",
+    "TransformStream",
+    "TransitionEvent",
+    "TreeWalker",
+    "TrustedHTML",
+    "TrustedScript",
+    "TrustedScriptURL",
+    "TrustedTypePolicy",
+    "TrustedTypePolicyFactory",
+    "TypeError",
+    "U2F",
+    "UIEvent",
+    "UNCACHED",
+    "UNIFORM_ARRAY_STRIDE",
+    "UNIFORM_BLOCK_ACTIVE_UNIFORMS",
+    "UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES",
+    "UNIFORM_BLOCK_BINDING",
+    "UNIFORM_BLOCK_DATA_SIZE",
+    "UNIFORM_BLOCK_INDEX",
+    "UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER",
+    "UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER",
+    "UNIFORM_BUFFER",
+    "UNIFORM_BUFFER_BINDING",
+    "UNIFORM_BUFFER_OFFSET_ALIGNMENT",
+    "UNIFORM_BUFFER_SIZE",
+    "UNIFORM_BUFFER_START",
+    "UNIFORM_IS_ROW_MAJOR",
+    "UNIFORM_MATRIX_STRIDE",
+    "UNIFORM_OFFSET",
+    "UNIFORM_SIZE",
+    "UNIFORM_TYPE",
+    "UNKNOWN_ERR",
+    "UNKNOWN_RULE",
+    "UNMASKED_RENDERER_WEBGL",
+    "UNMASKED_VENDOR_WEBGL",
+    "UNORDERED_NODE_ITERATOR_TYPE",
+    "UNORDERED_NODE_SNAPSHOT_TYPE",
+    "UNPACK_ALIGNMENT",
+    "UNPACK_COLORSPACE_CONVERSION_WEBGL",
+    "UNPACK_FLIP_Y_WEBGL",
+    "UNPACK_IMAGE_HEIGHT",
+    "UNPACK_PREMULTIPLY_ALPHA_WEBGL",
+    "UNPACK_ROW_LENGTH",
+    "UNPACK_SKIP_IMAGES",
+    "UNPACK_SKIP_PIXELS",
+    "UNPACK_SKIP_ROWS",
+    "UNSCHEDULED_STATE",
+    "UNSENT",
+    "UNSIGNALED",
+    "UNSIGNED_BYTE",
+    "UNSIGNED_INT",
+    "UNSIGNED_INT_10F_11F_11F_REV",
+    "UNSIGNED_INT_24_8",
+    "UNSIGNED_INT_2_10_10_10_REV",
+    "UNSIGNED_INT_5_9_9_9_REV",
+    "UNSIGNED_INT_SAMPLER_2D",
+    "UNSIGNED_INT_SAMPLER_2D_ARRAY",
+    "UNSIGNED_INT_SAMPLER_3D",
+    "UNSIGNED_INT_SAMPLER_CUBE",
+    "UNSIGNED_INT_VEC2",
+    "UNSIGNED_INT_VEC3",
+    "UNSIGNED_INT_VEC4",
+    "UNSIGNED_NORMALIZED",
+    "UNSIGNED_SHORT",
+    "UNSIGNED_SHORT_4_4_4_4",
+    "UNSIGNED_SHORT_5_5_5_1",
+    "UNSIGNED_SHORT_5_6_5",
+    "UNSPECIFIED_EVENT_TYPE_ERR",
+    "UPDATE",
+    "UPDATEREADY",
+    "UPDATE_AVAILABLE",
+    "URIError",
+    "URL",
+    "URLSearchParams",
+    "URLUnencoded",
+    "URL_MISMATCH_ERR",
+    "USB",
+    "USBAlternateInterface",
+    "USBConfiguration",
+    "USBConnectionEvent",
+    "USBDevice",
+    "USBEndpoint",
+    "USBInTransferResult",
+    "USBInterface",
+    "USBIsochronousInTransferPacket",
+    "USBIsochronousInTransferResult",
+    "USBIsochronousOutTransferPacket",
+    "USBIsochronousOutTransferResult",
+    "USBOutTransferResult",
+    "UTC",
+    "Uint16Array",
+    "Uint32Array",
+    "Uint8Array",
+    "Uint8ClampedArray",
+    "UserActivation",
+    "UserMessageHandler",
+    "UserMessageHandlersNamespace",
+    "UserProximityEvent",
+    "VALIDATE_STATUS",
+    "VALIDATION_ERR",
+    "VARIABLES_RULE",
+    "VBArray",
+    "VENDOR",
+    "VERSION",
+    "VERSION_CHANGE",
+    "VERSION_ERR",
+    "VERTEX_ARRAY_BINDING",
+    "VERTEX_ATTRIB_ARRAY_BUFFER_BINDING",
+    "VERTEX_ATTRIB_ARRAY_DIVISOR",
+    "VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE",
+    "VERTEX_ATTRIB_ARRAY_ENABLED",
+    "VERTEX_ATTRIB_ARRAY_INTEGER",
+    "VERTEX_ATTRIB_ARRAY_NORMALIZED",
+    "VERTEX_ATTRIB_ARRAY_POINTER",
+    "VERTEX_ATTRIB_ARRAY_SIZE",
+    "VERTEX_ATTRIB_ARRAY_STRIDE",
+    "VERTEX_ATTRIB_ARRAY_TYPE",
+    "VERTEX_SHADER",
+    "VERTICAL",
+    "VERTICAL_AXIS",
+    "VER_ERR",
+    "VIEWPORT",
+    "VIEWPORT_RULE",
+    "VRDisplay",
+    "VRDisplayCapabilities",
+    "VRDisplayEvent",
+    "VREyeParameters",
+    "VRFieldOfView",
+    "VRFrameData",
+    "VRPose",
+    "VRStageParameters",
+    "VTTCue",
+    "VTTRegion",
+    "ValidityState",
+    "VideoPlaybackQuality",
+    "VideoStreamTrack",
+    "VideoTrack",
+    "VideoTrackList",
+    "VisualViewport",
+    "WAIT_FAILED",
+    "WEBGL_compressed_texture_s3tc",
+    "WEBGL_debug_renderer_info",
+    "WEBKIT_FILTER_RULE",
+    "WEBKIT_FORCE_AT_FORCE_MOUSE_DOWN",
+    "WEBKIT_FORCE_AT_MOUSE_DOWN",
+    "WEBKIT_KEYFRAMES_RULE",
+    "WEBKIT_KEYFRAME_RULE",
+    "WEBKIT_REGION_RULE",
+    "WIN",
+    "WRONG_DOCUMENT_ERR",
+    "WakeLock",
+    "WakeLockSentinel",
+    "WaveShaperNode",
+    "WeakMap",
+    "WeakRef",
+    "WeakSet",
+    "WebAssembly",
+    "WebGL2RenderingContext",
+    "WebGLActiveInfo",
+    "WebGLBuffer",
+    "WebGLContextEvent",
+    "WebGLFramebuffer",
+    "WebGLObject",
+    "WebGLProgram",
+    "WebGLQuery",
+    "WebGLRenderbuffer",
+    "WebGLRenderingContext",
+    "WebGLSampler",
+    "WebGLShader",
+    "WebGLShaderPrecisionFormat",
+    "WebGLSync",
+    "WebGLTexture",
+    "WebGLTransformFeedback",
+    "WebGLUniformLocation",
+    "WebGLVertexArray",
+    "WebGLVertexArrayObject",
+    "WebKit built-in PDF",
+    "WebKitAnimationEvent",
+    "WebKitBlobBuilder",
+    "WebKitCSSFilterRule",
+    "WebKitCSSFilterValue",
+    "WebKitCSSKeyframeRule",
+    "WebKitCSSKeyframesRule",
+    "WebKitCSSMatrix",
+    "WebKitCSSRegionRule",
+    "WebKitCSSTransformValue",
+    "WebKitDataCue",
+    "WebKitGamepad",
+    "WebKitMediaKeyError",
+    "WebKitMediaKeyMessageEvent",
+    "WebKitMediaKeyNeededEvent",
+    "WebKitMediaKeySession",
+    "WebKitMediaKeys",
+    "WebKitMediaSource",
+    "WebKitMutationObserver",
+    "WebKitNamespace",
+    "WebKitPlaybackTargetAvailabilityEvent",
+    "WebKitPoint",
+    "WebKitShadowRoot",
+    "WebKitSourceBuffer",
+    "WebKitSourceBufferList",
+    "WebKitTransitionEvent",
+    "WebSocket",
+    "WebkitAlignContent",
+    "WebkitAlignItems",
+    "WebkitAlignSelf",
+    "WebkitAnimation",
+    "WebkitAnimationDelay",
+    "WebkitAnimationDirection",
+    "WebkitAnimationDuration",
+    "WebkitAnimationFillMode",
+    "WebkitAnimationIterationCount",
+    "WebkitAnimationName",
+    "WebkitAnimationPlayState",
+    "WebkitAnimationTimingFunction",
+    "WebkitAppearance",
+    "WebkitBackfaceVisibility",
+    "WebkitBackgroundClip",
+    "WebkitBackgroundOrigin",
+    "WebkitBackgroundSize",
+    "WebkitBorderBottomLeftRadius",
+    "WebkitBorderBottomRightRadius",
+    "WebkitBorderImage",
+    "WebkitBorderRadius",
+    "WebkitBorderTopLeftRadius",
+    "WebkitBorderTopRightRadius",
+    "WebkitBoxAlign",
+    "WebkitBoxDirection",
+    "WebkitBoxFlex",
+    "WebkitBoxOrdinalGroup",
+    "WebkitBoxOrient",
+    "WebkitBoxPack",
+    "WebkitBoxShadow",
+    "WebkitBoxSizing",
+    "WebkitFilter",
+    "WebkitFlex",
+    "WebkitFlexBasis",
+    "WebkitFlexDirection",
+    "WebkitFlexFlow",
+    "WebkitFlexGrow",
+    "WebkitFlexShrink",
+    "WebkitFlexWrap",
+    "WebkitJustifyContent",
+    "WebkitLineClamp",
+    "WebkitMask",
+    "WebkitMaskClip",
+    "WebkitMaskComposite",
+    "WebkitMaskImage",
+    "WebkitMaskOrigin",
+    "WebkitMaskPosition",
+    "WebkitMaskPositionX",
+    "WebkitMaskPositionY",
+    "WebkitMaskRepeat",
+    "WebkitMaskSize",
+    "WebkitOrder",
+    "WebkitPerspective",
+    "WebkitPerspectiveOrigin",
+    "WebkitTextFillColor",
+    "WebkitTextSizeAdjust",
+    "WebkitTextStroke",
+    "WebkitTextStrokeColor",
+    "WebkitTextStrokeWidth",
+    "WebkitTransform",
+    "WebkitTransformOrigin",
+    "WebkitTransformStyle",
+    "WebkitTransition",
+    "WebkitTransitionDelay",
+    "WebkitTransitionDuration",
+    "WebkitTransitionProperty",
+    "WebkitTransitionTimingFunction",
+    "WebkitUserSelect",
+    "WheelEvent",
+    "Window",
+    "Windows Media Player Plug-in Dynamic Link Library",
+    "Windows Presentation Foundation",
+    "Worker",
+    "Worklet",
+    "WritableStream",
+    "WritableStreamDefaultWriter",
+    "X86_32",
+    "X86_64",
+    "XMLDocument",
+    "XMLHttpRequest",
+    "XMLHttpRequestEventTarget",
+    "XMLHttpRequestException",
+    "XMLHttpRequestProgressEvent",
+    "XMLHttpRequestUpload",
+    "XMLSerializer",
+    "XMLStylesheetProcessingInstruction",
+    "XPathEvaluator",
+    "XPathException",
+    "XPathExpression",
+    "XPathNSResolver",
+    "XPathResult",
+    "XR",
+    "XRBoundedReferenceSpace",
+    "XRDOMOverlayState",
+    "XRFrame",
+    "XRHitTestResult",
+    "XRHitTestSource",
+    "XRInputSource",
+    "XRInputSourceArray",
+    "XRInputSourceEvent",
+    "XRInputSourcesChangeEvent",
+    "XRLayer",
+    "XRPose",
+    "XRRay",
+    "XRReferenceSpace",
+    "XRReferenceSpaceEvent",
+    "XRRenderState",
+    "XRRigidTransform",
+    "XRSession",
+    "XRSessionEvent",
+    "XRSpace",
+    "XRSystem",
+    "XRTransientInputHitTestResult",
+    "XRTransientInputHitTestSource",
+    "XRView",
+    "XRViewerPose",
+    "XRViewport",
+    "XRWebGLLayer",
+    "XSLTProcessor",
+    "ZERO",
+    "_XD0M_",
+    "_YD0M_",
+    "__defineGetter__",
+    "__defineSetter__",
+    "__lookupGetter__",
+    "__lookupSetter__",
+    "__opera",
+    "__proto__",
+    "__relevantExtensionKeys",
+    "_browserjsran",
+    "a",
+    "aLink",
+    "abbr",
+    "abort",
+    "aborted",
+    "abs",
+    "absolute",
+    "acceleration",
+    "accelerationIncludingGravity",
+    "accelerator",
+    "accept",
+    "acceptCharset",
+    "acceptNode",
+    "accessKey",
+    "accessKeyLabel",
+    "accuracy",
+    "acos",
+    "acosh",
+    "action",
+    "actionURL",
+    "actions",
+    "activated",
+    "active",
+    "activeCues",
+    "activeElement",
+    "activeSourceBuffers",
+    "activeSourceCount",
+    "activeTexture",
+    "activeVRDisplays",
+    "actualBoundingBoxAscent",
+    "actualBoundingBoxDescent",
+    "actualBoundingBoxLeft",
+    "actualBoundingBoxRight",
+    "add",
+    "addAll",
+    "addBehavior",
+    "addCandidate",
+    "addColorStop",
+    "addCue",
+    "addElement",
+    "addEventListener",
+    "addFilter",
+    "addFromString",
+    "addFromUri",
+    "addIceCandidate",
+    "addImport",
+    "addListener",
+    "addModule",
+    "addNamed",
+    "addPageRule",
+    "addPath",
+    "addPointer",
+    "addRange",
+    "addRegion",
+    "addRule",
+    "addRules",
+    "addSearchEngine",
+    "addSourceBuffer",
+    "addStream",
+    "addTextTrack",
+    "addTrack",
+    "addTransceiver",
+    "addWakeLockListener",
+    "added",
+    "addedNodes",
+    "additionalName",
+    "additiveSymbols",
+    "addons",
+    "address",
+    "addressLine",
+    "adoptNode",
+    "adoptText",
+    "adoptedCallback",
+    "adoptedStyleSheets",
+    "adr",
+    "advance",
+    "after",
+    "album",
+    "alert",
+    "algorithm",
+    "align",
+    "align-content",
+    "align-items",
+    "align-self",
+    "alignContent",
+    "alignItems",
+    "alignSelf",
+    "alignmentBaseline",
+    "alinkColor",
+    "all",
+    "allSettled",
+    "allow",
+    "allowFullscreen",
+    "allowPaymentRequest",
+    "allowTransparency",
+    "allowedDirections",
+    "allowedFeatures",
+    "allowsFeature",
+    "alpha",
+    "alphabeticBaseline",
+    "alt",
+    "altGraphKey",
+    "altHtml",
+    "altKey",
+    "altLeft",
+    "alternate",
+    "alternateSetting",
+    "alternates",
+    "altitude",
+    "altitudeAccuracy",
+    "amplitude",
+    "ancestorOrigins",
+    "anchor",
+    "anchorNode",
+    "anchorOffset",
+    "anchors",
+    "and",
+    "angle",
+    "angularAcceleration",
+    "angularVelocity",
+    "animVal",
+    "animate",
+    "animatedInstanceRoot",
+    "animatedNormalizedPathSegList",
+    "animatedPathSegList",
+    "animatedPoints",
+    "animation",
+    "animation-delay",
+    "animation-direction",
+    "animation-duration",
+    "animation-fill-mode",
+    "animation-iteration-count",
+    "animation-name",
+    "animation-play-state",
+    "animation-timing-function",
+    "animationDelay",
+    "animationDirection",
+    "animationDuration",
+    "animationFillMode",
+    "animationIterationCount",
+    "animationName",
+    "animationPlayState",
+    "animationStartTime",
+    "animationTimingFunction",
+    "animationsPaused",
+    "anniversary",
+    "antialias",
+    "any",
+    "app",
+    "appCodeName",
+    "appMinorVersion",
+    "appName",
+    "appNotifications",
+    "appVersion",
+    "appearance",
+    "append",
+    "appendBuffer",
+    "appendChild",
+    "appendData",
+    "appendItem",
+    "appendMedium",
+    "appendNamed",
+    "appendRule",
+    "appendStream",
+    "appendWindowEnd",
+    "appendWindowStart",
+    "appleTrailingWord",
+    "applets",
+    "application/apple-default-browser",
+    "application/asx",
+    "application/java-deployment-toolkit",
+    "application/pdf",
+    "application/postscript",
+    "application/x-drm",
+    "application/x-drm-v2",
+    "application/x-google-chrome-pdf",
+    "application/x-java-applet",
+    "application/x-java-applet;deploy=10.25.2",
+    "application/x-java-applet;javafx=2.2.25",
+    "application/x-java-applet;jpi-version=1.7.0_25",
+    "application/x-java-applet;version=1.1",
+    "application/x-java-applet;version=1.1.1",
+    "application/x-java-applet;version=1.1.2",
+    "application/x-java-applet;version=1.1.3",
+    "application/x-java-applet;version=1.2",
+    "application/x-java-applet;version=1.2.1",
+    "application/x-java-applet;version=1.2.2",
+    "application/x-java-applet;version=1.3",
+    "application/x-java-applet;version=1.3.1",
+    "application/x-java-applet;version=1.4",
+    "application/x-java-applet;version=1.4.1",
+    "application/x-java-applet;version=1.4.2",
+    "application/x-java-applet;version=1.5",
+    "application/x-java-applet;version=1.6",
+    "application/x-java-applet;version=1.7",
+    "application/x-java-bean",
+    "application/x-java-bean;jpi-version=1.7.0_25",
+    "application/x-java-bean;version=1.1",
+    "application/x-java-bean;version=1.1.1",
+    "application/x-java-bean;version=1.1.2",
+    "application/x-java-bean;version=1.1.3",
+    "application/x-java-bean;version=1.2",
+    "application/x-java-bean;version=1.2.1",
+    "application/x-java-bean;version=1.2.2",
+    "application/x-java-bean;version=1.3",
+    "application/x-java-bean;version=1.3.1",
+    "application/x-java-bean;version=1.4",
+    "application/x-java-bean;version=1.4.1",
+    "application/x-java-bean;version=1.4.2",
+    "application/x-java-bean;version=1.5",
+    "application/x-java-bean;version=1.6",
+    "application/x-java-bean;version=1.7",
+    "application/x-java-vm",
+    "application/x-java-vm-npruntime",
+    "application/x-mplayer2",
+    "application/x-ms-xbap",
+    "application/x-nacl",
+    "application/x-pnacl",
+    "application/xaml+xml",
+    "applicationCache",
+    "applicationServerKey",
+    "apply",
+    "applyConstraints",
+    "applyElement",
+    "arc",
+    "arcTo",
+    "archive",
+    "areas",
+    "arguments",
+    "aria-activedescendant",
+    "aria-busy",
+    "aria-checked",
+    "aria-controls",
+    "aria-describedby",
+    "aria-disabled",
+    "aria-expanded",
+    "aria-flowto",
+    "aria-haspopup",
+    "aria-hidden",
+    "aria-invalid",
+    "aria-labelledby",
+    "aria-level",
+    "aria-live",
+    "aria-multiselectable",
+    "aria-owns",
+    "aria-posinset",
+    "aria-pressed",
+    "aria-readonly",
+    "aria-relevant",
+    "aria-required",
+    "aria-secret",
+    "aria-selected",
+    "aria-setsize",
+    "aria-valuemax",
+    "aria-valuemin",
+    "aria-valuenow",
+    "ariaAtomic",
+    "ariaAutoComplete",
+    "ariaBusy",
+    "ariaChecked",
+    "ariaColCount",
+    "ariaColIndex",
+    "ariaColSpan",
+    "ariaCurrent",
+    "ariaDescription",
+    "ariaDisabled",
+    "ariaExpanded",
+    "ariaHasPopup",
+    "ariaHidden",
+    "ariaKeyShortcuts",
+    "ariaLabel",
+    "ariaLevel",
+    "ariaLive",
+    "ariaModal",
+    "ariaMultiLine",
+    "ariaMultiSelectable",
+    "ariaOrientation",
+    "ariaPlaceholder",
+    "ariaPosInSet",
+    "ariaPressed",
+    "ariaReadOnly",
+    "ariaRelevant",
+    "ariaRequired",
+    "ariaRoleDescription",
+    "ariaRowCount",
+    "ariaRowIndex",
+    "ariaRowSpan",
+    "ariaSelected",
+    "ariaSetSize",
+    "ariaSort",
+    "ariaValueMax",
+    "ariaValueMin",
+    "ariaValueNow",
+    "ariaValueText",
+    "arrayBuffer",
+    "artist",
+    "artwork",
+    "as",
+    "asIntN",
+    "asUintN",
+    "asin",
+    "asinh",
+    "assert",
+    "assign",
+    "assignedElements",
+    "assignedNodes",
+    "assignedSlot",
+    "async",
+    "asyncIterator",
+    "atEnd",
+    "atan",
+    "atan2",
+    "atanh",
+    "atob",
+    "atomic",
+    "attachEvent",
+    "attachInternals",
+    "attachShader",
+    "attachShadow",
+    "attachments",
+    "attack",
+    "attestationObject",
+    "attrChange",
+    "attrName",
+    "attributeChangedCallback",
+    "attributeFilter",
+    "attributeName",
+    "attributeNamespace",
+    "attributeOldValue",
+    "attributeStyleMap",
+    "attributes",
+    "attribution",
+    "audio/x-ms-wax",
+    "audio/x-ms-wma",
+    "audioBitsPerSecond",
+    "audioTracks",
+    "audioWorklet",
+    "authenticatedSignedWrites",
+    "authenticatorData",
+    "autoIncrement",
+    "autobuffer",
+    "autocapitalize",
+    "autocomplete",
+    "autocorrect",
+    "autofocus",
+    "automationRate",
+    "autoplay",
+    "availHeight",
+    "availLeft",
+    "availTop",
+    "availWidth",
+    "availability",
+    "available",
+    "aversion",
+    "ax",
+    "axes",
+    "axis",
+    "ay",
+    "azimuth",
+    "b",
+    "back",
+    "backdropFilter",
+    "backface-visibility",
+    "backfaceVisibility",
+    "background",
+    "background-attachment",
+    "background-blend-mode",
+    "background-clip",
+    "background-color",
+    "background-image",
+    "background-origin",
+    "background-position",
+    "background-position-x",
+    "background-position-y",
+    "background-repeat",
+    "background-size",
+    "backgroundAttachment",
+    "backgroundBlendMode",
+    "backgroundClip",
+    "backgroundColor",
+    "backgroundFetch",
+    "backgroundImage",
+    "backgroundOrigin",
+    "backgroundPosition",
+    "backgroundPositionX",
+    "backgroundPositionY",
+    "backgroundRepeat",
+    "backgroundRepeatX",
+    "backgroundRepeatY",
+    "backgroundSize",
+    "badInput",
+    "badge",
+    "balance",
+    "baseFrequencyX",
+    "baseFrequencyY",
+    "baseLatency",
+    "baseLayer",
+    "baseName",
+    "baseNode",
+    "baseOffset",
+    "baseURI",
+    "baseVal",
+    "baselineShift",
+    "battery",
+    "bday",
+    "before",
+    "beginElement",
+    "beginElementAt",
+    "beginPath",
+    "beginQuery",
+    "beginTransformFeedback",
+    "behavior",
+    "behaviorCookie",
+    "behaviorPart",
+    "behaviorUrns",
+    "beta",
+    "bezierCurveTo",
+    "bgColor",
+    "bgProperties",
+    "bias",
+    "big",
+    "binaryType",
+    "bind",
+    "bindAttribLocation",
+    "bindBuffer",
+    "bindBufferBase",
+    "bindBufferRange",
+    "bindFramebuffer",
+    "bindRenderbuffer",
+    "bindSampler",
+    "bindTexture",
+    "bindTransformFeedback",
+    "bindVertexArray",
+    "blendColor",
+    "blendEquation",
+    "blendEquationSeparate",
+    "blendFunc",
+    "blendFuncSeparate",
+    "blink",
+    "blitFramebuffer",
+    "blob",
+    "block-size",
+    "blockDirection",
+    "blockSize",
+    "blockedURI",
+    "blue",
+    "bluetooth",
+    "blur",
+    "body",
+    "bodyUsed",
+    "bold",
+    "bookmarks",
+    "booleanValue",
+    "border",
+    "border-block",
+    "border-block-color",
+    "border-block-end",
+    "border-block-end-color",
+    "border-block-end-style",
+    "border-block-end-width",
+    "border-block-start",
+    "border-block-start-color",
+    "border-block-start-style",
+    "border-block-start-width",
+    "border-block-style",
+    "border-block-width",
+    "border-bottom",
+    "border-bottom-color",
+    "border-bottom-left-radius",
+    "border-bottom-right-radius",
+    "border-bottom-style",
+    "border-bottom-width",
+    "border-collapse",
+    "border-color",
+    "border-end-end-radius",
+    "border-end-start-radius",
+    "border-image",
+    "border-image-outset",
+    "border-image-repeat",
+    "border-image-slice",
+    "border-image-source",
+    "border-image-width",
+    "border-inline",
+    "border-inline-color",
+    "border-inline-end",
+    "border-inline-end-color",
+    "border-inline-end-style",
+    "border-inline-end-width",
+    "border-inline-start",
+    "border-inline-start-color",
+    "border-inline-start-style",
+    "border-inline-start-width",
+    "border-inline-style",
+    "border-inline-width",
+    "border-left",
+    "border-left-color",
+    "border-left-style",
+    "border-left-width",
+    "border-radius",
+    "border-right",
+    "border-right-color",
+    "border-right-style",
+    "border-right-width",
+    "border-spacing",
+    "border-start-end-radius",
+    "border-start-start-radius",
+    "border-style",
+    "border-top",
+    "border-top-color",
+    "border-top-left-radius",
+    "border-top-right-radius",
+    "border-top-style",
+    "border-top-width",
+    "border-width",
+    "borderBlock",
+    "borderBlockColor",
+    "borderBlockEnd",
+    "borderBlockEndColor",
+    "borderBlockEndStyle",
+    "borderBlockEndWidth",
+    "borderBlockStart",
+    "borderBlockStartColor",
+    "borderBlockStartStyle",
+    "borderBlockStartWidth",
+    "borderBlockStyle",
+    "borderBlockWidth",
+    "borderBottom",
+    "borderBottomColor",
+    "borderBottomLeftRadius",
+    "borderBottomRightRadius",
+    "borderBottomStyle",
+    "borderBottomWidth",
+    "borderBoxSize",
+    "borderCollapse",
+    "borderColor",
+    "borderColorDark",
+    "borderColorLight",
+    "borderEndEndRadius",
+    "borderEndStartRadius",
+    "borderImage",
+    "borderImageOutset",
+    "borderImageRepeat",
+    "borderImageSlice",
+    "borderImageSource",
+    "borderImageWidth",
+    "borderInline",
+    "borderInlineColor",
+    "borderInlineEnd",
+    "borderInlineEndColor",
+    "borderInlineEndStyle",
+    "borderInlineEndWidth",
+    "borderInlineStart",
+    "borderInlineStartColor",
+    "borderInlineStartStyle",
+    "borderInlineStartWidth",
+    "borderInlineStyle",
+    "borderInlineWidth",
+    "borderLeft",
+    "borderLeftColor",
+    "borderLeftStyle",
+    "borderLeftWidth",
+    "borderRadius",
+    "borderRight",
+    "borderRightColor",
+    "borderRightStyle",
+    "borderRightWidth",
+    "borderSpacing",
+    "borderStartEndRadius",
+    "borderStartStartRadius",
+    "borderStyle",
+    "borderTop",
+    "borderTopColor",
+    "borderTopLeftRadius",
+    "borderTopRightRadius",
+    "borderTopStyle",
+    "borderTopWidth",
+    "borderWidth",
+    "bottom",
+    "bottomMargin",
+    "bound",
+    "boundElements",
+    "boundingClientRect",
+    "boundingHeight",
+    "boundingLeft",
+    "boundingTop",
+    "boundingWidth",
+    "bounds",
+    "boundsGeometry",
+    "box-decoration-break",
+    "box-shadow",
+    "box-sizing",
+    "boxDecorationBreak",
+    "boxShadow",
+    "boxSizing",
+    "break-after",
+    "break-before",
+    "break-inside",
+    "breakAfter",
+    "breakBefore",
+    "breakInside",
+    "breakType",
+    "broadcast",
+    "browserLanguage",
+    "btoa",
+    "bubbles",
+    "buffer",
+    "bufferData",
+    "bufferDepth",
+    "bufferSize",
+    "bufferSubData",
+    "buffered",
+    "bufferedAmount",
+    "bufferedAmountLowThreshold",
+    "bufferedRendering",
+    "buildID",
+    "buildNumber",
+    "button",
+    "buttonID",
+    "buttons",
+    "byteLength",
+    "byteOffset",
+    "bytesWritten",
+    "c",
+    "cache",
+    "caches",
+    "calendar",
+    "call",
+    "caller",
+    "canBeFormatted",
+    "canBeMounted",
+    "canBeShared",
+    "canHaveChildren",
+    "canHaveHTML",
+    "canInsertDTMF",
+    "canMakePayment",
+    "canPlayType",
+    "canPresent",
+    "canTrickleIceCandidates",
+    "cancel",
+    "cancelAndHoldAtTime",
+    "cancelAnimationFrame",
+    "cancelBubble",
+    "cancelIdleCallback",
+    "cancelScheduledValues",
+    "cancelVideoFrameCallback",
+    "cancelWatchAvailability",
+    "cancelable",
+    "candidate",
+    "canonicalUUID",
+    "canvas",
+    "capabilities",
+    "caption",
+    "caption-side",
+    "captionSide",
+    "capture",
+    "captureEvents",
+    "captureStackTrace",
+    "captureStream",
+    "caret-color",
+    "caretBidiLevel",
+    "caretColor",
+    "caretPositionFromPoint",
+    "caretRangeFromPoint",
+    "caseFirst",
+    "cast",
+    "catch",
+    "category",
+    "cbrt",
+    "cd",
+    "ceil",
+    "cellIndex",
+    "cellPadding",
+    "cellSpacing",
+    "cells",
+    "ch",
+    "chOff",
+    "chain",
+    "challenge",
+    "changeType",
+    "changeVersion",
+    "changedTouches",
+    "channel",
+    "channelCount",
+    "channelCountMode",
+    "channelInterpretation",
+    "char",
+    "charAt",
+    "charCode",
+    "charCodeAt",
+    "charIndex",
+    "charLength",
+    "characterData",
+    "characterDataOldValue",
+    "characterSet",
+    "characteristic",
+    "charging",
+    "chargingTime",
+    "charset",
+    "check",
+    "checkEnclosure",
+    "checkFramebufferStatus",
+    "checkInstalled",
+    "checkIntersection",
+    "checkValidity",
+    "checked",
+    "childElementCount",
+    "childList",
+    "childNodes",
+    "children",
+    "chrome",
+    "ciphertext",
+    "cite",
+    "city",
+    "claimInterface",
+    "claimed",
+    "classList",
+    "className",
+    "classid",
+    "clear",
+    "clearAppBadge",
+    "clearAttributes",
+    "clearBufferfi",
+    "clearBufferfv",
+    "clearBufferiv",
+    "clearBufferuiv",
+    "clearColor",
+    "clearData",
+    "clearDepth",
+    "clearHalt",
+    "clearImmediate",
+    "clearInterval",
+    "clearLiveSeekableRange",
+    "clearMarks",
+    "clearMeasures",
+    "clearParameters",
+    "clearRect",
+    "clearResourceTimings",
+    "clearShadow",
+    "clearStencil",
+    "clearTimeout",
+    "clearWatch",
+    "click",
+    "clickCount",
+    "clientDataJSON",
+    "clientHeight",
+    "clientInformation",
+    "clientLeft",
+    "clientRect",
+    "clientRects",
+    "clientTop",
+    "clientWaitSync",
+    "clientWidth",
+    "clientX",
+    "clientY",
+    "clip",
+    "clip-path",
+    "clip-rule",
+    "clipBottom",
+    "clipLeft",
+    "clipPath",
+    "clipPathUnits",
+    "clipRight",
+    "clipRule",
+    "clipTop",
+    "clipboard",
+    "clipboardData",
+    "clone",
+    "cloneContents",
+    "cloneNode",
+    "cloneRange",
+    "close",
+    "closePath",
+    "closed",
+    "closest",
+    "clz",
+    "clz32",
+    "cm",
+    "cmp",
+    "code",
+    "codeBase",
+    "codePointAt",
+    "codeType",
+    "colSpan",
+    "collapse",
+    "collapseToEnd",
+    "collapseToStart",
+    "collapsed",
+    "collation",
+    "collect",
+    "colno",
+    "color",
+    "color-adjust",
+    "color-interpolation",
+    "color-interpolation-filters",
+    "colorAdjust",
+    "colorDepth",
+    "colorInterpolation",
+    "colorInterpolationFilters",
+    "colorMask",
+    "colorProfile",
+    "colorRendering",
+    "colorScheme",
+    "colorType",
+    "cols",
+    "column",
+    "column-count",
+    "column-fill",
+    "column-gap",
+    "column-rule",
+    "column-rule-color",
+    "column-rule-style",
+    "column-rule-width",
+    "column-span",
+    "column-width",
+    "columnCount",
+    "columnFill",
+    "columnGap",
+    "columnNumber",
+    "columnRule",
+    "columnRuleColor",
+    "columnRuleStyle",
+    "columnRuleWidth",
+    "columnSpan",
+    "columnWidth",
+    "columns",
+    "command",
+    "commit",
+    "commitLoadTime",
+    "commitPreferences",
+    "commitStyles",
+    "commonAncestorContainer",
+    "compact",
+    "compare",
+    "compareBoundaryPoints",
+    "compareDocumentPosition",
+    "compareEndPoints",
+    "compareExchange",
+    "compareNode",
+    "comparePoint",
+    "compatMode",
+    "compatible",
+    "compile",
+    "compileShader",
+    "compileStreaming",
+    "complete",
+    "component",
+    "componentFromPoint",
+    "composed",
+    "composedPath",
+    "composite",
+    "compositionEndOffset",
+    "compositionStartOffset",
+    "compressedTexImage2D",
+    "compressedTexImage3D",
+    "compressedTexSubImage2D",
+    "compressedTexSubImage3D",
+    "computedStyleMap",
+    "concat",
+    "conditionText",
+    "coneInnerAngle",
+    "coneOuterAngle",
+    "coneOuterGain",
+    "configuration",
+    "configurationName",
+    "configurationValue",
+    "configurations",
+    "confirm",
+    "confirmComposition",
+    "confirmSiteSpecificTrackingException",
+    "confirmWebWideTrackingException",
+    "connect",
+    "connectEnd",
+    "connectStart",
+    "connected",
+    "connectedCallback",
+    "connection",
+    "connectionInfo",
+    "connectionList",
+    "connectionSpeed",
+    "connectionState",
+    "connections",
+    "console",
+    "consoleHistory",
+    "consolidate",
+    "constraint",
+    "constrictionActive",
+    "construct",
+    "constructor",
+    "contactID",
+    "contain",
+    "containIntrinsicSize",
+    "containerId",
+    "containerName",
+    "containerSrc",
+    "containerType",
+    "contains",
+    "containsNode",
+    "content",
+    "contentBoxSize",
+    "contentDocument",
+    "contentEditable",
+    "contentHint",
+    "contentOverflow",
+    "contentRect",
+    "contentScriptType",
+    "contentStyleType",
+    "contentType",
+    "contentWindow",
+    "context",
+    "contextMenu",
+    "contextmenu",
+    "continue",
+    "continuePrimaryKey",
+    "continuous",
+    "control",
+    "controlTransferIn",
+    "controlTransferOut",
+    "controller",
+    "controls",
+    "controlsList",
+    "convertToBlob",
+    "convertToSpecifiedUnits",
+    "cookie",
+    "cookieEnabled",
+    "coords",
+    "copyBufferSubData",
+    "copyFromChannel",
+    "copyTexImage2D",
+    "copyTexSubImage2D",
+    "copyTexSubImage3D",
+    "copyToChannel",
+    "copyWithin",
+    "correspondingElement",
+    "correspondingUseElement",
+    "corruptedVideoFrames",
+    "cos",
+    "cosh",
+    "count",
+    "countReset",
+    "counter-increment",
+    "counter-reset",
+    "counter-set",
+    "counterIncrement",
+    "counterReset",
+    "counterSet",
+    "country",
+    "cpuClass",
+    "cpuSleepAllowed",
+    "create",
+    "createAnalyser",
+    "createAnswer",
+    "createAttribute",
+    "createAttributeNS",
+    "createBiquadFilter",
+    "createBuffer",
+    "createBufferSource",
+    "createCDATASection",
+    "createCSSStyleSheet",
+    "createCaption",
+    "createChannelMerger",
+    "createChannelSplitter",
+    "createComment",
+    "createConstantSource",
+    "createContextualFragment",
+    "createControlRange",
+    "createConvolver",
+    "createDTMFSender",
+    "createDataChannel",
+    "createDelay",
+    "createDelayNode",
+    "createDocument",
+    "createDocumentFragment",
+    "createDocumentType",
+    "createDynamicsCompressor",
+    "createElement",
+    "createElementNS",
+    "createEntityReference",
+    "createEvent",
+    "createEventObject",
+    "createExpression",
+    "createFramebuffer",
+    "createFunction",
+    "createGain",
+    "createGainNode",
+    "createHTML",
+    "createHTMLDocument",
+    "createIIRFilter",
+    "createImageBitmap",
+    "createImageData",
+    "createIndex",
+    "createJavaScriptNode",
+    "createLinearGradient",
+    "createMediaElementSource",
+    "createMediaKeys",
+    "createMediaStreamDestination",
+    "createMediaStreamSource",
+    "createMediaStreamTrackSource",
+    "createMutableFile",
+    "createNSResolver",
+    "createNodeIterator",
+    "createNotification",
+    "createObjectStore",
+    "createObjectURL",
+    "createOffer",
+    "createOscillator",
+    "createPanner",
+    "createPattern",
+    "createPeriodicWave",
+    "createPolicy",
+    "createPopup",
+    "createProcessingInstruction",
+    "createProgram",
+    "createQuery",
+    "createRadialGradient",
+    "createRange",
+    "createRangeCollection",
+    "createReader",
+    "createRenderbuffer",
+    "createSVGAngle",
+    "createSVGLength",
+    "createSVGMatrix",
+    "createSVGNumber",
+    "createSVGPathSegArcAbs",
+    "createSVGPathSegArcRel",
+    "createSVGPathSegClosePath",
+    "createSVGPathSegCurvetoCubicAbs",
+    "createSVGPathSegCurvetoCubicRel",
+    "createSVGPathSegCurvetoCubicSmoothAbs",
+    "createSVGPathSegCurvetoCubicSmoothRel",
+    "createSVGPathSegCurvetoQuadraticAbs",
+    "createSVGPathSegCurvetoQuadraticRel",
+    "createSVGPathSegCurvetoQuadraticSmoothAbs",
+    "createSVGPathSegCurvetoQuadraticSmoothRel",
+    "createSVGPathSegLinetoAbs",
+    "createSVGPathSegLinetoHorizontalAbs",
+    "createSVGPathSegLinetoHorizontalRel",
+    "createSVGPathSegLinetoRel",
+    "createSVGPathSegLinetoVerticalAbs",
+    "createSVGPathSegLinetoVerticalRel",
+    "createSVGPathSegMovetoAbs",
+    "createSVGPathSegMovetoRel",
+    "createSVGPoint",
+    "createSVGRect",
+    "createSVGTransform",
+    "createSVGTransformFromMatrix",
+    "createSampler",
+    "createScript",
+    "createScriptProcessor",
+    "createScriptURL",
+    "createSession",
+    "createShader",
+    "createShadowRoot",
+    "createStereoPanner",
+    "createStyleSheet",
+    "createTBody",
+    "createTFoot",
+    "createTHead",
+    "createTextNode",
+    "createTextRange",
+    "createTexture",
+    "createTouch",
+    "createTouchList",
+    "createTransformFeedback",
+    "createTreeWalker",
+    "createVertexArray",
+    "createWaveShaper",
+    "creationTime",
+    "credentials",
+    "crossOrigin",
+    "crossOriginIsolated",
+    "crypto",
+    "csi",
+    "csp",
+    "cssFloat",
+    "cssRules",
+    "cssText",
+    "cssValueType",
+    "ctrlKey",
+    "ctrlLeft",
+    "cues",
+    "cullFace",
+    "currency",
+    "currencyDisplay",
+    "current",
+    "currentDirection",
+    "currentLocalDescription",
+    "currentNode",
+    "currentPage",
+    "currentRect",
+    "currentRemoteDescription",
+    "currentScale",
+    "currentScript",
+    "currentSrc",
+    "currentState",
+    "currentStyle",
+    "currentTarget",
+    "currentTime",
+    "currentTranslate",
+    "currentView",
+    "cursor",
+    "curve",
+    "customElements",
+    "customError",
+    "customSections",
+    "cx",
+    "cy",
+    "d",
+    "data",
+    "dataFld",
+    "dataFormatAs",
+    "dataLoss",
+    "dataLossMessage",
+    "dataPageSize",
+    "dataSrc",
+    "dataTransfer",
+    "database",
+    "databases",
+    "dataset",
+    "dateTime",
+    "day",
+    "db",
+    "debug",
+    "debuggerEnabled",
+    "declare",
+    "decode",
+    "decodeAudioData",
+    "decodeURI",
+    "decodeURIComponent",
+    "decodedBodySize",
+    "decoding",
+    "decodingInfo",
+    "decrypt",
+    "default",
+    "defaultCharset",
+    "defaultChecked",
+    "defaultMuted",
+    "defaultPlaybackRate",
+    "defaultPolicy",
+    "defaultPrevented",
+    "defaultRequest",
+    "defaultSelected",
+    "defaultStatus",
+    "defaultURL",
+    "defaultValue",
+    "defaultView",
+    "defaultstatus",
+    "defer",
+    "define",
+    "defineMagicFunction",
+    "defineMagicVariable",
+    "defineProperties",
+    "defineProperty",
+    "deg",
+    "delay",
+    "delayTime",
+    "delegatesFocus",
+    "delete",
+    "deleteBuffer",
+    "deleteCaption",
+    "deleteCell",
+    "deleteContents",
+    "deleteData",
+    "deleteDatabase",
+    "deleteFramebuffer",
+    "deleteFromDocument",
+    "deleteIndex",
+    "deleteMedium",
+    "deleteObjectStore",
+    "deleteProgram",
+    "deleteProperty",
+    "deleteQuery",
+    "deleteRenderbuffer",
+    "deleteRow",
+    "deleteRule",
+    "deleteSampler",
+    "deleteShader",
+    "deleteSync",
+    "deleteTFoot",
+    "deleteTHead",
+    "deleteTexture",
+    "deleteTransformFeedback",
+    "deleteVertexArray",
+    "deliverChangeRecords",
+    "delivery",
+    "deliveryInfo",
+    "deliveryStatus",
+    "deliveryTimestamp",
+    "delta",
+    "deltaMode",
+    "deltaX",
+    "deltaY",
+    "deltaZ",
+    "dependentLocality",
+    "depthFar",
+    "depthFunc",
+    "depthMask",
+    "depthNear",
+    "depthRange",
+    "deref",
+    "deriveBits",
+    "deriveKey",
+    "description",
+    "deselectAll",
+    "designMode",
+    "desiredSize",
+    "destination",
+    "destinationURL",
+    "detach",
+    "detachEvent",
+    "detachShader",
+    "detail",
+    "details",
+    "detect",
+    "detune",
+    "device",
+    "deviceClass",
+    "deviceId",
+    "deviceMemory",
+    "devicePixelContentBoxSize",
+    "devicePixelRatio",
+    "deviceProtocol",
+    "deviceSessionId",
+    "deviceSubclass",
+    "deviceVersionMajor",
+    "deviceVersionMinor",
+    "deviceVersionSubminor",
+    "deviceXDPI",
+    "deviceYDPI",
+    "didTimeout",
+    "diffuseConstant",
+    "digest",
+    "dimensions",
+    "dir",
+    "dirName",
+    "dirXml",
+    "direction",
+    "dirxml",
+    "disable",
+    "disablePictureInPicture",
+    "disableRemotePlayback",
+    "disableVertexAttribArray",
+    "disabled",
+    "dischargingTime",
+    "disconnect",
+    "disconnectedCallback",
+    "dispatch",
+    "dispatchEvent",
+    "dispatchToListener",
+    "display",
+    "displayId",
+    "displayName",
+    "disposition",
+    "distanceModel",
+    "div",
+    "divisor",
+    "djsapi",
+    "djsproxy",
+    "doImport",
+    "doNotTrack",
+    "doScroll",
+    "doctype",
+    "document",
+    "documentElement",
+    "documentMode",
+    "documentURI",
+    "dolphin",
+    "dolphinGameCenter",
+    "dolphininfo",
+    "dolphinmeta",
+    "domComplete",
+    "domContentLoadedEventEnd",
+    "domContentLoadedEventStart",
+    "domInteractive",
+    "domLoading",
+    "domOverlayState",
+    "domain",
+    "domainLookupEnd",
+    "domainLookupStart",
+    "dominant-baseline",
+    "dominantBaseline",
+    "done",
+    "dopplerFactor",
+    "dotAll",
+    "downDegrees",
+    "downlink",
+    "download",
+    "downloadTotal",
+    "downloaded",
+    "dpcm",
+    "dpi",
+    "dppx",
+    "dragDrop",
+    "draggable",
+    "drawArrays",
+    "drawArraysInstanced",
+    "drawArraysInstancedANGLE",
+    "drawBuffers",
+    "drawCustomFocusRing",
+    "drawElements",
+    "drawElementsInstanced",
+    "drawElementsInstancedANGLE",
+    "drawFocusIfNeeded",
+    "drawImage",
+    "drawImageFromRect",
+    "drawRangeElements",
+    "drawSystemFocusRing",
+    "drawingBufferHeight",
+    "drawingBufferWidth",
+    "dropEffect",
+    "droppedVideoFrames",
+    "dropzone",
+    "dtmf",
+    "dump",
+    "duplicate",
+    "durability",
+    "duration",
+    "dvname",
+    "dvnum",
+    "dx",
+    "dy",
+    "dynsrc",
+    "e",
+    "edgeMode",
+    "effect",
+    "effectAllowed",
+    "effectiveDirective",
+    "effectiveType",
+    "elapsedTime",
+    "element",
+    "elementFromPoint",
+    "elementTiming",
+    "elements",
+    "elementsFromPoint",
+    "elevation",
+    "ellipse",
+    "em",
+    "emHeightAscent",
+    "emHeightDescent",
+    "email",
+    "embeds",
+    "emma",
+    "empty",
+    "empty-cells",
+    "emptyCells",
+    "emptyHTML",
+    "emptyScript",
+    "emulatedPosition",
+    "enable",
+    "enableBackground",
+    "enableDelegations",
+    "enableStyleSheetsForSet",
+    "enableVertexAttribArray",
+    "enabled",
+    "enabledPlugin",
+    "encode",
+    "encodeInto",
+    "encodeURI",
+    "encodeURIComponent",
+    "encodedBodySize",
+    "encoding",
+    "encodingInfo",
+    "encrypt",
+    "enctype",
+    "end",
+    "endContainer",
+    "endElement",
+    "endElementAt",
+    "endOfStream",
+    "endOffset",
+    "endQuery",
+    "endTime",
+    "endTransformFeedback",
+    "ended",
+    "endpoint",
+    "endpointNumber",
+    "endpoints",
+    "endsWith",
+    "enterKeyHint",
+    "entities",
+    "entries",
+    "entryType",
+    "enumerate",
+    "enumerateDevices",
+    "enumerateEditable",
+    "environmentBlendMode",
+    "epubCaptionSide",
+    "epubTextCombine",
+    "epubTextEmphasis",
+    "epubTextEmphasisColor",
+    "epubTextEmphasisStyle",
+    "epubTextOrientation",
+    "epubTextTransform",
+    "epubWordBreak",
+    "epubWritingMode",
+    "equals",
+    "era",
+    "error",
+    "errorCode",
+    "errorDetail",
+    "errorText",
+    "escape",
+    "estimate",
+    "eval",
+    "evaluate",
+    "event",
+    "eventPhase",
+    "every",
+    "ex",
+    "exception",
+    "exchange",
+    "exec",
+    "execCommand",
+    "execCommandShowHelp",
+    "execScript",
+    "executeSql",
+    "exitFullscreen",
+    "exitPictureInPicture",
+    "exitPointerLock",
+    "exitPresent",
+    "exp",
+    "expand",
+    "expandEntityReferences",
+    "expando",
+    "expansion",
+    "expiration",
+    "expirationTime",
+    "expires",
+    "expiryDate",
+    "explicitOriginalTarget",
+    "expm1",
+    "exponent",
+    "exponentialRampToValueAtTime",
+    "exportKey",
+    "exports",
+    "extend",
+    "extensions",
+    "extentNode",
+    "extentOffset",
+    "external",
+    "externalResourcesRequired",
+    "extractContents",
+    "extractable",
+    "eye",
+    "f",
+    "face",
+    "factoryReset",
+    "failureReason",
+    "fallback",
+    "family",
+    "familyName",
+    "farthestViewportElement",
+    "fastSeek",
+    "fatal",
+    "featurePolicy",
+    "featureSettings",
+    "features",
+    "fenceSync",
+    "fetch",
+    "fetchStart",
+    "fftSize",
+    "fgColor",
+    "fieldOfView",
+    "file",
+    "fileCreatedDate",
+    "fileHandle",
+    "fileModifiedDate",
+    "fileName",
+    "fileSize",
+    "fileUpdatedDate",
+    "filename",
+    "files",
+    "filesystem",
+    "fill",
+    "fill-opacity",
+    "fill-rule",
+    "fillLightMode",
+    "fillOpacity",
+    "fillRect",
+    "fillRule",
+    "fillStyle",
+    "fillText",
+    "filter",
+    "filterResX",
+    "filterResY",
+    "filterUnits",
+    "filters",
+    "finally",
+    "find",
+    "findIndex",
+    "findRule",
+    "findText",
+    "finish",
+    "finishDocumentLoadTime",
+    "finishLoadTime",
+    "finished",
+    "fireEvent",
+    "firesTouchEvents",
+    "first",
+    "firstChild",
+    "firstElementChild",
+    "firstPage",
+    "firstPaintAfterLoadTime",
+    "firstPaintTime",
+    "fixed",
+    "flags",
+    "flat",
+    "flatMap",
+    "flex",
+    "flex-basis",
+    "flex-direction",
+    "flex-flow",
+    "flex-grow",
+    "flex-shrink",
+    "flex-wrap",
+    "flexBasis",
+    "flexDirection",
+    "flexFlow",
+    "flexGrow",
+    "flexShrink",
+    "flexWrap",
+    "flipX",
+    "flipY",
+    "float",
+    "flood-color",
+    "flood-opacity",
+    "floodColor",
+    "floodOpacity",
+    "floor",
+    "flush",
+    "focus",
+    "focusNode",
+    "focusOffset",
+    "font",
+    "font-family",
+    "font-feature-settings",
+    "font-kerning",
+    "font-language-override",
+    "font-size",
+    "font-size-adjust",
+    "font-stretch",
+    "font-style",
+    "font-synthesis",
+    "font-variant",
+    "font-variant-alternates",
+    "font-variant-caps",
+    "font-variant-east-asian",
+    "font-variant-ligatures",
+    "font-variant-numeric",
+    "font-variant-position",
+    "font-weight",
+    "fontBoundingBoxAscent",
+    "fontBoundingBoxDescent",
+    "fontDisplay",
+    "fontFamily",
+    "fontFeatureSettings",
+    "fontKerning",
+    "fontLanguageOverride",
+    "fontOpticalSizing",
+    "fontSize",
+    "fontSizeAdjust",
+    "fontSmoothingEnabled",
+    "fontStretch",
+    "fontStyle",
+    "fontSynthesis",
+    "fontVariant",
+    "fontVariantAlternates",
+    "fontVariantCaps",
+    "fontVariantEastAsian",
+    "fontVariantLigatures",
+    "fontVariantNumeric",
+    "fontVariantPosition",
+    "fontVariationSettings",
+    "fontWeight",
+    "fontcolor",
+    "fontfaces",
+    "fonts",
+    "fontsize",
+    "for",
+    "forEach",
+    "force",
+    "forceRedraw",
+    "form",
+    "formAction",
+    "formData",
+    "formEnctype",
+    "formMethod",
+    "formNoValidate",
+    "formTarget",
+    "format",
+    "formatRange",
+    "formatRangeToParts",
+    "formatToParts",
+    "forms",
+    "forward",
+    "forwardX",
+    "forwardY",
+    "forwardZ",
+    "foundation",
+    "fr",
+    "fragmentDirective",
+    "frame",
+    "frameBorder",
+    "frameElement",
+    "frameSpacing",
+    "framebuffer",
+    "framebufferHeight",
+    "framebufferRenderbuffer",
+    "framebufferTexture2D",
+    "framebufferTextureLayer",
+    "framebufferWidth",
+    "frames",
+    "freeSpace",
+    "freeze",
+    "frequency",
+    "frequencyBinCount",
+    "from",
+    "fromCharCode",
+    "fromCodePoint",
+    "fromElement",
+    "fromEntries",
+    "fromFloat32Array",
+    "fromFloat64Array",
+    "fromMatrix",
+    "fromPoint",
+    "fromQuad",
+    "fromRect",
+    "frontFace",
+    "fround",
+    "fullPath",
+    "fullScreen",
+    "fullscreen",
+    "fullscreenElement",
+    "fullscreenEnabled",
+    "fx",
+    "fy",
+    "gain",
+    "gamepad",
+    "gamma",
+    "gap",
+    "gatheringState",
+    "gatt",
+    "genderIdentity",
+    "generateCertificate",
+    "generateKey",
+    "generateMipmap",
+    "generateRequest",
+    "geolocation",
+    "gestureObject",
+    "get",
+    "getActiveAttrib",
+    "getActiveUniform",
+    "getActiveUniformBlockName",
+    "getActiveUniformBlockParameter",
+    "getActiveUniforms",
+    "getAdditionalLanguages",
+    "getAdjacentText",
+    "getAll",
+    "getAllKeys",
+    "getAllResponseHeaders",
+    "getAllowlistForFeature",
+    "getAnimations",
+    "getAsFile",
+    "getAsString",
+    "getAttachedShaders",
+    "getAttribLocation",
+    "getAttribute",
+    "getAttributeNS",
+    "getAttributeNames",
+    "getAttributeNode",
+    "getAttributeNodeNS",
+    "getAttributeType",
+    "getAudioTracks",
+    "getAvailability",
+    "getBBox",
+    "getBattery",
+    "getBigInt64",
+    "getBigUint64",
+    "getBlob",
+    "getBookmark",
+    "getBoundingClientRect",
+    "getBounds",
+    "getBufferParameter",
+    "getBufferSubData",
+    "getByteFrequencyData",
+    "getByteTimeDomainData",
+    "getCSSCanvasContext",
+    "getCTM",
+    "getCandidateWindowClientRect",
+    "getCanonicalLocales",
+    "getCapabilities",
+    "getChannelData",
+    "getCharNumAtPosition",
+    "getCharacteristic",
+    "getCharacteristics",
+    "getClientExtensionResults",
+    "getClientRect",
+    "getClientRects",
+    "getCoalescedEvents",
+    "getCompositionAlternatives",
+    "getComputedStyle",
+    "getComputedTextLength",
+    "getComputedTiming",
+    "getConfiguration",
+    "getConstraints",
+    "getContext",
+    "getContextAttributes",
+    "getContributingSources",
+    "getCount",
+    "getCounterValue",
+    "getCueAsHTML",
+    "getCueById",
+    "getCurrentPosition",
+    "getCurrentTime",
+    "getData",
+    "getDatabaseNames",
+    "getDate",
+    "getDay",
+    "getDefaultComputedStyle",
+    "getDescriptor",
+    "getDescriptors",
+    "getDestinationInsertionPoints",
+    "getDetails",
+    "getDevices",
+    "getDirectory",
+    "getDisplayMedia",
+    "getDistributedNodes",
+    "getEditable",
+    "getElementById",
+    "getElementsByClassName",
+    "getElementsByName",
+    "getElementsByTagName",
+    "getElementsByTagNameNS",
+    "getEnclosureList",
+    "getEndPositionOfChar",
+    "getEntries",
+    "getEntriesByName",
+    "getEntriesByType",
+    "getError",
+    "getExtension",
+    "getExtentOfChar",
+    "getEyeParameters",
+    "getFeature",
+    "getFile",
+    "getFiles",
+    "getFilesAndDirectories",
+    "getFingerprints",
+    "getFloat32",
+    "getFloat64",
+    "getFloatFrequencyData",
+    "getFloatTimeDomainData",
+    "getFloatValue",
+    "getFragDataLocation",
+    "getFrameData",
+    "getFramebufferAttachmentParameter",
+    "getFrequencyResponse",
+    "getFullYear",
+    "getGamepads",
+    "getHitTestResults",
+    "getHitTestResultsForTransientInput",
+    "getHours",
+    "getIdentityAssertion",
+    "getIds",
+    "getImageData",
+    "getIndexedParameter",
+    "getInstalled",
+    "getInstalledRelatedApps",
+    "getInt16",
+    "getInt32",
+    "getInt8",
+    "getInternalformatParameter",
+    "getIntersectionList",
+    "getIsInstalled",
+    "getItem",
+    "getItems",
+    "getKey",
+    "getKeyframes",
+    "getLayers",
+    "getLayoutMap",
+    "getLineDash",
+    "getLocalCandidates",
+    "getLocalParameters",
+    "getLocalStreams",
+    "getLocalizationResource",
+    "getMarks",
+    "getMatchedCSSRules",
+    "getMeasures",
+    "getMetadata",
+    "getMilliseconds",
+    "getMinutes",
+    "getModifierState",
+    "getMonth",
+    "getNamedItem",
+    "getNamedItemNS",
+    "getNativeFramebufferScaleFactor",
+    "getNotifications",
+    "getNotifier",
+    "getNumberOfChars",
+    "getOffsetReferenceSpace",
+    "getOutputTimestamp",
+    "getOverrideHistoryNavigationMode",
+    "getOverrideStyle",
+    "getOwnPropertyDescriptor",
+    "getOwnPropertyDescriptors",
+    "getOwnPropertyNames",
+    "getOwnPropertySymbols",
+    "getParameter",
+    "getParameters",
+    "getParent",
+    "getPathSegAtLength",
+    "getPhotoCapabilities",
+    "getPhotoSettings",
+    "getPointAtLength",
+    "getPose",
+    "getPredictedEvents",
+    "getPreference",
+    "getPreferenceDefault",
+    "getPresentationAttribute",
+    "getPreventDefault",
+    "getPrimaryService",
+    "getPrimaryServices",
+    "getProgramInfoLog",
+    "getProgramParameter",
+    "getPropertyCSSValue",
+    "getPropertyPriority",
+    "getPropertyShorthand",
+    "getPropertyType",
+    "getPropertyValue",
+    "getPrototypeOf",
+    "getQuery",
+    "getQueryParameter",
+    "getRGBColorValue",
+    "getRandomValues",
+    "getRangeAt",
+    "getReader",
+    "getReceivers",
+    "getRectValue",
+    "getRegistration",
+    "getRegistrations",
+    "getRemoteCandidates",
+    "getRemoteCertificates",
+    "getRemoteParameters",
+    "getRemoteStreams",
+    "getRenderbufferParameter",
+    "getResponseHeader",
+    "getRevision",
+    "getRoot",
+    "getRootNode",
+    "getRotationOfChar",
+    "getRules",
+    "getSVGDocument",
+    "getSamplerParameter",
+    "getScreenCTM",
+    "getSeconds",
+    "getSelectedCandidatePair",
+    "getSelection",
+    "getSelf",
+    "getSenders",
+    "getService",
+    "getSettings",
+    "getShaderInfoLog",
+    "getShaderParameter",
+    "getShaderPrecisionFormat",
+    "getShaderSource",
+    "getSimpleDuration",
+    "getSiteIcons",
+    "getSources",
+    "getSpeculativeParserUrls",
+    "getStartDate",
+    "getStartPositionOfChar",
+    "getStartTime",
+    "getState",
+    "getStats",
+    "getStatusForPolicy",
+    "getStorageUpdates",
+    "getStreamById",
+    "getStringValue",
+    "getSubStringLength",
+    "getSubscription",
+    "getSupportedConstraints",
+    "getSupportedExtensions",
+    "getSupportedFormats",
+    "getSyncParameter",
+    "getSynchronizationSources",
+    "getTags",
+    "getTargetRanges",
+    "getTexParameter",
+    "getTime",
+    "getTimezoneOffset",
+    "getTiming",
+    "getTotalLength",
+    "getTrackById",
+    "getTracks",
+    "getTransceivers",
+    "getTransform",
+    "getTransformFeedbackVarying",
+    "getTransformToElement",
+    "getTransports",
+    "getType",
+    "getTypeMapping",
+    "getUTCDate",
+    "getUTCDay",
+    "getUTCFullYear",
+    "getUTCHours",
+    "getUTCMilliseconds",
+    "getUTCMinutes",
+    "getUTCMonth",
+    "getUTCSeconds",
+    "getUint16",
+    "getUint32",
+    "getUint8",
+    "getUniform",
+    "getUniformBlockIndex",
+    "getUniformIndices",
+    "getUniformLocation",
+    "getUserMedia",
+    "getVRDisplays",
+    "getValues",
+    "getVarDate",
+    "getVariableValue",
+    "getVertexAttrib",
+    "getVertexAttribOffset",
+    "getVideoPlaybackQuality",
+    "getVideoTracks",
+    "getViewerPose",
+    "getViewport",
+    "getVoices",
+    "getWakeLockState",
+    "getWriter",
+    "getYear",
+    "givenName",
+    "global",
+    "globalAlpha",
+    "globalCompositeOperation",
+    "globalThis",
+    "glyphOrientationHorizontal",
+    "glyphOrientationVertical",
+    "glyphRef",
+    "go",
+    "grabFrame",
+    "grad",
+    "gradientTransform",
+    "gradientUnits",
+    "grammars",
+    "green",
+    "grid",
+    "grid-area",
+    "grid-auto-columns",
+    "grid-auto-flow",
+    "grid-auto-rows",
+    "grid-column",
+    "grid-column-end",
+    "grid-column-gap",
+    "grid-column-start",
+    "grid-gap",
+    "grid-row",
+    "grid-row-end",
+    "grid-row-gap",
+    "grid-row-start",
+    "grid-template",
+    "grid-template-areas",
+    "grid-template-columns",
+    "grid-template-rows",
+    "gridArea",
+    "gridAutoColumns",
+    "gridAutoFlow",
+    "gridAutoRows",
+    "gridColumn",
+    "gridColumnEnd",
+    "gridColumnGap",
+    "gridColumnStart",
+    "gridGap",
+    "gridRow",
+    "gridRowEnd",
+    "gridRowGap",
+    "gridRowStart",
+    "gridTemplate",
+    "gridTemplateAreas",
+    "gridTemplateColumns",
+    "gridTemplateRows",
+    "gripSpace",
+    "group",
+    "groupCollapsed",
+    "groupEnd",
+    "groupId",
+    "grow",
+    "hadRecentInput",
+    "hand",
+    "handedness",
+    "hangingBaseline",
+    "hangingPunctuation",
+    "hapticActuators",
+    "hardwareConcurrency",
+    "has",
+    "hasAttribute",
+    "hasAttributeNS",
+    "hasAttributes",
+    "hasBeenActive",
+    "hasChildNodes",
+    "hasComposition",
+    "hasEnrolledInstrument",
+    "hasExtension",
+    "hasExternalDisplay",
+    "hasFeature",
+    "hasFocus",
+    "hasInstance",
+    "hasLayout",
+    "hasListener",
+    "hasListeners",
+    "hasOrientation",
+    "hasOwnProperty",
+    "hasPointerCapture",
+    "hasPosition",
+    "hasReading",
+    "hasStorageAccess",
+    "hash",
+    "head",
+    "headers",
+    "heading",
+    "height",
+    "hidden",
+    "hide",
+    "hideFocus",
+    "high",
+    "highWaterMark",
+    "hint",
+    "history",
+    "honorificPrefix",
+    "honorificSuffix",
+    "horizontalOverflow",
+    "host",
+    "hostCandidate",
+    "hostname",
+    "hour",
+    "hour12",
+    "hourCycle",
+    "href",
+    "hrefTranslate",
+    "hreflang",
+    "hspace",
+    "html5TagCheckInerface",
+    "htmlFor",
+    "htmlText",
+    "httpEquiv",
+    "httpRequestStatusCode",
+    "hwTimestamp",
+    "hyphens",
+    "hypot",
+    "iccId",
+    "iceConnectionState",
+    "iceGatheringState",
+    "iceTransport",
+    "icon",
+    "iconURL",
+    "id",
+    "identifier",
+    "identity",
+    "ideographicBaseline",
+    "idpLoginUrl",
+    "ignoreBOM",
+    "ignoreCase",
+    "ignoreDepthValues",
+    "ignoreMutedMedia",
+    "ignorePunctuation",
+    "image-orientation",
+    "image-rendering",
+    "imageHeight",
+    "imageOrientation",
+    "imageRendering",
+    "imageSizes",
+    "imageSmoothingEnabled",
+    "imageSmoothingQuality",
+    "imageSrcset",
+    "imageWidth",
+    "images",
+    "ime-mode",
+    "imeMode",
+    "implementation",
+    "import",
+    "importKey",
+    "importNode",
+    "importStylesheet",
+    "imports",
+    "impp",
+    "imul",
+    "in",
+    "in1",
+    "in2",
+    "inBandMetadataTrackDispatchType",
+    "inRange",
+    "includes",
+    "incremental",
+    "indeterminate",
+    "index",
+    "indexNames",
+    "indexOf",
+    "indexedDB",
+    "indicate",
+    "inertiaDestinationX",
+    "inertiaDestinationY",
+    "info",
+    "init",
+    "initAnimationEvent",
+    "initBeforeLoadEvent",
+    "initClipboardEvent",
+    "initCloseEvent",
+    "initCommandEvent",
+    "initCompositionEvent",
+    "initCustomEvent",
+    "initData",
+    "initDataType",
+    "initDeviceMotionEvent",
+    "initDeviceOrientationEvent",
+    "initDragEvent",
+    "initErrorEvent",
+    "initEvent",
+    "initFocusEvent",
+    "initGestureEvent",
+    "initHashChangeEvent",
+    "initKeyEvent",
+    "initKeyboardEvent",
+    "initMSManipulationEvent",
+    "initMessageEvent",
+    "initMouseEvent",
+    "initMouseScrollEvent",
+    "initMouseWheelEvent",
+    "initMutationEvent",
+    "initNSMouseEvent",
+    "initOverflowEvent",
+    "initPageEvent",
+    "initPageTransitionEvent",
+    "initPointerEvent",
+    "initPopStateEvent",
+    "initProgressEvent",
+    "initScrollAreaEvent",
+    "initSimpleGestureEvent",
+    "initStorageEvent",
+    "initTextEvent",
+    "initTimeEvent",
+    "initTouchEvent",
+    "initTransitionEvent",
+    "initUIEvent",
+    "initWebKitAnimationEvent",
+    "initWebKitTransitionEvent",
+    "initWebKitWheelEvent",
+    "initWheelEvent",
+    "initialTime",
+    "initialize",
+    "initiatorType",
+    "inline-size",
+    "inlineSize",
+    "inlineVerticalFieldOfView",
+    "inner",
+    "innerHTML",
+    "innerHeight",
+    "innerText",
+    "innerWidth",
+    "input",
+    "inputBuffer",
+    "inputEncoding",
+    "inputMethod",
+    "inputMode",
+    "inputSource",
+    "inputSources",
+    "inputType",
+    "inputs",
+    "insertAdjacentElement",
+    "insertAdjacentHTML",
+    "insertAdjacentText",
+    "insertBefore",
+    "insertCell",
+    "insertDTMF",
+    "insertData",
+    "insertId",
+    "insertItemBefore",
+    "insertNode",
+    "insertRow",
+    "insertRule",
+    "inset",
+    "inset-block",
+    "inset-block-end",
+    "inset-block-start",
+    "inset-inline",
+    "inset-inline-end",
+    "inset-inline-start",
+    "insetBlock",
+    "insetBlockEnd",
+    "insetBlockStart",
+    "insetInline",
+    "insetInlineEnd",
+    "insetInlineStart",
+    "install",
+    "installChrome",
+    "installPackage",
+    "installState",
+    "installing",
+    "instanceRoot",
+    "instantiate",
+    "instantiateStreaming",
+    "instruments",
+    "integrity",
+    "interactionMode",
+    "intercept",
+    "interfaceClass",
+    "interfaceName",
+    "interfaceNumber",
+    "interfaceProtocol",
+    "interfaceSubclass",
+    "interfaces",
+    "interimResults",
+    "internalSubset",
+    "interpretation",
+    "intersectionRatio",
+    "intersectionRect",
+    "intersectsNode",
+    "interval",
+    "invalidIteratorState",
+    "invalidateFramebuffer",
+    "invalidateSubFramebuffer",
+    "inverse",
+    "invertSelf",
+    "is",
+    "is2D",
+    "isActive",
+    "isAlternate",
+    "isArray",
+    "isBingCurrentSearchDefault",
+    "isBuffer",
+    "isCandidateWindowVisible",
+    "isChar",
+    "isCollapsed",
+    "isComposing",
+    "isConcatSpreadable",
+    "isConnected",
+    "isContentEditable",
+    "isContentHandlerRegistered",
+    "isContextLost",
+    "isDefaultNamespace",
+    "isDirectory",
+    "isDisabled",
+    "isEnabled",
+    "isEqual",
+    "isEqualNode",
+    "isExtensible",
+    "isExternalCTAP2SecurityKeySupported",
+    "isFile",
+    "isFinite",
+    "isFramebuffer",
+    "isFrozen",
+    "isGenerator",
+    "isHTML",
+    "isHistoryNavigation",
+    "isId",
+    "isIdentity",
+    "isInjected",
+    "isInstalled",
+    "isInteger",
+    "isIntersecting",
+    "isLockFree",
+    "isMap",
+    "isMultiLine",
+    "isNaN",
+    "isOpen",
+    "isPointInFill",
+    "isPointInPath",
+    "isPointInRange",
+    "isPointInStroke",
+    "isPrefAlternate",
+    "isPresenting",
+    "isPrimary",
+    "isProgram",
+    "isPropertyImplicit",
+    "isProtocolHandlerRegistered",
+    "isPrototypeOf",
+    "isQuery",
+    "isRenderbuffer",
+    "isSafeInteger",
+    "isSameNode",
+    "isSampler",
+    "isScript",
+    "isScriptURL",
+    "isSealed",
+    "isSecureContext",
+    "isSessionSupported",
+    "isShader",
+    "isSupported",
+    "isSync",
+    "isTextEdit",
+    "isTexture",
+    "isTransformFeedback",
+    "isTrusted",
+    "isTypeSupported",
+    "isTypeSupportedWithFeatures",
+    "isUserVerifyingPlatformAuthenticatorAvailable",
+    "isVertexArray",
+    "isView",
+    "isVisible",
+    "isochronousTransferIn",
+    "isochronousTransferOut",
+    "isolation",
+    "italics",
+    "item",
+    "itemId",
+    "itemProp",
+    "itemRef",
+    "itemScope",
+    "itemType",
+    "itemValue",
+    "items",
+    "iterateNext",
+    "iterator",
+    "javaEnabled",
+    "jobTitle",
+    "join",
+    "jsHeapSizeLimit",
+    "json",
+    "justify-content",
+    "justify-items",
+    "justify-self",
+    "justifyContent",
+    "justifyItems",
+    "justifySelf",
+    "k1",
+    "k2",
+    "k3",
+    "k4",
+    "kHz",
+    "keepalive",
+    "kernelMatrix",
+    "kernelUnitLengthX",
+    "kernelUnitLengthY",
+    "kerning",
+    "key",
+    "keyCode",
+    "keyFor",
+    "keyIdentifier",
+    "keyLightEnabled",
+    "keyLocation",
+    "keyPath",
+    "keyStatuses",
+    "keySystem",
+    "keyText",
+    "keyUsage",
+    "keyboard",
+    "keys",
+    "keytype",
+    "kind",
+    "knee",
+    "label",
+    "labels",
+    "lang",
+    "language",
+    "languages",
+    "largeArcFlag",
+    "lastActivePanel",
+    "lastChild",
+    "lastElementChild",
+    "lastEventId",
+    "lastIndex",
+    "lastIndexOf",
+    "lastInputTime",
+    "lastMatch",
+    "lastMessageSubject",
+    "lastMessageType",
+    "lastModified",
+    "lastModifiedDate",
+    "lastPage",
+    "lastParen",
+    "lastState",
+    "lastStyleSheetSet",
+    "latitude",
+    "layerX",
+    "layerY",
+    "layoutFlow",
+    "layoutGrid",
+    "layoutGridChar",
+    "layoutGridLine",
+    "layoutGridMode",
+    "layoutGridType",
+    "lbound",
+    "left",
+    "leftContext",
+    "leftDegrees",
+    "leftMargin",
+    "leftProjectionMatrix",
+    "leftViewMatrix",
+    "length",
+    "lengthAdjust",
+    "lengthComputable",
+    "letter-spacing",
+    "letterSpacing",
+    "level",
+    "lighting-color",
+    "lightingColor",
+    "limitingConeAngle",
+    "line",
+    "line-break",
+    "line-height",
+    "lineAlign",
+    "lineBreak",
+    "lineCap",
+    "lineDashOffset",
+    "lineHeight",
+    "lineJoin",
+    "lineNumber",
+    "lineTo",
+    "lineWidth",
+    "linearAcceleration",
+    "linearRampToValueAtTime",
+    "linearVelocity",
+    "lineno",
+    "lines",
+    "link",
+    "linkColor",
+    "linkProgram",
+    "links",
+    "list",
+    "list-style",
+    "list-style-image",
+    "list-style-position",
+    "list-style-type",
+    "listStyle",
+    "listStyleImage",
+    "listStylePosition",
+    "listStyleType",
+    "listener",
+    "load",
+    "loadEventEnd",
+    "loadEventStart",
+    "loadTime",
+    "loadTimes",
+    "loaded",
+    "loading",
+    "localDescription",
+    "localName",
+    "localService",
+    "localStorage",
+    "locale",
+    "localeCompare",
+    "location",
+    "locationbar",
+    "lock",
+    "locked",
+    "lockedFile",
+    "locks",
+    "log",
+    "log10",
+    "log1p",
+    "log2",
+    "logicalXDPI",
+    "logicalYDPI",
+    "longDesc",
+    "longitude",
+    "lookupNamespaceURI",
+    "lookupPrefix",
+    "loop",
+    "loopEnd",
+    "loopStart",
+    "looping",
+    "low",
+    "lower",
+    "lowerBound",
+    "lowerOpen",
+    "lowsrc",
+    "m11",
+    "m12",
+    "m13",
+    "m14",
+    "m21",
+    "m22",
+    "m23",
+    "m24",
+    "m31",
+    "m32",
+    "m33",
+    "m34",
+    "m41",
+    "m42",
+    "m43",
+    "m44",
+    "makeXRCompatible",
+    "manifest",
+    "manufacturer",
+    "manufacturerName",
+    "map",
+    "mapping",
+    "margin",
+    "margin-block",
+    "margin-block-end",
+    "margin-block-start",
+    "margin-bottom",
+    "margin-inline",
+    "margin-inline-end",
+    "margin-inline-start",
+    "margin-left",
+    "margin-right",
+    "margin-top",
+    "marginBlock",
+    "marginBlockEnd",
+    "marginBlockStart",
+    "marginBottom",
+    "marginHeight",
+    "marginInline",
+    "marginInlineEnd",
+    "marginInlineStart",
+    "marginLeft",
+    "marginRight",
+    "marginTop",
+    "marginWidth",
+    "mark",
+    "markTimeline",
+    "marker",
+    "marker-end",
+    "marker-mid",
+    "marker-offset",
+    "marker-start",
+    "markerEnd",
+    "markerHeight",
+    "markerMid",
+    "markerOffset",
+    "markerStart",
+    "markerUnits",
+    "markerWidth",
+    "marks",
+    "mask",
+    "mask-clip",
+    "mask-composite",
+    "mask-image",
+    "mask-mode",
+    "mask-origin",
+    "mask-position",
+    "mask-position-x",
+    "mask-position-y",
+    "mask-repeat",
+    "mask-size",
+    "mask-type",
+    "maskClip",
+    "maskComposite",
+    "maskContentUnits",
+    "maskImage",
+    "maskMode",
+    "maskOrigin",
+    "maskPosition",
+    "maskPositionX",
+    "maskPositionY",
+    "maskRepeat",
+    "maskSize",
+    "maskType",
+    "maskUnits",
+    "match",
+    "matchAll",
+    "matchMedia",
+    "matchMedium",
+    "matches",
+    "matrix",
+    "matrixTransform",
+    "max",
+    "max-block-size",
+    "max-height",
+    "max-inline-size",
+    "max-width",
+    "maxActions",
+    "maxAlternatives",
+    "maxBlockSize",
+    "maxChannelCount",
+    "maxChannels",
+    "maxConnectionsPerServer",
+    "maxDecibels",
+    "maxDistance",
+    "maxHeight",
+    "maxInlineSize",
+    "maxLayers",
+    "maxLength",
+    "maxMessageSize",
+    "maxPacketLifeTime",
+    "maxRetransmits",
+    "maxTouchPoints",
+    "maxValue",
+    "maxWidth",
+    "maxZoom",
+    "maximize",
+    "maximumFractionDigits",
+    "measure",
+    "measureText",
+    "media",
+    "mediaCapabilities",
+    "mediaDevices",
+    "mediaElement",
+    "mediaGroup",
+    "mediaKeys",
+    "mediaSession",
+    "mediaStream",
+    "mediaText",
+    "meetOrSlice",
+    "memory",
+    "menubar",
+    "mergeAttributes",
+    "message",
+    "messageClass",
+    "messageHandlers",
+    "messageType",
+    "metaKey",
+    "metadata",
+    "method",
+    "methodDetails",
+    "methodName",
+    "mid",
+    "mimeType",
+    "mimeTypes",
+    "min",
+    "min-block-size",
+    "min-height",
+    "min-inline-size",
+    "min-width",
+    "minBlockSize",
+    "minDecibels",
+    "minHeight",
+    "minInlineSize",
+    "minLength",
+    "minValue",
+    "minWidth",
+    "minZoom",
+    "minimize",
+    "minimumFractionDigits",
+    "minimumIntegerDigits",
+    "minute",
+    "miterLimit",
+    "mix-blend-mode",
+    "mixBlendMode",
+    "mm",
+    "mode",
+    "modify",
+    "month",
+    "motion",
+    "motionOffset",
+    "motionPath",
+    "motionRotation",
+    "mount",
+    "move",
+    "moveBy",
+    "moveEnd",
+    "moveFirst",
+    "moveFocusDown",
+    "moveFocusLeft",
+    "moveFocusRight",
+    "moveFocusUp",
+    "moveNext",
+    "moveRow",
+    "moveStart",
+    "moveTo",
+    "moveToBookmark",
+    "moveToElementText",
+    "moveToPoint",
+    "movementX",
+    "movementY",
+    "mozAdd",
+    "mozAnimationStartTime",
+    "mozAnon",
+    "mozApps",
+    "mozAudioCaptured",
+    "mozAudioChannelType",
+    "mozAutoplayEnabled",
+    "mozCancelAnimationFrame",
+    "mozCancelFullScreen",
+    "mozCancelRequestAnimationFrame",
+    "mozCaptureStream",
+    "mozCaptureStreamUntilEnded",
+    "mozClearDataAt",
+    "mozContact",
+    "mozContacts",
+    "mozCreateFileHandle",
+    "mozCurrentTransform",
+    "mozCurrentTransformInverse",
+    "mozCursor",
+    "mozDash",
+    "mozDashOffset",
+    "mozDecodedFrames",
+    "mozExitPointerLock",
+    "mozFillRule",
+    "mozFragmentEnd",
+    "mozFrameDelay",
+    "mozFullScreen",
+    "mozFullScreenElement",
+    "mozFullScreenEnabled",
+    "mozGetAll",
+    "mozGetAllKeys",
+    "mozGetAsFile",
+    "mozGetDataAt",
+    "mozGetMetadata",
+    "mozGetUserMedia",
+    "mozHasAudio",
+    "mozHasItem",
+    "mozHidden",
+    "mozImageSmoothingEnabled",
+    "mozIndexedDB",
+    "mozInnerScreenX",
+    "mozInnerScreenY",
+    "mozInputSource",
+    "mozIsTextField",
+    "mozItem",
+    "mozItemCount",
+    "mozItems",
+    "mozLength",
+    "mozLockOrientation",
+    "mozMatchesSelector",
+    "mozMovementX",
+    "mozMovementY",
+    "mozOpaque",
+    "mozOrientation",
+    "mozPaintCount",
+    "mozPaintedFrames",
+    "mozParsedFrames",
+    "mozPay",
+    "mozPointerLockElement",
+    "mozPresentedFrames",
+    "mozPreservesPitch",
+    "mozPressure",
+    "mozPrintCallback",
+    "mozRTCIceCandidate",
+    "mozRTCPeerConnection",
+    "mozRTCSessionDescription",
+    "mozRemove",
+    "mozRequestAnimationFrame",
+    "mozRequestFullScreen",
+    "mozRequestPointerLock",
+    "mozSetDataAt",
+    "mozSetImageElement",
+    "mozSourceNode",
+    "mozSrcObject",
+    "mozSystem",
+    "mozTCPSocket",
+    "mozTextStyle",
+    "mozTypesAt",
+    "mozUnlockOrientation",
+    "mozUserCancelled",
+    "mozVisibilityState",
+    "ms",
+    "msAnimation",
+    "msAnimationDelay",
+    "msAnimationDirection",
+    "msAnimationDuration",
+    "msAnimationFillMode",
+    "msAnimationIterationCount",
+    "msAnimationName",
+    "msAnimationPlayState",
+    "msAnimationStartTime",
+    "msAnimationTimingFunction",
+    "msBackfaceVisibility",
+    "msBlockProgression",
+    "msCSSOMElementFloatMetrics",
+    "msCaching",
+    "msCachingEnabled",
+    "msCancelRequestAnimationFrame",
+    "msCapsLockWarningOff",
+    "msClearImmediate",
+    "msClose",
+    "msContentZoomChaining",
+    "msContentZoomFactor",
+    "msContentZoomLimit",
+    "msContentZoomLimitMax",
+    "msContentZoomLimitMin",
+    "msContentZoomSnap",
+    "msContentZoomSnapPoints",
+    "msContentZoomSnapType",
+    "msContentZooming",
+    "msConvertURL",
+    "msCrypto",
+    "msDoNotTrack",
+    "msElementsFromPoint",
+    "msElementsFromRect",
+    "msExitFullscreen",
+    "msExtendedCode",
+    "msFillRule",
+    "msFirstPaint",
+    "msFlex",
+    "msFlexAlign",
+    "msFlexDirection",
+    "msFlexFlow",
+    "msFlexItemAlign",
+    "msFlexLinePack",
+    "msFlexNegative",
+    "msFlexOrder",
+    "msFlexPack",
+    "msFlexPositive",
+    "msFlexPreferredSize",
+    "msFlexWrap",
+    "msFlowFrom",
+    "msFlowInto",
+    "msFontFeatureSettings",
+    "msFullscreenElement",
+    "msFullscreenEnabled",
+    "msGetInputContext",
+    "msGetRegionContent",
+    "msGetUntransformedBounds",
+    "msGraphicsTrustStatus",
+    "msGridColumn",
+    "msGridColumnAlign",
+    "msGridColumnSpan",
+    "msGridColumns",
+    "msGridRow",
+    "msGridRowAlign",
+    "msGridRowSpan",
+    "msGridRows",
+    "msHidden",
+    "msHighContrastAdjust",
+    "msHyphenateLimitChars",
+    "msHyphenateLimitLines",
+    "msHyphenateLimitZone",
+    "msHyphens",
+    "msImageSmoothingEnabled",
+    "msImeAlign",
+    "msIndexedDB",
+    "msInterpolationMode",
+    "msIsStaticHTML",
+    "msKeySystem",
+    "msKeys",
+    "msLaunchUri",
+    "msLockOrientation",
+    "msManipulationViewsEnabled",
+    "msMatchMedia",
+    "msMatchesSelector",
+    "msMaxTouchPoints",
+    "msOrientation",
+    "msOverflowStyle",
+    "msPerspective",
+    "msPerspectiveOrigin",
+    "msPlayToDisabled",
+    "msPlayToPreferredSourceUri",
+    "msPlayToPrimary",
+    "msPointerEnabled",
+    "msRegionOverflow",
+    "msReleasePointerCapture",
+    "msRequestAnimationFrame",
+    "msRequestFullscreen",
+    "msSaveBlob",
+    "msSaveOrOpenBlob",
+    "msScrollChaining",
+    "msScrollLimit",
+    "msScrollLimitXMax",
+    "msScrollLimitXMin",
+    "msScrollLimitYMax",
+    "msScrollLimitYMin",
+    "msScrollRails",
+    "msScrollSnapPointsX",
+    "msScrollSnapPointsY",
+    "msScrollSnapType",
+    "msScrollSnapX",
+    "msScrollSnapY",
+    "msScrollTranslation",
+    "msSetImmediate",
+    "msSetMediaKeys",
+    "msSetPointerCapture",
+    "msTextCombineHorizontal",
+    "msTextSizeAdjust",
+    "msToBlob",
+    "msTouchAction",
+    "msTouchSelect",
+    "msTraceAsyncCallbackCompleted",
+    "msTraceAsyncCallbackStarting",
+    "msTraceAsyncOperationCompleted",
+    "msTraceAsyncOperationStarting",
+    "msTransform",
+    "msTransformOrigin",
+    "msTransformStyle",
+    "msTransition",
+    "msTransitionDelay",
+    "msTransitionDuration",
+    "msTransitionProperty",
+    "msTransitionTimingFunction",
+    "msUnlockOrientation",
+    "msUpdateAsyncCallbackRelation",
+    "msUserSelect",
+    "msVisibilityState",
+    "msWrapFlow",
+    "msWrapMargin",
+    "msWrapThrough",
+    "msWriteProfilerMark",
+    "msZoom",
+    "msZoomTo",
+    "mt",
+    "mul",
+    "multiEntry",
+    "multiSelectionObj",
+    "multiline",
+    "multiple",
+    "multiply",
+    "multiplySelf",
+    "mutableFile",
+    "muted",
+    "n",
+    "name",
+    "nameProp",
+    "namedItem",
+    "namedRecordset",
+    "names",
+    "namespaceURI",
+    "namespaces",
+    "naturalHeight",
+    "naturalWidth",
+    "navigate",
+    "navigation",
+    "navigationMode",
+    "navigationPreload",
+    "navigationStart",
+    "navigationType",
+    "navigator",
+    "near",
+    "nearestViewportElement",
+    "negative",
+    "negotiated",
+    "netscape",
+    "networkState",
+    "newScale",
+    "newTranslate",
+    "newURL",
+    "newValue",
+    "newValueSpecifiedUnits",
+    "newVersion",
+    "newhome",
+    "next",
+    "nextElementSibling",
+    "nextHopProtocol",
+    "nextNode",
+    "nextPage",
+    "nextSibling",
+    "nickname",
+    "noHref",
+    "noModule",
+    "noResize",
+    "noShade",
+    "noValidate",
+    "noWrap",
+    "node",
+    "nodeName",
+    "nodeType",
+    "nodeValue",
+    "nonce",
+    "normalize",
+    "normalizedPathSegList",
+    "notationName",
+    "notations",
+    "note",
+    "noteGrainOn",
+    "noteOff",
+    "noteOn",
+    "notify",
+    "now",
+    "npnNegotiatedProtocol",
+    "numOctaves",
+    "number",
+    "numberOfChannels",
+    "numberOfInputs",
+    "numberOfItems",
+    "numberOfOutputs",
+    "numberValue",
+    "numberingSystem",
+    "numeric",
+    "oMatchesSelector",
+    "object",
+    "object-fit",
+    "object-position",
+    "objectFit",
+    "objectPosition",
+    "objectStore",
+    "objectStoreNames",
+    "observe",
+    "observedAttributes",
+    "of",
+    "offscreenBuffering",
+    "offset",
+    "offset-anchor",
+    "offset-block-end",
+    "offset-block-start",
+    "offset-distance",
+    "offset-inline-end",
+    "offset-inline-start",
+    "offset-path",
+    "offset-rotate",
+    "offsetAnchor",
+    "offsetBlockEnd",
+    "offsetBlockStart",
+    "offsetDistance",
+    "offsetHeight",
+    "offsetInlineEnd",
+    "offsetInlineStart",
+    "offsetLeft",
+    "offsetNode",
+    "offsetParent",
+    "offsetPath",
+    "offsetRotate",
+    "offsetTop",
+    "offsetWidth",
+    "offsetX",
+    "offsetY",
+    "ok",
+    "oldURL",
+    "oldValue",
+    "oldVersion",
+    "olderShadowRoot",
+    "onDownloadProgress",
+    "onInstallStageChanged",
+    "onLine",
+    "onabort",
+    "onabsolutedeviceorientation",
+    "onactivate",
+    "onactive",
+    "onaddsourcebuffer",
+    "onaddstream",
+    "onaddtrack",
+    "onafterprint",
+    "onafterscriptexecute",
+    "onafterupdate",
+    "onanimationcancel",
+    "onanimationend",
+    "onanimationiteration",
+    "onanimationstart",
+    "onappinstalled",
+    "onaudioend",
+    "onaudioprocess",
+    "onaudiostart",
+    "onautocomplete",
+    "onautocompleteerror",
+    "onauxclick",
+    "onbeforeactivate",
+    "onbeforecopy",
+    "onbeforecut",
+    "onbeforedeactivate",
+    "onbeforeeditfocus",
+    "onbeforeinput",
+    "onbeforeinstallprompt",
+    "onbeforeload",
+    "onbeforepaste",
+    "onbeforeprint",
+    "onbeforescriptexecute",
+    "onbeforeunload",
+    "onbeforeupdate",
+    "onbeforexrselect",
+    "onbegin",
+    "onblocked",
+    "onblur",
+    "onbounce",
+    "onboundary",
+    "onbufferedamountlow",
+    "oncached",
+    "oncancel",
+    "oncandidatewindowhide",
+    "oncandidatewindowshow",
+    "oncandidatewindowupdate",
+    "oncanplay",
+    "oncanplaythrough",
+    "once",
+    "oncellchange",
+    "onchange",
+    "oncharacteristicvaluechanged",
+    "onchargingchange",
+    "onchargingtimechange",
+    "onchecking",
+    "onclick",
+    "onclose",
+    "onclosing",
+    "oncompassneedscalibration",
+    "oncomplete",
+    "onconnect",
+    "onconnecting",
+    "onconnectionavailable",
+    "onconnectionstatechange",
+    "oncontactchange",
+    "oncontextmenu",
+    "oncontrollerchange",
+    "oncontrolselect",
+    "oncopy",
+    "oncuechange",
+    "oncut",
+    "ondataavailable",
+    "ondatachannel",
+    "ondatasetchanged",
+    "ondatasetcomplete",
+    "ondblclick",
+    "ondeactivate",
+    "ondevicechange",
+    "ondevicelight",
+    "ondevicemotion",
+    "ondeviceorientation",
+    "ondeviceorientationabsolute",
+    "ondeviceproximity",
+    "ondischargingtimechange",
+    "ondisconnect",
+    "ondisplay",
+    "ondownloading",
+    "ondrag",
+    "ondragend",
+    "ondragenter",
+    "ondragexit",
+    "ondragleave",
+    "ondragover",
+    "ondragstart",
+    "ondrop",
+    "ondurationchange",
+    "onemptied",
+    "onencrypted",
+    "onend",
+    "onended",
+    "onenter",
+    "onenterpictureinpicture",
+    "onerror",
+    "onerrorupdate",
+    "onexit",
+    "onfilterchange",
+    "onfinish",
+    "onfocus",
+    "onfocusin",
+    "onfocusout",
+    "onformdata",
+    "onfreeze",
+    "onfullscreenchange",
+    "onfullscreenerror",
+    "ongatheringstatechange",
+    "ongattserverdisconnected",
+    "ongesturechange",
+    "ongestureend",
+    "ongesturestart",
+    "ongotpointercapture",
+    "onhashchange",
+    "onhelp",
+    "onicecandidate",
+    "onicecandidateerror",
+    "oniceconnectionstatechange",
+    "onicegatheringstatechange",
+    "oninactive",
+    "oninput",
+    "oninputsourceschange",
+    "oninvalid",
+    "onkeydown",
+    "onkeypress",
+    "onkeystatuseschange",
+    "onkeyup",
+    "onlanguagechange",
+    "onlayoutcomplete",
+    "onleavepictureinpicture",
+    "onlevelchange",
+    "onload",
+    "onloadT",
+    "onloadeddata",
+    "onloadedmetadata",
+    "onloadend",
+    "onloading",
+    "onloadingdone",
+    "onloadingerror",
+    "onloadstart",
+    "onlosecapture",
+    "onlostpointercapture",
+    "only",
+    "onmark",
+    "onmessage",
+    "onmessageerror",
+    "onmidimessage",
+    "onmousedown",
+    "onmouseenter",
+    "onmouseleave",
+    "onmousemove",
+    "onmouseout",
+    "onmouseover",
+    "onmouseup",
+    "onmousewheel",
+    "onmove",
+    "onmoveend",
+    "onmovestart",
+    "onmozfullscreenchange",
+    "onmozfullscreenerror",
+    "onmozorientationchange",
+    "onmozpointerlockchange",
+    "onmozpointerlockerror",
+    "onmscontentzoom",
+    "onmsfullscreenchange",
+    "onmsfullscreenerror",
+    "onmsgesturechange",
+    "onmsgesturedoubletap",
+    "onmsgestureend",
+    "onmsgesturehold",
+    "onmsgesturestart",
+    "onmsgesturetap",
+    "onmsgotpointercapture",
+    "onmsinertiastart",
+    "onmslostpointercapture",
+    "onmsmanipulationstatechanged",
+    "onmsneedkey",
+    "onmsorientationchange",
+    "onmspointercancel",
+    "onmspointerdown",
+    "onmspointerenter",
+    "onmspointerhover",
+    "onmspointerleave",
+    "onmspointermove",
+    "onmspointerout",
+    "onmspointerover",
+    "onmspointerup",
+    "onmssitemodejumplistitemremoved",
+    "onmsthumbnailclick",
+    "onmute",
+    "onnegotiationneeded",
+    "onnomatch",
+    "onnoupdate",
+    "onobsolete",
+    "onoffline",
+    "ononline",
+    "onopen",
+    "onorientationchange",
+    "onoverconstrained",
+    "onpage",
+    "onpagechange",
+    "onpagehide",
+    "onpageshow",
+    "onpaste",
+    "onpause",
+    "onpayerdetailchange",
+    "onpaymentmethodchange",
+    "onplay",
+    "onplaying",
+    "onpluginstreamstart",
+    "onpointercancel",
+    "onpointerdown",
+    "onpointerenter",
+    "onpointerleave",
+    "onpointerlockchange",
+    "onpointerlockerror",
+    "onpointermove",
+    "onpointerout",
+    "onpointerover",
+    "onpointerrawupdate",
+    "onpointerup",
+    "onpopstate",
+    "onprocessorerror",
+    "onprogress",
+    "onpropertychange",
+    "onratechange",
+    "onreading",
+    "onreadystatechange",
+    "onrejectionhandled",
+    "onrelease",
+    "onremove",
+    "onremovesourcebuffer",
+    "onremovestream",
+    "onremovetrack",
+    "onrepeat",
+    "onreset",
+    "onresize",
+    "onresizeend",
+    "onresizestart",
+    "onresourcetimingbufferfull",
+    "onresult",
+    "onresume",
+    "onrowenter",
+    "onrowexit",
+    "onrowsdelete",
+    "onrowsinserted",
+    "onscroll",
+    "onsearch",
+    "onsecuritypolicyviolation",
+    "onseeked",
+    "onseeking",
+    "onselect",
+    "onselectedcandidatepairchange",
+    "onselectend",
+    "onselectionchange",
+    "onselectstart",
+    "onshippingaddresschange",
+    "onshippingoptionchange",
+    "onshow",
+    "onsignalingstatechange",
+    "onsoundend",
+    "onsoundstart",
+    "onsourceclose",
+    "onsourceclosed",
+    "onsourceended",
+    "onsourceopen",
+    "onspeechend",
+    "onspeechstart",
+    "onsqueeze",
+    "onsqueezeend",
+    "onsqueezestart",
+    "onstalled",
+    "onstart",
+    "onstatechange",
+    "onstop",
+    "onstorage",
+    "onstoragecommit",
+    "onsubmit",
+    "onsuccess",
+    "onsuspend",
+    "onterminate",
+    "ontextinput",
+    "ontimeout",
+    "ontimeupdate",
+    "ontoggle",
+    "ontonechange",
+    "ontouchcancel",
+    "ontouchend",
+    "ontouchmove",
+    "ontouchstart",
+    "ontrack",
+    "ontransitioncancel",
+    "ontransitionend",
+    "ontransitionrun",
+    "ontransitionstart",
+    "onunhandledrejection",
+    "onunload",
+    "onunmute",
+    "onupdate",
+    "onupdateend",
+    "onupdatefound",
+    "onupdateready",
+    "onupdatestart",
+    "onupgradeneeded",
+    "onuserproximity",
+    "onversionchange",
+    "onvisibilitychange",
+    "onvoiceschanged",
+    "onvolumechange",
+    "onvrdisplayactivate",
+    "onvrdisplayconnect",
+    "onvrdisplaydeactivate",
+    "onvrdisplaydisconnect",
+    "onvrdisplaypresentchange",
+    "onwaiting",
+    "onwaitingforkey",
+    "onwarning",
+    "onwebkitanimationend",
+    "onwebkitanimationiteration",
+    "onwebkitanimationstart",
+    "onwebkitcurrentplaybacktargetiswirelesschanged",
+    "onwebkitfullscreenchange",
+    "onwebkitfullscreenerror",
+    "onwebkitkeyadded",
+    "onwebkitkeyerror",
+    "onwebkitkeymessage",
+    "onwebkitmouseforcechanged",
+    "onwebkitmouseforcedown",
+    "onwebkitmouseforceup",
+    "onwebkitmouseforcewillbegin",
+    "onwebkitneedkey",
+    "onwebkitorientationchange",
+    "onwebkitplaybacktargetavailabilitychanged",
+    "onwebkitpointerlockchange",
+    "onwebkitpointerlockerror",
+    "onwebkitresourcetimingbufferfull",
+    "onwebkittransitionend",
+    "onwheel",
+    "onzoom",
+    "opacity",
+    "open",
+    "openCursor",
+    "openDatabase",
+    "openKeyCursor",
+    "opened",
+    "opener",
+    "opera",
+    "operationType",
+    "operator",
+    "opr",
+    "opsProfile",
+    "optimum",
+    "options",
+    "or",
+    "order",
+    "orderX",
+    "orderY",
+    "ordered",
+    "org",
+    "organization",
+    "orient",
+    "orientAngle",
+    "orientType",
+    "orientation",
+    "orientationX",
+    "orientationY",
+    "orientationZ",
+    "origin",
+    "originalPolicy",
+    "originalTarget",
+    "orphans",
+    "oscpu",
+    "outcome",
+    "outerHTML",
+    "outerHeight",
+    "outerText",
+    "outerWidth",
+    "outline",
+    "outline-color",
+    "outline-offset",
+    "outline-style",
+    "outline-width",
+    "outlineColor",
+    "outlineOffset",
+    "outlineStyle",
+    "outlineWidth",
+    "outputBuffer",
+    "outputLatency",
+    "outputs",
+    "overflow",
+    "overflow-anchor",
+    "overflow-block",
+    "overflow-inline",
+    "overflow-wrap",
+    "overflow-x",
+    "overflow-y",
+    "overflowAnchor",
+    "overflowBlock",
+    "overflowInline",
+    "overflowWrap",
+    "overflowX",
+    "overflowY",
+    "overrideMimeType",
+    "oversample",
+    "overscroll-behavior",
+    "overscroll-behavior-block",
+    "overscroll-behavior-inline",
+    "overscroll-behavior-x",
+    "overscroll-behavior-y",
+    "overscrollBehavior",
+    "overscrollBehaviorBlock",
+    "overscrollBehaviorInline",
+    "overscrollBehaviorX",
+    "overscrollBehaviorY",
+    "ownKeys",
+    "ownerDocument",
+    "ownerElement",
+    "ownerNode",
+    "ownerRule",
+    "ownerSVGElement",
+    "owningElement",
+    "p1",
+    "p2",
+    "p3",
+    "p4",
+    "packetSize",
+    "packets",
+    "pad",
+    "padEnd",
+    "padStart",
+    "padding",
+    "padding-block",
+    "padding-block-end",
+    "padding-block-start",
+    "padding-bottom",
+    "padding-inline",
+    "padding-inline-end",
+    "padding-inline-start",
+    "padding-left",
+    "padding-right",
+    "padding-top",
+    "paddingBlock",
+    "paddingBlockEnd",
+    "paddingBlockStart",
+    "paddingBottom",
+    "paddingInline",
+    "paddingInlineEnd",
+    "paddingInlineStart",
+    "paddingLeft",
+    "paddingRight",
+    "paddingTop",
+    "page",
+    "page-break-after",
+    "page-break-before",
+    "page-break-inside",
+    "pageBreakAfter",
+    "pageBreakBefore",
+    "pageBreakInside",
+    "pageCount",
+    "pageLeft",
+    "pageT",
+    "pageTop",
+    "pageX",
+    "pageXOffset",
+    "pageY",
+    "pageYOffset",
+    "pages",
+    "paint-order",
+    "paintOrder",
+    "paintRequests",
+    "paintType",
+    "paintWorklet",
+    "palette",
+    "pan",
+    "panningModel",
+    "parameters",
+    "parent",
+    "parentElement",
+    "parentNode",
+    "parentRule",
+    "parentStyleSheet",
+    "parentTextEdit",
+    "parentWindow",
+    "parse",
+    "parseAll",
+    "parseFloat",
+    "parseFromString",
+    "parseInt",
+    "part",
+    "participants",
+    "passive",
+    "password",
+    "pasteHTML",
+    "path",
+    "pathLength",
+    "pathSegList",
+    "pathSegType",
+    "pathSegTypeAsLetter",
+    "pathname",
+    "pattern",
+    "patternContentUnits",
+    "patternMismatch",
+    "patternTransform",
+    "patternUnits",
+    "pause",
+    "pauseAnimations",
+    "pauseOnExit",
+    "pauseTransformFeedback",
+    "paused",
+    "payerEmail",
+    "payerName",
+    "payerPhone",
+    "paymentManager",
+    "pc",
+    "peerIdentity",
+    "pending",
+    "pendingLocalDescription",
+    "pendingRemoteDescription",
+    "percent",
+    "performance",
+    "periodicSync",
+    "permission",
+    "permissionState",
+    "permissions",
+    "persist",
+    "persisted",
+    "personalbar",
+    "perspective",
+    "perspective-origin",
+    "perspectiveOrigin",
+    "perspectiveOriginX",
+    "perspectiveOriginY",
+    "phone",
+    "phoneticFamilyName",
+    "phoneticGivenName",
+    "photo",
+    "pictureInPictureElement",
+    "pictureInPictureEnabled",
+    "pictureInPictureWindow",
+    "ping",
+    "pipeThrough",
+    "pipeTo",
+    "pitch",
+    "pixelBottom",
+    "pixelDepth",
+    "pixelHeight",
+    "pixelLeft",
+    "pixelRight",
+    "pixelStorei",
+    "pixelTop",
+    "pixelUnitToMillimeterX",
+    "pixelUnitToMillimeterY",
+    "pixelWidth",
+    "place-content",
+    "place-items",
+    "place-self",
+    "placeContent",
+    "placeItems",
+    "placeSelf",
+    "placeholder",
+    "platform",
+    "platforms",
+    "play",
+    "playEffect",
+    "playState",
+    "playbackRate",
+    "playbackState",
+    "playbackTime",
+    "played",
+    "playoutDelayHint",
+    "playsInline",
+    "plugins",
+    "pluginspage",
+    "pname",
+    "pointer-events",
+    "pointerBeforeReferenceNode",
+    "pointerEnabled",
+    "pointerEvents",
+    "pointerId",
+    "pointerLockElement",
+    "pointerType",
+    "points",
+    "pointsAtX",
+    "pointsAtY",
+    "pointsAtZ",
+    "polygonOffset",
+    "pop",
+    "populateMatrix",
+    "popupWindowFeatures",
+    "popupWindowName",
+    "popupWindowURI",
+    "port",
+    "port1",
+    "port2",
+    "ports",
+    "posBottom",
+    "posHeight",
+    "posLeft",
+    "posRight",
+    "posTop",
+    "posWidth",
+    "pose",
+    "position",
+    "positionAlign",
+    "positionX",
+    "positionY",
+    "positionZ",
+    "postError",
+    "postMessage",
+    "postalCode",
+    "poster",
+    "pow",
+    "powerEfficient",
+    "powerOff",
+    "preMultiplySelf",
+    "precision",
+    "preferredStyleSheetSet",
+    "preferredStylesheetSet",
+    "prefix",
+    "preload",
+    "prepend",
+    "presentation",
+    "preserveAlpha",
+    "preserveAspectRatio",
+    "preserveAspectRatioString",
+    "pressed",
+    "pressure",
+    "prevValue",
+    "preventDefault",
+    "preventExtensions",
+    "preventSilentAccess",
+    "previousElementSibling",
+    "previousNode",
+    "previousPage",
+    "previousRect",
+    "previousScale",
+    "previousSibling",
+    "previousTranslate",
+    "primaryKey",
+    "primitiveType",
+    "primitiveUnits",
+    "principals",
+    "print",
+    "priority",
+    "privateKey",
+    "probablySupportsContext",
+    "process",
+    "processIceMessage",
+    "processingEnd",
+    "processingStart",
+    "product",
+    "productId",
+    "productName",
+    "productSub",
+    "profile",
+    "profileEnd",
+    "profiles",
+    "projectionMatrix",
+    "promise",
+    "prompt",
+    "properties",
+    "propertyIsEnumerable",
+    "propertyName",
+    "protocol",
+    "protocolLong",
+    "prototype",
+    "provider",
+    "pseudoClass",
+    "pseudoElement",
+    "pt",
+    "publicId",
+    "publicKey",
+    "published",
+    "pulse",
+    "push",
+    "pushManager",
+    "pushNotification",
+    "pushState",
+    "put",
+    "putImageData",
+    "px",
+    "quadraticCurveTo",
+    "qualifier",
+    "quaternion",
+    "query",
+    "queryCommandEnabled",
+    "queryCommandIndeterm",
+    "queryCommandState",
+    "queryCommandSupported",
+    "queryCommandText",
+    "queryCommandValue",
+    "querySelector",
+    "querySelectorAll",
+    "queryUsageAndQuota",
+    "queueMicrotask",
+    "quote",
+    "quotes",
+    "r",
+    "r1",
+    "r2",
+    "race",
+    "rad",
+    "radiogroup",
+    "radiusX",
+    "radiusY",
+    "random",
+    "range",
+    "rangeCount",
+    "rangeMax",
+    "rangeMin",
+    "rangeOffset",
+    "rangeOverflow",
+    "rangeParent",
+    "rangeUnderflow",
+    "rate",
+    "ratio",
+    "raw",
+    "rawId",
+    "read",
+    "readAsArrayBuffer",
+    "readAsBinaryString",
+    "readAsBlob",
+    "readAsDataURL",
+    "readAsText",
+    "readBuffer",
+    "readEntries",
+    "readOnly",
+    "readPixels",
+    "readReportRequested",
+    "readText",
+    "readTransaction",
+    "readValue",
+    "readable",
+    "ready",
+    "readyState",
+    "reason",
+    "reboot",
+    "receivedAlert",
+    "receivedTime",
+    "receiver",
+    "receivers",
+    "recipient",
+    "reconnect",
+    "record",
+    "recordEnd",
+    "recordNumber",
+    "recordsAvailable",
+    "recordset",
+    "rect",
+    "red",
+    "redEyeReduction",
+    "redirect",
+    "redirectCount",
+    "redirectEnd",
+    "redirectStart",
+    "redirected",
+    "reduce",
+    "reduceRight",
+    "reduction",
+    "refDistance",
+    "refX",
+    "refY",
+    "referenceNode",
+    "referenceSpace",
+    "referrer",
+    "referrerPolicy",
+    "refresh",
+    "region",
+    "regionAnchorX",
+    "regionAnchorY",
+    "regionId",
+    "regions",
+    "register",
+    "registerContentHandler",
+    "registerElement",
+    "registerProperty",
+    "registerProtocolHandler",
+    "reject",
+    "rel",
+    "relList",
+    "relatedAddress",
+    "relatedNode",
+    "relatedPort",
+    "relatedTarget",
+    "release",
+    "releaseCapture",
+    "releaseEvents",
+    "releaseInterface",
+    "releaseLock",
+    "releasePointerCapture",
+    "releaseShaderCompiler",
+    "reliable",
+    "reliableWrite",
+    "reload",
+    "rem",
+    "remainingSpace",
+    "remote",
+    "remoteDescription",
+    "remove",
+    "removeAllRanges",
+    "removeAttribute",
+    "removeAttributeNS",
+    "removeAttributeNode",
+    "removeBehavior",
+    "removeChild",
+    "removeCue",
+    "removeEventListener",
+    "removeFilter",
+    "removeImport",
+    "removeItem",
+    "removeListener",
+    "removeNamedItem",
+    "removeNamedItemNS",
+    "removeNode",
+    "removeParameter",
+    "removeProperty",
+    "removeRange",
+    "removeRegion",
+    "removeRule",
+    "removeRules",
+    "removeSiteSpecificTrackingException",
+    "removeSourceBuffer",
+    "removeStream",
+    "removeTrack",
+    "removeVariable",
+    "removeWakeLockListener",
+    "removeWebWideTrackingException",
+    "removed",
+    "removedNodes",
+    "renderHeight",
+    "renderState",
+    "renderTime",
+    "renderWidth",
+    "renderbufferStorage",
+    "renderbufferStorageMultisample",
+    "renderedBuffer",
+    "renderingMode",
+    "renotify",
+    "repeat",
+    "replace",
+    "replaceAdjacentText",
+    "replaceAll",
+    "replaceChild",
+    "replaceChildren",
+    "replaceData",
+    "replaceId",
+    "replaceItem",
+    "replaceNode",
+    "replaceState",
+    "replaceSync",
+    "replaceTrack",
+    "replaceWholeText",
+    "replaceWith",
+    "reportValidity",
+    "request",
+    "requestAnimationFrame",
+    "requestAutocomplete",
+    "requestData",
+    "requestDevice",
+    "requestFrame",
+    "requestFullscreen",
+    "requestHitTestSource",
+    "requestHitTestSourceForTransientInput",
+    "requestId",
+    "requestIdleCallback",
+    "requestMIDIAccess",
+    "requestMediaKeySystemAccess",
+    "requestPermission",
+    "requestPictureInPicture",
+    "requestPointerLock",
+    "requestPresent",
+    "requestQuota",
+    "requestReferenceSpace",
+    "requestSession",
+    "requestStart",
+    "requestStorageAccess",
+    "requestSubmit",
+    "requestTime",
+    "requestVideoFrameCallback",
+    "requestedLocale",
+    "requestingWindow",
+    "requireInteraction",
+    "required",
+    "requiredExtensions",
+    "requiredFeatures",
+    "reset",
+    "resetPose",
+    "resetTransform",
+    "resize",
+    "resizeBy",
+    "resizeTo",
+    "resolve",
+    "resolved",
+    "resolvedOptions",
+    "resource-history",
+    "resourcesFramesExpanded",
+    "response",
+    "responseBody",
+    "responseEnd",
+    "responseReady",
+    "responseStart",
+    "responseText",
+    "responseType",
+    "responseURL",
+    "responseXML",
+    "restartIce",
+    "restore",
+    "result",
+    "resultIndex",
+    "resultType",
+    "results",
+    "resume",
+    "resumeTransformFeedback",
+    "retry",
+    "returnValue",
+    "rev",
+    "reverse",
+    "reversed",
+    "revocable",
+    "revokeObjectURL",
+    "rgbColor",
+    "right",
+    "rightContext",
+    "rightDegrees",
+    "rightMargin",
+    "rightProjectionMatrix",
+    "rightViewMatrix",
+    "role",
+    "rolloffFactor",
+    "root",
+    "rootBounds",
+    "rootElement",
+    "rootMargin",
+    "rotate",
+    "rotateAxisAngle",
+    "rotateAxisAngleSelf",
+    "rotateFromVector",
+    "rotateFromVectorSelf",
+    "rotateSelf",
+    "rotation",
+    "rotationAngle",
+    "rotationRate",
+    "round",
+    "row-gap",
+    "rowGap",
+    "rowIndex",
+    "rowSpan",
+    "rows",
+    "rowsAffected",
+    "rtcpTransport",
+    "rtt",
+    "ruby-align",
+    "ruby-position",
+    "rubyAlign",
+    "rubyOverhang",
+    "rubyPosition",
+    "rules",
+    "runningState",
+    "runtime",
+    "runtimeStyle",
+    "rx",
+    "ry",
+    "s",
+    "safari",
+    "sample",
+    "sampleCoverage",
+    "sampleRate",
+    "samplerParameterf",
+    "samplerParameteri",
+    "sandbox",
+    "save",
+    "saveData",
+    "scale",
+    "scale3d",
+    "scale3dSelf",
+    "scaleNonUniform",
+    "scaleNonUniformSelf",
+    "scaleSelf",
+    "scheme",
+    "scissor",
+    "scope",
+    "scopeName",
+    "scoped",
+    "screen",
+    "screenBrightness",
+    "screenEnabled",
+    "screenLeft",
+    "screenPixelToMillimeterX",
+    "screenPixelToMillimeterY",
+    "screenTop",
+    "screenX",
+    "screenY",
+    "script",
+    "scriptURL",
+    "scripts",
+    "scroll",
+    "scroll-behavior",
+    "scroll-margin",
+    "scroll-margin-block",
+    "scroll-margin-block-end",
+    "scroll-margin-block-start",
+    "scroll-margin-bottom",
+    "scroll-margin-inline",
+    "scroll-margin-inline-end",
+    "scroll-margin-inline-start",
+    "scroll-margin-left",
+    "scroll-margin-right",
+    "scroll-margin-top",
+    "scroll-padding",
+    "scroll-padding-block",
+    "scroll-padding-block-end",
+    "scroll-padding-block-start",
+    "scroll-padding-bottom",
+    "scroll-padding-inline",
+    "scroll-padding-inline-end",
+    "scroll-padding-inline-start",
+    "scroll-padding-left",
+    "scroll-padding-right",
+    "scroll-padding-top",
+    "scroll-snap-align",
+    "scroll-snap-coordinate",
+    "scroll-snap-destination",
+    "scroll-snap-points-x",
+    "scroll-snap-points-y",
+    "scroll-snap-type",
+    "scroll-snap-type-x",
+    "scroll-snap-type-y",
+    "scrollAmount",
+    "scrollBehavior",
+    "scrollBy",
+    "scrollByLines",
+    "scrollByPages",
+    "scrollDelay",
+    "scrollHeight",
+    "scrollIntoView",
+    "scrollIntoViewIfNeeded",
+    "scrollLeft",
+    "scrollLeftMax",
+    "scrollMargin",
+    "scrollMarginBlock",
+    "scrollMarginBlockEnd",
+    "scrollMarginBlockStart",
+    "scrollMarginBottom",
+    "scrollMarginInline",
+    "scrollMarginInlineEnd",
+    "scrollMarginInlineStart",
+    "scrollMarginLeft",
+    "scrollMarginRight",
+    "scrollMarginTop",
+    "scrollMaxX",
+    "scrollMaxY",
+    "scrollPadding",
+    "scrollPaddingBlock",
+    "scrollPaddingBlockEnd",
+    "scrollPaddingBlockStart",
+    "scrollPaddingBottom",
+    "scrollPaddingInline",
+    "scrollPaddingInlineEnd",
+    "scrollPaddingInlineStart",
+    "scrollPaddingLeft",
+    "scrollPaddingRight",
+    "scrollPaddingTop",
+    "scrollRestoration",
+    "scrollSnapAlign",
+    "scrollSnapCoordinate",
+    "scrollSnapDestination",
+    "scrollSnapMargin",
+    "scrollSnapMarginBottom",
+    "scrollSnapMarginLeft",
+    "scrollSnapMarginRight",
+    "scrollSnapMarginTop",
+    "scrollSnapPointsX",
+    "scrollSnapPointsY",
+    "scrollSnapStop",
+    "scrollSnapType",
+    "scrollSnapTypeX",
+    "scrollSnapTypeY",
+    "scrollTo",
+    "scrollTop",
+    "scrollTopMax",
+    "scrollWidth",
+    "scrollX",
+    "scrollY",
+    "scrollbar-color",
+    "scrollbar-width",
+    "scrollbar3dLightColor",
+    "scrollbarArrowColor",
+    "scrollbarBaseColor",
+    "scrollbarColor",
+    "scrollbarDarkShadowColor",
+    "scrollbarFaceColor",
+    "scrollbarHighlightColor",
+    "scrollbarShadowColor",
+    "scrollbarTrackColor",
+    "scrollbarWidth",
+    "scrollbars",
+    "scrolling",
+    "scrollingElement",
+    "sctp",
+    "sctpCauseCode",
+    "sdp",
+    "sdpLineNumber",
+    "sdpMLineIndex",
+    "sdpMid",
+    "seal",
+    "search",
+    "searchBox",
+    "searchBoxJavaBridge_",
+    "searchParams",
+    "second",
+    "sectionRowIndex",
+    "secureConnectionStart",
+    "security",
+    "seed",
+    "seekToNextFrame",
+    "seekable",
+    "seeking",
+    "select",
+    "selectAllChildren",
+    "selectAlternateInterface",
+    "selectConfiguration",
+    "selectNode",
+    "selectNodeContents",
+    "selectNodes",
+    "selectSingleNode",
+    "selectSubString",
+    "selected",
+    "selectedIndex",
+    "selectedOption",
+    "selectedOptions",
+    "selectedStyleSheetSet",
+    "selectedStylesheetSet",
+    "selection",
+    "selectionDirection",
+    "selectionEnd",
+    "selectionStart",
+    "selector",
+    "selectorText",
+    "self",
+    "send",
+    "sendAsBinary",
+    "sendBeacon",
+    "sendMessage",
+    "sender",
+    "sensitivity",
+    "sentAlert",
+    "sentTimestamp",
+    "separator",
+    "serialNumber",
+    "serializeToString",
+    "serverTiming",
+    "service",
+    "serviceWorker",
+    "session",
+    "sessionId",
+    "sessionStorage",
+    "set",
+    "setActionHandler",
+    "setActive",
+    "setAlpha",
+    "setAppBadge",
+    "setAttribute",
+    "setAttributeNS",
+    "setAttributeNode",
+    "setAttributeNodeNS",
+    "setBaseAndExtent",
+    "setBigInt64",
+    "setBigUint64",
+    "setBingCurrentSearchDefault",
+    "setCapture",
+    "setCodecPreferences",
+    "setColor",
+    "setCompositeOperation",
+    "setConfiguration",
+    "setCurrentTime",
+    "setCustomValidity",
+    "setData",
+    "setDate",
+    "setDirection",
+    "setDragImage",
+    "setEnd",
+    "setEndAfter",
+    "setEndBefore",
+    "setEndPoint",
+    "setFillColor",
+    "setFilterRes",
+    "setFloat32",
+    "setFloat64",
+    "setFloatValue",
+    "setFormValue",
+    "setFullYear",
+    "setHeaderValue",
+    "setHours",
+    "setIdentityProvider",
+    "setImmediate",
+    "setInt16",
+    "setInt32",
+    "setInt8",
+    "setInterval",
+    "setItem",
+    "setKeyframes",
+    "setLineCap",
+    "setLineDash",
+    "setLineJoin",
+    "setLineWidth",
+    "setLiveSeekableRange",
+    "setLocalDescription",
+    "setMatrix",
+    "setMatrixValue",
+    "setMediaKeys",
+    "setMilliseconds",
+    "setMinutes",
+    "setMiterLimit",
+    "setMonth",
+    "setNamedItem",
+    "setNamedItemNS",
+    "setNonUserCodeExceptions",
+    "setOrientToAngle",
+    "setOrientToAuto",
+    "setOrientation",
+    "setOverrideHistoryNavigationMode",
+    "setPaint",
+    "setParameter",
+    "setParameters",
+    "setPeriodicWave",
+    "setPointerCapture",
+    "setPosition",
+    "setPositionState",
+    "setPreference",
+    "setProperty",
+    "setPrototypeOf",
+    "setRGBColor",
+    "setRGBColorICCColor",
+    "setRadius",
+    "setRangeText",
+    "setRemoteDescription",
+    "setRequestHeader",
+    "setResizable",
+    "setResourceTimingBufferSize",
+    "setRotate",
+    "setScale",
+    "setSeconds",
+    "setSelectionRange",
+    "setServerCertificate",
+    "setShadow",
+    "setSinkId",
+    "setSkewX",
+    "setSkewY",
+    "setStart",
+    "setStartAfter",
+    "setStartBefore",
+    "setStdDeviation",
+    "setStreams",
+    "setStringValue",
+    "setStrokeColor",
+    "setSuggestResult",
+    "setTargetAtTime",
+    "setTargetValueAtTime",
+    "setTime",
+    "setTimeout",
+    "setTransform",
+    "setTranslate",
+    "setUTCDate",
+    "setUTCFullYear",
+    "setUTCHours",
+    "setUTCMilliseconds",
+    "setUTCMinutes",
+    "setUTCMonth",
+    "setUTCSeconds",
+    "setUint16",
+    "setUint32",
+    "setUint8",
+    "setUri",
+    "setValidity",
+    "setValueAtTime",
+    "setValueCurveAtTime",
+    "setVariable",
+    "setVelocity",
+    "setVersion",
+    "setYear",
+    "settingName",
+    "settingValue",
+    "sex",
+    "shaderSource",
+    "shadowBlur",
+    "shadowColor",
+    "shadowOffsetX",
+    "shadowOffsetY",
+    "shadowRoot",
+    "shape",
+    "shape-image-threshold",
+    "shape-margin",
+    "shape-outside",
+    "shape-rendering",
+    "shapeImageThreshold",
+    "shapeMargin",
+    "shapeOutside",
+    "shapeRendering",
+    "sheet",
+    "shift",
+    "shiftKey",
+    "shiftLeft",
+    "shippingAddress",
+    "shippingOption",
+    "shippingType",
+    "show",
+    "showHelp",
+    "showModal",
+    "showModalDialog",
+    "showModelessDialog",
+    "showNotification",
+    "sidebar",
+    "sign",
+    "signal",
+    "signalingState",
+    "signature",
+    "silent",
+    "sin",
+    "singleNodeValue",
+    "sinh",
+    "sinkId",
+    "sittingToStandingTransform",
+    "size",
+    "sizeToContent",
+    "sizeX",
+    "sizeZ",
+    "sizes",
+    "skewX",
+    "skewXSelf",
+    "skewY",
+    "skewYSelf",
+    "slice",
+    "slope",
+    "slot",
+    "small",
+    "smil",
+    "smooth",
+    "smoothingTimeConstant",
+    "snapToLines",
+    "snapshotItem",
+    "snapshotLength",
+    "some",
+    "sort",
+    "sortingCode",
+    "source",
+    "sourceBuffer",
+    "sourceBuffers",
+    "sourceCapabilities",
+    "sourceFile",
+    "sourceIndex",
+    "sourceURL",
+    "sources",
+    "spacing",
+    "span",
+    "speak",
+    "speakAs",
+    "speaking",
+    "species",
+    "specified",
+    "specularConstant",
+    "specularExponent",
+    "speechSynthesis",
+    "speed",
+    "speedOfSound",
+    "spellcheck",
+    "splice",
+    "split",
+    "splitText",
+    "spreadMethod",
+    "sqrt",
+    "src",
+    "srcElement",
+    "srcFilter",
+    "srcObject",
+    "srcUrn",
+    "srcdoc",
+    "srclang",
+    "srcset",
+    "stack",
+    "stackTraceLimit",
+    "stacktrace",
+    "stageParameters",
+    "standalone",
+    "standby",
+    "start",
+    "startContainer",
+    "startE",
+    "startIce",
+    "startLoadTime",
+    "startMessages",
+    "startNotifications",
+    "startOffset",
+    "startRendering",
+    "startSoftwareUpdate",
+    "startTime",
+    "startsWith",
+    "state",
+    "status",
+    "statusCode",
+    "statusMessage",
+    "statusText",
+    "statusbar",
+    "stdDeviationX",
+    "stdDeviationY",
+    "stencilFunc",
+    "stencilFuncSeparate",
+    "stencilMask",
+    "stencilMaskSeparate",
+    "stencilOp",
+    "stencilOpSeparate",
+    "step",
+    "stepDown",
+    "stepMismatch",
+    "stepUp",
+    "sticky",
+    "stitchTiles",
+    "stop",
+    "stop-color",
+    "stop-opacity",
+    "stopColor",
+    "stopImmediatePropagation",
+    "stopNotifications",
+    "stopOpacity",
+    "stopPropagation",
+    "stopped",
+    "storage",
+    "storageArea",
+    "storageName",
+    "storageStatus",
+    "store",
+    "storeSiteSpecificTrackingException",
+    "storeWebWideTrackingException",
+    "stpVersion",
+    "stream",
+    "streams",
+    "strength",
+    "stretch",
+    "strike",
+    "stringValue",
+    "stringify",
+    "stroke",
+    "stroke-dasharray",
+    "stroke-dashoffset",
+    "stroke-linecap",
+    "stroke-linejoin",
+    "stroke-miterlimit",
+    "stroke-opacity",
+    "stroke-width",
+    "strokeColor",
+    "strokeDasharray",
+    "strokeDashoffset",
+    "strokeLinecap",
+    "strokeLinejoin",
+    "strokeMiterlimit",
+    "strokeOpacity",
+    "strokeRect",
+    "strokeStyle",
+    "strokeText",
+    "strokeWidth",
+    "style",
+    "styleFloat",
+    "styleMap",
+    "styleMedia",
+    "styleSheet",
+    "styleSheetSets",
+    "styleSheets",
+    "sub",
+    "subarray",
+    "subject",
+    "submit",
+    "submitFrame",
+    "submitter",
+    "subscribe",
+    "substr",
+    "substring",
+    "substringData",
+    "subtle",
+    "subtree",
+    "suffix",
+    "suffixes",
+    "summary",
+    "sup",
+    "supported",
+    "supportedContentEncodings",
+    "supportedEntryTypes",
+    "supportedLocalesOf",
+    "supports",
+    "supportsSession",
+    "surfaceScale",
+    "surroundContents",
+    "suspend",
+    "suspendRedraw",
+    "swapCache",
+    "swapNode",
+    "sweepFlag",
+    "symbols",
+    "sync",
+    "sysexEnabled",
+    "system",
+    "systemCode",
+    "systemId",
+    "systemLanguage",
+    "systemXDPI",
+    "systemYDPI",
+    "tBodies",
+    "tFoot",
+    "tHead",
+    "tabIndex",
+    "tabSize",
+    "table",
+    "table-layout",
+    "tableLayout",
+    "tableValues",
+    "tag",
+    "tagName",
+    "tagUrn",
+    "tags",
+    "taintEnabled",
+    "takeHeapSnapshot",
+    "takePhoto",
+    "takeRecords",
+    "tan",
+    "tangentialPressure",
+    "tanh",
+    "target",
+    "targetElement",
+    "targetRayMode",
+    "targetRaySpace",
+    "targetTouches",
+    "targetX",
+    "targetY",
+    "tcpType",
+    "tee",
+    "tel",
+    "terminate",
+    "test",
+    "texImage2D",
+    "texImage3D",
+    "texParameterf",
+    "texParameteri",
+    "texStorage2D",
+    "texStorage3D",
+    "texSubImage2D",
+    "texSubImage3D",
+    "text",
+    "text-align",
+    "text-align-last",
+    "text-anchor",
+    "text-combine-upright",
+    "text-decoration",
+    "text-decoration-color",
+    "text-decoration-line",
+    "text-decoration-skip-ink",
+    "text-decoration-style",
+    "text-decoration-thickness",
+    "text-emphasis",
+    "text-emphasis-color",
+    "text-emphasis-position",
+    "text-emphasis-style",
+    "text-indent",
+    "text-justify",
+    "text-orientation",
+    "text-overflow",
+    "text-rendering",
+    "text-shadow",
+    "text-transform",
+    "text-underline-offset",
+    "text-underline-position",
+    "text/pdf",
+    "textAlign",
+    "textAlignLast",
+    "textAnchor",
+    "textAutospace",
+    "textBaseline",
+    "textCombineUpright",
+    "textContent",
+    "textDecoration",
+    "textDecorationBlink",
+    "textDecorationColor",
+    "textDecorationLine",
+    "textDecorationLineThrough",
+    "textDecorationNone",
+    "textDecorationOverline",
+    "textDecorationSkipInk",
+    "textDecorationStyle",
+    "textDecorationThickness",
+    "textDecorationUnderline",
+    "textEmphasis",
+    "textEmphasisColor",
+    "textEmphasisPosition",
+    "textEmphasisStyle",
+    "textIndent",
+    "textJustify",
+    "textJustifyTrim",
+    "textKashida",
+    "textKashidaSpace",
+    "textLength",
+    "textOrientation",
+    "textOverflow",
+    "textRendering",
+    "textShadow",
+    "textSizeAdjust",
+    "textTracks",
+    "textTransform",
+    "textUnderlineOffset",
+    "textUnderlinePosition",
+    "then",
+    "threadId",
+    "threshold",
+    "thresholds",
+    "tiltX",
+    "tiltY",
+    "time",
+    "timeEnd",
+    "timeLog",
+    "timeOrigin",
+    "timeRemaining",
+    "timeStamp",
+    "timeZone",
+    "timeZoneName",
+    "timecode",
+    "timeline",
+    "timelineEnd",
+    "timelineTime",
+    "timeout",
+    "timestamp",
+    "timestampOffset",
+    "timing",
+    "title",
+    "to",
+    "toArray",
+    "toBlob",
+    "toDataURL",
+    "toDateString",
+    "toElement",
+    "toExponential",
+    "toFixed",
+    "toFloat32Array",
+    "toFloat64Array",
+    "toGMTString",
+    "toISOString",
+    "toJSON",
+    "toLocaleDateString",
+    "toLocaleFormat",
+    "toLocaleLowerCase",
+    "toLocaleString",
+    "toLocaleTimeString",
+    "toLocaleUpperCase",
+    "toLowerCase",
+    "toMatrix",
+    "toMethod",
+    "toPrecision",
+    "toPrimitive",
+    "toSdp",
+    "toSource",
+    "toStaticHTML",
+    "toString",
+    "toStringTag",
+    "toSum",
+    "toTimeString",
+    "toUTCString",
+    "toUpperCase",
+    "toggle",
+    "toggleAttribute",
+    "toggleLongPressEnabled",
+    "tone",
+    "toneBuffer",
+    "tooLong",
+    "tooShort",
+    "toolbar",
+    "top",
+    "topMargin",
+    "total",
+    "totalFrameDelay",
+    "totalJSHeapSize",
+    "totalSize",
+    "totalVideoFrames",
+    "touch-action",
+    "touchAction",
+    "touched",
+    "touches",
+    "trace",
+    "track",
+    "trackVisibility",
+    "tran",
+    "transaction",
+    "transactions",
+    "transceiver",
+    "transferControlToOffscreen",
+    "transferFromImageBitmap",
+    "transferImageBitmap",
+    "transferIn",
+    "transferOut",
+    "transferSize",
+    "transferToImageBitmap",
+    "transform",
+    "transform-box",
+    "transform-origin",
+    "transform-style",
+    "transformBox",
+    "transformFeedbackVaryings",
+    "transformOrigin",
+    "transformOriginX",
+    "transformOriginY",
+    "transformOriginZ",
+    "transformPoint",
+    "transformString",
+    "transformStyle",
+    "transformToDocument",
+    "transformToFragment",
+    "transition",
+    "transition-delay",
+    "transition-duration",
+    "transition-property",
+    "transition-timing-function",
+    "transitionDelay",
+    "transitionDuration",
+    "transitionProperty",
+    "transitionTimingFunction",
+    "translate",
+    "translateSelf",
+    "translationX",
+    "translationY",
+    "transport",
+    "trim",
+    "trimEnd",
+    "trimLeft",
+    "trimRight",
+    "trimStart",
+    "trueSpeed",
+    "trunc",
+    "truncate",
+    "trustedTypes",
+    "turn",
+    "twist",
+    "type",
+    "typeDetail",
+    "typeMismatch",
+    "typeMustMatch",
+    "types",
+    "tz",
+    "u2f",
+    "ubound",
+    "undefined",
+    "unescape",
+    "uneval",
+    "unicode",
+    "unicode-bidi",
+    "unicodeBidi",
+    "unicodeRange",
+    "uniform1f",
+    "uniform1fv",
+    "uniform1i",
+    "uniform1iv",
+    "uniform1ui",
+    "uniform1uiv",
+    "uniform2f",
+    "uniform2fv",
+    "uniform2i",
+    "uniform2iv",
+    "uniform2ui",
+    "uniform2uiv",
+    "uniform3f",
+    "uniform3fv",
+    "uniform3i",
+    "uniform3iv",
+    "uniform3ui",
+    "uniform3uiv",
+    "uniform4f",
+    "uniform4fv",
+    "uniform4i",
+    "uniform4iv",
+    "uniform4ui",
+    "uniform4uiv",
+    "uniformBlockBinding",
+    "uniformMatrix2fv",
+    "uniformMatrix2x3fv",
+    "uniformMatrix2x4fv",
+    "uniformMatrix3fv",
+    "uniformMatrix3x2fv",
+    "uniformMatrix3x4fv",
+    "uniformMatrix4fv",
+    "uniformMatrix4x2fv",
+    "uniformMatrix4x3fv",
+    "unique",
+    "uniqueID",
+    "uniqueNumber",
+    "unit",
+    "unitType",
+    "units",
+    "unloadEventEnd",
+    "unloadEventStart",
+    "unlock",
+    "unmount",
+    "unobserve",
+    "unpause",
+    "unpauseAnimations",
+    "unreadCount",
+    "unregister",
+    "unregisterContentHandler",
+    "unregisterProtocolHandler",
+    "unscopables",
+    "unselectable",
+    "unshift",
+    "unsubscribe",
+    "unsuspendRedraw",
+    "unsuspendRedrawAll",
+    "unwatch",
+    "unwrapKey",
+    "upDegrees",
+    "upX",
+    "upY",
+    "upZ",
+    "update",
+    "updateCommands",
+    "updateEnabled",
+    "updateIce",
+    "updateInterval",
+    "updatePlaybackRate",
+    "updateRenderState",
+    "updateSettings",
+    "updateTiming",
+    "updateViaCache",
+    "updateWith",
+    "updated",
+    "updating",
+    "upgrade",
+    "upload",
+    "uploadTotal",
+    "uploaded",
+    "upper",
+    "upperBound",
+    "upperOpen",
+    "uri",
+    "url",
+    "urn",
+    "urns",
+    "usage",
+    "usages",
+    "usb",
+    "usbVersionMajor",
+    "usbVersionMinor",
+    "usbVersionSubminor",
+    "useCurrentView",
+    "useGrouping",
+    "useMap",
+    "useProgram",
+    "usedJSHeapSize",
+    "usedSpace",
+    "user-select",
+    "userActivation",
+    "userAgent",
+    "userChoice",
+    "userHandle",
+    "userHint",
+    "userLanguage",
+    "userProfile",
+    "userSelect",
+    "userVisibleOnly",
+    "userZoom",
+    "username",
+    "usernameFragment",
+    "utterance",
+    "uuid",
+    "v8BreakIterator",
+    "v8Parse",
+    "vAlign",
+    "vLink",
+    "valid",
+    "validate",
+    "validateProgram",
+    "validationMessage",
+    "validity",
+    "value",
+    "valueAsDate",
+    "valueAsNumber",
+    "valueAsString",
+    "valueInSpecifiedUnits",
+    "valueMissing",
+    "valueOf",
+    "valueText",
+    "valueType",
+    "values",
+    "variable",
+    "variant",
+    "vector-effect",
+    "vectorEffect",
+    "velocityAngular",
+    "velocityExpansion",
+    "velocityX",
+    "velocityY",
+    "vendor",
+    "vendorId",
+    "vendorSub",
+    "verify",
+    "version",
+    "vertexAttrib1f",
+    "vertexAttrib1fv",
+    "vertexAttrib2f",
+    "vertexAttrib2fv",
+    "vertexAttrib3f",
+    "vertexAttrib3fv",
+    "vertexAttrib4f",
+    "vertexAttrib4fv",
+    "vertexAttribDivisor",
+    "vertexAttribDivisorANGLE",
+    "vertexAttribI4i",
+    "vertexAttribI4iv",
+    "vertexAttribI4ui",
+    "vertexAttribI4uiv",
+    "vertexAttribIPointer",
+    "vertexAttribPointer",
+    "vertical",
+    "vertical-align",
+    "verticalAlign",
+    "verticalOverflow",
+    "vh",
+    "vibrate",
+    "vibrationActuator",
+    "video/x-ms-asf",
+    "video/x-ms-asf-plugin",
+    "video/x-ms-wm",
+    "video/x-ms-wmv",
+    "video/x-ms-wvx",
+    "videoBitsPerSecond",
+    "videoHeight",
+    "videoTracks",
+    "videoWidth",
+    "view",
+    "viewBox",
+    "viewBoxString",
+    "viewTarget",
+    "viewTargetString",
+    "viewport",
+    "viewportAnchorX",
+    "viewportAnchorY",
+    "viewportElement",
+    "views",
+    "violatedDirective",
+    "visibility",
+    "visibilityState",
+    "visible",
+    "visualViewport",
+    "vlinkColor",
+    "vmax",
+    "vmin",
+    "voice",
+    "voiceURI",
+    "volume",
+    "vrml",
+    "vspace",
+    "vw",
+    "w",
+    "wait",
+    "waitSync",
+    "waiting",
+    "wake",
+    "wakeLock",
+    "wand",
+    "warn",
+    "wasAlternateProtocolAvailable",
+    "wasClean",
+    "wasDiscarded",
+    "wasFetchedViaSpdy",
+    "wasNpnNegotiated",
+    "watch",
+    "watchAvailability",
+    "watchPosition",
+    "webdriver",
+    "webkitAddKey",
+    "webkitAlignContent",
+    "webkitAlignItems",
+    "webkitAlignSelf",
+    "webkitAnimation",
+    "webkitAnimationDelay",
+    "webkitAnimationDirection",
+    "webkitAnimationDuration",
+    "webkitAnimationFillMode",
+    "webkitAnimationIterationCount",
+    "webkitAnimationName",
+    "webkitAnimationPlayState",
+    "webkitAnimationTimingFunction",
+    "webkitAppRegion",
+    "webkitAppearance",
+    "webkitAspectRatio",
+    "webkitAudioContext",
+    "webkitAudioDecodedByteCount",
+    "webkitAudioPannerNode",
+    "webkitBackdropFilter",
+    "webkitBackfaceVisibility",
+    "webkitBackground",
+    "webkitBackgroundAttachment",
+    "webkitBackgroundClip",
+    "webkitBackgroundColor",
+    "webkitBackgroundComposite",
+    "webkitBackgroundImage",
+    "webkitBackgroundOrigin",
+    "webkitBackgroundPosition",
+    "webkitBackgroundPositionX",
+    "webkitBackgroundPositionY",
+    "webkitBackgroundRepeat",
+    "webkitBackgroundSize",
+    "webkitBackingStorePixelRatio",
+    "webkitBorderAfter",
+    "webkitBorderAfterColor",
+    "webkitBorderAfterStyle",
+    "webkitBorderAfterWidth",
+    "webkitBorderBefore",
+    "webkitBorderBeforeColor",
+    "webkitBorderBeforeStyle",
+    "webkitBorderBeforeWidth",
+    "webkitBorderBottomLeftRadius",
+    "webkitBorderBottomRightRadius",
+    "webkitBorderEnd",
+    "webkitBorderEndColor",
+    "webkitBorderEndStyle",
+    "webkitBorderEndWidth",
+    "webkitBorderFit",
+    "webkitBorderHorizontalSpacing",
+    "webkitBorderImage",
+    "webkitBorderImageOutset",
+    "webkitBorderImageRepeat",
+    "webkitBorderImageSlice",
+    "webkitBorderImageSource",
+    "webkitBorderImageWidth",
+    "webkitBorderRadius",
+    "webkitBorderStart",
+    "webkitBorderStartColor",
+    "webkitBorderStartStyle",
+    "webkitBorderStartWidth",
+    "webkitBorderTopLeftRadius",
+    "webkitBorderTopRightRadius",
+    "webkitBorderVerticalSpacing",
+    "webkitBoxAlign",
+    "webkitBoxDecorationBreak",
+    "webkitBoxDirection",
+    "webkitBoxFlex",
+    "webkitBoxFlexGroup",
+    "webkitBoxLines",
+    "webkitBoxOrdinalGroup",
+    "webkitBoxOrient",
+    "webkitBoxPack",
+    "webkitBoxReflect",
+    "webkitBoxShadow",
+    "webkitBoxSizing",
+    "webkitCancelAnimationFrame",
+    "webkitCancelFullScreen",
+    "webkitCancelKeyRequest",
+    "webkitCancelRequestAnimationFrame",
+    "webkitClearResourceTimings",
+    "webkitClipPath",
+    "webkitClosedCaptionsVisible",
+    "webkitColumnAxis",
+    "webkitColumnBreakAfter",
+    "webkitColumnBreakBefore",
+    "webkitColumnBreakInside",
+    "webkitColumnCount",
+    "webkitColumnGap",
+    "webkitColumnProgression",
+    "webkitColumnRule",
+    "webkitColumnRuleColor",
+    "webkitColumnRuleStyle",
+    "webkitColumnRuleWidth",
+    "webkitColumnSpan",
+    "webkitColumnWidth",
+    "webkitColumns",
+    "webkitConvertPointFromNodeToPage",
+    "webkitConvertPointFromPageToNode",
+    "webkitCreateShadowRoot",
+    "webkitCurrentFullScreenElement",
+    "webkitCurrentPlaybackTargetIsWireless",
+    "webkitCursorVisibility",
+    "webkitDashboardRegion",
+    "webkitDecodedFrameCount",
+    "webkitDirectionInvertedFromDevice",
+    "webkitDisplayingFullscreen",
+    "webkitDroppedFrameCount",
+    "webkitEnterFullScreen",
+    "webkitEnterFullscreen",
+    "webkitEntries",
+    "webkitExitFullScreen",
+    "webkitExitFullscreen",
+    "webkitExitPointerLock",
+    "webkitFilter",
+    "webkitFlex",
+    "webkitFlexBasis",
+    "webkitFlexDirection",
+    "webkitFlexFlow",
+    "webkitFlexGrow",
+    "webkitFlexShrink",
+    "webkitFlexWrap",
+    "webkitFontFeatureSettings",
+    "webkitFontKerning",
+    "webkitFontSizeDelta",
+    "webkitFontSmoothing",
+    "webkitForce",
+    "webkitFullScreenKeyboardInputAllowed",
+    "webkitFullscreenElement",
+    "webkitFullscreenEnabled",
+    "webkitGenerateKeyRequest",
+    "webkitGetAsEntry",
+    "webkitGetDatabaseNames",
+    "webkitGetEntries",
+    "webkitGetEntriesByName",
+    "webkitGetEntriesByType",
+    "webkitGetFlowByName",
+    "webkitGetGamepads",
+    "webkitGetImageDataHD",
+    "webkitGetNamedFlows",
+    "webkitGetRegionFlowRanges",
+    "webkitGetUserMedia",
+    "webkitHasClosedCaptions",
+    "webkitHidden",
+    "webkitHighlight",
+    "webkitHyphenateCharacter",
+    "webkitHyphenateLimitAfter",
+    "webkitHyphenateLimitBefore",
+    "webkitHyphenateLimitLines",
+    "webkitHyphens",
+    "webkitIDBCursor",
+    "webkitIDBDatabase",
+    "webkitIDBDatabaseError",
+    "webkitIDBDatabaseException",
+    "webkitIDBFactory",
+    "webkitIDBIndex",
+    "webkitIDBKeyRange",
+    "webkitIDBObjectStore",
+    "webkitIDBRequest",
+    "webkitIDBTransaction",
+    "webkitImageSmoothingEnabled",
+    "webkitIndexedDB",
+    "webkitInitMessageEvent",
+    "webkitInitialLetter",
+    "webkitIsFullScreen",
+    "webkitJustifyContent",
+    "webkitKeys",
+    "webkitLineAlign",
+    "webkitLineBoxContain",
+    "webkitLineBreak",
+    "webkitLineClamp",
+    "webkitLineDash",
+    "webkitLineDashOffset",
+    "webkitLineGrid",
+    "webkitLineSnap",
+    "webkitLocale",
+    "webkitLockOrientation",
+    "webkitLogicalHeight",
+    "webkitLogicalWidth",
+    "webkitMarginAfter",
+    "webkitMarginAfterCollapse",
+    "webkitMarginBefore",
+    "webkitMarginBeforeCollapse",
+    "webkitMarginBottomCollapse",
+    "webkitMarginCollapse",
+    "webkitMarginEnd",
+    "webkitMarginStart",
+    "webkitMarginTopCollapse",
+    "webkitMarquee",
+    "webkitMarqueeDirection",
+    "webkitMarqueeIncrement",
+    "webkitMarqueeRepetition",
+    "webkitMarqueeSpeed",
+    "webkitMarqueeStyle",
+    "webkitMask",
+    "webkitMaskBoxImage",
+    "webkitMaskBoxImageOutset",
+    "webkitMaskBoxImageRepeat",
+    "webkitMaskBoxImageSlice",
+    "webkitMaskBoxImageSource",
+    "webkitMaskBoxImageWidth",
+    "webkitMaskClip",
+    "webkitMaskComposite",
+    "webkitMaskImage",
+    "webkitMaskOrigin",
+    "webkitMaskPosition",
+    "webkitMaskPositionX",
+    "webkitMaskPositionY",
+    "webkitMaskRepeat",
+    "webkitMaskRepeatX",
+    "webkitMaskRepeatY",
+    "webkitMaskSize",
+    "webkitMaskSourceType",
+    "webkitMatchesSelector",
+    "webkitMaxLogicalHeight",
+    "webkitMaxLogicalWidth",
+    "webkitMediaStream",
+    "webkitMinLogicalHeight",
+    "webkitMinLogicalWidth",
+    "webkitNbspMode",
+    "webkitNotifications",
+    "webkitOfflineAudioContext",
+    "webkitOpacity",
+    "webkitOrder",
+    "webkitOrientation",
+    "webkitPaddingAfter",
+    "webkitPaddingBefore",
+    "webkitPaddingEnd",
+    "webkitPaddingStart",
+    "webkitPeerConnection00",
+    "webkitPersistentStorage",
+    "webkitPerspective",
+    "webkitPerspectiveOrigin",
+    "webkitPerspectiveOriginX",
+    "webkitPerspectiveOriginY",
+    "webkitPointerLockElement",
+    "webkitPostMessage",
+    "webkitPreservesPitch",
+    "webkitPrintColorAdjust",
+    "webkitPutImageDataHD",
+    "webkitRTCPeerConnection",
+    "webkitRegionOverset",
+    "webkitRelativePath",
+    "webkitRequestAnimationFrame",
+    "webkitRequestFileSystem",
+    "webkitRequestFullScreen",
+    "webkitRequestFullscreen",
+    "webkitRequestPointerLock",
+    "webkitResolveLocalFileSystemURL",
+    "webkitRtlOrdering",
+    "webkitRubyPosition",
+    "webkitSetMediaKeys",
+    "webkitSetResourceTimingBufferSize",
+    "webkitShadowRoot",
+    "webkitShapeImageThreshold",
+    "webkitShapeMargin",
+    "webkitShapeOutside",
+    "webkitShowPlaybackTargetPicker",
+    "webkitSlice",
+    "webkitSpeechGrammar",
+    "webkitSpeechGrammarList",
+    "webkitSpeechRecognition",
+    "webkitSpeechRecognitionError",
+    "webkitSpeechRecognitionEvent",
+    "webkitStorageInfo",
+    "webkitSupportsFullscreen",
+    "webkitSvgShadow",
+    "webkitTapHighlightColor",
+    "webkitTemporaryStorage",
+    "webkitTextCombine",
+    "webkitTextDecoration",
+    "webkitTextDecorationColor",
+    "webkitTextDecorationLine",
+    "webkitTextDecorationSkip",
+    "webkitTextDecorationStyle",
+    "webkitTextDecorationsInEffect",
+    "webkitTextEmphasis",
+    "webkitTextEmphasisColor",
+    "webkitTextEmphasisPosition",
+    "webkitTextEmphasisStyle",
+    "webkitTextFillColor",
+    "webkitTextOrientation",
+    "webkitTextSecurity",
+    "webkitTextSizeAdjust",
+    "webkitTextStroke",
+    "webkitTextStrokeColor",
+    "webkitTextStrokeWidth",
+    "webkitTextUnderlinePosition",
+    "webkitTextZoom",
+    "webkitTransform",
+    "webkitTransformOrigin",
+    "webkitTransformOriginX",
+    "webkitTransformOriginY",
+    "webkitTransformOriginZ",
+    "webkitTransformStyle",
+    "webkitTransition",
+    "webkitTransitionDelay",
+    "webkitTransitionDuration",
+    "webkitTransitionProperty",
+    "webkitTransitionTimingFunction",
+    "webkitURL",
+    "webkitUnlockOrientation",
+    "webkitUserDrag",
+    "webkitUserModify",
+    "webkitUserSelect",
+    "webkitVideoDecodedByteCount",
+    "webkitVisibilityState",
+    "webkitWirelessVideoPlaybackDisabled",
+    "webkitWritingMode",
+    "webkitdirectory",
+    "webkitdropzone",
+    "webstore",
+    "weekday",
+    "weight",
+    "whatToShow",
+    "wheelDelta",
+    "wheelDeltaX",
+    "wheelDeltaY",
+    "whenDefined",
+    "which",
+    "white-space",
+    "whiteSpace",
+    "wholeText",
+    "widows",
+    "width",
+    "will-change",
+    "willChange",
+    "willValidate",
+    "window",
+    "withCredentials",
+    "word-break",
+    "word-spacing",
+    "word-wrap",
+    "wordBreak",
+    "wordSpacing",
+    "wordWrap",
+    "workerStart",
+    "wrap",
+    "wrapKey",
+    "writable",
+    "writableAuxiliaries",
+    "write",
+    "writeText",
+    "writeValue",
+    "writeWithoutResponse",
+    "writeln",
+    "writing-mode",
+    "writingMode",
+    "x",
+    "x1",
+    "x2",
+    "xChannelSelector",
+    "xmlEncoding",
+    "xmlStandalone",
+    "xmlVersion",
+    "xmlbase",
+    "xmllang",
+    "xmlspace",
+    "xor",
+    "xr",
+    "y",
+    "y1",
+    "y2",
+    "yChannelSelector",
+    "yandex",
+    "year",
+    "z",
+    "z-index",
+    "zIndex",
+    "zoom",
+    "zoomAndPan",
+    "zoomRectScreen"
+]
Index: /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/node.js
===================================================================
--- /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/node.js	(revision 20239)
+++ /branches/rel_ag_9_4_0_493_SBOM/restfulapi/proxy/media/node_modules/grunt-contrib-uglify/node_modules/uglify-js/tools/node.js	(working copy)
@@ -1,173 +1,73 @@
-var path = require("path");
 var fs = require("fs");
-var vm = require("vm");
 
-var UglifyJS = vm.createContext({
-    console       : console,
-    process       : process,
-    Buffer        : Buffer,
-    MOZ_SourceMap : require("source-map")
-});
-
-function load_global(file) {
-    file = path.resolve(path.dirname(module.filename), file);
-    try {
-        var code = fs.readFileSync(file, "utf8");
-        return vm.runInContext(code, UglifyJS, file);
-    } catch(ex) {
-        // XXX: in case of a syntax error, the message is kinda
-        // useless. (no location information).
-        console.log("ERROR in file: " + file + " / " + ex);
-        process.exit(1);
-    }
-};
-
-var FILES = exports.FILES = [
-    "../lib/utils.js",
-    "../lib/ast.js",
-    "../lib/parse.js",
-    "../lib/transform.js",
-    "../lib/scope.js",
-    "../lib/output.js",
-    "../lib/compress.js",
-    "../lib/sourcemap.js",
-    "../lib/mozilla-ast.js",
-    "../lib/propmangle.js"
-].map(function(file){
-    return fs.realpathSync(path.join(path.dirname(__filename), file));
-});
-
-FILES.forEach(load_global);
-
-UglifyJS.AST_Node.warn_function = function(txt) {
-    console.error("WARN: %s", txt);
-};
-
-// XXX: perhaps we shouldn't export everything but heck, I'm lazy.
-for (var i in UglifyJS) {
-    if (UglifyJS.hasOwnProperty(i)) {
-        exports[i] = UglifyJS[i];
-    }
-}
-
-exports.minify = function(files, options) {
-    options = UglifyJS.defaults(options, {
-        spidermonkey : false,
-        outSourceMap : null,
-        sourceRoot   : null,
-        inSourceMap  : null,
-        fromString   : false,
-        warnings     : false,
-        mangle       : {},
-        output       : null,
-        compress     : {}
+exports.FILES = [
+    require.resolve("../lib/utils.js"),
+    require.resolve("../lib/ast.js"),
+    require.resolve("../lib/transform.js"),
+    require.resolve("../lib/parse.js"),
+    require.resolve("../lib/scope.js"),
+    require.resolve("../lib/compress.js"),
+    require.resolve("../lib/output.js"),
+    require.resolve("../lib/sourcemap.js"),
+    require.resolve("../lib/mozilla-ast.js"),
+    require.resolve("../lib/propmangle.js"),
+    require.resolve("../lib/minify.js"),
+    require.resolve("./exports.js"),
+];
+
+new Function("domprops", "exports", function() {
+    var code = exports.FILES.map(function(file) {
+        return fs.readFileSync(file, "utf8");
     });
-    UglifyJS.base54.reset();
-
-    // 1. parse
-    var toplevel = null,
-        sourcesContent = {};
-
-    if (options.spidermonkey) {
-        toplevel = UglifyJS.AST_Node.from_mozilla_ast(files);
-    } else {
-        if (typeof files == "string")
-            files = [ files ];
-        files.forEach(function(file){
-            var code = options.fromString
-                ? file
-                : fs.readFileSync(file, "utf8");
-            sourcesContent[file] = code;
-            toplevel = UglifyJS.parse(code, {
-                filename: options.fromString ? "?" : file,
-                toplevel: toplevel
-            });
-        });
-    }
-
-    // 2. compress
-    if (options.compress) {
-        var compress = { warnings: options.warnings };
-        UglifyJS.merge(compress, options.compress);
-        toplevel.figure_out_scope();
-        var sq = UglifyJS.Compressor(compress);
-        toplevel = toplevel.transform(sq);
-    }
-
-    // 3. mangle
-    if (options.mangle) {
-        toplevel.figure_out_scope(options.mangle);
-        toplevel.compute_char_frequency(options.mangle);
-        toplevel.mangle_names(options.mangle);
-    }
-
-    // 4. output
-    var inMap = options.inSourceMap;
-    var output = {};
-    if (typeof options.inSourceMap == "string") {
-        inMap = fs.readFileSync(options.inSourceMap, "utf8");
-    }
-    if (options.outSourceMap) {
-        output.source_map = UglifyJS.SourceMap({
-            file: options.outSourceMap,
-            orig: inMap,
-            root: options.sourceRoot
-        });
-        if (options.sourceMapIncludeSources) {
-            for (var file in sourcesContent) {
-                if (sourcesContent.hasOwnProperty(file)) {
-                    output.source_map.get().setSourceContent(file, sourcesContent[file]);
-                }
-            }
-        }
-
-    }
-    if (options.output) {
-        UglifyJS.merge(output, options.output);
-    }
-    var stream = UglifyJS.OutputStream(output);
-    toplevel.print(stream);
-
-    if(options.outSourceMap){
-        stream += "\n//# sourceMappingURL=" + options.outSourceMap;
-    }
-
-    var source_map = output.source_map;
-    if (source_map) {
-        source_map = source_map + "";
-    }
-
-    return {
-        code : stream + "",
-        map  : source_map
-    };
-};
+    code.push("exports.describe_ast = " + describe_ast.toString());
+    return code.join("\n\n");
+}())(require("./domprops.json"), exports);
+
+function to_comment(value) {
+    if (typeof value != "string") value = JSON.stringify(value, function(key, value) {
+        return typeof value == "function" ? "<[ " + value + " ]>" : value;
+    }, 2);
+    return "// " + value.replace(/\n/g, "\n// ");
+}
 
-// exports.describe_ast = function() {
-//     function doitem(ctor) {
-//         var sub = {};
-//         ctor.SUBCLASSES.forEach(function(ctor){
-//             sub[ctor.TYPE] = doitem(ctor);
-//         });
-//         var ret = {};
-//         if (ctor.SELF_PROPS.length > 0) ret.props = ctor.SELF_PROPS;
-//         if (ctor.SUBCLASSES.length > 0) ret.sub = sub;
-//         return ret;
-//     }
-//     return doitem(UglifyJS.AST_Node).sub;
-// }
+if (+process.env["UGLIFY_BUG_REPORT"]) exports.minify = function(files, options) {
+    if (typeof options == "undefined") options = "<<undefined>>";
+    var code = [
+        "// UGLIFY_BUG_REPORT",
+        to_comment(options),
+    ];
+    if (typeof files == "string") {
+        code.push("");
+        code.push("//-------------------------------------------------------------")
+        code.push("// INPUT CODE", files);
+    } else for (var name in files) {
+        code.push("");
+        code.push("//-------------------------------------------------------------")
+        code.push(to_comment(name), files[name]);
+    }
+    if (options.sourceMap && options.sourceMap.url) {
+        code.push("");
+        code.push("//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IiJ9");
+    }
+    var result = { code: code.join("\n") };
+    if (options.sourceMap) result.map = '{"version":3,"sources":[],"names":[],"mappings":""}';
+    return result;
+};
+
+function describe_ast() {
+    var out = OutputStream({ beautify: true });
+    doitem(AST_Node);
+    return out.get() + "\n";
 
-exports.describe_ast = function() {
-    var out = UglifyJS.OutputStream({ beautify: true });
     function doitem(ctor) {
         out.print("AST_" + ctor.TYPE);
-        var props = ctor.SELF_PROPS.filter(function(prop){
+        var props = ctor.SELF_PROPS.filter(function(prop) {
             return !/^\$/.test(prop);
         });
         if (props.length > 0) {
             out.space();
-            out.with_parens(function(){
-                props.forEach(function(prop, i){
+            out.with_parens(function() {
+                props.forEach(function(prop, i) {
                     if (i) out.space();
                     out.print(prop);
                 });
@@ -179,75 +79,32 @@
         }
         if (ctor.SUBCLASSES.length > 0) {
             out.space();
-            out.with_block(function(){
-                ctor.SUBCLASSES.forEach(function(ctor, i){
+            out.with_block(function() {
+                ctor.SUBCLASSES.sort(function(a, b) {
+                    return a.TYPE < b.TYPE ? -1 : 1;
+                }).forEach(function(ctor, i) {
                     out.indent();
                     doitem(ctor);
                     out.newline();
                 });
             });
         }
-    };
-    doitem(UglifyJS.AST_Node);
-    return out + "";
-};
-
-function readReservedFile(filename, reserved) {
-    if (!reserved) {
-        reserved = { vars: [], props: [] };
-    }
-    var data = fs.readFileSync(filename, "utf8");
-    data = JSON.parse(data);
-    if (data.vars) {
-        data.vars.forEach(function(name){
-            UglifyJS.push_uniq(reserved.vars, name);
-        });
     }
-    if (data.props) {
-        data.props.forEach(function(name){
-            UglifyJS.push_uniq(reserved.props, name);
-        });
-    }
-    return reserved;
 }
 
-exports.readReservedFile = readReservedFile;
-
-exports.readDefaultReservedFile = function(reserved) {
-    return readReservedFile(path.join(__dirname, "domprops.json"), reserved);
-};
-
-exports.readNameCache = function(filename, key) {
-    var cache = null;
-    if (filename) {
-        try {
-            var cache = fs.readFileSync(filename, "utf8");
-            cache = JSON.parse(cache)[key];
-            if (!cache) throw "init";
-            cache.props = UglifyJS.Dictionary.fromObject(cache.props);
-        } catch(ex) {
-            cache = {
-                cname: -1,
-                props: new UglifyJS.Dictionary()
-            };
-        }
-    }
-    return cache;
-};
+function infer_options(options) {
+    var result = exports.minify("", options);
+    return result.error && result.error.defs;
+}
 
-exports.writeNameCache = function(filename, key, cache) {
-    if (filename) {
-        var data;
-        try {
-            data = fs.readFileSync(filename, "utf8");
-            data = JSON.parse(data);
-        } catch(ex) {
-            data = {};
+exports.default_options = function() {
+    var defs = infer_options({ 0: 0 });
+    Object.keys(defs).forEach(function(component) {
+        var options = {};
+        options[component] = { 0: 0 };
+        if (options = infer_options(options)) {
+            defs[component] = options;
         }
-        data[key] = {
-            cname: cache.cname,
-            props: cache.props.toObject()
-        };
-        fs.writeFileSync(filename, JSON.stringify(data, null, 2), "utf8");
-    }
+    });
+    return defs;
 };
