Skip to content

Instantly share code, notes, and snippets.

@kumavis kumavis/index.js
Created Nov 1, 2014

Embed
What would you like to do?
requirebin sketch
var esprima = require('esprima')
var escodegen = require('escodegen')
var treeify = require('treeify').asTree
var match = require('pattern-match')
var isArray = require('is-array')
// setup registry
var registry = {}
function register(pattern, callback){
if (!registry[pattern.type]) registry[pattern.type] = []
var registered = registry[pattern.type]
registered.push({
pattern: pattern,
callback: callback,
})
}
function convertAst(ast){
var nodes = isArray(ast) ? ast : [ast]
nodes.forEach(function(node){
try {
match(node, function(when) {
var registered = registry[node.type] || []
registered.forEach(function(entry){
when(entry.pattern, entry.callback)
})
})
} catch (err) {
if (err instanceof match.MatchError) {
console.log('no match for pattern:')
console.log(treeify(err.actual, true))
console.log('from registered:')
console.log(treeify(err.expected, true))
} else {
throw err
}
}
})
}
// register signatures
// Program is just a pass through
register({
type: 'Program',
body: match.var('body')
}, function(matched){
convertAst(matched.body)
})
// ExpressionStatement is just a pass through
register({
type: 'ExpressionStatement',
expression: match.var('expression'),
}, function(matched){
convertAst(matched.expression)
})
register({
type: 'CallExpression',
callee: match.var('callee'),
arguments: match.var('arguments'),
}, function(matched){
console.log('call expression!')
convertAst(matched.callee)
convertAst(matched.arguments)
})
register({
type: 'MemberExpression',
object: match.var('object'),
property: match.var('property'),
}, function(matched){
console.log('member expression!')
convertAst(matched.object)
convertAst(matched.property)
})
register({
type: 'BinaryExpression',
operator: match.var('operator'),
left: match.var('left'),
right: match.var('right'),
}, function(matched){
console.log('member expression!')
convertAst(matched.left)
convertAst(matched.right)
})
register({
type: 'Identifier',
name: match.var('name'),
}, function(matched){
console.log('saw variable: "'+matched.name+'"!')
})
register({
type: 'Literal',
value: match.var('value'),
}, function(matched){
console.log('saw literal: "'+matched.value+'"!')
})
// translate src
var src = 'console.log("haay"+" wuurl")'
var ast = esprima.parse(src)
var resrc = escodegen.generate(ast)
convertAst(ast)
// logging
//console.log(src)
//console.log(treeify(ast, true))
//console.log(resrc)
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({esprima:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.esprima={})}})(this,function(exports){"use strict";var Token,TokenName,FnExprTokens,Syntax,PropertyKind,Messages,Regex,SyntaxTreeDelegate,source,strict,index,lineNumber,lineStart,length,delegate,lookahead,state,extra;Token={BooleanLiteral:1,EOF:2,Identifier:3,Keyword:4,NullLiteral:5,NumericLiteral:6,Punctuator:7,StringLiteral:8,RegularExpression:9};TokenName={};TokenName[Token.BooleanLiteral]="Boolean";TokenName[Token.EOF]="<end>";TokenName[Token.Identifier]="Identifier";TokenName[Token.Keyword]="Keyword";TokenName[Token.NullLiteral]="Null";TokenName[Token.NumericLiteral]="Numeric";TokenName[Token.Punctuator]="Punctuator";TokenName[Token.StringLiteral]="String";TokenName[Token.RegularExpression]="RegularExpression";FnExprTokens=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",Identifier:"Identifier",IfStatement:"IfStatement",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement"};PropertyKind={Data:1,Get:2,Set:4};Messages={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedEOS:"Unexpected end of input",NewlineAfterThrow:"Illegal newline after throw",InvalidRegExp:"Invalid regular expression",UnterminatedRegExp:"Invalid regular expression: missing /",InvalidLHSInAssignment:"Invalid left-hand side in assignment",InvalidLHSInForIn:"Invalid left-hand side in for-in",MultipleDefaultsInSwitch:"More than one default clause in switch statement",NoCatchOrFinally:"Missing catch or finally after try",UnknownLabel:"Undefined label '%0'",Redeclaration:"%0 '%1' has already been declared",IllegalContinue:"Illegal continue statement",IllegalBreak:"Illegal break statement",IllegalReturn:"Illegal return statement",StrictModeWith:"Strict mode code may not include a with statement",StrictCatchVariable:"Catch variable may not be eval or arguments in strict mode",StrictVarName:"Variable name may not be eval or arguments in strict mode",StrictParamName:"Parameter name eval or arguments is not allowed in strict mode",StrictParamDupe:"Strict mode function may not have duplicate parameter names",StrictFunctionName:"Function name may not be eval or arguments in strict mode",StrictOctalLiteral:"Octal literals are not allowed in strict mode.",StrictDelete:"Delete of an unqualified identifier in strict mode.",StrictDuplicateProperty:"Duplicate data property in object literal not allowed in strict mode",AccessorDataProperty:"Object literal may not have data and accessor property with the same name",AccessorGetSet:"Object literal may not have multiple get/set accessors with the same name",StrictLHSAssignment:"Assignment to eval or arguments is not allowed in strict mode",StrictLHSPostfix:"Postfix increment/decrement may not have eval or arguments operand in strict mode",StrictLHSPrefix:"Prefix increment/decrement may not have eval or arguments operand in strict mode",StrictReservedWord:"Use of future reserved word in strict mode"};Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function assert(condition,message){if(!condition){throw new Error("ASSERT: "+message)}}function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return"0123456789abcdefABCDEF".indexOf(ch)>=0}function isOctalDigit(ch){return"01234567".indexOf(ch)>=0}function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}function isFutureReservedWord(id){switch(id){case"class":case"enum":case"export":case"extends":case"import":case"super":return true;default:return false}}function isStrictModeReservedWord(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"yield":case"let":return true;default:return false}}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isKeyword(id){if(strict&&isStrictModeReservedWord(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try"||id==="let";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function addComment(type,value,start,end,loc){var comment,attacher;assert(typeof start==="number","Comment must have valid position");if(state.lastCommentStart>=start){return}state.lastCommentStart=start;comment={type:type,value:value};if(extra.range){comment.range=[start,end]}if(extra.loc){comment.loc=loc}extra.comments.push(comment);if(extra.attachComment){extra.leadingComments.push(comment);extra.trailingComments.push(comment)}}function skipSingleLineComment(offset){var start,loc,ch,comment;start=index-offset;loc={start:{line:lineNumber,column:index-lineStart-offset}};while(index<length){ch=source.charCodeAt(index);++index;if(isLineTerminator(ch)){if(extra.comments){comment=source.slice(start+offset,index-1);loc.end={line:lineNumber,column:index-lineStart-1};addComment("Line",comment,start,index-1,loc)}if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index;return}}if(extra.comments){comment=source.slice(start+offset,index);loc.end={line:lineNumber,column:index-lineStart};addComment("Line",comment,start,index,loc)}}function skipMultiLineComment(){var start,loc,ch,comment;if(extra.comments){start=index-2;loc={start:{line:lineNumber,column:index-lineStart-2}}}while(index<length){ch=source.charCodeAt(index);if(isLineTerminator(ch)){if(ch===13&&source.charCodeAt(index+1)===10){++index}++lineNumber;++index;lineStart=index;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}else if(ch===42){if(source.charCodeAt(index+1)===47){++index;++index;if(extra.comments){comment=source.slice(start+2,index-2);loc.end={line:lineNumber,column:index-lineStart};addComment("Block",comment,start,index,loc)}return}++index}else{++index}}throwError({},Messages.UnexpectedToken,"ILLEGAL")}function skipComment(){var ch,start;start=index===0;while(index<length){ch=source.charCodeAt(index);if(isWhiteSpace(ch)){++index}else if(isLineTerminator(ch)){++index;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index;start=true}else if(ch===47){ch=source.charCodeAt(index+1);if(ch===47){++index;++index;skipSingleLineComment(2);start=true}else if(ch===42){++index;++index;skipMultiLineComment()}else{break}}else if(start&&ch===45){if(source.charCodeAt(index+1)===45&&source.charCodeAt(index+2)===62){index+=3;skipSingleLineComment(3)}else{break}}else if(ch===60){if(source.slice(index+1,index+4)==="!--"){++index;++index;++index;++index;skipSingleLineComment(4)}else{break}}else{break}}}function scanHexEscape(prefix){var i,len,ch,code=0;len=prefix==="u"?4:2;for(i=0;i<len;++i){if(index<length&&isHexDigit(source[index])){ch=source[index++];code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}else{return""}}return String.fromCharCode(code)}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);if(ch===92){if(source.charCodeAt(index)!==117){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierStart(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}id=ch}while(index<length){ch=source.charCodeAt(index);if(!isIdentifierPart(ch)){break}++index;id+=String.fromCharCode(ch);if(ch===92){id=id.substr(0,id.length-1);if(source.charCodeAt(index)!==117){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierPart(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}id+=ch}}return id}function getIdentifier(){var start,ch;start=index++;while(index<length){ch=source.charCodeAt(index);if(ch===92){index=start;return getEscapedIdentifier()}if(isIdentifierPart(ch)){++index}else{break}}return source.slice(start,index)}function scanIdentifier(){var start,id,type;start=index;id=source.charCodeAt(index)===92?getEscapedIdentifier():getIdentifier();if(id.length===1){type=Token.Identifier}else if(isKeyword(id)){type=Token.Keyword}else if(id==="null"){type=Token.NullLiteral}else if(id==="true"||id==="false"){type=Token.BooleanLiteral}else{type=Token.Identifier}return{type:type,value:id,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanPunctuator(){var start=index,code=source.charCodeAt(index),code2,ch1=source[index],ch2,ch3,ch4;switch(code){case 46:case 40:case 41:case 59:case 44:case 123:case 125:case 91:case 93:case 58:case 63:case 126:++index;if(extra.tokenize){if(code===40){extra.openParenToken=extra.tokens.length}else if(code===123){extra.openCurlyToken=extra.tokens.length}}return{type:Token.Punctuator,value:String.fromCharCode(code),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};default:code2=source.charCodeAt(index+1);if(code2===61){switch(code){case 43:case 45:case 47:case 60:case 62:case 94:case 124:case 37:case 38:case 42:index+=2;return{type:Token.Punctuator,value:String.fromCharCode(code)+String.fromCharCode(code2),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index};case 33:case 61:index+=2;if(source.charCodeAt(index)===61){++index}return{type:Token.Punctuator,value:source.slice(start,index),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}}}ch4=source.substr(index,4);if(ch4===">>>="){index+=4;return{type:Token.Punctuator,value:ch4,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}ch3=ch4.substr(0,3);if(ch3===">>>"||ch3==="<<="||ch3===">>="){index+=3;return{type:Token.Punctuator,value:ch3,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}ch2=ch3.substr(0,2);if(ch1===ch2[1]&&"+-<>&|".indexOf(ch1)>=0||ch2==="=>"){index+=2;return{type:Token.Punctuator,value:ch2,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}if("<>=!+-*%&|^/".indexOf(ch1)>=0){++index;return{type:Token.Punctuator,value:ch1,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}throwError({},Messages.UnexpectedToken,"ILLEGAL")}function scanHexLiteral(start){var number="";while(index<length){if(!isHexDigit(source[index])){break}number+=source[index++]}if(number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(isIdentifierStart(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseInt("0x"+number,16),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanOctalLiteral(start){var number="0"+source[index++];while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:true,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanNumericLiteral(){var number,start,ch;ch=source[index];assert(isDecimalDigit(ch.charCodeAt(0))||ch===".","Numeric literal must start with a decimal digit or a decimal point");start=index;number="";if(ch!=="."){number=source[index++];ch=source[index];if(number==="0"){if(ch==="x"||ch==="X"){++index;return scanHexLiteral(start)}if(isOctalDigit(ch)){return scanOctalLiteral(start)}if(ch&&isDecimalDigit(ch.charCodeAt(0))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="."){number+=source[index++];while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}ch=source[index]}if(ch==="e"||ch==="E"){number+=source[index++];ch=source[index];if(ch==="+"||ch==="-"){number+=source[index++]}if(isDecimalDigit(source.charCodeAt(index))){while(isDecimalDigit(source.charCodeAt(index))){number+=source[index++]}}else{throwError({},Messages.UnexpectedToken,"ILLEGAL")}}if(isIdentifierStart(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseFloat(number),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanStringLiteral(){var str="",quote,start,ch,code,unescaped,restore,octal=false,startLineNumber,startLineStart;startLineNumber=lineNumber;startLineStart=lineStart;quote=source[index];assert(quote==="'"||quote==='"',"String literal must starts with a quote");start=index;++index;while(index<length){ch=source[index++];if(ch===quote){quote="";break}else if(ch==="\\"){ch=source[index++];if(!ch||!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"u":case"x":restore=index;unescaped=scanHexEscape(ch);if(unescaped){str+=unescaped}else{index=restore;str+=ch}break;case"n":str+="\n";break;case"r":str+="\r";break;case"t":str+=" ";break;case"b":str+="\b";break;case"f":str+="\f";break;case"v":str+=" ";break;default:if(isOctalDigit(ch)){code="01234567".indexOf(ch);if(code!==0){octal=true}if(index<length&&isOctalDigit(source[index])){octal=true;code=code*8+"01234567".indexOf(source[index++]);if("0123".indexOf(ch)>=0&&index<length&&isOctalDigit(source[index])){code=code*8+"01234567".indexOf(source[index++])}}str+=String.fromCharCode(code)}else{str+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){break}else{str+=ch}}if(quote!==""){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.StringLiteral,value:str,octal:octal,startLineNumber:startLineNumber,startLineStart:startLineStart,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function testRegExp(pattern,flags){var value;try{value=new RegExp(pattern,flags)}catch(e){throwError({},Messages.InvalidRegExp)}return value}function scanRegExpBody(){var ch,str,classMarker,terminated,body;ch=source[index];assert(ch==="/","Regular expression literal must start with a slash");str=source[index++];classMarker=false;terminated=false;while(index<length){ch=source[index++];str+=ch;if(ch==="\\"){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}str+=ch}else if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}else if(classMarker){if(ch==="]"){classMarker=false}}else{if(ch==="/"){terminated=true;break}else if(ch==="["){classMarker=true}}}if(!terminated){throwError({},Messages.UnterminatedRegExp)}body=str.substr(1,str.length-2);return{value:body,literal:str}}function scanRegExpFlags(){var ch,str,flags,restore;str="";flags="";while(index<length){ch=source[index];if(!isIdentifierPart(ch.charCodeAt(0))){break}++index;if(ch==="\\"&&index<length){ch=source[index];if(ch==="u"){++index;restore=index;ch=scanHexEscape("u");if(ch){flags+=ch;for(str+="\\u";restore<index;++restore){str+=source[restore]}}else{index=restore;flags+="u";str+="\\u"}throwErrorTolerant({},Messages.UnexpectedToken,"ILLEGAL")}else{str+="\\";throwErrorTolerant({},Messages.UnexpectedToken,"ILLEGAL")}}else{flags+=ch;str+=ch}}return{value:flags,literal:str}}function scanRegExp(){var start,body,flags,pattern,value;lookahead=null;skipComment();start=index;body=scanRegExpBody();flags=scanRegExpFlags();value=testRegExp(body.value,flags.value);if(extra.tokenize){return{type:Token.RegularExpression,value:value,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}return{literal:body.literal+flags.literal,value:value,start:start,end:index}}function collectRegex(){var pos,loc,regex,token;skipComment();pos=index;loc={start:{line:lineNumber,column:index-lineStart}};regex=scanRegExp();loc.end={line:lineNumber,column:index-lineStart};if(!extra.tokenize){if(extra.tokens.length>0){token=extra.tokens[extra.tokens.length-1];if(token.range[0]===pos&&token.type==="Punctuator"){if(token.value==="/"||token.value==="/="){extra.tokens.pop()}}}extra.tokens.push({type:"RegularExpression",value:regex.literal,range:[pos,index],loc:loc})}return regex}function isIdentifierName(token){return token.type===Token.Identifier||token.type===Token.Keyword||token.type===Token.BooleanLiteral||token.type===Token.NullLiteral}function advanceSlash(){var prevToken,checkToken;prevToken=extra.tokens[extra.tokens.length-1];if(!prevToken){return collectRegex()}if(prevToken.type==="Punctuator"){if(prevToken.value==="]"){return scanPunctuator()}if(prevToken.value===")"){checkToken=extra.tokens[extra.openParenToken-1];if(checkToken&&checkToken.type==="Keyword"&&(checkToken.value==="if"||checkToken.value==="while"||checkToken.value==="for"||checkToken.value==="with")){return collectRegex()}return scanPunctuator()}if(prevToken.value==="}"){if(extra.tokens[extra.openCurlyToken-3]&&extra.tokens[extra.openCurlyToken-3].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-4];if(!checkToken){return scanPunctuator()}}else if(extra.tokens[extra.openCurlyToken-4]&&extra.tokens[extra.openCurlyToken-4].type==="Keyword"){checkToken=extra.tokens[extra.openCurlyToken-5];if(!checkToken){return collectRegex()}}else{return scanPunctuator()}if(FnExprTokens.indexOf(checkToken.value)>=0){return scanPunctuator()}return collectRegex()}return collectRegex()}if(prevToken.type==="Keyword"){return collectRegex()}return scanPunctuator()}function advance(){var ch;skipComment();if(index>=length){return{type:Token.EOF,lineNumber:lineNumber,lineStart:lineStart,start:index,end:index}}ch=source.charCodeAt(index);if(isIdentifierStart(ch)){return scanIdentifier()}if(ch===40||ch===41||ch===59){return scanPunctuator()}if(ch===39||ch===34){return scanStringLiteral()}if(ch===46){if(isDecimalDigit(source.charCodeAt(index+1))){return scanNumericLiteral()}return scanPunctuator()}if(isDecimalDigit(ch)){return scanNumericLiteral()}if(extra.tokenize&&ch===47){return advanceSlash()}return scanPunctuator()}function collectToken(){var loc,token,range,value;skipComment();loc={start:{line:lineNumber,column:index-lineStart}};token=advance();loc.end={line:lineNumber,column:index-lineStart};if(token.type!==Token.EOF){value=source.slice(token.start,token.end);extra.tokens.push({type:TokenName[token.type],value:value,range:[token.start,token.end],loc:loc})}return token}function lex(){var token;token=lookahead;index=token.end;lineNumber=token.lineNumber;lineStart=token.lineStart;lookahead=typeof extra.tokens!=="undefined"?collectToken():advance();index=token.end;lineNumber=token.lineNumber;lineStart=token.lineStart;return token}function peek(){var pos,line,start;pos=index;line=lineNumber;start=lineStart;lookahead=typeof extra.tokens!=="undefined"?collectToken():advance();index=pos;lineNumber=line;lineStart=start}function Position(line,column){this.line=line;this.column=column}function SourceLocation(startLine,startColumn,line,column){this.start=new Position(startLine,startColumn);this.end=new Position(line,column)}SyntaxTreeDelegate={name:"SyntaxTree",processComment:function(node){var lastChild,trailingComments;if(node.type===Syntax.Program){if(node.body.length>0){return}}if(extra.trailingComments.length>0){if(extra.trailingComments[0].range[0]>=node.range[1]){trailingComments=extra.trailingComments;extra.trailingComments=[]}else{extra.trailingComments.length=0}}else{if(extra.bottomRightStack.length>0&&extra.bottomRightStack[extra.bottomRightStack.length-1].trailingComments&&extra.bottomRightStack[extra.bottomRightStack.length-1].trailingComments[0].range[0]>=node.range[1]){trailingComments=extra.bottomRightStack[extra.bottomRightStack.length-1].trailingComments;delete extra.bottomRightStack[extra.bottomRightStack.length-1].trailingComments}}while(extra.bottomRightStack.length>0&&extra.bottomRightStack[extra.bottomRightStack.length-1].range[0]>=node.range[0]){lastChild=extra.bottomRightStack.pop()}if(lastChild){if(lastChild.leadingComments&&lastChild.leadingComments[lastChild.leadingComments.length-1].range[1]<=node.range[0]){node.leadingComments=lastChild.leadingComments;delete lastChild.leadingComments}}else if(extra.leadingComments.length>0&&extra.leadingComments[extra.leadingComments.length-1].range[1]<=node.range[0]){node.leadingComments=extra.leadingComments;extra.leadingComments=[]}if(trailingComments){node.trailingComments=trailingComments}extra.bottomRightStack.push(node)},markEnd:function(node,startToken){if(extra.range){node.range=[startToken.start,index]}if(extra.loc){node.loc=new SourceLocation(startToken.startLineNumber===undefined?startToken.lineNumber:startToken.startLineNumber,startToken.start-(startToken.startLineStart===undefined?startToken.lineStart:startToken.startLineStart),lineNumber,index-lineStart);this.postProcess(node)}if(extra.attachComment){this.processComment(node)}return node},postProcess:function(node){if(extra.source){node.loc.source=extra.source}return node},createArrayExpression:function(elements){return{type:Syntax.ArrayExpression,elements:elements}},createAssignmentExpression:function(operator,left,right){return{type:Syntax.AssignmentExpression,operator:operator,left:left,right:right}},createBinaryExpression:function(operator,left,right){var type=operator==="||"||operator==="&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;return{type:type,operator:operator,left:left,right:right}},createBlockStatement:function(body){return{type:Syntax.BlockStatement,body:body}},createBreakStatement:function(label){return{type:Syntax.BreakStatement,label:label}},createCallExpression:function(callee,args){return{type:Syntax.CallExpression,callee:callee,arguments:args}},createCatchClause:function(param,body){return{type:Syntax.CatchClause,param:param,body:body}},createConditionalExpression:function(test,consequent,alternate){return{type:Syntax.ConditionalExpression,test:test,consequent:consequent,alternate:alternate}},createContinueStatement:function(label){return{type:Syntax.ContinueStatement,label:label}},createDebuggerStatement:function(){return{type:Syntax.DebuggerStatement}},createDoWhileStatement:function(body,test){return{type:Syntax.DoWhileStatement,body:body,test:test}},createEmptyStatement:function(){return{type:Syntax.EmptyStatement}},createExpressionStatement:function(expression){return{type:Syntax.ExpressionStatement,expression:expression}},createForStatement:function(init,test,update,body){return{type:Syntax.ForStatement,init:init,test:test,update:update,body:body}},createForInStatement:function(left,right,body){return{type:Syntax.ForInStatement,left:left,right:right,body:body,each:false}},createFunctionDeclaration:function(id,params,defaults,body){return{type:Syntax.FunctionDeclaration,id:id,params:params,defaults:defaults,body:body,rest:null,generator:false,expression:false}},createFunctionExpression:function(id,params,defaults,body){return{type:Syntax.FunctionExpression,id:id,params:params,defaults:defaults,body:body,rest:null,generator:false,expression:false}},createIdentifier:function(name){return{type:Syntax.Identifier,name:name}},createIfStatement:function(test,consequent,alternate){return{type:Syntax.IfStatement,test:test,consequent:consequent,alternate:alternate}},createLabeledStatement:function(label,body){return{type:Syntax.LabeledStatement,label:label,body:body}},createLiteral:function(token){return{type:Syntax.Literal,value:token.value,raw:source.slice(token.start,token.end)}},createMemberExpression:function(accessor,object,property){return{type:Syntax.MemberExpression,computed:accessor==="[",object:object,property:property}},createNewExpression:function(callee,args){return{type:Syntax.NewExpression,callee:callee,arguments:args}},createObjectExpression:function(properties){return{type:Syntax.ObjectExpression,properties:properties}},createPostfixExpression:function(operator,argument){return{type:Syntax.UpdateExpression,operator:operator,argument:argument,prefix:false}},createProgram:function(body){return{type:Syntax.Program,body:body}},createProperty:function(kind,key,value){return{type:Syntax.Property,key:key,value:value,kind:kind}},createReturnStatement:function(argument){return{type:Syntax.ReturnStatement,argument:argument}},createSequenceExpression:function(expressions){return{type:Syntax.SequenceExpression,expressions:expressions}},createSwitchCase:function(test,consequent){return{type:Syntax.SwitchCase,test:test,consequent:consequent}},createSwitchStatement:function(discriminant,cases){return{type:Syntax.SwitchStatement,discriminant:discriminant,cases:cases}},createThisExpression:function(){return{type:Syntax.ThisExpression}},createThrowStatement:function(argument){return{type:Syntax.ThrowStatement,argument:argument}},createTryStatement:function(block,guardedHandlers,handlers,finalizer){return{type:Syntax.TryStatement,block:block,guardedHandlers:guardedHandlers,handlers:handlers,finalizer:finalizer}},createUnaryExpression:function(operator,argument){if(operator==="++"||operator==="--"){return{type:Syntax.UpdateExpression,operator:operator,argument:argument,prefix:true}}return{type:Syntax.UnaryExpression,operator:operator,argument:argument,prefix:true}},createVariableDeclaration:function(declarations,kind){return{type:Syntax.VariableDeclaration,declarations:declarations,kind:kind}},createVariableDeclarator:function(id,init){return{type:Syntax.VariableDeclarator,id:id,init:init}},createWhileStatement:function(test,body){return{type:Syntax.WhileStatement,test:test,body:body}},createWithStatement:function(object,body){return{type:Syntax.WithStatement,object:object,body:body}}};function peekLineTerminator(){var pos,line,start,found;pos=index;line=lineNumber;start=lineStart;skipComment();found=lineNumber!==line;index=pos;lineNumber=line;lineStart=start;return found}function throwError(token,messageFormat){var error,args=Array.prototype.slice.call(arguments,2),msg=messageFormat.replace(/%(\d)/g,function(whole,index){assert(index<args.length,"Message reference must be in range");return args[index]});if(typeof token.lineNumber==="number"){error=new Error("Line "+token.lineNumber+": "+msg);error.index=token.start;error.lineNumber=token.lineNumber;error.column=token.start-lineStart+1}else{error=new Error("Line "+lineNumber+": "+msg);error.index=index;error.lineNumber=lineNumber;error.column=index-lineStart+1}error.description=msg;throw error}function throwErrorTolerant(){try{throwError.apply(null,arguments)}catch(e){if(extra.errors){extra.errors.push(e)}else{throw e}}}function throwUnexpected(token){if(token.type===Token.EOF){throwError(token,Messages.UnexpectedEOS)}if(token.type===Token.NumericLiteral){throwError(token,Messages.UnexpectedNumber)}if(token.type===Token.StringLiteral){throwError(token,Messages.UnexpectedString)}if(token.type===Token.Identifier){throwError(token,Messages.UnexpectedIdentifier)}if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){throwError(token,Messages.UnexpectedReserved)}else if(strict&&isStrictModeReservedWord(token.value)){throwErrorTolerant(token,Messages.StrictReservedWord);return}throwError(token,Messages.UnexpectedToken,token.value)}throwError(token,Messages.UnexpectedToken,token.value)}function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpected(token)
}}function expectKeyword(keyword){var token=lex();if(token.type!==Token.Keyword||token.value!==keyword){throwUnexpected(token)}}function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value}function matchKeyword(keyword){return lookahead.type===Token.Keyword&&lookahead.value===keyword}function matchAssign(){var op;if(lookahead.type!==Token.Punctuator){return false}op=lookahead.value;return op==="="||op==="*="||op==="/="||op==="%="||op==="+="||op==="-="||op==="<<="||op===">>="||op===">>>="||op==="&="||op==="^="||op==="|="}function consumeSemicolon(){var line;if(source.charCodeAt(index)===59||match(";")){lex();return}line=lineNumber;skipComment();if(lineNumber!==line){return}if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpected(lookahead)}}function isLeftHandSide(expr){return expr.type===Syntax.Identifier||expr.type===Syntax.MemberExpression}function parseArrayInitialiser(){var elements=[],startToken;startToken=lookahead;expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)}else{elements.push(parseAssignmentExpression());if(!match("]")){expect(",")}}}lex();return delegate.markEnd(delegate.createArrayExpression(elements),startToken)}function parsePropertyFunction(param,first){var previousStrict,body,startToken;previousStrict=strict;startToken=lookahead;body=parseFunctionSourceElements();if(first&&strict&&isRestrictedWord(param[0].name)){throwErrorTolerant(first,Messages.StrictParamName)}strict=previousStrict;return delegate.markEnd(delegate.createFunctionExpression(null,param,[],body),startToken)}function parseObjectPropertyKey(){var token,startToken;startToken=lookahead;token=lex();if(token.type===Token.StringLiteral||token.type===Token.NumericLiteral){if(strict&&token.octal){throwErrorTolerant(token,Messages.StrictOctalLiteral)}return delegate.markEnd(delegate.createLiteral(token),startToken)}return delegate.markEnd(delegate.createIdentifier(token.value),startToken)}function parseObjectProperty(){var token,key,id,value,param,startToken;token=lookahead;startToken=lookahead;if(token.type===Token.Identifier){id=parseObjectPropertyKey();if(token.value==="get"&&!match(":")){key=parseObjectPropertyKey();expect("(");expect(")");value=parsePropertyFunction([]);return delegate.markEnd(delegate.createProperty("get",key,value),startToken)}if(token.value==="set"&&!match(":")){key=parseObjectPropertyKey();expect("(");token=lookahead;if(token.type!==Token.Identifier){expect(")");throwErrorTolerant(token,Messages.UnexpectedToken,token.value);value=parsePropertyFunction([])}else{param=[parseVariableIdentifier()];expect(")");value=parsePropertyFunction(param,token)}return delegate.markEnd(delegate.createProperty("set",key,value),startToken)}expect(":");value=parseAssignmentExpression();return delegate.markEnd(delegate.createProperty("init",id,value),startToken)}if(token.type===Token.EOF||token.type===Token.Punctuator){throwUnexpected(token)}else{key=parseObjectPropertyKey();expect(":");value=parseAssignmentExpression();return delegate.markEnd(delegate.createProperty("init",key,value),startToken)}}function parseObjectInitialiser(){var properties=[],property,name,key,kind,map={},toString=String,startToken;startToken=lookahead;expect("{");while(!match("}")){property=parseObjectProperty();if(property.key.type===Syntax.Identifier){name=property.key.name}else{name=toString(property.key.value)}kind=property.kind==="init"?PropertyKind.Data:property.kind==="get"?PropertyKind.Get:PropertyKind.Set;key="$"+name;if(Object.prototype.hasOwnProperty.call(map,key)){if(map[key]===PropertyKind.Data){if(strict&&kind===PropertyKind.Data){throwErrorTolerant({},Messages.StrictDuplicateProperty)}else if(kind!==PropertyKind.Data){throwErrorTolerant({},Messages.AccessorDataProperty)}}else{if(kind===PropertyKind.Data){throwErrorTolerant({},Messages.AccessorDataProperty)}else if(map[key]&kind){throwErrorTolerant({},Messages.AccessorGetSet)}}map[key]|=kind}else{map[key]=kind}properties.push(property);if(!match("}")){expect(",")}}expect("}");return delegate.markEnd(delegate.createObjectExpression(properties),startToken)}function parseGroupExpression(){var expr;expect("(");expr=parseExpression();expect(")");return expr}function parsePrimaryExpression(){var type,token,expr,startToken;if(match("(")){return parseGroupExpression()}if(match("[")){return parseArrayInitialiser()}if(match("{")){return parseObjectInitialiser()}type=lookahead.type;startToken=lookahead;if(type===Token.Identifier){expr=delegate.createIdentifier(lex().value)}else if(type===Token.StringLiteral||type===Token.NumericLiteral){if(strict&&lookahead.octal){throwErrorTolerant(lookahead,Messages.StrictOctalLiteral)}expr=delegate.createLiteral(lex())}else if(type===Token.Keyword){if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("this")){lex();expr=delegate.createThisExpression()}else{throwUnexpected(lex())}}else if(type===Token.BooleanLiteral){token=lex();token.value=token.value==="true";expr=delegate.createLiteral(token)}else if(type===Token.NullLiteral){token=lex();token.value=null;expr=delegate.createLiteral(token)}else if(match("/")||match("/=")){if(typeof extra.tokens!=="undefined"){expr=delegate.createLiteral(collectRegex())}else{expr=delegate.createLiteral(scanRegExp())}peek()}else{throwUnexpected(lex())}return delegate.markEnd(expr,startToken)}function parseArguments(){var args=[];expect("(");if(!match(")")){while(index<length){args.push(parseAssignmentExpression());if(match(")")){break}expect(",")}}expect(")");return args}function parseNonComputedProperty(){var token,startToken;startToken=lookahead;token=lex();if(!isIdentifierName(token)){throwUnexpected(token)}return delegate.markEnd(delegate.createIdentifier(token.value),startToken)}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression();expect("]");return expr}function parseNewExpression(){var callee,args,startToken;startToken=lookahead;expectKeyword("new");callee=parseLeftHandSideExpression();args=match("(")?parseArguments():[];return delegate.markEnd(delegate.createNewExpression(callee,args),startToken)}function parseLeftHandSideExpressionAllowCall(){var previousAllowIn,expr,args,property,startToken;startToken=lookahead;previousAllowIn=state.allowIn;state.allowIn=true;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();state.allowIn=previousAllowIn;for(;;){if(match(".")){property=parseNonComputedMember();expr=delegate.createMemberExpression(".",expr,property)}else if(match("(")){args=parseArguments();expr=delegate.createCallExpression(expr,args)}else if(match("[")){property=parseComputedMember();expr=delegate.createMemberExpression("[",expr,property)}else{break}delegate.markEnd(expr,startToken)}return expr}function parseLeftHandSideExpression(){var previousAllowIn,expr,property,startToken;startToken=lookahead;previousAllowIn=state.allowIn;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();state.allowIn=previousAllowIn;while(match(".")||match("[")){if(match("[")){property=parseComputedMember();expr=delegate.createMemberExpression("[",expr,property)}else{property=parseNonComputedMember();expr=delegate.createMemberExpression(".",expr,property)}delegate.markEnd(expr,startToken)}return expr}function parsePostfixExpression(){var expr,token,startToken=lookahead;expr=parseLeftHandSideExpressionAllowCall();if(lookahead.type===Token.Punctuator){if((match("++")||match("--"))&&!peekLineTerminator()){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPostfix)}if(!isLeftHandSide(expr)){throwErrorTolerant({},Messages.InvalidLHSInAssignment)}token=lex();expr=delegate.markEnd(delegate.createPostfixExpression(token.value,expr),startToken)}}return expr}function parseUnaryExpression(){var token,expr,startToken;if(lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){expr=parsePostfixExpression()}else if(match("++")||match("--")){startToken=lookahead;token=lex();expr=parseUnaryExpression();if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPrefix)}if(!isLeftHandSide(expr)){throwErrorTolerant({},Messages.InvalidLHSInAssignment)}expr=delegate.createUnaryExpression(token.value,expr);expr=delegate.markEnd(expr,startToken)}else if(match("+")||match("-")||match("~")||match("!")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=delegate.createUnaryExpression(token.value,expr);expr=delegate.markEnd(expr,startToken)}else if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=delegate.createUnaryExpression(token.value,expr);expr=delegate.markEnd(expr,startToken);if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){throwErrorTolerant({},Messages.StrictDelete)}}else{expr=parsePostfixExpression()}return expr}function binaryPrecedence(token,allowIn){var prec=0;if(token.type!==Token.Punctuator&&token.type!==Token.Keyword){return 0}switch(token.value){case"||":prec=1;break;case"&&":prec=2;break;case"|":prec=3;break;case"^":prec=4;break;case"&":prec=5;break;case"==":case"!=":case"===":case"!==":prec=6;break;case"<":case">":case"<=":case">=":case"instanceof":prec=7;break;case"in":prec=allowIn?7:0;break;case"<<":case">>":case">>>":prec=8;break;case"+":case"-":prec=9;break;case"*":case"/":case"%":prec=11;break;default:break}return prec}function parseBinaryExpression(){var marker,markers,expr,token,prec,stack,right,operator,left,i;marker=lookahead;left=parseUnaryExpression();token=lookahead;prec=binaryPrecedence(token,state.allowIn);if(prec===0){return left}token.prec=prec;lex();markers=[marker,lookahead];right=parseUnaryExpression();stack=[left,token,right];while((prec=binaryPrecedence(lookahead,state.allowIn))>0){while(stack.length>2&&prec<=stack[stack.length-2].prec){right=stack.pop();operator=stack.pop().value;left=stack.pop();expr=delegate.createBinaryExpression(operator,left,right);markers.pop();marker=markers[markers.length-1];delegate.markEnd(expr,marker);stack.push(expr)}token=lex();token.prec=prec;stack.push(token);markers.push(lookahead);expr=parseUnaryExpression();stack.push(expr)}i=stack.length-1;expr=stack[i];markers.pop();while(i>1){expr=delegate.createBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2;marker=markers.pop();delegate.markEnd(expr,marker)}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,startToken;startToken=lookahead;expr=parseBinaryExpression();if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=parseAssignmentExpression();state.allowIn=previousAllowIn;expect(":");alternate=parseAssignmentExpression();expr=delegate.createConditionalExpression(expr,consequent,alternate);delegate.markEnd(expr,startToken)}return expr}function parseAssignmentExpression(){var token,left,right,node,startToken;token=lookahead;startToken=lookahead;node=left=parseConditionalExpression();if(matchAssign()){if(!isLeftHandSide(left)){throwErrorTolerant({},Messages.InvalidLHSInAssignment)}if(strict&&left.type===Syntax.Identifier&&isRestrictedWord(left.name)){throwErrorTolerant(token,Messages.StrictLHSAssignment)}token=lex();right=parseAssignmentExpression();node=delegate.markEnd(delegate.createAssignmentExpression(token.value,left,right),startToken)}return node}function parseExpression(){var expr,startToken=lookahead;expr=parseAssignmentExpression();if(match(",")){expr=delegate.createSequenceExpression([expr]);while(index<length){if(!match(",")){break}lex();expr.expressions.push(parseAssignmentExpression())}delegate.markEnd(expr,startToken)}return expr}function parseStatementList(){var list=[],statement;while(index<length){if(match("}")){break}statement=parseSourceElement();if(typeof statement==="undefined"){break}list.push(statement)}return list}function parseBlock(){var block,startToken;startToken=lookahead;expect("{");block=parseStatementList();expect("}");return delegate.markEnd(delegate.createBlockStatement(block),startToken)}function parseVariableIdentifier(){var token,startToken;startToken=lookahead;token=lex();if(token.type!==Token.Identifier){throwUnexpected(token)}return delegate.markEnd(delegate.createIdentifier(token.value),startToken)}function parseVariableDeclaration(kind){var init=null,id,startToken;startToken=lookahead;id=parseVariableIdentifier();if(strict&&isRestrictedWord(id.name)){throwErrorTolerant({},Messages.StrictVarName)}if(kind==="const"){expect("=");init=parseAssignmentExpression()}else if(match("=")){lex();init=parseAssignmentExpression()}return delegate.markEnd(delegate.createVariableDeclarator(id,init),startToken)}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break}lex()}while(index<length);return list}function parseVariableStatement(){var declarations;expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return delegate.createVariableDeclaration(declarations,"var")}function parseConstLetDeclaration(kind){var declarations,startToken;startToken=lookahead;expectKeyword(kind);declarations=parseVariableDeclarationList(kind);consumeSemicolon();return delegate.markEnd(delegate.createVariableDeclaration(declarations,kind),startToken)}function parseEmptyStatement(){expect(";");return delegate.createEmptyStatement()}function parseExpressionStatement(){var expr=parseExpression();consumeSemicolon();return delegate.createExpressionStatement(expr)}function parseIfStatement(){var test,consequent,alternate;expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return delegate.createIfStatement(test,consequent,alternate)}function parseDoWhileStatement(){var body,test,oldInIteration;expectKeyword("do");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");if(match(";")){lex()}return delegate.createDoWhileStatement(body,test)}function parseWhileStatement(){var test,body,oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return delegate.createWhileStatement(test,body)}function parseForVariableDeclaration(){var token,declarations,startToken;startToken=lookahead;token=lex();declarations=parseVariableDeclarationList();return delegate.markEnd(delegate.createVariableDeclaration(declarations,token.value),startToken)}function parseForStatement(){var init,test,update,left,right,body,oldInIteration;init=test=update=null;expectKeyword("for");expect("(");if(match(";")){lex()}else{if(matchKeyword("var")||matchKeyword("let")){state.allowIn=false;init=parseForVariableDeclaration();state.allowIn=true;if(init.declarations.length===1&&matchKeyword("in")){lex();left=init;right=parseExpression();init=null}}else{state.allowIn=false;init=parseExpression();state.allowIn=true;if(matchKeyword("in")){if(!isLeftHandSide(init)){throwErrorTolerant({},Messages.InvalidLHSInForIn)}lex();left=init;right=parseExpression();init=null}}if(typeof left==="undefined"){expect(";")}}if(typeof left==="undefined"){if(!match(";")){test=parseExpression()}expect(";");if(!match(")")){update=parseExpression()}}expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return typeof left==="undefined"?delegate.createForStatement(init,test,update,body):delegate.createForInStatement(left,right,body)}function parseContinueStatement(){var label=null,key;expectKeyword("continue");if(source.charCodeAt(index)===59){lex();if(!state.inIteration){throwError({},Messages.IllegalContinue)}return delegate.createContinueStatement(null)}if(peekLineTerminator()){if(!state.inIteration){throwError({},Messages.IllegalContinue)}return delegate.createContinueStatement(null)}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!state.inIteration){throwError({},Messages.IllegalContinue)}return delegate.createContinueStatement(label)}function parseBreakStatement(){var label=null,key;expectKeyword("break");if(source.charCodeAt(index)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return delegate.createBreakStatement(null)}if(peekLineTerminator()){if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return delegate.createBreakStatement(null)}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();key="$"+label.name;if(!Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return delegate.createBreakStatement(label)}function parseReturnStatement(){var argument=null;expectKeyword("return");if(!state.inFunctionBody){throwErrorTolerant({},Messages.IllegalReturn)}if(source.charCodeAt(index)===32){if(isIdentifierStart(source.charCodeAt(index+1))){argument=parseExpression();consumeSemicolon();return delegate.createReturnStatement(argument)}}if(peekLineTerminator()){return delegate.createReturnStatement(null)}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return delegate.createReturnStatement(argument)}function parseWithStatement(){var object,body;if(strict){skipComment();throwErrorTolerant({},Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return delegate.createWithStatement(object,body)}function parseSwitchCase(){var test,consequent=[],statement,startToken;startToken=lookahead;if(matchKeyword("default")){lex();test=null}else{expectKeyword("case");test=parseExpression()}expect(":");while(index<length){if(match("}")||matchKeyword("default")||matchKeyword("case")){break}statement=parseStatement();consequent.push(statement)}return delegate.markEnd(delegate.createSwitchCase(test,consequent),startToken)}function parseSwitchStatement(){var discriminant,cases,clause,oldInSwitch,defaultFound;expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return delegate.createSwitchStatement(discriminant,cases)}oldInSwitch=state.inSwitch;state.inSwitch=true;defaultFound=false;while(index<length){if(match("}")){break}clause=parseSwitchCase();if(clause.test===null){if(defaultFound){throwError({},Messages.MultipleDefaultsInSwitch)}defaultFound=true}cases.push(clause)}state.inSwitch=oldInSwitch;expect("}");return delegate.createSwitchStatement(discriminant,cases)}function parseThrowStatement(){var argument;expectKeyword("throw");if(peekLineTerminator()){throwError({},Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return delegate.createThrowStatement(argument)}function parseCatchClause(){var param,body,startToken;startToken=lookahead;expectKeyword("catch");expect("(");if(match(")")){throwUnexpected(lookahead)}param=parseVariableIdentifier();if(strict&&isRestrictedWord(param.name)){throwErrorTolerant({},Messages.StrictCatchVariable)}expect(")");body=parseBlock();return delegate.markEnd(delegate.createCatchClause(param,body),startToken)}function parseTryStatement(){var block,handlers=[],finalizer=null;expectKeyword("try");block=parseBlock();if(matchKeyword("catch")){handlers.push(parseCatchClause())}if(matchKeyword("finally")){lex();finalizer=parseBlock()}if(handlers.length===0&&!finalizer){throwError({},Messages.NoCatchOrFinally)}return delegate.createTryStatement(block,[],handlers,finalizer)}function parseDebuggerStatement(){expectKeyword("debugger");consumeSemicolon();return delegate.createDebuggerStatement()}function parseStatement(){var type=lookahead.type,expr,labeledBody,key,startToken;if(type===Token.EOF){throwUnexpected(lookahead)}if(type===Token.Punctuator&&lookahead.value==="{"){return parseBlock()}startToken=lookahead;if(type===Token.Punctuator){switch(lookahead.value){case";":return delegate.markEnd(parseEmptyStatement(),startToken);case"(":return delegate.markEnd(parseExpressionStatement(),startToken);default:break}}if(type===Token.Keyword){switch(lookahead.value){case"break":return delegate.markEnd(parseBreakStatement(),startToken);case"continue":return delegate.markEnd(parseContinueStatement(),startToken);case"debugger":return delegate.markEnd(parseDebuggerStatement(),startToken);case"do":return delegate.markEnd(parseDoWhileStatement(),startToken);case"for":return delegate.markEnd(parseForStatement(),startToken);case"function":return delegate.markEnd(parseFunctionDeclaration(),startToken);case"if":return delegate.markEnd(parseIfStatement(),startToken);case"return":return delegate.markEnd(parseReturnStatement(),startToken);case"switch":return delegate.markEnd(parseSwitchStatement(),startToken);case"throw":return delegate.markEnd(parseThrowStatement(),startToken);case"try":return delegate.markEnd(parseTryStatement(),startToken);case"var":return delegate.markEnd(parseVariableStatement(),startToken);case"while":return delegate.markEnd(parseWhileStatement(),startToken);case"with":return delegate.markEnd(parseWithStatement(),startToken);default:break}}expr=parseExpression();if(expr.type===Syntax.Identifier&&match(":")){lex();key="$"+expr.name;if(Object.prototype.hasOwnProperty.call(state.labelSet,key)){throwError({},Messages.Redeclaration,"Label",expr.name)}state.labelSet[key]=true;labeledBody=parseStatement();delete state.labelSet[key];return delegate.markEnd(delegate.createLabeledStatement(expr,labeledBody),startToken)}consumeSemicolon();return delegate.markEnd(delegate.createExpressionStatement(expr),startToken)}function parseFunctionSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,startToken;startToken=lookahead;expect("{");while(index<length){if(lookahead.type!==Token.StringLiteral){break}token=lookahead;sourceElement=parseSourceElement();sourceElements.push(sourceElement);if(sourceElement.expression.type!==Syntax.Literal){break}directive=source.slice(token.start+1,token.end-1);if(directive==="use strict"){strict=true;if(firstRestricted){throwErrorTolerant(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;while(index<length){if(match("}")){break}sourceElement=parseSourceElement();if(typeof sourceElement==="undefined"){break}sourceElements.push(sourceElement)}expect("}");state.labelSet=oldLabelSet;state.inIteration=oldInIteration;state.inSwitch=oldInSwitch;state.inFunctionBody=oldInFunctionBody;return delegate.markEnd(delegate.createBlockStatement(sourceElements),startToken)}function parseParams(firstRestricted){var param,params=[],token,stricted,paramSet,key,message;expect("(");if(!match(")")){paramSet={};while(index<length){token=lookahead;param=parseVariableIdentifier();key="$"+token.value;if(strict){if(isRestrictedWord(token.value)){stricted=token;message=Messages.StrictParamName}if(Object.prototype.hasOwnProperty.call(paramSet,key)){stricted=token;message=Messages.StrictParamDupe}}else if(!firstRestricted){if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictParamName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(paramSet,key)){firstRestricted=token;message=Messages.StrictParamDupe}}params.push(param);paramSet[key]=true;if(match(")")){break}expect(",")}}expect(")");return{params:params,stricted:stricted,firstRestricted:firstRestricted,message:message}}function parseFunctionDeclaration(){var id,params=[],body,token,stricted,tmp,firstRestricted,message,previousStrict,startToken;startToken=lookahead;expectKeyword("function");token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}tmp=parseParams(firstRestricted);params=tmp.params;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&stricted){throwErrorTolerant(stricted,message)}strict=previousStrict;return delegate.markEnd(delegate.createFunctionDeclaration(id,params,[],body),startToken)}function parseFunctionExpression(){var token,id=null,stricted,firstRestricted,message,tmp,params=[],body,previousStrict,startToken;startToken=lookahead;expectKeyword("function");if(!match("(")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){throwErrorTolerant(token,Messages.StrictFunctionName)}}else{if(isRestrictedWord(token.value)){firstRestricted=token;message=Messages.StrictFunctionName}else if(isStrictModeReservedWord(token.value)){firstRestricted=token;message=Messages.StrictReservedWord}}}tmp=parseParams(firstRestricted);params=tmp.params;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&stricted){throwErrorTolerant(stricted,message)}strict=previousStrict;return delegate.markEnd(delegate.createFunctionExpression(id,params,[],body),startToken)}function parseSourceElement(){if(lookahead.type===Token.Keyword){switch(lookahead.value){case"const":case"let":return parseConstLetDeclaration(lookahead.value);case"function":return parseFunctionDeclaration();default:return parseStatement()}}if(lookahead.type!==Token.EOF){return parseStatement()}}function parseSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted;while(index<length){token=lookahead;if(token.type!==Token.StringLiteral){break}sourceElement=parseSourceElement();sourceElements.push(sourceElement);if(sourceElement.expression.type!==Syntax.Literal){break}directive=source.slice(token.start+1,token.end-1);if(directive==="use strict"){strict=true;if(firstRestricted){throwErrorTolerant(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}while(index<length){sourceElement=parseSourceElement();if(typeof sourceElement==="undefined"){break}sourceElements.push(sourceElement)}return sourceElements}function parseProgram(){var body,startToken;skipComment();peek();startToken=lookahead;strict=false;body=parseSourceElements();return delegate.markEnd(delegate.createProgram(body),startToken)}function filterTokenLocation(){var i,entry,token,tokens=[];for(i=0;i<extra.tokens.length;++i){entry=extra.tokens[i];token={type:entry.type,value:entry.value};if(extra.range){token.range=entry.range}if(extra.loc){token.loc=entry.loc}tokens.push(token)}extra.tokens=tokens}function tokenize(code,options){var toString,token,tokens;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}delegate=SyntaxTreeDelegate;source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1};extra={};options=options||{};options.tokens=true;extra.tokens=[];extra.tokenize=true;extra.openParenToken=-1;extra.openCurlyToken=-1;extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}try{peek();if(lookahead.type===Token.EOF){return extra.tokens}token=lex();while(lookahead.type!==Token.EOF){try{token=lex()}catch(lexError){token=lookahead;if(extra.errors){extra.errors.push(lexError);break}else{throw lexError}}}filterTokenLocation();tokens=extra.tokens;if(typeof extra.comments!=="undefined"){tokens.comments=extra.comments}if(typeof extra.errors!=="undefined"){tokens.errors=extra.errors}}catch(e){throw e}finally{extra={}}return tokens}function parse(code,options){var program,toString;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}delegate=SyntaxTreeDelegate;source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},inFunctionBody:false,inIteration:false,inSwitch:false,lastCommentStart:-1};extra={};if(typeof options!=="undefined"){extra.range=typeof options.range==="boolean"&&options.range;extra.loc=typeof options.loc==="boolean"&&options.loc;extra.attachComment=typeof options.attachComment==="boolean"&&options.attachComment;if(extra.loc&&options.source!==null&&options.source!==undefined){extra.source=toString(options.source)}if(typeof options.tokens==="boolean"&&options.tokens){extra.tokens=[]}if(typeof options.comment==="boolean"&&options.comment){extra.comments=[]}if(typeof options.tolerant==="boolean"&&options.tolerant){extra.errors=[]}if(extra.attachComment){extra.range=true;extra.comments=[];extra.bottomRightStack=[];extra.trailingComments=[];extra.leadingComments=[]}}try{program=parseProgram();if(typeof extra.comments!=="undefined"){program.comments=extra.comments}if(typeof extra.tokens!=="undefined"){filterTokenLocation();program.tokens=extra.tokens}if(typeof extra.errors!=="undefined"){program.errors=extra.errors}}catch(e){throw e}finally{extra={}}return program}exports.version="1.2.2";exports.tokenize=tokenize;exports.parse=parse;exports.Syntax=function(){var name,types={};if(typeof Object.create==="function"){types=Object.create(null)}for(name in Syntax){if(Syntax.hasOwnProperty(name)){types[name]=Syntax[name]}}if(typeof Object.freeze==="function"){Object.freeze(types)}return types}()})},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(process){function normalizeArray(parts,allowAboveRoot){var up=0;for(var i=parts.length-1;i>=0;i--){var last=parts[i];if(last==="."){parts.splice(i,1)}else if(last===".."){parts.splice(i,1);up++}else if(up){parts.splice(i,1);up--}}if(allowAboveRoot){for(;up--;up){parts.unshift("..")}}return parts}var splitPathRe=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var splitPath=function(filename){return splitPathRe.exec(filename).slice(1)};exports.resolve=function(){var resolvedPath="",resolvedAbsolute=false;for(var i=arguments.length-1;i>=-1&&!resolvedAbsolute;i--){var path=i>=0?arguments[i]:process.cwd();if(typeof path!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!path){continue}resolvedPath=path+"/"+resolvedPath;resolvedAbsolute=path.charAt(0)==="/"}resolvedPath=normalizeArray(filter(resolvedPath.split("/"),function(p){return!!p
}),!resolvedAbsolute).join("/");return(resolvedAbsolute?"/":"")+resolvedPath||"."};exports.normalize=function(path){var isAbsolute=exports.isAbsolute(path),trailingSlash=substr(path,-1)==="/";path=normalizeArray(filter(path.split("/"),function(p){return!!p}),!isAbsolute).join("/");if(!path&&!isAbsolute){path="."}if(path&&trailingSlash){path+="/"}return(isAbsolute?"/":"")+path};exports.isAbsolute=function(path){return path.charAt(0)==="/"};exports.join=function(){var paths=Array.prototype.slice.call(arguments,0);return exports.normalize(filter(paths,function(p,index){if(typeof p!=="string"){throw new TypeError("Arguments to path.join must be strings")}return p}).join("/"))};exports.relative=function(from,to){from=exports.resolve(from).substr(1);to=exports.resolve(to).substr(1);function trim(arr){var start=0;for(;start<arr.length;start++){if(arr[start]!=="")break}var end=arr.length-1;for(;end>=0;end--){if(arr[end]!=="")break}if(start>end)return[];return arr.slice(start,end-start+1)}var fromParts=trim(from.split("/"));var toParts=trim(to.split("/"));var length=Math.min(fromParts.length,toParts.length);var samePartsLength=length;for(var i=0;i<length;i++){if(fromParts[i]!==toParts[i]){samePartsLength=i;break}}var outputParts=[];for(var i=samePartsLength;i<fromParts.length;i++){outputParts.push("..")}outputParts=outputParts.concat(toParts.slice(samePartsLength));return outputParts.join("/")};exports.sep="/";exports.delimiter=":";exports.dirname=function(path){var result=splitPath(path),root=result[0],dir=result[1];if(!root&&!dir){return"."}if(dir){dir=dir.substr(0,dir.length-1)}return root+dir};exports.basename=function(path,ext){var f=splitPath(path)[2];if(ext&&f.substr(-1*ext.length)===ext){f=f.substr(0,f.length-ext.length)}return f};exports.extname=function(path){return splitPath(path)[3]};function filter(xs,f){if(xs.filter)return xs.filter(f);var res=[];for(var i=0;i<xs.length;i++){if(f(xs[i],i,xs))res.push(xs[i])}return res}var substr="ab".substr(-1)==="b"?function(str,start,len){return str.substr(start,len)}:function(str,start,len){if(start<0)start=str.length+start;return str.substr(start,len)}}).call(this,require("_process"))},{_process:2}],2:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];function noop(){}process.on=noop;process.addListener=noop;process.once=noop;process.off=noop;process.removeListener=noop;process.removeAllListeners=noop;process.emit=noop;process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],3:[function(require,module,exports){(function(root,factory){"use strict";if(typeof define==="function"&&define.amd){define(["exports"],factory)}else if(typeof exports!=="undefined"){factory(exports)}else{factory(root.estraverse={})}})(this,function(exports){"use strict";var Syntax,isArray,VisitorOption,VisitorKeys,objectCreate,objectKeys,BREAK,SKIP,REMOVE;function ignoreJSHintError(){}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function deepCopy(obj){var ret={},key,val;for(key in obj){if(obj.hasOwnProperty(key)){val=obj[key];if(typeof val==="object"&&val!==null){ret[key]=deepCopy(val)}else{ret[key]=val}}}return ret}function shallowCopy(obj){var ret={},key;for(key in obj){if(obj.hasOwnProperty(key)){ret[key]=obj[key]}}return ret}ignoreJSHintError(shallowCopy);function upperBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){len=diff}else{i=current+1;len-=diff+1}}return i}function lowerBound(array,func){var diff,len,i,current;len=array.length;i=0;while(len){diff=len>>>1;current=i+diff;if(func(array[current])){i=current+1;len-=diff+1}else{len=diff}}return i}ignoreJSHintError(lowerBound);objectCreate=Object.create||function(){function F(){}return function(o){F.prototype=o;return new F}}();objectKeys=Object.keys||function(o){var keys=[],key;for(key in o){keys.push(key)}return keys};function extend(to,from){objectKeys(from).forEach(function(key){to[key]=from[key]});return to}Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};VisitorKeys={AssignmentExpression:["left","right"],ArrayExpression:["elements"],ArrayPattern:["elements"],ArrowFunctionExpression:["params","defaults","rest","body"],BlockStatement:["body"],BinaryExpression:["left","right"],BreakStatement:["label"],CallExpression:["callee","arguments"],CatchClause:["param","body"],ClassBody:["body"],ClassDeclaration:["id","body","superClass"],ClassExpression:["id","body","superClass"],ComprehensionBlock:["left","right"],ComprehensionExpression:["blocks","filter","body"],ConditionalExpression:["test","consequent","alternate"],ContinueStatement:["label"],DebuggerStatement:[],DirectiveStatement:[],DoWhileStatement:["body","test"],EmptyStatement:[],ExportBatchSpecifier:[],ExportDeclaration:["declaration","specifiers","source"],ExportSpecifier:["id","name"],ExpressionStatement:["expression"],ForStatement:["init","test","update","body"],ForInStatement:["left","right","body"],ForOfStatement:["left","right","body"],FunctionDeclaration:["id","params","defaults","rest","body"],FunctionExpression:["id","params","defaults","rest","body"],GeneratorExpression:["blocks","filter","body"],Identifier:[],IfStatement:["test","consequent","alternate"],ImportDeclaration:["specifiers","source"],ImportDefaultSpecifier:["id"],ImportNamespaceSpecifier:["id"],ImportSpecifier:["id","name"],Literal:[],LabeledStatement:["label","body"],LogicalExpression:["left","right"],MemberExpression:["object","property"],MethodDefinition:["key","value"],ModuleSpecifier:[],NewExpression:["callee","arguments"],ObjectExpression:["properties"],ObjectPattern:["properties"],Program:["body"],Property:["key","value"],ReturnStatement:["argument"],SequenceExpression:["expressions"],SpreadElement:["argument"],SwitchStatement:["discriminant","cases"],SwitchCase:["test","consequent"],TaggedTemplateExpression:["tag","quasi"],TemplateElement:[],TemplateLiteral:["quasis","expressions"],ThisExpression:[],ThrowStatement:["argument"],TryStatement:["block","handlers","handler","guardedHandlers","finalizer"],UnaryExpression:["argument"],UpdateExpression:["argument"],VariableDeclaration:["declarations"],VariableDeclarator:["id","init"],WhileStatement:["test","body"],WithStatement:["object","body"],YieldExpression:["argument"]};BREAK={};SKIP={};REMOVE={};VisitorOption={Break:BREAK,Skip:SKIP,Remove:REMOVE};function Reference(parent,key){this.parent=parent;this.key=key}Reference.prototype.replace=function replace(node){this.parent[this.key]=node};Reference.prototype.remove=function remove(){if(isArray(this.parent)){this.parent.splice(this.key,1);return true}else{this.replace(null);return false}};function Element(node,path,wrap,ref){this.node=node;this.path=path;this.wrap=wrap;this.ref=ref}function Controller(){}Controller.prototype.path=function path(){var i,iz,j,jz,result,element;function addToPath(result,path){if(isArray(path)){for(j=0,jz=path.length;j<jz;++j){result.push(path[j])}}else{result.push(path)}}if(!this.__current.path){return null}result=[];for(i=2,iz=this.__leavelist.length;i<iz;++i){element=this.__leavelist[i];addToPath(result,element.path)}addToPath(result,this.__current.path);return result};Controller.prototype.parents=function parents(){var i,iz,result;result=[];for(i=1,iz=this.__leavelist.length;i<iz;++i){result.push(this.__leavelist[i].node)}return result};Controller.prototype.current=function current(){return this.__current.node};Controller.prototype.__execute=function __execute(callback,element){var previous,result;result=undefined;previous=this.__current;this.__current=element;this.__state=null;if(callback){result=callback.call(this,element.node,this.__leavelist[this.__leavelist.length-1].node)}this.__current=previous;return result};Controller.prototype.notify=function notify(flag){this.__state=flag};Controller.prototype.skip=function(){this.notify(SKIP)};Controller.prototype["break"]=function(){this.notify(BREAK)};Controller.prototype.remove=function(){this.notify(REMOVE)};Controller.prototype.__initialize=function(root,visitor){this.visitor=visitor;this.root=root;this.__worklist=[];this.__leavelist=[];this.__current=null;this.__state=null;this.__fallback=visitor.fallback==="iteration";this.__keys=VisitorKeys;if(visitor.keys){this.__keys=extend(objectCreate(this.__keys),visitor.keys)}};function isNode(node){if(node==null){return false}return typeof node==="object"&&typeof node.type==="string"}function isProperty(nodeType,key){return(nodeType===Syntax.ObjectExpression||nodeType===Syntax.ObjectPattern)&&"properties"===key}Controller.prototype.traverse=function traverse(root,visitor){var worklist,leavelist,element,node,nodeType,ret,key,current,current2,candidates,candidate,sentinel;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;worklist.push(new Element(root,null,null,null));leavelist.push(new Element(null,null,null,null));while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();ret=this.__execute(visitor.leave,element);if(this.__state===BREAK||ret===BREAK){return}continue}if(element.node){ret=this.__execute(visitor.enter,element);if(this.__state===BREAK||ret===BREAK){return}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||ret===SKIP){continue}node=element.node;nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",null)}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,null)}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,null))}}}}};Controller.prototype.replace=function replace(root,visitor){function removeElem(){var i,nextElem,parent;if(element.ref.remove()){parent=element.ref.parent;for(i=1;i<worklist.length;i++){nextElem=worklist[i];if(nextElem===sentinel||nextElem.ref.parent!==parent){break}nextElem.path[nextElem.path.length-1]=--nextElem.ref.key}}}var worklist,leavelist,node,nodeType,target,element,current,current2,candidates,candidate,sentinel,outer,key;this.__initialize(root,visitor);sentinel={};worklist=this.__worklist;leavelist=this.__leavelist;outer={root:root};element=new Element(root,null,null,new Reference(outer,"root"));worklist.push(element);leavelist.push(element);while(worklist.length){element=worklist.pop();if(element===sentinel){element=leavelist.pop();target=this.__execute(visitor.leave,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target)}if(this.__state===REMOVE||target===REMOVE){removeElem()}if(this.__state===BREAK||target===BREAK){return outer.root}continue}target=this.__execute(visitor.enter,element);if(target!==undefined&&target!==BREAK&&target!==SKIP&&target!==REMOVE){element.ref.replace(target);element.node=target}if(this.__state===REMOVE||target===REMOVE){removeElem();element.node=null}if(this.__state===BREAK||target===BREAK){return outer.root}node=element.node;if(!node){continue}worklist.push(sentinel);leavelist.push(element);if(this.__state===SKIP||target===SKIP){continue}nodeType=element.wrap||node.type;candidates=this.__keys[nodeType];if(!candidates){if(this.__fallback){candidates=objectKeys(node)}else{throw new Error("Unknown node type "+nodeType+".")}}current=candidates.length;while((current-=1)>=0){key=candidates[current];candidate=node[key];if(!candidate){continue}if(isArray(candidate)){current2=candidate.length;while((current2-=1)>=0){if(!candidate[current2]){continue}if(isProperty(nodeType,candidates[current])){element=new Element(candidate[current2],[key,current2],"Property",new Reference(candidate,current2))}else if(isNode(candidate[current2])){element=new Element(candidate[current2],[key,current2],null,new Reference(candidate,current2))}else{continue}worklist.push(element)}}else if(isNode(candidate)){worklist.push(new Element(candidate,key,null,new Reference(node,key)))}}}return outer.root};function traverse(root,visitor){var controller=new Controller;return controller.traverse(root,visitor)}function replace(root,visitor){var controller=new Controller;return controller.replace(root,visitor)}function extendCommentRange(comment,tokens){var target;target=upperBound(tokens,function search(token){return token.range[0]>comment.range[0]});comment.extendedRange=[comment.range[0],comment.range[1]];if(target!==tokens.length){comment.extendedRange[1]=tokens[target].range[0]}target-=1;if(target>=0){comment.extendedRange[0]=tokens[target].range[1]}return comment}function attachComments(tree,providedComments,tokens){var comments=[],comment,len,i,cursor;if(!tree.range){throw new Error("attachComments needs range information")}if(!tokens.length){if(providedComments.length){for(i=0,len=providedComments.length;i<len;i+=1){comment=deepCopy(providedComments[i]);comment.extendedRange=[0,tree.range[0]];comments.push(comment)}tree.leadingComments=comments}return tree}for(i=0,len=providedComments.length;i<len;i+=1){comments.push(extendCommentRange(deepCopy(providedComments[i]),tokens))}cursor=0;traverse(tree,{enter:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(comment.extendedRange[1]>node.range[0]){break}if(comment.extendedRange[1]===node.range[0]){if(!node.leadingComments){node.leadingComments=[]}node.leadingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});cursor=0;traverse(tree,{leave:function(node){var comment;while(cursor<comments.length){comment=comments[cursor];if(node.range[1]<comment.extendedRange[0]){break}if(node.range[1]===comment.extendedRange[0]){if(!node.trailingComments){node.trailingComments=[]}node.trailingComments.push(comment);comments.splice(cursor,1)}else{cursor+=1}}if(cursor===comments.length){return VisitorOption.Break}if(comments[cursor].extendedRange[0]>node.range[1]){return VisitorOption.Skip}}});return tree}exports.version="1.5.1-dev";exports.Syntax=Syntax;exports.traverse=traverse;exports.replace=replace;exports.attachComments=attachComments;exports.VisitorKeys=VisitorKeys;exports.VisitorOption=VisitorOption;exports.Controller=Controller})},{}],4:[function(require,module,exports){(function(){"use strict";function isExpression(node){if(node==null){return false}switch(node.type){case"ArrayExpression":case"AssignmentExpression":case"BinaryExpression":case"CallExpression":case"ConditionalExpression":case"FunctionExpression":case"Identifier":case"Literal":case"LogicalExpression":case"MemberExpression":case"NewExpression":case"ObjectExpression":case"SequenceExpression":case"ThisExpression":case"UnaryExpression":case"UpdateExpression":return true}return false}function isIterationStatement(node){if(node==null){return false}switch(node.type){case"DoWhileStatement":case"ForInStatement":case"ForStatement":case"WhileStatement":return true}return false}function isStatement(node){if(node==null){return false}switch(node.type){case"BlockStatement":case"BreakStatement":case"ContinueStatement":case"DebuggerStatement":case"DoWhileStatement":case"EmptyStatement":case"ExpressionStatement":case"ForInStatement":case"ForStatement":case"IfStatement":case"LabeledStatement":case"ReturnStatement":case"SwitchStatement":case"ThrowStatement":case"TryStatement":case"VariableDeclaration":case"WhileStatement":case"WithStatement":return true}return false}function isSourceElement(node){return isStatement(node)||node!=null&&node.type==="FunctionDeclaration"}function trailingStatement(node){switch(node.type){case"IfStatement":if(node.alternate!=null){return node.alternate}return node.consequent;case"LabeledStatement":case"ForStatement":case"ForInStatement":case"WhileStatement":case"WithStatement":return node.body}return null}function isProblematicIfStatement(node){var current;if(node.type!=="IfStatement"){return false}if(node.alternate==null){return false}current=node.consequent;do{if(current.type==="IfStatement"){if(current.alternate==null){return true}}current=trailingStatement(current)}while(current);return false}module.exports={isExpression:isExpression,isStatement:isStatement,isIterationStatement:isIterationStatement,isSourceElement:isSourceElement,isProblematicIfStatement:isProblematicIfStatement,trailingStatement:trailingStatement}})()},{}],5:[function(require,module,exports){(function(){"use strict";var Regex;Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‌‍‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]")};function isDecimalDigit(ch){return ch>=48&&ch<=57}function isHexDigit(ch){return isDecimalDigit(ch)||97<=ch&&ch<=102||65<=ch&&ch<=70}function isOctalDigit(ch){return ch>=48&&ch<=55}function isWhiteSpace(ch){return ch===32||ch===9||ch===11||ch===12||ch===160||ch>=5760&&[5760,6158,8192,8193,8194,8195,8196,8197,8198,8199,8200,8201,8202,8239,8287,12288,65279].indexOf(ch)>=0}function isLineTerminator(ch){return ch===10||ch===13||ch===8232||ch===8233}function isIdentifierStart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch===92||ch>=128&&Regex.NonAsciiIdentifierStart.test(String.fromCharCode(ch))}function isIdentifierPart(ch){return ch===36||ch===95||ch>=65&&ch<=90||ch>=97&&ch<=122||ch>=48&&ch<=57||ch===92||ch>=128&&Regex.NonAsciiIdentifierPart.test(String.fromCharCode(ch))}module.exports={isDecimalDigit:isDecimalDigit,isHexDigit:isHexDigit,isOctalDigit:isOctalDigit,isWhiteSpace:isWhiteSpace,isLineTerminator:isLineTerminator,isIdentifierStart:isIdentifierStart,isIdentifierPart:isIdentifierPart}})()},{}],6:[function(require,module,exports){(function(){"use strict";var code=require("./code");function isStrictModeReservedWordES6(id){switch(id){case"implements":case"interface":case"package":case"private":case"protected":case"public":case"static":case"let":return true;default:return false}}function isKeywordES5(id,strict){if(!strict&&id==="yield"){return false}return isKeywordES6(id,strict)}function isKeywordES6(id,strict){if(strict&&isStrictModeReservedWordES6(id)){return true}switch(id.length){case 2:return id==="if"||id==="in"||id==="do";case 3:return id==="var"||id==="for"||id==="new"||id==="try";case 4:return id==="this"||id==="else"||id==="case"||id==="void"||id==="with"||id==="enum";case 5:return id==="while"||id==="break"||id==="catch"||id==="throw"||id==="const"||id==="yield"||id==="class"||id==="super";case 6:return id==="return"||id==="typeof"||id==="delete"||id==="switch"||id==="export"||id==="import";case 7:return id==="default"||id==="finally"||id==="extends";case 8:return id==="function"||id==="continue"||id==="debugger";case 10:return id==="instanceof";default:return false}}function isReservedWordES5(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES5(id,strict)}function isReservedWordES6(id,strict){return id==="null"||id==="true"||id==="false"||isKeywordES6(id,strict)}function isRestrictedWord(id){return id==="eval"||id==="arguments"}function isIdentifierName(id){var i,iz,ch;if(id.length===0){return false}ch=id.charCodeAt(0);if(!code.isIdentifierStart(ch)||ch===92){return false}for(i=1,iz=id.length;i<iz;++i){ch=id.charCodeAt(i);if(!code.isIdentifierPart(ch)||ch===92){return false}}return true}function isIdentifierES5(id,strict){return isIdentifierName(id)&&!isReservedWordES5(id,strict)}function isIdentifierES6(id,strict){return isIdentifierName(id)&&!isReservedWordES6(id,strict)}module.exports={isKeywordES5:isKeywordES5,isKeywordES6:isKeywordES6,isReservedWordES5:isReservedWordES5,isReservedWordES6:isReservedWordES6,isRestrictedWord:isRestrictedWord,isIdentifierName:isIdentifierName,isIdentifierES5:isIdentifierES5,isIdentifierES6:isIdentifierES6}})()},{"./code":5}],7:[function(require,module,exports){(function(){"use strict";exports.ast=require("./ast");exports.code=require("./code");exports.keyword=require("./keyword")})()},{"./ast":4,"./code":5,"./keyword":6}],8:[function(require,module,exports){exports.SourceMapGenerator=require("./source-map/source-map-generator").SourceMapGenerator;exports.SourceMapConsumer=require("./source-map/source-map-consumer").SourceMapConsumer;exports.SourceNode=require("./source-map/source-node").SourceNode},{"./source-map/source-map-consumer":13,"./source-map/source-map-generator":14,"./source-map/source-node":15}],9:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");function ArraySet(){this._array=[];this._set={}}ArraySet.fromArray=function ArraySet_fromArray(aArray,aAllowDuplicates){var set=new ArraySet;for(var i=0,len=aArray.length;i<len;i++){set.add(aArray[i],aAllowDuplicates)}return set};ArraySet.prototype.add=function ArraySet_add(aStr,aAllowDuplicates){var isDuplicate=this.has(aStr);var idx=this._array.length;if(!isDuplicate||aAllowDuplicates){this._array.push(aStr)}if(!isDuplicate){this._set[util.toSetString(aStr)]=idx}};ArraySet.prototype.has=function ArraySet_has(aStr){return Object.prototype.hasOwnProperty.call(this._set,util.toSetString(aStr))};ArraySet.prototype.indexOf=function ArraySet_indexOf(aStr){if(this.has(aStr)){return this._set[util.toSetString(aStr)]}throw new Error('"'+aStr+'" is not in the set.')};ArraySet.prototype.at=function ArraySet_at(aIdx){if(aIdx>=0&&aIdx<this._array.length){return this._array[aIdx]}throw new Error("No element indexed by "+aIdx)};ArraySet.prototype.toArray=function ArraySet_toArray(){return this._array.slice()};exports.ArraySet=ArraySet})},{"./util":16,amdefine:17}],10:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64=require("./base64");var VLQ_BASE_SHIFT=5;var VLQ_BASE=1<<VLQ_BASE_SHIFT;var VLQ_BASE_MASK=VLQ_BASE-1;var VLQ_CONTINUATION_BIT=VLQ_BASE;function toVLQSigned(aValue){return aValue<0?(-aValue<<1)+1:(aValue<<1)+0}function fromVLQSigned(aValue){var isNegative=(aValue&1)===1;var shifted=aValue>>1;return isNegative?-shifted:shifted}exports.encode=function base64VLQ_encode(aValue){var encoded="";var digit;var vlq=toVLQSigned(aValue);do{digit=vlq&VLQ_BASE_MASK;vlq>>>=VLQ_BASE_SHIFT;if(vlq>0){digit|=VLQ_CONTINUATION_BIT}encoded+=base64.encode(digit)}while(vlq>0);return encoded};exports.decode=function base64VLQ_decode(aStr,aOutParam){var i=0;var strLen=aStr.length;var result=0;var shift=0;var continuation,digit;do{if(i>=strLen){throw new Error("Expected more digits in base 64 VLQ value.")}digit=base64.decode(aStr.charAt(i++));continuation=!!(digit&VLQ_CONTINUATION_BIT);digit&=VLQ_BASE_MASK;result=result+(digit<<shift);shift+=VLQ_BASE_SHIFT}while(continuation);aOutParam.value=fromVLQSigned(result);aOutParam.rest=aStr.slice(i)}})},{"./base64":11,amdefine:17}],11:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var charToIntMap={};var intToCharMap={};"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("").forEach(function(ch,index){charToIntMap[ch]=index;intToCharMap[index]=ch});exports.encode=function base64_encode(aNumber){if(aNumber in intToCharMap){return intToCharMap[aNumber]}throw new TypeError("Must be between 0 and 63: "+aNumber)};exports.decode=function base64_decode(aChar){if(aChar in charToIntMap){return charToIntMap[aChar]}throw new TypeError("Not a valid base 64 digit: "+aChar)}})},{amdefine:17}],12:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function recursiveSearch(aLow,aHigh,aNeedle,aHaystack,aCompare){var mid=Math.floor((aHigh-aLow)/2)+aLow;var cmp=aCompare(aNeedle,aHaystack[mid],true);if(cmp===0){return aHaystack[mid]}else if(cmp>0){if(aHigh-mid>1){return recursiveSearch(mid,aHigh,aNeedle,aHaystack,aCompare)}return aHaystack[mid]}else{if(mid-aLow>1){return recursiveSearch(aLow,mid,aNeedle,aHaystack,aCompare)}return aLow<0?null:aHaystack[aLow]}}exports.search=function search(aNeedle,aHaystack,aCompare){return aHaystack.length>0?recursiveSearch(-1,aHaystack.length,aNeedle,aHaystack,aCompare):null}})},{amdefine:17}],13:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var util=require("./util");var binarySearch=require("./binary-search");var ArraySet=require("./array-set").ArraySet;var base64VLQ=require("./base64-vlq");function SourceMapConsumer(aSourceMap){var sourceMap=aSourceMap;if(typeof aSourceMap==="string"){sourceMap=JSON.parse(aSourceMap.replace(/^\)\]\}'/,""))}var version=util.getArg(sourceMap,"version");var sources=util.getArg(sourceMap,"sources");var names=util.getArg(sourceMap,"names",[]);var sourceRoot=util.getArg(sourceMap,"sourceRoot",null);var sourcesContent=util.getArg(sourceMap,"sourcesContent",null);var mappings=util.getArg(sourceMap,"mappings");var file=util.getArg(sourceMap,"file",null);if(version!=this._version){throw new Error("Unsupported version: "+version)}this._names=ArraySet.fromArray(names,true);this._sources=ArraySet.fromArray(sources,true);this.sourceRoot=sourceRoot;this.sourcesContent=sourcesContent;this._mappings=mappings;this.file=file}SourceMapConsumer.fromSourceMap=function SourceMapConsumer_fromSourceMap(aSourceMap){var smc=Object.create(SourceMapConsumer.prototype);smc._names=ArraySet.fromArray(aSourceMap._names.toArray(),true);smc._sources=ArraySet.fromArray(aSourceMap._sources.toArray(),true);smc.sourceRoot=aSourceMap._sourceRoot;smc.sourcesContent=aSourceMap._generateSourcesContent(smc._sources.toArray(),smc.sourceRoot);smc.file=aSourceMap._file;smc.__generatedMappings=aSourceMap._mappings.slice().sort(util.compareByGeneratedPositions);smc.__originalMappings=aSourceMap._mappings.slice().sort(util.compareByOriginalPositions);return smc};SourceMapConsumer.prototype._version=3;Object.defineProperty(SourceMapConsumer.prototype,"sources",{get:function(){return this._sources.toArray().map(function(s){return this.sourceRoot!=null?util.join(this.sourceRoot,s):s},this)}});SourceMapConsumer.prototype.__generatedMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_generatedMappings",{get:function(){if(!this.__generatedMappings){this.__generatedMappings=[];this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__generatedMappings}});SourceMapConsumer.prototype.__originalMappings=null;Object.defineProperty(SourceMapConsumer.prototype,"_originalMappings",{get:function(){if(!this.__originalMappings){this.__generatedMappings=[];
this.__originalMappings=[];this._parseMappings(this._mappings,this.sourceRoot)}return this.__originalMappings}});SourceMapConsumer.prototype._nextCharIsMappingSeparator=function SourceMapConsumer_nextCharIsMappingSeparator(aStr){var c=aStr.charAt(0);return c===";"||c===","};SourceMapConsumer.prototype._parseMappings=function SourceMapConsumer_parseMappings(aStr,aSourceRoot){var generatedLine=1;var previousGeneratedColumn=0;var previousOriginalLine=0;var previousOriginalColumn=0;var previousSource=0;var previousName=0;var str=aStr;var temp={};var mapping;while(str.length>0){if(str.charAt(0)===";"){generatedLine++;str=str.slice(1);previousGeneratedColumn=0}else if(str.charAt(0)===","){str=str.slice(1)}else{mapping={};mapping.generatedLine=generatedLine;base64VLQ.decode(str,temp);mapping.generatedColumn=previousGeneratedColumn+temp.value;previousGeneratedColumn=mapping.generatedColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.source=this._sources.at(previousSource+temp.value);previousSource+=temp.value;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source, but no line and column")}base64VLQ.decode(str,temp);mapping.originalLine=previousOriginalLine+temp.value;previousOriginalLine=mapping.originalLine;mapping.originalLine+=1;str=temp.rest;if(str.length===0||this._nextCharIsMappingSeparator(str)){throw new Error("Found a source and line, but no column")}base64VLQ.decode(str,temp);mapping.originalColumn=previousOriginalColumn+temp.value;previousOriginalColumn=mapping.originalColumn;str=temp.rest;if(str.length>0&&!this._nextCharIsMappingSeparator(str)){base64VLQ.decode(str,temp);mapping.name=this._names.at(previousName+temp.value);previousName+=temp.value;str=temp.rest}}this.__generatedMappings.push(mapping);if(typeof mapping.originalLine==="number"){this.__originalMappings.push(mapping)}}}this.__generatedMappings.sort(util.compareByGeneratedPositions);this.__originalMappings.sort(util.compareByOriginalPositions)};SourceMapConsumer.prototype._findMapping=function SourceMapConsumer_findMapping(aNeedle,aMappings,aLineName,aColumnName,aComparator){if(aNeedle[aLineName]<=0){throw new TypeError("Line must be greater than or equal to 1, got "+aNeedle[aLineName])}if(aNeedle[aColumnName]<0){throw new TypeError("Column must be greater than or equal to 0, got "+aNeedle[aColumnName])}return binarySearch.search(aNeedle,aMappings,aComparator)};SourceMapConsumer.prototype.originalPositionFor=function SourceMapConsumer_originalPositionFor(aArgs){var needle={generatedLine:util.getArg(aArgs,"line"),generatedColumn:util.getArg(aArgs,"column")};var mapping=this._findMapping(needle,this._generatedMappings,"generatedLine","generatedColumn",util.compareByGeneratedPositions);if(mapping&&mapping.generatedLine===needle.generatedLine){var source=util.getArg(mapping,"source",null);if(source!=null&&this.sourceRoot!=null){source=util.join(this.sourceRoot,source)}return{source:source,line:util.getArg(mapping,"originalLine",null),column:util.getArg(mapping,"originalColumn",null),name:util.getArg(mapping,"name",null)}}return{source:null,line:null,column:null,name:null}};SourceMapConsumer.prototype.sourceContentFor=function SourceMapConsumer_sourceContentFor(aSource){if(!this.sourcesContent){return null}if(this.sourceRoot!=null){aSource=util.relative(this.sourceRoot,aSource)}if(this._sources.has(aSource)){return this.sourcesContent[this._sources.indexOf(aSource)]}var url;if(this.sourceRoot!=null&&(url=util.urlParse(this.sourceRoot))){var fileUriAbsPath=aSource.replace(/^file:\/\//,"");if(url.scheme=="file"&&this._sources.has(fileUriAbsPath)){return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]}if((!url.path||url.path=="/")&&this._sources.has("/"+aSource)){return this.sourcesContent[this._sources.indexOf("/"+aSource)]}}throw new Error('"'+aSource+'" is not in the SourceMap.')};SourceMapConsumer.prototype.generatedPositionFor=function SourceMapConsumer_generatedPositionFor(aArgs){var needle={source:util.getArg(aArgs,"source"),originalLine:util.getArg(aArgs,"line"),originalColumn:util.getArg(aArgs,"column")};if(this.sourceRoot!=null){needle.source=util.relative(this.sourceRoot,needle.source)}var mapping=this._findMapping(needle,this._originalMappings,"originalLine","originalColumn",util.compareByOriginalPositions);if(mapping){return{line:util.getArg(mapping,"generatedLine",null),column:util.getArg(mapping,"generatedColumn",null)}}return{line:null,column:null}};SourceMapConsumer.GENERATED_ORDER=1;SourceMapConsumer.ORIGINAL_ORDER=2;SourceMapConsumer.prototype.eachMapping=function SourceMapConsumer_eachMapping(aCallback,aContext,aOrder){var context=aContext||null;var order=aOrder||SourceMapConsumer.GENERATED_ORDER;var mappings;switch(order){case SourceMapConsumer.GENERATED_ORDER:mappings=this._generatedMappings;break;case SourceMapConsumer.ORIGINAL_ORDER:mappings=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var sourceRoot=this.sourceRoot;mappings.map(function(mapping){var source=mapping.source;if(source!=null&&sourceRoot!=null){source=util.join(sourceRoot,source)}return{source:source,generatedLine:mapping.generatedLine,generatedColumn:mapping.generatedColumn,originalLine:mapping.originalLine,originalColumn:mapping.originalColumn,name:mapping.name}}).forEach(aCallback,context)};exports.SourceMapConsumer=SourceMapConsumer})},{"./array-set":9,"./base64-vlq":10,"./binary-search":12,"./util":16,amdefine:17}],14:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var base64VLQ=require("./base64-vlq");var util=require("./util");var ArraySet=require("./array-set").ArraySet;function SourceMapGenerator(aArgs){if(!aArgs){aArgs={}}this._file=util.getArg(aArgs,"file",null);this._sourceRoot=util.getArg(aArgs,"sourceRoot",null);this._sources=new ArraySet;this._names=new ArraySet;this._mappings=[];this._sourcesContents=null}SourceMapGenerator.prototype._version=3;SourceMapGenerator.fromSourceMap=function SourceMapGenerator_fromSourceMap(aSourceMapConsumer){var sourceRoot=aSourceMapConsumer.sourceRoot;var generator=new SourceMapGenerator({file:aSourceMapConsumer.file,sourceRoot:sourceRoot});aSourceMapConsumer.eachMapping(function(mapping){var newMapping={generated:{line:mapping.generatedLine,column:mapping.generatedColumn}};if(mapping.source!=null){newMapping.source=mapping.source;if(sourceRoot!=null){newMapping.source=util.relative(sourceRoot,newMapping.source)}newMapping.original={line:mapping.originalLine,column:mapping.originalColumn};if(mapping.name!=null){newMapping.name=mapping.name}}generator.addMapping(newMapping)});aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){generator.setSourceContent(sourceFile,content)}});return generator};SourceMapGenerator.prototype.addMapping=function SourceMapGenerator_addMapping(aArgs){var generated=util.getArg(aArgs,"generated");var original=util.getArg(aArgs,"original",null);var source=util.getArg(aArgs,"source",null);var name=util.getArg(aArgs,"name",null);this._validateMapping(generated,original,source,name);if(source!=null&&!this._sources.has(source)){this._sources.add(source)}if(name!=null&&!this._names.has(name)){this._names.add(name)}this._mappings.push({generatedLine:generated.line,generatedColumn:generated.column,originalLine:original!=null&&original.line,originalColumn:original!=null&&original.column,source:source,name:name})};SourceMapGenerator.prototype.setSourceContent=function SourceMapGenerator_setSourceContent(aSourceFile,aSourceContent){var source=aSourceFile;if(this._sourceRoot!=null){source=util.relative(this._sourceRoot,source)}if(aSourceContent!=null){if(!this._sourcesContents){this._sourcesContents={}}this._sourcesContents[util.toSetString(source)]=aSourceContent}else if(this._sourcesContents){delete this._sourcesContents[util.toSetString(source)];if(Object.keys(this._sourcesContents).length===0){this._sourcesContents=null}}};SourceMapGenerator.prototype.applySourceMap=function SourceMapGenerator_applySourceMap(aSourceMapConsumer,aSourceFile,aSourceMapPath){var sourceFile=aSourceFile;if(aSourceFile==null){if(aSourceMapConsumer.file==null){throw new Error("SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, "+'or the source map\'s "file" property. Both were omitted.')}sourceFile=aSourceMapConsumer.file}var sourceRoot=this._sourceRoot;if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}var newSources=new ArraySet;var newNames=new ArraySet;this._mappings.forEach(function(mapping){if(mapping.source===sourceFile&&mapping.originalLine!=null){var original=aSourceMapConsumer.originalPositionFor({line:mapping.originalLine,column:mapping.originalColumn});if(original.source!=null){mapping.source=original.source;if(aSourceMapPath!=null){mapping.source=util.join(aSourceMapPath,mapping.source)}if(sourceRoot!=null){mapping.source=util.relative(sourceRoot,mapping.source)}mapping.originalLine=original.line;mapping.originalColumn=original.column;if(original.name!=null){mapping.name=original.name}}}var source=mapping.source;if(source!=null&&!newSources.has(source)){newSources.add(source)}var name=mapping.name;if(name!=null&&!newNames.has(name)){newNames.add(name)}},this);this._sources=newSources;this._names=newNames;aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aSourceMapPath!=null){sourceFile=util.join(aSourceMapPath,sourceFile)}if(sourceRoot!=null){sourceFile=util.relative(sourceRoot,sourceFile)}this.setSourceContent(sourceFile,content)}},this)};SourceMapGenerator.prototype._validateMapping=function SourceMapGenerator_validateMapping(aGenerated,aOriginal,aSource,aName){if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aGenerated.line>0&&aGenerated.column>=0&&!aOriginal&&!aSource&&!aName){return}else if(aGenerated&&"line"in aGenerated&&"column"in aGenerated&&aOriginal&&"line"in aOriginal&&"column"in aOriginal&&aGenerated.line>0&&aGenerated.column>=0&&aOriginal.line>0&&aOriginal.column>=0&&aSource){return}else{throw new Error("Invalid mapping: "+JSON.stringify({generated:aGenerated,source:aSource,original:aOriginal,name:aName}))}};SourceMapGenerator.prototype._serializeMappings=function SourceMapGenerator_serializeMappings(){var previousGeneratedColumn=0;var previousGeneratedLine=1;var previousOriginalColumn=0;var previousOriginalLine=0;var previousName=0;var previousSource=0;var result="";var mapping;this._mappings.sort(util.compareByGeneratedPositions);for(var i=0,len=this._mappings.length;i<len;i++){mapping=this._mappings[i];if(mapping.generatedLine!==previousGeneratedLine){previousGeneratedColumn=0;while(mapping.generatedLine!==previousGeneratedLine){result+=";";previousGeneratedLine++}}else{if(i>0){if(!util.compareByGeneratedPositions(mapping,this._mappings[i-1])){continue}result+=","}}result+=base64VLQ.encode(mapping.generatedColumn-previousGeneratedColumn);previousGeneratedColumn=mapping.generatedColumn;if(mapping.source!=null){result+=base64VLQ.encode(this._sources.indexOf(mapping.source)-previousSource);previousSource=this._sources.indexOf(mapping.source);result+=base64VLQ.encode(mapping.originalLine-1-previousOriginalLine);previousOriginalLine=mapping.originalLine-1;result+=base64VLQ.encode(mapping.originalColumn-previousOriginalColumn);previousOriginalColumn=mapping.originalColumn;if(mapping.name!=null){result+=base64VLQ.encode(this._names.indexOf(mapping.name)-previousName);previousName=this._names.indexOf(mapping.name)}}}return result};SourceMapGenerator.prototype._generateSourcesContent=function SourceMapGenerator_generateSourcesContent(aSources,aSourceRoot){return aSources.map(function(source){if(!this._sourcesContents){return null}if(aSourceRoot!=null){source=util.relative(aSourceRoot,source)}var key=util.toSetString(source);return Object.prototype.hasOwnProperty.call(this._sourcesContents,key)?this._sourcesContents[key]:null},this)};SourceMapGenerator.prototype.toJSON=function SourceMapGenerator_toJSON(){var map={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};if(this._file!=null){map.file=this._file}if(this._sourceRoot!=null){map.sourceRoot=this._sourceRoot}if(this._sourcesContents){map.sourcesContent=this._generateSourcesContent(map.sources,map.sourceRoot)}return map};SourceMapGenerator.prototype.toString=function SourceMapGenerator_toString(){return JSON.stringify(this)};exports.SourceMapGenerator=SourceMapGenerator})},{"./array-set":9,"./base64-vlq":10,"./util":16,amdefine:17}],15:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){var SourceMapGenerator=require("./source-map-generator").SourceMapGenerator;var util=require("./util");var REGEX_NEWLINE=/(\r?\n)/;var REGEX_CHARACTER=/\r\n|[\s\S]/g;function SourceNode(aLine,aColumn,aSource,aChunks,aName){this.children=[];this.sourceContents={};this.line=aLine==null?null:aLine;this.column=aColumn==null?null:aColumn;this.source=aSource==null?null:aSource;this.name=aName==null?null:aName;if(aChunks!=null)this.add(aChunks)}SourceNode.fromStringWithSourceMap=function SourceNode_fromStringWithSourceMap(aGeneratedCode,aSourceMapConsumer,aRelativePath){var node=new SourceNode;var remainingLines=aGeneratedCode.split(REGEX_NEWLINE);var shiftNextLine=function(){var lineContents=remainingLines.shift();var newLine=remainingLines.shift()||"";return lineContents+newLine};var lastGeneratedLine=1,lastGeneratedColumn=0;var lastMapping=null;aSourceMapConsumer.eachMapping(function(mapping){if(lastMapping!==null){if(lastGeneratedLine<mapping.generatedLine){var code="";addMappingWithCode(lastMapping,shiftNextLine());lastGeneratedLine++;lastGeneratedColumn=0}else{var nextLine=remainingLines[0];var code=nextLine.substr(0,mapping.generatedColumn-lastGeneratedColumn);remainingLines[0]=nextLine.substr(mapping.generatedColumn-lastGeneratedColumn);lastGeneratedColumn=mapping.generatedColumn;addMappingWithCode(lastMapping,code);lastMapping=mapping;return}}while(lastGeneratedLine<mapping.generatedLine){node.add(shiftNextLine());lastGeneratedLine++}if(lastGeneratedColumn<mapping.generatedColumn){var nextLine=remainingLines[0];node.add(nextLine.substr(0,mapping.generatedColumn));remainingLines[0]=nextLine.substr(mapping.generatedColumn);lastGeneratedColumn=mapping.generatedColumn}lastMapping=mapping},this);if(remainingLines.length>0){if(lastMapping){addMappingWithCode(lastMapping,shiftNextLine())}node.add(remainingLines.join(""))}aSourceMapConsumer.sources.forEach(function(sourceFile){var content=aSourceMapConsumer.sourceContentFor(sourceFile);if(content!=null){if(aRelativePath!=null){sourceFile=util.join(aRelativePath,sourceFile)}node.setSourceContent(sourceFile,content)}});return node;function addMappingWithCode(mapping,code){if(mapping===null||mapping.source===undefined){node.add(code)}else{var source=aRelativePath?util.join(aRelativePath,mapping.source):mapping.source;node.add(new SourceNode(mapping.originalLine,mapping.originalColumn,source,code,mapping.name))}}};SourceNode.prototype.add=function SourceNode_add(aChunk){if(Array.isArray(aChunk)){aChunk.forEach(function(chunk){this.add(chunk)},this)}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){if(aChunk){this.children.push(aChunk)}}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.prepend=function SourceNode_prepend(aChunk){if(Array.isArray(aChunk)){for(var i=aChunk.length-1;i>=0;i--){this.prepend(aChunk[i])}}else if(aChunk instanceof SourceNode||typeof aChunk==="string"){this.children.unshift(aChunk)}else{throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+aChunk)}return this};SourceNode.prototype.walk=function SourceNode_walk(aFn){var chunk;for(var i=0,len=this.children.length;i<len;i++){chunk=this.children[i];if(chunk instanceof SourceNode){chunk.walk(aFn)}else{if(chunk!==""){aFn(chunk,{source:this.source,line:this.line,column:this.column,name:this.name})}}}};SourceNode.prototype.join=function SourceNode_join(aSep){var newChildren;var i;var len=this.children.length;if(len>0){newChildren=[];for(i=0;i<len-1;i++){newChildren.push(this.children[i]);newChildren.push(aSep)}newChildren.push(this.children[i]);this.children=newChildren}return this};SourceNode.prototype.replaceRight=function SourceNode_replaceRight(aPattern,aReplacement){var lastChild=this.children[this.children.length-1];if(lastChild instanceof SourceNode){lastChild.replaceRight(aPattern,aReplacement)}else if(typeof lastChild==="string"){this.children[this.children.length-1]=lastChild.replace(aPattern,aReplacement)}else{this.children.push("".replace(aPattern,aReplacement))}return this};SourceNode.prototype.setSourceContent=function SourceNode_setSourceContent(aSourceFile,aSourceContent){this.sourceContents[util.toSetString(aSourceFile)]=aSourceContent};SourceNode.prototype.walkSourceContents=function SourceNode_walkSourceContents(aFn){for(var i=0,len=this.children.length;i<len;i++){if(this.children[i]instanceof SourceNode){this.children[i].walkSourceContents(aFn)}}var sources=Object.keys(this.sourceContents);for(var i=0,len=sources.length;i<len;i++){aFn(util.fromSetString(sources[i]),this.sourceContents[sources[i]])}};SourceNode.prototype.toString=function SourceNode_toString(){var str="";this.walk(function(chunk){str+=chunk});return str};SourceNode.prototype.toStringWithSourceMap=function SourceNode_toStringWithSourceMap(aArgs){var generated={code:"",line:1,column:0};var map=new SourceMapGenerator(aArgs);var sourceMappingActive=false;var lastOriginalSource=null;var lastOriginalLine=null;var lastOriginalColumn=null;var lastOriginalName=null;this.walk(function(chunk,original){generated.code+=chunk;if(original.source!==null&&original.line!==null&&original.column!==null){if(lastOriginalSource!==original.source||lastOriginalLine!==original.line||lastOriginalColumn!==original.column||lastOriginalName!==original.name){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}lastOriginalSource=original.source;lastOriginalLine=original.line;lastOriginalColumn=original.column;lastOriginalName=original.name;sourceMappingActive=true}else if(sourceMappingActive){map.addMapping({generated:{line:generated.line,column:generated.column}});lastOriginalSource=null;sourceMappingActive=false}chunk.match(REGEX_CHARACTER).forEach(function(ch,idx,array){if(REGEX_NEWLINE.test(ch)){generated.line++;generated.column=0;if(idx+1===array.length){lastOriginalSource=null;sourceMappingActive=false}else if(sourceMappingActive){map.addMapping({source:original.source,original:{line:original.line,column:original.column},generated:{line:generated.line,column:generated.column},name:original.name})}}else{generated.column+=ch.length}})});this.walkSourceContents(function(sourceFile,sourceContent){map.setSourceContent(sourceFile,sourceContent)});return{code:generated.code,map:map}};exports.SourceNode=SourceNode})},{"./source-map-generator":14,"./util":16,amdefine:17}],16:[function(require,module,exports){if(typeof define!=="function"){var define=require("amdefine")(module,require)}define(function(require,exports,module){function getArg(aArgs,aName,aDefaultValue){if(aName in aArgs){return aArgs[aName]}else if(arguments.length===3){return aDefaultValue}else{throw new Error('"'+aName+'" is a required argument.')}}exports.getArg=getArg;var urlRegexp=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.]*)(?::(\d+))?(\S*)$/;var dataUrlRegexp=/^data:.+\,.+$/;function urlParse(aUrl){var match=aUrl.match(urlRegexp);if(!match){return null}return{scheme:match[1],auth:match[2],host:match[3],port:match[4],path:match[5]}}exports.urlParse=urlParse;function urlGenerate(aParsedUrl){var url="";if(aParsedUrl.scheme){url+=aParsedUrl.scheme+":"}url+="//";if(aParsedUrl.auth){url+=aParsedUrl.auth+"@"}if(aParsedUrl.host){url+=aParsedUrl.host}if(aParsedUrl.port){url+=":"+aParsedUrl.port}if(aParsedUrl.path){url+=aParsedUrl.path}return url}exports.urlGenerate=urlGenerate;function normalize(aPath){var path=aPath;var url=urlParse(aPath);if(url){if(!url.path){return aPath}path=url.path}var isAbsolute=path.charAt(0)==="/";var parts=path.split(/\/+/);for(var part,up=0,i=parts.length-1;i>=0;i--){part=parts[i];if(part==="."){parts.splice(i,1)}else if(part===".."){up++}else if(up>0){if(part===""){parts.splice(i+1,up);up=0}else{parts.splice(i,2);up--}}}path=parts.join("/");if(path===""){path=isAbsolute?"/":"."}if(url){url.path=path;return urlGenerate(url)}return path}exports.normalize=normalize;function join(aRoot,aPath){if(aRoot===""){aRoot="."}if(aPath===""){aPath="."}var aPathUrl=urlParse(aPath);var aRootUrl=urlParse(aRoot);if(aRootUrl){aRoot=aRootUrl.path||"/"}if(aPathUrl&&!aPathUrl.scheme){if(aRootUrl){aPathUrl.scheme=aRootUrl.scheme}return urlGenerate(aPathUrl)}if(aPathUrl||aPath.match(dataUrlRegexp)){return aPath}if(aRootUrl&&!aRootUrl.host&&!aRootUrl.path){aRootUrl.host=aPath;return urlGenerate(aRootUrl)}var joined=aPath.charAt(0)==="/"?aPath:normalize(aRoot.replace(/\/+$/,"")+"/"+aPath);if(aRootUrl){aRootUrl.path=joined;return urlGenerate(aRootUrl)}return joined}exports.join=join;function relative(aRoot,aPath){if(aRoot===""){aRoot="."}aRoot=aRoot.replace(/\/$/,"");var url=urlParse(aRoot);if(aPath.charAt(0)=="/"&&url&&url.path=="/"){return aPath.slice(1)}return aPath.indexOf(aRoot+"/")===0?aPath.substr(aRoot.length+1):aPath}exports.relative=relative;function toSetString(aStr){return"$"+aStr}exports.toSetString=toSetString;function fromSetString(aStr){return aStr.substr(1)}exports.fromSetString=fromSetString;function strcmp(aStr1,aStr2){var s1=aStr1||"";var s2=aStr2||"";return(s1>s2)-(s1<s2)}function compareByOriginalPositions(mappingA,mappingB,onlyCompareOriginal){var cmp;cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp||onlyCompareOriginal){return cmp}cmp=strcmp(mappingA.name,mappingB.name);if(cmp){return cmp}cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}return mappingA.generatedColumn-mappingB.generatedColumn}exports.compareByOriginalPositions=compareByOriginalPositions;function compareByGeneratedPositions(mappingA,mappingB,onlyCompareGenerated){var cmp;cmp=mappingA.generatedLine-mappingB.generatedLine;if(cmp){return cmp}cmp=mappingA.generatedColumn-mappingB.generatedColumn;if(cmp||onlyCompareGenerated){return cmp}cmp=strcmp(mappingA.source,mappingB.source);if(cmp){return cmp}cmp=mappingA.originalLine-mappingB.originalLine;if(cmp){return cmp}cmp=mappingA.originalColumn-mappingB.originalColumn;if(cmp){return cmp}return strcmp(mappingA.name,mappingB.name)}exports.compareByGeneratedPositions=compareByGeneratedPositions})},{amdefine:17}],17:[function(require,module,exports){(function(process,__filename){"use strict";function amdefine(module,requireFn){"use strict";var defineCache={},loaderCache={},alreadyCalled=false,path=require("path"),makeRequire,stringRequire;function trimDots(ary){var i,part;for(i=0;ary[i];i+=1){part=ary[i];if(part==="."){ary.splice(i,1);i-=1}else if(part===".."){if(i===1&&(ary[2]===".."||ary[0]==="..")){break}else if(i>0){ary.splice(i-1,2);i-=2}}}}function normalize(name,baseName){var baseParts;if(name&&name.charAt(0)==="."){if(baseName){baseParts=baseName.split("/");baseParts=baseParts.slice(0,baseParts.length-1);baseParts=baseParts.concat(name.split("/"));trimDots(baseParts);name=baseParts.join("/")}}return name}function makeNormalize(relName){return function(name){return normalize(name,relName)}}function makeLoad(id){function load(value){loaderCache[id]=value}load.fromText=function(id,text){throw new Error("amdefine does not implement load.fromText")};return load}makeRequire=function(systemRequire,exports,module,relId){function amdRequire(deps,callback){if(typeof deps==="string"){return stringRequire(systemRequire,exports,module,deps,relId)}else{deps=deps.map(function(depName){return stringRequire(systemRequire,exports,module,depName,relId)});process.nextTick(function(){callback.apply(null,deps)})}}amdRequire.toUrl=function(filePath){if(filePath.indexOf(".")===0){return normalize(filePath,path.dirname(module.filename))}else{return filePath}};return amdRequire};requireFn=requireFn||function req(){return module.require.apply(module,arguments)};function runFactory(id,deps,factory){var r,e,m,result;if(id){e=loaderCache[id]={};m={id:id,uri:__filename,exports:e};r=makeRequire(requireFn,e,m,id)}else{if(alreadyCalled){throw new Error("amdefine with no module ID cannot be called more than once per file.")}alreadyCalled=true;e=module.exports;m=module;r=makeRequire(requireFn,e,m,module.id)}if(deps){deps=deps.map(function(depName){return r(depName)})}if(typeof factory==="function"){result=factory.apply(m.exports,deps)}else{result=factory}if(result!==undefined){m.exports=result;if(id){loaderCache[id]=m.exports}}}stringRequire=function(systemRequire,exports,module,id,relId){var index=id.indexOf("!"),originalId=id,prefix,plugin;if(index===-1){id=normalize(id,relId);if(id==="require"){return makeRequire(systemRequire,exports,module,relId)}else if(id==="exports"){return exports}else if(id==="module"){return module}else if(loaderCache.hasOwnProperty(id)){return loaderCache[id]}else if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}else{if(systemRequire){return systemRequire(originalId)}else{throw new Error("No module with ID: "+id)}}}else{prefix=id.substring(0,index);id=id.substring(index+1,id.length);plugin=stringRequire(systemRequire,exports,module,prefix,relId);if(plugin.normalize){id=plugin.normalize(id,makeNormalize(relId))}else{id=normalize(id,relId)}if(loaderCache[id]){return loaderCache[id]}else{plugin.load(id,makeRequire(systemRequire,exports,module,relId),makeLoad(id),{});return loaderCache[id]}}};function define(id,deps,factory){if(Array.isArray(id)){factory=deps;deps=id;id=undefined}else if(typeof id!=="string"){factory=id;id=deps=undefined}if(deps&&!Array.isArray(deps)){factory=deps;deps=undefined}if(!deps){deps=["require","exports","module"]}if(id){defineCache[id]=[id,deps,factory]}else{runFactory(id,deps,factory)}}define.require=function(id){if(loaderCache[id]){return loaderCache[id]}if(defineCache[id]){runFactory.apply(null,defineCache[id]);return loaderCache[id]}};define.amd={};return define}module.exports=amdefine}).call(this,require("_process"),"/node_modules/escodegen/node_modules/source-map/node_modules/amdefine/amdefine.js")},{_process:2,path:1}],18:[function(require,module,exports){module.exports={name:"escodegen",description:"ECMAScript code generator",homepage:"http://github.com/Constellation/escodegen",main:"escodegen.js",bin:{esgenerate:"./bin/esgenerate.js",escodegen:"./bin/escodegen.js"},version:"1.4.1",engines:{node:">=0.10.0"},maintainers:[{name:"Yusuke Suzuki",email:"utatane.tea@gmail.com",web:"http://github.com/Constellation"}],repository:{type:"git",url:"http://github.com/Constellation/escodegen.git"},dependencies:{estraverse:"^1.5.1",esutils:"^1.1.4",esprima:"^1.2.2"},optionalDependencies:{"source-map":"~0.1.37"},devDependencies:{"esprima-moz":"*",semver:"^3.0.1",bluebird:"^2.2.2","jshint-stylish":"^0.4.0",chai:"^1.9.1","gulp-mocha":"^1.0.0","gulp-eslint":"^0.1.8",gulp:"^3.8.6","bower-registry-client":"^0.2.1","gulp-jshint":"^1.8.0","commonjs-everywhere":"^0.9.7"},licenses:[{type:"BSD",url:"http://github.com/Constellation/escodegen/raw/master/LICENSE.BSD"}],scripts:{},readme:"### Escodegen [![Build Status](https://secure.travis-ci.org/Constellation/escodegen.svg)](http://travis-ci.org/Constellation/escodegen) [![Build Status](https://drone.io/github.com/Constellation/escodegen/status.png)](https://drone.io/github.com/Constellation/escodegen/latest) [![devDependency Status](https://david-dm.org/Constellation/escodegen/dev-status.svg)](https://david-dm.org/Constellation/escodegen#info=devDependencies)\n\nEscodegen ([escodegen](http://github.com/Constellation/escodegen)) is an\n[ECMAScript](http://www.ecma-international.org/publications/standards/Ecma-262.htm)\n(also popularly known as [JavaScript](http://en.wikipedia.org/wiki/JavaScript>JavaScript))\ncode generator from [Mozilla'ss Parser API](https://developer.mozilla.org/en/SpiderMonkey/Parser_API)\nAST. See the [online generator](https://constellation.github.io/escodegen/demo/index.html)\nfor a demo.\n\n\n### Install\n\nEscodegen can be used in a web browser:\n\n <script src=\"escodegen.browser.js\"></script>\n\nescodegen.browser.js can be found in tagged revisions on GitHub.\n\nOr in a Node.js application via npm:\n\n npm install escodegen\n\n### Usage\n\nA simple example: the program\n\n escodegen.generate({\n type: 'BinaryExpression',\n operator: '+',\n left: { type: 'Literal', value: 40 },\n right: { type: 'Literal', value: 2 }\n });\n\nproduces the string `'40 + 2'`.\n\nSee the [API page](https://github.com/Constellation/escodegen/wiki/API) for\noptions. To run the tests, execute `npm test` in the root directory.\n\n### Building browser bundle / minified browser bundle\n\nAt first, execute `npm install` to install the all dev dependencies.\nAfter that,\n\n npm run-script build\n\nwill generate `escodegen.browser.js`, which can be used in browser environments.\n\nAnd,\n\n npm run-script build-min\n\nwill generate the minified file `escodegen.browser.min.js`.\n\n### License\n\n#### Escodegen\n\nCopyright (C) 2012 [Yusuke Suzuki](http://github.com/Constellation)\n (twitter: [@Constellation](http://twitter.com/Constellation)) and other contributors.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above copyright\n notice, this list of conditions and the following disclaimer in the\n documentation and/or other materials provided with the distribution.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\nAND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\nIMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\nARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY\nDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF\nTHIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n#### source-map\n\nSourceNodeMocks has a limited interface of mozilla/source-map SourceNode implementations.\n\nCopyright (c) 2009-2011, Mozilla Foundation and contributors\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n\n* Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n\n* Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n\n* Neither the names of the Mozilla Foundation nor the names of project\n contributors may be used to endorse or promote products derived from this\n software without specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\nFOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\nDAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\nSERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\nCAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\nOR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\nOF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n",readmeFilename:"package/README.md"}
},{}],escodegen:[function(require,module,exports){(function(global){(function(){"use strict";var Syntax,Precedence,BinaryPrecedence,SourceNode,estraverse,esutils,isArray,base,indent,json,renumber,hexadecimal,quotes,escapeless,newline,space,parentheses,semicolons,safeConcatenation,directive,extra,parse,sourceMap,FORMAT_MINIFY,FORMAT_DEFAULTS;estraverse=require("estraverse");esutils=require("esutils");Syntax={AssignmentExpression:"AssignmentExpression",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrowFunctionExpression:"ArrowFunctionExpression",BlockStatement:"BlockStatement",BinaryExpression:"BinaryExpression",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DirectiveStatement:"DirectiveStatement",DoWhileStatement:"DoWhileStatement",DebuggerStatement:"DebuggerStatement",EmptyStatement:"EmptyStatement",ExportBatchSpecifier:"ExportBatchSpecifier",ExportDeclaration:"ExportDeclaration",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForStatement:"ForStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",GeneratorExpression:"GeneratorExpression",Identifier:"Identifier",IfStatement:"IfStatement",ImportSpecifier:"ImportSpecifier",ImportDeclaration:"ImportDeclaration",Literal:"Literal",LabeledStatement:"LabeledStatement",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleDeclaration:"ModuleDeclaration",NewExpression:"NewExpression",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",Program:"Program",Property:"Property",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SwitchStatement:"SwitchStatement",SwitchCase:"SwitchCase",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TryStatement:"TryStatement",UnaryExpression:"UnaryExpression",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",WhileStatement:"WhileStatement",WithStatement:"WithStatement",YieldExpression:"YieldExpression"};function isExpression(node){switch(node.type){case Syntax.AssignmentExpression:case Syntax.ArrayExpression:case Syntax.ArrayPattern:case Syntax.BinaryExpression:case Syntax.CallExpression:case Syntax.ConditionalExpression:case Syntax.ClassExpression:case Syntax.ExportBatchSpecifier:case Syntax.ExportSpecifier:case Syntax.FunctionExpression:case Syntax.Identifier:case Syntax.ImportSpecifier:case Syntax.Literal:case Syntax.LogicalExpression:case Syntax.MemberExpression:case Syntax.MethodDefinition:case Syntax.NewExpression:case Syntax.ObjectExpression:case Syntax.ObjectPattern:case Syntax.Property:case Syntax.SequenceExpression:case Syntax.ThisExpression:case Syntax.UnaryExpression:case Syntax.UpdateExpression:case Syntax.YieldExpression:return true}return false}function isStatement(node){switch(node.type){case Syntax.BlockStatement:case Syntax.BreakStatement:case Syntax.CatchClause:case Syntax.ContinueStatement:case Syntax.ClassDeclaration:case Syntax.ClassBody:case Syntax.DirectiveStatement:case Syntax.DoWhileStatement:case Syntax.DebuggerStatement:case Syntax.EmptyStatement:case Syntax.ExpressionStatement:case Syntax.ForStatement:case Syntax.ForInStatement:case Syntax.ForOfStatement:case Syntax.FunctionDeclaration:case Syntax.IfStatement:case Syntax.LabeledStatement:case Syntax.ModuleDeclaration:case Syntax.Program:case Syntax.ReturnStatement:case Syntax.SwitchStatement:case Syntax.SwitchCase:case Syntax.ThrowStatement:case Syntax.TryStatement:case Syntax.VariableDeclaration:case Syntax.VariableDeclarator:case Syntax.WhileStatement:case Syntax.WithStatement:return true}return false}Precedence={Sequence:0,Yield:1,Assignment:1,Conditional:2,ArrowFunction:2,LogicalOR:3,LogicalAND:4,BitwiseOR:5,BitwiseXOR:6,BitwiseAND:7,Equality:8,Relational:9,BitwiseSHIFT:10,Additive:11,Multiplicative:12,Unary:13,Postfix:14,Call:15,New:16,TaggedTemplate:17,Member:18,Primary:19};BinaryPrecedence={"||":Precedence.LogicalOR,"&&":Precedence.LogicalAND,"|":Precedence.BitwiseOR,"^":Precedence.BitwiseXOR,"&":Precedence.BitwiseAND,"==":Precedence.Equality,"!=":Precedence.Equality,"===":Precedence.Equality,"!==":Precedence.Equality,is:Precedence.Equality,isnt:Precedence.Equality,"<":Precedence.Relational,">":Precedence.Relational,"<=":Precedence.Relational,">=":Precedence.Relational,"in":Precedence.Relational,"instanceof":Precedence.Relational,"<<":Precedence.BitwiseSHIFT,">>":Precedence.BitwiseSHIFT,">>>":Precedence.BitwiseSHIFT,"+":Precedence.Additive,"-":Precedence.Additive,"*":Precedence.Multiplicative,"%":Precedence.Multiplicative,"/":Precedence.Multiplicative};function getDefaultOptions(){return{indent:null,base:null,parse:null,comment:false,format:{indent:{style:" ",base:0,adjustMultilineComment:false},newline:"\n",space:" ",json:false,renumber:false,hexadecimal:false,quotes:"single",escapeless:false,compact:false,parentheses:true,semicolons:true,safeConcatenation:false},moz:{comprehensionExpressionStartsWithAssignment:false,starlessGenerator:false},sourceMap:null,sourceMapRoot:null,sourceMapWithCode:false,directive:false,raw:true,verbatim:null}}function stringRepeat(str,num){var result="";for(num|=0;num>0;num>>>=1,str+=str){if(num&1){result+=str}}return result}isArray=Array.isArray;if(!isArray){isArray=function isArray(array){return Object.prototype.toString.call(array)==="[object Array]"}}function hasLineTerminator(str){return/[\r\n]/g.test(str)}function endsWithLineTerminator(str){var len=str.length;return len&&esutils.code.isLineTerminator(str.charCodeAt(len-1))}function updateDeeply(target,override){var key,val;function isHashObject(target){return typeof target==="object"&&target instanceof Object&&!(target instanceof RegExp)}for(key in override){if(override.hasOwnProperty(key)){val=override[key];if(isHashObject(val)){if(isHashObject(target[key])){updateDeeply(target[key],val)}else{target[key]=updateDeeply({},val)}}else{target[key]=val}}}return target}function generateNumber(value){var result,point,temp,exponent,pos;if(value!==value){throw new Error("Numeric literal whose value is NaN")}if(value<0||value===0&&1/value<0){throw new Error("Numeric literal whose value is negative")}if(value===1/0){return json?"null":renumber?"1e400":"1e+400"}result=""+value;if(!renumber||result.length<3){return result}point=result.indexOf(".");if(!json&&result.charCodeAt(0)===48&&point===1){point=0;result=result.slice(1)}temp=result;result=result.replace("e+","e");exponent=0;if((pos=temp.indexOf("e"))>0){exponent=+temp.slice(pos+1);temp=temp.slice(0,pos)}if(point>=0){exponent-=temp.length-point-1;temp=+(temp.slice(0,point)+temp.slice(point+1))+""}pos=0;while(temp.charCodeAt(temp.length+pos-1)===48){--pos}if(pos!==0){exponent-=pos;temp=temp.slice(0,pos)}if(exponent!==0){temp+="e"+exponent}if((temp.length<result.length||hexadecimal&&value>1e12&&Math.floor(value)===value&&(temp="0x"+value.toString(16)).length<result.length)&&+temp===value){result=temp}return result}function escapeRegExpCharacter(ch,previousIsBackslash){if((ch&~1)===8232){return(previousIsBackslash?"u":"\\u")+(ch===8232?"2028":"2029")}else if(ch===10||ch===13){return(previousIsBackslash?"":"\\")+(ch===10?"n":"r")}return String.fromCharCode(ch)}function generateRegExp(reg){var match,result,flags,i,iz,ch,characterInBrack,previousIsBackslash;result=reg.toString();if(reg.source){match=result.match(/\/([^/]*)$/);if(!match){return result}flags=match[1];result="";characterInBrack=false;previousIsBackslash=false;for(i=0,iz=reg.source.length;i<iz;++i){ch=reg.source.charCodeAt(i);if(!previousIsBackslash){if(characterInBrack){if(ch===93){characterInBrack=false}}else{if(ch===47){result+="\\"}else if(ch===91){characterInBrack=true}}result+=escapeRegExpCharacter(ch,previousIsBackslash);previousIsBackslash=ch===92}else{result+=escapeRegExpCharacter(ch,previousIsBackslash);previousIsBackslash=false}}return"/"+result+"/"+flags}return result}function escapeAllowedCharacter(code,next){var hex,result="\\";switch(code){case 8:result+="b";break;case 12:result+="f";break;case 9:result+="t";break;default:hex=code.toString(16).toUpperCase();if(json||code>255){result+="u"+"0000".slice(hex.length)+hex}else if(code===0&&!esutils.code.isDecimalDigit(next)){result+="0"}else if(code===11){result+="x0B"}else{result+="x"+"00".slice(hex.length)+hex}break}return result}function escapeDisallowedCharacter(code){var result="\\";switch(code){case 92:result+="\\";break;case 10:result+="n";break;case 13:result+="r";break;case 8232:result+="u2028";break;case 8233:result+="u2029";break;default:throw new Error("Incorrectly classified character")}return result}function escapeDirective(str){var i,iz,code,quote;quote=quotes==="double"?'"':"'";for(i=0,iz=str.length;i<iz;++i){code=str.charCodeAt(i);if(code===39){quote='"';break}else if(code===34){quote="'";break}else if(code===92){++i}}return quote+str+quote}function escapeString(str){var result="",i,len,code,singleQuotes=0,doubleQuotes=0,single,quote;for(i=0,len=str.length;i<len;++i){code=str.charCodeAt(i);if(code===39){++singleQuotes}else if(code===34){++doubleQuotes}else if(code===47&&json){result+="\\"}else if(esutils.code.isLineTerminator(code)||code===92){result+=escapeDisallowedCharacter(code);continue}else if(json&&code<32||!(json||escapeless||code>=32&&code<=126)){result+=escapeAllowedCharacter(code,str.charCodeAt(i+1));continue}result+=String.fromCharCode(code)}single=!(quotes==="double"||quotes==="auto"&&doubleQuotes<singleQuotes);quote=single?"'":'"';if(!(single?singleQuotes:doubleQuotes)){return quote+result+quote}str=result;result=quote;for(i=0,len=str.length;i<len;++i){code=str.charCodeAt(i);if(code===39&&single||code===34&&!single){result+="\\"}result+=String.fromCharCode(code)}return result+quote}function flattenToString(arr){var i,iz,elem,result="";for(i=0,iz=arr.length;i<iz;++i){elem=arr[i];result+=isArray(elem)?flattenToString(elem):elem}return result}function toSourceNodeWhenNeeded(generated,node){if(!sourceMap){if(isArray(generated)){return flattenToString(generated)}else{return generated}}if(node==null){if(generated instanceof SourceNode){return generated}else{node={}}}if(node.loc==null){return new SourceNode(null,null,sourceMap,generated,node.name||null)}return new SourceNode(node.loc.start.line,node.loc.start.column,sourceMap===true?node.loc.source||null:sourceMap,generated,node.name||null)}function noEmptySpace(){return space?space:" "}function join(left,right){var leftSource,rightSource,leftCharCode,rightCharCode;leftSource=toSourceNodeWhenNeeded(left).toString();if(leftSource.length===0){return[right]}rightSource=toSourceNodeWhenNeeded(right).toString();if(rightSource.length===0){return[left]}leftCharCode=leftSource.charCodeAt(leftSource.length-1);rightCharCode=rightSource.charCodeAt(0);if((leftCharCode===43||leftCharCode===45)&&leftCharCode===rightCharCode||esutils.code.isIdentifierPart(leftCharCode)&&esutils.code.isIdentifierPart(rightCharCode)||leftCharCode===47&&rightCharCode===105){return[left,noEmptySpace(),right]}else if(esutils.code.isWhiteSpace(leftCharCode)||esutils.code.isLineTerminator(leftCharCode)||esutils.code.isWhiteSpace(rightCharCode)||esutils.code.isLineTerminator(rightCharCode)){return[left,right]}return[left,space,right]}function addIndent(stmt){return[base,stmt]}function withIndent(fn){var previousBase,result;previousBase=base;base+=indent;result=fn.call(this,base);base=previousBase;return result}function calculateSpaces(str){var i;for(i=str.length-1;i>=0;--i){if(esutils.code.isLineTerminator(str.charCodeAt(i))){break}}return str.length-1-i}function adjustMultilineComment(value,specialBase){var array,i,len,line,j,spaces,previousBase,sn;array=value.split(/\r\n|[\r\n]/);spaces=Number.MAX_VALUE;for(i=1,len=array.length;i<len;++i){line=array[i];j=0;while(j<line.length&&esutils.code.isWhiteSpace(line.charCodeAt(j))){++j}if(spaces>j){spaces=j}}if(typeof specialBase!=="undefined"){previousBase=base;if(array[1][spaces]==="*"){specialBase+=" "}base=specialBase}else{if(spaces&1){--spaces}previousBase=base}for(i=1,len=array.length;i<len;++i){sn=toSourceNodeWhenNeeded(addIndent(array[i].slice(spaces)));array[i]=sourceMap?sn.join(""):sn}base=previousBase;return array.join("\n")}function generateComment(comment,specialBase){if(comment.type==="Line"){if(endsWithLineTerminator(comment.value)){return"//"+comment.value}else{return"//"+comment.value+"\n"}}if(extra.format.indent.adjustMultilineComment&&/[\n\r]/.test(comment.value)){return adjustMultilineComment("/*"+comment.value+"*/",specialBase)}return"/*"+comment.value+"*/"}function addComments(stmt,result){var i,len,comment,save,tailingToStatement,specialBase,fragment;if(stmt.leadingComments&&stmt.leadingComments.length>0){save=result;comment=stmt.leadingComments[0];result=[];if(safeConcatenation&&stmt.type===Syntax.Program&&stmt.body.length===0){result.push("\n")}result.push(generateComment(comment));if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push("\n")}for(i=1,len=stmt.leadingComments.length;i<len;++i){comment=stmt.leadingComments[i];fragment=[generateComment(comment)];if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){fragment.push("\n")}result.push(addIndent(fragment))}result.push(addIndent(save))}if(stmt.trailingComments){tailingToStatement=!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString());specialBase=stringRepeat(" ",calculateSpaces(toSourceNodeWhenNeeded([base,result,indent]).toString()));for(i=0,len=stmt.trailingComments.length;i<len;++i){comment=stmt.trailingComments[i];if(tailingToStatement){if(i===0){result=[result,indent]}else{result=[result,specialBase]}result.push(generateComment(comment,specialBase))}else{result=[result,addIndent(generateComment(comment))]}if(i!==len-1&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result=[result,"\n"]}}}return result}function parenthesize(text,current,should){if(current<should){return["(",text,")"]}return text}function maybeBlock(stmt,semicolonOptional,functionBody){var result,noLeadingComment;noLeadingComment=!extra.comment||!stmt.leadingComments;if(stmt.type===Syntax.BlockStatement&&noLeadingComment){return[space,generateStatement(stmt,{functionBody:functionBody})]}if(stmt.type===Syntax.EmptyStatement&&noLeadingComment){return";"}withIndent(function(){result=[newline,addIndent(generateStatement(stmt,{semicolonOptional:semicolonOptional,functionBody:functionBody}))]});return result}function maybeBlockSuffix(stmt,result){var ends=endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString());if(stmt.type===Syntax.BlockStatement&&(!extra.comment||!stmt.leadingComments)&&!ends){return[result,space]}if(ends){return[result,base]}return[result,newline,base]}function generateVerbatimString(string){var i,iz,result;result=string.split(/\r\n|\n/);for(i=1,iz=result.length;i<iz;i++){result[i]=newline+base+result[i]}return result}function generateVerbatim(expr,option){var verbatim,result,prec;verbatim=expr[extra.verbatim];if(typeof verbatim==="string"){result=parenthesize(generateVerbatimString(verbatim),Precedence.Sequence,option.precedence)}else{result=generateVerbatimString(verbatim.content);prec=verbatim.precedence!=null?verbatim.precedence:Precedence.Sequence;result=parenthesize(result,prec,option.precedence)}return toSourceNodeWhenNeeded(result,expr)}function generateIdentifier(node){return toSourceNodeWhenNeeded(node.name,node)}function generatePattern(node,options){var result;if(node.type===Syntax.Identifier){result=generateIdentifier(node)}else{result=generateExpression(node,{precedence:options.precedence,allowIn:options.allowIn,allowCall:true})}return result}function generateFunctionParams(node){var i,iz,result,hasDefault;hasDefault=false;if(node.type===Syntax.ArrowFunctionExpression&&!node.rest&&(!node.defaults||node.defaults.length===0)&&node.params.length===1&&node.params[0].type===Syntax.Identifier){result=[generateIdentifier(node.params[0])]}else{result=["("];if(node.defaults){hasDefault=true}for(i=0,iz=node.params.length;i<iz;++i){if(hasDefault&&node.defaults[i]){result.push(generateAssignment(node.params[i],node.defaults[i],"=",{precedence:Precedence.Assignment,allowIn:true,allowCall:true}))}else{result.push(generatePattern(node.params[i],{precedence:Precedence.Assignment,allowIn:true,allowCall:true}))}if(i+1<iz){result.push(","+space)}}if(node.rest){if(node.params.length){result.push(","+space)}result.push("...");result.push(generateIdentifier(node.rest,{precedence:Precedence.Assignment,allowIn:true,allowCall:true}))}result.push(")")}return result}function generateFunctionBody(node){var result,expr;result=generateFunctionParams(node);if(node.type===Syntax.ArrowFunctionExpression){result.push(space);result.push("=>")}if(node.expression){result.push(space);expr=generateExpression(node.body,{precedence:Precedence.Assignment,allowIn:true,allowCall:true});if(expr.toString().charAt(0)==="{"){expr=["(",expr,")"]}result.push(expr)}else{result.push(maybeBlock(node.body,false,true))}return result}function generateIterationForStatement(operator,stmt,semicolonIsNotNeeded){var result=["for"+space+"("];withIndent(function(){if(stmt.left.type===Syntax.VariableDeclaration){withIndent(function(){result.push(stmt.left.kind+noEmptySpace());result.push(generateStatement(stmt.left.declarations[0],{allowIn:false}))})}else{result.push(generateExpression(stmt.left,{precedence:Precedence.Call,allowIn:true,allowCall:true}))}result=join(result,operator);result=[join(result,generateExpression(stmt.right,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})),")"]});result.push(maybeBlock(stmt.body,semicolonIsNotNeeded));return result}function generateVariableDeclaration(stmt,semicolon,allowIn){var result,i,iz,node;result=[stmt.kind];function block(){node=stmt.declarations[0];if(extra.comment&&node.leadingComments){result.push("\n");result.push(addIndent(generateStatement(node,{allowIn:allowIn})))}else{result.push(noEmptySpace());result.push(generateStatement(node,{allowIn:allowIn}))}for(i=1,iz=stmt.declarations.length;i<iz;++i){node=stmt.declarations[i];if(extra.comment&&node.leadingComments){result.push(","+newline);result.push(addIndent(generateStatement(node,{allowIn:allowIn})))}else{result.push(","+space);result.push(generateStatement(node,{allowIn:allowIn}))}}}if(stmt.declarations.length>1){withIndent(block)}else{block()}result.push(semicolon);return result}function generateClassBody(classBody){var result=["{",newline];withIndent(function(indent){var i,iz;for(i=0,iz=classBody.body.length;i<iz;++i){result.push(indent);result.push(generateExpression(classBody.body[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true,type:Syntax.Property}));if(i+1<iz){result.push(newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base);result.push("}");return result}function generateLiteral(expr){var raw;if(expr.hasOwnProperty("raw")&&parse&&extra.raw){try{raw=parse(expr.raw).body[0].expression;if(raw.type===Syntax.Literal){if(raw.value===expr.value){return expr.raw}}}catch(e){}}if(expr.value===null){return"null"}if(typeof expr.value==="string"){return escapeString(expr.value)}if(typeof expr.value==="number"){return generateNumber(expr.value)}if(typeof expr.value==="boolean"){return expr.value?"true":"false"}return generateRegExp(expr.value)}function generatePropertyKey(expr,computed,option){var result=[];if(computed){result.push("[")}result.push(generateExpression(expr,option));if(computed){result.push("]")}return result}function generateAssignment(left,right,operator,option){var allowIn,precedence;precedence=option.precedence;allowIn=option.allowIn||Precedence.Assignment<precedence;return parenthesize([generateExpression(left,{precedence:Precedence.Call,allowIn:allowIn,allowCall:true}),space+operator+space,generateExpression(right,{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true})],Precedence.Assignment,precedence)}function generateExpression(expr,option){var result,precedence,type,currentPrecedence,i,len,fragment,multiline,leftCharCode,leftSource,rightCharCode,allowIn,allowCall,allowUnparenthesizedNew,property,isGenerator;precedence=option.precedence;allowIn=option.allowIn;allowCall=option.allowCall;type=expr.type||option.type;if(extra.verbatim&&expr.hasOwnProperty(extra.verbatim)){return generateVerbatim(expr,option)}switch(type){case Syntax.SequenceExpression:result=[];allowIn|=Precedence.Sequence<precedence;for(i=0,len=expr.expressions.length;i<len;++i){result.push(generateExpression(expr.expressions[i],{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true}));if(i+1<len){result.push(","+space)}}result=parenthesize(result,Precedence.Sequence,precedence);break;case Syntax.AssignmentExpression:result=generateAssignment(expr.left,expr.right,expr.operator,option);break;case Syntax.ArrowFunctionExpression:allowIn|=Precedence.ArrowFunction<precedence;result=parenthesize(generateFunctionBody(expr),Precedence.ArrowFunction,precedence);break;case Syntax.ConditionalExpression:allowIn|=Precedence.Conditional<precedence;result=parenthesize([generateExpression(expr.test,{precedence:Precedence.LogicalOR,allowIn:allowIn,allowCall:true}),space+"?"+space,generateExpression(expr.consequent,{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true}),space+":"+space,generateExpression(expr.alternate,{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true})],Precedence.Conditional,precedence);break;case Syntax.LogicalExpression:case Syntax.BinaryExpression:currentPrecedence=BinaryPrecedence[expr.operator];allowIn|=currentPrecedence<precedence;fragment=generateExpression(expr.left,{precedence:currentPrecedence,allowIn:allowIn,allowCall:true});leftSource=fragment.toString();if(leftSource.charCodeAt(leftSource.length-1)===47&&esutils.code.isIdentifierPart(expr.operator.charCodeAt(0))){result=[fragment,noEmptySpace(),expr.operator]}else{result=join(fragment,expr.operator)}fragment=generateExpression(expr.right,{precedence:currentPrecedence+1,allowIn:allowIn,allowCall:true});if(expr.operator==="/"&&fragment.toString().charAt(0)==="/"||expr.operator.slice(-1)==="<"&&fragment.toString().slice(0,3)==="!--"){result.push(noEmptySpace());result.push(fragment)}else{result=join(result,fragment)}if(expr.operator==="in"&&!allowIn){result=["(",result,")"]}else{result=parenthesize(result,currentPrecedence,precedence)}break;case Syntax.CallExpression:result=[generateExpression(expr.callee,{precedence:Precedence.Call,allowIn:true,allowCall:true,allowUnparenthesizedNew:false})];result.push("(");for(i=0,len=expr["arguments"].length;i<len;++i){result.push(generateExpression(expr["arguments"][i],{precedence:Precedence.Assignment,allowIn:true,allowCall:true}));if(i+1<len){result.push(","+space)}}result.push(")");if(!allowCall){result=["(",result,")"]}else{result=parenthesize(result,Precedence.Call,precedence)}break;case Syntax.NewExpression:len=expr["arguments"].length;allowUnparenthesizedNew=option.allowUnparenthesizedNew===undefined||option.allowUnparenthesizedNew;result=join("new",generateExpression(expr.callee,{precedence:Precedence.New,allowIn:true,allowCall:false,allowUnparenthesizedNew:allowUnparenthesizedNew&&!parentheses&&len===0}));if(!allowUnparenthesizedNew||parentheses||len>0){result.push("(");for(i=0;i<len;++i){result.push(generateExpression(expr["arguments"][i],{precedence:Precedence.Assignment,allowIn:true,allowCall:true}));if(i+1<len){result.push(","+space)}}result.push(")")}result=parenthesize(result,Precedence.New,precedence);break;case Syntax.MemberExpression:result=[generateExpression(expr.object,{precedence:Precedence.Call,allowIn:true,allowCall:allowCall,allowUnparenthesizedNew:false})];if(expr.computed){result.push("[");result.push(generateExpression(expr.property,{precedence:Precedence.Sequence,allowIn:true,allowCall:allowCall}));result.push("]")}else{if(expr.object.type===Syntax.Literal&&typeof expr.object.value==="number"){fragment=toSourceNodeWhenNeeded(result).toString();if(fragment.indexOf(".")<0&&!/[eExX]/.test(fragment)&&esutils.code.isDecimalDigit(fragment.charCodeAt(fragment.length-1))&&!(fragment.length>=2&&fragment.charCodeAt(0)===48)){result.push(".")}}result.push(".");result.push(generateIdentifier(expr.property))}result=parenthesize(result,Precedence.Member,precedence);break;case Syntax.UnaryExpression:fragment=generateExpression(expr.argument,{precedence:Precedence.Unary,allowIn:true,allowCall:true});if(space===""){result=join(expr.operator,fragment)}else{result=[expr.operator];if(expr.operator.length>2){result=join(result,fragment)}else{leftSource=toSourceNodeWhenNeeded(result).toString();leftCharCode=leftSource.charCodeAt(leftSource.length-1);rightCharCode=fragment.toString().charCodeAt(0);if((leftCharCode===43||leftCharCode===45)&&leftCharCode===rightCharCode||esutils.code.isIdentifierPart(leftCharCode)&&esutils.code.isIdentifierPart(rightCharCode)){result.push(noEmptySpace());result.push(fragment)}else{result.push(fragment)}}}result=parenthesize(result,Precedence.Unary,precedence);break;case Syntax.YieldExpression:if(expr.delegate){result="yield*"}else{result="yield"}if(expr.argument){result=join(result,generateExpression(expr.argument,{precedence:Precedence.Yield,allowIn:true,allowCall:true}))}result=parenthesize(result,Precedence.Yield,precedence);break;case Syntax.UpdateExpression:if(expr.prefix){result=parenthesize([expr.operator,generateExpression(expr.argument,{precedence:Precedence.Unary,allowIn:true,allowCall:true})],Precedence.Unary,precedence)}else{result=parenthesize([generateExpression(expr.argument,{precedence:Precedence.Postfix,allowIn:true,allowCall:true}),expr.operator],Precedence.Postfix,precedence)}break;case Syntax.FunctionExpression:isGenerator=expr.generator&&!extra.moz.starlessGenerator;result=isGenerator?"function*":"function";if(expr.id){result=[result,isGenerator?space:noEmptySpace(),generateIdentifier(expr.id),generateFunctionBody(expr)]}else{result=[result+space,generateFunctionBody(expr)]}break;case Syntax.ExportBatchSpecifier:result="*";break;case Syntax.ArrayPattern:case Syntax.ArrayExpression:if(!expr.elements.length){result="[]";break}multiline=expr.elements.length>1;result=["[",multiline?newline:""];withIndent(function(indent){for(i=0,len=expr.elements.length;i<len;++i){if(!expr.elements[i]){if(multiline){result.push(indent)}if(i+1===len){result.push(",")}}else{result.push(multiline?indent:"");result.push(generateExpression(expr.elements[i],{precedence:Precedence.Assignment,allowIn:true,allowCall:true}))}if(i+1<len){result.push(","+(multiline?newline:space))}}});if(multiline&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(multiline?base:"");result.push("]");break;case Syntax.ClassExpression:result=["class"];if(expr.id){result=join(result,generateExpression(expr.id,{allowIn:true,allowCall:true}))}if(expr.superClass){fragment=join("extends",generateExpression(expr.superClass,{precedence:Precedence.Assignment,allowIn:true,allowCall:true}));result=join(result,fragment)}result.push(space);result.push(generateStatement(expr.body,{semicolonOptional:true,directiveContext:false}));break;case Syntax.MethodDefinition:if(expr["static"]){result=["static"+space]}else{result=[]}if(expr.kind==="get"||expr.kind==="set"){result=join(result,[join(expr.kind,generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})),generateFunctionBody(expr.value)])}else{fragment=[generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),generateFunctionBody(expr.value)];if(expr.value.generator){result.push("*");result.push(fragment)}else{result=join(result,fragment)}}break;case Syntax.Property:if(expr.kind==="get"||expr.kind==="set"){result=[expr.kind,noEmptySpace(),generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),generateFunctionBody(expr.value)]}else{if(expr.shorthand){result=generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})}else if(expr.method){result=[];if(expr.value.generator){result.push("*")}result.push(generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result.push(generateFunctionBody(expr.value))}else{result=[generatePropertyKey(expr.key,expr.computed,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),":"+space,generateExpression(expr.value,{precedence:Precedence.Assignment,allowIn:true,allowCall:true})]}}break;case Syntax.ObjectExpression:if(!expr.properties.length){result="{}";break}multiline=expr.properties.length>1;withIndent(function(){fragment=generateExpression(expr.properties[0],{precedence:Precedence.Sequence,allowIn:true,allowCall:true,type:Syntax.Property})});if(!multiline){if(!hasLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result=["{",space,fragment,space,"}"];break}}withIndent(function(indent){result=["{",newline,indent,fragment];if(multiline){result.push(","+newline);for(i=1,len=expr.properties.length;i<len;++i){result.push(indent);result.push(generateExpression(expr.properties[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true,type:Syntax.Property}));if(i+1<len){result.push(","+newline)}}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base);result.push("}");break;case Syntax.ObjectPattern:if(!expr.properties.length){result="{}";break}multiline=false;if(expr.properties.length===1){property=expr.properties[0];if(property.value.type!==Syntax.Identifier){multiline=true}}else{for(i=0,len=expr.properties.length;i<len;++i){property=expr.properties[i];if(!property.shorthand){multiline=true;break}}}result=["{",multiline?newline:""];withIndent(function(indent){for(i=0,len=expr.properties.length;i<len;++i){result.push(multiline?indent:"");result.push(generateExpression(expr.properties[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));if(i+1<len){result.push(","+(multiline?newline:space))}}});if(multiline&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(multiline?base:"");result.push("}");break;case Syntax.ThisExpression:result="this";break;case Syntax.Identifier:result=generateIdentifier(expr);break;case Syntax.ImportSpecifier:case Syntax.ExportSpecifier:result=[expr.id.name];if(expr.name){result.push(noEmptySpace()+"as"+noEmptySpace()+expr.name.name)}break;case Syntax.Literal:result=generateLiteral(expr);break;case Syntax.GeneratorExpression:case Syntax.ComprehensionExpression:result=type===Syntax.GeneratorExpression?["("]:["["];if(extra.moz.comprehensionExpressionStartsWithAssignment){fragment=generateExpression(expr.body,{precedence:Precedence.Assignment,allowIn:true,allowCall:true});result.push(fragment)}if(expr.blocks){withIndent(function(){for(i=0,len=expr.blocks.length;i<len;++i){fragment=generateExpression(expr.blocks[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true});if(i>0||extra.moz.comprehensionExpressionStartsWithAssignment){result=join(result,fragment)}else{result.push(fragment)}}})}if(expr.filter){result=join(result,"if"+space);fragment=generateExpression(expr.filter,{precedence:Precedence.Sequence,allowIn:true,allowCall:true});result=join(result,["(",fragment,")"])}if(!extra.moz.comprehensionExpressionStartsWithAssignment){fragment=generateExpression(expr.body,{precedence:Precedence.Assignment,allowIn:true,allowCall:true});
result=join(result,fragment)}result.push(type===Syntax.GeneratorExpression?")":"]");break;case Syntax.ComprehensionBlock:if(expr.left.type===Syntax.VariableDeclaration){fragment=[expr.left.kind,noEmptySpace(),generateStatement(expr.left.declarations[0],{allowIn:false})]}else{fragment=generateExpression(expr.left,{precedence:Precedence.Call,allowIn:true,allowCall:true})}fragment=join(fragment,expr.of?"of":"in");fragment=join(fragment,generateExpression(expr.right,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result=["for"+space+"(",fragment,")"];break;case Syntax.SpreadElement:result=["...",generateExpression(expr.argument,{precedence:Precedence.Assignment,allowIn:true,allowCall:true})];break;case Syntax.TaggedTemplateExpression:result=[generateExpression(expr.tag,{precedence:Precedence.Call,allowIn:true,allowCall:allowCall,allowUnparenthesizedNew:false}),generateExpression(expr.quasi,{precedence:Precedence.Primary})];result=parenthesize(result,Precedence.TaggedTemplate,precedence);break;case Syntax.TemplateElement:result=expr.value.raw;break;case Syntax.TemplateLiteral:result=["`"];for(i=0,len=expr.quasis.length;i<len;++i){result.push(generateExpression(expr.quasis[i],{precedence:Precedence.Primary,allowIn:true,allowCall:true}));if(i+1<len){result.push("${"+space);result.push(generateExpression(expr.expressions[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result.push(space+"}")}}result.push("`");break;default:throw new Error("Unknown expression type: "+expr.type)}if(extra.comment){result=addComments(expr,result)}return toSourceNodeWhenNeeded(result,expr)}function generateImportDeclaration(stmt,semicolon){var result,namedStart;if(stmt.specifiers.length===0){return["import",space,generateLiteral(stmt.source),semicolon]}result=["import"];namedStart=0;if(stmt.specifiers[0]["default"]){result=join(result,[stmt.specifiers[0].id.name]);++namedStart}if(stmt.specifiers[namedStart]){if(namedStart!==0){result.push(",")}result.push(space+"{");if(stmt.specifiers.length-namedStart===1){result.push(space);result.push(generateExpression(stmt.specifiers[namedStart],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result.push(space+"}"+space)}else{withIndent(function(indent){var i,iz;result.push(newline);for(i=namedStart,iz=stmt.specifiers.length;i<iz;++i){result.push(indent);result.push(generateExpression(stmt.specifiers[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));if(i+1<iz){result.push(","+newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base+"}"+space)}}result=join(result,["from"+space,generateLiteral(stmt.source),semicolon]);return result}function generateStatement(stmt,option){var i,len,result,allowIn,functionBody,directiveContext,fragment,semicolon,isGenerator,guardedHandlers;allowIn=true;semicolon=";";functionBody=false;directiveContext=false;if(option){allowIn=option.allowIn===undefined||option.allowIn;if(!semicolons&&option.semicolonOptional===true){semicolon=""}functionBody=option.functionBody;directiveContext=option.directiveContext}switch(stmt.type){case Syntax.BlockStatement:result=["{",newline];withIndent(function(){for(i=0,len=stmt.body.length;i<len;++i){fragment=addIndent(generateStatement(stmt.body[i],{semicolonOptional:i===len-1,directiveContext:functionBody}));result.push(fragment);if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}});result.push(addIndent("}"));break;case Syntax.BreakStatement:if(stmt.label){result="break "+stmt.label.name+semicolon}else{result="break"+semicolon}break;case Syntax.ContinueStatement:if(stmt.label){result="continue "+stmt.label.name+semicolon}else{result="continue"+semicolon}break;case Syntax.ClassBody:result=generateClassBody(stmt);break;case Syntax.ClassDeclaration:result=["class "+stmt.id.name];if(stmt.superClass){fragment=join("extends",generateExpression(stmt.superClass,{precedence:Precedence.Assignment,allowIn:true,allowCall:true}));result=join(result,fragment)}result.push(space);result.push(generateStatement(stmt.body,{semicolonOptional:true,directiveContext:false}));break;case Syntax.DirectiveStatement:if(extra.raw&&stmt.raw){result=stmt.raw+semicolon}else{result=escapeDirective(stmt.directive)+semicolon}break;case Syntax.DoWhileStatement:result=join("do",maybeBlock(stmt.body));result=maybeBlockSuffix(stmt.body,result);result=join(result,["while"+space+"(",generateExpression(stmt.test,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"+semicolon]);break;case Syntax.CatchClause:withIndent(function(){var guard;result=["catch"+space+"(",generateExpression(stmt.param,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"];if(stmt.guard){guard=generateExpression(stmt.guard,{precedence:Precedence.Sequence,allowIn:true,allowCall:true});result.splice(2,0," if ",guard)}});result.push(maybeBlock(stmt.body));break;case Syntax.DebuggerStatement:result="debugger"+semicolon;break;case Syntax.EmptyStatement:result=";";break;case Syntax.ExportDeclaration:result=["export"];if(stmt["default"]){result=join(result,"default");result=join(result,generateExpression(stmt.declaration,{precedence:Precedence.Assignment,allowIn:true,allowCall:true})+semicolon);break}if(stmt.specifiers){if(stmt.specifiers.length===0){result=join(result,"{"+space+"}")}else if(stmt.specifiers[0].type===Syntax.ExportBatchSpecifier){result=join(result,generateExpression(stmt.specifiers[0],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}))}else{result=join(result,"{");withIndent(function(indent){var i,iz;result.push(newline);for(i=0,iz=stmt.specifiers.length;i<iz;++i){result.push(indent);result.push(generateExpression(stmt.specifiers[i],{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));if(i+1<iz){result.push(","+newline)}}});if(!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}result.push(base+"}")}if(stmt.source){result=join(result,["from"+space,generateLiteral(stmt.source),semicolon])}else{result.push(semicolon)}break}if(stmt.declaration){result=join(result,generateStatement(stmt.declaration,{semicolonOptional:semicolon===""}))}break;case Syntax.ExpressionStatement:result=[generateExpression(stmt.expression,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})];fragment=toSourceNodeWhenNeeded(result).toString();if(fragment.charAt(0)==="{"||fragment.slice(0,5)==="class"&&" {".indexOf(fragment.charAt(5))>=0||fragment.slice(0,8)==="function"&&"* (".indexOf(fragment.charAt(8))>=0||directive&&directiveContext&&stmt.expression.type===Syntax.Literal&&typeof stmt.expression.value==="string"){result=["(",result,")"+semicolon]}else{result.push(semicolon)}break;case Syntax.ImportDeclaration:result=generateImportDeclaration(stmt,semicolon);break;case Syntax.VariableDeclarator:if(stmt.init){result=[generateExpression(stmt.id,{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true}),space,"=",space,generateExpression(stmt.init,{precedence:Precedence.Assignment,allowIn:allowIn,allowCall:true})]}else{result=generatePattern(stmt.id,{precedence:Precedence.Assignment,allowIn:allowIn})}break;case Syntax.VariableDeclaration:result=generateVariableDeclaration(stmt,semicolon,allowIn);break;case Syntax.ThrowStatement:result=[join("throw",generateExpression(stmt.argument,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})),semicolon];break;case Syntax.TryStatement:result=["try",maybeBlock(stmt.block)];result=maybeBlockSuffix(stmt.block,result);if(stmt.handlers){for(i=0,len=stmt.handlers.length;i<len;++i){result=join(result,generateStatement(stmt.handlers[i]));if(stmt.finalizer||i+1!==len){result=maybeBlockSuffix(stmt.handlers[i].body,result)}}}else{guardedHandlers=stmt.guardedHandlers||[];for(i=0,len=guardedHandlers.length;i<len;++i){result=join(result,generateStatement(guardedHandlers[i]));if(stmt.finalizer||i+1!==len){result=maybeBlockSuffix(guardedHandlers[i].body,result)}}if(stmt.handler){if(isArray(stmt.handler)){for(i=0,len=stmt.handler.length;i<len;++i){result=join(result,generateStatement(stmt.handler[i]));if(stmt.finalizer||i+1!==len){result=maybeBlockSuffix(stmt.handler[i].body,result)}}}else{result=join(result,generateStatement(stmt.handler));if(stmt.finalizer){result=maybeBlockSuffix(stmt.handler.body,result)}}}}if(stmt.finalizer){result=join(result,["finally",maybeBlock(stmt.finalizer)])}break;case Syntax.SwitchStatement:withIndent(function(){result=["switch"+space+"(",generateExpression(stmt.discriminant,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"+space+"{"+newline]});if(stmt.cases){for(i=0,len=stmt.cases.length;i<len;++i){fragment=addIndent(generateStatement(stmt.cases[i],{semicolonOptional:i===len-1}));result.push(fragment);if(!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}}result.push(addIndent("}"));break;case Syntax.SwitchCase:withIndent(function(){if(stmt.test){result=[join("case",generateExpression(stmt.test,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})),":"]}else{result=["default:"]}i=0;len=stmt.consequent.length;if(len&&stmt.consequent[0].type===Syntax.BlockStatement){fragment=maybeBlock(stmt.consequent[0]);result.push(fragment);i=1}if(i!==len&&!endsWithLineTerminator(toSourceNodeWhenNeeded(result).toString())){result.push(newline)}for(;i<len;++i){fragment=addIndent(generateStatement(stmt.consequent[i],{semicolonOptional:i===len-1&&semicolon===""}));result.push(fragment);if(i+1!==len&&!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}});break;case Syntax.IfStatement:withIndent(function(){result=["if"+space+"(",generateExpression(stmt.test,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"]});if(stmt.alternate){result.push(maybeBlock(stmt.consequent));result=maybeBlockSuffix(stmt.consequent,result);if(stmt.alternate.type===Syntax.IfStatement){result=join(result,["else ",generateStatement(stmt.alternate,{semicolonOptional:semicolon===""})])}else{result=join(result,join("else",maybeBlock(stmt.alternate,semicolon==="")))}}else{result.push(maybeBlock(stmt.consequent,semicolon===""))}break;case Syntax.ForStatement:withIndent(function(){result=["for"+space+"("];if(stmt.init){if(stmt.init.type===Syntax.VariableDeclaration){result.push(generateStatement(stmt.init,{allowIn:false}))}else{result.push(generateExpression(stmt.init,{precedence:Precedence.Sequence,allowIn:false,allowCall:true}));result.push(";")}}else{result.push(";")}if(stmt.test){result.push(space);result.push(generateExpression(stmt.test,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result.push(";")}else{result.push(";")}if(stmt.update){result.push(space);result.push(generateExpression(stmt.update,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}));result.push(")")}else{result.push(")")}});result.push(maybeBlock(stmt.body,semicolon===""));break;case Syntax.ForInStatement:result=generateIterationForStatement("in",stmt,semicolon==="");break;case Syntax.ForOfStatement:result=generateIterationForStatement("of",stmt,semicolon==="");break;case Syntax.LabeledStatement:result=[stmt.label.name+":",maybeBlock(stmt.body,semicolon==="")];break;case Syntax.ModuleDeclaration:result=["module",noEmptySpace(),stmt.id.name,noEmptySpace(),"from",space,generateLiteral(stmt.source),semicolon];break;case Syntax.Program:len=stmt.body.length;result=[safeConcatenation&&len>0?"\n":""];for(i=0;i<len;++i){fragment=addIndent(generateStatement(stmt.body[i],{semicolonOptional:!safeConcatenation&&i===len-1,directiveContext:true}));result.push(fragment);if(i+1<len&&!endsWithLineTerminator(toSourceNodeWhenNeeded(fragment).toString())){result.push(newline)}}break;case Syntax.FunctionDeclaration:isGenerator=stmt.generator&&!extra.moz.starlessGenerator;result=[isGenerator?"function*":"function",isGenerator?space:noEmptySpace(),generateIdentifier(stmt.id),generateFunctionBody(stmt)];break;case Syntax.ReturnStatement:if(stmt.argument){result=[join("return",generateExpression(stmt.argument,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})),semicolon]}else{result=["return"+semicolon]}break;case Syntax.WhileStatement:withIndent(function(){result=["while"+space+"(",generateExpression(stmt.test,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"]});result.push(maybeBlock(stmt.body,semicolon===""));break;case Syntax.WithStatement:withIndent(function(){result=["with"+space+"(",generateExpression(stmt.object,{precedence:Precedence.Sequence,allowIn:true,allowCall:true}),")"]});result.push(maybeBlock(stmt.body,semicolon===""));break;default:throw new Error("Unknown statement type: "+stmt.type)}if(extra.comment){result=addComments(stmt,result)}fragment=toSourceNodeWhenNeeded(result).toString();if(stmt.type===Syntax.Program&&!safeConcatenation&&newline===""&&fragment.charAt(fragment.length-1)==="\n"){result=sourceMap?toSourceNodeWhenNeeded(result).replaceRight(/\s+$/,""):fragment.replace(/\s+$/,"")}return toSourceNodeWhenNeeded(result,stmt)}function generateInternal(node){if(isStatement(node)){return generateStatement(node)}if(isExpression(node)){return generateExpression(node,{precedence:Precedence.Sequence,allowIn:true,allowCall:true})}throw new Error("Unknown node type: "+node.type)}function generate(node,options){var defaultOptions=getDefaultOptions(),result,pair;if(options!=null){if(typeof options.indent==="string"){defaultOptions.format.indent.style=options.indent}if(typeof options.base==="number"){defaultOptions.format.indent.base=options.base}options=updateDeeply(defaultOptions,options);indent=options.format.indent.style;if(typeof options.base==="string"){base=options.base}else{base=stringRepeat(indent,options.format.indent.base)}}else{options=defaultOptions;indent=options.format.indent.style;base=stringRepeat(indent,options.format.indent.base)}json=options.format.json;renumber=options.format.renumber;hexadecimal=json?false:options.format.hexadecimal;quotes=json?"double":options.format.quotes;escapeless=options.format.escapeless;newline=options.format.newline;space=options.format.space;if(options.format.compact){newline=space=indent=base=""}parentheses=options.format.parentheses;semicolons=options.format.semicolons;safeConcatenation=options.format.safeConcatenation;directive=options.directive;parse=json?null:options.parse;sourceMap=options.sourceMap;extra=options;if(sourceMap){if(!exports.browser){SourceNode=require("source-map").SourceNode}else{SourceNode=global.sourceMap.SourceNode}}result=generateInternal(node);if(!sourceMap){pair={code:result.toString(),map:null};return options.sourceMapWithCode?pair:pair.code}pair=result.toStringWithSourceMap({file:options.file,sourceRoot:options.sourceMapRoot});if(options.sourceContent){pair.map.setSourceContent(options.sourceMap,options.sourceContent)}if(options.sourceMapWithCode){return pair}return pair.map.toString()}FORMAT_MINIFY={indent:{style:"",base:0},renumber:true,hexadecimal:true,quotes:"auto",escapeless:true,compact:true,parentheses:false,semicolons:false};FORMAT_DEFAULTS=getDefaultOptions().format;exports.version=require("./package.json").version;exports.generate=generate;exports.attachComments=estraverse.attachComments;exports.Precedence=updateDeeply({},Precedence);exports.browser=false;exports.FORMAT_MINIFY=FORMAT_MINIFY;exports.FORMAT_DEFAULTS=FORMAT_DEFAULTS})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./package.json":18,estraverse:3,esutils:7,"source-map":8}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({treeify:[function(require,module,exports){(function(root,factory){if(typeof exports==="object"){module.exports=factory()}else if(typeof define==="function"&&define.amd){define(factory)}else{root.treeify=factory()}})(this,function(){function makePrefix(key,last){var str=last?"└":"├";if(key){str+="─ "}else{str+="──┐"}return str}function filterKeys(obj,hideFunctions){var keys=[];for(var branch in obj){if(!obj.hasOwnProperty(branch)){continue}if(hideFunctions&&typeof obj[branch]==="function"){continue}keys.push(branch)}return keys}function growBranch(key,root,last,lastStates,showValues,hideFunctions,callback){var line="",index=0,lastKey,circular,lastStatesCopy=lastStates.slice(0);if(lastStatesCopy.push([root,last])&&lastStates.length>0){lastStates.forEach(function(lastState,idx){if(idx>0){line+=(lastState[1]?" ":"│")+" "}if(!circular&&lastState[0]===root){circular=true}});line+=makePrefix(key,last)+key;showValues&&typeof root!=="object"&&(line+=": "+root);circular&&(line+=" (circular ref.)");callback(line)}if(!circular&&typeof root==="object"){var keys=filterKeys(root,hideFunctions);keys.forEach(function(branch){lastKey=++index===keys.length;growBranch(branch,root[branch],lastKey,lastStatesCopy,showValues,hideFunctions,callback)})}}var Treeify={};Treeify.asLines=function(obj,showValues,hideFunctions,lineCallback){var hideFunctionsArg=typeof hideFunctions!=="function"?hideFunctions:false;growBranch(".",obj,false,[],showValues,hideFunctionsArg,lineCallback||hideFunctions)};Treeify.asTree=function(obj,showValues,hideFunctions){var tree="";growBranch(".",obj,false,[],showValues,hideFunctions,function(line){tree+=line+"\n"});return tree};return Treeify})},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"pattern-match":[function(require,module,exports){(function(global){function match(actual,body,thisArg){if(typeof body==="undefined"){return{when:function(pattern,template,thisArg){return matchCases(actual,[{pattern:pattern,template:template,thisArg:thisArg}])}}}var cases=[];if(typeof thisArg==="undefined")thisArg=global;body.call(thisArg,function(pattern,template,thisArg){cases.push({pattern:pattern,template:template,thisArg:thisArg})});return matchCases(actual,cases)}function matchCases(actual,cases){for(var i=0,n=cases.length;i<n;i++){var c=cases[i];try{var matches={};matchPattern(c.pattern,actual,matches);return c.template?c.template.call(typeof c.thisArg==="undefined"?global:c.thisArg,matches):matches}catch(e){if(e instanceof MatchError)continue;throw e}}throw new MatchError(cases,actual,"no more cases")}function MatchError(expected,actual,message){Error.call(this,message);if(!("stack"in this))this.stack=(new Error).stack;this.expected=expected;this.actual=actual}MatchError.prototype=Object.create(Error.prototype);function matchPattern(pattern,actual,matches){if(pattern instanceof Pattern){pattern.match(actual,matches)}else if(Array.isArray(pattern)){matchArray(pattern,actual,matches)}else if(typeof pattern==="object"){if(!pattern)matchNull(actual);else if(pattern instanceof RegExp)matchRegExp(pattern,actual);else matchObject(pattern,actual,matches)}else if(typeof pattern==="string"){matchString(pattern,actual)}else if(typeof pattern==="number"){if(pattern!==pattern)matchNaN(actual);else matchNumber(pattern,actual)}else if(typeof pattern==="boolean"){matchBoolean(pattern,actual)}else if(typeof pattern==="function"){matchPredicate(pattern,actual)}else if(typeof pattern==="undefined"){matchUndefined(actual)}}function matchNull(actual,matches){if(actual!==null)throw new MatchError(null,actual,"not null")}function matchArray(arr,actual,matches){if(typeof actual!=="object")throw new MatchError(arr,actual,"not an object");if(!actual)throw new MatchError(arr,actual,"null");var n=arr.length;for(var i=0;i<n;i++){if(!(i in actual))throw new MatchError(arr,actual,"no element at index "+i);matchPattern(arr[i],actual[i],matches)}}var hasOwn={}.hasOwnProperty;function matchObject(obj,actual,matches){if(typeof actual!=="object")throw new MatchError(obj,actual,"not an object");if(!actual)throw new MatchError(obj,actual,"null");for(var key in obj){if(!hasOwn.call(obj,key))continue;if(!(key in actual))throw new MatchError(obj,actual,"no property "+key);matchPattern(obj[key],actual[key],matches)}}function matchString(str,actual){if(typeof actual!=="string")throw new MatchError(str,actual,"not a string");if(actual!==str)throw new MatchError(str,actual,"wrong string value")}function matchRegExp(re,actual){if(typeof actual!=="string")throw new MatchError(re,actual,"not a string");if(!re.test(actual))throw new MatchError(re,actual,"regexp pattern match failed")}function matchNumber(num,actual){if(typeof actual!=="number")throw new MatchError(num,actual,"not a number");if(actual!==num)throw new MatchError(num,actual,"wrong number value")}function matchNaN(actual){if(typeof actual!=="number"||actual===actual)throw new MatchError(NaN,actual,"not NaN")}function matchPredicate(pred,actual){if(!pred(actual))throw new MatchError(pred,actual,"predicate failed")}function matchBoolean(bool,actual){if(typeof actual!=="boolean")throw new MatchError(bool,actual,"not a boolean");if(actual!==bool)throw new MatchError(bool,actual,"wrong boolean value")}function matchUndefined(actual){if(typeof actual!=="undefined")throw new MatchError(undefined,actual,"not undefined")}function Pattern(){}function Var(name,pattern){this._name=name;this._pattern=typeof pattern==="undefined"?Any:pattern}Var.prototype=Object.create(Pattern.prototype);Var.prototype.match=function Var_match(actual,matches){matchPattern(this._pattern,actual,matches);matches[this._name]=actual};var Any=Object.create(Pattern.prototype);Any.match=function Any_match(actual){};match.var=function(name,pattern){return new Var(name,pattern)};match.any=Any;match.object=function(x){return typeof x==="object"&&x};match.array=Array.isArray;match.primitive=function(x){return x===null||typeof x!=="object"};match.number=function(x){return typeof x==="number"};match.range=function(start,end){return function(x){return typeof x==="number"&&x>=start&&x<end}};var floor=Math.floor,abs=Math.abs;function sign(x){return x<0?-1:1}function toInteger(x){return x!==x?0:x===0||x===-Infinity||x===Infinity?x:sign(x)*floor(abs(x))}match.negative=function(x){return typeof x==="number"&&x<0};match.positive=function(x){return typeof x==="number"&&x>0};match.nonnegative=function(x){return typeof x==="number"&&x>=0};match.minusZero=function(x){return x===0&&1/x===-Infinity};match.plusZero=function(x){return x===0&&1/x===Infinity};match.finite=function(x){return typeof x==="number"&&isFinite(x)};match.infinite=function(x){return typeof x==="number"&&(x===Infinity||x===-Infinity)};match.integer=function(x){return typeof x==="number"&&x===toInteger(x)};match.int32=function(x){return typeof x==="number"&&x===(x|0)};match.uint32=function(x){return typeof x==="number"&&x===x>>>0};match.string=function(x){return typeof x==="string"};match.boolean=function(x){return typeof x==="boolean"};match.null=function(x){return x===null};match.undefined=function(x){return typeof x==="undefined"};match.function=function(x){return typeof x==="function"};function All(patterns){this.patterns=patterns}All.prototype=Object.create(Pattern.prototype);All.prototype.match=function(actual,matches){var temp={};for(var i=0,n=this.patterns.length;i<n;i++){matchPattern(this.patterns[i],actual,temp)}for(var key in temp){if(!hasOwn.call(temp,key))continue;matches[key]=temp[key]}};match.all=function(){return new All(arguments)};function Some(patterns){this.patterns=patterns}Some.prototype=Object.create(Pattern.prototype);Some.prototype.match=function(actual,matches){var temp;for(var i=0,n=this.patterns.length;i<n;i++){temp={};try{matchPattern(this.patterns[i],actual,temp);for(var key in temp){if(!hasOwn.call(temp,key))continue;matches[key]=temp[key]}return}catch(e){if(!(e instanceof MatchError))throw e}}throw new MatchError("no alternates matched",actual,this)};match.some=function(){return new Some(arguments)};match.MatchError=MatchError;match.pattern=Pattern.prototype;module.exports=match}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"is-array":[function(require,module,exports){var isArray=Array.isArray;var str=Object.prototype.toString;module.exports=isArray||function(val){return!!val&&"[object Array]"==str.call(val)}},{}]},{},[]);var esprima=require("esprima");var escodegen=require("escodegen");var treeify=require("treeify").asTree;var match=require("pattern-match");var isArray=require("is-array");var registry={};function register(pattern,callback){if(!registry[pattern.type])registry[pattern.type]=[];var registered=registry[pattern.type];registered.push({pattern:pattern,callback:callback})}function convertAst(ast){var nodes=isArray(ast)?ast:[ast];nodes.forEach(function(node){try{match(node,function(when){var registered=registry[node.type]||[];registered.forEach(function(entry){when(entry.pattern,entry.callback)})})}catch(err){if(err instanceof match.MatchError){console.log("no match for pattern:");console.log(treeify(err.actual,true));console.log("from registered:");console.log(treeify(err.expected,true))}else{throw err}}})}register({type:"Program",body:match.var("body")},function(matched){convertAst(matched.body)});register({type:"ExpressionStatement",expression:match.var("expression")},function(matched){convertAst(matched.expression)});register({type:"CallExpression",callee:match.var("callee"),arguments:match.var("arguments")},function(matched){console.log("call expression!");convertAst(matched.callee);convertAst(matched.arguments)});register({type:"MemberExpression",object:match.var("object"),property:match.var("property")},function(matched){console.log("member expression!");convertAst(matched.object);convertAst(matched.property)});register({type:"BinaryExpression",operator:match.var("operator"),left:match.var("left"),right:match.var("right")},function(matched){console.log("member expression!");convertAst(matched.left);convertAst(matched.right)});register({type:"Identifier",name:match.var("name")},function(matched){console.log('saw variable: "'+matched.name+'"!')});register({type:"Literal",value:match.var("value")},function(matched){console.log('saw literal: "'+matched.value+'"!')});var src='console.log("haay"+" wuurl")';var ast=esprima.parse(src);var resrc=escodegen.generate(ast);convertAst(ast);
{
"name": "requirebin-sketch",
"version": "1.0.0",
"dependencies": {
"esprima": "1.2.2",
"escodegen": "1.4.1",
"treeify": "1.0.1",
"pattern-match": "0.3.0",
"is-array": "1.0.1"
}
}
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; }
body, html { height: 100%; width: 100%; }</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.