"use strict";function DEFNODE(j,a,b,c){4>arguments.length&&(c=AST_Node),a=a?a.split(/\s+/):[];var d=a;c&&c.PROPS&&(a=a.concat(c.PROPS));for(var e="return function AST_"+j+"(props){ if (props) { ",f=a.length;0<=--f;)e+="this."+a[f]+" = props."+a[f]+";";var g=c&&new c;(g&&g.initialize||b&&b.initialize)&&(e+="this.initialize();"),e+="}}";var h=new Function(e)();if(g&&(h.prototype=g,h.BASE=c),c&&c.SUBCLASSES.push(h),h.prototype.CTOR=h,h.PROPS=a||null,h.SELF_PROPS=d,h.SUBCLASSES=[],j&&(h.prototype.TYPE=h.TYPE=j),b)for(f in b)HOP(b,f)&&(/^\$/.test(f)?h[f.substr(1)]=b[f]:h.prototype[f]=b[f]);return h.DEFMETHOD=function(c,a){this.prototype[c]=a},"undefined"!=typeof exports&&(exports["AST_"+j]=h),h}var AST_Token=DEFNODE("Token","type value line col pos endline endcol endpos nlb comments_before comments_after file raw",{},null),AST_Node=DEFNODE("Node","start end",{_clone:function(c){if(c){var d=this.clone();return d.transform(new TreeTransformer(function(b){if(b!==d)return b.clone(!0)}))}return new this.CTOR(this)},clone:function(b){return this._clone(b)},$documentation:"Base class of all AST nodes",$propdoc:{start:"[AST_Token] The first token of this node",end:"[AST_Token] The last token of this node"},_walk:function(b){return b._visit(this)},walk:function(b){return this._walk(b)}},null);AST_Node.warn_function=null,AST_Node.warn=function(c,a){AST_Node.warn_function&&AST_Node.warn_function(string_template(c,a))};var AST_Statement=DEFNODE("Statement",null,{$documentation:"Base class of all statements"}),AST_Debugger=DEFNODE("Debugger",null,{$documentation:"Represents a debugger statement"},AST_Statement),AST_Directive=DEFNODE("Directive","value quote",{$documentation:"Represents a directive, like \"use strict\";",$propdoc:{value:"[string] The value of this directive as a plain string (it's not an AST_String!)",quote:"[string] the original quote character"}},AST_Statement),AST_SimpleStatement=DEFNODE("SimpleStatement","body",{$documentation:"A statement consisting of an expression, i.e. a = 1 + 2",$propdoc:{body:"[AST_Node] an expression node (should not be instanceof AST_Statement)"},_walk:function(b){return b._visit(this,function(){this.body._walk(b)})}},AST_Statement);function walk_body(f,a){var b=f.body;if(b instanceof AST_Node)b._walk(a);else for(var c=0,d=b.length;c SymbolDef for all variables/functions defined in this scope",functions:"[Object/S] like `variables`, but only lists function declarations",uses_with:"[boolean/S] tells whether this scope uses the `with` statement",uses_eval:"[boolean/S] tells whether this scope contains a direct call to the global `eval`",parent_scope:"[AST_Scope?/S] link to the parent scope",enclosed:"[SymbolDef*/S] a list of all symbol definitions that are accessed from this scope or any subscopes",cname:"[integer/S] current index for mangling variables (used internally by the mangler)"},get_defun_scope:function(){for(var b=this;b.is_block_scope();)b=b.parent_scope;return b},clone:function(c){var a=this._clone(c);return this.variables&&(a.variables=this.variables.clone()),this.functions&&(a.functions=this.functions.clone()),this.enclosed&&(a.enclosed=this.enclosed.slice()),a}},AST_Block),AST_Toplevel=DEFNODE("Toplevel","globals",{$documentation:"The toplevel scope",$propdoc:{globals:"[Object/S] a map of name -> SymbolDef for all undeclared names"},wrap_commonjs:function(d){var e=this.body,a="(function(exports){'$ORIG';})(typeof "+d+"=='undefined'?("+d+"={}):"+d+");";return a=parse(a),a=a.transform(new TreeTransformer(function(b){if(b instanceof AST_Directive&&"$ORIG"==b.value)return MAP.splice(e)})),a}},AST_Scope),AST_Expansion=DEFNODE("Expansion","expression",{$documentation:"An expandible argument, such as ...rest, a splat, such as [1,2,...all], or an expansion in a variable declaration, such as var [first, ...rest] = list",$propdoc:{expression:"[AST_Node] the thing to be expanded"},_walk:function(c){var a=this;return c._visit(this,function(){a.expression.walk(c)})}}),AST_Lambda=DEFNODE("Lambda","name argnames uses_arguments is_generator async",{$documentation:"Base class for functions",$propdoc:{name:"[AST_SymbolDeclaration?] the name of this function",argnames:"[AST_SymbolFunarg|AST_Destructuring|AST_Expansion|AST_DefaultAssign*] array of function arguments, destructurings, or expanding arguments",uses_arguments:"[boolean/S] tells whether this function accesses the arguments array",is_generator:"[boolean] is this a generator method",async:"[boolean] is this method async"},args_as_names:function(){for(var c=[],a=0;a b)"},AST_Lambda),AST_Defun=DEFNODE("Defun","inlined",{$documentation:"A function definition"},AST_Lambda),AST_Destructuring=DEFNODE("Destructuring","names is_array",{$documentation:"A destructuring of several names. Used in destructuring assignment and with destructuring function argument names",$propdoc:{names:"[AST_Node*] Array of properties or elements",is_array:"[Boolean] Whether the destructuring represents an object or array"},_walk:function(c){return c._visit(this,function(){this.names.forEach(function(a){a._walk(c)})})},all_symbols:function(){var c=[];return this.walk(new TreeWalker(function(a){a instanceof AST_Symbol&&c.push(a),a instanceof AST_Expansion&&c.push(a.expression)})),c}}),AST_PrefixedTemplateString=DEFNODE("PrefixedTemplateString","template_string prefix",{$documentation:"A templatestring with a prefix, such as String.raw`foobarbaz`",$propdoc:{template_string:"[AST_TemplateString] The template string",prefix:"[AST_SymbolRef|AST_PropAccess] The prefix, which can be a symbol such as `foo` or a dotted expression such as `String.raw`."},_walk:function(b){this.prefix._walk(b),this.template_string._walk(b)}}),AST_TemplateString=DEFNODE("TemplateString","segments",{$documentation:"A template string literal",$propdoc:{segments:"[AST_Node*] One or more segments, starting with AST_TemplateSegment. AST_Node may follow AST_TemplateSegment, but each AST_Node must be followed by AST_TemplateSegment."},_walk:function(c){return c._visit(this,function(){this.segments.forEach(function(a){a._walk(c)})})}}),AST_TemplateSegment=DEFNODE("TemplateSegment","value raw",{$documentation:"A segment of a template string literal",$propdoc:{value:"Content of the segment",raw:"Raw content of the segment"}}),AST_Jump=DEFNODE("Jump",null,{$documentation:"Base class for \u201Cjumps\u201D (for now that's `return`, `throw`, `break` and `continue`)"},AST_Statement),AST_Exit=DEFNODE("Exit","value",{$documentation:"Base class for \u201Cexits\u201D (`return` and `throw`)",$propdoc:{value:"[AST_Node?] the value returned or thrown by this statement; could be null for AST_Return"},_walk:function(b){return b._visit(this,this.value&&function(){this.value._walk(b)})}},AST_Jump),AST_Return=DEFNODE("Return",null,{$documentation:"A `return` statement"},AST_Exit),AST_Throw=DEFNODE("Throw",null,{$documentation:"A `throw` statement"},AST_Exit),AST_LoopControl=DEFNODE("LoopControl","label",{$documentation:"Base class for loop control statements (`break` and `continue`)",$propdoc:{label:"[AST_LabelRef?] the label, or null if none"},_walk:function(b){return b._visit(this,this.label&&function(){this.label._walk(b)})}},AST_Jump),AST_Break=DEFNODE("Break",null,{$documentation:"A `break` statement"},AST_LoopControl),AST_Continue=DEFNODE("Continue",null,{$documentation:"A `continue` statement"},AST_LoopControl),AST_If=DEFNODE("If","condition alternative",{$documentation:"A `if` statement",$propdoc:{condition:"[AST_Node] the `if` condition",alternative:"[AST_Statement?] the `else` part, or null if not present"},_walk:function(b){return b._visit(this,function(){this.condition._walk(b),this.body._walk(b),this.alternative&&this.alternative._walk(b)})}},AST_StatementWithBody),AST_Switch=DEFNODE("Switch","expression",{$documentation:"A `switch` statement",$propdoc:{expression:"[AST_Node] the `switch` \u201Cdiscriminant\u201D"},_walk:function(b){return b._visit(this,function(){this.expression._walk(b),walk_body(this,b)})}},AST_Block),AST_SwitchBranch=DEFNODE("SwitchBranch",null,{$documentation:"Base class for `switch` branches"},AST_Block),AST_Default=DEFNODE("Default",null,{$documentation:"A `default` switch branch"},AST_SwitchBranch),AST_Case=DEFNODE("Case","expression",{$documentation:"A `case` switch branch",$propdoc:{expression:"[AST_Node] the `case` expression"},_walk:function(b){return b._visit(this,function(){this.expression._walk(b),walk_body(this,b)})}},AST_SwitchBranch),AST_Try=DEFNODE("Try","bcatch bfinally",{$documentation:"A `try` statement",$propdoc:{bcatch:"[AST_Catch?] the catch block, or null if not present",bfinally:"[AST_Finally?] the finally block, or null if not present"},_walk:function(b){return b._visit(this,function(){walk_body(this,b),this.bcatch&&this.bcatch._walk(b),this.bfinally&&this.bfinally._walk(b)})}},AST_Block),AST_Catch=DEFNODE("Catch","argname",{$documentation:"A `catch` node; only makes sense as part of a `try` statement",$propdoc:{argname:"[AST_SymbolCatch|AST_Destructuring|AST_Expansion|AST_DefaultAssign] symbol for the exception"},_walk:function(b){return b._visit(this,function(){this.argname._walk(b),walk_body(this,b)})}},AST_Block),AST_Finally=DEFNODE("Finally",null,{$documentation:"A `finally` node; only makes sense as part of a `try` statement"},AST_Block),AST_Definitions=DEFNODE("Definitions","definitions",{$documentation:"Base class for `var` or `const` nodes (variable declarations/initializations)",$propdoc:{definitions:"[AST_VarDef*] array of variable definitions"},_walk:function(e){return e._visit(this,function(){for(var a=this.definitions,b=0,c=a.length;b a`"},AST_Binary),AST_Array=DEFNODE("Array","elements",{$documentation:"An array literal",$propdoc:{elements:"[AST_Node*] array of elements"},_walk:function(e){return e._visit(this,function(){for(var a=this.elements,b=0,c=a.length;b