mirror of
				https://scm.univ-tours.fr/22107988t/rappaurio-sae501_502.git
				synced 2025-11-04 07:45:27 +01:00 
			
		
		
		
	v1.0 du site web
This commit is contained in:
		
							
								
								
									
										2356
									
								
								app/node_modules/uglify-js/lib/ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2356
									
								
								app/node_modules/uglify-js/lib/ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										14241
									
								
								app/node_modules/uglify-js/lib/compress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										14241
									
								
								app/node_modules/uglify-js/lib/compress.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										276
									
								
								app/node_modules/uglify-js/lib/minify.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										276
									
								
								app/node_modules/uglify-js/lib/minify.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,276 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
var to_ascii, to_base64;
 | 
			
		||||
if (typeof Buffer == "undefined") {
 | 
			
		||||
    to_ascii = atob;
 | 
			
		||||
    to_base64 = btoa;
 | 
			
		||||
} else if (typeof Buffer.alloc == "undefined") {
 | 
			
		||||
    to_ascii = function(b64) {
 | 
			
		||||
        return new Buffer(b64, "base64").toString();
 | 
			
		||||
    };
 | 
			
		||||
    to_base64 = function(str) {
 | 
			
		||||
        return new Buffer(str).toString("base64");
 | 
			
		||||
    };
 | 
			
		||||
} else {
 | 
			
		||||
    to_ascii = function(b64) {
 | 
			
		||||
        return Buffer.from(b64, "base64").toString();
 | 
			
		||||
    };
 | 
			
		||||
    to_base64 = function(str) {
 | 
			
		||||
        return Buffer.from(str).toString("base64");
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function read_source_map(name, toplevel) {
 | 
			
		||||
    var comments = toplevel.end.comments_after;
 | 
			
		||||
    for (var i = comments.length; --i >= 0;) {
 | 
			
		||||
        var comment = comments[i];
 | 
			
		||||
        if (comment.type != "comment1") break;
 | 
			
		||||
        var match = /^# ([^\s=]+)=(\S+)\s*$/.exec(comment.value);
 | 
			
		||||
        if (!match) break;
 | 
			
		||||
        if (match[1] == "sourceMappingURL") {
 | 
			
		||||
            match = /^data:application\/json(;.*?)?;base64,([^,]+)$/.exec(match[2]);
 | 
			
		||||
            if (!match) break;
 | 
			
		||||
            return to_ascii(match[2]);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    AST_Node.warn("inline source map not found: {name}", {
 | 
			
		||||
        name: name,
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function parse_source_map(content) {
 | 
			
		||||
    try {
 | 
			
		||||
        return JSON.parse(content);
 | 
			
		||||
    } catch (ex) {
 | 
			
		||||
        throw new Error("invalid input source map: " + content);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function set_shorthand(name, options, keys) {
 | 
			
		||||
    keys.forEach(function(key) {
 | 
			
		||||
        if (options[key]) {
 | 
			
		||||
            if (typeof options[key] != "object") options[key] = {};
 | 
			
		||||
            if (!(name in options[key])) options[key][name] = options[name];
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function init_cache(cache) {
 | 
			
		||||
    if (!cache) return;
 | 
			
		||||
    if (!("props" in cache)) {
 | 
			
		||||
        cache.props = new Dictionary();
 | 
			
		||||
    } else if (!(cache.props instanceof Dictionary)) {
 | 
			
		||||
        cache.props = Dictionary.fromObject(cache.props);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function to_json(cache) {
 | 
			
		||||
    return {
 | 
			
		||||
        props: cache.props.toObject()
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function minify(files, options) {
 | 
			
		||||
    try {
 | 
			
		||||
        options = defaults(options, {
 | 
			
		||||
            annotations: undefined,
 | 
			
		||||
            compress: {},
 | 
			
		||||
            enclose: false,
 | 
			
		||||
            expression: false,
 | 
			
		||||
            ie: false,
 | 
			
		||||
            ie8: false,
 | 
			
		||||
            keep_fargs: false,
 | 
			
		||||
            keep_fnames: false,
 | 
			
		||||
            mangle: {},
 | 
			
		||||
            module: false,
 | 
			
		||||
            nameCache: null,
 | 
			
		||||
            output: {},
 | 
			
		||||
            parse: {},
 | 
			
		||||
            rename: undefined,
 | 
			
		||||
            sourceMap: false,
 | 
			
		||||
            timings: false,
 | 
			
		||||
            toplevel: !!(options && options["module"]),
 | 
			
		||||
            v8: false,
 | 
			
		||||
            validate: false,
 | 
			
		||||
            warnings: false,
 | 
			
		||||
            webkit: false,
 | 
			
		||||
            wrap: false,
 | 
			
		||||
        }, true);
 | 
			
		||||
        if (options.validate) AST_Node.enable_validation();
 | 
			
		||||
        var timings = options.timings && { start: Date.now() };
 | 
			
		||||
        if (options.annotations !== undefined) set_shorthand("annotations", options, [ "compress", "output" ]);
 | 
			
		||||
        if (options.expression) set_shorthand("expression", options, [ "compress", "parse" ]);
 | 
			
		||||
        if (options.ie8) options.ie = options.ie || options.ie8;
 | 
			
		||||
        if (options.ie) set_shorthand("ie", options, [ "compress", "mangle", "output", "rename" ]);
 | 
			
		||||
        if (options.keep_fargs) set_shorthand("keep_fargs", options, [ "compress", "mangle", "rename" ]);
 | 
			
		||||
        if (options.keep_fnames) set_shorthand("keep_fnames", options, [ "compress", "mangle", "rename" ]);
 | 
			
		||||
        if (options.module) set_shorthand("module", options, [ "compress", "parse" ]);
 | 
			
		||||
        if (options.toplevel) set_shorthand("toplevel", options, [ "compress", "mangle", "rename" ]);
 | 
			
		||||
        if (options.v8) set_shorthand("v8", options, [ "mangle", "output", "rename" ]);
 | 
			
		||||
        if (options.webkit) set_shorthand("webkit", options, [ "compress", "mangle", "output", "rename" ]);
 | 
			
		||||
        var quoted_props;
 | 
			
		||||
        if (options.mangle) {
 | 
			
		||||
            options.mangle = defaults(options.mangle, {
 | 
			
		||||
                cache: options.nameCache && (options.nameCache.vars || {}),
 | 
			
		||||
                eval: false,
 | 
			
		||||
                ie: false,
 | 
			
		||||
                keep_fargs: false,
 | 
			
		||||
                keep_fnames: false,
 | 
			
		||||
                properties: false,
 | 
			
		||||
                reserved: [],
 | 
			
		||||
                toplevel: false,
 | 
			
		||||
                v8: false,
 | 
			
		||||
                webkit: false,
 | 
			
		||||
            }, true);
 | 
			
		||||
            if (options.mangle.properties) {
 | 
			
		||||
                if (typeof options.mangle.properties != "object") {
 | 
			
		||||
                    options.mangle.properties = {};
 | 
			
		||||
                }
 | 
			
		||||
                if (options.mangle.properties.keep_quoted) {
 | 
			
		||||
                    quoted_props = options.mangle.properties.reserved;
 | 
			
		||||
                    if (!Array.isArray(quoted_props)) quoted_props = [];
 | 
			
		||||
                    options.mangle.properties.reserved = quoted_props;
 | 
			
		||||
                }
 | 
			
		||||
                if (options.nameCache && !("cache" in options.mangle.properties)) {
 | 
			
		||||
                    options.mangle.properties.cache = options.nameCache.props || {};
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            init_cache(options.mangle.cache);
 | 
			
		||||
            init_cache(options.mangle.properties.cache);
 | 
			
		||||
        }
 | 
			
		||||
        if (options.rename === undefined) options.rename = options.compress && options.mangle;
 | 
			
		||||
        if (options.sourceMap) {
 | 
			
		||||
            options.sourceMap = defaults(options.sourceMap, {
 | 
			
		||||
                content: null,
 | 
			
		||||
                filename: null,
 | 
			
		||||
                includeSources: false,
 | 
			
		||||
                names: true,
 | 
			
		||||
                root: null,
 | 
			
		||||
                url: null,
 | 
			
		||||
            }, true);
 | 
			
		||||
        }
 | 
			
		||||
        var warnings = [];
 | 
			
		||||
        if (options.warnings) AST_Node.log_function(function(warning) {
 | 
			
		||||
            warnings.push(warning);
 | 
			
		||||
        }, options.warnings == "verbose");
 | 
			
		||||
        if (timings) timings.parse = Date.now();
 | 
			
		||||
        var toplevel;
 | 
			
		||||
        options.parse = options.parse || {};
 | 
			
		||||
        if (files instanceof AST_Node) {
 | 
			
		||||
            toplevel = files;
 | 
			
		||||
        } else {
 | 
			
		||||
            if (typeof files == "string") files = [ files ];
 | 
			
		||||
            options.parse.toplevel = null;
 | 
			
		||||
            var source_map_content = options.sourceMap && options.sourceMap.content;
 | 
			
		||||
            if (typeof source_map_content == "string" && source_map_content != "inline") {
 | 
			
		||||
                source_map_content = parse_source_map(source_map_content);
 | 
			
		||||
            }
 | 
			
		||||
            if (source_map_content) options.sourceMap.orig = Object.create(null);
 | 
			
		||||
            for (var name in files) if (HOP(files, name)) {
 | 
			
		||||
                options.parse.filename = name;
 | 
			
		||||
                options.parse.toplevel = toplevel = parse(files[name], options.parse);
 | 
			
		||||
                if (source_map_content == "inline") {
 | 
			
		||||
                    var inlined_content = read_source_map(name, toplevel);
 | 
			
		||||
                    if (inlined_content) options.sourceMap.orig[name] = parse_source_map(inlined_content);
 | 
			
		||||
                } else if (source_map_content) {
 | 
			
		||||
                    options.sourceMap.orig[name] = source_map_content;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (options.parse.expression) toplevel = toplevel.wrap_expression();
 | 
			
		||||
        if (quoted_props) reserve_quoted_keys(toplevel, quoted_props);
 | 
			
		||||
        [ "enclose", "wrap" ].forEach(function(action) {
 | 
			
		||||
            var option = options[action];
 | 
			
		||||
            if (!option) return;
 | 
			
		||||
            var orig = toplevel.print_to_string().slice(0, -1);
 | 
			
		||||
            toplevel = toplevel[action](option);
 | 
			
		||||
            files[toplevel.start.file] = toplevel.print_to_string().replace(orig, "");
 | 
			
		||||
        });
 | 
			
		||||
        if (options.validate) toplevel.validate_ast();
 | 
			
		||||
        if (timings) timings.rename = Date.now();
 | 
			
		||||
        if (options.rename) {
 | 
			
		||||
            toplevel.figure_out_scope(options.rename);
 | 
			
		||||
            toplevel.expand_names(options.rename);
 | 
			
		||||
        }
 | 
			
		||||
        if (timings) timings.compress = Date.now();
 | 
			
		||||
        if (options.compress) {
 | 
			
		||||
            toplevel = new Compressor(options.compress).compress(toplevel);
 | 
			
		||||
            if (options.validate) toplevel.validate_ast();
 | 
			
		||||
        }
 | 
			
		||||
        if (timings) timings.scope = Date.now();
 | 
			
		||||
        if (options.mangle) toplevel.figure_out_scope(options.mangle);
 | 
			
		||||
        if (timings) timings.mangle = Date.now();
 | 
			
		||||
        if (options.mangle) {
 | 
			
		||||
            toplevel.compute_char_frequency(options.mangle);
 | 
			
		||||
            toplevel.mangle_names(options.mangle);
 | 
			
		||||
        }
 | 
			
		||||
        if (timings) timings.properties = Date.now();
 | 
			
		||||
        if (quoted_props) reserve_quoted_keys(toplevel, quoted_props);
 | 
			
		||||
        if (options.mangle && options.mangle.properties) mangle_properties(toplevel, options.mangle.properties);
 | 
			
		||||
        if (options.parse.expression) toplevel = toplevel.unwrap_expression();
 | 
			
		||||
        if (timings) timings.output = Date.now();
 | 
			
		||||
        var result = {};
 | 
			
		||||
        var output = defaults(options.output, {
 | 
			
		||||
            ast: false,
 | 
			
		||||
            code: true,
 | 
			
		||||
        });
 | 
			
		||||
        if (output.ast) result.ast = toplevel;
 | 
			
		||||
        if (output.code) {
 | 
			
		||||
            if (options.sourceMap) {
 | 
			
		||||
                output.source_map = SourceMap(options.sourceMap);
 | 
			
		||||
                if (options.sourceMap.includeSources) {
 | 
			
		||||
                    if (files instanceof AST_Toplevel) {
 | 
			
		||||
                        throw new Error("original source content unavailable");
 | 
			
		||||
                    } else for (var name in files) if (HOP(files, name)) {
 | 
			
		||||
                        output.source_map.setSourceContent(name, files[name]);
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            delete output.ast;
 | 
			
		||||
            delete output.code;
 | 
			
		||||
            var stream = OutputStream(output);
 | 
			
		||||
            toplevel.print(stream);
 | 
			
		||||
            result.code = stream.get();
 | 
			
		||||
            if (options.sourceMap) {
 | 
			
		||||
                result.map = output.source_map.toString();
 | 
			
		||||
                var url = options.sourceMap.url;
 | 
			
		||||
                if (url) {
 | 
			
		||||
                    result.code = result.code.replace(/\n\/\/# sourceMappingURL=\S+\s*$/, "");
 | 
			
		||||
                    if (url == "inline") {
 | 
			
		||||
                        result.code += "\n//# sourceMappingURL=data:application/json;charset=utf-8;base64," + to_base64(result.map);
 | 
			
		||||
                    } else {
 | 
			
		||||
                        result.code += "\n//# sourceMappingURL=" + url;
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (options.nameCache && options.mangle) {
 | 
			
		||||
            if (options.mangle.cache) options.nameCache.vars = to_json(options.mangle.cache);
 | 
			
		||||
            if (options.mangle.properties && options.mangle.properties.cache) {
 | 
			
		||||
                options.nameCache.props = to_json(options.mangle.properties.cache);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        if (timings) {
 | 
			
		||||
            timings.end = Date.now();
 | 
			
		||||
            result.timings = {
 | 
			
		||||
                parse: 1e-3 * (timings.rename - timings.parse),
 | 
			
		||||
                rename: 1e-3 * (timings.compress - timings.rename),
 | 
			
		||||
                compress: 1e-3 * (timings.scope - timings.compress),
 | 
			
		||||
                scope: 1e-3 * (timings.mangle - timings.scope),
 | 
			
		||||
                mangle: 1e-3 * (timings.properties - timings.mangle),
 | 
			
		||||
                properties: 1e-3 * (timings.output - timings.properties),
 | 
			
		||||
                output: 1e-3 * (timings.end - timings.output),
 | 
			
		||||
                total: 1e-3 * (timings.end - timings.start)
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
        if (warnings.length) {
 | 
			
		||||
            result.warnings = warnings;
 | 
			
		||||
        }
 | 
			
		||||
        return result;
 | 
			
		||||
    } catch (ex) {
 | 
			
		||||
        return { error: ex };
 | 
			
		||||
    } finally {
 | 
			
		||||
        AST_Node.log_function();
 | 
			
		||||
        AST_Node.disable_validation();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1310
									
								
								app/node_modules/uglify-js/lib/mozilla-ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1310
									
								
								app/node_modules/uglify-js/lib/mozilla-ast.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										1956
									
								
								app/node_modules/uglify-js/lib/output.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										1956
									
								
								app/node_modules/uglify-js/lib/output.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										2585
									
								
								app/node_modules/uglify-js/lib/parse.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2585
									
								
								app/node_modules/uglify-js/lib/parse.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										328
									
								
								app/node_modules/uglify-js/lib/propmangle.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										328
									
								
								app/node_modules/uglify-js/lib/propmangle.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,328 @@
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 | 
			
		||||
  A JavaScript tokenizer / parser / beautifier / compressor.
 | 
			
		||||
  https://github.com/mishoo/UglifyJS
 | 
			
		||||
 | 
			
		||||
  -------------------------------- (C) ---------------------------------
 | 
			
		||||
 | 
			
		||||
                           Author: Mihai Bazon
 | 
			
		||||
                         <mihai.bazon@gmail.com>
 | 
			
		||||
                       http://mihai.bazon.net/blog
 | 
			
		||||
 | 
			
		||||
  Distributed under the BSD license:
 | 
			
		||||
 | 
			
		||||
    Copyright 2012 (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
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
 | 
			
		||||
 | 
			
		||||
 ***********************************************************************/
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
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 (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(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);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function mangle_properties(ast, options) {
 | 
			
		||||
    options = defaults(options, {
 | 
			
		||||
        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 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;
 | 
			
		||||
 | 
			
		||||
    // 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.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: 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);
 | 
			
		||||
        }
 | 
			
		||||
    }));
 | 
			
		||||
 | 
			
		||||
    // only function declarations after this line
 | 
			
		||||
 | 
			
		||||
    function can_mangle(name) {
 | 
			
		||||
        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 (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)) names_to_mangle.set(name, true);
 | 
			
		||||
        if (!should_mangle(name)) unmangleable.set(name, true);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function mangle(name) {
 | 
			
		||||
        if (!should_mangle(name)) return name;
 | 
			
		||||
        var mangled = cache.get(name);
 | 
			
		||||
        if (!mangled) {
 | 
			
		||||
            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));
 | 
			
		||||
            if (/^#/.test(name)) mangled = "#" + mangled;
 | 
			
		||||
            cache.set(name, mangled);
 | 
			
		||||
        }
 | 
			
		||||
        AST_Node.info("Mapping property {name} to {mangled}", {
 | 
			
		||||
            mangled: mangled,
 | 
			
		||||
            name: name,
 | 
			
		||||
        });
 | 
			
		||||
        return mangled;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function mangleStrings(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);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										866
									
								
								app/node_modules/uglify-js/lib/scope.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										866
									
								
								app/node_modules/uglify-js/lib/scope.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,866 @@
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 | 
			
		||||
  A JavaScript tokenizer / parser / beautifier / compressor.
 | 
			
		||||
  https://github.com/mishoo/UglifyJS
 | 
			
		||||
 | 
			
		||||
  -------------------------------- (C) ---------------------------------
 | 
			
		||||
 | 
			
		||||
                           Author: Mihai Bazon
 | 
			
		||||
                         <mihai.bazon@gmail.com>
 | 
			
		||||
                       http://mihai.bazon.net/blog
 | 
			
		||||
 | 
			
		||||
  Distributed under the BSD license:
 | 
			
		||||
 | 
			
		||||
    Copyright 2012 (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
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
 | 
			
		||||
 | 
			
		||||
 ***********************************************************************/
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
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.references = [];
 | 
			
		||||
    this.replaced = 0;
 | 
			
		||||
    this.safe_ids = undefined;
 | 
			
		||||
    this.scope = scope;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
SymbolDef.prototype = {
 | 
			
		||||
    forEach: function(fn) {
 | 
			
		||||
        this.orig.forEach(fn);
 | 
			
		||||
        this.references.forEach(fn);
 | 
			
		||||
    },
 | 
			
		||||
    mangle: function(options) {
 | 
			
		||||
        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.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;
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
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, {
 | 
			
		||||
        cache: null,
 | 
			
		||||
        ie: false,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // pass 1: setup scope chaining and handle definitions
 | 
			
		||||
    var self = this;
 | 
			
		||||
    var defun = null;
 | 
			
		||||
    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();
 | 
			
		||||
            exported = save_exported;
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
        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_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) {
 | 
			
		||||
            var s = scope;
 | 
			
		||||
            do {
 | 
			
		||||
                s = s.resolve();
 | 
			
		||||
                if (s.uses_with) break;
 | 
			
		||||
                s.uses_with = true;
 | 
			
		||||
            } 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_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;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        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
 | 
			
		||||
    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) {
 | 
			
		||||
            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) {
 | 
			
		||||
                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;
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            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 (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);
 | 
			
		||||
 | 
			
		||||
    // 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);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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_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;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
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_Symbol.DEFMETHOD("mark_enclosed", function(options) {
 | 
			
		||||
    var def = this.definition();
 | 
			
		||||
    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;
 | 
			
		||||
    }
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
AST_Symbol.DEFMETHOD("reference", function(options) {
 | 
			
		||||
    this.definition().references.push(this);
 | 
			
		||||
    this.mark_enclosed(options);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
AST_BlockScope.DEFMETHOD("find_variable", function(name) {
 | 
			
		||||
    return this.variables.get(name)
 | 
			
		||||
        || this.parent_scope && this.parent_scope.find_variable(name);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
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_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;
 | 
			
		||||
    }
 | 
			
		||||
    return symbol.thedef = def;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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) {
 | 
			
		||||
        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_Symbol.DEFMETHOD("unmangleable", function(options) {
 | 
			
		||||
    var def = this.definition();
 | 
			
		||||
    return !def || def.unmangleable(options);
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
// labels are always mangleable
 | 
			
		||||
AST_Label.DEFMETHOD("unmangleable", return_false);
 | 
			
		||||
 | 
			
		||||
AST_Symbol.DEFMETHOD("definition", function() {
 | 
			
		||||
    return this.thedef;
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function _default_mangler_options(options) {
 | 
			
		||||
    options = defaults(options, {
 | 
			
		||||
        eval        : false,
 | 
			
		||||
        ie          : false,
 | 
			
		||||
        keep_fargs  : false,
 | 
			
		||||
        keep_fnames : false,
 | 
			
		||||
        reserved    : [],
 | 
			
		||||
        toplevel    : false,
 | 
			
		||||
        v8          : false,
 | 
			
		||||
        webkit      : false,
 | 
			
		||||
    });
 | 
			
		||||
    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 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);
 | 
			
		||||
            });
 | 
			
		||||
            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 (RESERVED_WORDS[name]);
 | 
			
		||||
            node.mangled_name = name;
 | 
			
		||||
            return true;
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
    this.walk(tw);
 | 
			
		||||
    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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    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("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 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() {
 | 
			
		||||
        chars = null;
 | 
			
		||||
        frequency = Object.create(freq);
 | 
			
		||||
    }
 | 
			
		||||
    base54.consider = function(str, delta) {
 | 
			
		||||
        for (var i = str.length; --i >= 0;) {
 | 
			
		||||
            frequency[str[i]] += delta;
 | 
			
		||||
        }
 | 
			
		||||
    };
 | 
			
		||||
    function compare(a, b) {
 | 
			
		||||
        return frequency[b] - frequency[a];
 | 
			
		||||
    }
 | 
			
		||||
    base54.sort = function() {
 | 
			
		||||
        chars = leading.sort(compare).concat(digits).sort(compare);
 | 
			
		||||
    };
 | 
			
		||||
    base54.reset = reset;
 | 
			
		||||
    reset();
 | 
			
		||||
    function base54(num) {
 | 
			
		||||
        var ret = leading[num % 54];
 | 
			
		||||
        for (num = Math.floor(num / 54); --num >= 0; num >>= 6) {
 | 
			
		||||
            ret += chars[num & 0x3F];
 | 
			
		||||
        }
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
    return base54;
 | 
			
		||||
})();
 | 
			
		||||
							
								
								
									
										195
									
								
								app/node_modules/uglify-js/lib/sourcemap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								app/node_modules/uglify-js/lib/sourcemap.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,195 @@
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 | 
			
		||||
  A JavaScript tokenizer / parser / beautifier / compressor.
 | 
			
		||||
  https://github.com/mishoo/UglifyJS
 | 
			
		||||
 | 
			
		||||
  -------------------------------- (C) ---------------------------------
 | 
			
		||||
 | 
			
		||||
                           Author: Mihai Bazon
 | 
			
		||||
                         <mihai.bazon@gmail.com>
 | 
			
		||||
                       http://mihai.bazon.net/blog
 | 
			
		||||
 | 
			
		||||
  Distributed under the BSD license:
 | 
			
		||||
 | 
			
		||||
    Copyright 2012 (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
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
 | 
			
		||||
 | 
			
		||||
 ***********************************************************************/
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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 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: 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;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										250
									
								
								app/node_modules/uglify-js/lib/transform.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										250
									
								
								app/node_modules/uglify-js/lib/transform.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,250 @@
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 | 
			
		||||
  A JavaScript tokenizer / parser / beautifier / compressor.
 | 
			
		||||
  https://github.com/mishoo/UglifyJS
 | 
			
		||||
 | 
			
		||||
  -------------------------------- (C) ---------------------------------
 | 
			
		||||
 | 
			
		||||
                           Author: Mihai Bazon
 | 
			
		||||
                         <mihai.bazon@gmail.com>
 | 
			
		||||
                       http://mihai.bazon.net/blog
 | 
			
		||||
 | 
			
		||||
  Distributed under the BSD license:
 | 
			
		||||
 | 
			
		||||
    Copyright 2012 (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
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
 | 
			
		||||
 | 
			
		||||
 ***********************************************************************/
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
function TreeTransformer(before, after) {
 | 
			
		||||
    TreeWalker.call(this);
 | 
			
		||||
    this.before = before;
 | 
			
		||||
    this.after = after;
 | 
			
		||||
}
 | 
			
		||||
TreeTransformer.prototype = new TreeWalker;
 | 
			
		||||
 | 
			
		||||
(function(DEF) {
 | 
			
		||||
    function do_list(list, tw) {
 | 
			
		||||
        return List(list, function(node) {
 | 
			
		||||
            return node.transform(tw, true);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    DEF(AST_Node, noop);
 | 
			
		||||
    DEF(AST_LabeledStatement, function(self, tw) {
 | 
			
		||||
        self.label = self.label.transform(tw);
 | 
			
		||||
        self.body = self.body.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_SimpleStatement, function(self, tw) {
 | 
			
		||||
        self.body = self.body.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Block, function(self, tw) {
 | 
			
		||||
        self.body = do_list(self.body, 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);
 | 
			
		||||
    });
 | 
			
		||||
    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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_ForEnumeration, function(self, tw) {
 | 
			
		||||
        self.init = self.init.transform(tw);
 | 
			
		||||
        self.object = self.object.transform(tw);
 | 
			
		||||
        self.body = self.body.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_With, function(self, tw) {
 | 
			
		||||
        self.expression = self.expression.transform(tw);
 | 
			
		||||
        self.body = self.body.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Exit, function(self, tw) {
 | 
			
		||||
        if (self.value) self.value = self.value.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_LoopControl, function(self, tw) {
 | 
			
		||||
        if (self.label) self.label = self.label.transform(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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Switch, function(self, tw) {
 | 
			
		||||
        self.expression = self.expression.transform(tw);
 | 
			
		||||
        self.body = do_list(self.body, tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Case, function(self, tw) {
 | 
			
		||||
        self.expression = self.expression.transform(tw);
 | 
			
		||||
        self.body = do_list(self.body, 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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Catch, function(self, tw) {
 | 
			
		||||
        if (self.argname) self.argname = self.argname.transform(tw);
 | 
			
		||||
        self.body = do_list(self.body, tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Definitions, function(self, tw) {
 | 
			
		||||
        self.definitions = do_list(self.definitions, tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_VarDef, function(self, tw) {
 | 
			
		||||
        self.name = self.name.transform(tw);
 | 
			
		||||
        if (self.value) self.value = self.value.transform(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);
 | 
			
		||||
    });
 | 
			
		||||
    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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Sequence, function(self, tw) {
 | 
			
		||||
        self.expressions = do_list(self.expressions, tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Await, function(self, tw) {
 | 
			
		||||
        self.expression = self.expression.transform(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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Spread, function(self, tw) {
 | 
			
		||||
        self.expression = self.expression.transform(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);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Conditional, function(self, tw) {
 | 
			
		||||
        self.condition = self.condition.transform(tw);
 | 
			
		||||
        self.consequent = self.consequent.transform(tw);
 | 
			
		||||
        self.alternative = self.alternative.transform(tw);
 | 
			
		||||
    });
 | 
			
		||||
    DEF(AST_Array, function(self, tw) {
 | 
			
		||||
        self.elements = do_list(self.elements, 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);
 | 
			
		||||
    });
 | 
			
		||||
    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;
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
							
								
								
									
										287
									
								
								app/node_modules/uglify-js/lib/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										287
									
								
								app/node_modules/uglify-js/lib/utils.js
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,287 @@
 | 
			
		||||
/***********************************************************************
 | 
			
		||||
 | 
			
		||||
  A JavaScript tokenizer / parser / beautifier / compressor.
 | 
			
		||||
  https://github.com/mishoo/UglifyJS
 | 
			
		||||
 | 
			
		||||
  -------------------------------- (C) ---------------------------------
 | 
			
		||||
 | 
			
		||||
                           Author: Mihai Bazon
 | 
			
		||||
                         <mihai.bazon@gmail.com>
 | 
			
		||||
                       http://mihai.bazon.net/blog
 | 
			
		||||
 | 
			
		||||
  Distributed under the BSD license:
 | 
			
		||||
 | 
			
		||||
    Copyright 2012 (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
 | 
			
		||||
    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.
 | 
			
		||||
 | 
			
		||||
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER “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 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.
 | 
			
		||||
 | 
			
		||||
 ***********************************************************************/
 | 
			
		||||
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
function characters(str) {
 | 
			
		||||
    return str.split("");
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function member(name, array) {
 | 
			
		||||
    return array.indexOf(name) >= 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function find_if(func, array) {
 | 
			
		||||
    for (var i = array.length; --i >= 0;) if (func(array[i])) return array[i];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
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) {
 | 
			
		||||
    this.message = msg;
 | 
			
		||||
    this.defs = defs;
 | 
			
		||||
}
 | 
			
		||||
DefaultsError.prototype = Object.create(Error.prototype);
 | 
			
		||||
DefaultsError.prototype.constructor = DefaultsError;
 | 
			
		||||
DefaultsError.prototype.name = "DefaultsError";
 | 
			
		||||
configure_error_stack(DefaultsError);
 | 
			
		||||
 | 
			
		||||
function defaults(args, defs, croak) {
 | 
			
		||||
    if (croak) for (var i in args) {
 | 
			
		||||
        if (HOP(args, i) && !HOP(defs, i)) throw new DefaultsError("`" + i + "` is not a supported option", defs);
 | 
			
		||||
    }
 | 
			
		||||
    for (var i in args) {
 | 
			
		||||
        if (HOP(args, i)) defs[i] = args[i];
 | 
			
		||||
    }
 | 
			
		||||
    return defs;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function noop() {}
 | 
			
		||||
function return_false() { return false; }
 | 
			
		||||
function return_true() { return true; }
 | 
			
		||||
function return_this() { return this; }
 | 
			
		||||
function return_null() { return null; }
 | 
			
		||||
 | 
			
		||||
var List = (function() {
 | 
			
		||||
    function List(a, f) {
 | 
			
		||||
        var ret = [];
 | 
			
		||||
        for (var i = 0; i < a.length; i++) {
 | 
			
		||||
            var val = f(a[i], i);
 | 
			
		||||
            if (val === skip) continue;
 | 
			
		||||
            if (val instanceof Splice) {
 | 
			
		||||
                ret.push.apply(ret, val.v);
 | 
			
		||||
            } else {
 | 
			
		||||
                ret.push(val);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return ret;
 | 
			
		||||
    }
 | 
			
		||||
    List.is_op = function(val) {
 | 
			
		||||
        return val === skip || val instanceof Splice;
 | 
			
		||||
    };
 | 
			
		||||
    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) return array.push(el);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function string_template(text, props) {
 | 
			
		||||
    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) {
 | 
			
		||||
    var index = array.indexOf(el);
 | 
			
		||||
    if (index >= 0) array.splice(index, 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function makePredicate(words) {
 | 
			
		||||
    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], i))
 | 
			
		||||
            return false;
 | 
			
		||||
    return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function Dictionary() {
 | 
			
		||||
    this.values = Object.create(null);
 | 
			
		||||
}
 | 
			
		||||
Dictionary.prototype = {
 | 
			
		||||
    set: function(key, val) {
 | 
			
		||||
        if (key == "__proto__") {
 | 
			
		||||
            this.proto_value = val;
 | 
			
		||||
        } else {
 | 
			
		||||
            this.values[key] = val;
 | 
			
		||||
        }
 | 
			
		||||
        return this;
 | 
			
		||||
    },
 | 
			
		||||
    add: function(key, val) {
 | 
			
		||||
        var list = this.get(key);
 | 
			
		||||
        if (list) {
 | 
			
		||||
            list.push(val);
 | 
			
		||||
        } else {
 | 
			
		||||
            this.set(key, [ val ]);
 | 
			
		||||
        }
 | 
			
		||||
        return this;
 | 
			
		||||
    },
 | 
			
		||||
    get: function(key) {
 | 
			
		||||
        return key == "__proto__" ? this.proto_value : this.values[key];
 | 
			
		||||
    },
 | 
			
		||||
    del: function(key) {
 | 
			
		||||
        if (key == "__proto__") {
 | 
			
		||||
            delete this.proto_value;
 | 
			
		||||
        } else {
 | 
			
		||||
            delete this.values[key];
 | 
			
		||||
        }
 | 
			
		||||
        return this;
 | 
			
		||||
    },
 | 
			
		||||
    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);
 | 
			
		||||
        if ("proto_value" in this) f(this.proto_value, "__proto__");
 | 
			
		||||
    },
 | 
			
		||||
    size: function() {
 | 
			
		||||
        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));
 | 
			
		||||
        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() {
 | 
			
		||||
        var obj = {};
 | 
			
		||||
        this.each(function(value, i) {
 | 
			
		||||
            obj["$" + i] = value;
 | 
			
		||||
        });
 | 
			
		||||
        return obj;
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
Dictionary.fromObject = function(obj) {
 | 
			
		||||
    var dict = new Dictionary();
 | 
			
		||||
    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;
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user