made with requirebin
Created
February 28, 2015 10:12
-
-
Save royriojas/72d57a7f3c687d961d06 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var config = { | |
"indent": { | |
"value": " ", | |
"ArrayExpression": 1, | |
"AssignmentExpression": 1, | |
"BinaryExpression": 1, | |
"ConditionalExpression": 1, | |
"CallExpression": 1, | |
"CatchClause": 1, | |
"DoWhileStatement": 1, | |
"ForInStatement": 1, | |
"ForStatement": 1, | |
"FunctionDeclaration": 1, | |
"FunctionExpression": 1, | |
"IfStatement": 1, | |
"MemberExpression": 1, | |
"MultipleVariableDeclaration": 1, | |
"ObjectExpression": 1, | |
"ReturnStatement": ">=1", | |
"SwitchCase": 1, | |
"SwitchStatement": 1, | |
"TopLevelFunctionBlock": 1, | |
"TryStatement": 1, | |
"VariableDeclaration.LogicalExpression": 1, | |
"WhileStatement": 1 | |
}, | |
"lineBreak": { | |
"before": { | |
"AssignmentExpression": ">=0", | |
"AssignmentOperator": 0, | |
"BlockStatement": 1, | |
"CallExpression": -1, | |
"ConditionalExpression": ">=1", | |
"CatchOpeningBrace": 0, | |
"CatchClosingBrace": ">=1", | |
"CatchKeyword": 0, | |
"DeleteOperator": ">=1", | |
"DoWhileStatement": ">=1", | |
"DoWhileStatementOpeningBrace": 0, | |
"DoWhileStatementClosingBrace": ">=1", | |
"EndOfFile": 1, | |
"EmptyStatement": -1, | |
"FinallyKeyword": -1, | |
"FinallyOpeningBrace": 0, | |
"FinallyClosingBrace": ">=1", | |
"ForInStatement": ">=1", | |
"ForInStatementExpressionOpening": 0, | |
"ForInStatementExpressionClosing": 0, | |
"ForInStatementOpeningBrace": 0, | |
"ForInStatementClosingBrace": ">=1", | |
"ForStatement": ">=1", | |
"ForStatementExpressionOpening": 0, | |
"ForStatementExpressionClosing": "<2", | |
"ForStatementOpeningBrace": 0, | |
"ForStatementClosingBrace": ">=1", | |
"FunctionExpression": 0, | |
"FunctionExpressionOpeningBrace": 0, | |
"FunctionExpressionClosingBrace": ">=1", | |
"FunctionDeclaration": ">=1", | |
"FunctionDeclarationOpeningBrace": 0, | |
"FunctionDeclarationClosingBrace": ">=1", | |
"IfStatement": ">=1", | |
"IfStatementOpeningBrace": 0, | |
"IfStatementClosingBrace": ">=1", | |
"ElseIfStatement": 0, | |
"ElseIfStatementOpeningBrace": 0, | |
"ElseIfStatementClosingBrace": ">=1", | |
"ElseStatement": 0, | |
"ElseStatementOpeningBrace": 0, | |
"ElseStatementClosingBrace": ">=1", | |
"LogicalExpression": -1, | |
"ObjectExpressionOpeningBrace": 0, | |
"ObjectExpressionClosingBrace": 1, | |
"Property": 1, | |
"ReturnStatement": ">=1", | |
"SwitchOpeningBrace": 0, | |
"SwitchClosingBrace": ">=1", | |
"ThisExpression": -1, | |
"ThrowStatement": ">=1", | |
"TryKeyword": -1, | |
"TryOpeningBrace": 0, | |
"TryClosingBrace": ">=1", | |
"VariableName": ">=1", | |
"VariableValue": 0, | |
"VariableDeclaration": ">=1", | |
"VariableDeclarationWithoutInit": ">=1", | |
"WhileStatement": ">=1", | |
"WhileStatementOpeningBrace": 0, | |
"WhileStatementClosingBrace": ">=1", | |
"ArrayExpressionClosing": 1 | |
}, | |
"after": { | |
"AssignmentExpression": ">=1", | |
"AssignmentOperator": 0, | |
"BlockStatement": 0, | |
"CallExpression": -1, | |
"CatchOpeningBrace": ">=1", | |
"CatchClosingBrace": ">=0", | |
"CatchKeyword": 0, | |
"ConditionalExpression": ">=1", | |
"DeleteOperator": ">=1", | |
"DoWhileStatement": ">=1", | |
"DoWhileStatementOpeningBrace": ">=1", | |
"DoWhileStatementClosingBrace": 0, | |
"EmptyStatement": -1, | |
"FinallyKeyword": -1, | |
"FinallyOpeningBrace": ">=1", | |
"FinallyClosingBrace": ">=1", | |
"ForInStatement": ">=1", | |
"ForInStatementExpressionOpening": "<2", | |
"ForInStatementExpressionClosing": -1, | |
"ForInStatementOpeningBrace": ">=1", | |
"ForInStatementClosingBrace": ">=1", | |
"ForStatement": ">=1", | |
"ForStatementExpressionOpening": "<2", | |
"ForStatementExpressionClosing": -1, | |
"ForStatementOpeningBrace": ">=1", | |
"ForStatementClosingBrace": ">=1", | |
"FunctionExpression": ">=1", | |
"FunctionExpressionOpeningBrace": ">=1", | |
"FunctionExpressionClosingBrace": -1, | |
"FunctionDeclaration": ">=1", | |
"FunctionDeclarationOpeningBrace": ">=1", | |
"FunctionDeclarationClosingBrace": ">=1", | |
"IfStatement": ">=1", | |
"IfStatementOpeningBrace": ">=1", | |
"IfStatementClosingBrace": ">=1", | |
"ElseIfStatement": ">=1", | |
"ElseIfStatementOpeningBrace": ">=1", | |
"ElseIfStatementClosingBrace": ">=1", | |
"ElseStatement": ">=1", | |
"ElseStatementOpeningBrace": ">=1", | |
"ElseStatementClosingBrace": ">=1", | |
"LogicalExpression": -1, | |
"ObjectExpressionClosingBrace": 0, | |
"ObjectExpressionOpeningBrace": 1, | |
"PropertyValue": 0, | |
"Property": 0, | |
"ReturnStatement": 1, | |
"SwitchOpeningBrace": ">=1", | |
"SwitchClosingBrace": ">=1", | |
"ThisExpression": 0, | |
"ThrowStatement": ">=1", | |
"TryKeyword": -1, | |
"TryOpeningBrace": ">=1", | |
"TryClosingBrace": 0, | |
"VariableDeclaration": ">=1", | |
"WhileStatement": ">=1", | |
"WhileStatementOpeningBrace": ">=1", | |
"WhileStatementClosingBrace": ">=1", | |
"ArrayExpressionOpening": 1, | |
"ArrayExpressionComma": 1 | |
} | |
}, | |
"whiteSpace": { | |
"value": " ", | |
"removeTrailing": 1, | |
"before": { | |
"ArgumentComma": 0, | |
"ArgumentList": 1, | |
"ArgumentListArrayExpression": 0, | |
"ArgumentListFunctionExpression": 1, | |
"ArgumentListObjectExpression": 0, | |
"AssignmentOperator": 1, | |
"BinaryExpression": 0, | |
"BinaryExpressionOperator": 1, | |
"BlockComment": 1, | |
"CallExpression": 1, | |
"CatchParameterList": 0, | |
"CatchOpeningBrace": 1, | |
"CatchClosingBrace": 1, | |
"CatchKeyword": 1, | |
"CommaOperator": 0, | |
"ConditionalExpressionConsequent": 1, | |
"ConditionalExpressionAlternate": 1, | |
"DoWhileStatementOpeningBrace": 1, | |
"DoWhileStatementClosingBrace": 1, | |
"DoWhileStatementConditional": 1, | |
"EmptyStatement": 0, | |
"ExpressionClosingParentheses": 0, | |
"FinallyKeyword": -1, | |
"FinallyOpeningBrace": 1, | |
"FinallyClosingBrace": 1, | |
"ForInStatement": 1, | |
"ForInStatementExpressionOpening": 1, | |
"ForInStatementExpressionClosing": 0, | |
"ForInStatementOpeningBrace": 1, | |
"ForInStatementClosingBrace": 1, | |
"ForStatement": 1, | |
"ForStatementExpressionOpening": 1, | |
"ForStatementExpressionClosing": 0, | |
"ForStatementOpeningBrace": 1, | |
"ForStatementClosingBrace": 1, | |
"ForStatementSemicolon": 0, | |
"FunctionDeclarationOpeningBrace": 1, | |
"FunctionDeclarationClosingBrace": 1, | |
"FunctionExpressionOpeningBrace": 1, | |
"FunctionExpressionClosingBrace": 1, | |
"IfStatementConditionalOpening": 1, | |
"IfStatementConditionalClosing": 1, | |
"IfStatementOpeningBrace": 1, | |
"IfStatementClosingBrace": 1, | |
"ElseStatementOpeningBrace": 1, | |
"ElseStatementClosingBrace": 1, | |
"ElseIfStatementOpeningBrace": 1, | |
"ElseIfStatementClosingBrace": 1, | |
"MemberExpressionClosing": 1, | |
"LineComment": 1, | |
"LogicalExpressionOperator": 1, | |
"Property": 1, | |
"PropertyValue": 1, | |
"ParameterList": 1, | |
"SwitchDiscriminantOpening": 1, | |
"SwitchDiscriminantClosing": 0, | |
"ThrowKeyword": 1, | |
"TryKeyword": -1, | |
"TryOpeningBrace": 1, | |
"TryClosingBrace": 1, | |
"UnaryExpressionOperator": 0, | |
"VariableName": 1, | |
"VariableValue": 1, | |
"WhileStatementConditionalOpening": 1, | |
"WhileStatementConditionalClosing": 0, | |
"WhileStatementOpeningBrace": 1, | |
"WhileStatementClosingBrace": 1, | |
"ParameterComma": 0, | |
"ArrayExpressionOpening": 0, | |
"ArrayExpressionClosing": 1, | |
"ArrayExpressionComma": 0 | |
}, | |
"after": { | |
"ArrayExpressionOpening": 1, | |
"ArrayExpressionClosing": 0, | |
"ArrayExpressionComma": 1, | |
"ArgumentComma": 1, | |
"ArgumentList": 1, | |
"ArgumentListArrayExpression": 1, | |
"ArgumentListFunctionExpression": 1, | |
"ArgumentListObjectExpression": 0, | |
"AssignmentOperator": 1, | |
"BinaryExpression": 0, | |
"BinaryExpressionOperator": 1, | |
"BlockComment": 1, | |
"CallExpression": 0, | |
"CatchParameterList": 0, | |
"CatchOpeningBrace": 1, | |
"CatchClosingBrace": 1, | |
"CatchKeyword": 1, | |
"CommaOperator": 1, | |
"ConditionalExpressionConsequent": 1, | |
"ConditionalExpressionTest": 1, | |
"DoWhileStatementOpeningBrace": 1, | |
"DoWhileStatementClosingBrace": 1, | |
"DoWhileStatementBody": 1, | |
"EmptyStatement": 0, | |
"ExpressionOpeningParentheses": 0, | |
"FinallyKeyword": -1, | |
"FinallyOpeningBrace": 1, | |
"FinallyClosingBrace": 1, | |
"ForInStatement": 1, | |
"ForInStatementExpressionOpening": 0, | |
"ForInStatementExpressionClosing": 1, | |
"ForInStatementOpeningBrace": 1, | |
"ForInStatementClosingBrace": 1, | |
"ForStatement": 1, | |
"ForStatementExpressionOpening": 0, | |
"ForStatementExpressionClosing": 1, | |
"ForStatementClosingBrace": 1, | |
"ForStatementOpeningBrace": 1, | |
"ForStatementSemicolon": 1, | |
"FunctionReservedWord": 1, | |
"FunctionName": 0, | |
"FunctionExpressionOpeningBrace": 0, | |
"FunctionExpressionClosingBrace": 0, | |
"FunctionDeclarationOpeningBrace": 1, | |
"FunctionDeclarationClosingBrace": 1, | |
"IfStatementConditionalOpening": 1, | |
"IfStatementConditionalClosing": 1, | |
"IfStatementOpeningBrace": 1, | |
"IfStatementClosingBrace": 1, | |
"ElseStatementOpeningBrace": 1, | |
"ElseStatementClosingBrace": 1, | |
"ElseIfStatementOpeningBrace": 1, | |
"ElseIfStatementClosingBrace": 1, | |
"MemberExpressionOpening": 1, | |
"LogicalExpressionOperator": 1, | |
"PropertyName": 0, | |
"PropertyValue": 0, | |
"ParameterComma": 1, | |
"ParameterList": 1, | |
"SwitchDiscriminantOpening": 0, | |
"SwitchDiscriminantClosing": 1, | |
"ThrowKeyword": 1, | |
"TryKeyword": -1, | |
"TryOpeningBrace": 1, | |
"TryClosingBrace": 1, | |
"UnaryExpressionOperator": 0, | |
"VariableName": 1, | |
"WhileStatementConditionalOpening": 0, | |
"WhileStatementConditionalClosing": 1, | |
"WhileStatementOpeningBrace": 1, | |
"WhileStatementClosingBrace": 1, | |
"ObjectExpressionClosingBrace": 0 | |
} | |
} | |
}; | |
// require() some stuff from npm (like you were using browserify) | |
// and then hit Rebuild to run it on the right | |
var esformatter = require( 'esformatter' ); | |
var esformatterJSX = require( 'esformatter-jsx' ); | |
var plugin = { | |
nodeAfter: function ( node ) { | |
if (node.type === 'ArrayExpression') { | |
console.log(arguments); | |
} | |
} | |
}; | |
esformatter.register( plugin ); | |
var insertCSS = require( 'insert-css' ) | |
var domify = require( 'domify' ) | |
var css = '@import url(//facebook.github.io/react/css/codemirror.css); body {padding: 20px; box-sizing:border-box; } \n\nbody, html {\n height: 100%;\n}\n\n.main-container {\n position:relative; height: calc(100% - 150px) ;\n width: 100%;\n display: flex;\n box-sizing:border-box; padding: 22px 0 0 0;\n}\n h1 { white-space:nowrap; text-overflow:ellipsis; margin:17px 0 33px; font-family: Consolas, Monaco, Monospace; font-size: 36px; } h1 a { background: rgb(56, 159, 203);padding: 10px 15px 7px;color: #fff;text-decoration: none; } \n\n#source-area,\n#result-area {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n overflow: auto;\n flex: 1;\n min-height: 500px;\n border: 1px solid #aaa;\n margin: 0;\n}\n\n#source {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n overflow: auto;\n padding: 5px 10px;\n background: rgb(203, 68, 68);\n color: #fff;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n#result {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n padding: 5px 10px;\n background: rgb(116, 178, 116);\n color: #fff;\n display: block;\n position: absolute;\n top: 0;\n right: 0;\n}\n\n.CodeMirror.cm-s-default {\n height:100%; \n flex:1;\n border: 1px solid #aaa;\n}\n\n.CodeMirror pre {\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n}\n\n.CodeMirror.cm-s-default .cm-string-2 {\n color: #2A2523;\n} .credits { font-family: Consolas, Monaco, Monospace; font-size: 14px; padding: 10px 7px 6px; }'; | |
var testCode = '// Paste your own code here...\n\n\n\ var Cards = React.createClass({\ngetInitialState: function() {\nreturn {\n allToggled: false\n};\n },\n onToggled: function(cardId, state) {\n var result = this.props.cards.filter(function(card) {\n return cardId === card.id;\n });\n if (result.length > 0) {\n result[0].toggled = state;\n }\n var allToggled = this.props.cards.reduce(function(prev, card) {\n console.log(\'prev\', prev, card.toggled);\n return prev && card.toggled;\n}, true);\n\nconsole.log(\'>>>cards\',this.props.cards, allToggled);\n\nthis.setState({\n allToggled: allToggled\n});\n},\n render: function() {\n var footerClass = \'final message\';\n if (this.state.allToggled) {\n footerClass += \' on\';\n }\n var me = this;\n var cards = this.props.cards.map(function(card) {\n var pos = {\n top: 0,\n left: card.id * 310\n };\n \n return <Card card={card}\n key = {card.id}\n pos = {pos}\n \n \n onToggled = {me.onToggled}\n />;\n });\n return <div>\n <div className="message">\n <p> Lo que te voy a decir no es un secreto...<br />\n Pero igual deberás descubrirlo </p>\n</div>\n<div className="stage"> {cards} </div>\n<div className={footerClass} >\n <p> Y no me cansaré de repetírtelo... <br /> Me haces muy feliz! </p>\n</div>\n</div>;\n }\n});\n\nvar cards = [{\n text: \'Te\',\n id: 0,\n image: \'kitty-1.png\'\n}, {\n text: \'amo\',\n id: 1,\n image: \'kitty-2.png\'\n}, {\n text: \'Eve bb\',\n id: 2,\n image: \'kitty-3.png\'\n}];\n\nReact.render( <Cards cards={cards} />, document.querySelector(\'.app\'));'; | |
var iCode = window.localStorage.__code__ || testCode; | |
var html = '<h1><a target="_blank" href="https://www.npmjs.com/package/esformatter-jsx">Esformatter + JSX (Beautify React JSX files)</a></h1><div class="main-container"><textarea id="source-area">' + iCode + '</textarea><textarea id="result-area"></textarea><div id="source">Javascript + JSX, code to beautify:</div><div id="result">Output, beautified code:</div></div><div class="credits">r3m</div><a href="https://twitter.com/share" class="twitter-share-button" data-via="royriojas" data-size="large" data-hashtags="esformatterjsx">Tweet</a><a href="https://twitter.com/royriojas" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @royriojas</a>'; | |
esformatter.register( esformatterJSX ); | |
var body = document.body; | |
//var pre = document.createElement('pre'); | |
//document.head.appendChild(domify(styles)); | |
body.appendChild( domify( html ) ); | |
var source = document.getElementById( 'source-area' ); | |
var pre = document.getElementById( 'result-area' ); | |
var throttle = require( 'lodash.throttle' ); | |
//source.addEventListener('keypress', fCode); | |
//source.addEventListener('change', fCode); | |
//source.addEventListener('input', fCode); | |
insertCSS( css ); | |
var script = document.createElement( 'script' ); | |
script.src = '//cdn.jsdelivr.net/codemirror/4.5.0/codemirror.min.js'; | |
script.onload = function () { | |
var js = document.createElement( 'script' ); | |
js.src = '//cdn.jsdelivr.net/codemirror/4.5.0/mode/javascript/javascript.js'; | |
js.onload = function () { | |
var cdmIn = CodeMirror.fromTextArea( source, { | |
lineNumbers: true, | |
mode: "javascript" | |
} ); | |
var cdmOut = CodeMirror.fromTextArea( pre, { | |
lineNumbers: true, | |
mode: "javascript" | |
} ); | |
var formatCode = function () { | |
try { | |
var code = cdmIn.getValue(); | |
window.localStorage.__code__ = code; | |
cdmOut.setValue( esformatter.format( code, config ) ); | |
} catch (ex) { | |
cdmOut.setValue( '//==> Error: ' + ex.message ); | |
// pre.textContent = ; | |
window.localStorage.__code__ = testCode; | |
} | |
}; | |
var fCode = throttle( formatCode, 500 ); | |
fCode(); | |
cdmIn.on( 'change', function ( e ) { | |
fCode(); | |
} ); | |
}; | |
document.head.appendChild( js ); | |
}; | |
document.head.appendChild( script ); | |
!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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){},{}],2:[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:3}],3:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canMutationObserver=typeof window!=="undefined"&&window.MutationObserver;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}var queue=[];if(canMutationObserver){var hiddenDiv=document.createElement("div");var observer=new MutationObserver(function(){var queueList=queue.slice();queue.length=0;queueList.forEach(function(fn){fn()})});observer.observe(hiddenDiv,{attributes:true});return function nextTick(fn){if(!queue.length){hiddenDiv.setAttribute("yes","no")}queue.push(fn)}}if(canPost){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")}},{}],4:[function(require,module,exports){"use strict";exports.ArrayExpression=require("./hooks/ArrayExpression");exports.AssignmentExpression=require("./hooks/AssignmentExpression");exports.BinaryExpression=require("./hooks/BinaryExpression");exports.CallExpression=exports.NewExpression=require("./hooks/CallExpression");exports.CatchClause=require("./hooks/CatchClause");exports.ConditionalExpression=require("./hooks/ConditionalExpression");exports.DoWhileStatement=require("./hooks/DoWhileStatement");exports.ForInStatement=require("./hooks/ForInStatement");exports.ForStatement=require("./hooks/ForStatement");exports.FunctionDeclaration=require("./hooks/FunctionDeclaration");exports.FunctionExpression=require("./hooks/FunctionExpression");exports.IfStatement=require("./hooks/IfStatement");exports.LogicalExpression=require("./hooks/LogicalExpression");exports.MemberExpression=require("./hooks/MemberExpression");exports.ObjectExpression=require("./hooks/ObjectExpression");exports.ReturnStatement=require("./hooks/ReturnStatement");exports.SequenceExpression=require("./hooks/SequenceExpression");exports.SwitchStatement=require("./hooks/SwitchStatement");exports.SwitchCase=require("./hooks/SwitchCase");exports.ThrowStatement=require("./hooks/ThrowStatement");exports.TryStatement=require("./hooks/TryStatement");exports.UnaryExpression=require("./hooks/UnaryExpression");exports.UpdateExpression=require("./hooks/UpdateExpression");exports.VariableDeclaration=require("./hooks/VariableDeclaration");exports.WhileStatement=require("./hooks/WhileStatement")},{"./hooks/ArrayExpression":5,"./hooks/AssignmentExpression":6,"./hooks/BinaryExpression":7,"./hooks/CallExpression":8,"./hooks/CatchClause":9,"./hooks/ConditionalExpression":10,"./hooks/DoWhileStatement":11,"./hooks/ForInStatement":12,"./hooks/ForStatement":13,"./hooks/FunctionDeclaration":14,"./hooks/FunctionExpression":15,"./hooks/IfStatement":16,"./hooks/LogicalExpression":17,"./hooks/MemberExpression":18,"./hooks/ObjectExpression":19,"./hooks/ReturnStatement":21,"./hooks/SequenceExpression":22,"./hooks/SwitchCase":23,"./hooks/SwitchStatement":24,"./hooks/ThrowStatement":25,"./hooks/TryStatement":26,"./hooks/UnaryExpression":27,"./hooks/UpdateExpression":28,"./hooks/VariableDeclaration":29,"./hooks/WhileStatement":30}],5:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _limit=require("../limit");exports.format=function ArrayExpression(node){if(node.elements.length){_limit.around(node.startToken,"ArrayExpressionOpening");_limit.around(node.endToken,"ArrayExpressionClosing");node.elements.forEach(function(el){if(!el)return;var prev=_tk.findPrevNonEmpty(el.startToken);if(prev.value===","){_limit.around(prev,"ArrayExpressionComma")}})}else{_limit.after(node.startToken,0)}};exports.getIndentEdges=function(node){var start;var prev=node.startToken;node.elements.some(function(el,i,els){if(i){var prevEl=els[i-1];prev=prevEl?prevEl.endToken:_tk.findNextNonEmpty(prev)}var next=el?el.startToken:_tk.findNextNonEmpty(prev);if(_tk.findInBetween(prev,next,_tk.isBr)){start=prev;return true}});var end=isChainedMemberExpressionArgument(node)?node.endToken.prev:node.endToken;return start?{startToken:start,endToken:end}:false};function isChainedMemberExpressionArgument(node){return node.parent&&node.parent.type==="CallExpression"&&node.parent.callee.type==="MemberExpression"}},{"../limit":33,"rocambole-token":64}],6:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var _br=require("../lineBreak");exports.format=function AssignmentExpression(node){var operator=_tk.findNext(node.left.endToken,node.operator);_br.limit(operator,"AssignmentOperator");_ws.limit(operator,"AssignmentOperator")};exports.getIndentEdges=function(node,opts){var operator=_tk.findNext(node.left.endToken,node.operator);if(_tk.findInBetween(operator,node.right.startToken,_tk.isBr)||opts["AssignmentExpression."+node.right.type]&&_tk.findInBetween(operator,node.right.endToken,_tk.isBr)){return{startToken:operator,endToken:node.endToken.next||node.endToken}}}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],7:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function BinaryExpression(node){var operator=_tk.findNext(node.left.endToken,node.operator);_ws.limit(operator,"BinaryExpressionOperator")};exports.getIndentEdges=function(node){if(node.parent.type==="BinaryExpression"){return}return{startToken:node.startToken.next,endToken:node.endToken.next||node.endToken}}},{"../whiteSpace":40,"rocambole-token":64}],8:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _limit=require("../limit");var _parens=require("./expressionParentheses");exports.format=function CallExpression(node){var args=node["arguments"];if(args.length){var firstArg=args[0];_limit.before(firstArg.startToken,"ArgumentList");args.forEach(function(arg){var next=_tk.findNextNonEmpty(arg.endToken);if(next&&next.value===","){_limit.around(next,"ArgumentComma")}});var lastArg=args[args.length-1];_limit.after(lastArg.endToken,"ArgumentList")}else{var openingParentheses=_tk.findNext(node.callee.endToken,"(");var closingParentheses=_tk.findNext(openingParentheses,")");_limit.after(openingParentheses,0);_limit.before(closingParentheses,0)}if(node.callee.type==="FunctionExpression"){var parens=_parens.getParentheses({type:"Special",startToken:node.startToken,endToken:node.endToken});if(parens){_limit.after(parens.opening,"IIFEOpeningParentheses");_limit.before(parens.closing,"IIFEClosingParentheses")}}};exports.getIndentEdges=function(node,opts){if(!node.arguments.length){return false}var start;var openingParentheses=_tk.findNext(node.callee.endToken,"(");function hasBr(start,end){return _tk.findInBetween(start,end,_tk.isBr)}node.arguments.some(function(arg,i,args){var prev=i?args[i-1].endToken.next:openingParentheses;if(hasBr(prev,arg.startToken)){start=prev;return true}});if(!start){node.arguments.some(function(arg){if(opts["CallExpression."+arg.type]&&hasBr(arg.startToken,arg.endToken)){start=arg.startToken.next;return true}})}return start?{startToken:start,endToken:node.endToken}:false}},{"../limit":33,"./expressionParentheses":31,"rocambole-token":64}],9:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _limit=require("../limit");exports.format=function CatchClause(node){_limit.around(node.startToken,"CatchKeyword");_limit.before(node.param.startToken,"CatchParameterList");_limit.after(node.param.endToken,"CatchParameterList");_limit.around(node.body.startToken,"CatchOpeningBrace");_limit.around(node.body.endToken,"CatchClosingBrace");if(!node.body.body.length&&!containsCommentsInside(node.body)){_tk.removeEmptyInBetween(node.body.startToken,node.body.endToken)}};function containsCommentsInside(node){return!!_tk.findInBetween(node.startToken,node.endToken,_tk.isComment)}exports.getIndentEdges=function(node){return node.body}},{"../limit":33,"rocambole-token":64}],10:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function ConditionalExpression(node){var questionMark=_tk.findNext(node.test.endToken,"?");var colon=_tk.findNext(node.consequent.endToken,":");_ws.limitBefore(questionMark,_ws.getAmountAfterType("ConditionalExpressionTest"));_ws.limitAfter(questionMark,_ws.getAmountBeforeType("ConditionalExpressionConsequent"));_ws.limitBefore(colon,_ws.getAmountAfterType("ConditionalExpressionConsequent"));_ws.limitAfter(colon,_ws.getAmountBeforeType("ConditionalExpressionAlternate"))};exports.getIndentEdges=function(node){if(_tk.findInBetween(node.test.endToken,node.consequent.startToken,_tk.isBr)){return{startToken:node.test.endToken.next,endToken:node.endToken.next}}}},{"../whiteSpace":40,"rocambole-token":64}],11:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _br=require("../lineBreak");var _ws=require("../whiteSpace");exports.format=function DoWhileStatement(node){if(node.body.type==="BlockStatement"){_br.limit(node.body.startToken,"DoWhileStatementOpeningBrace");_ws.limit(node.body.startToken,"DoWhileStatementOpeningBrace");_br.limit(node.body.endToken,"DoWhileStatementClosingBrace");_ws.limit(node.body.endToken,"DoWhileStatementClosingBrace")}else{_ws.limitAfter(node.startToken,1)}var whileKeyword=_tk.findPrev(node.test.startToken,"while");_ws.limit(whileKeyword,1)};exports.getIndentEdges=function(node){return[node.body,{startToken:_tk.findNext(node.body.endToken,"("),endToken:_tk.findPrev(node.endToken,")")}]}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],12:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function ForInStatement(node){var expressionStart=_tk.findNext(node.startToken,"(");var expressionEnd=_tk.findPrev(node.body.startToken,")");_br.limit(expressionStart,"ForInStatementExpressionOpening");_ws.limit(expressionStart,"ForInStatementExpressionOpening");_br.limit(expressionEnd,"ForInStatementExpressionClosing");_ws.limit(expressionEnd,"ForInStatementExpressionClosing");if(node.body.type==="BlockStatement"&&node.body.body.length){var bodyStart=node.body.startToken;var bodyEnd=node.body.endToken;_br.limit(bodyStart,"ForInStatementOpeningBrace");_ws.limit(bodyStart,"ForInStatementOpeningBrace");_br.limit(bodyEnd,"ForInStatementClosingBrace");_ws.limit(bodyEnd,"ForInStatementClosingBrace");_ws.limitAfter(expressionEnd,"ForInStatementExpression")}_ws.limitAfter(node.left.endToken,1);_ws.limitBefore(node.right.startToken,1)};exports.getIndentEdges=function(node){var edges=[];edges.push({startToken:node.left.startToken,endToken:node.right.endToken});if(node.body.type==="BlockStatement"){edges.push(node.body)}else{edges.push({startToken:_tk.findNext(node.right.endToken,")").next,endToken:node.endToken})}return edges}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],13:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var _limit=require("../limit");exports.format=function ForStatement(node){var expressionStart=_tk.findNext(node.startToken,"(");var expressionEnd=_tk.findPrev(node.body.startToken,")");_limit.around(expressionStart,"ForStatementExpressionOpening");_limit.around(expressionEnd,"ForStatementExpressionClosing");var semi_1,semi_2;if(node.test){semi_1=_tk.findPrev(node.test.startToken,";");semi_2=_tk.findNext(node.test.endToken,";")}else{if(node.init)semi_1=_tk.findNext(node.init.endToken,";");if(node.update)semi_2=_tk.findPrev(node.update.startToken,";")}if(semi_1)_ws.limit(semi_1,"ForStatementSemicolon");if(semi_2)_ws.limit(semi_2,"ForStatementSemicolon");if(node.body.type==="BlockStatement"){var bodyStart=node.body.startToken;var bodyEnd=node.body.endToken;_limit.around(bodyStart,"ForStatementOpeningBrace");_limit.around(bodyEnd,"ForStatementClosingBrace")}};exports.getIndentEdges=function(node){var edges=[];var args={startToken:_tk.findNext(node.startToken,"("),endToken:_tk.findPrev(node.body.startToken,")")};edges.push(args);if(node.body.type==="BlockStatement"){edges.push(node.body)}else{edges.push({startToken:args.endToken.next,endToken:node.endToken})}return edges}},{"../limit":33,"../whiteSpace":40,"rocambole-token":64}],14:[function(require,module,exports){"use strict";var _limit=require("../limit");var _params=require("./Params");exports.format=function FunctionDeclaration(node){_limit.after(node.id.startToken,"FunctionName");_params.format(node);_limit.around(node.body.startToken,"FunctionDeclarationOpeningBrace");_limit.around(node.body.endToken,"FunctionDeclarationClosingBrace")};exports.getIndentEdges=function(node,opts){return[_params.getIndentEdges(node,opts),node.body]}},{"../limit":33,"./Params":20}],15:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var _params=require("./Params");var _limit=require("../limit");exports.format=function FunctionExpression(node){_limit.around(node.body.startToken,"FunctionExpressionOpeningBrace");_limit.around(node.endToken,"FunctionExpressionClosingBrace");if(node.id){_ws.limitAfter(node.id.startToken,"FunctionName")}else{_ws.limit(node.startToken,"FunctionReservedWord")}if(_tk.isWs(node.endToken.next)&&_tk.isSemiColon(node.endToken.next.next)){_tk.remove(node.endToken.next)}if(node.parent.type==="CallExpression"){_ws.limitAfter(node.endToken,0)}var bodyFirstNonEmpty=_tk.findNextNonEmpty(node.body.startToken);if(bodyFirstNonEmpty.value==="}"){_limit.after(node.body.startToken,0)}_params.format(node)};exports.getIndentEdges=function(node,opts){var params=_params.getIndentEdges(node,opts);if(!opts.TopLevelFunctionBlock&&isTopLevelFunctionBlock(node)){return params}return[params,{startToken:node.body.startToken,endToken:_tk.findPrevNonEmpty(node.body.endToken).next}]};function isTopLevelFunctionBlock(node){return!(node.params.length===1&&node.params[0].name==="factory")&&(isOfType(node.parent,"CallExpression")||isOfType(node.parent,"AssignmentExpression"))&&!isOfType(node.parent.callee,"MemberExpression")&&isOfType(node.parent.parent,"ExpressionStatement")&&isOfType(node.parent.parent.parent,"Program")}function isOfType(node,type){return node&&node.type===type}},{"../limit":33,"../whiteSpace":40,"./Params":20,"rocambole-token":64}],16:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var _limit=require("../limit");exports.format=function IfStatement(node){var startBody=node.consequent.startToken;var endBody=node.consequent.endToken;var conditionalStart=_tk.findPrev(node.test.startToken,"(");var conditionalEnd=_tk.findNext(node.test.endToken,")");_ws.limit(conditionalStart,"IfStatementConditionalOpening");_ws.limit(conditionalEnd,"IfStatementConditionalClosing");var alt=node.alternate;if(alt){var elseKeyword=_tk.findPrev(alt.startToken,"else");if(alt.type==="IfStatement"){_br.limitBefore(alt.startToken,0);_ws.limitBefore(alt.startToken,1);if(alt.consequent.type==="BlockStatement"){_br.limitBefore(alt.consequent.startToken,"ElseIfStatementOpeningBrace");_br.limitBefore(alt.consequent.endToken,"ElseIfStatementClosingBrace")}_br.limitBefore(elseKeyword,"ElseIfStatement");if(!alt.alternate){_br.limitAfter(alt.consequent.endToken,"ElseIfStatement")}}else if(alt.type==="BlockStatement"){_limit.around(alt.startToken,"ElseStatementOpeningBrace");_br.limitBefore(elseKeyword,"ElseStatement");_br.limitAfter(alt.endToken,"ElseStatement");_ws.limitBefore(elseKeyword,1);_limit.around(alt.endToken,"ElseStatementClosingBrace")}else{_ws.limitAfter(elseKeyword,1)}}if(node.consequent.type==="BlockStatement"){_limit.around(startBody,"IfStatementOpeningBrace");if(!alt){_br.limit(endBody,"IfStatementClosingBrace")}else{_br.limitBefore(endBody,"IfStatementClosingBrace")}_ws.limit(endBody,"IfStatementClosingBrace")}};exports.getIndentEdges=function(node,opts){var edges=[];var test=node.test;var consequent=node.consequent;var alt=node.alternate;edges.push({level:opts.IfStatementConditional,startToken:_tk.findPrevNonEmpty(test.startToken),endToken:test.endToken});function isExecutable(token){return _tk.isNotEmpty(token)&&!_tk.isComment(token)}edges.push({startToken:consequent.type==="BlockStatement"?consequent.startToken:test.endToken.next,endToken:alt&&_tk.isComment(_tk.findPrevNonEmpty(consequent.endToken))?_tk.findPrev(consequent.endToken,isExecutable).next:consequent.endToken});if(alt&&alt.type!=="IfStatement"){edges.push({startToken:alt.type==="BlockStatement"?alt.startToken:_tk.findPrevNonEmpty(alt.startToken).next,endToken:alt.endToken})}return edges}},{"../limit":33,"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],17:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function LogicalExpression(node){var operator=_tk.findNext(node.left.endToken,node.operator);_ws.limit(operator,"LogicalExpressionOperator");if(node.parent.type==="ExpressionStatement"){var prev=_tk.findPrevNonEmpty(node.left.startToken);if(prev&&prev.value==="("){_br.limit(prev,"ExpressionOpeningParentheses");_ws.limit(prev,"ExpressionOpeningParentheses");node.startToken=prev}var next=_tk.findNextNonEmpty(node.right.endToken);if(next&&next.value===")"){_br.limit(next,"ExpressionClosingParentheses");_ws.limit(next,"ExpressionClosingParentheses");node.endToken=next}}}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],18:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function MemberExpression(node){var opening=_tk.findPrevNonEmpty(node.property.startToken),closing=_tk.findNextNonEmpty(node.property.endToken);if(opening&&closing&&opening.value==="["&&closing.value==="]"){_ws.limitAfter(opening,"MemberExpressionOpening");_ws.limitBefore(closing,"MemberExpressionClosing")}};exports.getIndentEdges=function(node){var edge={};edge.startToken=node.object.endToken;if(node.object.type!=="CallExpression"){edge.startToken=edge.startToken.next}edge.endToken=node.endToken;if(node.parent.type==="CallExpression"&&node.parent.callee.type==="MemberExpression"){edge.endToken=node.parent.endToken}if(!_tk.findInBetween(edge.startToken,node.property.startToken,_tk.isBr)){return false}return edge}},{"../whiteSpace":40,"rocambole-token":64}],19:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var _limit=require("../limit");exports.format=function ObjectExpression(node){if(!node.properties.length)return;var shouldBeSingleLine=node.parent.type==="ForInStatement";if(!shouldBeSingleLine){_limit.around(node.startToken,"ObjectExpressionOpeningBrace")}else{_tk.removeEmptyInBetween(node.startToken,node.endToken)}node.properties.forEach(function(prop){var valueStart;if(prop.kind==="get"||prop.kind==="set"){valueStart=prop.value.startToken}else{valueStart=_tk.findNextNonEmpty(_tk.findPrev(prop.value.startToken,":"))}var eol=_tk.findNext(prop.value.endToken,["LineBreak",",","}"]);var valueEnd=_tk.findPrev(eol,function(token){return!_tk.isEmpty(token)&&!_tk.isComment(token)});var comma=_tk.findNext(prop.value.endToken,[",","}"]);if(_tk.isComma(comma)){var br=_tk.findInBetween(prop.value.endToken,comma,_tk.isBr);if(br){_tk.remove(br)}_tk.remove(comma);_tk.after(valueEnd,comma)}if(!shouldBeSingleLine){_br.limitBefore(prop.key.startToken,"PropertyName");_br.limitAfter(prop.key.endToken,"PropertyName");_br.limitBefore(prop.value.startToken,"PropertyValue");_br.limitAfter(prop.value.endToken,"PropertyValue")}else if(prop.key.startToken.prev.value!=="{"){_ws.limitBefore(prop.key.startToken,"Property")}_ws.limitBefore(prop.key.startToken,"PropertyName");_ws.limitAfter(prop.key.endToken,"PropertyName");_ws.limitBefore(valueStart,"PropertyValue");_ws.limitAfter(valueEnd,"PropertyValue")});if(!shouldBeSingleLine){_limit.around(node.endToken,"ObjectExpressionClosingBrace")}};exports.getIndentEdges=function(node){return{startToken:node.startToken,endToken:_tk.findInBetweenFromEnd(node.startToken,node.endToken,_tk.isBr)}}},{"../limit":33,"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],20:[function(require,module,exports){"use strict";var _ws=require("../whiteSpace");var _tk=require("rocambole-token");var _limit=require("../limit");exports.format=function Params(node){var params=node.params;if(params.length){_ws.limitBefore(params[0].startToken,"ParameterList");params.forEach(function(param,i){if(i===params.length-1)return;_ws.limit(_tk.findNext(param.startToken,","),"ParameterComma")});_ws.limitAfter(params[params.length-1].endToken,"ParameterList")}else{var openingParentheses=_tk.findNext(node.startToken,"(");_limit.after(openingParentheses,0)}};exports.getIndentEdges=function(node,opts){var params=node.params;if(params.length&&opts.ParameterList){var start=node.parent.type==="Property"?node.parent.startToken:node.startToken;return{startToken:_tk.findNext(start,"("),endToken:_tk.findPrev(node.body.startToken,")"),level:opts.ParameterList}}return null}},{"../limit":33,"../whiteSpace":40,"rocambole-token":64}],21:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var expressionParentheses=require("./expressionParentheses");exports.format=function ReturnStatement(node){var nonEmpty=_tk.findInBetween(node.startToken.next,node.endToken,_tk.isNotEmpty);if(nonEmpty)_tk.removeEmptyInBetween(node.startToken,nonEmpty);_ws.limitAfter(node.startToken,1);if(_tk.isSemiColon(node.endToken)){_tk.removeEmptyInBetween(_tk.findPrevNonEmpty(node.endToken),node.endToken)}if(node.argument){expressionParentheses.addSpaceInside(node.argument)}};var _specialArguments={BinaryExpression:true};exports.getIndentEdges=function(node,opts){if(!node.argument||opts[node.argument.type]&&!_specialArguments[node.argument.type]){return false}var parentheses=expressionParentheses.getParentheses(node.argument);return parentheses?{startToken:parentheses.opening,endToken:parentheses.closing}:{startToken:node.startToken.next,endToken:node.endToken}}},{"../whiteSpace":40,"./expressionParentheses":31,"rocambole-token":64}],22:[function(require,module,exports){"use strict";var _ws=require("../whiteSpace");exports.format=function SequenceExpression(node){node.expressions.forEach(function(expr,i){if(i){var operator=expr.startToken.prev;while(operator.value!==","){operator=operator.prev}_ws.limit(operator,"CommaOperator")}})}},{"../whiteSpace":40}],23:[function(require,module,exports){"use strict";var _ws=require("../whiteSpace");var _br=require("../lineBreak");exports.format=function SwitchCase(node){if(node.test){_br.limitBefore(node.test.startToken,0);_ws.limitBefore(node.test.startToken,1)}};exports.getIndentEdges=function(node){return{startToken:node.startToken.next,endToken:node.endToken.next||node.endToken}}},{"../lineBreak":34,"../whiteSpace":40}],24:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _limit=require("../limit");exports.format=function SwitchStatement(node){var opening=_tk.findPrev(node.discriminant.startToken,"(");var closing=_tk.findNext(node.discriminant.endToken,")");var openingBrace=_tk.findNext(closing,"{");var closingBrace=node.endToken;_limit.around(openingBrace,"SwitchOpeningBrace");_limit.around(closingBrace,"SwitchClosingBrace");_limit.around(opening,"SwitchDiscriminantOpening");_limit.around(closing,"SwitchDiscriminantClosing")};exports.getIndentEdges=function(node){return{startToken:_tk.findNext(node.discriminant.endToken,"{"),endToken:node.endToken}}},{"../limit":33,"rocambole-token":64}],25:[function(require,module,exports){"use strict";var _ws=require("../whiteSpace");exports.format=function ThrowStatement(node){_ws.limit(node.startToken,"ThrowKeyword")}},{"../whiteSpace":40}],26:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _limit=require("../limit");exports.format=function TryStatement(node){var finalizer=node.finalizer;if(finalizer){var finallyKeyword=_tk.findPrev(finalizer.startToken,"finally");_limit.around(finallyKeyword,"FinallyKeyword");_limit.around(finalizer.startToken,"FinallyOpeningBrace");_limit.around(finalizer.endToken,"FinallyClosingBrace");if(!finalizer.body.length&&!containsCommentsInside(finalizer)){_tk.removeEmptyInBetween(finalizer.startToken,finalizer.endToken)}}_limit.around(node.startToken,"TryKeyword");_limit.around(node.block.startToken,"TryOpeningBrace");_limit.around(node.block.endToken,"TryClosingBrace")};function containsCommentsInside(node){return!!_tk.findInBetween(node.startToken,node.endToken,_tk.isComment)}exports.getIndentEdges=function(node){var edges=[node.block];if(node.finalizer){edges.push(node.finalizer)}return edges}},{"../limit":33,"rocambole-token":64}],27:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function UnaryExpression(node){if(node.operator==="delete"){_ws.limitAfter(node.startToken,1);_br.limitBefore(node.startToken,"DeleteOperator");var endToken=node.endToken;if(_tk.isSemiColon(endToken.next)){endToken=endToken.next}_br.limitAfter(endToken,"DeleteOperator")}else if(node.operator==="typeof"||node.operator==="void"){_ws.limitAfter(node.startToken,1)}else{_ws.limit(node.startToken,"UnaryExpressionOperator")}}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],28:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");exports.format=function UpdateExpression(node){_tk.removeEmptyInBetween(node.startToken,node.endToken)}},{"rocambole-token":64}],29:[function(require,module,exports){"use strict";var _br=require("../lineBreak");var _tk=require("rocambole-token");var _ws=require("../whiteSpace");exports.format=function VariableDeclaration(node){var insideFor=node.parent.type==="ForStatement";node.declarations.forEach(function(declarator,i){var idStartToken=declarator.id.startToken;var prevNonEmpty=_tk.findPrevNonEmpty(idStartToken);if(i&&prevNonEmpty.value===","){if(_tk.isBr(prevNonEmpty.prev)||_tk.isBr(prevNonEmpty.prev.prev)){var beforeComma=_tk.findPrev(prevNonEmpty,function(t){return!_tk.isEmpty(t)&&!_tk.isComment(t)});_tk.remove(prevNonEmpty);_tk.after(beforeComma,prevNonEmpty)}}if(!i&&!_tk.isComment(_tk.findPrevNonEmpty(idStartToken))){_tk.removeEmptyAdjacentBefore(idStartToken)}else if(!insideFor&&declarator.init){_br.limit(idStartToken,"VariableName")}_ws.limitBefore(idStartToken,"VariableName");if(declarator.init){_ws.limitAfter(declarator.id.endToken,"VariableName");var equalSign=_tk.findNext(declarator.id.endToken,"=");var valueStart=_tk.findNextNonEmpty(equalSign);_br.limitBefore(valueStart,"VariableValue");_ws.limitBefore(valueStart,"VariableValue");_br.limitAfter(declarator.endToken,"VariableValue");_ws.limitAfter(declarator.endToken,"VariableValue")}});_ws.limitAfter(node.startToken,1)};exports.getIndentEdges=function(node,opts){if(opts.MultipleVariableDeclaration&&node.declarations.length>1){return{startToken:node.startToken.next,endToken:node.endToken}}var edges=[];node.declarations.forEach(function(declaration){var init=declaration.init;if(init&&opts["VariableDeclaration."+init.type]){edges.push({startToken:init.startToken,endToken:init.endToken.next||node.endToken.next||node.endToken})}});return edges}},{"../lineBreak":34,"../whiteSpace":40,"rocambole-token":64}],30:[function(require,module,exports){"use strict";var _tk=require("rocambole-token"); | |
var _limit=require("../limit");exports.format=function WhileStatement(node){var conditionalStart=_tk.findNext(node.startToken,"(");var conditionalEnd=_tk.findPrev(node.body.startToken,")");_limit.around(conditionalStart,"WhileStatementConditionalOpening");if(node.body.type==="BlockStatement"){var bodyStart=node.body.startToken;var bodyEnd=node.body.endToken;_limit.around(bodyStart,"WhileStatementOpeningBrace");_limit.around(bodyEnd,"WhileStatementClosingBrace");_limit.around(conditionalEnd,"WhileStatementConditionalClosing")}else{var next=_tk.findNextNonEmpty(conditionalEnd);_limit.before(conditionalEnd,"WhileStatementConditionalClosing");if(_tk.isSemiColon(next)){_limit.after(conditionalEnd,0)}else{_limit.after(conditionalEnd,"WhileStatementConditionalClosing")}}};exports.getIndentEdges=function(node){return[{startToken:node.test.startToken,endToken:_tk.findPrev(node.body.startToken,")")},node.body]}},{"../limit":33,"rocambole-token":64}],31:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _ws=require("../whiteSpace");var debug=require("debug")("esformatter:parentheses");exports.addSpaceInside=addSpaceInsideExpressionParentheses;function addSpaceInsideExpressionParentheses(node){var parentheses=getParentheses(node);if(parentheses){_ws.limitAfter(parentheses.opening,"ExpressionOpeningParentheses");_ws.limitBefore(parentheses.closing,"ExpressionClosingParentheses")}}exports.getParentheses=getParentheses;function getParentheses(node){if(!isValidExpression(node)){debug("not valid expression: %s",node.type);return}var opening=node.startToken;if(node.type==="BinaryExpression"||opening.value!=="("){opening=_tk.findPrevNonEmpty(opening)}if(!opening||opening.value!=="("){debug('opening is not a parentheses; type: %s, opening: "%s"',node.type,opening&&opening.value);return}var token=opening;var count=0;var closing;while(token){if(token.value==="("){count+=1}else if(token.value===")"){count-=1}if(count===0){closing=token;break}token=token.next}if(!closing){debug("not inside parentheses",count);return}debug('found parentheses; type: %s, opening: "%s", closing: "%s"',node.type,opening&&opening.value,closing&&closing.value);return{opening:opening,closing:closing}}var needExpressionParenthesesSpaces={Literal:true,CallExpression:false,FunctionExpression:false,ArrayExpression:false,ObjectExpression:false,Special:true};function isValidExpression(node){var needSpaces=needExpressionParenthesesSpaces[node.type];if(needSpaces){return true}if(needSpaces==null&&node.type.indexOf("Expression")!==-1){if(node.type==="ExpressionStatement"&&(node.expression.callee&&node.expression.callee.type==="FunctionExpression")){return false}return true}return false}},{"../whiteSpace":40,debug:41,"rocambole-token":64}],32:[function(require,module,exports){"use strict";var rocambole=require("rocambole");var escapeRegExp=require("mout/string/escapeRegExp");var repeat=require("mout/string/repeat");var tk=require("rocambole-token");var debug=require("debug")("esformatter:indent");var hooks=require("./hooks");var _opts;var _specialTypes={VariableDeclaration:"MultipleVariableDeclaration"};exports.setOptions=setOptions;function setOptions(opts){_opts=opts}exports.transform=transform;function transform(ast){rocambole.moonwalk(ast,transformNode);sanitize(ast);return ast}function transformNode(node){var indentLevel=getIndentLevel(node);if(indentLevel>0){var type=node.type;var edges;if(type in hooks&&hooks[type].getIndentEdges){edges=hooks[type].getIndentEdges(node,_opts);if(!edges){debug("[transformNode]: hook returned no edges");return}}else{edges=node}debug("[transformNode] type: %s, edges: %s, %s",node.type,edges&&edges.startToken&&edges.startToken.value,edges&&edges.endToken&&edges.endToken.value);if(Array.isArray(edges)){edges.forEach(function(edge){if(!edge){return}indentInBetween(edge.startToken,edge.endToken,edge.level||indentLevel)})}else{indentInBetween(edges.startToken,edges.endToken,edges.level||indentLevel)}}}function getIndentLevel(node){var value=_opts[node.type];debug("[getIndentLevel] type: %s, value: %s",node.type,value);if(node.type in _specialTypes){value=value||_opts[_specialTypes[node.type]];debug("[specialNodeType] indent: %s",value)}return value}exports.indentInBetween=indentInBetween;function indentInBetween(startToken,endToken,level){level=level==null?1:level;var token=getIndentStart(startToken);debug("[indentInBetween] originalStart: %s, start: %s, end: %s, level: %s",startToken&&startToken.value,token&&token.value,endToken&&endToken.value,level);if(level<0||!startToken||!token||!endToken)return;var next;while(token&&token!==endToken){next=token.next;if(tk.isBr(token.prev)){if(tk.isWs(token)){tk.remove(token)}else if(!tk.isBr(token)){indentBefore(token,level)}}token=next}}function getIndentStart(token){var val=token.value;return val==="{"||val==="("||val==="["?token.next:token}exports.indentBefore=indentBefore;function indentBefore(token,level){var value=repeat(_opts.value,level);if(tk.isIndent(token)){token.value+=value;token.level+=level}else if(tk.isWs(token)){token.type="Indent";token.value=value;token.level=level}else{tk.before(token,{type:"Indent",value:value,level:level})}}exports.sanitize=sanitize;function sanitize(ast){var token=ast.startToken;while(token){var next=token.next;if(isOriginalIndent(token)){tk.remove(token)}else if(token.type==="BlockComment"){updateBlockComment(token)}token=next}}function isOriginalIndent(token){return token.type==="WhiteSpace"&&(!token.prev||tk.isBr(token.prev))&&!tk.isBr(token.next)||token.type==="Indent"&&(token.level==null||!tk.isBr(token.prev))}function updateBlockComment(comment){var orig=new RegExp("([\\n\\r]+)"+escapeRegExp(comment.originalIndent||""),"gm");var update=comment.prev&&comment.prev.type==="Indent"?comment.prev.value:"";comment.raw=comment.raw.replace(orig,"$1"+update)}},{"./hooks":4,debug:41,"mout/string/escapeRegExp":61,"mout/string/repeat":62,rocambole:70,"rocambole-token":64}],33:[function(require,module,exports){"use strict";var _br=require("./lineBreak");var _ws=require("./whiteSpace");exports.before=limitBefore;function limitBefore(token,typeOrValue){_br.limitBefore(token,typeOrValue);_ws.limitBefore(token,typeOrValue)}exports.after=limitAfter;function limitAfter(token,typeOrValue){_br.limitAfter(token,typeOrValue);_ws.limitAfter(token,typeOrValue)}exports.around=limitAround;function limitAround(token,typeOrValue){_br.limit(token,typeOrValue);_ws.limit(token,typeOrValue)}},{"./lineBreak":34,"./whiteSpace":40}],34:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var debug=require("debug");var debugBefore=debug("esformatter:br:before");var debugAfter=debug("esformatter:br:after");var debugBetween=debug("esformatter:br:between");var semver=require("semver");var _curOpts={value:"\n"};exports.setOptions=setOptions;function setOptions(opts){_curOpts=opts}exports.limit=limit;function limit(token,type){limitBefore(token,type);limitAfter(token,type)}exports.limitBefore=limitBefore;function limitBefore(token,type){var expected=getExpect("before",type);debugBefore("[limitBefore] type: %s, expected: %s, value: %s",type,expected,token&&token.value);if(expected<0)return;var start=getStartToken(token);limitInBetween("before",start,token,expected)}exports.limitAfter=limitAfter;function limitAfter(token,type){var expected=getExpect("after",type);debugAfter("[limitAfter] type: %s, expected: %s, value: %s",type,expected,token&&token.value);if(expected<0)return;var end=getEndToken(token);limitInBetween("after",token,end,expected)}function getExpect(location,type){var expected;if(typeof type==="string"){expected=_curOpts[location][type]}else{expected=type}expected=expected!=null?expected:-1;if(typeof expected==="boolean"){expected=expected?">=1":0}if(expected<0){return expected}else if(typeof expected==="number"){return String(expected)}else{return expected}}function limitInBetween(location,start,end,expected){var n=getDiff(start,end,expected);debugBetween("[limitInBetween] diff: %d",n);if(n){_tk.removeInBetween(start,end,"WhiteSpace")}if(n<0){_tk.removeInBetween(start,end,function(token){return token.type==="LineBreak"&&n++<0&&!siblingIsComment(location,token)})}else if(n>0){var target=location==="after"?start:end;var insertNextTo=_tk[location];while(n-->0){insertNextTo(target,{type:"LineBreak",value:_curOpts.value})}}}function siblingIsComment(location,token){var prop=location==="before"?"prev":"next";return _tk.isComment(token[prop])}function getDiff(start,end,expected){if(start===end)return 0;var count=countBrInBetween(start,end);var vCount=String(count)+".0.0";if(semver.satisfies(vCount,expected)){return 0}else{return getSatisfyingMatch(count,vCount,expected)-count}}function getSatisfyingMatch(count,vCount,expected){var result;var diff=semver.gtr(vCount,expected)?-1:1;count+=diff;while(result==null&&count>=0&&count<100){if(semver.satisfies(String(count)+".0.0",expected)){result=count}count+=diff}return parseInt(result,10)}function countBrInBetween(start,end){var count=0;_tk.eachInBetween(start,end,function(token){if(_tk.isBr(token))count++});return count}function getEndToken(token){var end=_tk.findNextNonEmpty(token);if(shouldSkipToken(end)){end=_tk.findNextNonEmpty(end)}return end?end:token.root.endToken}function shouldSkipToken(token){var result=_tk.isComment(token)&&!isOnSeparateLine(token);return result&&getExpect("before",token.type)<=0}function isOnSeparateLine(token){return _tk.isBr(token.prev)||_tk.isEmpty(token.prev)&&_tk.isBr(token.prev.prev)}function getStartToken(token){var end=_tk.findPrevNonEmpty(token);return end?end:token.root.startToken}exports.limitBeforeEndOfFile=function(ast){var expected=getExpect("before","EndOfFile");if(expected<0)return;var lastNonEmpty=_tk.isEmpty(ast.endToken)?_tk.findPrevNonEmpty(ast.endToken):ast.endToken;if(lastNonEmpty){limitInBetween("after",lastNonEmpty,null,expected)}else{do{var br={type:"LineBreak",value:_curOpts.value};if(ast.startToken){_tk.after(ast.startToken,br)}else{ast.startToken=ast.endToken=br}}while(--expected)}}},{debug:41,"rocambole-token":64,semver:71}],35:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var _br=require("./lineBreak");var debugAround=require("debug")("esformatter:br:around");module.exports=aroundNodeIfNeeded;function aroundNodeIfNeeded(node){var shouldLimit=shouldLimitLineBreakAroundNode(node);debugAround("[aroundNodeIfNeeded] type: %s, shouldLimit: %s, ",node.type,shouldLimit);if(!shouldLimit)return;var type=node.type;_br.limitBefore(node.startToken,type);if(_tk.isSemiColon(node.endToken)){_br.limitAfter(node.endToken,type)}}var CONTEXTUAL_LINE_BREAK={AssignmentExpression:1,ConditionalExpression:1,CallExpression:1,ExpressionStatement:1,SequenceExpression:1,LogicalExpression:1,VariableDeclaration:1};var BYPASS_CHILD_LINE_BREAK={CallExpression:1,DoWhileStatement:1,IfStatement:1,WhileStatement:1,ForStatement:1,ForInStatement:1,ReturnStatement:1,ThrowStatement:1};var CONTEXTUAL_LINE_BREAK_GREAT_PARENTS={Program:1,BlockStatement:1,IfStatement:1,FunctionExpression:1};function shouldLimitLineBreakAroundNode(node){if(node.parent){if(node.parent.prev&&node.parent.prev.type==="EmptyStatement"){return false}if(node.parent.type==="Program"){return true}if(isInsideIfTest(node)){return false}}if(!(node.type in CONTEXTUAL_LINE_BREAK)){return true}if(node.parent.type in BYPASS_CHILD_LINE_BREAK){return false}if(node.type==="CallExpression"&&node.callee.type==="FunctionExpression"){return false}var gp=node.parent.parent;if(gp&&gp.type in CONTEXTUAL_LINE_BREAK_GREAT_PARENTS){return true}return false}function isInsideIfTest(node){if(node.parent&&node.parent.type==="IfStatement"){return node===node.parent.test}var greatParent=node.parent&&node.parent.parent;return greatParent&&greatParent.type==="IfStatement"&&node.parent===greatParent.test}},{"./lineBreak":34,debug:41,"rocambole-token":64}],36:[function(require,module,exports){(function(process){"use strict";var stripJsonComments=require("strip-json-comments");var fs=require("fs");var path=require("path");var _ws=require("./whiteSpace");var _br=require("./lineBreak");var indent=require("./indent");var plugins=require("./plugins");var merge=require("mout/object/merge");var get=require("mout/object/get");var isObject=require("mout/lang/isObject");var _curOpts;exports.presets={"default":require("./preset/default.json"),jquery:require("./preset/jquery.json")};exports.set=function(opts){var preset=opts&&opts.preset?opts.preset:"default";_curOpts=mergeOptions(preset,opts);_ws.setOptions(_curOpts.whiteSpace);_br.setOptions(_curOpts.lineBreak);indent.setOptions(_curOpts.indent);plugins.setOptions(_curOpts)};function mergeOptions(preset,opts){if(!(preset in exports.presets)){throw new Error('Invalid preset file "'+preset+'".')}var baseOpts=exports.presets[preset];if(baseOpts.preset){baseOpts=mergeOptions(baseOpts.preset,baseOpts)}return merge({},baseOpts,opts)}exports.get=function(prop){return prop?get(_curOpts,prop):_curOpts};exports.getRc=getRc;function getRc(filePath,customOptions){if(isTopLevel(customOptions)){return customOptions}if(isObject(filePath)){customOptions=filePath;filePath=null}var basedir=filePath?path.dirname(filePath):process.cwd();var cwd=process.cwd();var rc=findAndMergeConfigs(basedir);if(!rc&&basedir!==cwd){rc=findAndMergeConfigs(cwd)}return merge(rc||getGlobalConfig(),customOptions)}function findAndMergeConfigs(basedir){if(!basedir||!basedir.length)return;var configFiles=[".esformatter","package.json"];var config;configFiles.some(function(name){var filePath=path.join(basedir,name);if(!fs.existsSync(filePath))return;var cur=loadAndParseConfig(filePath);if(name==="package.json"){cur=cur.esformatter}if(!cur)return;config=config?merge(cur,config):cur;if(isTopLevel(config))return true});if(isTopLevel(config)){return config}var parentDir=path.resolve(basedir,"..");var parentConfig=parentDir&&parentDir!==basedir?findAndMergeConfigs(parentDir):{};return merge(parentConfig,config)}function isTopLevel(config){return config&&(config.root||config.preset)}function getGlobalConfig(){var home=process.platform==="win32"?process.env.USERPROFILE:process.env.HOME;var file=path.join(home,".esformatter");return fs.existsSync(file)?loadAndParseConfig(file):{}}exports.loadAndParseConfig=loadAndParseConfig;function loadAndParseConfig(file){try{return JSON.parse(stripJsonComments(fs.readFileSync(file).toString()))}catch(ex){console.error("Can't parse configuration file: \""+file+'"\nException: '+ex.message);process.exit(1)}}}).call(this,require("_process"))},{"./indent":32,"./lineBreak":34,"./plugins":37,"./preset/default.json":38,"./preset/jquery.json":39,"./whiteSpace":40,_process:3,fs:1,"mout/lang/isObject":49,"mout/object/get":57,"mout/object/merge":59,path:2,"strip-json-comments":72}],37:[function(require,module,exports){"use strict";var partial=require("mout/function/partial");var remove=require("mout/array/remove");var _plugins=[];exports.register=register;function register(plugin){if(_plugins.indexOf(plugin)===-1){_plugins.push(plugin)}}exports.unregister=partial(remove,_plugins);exports.unregisterAll=unregisterAll;function unregisterAll(){_plugins=[]}exports.setOptions=function(opts){loadAndRegister(opts&&opts.plugins);exec("setOptions",opts)};exports.loadAndRegister=loadAndRegister;function loadAndRegister(ids){ids=ids||[];ids.forEach(function(id){register(require(id))})}exportMethods(["tokenBefore","tokenAfter","nodeBefore","nodeAfter","transform","transformAfter","transformBefore"],exec);exportMethods(["stringBefore","stringAfter"],pipe);function exportMethods(arr,fn){arr.forEach(function(methodName){exports[methodName]=partial(fn,methodName)})}function exec(methodName){var args=Array.prototype.slice.call(arguments,1);_plugins.forEach(function(plugin){if(methodName in plugin){plugin[methodName].apply(plugin,args)}})}function pipe(methodName,input){return _plugins.reduce(function(output,plugin){return methodName in plugin?plugin[methodName](output):output},input)}},{"mout/array/remove":43,"mout/function/partial":45}],38:[function(require,module,exports){module.exports={indent:{value:" ",ArrayExpression:1,AssignmentExpression:1,"AssignmentExpression.BinaryExpression":1,"AssignmentExpression.LogicalExpression":1,BinaryExpression:-1,ConditionalExpression:1,CallExpression:1,"CallExpression.BinaryExpression":1,"CallExpression.LogicalExpression":1,CatchClause:1,ConditionalExpression:1,DoWhileStatement:1,ForInStatement:1,ForStatement:1,FunctionDeclaration:1,FunctionExpression:1,IfStatement:1,MemberExpression:1,MultipleVariableDeclaration:1,ObjectExpression:1,ParameterList:1,ReturnStatement:1,SwitchCase:1,SwitchStatement:1,TopLevelFunctionBlock:1,TryStatement:1,"VariableDeclaration.BinaryExpression":1,"VariableDeclaration.LogicalExpression":1,WhileStatement:1},lineBreak:{value:"\n",before:{AssignmentExpression:">=1",AssignmentOperator:0,BlockStatement:0,CallExpression:-1,ConditionalExpression:">=1",CatchOpeningBrace:0,CatchClosingBrace:">=1",CatchKeyword:0,DeleteOperator:">=1",DoWhileStatement:">=1",DoWhileStatementOpeningBrace:0,DoWhileStatementClosingBrace:">=1",EndOfFile:-1,EmptyStatement:-1,FinallyKeyword:-1,FinallyOpeningBrace:0,FinallyClosingBrace:">=1",ForInStatement:">=1",ForInStatementExpressionOpening:0,ForInStatementExpressionClosing:0,ForInStatementOpeningBrace:0,ForInStatementClosingBrace:">=1",ForStatement:">=1",ForStatementExpressionOpening:0,ForStatementExpressionClosing:"<2",ForStatementOpeningBrace:0,ForStatementClosingBrace:">=1",FunctionExpression:-1,FunctionExpressionOpeningBrace:0,FunctionExpressionClosingBrace:">=1",FunctionDeclaration:">=1",FunctionDeclarationOpeningBrace:0,FunctionDeclarationClosingBrace:">=1",IIFEClosingParentheses:0,IfStatement:">=1",IfStatementOpeningBrace:0,IfStatementClosingBrace:">=1",ElseIfStatement:0,ElseIfStatementOpeningBrace:0,ElseIfStatementClosingBrace:">=1",ElseStatement:0,ElseStatementOpeningBrace:0,ElseStatementClosingBrace:">=1",LogicalExpression:-1,ObjectExpressionClosingBrace:">=1",Property:">=1",ReturnStatement:-1,SwitchOpeningBrace:0,SwitchClosingBrace:">=1",ThisExpression:-1,ThrowStatement:">=1",TryKeyword:-1,TryOpeningBrace:0,TryClosingBrace:">=1",VariableName:">=1",VariableValue:0,VariableDeclaration:">=1",VariableDeclarationWithoutInit:">=1",WhileStatement:">=1",WhileStatementOpeningBrace:0,WhileStatementClosingBrace:">=1"},after:{AssignmentExpression:">=1",AssignmentOperator:0,BlockStatement:0,CallExpression:-1,CatchOpeningBrace:">=1",CatchClosingBrace:">=0",CatchKeyword:0,ConditionalExpression:">=1",DeleteOperator:">=1",DoWhileStatement:">=1",DoWhileStatementOpeningBrace:">=1",DoWhileStatementClosingBrace:0,EmptyStatement:-1,FinallyKeyword:-1,FinallyOpeningBrace:">=1",FinallyClosingBrace:">=1",ForInStatement:">=1",ForInStatementExpressionOpening:"<2",ForInStatementExpressionClosing:-1,ForInStatementOpeningBrace:">=1",ForInStatementClosingBrace:">=1",ForStatement:">=1",ForStatementExpressionOpening:"<2",ForStatementExpressionClosing:-1,ForStatementOpeningBrace:">=1",ForStatementClosingBrace:">=1",FunctionExpression:">=1",FunctionExpressionOpeningBrace:">=1",FunctionExpressionClosingBrace:-1,FunctionDeclaration:">=1",FunctionDeclarationOpeningBrace:">=1",FunctionDeclarationClosingBrace:">=1",IIFEOpeningParentheses:0,IfStatement:">=1",IfStatementOpeningBrace:">=1",IfStatementClosingBrace:">=1",ElseIfStatement:">=1",ElseIfStatementOpeningBrace:">=1",ElseIfStatementClosingBrace:">=1",ElseStatement:">=1",ElseStatementOpeningBrace:">=1",ElseStatementClosingBrace:">=1",LogicalExpression:-1,ObjectExpressionOpeningBrace:">=1",Property:0,ReturnStatement:-1,SwitchOpeningBrace:">=1",SwitchClosingBrace:">=1",ThisExpression:0,ThrowStatement:">=1",TryKeyword:-1,TryOpeningBrace:">=1",TryClosingBrace:0,VariableDeclaration:">=1",WhileStatement:">=1",WhileStatementOpeningBrace:">=1",WhileStatementClosingBrace:">=1"}},whiteSpace:{value:" ",removeTrailing:1,before:{ArrayExpressionOpening:0,ArrayExpressionClosing:0,ArrayExpressionComma:0,ArgumentComma:0,ArgumentList:0,AssignmentOperator:1,BinaryExpression:0,BinaryExpressionOperator:1,BlockComment:1,CallExpression:-1,CatchParameterList:0,CatchOpeningBrace:1,CatchClosingBrace:1,CatchKeyword:1,CommaOperator:0,ConditionalExpressionConsequent:1,ConditionalExpressionAlternate:1,DoWhileStatementOpeningBrace:1,DoWhileStatementClosingBrace:1,DoWhileStatementConditional:1,EmptyStatement:0,ExpressionClosingParentheses:0,FinallyKeyword:-1,FinallyOpeningBrace:1,FinallyClosingBrace:1,ForInStatement:1,ForInStatementExpressionOpening:1,ForInStatementExpressionClosing:0,ForInStatementOpeningBrace:1,ForInStatementClosingBrace:1,ForStatement:1,ForStatementExpressionOpening:1,ForStatementExpressionClosing:0,ForStatementOpeningBrace:1,ForStatementClosingBrace:1,ForStatementSemicolon:0,FunctionDeclarationOpeningBrace:1,FunctionDeclarationClosingBrace:1,FunctionExpressionOpeningBrace:1,FunctionExpressionClosingBrace:1,IIFEClosingParentheses:0,IfStatementConditionalOpening:1,IfStatementConditionalClosing:0,IfStatementOpeningBrace:1,IfStatementClosingBrace:1,ElseStatementOpeningBrace:1,ElseStatementClosingBrace:1,ElseIfStatementOpeningBrace:1,ElseIfStatementClosingBrace:1,MemberExpressionClosing:0,LineComment:1,LogicalExpressionOperator:1,Property:1,PropertyValue:1,ParameterComma:0,ParameterList:0,SwitchDiscriminantOpening:1,SwitchDiscriminantClosing:0,ThrowKeyword:1,TryKeyword:-1,TryOpeningBrace:1,TryClosingBrace:1,UnaryExpressionOperator:0,VariableName:1,VariableValue:1,WhileStatementConditionalOpening:1,WhileStatementConditionalClosing:0,WhileStatementOpeningBrace:1,WhileStatementClosingBrace:1},after:{ArrayExpressionOpening:0,ArrayExpressionClosing:0,ArrayExpressionComma:1,ArgumentComma:1,ArgumentList:0,AssignmentOperator:1,BinaryExpression:0,BinaryExpressionOperator:1,BlockComment:1,CallExpression:-1,CatchParameterList:0,CatchOpeningBrace:1,CatchClosingBrace:1,CatchKeyword:1,CommaOperator:1,ConditionalExpressionConsequent:1,ConditionalExpressionTest:1,DoWhileStatementOpeningBrace:1,DoWhileStatementClosingBrace:1,DoWhileStatementBody:1,EmptyStatement:0,ExpressionOpeningParentheses:0,FinallyKeyword:-1,FinallyOpeningBrace:1,FinallyClosingBrace:1,ForInStatement:1,ForInStatementExpressionOpening:0,ForInStatementExpressionClosing:1,ForInStatementOpeningBrace:1,ForInStatementClosingBrace:1,ForStatement:1,ForStatementExpressionOpening:0,ForStatementExpressionClosing:1,ForStatementClosingBrace:1,ForStatementOpeningBrace:1,ForStatementSemicolon:1,FunctionReservedWord:0,FunctionName:0,FunctionExpressionOpeningBrace:1,FunctionExpressionClosingBrace:0,FunctionDeclarationOpeningBrace:1,FunctionDeclarationClosingBrace:1,IIFEOpeningParentheses:0,IfStatementConditionalOpening:0,IfStatementConditionalClosing:1,IfStatementOpeningBrace:1,IfStatementClosingBrace:1,ElseStatementOpeningBrace:1,ElseStatementClosingBrace:1,ElseIfStatementOpeningBrace:1,ElseIfStatementClosingBrace:1,MemberExpressionOpening:0,LogicalExpressionOperator:1,ObjectExpressionClosingBrace:0,PropertyName:0,PropertyValue:0,ParameterComma:1,ParameterList:0,SwitchDiscriminantOpening:0,SwitchDiscriminantClosing:1,ThrowKeyword:1,TryKeyword:-1,TryOpeningBrace:1,TryClosingBrace:1,UnaryExpressionOperator:0,VariableName:1,WhileStatementConditionalOpening:0,WhileStatementConditionalClosing:1,WhileStatementOpeningBrace:1,WhileStatementClosingBrace:1}}}},{}],39:[function(require,module,exports){module.exports={preset:"default",indent:{value:" ",IfStatementConditional:2,SwitchStatement:0,TopLevelFunctionBlock:0},lineBreak:{before:{ObjectExpressionOpeningBrace:-1,ObjectExpressionClosingBrace:-1,Property:-1,VariableDeclarationWithoutInit:0},after:{AssignmentOperator:-1,ObjectExpressionOpeningBrace:-1,ObjectExpressionClosingBrace:-1,Property:-1}},whiteSpace:{before:{ArgumentList:1,ArrayExpressionClosing:1,CatchParameterList:1,ExpressionClosingParentheses:1,ForInStatementExpressionClosing:1,ForStatementExpressionClosing:1,IfStatementConditionalClosing:1,MemberExpressionClosing:1,ParameterList:1,SwitchDiscriminantClosing:1,WhileStatementConditionalClosing:1},after:{ArgumentList:1,ArrayExpressionOpening:1,CatchParameterList:1,ExpressionOpeningParentheses:1,ForInStatementExpressionOpening:1,ForStatementExpressionOpening:1,IfStatementConditionalOpening:1,MemberExpressionOpening:1,ParameterList:1,PropertyValue:-1,SwitchDiscriminantOpening:1,WhileStatementConditionalOpening:1}}}},{}],40:[function(require,module,exports){"use strict";var _tk=require("rocambole-token");var repeat=require("mout/string/repeat");var debug=require("debug");var debugBefore=debug("esformatter:ws:before");var debugAfter=debug("esformatter:ws:after");var _curOpts={value:" "};exports.setOptions=setOptions;function setOptions(opts){_curOpts=opts}exports.limit=limit;function limit(token,type){limitBefore(token,type);limitAfter(token,type)}exports.limitBefore=limitBefore;function limitBefore(token,type){var amount=getAmountBeforeType(type);debugBefore("[limitBefore] type: %s, amount: %s, token: %s",type,amount,token.value);if(amount<0)return;update("before",token,amount)}exports.limitAfter=limitAfter;function limitAfter(token,type){var amount=getAmountAfterType(type);debugAfter("[limitAfter] type: %s, amount: %s, token: %s",type,amount,token.value);if(amount<0)return;update("after",token,amount)}exports.getAmountAfterType=getAmountAfterType;function getAmountAfterType(type){return getAmount("after",type)}exports.getAmountBeforeType=getAmountBeforeType;function getAmountBeforeType(type){return getAmount("before",type)}function getAmount(position,type){if(typeof type==="number"){return type}var amount=_curOpts[position][type];return amount==null?-1:amount}function update(position,target,amount){var adjacent=position==="before"?target.prev:target.next;var adjacentIsWs=_tk.isWs(adjacent);if(!adjacent||_tk.isBr(adjacent))return;if(amount===0&&adjacentIsWs){_tk.remove(adjacent);return}var ws;if(adjacentIsWs){ws=adjacent}else{ws={type:"WhiteSpace"}}ws.value=repeat(_curOpts.value||" ",amount);if(!adjacentIsWs){_tk[position](target,ws)}}},{debug:41,"mout/string/repeat":62,"rocambole-token":64}],41:[function(require,module,exports){module.exports=debug;function debug(name){if(!debug.enabled(name))return function(){};return function(fmt){fmt=coerce(fmt);var curr=new Date;var ms=curr-(debug[name]||curr);debug[name]=curr;fmt=name+" "+fmt+" +"+debug.humanize(ms);window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}}debug.names=[];debug.skips=[];debug.enable=function(name){try{localStorage.debug=name}catch(e){}var split=(name||"").split(/[\s,]+/),len=split.length;for(var i=0;i<len;i++){name=split[i].replace("*",".*?");if(name[0]==="-"){debug.skips.push(new RegExp("^"+name.substr(1)+"$"))}else{debug.names.push(new RegExp("^"+name+"$"))}}};debug.disable=function(){debug.enable("")};debug.humanize=function(ms){var sec=1e3,min=60*1e3,hour=60*min;if(ms>=hour)return(ms/hour).toFixed(1)+"h";if(ms>=min)return(ms/min).toFixed(1)+"m";if(ms>=sec)return(ms/sec|0)+"s";return ms+"ms"};debug.enabled=function(name){for(var i=0,len=debug.skips.length;i<len;i++){if(debug.skips[i].test(name)){return false}}for(var i=0,len=debug.names.length;i<len;i++){if(debug.names[i].test(name)){return true}}return false};function coerce(val){if(val instanceof Error)return val.stack||val.message;return val}try{if(window.localStorage)debug.enable(localStorage.debug)}catch(e){}},{}],42:[function(require,module,exports){function indexOf(arr,item,fromIndex){fromIndex=fromIndex||0;if(arr==null){return-1}var len=arr.length,i=fromIndex<0?len+fromIndex:fromIndex;while(i<len){if(arr[i]===item){return i}i++}return-1}module.exports=indexOf},{}],43:[function(require,module,exports){var indexOf=require("./indexOf");function remove(arr,item){var idx=indexOf(arr,item);if(idx!==-1)arr.splice(idx,1)}module.exports=remove},{"./indexOf":42}],44:[function(require,module,exports){function slice(arr,start,end){var len=arr.length;if(start==null){start=0}else if(start<0){start=Math.max(len+start,0)}else{start=Math.min(start,len)}if(end==null){end=len}else if(end<0){end=Math.max(len+end,0)}else{end=Math.min(end,len)}var result=[];while(start<end){result.push(arr[start++])}return result}module.exports=slice},{}],45:[function(require,module,exports){var slice=require("../array/slice");function partial(f){var as=slice(arguments,1);return function(){var args=as.concat(slice(arguments));for(var i=args.length;i--;){if(args[i]===partial._){args[i]=args.splice(-1)[0]}}return f.apply(this,args)}}partial._={};module.exports=partial},{"../array/slice":44}],46:[function(require,module,exports){var kindOf=require("./kindOf");var isPlainObject=require("./isPlainObject");var mixIn=require("../object/mixIn");function clone(val){switch(kindOf(val)){case"Object":return cloneObject(val);case"Array":return cloneArray(val);case"RegExp":return cloneRegExp(val);case"Date":return cloneDate(val);default:return val}}function cloneObject(source){if(isPlainObject(source)){return mixIn({},source)}else{return source}}function cloneRegExp(r){var flags="";flags+=r.multiline?"m":"";flags+=r.global?"g":"";flags+=r.ignoreCase?"i":"";return new RegExp(r.source,flags)}function cloneDate(date){return new Date(+date)}function cloneArray(arr){return arr.slice()}module.exports=clone},{"../object/mixIn":60,"./isPlainObject":50,"./kindOf":52}],47:[function(require,module,exports){var clone=require("./clone");var forOwn=require("../object/forOwn");var kindOf=require("./kindOf");var isPlainObject=require("./isPlainObject");function deepClone(val,instanceClone){switch(kindOf(val)){case"Object":return cloneObject(val,instanceClone);case"Array":return cloneArray(val,instanceClone);default:return clone(val)}}function cloneObject(source,instanceClone){if(isPlainObject(source)){var out={};forOwn(source,function(val,key){this[key]=deepClone(val,instanceClone)},out);return out}else if(instanceClone){return instanceClone(source)}else{return source}}function cloneArray(arr,instanceClone){var out=[],i=-1,n=arr.length,val;while(++i<n){out[i]=deepClone(arr[i],instanceClone)}return out}module.exports=deepClone},{"../object/forOwn":56,"./clone":46,"./isPlainObject":50,"./kindOf":52}],48:[function(require,module,exports){var kindOf=require("./kindOf");function isKind(val,kind){return kindOf(val)===kind}module.exports=isKind},{"./kindOf":52}],49:[function(require,module,exports){var isKind=require("./isKind");function isObject(val){return isKind(val,"Object")}module.exports=isObject},{"./isKind":48}],50:[function(require,module,exports){function isPlainObject(value){return!!value&&typeof value==="object"&&value.constructor===Object}module.exports=isPlainObject},{}],51:[function(require,module,exports){function isPrimitive(value){switch(typeof value){case"string":case"number":case"boolean":return true}return value==null}module.exports=isPrimitive},{}],52:[function(require,module,exports){var _rKind=/^\[object (.*)\]$/,_toString=Object.prototype.toString,UNDEF;function kindOf(val){if(val===null){return"Null"}else if(val===UNDEF){return"Undefined"}else{return _rKind.exec(_toString.call(val))[1]}}module.exports=kindOf},{}],53:[function(require,module,exports){function toString(val){return val==null?"":val.toString()}module.exports=toString},{}],54:[function(require,module,exports){function toInt(val){return~~val}module.exports=toInt},{}],55:[function(require,module,exports){var hasOwn=require("./hasOwn");var _hasDontEnumBug,_dontEnums;function checkDontEnum(){_dontEnums=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"];_hasDontEnumBug=true;for(var key in{toString:null}){_hasDontEnumBug=false}}function forIn(obj,fn,thisObj){var key,i=0;if(_hasDontEnumBug==null)checkDontEnum();for(key in obj){if(exec(fn,obj,key,thisObj)===false){break}}if(_hasDontEnumBug){var ctor=obj.constructor,isProto=!!ctor&&obj===ctor.prototype;while(key=_dontEnums[i++]){if((key!=="constructor"||!isProto&&hasOwn(obj,key))&&obj[key]!==Object.prototype[key]){if(exec(fn,obj,key,thisObj)===false){break | |
}}}}}function exec(fn,obj,key,thisObj){return fn.call(thisObj,obj[key],key,obj)}module.exports=forIn},{"./hasOwn":58}],56:[function(require,module,exports){var hasOwn=require("./hasOwn");var forIn=require("./forIn");function forOwn(obj,fn,thisObj){forIn(obj,function(val,key){if(hasOwn(obj,key)){return fn.call(thisObj,obj[key],key,obj)}})}module.exports=forOwn},{"./forIn":55,"./hasOwn":58}],57:[function(require,module,exports){var isPrimitive=require("../lang/isPrimitive");function get(obj,prop){var parts=prop.split("."),last=parts.pop();while(prop=parts.shift()){obj=obj[prop];if(obj==null)return}return obj[last]}module.exports=get},{"../lang/isPrimitive":51}],58:[function(require,module,exports){function hasOwn(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=hasOwn},{}],59:[function(require,module,exports){var hasOwn=require("./hasOwn");var deepClone=require("../lang/deepClone");var isObject=require("../lang/isObject");function merge(){var i=1,key,val,obj,target;target=deepClone(arguments[0]);while(obj=arguments[i++]){for(key in obj){if(!hasOwn(obj,key)){continue}val=obj[key];if(isObject(val)&&isObject(target[key])){target[key]=merge(target[key],val)}else{target[key]=deepClone(val)}}}return target}module.exports=merge},{"../lang/deepClone":47,"../lang/isObject":49,"./hasOwn":58}],60:[function(require,module,exports){var forOwn=require("./forOwn");function mixIn(target,objects){var i=0,n=arguments.length,obj;while(++i<n){obj=arguments[i];if(obj!=null){forOwn(obj,copyProp,target)}}return target}function copyProp(val,key){this[key]=val}module.exports=mixIn},{"./forOwn":56}],61:[function(require,module,exports){var toString=require("../lang/toString");function escapeRegExp(str){return toString(str).replace(/\W/g,"\\$&")}module.exports=escapeRegExp},{"../lang/toString":53}],62:[function(require,module,exports){var toString=require("../lang/toString");var toInt=require("../number/toInt");function repeat(str,n){var result="";str=toString(str);n=toInt(n);if(n<1){return""}while(n>0){if(n%2){result+=str}n=Math.floor(n/2);str+=str}return result}module.exports=repeat},{"../lang/toString":53,"../number/toInt":54}],63:[function(require,module,exports){"use strict";var makeCheck=require("./makeCheck");var isNotEmpty=require("./is").isNotEmpty;exports.findInBetween=findInBetween;function findInBetween(startToken,endToken,check){check=makeCheck(check);var found;var last=endToken&&endToken.next;while(startToken&&startToken!==last&&!found){if(check(startToken)){found=startToken}startToken=startToken.next}return found}exports.findInBetweenFromEnd=findInBetweenFromEnd;function findInBetweenFromEnd(startToken,endToken,check){check=makeCheck(check);var found;var last=startToken&&startToken.prev;while(endToken&&endToken!==last&&!found){if(check(endToken)){found=endToken}endToken=endToken.prev}return found}exports.findNext=findNext;function findNext(startToken,check){check=makeCheck(check);startToken=startToken&&startToken.next;while(startToken){if(check(startToken)){return startToken}startToken=startToken.next}}exports.findPrev=findPrev;function findPrev(endToken,check){check=makeCheck(check);endToken=endToken&&endToken.prev;while(endToken){if(check(endToken)){return endToken}endToken=endToken.prev}}exports.findNextNonEmpty=findNextNonEmpty;function findNextNonEmpty(startToken){return findNext(startToken,isNotEmpty)}exports.findPrevNonEmpty=findPrevNonEmpty;function findPrevNonEmpty(endToken){return findPrev(endToken,isNotEmpty)}},{"./is":66,"./makeCheck":67}],64:[function(require,module,exports){"use strict";function mixIn(target,source){Object.keys(source).forEach(function(key){target[key]=source[key]});return target}exports.eachInBetween=eachInBetween;function eachInBetween(startToken,endToken,iterator){var last=endToken&&endToken.next;while(startToken&&startToken!==last){iterator(startToken);startToken=startToken.next}}mixIn(exports,require("./find"));mixIn(exports,require("./insert"));mixIn(exports,require("./is"));mixIn(exports,require("./remove"))},{"./find":63,"./insert":65,"./is":66,"./remove":68}],65:[function(require,module,exports){"use strict";exports.before=before;function before(target,newToken){newToken.prev=target.prev;newToken.next=target;if(target.prev){target.prev.next=newToken}else if(target.root){target.root.startToken=newToken}target.prev=newToken;newToken.root=target.root;return newToken}exports.after=after;function after(target,newToken){if(target.next){target.next.prev=newToken}else if(target.root){target.root.endToken=newToken}newToken.prev=target;newToken.next=target.next;target.next=newToken;newToken.root=target.root;return newToken}},{}],66:[function(require,module,exports){"use strict";exports.isWs=isWs;function isWs(token){return token&&token.type==="WhiteSpace"}exports.isBr=isBr;function isBr(token){return token&&token.type==="LineBreak"}exports.isEmpty=isEmpty;function isEmpty(token){return token&&(token.type==="WhiteSpace"||token.type==="LineBreak"||token.type==="Indent")}exports.isNotEmpty=isNotEmpty;function isNotEmpty(token){return!isEmpty(token)}exports.isCode=isCode;function isCode(token){return!isEmpty(token)&&!isComment(token)}exports.isSemiColon=isSemiColon;function isSemiColon(token){return token&&(token.type==="Punctuator"&&token.value===";")}exports.isComma=isComma;function isComma(token){return token&&(token.type==="Punctuator"&&token.value===",")}exports.isIndent=isIndent;function isIndent(token){return token&&token.type==="Indent"}exports.isComment=isComment;function isComment(token){return token&&(token.type==="LineComment"||token.type==="BlockComment")}},{}],67:[function(require,module,exports){"use strict";module.exports=makeCheck;function makeCheck(orig){if(typeof orig==="string"){return makeStringCheck(orig)}else if(Array.isArray(orig)){return makeArrayCheck(orig)}return orig}function makeArrayCheck(arr){return function checkTypeAndValueByIndex(token){return token&&(arr.indexOf(token.type)!==-1||arr.indexOf(token.value)!==-1)}}function makeStringCheck(str){return function checkTypeAndValueByString(token){return token&&(token.type===str||token.value===str)}}},{}],68:[function(require,module,exports){"use strict";var makeCheck=require("./makeCheck");var isEmpty=require("./is").isEmpty;exports.remove=remove;function remove(target){if(target.next){target.next.prev=target.prev}else if(target.root){target.root.endToken=target.prev}if(target.prev){target.prev.next=target.next}else if(target.root){target.root.startToken=target.next}}exports.removeInBetween=removeInBetween;function removeInBetween(startToken,endToken,check){check=makeCheck(check);var last=endToken&&endToken.next;while(startToken&&startToken!==last){if(check(startToken)){remove(startToken)}startToken=startToken.next}}exports.removeAdjacent=removeAdjacent;function removeAdjacent(token,check){removeAdjacentBefore(token,check);removeAdjacentAfter(token,check)}exports.removeAdjacentBefore=removeAdjacentBefore;function removeAdjacentBefore(token,check){check=makeCheck(check);var prev=token.prev;while(prev&&check(prev)){remove(prev);prev=prev.prev}}exports.removeAdjacentAfter=removeAdjacentAfter;function removeAdjacentAfter(token,check){check=makeCheck(check);var next=token.next;while(next&&check(next)){remove(next);next=next.next}}exports.removeEmptyAdjacentBefore=removeEmptyAdjacentBefore;function removeEmptyAdjacentBefore(startToken){removeAdjacentBefore(startToken,isEmpty)}exports.removeEmptyAdjacentAfter=removeEmptyAdjacentAfter;function removeEmptyAdjacentAfter(startToken){removeAdjacentAfter(startToken,isEmpty)}exports.removeEmptyInBetween=removeEmptyInBetween;function removeEmptyInBetween(startToken,endToken){removeInBetween(startToken,endToken,isEmpty)}},{"./is":66,"./makeCheck":67}],69:[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,PlaceHolders,PropertyKind,Messages,Regex,source,strict,index,lineNumber,lineStart,length,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",ArrowFunctionExpression:"ArrowFunctionExpression",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"};PlaceHolders={ArrowParameterPlaceHolder:{type:"ArrowParameterPlaceHolder"}};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;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){throwUnexpectedToken()}}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}}throwUnexpectedToken()}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 scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;if(ch==="}"){throwUnexpectedToken()}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break}code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}if(code>1114111||ch!=="}"){throwUnexpectedToken()}if(code<=65535){return String.fromCharCode(code)}cu1=(code-65536>>10)+55296;cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);if(ch===92){if(source.charCodeAt(index)!==117){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierStart(ch.charCodeAt(0))){throwUnexpectedToken()}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){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierPart(ch.charCodeAt(0))){throwUnexpectedToken()}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}}throwUnexpectedToken()}function scanHexLiteral(start){var number="";while(index<length){if(!isHexDigit(source[index])){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt("0x"+number,16),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanBinaryLiteral(start){var ch,number;number="";while(index<length){ch=source[index];if(ch!=="0"&&ch!=="1"){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(index<length){ch=source.charCodeAt(index);if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwUnexpectedToken()}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number="0"+source[index++]}else{octal=false;++index;number=""}while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(!octal&&number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function isImplicitOctalLiteral(){var i,ch;for(i=index+1;i<length;++i){ch=source[i];if(ch==="8"||ch==="9"){return false}if(!isOctalDigit(ch)){return true}}return true}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(ch==="b"||ch==="B"){++index;return scanBinaryLiteral(start)}if(ch==="o"||ch==="O"){return scanOctalLiteral(ch,start)}if(isOctalDigit(ch)){if(isImplicitOctalLiteral()){return scanOctalLiteral(ch,start)}}}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{throwUnexpectedToken()}}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}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":if(source[index]==="{"){++index;str+=scanUnicodeCodePointEscape()}else{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!==""){throwUnexpectedToken()}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 tmp=pattern,value;if(flags.indexOf("u")>=0){tmp=tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g,function($0,$1){if(parseInt($1,16)<=1114111){return"x"}throwError(Messages.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{value=new RegExp(tmp)}catch(e){throwError(Messages.InvalidRegExp)}try{return new RegExp(pattern,flags)}catch(exception){return null}}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"}tolerateUnexpectedToken()}else{str+="\\";tolerateUnexpectedToken()}}else{flags+=ch;str+=ch}}return{value:flags,literal:str}}function scanRegExp(){var start,body,flags,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,regex:{pattern:body.value,flags:flags.value},lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}return{literal:body.literal+flags.literal,value:value,regex:{pattern:body.value,flags:flags.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,regex:regex.regex,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"&&prevToken.value!=="this"){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,value,entry;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);entry={type:TokenName[token.type],value:value,range:[token.start,token.end],loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags}}extra.tokens.push(entry)}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(){this.line=lineNumber;this.column=index-lineStart}function SourceLocation(){this.start=new Position;this.end=null}function WrappingSourceLocation(startToken){if(startToken.type===Token.StringLiteral){this.start={line:startToken.startLineNumber,column:startToken.start-startToken.startLineStart}}else{this.start={line:startToken.lineNumber,column:startToken.start-startToken.lineStart}}this.end=null}function Node(){index=lookahead.start;if(lookahead.type===Token.StringLiteral){lineNumber=lookahead.startLineNumber;lineStart=lookahead.startLineStart}else{lineNumber=lookahead.lineNumber;lineStart=lookahead.lineStart}if(extra.range){this.range=[index,0]}if(extra.loc){this.loc=new SourceLocation}}function WrappingNode(startToken){if(extra.range){this.range=[startToken.start,0]}if(extra.loc){this.loc=new WrappingSourceLocation(startToken)}}WrappingNode.prototype=Node.prototype={processComment:function(){var lastChild,leadingComments,trailingComments,bottomRight=extra.bottomRightStack,i,comment,last=bottomRight[bottomRight.length-1];if(this.type===Syntax.Program){if(this.body.length>0){return}}if(extra.trailingComments.length>0){trailingComments=[];for(i=extra.trailingComments.length-1;i>=0;--i){comment=extra.trailingComments[i];if(comment.range[0]>=this.range[1]){trailingComments.unshift(comment);extra.trailingComments.splice(i,1)}}extra.trailingComments=[]}else{if(last&&last.trailingComments&&last.trailingComments[0].range[0]>=this.range[1]){trailingComments=last.trailingComments;delete last.trailingComments}}if(last){while(last&&last.range[0]>=this.range[0]){lastChild=last;last=bottomRight.pop()}}if(lastChild){if(lastChild.leadingComments&&lastChild.leadingComments[lastChild.leadingComments.length-1].range[1]<=this.range[0]){this.leadingComments=lastChild.leadingComments;lastChild.leadingComments=undefined}}else if(extra.leadingComments.length>0){leadingComments=[];for(i=extra.leadingComments.length-1;i>=0;--i){comment=extra.leadingComments[i];if(comment.range[1]<=this.range[0]){leadingComments.unshift(comment);extra.leadingComments.splice(i,1)}}}if(leadingComments&&leadingComments.length>0){this.leadingComments=leadingComments}if(trailingComments&&trailingComments.length>0){this.trailingComments=trailingComments}bottomRight.push(this)},finish:function(){if(extra.range){this.range[1]=index}if(extra.loc){this.loc.end=new Position;if(extra.source){this.loc.source=extra.source}}if(extra.attachComment){this.processComment()}},finishArrayExpression:function(elements){this.type=Syntax.ArrayExpression;this.elements=elements;this.finish();return this},finishArrowFunctionExpression:function(params,defaults,body,expression){this.type=Syntax.ArrowFunctionExpression;this.id=null;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=expression;this.finish();return this},finishAssignmentExpression:function(operator,left,right){this.type=Syntax.AssignmentExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishBinaryExpression:function(operator,left,right){this.type=operator==="||"||operator==="&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishBlockStatement:function(body){this.type=Syntax.BlockStatement;this.body=body;this.finish();return this},finishBreakStatement:function(label){this.type=Syntax.BreakStatement;this.label=label;this.finish();return this},finishCallExpression:function(callee,args){this.type=Syntax.CallExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishCatchClause:function(param,body){this.type=Syntax.CatchClause;this.param=param;this.body=body;this.finish();return this},finishConditionalExpression:function(test,consequent,alternate){this.type=Syntax.ConditionalExpression;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishContinueStatement:function(label){this.type=Syntax.ContinueStatement;this.label=label;this.finish();return this},finishDebuggerStatement:function(){this.type=Syntax.DebuggerStatement;this.finish();return this},finishDoWhileStatement:function(body,test){this.type=Syntax.DoWhileStatement;this.body=body;this.test=test;this.finish();return this},finishEmptyStatement:function(){this.type=Syntax.EmptyStatement;this.finish();return this},finishExpressionStatement:function(expression){this.type=Syntax.ExpressionStatement;this.expression=expression;this.finish();return this},finishForStatement:function(init,test,update,body){this.type=Syntax.ForStatement;this.init=init;this.test=test;this.update=update;this.body=body;this.finish();return this},finishForInStatement:function(left,right,body){this.type=Syntax.ForInStatement;this.left=left;this.right=right;this.body=body;this.each=false;this.finish();return this},finishFunctionDeclaration:function(id,params,defaults,body){this.type=Syntax.FunctionDeclaration;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=false;this.finish();return this},finishFunctionExpression:function(id,params,defaults,body){this.type=Syntax.FunctionExpression;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=false;this.finish();return this},finishIdentifier:function(name){this.type=Syntax.Identifier;this.name=name;this.finish();return this},finishIfStatement:function(test,consequent,alternate){this.type=Syntax.IfStatement;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishLabeledStatement:function(label,body){this.type=Syntax.LabeledStatement;this.label=label;this.body=body;this.finish();return this},finishLiteral:function(token){this.type=Syntax.Literal;this.value=token.value;this.raw=source.slice(token.start,token.end);if(token.regex){this.regex=token.regex}this.finish();return this},finishMemberExpression:function(accessor,object,property){this.type=Syntax.MemberExpression;this.computed=accessor==="[";this.object=object;this.property=property;this.finish();return this},finishNewExpression:function(callee,args){this.type=Syntax.NewExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishObjectExpression:function(properties){this.type=Syntax.ObjectExpression;this.properties=properties;this.finish();return this},finishPostfixExpression:function(operator,argument){this.type=Syntax.UpdateExpression;this.operator=operator;this.argument=argument;this.prefix=false;this.finish();return this},finishProgram:function(body){this.type=Syntax.Program;this.body=body;this.finish();return this},finishProperty:function(kind,key,value,method,shorthand){this.type=Syntax.Property;this.key=key;this.value=value;this.kind=kind;this.method=method;this.shorthand=shorthand;this.finish();return this},finishReturnStatement:function(argument){this.type=Syntax.ReturnStatement;this.argument=argument;this.finish();return this},finishSequenceExpression:function(expressions){this.type=Syntax.SequenceExpression;this.expressions=expressions;this.finish();return this},finishSwitchCase:function(test,consequent){this.type=Syntax.SwitchCase;this.test=test;this.consequent=consequent;this.finish();return this},finishSwitchStatement:function(discriminant,cases){this.type=Syntax.SwitchStatement;this.discriminant=discriminant;this.cases=cases;this.finish();return this},finishThisExpression:function(){this.type=Syntax.ThisExpression;this.finish();return this},finishThrowStatement:function(argument){this.type=Syntax.ThrowStatement;this.argument=argument;this.finish();return this},finishTryStatement:function(block,guardedHandlers,handlers,finalizer){this.type=Syntax.TryStatement;this.block=block;this.guardedHandlers=guardedHandlers;this.handlers=handlers;this.finalizer=finalizer;this.finish();return this},finishUnaryExpression:function(operator,argument){this.type=operator==="++"||operator==="--"?Syntax.UpdateExpression:Syntax.UnaryExpression;this.operator=operator;this.argument=argument;this.prefix=true;this.finish();return this},finishVariableDeclaration:function(declarations,kind){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind=kind;this.finish();return this},finishVariableDeclarator:function(id,init){this.type=Syntax.VariableDeclarator;this.id=id;this.init=init;this.finish();return this},finishWhileStatement:function(test,body){this.type=Syntax.WhileStatement;this.test=test;this.body=body;this.finish();return this},finishWithStatement:function(object,body){this.type=Syntax.WithStatement;this.object=object;this.body=body;this.finish();return this}};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 createError(line,pos,description){var error=new Error("Line "+line+": "+description);error.index=pos;error.lineNumber=line;error.column=pos-lineStart+1;error.description=description;return error}function throwError(messageFormat){var args,msg;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});throw createError(lineNumber,index,msg)}function tolerateError(messageFormat){var args,msg,error;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});error=createError(lineNumber,index,msg);if(extra.errors){extra.errors.push(error)}else{throw error}}function unexpectedTokenError(token,message){var msg=Messages.UnexpectedToken;if(token){msg=message?message:token.type===Token.EOF?Messages.UnexpectedEOS:token.type===Token.Identifier?Messages.UnexpectedIdentifier:token.type===Token.NumericLiteral?Messages.UnexpectedNumber:token.type===Token.StringLiteral?Messages.UnexpectedString:Messages.UnexpectedToken;if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){msg=Messages.UnexpectedReserved}else if(strict&&isStrictModeReservedWord(token.value)){msg=Messages.StrictReservedWord}}}msg=msg.replace("%0",token?token.value:"ILLEGAL");return token&&typeof token.lineNumber==="number"?createError(token.lineNumber,token.start,msg):createError(lineNumber,index,msg)}function throwUnexpectedToken(token,message){throw unexpectedTokenError(token,message)}function tolerateUnexpectedToken(token,message){var error=unexpectedTokenError(token,message);if(extra.errors){extra.errors.push(error)}else{throw error}}function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpectedToken(token)}}function expectCommaSeparator(){var token;if(extra.errors){token=lookahead;if(token.type===Token.Punctuator&&token.value===","){lex()}else if(token.type===Token.Punctuator&&token.value===";"){lex();tolerateUnexpectedToken(token)}else{tolerateUnexpectedToken(token,Messages.UnexpectedToken)}}else{expect(",")}}function expectKeyword(keyword){var token=lex();if(token.type!==Token.Keyword||token.value!==keyword){throwUnexpectedToken(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,oldIndex=index,oldLineNumber=lineNumber,oldLineStart=lineStart,oldLookahead=lookahead;if(source.charCodeAt(index)===59||match(";")){lex();return}line=lineNumber;skipComment();if(lineNumber!==line){index=oldIndex;lineNumber=oldLineNumber;lineStart=oldLineStart;lookahead=oldLookahead;return}if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpectedToken(lookahead)}}function isLeftHandSide(expr){return expr.type===Syntax.Identifier||expr.type===Syntax.MemberExpression}function parseArrayInitialiser(){var elements=[],node=new Node;expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)}else{elements.push(parseAssignmentExpression());if(!match("]")){expect(",")}}}lex();return node.finishArrayExpression(elements)}function parsePropertyFunction(param,first){var previousStrict,body,node=new Node;previousStrict=strict;body=parseFunctionSourceElements();if(first&&strict&&isRestrictedWord(param[0].name)){tolerateUnexpectedToken(first,Messages.StrictParamName)}strict=previousStrict;return node.finishFunctionExpression(null,param,[],body)}function parsePropertyMethodFunction(){var previousStrict,param,method;previousStrict=strict;strict=true;param=parseParams();method=parsePropertyFunction(param.params);strict=previousStrict;return method}function parseObjectPropertyKey(){var token,node=new Node;token=lex();if(token.type===Token.StringLiteral||token.type===Token.NumericLiteral){if(strict&&token.octal){tolerateUnexpectedToken(token,Messages.StrictOctalLiteral)}return node.finishLiteral(token)}return node.finishIdentifier(token.value)}function parseObjectProperty(){var token,key,id,value,param,node=new Node;token=lookahead;if(token.type===Token.Identifier){id=parseObjectPropertyKey();if(token.value==="get"&&!(match(":")||match("("))){key=parseObjectPropertyKey();expect("(");expect(")");value=parsePropertyFunction([]);return node.finishProperty("get",key,value,false,false)}if(token.value==="set"&&!(match(":")||match("("))){key=parseObjectPropertyKey();expect("(");token=lookahead;if(token.type!==Token.Identifier){expect(")");tolerateUnexpectedToken(token);value=parsePropertyFunction([])}else{param=[parseVariableIdentifier()];expect(")");value=parsePropertyFunction(param,token)}return node.finishProperty("set",key,value,false,false)}if(match(":")){lex();value=parseAssignmentExpression();return node.finishProperty("init",id,value,false,false)}if(match("(")){value=parsePropertyMethodFunction();return node.finishProperty("init",id,value,true,false)}value=id;return node.finishProperty("init",id,value,false,true)}if(token.type===Token.EOF||token.type===Token.Punctuator){throwUnexpectedToken(token)}else{key=parseObjectPropertyKey();if(match(":")){lex();value=parseAssignmentExpression();return node.finishProperty("init",key,value,false,false)}if(match("(")){value=parsePropertyMethodFunction();return node.finishProperty("init",key,value,true,false)}throwUnexpectedToken(lex())}}function parseObjectInitialiser(){var properties=[],property,name,key,kind,map={},toString=String,node=new Node;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){tolerateError(Messages.StrictDuplicateProperty)}else if(kind!==PropertyKind.Data){tolerateError(Messages.AccessorDataProperty)}}else{if(kind===PropertyKind.Data){tolerateError(Messages.AccessorDataProperty)}else if(map[key]&kind){tolerateError(Messages.AccessorGetSet)}}map[key]|=kind}else{map[key]=kind}properties.push(property);if(!match("}")){expectCommaSeparator()}}expect("}");return node.finishObjectExpression(properties)}function parseGroupExpression(){var expr;expect("(");if(match(")")){lex();return PlaceHolders.ArrowParameterPlaceHolder}++state.parenthesisCount;expr=parseExpression();expect(")");return expr}function parsePrimaryExpression(){var type,token,expr,node;if(match("(")){return parseGroupExpression()}if(match("[")){return parseArrayInitialiser()}if(match("{")){return parseObjectInitialiser()}type=lookahead.type;node=new Node;if(type===Token.Identifier){expr=node.finishIdentifier(lex().value)}else if(type===Token.StringLiteral||type===Token.NumericLiteral){if(strict&&lookahead.octal){tolerateUnexpectedToken(lookahead,Messages.StrictOctalLiteral)}expr=node.finishLiteral(lex())}else if(type===Token.Keyword){if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("this")){lex();expr=node.finishThisExpression()}else{throwUnexpectedToken(lex())}}else if(type===Token.BooleanLiteral){token=lex();token.value=token.value==="true";expr=node.finishLiteral(token)}else if(type===Token.NullLiteral){token=lex();token.value=null;expr=node.finishLiteral(token)}else if(match("/")||match("/=")){if(typeof extra.tokens!=="undefined"){expr=node.finishLiteral(collectRegex())}else{expr=node.finishLiteral(scanRegExp())}peek()}else{throwUnexpectedToken(lex())}return expr}function parseArguments(){var args=[];expect("(");if(!match(")")){while(index<length){args.push(parseAssignmentExpression());if(match(")")){break}expectCommaSeparator()}}expect(")");return args}function parseNonComputedProperty(){var token,node=new Node;token=lex();if(!isIdentifierName(token)){throwUnexpectedToken(token)}return node.finishIdentifier(token.value)}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression();expect("]");return expr}function parseNewExpression(){var callee,args,node=new Node;expectKeyword("new");callee=parseLeftHandSideExpression();args=match("(")?parseArguments():[];return node.finishNewExpression(callee,args)}function parseLeftHandSideExpressionAllowCall(){var expr,args,property,startToken,previousAllowIn=state.allowIn;startToken=lookahead;state.allowIn=true;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();for(;;){if(match(".")){property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else if(match("(")){args=parseArguments();expr=new WrappingNode(startToken).finishCallExpression(expr,args)}else if(match("[")){property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else{break}}state.allowIn=previousAllowIn;return expr}function parseLeftHandSideExpression(){var expr,property,startToken;assert(state.allowIn,"callee of new expression always allow in keyword.");startToken=lookahead;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();for(;;){if(match("[")){property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else if(match(".")){property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else{break}}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)){tolerateError(Messages.StrictLHSPostfix)}if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}token=lex();expr=new WrappingNode(startToken).finishPostfixExpression(token.value,expr)}}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)){tolerateError(Messages.StrictLHSPrefix)}if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr)}else if(match("+")||match("-")||match("~")||match("!")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr)}else if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){tolerateError(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();if(left===PlaceHolders.ArrowParameterPlaceHolder){return left}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();markers.pop();expr=new WrappingNode(markers[markers.length-1]).finishBinaryExpression(operator,left,right);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=new WrappingNode(markers.pop()).finishBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,startToken;startToken=lookahead;expr=parseBinaryExpression();if(expr===PlaceHolders.ArrowParameterPlaceHolder){return expr}if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=parseAssignmentExpression();state.allowIn=previousAllowIn;expect(":");alternate=parseAssignmentExpression();expr=new WrappingNode(startToken).finishConditionalExpression(expr,consequent,alternate)}return expr}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements()}return parseAssignmentExpression()}function reinterpretAsCoverFormalsList(expressions){var i,len,param,params,defaults,defaultCount,options,rest,token;params=[];defaults=[];defaultCount=0;rest=null;options={paramSet:{}};for(i=0,len=expressions.length;i<len;i+=1){param=expressions[i];if(param.type===Syntax.Identifier){params.push(param);defaults.push(null);validateParam(options,param,param.name)}else if(param.type===Syntax.AssignmentExpression){params.push(param.left);defaults.push(param.right);++defaultCount;validateParam(options,param.left,param.left.name)}else{return null}}if(options.message===Messages.StrictParamDupe){token=strict?options.stricted:options.firstRestricted;throwUnexpectedToken(token,options.message)}if(defaultCount===0){defaults=[]}return{params:params,defaults:defaults,rest:rest,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseArrowFunctionExpression(options,node){var previousStrict,body;expect("=>");previousStrict=strict;body=parseConciseBody();if(strict&&options.firstRestricted){throwUnexpectedToken(options.firstRestricted,options.message)}if(strict&&options.stricted){tolerateUnexpectedToken(options.stricted,options.message)}strict=previousStrict;return node.finishArrowFunctionExpression(options.params,options.defaults,body,body.type!==Syntax.BlockStatement)}function parseAssignmentExpression(){var oldParenthesisCount,token,expr,right,list,startToken;oldParenthesisCount=state.parenthesisCount;startToken=lookahead;token=lookahead;expr=parseConditionalExpression();if(expr===PlaceHolders.ArrowParameterPlaceHolder||match("=>")){if(state.parenthesisCount===oldParenthesisCount||state.parenthesisCount===oldParenthesisCount+1){if(expr.type===Syntax.Identifier){list=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.AssignmentExpression){list=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.SequenceExpression){list=reinterpretAsCoverFormalsList(expr.expressions)}else if(expr===PlaceHolders.ArrowParameterPlaceHolder){list=reinterpretAsCoverFormalsList([])}if(list){return parseArrowFunctionExpression(list,new WrappingNode(startToken))}}}if(matchAssign()){if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateUnexpectedToken(token,Messages.StrictLHSAssignment)}token=lex();right=parseAssignmentExpression();expr=new WrappingNode(startToken).finishAssignmentExpression(token.value,expr,right)}return expr}function parseExpression(){var expr,startToken=lookahead,expressions;expr=parseAssignmentExpression();if(match(",")){expressions=[expr];while(index<length){if(!match(",")){break}lex();expressions.push(parseAssignmentExpression())}expr=new WrappingNode(startToken).finishSequenceExpression(expressions)}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,node=new Node;expect("{");block=parseStatementList();expect("}");return node.finishBlockStatement(block)}function parseVariableIdentifier(){var token,node=new Node;token=lex();if(token.type!==Token.Identifier){if(strict&&token.type===Token.Keyword&&isStrictModeReservedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictReservedWord)}else{throwUnexpectedToken(token)}}return node.finishIdentifier(token.value)}function parseVariableDeclaration(kind){var init=null,id,node=new Node;id=parseVariableIdentifier();if(strict&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName)}if(kind==="const"){expect("=");init=parseAssignmentExpression()}else if(match("=")){lex();init=parseAssignmentExpression()}return node.finishVariableDeclarator(id,init)}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break}lex()}while(index<length);return list}function parseVariableStatement(node){var declarations;expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return node.finishVariableDeclaration(declarations,"var")}function parseConstLetDeclaration(kind){var declarations,node=new Node;expectKeyword(kind);declarations=parseVariableDeclarationList(kind);consumeSemicolon();return node.finishVariableDeclaration(declarations,kind)}function parseEmptyStatement(){var node=new Node;expect(";");return node.finishEmptyStatement()}function parseExpressionStatement(node){var expr=parseExpression();consumeSemicolon();return node.finishExpressionStatement(expr)}function parseIfStatement(node){var test,consequent,alternate;expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return node.finishIfStatement(test,consequent,alternate)}function parseDoWhileStatement(node){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 node.finishDoWhileStatement(body,test)}function parseWhileStatement(node){var test,body,oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return node.finishWhileStatement(test,body)}function parseForVariableDeclaration(){var token,declarations,node=new Node;token=lex();declarations=parseVariableDeclarationList();return node.finishVariableDeclaration(declarations,token.value)}function parseForStatement(node){var init,test,update,left,right,body,oldInIteration,previousAllowIn=state.allowIn;init=test=update=null;expectKeyword("for");expect("(");if(match(";")){lex()}else{if(matchKeyword("var")||matchKeyword("let")){state.allowIn=false;init=parseForVariableDeclaration();state.allowIn=previousAllowIn;if(init.declarations.length===1&&matchKeyword("in")){lex();left=init;right=parseExpression();init=null}}else{state.allowIn=false;init=parseExpression();state.allowIn=previousAllowIn;if(matchKeyword("in")){if(!isLeftHandSide(init)){tolerateError(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"?node.finishForStatement(init,test,update,body):node.finishForInStatement(left,right,body)}function parseContinueStatement(node){var label=null,key;expectKeyword("continue");if(source.charCodeAt(index)===59){lex();if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(null)}if(peekLineTerminator()){if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(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 node.finishContinueStatement(label)}function parseBreakStatement(node){var label=null,key;expectKeyword("break");if(source.charCodeAt(index)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(null)}if(peekLineTerminator()){if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(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 node.finishBreakStatement(label)}function parseReturnStatement(node){var argument=null;expectKeyword("return");if(!state.inFunctionBody){tolerateError(Messages.IllegalReturn)}if(source.charCodeAt(index)===32){if(isIdentifierStart(source.charCodeAt(index+1))){argument=parseExpression();consumeSemicolon();return node.finishReturnStatement(argument)}}if(peekLineTerminator()){return node.finishReturnStatement(null)}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return node.finishReturnStatement(argument)}function parseWithStatement(node){var object,body;if(strict){skipComment();tolerateError(Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return node.finishWithStatement(object,body)}function parseSwitchCase(){var test,consequent=[],statement,node=new Node;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 node.finishSwitchCase(test,consequent)}function parseSwitchStatement(node){var discriminant,cases,clause,oldInSwitch,defaultFound;expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return node.finishSwitchStatement(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 node.finishSwitchStatement(discriminant,cases)}function parseThrowStatement(node){var argument;expectKeyword("throw");if(peekLineTerminator()){throwError(Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return node.finishThrowStatement(argument)}function parseCatchClause(){var param,body,node=new Node;expectKeyword("catch");expect("(");if(match(")")){throwUnexpectedToken(lookahead)}param=parseVariableIdentifier();if(strict&&isRestrictedWord(param.name)){tolerateError(Messages.StrictCatchVariable)}expect(")");body=parseBlock();return node.finishCatchClause(param,body)}function parseTryStatement(node){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 node.finishTryStatement(block,[],handlers,finalizer)}function parseDebuggerStatement(node){expectKeyword("debugger");consumeSemicolon();return node.finishDebuggerStatement()}function parseStatement(){var type=lookahead.type,expr,labeledBody,key,node;if(type===Token.EOF){throwUnexpectedToken(lookahead)}if(type===Token.Punctuator&&lookahead.value==="{"){return parseBlock()}node=new Node;if(type===Token.Punctuator){switch(lookahead.value){case";":return parseEmptyStatement(node);case"(":return parseExpressionStatement(node);default:break}}else if(type===Token.Keyword){switch(lookahead.value){case"break":return parseBreakStatement(node);case"continue":return parseContinueStatement(node);case"debugger":return parseDebuggerStatement(node);case"do":return parseDoWhileStatement(node);case"for":return parseForStatement(node);case"function":return parseFunctionDeclaration(node);case"if":return parseIfStatement(node);case"return":return parseReturnStatement(node);case"switch":return parseSwitchStatement(node);case"throw":return parseThrowStatement(node);case"try":return parseTryStatement(node);case"var":return parseVariableStatement(node);case"while":return parseWhileStatement(node);case"with":return parseWithStatement(node);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 node.finishLabeledStatement(expr,labeledBody)}consumeSemicolon();return node.finishExpressionStatement(expr)}function parseFunctionSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,oldParenthesisCount,node=new Node;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){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;oldParenthesisCount=state.parenthesizedCount;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;state.parenthesizedCount=0;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;state.parenthesizedCount=oldParenthesisCount;return node.finishBlockStatement(sourceElements)}function validateParam(options,param,name){var key="$"+name;if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName}if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.firstRestricted=param;options.message=Messages.StrictParamDupe}}options.paramSet[key]=true}function parseParam(options){var token,param,def;token=lookahead;param=parseVariableIdentifier();validateParam(options,token,token.value);if(match("=")){lex();def=parseAssignmentExpression();++options.defaultCount}options.params.push(param);options.defaults.push(def);return!match(")")}function parseParams(firstRestricted){var options;options={params:[],defaultCount:0,defaults:[],firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet={};while(index<length){if(!parseParam(options)){break}expect(",")}}expect(")");if(options.defaultCount===0){options.defaults=[]}return{params:options.params,defaults:options.defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseFunctionDeclaration(){var id,params=[],defaults=[],body,token,stricted,tmp,firstRestricted,message,previousStrict,node=new Node;expectKeyword("function");token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(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;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionDeclaration(id,params,defaults,body)}function parseFunctionExpression(){var token,id=null,stricted,firstRestricted,message,tmp,params=[],defaults=[],body,previousStrict,node=new Node;expectKeyword("function");if(!match("(")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(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;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionExpression(id,params,defaults,body)}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){tolerateUnexpectedToken(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,node;skipComment();peek();node=new Node;strict=false;body=parseSourceElements();return node.finishProgram(body)}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(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags}}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,tokens;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}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}lex();while(lookahead.type!==Token.EOF){try{lex()}catch(lexError){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)}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},parenthesisCount:0,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="2.0.0";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}()})},{}],70:[function(require,module,exports){"use strict";var esprima=require("esprima");exports.BYPASS_RECURSION={root:true,comments:true,tokens:true,loc:true,range:true,parent:true,next:true,prev:true,type:true,raw:true,startToken:true,endToken:true};var _addLocInfo;exports.parse=function parse(source,opts){_addLocInfo=opts&&opts.loc;source=source.toString();var ast=esprima.parse(source,{loc:_addLocInfo,range:true,tokens:true,comment:true});if(!ast.tokens.length&&!ast.comments.length){ast.depth=0;ast.startToken=ast.endToken=null;ast.toString=_nodeProto.toString;return ast}instrumentTokens(ast,source);var lastToken=ast.tokens[ast.tokens.length-1];ast.range[0]=ast.tokens[0].range[0];ast.range[1]=lastToken.range[1];if(_addLocInfo){ast.loc.start.line=0;ast.loc.start.column=0;ast.loc.end.line=lastToken.loc.end.line;ast.loc.end.column=lastToken.loc.end.column}var toString=_nodeProto.toString;var instrumentNodes=function(node,parent,prev,next){node.parent=parent;node.prev=prev;node.next=next;node.depth=parent?parent.depth+1:0;node.toString=toString;var prevToken=prev?prev.endToken:parent?parent.startToken:null;var nextToken=parent?parent.endToken:null;node.startToken=prevToken?getNodeStartToken(prevToken,node.range):ast.tokens[0];node.endToken=nextToken?getNodeEndToken(nextToken,node.range):ast.tokens[ast.tokens.length-1]};recursiveWalk(ast,instrumentNodes);return ast};var _nodeProto={};_nodeProto.toString=function(){var str="";var token=this.startToken;if(!token)return str;do{str+="raw"in token?token.raw:token.value;token=token.next}while(token&&token!==this.endToken.next);return str};function getNodeStartToken(token,range){var startRange=range[0];while(token){if(token.range[0]>=startRange){return token}token=token.next}}function getNodeEndToken(token,range){var endRange=range[1];while(token){if(token.range[1]<=endRange){return token}token=token.prev}}function getPrevToken(tokens,range){var result,token,startRange=range[0],n=tokens.length;while(n--){token=tokens[n];if(token.range[1]<=startRange){result=token;break}}return result}function instrumentTokens(ast,source){var tokens=ast.tokens;var comments=ast.comments;var comment,q=-1,nComments=comments.length;while(++q<nComments){comment=comments[q];comment.raw=comment.type==="Block"?"/*"+comment.value+"*/":"//"+comment.value;comment.type+="Comment";var prevToken=getPrevToken(tokens,comment.range);var prevIndex=prevToken?tokens.indexOf(prevToken):-1;tokens.splice(prevIndex+1,0,comment)}var result=[];var wsTokens;var firstToken=ast.tokens[0];var raw;if(firstToken.range[0]){raw=source.substring(0,firstToken.range[0]);result=result.concat(getWhiteSpaceTokens(raw,null))}var i=-1,nTokens=tokens.length,token,prev;var k,nWs;while(++i<nTokens){token=tokens[i];if(i){if(prev.range[1]<token.range[0]){wsTokens=getWhiteSpaceTokens(source.substring(prev.range[1],token.range[0]),prev);k=-1;nWs=wsTokens.length;while(++k<nWs){result.push(wsTokens[k])}}}result.push(token);prev=token}var lastToken=ast.tokens[ast.tokens.length-1];if(lastToken.range[1]<source.length){wsTokens=getWhiteSpaceTokens(source.substring(lastToken.range[1],source.length),lastToken);k=-1;nWs=wsTokens.length;while(++k<nWs){result.push(wsTokens[k])}}var n;for(i=0,n=result.length,token;i<n;i++){token=result[i];token.prev=i?result[i-1]:undefined;token.next=result[i+1];token.root=ast;if(token.type==="BlockComment"&&token.prev&&token.prev.type==="WhiteSpace"&&(!token.prev.prev||token.prev.prev.type==="LineBreak")){token.originalIndent=token.prev.value}}ast.tokens=result}function getWhiteSpaceTokens(raw,prev){var whiteSpaces=getWhiteSpaces(raw);var startRange=prev?prev.range[1]:0;var startLine,startColumn;if(_addLocInfo){startLine=prev?prev.loc.end.line:1;startColumn=prev?prev.loc.end.column:0}var tokens=[];for(var i=0,n=whiteSpaces.length,value;i<n;i++){value=whiteSpaces[i];var wsToken={value:value};var isBr="\r\n".indexOf(value)>=0;wsToken.type=isBr?"LineBreak":"WhiteSpace";wsToken.range=[startRange,startRange+value.length];if(_addLocInfo){wsToken.loc={start:{line:startLine,column:startColumn},end:{line:startLine,column:startColumn+value.length}};if(isBr){startLine=wsToken.loc.end.line+1;startColumn=0}else{startLine=wsToken.loc.end.line;startColumn=wsToken.loc.end.column}}startRange+=value.length;tokens.push(wsToken)}return tokens}function getWhiteSpaces(source){var result=[];var whiteSpaces=source.split("");var buf="";for(var value,i=0,nSpaces=whiteSpaces.length;i<nSpaces;i++){value=whiteSpaces[i];switch(value){case"\n":if(buf==="\r"){result.push(buf+value)}else{if(buf){result.push(buf)}result.push(value)}buf="";break;case"\r":if(buf){result.push(buf)}buf=value;break;default:if(buf==="\r"){result.push(buf);buf=value}else{buf+=value}}}if(buf){result.push(buf)}return result}exports.walk=exports.recursive=recursiveWalk;function recursiveWalk(node,fn,parent,prev,next){if(!node||fn(node,parent,prev,next)===false){return}var keys=Object.keys(node),child,key;for(var i=0,nKeys=keys.length;i<nKeys;i++){key=keys[i];child=node[key];if(!child||typeof child!=="object"||exports.BYPASS_RECURSION[key]){continue}if(typeof child.type==="string"){recursiveWalk(child,fn,node)}else if(typeof child.length==="number"){for(var k=0,nChilds=child.length;k<nChilds;k++){recursiveWalk(child[k],fn,node,k?child[k-1]:undefined,child[k+1])}}}}exports.moonwalk=function moonwalk(ast,fn){if(typeof ast==="string"){ast=exports.parse(ast)}var swap=[];recursiveWalk(ast,function(node){if(!swap[node.depth]){swap[node.depth]=[]}swap[node.depth].push(node)});var nodes=[];var nDepths=swap.length,cur;while(cur=swap[--nDepths]){for(var i=0,n=cur.length;i<n;i++){nodes.push(cur[i])}}nodes.forEach(fn);return ast}},{esprima:69}],71:[function(require,module,exports){(function(exports){if(typeof module==="object"&&module.exports===exports)exports=module.exports=SemVer;exports.SEMVER_SPEC_VERSION="2.0.0";var re=exports.re=[];var src=exports.src=[];var R=0;var NUMERICIDENTIFIER=R++;src[NUMERICIDENTIFIER]="0|[1-9]\\d*";var NUMERICIDENTIFIERLOOSE=R++;src[NUMERICIDENTIFIERLOOSE]="[0-9]+";var NONNUMERICIDENTIFIER=R++;src[NONNUMERICIDENTIFIER]="\\d*[a-zA-Z-][a-zA-Z0-9-]*";var MAINVERSION=R++;src[MAINVERSION]="("+src[NUMERICIDENTIFIER]+")\\."+"("+src[NUMERICIDENTIFIER]+")\\."+"("+src[NUMERICIDENTIFIER]+")";var MAINVERSIONLOOSE=R++;src[MAINVERSIONLOOSE]="("+src[NUMERICIDENTIFIERLOOSE]+")\\."+"("+src[NUMERICIDENTIFIERLOOSE]+")\\."+"("+src[NUMERICIDENTIFIERLOOSE]+")";var PRERELEASEIDENTIFIER=R++;src[PRERELEASEIDENTIFIER]="(?:"+src[NUMERICIDENTIFIER]+"|"+src[NONNUMERICIDENTIFIER]+")";var PRERELEASEIDENTIFIERLOOSE=R++;src[PRERELEASEIDENTIFIERLOOSE]="(?:"+src[NUMERICIDENTIFIERLOOSE]+"|"+src[NONNUMERICIDENTIFIER]+")";var PRERELEASE=R++;src[PRERELEASE]="(?:-("+src[PRERELEASEIDENTIFIER]+"(?:\\."+src[PRERELEASEIDENTIFIER]+")*))";var PRERELEASELOOSE=R++;src[PRERELEASELOOSE]="(?:-?("+src[PRERELEASEIDENTIFIERLOOSE]+"(?:\\."+src[PRERELEASEIDENTIFIERLOOSE]+")*))";var BUILDIDENTIFIER=R++;src[BUILDIDENTIFIER]="[0-9A-Za-z-]+";var BUILD=R++;src[BUILD]="(?:\\+("+src[BUILDIDENTIFIER]+"(?:\\."+src[BUILDIDENTIFIER]+")*))";var FULL=R++;var FULLPLAIN="v?"+src[MAINVERSION]+src[PRERELEASE]+"?"+src[BUILD]+"?";src[FULL]="^"+FULLPLAIN+"$";var LOOSEPLAIN="[v=\\s]*"+src[MAINVERSIONLOOSE]+src[PRERELEASELOOSE]+"?"+src[BUILD]+"?";var LOOSE=R++;src[LOOSE]="^"+LOOSEPLAIN+"$";var GTLT=R++;src[GTLT]="((?:<|>)?=?)";var XRANGEIDENTIFIERLOOSE=R++;src[XRANGEIDENTIFIERLOOSE]=src[NUMERICIDENTIFIERLOOSE]+"|x|X|\\*";var XRANGEIDENTIFIER=R++;src[XRANGEIDENTIFIER]=src[NUMERICIDENTIFIER]+"|x|X|\\*";var XRANGEPLAIN=R++;src[XRANGEPLAIN]="[v=\\s]*("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:\\.("+src[XRANGEIDENTIFIER]+")"+"(?:("+src[PRERELEASE]+")"+")?)?)?";var XRANGEPLAINLOOSE=R++;src[XRANGEPLAINLOOSE]="[v=\\s]*("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:\\.("+src[XRANGEIDENTIFIERLOOSE]+")"+"(?:("+src[PRERELEASELOOSE]+")"+")?)?)?";var XRANGE=R++;src[XRANGE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAIN]+"$";var XRANGELOOSE=R++;src[XRANGELOOSE]="^"+src[GTLT]+"\\s*"+src[XRANGEPLAINLOOSE]+"$";var LONETILDE=R++;src[LONETILDE]="(?:~>?)";var TILDETRIM=R++;src[TILDETRIM]="(\\s*)"+src[LONETILDE]+"\\s+";re[TILDETRIM]=new RegExp(src[TILDETRIM],"g");var tildeTrimReplace="$1~";var TILDE=R++;src[TILDE]="^"+src[LONETILDE]+src[XRANGEPLAIN]+"$";var TILDELOOSE=R++;src[TILDELOOSE]="^"+src[LONETILDE]+src[XRANGEPLAINLOOSE]+"$";var LONECARET=R++;src[LONECARET]="(?:\\^)";var CARETTRIM=R++;src[CARETTRIM]="(\\s*)"+src[LONECARET]+"\\s+";re[CARETTRIM]=new RegExp(src[CARETTRIM],"g");var caretTrimReplace="$1^";var CARET=R++;src[CARET]="^"+src[LONECARET]+src[XRANGEPLAIN]+"$";var CARETLOOSE=R++;src[CARETLOOSE]="^"+src[LONECARET]+src[XRANGEPLAINLOOSE]+"$";var COMPARATORLOOSE=R++;src[COMPARATORLOOSE]="^"+src[GTLT]+"\\s*("+LOOSEPLAIN+")$|^$";var COMPARATOR=R++;src[COMPARATOR]="^"+src[GTLT]+"\\s*("+FULLPLAIN+")$|^$";var COMPARATORTRIM=R++;src[COMPARATORTRIM]="(\\s*)"+src[GTLT]+"\\s*("+LOOSEPLAIN+"|"+src[XRANGEPLAIN]+")";re[COMPARATORTRIM]=new RegExp(src[COMPARATORTRIM],"g");var comparatorTrimReplace="$1$2$3";var HYPHENRANGE=R++;src[HYPHENRANGE]="^\\s*("+src[XRANGEPLAIN]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAIN]+")"+"\\s*$";var HYPHENRANGELOOSE=R++;src[HYPHENRANGELOOSE]="^\\s*("+src[XRANGEPLAINLOOSE]+")"+"\\s+-\\s+"+"("+src[XRANGEPLAINLOOSE]+")"+"\\s*$";var STAR=R++;src[STAR]="(<|>)?=?\\s*\\*";for(var i=0;i<R;i++){if(!re[i])re[i]=new RegExp(src[i])}exports.parse=parse;function parse(version,loose){var r=loose?re[LOOSE]:re[FULL];return r.test(version)?new SemVer(version,loose):null}exports.valid=valid;function valid(version,loose){var v=parse(version,loose);return v?v.version:null}exports.clean=clean;function clean(version,loose){var s=parse(version,loose);return s?s.version:null}exports.SemVer=SemVer;function SemVer(version,loose){if(version instanceof SemVer){if(version.loose===loose)return version;else version=version.version}if(!(this instanceof SemVer))return new SemVer(version,loose);this.loose=loose;var m=version.trim().match(loose?re[LOOSE]:re[FULL]);if(!m)throw new TypeError("Invalid Version: "+version);this.raw=version;this.major=+m[1];this.minor=+m[2];this.patch=+m[3];if(!m[4])this.prerelease=[];else this.prerelease=m[4].split(".").map(function(id){return/^[0-9]+$/.test(id)?+id:id});this.build=m[5]?m[5].split("."):[];this.format()}SemVer.prototype.format=function(){this.version=this.major+"."+this.minor+"."+this.patch;if(this.prerelease.length)this.version+="-"+this.prerelease.join(".");return this.version};SemVer.prototype.inspect=function(){return'<SemVer "'+this+'">'};SemVer.prototype.toString=function(){return this.version};SemVer.prototype.compare=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);return this.compareMain(other)||this.comparePre(other)};SemVer.prototype.compareMain=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);return compareIdentifiers(this.major,other.major)||compareIdentifiers(this.minor,other.minor)||compareIdentifiers(this.patch,other.patch)};SemVer.prototype.comparePre=function(other){if(!(other instanceof SemVer))other=new SemVer(other,this.loose);if(this.prerelease.length&&!other.prerelease.length)return-1;else if(!this.prerelease.length&&other.prerelease.length)return 1;else if(!this.prerelease.lenth&&!other.prerelease.length)return 0;var i=0;do{var a=this.prerelease[i];var b=other.prerelease[i];if(a===undefined&&b===undefined)return 0;else if(b===undefined)return 1;else if(a===undefined)return-1;else if(a===b)continue;else return compareIdentifiers(a,b)}while(++i)};SemVer.prototype.inc=function(release){switch(release){case"major":this.major++;this.minor=-1;case"minor":this.minor++;this.patch=-1;case"patch":this.patch++;this.prerelease=[];break;case"prerelease":if(this.prerelease.length===0)this.prerelease=[0];else{var i=this.prerelease.length;while(--i>=0){if(typeof this.prerelease[i]==="number"){this.prerelease[i]++;i=-2}}if(i===-1)this.prerelease.push(0)}break;default:throw new Error("invalid increment argument: "+release)}this.format();return this};exports.inc=inc;function inc(version,release,loose){try{return new SemVer(version,loose).inc(release).version}catch(er){return null}}exports.compareIdentifiers=compareIdentifiers;var numeric=/^[0-9]+$/;function compareIdentifiers(a,b){var anum=numeric.test(a);var bnum=numeric.test(b);if(anum&&bnum){a=+a;b=+b}return anum&&!bnum?-1:bnum&&!anum?1:a<b?-1:a>b?1:0}exports.rcompareIdentifiers=rcompareIdentifiers;function rcompareIdentifiers(a,b){return compareIdentifiers(b,a)}exports.compare=compare;function compare(a,b,loose){return new SemVer(a,loose).compare(b)}exports.compareLoose=compareLoose;function compareLoose(a,b){return compare(a,b,true)}exports.rcompare=rcompare;function rcompare(a,b,loose){return compare(b,a,loose)}exports.sort=sort;function sort(list,loose){return list.sort(function(a,b){return exports.compare(a,b,loose)})}exports.rsort=rsort;function rsort(list,loose){return list.sort(function(a,b){return exports.rcompare(a,b,loose)})}exports.gt=gt;function gt(a,b,loose){return compare(a,b,loose)>0}exports.lt=lt;function lt(a,b,loose){return compare(a,b,loose)<0}exports.eq=eq;function eq(a,b,loose){return compare(a,b,loose)===0}exports.neq=neq;function neq(a,b,loose){return compare(a,b,loose)!==0}exports.gte=gte;function gte(a,b,loose){return compare(a,b,loose)>=0}exports.lte=lte;function lte(a,b,loose){return compare(a,b,loose)<=0}exports.cmp=cmp;function cmp(a,op,b,loose){var ret;switch(op){case"===":ret=a===b;break;case"!==":ret=a!==b;break;case"":case"=":case"==":ret=eq(a,b,loose);break;case"!=":ret=neq(a,b,loose);break;case">":ret=gt(a,b,loose);break;case">=":ret=gte(a,b,loose);break;case"<":ret=lt(a,b,loose);break;case"<=":ret=lte(a,b,loose);break;default:throw new TypeError("Invalid operator: "+op)}return ret}exports.Comparator=Comparator;function Comparator(comp,loose){if(comp instanceof Comparator){if(comp.loose===loose)return comp;else comp=comp.value}if(!(this instanceof Comparator))return new Comparator(comp,loose);this.loose=loose;this.parse(comp);if(this.semver===ANY)this.value="";else this.value=this.operator+this.semver.version}var ANY={};Comparator.prototype.parse=function(comp){var r=this.loose?re[COMPARATORLOOSE]:re[COMPARATOR];var m=comp.match(r);if(!m)throw new TypeError("Invalid comparator: "+comp);this.operator=m[1];if(!m[2])this.semver=ANY;else{this.semver=new SemVer(m[2],this.loose);if(this.operator==="<"&&!this.semver.prerelease.length){this.semver.prerelease=["0"];this.semver.format()}}};Comparator.prototype.inspect=function(){return'<SemVer Comparator "'+this+'">'};Comparator.prototype.toString=function(){return this.value};Comparator.prototype.test=function(version){return this.semver===ANY?true:cmp(version,this.operator,this.semver,this.loose)};exports.Range=Range;function Range(range,loose){if(range instanceof Range&&range.loose===loose)return range;if(!(this instanceof Range))return new Range(range,loose);this.loose=loose;this.raw=range;this.set=range.split(/\s*\|\|\s*/).map(function(range){return this.parseRange(range.trim())},this).filter(function(c){return c.length});if(!this.set.length){throw new TypeError("Invalid SemVer Range: "+range)}this.format()}Range.prototype.inspect=function(){return'<SemVer Range "'+this.range+'">'};Range.prototype.format=function(){this.range=this.set.map(function(comps){return comps.join(" ").trim()}).join("||").trim();return this.range};Range.prototype.toString=function(){return this.range};Range.prototype.parseRange=function(range){var loose=this.loose;range=range.trim();var hr=loose?re[HYPHENRANGELOOSE]:re[HYPHENRANGE];range=range.replace(hr,hyphenReplace);range=range.replace(re[COMPARATORTRIM],comparatorTrimReplace);range=range.replace(re[TILDETRIM],tildeTrimReplace);range=range.replace(re[CARETTRIM],caretTrimReplace);range=range.split(/\s+/).join(" ");var compRe=loose?re[COMPARATORLOOSE]:re[COMPARATOR];var set=range.split(" ").map(function(comp){return parseComparator(comp,loose)}).join(" ").split(/\s+/);if(this.loose){set=set.filter(function(comp){return!!comp.match(compRe)})}set=set.map(function(comp){return new Comparator(comp,loose)});return set};exports.toComparators=toComparators;function toComparators(range,loose){return new Range(range,loose).set.map(function(comp){return comp.map(function(c){return c.value}).join(" ").trim().split(" ")})}function parseComparator(comp,loose){comp=replaceCarets(comp,loose);comp=replaceTildes(comp,loose);comp=replaceXRanges(comp,loose);comp=replaceStars(comp,loose);return comp}function isX(id){return!id||id.toLowerCase()==="x"||id==="*"}function replaceTildes(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceTilde(comp,loose)}).join(" ")}function replaceTilde(comp,loose){var r=loose?re[TILDELOOSE]:re[TILDE];return comp.replace(r,function(_,M,m,p,pr){var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0";else if(isX(p))ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0";else if(pr){if(pr.charAt(0)!=="-")pr="-"+pr;ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+"-0"+" <"+M+"."+(+m+1)+".0-0";return ret})}function replaceCarets(comp,loose){return comp.trim().split(/\s+/).map(function(comp){return replaceCaret(comp,loose)}).join(" ")}function replaceCaret(comp,loose){var r=loose?re[CARETLOOSE]:re[CARET];return comp.replace(r,function(_,M,m,p,pr){var ret;if(isX(M))ret="";else if(isX(m))ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0";else if(isX(p)){if(M==="0")ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0";else ret=">="+M+"."+m+".0-0 <"+(+M+1)+".0.0-0"}else if(pr){if(pr.charAt(0)!=="-")pr="-"+pr;if(M==="0"){if(m==="0")ret="="+M+"."+m+"."+p+pr;else ret=">="+M+"."+m+"."+p+pr+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+pr+" <"+(+M+1)+".0.0-0"}else{if(M==="0"){if(m==="0")ret="="+M+"."+m+"."+p;else ret=">="+M+"."+m+"."+p+"-0"+" <"+M+"."+(+m+1)+".0-0"}else ret=">="+M+"."+m+"."+p+"-0"+" <"+(+M+1)+".0.0-0"}return ret})}function replaceXRanges(comp,loose){return comp.split(/\s+/).map(function(comp){return replaceXRange(comp,loose)}).join(" ")}function replaceXRange(comp,loose){comp=comp.trim();var r=loose?re[XRANGELOOSE]:re[XRANGE];return comp.replace(r,function(ret,gtlt,M,m,p,pr){var xM=isX(M);var xm=xM||isX(m);var xp=xm||isX(p);var anyX=xp;if(gtlt==="="&&anyX)gtlt="";if(gtlt&&anyX){if(xM)M=0;if(xm)m=0;if(xp)p=0;if(gtlt===">"){gtlt=">=";if(xM){}else if(xm){M=+M+1;m=0;p=0}else if(xp){m=+m+1;p=0}}ret=gtlt+M+"."+m+"."+p+"-0"}else if(xM){ret="*"}else if(xm){ret=">="+M+".0.0-0 <"+(+M+1)+".0.0-0"}else if(xp){ret=">="+M+"."+m+".0-0 <"+M+"."+(+m+1)+".0-0"}return ret})}function replaceStars(comp,loose){return comp.trim().replace(re[STAR],"")}function hyphenReplace($0,from,fM,fm,fp,fpr,fb,to,tM,tm,tp,tpr,tb){if(isX(fM))from="";else if(isX(fm))from=">="+fM+".0.0-0";else if(isX(fp))from=">="+fM+"."+fm+".0-0";else from=">="+from;if(isX(tM))to="";else if(isX(tm))to="<"+(+tM+1)+".0.0-0";else if(isX(tp))to="<"+tM+"."+(+tm+1)+".0-0";else if(tpr)to="<="+tM+"."+tm+"."+tp+"-"+tpr;else to="<="+to;return(from+" "+to).trim()}Range.prototype.test=function(version){if(!version)return false;for(var i=0;i<this.set.length;i++){if(testSet(this.set[i],version))return true}return false};function testSet(set,version){for(var i=0;i<set.length;i++){if(!set[i].test(version))return false}return true}exports.satisfies=satisfies;function satisfies(version,range,loose){try{range=new Range(range,loose)}catch(er){return false}return range.test(version)}exports.maxSatisfying=maxSatisfying;function maxSatisfying(versions,range,loose){return versions.filter(function(version){return satisfies(version,range,loose)}).sort(function(a,b){return rcompare(a,b,loose) | |
})[0]||null}exports.validRange=validRange;function validRange(range,loose){try{return new Range(range,loose).range||"*"}catch(er){return null}}exports.ltr=ltr;function ltr(version,range,loose){return outside(version,range,"<",loose)}exports.gtr=gtr;function gtr(version,range,loose){return outside(version,range,">",loose)}exports.outside=outside;function outside(version,range,hilo,loose){version=new SemVer(version,loose);range=new Range(range,loose);var gtfn,ltefn,ltfn,comp,ecomp;switch(hilo){case">":gtfn=gt;ltefn=lte;ltfn=lt;comp=">";ecomp=">=";break;case"<":gtfn=lt;ltefn=gte;ltfn=gt;comp="<";ecomp="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(satisfies(version,range,loose)){return false}for(var i=0;i<range.set.length;++i){var comparators=range.set[i];var high=null;var low=null;comparators.forEach(function(comparator){high=high||comparator;low=low||comparator;if(gtfn(comparator.semver,high.semver,loose)){high=comparator}else if(ltfn(comparator.semver,low.semver,loose)){low=comparator}});if(high.operator===comp||high.operator===ecomp){return false}if((!low.operator||low.operator===comp)&<efn(version,low.semver)){return false}else if(low.operator===ecomp&<fn(version,low.semver)){return false}}return true}if(typeof define==="function"&&define.amd)define(exports)})(typeof exports==="object"?exports:typeof define==="function"&&define.amd?{}:semver={})},{}],72:[function(require,module,exports){(function(){"use strict";function stripJsonComments(str){var currentChar;var nextChar;var insideString=false;var insideComment=false;var ret="";for(var i=0;i<str.length;i++){currentChar=str[i];nextChar=str[i+1];if(!insideComment&&str[i-1]!=="\\"&¤tChar==='"'){insideString=!insideString}if(insideString){ret+=currentChar;continue}if(!insideComment&¤tChar+nextChar==="//"){insideComment="single";i++}else if(insideComment==="single"&¤tChar+nextChar==="\r\n"){insideComment=false;i++}else if(insideComment==="single"&¤tChar==="\n"){insideComment=false}else if(!insideComment&¤tChar+nextChar==="/*"){insideComment="multi";i++;continue}else if(insideComment==="multi"&¤tChar+nextChar==="*/"){insideComment=false;i++;continue}if(insideComment){continue}ret+=currentChar}return ret}if(typeof module!=="undefined"&&module.exports){module.exports=stripJsonComments}else{window.stripJsonComments=stripJsonComments}})()},{}],esformatter:[function(require,module,exports){"use strict";var _br=require("./lineBreak");var _options=require("./options");var _tk=require("rocambole-token");var _ws=require("./whiteSpace");var addBrAroundNode=require("./lineBreakAroundNode");var expressionParentheses=require("./hooks/expressionParentheses");var hooks=require("./hooks");var indent=require("./indent");var plugins=require("./plugins");var rocambole=require("rocambole");var _shouldRemoveTrailingWs;exports.hooks=hooks;exports.format=format;exports.transform=transform;exports.rc=_options.getRc;exports.register=plugins.register;exports.unregister=plugins.unregister;exports.unregisterAll=plugins.unregisterAll;function format(str,opts){plugins.loadAndRegister(opts&&opts.plugins);str=plugins.stringBefore(str);var ast=rocambole.parse(str);transform(ast,opts);str=ast.toString();return plugins.stringAfter(str)}function transform(ast,opts){_options.set(opts);_shouldRemoveTrailingWs=Boolean(_options.get("whiteSpace.removeTrailing"));plugins.transformBefore(ast);_tk.eachInBetween(ast.startToken,ast.endToken,preprocessToken);rocambole.moonwalk(ast,transformNode);_tk.eachInBetween(ast.startToken,ast.endToken,postprocessToken);_br.limitBeforeEndOfFile(ast);indent.transform(ast);plugins.transform(ast);plugins.transformAfter(ast);return ast}function transformNode(node){plugins.nodeBefore(node);addBrAroundNode(node);var hook=hooks[node.type];if(hook&&"format"in hook){hook.format(node)}if(node.startToken){_ws.limitBefore(node.startToken,node.type);_ws.limitAfter(node.endToken,node.type)}expressionParentheses.addSpaceInside(node);plugins.nodeAfter(node)}function preprocessToken(token){if(_tk.isComment(token)){_br.limit(token,token.type)}plugins.tokenBefore(token)}function postprocessToken(token){if(_tk.isComment(token)){processComment(token)}else if(_shouldRemoveTrailingWs&&_tk.isWs(token)){removeTrailingWs(token)}plugins.tokenAfter(token)}function processComment(token){_ws.limitBefore(token,token.type);if(token.type==="BlockComment"){_ws.limitAfter(token,token.type)}}function removeTrailingWs(token){if(_tk.isBr(token.next)||!token.next){_tk.remove(token)}}},{"./hooks":4,"./hooks/expressionParentheses":31,"./indent":32,"./lineBreak":34,"./lineBreakAroundNode":35,"./options":36,"./plugins":37,"./whiteSpace":40,rocambole:70,"rocambole-token":64}]},{},[]);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(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,XHTMLEntities,ClassPropertyType,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,Template:10,XJSIdentifier:11,XJSText:12};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.XJSIdentifier]="XJSIdentifier";TokenName[Token.XJSText]="XJSText";TokenName[Token.RegularExpression]="RegularExpression";FnExprTokens=["(","{","[","in","typeof","instanceof","new","return","case","delete","throw","void","=","+=","-=","*=","/=","%=","<<=",">>=",">>>=","&=","|=","^=",",","+","-","*","/","%","++","--","<<",">>",">>>","&","|","^","!","~","&&","||","?",":","===","==",">=","<=","<",">","!=","!=="];Syntax={AnyTypeAnnotation:"AnyTypeAnnotation",ArrayExpression:"ArrayExpression",ArrayPattern:"ArrayPattern",ArrayTypeAnnotation:"ArrayTypeAnnotation",ArrowFunctionExpression:"ArrowFunctionExpression",AssignmentExpression:"AssignmentExpression",BinaryExpression:"BinaryExpression",BlockStatement:"BlockStatement",BooleanTypeAnnotation:"BooleanTypeAnnotation",BreakStatement:"BreakStatement",CallExpression:"CallExpression",CatchClause:"CatchClause",ClassBody:"ClassBody",ClassDeclaration:"ClassDeclaration",ClassExpression:"ClassExpression",ClassImplements:"ClassImplements",ClassProperty:"ClassProperty",ComprehensionBlock:"ComprehensionBlock",ComprehensionExpression:"ComprehensionExpression",ConditionalExpression:"ConditionalExpression",ContinueStatement:"ContinueStatement",DebuggerStatement:"DebuggerStatement",DeclareClass:"DeclareClass",DeclareFunction:"DeclareFunction",DeclareModule:"DeclareModule",DeclareVariable:"DeclareVariable",DoWhileStatement:"DoWhileStatement",EmptyStatement:"EmptyStatement",ExportDeclaration:"ExportDeclaration",ExportBatchSpecifier:"ExportBatchSpecifier",ExportSpecifier:"ExportSpecifier",ExpressionStatement:"ExpressionStatement",ForInStatement:"ForInStatement",ForOfStatement:"ForOfStatement",ForStatement:"ForStatement",FunctionDeclaration:"FunctionDeclaration",FunctionExpression:"FunctionExpression",FunctionTypeAnnotation:"FunctionTypeAnnotation",FunctionTypeParam:"FunctionTypeParam",GenericTypeAnnotation:"GenericTypeAnnotation",Identifier:"Identifier",IfStatement:"IfStatement",ImportDeclaration:"ImportDeclaration",ImportDefaultSpecifier:"ImportDefaultSpecifier",ImportNamespaceSpecifier:"ImportNamespaceSpecifier",ImportSpecifier:"ImportSpecifier",InterfaceDeclaration:"InterfaceDeclaration",InterfaceExtends:"InterfaceExtends",IntersectionTypeAnnotation:"IntersectionTypeAnnotation",LabeledStatement:"LabeledStatement",Literal:"Literal",LogicalExpression:"LogicalExpression",MemberExpression:"MemberExpression",MethodDefinition:"MethodDefinition",ModuleSpecifier:"ModuleSpecifier",NewExpression:"NewExpression",NullableTypeAnnotation:"NullableTypeAnnotation",NumberTypeAnnotation:"NumberTypeAnnotation",ObjectExpression:"ObjectExpression",ObjectPattern:"ObjectPattern",ObjectTypeAnnotation:"ObjectTypeAnnotation",ObjectTypeCallProperty:"ObjectTypeCallProperty",ObjectTypeIndexer:"ObjectTypeIndexer",ObjectTypeProperty:"ObjectTypeProperty",Program:"Program",Property:"Property",QualifiedTypeIdentifier:"QualifiedTypeIdentifier",ReturnStatement:"ReturnStatement",SequenceExpression:"SequenceExpression",SpreadElement:"SpreadElement",SpreadProperty:"SpreadProperty",StringLiteralTypeAnnotation:"StringLiteralTypeAnnotation",StringTypeAnnotation:"StringTypeAnnotation",SwitchCase:"SwitchCase",SwitchStatement:"SwitchStatement",TaggedTemplateExpression:"TaggedTemplateExpression",TemplateElement:"TemplateElement",TemplateLiteral:"TemplateLiteral",ThisExpression:"ThisExpression",ThrowStatement:"ThrowStatement",TupleTypeAnnotation:"TupleTypeAnnotation",TryStatement:"TryStatement",TypeAlias:"TypeAlias",TypeAnnotation:"TypeAnnotation",TypeCastExpression:"TypeCastExpression",TypeofTypeAnnotation:"TypeofTypeAnnotation",TypeParameterDeclaration:"TypeParameterDeclaration",TypeParameterInstantiation:"TypeParameterInstantiation",UnaryExpression:"UnaryExpression",UnionTypeAnnotation:"UnionTypeAnnotation",UpdateExpression:"UpdateExpression",VariableDeclaration:"VariableDeclaration",VariableDeclarator:"VariableDeclarator",VoidTypeAnnotation:"VoidTypeAnnotation",WhileStatement:"WhileStatement",WithStatement:"WithStatement",XJSIdentifier:"XJSIdentifier",XJSNamespacedName:"XJSNamespacedName",XJSMemberExpression:"XJSMemberExpression",XJSEmptyExpression:"XJSEmptyExpression",XJSExpressionContainer:"XJSExpressionContainer",XJSElement:"XJSElement",XJSClosingElement:"XJSClosingElement",XJSOpeningElement:"XJSOpeningElement",XJSAttribute:"XJSAttribute",XJSSpreadAttribute:"XJSSpreadAttribute",XJSText:"XJSText",YieldExpression:"YieldExpression",AwaitExpression:"AwaitExpression"};PropertyKind={Data:1,Get:2,Set:4};ClassPropertyType={"static":"static",prototype:"prototype"};Messages={UnexpectedToken:"Unexpected token %0",UnexpectedNumber:"Unexpected number",UnexpectedString:"Unexpected string",UnexpectedIdentifier:"Unexpected identifier",UnexpectedReserved:"Unexpected reserved word",UnexpectedTemplate:"Unexpected quasi %0",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",InvalidLHSInFormalsList:"Invalid left-hand side in formals list",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",IllegalDuplicateClassProperty:"Illegal duplicate property in class definition",IllegalReturn:"Illegal return statement",IllegalSpread:"Illegal spread element",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",ParameterAfterRestParameter:"Rest parameter must be final parameter of an argument list",DefaultRestParameter:"Rest parameter can not have a default value",ElementAfterSpreadElement:"Spread must be the final element of an element list",PropertyAfterSpreadProperty:"A rest property must be the final property of an object literal",ObjectPatternAsRestParameter:"Invalid rest parameter",ObjectPatternAsSpread:"Invalid spread argument",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",MissingFromClause:"Missing from clause",NoAsAfterImportNamespace:"Missing as after import *",InvalidModuleSpecifier:"Invalid module specifier",IllegalImportDeclaration:"Illegal import declaration",IllegalExportDeclaration:"Illegal export declaration",NoUnintializedConst:"Const must be initialized",ComprehensionRequiresBlock:"Comprehension must have at least one block",ComprehensionError:"Comprehension Error",EachNotAllowed:"Each is not supported",InvalidXJSAttributeValue:"XJS value should be either an expression or a quoted XJS text",ExpectedXJSClosingTag:"Expected corresponding XJS closing tag for %0",AdjacentXJSElements:"Adjacent XJS elements must be wrapped in an enclosing tag",ConfusedAboutFunctionType:"Unexpected token =>. It looks like "+"you are trying to write a function type, but you ended up "+"writing a grouped type followed by an =>, which is a syntax "+"error. Remember, function type parameters are named so function "+"types look like (name1: type1, name2: type2) => returnType. You "+"probably wrote (type1) => returnType"};Regex={NonAsciiIdentifierStart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),NonAsciiIdentifierPart:new RegExp("[ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮ̀-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁ҃-҇Ҋ-ԧԱ-Ֆՙա-և֑-ׇֽֿׁׂׅׄא-תװ-ײؐ-ؚؠ-٩ٮ-ۓە-ۜ۟-۪ۨ-ۼۿܐ-݊ݍ-ޱ߀-ߵߺࠀ-࠭ࡀ-࡛ࢠࢢ-ࢬࣤ-ࣾऀ-ॣ०-९ॱ-ॷॹ-ॿঁ-ঃঅ-ঌএঐও-নপ-রলশ-হ়-ৄেৈো-ৎৗড়ঢ়য়-ৣ০-ৱਁ-ਃਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹ਼ਾ-ੂੇੈੋ-੍ੑਖ਼-ੜਫ਼੦-ੵઁ-ઃઅ-ઍએ-ઑઓ-નપ-રલળવ-હ઼-ૅે-ૉો-્ૐૠ-ૣ૦-૯ଁ-ଃଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହ଼-ୄେୈୋ-୍ୖୗଡ଼ଢ଼ୟ-ୣ୦-୯ୱஂஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-்ௐௗ௦-௯ఁ-ఃఅ-ఌఎ-ఐఒ-నప-ళవ-హఽ-ౄె-ైొ-్ౕౖౘౙౠ-ౣ౦-౯ಂಃಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹ಼-ೄೆ-ೈೊ-್ೕೖೞೠ-ೣ೦-೯ೱೲംഃഅ-ഌഎ-ഐഒ-ഺഽ-ൄെ-ൈൊ-ൎൗൠ-ൣ൦-൯ൺ-ൿංඃඅ-ඖක-නඳ-රලව-ෆ්ා-ුූෘ-ෟෲෳก-ฺเ-๎๐-๙ກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆ່-ໍ໐-໙ໜ-ໟༀ༘༙༠-༩༹༵༷༾-ཇཉ-ཬཱ-྄྆-ྗྙ-ྼ࿆က-၉ၐ-ႝႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚ፝-፟ᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-᜔ᜠ-᜴ᝀ-ᝓᝠ-ᝬᝮ-ᝰᝲᝳក-៓ៗៜ៝០-៩᠋-᠍᠐-᠙ᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤜᤠ-ᤫᤰ-᤻᥆-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉ᧐-᧙ᨀ-ᨛᨠ-ᩞ᩠-᩿᩼-᪉᪐-᪙ᪧᬀ-ᭋ᭐-᭙᭫-᭳ᮀ-᯳ᰀ-᰷᱀-᱉ᱍ-ᱽ᳐-᳔᳒-ᳶᴀ-ᷦ᷼-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼ‿⁀⁔ⁱⁿₐ-ₜ⃐-⃥⃜⃡-⃰ℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯ⵿-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⷠ-ⷿⸯ々-〇〡-〯〱-〵〸-〼ぁ-ゖ゙゚ゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘫꙀ-꙯ꙴ-꙽ꙿ-ꚗꚟ-꛱ꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠧꡀ-ꡳꢀ-꣄꣐-꣙꣠-ꣷꣻ꤀-꤭ꤰ-꥓ꥠ-ꥼꦀ-꧀ꧏ-꧙ꨀ-ꨶꩀ-ꩍ꩐-꩙ꩠ-ꩶꩺꩻꪀ-ꫂꫛ-ꫝꫠ-ꫯꫲ-꫶ꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯪ꯬꯭꯰-꯹가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻ︀-️︠-︦︳︴﹍-﹏ﹰ-ﹴﹶ-ﻼ0-9A-Z_a-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ]"),LeadingZeros:new RegExp("^0+(?!$)")};function assert(condition,message){if(!condition){throw new Error("ASSERT: "+message)}}function StringMap(){this.$data={}}StringMap.prototype.get=function(key){key="$"+key;return this.$data[key]};StringMap.prototype.set=function(key,value){key="$"+key;this.$data[key]=value;return this};StringMap.prototype.has=function(key){key="$"+key;return Object.prototype.hasOwnProperty.call(this.$data,key)};StringMap.prototype["delete"]=function(key){key="$"+key;return delete this.$data[key]};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&&" ".indexOf(String.fromCharCode(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==="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 skipComment(){var ch,blockComment,lineComment;blockComment=false;lineComment=false;while(index<length){ch=source.charCodeAt(index);if(lineComment){++index;if(isLineTerminator(ch)){lineComment=false;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index}}else if(blockComment){if(isLineTerminator(ch)){if(ch===13){++index}if(ch!==13||source.charCodeAt(index)===10){++lineNumber;++index;lineStart=index;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}}else{ch=source.charCodeAt(index++);if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(ch===42){ch=source.charCodeAt(index);if(ch===47){++index;blockComment=false}}}}else if(ch===47){ch=source.charCodeAt(index+1);if(ch===47){index+=2;lineComment=true}else if(ch===42){index+=2;blockComment=true;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}else{break}}else if(isWhiteSpace(ch)){++index}else if(isLineTerminator(ch)){++index;if(ch===13&&source.charCodeAt(index)===10){++index}++lineNumber;lineStart=index}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 scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;if(ch==="}"){throwError({},Messages.UnexpectedToken,"ILLEGAL")}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break}code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}if(code>1114111||ch!=="}"){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(code<=65535){return String.fromCharCode(code)}cu1=(code-65536>>10)+55296;cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}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,range:[start,index]}}function scanPunctuator(){var start=index,code=source.charCodeAt(index),code2,ch1=source[index],ch2,ch3,ch4;if(state.inXJSTag||state.inXJSChild){switch(code){case 60:case 62:++index;return{type:Token.Punctuator,value:String.fromCharCode(code),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}}switch(code){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,range:[start,index]};default:code2=source.charCodeAt(index+1);if(code2===61){switch(code){case 37:case 38:case 42:case 43:case 45:case 47:case 60:case 62:case 94:case 124:index+=2;return{type:Token.Punctuator,value:String.fromCharCode(code)+String.fromCharCode(code2),lineNumber:lineNumber,lineStart:lineStart,range:[start,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,range:[start,index]};default:break}}break}ch2=source[index+1];ch3=source[index+2];ch4=source[index+3];if(ch1===">"&&ch2===">"&&ch3===">"){if(ch4==="="){index+=4;return{type:Token.Punctuator,value:">>>=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}}if(ch1===">"&&ch2===">"&&ch3===">"){index+=3;return{type:Token.Punctuator,value:">>>",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="<"&&ch2==="<"&&ch3==="="){index+=3;return{type:Token.Punctuator,value:"<<=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1===">"&&ch2===">"&&ch3==="="){index+=3;return{type:Token.Punctuator,value:">>=",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="."&&ch2==="."&&ch3==="."){index+=3;return{type:Token.Punctuator,value:"...",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1===ch2&&"+-<>&|".indexOf(ch1)>=0&&!state.inType){index+=2;return{type:Token.Punctuator,value:ch1+ch2,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="="&&ch2===">"){index+=2;return{type:Token.Punctuator,value:"=>",lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if("<>=!+-*%&|^/".indexOf(ch1)>=0){++index;return{type:Token.Punctuator,value:ch1,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch1==="."){++index;return{type:Token.Punctuator,value:ch1,lineNumber:lineNumber,lineStart:lineStart,range:[start,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,range:[start,index]}}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number="0"+source[index++]}else{octal=false;++index;number=""}while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(!octal&&number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanNumericLiteral(){var number,start,ch,octal;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(ch==="b"||ch==="B"){++index;number="";while(index<length){ch=source[index];if(ch!=="0"&&ch!=="1"){break}number+=source[index++]}if(number.length===0){throwError({},Messages.UnexpectedToken,"ILLEGAL")}if(index<length){ch=source.charCodeAt(index);if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}if(ch==="o"||ch==="O"||isOctalDigit(ch)){return scanOctalLiteral(ch,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,range:[start,index]}}function scanStringLiteral(){var str="",quote,start,ch,code,unescaped,restore,octal=false;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"n":str+="\n";break;case"r":str+="\r";break;case"t":str+=" ";break;case"u":case"x":if(source[index]==="{"){++index;str+=scanUnicodeCodePointEscape()}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){str+=unescaped}else{index=restore;str+=ch}}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,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanTemplate(){var cooked="",ch,start,terminated,tail,restore,unescaped,code,octal;terminated=false;tail=false;start=index;++index;while(index<length){ch=source[index++];if(ch==="`"){tail=true;terminated=true;break}else if(ch==="$"){if(source[index]==="{"){++index;terminated=true;break}cooked+=ch}else if(ch==="\\"){ch=source[index++];if(!isLineTerminator(ch.charCodeAt(0))){switch(ch){case"n":cooked+="\n";break;case"r":cooked+="\r";break;case"t":cooked+=" ";break;case"u":case"x":if(source[index]==="{"){++index;cooked+=scanUnicodeCodePointEscape()}else{restore=index;unescaped=scanHexEscape(ch);if(unescaped){cooked+=unescaped}else{index=restore;cooked+=ch}}break;case"b":cooked+="\b";break;case"f":cooked+="\f";break;case"v":cooked+="";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++])}}cooked+=String.fromCharCode(code)}else{cooked+=ch}break}}else{++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index}}else if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;if(ch==="\r"&&source[index]==="\n"){++index}lineStart=index;cooked+="\n"}else{cooked+=ch}}if(!terminated){throwError({},Messages.UnexpectedToken,"ILLEGAL")}return{type:Token.Template,value:{cooked:cooked,raw:source.slice(start+1,index-(tail?1:2))},tail:tail,octal:octal,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanTemplateElement(option){var startsWith,template;lookahead=null;skipComment();startsWith=option.head?"`":"}";if(source[index]!==startsWith){throwError({},Messages.UnexpectedToken,"ILLEGAL")}template=scanTemplate();peek();return template}function scanRegExp(){var str,ch,start,pattern,flags,value,classMarker=false,restore,terminated=false,tmp;lookahead=null;skipComment();start=index;ch=source[index];assert(ch==="/","Regular expression literal must start with a slash");str=source[index++];while(index<length){ch=source[index++];str+=ch;if(classMarker){if(ch==="]"){classMarker=false}}else{if(ch==="\\"){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}str+=ch}else if(ch==="/"){terminated=true;break}else if(ch==="["){classMarker=true}else if(isLineTerminator(ch.charCodeAt(0))){throwError({},Messages.UnterminatedRegExp)}}}if(!terminated){throwError({},Messages.UnterminatedRegExp)}pattern=str.substr(1,str.length-2);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+="\\"}}else{flags+=ch;str+=ch}}tmp=pattern;if(flags.indexOf("u")>=0){tmp=tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g,function($0,$1){if(parseInt($1,16)<=1114111){return"x" | |
}throwError({},Messages.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{value=new RegExp(tmp)}catch(e){throwError({},Messages.InvalidRegExp)}try{value=new RegExp(pattern,flags)}catch(exception){value=null}if(extra.tokenize){return{type:Token.RegularExpression,value:value,regex:{pattern:pattern,flags:flags},lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}return{literal:str,value:value,regex:{pattern:pattern,flags:flags},range:[start,index]}}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 scanRegExp()}if(prevToken.type==="Punctuator"){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 scanRegExp()}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 scanRegExp()}}else{return scanPunctuator()}if(FnExprTokens.indexOf(checkToken.value)>=0){return scanPunctuator()}return scanRegExp()}return scanRegExp()}if(prevToken.type==="Keyword"){return scanRegExp()}return scanPunctuator()}function advance(){var ch;if(!state.inXJSChild){skipComment()}if(index>=length){return{type:Token.EOF,lineNumber:lineNumber,lineStart:lineStart,range:[index,index]}}if(state.inXJSChild){return advanceXJSChild()}ch=source.charCodeAt(index);if(ch===40||ch===41||ch===58){return scanPunctuator()}if(ch===39||ch===34){if(state.inXJSTag){return scanXJSStringLiteral()}return scanStringLiteral()}if(state.inXJSTag&&isXJSIdentifierStart(ch)){return scanXJSIdentifier()}if(ch===96){return scanTemplate()}if(isIdentifierStart(ch)){return scanIdentifier()}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 lex(){var token;token=lookahead;index=token.range[1];lineNumber=token.lineNumber;lineStart=token.lineStart;lookahead=advance();index=token.range[1];lineNumber=token.lineNumber;lineStart=token.lineStart;return token}function peek(){var pos,line,start;pos=index;line=lineNumber;start=lineStart;lookahead=advance();index=pos;lineNumber=line;lineStart=start}function lookahead2(){var adv,pos,line,start,result;adv=typeof extra.advance==="function"?extra.advance:advance;pos=index;line=lineNumber;start=lineStart;if(lookahead===null){lookahead=adv()}index=lookahead.range[1];lineNumber=lookahead.lineNumber;lineStart=lookahead.lineStart;result=adv();index=pos;lineNumber=line;lineStart=start;return result}function rewind(token){index=token.range[0];lineNumber=token.lineNumber;lineStart=token.lineStart;lookahead=token}function markerCreate(){if(!extra.loc&&!extra.range){return undefined}skipComment();return{offset:index,line:lineNumber,col:index-lineStart}}function markerCreatePreserveWhitespace(){if(!extra.loc&&!extra.range){return undefined}return{offset:index,line:lineNumber,col:index-lineStart}}function processComment(node){var lastChild,trailingComments,bottomRight=extra.bottomRightStack,last=bottomRight[bottomRight.length-1];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(last&&last.trailingComments&&last.trailingComments[0].range[0]>=node.range[1]){trailingComments=last.trailingComments;delete last.trailingComments}}if(last){while(last&&last.range[0]>=node.range[0]){lastChild=last;last=bottomRight.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}bottomRight.push(node)}function markerApply(marker,node){if(extra.range){node.range=[marker.offset,index]}if(extra.loc){node.loc={start:{line:marker.line,column:marker.col},end:{line:lineNumber,column:index-lineStart}};node=delegate.postProcess(node)}if(extra.attachComment){processComment(node)}return node}SyntaxTreeDelegate={name:"SyntaxTree",postProcess:function(node){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}},createForOfStatement:function(left,right,body){return{type:Syntax.ForOfStatement,left:left,right:right,body:body}},createFunctionDeclaration:function(id,params,defaults,body,rest,generator,expression,isAsync,returnType,typeParameters){var funDecl={type:Syntax.FunctionDeclaration,id:id,params:params,defaults:defaults,body:body,rest:rest,generator:generator,expression:expression,returnType:returnType,typeParameters:typeParameters};if(isAsync){funDecl.async=true}return funDecl},createFunctionExpression:function(id,params,defaults,body,rest,generator,expression,isAsync,returnType,typeParameters){var funExpr={type:Syntax.FunctionExpression,id:id,params:params,defaults:defaults,body:body,rest:rest,generator:generator,expression:expression,returnType:returnType,typeParameters:typeParameters};if(isAsync){funExpr.async=true}return funExpr},createIdentifier:function(name){return{type:Syntax.Identifier,name:name,typeAnnotation:undefined,optional:undefined}},createTypeAnnotation:function(typeAnnotation){return{type:Syntax.TypeAnnotation,typeAnnotation:typeAnnotation}},createTypeCast:function(expression,typeAnnotation){return{type:Syntax.TypeCastExpression,expression:expression,typeAnnotation:typeAnnotation}},createFunctionTypeAnnotation:function(params,returnType,rest,typeParameters){return{type:Syntax.FunctionTypeAnnotation,params:params,returnType:returnType,rest:rest,typeParameters:typeParameters}},createFunctionTypeParam:function(name,typeAnnotation,optional){return{type:Syntax.FunctionTypeParam,name:name,typeAnnotation:typeAnnotation,optional:optional}},createNullableTypeAnnotation:function(typeAnnotation){return{type:Syntax.NullableTypeAnnotation,typeAnnotation:typeAnnotation}},createArrayTypeAnnotation:function(elementType){return{type:Syntax.ArrayTypeAnnotation,elementType:elementType}},createGenericTypeAnnotation:function(id,typeParameters){return{type:Syntax.GenericTypeAnnotation,id:id,typeParameters:typeParameters}},createQualifiedTypeIdentifier:function(qualification,id){return{type:Syntax.QualifiedTypeIdentifier,qualification:qualification,id:id}},createTypeParameterDeclaration:function(params){return{type:Syntax.TypeParameterDeclaration,params:params}},createTypeParameterInstantiation:function(params){return{type:Syntax.TypeParameterInstantiation,params:params}},createAnyTypeAnnotation:function(){return{type:Syntax.AnyTypeAnnotation}},createBooleanTypeAnnotation:function(){return{type:Syntax.BooleanTypeAnnotation}},createNumberTypeAnnotation:function(){return{type:Syntax.NumberTypeAnnotation}},createStringTypeAnnotation:function(){return{type:Syntax.StringTypeAnnotation}},createStringLiteralTypeAnnotation:function(token){return{type:Syntax.StringLiteralTypeAnnotation,value:token.value,raw:source.slice(token.range[0],token.range[1])}},createVoidTypeAnnotation:function(){return{type:Syntax.VoidTypeAnnotation}},createTypeofTypeAnnotation:function(argument){return{type:Syntax.TypeofTypeAnnotation,argument:argument}},createTupleTypeAnnotation:function(types){return{type:Syntax.TupleTypeAnnotation,types:types}},createObjectTypeAnnotation:function(properties,indexers,callProperties){return{type:Syntax.ObjectTypeAnnotation,properties:properties,indexers:indexers,callProperties:callProperties}},createObjectTypeIndexer:function(id,key,value,isStatic){return{type:Syntax.ObjectTypeIndexer,id:id,key:key,value:value,"static":isStatic}},createObjectTypeCallProperty:function(value,isStatic){return{type:Syntax.ObjectTypeCallProperty,value:value,"static":isStatic}},createObjectTypeProperty:function(key,value,optional,isStatic){return{type:Syntax.ObjectTypeProperty,key:key,value:value,optional:optional,"static":isStatic}},createUnionTypeAnnotation:function(types){return{type:Syntax.UnionTypeAnnotation,types:types}},createIntersectionTypeAnnotation:function(types){return{type:Syntax.IntersectionTypeAnnotation,types:types}},createTypeAlias:function(id,typeParameters,right){return{type:Syntax.TypeAlias,id:id,typeParameters:typeParameters,right:right}},createInterface:function(id,typeParameters,body,extended){return{type:Syntax.InterfaceDeclaration,id:id,typeParameters:typeParameters,body:body,"extends":extended}},createInterfaceExtends:function(id,typeParameters){return{type:Syntax.InterfaceExtends,id:id,typeParameters:typeParameters}},createDeclareFunction:function(id){return{type:Syntax.DeclareFunction,id:id}},createDeclareVariable:function(id){return{type:Syntax.DeclareVariable,id:id}},createDeclareModule:function(id,body){return{type:Syntax.DeclareModule,id:id,body:body}},createXJSAttribute:function(name,value){return{type:Syntax.XJSAttribute,name:name,value:value||null}},createXJSSpreadAttribute:function(argument){return{type:Syntax.XJSSpreadAttribute,argument:argument}},createXJSIdentifier:function(name){return{type:Syntax.XJSIdentifier,name:name}},createXJSNamespacedName:function(namespace,name){return{type:Syntax.XJSNamespacedName,namespace:namespace,name:name}},createXJSMemberExpression:function(object,property){return{type:Syntax.XJSMemberExpression,object:object,property:property}},createXJSElement:function(openingElement,closingElement,children){return{type:Syntax.XJSElement,openingElement:openingElement,closingElement:closingElement,children:children}},createXJSEmptyExpression:function(){return{type:Syntax.XJSEmptyExpression}},createXJSExpressionContainer:function(expression){return{type:Syntax.XJSExpressionContainer,expression:expression}},createXJSOpeningElement:function(name,attributes,selfClosing){return{type:Syntax.XJSOpeningElement,name:name,selfClosing:selfClosing,attributes:attributes}},createXJSClosingElement:function(name){return{type:Syntax.XJSClosingElement,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){var object={type:Syntax.Literal,value:token.value,raw:source.slice(token.range[0],token.range[1])};if(token.regex){object.regex=token.regex}return object},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,method,shorthand,computed){return{type:Syntax.Property,key:key,value:value,kind:kind,method:method,shorthand:shorthand,computed:computed}},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}},createTemplateElement:function(value,tail){return{type:Syntax.TemplateElement,value:value,tail:tail}},createTemplateLiteral:function(quasis,expressions){return{type:Syntax.TemplateLiteral,quasis:quasis,expressions:expressions}},createSpreadElement:function(argument){return{type:Syntax.SpreadElement,argument:argument}},createSpreadProperty:function(argument){return{type:Syntax.SpreadProperty,argument:argument}},createTaggedTemplateExpression:function(tag,quasi){return{type:Syntax.TaggedTemplateExpression,tag:tag,quasi:quasi}},createArrowFunctionExpression:function(params,defaults,body,rest,expression,isAsync){var arrowExpr={type:Syntax.ArrowFunctionExpression,id:null,params:params,defaults:defaults,body:body,rest:rest,generator:false,expression:expression};if(isAsync){arrowExpr.async=true}return arrowExpr},createMethodDefinition:function(propertyType,kind,key,value,computed){return{type:Syntax.MethodDefinition,key:key,value:value,kind:kind,"static":propertyType===ClassPropertyType.static,computed:computed}},createClassProperty:function(key,typeAnnotation,computed,isStatic){return{type:Syntax.ClassProperty,key:key,typeAnnotation:typeAnnotation,computed:computed,"static":isStatic}},createClassBody:function(body){return{type:Syntax.ClassBody,body:body}},createClassImplements:function(id,typeParameters){return{type:Syntax.ClassImplements,id:id,typeParameters:typeParameters}},createClassExpression:function(id,superClass,body,typeParameters,superTypeParameters,implemented){return{type:Syntax.ClassExpression,id:id,superClass:superClass,body:body,typeParameters:typeParameters,superTypeParameters:superTypeParameters,"implements":implemented}},createClassDeclaration:function(id,superClass,body,typeParameters,superTypeParameters,implemented){return{type:Syntax.ClassDeclaration,id:id,superClass:superClass,body:body,typeParameters:typeParameters,superTypeParameters:superTypeParameters,"implements":implemented}},createModuleSpecifier:function(token){return{type:Syntax.ModuleSpecifier,value:token.value,raw:source.slice(token.range[0],token.range[1])}},createExportSpecifier:function(id,name){return{type:Syntax.ExportSpecifier,id:id,name:name}},createExportBatchSpecifier:function(){return{type:Syntax.ExportBatchSpecifier}},createImportDefaultSpecifier:function(id){return{type:Syntax.ImportDefaultSpecifier,id:id}},createImportNamespaceSpecifier:function(id){return{type:Syntax.ImportNamespaceSpecifier,id:id}},createExportDeclaration:function(isDefault,declaration,specifiers,source){return{type:Syntax.ExportDeclaration,"default":!!isDefault,declaration:declaration,specifiers:specifiers,source:source}},createImportSpecifier:function(id,name){return{type:Syntax.ImportSpecifier,id:id,name:name}},createImportDeclaration:function(specifiers,source,isType){return{type:Syntax.ImportDeclaration,specifiers:specifiers,source:source,isType:isType}},createYieldExpression:function(argument,delegate){return{type:Syntax.YieldExpression,argument:argument,delegate:delegate}},createAwaitExpression:function(argument){return{type:Syntax.AwaitExpression,argument:argument}},createComprehensionExpression:function(filter,blocks,body){return{type:Syntax.ComprehensionExpression,filter:filter,blocks:blocks,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.range[0];error.lineNumber=token.lineNumber;error.column=token.range[0]-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||token.type===Token.XJSText){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)}if(token.type===Token.Template){throwError(token,Messages.UnexpectedTemplate,token.value.raw)}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,contextual){var token=lex();if(token.type!==(contextual?Token.Identifier:Token.Keyword)||token.value!==keyword){throwUnexpected(token)}}function expectContextualKeyword(keyword){return expectKeyword(keyword,true)}function match(value){return lookahead.type===Token.Punctuator&&lookahead.value===value}function matchKeyword(keyword,contextual){var expectedType=contextual?Token.Identifier:Token.Keyword;return lookahead.type===expectedType&&lookahead.value===keyword}function matchContextualKeyword(keyword){return matchKeyword(keyword,true)}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 matchYield(){return state.yieldAllowed&&matchKeyword("yield",!strict)}function matchAsync(){var backtrackToken=lookahead,matches=false;if(matchContextualKeyword("async")){lex();matches=!peekLineTerminator();rewind(backtrackToken)}return matches}function matchAwait(){return state.awaitAllowed&&matchContextualKeyword("await")}function consumeSemicolon(){var line,oldIndex=index,oldLineNumber=lineNumber,oldLineStart=lineStart,oldLookahead=lookahead;if(source.charCodeAt(index)===59){lex();return}line=lineNumber;skipComment();if(lineNumber!==line){index=oldIndex;lineNumber=oldLineNumber;lineStart=oldLineStart;lookahead=oldLookahead;return}if(match(";")){lex();return}if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpected(lookahead)}}function isLeftHandSide(expr){return expr.type===Syntax.Identifier||expr.type===Syntax.MemberExpression}function isAssignableLeftHandSide(expr){return isLeftHandSide(expr)||expr.type===Syntax.ObjectPattern||expr.type===Syntax.ArrayPattern}function parseArrayInitialiser(){var elements=[],blocks=[],filter=null,tmp,possiblecomprehension=true,body,marker=markerCreate();expect("[");while(!match("]")){if(lookahead.value==="for"&&lookahead.type===Token.Keyword){if(!possiblecomprehension){throwError({},Messages.ComprehensionError)}matchKeyword("for");tmp=parseForStatement({ignoreBody:true});tmp.of=tmp.type===Syntax.ForOfStatement;tmp.type=Syntax.ComprehensionBlock;if(tmp.left.kind){throwError({},Messages.ComprehensionError)}blocks.push(tmp)}else if(lookahead.value==="if"&&lookahead.type===Token.Keyword){if(!possiblecomprehension){throwError({},Messages.ComprehensionError)}expectKeyword("if");expect("(");filter=parseExpression();expect(")")}else if(lookahead.value===","&&lookahead.type===Token.Punctuator){possiblecomprehension=false;lex();elements.push(null)}else{tmp=parseSpreadOrAssignmentExpression();elements.push(tmp);if(tmp&&tmp.type===Syntax.SpreadElement){if(!match("]")){throwError({},Messages.ElementAfterSpreadElement)}}else if(!(match("]")||matchKeyword("for")||matchKeyword("if"))){expect(",");possiblecomprehension=false}}}expect("]");if(filter&&!blocks.length){throwError({},Messages.ComprehensionRequiresBlock)}if(blocks.length){if(elements.length!==1){throwError({},Messages.ComprehensionError)}return markerApply(marker,delegate.createComprehensionExpression(filter,blocks,elements[0]))}return markerApply(marker,delegate.createArrayExpression(elements))}function parsePropertyFunction(options){var previousStrict,previousYieldAllowed,previousAwaitAllowed,params,defaults,body,marker=markerCreate();previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=options.generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=options.async;params=options.params||[];defaults=options.defaults||[];body=parseConciseBody();if(options.name&&strict&&isRestrictedWord(params[0].name)){throwErrorTolerant(options.name,Messages.StrictParamName)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionExpression(null,params,defaults,body,options.rest||null,options.generator,body.type!==Syntax.BlockStatement,options.async,options.returnType,options.typeParameters))}function parsePropertyMethodFunction(options){var previousStrict,tmp,method;previousStrict=strict;strict=true;tmp=parseParams();if(tmp.stricted){throwErrorTolerant(tmp.stricted,tmp.message)}method=parsePropertyFunction({params:tmp.params,defaults:tmp.defaults,rest:tmp.rest,generator:options.generator,async:options.async,returnType:tmp.returnType,typeParameters:options.typeParameters});strict=previousStrict;return method}function parseObjectPropertyKey(){var marker=markerCreate(),token=lex(),propertyKey,result;if(token.type===Token.StringLiteral||token.type===Token.NumericLiteral){if(strict&&token.octal){throwErrorTolerant(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createLiteral(token))}if(token.type===Token.Punctuator&&token.value==="["){marker=markerCreate();propertyKey=parseAssignmentExpression();result=markerApply(marker,propertyKey);expect("]");return result}return markerApply(marker,delegate.createIdentifier(token.value))}function parseObjectProperty(){var token,key,id,value,param,expr,computed,marker=markerCreate(),returnType,typeParameters;token=lookahead;computed=token.value==="["&&token.type===Token.Punctuator;if(token.type===Token.Identifier||computed||matchAsync()){id=parseObjectPropertyKey();if(match(":")){lex();return markerApply(marker,delegate.createProperty("init",id,parseAssignmentExpression(),false,false,computed))}if(match("(")||match("<")){if(match("<")){typeParameters=parseTypeParameterDeclaration()}return markerApply(marker,delegate.createProperty("init",id,parsePropertyMethodFunction({generator:false,async:false,typeParameters:typeParameters}),true,false,computed))}if(token.value==="get"){computed=lookahead.value==="[";key=parseObjectPropertyKey();expect("(");expect(")");if(match(":")){returnType=parseTypeAnnotation()}return markerApply(marker,delegate.createProperty("get",key,parsePropertyFunction({generator:false,async:false,returnType:returnType}),false,false,computed))}if(token.value==="set"){computed=lookahead.value==="[";key=parseObjectPropertyKey();expect("(");token=lookahead;param=[parseTypeAnnotatableIdentifier()];expect(")");if(match(":")){returnType=parseTypeAnnotation()}return markerApply(marker,delegate.createProperty("set",key,parsePropertyFunction({params:param,generator:false,async:false,name:token,returnType:returnType}),false,false,computed))}if(token.value==="async"){computed=lookahead.value==="[";key=parseObjectPropertyKey();if(match("<")){typeParameters=parseTypeParameterDeclaration()}return markerApply(marker,delegate.createProperty("init",key,parsePropertyMethodFunction({generator:false,async:true,typeParameters:typeParameters}),true,false,computed))}if(computed){throwUnexpected(lookahead)}return markerApply(marker,delegate.createProperty("init",id,id,false,true,false))}if(token.type===Token.EOF||token.type===Token.Punctuator){if(!match("*")){throwUnexpected(token)}lex();computed=lookahead.type===Token.Punctuator&&lookahead.value==="[";id=parseObjectPropertyKey();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(!match("(")){throwUnexpected(lex())}return markerApply(marker,delegate.createProperty("init",id,parsePropertyMethodFunction({generator:true,typeParameters:typeParameters}),true,false,computed))}key=parseObjectPropertyKey();if(match(":")){lex();return markerApply(marker,delegate.createProperty("init",key,parseAssignmentExpression(),false,false,false))}if(match("(")||match("<")){if(match("<")){typeParameters=parseTypeParameterDeclaration()}return markerApply(marker,delegate.createProperty("init",key,parsePropertyMethodFunction({generator:false,typeParameters:typeParameters}),true,false,false))}throwUnexpected(lex())}function parseObjectSpreadProperty(){var marker=markerCreate();expect("...");return markerApply(marker,delegate.createSpreadProperty(parseAssignmentExpression()))}function getFieldName(key){var toString=String;if(key.type===Syntax.Identifier){return key.name}return toString(key.value)}function parseObjectInitialiser(){var properties=[],property,name,kind,storedKind,map=new StringMap,marker=markerCreate(),toString=String;expect("{");while(!match("}")){if(match("...")){property=parseObjectSpreadProperty()}else{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;if(map.has(name)){storedKind=map.get(name);if(storedKind===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(storedKind&kind){throwErrorTolerant({},Messages.AccessorGetSet)}}map.set(name,storedKind|kind)}else{map.set(name,kind)}}properties.push(property);if(!match("}")){expect(",")}}expect("}");return markerApply(marker,delegate.createObjectExpression(properties))}function parseTemplateElement(option){var marker=markerCreate(),token=scanTemplateElement(option);if(strict&&token.octal){throwError(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createTemplateElement({raw:token.value.raw,cooked:token.value.cooked},token.tail))}function parseTemplateLiteral(){var quasi,quasis,expressions,marker=markerCreate();quasi=parseTemplateElement({head:true});quasis=[quasi];expressions=[];while(!quasi.tail){expressions.push(parseExpression());quasi=parseTemplateElement({head:false});quasis.push(quasi)}return markerApply(marker,delegate.createTemplateLiteral(quasis,expressions))}function parseGroupExpression(){var expr,marker,typeAnnotation;expect("(");++state.parenthesizedCount;marker=markerCreate();expr=parseExpression();if(match(":")){typeAnnotation=parseTypeAnnotation();expr=markerApply(marker,delegate.createTypeCast(expr,typeAnnotation))}expect(")");return expr}function matchAsyncFuncExprOrDecl(){var token;if(matchAsync()){token=lookahead2();if(token.type===Token.Keyword&&token.value==="function"){return true}}return false}function parsePrimaryExpression(){var marker,type,token,expr;type=lookahead.type;if(type===Token.Identifier){marker=markerCreate();return markerApply(marker,delegate.createIdentifier(lex().value))}if(type===Token.StringLiteral||type===Token.NumericLiteral){if(strict&&lookahead.octal){throwErrorTolerant(lookahead,Messages.StrictOctalLiteral)}marker=markerCreate();return markerApply(marker,delegate.createLiteral(lex()))}if(type===Token.Keyword){if(matchKeyword("this")){marker=markerCreate();lex();return markerApply(marker,delegate.createThisExpression())}if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("class")){return parseClassExpression()}if(matchKeyword("super")){marker=markerCreate();lex();return markerApply(marker,delegate.createIdentifier("super"))}}if(type===Token.BooleanLiteral){marker=markerCreate();token=lex();token.value=token.value==="true";return markerApply(marker,delegate.createLiteral(token))}if(type===Token.NullLiteral){marker=markerCreate();token=lex();token.value=null;return markerApply(marker,delegate.createLiteral(token))}if(match("[")){return parseArrayInitialiser()}if(match("{")){return parseObjectInitialiser()}if(match("(")){return parseGroupExpression()}if(match("/")||match("/=")){marker=markerCreate();expr=delegate.createLiteral(scanRegExp());peek();return markerApply(marker,expr)}if(type===Token.Template){return parseTemplateLiteral()}if(match("<")){return parseXJSElement()}throwUnexpected(lex())}function parseArguments(){var args=[],arg;expect("(");if(!match(")")){while(index<length){arg=parseSpreadOrAssignmentExpression();args.push(arg);if(match(")")){break}else if(arg.type===Syntax.SpreadElement){throwError({},Messages.ElementAfterSpreadElement) | |
}expect(",")}}expect(")");return args}function parseSpreadOrAssignmentExpression(){if(match("...")){var marker=markerCreate();lex();return markerApply(marker,delegate.createSpreadElement(parseAssignmentExpression()))}return parseAssignmentExpression()}function parseNonComputedProperty(){var marker=markerCreate(),token=lex();if(!isIdentifierName(token)){throwUnexpected(token)}return markerApply(marker,delegate.createIdentifier(token.value))}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression();expect("]");return expr}function parseNewExpression(){var callee,args,marker=markerCreate();expectKeyword("new");callee=parseLeftHandSideExpression();args=match("(")?parseArguments():[];return markerApply(marker,delegate.createNewExpression(callee,args))}function parseLeftHandSideExpressionAllowCall(){var expr,args,marker=markerCreate();expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".")||match("[")||match("(")||lookahead.type===Token.Template){if(match("(")){args=parseArguments();expr=markerApply(marker,delegate.createCallExpression(expr,args))}else if(match("[")){expr=markerApply(marker,delegate.createMemberExpression("[",expr,parseComputedMember()))}else if(match(".")){expr=markerApply(marker,delegate.createMemberExpression(".",expr,parseNonComputedMember()))}else{expr=markerApply(marker,delegate.createTaggedTemplateExpression(expr,parseTemplateLiteral()))}}return expr}function parseLeftHandSideExpression(){var expr,marker=markerCreate();expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();while(match(".")||match("[")||lookahead.type===Token.Template){if(match("[")){expr=markerApply(marker,delegate.createMemberExpression("[",expr,parseComputedMember()))}else if(match(".")){expr=markerApply(marker,delegate.createMemberExpression(".",expr,parseNonComputedMember()))}else{expr=markerApply(marker,delegate.createTaggedTemplateExpression(expr,parseTemplateLiteral()))}}return expr}function parsePostfixExpression(){var marker=markerCreate(),expr=parseLeftHandSideExpressionAllowCall(),token;if(lookahead.type!==Token.Punctuator){return expr}if((match("++")||match("--"))&&!peekLineTerminator()){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPostfix)}if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}token=lex();expr=markerApply(marker,delegate.createPostfixExpression(token.value,expr))}return expr}function parseUnaryExpression(){var marker,token,expr;if(lookahead.type!==Token.Punctuator&&lookahead.type!==Token.Keyword){return parsePostfixExpression()}if(match("++")||match("--")){marker=markerCreate();token=lex();expr=parseUnaryExpression();if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant({},Messages.StrictLHSPrefix)}if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}return markerApply(marker,delegate.createUnaryExpression(token.value,expr))}if(match("+")||match("-")||match("~")||match("!")){marker=markerCreate();token=lex();expr=parseUnaryExpression();return markerApply(marker,delegate.createUnaryExpression(token.value,expr))}if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){marker=markerCreate();token=lex();expr=parseUnaryExpression();expr=markerApply(marker,delegate.createUnaryExpression(token.value,expr));if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){throwErrorTolerant({},Messages.StrictDelete)}return expr}return parsePostfixExpression()}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 expr,token,prec,previousAllowIn,stack,right,operator,left,i,marker,markers;previousAllowIn=state.allowIn;state.allowIn=true;marker=markerCreate();left=parseUnaryExpression();token=lookahead;prec=binaryPrecedence(token,previousAllowIn);if(prec===0){return left}token.prec=prec;lex();markers=[marker,markerCreate()];right=parseUnaryExpression();stack=[left,token,right];while((prec=binaryPrecedence(lookahead,previousAllowIn))>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.pop();markerApply(marker,expr);stack.push(expr);markers.push(marker)}token=lex();token.prec=prec;stack.push(token);markers.push(markerCreate());expr=parseUnaryExpression();stack.push(expr)}state.allowIn=previousAllowIn;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();markerApply(marker,expr)}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,marker=markerCreate();expr=parseBinaryExpression();if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=parseAssignmentExpression();state.allowIn=previousAllowIn;expect(":");alternate=parseAssignmentExpression();expr=markerApply(marker,delegate.createConditionalExpression(expr,consequent,alternate))}return expr}function reinterpretAsAssignmentBindingPattern(expr){var i,len,property,element;if(expr.type===Syntax.ObjectExpression){expr.type=Syntax.ObjectPattern;for(i=0,len=expr.properties.length;i<len;i+=1){property=expr.properties[i];if(property.type===Syntax.SpreadProperty){if(i<len-1){throwError({},Messages.PropertyAfterSpreadProperty)}reinterpretAsAssignmentBindingPattern(property.argument)}else{if(property.kind!=="init"){throwError({},Messages.InvalidLHSInAssignment)}reinterpretAsAssignmentBindingPattern(property.value)}}}else if(expr.type===Syntax.ArrayExpression){expr.type=Syntax.ArrayPattern;for(i=0,len=expr.elements.length;i<len;i+=1){element=expr.elements[i];if(element){reinterpretAsAssignmentBindingPattern(element)}}}else if(expr.type===Syntax.Identifier){if(isRestrictedWord(expr.name)){throwError({},Messages.InvalidLHSInAssignment)}}else if(expr.type===Syntax.SpreadElement){reinterpretAsAssignmentBindingPattern(expr.argument);if(expr.argument.type===Syntax.ObjectPattern){throwError({},Messages.ObjectPatternAsSpread)}}else{if(expr.type!==Syntax.MemberExpression&&expr.type!==Syntax.CallExpression&&expr.type!==Syntax.NewExpression){throwError({},Messages.InvalidLHSInAssignment)}}}function reinterpretAsDestructuredParameter(options,expr){var i,len,property,element;if(expr.type===Syntax.ObjectExpression){expr.type=Syntax.ObjectPattern;for(i=0,len=expr.properties.length;i<len;i+=1){property=expr.properties[i];if(property.type===Syntax.SpreadProperty){if(i<len-1){throwError({},Messages.PropertyAfterSpreadProperty)}reinterpretAsDestructuredParameter(options,property.argument)}else{if(property.kind!=="init"){throwError({},Messages.InvalidLHSInFormalsList)}reinterpretAsDestructuredParameter(options,property.value)}}}else if(expr.type===Syntax.ArrayExpression){expr.type=Syntax.ArrayPattern;for(i=0,len=expr.elements.length;i<len;i+=1){element=expr.elements[i];if(element){reinterpretAsDestructuredParameter(options,element)}}}else if(expr.type===Syntax.Identifier){validateParam(options,expr,expr.name)}else if(expr.type===Syntax.SpreadElement){if(expr.argument.type!==Syntax.Identifier){throwError({},Messages.InvalidLHSInFormalsList)}validateParam(options,expr.argument,expr.argument.name)}else{throwError({},Messages.InvalidLHSInFormalsList)}}function reinterpretAsCoverFormalsList(expressions){var i,len,param,params,defaults,defaultCount,options,rest;params=[];defaults=[];defaultCount=0;rest=null;options={paramSet:new StringMap};for(i=0,len=expressions.length;i<len;i+=1){param=expressions[i];if(param.type===Syntax.Identifier){params.push(param);defaults.push(null);validateParam(options,param,param.name)}else if(param.type===Syntax.ObjectExpression||param.type===Syntax.ArrayExpression){reinterpretAsDestructuredParameter(options,param);params.push(param);defaults.push(null)}else if(param.type===Syntax.SpreadElement){assert(i===len-1,"It is guaranteed that SpreadElement is last element by parseExpression");if(param.argument.type!==Syntax.Identifier){throwError({},Messages.InvalidLHSInFormalsList)}reinterpretAsDestructuredParameter(options,param.argument);rest=param.argument}else if(param.type===Syntax.AssignmentExpression){params.push(param.left);defaults.push(param.right);++defaultCount;validateParam(options,param.left,param.left.name)}else{return null}}if(options.message===Messages.StrictParamDupe){throwError(strict?options.stricted:options.firstRestricted,options.message)}if(defaultCount===0){defaults=[]}return{params:params,defaults:defaults,rest:rest,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseArrowFunctionExpression(options,marker){var previousStrict,previousYieldAllowed,previousAwaitAllowed,body;expect("=>");previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=!!options.async;body=parseConciseBody();if(strict&&options.firstRestricted){throwError(options.firstRestricted,options.message)}if(strict&&options.stricted){throwErrorTolerant(options.stricted,options.message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createArrowFunctionExpression(options.params,options.defaults,body,options.rest,body.type!==Syntax.BlockStatement,!!options.async))}function parseAssignmentExpression(){var marker,expr,token,params,oldParenthesizedCount,startsWithParen=false,backtrackToken=lookahead,possiblyAsync=false;if(matchYield()){return parseYieldExpression()}if(matchAwait()){return parseAwaitExpression()}oldParenthesizedCount=state.parenthesizedCount;marker=markerCreate();if(matchAsyncFuncExprOrDecl()){return parseFunctionExpression()}if(matchAsync()){possiblyAsync=true;lex()}if(match("(")){token=lookahead2();if(token.type===Token.Punctuator&&token.value===")"||token.value==="..."){params=parseParams();if(!match("=>")){throwUnexpected(lex())}params.async=possiblyAsync;return parseArrowFunctionExpression(params,marker)}startsWithParen=true}token=lookahead;if(possiblyAsync&&!match("(")&&token.type!==Token.Identifier){possiblyAsync=false;rewind(backtrackToken)}expr=parseConditionalExpression();if(match("=>")&&(state.parenthesizedCount===oldParenthesizedCount||state.parenthesizedCount===oldParenthesizedCount+1)){if(expr.type===Syntax.Identifier){params=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.AssignmentExpression||expr.type===Syntax.ArrayExpression||expr.type===Syntax.ObjectExpression){if(!startsWithParen){throwUnexpected(lex())}params=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.SequenceExpression){params=reinterpretAsCoverFormalsList(expr.expressions)}if(params){params.async=possiblyAsync;return parseArrowFunctionExpression(params,marker)}}if(possiblyAsync){possiblyAsync=false;rewind(backtrackToken);expr=parseConditionalExpression()}if(matchAssign()){if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){throwErrorTolerant(token,Messages.StrictLHSAssignment)}if(match("=")&&(expr.type===Syntax.ObjectExpression||expr.type===Syntax.ArrayExpression)){reinterpretAsAssignmentBindingPattern(expr)}else if(!isLeftHandSide(expr)){throwError({},Messages.InvalidLHSInAssignment)}expr=markerApply(marker,delegate.createAssignmentExpression(lex().value,expr,parseAssignmentExpression()))}return expr}function parseExpression(){var marker,expr,expressions,sequence,coverFormalsList,spreadFound,oldParenthesizedCount;oldParenthesizedCount=state.parenthesizedCount;marker=markerCreate();expr=parseAssignmentExpression();expressions=[expr];if(match(",")){while(index<length){if(!match(",")){break}lex();expr=parseSpreadOrAssignmentExpression();expressions.push(expr);if(expr.type===Syntax.SpreadElement){spreadFound=true;if(!match(")")){throwError({},Messages.ElementAfterSpreadElement)}break}}sequence=markerApply(marker,delegate.createSequenceExpression(expressions))}if(spreadFound&&lookahead2().value!=="=>"){throwError({},Messages.IllegalSpread)}return sequence||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,marker=markerCreate();expect("{");block=parseStatementList();expect("}");return markerApply(marker,delegate.createBlockStatement(block))}function parseTypeParameterDeclaration(){var marker=markerCreate(),paramTypes=[];expect("<");while(!match(">")){paramTypes.push(parseVariableIdentifier());if(!match(">")){expect(",")}}expect(">");return markerApply(marker,delegate.createTypeParameterDeclaration(paramTypes))}function parseTypeParameterInstantiation(){var marker=markerCreate(),oldInType=state.inType,paramTypes=[];state.inType=true;expect("<");while(!match(">")){paramTypes.push(parseType());if(!match(">")){expect(",")}}expect(">");state.inType=oldInType;return markerApply(marker,delegate.createTypeParameterInstantiation(paramTypes))}function parseObjectTypeIndexer(marker,isStatic){var id,key,value;expect("[");id=parseObjectPropertyKey();expect(":");key=parseType();expect("]");expect(":");value=parseType();return markerApply(marker,delegate.createObjectTypeIndexer(id,key,value,isStatic))}function parseObjectTypeMethodish(marker){var params=[],rest=null,returnType,typeParameters=null;if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("(");while(lookahead.type===Token.Identifier){params.push(parseFunctionTypeParam());if(!match(")")){expect(",")}}if(match("...")){lex();rest=parseFunctionTypeParam()}expect(")");expect(":");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters))}function parseObjectTypeMethod(marker,isStatic,key){var optional=false,value;value=parseObjectTypeMethodish(marker);return markerApply(marker,delegate.createObjectTypeProperty(key,value,optional,isStatic))}function parseObjectTypeCallProperty(marker,isStatic){var valueMarker=markerCreate();return markerApply(marker,delegate.createObjectTypeCallProperty(parseObjectTypeMethodish(valueMarker),isStatic))}function parseObjectType(allowStatic){var callProperties=[],indexers=[],marker,optional=false,properties=[],property,propertyKey,propertyTypeAnnotation,token,isStatic,matchStatic;expect("{");while(!match("}")){marker=markerCreate();matchStatic=strict?matchKeyword("static"):matchContextualKeyword("static");if(allowStatic&&matchStatic){token=lex();isStatic=true}if(match("[")){indexers.push(parseObjectTypeIndexer(marker,isStatic))}else if(match("(")||match("<")){callProperties.push(parseObjectTypeCallProperty(marker,allowStatic))}else{if(isStatic&&match(":")){propertyKey=markerApply(marker,delegate.createIdentifier(token));throwErrorTolerant(token,Messages.StrictReservedWord)}else{propertyKey=parseObjectPropertyKey()}if(match("<")||match("(")){properties.push(parseObjectTypeMethod(marker,isStatic,propertyKey))}else{if(match("?")){lex();optional=true}expect(":");propertyTypeAnnotation=parseType();properties.push(markerApply(marker,delegate.createObjectTypeProperty(propertyKey,propertyTypeAnnotation,optional,isStatic)))}}if(match(";")){lex()}else if(!match("}")){throwUnexpected(lookahead)}}expect("}");return delegate.createObjectTypeAnnotation(properties,indexers,callProperties)}function parseGenericType(){var marker=markerCreate(),returnType=null,typeParameters=null,typeIdentifier,typeIdentifierMarker=markerCreate;typeIdentifier=parseVariableIdentifier();while(match(".")){expect(".");typeIdentifier=markerApply(marker,delegate.createQualifiedTypeIdentifier(typeIdentifier,parseVariableIdentifier()))}if(match("<")){typeParameters=parseTypeParameterInstantiation()}return markerApply(marker,delegate.createGenericTypeAnnotation(typeIdentifier,typeParameters))}function parseVoidType(){var marker=markerCreate();expectKeyword("void");return markerApply(marker,delegate.createVoidTypeAnnotation())}function parseTypeofType(){var argument,marker=markerCreate();expectKeyword("typeof");argument=parsePrimaryType();return markerApply(marker,delegate.createTypeofTypeAnnotation(argument))}function parseTupleType(){var marker=markerCreate(),types=[];expect("[");while(index<length&&!match("]")){types.push(parseType());if(match("]")){break}expect(",")}expect("]");return markerApply(marker,delegate.createTupleTypeAnnotation(types))}function parseFunctionTypeParam(){var marker=markerCreate(),name,optional=false,typeAnnotation;name=parseVariableIdentifier();if(match("?")){lex();optional=true}expect(":");typeAnnotation=parseType();return markerApply(marker,delegate.createFunctionTypeParam(name,typeAnnotation,optional))}function parseFunctionTypeParams(){var ret={params:[],rest:null};while(lookahead.type===Token.Identifier){ret.params.push(parseFunctionTypeParam());if(!match(")")){expect(",")}}if(match("...")){lex();ret.rest=parseFunctionTypeParam()}return ret}function parsePrimaryType(){var typeIdentifier=null,params=null,returnType=null,marker=markerCreate(),rest=null,tmp,typeParameters,token,type,isGroupedType=false;switch(lookahead.type){case Token.Identifier:switch(lookahead.value){case"any":lex();return markerApply(marker,delegate.createAnyTypeAnnotation());case"bool":case"boolean":lex();return markerApply(marker,delegate.createBooleanTypeAnnotation());case"number":lex();return markerApply(marker,delegate.createNumberTypeAnnotation());case"string":lex();return markerApply(marker,delegate.createStringTypeAnnotation())}return markerApply(marker,parseGenericType());case Token.Punctuator:switch(lookahead.value){case"{":return markerApply(marker,parseObjectType());case"[":return parseTupleType();case"<":typeParameters=parseTypeParameterDeclaration();expect("(");tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect("=>");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters));case"(":lex();if(!match(")")&&!match("...")){if(lookahead.type===Token.Identifier){token=lookahead2();isGroupedType=token.value!=="?"&&token.value!==":"}else{isGroupedType=true}}if(isGroupedType){type=parseType();expect(")");if(match("=>")){throwError({},Messages.ConfusedAboutFunctionType)}return type}tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect("=>");returnType=parseType();return markerApply(marker,delegate.createFunctionTypeAnnotation(params,returnType,rest,null))}break;case Token.Keyword:switch(lookahead.value){case"void":return markerApply(marker,parseVoidType());case"typeof":return markerApply(marker,parseTypeofType())}break;case Token.StringLiteral:token=lex();if(token.octal){throwError(token,Messages.StrictOctalLiteral)}return markerApply(marker,delegate.createStringLiteralTypeAnnotation(token))}throwUnexpected(lookahead)}function parsePostfixType(){var marker=markerCreate(),t=parsePrimaryType();if(match("[")){expect("[");expect("]");return markerApply(marker,delegate.createArrayTypeAnnotation(t))}return t}function parsePrefixType(){var marker=markerCreate();if(match("?")){lex();return markerApply(marker,delegate.createNullableTypeAnnotation(parsePrefixType()))}return parsePostfixType()}function parseIntersectionType(){var marker=markerCreate(),type,types;type=parsePrefixType();types=[type];while(match("&")){lex();types.push(parsePrefixType())}return types.length===1?type:markerApply(marker,delegate.createIntersectionTypeAnnotation(types))}function parseUnionType(){var marker=markerCreate(),type,types;type=parseIntersectionType();types=[type];while(match("|")){lex();types.push(parseIntersectionType())}return types.length===1?type:markerApply(marker,delegate.createUnionTypeAnnotation(types))}function parseType(){var oldInType=state.inType,type;state.inType=true;type=parseUnionType();state.inType=oldInType;return type}function parseTypeAnnotation(){var marker=markerCreate(),type;expect(":");type=parseType();return markerApply(marker,delegate.createTypeAnnotation(type))}function parseVariableIdentifier(){var marker=markerCreate(),token=lex();if(token.type!==Token.Identifier){throwUnexpected(token)}return markerApply(marker,delegate.createIdentifier(token.value))}function parseTypeAnnotatableIdentifier(requireTypeAnnotation,canBeOptionalParam){var marker=markerCreate(),ident=parseVariableIdentifier(),isOptionalParam=false;if(canBeOptionalParam&&match("?")){expect("?");isOptionalParam=true}if(requireTypeAnnotation||match(":")){ident.typeAnnotation=parseTypeAnnotation();ident=markerApply(marker,ident)}if(isOptionalParam){ident.optional=true;ident=markerApply(marker,ident)}return ident}function parseVariableDeclaration(kind){var id,marker=markerCreate(),init=null,typeAnnotationMarker=markerCreate();if(match("{")){id=parseObjectInitialiser();reinterpretAsAssignmentBindingPattern(id);if(match(":")){id.typeAnnotation=parseTypeAnnotation();markerApply(typeAnnotationMarker,id)}}else if(match("[")){id=parseArrayInitialiser();reinterpretAsAssignmentBindingPattern(id);if(match(":")){id.typeAnnotation=parseTypeAnnotation();markerApply(typeAnnotationMarker,id)}}else{id=state.allowKeyword?parseNonComputedProperty():parseTypeAnnotatableIdentifier();if(strict&&isRestrictedWord(id.name)){throwErrorTolerant({},Messages.StrictVarName)}}if(kind==="const"){if(!match("=")){throwError({},Messages.NoUnintializedConst)}expect("=");init=parseAssignmentExpression()}else if(match("=")){lex();init=parseAssignmentExpression()}return markerApply(marker,delegate.createVariableDeclarator(id,init))}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break}lex()}while(index<length);return list}function parseVariableStatement(){var declarations,marker=markerCreate();expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return markerApply(marker,delegate.createVariableDeclaration(declarations,"var"))}function parseConstLetDeclaration(kind){var declarations,marker=markerCreate();expectKeyword(kind);declarations=parseVariableDeclarationList(kind);consumeSemicolon();return markerApply(marker,delegate.createVariableDeclaration(declarations,kind))}function parseModuleSpecifier(){var marker=markerCreate(),specifier;if(lookahead.type!==Token.StringLiteral){throwError({},Messages.InvalidModuleSpecifier)}specifier=delegate.createModuleSpecifier(lookahead);lex();return markerApply(marker,specifier)}function parseExportBatchSpecifier(){var marker=markerCreate();expect("*");return markerApply(marker,delegate.createExportBatchSpecifier())}function parseExportSpecifier(){var id,name=null,marker=markerCreate(),from;if(matchKeyword("default")){lex();id=markerApply(marker,delegate.createIdentifier("default"))}else{id=parseVariableIdentifier()}if(matchContextualKeyword("as")){lex();name=parseNonComputedProperty()}return markerApply(marker,delegate.createExportSpecifier(id,name))}function parseExportDeclaration(){var backtrackToken,id,previousAllowKeyword,declaration=null,isExportFromIdentifier,src=null,specifiers=[],marker=markerCreate();expectKeyword("export");if(matchKeyword("default")){lex();if(matchKeyword("function")||matchKeyword("class")){backtrackToken=lookahead;lex();if(isIdentifierName(lookahead)){id=parseNonComputedProperty();rewind(backtrackToken);return markerApply(marker,delegate.createExportDeclaration(true,parseSourceElement(),[id],null))}rewind(backtrackToken);switch(lookahead.value){case"class":return markerApply(marker,delegate.createExportDeclaration(true,parseClassExpression(),[],null));case"function":return markerApply(marker,delegate.createExportDeclaration(true,parseFunctionExpression(),[],null))}}if(matchContextualKeyword("from")){throwError({},Messages.UnexpectedToken,lookahead.value)}if(match("{")){declaration=parseObjectInitialiser()}else if(match("[")){declaration=parseArrayInitialiser()}else{declaration=parseAssignmentExpression()}consumeSemicolon();return markerApply(marker,delegate.createExportDeclaration(true,declaration,[],null))}if(lookahead.type===Token.Keyword||matchContextualKeyword("type")){switch(lookahead.value){case"type":case"let":case"const":case"var":case"class":case"function":return markerApply(marker,delegate.createExportDeclaration(false,parseSourceElement(),specifiers,null))}}if(match("*")){specifiers.push(parseExportBatchSpecifier());if(!matchContextualKeyword("from")){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createExportDeclaration(false,null,specifiers,src))}expect("{");if(!match("}")){do{isExportFromIdentifier=isExportFromIdentifier||matchKeyword("default");specifiers.push(parseExportSpecifier())}while(match(",")&&lex())}expect("}");if(matchContextualKeyword("from")){lex();src=parseModuleSpecifier();consumeSemicolon()}else if(isExportFromIdentifier){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}else{consumeSemicolon()}return markerApply(marker,delegate.createExportDeclaration(false,declaration,specifiers,src))}function parseImportSpecifier(){var id,name=null,marker=markerCreate();id=parseNonComputedProperty();if(matchContextualKeyword("as")){lex();name=parseVariableIdentifier()}return markerApply(marker,delegate.createImportSpecifier(id,name))}function parseNamedImports(){var specifiers=[];expect("{");if(!match("}")){do{specifiers.push(parseImportSpecifier())}while(match(",")&&lex())}expect("}");return specifiers}function parseImportDefaultSpecifier(){var id,marker=markerCreate();id=parseNonComputedProperty();return markerApply(marker,delegate.createImportDefaultSpecifier(id))}function parseImportNamespaceSpecifier(){var id,marker=markerCreate();expect("*");if(!matchContextualKeyword("as")){throwError({},Messages.NoAsAfterImportNamespace)}lex();id=parseNonComputedProperty();return markerApply(marker,delegate.createImportNamespaceSpecifier(id))}function parseImportDeclaration(){var specifiers,src,marker=markerCreate(),isType=false,token2;expectKeyword("import");if(matchContextualKeyword("type")){token2=lookahead2();if(token2.type===Token.Identifier&&token2.value!=="from"||token2.type===Token.Punctuator&&(token2.value==="{"||token2.value==="*")){isType=true;lex()}}specifiers=[];if(lookahead.type===Token.StringLiteral){src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createImportDeclaration(specifiers,src,isType))}if(!matchKeyword("default")&&isIdentifierName(lookahead)){specifiers.push(parseImportDefaultSpecifier());if(match(",")){lex()}}if(match("*")){specifiers.push(parseImportNamespaceSpecifier())}else if(match("{")){specifiers=specifiers.concat(parseNamedImports())}if(!matchContextualKeyword("from")){throwError({},lookahead.value?Messages.UnexpectedToken:Messages.MissingFromClause,lookahead.value)}lex();src=parseModuleSpecifier();consumeSemicolon();return markerApply(marker,delegate.createImportDeclaration(specifiers,src,isType))}function parseEmptyStatement(){var marker=markerCreate();expect(";");return markerApply(marker,delegate.createEmptyStatement())}function parseExpressionStatement(){var marker=markerCreate(),expr=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createExpressionStatement(expr))}function parseIfStatement(){var test,consequent,alternate,marker=markerCreate();expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return markerApply(marker,delegate.createIfStatement(test,consequent,alternate))}function parseDoWhileStatement(){var body,test,oldInIteration,marker=markerCreate();expectKeyword("do");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");if(match(";")){lex()}return markerApply(marker,delegate.createDoWhileStatement(body,test))}function parseWhileStatement(){var test,body,oldInIteration,marker=markerCreate();expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return markerApply(marker,delegate.createWhileStatement(test,body))}function parseForVariableDeclaration(){var marker=markerCreate(),token=lex(),declarations=parseVariableDeclarationList();return markerApply(marker,delegate.createVariableDeclaration(declarations,token.value))}function parseForStatement(opts){var init,test,update,left,right,body,operator,oldInIteration,marker=markerCreate();init=test=update=null;expectKeyword("for");if(matchContextualKeyword("each")){throwError({},Messages.EachNotAllowed)}expect("(");if(match(";")){lex()}else{if(matchKeyword("var")||matchKeyword("let")||matchKeyword("const")){state.allowIn=false;init=parseForVariableDeclaration();state.allowIn=true;if(init.declarations.length===1){if(matchKeyword("in")||matchContextualKeyword("of")){operator=lookahead;if(!((operator.value==="in"||init.kind!=="var")&&init.declarations[0].init)){lex();left=init;right=parseExpression();init=null}}}}else{state.allowIn=false;init=parseExpression();state.allowIn=true;if(matchContextualKeyword("of")){operator=lex();left=init;right=parseExpression();init=null}else if(matchKeyword("in")){if(!isAssignableLeftHandSide(init)){throwError({},Messages.InvalidLHSInForIn)}operator=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;if(!(opts!==undefined&&opts.ignoreBody)){body=parseStatement()}state.inIteration=oldInIteration;if(typeof left==="undefined"){return markerApply(marker,delegate.createForStatement(init,test,update,body))}if(operator.value==="in"){return markerApply(marker,delegate.createForInStatement(left,right,body))}return markerApply(marker,delegate.createForOfStatement(left,right,body))}function parseContinueStatement(){var label=null,marker=markerCreate();expectKeyword("continue");if(source.charCodeAt(index)===59){lex();if(!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(null))}if(peekLineTerminator()){if(!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(null))}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();if(!state.labelSet.has(label.name)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!state.inIteration){throwError({},Messages.IllegalContinue)}return markerApply(marker,delegate.createContinueStatement(label))}function parseBreakStatement(){var label=null,marker=markerCreate();expectKeyword("break");if(source.charCodeAt(index)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(null))}if(peekLineTerminator()){if(!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(null)) | |
}if(lookahead.type===Token.Identifier){label=parseVariableIdentifier();if(!state.labelSet.has(label.name)){throwError({},Messages.UnknownLabel,label.name)}}consumeSemicolon();if(label===null&&!(state.inIteration||state.inSwitch)){throwError({},Messages.IllegalBreak)}return markerApply(marker,delegate.createBreakStatement(label))}function parseReturnStatement(){var argument=null,marker=markerCreate();expectKeyword("return");if(!state.inFunctionBody){throwErrorTolerant({},Messages.IllegalReturn)}if(source.charCodeAt(index)===32){if(isIdentifierStart(source.charCodeAt(index+1))){argument=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createReturnStatement(argument))}}if(peekLineTerminator()){return markerApply(marker,delegate.createReturnStatement(null))}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return markerApply(marker,delegate.createReturnStatement(argument))}function parseWithStatement(){var object,body,marker=markerCreate();if(strict){throwErrorTolerant({},Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return markerApply(marker,delegate.createWithStatement(object,body))}function parseSwitchCase(){var test,consequent=[],sourceElement,marker=markerCreate();if(matchKeyword("default")){lex();test=null}else{expectKeyword("case");test=parseExpression()}expect(":");while(index<length){if(match("}")||matchKeyword("default")||matchKeyword("case")){break}sourceElement=parseSourceElement();if(typeof sourceElement==="undefined"){break}consequent.push(sourceElement)}return markerApply(marker,delegate.createSwitchCase(test,consequent))}function parseSwitchStatement(){var discriminant,cases,clause,oldInSwitch,defaultFound,marker=markerCreate();expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return markerApply(marker,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 markerApply(marker,delegate.createSwitchStatement(discriminant,cases))}function parseThrowStatement(){var argument,marker=markerCreate();expectKeyword("throw");if(peekLineTerminator()){throwError({},Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return markerApply(marker,delegate.createThrowStatement(argument))}function parseCatchClause(){var param,body,marker=markerCreate();expectKeyword("catch");expect("(");if(match(")")){throwUnexpected(lookahead)}param=parseExpression();if(strict&¶m.type===Syntax.Identifier&&isRestrictedWord(param.name)){throwErrorTolerant({},Messages.StrictCatchVariable)}expect(")");body=parseBlock();return markerApply(marker,delegate.createCatchClause(param,body))}function parseTryStatement(){var block,handlers=[],finalizer=null,marker=markerCreate();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 markerApply(marker,delegate.createTryStatement(block,[],handlers,finalizer))}function parseDebuggerStatement(){var marker=markerCreate();expectKeyword("debugger");consumeSemicolon();return markerApply(marker,delegate.createDebuggerStatement())}function parseStatement(){var type=lookahead.type,marker,expr,labeledBody;if(type===Token.EOF){throwUnexpected(lookahead)}if(type===Token.Punctuator){switch(lookahead.value){case";":return parseEmptyStatement();case"{":return parseBlock();case"(":return parseExpressionStatement();default:break}}if(type===Token.Keyword){switch(lookahead.value){case"break":return parseBreakStatement();case"continue":return parseContinueStatement();case"debugger":return parseDebuggerStatement();case"do":return parseDoWhileStatement();case"for":return parseForStatement();case"function":return parseFunctionDeclaration();case"class":return parseClassDeclaration();case"if":return parseIfStatement();case"return":return parseReturnStatement();case"switch":return parseSwitchStatement();case"throw":return parseThrowStatement();case"try":return parseTryStatement();case"var":return parseVariableStatement();case"while":return parseWhileStatement();case"with":return parseWithStatement();default:break}}if(matchAsyncFuncExprOrDecl()){return parseFunctionDeclaration()}marker=markerCreate();expr=parseExpression();if(expr.type===Syntax.Identifier&&match(":")){lex();if(state.labelSet.has(expr.name)){throwError({},Messages.Redeclaration,"Label",expr.name)}state.labelSet.set(expr.name,true);labeledBody=parseStatement();state.labelSet["delete"](expr.name);return markerApply(marker,delegate.createLabeledStatement(expr,labeledBody))}consumeSemicolon();return markerApply(marker,delegate.createExpressionStatement(expr))}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements()}return parseAssignmentExpression()}function parseFunctionSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,oldParenthesizedCount,marker=markerCreate();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.range[0]+1,token.range[1]-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;oldParenthesizedCount=state.parenthesizedCount;state.labelSet=new StringMap;state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;state.parenthesizedCount=0;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;state.parenthesizedCount=oldParenthesizedCount;return markerApply(marker,delegate.createBlockStatement(sourceElements))}function validateParam(options,param,name){if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName}if(options.paramSet.has(name)){options.stricted=param;options.message=Messages.StrictParamDupe}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord}else if(options.paramSet.has(name)){options.firstRestricted=param;options.message=Messages.StrictParamDupe}}options.paramSet.set(name,true)}function parseParam(options){var marker,token,rest,param,def;token=lookahead;if(token.value==="..."){token=lex();rest=true}if(match("[")){marker=markerCreate();param=parseArrayInitialiser();reinterpretAsDestructuredParameter(options,param);if(match(":")){param.typeAnnotation=parseTypeAnnotation();markerApply(marker,param)}}else if(match("{")){marker=markerCreate();if(rest){throwError({},Messages.ObjectPatternAsRestParameter)}param=parseObjectInitialiser();reinterpretAsDestructuredParameter(options,param);if(match(":")){param.typeAnnotation=parseTypeAnnotation();markerApply(marker,param)}}else{param=rest?parseTypeAnnotatableIdentifier(false,false):parseTypeAnnotatableIdentifier(false,true);validateParam(options,token,token.value)}if(match("=")){if(rest){throwErrorTolerant(lookahead,Messages.DefaultRestParameter)}lex();def=parseAssignmentExpression();++options.defaultCount}if(rest){if(!match(")")){throwError({},Messages.ParameterAfterRestParameter)}options.rest=param;return false}options.params.push(param);options.defaults.push(def);return!match(")")}function parseParams(firstRestricted){var options,marker=markerCreate();options={params:[],defaultCount:0,defaults:[],rest:null,firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet=new StringMap;while(index<length){if(!parseParam(options)){break}expect(",")}}expect(")");if(options.defaultCount===0){options.defaults=[]}if(match(":")){options.returnType=parseTypeAnnotation()}return markerApply(marker,options)}function parseFunctionDeclaration(){var id,body,token,tmp,firstRestricted,message,generator,isAsync,previousStrict,previousYieldAllowed,previousAwaitAllowed,marker=markerCreate(),typeParameters;isAsync=false;if(matchAsync()){lex();isAsync=true}expectKeyword("function");generator=false;if(match("*")){lex();generator=true}token=lookahead;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}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);firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=isAsync;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&tmp.stricted){throwErrorTolerant(tmp.stricted,message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionDeclaration(id,tmp.params,tmp.defaults,body,tmp.rest,generator,false,isAsync,tmp.returnType,typeParameters))}function parseFunctionExpression(){var token,id=null,firstRestricted,message,tmp,body,generator,isAsync,previousStrict,previousYieldAllowed,previousAwaitAllowed,marker=markerCreate(),typeParameters;isAsync=false;if(matchAsync()){lex();isAsync=true}expectKeyword("function");generator=false;if(match("*")){lex();generator=true}if(!match("(")){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}}}if(match("<")){typeParameters=parseTypeParameterDeclaration()}}tmp=parseParams(firstRestricted);firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=generator;previousAwaitAllowed=state.awaitAllowed;state.awaitAllowed=isAsync;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwError(firstRestricted,message)}if(strict&&tmp.stricted){throwErrorTolerant(tmp.stricted,message)}strict=previousStrict;state.yieldAllowed=previousYieldAllowed;state.awaitAllowed=previousAwaitAllowed;return markerApply(marker,delegate.createFunctionExpression(id,tmp.params,tmp.defaults,body,tmp.rest,generator,false,isAsync,tmp.returnType,typeParameters))}function parseYieldExpression(){var delegateFlag,expr,marker=markerCreate();expectKeyword("yield",!strict);delegateFlag=false;if(match("*")){lex();delegateFlag=true}expr=parseAssignmentExpression();return markerApply(marker,delegate.createYieldExpression(expr,delegateFlag))}function parseAwaitExpression(){var expr,marker=markerCreate();expectContextualKeyword("await");expr=parseAssignmentExpression();return markerApply(marker,delegate.createAwaitExpression(expr))}function validateDuplicateProp(propMap,key,accessor){var propInfo,reversed,name,isValidDuplicateProp;name=getFieldName(key);if(propMap.has(name)){propInfo=propMap.get(name);if(accessor==="data"){isValidDuplicateProp=false}else{if(accessor==="get"){reversed="set"}else{reversed="get"}isValidDuplicateProp=propInfo[accessor]===undefined&&propInfo.data===undefined&&propInfo[reversed]!==undefined}if(!isValidDuplicateProp){throwError(key,Messages.IllegalDuplicateClassProperty)}}else{propInfo={get:undefined,set:undefined,data:undefined};propMap.set(name,propInfo)}propInfo[accessor]=true}function parseMethodDefinition(existingPropNames,key,isStatic,generator,computed){var token,param,propType,isValidDuplicateProp=false,isAsync,typeParameters,tokenValue,returnType,annotationMarker,propMap;propType=isStatic?ClassPropertyType.static:ClassPropertyType.prototype;propMap=existingPropNames[propType];if(generator){return delegate.createMethodDefinition(propType,"",key,parsePropertyMethodFunction({generator:true}),computed)}tokenValue=key.type==="Identifier"&&key.name;if(tokenValue==="get"&&!match("(")){key=parseObjectPropertyKey();if(!computed){validateDuplicateProp(propMap,key,"get")}expect("(");expect(")");if(match(":")){returnType=parseTypeAnnotation()}return delegate.createMethodDefinition(propType,"get",key,parsePropertyFunction({generator:false,returnType:returnType}),computed)}if(tokenValue==="set"&&!match("(")){key=parseObjectPropertyKey();if(!computed){validateDuplicateProp(propMap,key,"set")}expect("(");token=lookahead;param=[parseTypeAnnotatableIdentifier()];expect(")");if(match(":")){returnType=parseTypeAnnotation()}return delegate.createMethodDefinition(propType,"set",key,parsePropertyFunction({params:param,generator:false,name:token,returnType:returnType}),computed)}if(match("<")){typeParameters=parseTypeParameterDeclaration()}isAsync=tokenValue==="async"&&!match("(");if(isAsync){key=parseObjectPropertyKey()}if(!computed){validateDuplicateProp(propMap,key,"data")}return delegate.createMethodDefinition(propType,"",key,parsePropertyMethodFunction({generator:false,async:isAsync,typeParameters:typeParameters}),computed)}function parseClassProperty(existingPropNames,key,computed,isStatic){var typeAnnotation;typeAnnotation=parseTypeAnnotation();expect(";");return delegate.createClassProperty(key,typeAnnotation,computed,isStatic)}function parseClassElement(existingProps){var computed=false,generator=false,key,marker=markerCreate(),isStatic=false,possiblyOpenBracketToken;if(match(";")){lex();return}if(lookahead.value==="static"){lex();isStatic=true}if(match("*")){lex();generator=true}possiblyOpenBracketToken=lookahead;if(matchContextualKeyword("get")||matchContextualKeyword("set")){possiblyOpenBracketToken=lookahead2()}if(possiblyOpenBracketToken.type===Token.Punctuator&&possiblyOpenBracketToken.value==="["){computed=true}key=parseObjectPropertyKey();if(!generator&&lookahead.value===":"){return markerApply(marker,parseClassProperty(existingProps,key,computed,isStatic))}return markerApply(marker,parseMethodDefinition(existingProps,key,isStatic,generator,computed))}function parseClassBody(){var classElement,classElements=[],existingProps={},marker=markerCreate();existingProps[ClassPropertyType.static]=new StringMap;existingProps[ClassPropertyType.prototype]=new StringMap;expect("{");while(index<length){if(match("}")){break}classElement=parseClassElement(existingProps);if(typeof classElement!=="undefined"){classElements.push(classElement)}}expect("}");return markerApply(marker,delegate.createClassBody(classElements))}function parseClassImplements(){var id,implemented=[],marker,typeParameters;if(strict){expectKeyword("implements")}else{expectContextualKeyword("implements")}while(index<length){marker=markerCreate();id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterInstantiation()}else{typeParameters=null}implemented.push(markerApply(marker,delegate.createClassImplements(id,typeParameters)));if(!match(",")){break}expect(",")}return implemented}function parseClassExpression(){var id,implemented,previousYieldAllowed,superClass=null,superTypeParameters,marker=markerCreate(),typeParameters,matchImplements;expectKeyword("class");matchImplements=strict?matchKeyword("implements"):matchContextualKeyword("implements");if(!matchKeyword("extends")&&!matchImplements&&!match("{")){id=parseVariableIdentifier()}if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;superClass=parseLeftHandSideExpressionAllowCall();if(match("<")){superTypeParameters=parseTypeParameterInstantiation()}state.yieldAllowed=previousYieldAllowed}if(strict?matchKeyword("implements"):matchContextualKeyword("implements")){implemented=parseClassImplements()}return markerApply(marker,delegate.createClassExpression(id,superClass,parseClassBody(),typeParameters,superTypeParameters,implemented))}function parseClassDeclaration(){var id,implemented,previousYieldAllowed,superClass=null,superTypeParameters,marker=markerCreate(),typeParameters;expectKeyword("class");id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");previousYieldAllowed=state.yieldAllowed;state.yieldAllowed=false;superClass=parseLeftHandSideExpressionAllowCall();if(match("<")){superTypeParameters=parseTypeParameterInstantiation()}state.yieldAllowed=previousYieldAllowed}if(strict?matchKeyword("implements"):matchContextualKeyword("implements")){implemented=parseClassImplements()}return markerApply(marker,delegate.createClassDeclaration(id,superClass,parseClassBody(),typeParameters,superTypeParameters,implemented))}function parseSourceElement(){var token;if(lookahead.type===Token.Keyword){switch(lookahead.value){case"const":case"let":return parseConstLetDeclaration(lookahead.value);case"function":return parseFunctionDeclaration();case"export":throwErrorTolerant({},Messages.IllegalExportDeclaration);return parseExportDeclaration();case"import":throwErrorTolerant({},Messages.IllegalImportDeclaration);return parseImportDeclaration();case"interface":if(lookahead2().type===Token.Identifier){return parseInterface()}return parseStatement();default:return parseStatement()}}if(matchContextualKeyword("type")&&lookahead2().type===Token.Identifier){return parseTypeAlias()}if(matchContextualKeyword("interface")&&lookahead2().type===Token.Identifier){return parseInterface()}if(matchContextualKeyword("declare")){token=lookahead2();if(token.type===Token.Keyword){switch(token.value){case"class":return parseDeclareClass();case"function":return parseDeclareFunction();case"var":return parseDeclareVariable()}}else if(token.type===Token.Identifier&&token.value==="module"){return parseDeclareModule()}}if(lookahead.type!==Token.EOF){return parseStatement()}}function parseProgramElement(){var isModule=extra.sourceType==="module"||extra.sourceType==="nonStrictModule";if(isModule&&lookahead.type===Token.Keyword){switch(lookahead.value){case"export":return parseExportDeclaration();case"import":return parseImportDeclaration()}}return parseSourceElement()}function parseProgramElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted;while(index<length){token=lookahead;if(token.type!==Token.StringLiteral){break}sourceElement=parseProgramElement();sourceElements.push(sourceElement);if(sourceElement.expression.type!==Syntax.Literal){break}directive=source.slice(token.range[0]+1,token.range[1]-1);if(directive==="use strict"){strict=true;if(firstRestricted){throwErrorTolerant(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}while(index<length){sourceElement=parseProgramElement();if(typeof sourceElement==="undefined"){break}sourceElements.push(sourceElement)}return sourceElements}function parseProgram(){var body,marker=markerCreate();strict=extra.sourceType==="module";peek();body=parseProgramElements();return markerApply(marker,delegate.createProgram(body))}function addComment(type,value,start,end,loc){var comment;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 scanComment(){var comment,ch,loc,start,blockComment,lineComment;comment="";blockComment=false;lineComment=false;while(index<length){ch=source[index];if(lineComment){ch=source[index++];if(isLineTerminator(ch.charCodeAt(0))){loc.end={line:lineNumber,column:index-lineStart-1};lineComment=false;addComment("Line",comment,start,index-1,loc);if(ch==="\r"&&source[index]==="\n"){++index}++lineNumber;lineStart=index;comment=""}else if(index>=length){lineComment=false;comment+=ch;loc.end={line:lineNumber,column:length-lineStart};addComment("Line",comment,start,length,loc)}else{comment+=ch}}else if(blockComment){if(isLineTerminator(ch.charCodeAt(0))){if(ch==="\r"){++index;comment+="\r"}if(ch!=="\r"||source[index]==="\n"){comment+=source[index];++lineNumber;++index;lineStart=index;if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}}else{ch=source[index++];if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}comment+=ch;if(ch==="*"){ch=source[index];if(ch==="/"){comment=comment.substr(0,comment.length-1);blockComment=false;++index;loc.end={line:lineNumber,column:index-lineStart};addComment("Block",comment,start,index,loc);comment=""}}}}else if(ch==="/"){ch=source[index+1];if(ch==="/"){loc={start:{line:lineNumber,column:index-lineStart}};start=index;index+=2;lineComment=true;if(index>=length){loc.end={line:lineNumber,column:index-lineStart};lineComment=false;addComment("Line",comment,start,index,loc)}}else if(ch==="*"){start=index;index+=2;blockComment=true;loc={start:{line:lineNumber,column:index-lineStart-2}};if(index>=length){throwError({},Messages.UnexpectedToken,"ILLEGAL")}}else{break}}else if(isWhiteSpace(ch.charCodeAt(0))){++index}else if(isLineTerminator(ch.charCodeAt(0))){++index;if(ch==="\r"&&source[index]==="\n"){++index}++lineNumber;lineStart=index}else{break}}}XHTMLEntities={quot:'"',amp:"&",apos:"'",lt:"<",gt:">",nbsp:" ",iexcl:"¡",cent:"¢",pound:"£",curren:"¤",yen:"¥",brvbar:"¦",sect:"§",uml:"¨",copy:"©",ordf:"ª",laquo:"«",not:"¬",shy:"",reg:"®",macr:"¯",deg:"°",plusmn:"±",sup2:"²",sup3:"³",acute:"´",micro:"µ",para:"¶",middot:"·",cedil:"¸",sup1:"¹",ordm:"º",raquo:"»",frac14:"¼",frac12:"½",frac34:"¾",iquest:"¿",Agrave:"À",Aacute:"Á",Acirc:"Â",Atilde:"Ã",Auml:"Ä",Aring:"Å",AElig:"Æ",Ccedil:"Ç",Egrave:"È",Eacute:"É",Ecirc:"Ê",Euml:"Ë",Igrave:"Ì",Iacute:"Í",Icirc:"Î",Iuml:"Ï",ETH:"Ð",Ntilde:"Ñ",Ograve:"Ò",Oacute:"Ó",Ocirc:"Ô",Otilde:"Õ",Ouml:"Ö",times:"×",Oslash:"Ø",Ugrave:"Ù",Uacute:"Ú",Ucirc:"Û",Uuml:"Ü",Yacute:"Ý",THORN:"Þ",szlig:"ß",agrave:"à",aacute:"á",acirc:"â",atilde:"ã",auml:"ä",aring:"å",aelig:"æ",ccedil:"ç",egrave:"è",eacute:"é",ecirc:"ê",euml:"ë",igrave:"ì",iacute:"í",icirc:"î",iuml:"ï",eth:"ð",ntilde:"ñ",ograve:"ò",oacute:"ó",ocirc:"ô",otilde:"õ",ouml:"ö",divide:"÷",oslash:"ø",ugrave:"ù",uacute:"ú",ucirc:"û",uuml:"ü",yacute:"ý",thorn:"þ",yuml:"ÿ",OElig:"Œ",oelig:"œ",Scaron:"Š",scaron:"š",Yuml:"Ÿ",fnof:"ƒ",circ:"ˆ",tilde:"˜",Alpha:"Α",Beta:"Β",Gamma:"Γ",Delta:"Δ",Epsilon:"Ε",Zeta:"Ζ",Eta:"Η",Theta:"Θ",Iota:"Ι",Kappa:"Κ",Lambda:"Λ",Mu:"Μ",Nu:"Ν",Xi:"Ξ",Omicron:"Ο",Pi:"Π",Rho:"Ρ",Sigma:"Σ",Tau:"Τ",Upsilon:"Υ",Phi:"Φ",Chi:"Χ",Psi:"Ψ",Omega:"Ω",alpha:"α",beta:"β",gamma:"γ",delta:"δ",epsilon:"ε",zeta:"ζ",eta:"η",theta:"θ",iota:"ι",kappa:"κ",lambda:"λ",mu:"μ",nu:"ν",xi:"ξ",omicron:"ο",pi:"π",rho:"ρ",sigmaf:"ς",sigma:"σ",tau:"τ",upsilon:"υ",phi:"φ",chi:"χ",psi:"ψ",omega:"ω",thetasym:"ϑ",upsih:"ϒ",piv:"ϖ",ensp:" ",emsp:" ",thinsp:" ",zwnj:"",zwj:"",lrm:"",rlm:"",ndash:"–",mdash:"—",lsquo:"‘",rsquo:"’",sbquo:"‚",ldquo:"“",rdquo:"”",bdquo:"„",dagger:"†",Dagger:"‡",bull:"•",hellip:"…",permil:"‰",prime:"′",Prime:"″",lsaquo:"‹",rsaquo:"›",oline:"‾",frasl:"⁄",euro:"€",image:"ℑ",weierp:"℘",real:"ℜ",trade:"™",alefsym:"ℵ",larr:"←",uarr:"↑",rarr:"→",darr:"↓",harr:"↔",crarr:"↵",lArr:"⇐",uArr:"⇑",rArr:"⇒",dArr:"⇓",hArr:"⇔",forall:"∀",part:"∂",exist:"∃",empty:"∅",nabla:"∇",isin:"∈",notin:"∉",ni:"∋",prod:"∏",sum:"∑",minus:"−",lowast:"∗",radic:"√",prop:"∝",infin:"∞",ang:"∠",and:"∧",or:"∨",cap:"∩",cup:"∪","int":"∫",there4:"∴",sim:"∼",cong:"≅",asymp:"≈",ne:"≠",equiv:"≡",le:"≤",ge:"≥",sub:"⊂",sup:"⊃",nsub:"⊄",sube:"⊆",supe:"⊇",oplus:"⊕",otimes:"⊗",perp:"⊥",sdot:"⋅",lceil:"⌈",rceil:"⌉",lfloor:"⌊",rfloor:"⌋",lang:"〈",rang:"〉",loz:"◊",spades:"♠",clubs:"♣",hearts:"♥",diams:"♦"};function getQualifiedXJSName(object){if(object.type===Syntax.XJSIdentifier){return object.name}if(object.type===Syntax.XJSNamespacedName){return object.namespace.name+":"+object.name.name}if(object.type===Syntax.XJSMemberExpression){return getQualifiedXJSName(object.object)+"."+getQualifiedXJSName(object.property)}throwUnexpected(object)}function isXJSIdentifierStart(ch){return ch!==92&&isIdentifierStart(ch)}function isXJSIdentifierPart(ch){return ch!==92&&(ch===45||isIdentifierPart(ch))}function scanXJSIdentifier(){var ch,start,value="";start=index;while(index<length){ch=source.charCodeAt(index);if(!isXJSIdentifierPart(ch)){break}value+=source[index++]}return{type:Token.XJSIdentifier,value:value,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanXJSEntity(){var ch,str="",start=index,count=0,code;ch=source[index];assert(ch==="&","Entity must start with an ampersand");index++;while(index<length&&count++<10){ch=source[index++];if(ch===";"){break}str+=ch}if(ch===";"){if(str[0]==="#"){if(str[1]==="x"){code=+("0"+str.substr(1))}else{code=+str.substr(1).replace(Regex.LeadingZeros,"")}if(!isNaN(code)){return String.fromCharCode(code)}}else if(XHTMLEntities[str]){return XHTMLEntities[str]}}index=start+1;return"&"}function scanXJSText(stopChars){var ch,str="",start;start=index;while(index<length){ch=source[index];if(stopChars.indexOf(ch)!==-1){break}if(ch==="&"){str+=scanXJSEntity()}else{index++;if(ch==="\r"&&source[index]==="\n"){str+=ch;ch=source[index];index++}if(isLineTerminator(ch.charCodeAt(0))){++lineNumber;lineStart=index}str+=ch}}return{type:Token.XJSText,value:str,lineNumber:lineNumber,lineStart:lineStart,range:[start,index]}}function scanXJSStringLiteral(){var innerToken,quote,start;quote=source[index];assert(quote==="'"||quote==='"',"String literal must starts with a quote");start=index;++index;innerToken=scanXJSText([quote]);if(quote!==source[index]){throwError({},Messages.UnexpectedToken,"ILLEGAL")}++index;innerToken.range=[start,index];return innerToken}function advanceXJSChild(){var ch=source.charCodeAt(index);if(ch!==60&&ch!==62&&ch!==123&&ch!==125){return scanXJSText(["<",">","{","}"])}return scanPunctuator()}function parseXJSIdentifier(){var token,marker=markerCreate();if(lookahead.type!==Token.XJSIdentifier){throwUnexpected(lookahead)}token=lex();return markerApply(marker,delegate.createXJSIdentifier(token.value))}function parseXJSNamespacedName(){var namespace,name,marker=markerCreate();namespace=parseXJSIdentifier();expect(":");name=parseXJSIdentifier();return markerApply(marker,delegate.createXJSNamespacedName(namespace,name))}function parseXJSMemberExpression(){var marker=markerCreate(),expr=parseXJSIdentifier();while(match(".")){lex();expr=markerApply(marker,delegate.createXJSMemberExpression(expr,parseXJSIdentifier()))}return expr}function parseXJSElementName(){if(lookahead2().value===":"){return parseXJSNamespacedName()}if(lookahead2().value==="."){return parseXJSMemberExpression()}return parseXJSIdentifier()}function parseXJSAttributeName(){if(lookahead2().value===":"){return parseXJSNamespacedName()}return parseXJSIdentifier()}function parseXJSAttributeValue(){var value,marker;if(match("{")){value=parseXJSExpressionContainer();if(value.expression.type===Syntax.XJSEmptyExpression){throwError(value,"XJS attributes must only be assigned a non-empty "+"expression")}}else if(match("<")){value=parseXJSElement()}else if(lookahead.type===Token.XJSText){marker=markerCreate();value=markerApply(marker,delegate.createLiteral(lex()))}else{throwError({},Messages.InvalidXJSAttributeValue)}return value}function parseXJSEmptyExpression(){var marker=markerCreatePreserveWhitespace();while(source.charAt(index)!=="}"){index++}return markerApply(marker,delegate.createXJSEmptyExpression())}function parseXJSExpressionContainer(){var expression,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=false;expect("{");if(match("}")){expression=parseXJSEmptyExpression()}else{expression=parseExpression()}state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect("}");return markerApply(marker,delegate.createXJSExpressionContainer(expression))}function parseXJSSpreadAttribute(){var expression,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=false;expect("{");expect("...");expression=parseAssignmentExpression();state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect("}");return markerApply(marker,delegate.createXJSSpreadAttribute(expression))}function parseXJSAttribute(){var name,marker;if(match("{")){return parseXJSSpreadAttribute()}marker=markerCreate();name=parseXJSAttributeName();if(match("=")){lex();return markerApply(marker,delegate.createXJSAttribute(name,parseXJSAttributeValue()))}return markerApply(marker,delegate.createXJSAttribute(name))}function parseXJSChild(){var token,marker;if(match("{")){token=parseXJSExpressionContainer()}else if(lookahead.type===Token.XJSText){marker=markerCreatePreserveWhitespace();token=markerApply(marker,delegate.createLiteral(lex()))}else if(match("<")){token=parseXJSElement()}else{throwUnexpected(lookahead)}return token}function parseXJSClosingElement(){var name,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=true;expect("<");expect("/");name=parseXJSElementName();state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;expect(">");return markerApply(marker,delegate.createXJSClosingElement(name))}function parseXJSOpeningElement(){var name,attribute,attributes=[],selfClosing=false,origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;state.inXJSChild=false;state.inXJSTag=true;expect("<");name=parseXJSElementName();while(index<length&&lookahead.value!=="/"&&lookahead.value!==">"){attributes.push(parseXJSAttribute())}state.inXJSTag=origInXJSTag;if(lookahead.value==="/"){expect("/");state.inXJSChild=origInXJSChild;expect(">");selfClosing=true}else{state.inXJSChild=true;expect(">")}return markerApply(marker,delegate.createXJSOpeningElement(name,attributes,selfClosing))}function parseXJSElement(){var openingElement,closingElement=null,children=[],origInXJSChild,origInXJSTag,marker=markerCreate();origInXJSChild=state.inXJSChild;origInXJSTag=state.inXJSTag;openingElement=parseXJSOpeningElement();if(!openingElement.selfClosing){while(index<length){state.inXJSChild=false;if(lookahead.value==="<"&&lookahead2().value==="/"){break}state.inXJSChild=true;children.push(parseXJSChild())}state.inXJSChild=origInXJSChild;state.inXJSTag=origInXJSTag;closingElement=parseXJSClosingElement();if(getQualifiedXJSName(closingElement.name)!==getQualifiedXJSName(openingElement.name)){throwError({},Messages.ExpectedXJSClosingTag,getQualifiedXJSName(openingElement.name))}}if(!origInXJSChild&&match("<")){throwError(lookahead,Messages.AdjacentXJSElements)}return markerApply(marker,delegate.createXJSElement(openingElement,closingElement,children)) | |
}function parseTypeAlias(){var id,marker=markerCreate(),typeParameters=null,right;expectContextualKeyword("type");id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("=");right=parseType();consumeSemicolon();return markerApply(marker,delegate.createTypeAlias(id,typeParameters,right))}function parseInterfaceExtends(){var marker=markerCreate(),id,typeParameters=null;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterInstantiation()}return markerApply(marker,delegate.createInterfaceExtends(id,typeParameters))}function parseInterfaceish(marker,allowStatic){var body,bodyMarker,extended=[],id,typeParameters=null;id=parseVariableIdentifier();if(match("<")){typeParameters=parseTypeParameterDeclaration()}if(matchKeyword("extends")){expectKeyword("extends");while(index<length){extended.push(parseInterfaceExtends());if(!match(",")){break}expect(",")}}bodyMarker=markerCreate();body=markerApply(bodyMarker,parseObjectType(allowStatic));return markerApply(marker,delegate.createInterface(id,typeParameters,body,extended))}function parseInterface(){var body,bodyMarker,extended=[],id,marker=markerCreate(),typeParameters=null,previousStrict;if(strict){expectKeyword("interface")}else{expectContextualKeyword("interface")}return parseInterfaceish(marker,false)}function parseDeclareClass(){var marker=markerCreate(),ret;expectContextualKeyword("declare");expectKeyword("class");ret=parseInterfaceish(marker,true);ret.type=Syntax.DeclareClass;return ret}function parseDeclareFunction(){var id,idMarker,marker=markerCreate(),params,returnType,rest,tmp,typeParameters=null,value,valueMarker;expectContextualKeyword("declare");expectKeyword("function");idMarker=markerCreate();id=parseVariableIdentifier();valueMarker=markerCreate();if(match("<")){typeParameters=parseTypeParameterDeclaration()}expect("(");tmp=parseFunctionTypeParams();params=tmp.params;rest=tmp.rest;expect(")");expect(":");returnType=parseType();value=markerApply(valueMarker,delegate.createFunctionTypeAnnotation(params,returnType,rest,typeParameters));id.typeAnnotation=markerApply(valueMarker,delegate.createTypeAnnotation(value));markerApply(idMarker,id);consumeSemicolon();return markerApply(marker,delegate.createDeclareFunction(id))}function parseDeclareVariable(){var id,marker=markerCreate();expectContextualKeyword("declare");expectKeyword("var");id=parseTypeAnnotatableIdentifier();consumeSemicolon();return markerApply(marker,delegate.createDeclareVariable(id))}function parseDeclareModule(){var body=[],bodyMarker,id,idMarker,marker=markerCreate(),token;expectContextualKeyword("declare");expectContextualKeyword("module");if(lookahead.type===Token.StringLiteral){if(strict&&lookahead.octal){throwErrorTolerant(lookahead,Messages.StrictOctalLiteral)}idMarker=markerCreate();id=markerApply(idMarker,delegate.createLiteral(lex()))}else{id=parseVariableIdentifier()}bodyMarker=markerCreate();expect("{");while(index<length&&!match("}")){token=lookahead2();switch(token.value){case"class":body.push(parseDeclareClass());break;case"function":body.push(parseDeclareFunction());break;case"var":body.push(parseDeclareVariable());break;default:throwUnexpected(lookahead)}}expect("}");return markerApply(marker,delegate.createDeclareModule(id,markerApply(bodyMarker,delegate.createBlockStatement(body))))}function collectToken(){var start,loc,token,range,value,entry;if(!state.inXJSChild){skipComment()}start=index;loc={start:{line:lineNumber,column:index-lineStart}};token=extra.advance();loc.end={line:lineNumber,column:index-lineStart};if(token.type!==Token.EOF){range=[token.range[0],token.range[1]];value=source.slice(token.range[0],token.range[1]);entry={type:TokenName[token.type],value:value,range:range,loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags}}extra.tokens.push(entry)}return token}function collectRegex(){var pos,loc,regex,token;skipComment();pos=index;loc={start:{line:lineNumber,column:index-lineStart}};regex=extra.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,regex:regex.regex,range:[pos,index],loc:loc})}return regex}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(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags}}if(extra.range){token.range=entry.range}if(extra.loc){token.loc=entry.loc}tokens.push(token)}extra.tokens=tokens}function patch(){if(extra.comments){extra.skipComment=skipComment;skipComment=scanComment}if(typeof extra.tokens!=="undefined"){extra.advance=advance;extra.scanRegExp=scanRegExp;advance=collectToken;scanRegExp=collectRegex}}function unpatch(){if(typeof extra.skipComment==="function"){skipComment=extra.skipComment}if(typeof extra.scanRegExp==="function"){advance=extra.advance;scanRegExp=extra.scanRegExp}}function extend(object,properties){var entry,result={};for(entry in object){if(object.hasOwnProperty(entry)){result[entry]=object[entry]}}for(entry in properties){if(properties.hasOwnProperty(entry)){result[entry]=properties[entry]}}return result}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={allowKeyword:true,allowIn:true,labelSet:new StringMap,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=[]}patch();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{unpatch();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={allowKeyword:false,allowIn:true,labelSet:new StringMap,parenthesizedCount:0,inFunctionBody:false,inIteration:false,inSwitch:false,inXJSChild:false,inXJSTag:false,inType:false,lastCommentStart:-1,yieldAllowed:false,awaitAllowed:false};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){delegate=extend(delegate,{postProcess:function(node){node.loc.source=toString(options.source);return node}})}extra.sourceType=options.sourceType;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=[]}}patch();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{unpatch();extra={}}return program}exports.version="12001.1.0-dev-harmony-fb";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}()})},{}],2:[function(require,module,exports){(function(){var parse=typeof module=="undefined"?window.esprima.parse:require("esprima").parse;var objectKeys=Object.keys||function(obj){var keys=[];for(var key in obj)keys.push(key);return keys};var forEach=function(xs,fn){if(xs.forEach)return xs.forEach(fn);for(var i=0;i<xs.length;i++){fn.call(xs,xs[i],i,xs)}};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};var falafel=function(src,opts,fn,breadthFirstFn){if(typeof opts==="function"){breadthFirstFn=fn;fn=opts;opts={}}if(typeof src==="object"){opts=src;src=opts.source;delete opts.source}src=src===undefined?opts.source:src;opts.range=true;if(typeof src!=="string"){src=String(src)}if(!breadthFirstFn){breadthFirstFn=function(){}}var ast=opts.ast||parse(src,opts);delete opts.ast;var result={chunks:src.split(""),toString:function(){return result.chunks.join("")},inspect:function(){return result.toString()}};var index=0;(function walk(node,parent){insertHelpers(node,parent,result.chunks);breadthFirstFn(node);insertHelpers2(node,parent,result.chunks);forEach(objectKeys(node),function(key){if(key==="parent"){return}var child=node[key];if(isArray(child)){forEach(child,function(c){if(c&&typeof c.type==="string"){walk(c,node)}})}else if(child&&typeof child.type==="string"){insertHelpers(child,node,result.chunks);walk(child,node)}});fn(node)})(ast,undefined);return result};falafel.setParser=function(parser){parse=parser};function insertHelpers(node,parent,chunks){if(!node.range)return;node.parent=parent;node.source=function(){return chunks.slice(node.range[0],node.range[1]).join("")}}function insertHelpers2(node,parent,chunks){if(node.update&&typeof node.update==="object"){var prev=node.update;forEach(objectKeys(prev),function(key){update[key]=prev[key]});node.update=update}else{node.update=update}function update(s){chunks[node.range[0]]=s;for(var i=node.range[0]+1;i<node.range[1];i++){chunks[i]=""}}}if(typeof module==="undefined"){window.falafel=falafel}else{module.exports=falafel}})()},{esprima:3}],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.esprima={})}})(this,function(exports){"use strict";var Token,TokenName,FnExprTokens,Syntax,PlaceHolders,PropertyKind,Messages,Regex,source,strict,index,lineNumber,lineStart,length,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",ArrowFunctionExpression:"ArrowFunctionExpression",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"};PlaceHolders={ArrowParameterPlaceHolder:{type:"ArrowParameterPlaceHolder"}};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;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){throwUnexpectedToken()}}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}}throwUnexpectedToken()}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 scanUnicodeCodePointEscape(){var ch,code,cu1,cu2;ch=source[index];code=0;if(ch==="}"){throwUnexpectedToken()}while(index<length){ch=source[index++];if(!isHexDigit(ch)){break}code=code*16+"0123456789abcdef".indexOf(ch.toLowerCase())}if(code>1114111||ch!=="}"){throwUnexpectedToken()}if(code<=65535){return String.fromCharCode(code)}cu1=(code-65536>>10)+55296;cu2=(code-65536&1023)+56320;return String.fromCharCode(cu1,cu2)}function getEscapedIdentifier(){var ch,id;ch=source.charCodeAt(index++);id=String.fromCharCode(ch);if(ch===92){if(source.charCodeAt(index)!==117){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierStart(ch.charCodeAt(0))){throwUnexpectedToken()}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){throwUnexpectedToken()}++index;ch=scanHexEscape("u");if(!ch||ch==="\\"||!isIdentifierPart(ch.charCodeAt(0))){throwUnexpectedToken()}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}}throwUnexpectedToken()}function scanHexLiteral(start){var number="";while(index<length){if(!isHexDigit(source[index])){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt("0x"+number,16),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanBinaryLiteral(start){var ch,number;number="";while(index<length){ch=source[index];if(ch!=="0"&&ch!=="1"){break}number+=source[index++]}if(number.length===0){throwUnexpectedToken()}if(index<length){ch=source.charCodeAt(index);if(isIdentifierStart(ch)||isDecimalDigit(ch)){throwUnexpectedToken()}}return{type:Token.NumericLiteral,value:parseInt(number,2),lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function scanOctalLiteral(prefix,start){var number,octal;if(isOctalDigit(prefix)){octal=true;number="0"+source[index++]}else{octal=false;++index;number=""}while(index<length){if(!isOctalDigit(source[index])){break}number+=source[index++]}if(!octal&&number.length===0){throwUnexpectedToken()}if(isIdentifierStart(source.charCodeAt(index))||isDecimalDigit(source.charCodeAt(index))){throwUnexpectedToken()}return{type:Token.NumericLiteral,value:parseInt(number,8),octal:octal,lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}function isImplicitOctalLiteral(){var i,ch;for(i=index+1;i<length;++i){ch=source[i];if(ch==="8"||ch==="9"){return false}if(!isOctalDigit(ch)){return true}}return true}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(ch==="b"||ch==="B"){++index;return scanBinaryLiteral(start)}if(ch==="o"||ch==="O"){return scanOctalLiteral(ch,start)}if(isOctalDigit(ch)){if(isImplicitOctalLiteral()){return scanOctalLiteral(ch,start)}}}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{throwUnexpectedToken()}}if(isIdentifierStart(source.charCodeAt(index))){throwUnexpectedToken()}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":if(source[index]==="{"){++index;str+=scanUnicodeCodePointEscape()}else{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!==""){throwUnexpectedToken()}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 tmp=pattern,value;if(flags.indexOf("u")>=0){tmp=tmp.replace(/\\u\{([0-9a-fA-F]+)\}/g,function($0,$1){if(parseInt($1,16)<=1114111){return"x"}throwError(Messages.InvalidRegExp)}).replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,"x")}try{value=new RegExp(tmp)}catch(e){throwError(Messages.InvalidRegExp)}try{return new RegExp(pattern,flags)}catch(exception){return null}}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"}tolerateUnexpectedToken()}else{str+="\\";tolerateUnexpectedToken()}}else{flags+=ch;str+=ch}}return{value:flags,literal:str}}function scanRegExp(){var start,body,flags,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,regex:{pattern:body.value,flags:flags.value},lineNumber:lineNumber,lineStart:lineStart,start:start,end:index}}return{literal:body.literal+flags.literal,value:value,regex:{pattern:body.value,flags:flags.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,regex:regex.regex,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"&&prevToken.value!=="this"){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,value,entry;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);entry={type:TokenName[token.type],value:value,range:[token.start,token.end],loc:loc};if(token.regex){entry.regex={pattern:token.regex.pattern,flags:token.regex.flags}}extra.tokens.push(entry)}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(){this.line=lineNumber;this.column=index-lineStart}function SourceLocation(){this.start=new Position;this.end=null}function WrappingSourceLocation(startToken){if(startToken.type===Token.StringLiteral){this.start={line:startToken.startLineNumber,column:startToken.start-startToken.startLineStart}}else{this.start={line:startToken.lineNumber,column:startToken.start-startToken.lineStart}}this.end=null}function Node(){index=lookahead.start;if(lookahead.type===Token.StringLiteral){lineNumber=lookahead.startLineNumber;lineStart=lookahead.startLineStart}else{lineNumber=lookahead.lineNumber;lineStart=lookahead.lineStart}if(extra.range){this.range=[index,0]}if(extra.loc){this.loc=new SourceLocation}}function WrappingNode(startToken){if(extra.range){this.range=[startToken.start,0]}if(extra.loc){this.loc=new WrappingSourceLocation(startToken)}}WrappingNode.prototype=Node.prototype={processComment:function(){var lastChild,leadingComments,trailingComments,bottomRight=extra.bottomRightStack,i,comment,last=bottomRight[bottomRight.length-1];if(this.type===Syntax.Program){if(this.body.length>0){return}}if(extra.trailingComments.length>0){trailingComments=[];for(i=extra.trailingComments.length-1;i>=0;--i){comment=extra.trailingComments[i];if(comment.range[0]>=this.range[1]){trailingComments.unshift(comment);extra.trailingComments.splice(i,1)}}extra.trailingComments=[]}else{if(last&&last.trailingComments&&last.trailingComments[0].range[0]>=this.range[1]){trailingComments=last.trailingComments;delete last.trailingComments}}if(last){while(last&&last.range[0]>=this.range[0]){lastChild=last;last=bottomRight.pop()}}if(lastChild){if(lastChild.leadingComments&&lastChild.leadingComments[lastChild.leadingComments.length-1].range[1]<=this.range[0]){this.leadingComments=lastChild.leadingComments;lastChild.leadingComments=undefined}}else if(extra.leadingComments.length>0){leadingComments=[];for(i=extra.leadingComments.length-1;i>=0;--i){comment=extra.leadingComments[i];if(comment.range[1]<=this.range[0]){leadingComments.unshift(comment);extra.leadingComments.splice(i,1)}}}if(leadingComments&&leadingComments.length>0){this.leadingComments=leadingComments}if(trailingComments&&trailingComments.length>0){this.trailingComments=trailingComments}bottomRight.push(this)},finish:function(){if(extra.range){this.range[1]=index}if(extra.loc){this.loc.end=new Position;if(extra.source){this.loc.source=extra.source}}if(extra.attachComment){this.processComment()}},finishArrayExpression:function(elements){this.type=Syntax.ArrayExpression;this.elements=elements;this.finish();return this},finishArrowFunctionExpression:function(params,defaults,body,expression){this.type=Syntax.ArrowFunctionExpression;this.id=null;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=expression;this.finish();return this},finishAssignmentExpression:function(operator,left,right){this.type=Syntax.AssignmentExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishBinaryExpression:function(operator,left,right){this.type=operator==="||"||operator==="&&"?Syntax.LogicalExpression:Syntax.BinaryExpression;this.operator=operator;this.left=left;this.right=right;this.finish();return this},finishBlockStatement:function(body){this.type=Syntax.BlockStatement;this.body=body;this.finish();return this},finishBreakStatement:function(label){this.type=Syntax.BreakStatement;this.label=label;this.finish();return this},finishCallExpression:function(callee,args){this.type=Syntax.CallExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishCatchClause:function(param,body){this.type=Syntax.CatchClause;this.param=param;this.body=body;this.finish();return this},finishConditionalExpression:function(test,consequent,alternate){this.type=Syntax.ConditionalExpression;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishContinueStatement:function(label){this.type=Syntax.ContinueStatement;this.label=label;this.finish();return this},finishDebuggerStatement:function(){this.type=Syntax.DebuggerStatement;this.finish();return this},finishDoWhileStatement:function(body,test){this.type=Syntax.DoWhileStatement;this.body=body;this.test=test;this.finish();return this},finishEmptyStatement:function(){this.type=Syntax.EmptyStatement;this.finish();return this},finishExpressionStatement:function(expression){this.type=Syntax.ExpressionStatement;this.expression=expression;this.finish();return this},finishForStatement:function(init,test,update,body){this.type=Syntax.ForStatement;this.init=init;this.test=test;this.update=update;this.body=body;this.finish();return this},finishForInStatement:function(left,right,body){this.type=Syntax.ForInStatement;this.left=left;this.right=right;this.body=body;this.each=false;this.finish();return this},finishFunctionDeclaration:function(id,params,defaults,body){this.type=Syntax.FunctionDeclaration;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=false;this.finish();return this},finishFunctionExpression:function(id,params,defaults,body){this.type=Syntax.FunctionExpression;this.id=id;this.params=params;this.defaults=defaults;this.body=body;this.rest=null;this.generator=false;this.expression=false;this.finish();return this},finishIdentifier:function(name){this.type=Syntax.Identifier;this.name=name;this.finish();return this},finishIfStatement:function(test,consequent,alternate){this.type=Syntax.IfStatement;this.test=test;this.consequent=consequent;this.alternate=alternate;this.finish();return this},finishLabeledStatement:function(label,body){this.type=Syntax.LabeledStatement;this.label=label;this.body=body;this.finish();return this},finishLiteral:function(token){this.type=Syntax.Literal;this.value=token.value;this.raw=source.slice(token.start,token.end);if(token.regex){this.regex=token.regex}this.finish();return this},finishMemberExpression:function(accessor,object,property){this.type=Syntax.MemberExpression;this.computed=accessor==="[";this.object=object;this.property=property;this.finish();return this},finishNewExpression:function(callee,args){this.type=Syntax.NewExpression;this.callee=callee;this.arguments=args;this.finish();return this},finishObjectExpression:function(properties){this.type=Syntax.ObjectExpression;this.properties=properties;this.finish();return this},finishPostfixExpression:function(operator,argument){this.type=Syntax.UpdateExpression;this.operator=operator;this.argument=argument;this.prefix=false;this.finish();return this},finishProgram:function(body){this.type=Syntax.Program;this.body=body;this.finish();return this},finishProperty:function(kind,key,value,method,shorthand){this.type=Syntax.Property;this.key=key;this.value=value;this.kind=kind;this.method=method;this.shorthand=shorthand;this.finish();return this},finishReturnStatement:function(argument){this.type=Syntax.ReturnStatement;this.argument=argument;this.finish();return this},finishSequenceExpression:function(expressions){this.type=Syntax.SequenceExpression;this.expressions=expressions;this.finish();return this},finishSwitchCase:function(test,consequent){this.type=Syntax.SwitchCase;this.test=test;this.consequent=consequent;this.finish();return this},finishSwitchStatement:function(discriminant,cases){this.type=Syntax.SwitchStatement;this.discriminant=discriminant;this.cases=cases;this.finish();return this},finishThisExpression:function(){this.type=Syntax.ThisExpression;this.finish();return this},finishThrowStatement:function(argument){this.type=Syntax.ThrowStatement;this.argument=argument;this.finish();return this},finishTryStatement:function(block,guardedHandlers,handlers,finalizer){this.type=Syntax.TryStatement;this.block=block;this.guardedHandlers=guardedHandlers;this.handlers=handlers;this.finalizer=finalizer;this.finish();return this},finishUnaryExpression:function(operator,argument){this.type=operator==="++"||operator==="--"?Syntax.UpdateExpression:Syntax.UnaryExpression;this.operator=operator;this.argument=argument;this.prefix=true;this.finish();return this},finishVariableDeclaration:function(declarations,kind){this.type=Syntax.VariableDeclaration;this.declarations=declarations;this.kind=kind;this.finish();return this},finishVariableDeclarator:function(id,init){this.type=Syntax.VariableDeclarator;this.id=id;this.init=init;this.finish();return this},finishWhileStatement:function(test,body){this.type=Syntax.WhileStatement;this.test=test;this.body=body;this.finish();return this},finishWithStatement:function(object,body){this.type=Syntax.WithStatement;this.object=object;this.body=body;this.finish();return this}};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 createError(line,pos,description){var error=new Error("Line "+line+": "+description);error.index=pos;error.lineNumber=line;error.column=pos-lineStart+1;error.description=description;return error}function throwError(messageFormat){var args,msg;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});throw createError(lineNumber,index,msg)}function tolerateError(messageFormat){var args,msg,error;args=Array.prototype.slice.call(arguments,1);msg=messageFormat.replace(/%(\d)/g,function(whole,idx){assert(idx<args.length,"Message reference must be in range");return args[idx]});error=createError(lineNumber,index,msg);if(extra.errors){extra.errors.push(error)}else{throw error}}function unexpectedTokenError(token,message){var msg=Messages.UnexpectedToken;if(token){msg=message?message:token.type===Token.EOF?Messages.UnexpectedEOS:token.type===Token.Identifier?Messages.UnexpectedIdentifier:token.type===Token.NumericLiteral?Messages.UnexpectedNumber:token.type===Token.StringLiteral?Messages.UnexpectedString:Messages.UnexpectedToken;if(token.type===Token.Keyword){if(isFutureReservedWord(token.value)){msg=Messages.UnexpectedReserved}else if(strict&&isStrictModeReservedWord(token.value)){msg=Messages.StrictReservedWord}}}msg=msg.replace("%0",token?token.value:"ILLEGAL");return token&&typeof token.lineNumber==="number"?createError(token.lineNumber,token.start,msg):createError(lineNumber,index,msg)}function throwUnexpectedToken(token,message){throw unexpectedTokenError(token,message)}function tolerateUnexpectedToken(token,message){var error=unexpectedTokenError(token,message);if(extra.errors){extra.errors.push(error)}else{throw error}}function expect(value){var token=lex();if(token.type!==Token.Punctuator||token.value!==value){throwUnexpectedToken(token)}}function expectCommaSeparator(){var token;if(extra.errors){token=lookahead;if(token.type===Token.Punctuator&&token.value===","){lex()}else if(token.type===Token.Punctuator&&token.value===";"){lex();tolerateUnexpectedToken(token)}else{tolerateUnexpectedToken(token,Messages.UnexpectedToken)}}else{expect(",")}}function expectKeyword(keyword){var token=lex();if(token.type!==Token.Keyword||token.value!==keyword){throwUnexpectedToken(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,oldIndex=index,oldLineNumber=lineNumber,oldLineStart=lineStart,oldLookahead=lookahead;if(source.charCodeAt(index)===59||match(";")){lex();return}line=lineNumber;skipComment();if(lineNumber!==line){index=oldIndex;lineNumber=oldLineNumber;lineStart=oldLineStart;lookahead=oldLookahead;return}if(lookahead.type!==Token.EOF&&!match("}")){throwUnexpectedToken(lookahead)}}function isLeftHandSide(expr){return expr.type===Syntax.Identifier||expr.type===Syntax.MemberExpression}function parseArrayInitialiser(){var elements=[],node=new Node;expect("[");while(!match("]")){if(match(",")){lex();elements.push(null)}else{elements.push(parseAssignmentExpression());if(!match("]")){expect(",")}}}lex();return node.finishArrayExpression(elements)}function parsePropertyFunction(param,first){var previousStrict,body,node=new Node;previousStrict=strict;body=parseFunctionSourceElements();if(first&&strict&&isRestrictedWord(param[0].name)){tolerateUnexpectedToken(first,Messages.StrictParamName)}strict=previousStrict;return node.finishFunctionExpression(null,param,[],body)}function parsePropertyMethodFunction(){var previousStrict,param,method;previousStrict=strict;strict=true;param=parseParams();method=parsePropertyFunction(param.params);strict=previousStrict;return method}function parseObjectPropertyKey(){var token,node=new Node;token=lex();if(token.type===Token.StringLiteral||token.type===Token.NumericLiteral){if(strict&&token.octal){tolerateUnexpectedToken(token,Messages.StrictOctalLiteral)}return node.finishLiteral(token)}return node.finishIdentifier(token.value)}function parseObjectProperty(){var token,key,id,value,param,node=new Node;token=lookahead;if(token.type===Token.Identifier){id=parseObjectPropertyKey();if(token.value==="get"&&!(match(":")||match("("))){key=parseObjectPropertyKey();expect("(");expect(")");value=parsePropertyFunction([]);return node.finishProperty("get",key,value,false,false)}if(token.value==="set"&&!(match(":")||match("("))){key=parseObjectPropertyKey();expect("(");token=lookahead;if(token.type!==Token.Identifier){expect(")");tolerateUnexpectedToken(token);value=parsePropertyFunction([])}else{param=[parseVariableIdentifier()];expect(")");value=parsePropertyFunction(param,token)}return node.finishProperty("set",key,value,false,false)}if(match(":")){lex();value=parseAssignmentExpression();return node.finishProperty("init",id,value,false,false)}if(match("(")){value=parsePropertyMethodFunction();return node.finishProperty("init",id,value,true,false)}value=id;return node.finishProperty("init",id,value,false,true)}if(token.type===Token.EOF||token.type===Token.Punctuator){throwUnexpectedToken(token)}else{key=parseObjectPropertyKey();if(match(":")){lex();value=parseAssignmentExpression();return node.finishProperty("init",key,value,false,false)}if(match("(")){value=parsePropertyMethodFunction();return node.finishProperty("init",key,value,true,false)}throwUnexpectedToken(lex())}}function parseObjectInitialiser(){var properties=[],property,name,key,kind,map={},toString=String,node=new Node;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){tolerateError(Messages.StrictDuplicateProperty)}else if(kind!==PropertyKind.Data){tolerateError(Messages.AccessorDataProperty)}}else{if(kind===PropertyKind.Data){tolerateError(Messages.AccessorDataProperty)}else if(map[key]&kind){tolerateError(Messages.AccessorGetSet)}}map[key]|=kind}else{map[key]=kind}properties.push(property);if(!match("}")){expectCommaSeparator()}}expect("}");return node.finishObjectExpression(properties)}function parseGroupExpression(){var expr;expect("(");if(match(")")){lex();return PlaceHolders.ArrowParameterPlaceHolder}++state.parenthesisCount;expr=parseExpression();expect(")");return expr}function parsePrimaryExpression(){var type,token,expr,node;if(match("(")){return parseGroupExpression()}if(match("[")){return parseArrayInitialiser()}if(match("{")){return parseObjectInitialiser()}type=lookahead.type;node=new Node;if(type===Token.Identifier){expr=node.finishIdentifier(lex().value)}else if(type===Token.StringLiteral||type===Token.NumericLiteral){if(strict&&lookahead.octal){tolerateUnexpectedToken(lookahead,Messages.StrictOctalLiteral)}expr=node.finishLiteral(lex())}else if(type===Token.Keyword){if(matchKeyword("function")){return parseFunctionExpression()}if(matchKeyword("this")){lex();expr=node.finishThisExpression()}else{throwUnexpectedToken(lex())}}else if(type===Token.BooleanLiteral){token=lex();token.value=token.value==="true";expr=node.finishLiteral(token)}else if(type===Token.NullLiteral){token=lex();token.value=null;expr=node.finishLiteral(token)}else if(match("/")||match("/=")){if(typeof extra.tokens!=="undefined"){expr=node.finishLiteral(collectRegex())}else{expr=node.finishLiteral(scanRegExp())}peek()}else{throwUnexpectedToken(lex())}return expr}function parseArguments(){var args=[];expect("(");if(!match(")")){while(index<length){args.push(parseAssignmentExpression());if(match(")")){break}expectCommaSeparator()}}expect(")");return args}function parseNonComputedProperty(){var token,node=new Node;token=lex();if(!isIdentifierName(token)){throwUnexpectedToken(token)}return node.finishIdentifier(token.value)}function parseNonComputedMember(){expect(".");return parseNonComputedProperty()}function parseComputedMember(){var expr;expect("[");expr=parseExpression();expect("]");return expr}function parseNewExpression(){var callee,args,node=new Node;expectKeyword("new");callee=parseLeftHandSideExpression();args=match("(")?parseArguments():[];return node.finishNewExpression(callee,args)}function parseLeftHandSideExpressionAllowCall(){var expr,args,property,startToken,previousAllowIn=state.allowIn;startToken=lookahead;state.allowIn=true;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();for(;;){if(match(".")){property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else if(match("(")){args=parseArguments();expr=new WrappingNode(startToken).finishCallExpression(expr,args)}else if(match("[")){property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else{break}}state.allowIn=previousAllowIn;return expr}function parseLeftHandSideExpression(){var expr,property,startToken;assert(state.allowIn,"callee of new expression always allow in keyword.");startToken=lookahead;expr=matchKeyword("new")?parseNewExpression():parsePrimaryExpression();for(;;){if(match("[")){property=parseComputedMember();expr=new WrappingNode(startToken).finishMemberExpression("[",expr,property)}else if(match(".")){property=parseNonComputedMember();expr=new WrappingNode(startToken).finishMemberExpression(".",expr,property)}else{break}}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)){tolerateError(Messages.StrictLHSPostfix)}if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}token=lex();expr=new WrappingNode(startToken).finishPostfixExpression(token.value,expr)}}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)){tolerateError(Messages.StrictLHSPrefix)}if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr)}else if(match("+")||match("-")||match("~")||match("!")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr)}else if(matchKeyword("delete")||matchKeyword("void")||matchKeyword("typeof")){startToken=lookahead;token=lex();expr=parseUnaryExpression();expr=new WrappingNode(startToken).finishUnaryExpression(token.value,expr);if(strict&&expr.operator==="delete"&&expr.argument.type===Syntax.Identifier){tolerateError(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();if(left===PlaceHolders.ArrowParameterPlaceHolder){return left}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();markers.pop();expr=new WrappingNode(markers[markers.length-1]).finishBinaryExpression(operator,left,right);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=new WrappingNode(markers.pop()).finishBinaryExpression(stack[i-1].value,stack[i-2],expr);i-=2}return expr}function parseConditionalExpression(){var expr,previousAllowIn,consequent,alternate,startToken;startToken=lookahead;expr=parseBinaryExpression();if(expr===PlaceHolders.ArrowParameterPlaceHolder){return expr}if(match("?")){lex();previousAllowIn=state.allowIn;state.allowIn=true;consequent=parseAssignmentExpression();state.allowIn=previousAllowIn;expect(":");alternate=parseAssignmentExpression();expr=new WrappingNode(startToken).finishConditionalExpression(expr,consequent,alternate)}return expr}function parseConciseBody(){if(match("{")){return parseFunctionSourceElements()}return parseAssignmentExpression()}function reinterpretAsCoverFormalsList(expressions){var i,len,param,params,defaults,defaultCount,options,rest,token;params=[];defaults=[];defaultCount=0;rest=null;options={paramSet:{}};for(i=0,len=expressions.length;i<len;i+=1){param=expressions[i];if(param.type===Syntax.Identifier){params.push(param);defaults.push(null);validateParam(options,param,param.name)}else if(param.type===Syntax.AssignmentExpression){params.push(param.left);defaults.push(param.right);++defaultCount;validateParam(options,param.left,param.left.name)}else{return null}}if(options.message===Messages.StrictParamDupe){token=strict?options.stricted:options.firstRestricted;throwUnexpectedToken(token,options.message)}if(defaultCount===0){defaults=[]}return{params:params,defaults:defaults,rest:rest,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseArrowFunctionExpression(options,node){var previousStrict,body;expect("=>");previousStrict=strict;body=parseConciseBody();if(strict&&options.firstRestricted){throwUnexpectedToken(options.firstRestricted,options.message)}if(strict&&options.stricted){tolerateUnexpectedToken(options.stricted,options.message)}strict=previousStrict;return node.finishArrowFunctionExpression(options.params,options.defaults,body,body.type!==Syntax.BlockStatement)}function parseAssignmentExpression(){var oldParenthesisCount,token,expr,right,list,startToken;oldParenthesisCount=state.parenthesisCount;startToken=lookahead;token=lookahead;expr=parseConditionalExpression();if(expr===PlaceHolders.ArrowParameterPlaceHolder||match("=>")){if(state.parenthesisCount===oldParenthesisCount||state.parenthesisCount===oldParenthesisCount+1){if(expr.type===Syntax.Identifier){list=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.AssignmentExpression){list=reinterpretAsCoverFormalsList([expr])}else if(expr.type===Syntax.SequenceExpression){list=reinterpretAsCoverFormalsList(expr.expressions)}else if(expr===PlaceHolders.ArrowParameterPlaceHolder){list=reinterpretAsCoverFormalsList([])}if(list){return parseArrowFunctionExpression(list,new WrappingNode(startToken))}}}if(matchAssign()){if(!isLeftHandSide(expr)){tolerateError(Messages.InvalidLHSInAssignment)}if(strict&&expr.type===Syntax.Identifier&&isRestrictedWord(expr.name)){tolerateUnexpectedToken(token,Messages.StrictLHSAssignment)}token=lex();right=parseAssignmentExpression();expr=new WrappingNode(startToken).finishAssignmentExpression(token.value,expr,right)}return expr}function parseExpression(){var expr,startToken=lookahead,expressions;expr=parseAssignmentExpression();if(match(",")){expressions=[expr];while(index<length){if(!match(",")){break}lex();expressions.push(parseAssignmentExpression())}expr=new WrappingNode(startToken).finishSequenceExpression(expressions)}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,node=new Node;expect("{");block=parseStatementList();expect("}");return node.finishBlockStatement(block)}function parseVariableIdentifier(){var token,node=new Node;token=lex();if(token.type!==Token.Identifier){if(strict&&token.type===Token.Keyword&&isStrictModeReservedWord(token.value)){tolerateUnexpectedToken(token,Messages.StrictReservedWord)}else{throwUnexpectedToken(token)}}return node.finishIdentifier(token.value)}function parseVariableDeclaration(kind){var init=null,id,node=new Node;id=parseVariableIdentifier();if(strict&&isRestrictedWord(id.name)){tolerateError(Messages.StrictVarName)}if(kind==="const"){expect("=");init=parseAssignmentExpression()}else if(match("=")){lex();init=parseAssignmentExpression()}return node.finishVariableDeclarator(id,init)}function parseVariableDeclarationList(kind){var list=[];do{list.push(parseVariableDeclaration(kind));if(!match(",")){break}lex()}while(index<length);return list}function parseVariableStatement(node){var declarations;expectKeyword("var");declarations=parseVariableDeclarationList();consumeSemicolon();return node.finishVariableDeclaration(declarations,"var")}function parseConstLetDeclaration(kind){var declarations,node=new Node;expectKeyword(kind);declarations=parseVariableDeclarationList(kind);consumeSemicolon();return node.finishVariableDeclaration(declarations,kind)}function parseEmptyStatement(){var node=new Node;expect(";");return node.finishEmptyStatement()}function parseExpressionStatement(node){var expr=parseExpression();consumeSemicolon();return node.finishExpressionStatement(expr)}function parseIfStatement(node){var test,consequent,alternate;expectKeyword("if");expect("(");test=parseExpression();expect(")");consequent=parseStatement();if(matchKeyword("else")){lex();alternate=parseStatement()}else{alternate=null}return node.finishIfStatement(test,consequent,alternate)}function parseDoWhileStatement(node){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 node.finishDoWhileStatement(body,test)}function parseWhileStatement(node){var test,body,oldInIteration;expectKeyword("while");expect("(");test=parseExpression();expect(")");oldInIteration=state.inIteration;state.inIteration=true;body=parseStatement();state.inIteration=oldInIteration;return node.finishWhileStatement(test,body)}function parseForVariableDeclaration(){var token,declarations,node=new Node;token=lex();declarations=parseVariableDeclarationList();return node.finishVariableDeclaration(declarations,token.value)}function parseForStatement(node){var init,test,update,left,right,body,oldInIteration,previousAllowIn=state.allowIn;init=test=update=null;expectKeyword("for");expect("(");if(match(";")){lex()}else{if(matchKeyword("var")||matchKeyword("let")){state.allowIn=false;init=parseForVariableDeclaration();state.allowIn=previousAllowIn;if(init.declarations.length===1&&matchKeyword("in")){lex();left=init;right=parseExpression();init=null}}else{state.allowIn=false;init=parseExpression();state.allowIn=previousAllowIn;if(matchKeyword("in")){if(!isLeftHandSide(init)){tolerateError(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"?node.finishForStatement(init,test,update,body):node.finishForInStatement(left,right,body)}function parseContinueStatement(node){var label=null,key;expectKeyword("continue");if(source.charCodeAt(index)===59){lex();if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(null)}if(peekLineTerminator()){if(!state.inIteration){throwError(Messages.IllegalContinue)}return node.finishContinueStatement(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 node.finishContinueStatement(label)}function parseBreakStatement(node){var label=null,key;expectKeyword("break");if(source.charCodeAt(index)===59){lex();if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(null)}if(peekLineTerminator()){if(!(state.inIteration||state.inSwitch)){throwError(Messages.IllegalBreak)}return node.finishBreakStatement(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 node.finishBreakStatement(label)}function parseReturnStatement(node){var argument=null;expectKeyword("return");if(!state.inFunctionBody){tolerateError(Messages.IllegalReturn)}if(source.charCodeAt(index)===32){if(isIdentifierStart(source.charCodeAt(index+1))){argument=parseExpression();consumeSemicolon();return node.finishReturnStatement(argument)}}if(peekLineTerminator()){return node.finishReturnStatement(null)}if(!match(";")){if(!match("}")&&lookahead.type!==Token.EOF){argument=parseExpression()}}consumeSemicolon();return node.finishReturnStatement(argument)}function parseWithStatement(node){var object,body;if(strict){skipComment();tolerateError(Messages.StrictModeWith)}expectKeyword("with");expect("(");object=parseExpression();expect(")");body=parseStatement();return node.finishWithStatement(object,body)}function parseSwitchCase(){var test,consequent=[],statement,node=new Node;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 node.finishSwitchCase(test,consequent)}function parseSwitchStatement(node){var discriminant,cases,clause,oldInSwitch,defaultFound;expectKeyword("switch");expect("(");discriminant=parseExpression();expect(")");expect("{");cases=[];if(match("}")){lex();return node.finishSwitchStatement(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 node.finishSwitchStatement(discriminant,cases)}function parseThrowStatement(node){var argument;expectKeyword("throw");if(peekLineTerminator()){throwError(Messages.NewlineAfterThrow)}argument=parseExpression();consumeSemicolon();return node.finishThrowStatement(argument)}function parseCatchClause(){var param,body,node=new Node;expectKeyword("catch");expect("(");if(match(")")){throwUnexpectedToken(lookahead)}param=parseVariableIdentifier();if(strict&&isRestrictedWord(param.name)){tolerateError(Messages.StrictCatchVariable)}expect(")");body=parseBlock();return node.finishCatchClause(param,body)}function parseTryStatement(node){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 node.finishTryStatement(block,[],handlers,finalizer)}function parseDebuggerStatement(node){expectKeyword("debugger");consumeSemicolon();return node.finishDebuggerStatement()}function parseStatement(){var type=lookahead.type,expr,labeledBody,key,node;if(type===Token.EOF){throwUnexpectedToken(lookahead)}if(type===Token.Punctuator&&lookahead.value==="{"){return parseBlock()}node=new Node;if(type===Token.Punctuator){switch(lookahead.value){case";":return parseEmptyStatement(node);case"(":return parseExpressionStatement(node);default:break}}else if(type===Token.Keyword){switch(lookahead.value){case"break":return parseBreakStatement(node);case"continue":return parseContinueStatement(node);case"debugger":return parseDebuggerStatement(node);case"do":return parseDoWhileStatement(node);case"for":return parseForStatement(node);case"function":return parseFunctionDeclaration(node);case"if":return parseIfStatement(node);case"return":return parseReturnStatement(node);case"switch":return parseSwitchStatement(node);case"throw":return parseThrowStatement(node);case"try":return parseTryStatement(node);case"var":return parseVariableStatement(node);case"while":return parseWhileStatement(node);case"with":return parseWithStatement(node);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 node.finishLabeledStatement(expr,labeledBody)}consumeSemicolon();return node.finishExpressionStatement(expr)}function parseFunctionSourceElements(){var sourceElement,sourceElements=[],token,directive,firstRestricted,oldLabelSet,oldInIteration,oldInSwitch,oldInFunctionBody,oldParenthesisCount,node=new Node;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){tolerateUnexpectedToken(firstRestricted,Messages.StrictOctalLiteral)}}else{if(!firstRestricted&&token.octal){firstRestricted=token}}}oldLabelSet=state.labelSet;oldInIteration=state.inIteration;oldInSwitch=state.inSwitch;oldInFunctionBody=state.inFunctionBody;oldParenthesisCount=state.parenthesizedCount;state.labelSet={};state.inIteration=false;state.inSwitch=false;state.inFunctionBody=true;state.parenthesizedCount=0;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;state.parenthesizedCount=oldParenthesisCount;return node.finishBlockStatement(sourceElements)}function validateParam(options,param,name){var key="$"+name;if(strict){if(isRestrictedWord(name)){options.stricted=param;options.message=Messages.StrictParamName}if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.stricted=param;options.message=Messages.StrictParamDupe}}else if(!options.firstRestricted){if(isRestrictedWord(name)){options.firstRestricted=param;options.message=Messages.StrictParamName}else if(isStrictModeReservedWord(name)){options.firstRestricted=param;options.message=Messages.StrictReservedWord}else if(Object.prototype.hasOwnProperty.call(options.paramSet,key)){options.firstRestricted=param;options.message=Messages.StrictParamDupe}}options.paramSet[key]=true}function parseParam(options){var token,param,def;token=lookahead;param=parseVariableIdentifier();validateParam(options,token,token.value);if(match("=")){lex();def=parseAssignmentExpression();++options.defaultCount}options.params.push(param);options.defaults.push(def);return!match(")")}function parseParams(firstRestricted){var options;options={params:[],defaultCount:0,defaults:[],firstRestricted:firstRestricted};expect("(");if(!match(")")){options.paramSet={};while(index<length){if(!parseParam(options)){break}expect(",")}}expect(")");if(options.defaultCount===0){options.defaults=[]}return{params:options.params,defaults:options.defaults,stricted:options.stricted,firstRestricted:options.firstRestricted,message:options.message}}function parseFunctionDeclaration(){var id,params=[],defaults=[],body,token,stricted,tmp,firstRestricted,message,previousStrict,node=new Node;expectKeyword("function");token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(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;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionDeclaration(id,params,defaults,body)}function parseFunctionExpression(){var token,id=null,stricted,firstRestricted,message,tmp,params=[],defaults=[],body,previousStrict,node=new Node;expectKeyword("function");if(!match("(")){token=lookahead;id=parseVariableIdentifier();if(strict){if(isRestrictedWord(token.value)){tolerateUnexpectedToken(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;defaults=tmp.defaults;stricted=tmp.stricted;firstRestricted=tmp.firstRestricted;if(tmp.message){message=tmp.message}previousStrict=strict;body=parseFunctionSourceElements();if(strict&&firstRestricted){throwUnexpectedToken(firstRestricted,message)}if(strict&&stricted){tolerateUnexpectedToken(stricted,message)}strict=previousStrict;return node.finishFunctionExpression(id,params,defaults,body)}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){tolerateUnexpectedToken(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,node;skipComment();peek();node=new Node;strict=false;body=parseSourceElements();return node.finishProgram(body)}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(entry.regex){token.regex={pattern:entry.regex.pattern,flags:entry.regex.flags}}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,tokens;toString=String;if(typeof code!=="string"&&!(code instanceof String)){code=toString(code)}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}lex();while(lookahead.type!==Token.EOF){try{lex()}catch(lexError){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)}source=code;index=0;lineNumber=source.length>0?1:0;lineStart=0;length=source.length;lookahead=null;state={allowIn:true,labelSet:{},parenthesisCount:0,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="2.0.0";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}()})},{}],4:[function(require,module,exports){function get_beautify(js_beautify,css_beautify,html_beautify){var beautify=function(src,config){return js_beautify.js_beautify(src,config)};beautify.js=js_beautify.js_beautify;beautify.css=css_beautify.css_beautify;beautify.html=html_beautify.html_beautify;beautify.js_beautify=js_beautify.js_beautify;beautify.css_beautify=css_beautify.css_beautify;beautify.html_beautify=html_beautify.html_beautify;return beautify}if(typeof define==="function"&&define.amd){define(["./lib/beautify","./lib/beautify-css","./lib/beautify-html"],function(js_beautify,css_beautify,html_beautify){return get_beautify(js_beautify,css_beautify,html_beautify)})}else{(function(mod){var js_beautify=require("./lib/beautify");var css_beautify=require("./lib/beautify-css");var html_beautify=require("./lib/beautify-html");mod.exports=get_beautify(js_beautify,css_beautify,html_beautify)})(module)}},{"./lib/beautify":7,"./lib/beautify-css":5,"./lib/beautify-html":6}],5:[function(require,module,exports){(function(global){(function(){function css_beautify(source_text,options){options=options||{};var indentSize=options.indent_size||4;var indentCharacter=options.indent_char||" ";var selectorSeparatorNewline=options.selector_separator_newline===undefined?true:options.selector_separator_newline;var end_with_newline=options.end_with_newline===undefined?false:options.end_with_newline;if(typeof indentSize==="string"){indentSize=parseInt(indentSize,10)}var whiteRe=/^\s+$/;var wordRe=/[\w$\-_]/;var pos=-1,ch;function next(){ch=source_text.charAt(++pos);return ch||""}function peek(skipWhitespace){var prev_pos=pos;if(skipWhitespace){eatWhitespace()}result=source_text.charAt(pos+1)||"";pos=prev_pos-1;next();return result}function eatString(endChars){var start=pos;while(next()){if(ch==="\\"){next()}else if(endChars.indexOf(ch)!==-1){break}else if(ch==="\n"){break}}return source_text.substring(start,pos+1)}function peekString(endChar){var prev_pos=pos;var str=eatString(endChar);pos=prev_pos-1;next();return str}function eatWhitespace(){var result="";while(whiteRe.test(peek())){next();result+=ch}return result}function skipWhitespace(){var result="";if(ch&&whiteRe.test(ch)){result=ch}while(whiteRe.test(next())){result+=ch}return result}function eatComment(singleLine){var start=pos;var singleLine=peek()==="/";next();while(next()){if(!singleLine&&ch==="*"&&peek()==="/"){next();break}else if(singleLine&&ch==="\n"){return source_text.substring(start,pos)}}return source_text.substring(start,pos)+ch}function lookBack(str){return source_text.substring(pos-str.length,pos).toLowerCase()===str}function foundNestedPseudoClass(){for(var i=pos+1;i<source_text.length;i++){var ch=source_text.charAt(i);if(ch==="{"){return true}else if(ch===";"||ch==="}"||ch===")"){return false}}return false}var basebaseIndentString=source_text.match(/^[\t ]*/)[0];var singleIndent=new Array(indentSize+1).join(indentCharacter);var indentLevel=0;var nestedLevel=0;function indent(){indentLevel++;basebaseIndentString+=singleIndent}function outdent(){indentLevel--;basebaseIndentString=basebaseIndentString.slice(0,-indentSize)}var print={};print["{"]=function(ch){print.singleSpace();output.push(ch);print.newLine()};print["}"]=function(ch){print.newLine();output.push(ch);print.newLine()};print._lastCharWhitespace=function(){return whiteRe.test(output[output.length-1])};print.newLine=function(keepWhitespace){if(!keepWhitespace){print.trim()}if(output.length){output.push("\n")}if(basebaseIndentString){output.push(basebaseIndentString)}};print.singleSpace=function(){if(output.length&&!print._lastCharWhitespace()){output.push(" ")}};print.trim=function(){while(print._lastCharWhitespace()){output.pop()}};var output=[];if(basebaseIndentString){output.push(basebaseIndentString)}var insideRule=false;var enteringConditionalGroup=false;var top_ch="";var last_top_ch="";while(true){var whitespace=skipWhitespace();var isAfterSpace=whitespace!=="";var isAfterNewline=whitespace.indexOf("\n")!==-1;var last_top_ch=top_ch;var top_ch=ch;if(!ch){break}else if(ch==="/"&&peek()==="*"){var header=lookBack("");print.newLine();output.push(eatComment());print.newLine();if(header){print.newLine(true)}}else if(ch==="/"&&peek()==="/"){if(!isAfterNewline&&last_top_ch!=="{"){print.trim()}print.singleSpace();output.push(eatComment());print.newLine()}else if(ch==="@"){if(isAfterSpace){print.singleSpace()}output.push(ch);var variableOrRule=peekString(": ,;{}()[]/='\"").replace(/\s$/,"");if(variableOrRule in css_beautify.NESTED_AT_RULE){nestedLevel+=1;if(variableOrRule in css_beautify.CONDITIONAL_GROUP_RULE){enteringConditionalGroup=true}}else if(": ".indexOf(variableOrRule[variableOrRule.length-1])>=0){next();variableOrRule=eatString(": ").replace(/\s$/,"");output.push(variableOrRule);print.singleSpace()}}else if(ch==="{"){if(peek(true)==="}"){eatWhitespace();next();print.singleSpace();output.push("{}")}else{indent();print["{"](ch);if(enteringConditionalGroup){enteringConditionalGroup=false;insideRule=indentLevel>nestedLevel}else{insideRule=indentLevel>=nestedLevel}}}else if(ch==="}"){outdent();print["}"](ch);insideRule=false;if(nestedLevel){nestedLevel--}}else if(ch===":"){eatWhitespace();if((insideRule||enteringConditionalGroup)&&!(lookBack("&")||foundNestedPseudoClass())){output.push(":");print.singleSpace()}else{if(peek()===":"){next();output.push("::")}else{output.push(":")}}}else if(ch==='"'||ch==="'"){if(isAfterSpace){print.singleSpace()}output.push(eatString(ch))}else if(ch===";"){output.push(ch);print.newLine()}else if(ch==="("){if(lookBack("url")){output.push(ch);eatWhitespace();if(next()){if(ch!==")"&&ch!=='"'&&ch!=="'"){output.push(eatString(")"))}else{pos--}}}else{if(isAfterSpace){print.singleSpace()}output.push(ch);eatWhitespace()}}else if(ch===")"){output.push(ch)}else if(ch===","){output.push(ch);eatWhitespace();if(!insideRule&&selectorSeparatorNewline){print.newLine()}else{print.singleSpace()}}else if(ch==="]"){output.push(ch)}else if(ch==="["){if(isAfterSpace){print.singleSpace()}output.push(ch)}else if(ch==="="){eatWhitespace();output.push(ch)}else{if(isAfterSpace){print.singleSpace()}output.push(ch)}}var sweetCode=output.join("").replace(/[\r\n\t ]+$/,"");if(end_with_newline){sweetCode+="\n"}return sweetCode}css_beautify.NESTED_AT_RULE={"@page":true,"@font-face":true,"@keyframes":true,"@media":true,"@supports":true,"@document":true};css_beautify.CONDITIONAL_GROUP_RULE={"@media":true,"@supports":true,"@document":true};if(typeof define==="function"&&define.amd){define([],function(){return{css_beautify:css_beautify}})}else if(typeof exports!=="undefined"){exports.css_beautify=css_beautify}else if(typeof window!=="undefined"){window.css_beautify=css_beautify}else if(typeof global!=="undefined"){global.css_beautify=css_beautify}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],6:[function(require,module,exports){(function(global){(function(){function trim(s){return s.replace(/^\s+|\s+$/g,"")}function ltrim(s){return s.replace(/^\s+/g,"")}function rtrim(s){return s.replace(/\s+$/g,"")}function style_html(html_source,options,js_beautify,css_beautify){var multi_parser,indent_inner_html,indent_size,indent_character,wrap_line_length,brace_style,unformatted,preserve_newlines,max_preserve_newlines,indent_handlebars,end_with_newline;options=options||{};if((options.wrap_line_length===undefined||parseInt(options.wrap_line_length,10)===0)&&(options.max_char!==undefined&&parseInt(options.max_char,10)!==0)){options.wrap_line_length=options.max_char}indent_inner_html=options.indent_inner_html===undefined?false:options.indent_inner_html;indent_size=options.indent_size===undefined?4:parseInt(options.indent_size,10);indent_character=options.indent_char===undefined?" ":options.indent_char;brace_style=options.brace_style===undefined?"collapse":options.brace_style;wrap_line_length=parseInt(options.wrap_line_length,10)===0?32786:parseInt(options.wrap_line_length||250,10);unformatted=options.unformatted||["a","span","img","bdo","em","strong","dfn","code","samp","kbd","var","cite","abbr","acronym","q","sub","sup","tt","i","b","big","small","u","s","strike","font","ins","del","pre","address","dt","h1","h2","h3","h4","h5","h6"];preserve_newlines=options.preserve_newlines===undefined?true:options.preserve_newlines;max_preserve_newlines=preserve_newlines?isNaN(parseInt(options.max_preserve_newlines,10))?32786:parseInt(options.max_preserve_newlines,10):0;indent_handlebars=options.indent_handlebars===undefined?false:options.indent_handlebars;end_with_newline=options.end_with_newline===undefined?false:options.end_with_newline;function Parser(){this.pos=0;this.token="";this.current_mode="CONTENT";this.tags={parent:"parent1",parentcount:1,parent1:""};this.tag_type="";this.token_text=this.last_token=this.last_text=this.token_type="";this.newlines=0;this.indent_content=indent_inner_html;this.Utils={whitespace:"\n\r ".split(""),single_token:"br,input,link,meta,!doctype,basefont,base,area,hr,wbr,param,img,isindex,?xml,embed,?php,?,?=".split(","),extra_liners:"head,body,/html".split(","),in_array:function(what,arr){for(var i=0;i<arr.length;i++){if(what===arr[i]){return true}}return false}};this.is_whitespace=function(text){for(var n=0;n<text.length;text++){if(!this.Utils.in_array(text.charAt(n),this.Utils.whitespace)){return false}}return true};this.traverse_whitespace=function(){var input_char="";input_char=this.input.charAt(this.pos);if(this.Utils.in_array(input_char,this.Utils.whitespace)){this.newlines=0;while(this.Utils.in_array(input_char,this.Utils.whitespace)){if(preserve_newlines&&input_char==="\n"&&this.newlines<=max_preserve_newlines){this.newlines+=1}this.pos++;input_char=this.input.charAt(this.pos)}return true}return false};this.space_or_wrap=function(content){if(this.line_char_count>=this.wrap_line_length){this.print_newline(false,content);this.print_indentation(content)}else{this.line_char_count++;content.push(" ")}};this.get_content=function(){var input_char="",content=[],space=false;while(this.input.charAt(this.pos)!=="<"){if(this.pos>=this.input.length){return content.length?content.join(""):["","TK_EOF"]}if(this.traverse_whitespace()){this.space_or_wrap(content);continue}if(indent_handlebars){var peek3=this.input.substr(this.pos,3);if(peek3==="{{#"||peek3==="{{/"){break}else if(this.input.substr(this.pos,2)==="{{"){if(this.get_tag(true)==="{{else}}"){break}}}input_char=this.input.charAt(this.pos);this.pos++;this.line_char_count++;content.push(input_char)}return content.length?content.join(""):""};this.get_contents_to=function(name){if(this.pos===this.input.length){return["","TK_EOF"]}var input_char="";var content="";var reg_match=new RegExp("</"+name+"\\s*>","igm");reg_match.lastIndex=this.pos;var reg_array=reg_match.exec(this.input);var end_script=reg_array?reg_array.index:this.input.length;if(this.pos<end_script){content=this.input.substring(this.pos,end_script);this.pos=end_script}return content};this.record_tag=function(tag){if(this.tags[tag+"count"]){this.tags[tag+"count"]++;this.tags[tag+this.tags[tag+"count"]]=this.indent_level}else{this.tags[tag+"count"]=1;this.tags[tag+this.tags[tag+"count"]]=this.indent_level}this.tags[tag+this.tags[tag+"count"]+"parent"]=this.tags.parent;this.tags.parent=tag+this.tags[tag+"count"]};this.retrieve_tag=function(tag){if(this.tags[tag+"count"]){var temp_parent=this.tags.parent;while(temp_parent){if(tag+this.tags[tag+"count"]===temp_parent){break}temp_parent=this.tags[temp_parent+"parent"]}if(temp_parent){this.indent_level=this.tags[tag+this.tags[tag+"count"]];this.tags.parent=this.tags[temp_parent+"parent"]}delete this.tags[tag+this.tags[tag+"count"]+"parent"];delete this.tags[tag+this.tags[tag+"count"]];if(this.tags[tag+"count"]===1){delete this.tags[tag+"count"]}else{this.tags[tag+"count"]--}}};this.indent_to_tag=function(tag){if(!this.tags[tag+"count"]){return}var temp_parent=this.tags.parent;while(temp_parent){if(tag+this.tags[tag+"count"]===temp_parent){break}temp_parent=this.tags[temp_parent+"parent"]}if(temp_parent){this.indent_level=this.tags[tag+this.tags[tag+"count"]]}};this.get_tag=function(peek){var input_char="",content=[],comment="",space=false,tag_start,tag_end,tag_start_char,orig_pos=this.pos,orig_line_char_count=this.line_char_count;peek=peek!==undefined?peek:false;do{if(this.pos>=this.input.length){if(peek){this.pos=orig_pos;this.line_char_count=orig_line_char_count}return content.length?content.join(""):["","TK_EOF"]}input_char=this.input.charAt(this.pos);this.pos++;if(this.Utils.in_array(input_char,this.Utils.whitespace)){space=true;continue}if(input_char==="'"||input_char==='"'){input_char+=this.get_unformatted(input_char);space=true}if(input_char==="="){space=false}if(content.length&&content[content.length-1]!=="="&&input_char!==">"&&space){this.space_or_wrap(content);space=false}if(indent_handlebars&&tag_start_char==="<"){if(input_char+this.input.charAt(this.pos)==="{{"){input_char+=this.get_unformatted("}}");if(content.length&&content[content.length-1]!==" "&&content[content.length-1]!=="<"){input_char=" "+input_char}space=true}}if(input_char==="<"&&!tag_start_char){tag_start=this.pos-1;tag_start_char="<"}if(indent_handlebars&&!tag_start_char){if(content.length>=2&&content[content.length-1]==="{"&&content[content.length-2]=="{"){if(input_char==="#"||input_char==="/"){tag_start=this.pos-3}else{tag_start=this.pos-2}tag_start_char="{"}}this.line_char_count++;content.push(input_char);if(content[1]&&content[1]==="!"){content=[this.get_comment(tag_start)];break}if(indent_handlebars&&tag_start_char==="{"&&content.length>2&&content[content.length-2]==="}"&&content[content.length-1]==="}"){break}}while(input_char!==">");var tag_complete=content.join("");var tag_index;var tag_offset;if(tag_complete.indexOf(" ")!==-1){tag_index=tag_complete.indexOf(" ")}else if(tag_complete[0]==="{"){tag_index=tag_complete.indexOf("}")}else{tag_index=tag_complete.indexOf(">")}if(tag_complete[0]==="<"||!indent_handlebars){tag_offset=1}else{tag_offset=tag_complete[2]==="#"?3:2}var tag_check=tag_complete.substring(tag_offset,tag_index).toLowerCase();if(tag_complete.charAt(tag_complete.length-2)==="/"||this.Utils.in_array(tag_check,this.Utils.single_token)){if(!peek){this.tag_type="SINGLE"}}else if(indent_handlebars&&tag_complete[0]==="{"&&tag_check==="else"){if(!peek){this.indent_to_tag("if");this.tag_type="HANDLEBARS_ELSE";this.indent_content=true;this.traverse_whitespace()}}else if(this.is_unformatted(tag_check,unformatted)){comment=this.get_unformatted("</"+tag_check+">",tag_complete);content.push(comment);tag_end=this.pos-1;this.tag_type="SINGLE"}else if(tag_check==="script"&&(tag_complete.search("type")===-1||tag_complete.search("type")>-1&&tag_complete.search(/\b(text|application)\/(x-)?(javascript|ecmascript|jscript|livescript)/)>-1)){if(!peek){this.record_tag(tag_check);this.tag_type="SCRIPT"}}else if(tag_check==="style"&&(tag_complete.search("type")===-1||tag_complete.search("type")>-1&&tag_complete.search("text/css")>-1)){if(!peek){this.record_tag(tag_check);this.tag_type="STYLE"}}else if(tag_check.charAt(0)==="!"){if(!peek){this.tag_type="SINGLE";this.traverse_whitespace()}}else if(!peek){if(tag_check.charAt(0)==="/"){this.retrieve_tag(tag_check.substring(1));this.tag_type="END"}else{this.record_tag(tag_check);if(tag_check.toLowerCase()!=="html"){this.indent_content=true}this.tag_type="START"}if(this.traverse_whitespace()){this.space_or_wrap(content)}if(this.Utils.in_array(tag_check,this.Utils.extra_liners)){this.print_newline(false,this.output);if(this.output.length&&this.output[this.output.length-2]!=="\n"){this.print_newline(true,this.output)}}}if(peek){this.pos=orig_pos;this.line_char_count=orig_line_char_count}return content.join("")};this.get_comment=function(start_pos){var comment="",delimiter=">",matched=false;this.pos=start_pos;input_char=this.input.charAt(this.pos);this.pos++;while(this.pos<=this.input.length){comment+=input_char;if(comment[comment.length-1]===delimiter[delimiter.length-1]&&comment.indexOf(delimiter)!==-1){break}if(!matched&&comment.length<10){if(comment.indexOf("<![if")===0){delimiter="<![endif]>";matched=true}else if(comment.indexOf("<![cdata[")===0){delimiter="]]>";matched=true}else if(comment.indexOf("<![")===0){delimiter="]>";matched=true}else if(comment.indexOf("<!--")===0){delimiter="-->";matched=true}}input_char=this.input.charAt(this.pos);this.pos++}return comment};this.get_unformatted=function(delimiter,orig_tag){if(orig_tag&&orig_tag.toLowerCase().indexOf(delimiter)!==-1){return""}var input_char="";var content="";var min_index=0;var space=true;do{if(this.pos>=this.input.length){return content}input_char=this.input.charAt(this.pos);this.pos++;if(this.Utils.in_array(input_char,this.Utils.whitespace)){if(!space){this.line_char_count--; | |
continue}if(input_char==="\n"||input_char==="\r"){content+="\n";this.line_char_count=0;continue}}content+=input_char;this.line_char_count++;space=true;if(indent_handlebars&&input_char==="{"&&content.length&&content[content.length-2]==="{"){content+=this.get_unformatted("}}");min_index=content.length}}while(content.toLowerCase().indexOf(delimiter,min_index)===-1);return content};this.get_token=function(){var token;if(this.last_token==="TK_TAG_SCRIPT"||this.last_token==="TK_TAG_STYLE"){var type=this.last_token.substr(7);token=this.get_contents_to(type);if(typeof token!=="string"){return token}return[token,"TK_"+type]}if(this.current_mode==="CONTENT"){token=this.get_content();if(typeof token!=="string"){return token}else{return[token,"TK_CONTENT"]}}if(this.current_mode==="TAG"){token=this.get_tag();if(typeof token!=="string"){return token}else{var tag_name_type="TK_TAG_"+this.tag_type;return[token,tag_name_type]}}};this.get_full_indent=function(level){level=this.indent_level+level||0;if(level<1){return""}return Array(level+1).join(this.indent_string)};this.is_unformatted=function(tag_check,unformatted){if(!this.Utils.in_array(tag_check,unformatted)){return false}if(tag_check.toLowerCase()!=="a"||!this.Utils.in_array("a",unformatted)){return true}var next_tag=this.get_tag(true);var tag=(next_tag||"").match(/^\s*<\s*\/?([a-z]*)\s*[^>]*>\s*$/);if(!tag||this.Utils.in_array(tag,unformatted)){return true}else{return false}};this.printer=function(js_source,indent_character,indent_size,wrap_line_length,brace_style){this.input=js_source||"";this.output=[];this.indent_character=indent_character;this.indent_string="";this.indent_size=indent_size;this.brace_style=brace_style;this.indent_level=0;this.wrap_line_length=wrap_line_length;this.line_char_count=0;for(var i=0;i<this.indent_size;i++){this.indent_string+=this.indent_character}this.print_newline=function(force,arr){this.line_char_count=0;if(!arr||!arr.length){return}if(force||arr[arr.length-1]!=="\n"){if(arr[arr.length-1]!=="\n"){arr[arr.length-1]=rtrim(arr[arr.length-1])}arr.push("\n")}};this.print_indentation=function(arr){for(var i=0;i<this.indent_level;i++){arr.push(this.indent_string);this.line_char_count+=this.indent_string.length}};this.print_token=function(text){if(this.is_whitespace(text)&&!this.output.length){return}if(text||text!==""){if(this.output.length&&this.output[this.output.length-1]==="\n"){this.print_indentation(this.output);text=ltrim(text)}}this.print_token_raw(text)};this.print_token_raw=function(text){if(this.newlines>0){text=rtrim(text)}if(text&&text!==""){if(text.length>1&&text[text.length-1]==="\n"){this.output.push(text.slice(0,-1));this.print_newline(false,this.output)}else{this.output.push(text)}}for(var n=0;n<this.newlines;n++){this.print_newline(n>0,this.output)}this.newlines=0};this.indent=function(){this.indent_level++};this.unindent=function(){if(this.indent_level>0){this.indent_level--}}};return this}multi_parser=new Parser;multi_parser.printer(html_source,indent_character,indent_size,wrap_line_length,brace_style);while(true){var t=multi_parser.get_token();multi_parser.token_text=t[0];multi_parser.token_type=t[1];if(multi_parser.token_type==="TK_EOF"){break}switch(multi_parser.token_type){case"TK_TAG_START":multi_parser.print_newline(false,multi_parser.output);multi_parser.print_token(multi_parser.token_text);if(multi_parser.indent_content){multi_parser.indent();multi_parser.indent_content=false}multi_parser.current_mode="CONTENT";break;case"TK_TAG_STYLE":case"TK_TAG_SCRIPT":multi_parser.print_newline(false,multi_parser.output);multi_parser.print_token(multi_parser.token_text);multi_parser.current_mode="CONTENT";break;case"TK_TAG_END":if(multi_parser.last_token==="TK_CONTENT"&&multi_parser.last_text===""){var tag_name=multi_parser.token_text.match(/\w+/)[0];var tag_extracted_from_last_output=null;if(multi_parser.output.length){tag_extracted_from_last_output=multi_parser.output[multi_parser.output.length-1].match(/(?:<|{{#)\s*(\w+)/)}if(tag_extracted_from_last_output===null||tag_extracted_from_last_output[1]!==tag_name){multi_parser.print_newline(false,multi_parser.output)}}multi_parser.print_token(multi_parser.token_text);multi_parser.current_mode="CONTENT";break;case"TK_TAG_SINGLE":var tag_check=multi_parser.token_text.match(/^\s*<([a-z-]+)/i);if(!tag_check||!multi_parser.Utils.in_array(tag_check[1],unformatted)){multi_parser.print_newline(false,multi_parser.output)}multi_parser.print_token(multi_parser.token_text);multi_parser.current_mode="CONTENT";break;case"TK_TAG_HANDLEBARS_ELSE":multi_parser.print_token(multi_parser.token_text);if(multi_parser.indent_content){multi_parser.indent();multi_parser.indent_content=false}multi_parser.current_mode="CONTENT";break;case"TK_CONTENT":multi_parser.print_token(multi_parser.token_text);multi_parser.current_mode="TAG";break;case"TK_STYLE":case"TK_SCRIPT":if(multi_parser.token_text!==""){multi_parser.print_newline(false,multi_parser.output);var text=multi_parser.token_text,_beautifier,script_indent_level=1;if(multi_parser.token_type==="TK_SCRIPT"){_beautifier=typeof js_beautify==="function"&&js_beautify}else if(multi_parser.token_type==="TK_STYLE"){_beautifier=typeof css_beautify==="function"&&css_beautify}if(options.indent_scripts==="keep"){script_indent_level=0}else if(options.indent_scripts==="separate"){script_indent_level=-multi_parser.indent_level}var indentation=multi_parser.get_full_indent(script_indent_level);if(_beautifier){text=_beautifier(text.replace(/^\s*/,indentation),options)}else{var white=text.match(/^\s*/)[0];var _level=white.match(/[^\n\r]*$/)[0].split(multi_parser.indent_string).length-1;var reindent=multi_parser.get_full_indent(script_indent_level-_level);text=text.replace(/^\s*/,indentation).replace(/\r\n|\r|\n/g,"\n"+reindent).replace(/\s+$/,"")}if(text){multi_parser.print_token_raw(text);multi_parser.print_newline(true,multi_parser.output)}}multi_parser.current_mode="TAG";break;default:if(multi_parser.token_text!==""){multi_parser.print_token(multi_parser.token_text)}break}multi_parser.last_token=multi_parser.token_type;multi_parser.last_text=multi_parser.token_text}var sweet_code=multi_parser.output.join("").replace(/[\r\n\t ]+$/,"");if(end_with_newline){sweet_code+="\n"}return sweet_code}if(typeof define==="function"&&define.amd){define(["require","./beautify","./beautify-css"],function(requireamd){var js_beautify=requireamd("./beautify");var css_beautify=requireamd("./beautify-css");return{html_beautify:function(html_source,options){return style_html(html_source,options,js_beautify.js_beautify,css_beautify.css_beautify)}}})}else if(typeof exports!=="undefined"){var js_beautify=require("./beautify.js");var css_beautify=require("./beautify-css.js");exports.html_beautify=function(html_source,options){return style_html(html_source,options,js_beautify.js_beautify,css_beautify.css_beautify)}}else if(typeof window!=="undefined"){window.html_beautify=function(html_source,options){return style_html(html_source,options,window.js_beautify,window.css_beautify)}}else if(typeof global!=="undefined"){global.html_beautify=function(html_source,options){return style_html(html_source,options,global.js_beautify,global.css_beautify)}}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"./beautify-css.js":5,"./beautify.js":7}],7:[function(require,module,exports){(function(global){(function(){var acorn={};(function(exports){var nonASCIIwhitespace=/[\u1680\u180e\u2000-\u200a\u202f\u205f\u3000\ufeff]/;var nonASCIIidentifierStartChars="ªµºÀ-ÖØ-öø-ˁˆ-ˑˠ-ˤˬˮͰ-ʹͶͷͺ-ͽΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ҁҊ-ԧԱ-Ֆՙա-ևא-תװ-ײؠ-يٮٯٱ-ۓەۥۦۮۯۺ-ۼۿܐܒ-ܯݍ-ޥޱߊ-ߪߴߵߺࠀ-ࠕࠚࠤࠨࡀ-ࡘࢠࢢ-ࢬऄ-हऽॐक़-ॡॱ-ॷॹ-ॿঅ-ঌএঐও-নপ-রলশ-হঽৎড়ঢ়য়-ৡৰৱਅ-ਊਏਐਓ-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਖ਼-ੜਫ਼ੲ-ੴઅ-ઍએ-ઑઓ-નપ-રલળવ-હઽૐૠૡଅ-ଌଏଐଓ-ନପ-ରଲଳଵ-ହଽଡ଼ଢ଼ୟ-ୡୱஃஅ-ஊஎ-ஐஒ-கஙசஜஞடணதந-பம-ஹௐఅ-ఌఎ-ఐఒ-నప-ళవ-హఽౘౙౠౡಅ-ಌಎ-ಐಒ-ನಪ-ಳವ-ಹಽೞೠೡೱೲഅ-ഌഎ-ഐഒ-ഺഽൎൠൡൺ-ൿඅ-ඖක-නඳ-රලව-ෆก-ะาำเ-ๆກຂຄງຈຊຍດ-ທນ-ຟມ-ຣລວສຫອ-ະາຳຽເ-ໄໆໜ-ໟༀཀ-ཇཉ-ཬྈ-ྌက-ဪဿၐ-ၕၚ-ၝၡၥၦၮ-ၰၵ-ႁႎႠ-ჅჇჍა-ჺჼ-ቈቊ-ቍቐ-ቖቘቚ-ቝበ-ኈኊ-ኍነ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-ጐጒ-ጕጘ-ፚᎀ-ᎏᎠ-Ᏼᐁ-ᙬᙯ-ᙿᚁ-ᚚᚠ-ᛪᛮ-ᛰᜀ-ᜌᜎ-ᜑᜠ-ᜱᝀ-ᝑᝠ-ᝬᝮ-ᝰក-ឳៗៜᠠ-ᡷᢀ-ᢨᢪᢰ-ᣵᤀ-ᤜᥐ-ᥭᥰ-ᥴᦀ-ᦫᧁ-ᧇᨀ-ᨖᨠ-ᩔᪧᬅ-ᬳᭅ-ᭋᮃ-ᮠᮮᮯᮺ-ᯥᰀ-ᰣᱍ-ᱏᱚ-ᱽᳩ-ᳬᳮ-ᳱᳵᳶᴀ-ᶿḀ-ἕἘ-Ἕἠ-ὅὈ-Ὅὐ-ὗὙὛὝὟ-ώᾀ-ᾴᾶ-ᾼιῂ-ῄῆ-ῌῐ-ΐῖ-Ίῠ-Ῥῲ-ῴῶ-ῼⁱⁿₐ-ₜℂℇℊ-ℓℕℙ-ℝℤΩℨK-ℭℯ-ℹℼ-ℿⅅ-ⅉⅎⅠ-ↈⰀ-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-ⶖⶠ-ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-ⷎⷐ-ⷖⷘ-ⷞⸯ々-〇〡-〩〱-〵〸-〼ぁ-ゖゝ-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿ㐀-䶵一-鿌ꀀ-ꒌꓐ-ꓽꔀ-ꘌꘐ-ꘟꘪꘫꙀ-ꙮꙿ-ꚗꚠ-ꛯꜗ-ꜟꜢ-ꞈꞋ-ꞎꞐ-ꞓꞠ-Ɦꟸ-ꠁꠃ-ꠅꠇ-ꠊꠌ-ꠢꡀ-ꡳꢂ-ꢳꣲ-ꣷꣻꤊ-ꤥꤰ-ꥆꥠ-ꥼꦄ-ꦲꧏꨀ-ꨨꩀ-ꩂꩄ-ꩋꩠ-ꩶꩺꪀ-ꪯꪱꪵꪶꪹ-ꪽꫀꫂꫛ-ꫝꫠ-ꫪꫲ-ꫴꬁ-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꯀ-ꯢ가-힣ힰ-ퟆퟋ-ퟻ豈-舘並-龎ff-stﬓ-ﬗיִײַ-ﬨשׁ-זּטּ-לּמּנּסּףּפּצּ-ﮱﯓ-ﴽﵐ-ﶏﶒ-ﷇﷰ-ﷻﹰ-ﹴﹶ-ﻼA-Za-zヲ-하-ᅦᅧ-ᅬᅭ-ᅲᅳ-ᅵ";var nonASCIIidentifierChars="̀-ͯ҃-֑҇-ׇֽֿׁׂׅׄؐ-ؚؠ-ىٲ-ۓۧ-ۨۻ-ۼܰ-݊ࠀ-ࠔࠛ-ࠣࠥ-ࠧࠩ-࠭ࡀ-ࡗࣤ-ࣾऀ-ःऺ-़ा-ॏ॑-ॗॢ-ॣ०-९ঁ-ঃ়া-ৄেৈৗয়-ৠਁ-ਃ਼ਾ-ੂੇੈੋ-੍ੑ੦-ੱੵઁ-ઃ઼ા-ૅે-ૉો-્ૢ-ૣ૦-૯ଁ-ଃ଼ା-ୄେୈୋ-୍ୖୗୟ-ୠ୦-୯ஂா-ூெ-ைொ-்ௗ௦-௯ఁ-ఃె-ైొ-్ౕౖౢ-ౣ౦-౯ಂಃ಼ಾ-ೄೆ-ೈೊ-್ೕೖೢ-ೣ೦-೯ംഃെ-ൈൗൢ-ൣ൦-൯ංඃ්ා-ුූෘ-ෟෲෳิ-ฺเ-ๅ๐-๙ິ-ູ່-ໍ໐-໙༘༙༠-༩༹༵༷ཁ-ཇཱ-྄྆-྇ྍ-ྗྙ-ྼ࿆က-ဩ၀-၉ၧ-ၭၱ-ၴႂ-ႍႏ-ႝ፝-፟ᜎ-ᜐᜠ-ᜰᝀ-ᝐᝲᝳក-ឲ៝០-៩᠋-᠍᠐-᠙ᤠ-ᤫᤰ-᤻ᥑ-ᥭᦰ-ᧀᧈ-ᧉ᧐-᧙ᨀ-ᨕᨠ-ᩓ᩠-᩿᩼-᪉᪐-᪙ᭆ-ᭋ᭐-᭙᭫-᭳᮰-᮹᯦-᯳ᰀ-ᰢ᱀-᱉ᱛ-ᱽ᳐-᳒ᴀ-ᶾḁ-ἕ‿⁀⁔⃐-⃥⃜⃡-⃰ⶁ-ⶖⷠ-ⷿ〡-〨゙゚Ꙁ-ꙭꙴ-꙽ꚟ꛰-꛱ꟸ-ꠀ꠆ꠋꠣ-ꠧꢀ-ꢁꢴ-꣄꣐-꣙ꣳ-ꣷ꤀-꤉ꤦ-꤭ꤰ-ꥅꦀ-ꦃ꦳-꧀ꨀ-ꨧꩀ-ꩁꩌ-ꩍ꩐-꩙ꩻꫠ-ꫩꫲ-ꫳꯀ-ꯡ꯬꯭꯰-꯹ﬠ-ﬨ︀-️︠-︦︳︴﹍-﹏0-9_";var nonASCIIidentifierStart=new RegExp("["+nonASCIIidentifierStartChars+"]");var nonASCIIidentifier=new RegExp("["+nonASCIIidentifierStartChars+nonASCIIidentifierChars+"]");var newline=exports.newline=/[\n\r\u2028\u2029]/;var lineBreak=/\r\n|[\n\r\u2028\u2029]/g;var isIdentifierStart=exports.isIdentifierStart=function(code){if(code<65)return code===36;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifierStart.test(String.fromCharCode(code))};var isIdentifierChar=exports.isIdentifierChar=function(code){if(code<48)return code===36;if(code<58)return true;if(code<65)return false;if(code<91)return true;if(code<97)return code===95;if(code<123)return true;return code>=170&&nonASCIIidentifier.test(String.fromCharCode(code))}})(acorn);function in_array(what,arr){for(var i=0;i<arr.length;i+=1){if(arr[i]===what){return true}}return false}function trim(s){return s.replace(/^\s+|\s+$/g,"")}function js_beautify(js_source_text,options){"use strict";var beautifier=new Beautifier(js_source_text,options);return beautifier.beautify()}var MODE={BlockStatement:"BlockStatement",Statement:"Statement",ObjectLiteral:"ObjectLiteral",ArrayLiteral:"ArrayLiteral",ForInitializer:"ForInitializer",Conditional:"Conditional",Expression:"Expression"};function Beautifier(js_source_text,options){"use strict";var output;var tokens=[],token_pos;var Tokenizer;var current_token;var last_type,last_last_text,indent_string;var flags,previous_flags,flag_store;var prefix;var handlers,opt;var baseIndentString="";handlers={TK_START_EXPR:handle_start_expr,TK_END_EXPR:handle_end_expr,TK_START_BLOCK:handle_start_block,TK_END_BLOCK:handle_end_block,TK_WORD:handle_word,TK_RESERVED:handle_word,TK_SEMICOLON:handle_semicolon,TK_STRING:handle_string,TK_EQUALS:handle_equals,TK_OPERATOR:handle_operator,TK_COMMA:handle_comma,TK_BLOCK_COMMENT:handle_block_comment,TK_INLINE_COMMENT:handle_inline_comment,TK_COMMENT:handle_comment,TK_DOT:handle_dot,TK_UNKNOWN:handle_unknown,TK_EOF:handle_eof};function create_flags(flags_base,mode){var next_indent_level=0;if(flags_base){next_indent_level=flags_base.indentation_level;if(!output.just_added_newline()&&flags_base.line_indent_level>next_indent_level){next_indent_level=flags_base.line_indent_level}}var next_flags={mode:mode,parent:flags_base,last_text:flags_base?flags_base.last_text:"",last_word:flags_base?flags_base.last_word:"",declaration_statement:false,declaration_assignment:false,multiline_frame:false,if_block:false,else_block:false,do_block:false,do_while:false,in_case_statement:false,in_case:false,case_body:false,indentation_level:next_indent_level,line_indent_level:flags_base?flags_base.line_indent_level:next_indent_level,start_line_index:output.get_line_number(),ternary_depth:0};return next_flags}options=options?options:{};opt={};if(options.braces_on_own_line!==undefined){opt.brace_style=options.braces_on_own_line?"expand":"collapse"}opt.brace_style=options.brace_style?options.brace_style:opt.brace_style?opt.brace_style:"collapse";if(opt.brace_style==="expand-strict"){opt.brace_style="expand"}opt.indent_size=options.indent_size?parseInt(options.indent_size,10):4;opt.indent_char=options.indent_char?options.indent_char:" ";opt.preserve_newlines=options.preserve_newlines===undefined?true:options.preserve_newlines;opt.break_chained_methods=options.break_chained_methods===undefined?false:options.break_chained_methods;opt.max_preserve_newlines=options.max_preserve_newlines===undefined?0:parseInt(options.max_preserve_newlines,10);opt.space_in_paren=options.space_in_paren===undefined?false:options.space_in_paren;opt.space_in_empty_paren=options.space_in_empty_paren===undefined?false:options.space_in_empty_paren;opt.jslint_happy=options.jslint_happy===undefined?false:options.jslint_happy;opt.space_after_anon_function=options.space_after_anon_function===undefined?false:options.space_after_anon_function;opt.keep_array_indentation=options.keep_array_indentation===undefined?false:options.keep_array_indentation;opt.space_before_conditional=options.space_before_conditional===undefined?true:options.space_before_conditional;opt.unescape_strings=options.unescape_strings===undefined?false:options.unescape_strings;opt.wrap_line_length=options.wrap_line_length===undefined?0:parseInt(options.wrap_line_length,10);opt.e4x=options.e4x===undefined?false:options.e4x;opt.end_with_newline=options.end_with_newline===undefined?false:options.end_with_newline;if(opt.jslint_happy){opt.space_after_anon_function=true}if(options.indent_with_tabs){opt.indent_char=" ";opt.indent_size=1}indent_string="";while(opt.indent_size>0){indent_string+=opt.indent_char;opt.indent_size-=1}var preindent_index=0;if(js_source_text&&js_source_text.length){while(js_source_text.charAt(preindent_index)===" "||js_source_text.charAt(preindent_index)===" "){baseIndentString+=js_source_text.charAt(preindent_index);preindent_index+=1}js_source_text=js_source_text.substring(preindent_index)}last_type="TK_START_BLOCK";last_last_text="";output=new Output(indent_string,baseIndentString);flag_store=[];set_mode(MODE.BlockStatement);this.beautify=function(){var local_token,sweet_code;Tokenizer=new tokenizer(js_source_text,opt,indent_string);tokens=Tokenizer.tokenize();token_pos=0;while(local_token=get_token()){for(var i=0;i<local_token.comments_before.length;i++){handle_token(local_token.comments_before[i])}handle_token(local_token);last_last_text=flags.last_text;last_type=local_token.type;flags.last_text=local_token.text;token_pos+=1}sweet_code=output.get_code();if(opt.end_with_newline){sweet_code+="\n"}return sweet_code};function handle_token(local_token){var newlines=local_token.newlines;var keep_whitespace=opt.keep_array_indentation&&is_array(flags.mode);if(keep_whitespace){for(i=0;i<newlines;i+=1){print_newline(i>0)}}else{if(opt.max_preserve_newlines&&newlines>opt.max_preserve_newlines){newlines=opt.max_preserve_newlines}if(opt.preserve_newlines){if(local_token.newlines>1){print_newline();for(var i=1;i<newlines;i+=1){print_newline(true)}}}}current_token=local_token;handlers[current_token.type]()}function split_newlines(s){s=s.replace(/\x0d/g,"");var out=[],idx=s.indexOf("\n");while(idx!==-1){out.push(s.substring(0,idx));s=s.substring(idx+1);idx=s.indexOf("\n")}if(s.length){out.push(s)}return out}function allow_wrap_or_preserved_newline(force_linewrap){force_linewrap=force_linewrap===undefined?false:force_linewrap;if(output.just_added_newline()){return}if(opt.preserve_newlines&¤t_token.wanted_newline||force_linewrap){print_newline(false,true)}else if(opt.wrap_line_length){var proposed_line_length=output.current_line.get_character_count()+current_token.text.length+(output.space_before_token?1:0);if(proposed_line_length>=opt.wrap_line_length){print_newline(false,true)}}}function print_newline(force_newline,preserve_statement_flags){if(!preserve_statement_flags){if(flags.last_text!==";"&&flags.last_text!==","&&flags.last_text!=="="&&last_type!=="TK_OPERATOR"){while(flags.mode===MODE.Statement&&!flags.if_block&&!flags.do_block){restore_mode()}}}if(output.add_new_line(force_newline)){flags.multiline_frame=true}}function print_token_line_indentation(){if(output.just_added_newline()){if(opt.keep_array_indentation&&is_array(flags.mode)&¤t_token.wanted_newline){output.current_line.push("");for(var i=0;i<current_token.whitespace_before.length;i+=1){output.current_line.push(current_token.whitespace_before[i])}output.space_before_token=false}else if(output.add_indent_string(flags.indentation_level)){flags.line_indent_level=flags.indentation_level}}}function print_token(printable_token){printable_token=printable_token||current_token.text;print_token_line_indentation();output.add_token(printable_token)}function indent(){flags.indentation_level+=1}function deindent(){if(flags.indentation_level>0&&(!flags.parent||flags.indentation_level>flags.parent.indentation_level))flags.indentation_level-=1}function set_mode(mode){if(flags){flag_store.push(flags);previous_flags=flags}else{previous_flags=create_flags(null,mode)}flags=create_flags(previous_flags,mode)}function is_array(mode){return mode===MODE.ArrayLiteral}function is_expression(mode){return in_array(mode,[MODE.Expression,MODE.ForInitializer,MODE.Conditional])}function restore_mode(){if(flag_store.length>0){previous_flags=flags;flags=flag_store.pop();if(previous_flags.mode===MODE.Statement){output.remove_redundant_indentation(previous_flags)}}}function start_of_object_property(){return flags.parent.mode===MODE.ObjectLiteral&&flags.mode===MODE.Statement&&(flags.last_text===":"&&flags.ternary_depth===0||last_type==="TK_RESERVED"&&in_array(flags.last_text,["get","set"]))}function start_of_statement(){if(last_type==="TK_RESERVED"&&in_array(flags.last_text,["var","let","const"])&¤t_token.type==="TK_WORD"||last_type==="TK_RESERVED"&&flags.last_text==="do"||last_type==="TK_RESERVED"&&flags.last_text==="return"&&!current_token.wanted_newline||last_type==="TK_RESERVED"&&flags.last_text==="else"&&!(current_token.type==="TK_RESERVED"&¤t_token.text==="if")||last_type==="TK_END_EXPR"&&(previous_flags.mode===MODE.ForInitializer||previous_flags.mode===MODE.Conditional)||last_type==="TK_WORD"&&flags.mode===MODE.BlockStatement&&!flags.in_case&&!(current_token.text==="--"||current_token.text==="++")&¤t_token.type!=="TK_WORD"&¤t_token.type!=="TK_RESERVED"||flags.mode===MODE.ObjectLiteral&&(flags.last_text===":"&&flags.ternary_depth===0||last_type==="TK_RESERVED"&&in_array(flags.last_text,["get","set"]))){set_mode(MODE.Statement);indent();if(last_type==="TK_RESERVED"&&in_array(flags.last_text,["var","let","const"])&¤t_token.type==="TK_WORD"){flags.declaration_statement=true}if(!start_of_object_property()){allow_wrap_or_preserved_newline(current_token.type==="TK_RESERVED"&&in_array(current_token.text,["do","for","if","while"]))}return true}return false}function all_lines_start_with(lines,c){for(var i=0;i<lines.length;i++){var line=trim(lines[i]);if(line.charAt(0)!==c){return false}}return true}function each_line_matches_indent(lines,indent){var i=0,len=lines.length,line;for(;i<len;i++){line=lines[i];if(line&&line.indexOf(indent)!==0){return false}}return true}function is_special_word(word){return in_array(word,["case","return","do","if","throw","else"])}function get_token(offset){var index=token_pos+(offset||0);return index<0||index>=tokens.length?null:tokens[index]}function handle_start_expr(){if(start_of_statement()){}var next_mode=MODE.Expression;if(current_token.text==="["){if(last_type==="TK_WORD"||flags.last_text===")"){if(last_type==="TK_RESERVED"&&in_array(flags.last_text,Tokenizer.line_starters)){output.space_before_token=true}set_mode(next_mode);print_token();indent();if(opt.space_in_paren){output.space_before_token=true}return}next_mode=MODE.ArrayLiteral;if(is_array(flags.mode)){if(flags.last_text==="["||flags.last_text===","&&(last_last_text==="]"||last_last_text==="}")){if(!opt.keep_array_indentation){print_newline()}}}}else{if(last_type==="TK_RESERVED"&&flags.last_text==="for"){next_mode=MODE.ForInitializer}else if(last_type==="TK_RESERVED"&&in_array(flags.last_text,["if","while"])){next_mode=MODE.Conditional}else{}}if(flags.last_text===";"||last_type==="TK_START_BLOCK"){print_newline()}else if(last_type==="TK_END_EXPR"||last_type==="TK_START_EXPR"||last_type==="TK_END_BLOCK"||flags.last_text==="."){allow_wrap_or_preserved_newline(current_token.wanted_newline)}else if(!(last_type==="TK_RESERVED"&¤t_token.text==="(")&&last_type!=="TK_WORD"&&last_type!=="TK_OPERATOR"){output.space_before_token=true}else if(last_type==="TK_RESERVED"&&(flags.last_word==="function"||flags.last_word==="typeof")||flags.last_text==="*"&&last_last_text==="function"){if(opt.space_after_anon_function){output.space_before_token=true}}else if(last_type==="TK_RESERVED"&&(in_array(flags.last_text,Tokenizer.line_starters)||flags.last_text==="catch")){if(opt.space_before_conditional){output.space_before_token=true}}if(current_token.text==="("){if(last_type==="TK_EQUALS"||last_type==="TK_OPERATOR"){if(!start_of_object_property()){allow_wrap_or_preserved_newline()}}}set_mode(next_mode);print_token();if(opt.space_in_paren){output.space_before_token=true}indent()}function handle_end_expr(){while(flags.mode===MODE.Statement){restore_mode()}if(flags.multiline_frame){allow_wrap_or_preserved_newline(current_token.text==="]"&&is_array(flags.mode)&&!opt.keep_array_indentation)}if(opt.space_in_paren){if(last_type==="TK_START_EXPR"&&!opt.space_in_empty_paren){output.trim();output.space_before_token=false}else{output.space_before_token=true}}if(current_token.text==="]"&&opt.keep_array_indentation){print_token();restore_mode()}else{restore_mode();print_token()}output.remove_redundant_indentation(previous_flags);if(flags.do_while&&previous_flags.mode===MODE.Conditional){previous_flags.mode=MODE.Expression;flags.do_block=false;flags.do_while=false}}function handle_start_block(){var next_token=get_token(1);var second_token=get_token(2);if(second_token&&(second_token.text===":"&&in_array(next_token.type,["TK_STRING","TK_WORD","TK_RESERVED"])||in_array(next_token.text,["get","set"])&&in_array(second_token.type,["TK_WORD","TK_RESERVED"]))){if(!in_array(last_last_text,["class","interface"])){set_mode(MODE.ObjectLiteral)}else{set_mode(MODE.BlockStatement)}}else{set_mode(MODE.BlockStatement)}var empty_braces=!next_token.comments_before.length&&next_token.text==="}";var empty_anonymous_function=empty_braces&&flags.last_word==="function"&&last_type==="TK_END_EXPR";if(opt.brace_style==="expand"){if(last_type!=="TK_OPERATOR"&&(empty_anonymous_function||last_type==="TK_EQUALS"||last_type==="TK_RESERVED"&&is_special_word(flags.last_text)&&flags.last_text!=="else")){output.space_before_token=true}else{print_newline(false,true)}}else{if(last_type!=="TK_OPERATOR"&&last_type!=="TK_START_EXPR"){if(last_type==="TK_START_BLOCK"){print_newline()}else{output.space_before_token=true}}else{if(is_array(previous_flags.mode)&&flags.last_text===","){if(last_last_text==="}"){output.space_before_token=true}else{print_newline()}}}}print_token();indent()}function handle_end_block(){while(flags.mode===MODE.Statement){restore_mode()}var empty_braces=last_type==="TK_START_BLOCK";if(opt.brace_style==="expand"){if(!empty_braces){print_newline()}}else{if(!empty_braces){if(is_array(flags.mode)&&opt.keep_array_indentation){opt.keep_array_indentation=false;print_newline();opt.keep_array_indentation=true}else{print_newline()}}}restore_mode();print_token()}function handle_word(){if(current_token.type==="TK_RESERVED"&&flags.mode!==MODE.ObjectLiteral&&in_array(current_token.text,["set","get"])){current_token.type="TK_WORD"}if(current_token.type==="TK_RESERVED"&&flags.mode===MODE.ObjectLiteral){var next_token=get_token(1);if(next_token.text==":"){current_token.type="TK_WORD"}}if(start_of_statement()){}else if(current_token.wanted_newline&&!is_expression(flags.mode)&&(last_type!=="TK_OPERATOR"||(flags.last_text==="--"||flags.last_text==="++"))&&last_type!=="TK_EQUALS"&&(opt.preserve_newlines||!(last_type==="TK_RESERVED"&&in_array(flags.last_text,["var","let","const","set","get"])))){print_newline()}if(flags.do_block&&!flags.do_while){if(current_token.type==="TK_RESERVED"&¤t_token.text==="while"){output.space_before_token=true;print_token();output.space_before_token=true;flags.do_while=true;return}else{print_newline();flags.do_block=false}}if(flags.if_block){if(!flags.else_block&&(current_token.type==="TK_RESERVED"&¤t_token.text==="else")){flags.else_block=true}else{while(flags.mode===MODE.Statement){restore_mode()}flags.if_block=false;flags.else_block=false}}if(current_token.type==="TK_RESERVED"&&(current_token.text==="case"||current_token.text==="default"&&flags.in_case_statement)){print_newline();if(flags.case_body||opt.jslint_happy){deindent();flags.case_body=false}print_token();flags.in_case=true;flags.in_case_statement=true;return}if(current_token.type==="TK_RESERVED"&¤t_token.text==="function"){if(in_array(flags.last_text,["}",";"])||output.just_added_newline()&&!in_array(flags.last_text,["[","{",":","=",","])){if(!output.just_added_blankline()&&!current_token.comments_before.length){print_newline();print_newline(true)}}if(last_type==="TK_RESERVED"||last_type==="TK_WORD"){if(last_type==="TK_RESERVED"&&in_array(flags.last_text,["get","set","new","return","export"])){output.space_before_token=true}else if(last_type==="TK_RESERVED"&&flags.last_text==="default"&&last_last_text==="export"){output.space_before_token=true}else{print_newline()}}else if(last_type==="TK_OPERATOR"||flags.last_text==="="){output.space_before_token=true}else if(!flags.multiline_frame&&(is_expression(flags.mode)||is_array(flags.mode))){}else{print_newline()}}if(last_type==="TK_COMMA"||last_type==="TK_START_EXPR"||last_type==="TK_EQUALS"||last_type==="TK_OPERATOR"){if(!start_of_object_property()){allow_wrap_or_preserved_newline()}}if(current_token.type==="TK_RESERVED"&&in_array(current_token.text,["function","get","set"])){print_token();flags.last_word=current_token.text;return}prefix="NONE";if(last_type==="TK_END_BLOCK"){if(!(current_token.type==="TK_RESERVED"&&in_array(current_token.text,["else","catch","finally"]))){prefix="NEWLINE"}else{if(opt.brace_style==="expand"||opt.brace_style==="end-expand"){prefix="NEWLINE"}else{prefix="SPACE";output.space_before_token=true}}}else if(last_type==="TK_SEMICOLON"&&flags.mode===MODE.BlockStatement){prefix="NEWLINE"}else if(last_type==="TK_SEMICOLON"&&is_expression(flags.mode)){prefix="SPACE"}else if(last_type==="TK_STRING"){prefix="NEWLINE"}else if(last_type==="TK_RESERVED"||last_type==="TK_WORD"||flags.last_text==="*"&&last_last_text==="function"){prefix="SPACE"}else if(last_type==="TK_START_BLOCK"){prefix="NEWLINE"}else if(last_type==="TK_END_EXPR"){output.space_before_token=true;prefix="NEWLINE"}if(current_token.type==="TK_RESERVED"&&in_array(current_token.text,Tokenizer.line_starters)&&flags.last_text!==")"){if(flags.last_text==="else"||flags.last_text==="export"){prefix="SPACE"}else{prefix="NEWLINE"}}if(current_token.type==="TK_RESERVED"&&in_array(current_token.text,["else","catch","finally"])){if(last_type!=="TK_END_BLOCK"||opt.brace_style==="expand"||opt.brace_style==="end-expand"){print_newline()}else{output.trim(true);var line=output.current_line;if(line.last()!=="}"){print_newline()}output.space_before_token=true}}else if(prefix==="NEWLINE"){if(last_type==="TK_RESERVED"&&is_special_word(flags.last_text)){output.space_before_token=true}else if(last_type!=="TK_END_EXPR"){if((last_type!=="TK_START_EXPR"||!(current_token.type==="TK_RESERVED"&&in_array(current_token.text,["var","let","const"])))&&flags.last_text!==":"){if(current_token.type==="TK_RESERVED"&¤t_token.text==="if"&&flags.last_text==="else"){output.space_before_token=true}else{print_newline()}}}else if(current_token.type==="TK_RESERVED"&&in_array(current_token.text,Tokenizer.line_starters)&&flags.last_text!==")"){print_newline()}}else if(flags.multiline_frame&&is_array(flags.mode)&&flags.last_text===","&&last_last_text==="}"){print_newline()}else if(prefix==="SPACE"){output.space_before_token=true}print_token();flags.last_word=current_token.text;if(current_token.type==="TK_RESERVED"&¤t_token.text==="do"){flags.do_block=true}if(current_token.type==="TK_RESERVED"&¤t_token.text==="if"){flags.if_block=true}}function handle_semicolon(){if(start_of_statement()){output.space_before_token=false}while(flags.mode===MODE.Statement&&!flags.if_block&&!flags.do_block){restore_mode()}print_token()}function handle_string(){if(start_of_statement()){output.space_before_token=true}else if(last_type==="TK_RESERVED"||last_type==="TK_WORD"){output.space_before_token=true}else if(last_type==="TK_COMMA"||last_type==="TK_START_EXPR"||last_type==="TK_EQUALS"||last_type==="TK_OPERATOR"){if(!start_of_object_property()){allow_wrap_or_preserved_newline()}}else{print_newline()}print_token()}function handle_equals(){if(start_of_statement()){}if(flags.declaration_statement){flags.declaration_assignment=true}output.space_before_token=true;print_token();output.space_before_token=true}function handle_comma(){if(flags.declaration_statement){if(is_expression(flags.parent.mode)){flags.declaration_assignment=false}print_token();if(flags.declaration_assignment){flags.declaration_assignment=false;print_newline(false,true)}else{output.space_before_token=true}return}print_token();if(flags.mode===MODE.ObjectLiteral||flags.mode===MODE.Statement&&flags.parent.mode===MODE.ObjectLiteral){if(flags.mode===MODE.Statement){restore_mode()}print_newline()}else{output.space_before_token=true}}function handle_operator(){if(start_of_statement()){}if(last_type==="TK_RESERVED"&&is_special_word(flags.last_text)){output.space_before_token=true;print_token();return}if(current_token.text==="*"&&last_type==="TK_DOT"){print_token();return}if(current_token.text===":"&&flags.in_case){flags.case_body=true;indent();print_token();print_newline();flags.in_case=false;return}if(current_token.text==="::"){print_token();return}if(current_token.wanted_newline&&(current_token.text==="--"||current_token.text==="++")){print_newline(false,true)}if(last_type==="TK_OPERATOR"){allow_wrap_or_preserved_newline()}var space_before=true;var space_after=true;if(in_array(current_token.text,["--","++","!","~"])||in_array(current_token.text,["-","+"])&&(in_array(last_type,["TK_START_BLOCK","TK_START_EXPR","TK_EQUALS","TK_OPERATOR"])||in_array(flags.last_text,Tokenizer.line_starters)||flags.last_text===",")){space_before=false;space_after=false;if(flags.last_text===";"&&is_expression(flags.mode)){space_before=true}if(last_type==="TK_RESERVED"||last_type==="TK_END_EXPR"){space_before=true}else if(last_type==="TK_OPERATOR"){space_before=in_array(current_token.text,["--","-"])&&in_array(flags.last_text,["--","-"])||in_array(current_token.text,["++","+"])&&in_array(flags.last_text,["++","+"])}if((flags.mode===MODE.BlockStatement||flags.mode===MODE.Statement)&&(flags.last_text==="{"||flags.last_text===";")){print_newline()}}else if(current_token.text===":"){if(flags.ternary_depth===0){space_before=false}else{flags.ternary_depth-=1}}else if(current_token.text==="?"){flags.ternary_depth+=1}else if(current_token.text==="*"&&last_type==="TK_RESERVED"&&flags.last_text==="function"){space_before=false;space_after=false}output.space_before_token=output.space_before_token||space_before;print_token();output.space_before_token=space_after}function handle_block_comment(){var lines=split_newlines(current_token.text);var j;var javadoc=false;var starless=false;var lastIndent=current_token.whitespace_before.join("");var lastIndentLength=lastIndent.length;print_newline(false,true);if(lines.length>1){if(all_lines_start_with(lines.slice(1),"*")){javadoc=true}else if(each_line_matches_indent(lines.slice(1),lastIndent)){starless=true}}print_token(lines[0]);for(j=1;j<lines.length;j++){print_newline(false,true);if(javadoc){print_token(" "+trim(lines[j]))}else if(starless&&lines[j].length>lastIndentLength){print_token(lines[j].substring(lastIndentLength)) | |
}else{output.add_token(lines[j])}}print_newline(false,true)}function handle_inline_comment(){output.space_before_token=true;print_token();output.space_before_token=true}function handle_comment(){if(current_token.wanted_newline){print_newline(false,true)}else{output.trim(true)}output.space_before_token=true;print_token();print_newline(false,true)}function handle_dot(){if(start_of_statement()){}if(last_type==="TK_RESERVED"&&is_special_word(flags.last_text)){output.space_before_token=true}else{allow_wrap_or_preserved_newline(flags.last_text===")"&&opt.break_chained_methods)}print_token()}function handle_unknown(){print_token();if(current_token.text[current_token.text.length-1]==="\n"){print_newline()}}function handle_eof(){while(flags.mode===MODE.Statement){restore_mode()}}}function OutputLine(){var character_count=0;var line_items=[];this.get_character_count=function(){return character_count};this.get_item_count=function(){return line_items.length};this.get_output=function(){return line_items.join("")};this.last=function(){if(line_items.length){return line_items[line_items.length-1]}else{return null}};this.push=function(input){line_items.push(input);character_count+=input.length};this.remove_indent=function(indent_string,baseIndentString){var splice_index=0;if(line_items.length===0){return}if(baseIndentString&&line_items[0]===baseIndentString){splice_index=1}if(line_items[splice_index]===indent_string){character_count-=line_items[splice_index].length;line_items.splice(splice_index,1)}};this.trim=function(indent_string,baseIndentString){while(this.get_item_count()&&(this.last()===" "||this.last()===indent_string||this.last()===baseIndentString)){var item=line_items.pop();character_count-=item.length}}}function Output(indent_string,baseIndentString){var lines=[];this.baseIndentString=baseIndentString;this.current_line=null;this.space_before_token=false;this.get_line_number=function(){return lines.length};this.add_new_line=function(force_newline){if(this.get_line_number()===1&&this.just_added_newline()){return false}if(force_newline||!this.just_added_newline()){this.current_line=new OutputLine;lines.push(this.current_line);return true}return false};this.add_new_line(true);this.get_code=function(){var sweet_code=lines[0].get_output();for(var line_index=1;line_index<lines.length;line_index++){sweet_code+="\n"+lines[line_index].get_output()}sweet_code=sweet_code.replace(/[\r\n\t ]+$/,"");return sweet_code};this.add_indent_string=function(indentation_level){if(baseIndentString){this.current_line.push(baseIndentString)}if(lines.length>1){for(var i=0;i<indentation_level;i+=1){this.current_line.push(indent_string)}return true}return false};this.add_token=function(printable_token){this.add_space_before_token();this.current_line.push(printable_token)};this.add_space_before_token=function(){if(this.space_before_token&&this.current_line.get_item_count()){var last_output=this.current_line.last();if(last_output!==" "&&last_output!==indent_string&&last_output!==baseIndentString){this.current_line.push(" ")}}this.space_before_token=false};this.remove_redundant_indentation=function(frame){if(frame.multiline_frame||frame.mode===MODE.ForInitializer||frame.mode===MODE.Conditional){return}var index=frame.start_line_index;var line;var output_length=lines.length;while(index<output_length){lines[index].remove_indent(indent_string,baseIndentString);index++}};this.trim=function(eat_newlines){eat_newlines=eat_newlines===undefined?false:eat_newlines;this.current_line.trim(indent_string,baseIndentString);while(eat_newlines&&lines.length>1&&this.current_line.get_item_count()===0){lines.pop();this.current_line=lines[lines.length-1];this.current_line.trim(indent_string,baseIndentString)}};this.just_added_newline=function(){return this.current_line.get_item_count()===0};this.just_added_blankline=function(){if(this.just_added_newline()){if(lines.length===1){return true}var line=lines[lines.length-2];return line.get_item_count()===0}return false}}var Token=function(type,text,newlines,whitespace_before,mode,parent){this.type=type;this.text=text;this.comments_before=[];this.newlines=newlines||0;this.wanted_newline=newlines>0;this.whitespace_before=whitespace_before||[];this.parent=null};function tokenizer(input,opts,indent_string){var whitespace="\n\r ".split("");var digit=/[0-9]/;var punct=("+ - * / % & ++ -- = += -= *= /= %= == === != !== > < >= <= >> << >>> >>>= >>= <<= && &= | || ! ~ , : ? ^ ^= |= :: =>"+" <%= <% %> <?= <? ?>").split(" ");this.line_starters="continue,try,throw,return,var,let,const,if,switch,case,default,for,while,break,function,yield,import,export".split(",");var reserved_words=this.line_starters.concat(["do","in","else","get","set","new","catch","finally","typeof"]);var n_newlines,whitespace_before_token,in_html_comment,tokens,parser_pos;var input_length;this.tokenize=function(){input_length=input.length;parser_pos=0;in_html_comment=false;tokens=[];var next,last;var token_values;var open=null;var open_stack=[];var comments=[];while(!(last&&last.type==="TK_EOF")){token_values=tokenize_next();next=new Token(token_values[1],token_values[0],n_newlines,whitespace_before_token);while(next.type==="TK_INLINE_COMMENT"||next.type==="TK_COMMENT"||next.type==="TK_BLOCK_COMMENT"||next.type==="TK_UNKNOWN"){comments.push(next);token_values=tokenize_next();next=new Token(token_values[1],token_values[0],n_newlines,whitespace_before_token)}if(comments.length){next.comments_before=comments;comments=[]}if(next.type==="TK_START_BLOCK"||next.type==="TK_START_EXPR"){next.parent=last;open=next;open_stack.push(next)}else if((next.type==="TK_END_BLOCK"||next.type==="TK_END_EXPR")&&(open&&(next.text==="]"&&open.text==="["||next.text===")"&&open.text==="("||next.text==="}"&&open.text==="}"))){next.parent=open.parent;open=open_stack.pop()}tokens.push(next);last=next}return tokens};function tokenize_next(){var i,resulting_string;n_newlines=0;whitespace_before_token=[];if(parser_pos>=input_length){return["","TK_EOF"]}var last_token;if(tokens.length){last_token=tokens[tokens.length-1]}else{last_token=new Token("TK_START_BLOCK","{")}var c=input.charAt(parser_pos);parser_pos+=1;while(in_array(c,whitespace)){if(c==="\n"){n_newlines+=1;whitespace_before_token=[]}else if(n_newlines){if(c===indent_string){whitespace_before_token.push(indent_string)}else if(c!=="\r"){whitespace_before_token.push(" ")}}if(parser_pos>=input_length){return["","TK_EOF"]}c=input.charAt(parser_pos);parser_pos+=1}if(digit.test(c)){var allow_decimal=true;var allow_e=true;var local_digit=digit;if(c==="0"&&parser_pos<input_length&&/[Xx]/.test(input.charAt(parser_pos))){allow_decimal=false;allow_e=false;c+=input.charAt(parser_pos);parser_pos+=1;local_digit=/[0123456789abcdefABCDEF]/}else{c="";parser_pos-=1}while(parser_pos<input_length&&local_digit.test(input.charAt(parser_pos))){c+=input.charAt(parser_pos);parser_pos+=1;if(allow_decimal&&parser_pos<input_length&&input.charAt(parser_pos)==="."){c+=input.charAt(parser_pos);parser_pos+=1;allow_decimal=false}if(allow_e&&parser_pos<input_length&&/[Ee]/.test(input.charAt(parser_pos))){c+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos<input_length&&/[+-]/.test(input.charAt(parser_pos))){c+=input.charAt(parser_pos);parser_pos+=1}allow_e=false;allow_decimal=false}}return[c,"TK_WORD"]}if(acorn.isIdentifierStart(input.charCodeAt(parser_pos-1))){if(parser_pos<input_length){while(acorn.isIdentifierChar(input.charCodeAt(parser_pos))){c+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos===input_length){break}}}if(!(last_token.type==="TK_DOT"||last_token.type==="TK_RESERVED"&&in_array(last_token.text,["set","get"]))&&in_array(c,reserved_words)){if(c==="in"){return[c,"TK_OPERATOR"]}return[c,"TK_RESERVED"]}return[c,"TK_WORD"]}if(c==="("||c==="["){return[c,"TK_START_EXPR"]}if(c===")"||c==="]"){return[c,"TK_END_EXPR"]}if(c==="{"){return[c,"TK_START_BLOCK"]}if(c==="}"){return[c,"TK_END_BLOCK"]}if(c===";"){return[c,"TK_SEMICOLON"]}if(c==="/"){var comment="";var inline_comment=true;if(input.charAt(parser_pos)==="*"){parser_pos+=1;if(parser_pos<input_length){while(parser_pos<input_length&&!(input.charAt(parser_pos)==="*"&&input.charAt(parser_pos+1)&&input.charAt(parser_pos+1)==="/")){c=input.charAt(parser_pos);comment+=c;if(c==="\n"||c==="\r"){inline_comment=false}parser_pos+=1;if(parser_pos>=input_length){break}}}parser_pos+=2;if(inline_comment&&n_newlines===0){return["/*"+comment+"*/","TK_INLINE_COMMENT"]}else{return["/*"+comment+"*/","TK_BLOCK_COMMENT"]}}if(input.charAt(parser_pos)==="/"){comment=c;while(input.charAt(parser_pos)!=="\r"&&input.charAt(parser_pos)!=="\n"){comment+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos>=input_length){break}}return[comment,"TK_COMMENT"]}}if(c==="`"||c==="'"||c==='"'||(c==="/"||opts.e4x&&c==="<"&&input.slice(parser_pos-1).match(/^<([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])\s*([-a-zA-Z:0-9_.]+=('[^']*'|"[^"]*"|{[^{}]*})\s*)*\/?\s*>/))&&(last_token.type==="TK_RESERVED"&&in_array(last_token.text,["return","case","throw","else","do","typeof","yield"])||last_token.type==="TK_END_EXPR"&&last_token.text===")"&&last_token.parent&&last_token.parent.type==="TK_RESERVED"&&in_array(last_token.parent.text,["if","while","for"])||in_array(last_token.type,["TK_COMMENT","TK_START_EXPR","TK_START_BLOCK","TK_END_BLOCK","TK_OPERATOR","TK_EQUALS","TK_EOF","TK_SEMICOLON","TK_COMMA"]))){var sep=c,esc=false,has_char_escapes=false;resulting_string=c;if(sep==="/"){var in_char_class=false;while(parser_pos<input_length&&((esc||in_char_class||input.charAt(parser_pos)!==sep)&&!acorn.newline.test(input.charAt(parser_pos)))){resulting_string+=input.charAt(parser_pos);if(!esc){esc=input.charAt(parser_pos)==="\\";if(input.charAt(parser_pos)==="["){in_char_class=true}else if(input.charAt(parser_pos)==="]"){in_char_class=false}}else{esc=false}parser_pos+=1}}else if(opts.e4x&&sep==="<"){var xmlRegExp=/<(\/?)([-a-zA-Z:0-9_.]+|{[^{}]*}|!\[CDATA\[[\s\S]*?\]\])\s*([-a-zA-Z:0-9_.]+=('[^']*'|"[^"]*"|{[^{}]*})\s*)*(\/?)\s*>/g;var xmlStr=input.slice(parser_pos-1);var match=xmlRegExp.exec(xmlStr);if(match&&match.index===0){var rootTag=match[2];var depth=0;while(match){var isEndTag=!!match[1];var tagName=match[2];var isSingletonTag=!!match[match.length-1]||tagName.slice(0,8)==="![CDATA[";if(tagName===rootTag&&!isSingletonTag){if(isEndTag){--depth}else{++depth}}if(depth<=0){break}match=xmlRegExp.exec(xmlStr)}var xmlLength=match?match.index+match[0].length:xmlStr.length;parser_pos+=xmlLength-1;return[xmlStr.slice(0,xmlLength),"TK_STRING"]}}else{while(parser_pos<input_length&&(esc||input.charAt(parser_pos)!==sep&&(sep==="`"||!acorn.newline.test(input.charAt(parser_pos))))){resulting_string+=input.charAt(parser_pos);if(esc){if(input.charAt(parser_pos)==="x"||input.charAt(parser_pos)==="u"){has_char_escapes=true}esc=false}else{esc=input.charAt(parser_pos)==="\\"}parser_pos+=1}}if(has_char_escapes&&opts.unescape_strings){resulting_string=unescape_string(resulting_string)}if(parser_pos<input_length&&input.charAt(parser_pos)===sep){resulting_string+=sep;parser_pos+=1;if(sep==="/"){while(parser_pos<input_length&&acorn.isIdentifierStart(input.charCodeAt(parser_pos))){resulting_string+=input.charAt(parser_pos);parser_pos+=1}}}return[resulting_string,"TK_STRING"]}if(c==="#"){if(tokens.length===0&&input.charAt(parser_pos)==="!"){resulting_string=c;while(parser_pos<input_length&&c!=="\n"){c=input.charAt(parser_pos);resulting_string+=c;parser_pos+=1}return[trim(resulting_string)+"\n","TK_UNKNOWN"]}var sharp="#";if(parser_pos<input_length&&digit.test(input.charAt(parser_pos))){do{c=input.charAt(parser_pos);sharp+=c;parser_pos+=1}while(parser_pos<input_length&&c!=="#"&&c!=="=");if(c==="#"){}else if(input.charAt(parser_pos)==="["&&input.charAt(parser_pos+1)==="]"){sharp+="[]";parser_pos+=2}else if(input.charAt(parser_pos)==="{"&&input.charAt(parser_pos+1)==="}"){sharp+="{}";parser_pos+=2}return[sharp,"TK_WORD"]}}if(c==="<"&&input.substring(parser_pos-1,parser_pos+3)==="<!--"){parser_pos+=3;c="<!--";while(input.charAt(parser_pos)!=="\n"&&parser_pos<input_length){c+=input.charAt(parser_pos);parser_pos++}in_html_comment=true;return[c,"TK_COMMENT"]}if(c==="-"&&in_html_comment&&input.substring(parser_pos-1,parser_pos+2)==="-->"){in_html_comment=false;parser_pos+=2;return["-->","TK_COMMENT"]}if(c==="."){return[c,"TK_DOT"]}if(in_array(c,punct)){while(parser_pos<input_length&&in_array(c+input.charAt(parser_pos),punct)){c+=input.charAt(parser_pos);parser_pos+=1;if(parser_pos>=input_length){break}}if(c===","){return[c,"TK_COMMA"]}else if(c==="="){return[c,"TK_EQUALS"]}else{return[c,"TK_OPERATOR"]}}return[c,"TK_UNKNOWN"]}function unescape_string(s){var esc=false,out="",pos=0,s_hex="",escaped=0,c;while(esc||pos<s.length){c=s.charAt(pos);pos++;if(esc){esc=false;if(c==="x"){s_hex=s.substr(pos,2);pos+=2}else if(c==="u"){s_hex=s.substr(pos,4);pos+=4}else{out+="\\"+c;continue}if(!s_hex.match(/^[0123456789abcdefABCDEF]+$/)){return s}escaped=parseInt(s_hex,16);if(escaped>=0&&escaped<32){if(c==="x"){out+="\\x"+s_hex}else{out+="\\u"+s_hex}continue}else if(escaped===34||escaped===39||escaped===92){out+="\\"+String.fromCharCode(escaped)}else if(c==="x"&&escaped>126&&escaped<=255){return s}else{out+=String.fromCharCode(escaped)}}else if(c==="\\"){esc=true}else{out+=c}}return out}}if(typeof define==="function"&&define.amd){define([],function(){return{js_beautify:js_beautify}})}else if(typeof exports!=="undefined"){exports.js_beautify=js_beautify}else if(typeof window!=="undefined"){window.js_beautify=js_beautify}else if(typeof global!=="undefined"){global.js_beautify=js_beautify}})()}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],8:[function(require,module,exports){var arrayCopy=require("lodash._arraycopy"),assign=require("lodash.assign");function assignDefaults(objectValue,sourceValue){return typeof objectValue=="undefined"?sourceValue:objectValue}function defaults(object){if(object==null){return object}var args=arrayCopy(arguments);args.push(assignDefaults);return assign.apply(undefined,args)}module.exports=defaults},{"lodash._arraycopy":9,"lodash.assign":10}],9:[function(require,module,exports){function arrayCopy(source,array){var index=-1,length=source.length;array||(array=Array(length));while(++index<length){array[index]=source[index]}return array}module.exports=arrayCopy},{}],10:[function(require,module,exports){var baseAssign=require("lodash._baseassign"),createAssigner=require("lodash._createassigner");var assign=createAssigner(baseAssign);module.exports=assign},{"lodash._baseassign":11,"lodash._createassigner":17}],11:[function(require,module,exports){var baseCopy=require("lodash._basecopy"),keys=require("lodash.keys");function baseAssign(object,source,customizer){var props=keys(source);if(!customizer){return baseCopy(source,object,props)}var index=-1,length=props.length;while(++index<length){var key=props[index],value=object[key],result=customizer(value,source[key],key,object,source);if((result===result?result!==value:value===value)||typeof value=="undefined"&&!(key in object)){object[key]=result}}return object}module.exports=baseAssign},{"lodash._basecopy":12,"lodash.keys":13}],12:[function(require,module,exports){function baseCopy(source,object,props){if(!props){props=object;object={}}var index=-1,length=props.length;while(++index<length){var key=props[index];object[key]=source[key]}return object}module.exports=baseCopy},{}],13:[function(require,module,exports){var isArguments=require("lodash.isarguments"),isArray=require("lodash.isarray"),isNative=require("lodash.isnative");var objectProto=Object.prototype;var hasOwnProperty=objectProto.hasOwnProperty;var propertyIsEnumerable=objectProto.propertyIsEnumerable;var nativeKeys=isNative(nativeKeys=Object.keys)&&nativeKeys;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;var support={};(function(x){try{support.nonEnumArgs=!propertyIsEnumerable.call(arguments,1)}catch(e){support.nonEnumArgs=true}})(0,0);function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function shimKeys(object){var props=keysIn(object),propsLength=props.length,length=propsLength&&object.length;var allowIndexes=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object));var index=-1,result=[];while(++index<propsLength){var key=props[index];if(allowIndexes&&isIndex(key,length)||hasOwnProperty.call(object,key)){result.push(key)}}return result}function isObject(value){var type=typeof value;return type=="function"||value&&type=="object"||false}var keys=!nativeKeys?shimKeys:function(object){if(object){var Ctor=object.constructor,length=object.length}if(typeof Ctor=="function"&&Ctor.prototype===object||typeof object!="function"&&(length&&isLength(length))){return shimKeys(object)}return isObject(object)?nativeKeys(object):[]};function keysIn(object){if(object==null){return[]}if(!isObject(object)){object=Object(object)}var length=object.length;length=length&&isLength(length)&&(isArray(object)||support.nonEnumArgs&&isArguments(object))&&length||0;var Ctor=object.constructor,index=-1,isProto=typeof Ctor=="function"&&Ctor.prototype===object,result=Array(length),skipIndexes=length>0;while(++index<length){result[index]=index+""}for(var key in object){if(!(skipIndexes&&isIndex(key,length))&&!(key=="constructor"&&(isProto||!hasOwnProperty.call(object,key)))){result.push(key)}}return result}module.exports=keys},{"lodash.isarguments":14,"lodash.isarray":15,"lodash.isnative":16}],14:[function(require,module,exports){var argsTag="[object Arguments]";function isObjectLike(value){return value&&typeof value=="object"||false}var objectProto=Object.prototype;var objToString=objectProto.toString;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isArguments(value){var length=isObjectLike(value)?value.length:undefined;return isLength(length)&&objToString.call(value)==argsTag||false}module.exports=isArguments},{}],15:[function(require,module,exports){var arrayTag="[object Array]",funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return value&&typeof value=="object"||false}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var nativeIsArray=isNative(nativeIsArray=Array.isArray)&&nativeIsArray;var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}var isArray=nativeIsArray||function(value){return isObjectLike(value)&&isLength(value.length)&&objToString.call(value)==arrayTag||false};function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)||false}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isArray},{}],16:[function(require,module,exports){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return value&&typeof value=="object"||false}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)||false}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isNative},{}],17:[function(require,module,exports){var bindCallback=require("lodash._bindcallback"),isIterateeCall=require("lodash._isiterateecall");function createAssigner(assigner){return function(){var length=arguments.length,object=arguments[0];if(length<2||object==null){return object}if(length>3&&isIterateeCall(arguments[1],arguments[2],arguments[3])){length=2}if(length>3&&typeof arguments[length-2]=="function"){var customizer=bindCallback(arguments[--length-1],arguments[length--],5)}else if(length>2&&typeof arguments[length-1]=="function"){customizer=arguments[--length]}var index=0;while(++index<length){var source=arguments[index];if(source){assigner(object,source,customizer)}}return object}}module.exports=createAssigner},{"lodash._bindcallback":18,"lodash._isiterateecall":19}],18:[function(require,module,exports){function bindCallback(func,thisArg,argCount){if(typeof func!="function"){return identity}if(typeof thisArg=="undefined"){return func}switch(argCount){case 1:return function(value){return func.call(thisArg,value)};case 3:return function(value,index,collection){return func.call(thisArg,value,index,collection)};case 4:return function(accumulator,value,index,collection){return func.call(thisArg,accumulator,value,index,collection)};case 5:return function(value,other,key,object,source){return func.call(thisArg,value,other,key,object,source)}}return function(){return func.apply(thisArg,arguments)}}function identity(value){return value}module.exports=bindCallback},{}],19:[function(require,module,exports){var MAX_SAFE_INTEGER=Math.pow(2,53)-1;function isIndex(value,length){value=+value;length=length==null?MAX_SAFE_INTEGER:length;return value>-1&&value%1==0&&value<length}function isIterateeCall(value,index,object){if(!isObject(object)){return false}var type=typeof index;if(type=="number"){var length=object.length,prereq=isLength(length)&&isIndex(index,length)}else{prereq=type=="string"&&index in object}if(prereq){var other=object[index];return value===value?value===other:other!==other}return false}function isLength(value){return typeof value=="number"&&value>-1&&value%1==0&&value<=MAX_SAFE_INTEGER}function isObject(value){var type=typeof value;return type=="function"||value&&type=="object"||false}module.exports=isIterateeCall},{}],"esformatter-jsx":[function(require,module,exports){var falafel=require("fresh-falafel");var defaults=require("lodash.defaults");module.exports={setOptions:function(opts){opts=opts||{};var jsxOptions=opts["jsx"]||{};var me=this;me.formatJSX=typeof jsxOptions.formatJSX==="undefined"?true:!!jsxOptions.formatJSX;var htmlOptions=jsxOptions.htmlOptions||{};me.htmlOptions=defaults(htmlOptions,{brace_style:"collapse",indent_char:" ",indent_size:2,max_preserve_newlines:2,preserve_newlines:true})},_sections:[],stringBefore:function(code){var me=this;var sections=me._sections=[];falafel.setParser(require("esprima-fb").parse);code=falafel(code,{loc:true},function(node){if(node.type==="XJSElement"&&node.parent.type!=="XJSElement"){var source=node.source();sections.push(source);node.update("void("+(sections.length-1)+"/*$$$_XJS_ELEMENT_$$$*/)")}});return code.toString()},stringAfter:function(code){var me=this;var sections=me._sections||[];if(sections.length===0){return code}return falafel(code,{loc:true},function(node){if(node.type==="UnaryExpression"&&node.operator==="void"&&node.source().match(/void\s*\(\s*(\d+)\s*\/\*\$\$\$_XJS_ELEMENT_\$\$\$\*\/\s*\)/g)){var nodeIdx=parseInt(node.argument.source(),10);var source=sections[nodeIdx];if(me.formatJSX){var beautifier=require("js-beautify");var first=false;source=beautifier.html(source,me.htmlOptions).split("\n").map(function(line){if(!first){first=true;return line}var alingWith=node.loc.start.column+1;return new Array(alingWith).join(" ")+line}).join("\n")}node.update(source)}}).toString()}}},{"esprima-fb":1,"fresh-falafel":2,"js-beautify":4,"lodash.defaults":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}({"insert-css":[function(require,module,exports){var inserted={};module.exports=function(css,options){if(inserted[css])return;inserted[css]=true;var elem=document.createElement("style");elem.setAttribute("type","text/css");if("textContent"in elem){elem.textContent=css}else{elem.styleSheet.cssText=css}var head=document.getElementsByTagName("head")[0];if(options&&options.prepend){head.insertBefore(elem,head.childNodes[0])}else{head.appendChild(elem)}}},{}]},{},[]);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}({domify:[function(require,module,exports){module.exports=parse;var div=document.createElement("div");div.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';var innerHTMLBug=!div.getElementsByTagName("link").length;div=undefined;var map={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>","</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:innerHTMLBug?[1,"X<div>","</div>"]:[0,"",""]};map.td=map.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];map.option=map.optgroup=[1,'<select multiple="multiple">',"</select>"];map.thead=map.tbody=map.colgroup=map.caption=map.tfoot=[1,"<table>","</table>"];map.text=map.circle=map.ellipse=map.line=map.path=map.polygon=map.polyline=map.rect=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];function parse(html,doc){if("string"!=typeof html)throw new TypeError("String expected");if(!doc)doc=document;var m=/<([\w:]+)/.exec(html);if(!m)return doc.createTextNode(html);html=html.replace(/^\s+|\s+$/g,"");var tag=m[1];if(tag=="body"){var el=doc.createElement("html");el.innerHTML=html;return el.removeChild(el.lastChild)}var wrap=map[tag]||map._default;var depth=wrap[0];var prefix=wrap[1];var suffix=wrap[2];var el=doc.createElement("div");el.innerHTML=prefix+html+suffix;while(depth--)el=el.lastChild;if(el.firstChild==el.lastChild){return el.removeChild(el.firstChild)}var fragment=doc.createDocumentFragment();while(el.firstChild){fragment.appendChild(el.removeChild(el.firstChild))}return fragment}},{}]},{},[]);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){var isNative=require("lodash.isnative");var FUNC_ERROR_TEXT="Expected a function";var nativeMax=Math.max,nativeNow=isNative(nativeNow=Date.now)&&nativeNow;var now=nativeNow||function(){return(new Date).getTime()};function debounce(func,wait,options){var args,maxTimeoutId,result,stamp,thisArg,timeoutId,trailingCall,lastCalled=0,maxWait=false,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}wait=wait<0?0:+wait||0;if(options===true){var leading=true;trailing=false}else if(isObject(options)){leading=options.leading;maxWait="maxWait"in options&&nativeMax(+options.maxWait||0,wait);trailing="trailing"in options?options.trailing:trailing}function cancel(){if(timeoutId){clearTimeout(timeoutId)}if(maxTimeoutId){clearTimeout(maxTimeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined}function delayed(){var remaining=wait-(now()-stamp);if(remaining<=0||remaining>wait){if(maxTimeoutId){clearTimeout(maxTimeoutId)}var isCalled=trailingCall;maxTimeoutId=timeoutId=trailingCall=undefined;if(isCalled){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}else{timeoutId=setTimeout(delayed,remaining)}}function maxDelayed(){if(timeoutId){clearTimeout(timeoutId)}maxTimeoutId=timeoutId=trailingCall=undefined;if(trailing||maxWait!==wait){lastCalled=now();result=func.apply(thisArg,args);if(!timeoutId&&!maxTimeoutId){args=thisArg=null}}}function debounced(){args=arguments;stamp=now();thisArg=this;trailingCall=trailing&&(timeoutId||!leading);if(maxWait===false){var leadingCall=leading&&!timeoutId}else{if(!maxTimeoutId&&!leading){lastCalled=stamp}var remaining=maxWait-(stamp-lastCalled),isCalled=remaining<=0||remaining>maxWait;if(isCalled){if(maxTimeoutId){maxTimeoutId=clearTimeout(maxTimeoutId)}lastCalled=stamp;result=func.apply(thisArg,args)}else if(!maxTimeoutId){maxTimeoutId=setTimeout(maxDelayed,remaining)}}if(isCalled&&timeoutId){timeoutId=clearTimeout(timeoutId)}else if(!timeoutId&&wait!==maxWait){timeoutId=setTimeout(delayed,wait)}if(leadingCall){isCalled=true;result=func.apply(thisArg,args)}if(isCalled&&!timeoutId&&!maxTimeoutId){args=thisArg=null}return result}debounced.cancel=cancel;return debounced}function isObject(value){var type=typeof value;return type=="function"||value&&type=="object"||false}module.exports=debounce},{"lodash.isnative":2}],2:[function(require,module,exports){var funcTag="[object Function]";var reHostCtor=/^\[object .+?Constructor\]$/;var reRegExpChars=/[.*+?^${}()|[\]\/\\]/g,reHasRegExpChars=RegExp(reRegExpChars.source);function baseToString(value){if(typeof value=="string"){return value}return value==null?"":value+""}function isObjectLike(value){return value&&typeof value=="object"||false}var objectProto=Object.prototype;var fnToString=Function.prototype.toString;var objToString=objectProto.toString;var reNative=RegExp("^"+escapeRegExp(objToString).replace(/toString|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function isNative(value){if(value==null){return false}if(objToString.call(value)==funcTag){return reNative.test(fnToString.call(value))}return isObjectLike(value)&&reHostCtor.test(value)||false}function escapeRegExp(string){string=baseToString(string);return string&&reHasRegExpChars.test(string)?string.replace(reRegExpChars,"\\$&"):string}module.exports=isNative},{}],"lodash.throttle":[function(require,module,exports){var debounce=require("lodash.debounce");var FUNC_ERROR_TEXT="Expected a function";var debounceOptions={leading:false,maxWait:0,trailing:false};function throttle(func,wait,options){var leading=true,trailing=true;if(typeof func!="function"){throw new TypeError(FUNC_ERROR_TEXT)}if(options===false){leading=false}else if(isObject(options)){leading="leading"in options?!!options.leading:leading;trailing="trailing"in options?!!options.trailing:trailing}debounceOptions.leading=leading;debounceOptions.maxWait=+wait;debounceOptions.trailing=trailing;return debounce(func,wait,debounceOptions)}function isObject(value){var type=typeof value;return type=="function"||value&&type=="object"||false}module.exports=throttle},{"lodash.debounce":1}]},{},[]);var config={indent:{value:" ",ArrayExpression:1,AssignmentExpression:1,BinaryExpression:1,ConditionalExpression:1,CallExpression:1,CatchClause:1,DoWhileStatement:1,ForInStatement:1,ForStatement:1,FunctionDeclaration:1,FunctionExpression:1,IfStatement:1,MemberExpression:1,MultipleVariableDeclaration:1,ObjectExpression:1,ReturnStatement:">=1",SwitchCase:1,SwitchStatement:1,TopLevelFunctionBlock:1,TryStatement:1,"VariableDeclaration.LogicalExpression":1,WhileStatement:1},lineBreak:{before:{AssignmentExpression:">=0",AssignmentOperator:0,BlockStatement:1,CallExpression:-1,ConditionalExpression:">=1",CatchOpeningBrace:0,CatchClosingBrace:">=1",CatchKeyword:0,DeleteOperator:">=1",DoWhileStatement:">=1",DoWhileStatementOpeningBrace:0,DoWhileStatementClosingBrace:">=1",EndOfFile:1,EmptyStatement:-1,FinallyKeyword:-1,FinallyOpeningBrace:0,FinallyClosingBrace:">=1",ForInStatement:">=1",ForInStatementExpressionOpening:0,ForInStatementExpressionClosing:0,ForInStatementOpeningBrace:0,ForInStatementClosingBrace:">=1",ForStatement:">=1",ForStatementExpressionOpening:0,ForStatementExpressionClosing:"<2",ForStatementOpeningBrace:0,ForStatementClosingBrace:">=1",FunctionExpression:0,FunctionExpressionOpeningBrace:0,FunctionExpressionClosingBrace:">=1",FunctionDeclaration:">=1",FunctionDeclarationOpeningBrace:0,FunctionDeclarationClosingBrace:">=1",IfStatement:">=1",IfStatementOpeningBrace:0,IfStatementClosingBrace:">=1",ElseIfStatement:0,ElseIfStatementOpeningBrace:0,ElseIfStatementClosingBrace:">=1",ElseStatement:0,ElseStatementOpeningBrace:0,ElseStatementClosingBrace:">=1",LogicalExpression:-1,ObjectExpressionOpeningBrace:0,ObjectExpressionClosingBrace:1,Property:1,ReturnStatement:">=1",SwitchOpeningBrace:0,SwitchClosingBrace:">=1",ThisExpression:-1,ThrowStatement:">=1",TryKeyword:-1,TryOpeningBrace:0,TryClosingBrace:">=1",VariableName:">=1",VariableValue:0,VariableDeclaration:">=1",VariableDeclarationWithoutInit:">=1",WhileStatement:">=1",WhileStatementOpeningBrace:0,WhileStatementClosingBrace:">=1",ArrayExpressionClosing:1},after:{AssignmentExpression:">=1",AssignmentOperator:0,BlockStatement:0,CallExpression:-1,CatchOpeningBrace:">=1",CatchClosingBrace:">=0",CatchKeyword:0,ConditionalExpression:">=1",DeleteOperator:">=1",DoWhileStatement:">=1",DoWhileStatementOpeningBrace:">=1",DoWhileStatementClosingBrace:0,EmptyStatement:-1,FinallyKeyword:-1,FinallyOpeningBrace:">=1",FinallyClosingBrace:">=1",ForInStatement:">=1",ForInStatementExpressionOpening:"<2",ForInStatementExpressionClosing:-1,ForInStatementOpeningBrace:">=1",ForInStatementClosingBrace:">=1",ForStatement:">=1",ForStatementExpressionOpening:"<2",ForStatementExpressionClosing:-1,ForStatementOpeningBrace:">=1",ForStatementClosingBrace:">=1",FunctionExpression:">=1",FunctionExpressionOpeningBrace:">=1",FunctionExpressionClosingBrace:-1,FunctionDeclaration:">=1",FunctionDeclarationOpeningBrace:">=1",FunctionDeclarationClosingBrace:">=1",IfStatement:">=1",IfStatementOpeningBrace:">=1",IfStatementClosingBrace:">=1",ElseIfStatement:">=1",ElseIfStatementOpeningBrace:">=1",ElseIfStatementClosingBrace:">=1",ElseStatement:">=1",ElseStatementOpeningBrace:">=1",ElseStatementClosingBrace:">=1",LogicalExpression:-1,ObjectExpressionClosingBrace:0,ObjectExpressionOpeningBrace:1,PropertyValue:0,Property:0,ReturnStatement:1,SwitchOpeningBrace:">=1",SwitchClosingBrace:">=1",ThisExpression:0,ThrowStatement:">=1",TryKeyword:-1,TryOpeningBrace:">=1",TryClosingBrace:0,VariableDeclaration:">=1",WhileStatement:">=1",WhileStatementOpeningBrace:">=1",WhileStatementClosingBrace:">=1",ArrayExpressionOpening:1,ArrayExpressionComma:1}},whiteSpace:{value:" ",removeTrailing:1,before:{ArgumentComma:0,ArgumentList:1,ArgumentListArrayExpression:0,ArgumentListFunctionExpression:1,ArgumentListObjectExpression:0,AssignmentOperator:1,BinaryExpression:0,BinaryExpressionOperator:1,BlockComment:1,CallExpression:1,CatchParameterList:0,CatchOpeningBrace:1,CatchClosingBrace:1,CatchKeyword:1,CommaOperator:0,ConditionalExpressionConsequent:1,ConditionalExpressionAlternate:1,DoWhileStatementOpeningBrace:1,DoWhileStatementClosingBrace:1,DoWhileStatementConditional:1,EmptyStatement:0,ExpressionClosingParentheses:0,FinallyKeyword:-1,FinallyOpeningBrace:1,FinallyClosingBrace:1,ForInStatement:1,ForInStatementExpressionOpening:1,ForInStatementExpressionClosing:0,ForInStatementOpeningBrace:1,ForInStatementClosingBrace:1,ForStatement:1,ForStatementExpressionOpening:1,ForStatementExpressionClosing:0,ForStatementOpeningBrace:1,ForStatementClosingBrace:1,ForStatementSemicolon:0,FunctionDeclarationOpeningBrace:1,FunctionDeclarationClosingBrace:1,FunctionExpressionOpeningBrace:1,FunctionExpressionClosingBrace:1,IfStatementConditionalOpening:1,IfStatementConditionalClosing:1,IfStatementOpeningBrace:1,IfStatementClosingBrace:1,ElseStatementOpeningBrace:1,ElseStatementClosingBrace:1,ElseIfStatementOpeningBrace:1,ElseIfStatementClosingBrace:1,MemberExpressionClosing:1,LineComment:1,LogicalExpressionOperator:1,Property:1,PropertyValue:1,ParameterList:1,SwitchDiscriminantOpening:1,SwitchDiscriminantClosing:0,ThrowKeyword:1,TryKeyword:-1,TryOpeningBrace:1,TryClosingBrace:1,UnaryExpressionOperator:0,VariableName:1,VariableValue:1,WhileStatementConditionalOpening:1,WhileStatementConditionalClosing:0,WhileStatementOpeningBrace:1,WhileStatementClosingBrace:1,ParameterComma:0,ArrayExpressionOpening:0,ArrayExpressionClosing:1,ArrayExpressionComma:0},after:{ArrayExpressionOpening:1,ArrayExpressionClosing:0,ArrayExpressionComma:1,ArgumentComma:1,ArgumentList:1,ArgumentListArrayExpression:1,ArgumentListFunctionExpression:1,ArgumentListObjectExpression:0,AssignmentOperator:1,BinaryExpression:0,BinaryExpressionOperator:1,BlockComment:1,CallExpression:0,CatchParameterList:0,CatchOpeningBrace:1,CatchClosingBrace:1,CatchKeyword:1,CommaOperator:1,ConditionalExpressionConsequent:1,ConditionalExpressionTest:1,DoWhileStatementOpeningBrace:1,DoWhileStatementClosingBrace:1,DoWhileStatementBody:1,EmptyStatement:0,ExpressionOpeningParentheses:0,FinallyKeyword:-1,FinallyOpeningBrace:1,FinallyClosingBrace:1,ForInStatement:1,ForInStatementExpressionOpening:0,ForInStatementExpressionClosing:1,ForInStatementOpeningBrace:1,ForInStatementClosingBrace:1,ForStatement:1,ForStatementExpressionOpening:0,ForStatementExpressionClosing:1,ForStatementClosingBrace:1,ForStatementOpeningBrace:1,ForStatementSemicolon:1,FunctionReservedWord:1,FunctionName:0,FunctionExpressionOpeningBrace:0,FunctionExpressionClosingBrace:0,FunctionDeclarationOpeningBrace:1,FunctionDeclarationClosingBrace:1,IfStatementConditionalOpening:1,IfStatementConditionalClosing:1,IfStatementOpeningBrace:1,IfStatementClosingBrace:1,ElseStatementOpeningBrace:1,ElseStatementClosingBrace:1,ElseIfStatementOpeningBrace:1,ElseIfStatementClosingBrace:1,MemberExpressionOpening:1,LogicalExpressionOperator:1,PropertyName:0,PropertyValue:0,ParameterComma:1,ParameterList:1,SwitchDiscriminantOpening:0,SwitchDiscriminantClosing:1,ThrowKeyword:1,TryKeyword:-1,TryOpeningBrace:1,TryClosingBrace:1,UnaryExpressionOperator:0,VariableName:1,WhileStatementConditionalOpening:0,WhileStatementConditionalClosing:1,WhileStatementOpeningBrace:1,WhileStatementClosingBrace:1,ObjectExpressionClosingBrace:0}}}; | |
var esformatter=require("esformatter");var esformatterJSX=require("esformatter-jsx");var plugin={nodeAfter:function(node){if(node.type==="ArrayExpression"){console.log(arguments)}}};esformatter.register(plugin);var insertCSS=require("insert-css");var domify=require("domify");var css="@import url(//facebook.github.io/react/css/codemirror.css); body {padding: 20px; box-sizing:border-box; } \n\nbody, html {\n height: 100%;\n}\n\n.main-container {\n position:relative; height: calc(100% - 150px) ;\n width: 100%;\n display: flex;\n box-sizing:border-box; padding: 22px 0 0 0;\n}\n h1 { white-space:nowrap; text-overflow:ellipsis; margin:17px 0 33px; font-family: Consolas, Monaco, Monospace; font-size: 36px; } h1 a { background: rgb(56, 159, 203);padding: 10px 15px 7px;color: #fff;text-decoration: none; } \n\n#source-area,\n#result-area {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n overflow: auto;\n flex: 1;\n min-height: 500px;\n border: 1px solid #aaa;\n margin: 0;\n}\n\n#source {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n overflow: auto;\n padding: 5px 10px;\n background: rgb(203, 68, 68);\n color: #fff;\n display: block;\n position: absolute;\n top: 0;\n left: 0;\n}\n\n#result {\n line-height: 1em;\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n padding: 5px 10px;\n background: rgb(116, 178, 116);\n color: #fff;\n display: block;\n position: absolute;\n top: 0;\n right: 0;\n}\n\n.CodeMirror.cm-s-default {\n height:100%; \n flex:1;\n border: 1px solid #aaa;\n}\n\n.CodeMirror pre {\n font-family: Consolas, Monaco, Monospace;\n font-size: 13px;\n}\n\n.CodeMirror.cm-s-default .cm-string-2 {\n color: #2A2523;\n} .credits { font-family: Consolas, Monaco, Monospace; font-size: 14px; padding: 10px 7px 6px; }";var testCode="// Paste your own code here...\n\n\n var Cards = React.createClass({\ngetInitialState: function() {\nreturn {\n allToggled: false\n};\n },\n onToggled: function(cardId, state) {\n var result = this.props.cards.filter(function(card) {\n return cardId === card.id;\n });\n if (result.length > 0) {\n result[0].toggled = state;\n }\n var allToggled = this.props.cards.reduce(function(prev, card) {\n console.log('prev', prev, card.toggled);\n return prev && card.toggled;\n}, true);\n\nconsole.log('>>>cards',this.props.cards, allToggled);\n\nthis.setState({\n allToggled: allToggled\n});\n},\n render: function() {\n var footerClass = 'final message';\n if (this.state.allToggled) {\n footerClass += ' on';\n }\n var me = this;\n var cards = this.props.cards.map(function(card) {\n var pos = {\n top: 0,\n left: card.id * 310\n };\n \n return <Card card={card}\n key = {card.id}\n pos = {pos}\n \n \n onToggled = {me.onToggled}\n />;\n });\n return <div>\n <div className=\"message\">\n <p> Lo que te voy a decir no es un secreto...<br />\n Pero igual deberás descubrirlo </p>\n</div>\n<div className=\"stage\"> {cards} </div>\n<div className={footerClass} >\n <p> Y no me cansaré de repetírtelo... <br /> Me haces muy feliz! </p>\n</div>\n</div>;\n }\n});\n\nvar cards = [{\n text: 'Te',\n id: 0,\n image: 'kitty-1.png'\n}, {\n text: 'amo',\n id: 1,\n image: 'kitty-2.png'\n}, {\n text: 'Eve bb',\n id: 2,\n image: 'kitty-3.png'\n}];\n\nReact.render( <Cards cards={cards} />, document.querySelector('.app'));";var iCode=window.localStorage.__code__||testCode;var html='<h1><a target="_blank" href="https://www.npmjs.com/package/esformatter-jsx">Esformatter + JSX (Beautify React JSX files)</a></h1><div class="main-container"><textarea id="source-area">'+iCode+'</textarea><textarea id="result-area"></textarea><div id="source">Javascript + JSX, code to beautify:</div><div id="result">Output, beautified code:</div></div><div class="credits">r3m</div><a href="https://twitter.com/share" class="twitter-share-button" data-via="royriojas" data-size="large" data-hashtags="esformatterjsx">Tweet</a><a href="https://twitter.com/royriojas" class="twitter-follow-button" data-show-count="false" data-size="large">Follow @royriojas</a>';esformatter.register(esformatterJSX);var body=document.body;body.appendChild(domify(html));var source=document.getElementById("source-area");var pre=document.getElementById("result-area");var throttle=require("lodash.throttle");insertCSS(css);var script=document.createElement("script");script.src="//cdn.jsdelivr.net/codemirror/4.5.0/codemirror.min.js";script.onload=function(){var js=document.createElement("script");js.src="//cdn.jsdelivr.net/codemirror/4.5.0/mode/javascript/javascript.js";js.onload=function(){var cdmIn=CodeMirror.fromTextArea(source,{lineNumbers:true,mode:"javascript"});var cdmOut=CodeMirror.fromTextArea(pre,{lineNumbers:true,mode:"javascript"});var formatCode=function(){try{var code=cdmIn.getValue();window.localStorage.__code__=code;cdmOut.setValue(esformatter.format(code,config))}catch(ex){cdmOut.setValue("//==> Error: "+ex.message);window.localStorage.__code__=testCode}};var fCode=throttle(formatCode,500);fCode();cdmIn.on("change",function(e){fCode()})};document.head.appendChild(js)};document.head.appendChild(script);!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?"http":"https";if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs)}}(document,"script","twitter-wjs"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"esformatter": "0.5.0", | |
"esformatter-jsx": "1.0.1", | |
"insert-css": "0.2.0", | |
"domify": "1.3.1", | |
"lodash.throttle": "3.0.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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