diff --git a/dist/sval.es6.js b/dist/sval.es6.js index 20bb99e..2b7c12d 100644 --- a/dist/sval.es6.js +++ b/dist/sval.es6.js @@ -13,6 +13,8 @@ get ReturnStatement () { return ReturnStatement$1; }, get BreakStatement () { return BreakStatement$1; }, get ContinueStatement () { return ContinueStatement$1; }, + get LabeledStatement () { return LabeledStatement$1; }, + get WithStatement () { return WithStatement$1; }, get IfStatement () { return IfStatement$1; }, get SwitchStatement () { return SwitchStatement$1; }, get SwitchCase () { return SwitchCase$1; }, @@ -49,6 +51,8 @@ get ReturnStatement () { return ReturnStatement; }, get BreakStatement () { return BreakStatement; }, get ContinueStatement () { return ContinueStatement; }, + get LabeledStatement () { return LabeledStatement; }, + get WithStatement () { return WithStatement; }, get IfStatement () { return IfStatement; }, get SwitchStatement () { return SwitchStatement; }, get SwitchCase () { return SwitchCase; }, @@ -395,6 +399,10 @@ globalObj.crypto = crypto; } catch (err) { } + try { + globalObj.URL = URL; + } + catch (err) { } names = getOwnNames(globalObj); } } @@ -443,8 +451,8 @@ const AWAIT = { RES: undefined }; const RETURN = { RES: undefined }; - const CONTINUE = createSymbol('continue'); - const BREAK = createSymbol('break'); + const CONTINUE = { LABEL: undefined }; + const BREAK = { LABEL: undefined }; const SUPER = createSymbol('super'); const SUPERCALL = createSymbol('supercall'); const NOCTOR = createSymbol('noctor'); @@ -456,7 +464,7 @@ const IMPORT = createSymbol('import'); const EXPORTS = createSymbol('exports'); - var version = "0.5.3"; + var version = "0.5.4"; class Var { constructor(kind, value) { @@ -495,6 +503,7 @@ class Scope { constructor(parent = null, isolated = false) { this.context = create(null); + this.withContext = create(null); this.parent = parent; this.isolated = isolated; } @@ -505,18 +514,13 @@ } return scope; } - clone() { - const cloneScope = new Scope(this.parent, this.isolated); - for (const name in this.context) { - const variable = this.context[name]; - cloneScope[variable.kind](name, variable.get()); - } - return cloneScope; - } find(name) { if (this.context[name]) { return this.context[name]; } + else if (name in this.withContext) { + return new Prop(this.withContext, name); + } else if (this.parent) { return this.parent.find(name); } @@ -583,6 +587,11 @@ throw new SyntaxError(`Identifier '${name}' has already been declared`); } } + with(value) { + if (Object.keys(value)) { + this.withContext = value; + } + } } function Identifier$1(node, scope, options = {}) { @@ -1382,7 +1391,13 @@ } for (let i = 0; i < block.body.length; i++) { const result = evaluate$1(block.body[i], subScope); - if (result === BREAK || result === CONTINUE || result === RETURN) { + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + break; + } + return result; + } + if (result === CONTINUE || result === RETURN) { return result; } } @@ -1396,21 +1411,79 @@ RETURN.RES = node.argument ? (evaluate$1(node.argument, scope)) : undefined; return RETURN; } - function BreakStatement$1() { + function BreakStatement$1(node) { + var _a; + BREAK.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return BREAK; } - function ContinueStatement$1() { + function ContinueStatement$1(node) { + var _a; + CONTINUE.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return CONTINUE; } - function IfStatement$1(node, scope) { - if (evaluate$1(node.test, scope)) { - return evaluate$1(node.consequent, scope); + function LabeledStatement$1(node, scope) { + const label = node.label.name; + if (node.body.type === 'WhileStatement') { + return WhileStatement$1(node.body, scope, { label }); } - else { - return evaluate$1(node.alternate, scope); + if (node.body.type === 'DoWhileStatement') { + return DoWhileStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'ForStatement') { + return ForStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'ForInStatement') { + return ForInStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'ForOfStatement') { + return ForOfStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'BlockStatement') { + return BlockStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'WithStatement') { + return WithStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'IfStatement') { + return IfStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'SwitchStatement') { + return SwitchStatement$1(node.body, scope, { label }); + } + if (node.body.type === 'TryStatement') { + return TryStatement$1(node.body, scope, { label }); + } + throw new SyntaxError(`${node.body.type} cannot be labeled`); + } + function WithStatement$1(node, scope, options = {}) { + const withScope = new Scope(scope); + withScope.with(evaluate$1(node.object, scope)); + const result = evaluate$1(node.body, withScope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; } } - function SwitchStatement$1(node, scope) { + function IfStatement$1(node, scope, options = {}) { + const result = evaluate$1(node.test, scope) + ? evaluate$1(node.consequent, scope) + : evaluate$1(node.alternate, scope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } + } + function SwitchStatement$1(node, scope, options = {}) { const discriminant = evaluate$1(node.discriminant, scope); let matched = false; for (let i = 0; i < node.cases.length; i++) { @@ -1423,7 +1496,10 @@ if (matched) { const result = SwitchCase$1(eachCase, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } if (result === CONTINUE || result === RETURN) { return result; @@ -1442,9 +1518,10 @@ function ThrowStatement$1(node, scope) { throw evaluate$1(node.argument, scope); } - function TryStatement$1(node, scope) { + function TryStatement$1(node, scope, options = {}) { + let result; try { - return BlockStatement$1(node.block, scope); + result = BlockStatement$1(node.block, scope); } catch (err) { if (node.handler) { @@ -1459,7 +1536,7 @@ pattern(param, scope, { feed: err }); } } - return CatchClause$1(node.handler, subScope); + result = CatchClause$1(node.handler, subScope); } else { throw err; @@ -1467,45 +1544,63 @@ } finally { if (node.finalizer) { - const result = BlockStatement$1(node.finalizer, scope); - if (result === BREAK || result === CONTINUE || result === RETURN) { - return result; - } + result = BlockStatement$1(node.finalizer, scope); } } + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } } function CatchClause$1(node, scope) { return BlockStatement$1(node.body, scope, { invasived: true }); } - function WhileStatement$1(node, scope) { + function WhileStatement$1(node, scope, options = {}) { while (evaluate$1(node.test, scope)) { const result = evaluate$1(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function DoWhileStatement$1(node, scope) { + function DoWhileStatement$1(node, scope, options = {}) { do { const result = evaluate$1(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } while (evaluate$1(node.test, scope)); } - function ForStatement$1(node, scope) { + function ForStatement$1(node, scope, options = {}) { const forScope = new Scope(scope); for (evaluate$1(node.init, forScope); node.test ? (evaluate$1(node.test, forScope)) : true; evaluate$1(node.update, forScope)) { const subScope = new Scope(forScope); @@ -1517,39 +1612,57 @@ result = evaluate$1(node.body, subScope); } if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function ForInStatement$1(node, scope) { + function ForInStatement$1(node, scope, options = {}) { for (const value in evaluate$1(node.right, scope)) { const result = ForXHandler(node, scope, { value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function ForOfStatement$1(node, scope) { + function ForOfStatement$1(node, scope, options = {}) { const right = evaluate$1(node.right, scope); for (const value of right) { const result = ForXHandler(node, scope, { value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; @@ -2660,7 +2773,13 @@ } for (let i = 0; i < block.body.length; i++) { const result = yield* evaluate(block.body[i], subScope); - if (result === BREAK || result === CONTINUE || result === RETURN) { + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + break; + } + return result; + } + if (result === CONTINUE || result === RETURN) { return result; } } @@ -2674,21 +2793,79 @@ RETURN.RES = node.argument ? (yield* evaluate(node.argument, scope)) : undefined; return RETURN; } - function* BreakStatement() { + function* BreakStatement(node) { + var _a; + BREAK.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return BREAK; } - function* ContinueStatement() { + function* ContinueStatement(node) { + var _a; + CONTINUE.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return CONTINUE; } - function* IfStatement(node, scope) { - if (yield* evaluate(node.test, scope)) { - return yield* evaluate(node.consequent, scope); + function* LabeledStatement(node, scope) { + const label = node.label.name; + if (node.body.type === 'WhileStatement') { + return yield* WhileStatement(node.body, scope, { label }); } - else { - return yield* evaluate(node.alternate, scope); + if (node.body.type === 'DoWhileStatement') { + return yield* DoWhileStatement(node.body, scope, { label }); + } + if (node.body.type === 'ForStatement') { + return yield* ForStatement(node.body, scope, { label }); + } + if (node.body.type === 'ForInStatement') { + return yield* ForInStatement(node.body, scope, { label }); + } + if (node.body.type === 'ForOfStatement') { + return yield* ForOfStatement(node.body, scope, { label }); + } + if (node.body.type === 'BlockStatement') { + return yield* BlockStatement(node.body, scope, { label }); + } + if (node.body.type === 'WithStatement') { + return yield* WithStatement(node.body, scope, { label }); + } + if (node.body.type === 'IfStatement') { + return yield* IfStatement(node.body, scope, { label }); + } + if (node.body.type === 'SwitchStatement') { + return yield* SwitchStatement(node.body, scope, { label }); + } + if (node.body.type === 'TryStatement') { + return yield* TryStatement(node.body, scope, { label }); + } + throw new SyntaxError(`${node.body.type} cannot be labeled`); + } + function* WithStatement(node, scope, options = {}) { + const withScope = new Scope(scope); + withScope.with(yield* evaluate(node.object, scope)); + const result = yield* evaluate(node.body, withScope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } + } + function* IfStatement(node, scope, options = {}) { + const result = yield* evaluate(node.test, scope) + ? yield* evaluate(node.consequent, scope) + : yield* evaluate(node.alternate, scope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; } } - function* SwitchStatement(node, scope) { + function* SwitchStatement(node, scope, options = {}) { const discriminant = yield* evaluate(node.discriminant, scope); let matched = false; for (let i = 0; i < node.cases.length; i++) { @@ -2701,7 +2878,10 @@ if (matched) { const result = yield* SwitchCase(eachCase, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } if (result === CONTINUE || result === RETURN) { return result; @@ -2720,9 +2900,10 @@ function* ThrowStatement(node, scope) { throw yield* evaluate(node.argument, scope); } - function* TryStatement(node, scope) { + function* TryStatement(node, scope, options = {}) { + let result; try { - return yield* BlockStatement(node.block, scope); + result = yield* BlockStatement(node.block, scope); } catch (err) { if (node.handler) { @@ -2737,7 +2918,7 @@ yield* pattern$1(param, scope, { feed: err }); } } - return yield* CatchClause(node.handler, subScope); + result = yield* CatchClause(node.handler, subScope); } else { throw err; @@ -2745,45 +2926,63 @@ } finally { if (node.finalizer) { - const result = yield* BlockStatement(node.finalizer, scope); - if (result === BREAK || result === CONTINUE || result === RETURN) { - return result; - } + result = yield* BlockStatement(node.finalizer, scope); } } + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } } function* CatchClause(node, scope) { return yield* BlockStatement(node.body, scope, { invasived: true }); } - function* WhileStatement(node, scope) { + function* WhileStatement(node, scope, options = {}) { while (yield* evaluate(node.test, scope)) { const result = yield* evaluate(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function* DoWhileStatement(node, scope) { + function* DoWhileStatement(node, scope, options = {}) { do { const result = yield* evaluate(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } while (yield* evaluate(node.test, scope)); } - function* ForStatement(node, scope) { + function* ForStatement(node, scope, options = {}) { const forScope = new Scope(scope); for (yield* evaluate(node.init, forScope); node.test ? (yield* evaluate(node.test, forScope)) : true; yield* evaluate(node.update, forScope)) { const subScope = new Scope(forScope); @@ -2795,31 +2994,43 @@ result = yield* evaluate(node.body, subScope); } if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function* ForInStatement(node, scope) { + function* ForInStatement(node, scope, options = {}) { for (const value in yield* evaluate(node.right, scope)) { const result = yield* ForXHandler$1(node, scope, { value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function* ForOfStatement(node, scope) { + function* ForOfStatement(node, scope, options = {}) { const right = yield* evaluate(node.right, scope); if (node.await) { const iterator = getAsyncIterator(right); @@ -2827,10 +3038,16 @@ for (AWAIT.RES = iterator.next(), ret = yield AWAIT; !ret.done; AWAIT.RES = iterator.next(), ret = yield AWAIT) { const result = yield* ForXHandler$1(node, scope, { value: ret.value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; @@ -2841,10 +3058,16 @@ for (const value of right) { const result = yield* ForXHandler$1(node, scope, { value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; @@ -3303,6 +3526,7 @@ } } function createFunc$1(node, scope, options = {}) { + var _a; if (!node.generator && !node.async) { return createFunc(node, scope, options); } @@ -3396,6 +3620,13 @@ value: params.length, configurable: true }); + const source = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.source; + if (source) { + define(func, 'toString', { + value: () => source.substring(node.start, node.end), + configurable: true + }); + } return func; } function* createClass$1(node, scope) { @@ -3554,6 +3785,7 @@ } } function createFunc(node, scope, options = {}) { + var _a; if (node.generator || node.async) { return createFunc$1(node, scope, options); } @@ -3619,6 +3851,13 @@ value: params.length, configurable: true }); + const source = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.source; + if (source) { + define(func, 'toString', { + value: () => source.substring(node.start, node.end), + configurable: true + }); + } return func; } function createClass(node, scope) { diff --git a/dist/sval.js b/dist/sval.js index 68cc617..a321d89 100644 --- a/dist/sval.js +++ b/dist/sval.js @@ -13,6 +13,8 @@ get ReturnStatement () { return ReturnStatement$1; }, get BreakStatement () { return BreakStatement$1; }, get ContinueStatement () { return ContinueStatement$1; }, + get LabeledStatement () { return LabeledStatement$1; }, + get WithStatement () { return WithStatement$1; }, get IfStatement () { return IfStatement$1; }, get SwitchStatement () { return SwitchStatement$1; }, get SwitchCase () { return SwitchCase$1; }, @@ -49,6 +51,8 @@ get ReturnStatement () { return ReturnStatement; }, get BreakStatement () { return BreakStatement; }, get ContinueStatement () { return ContinueStatement; }, + get LabeledStatement () { return LabeledStatement; }, + get WithStatement () { return WithStatement; }, get IfStatement () { return IfStatement; }, get SwitchStatement () { return SwitchStatement; }, get SwitchCase () { return SwitchCase; }, @@ -395,6 +399,10 @@ globalObj.crypto = crypto; } catch (err) { } + try { + globalObj.URL = URL; + } + catch (err) { } names = getOwnNames(globalObj); } } @@ -444,8 +452,8 @@ var AWAIT = { RES: undefined }; var RETURN = { RES: undefined }; - var CONTINUE = createSymbol('continue'); - var BREAK = createSymbol('break'); + var CONTINUE = { LABEL: undefined }; + var BREAK = { LABEL: undefined }; var SUPER = createSymbol('super'); var SUPERCALL = createSymbol('supercall'); var NOCTOR = createSymbol('noctor'); @@ -500,6 +508,7 @@ if (parent === void 0) { parent = null; } if (isolated === void 0) { isolated = false; } this.context = create(null); + this.withContext = create(null); this.parent = parent; this.isolated = isolated; } @@ -510,18 +519,13 @@ } return scope; }; - Scope.prototype.clone = function () { - var cloneScope = new Scope(this.parent, this.isolated); - for (var name_1 in this.context) { - var variable = this.context[name_1]; - cloneScope[variable.kind](name_1, variable.get()); - } - return cloneScope; - }; Scope.prototype.find = function (name) { if (this.context[name]) { return this.context[name]; } + else if (name in this.withContext) { + return new Prop(this.withContext, name); + } else if (this.parent) { return this.parent.find(name); } @@ -588,6 +592,11 @@ throw new SyntaxError("Identifier '" + name + "' has already been declared"); } }; + Scope.prototype.with = function (value) { + if (Object.keys(value)) { + this.withContext = value; + } + }; return Scope; }()); @@ -1473,7 +1482,13 @@ } for (var i = 0; i < block.body.length; i++) { var result = evaluate$1(block.body[i], subScope); - if (result === BREAK || result === CONTINUE || result === RETURN) { + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + break; + } + return result; + } + if (result === CONTINUE || result === RETURN) { return result; } } @@ -1487,21 +1502,82 @@ RETURN.RES = node.argument ? (evaluate$1(node.argument, scope)) : undefined; return RETURN; } - function BreakStatement$1() { + function BreakStatement$1(node) { + var _a; + BREAK.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return BREAK; } - function ContinueStatement$1() { + function ContinueStatement$1(node) { + var _a; + CONTINUE.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return CONTINUE; } - function IfStatement$1(node, scope) { - if (evaluate$1(node.test, scope)) { - return evaluate$1(node.consequent, scope); + function LabeledStatement$1(node, scope) { + var label = node.label.name; + if (node.body.type === 'WhileStatement') { + return WhileStatement$1(node.body, scope, { label: label }); } - else { - return evaluate$1(node.alternate, scope); + if (node.body.type === 'DoWhileStatement') { + return DoWhileStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'ForStatement') { + return ForStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'ForInStatement') { + return ForInStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'ForOfStatement') { + return ForOfStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'BlockStatement') { + return BlockStatement$1(node.body, scope, { label: label }); } + if (node.body.type === 'WithStatement') { + return WithStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'IfStatement') { + return IfStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'SwitchStatement') { + return SwitchStatement$1(node.body, scope, { label: label }); + } + if (node.body.type === 'TryStatement') { + return TryStatement$1(node.body, scope, { label: label }); + } + throw new SyntaxError(node.body.type + " cannot be labeled"); } - function SwitchStatement$1(node, scope) { + function WithStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } + var withScope = new Scope(scope); + withScope.with(evaluate$1(node.object, scope)); + var result = evaluate$1(node.body, withScope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } + } + function IfStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } + var result = evaluate$1(node.test, scope) + ? evaluate$1(node.consequent, scope) + : evaluate$1(node.alternate, scope); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } + } + function SwitchStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } var discriminant = evaluate$1(node.discriminant, scope); var matched = false; for (var i = 0; i < node.cases.length; i++) { @@ -1514,7 +1590,10 @@ if (matched) { var result = SwitchCase$1(eachCase, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } if (result === CONTINUE || result === RETURN) { return result; @@ -1533,9 +1612,11 @@ function ThrowStatement$1(node, scope) { throw evaluate$1(node.argument, scope); } - function TryStatement$1(node, scope) { + function TryStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } + var result; try { - return BlockStatement$1(node.block, scope); + result = BlockStatement$1(node.block, scope); } catch (err) { if (node.handler) { @@ -1550,7 +1631,7 @@ pattern(param, scope, { feed: err }); } } - return CatchClause$1(node.handler, subScope); + result = CatchClause$1(node.handler, subScope); } else { throw err; @@ -1558,45 +1639,66 @@ } finally { if (node.finalizer) { - var result = BlockStatement$1(node.finalizer, scope); - if (result === BREAK || result === CONTINUE || result === RETURN) { - return result; - } + result = BlockStatement$1(node.finalizer, scope); } } + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return; + } + return result; + } + if (result === CONTINUE || result === RETURN) { + return result; + } } function CatchClause$1(node, scope) { return BlockStatement$1(node.body, scope, { invasived: true }); } - function WhileStatement$1(node, scope) { + function WhileStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } while (evaluate$1(node.test, scope)) { var result = evaluate$1(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function DoWhileStatement$1(node, scope) { + function DoWhileStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } do { var result = evaluate$1(node.body, scope); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } while (evaluate$1(node.test, scope)); } - function ForStatement$1(node, scope) { + function ForStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } var forScope = new Scope(scope); for (evaluate$1(node.init, forScope); node.test ? (evaluate$1(node.test, forScope)) : true; evaluate$1(node.update, forScope)) { var subScope = new Scope(forScope); @@ -1608,42 +1710,62 @@ result = evaluate$1(node.body, subScope); } if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function ForInStatement$1(node, scope) { + function ForInStatement$1(node, scope, options) { + if (options === void 0) { options = {}; } for (var value in evaluate$1(node.right, scope)) { var result = ForXHandler(node, scope, { value: value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; } } } - function ForOfStatement$1(node, scope) { + function ForOfStatement$1(node, scope, options) { var e_1, _a; + if (options === void 0) { options = {}; } var right = evaluate$1(node.right, scope); try { for (var right_1 = __values(right), right_1_1 = right_1.next(); !right_1_1.done; right_1_1 = right_1.next()) { var value = right_1_1.value; var result = ForXHandler(node, scope, { value: value }); if (result === BREAK) { - break; + if (result.LABEL === options.label) { + break; + } + return result; } else if (result === CONTINUE) { - continue; + if (result.LABEL === options.label) { + continue; + } + return result; } else if (result === RETURN) { return result; @@ -3171,7 +3293,13 @@ return [5, __values(evaluate(block.body[i], subScope))]; case 4: result = _c.sent(); - if (result === BREAK || result === CONTINUE || result === RETURN) { + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return [3, 6]; + } + return [2, result]; + } + if (result === CONTINUE || result === RETURN) { return [2, result]; } _c.label = 5; @@ -3213,31 +3341,130 @@ } }); } - function BreakStatement() { - return __generator(this, function (_a) { + function BreakStatement(node) { + var _a; + return __generator(this, function (_b) { + BREAK.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return [2, BREAK]; }); } - function ContinueStatement() { - return __generator(this, function (_a) { + function ContinueStatement(node) { + var _a; + return __generator(this, function (_b) { + CONTINUE.LABEL = (_a = node.label) === null || _a === void 0 ? void 0 : _a.name; return [2, CONTINUE]; }); } - function IfStatement(node, scope) { + function LabeledStatement(node, scope) { + var label; return __generator(this, function (_a) { switch (_a.label) { - case 0: return [5, __values(evaluate(node.test, scope))]; + case 0: + label = node.label.name; + if (!(node.body.type === 'WhileStatement')) return [3, 2]; + return [5, __values(WhileStatement(node.body, scope, { label: label }))]; + case 1: return [2, _a.sent()]; + case 2: + if (!(node.body.type === 'DoWhileStatement')) return [3, 4]; + return [5, __values(DoWhileStatement(node.body, scope, { label: label }))]; + case 3: return [2, _a.sent()]; + case 4: + if (!(node.body.type === 'ForStatement')) return [3, 6]; + return [5, __values(ForStatement(node.body, scope, { label: label }))]; + case 5: return [2, _a.sent()]; + case 6: + if (!(node.body.type === 'ForInStatement')) return [3, 8]; + return [5, __values(ForInStatement(node.body, scope, { label: label }))]; + case 7: return [2, _a.sent()]; + case 8: + if (!(node.body.type === 'ForOfStatement')) return [3, 10]; + return [5, __values(ForOfStatement(node.body, scope, { label: label }))]; + case 9: return [2, _a.sent()]; + case 10: + if (!(node.body.type === 'BlockStatement')) return [3, 12]; + return [5, __values(BlockStatement(node.body, scope, { label: label }))]; + case 11: return [2, _a.sent()]; + case 12: + if (!(node.body.type === 'WithStatement')) return [3, 14]; + return [5, __values(WithStatement(node.body, scope, { label: label }))]; + case 13: return [2, _a.sent()]; + case 14: + if (!(node.body.type === 'IfStatement')) return [3, 16]; + return [5, __values(IfStatement(node.body, scope, { label: label }))]; + case 15: return [2, _a.sent()]; + case 16: + if (!(node.body.type === 'SwitchStatement')) return [3, 18]; + return [5, __values(SwitchStatement(node.body, scope, { label: label }))]; + case 17: return [2, _a.sent()]; + case 18: + if (!(node.body.type === 'TryStatement')) return [3, 20]; + return [5, __values(TryStatement(node.body, scope, { label: label }))]; + case 19: return [2, _a.sent()]; + case 20: throw new SyntaxError(node.body.type + " cannot be labeled"); + } + }); + } + function WithStatement(node, scope, options) { + var withScope, _a, _b, result; + if (options === void 0) { options = {}; } + return __generator(this, function (_c) { + switch (_c.label) { + case 0: + withScope = new Scope(scope); + _b = (_a = withScope).with; + return [5, __values(evaluate(node.object, scope))]; case 1: - if (!_a.sent()) return [3, 3]; + _b.apply(_a, [_c.sent()]); + return [5, __values(evaluate(node.body, withScope))]; + case 2: + result = _c.sent(); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return [2]; + } + return [2, result]; + } + if (result === CONTINUE || result === RETURN) { + return [2, result]; + } + return [2]; + } + }); + } + function IfStatement(node, scope, options) { + var result, _a; + if (options === void 0) { options = {}; } + return __generator(this, function (_b) { + switch (_b.label) { + case 0: + if (!evaluate(node.test, scope)) return [3, 2]; return [5, __values(evaluate(node.consequent, scope))]; - case 2: return [2, _a.sent()]; - case 3: return [5, __values(evaluate(node.alternate, scope))]; - case 4: return [2, _a.sent()]; + case 1: + _a = _b.sent(); + return [3, 4]; + case 2: return [5, __values(evaluate(node.alternate, scope))]; + case 3: + _a = _b.sent(); + _b.label = 4; + case 4: return [5, __values(_a)]; + case 5: + result = _b.sent(); + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return [2]; + } + return [2, result]; + } + if (result === CONTINUE || result === RETURN) { + return [2, result]; + } + return [2]; } }); } - function SwitchStatement(node, scope) { + function SwitchStatement(node, scope, options) { var discriminant, matched, i, eachCase, _a, _b, result; + if (options === void 0) { options = {}; } return __generator(this, function (_c) { switch (_c.label) { case 0: return [5, __values(evaluate(node.discriminant, scope))]; @@ -3269,7 +3496,10 @@ case 6: result = _c.sent(); if (result === BREAK) { - return [3, 8]; + if (result.LABEL === options.label) { + return [3, 8]; + } + return [2, result]; } if (result === CONTINUE || result === RETURN) { return [2, result]; @@ -3313,14 +3543,17 @@ } }); } - function TryStatement(node, scope) { - var err_1, subScope, param, name_1, result; + function TryStatement(node, scope, options) { + var result, err_1, subScope, param, name_1; + if (options === void 0) { options = {}; } return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, 9, 12]); return [5, __values(BlockStatement(node.block, scope))]; - case 1: return [2, _a.sent()]; + case 1: + result = _a.sent(); + return [3, 12]; case 2: err_1 = _a.sent(); if (!node.handler) return [3, 7]; @@ -3336,7 +3569,9 @@ _a.sent(); _a.label = 5; case 5: return [5, __values(CatchClause(node.handler, subScope))]; - case 6: return [2, _a.sent()]; + case 6: + result = _a.sent(); + return [3, 8]; case 7: throw err_1; case 8: return [3, 12]; case 9: @@ -3344,12 +3579,19 @@ return [5, __values(BlockStatement(node.finalizer, scope))]; case 10: result = _a.sent(); - if (result === BREAK || result === CONTINUE || result === RETURN) { - return [2, result]; - } _a.label = 11; case 11: return [7]; - case 12: return [2]; + case 12: + if (result === BREAK) { + if (result.LABEL && result.LABEL === options.label) { + return [2]; + } + return [2, result]; + } + if (result === CONTINUE || result === RETURN) { + return [2, result]; + } + return [2]; } }); } @@ -3361,8 +3603,9 @@ } }); } - function WhileStatement(node, scope) { + function WhileStatement(node, scope, options) { var result; + if (options === void 0) { options = {}; } return __generator(this, function (_a) { switch (_a.label) { case 0: return [5, __values(evaluate(node.test, scope))]; @@ -3372,10 +3615,16 @@ case 2: result = _a.sent(); if (result === BREAK) { - return [3, 3]; + if (result.LABEL === options.label) { + return [3, 3]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 0]; + if (result.LABEL === options.label) { + return [3, 0]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -3385,18 +3634,25 @@ } }); } - function DoWhileStatement(node, scope) { + function DoWhileStatement(node, scope, options) { var result; + if (options === void 0) { options = {}; } return __generator(this, function (_a) { switch (_a.label) { case 0: return [5, __values(evaluate(node.body, scope))]; case 1: result = _a.sent(); if (result === BREAK) { - return [3, 4]; + if (result.LABEL === options.label) { + return [3, 4]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 2]; + if (result.LABEL === options.label) { + return [3, 2]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -3410,8 +3666,9 @@ } }); } - function ForStatement(node, scope) { + function ForStatement(node, scope, options) { var forScope, _a, subScope, result; + if (options === void 0) { options = {}; } return __generator(this, function (_b) { switch (_b.label) { case 0: @@ -3444,10 +3701,16 @@ _b.label = 9; case 9: if (result === BREAK) { - return [3, 12]; + if (result.LABEL === options.label) { + return [3, 12]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 10]; + if (result.LABEL === options.label) { + return [3, 10]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -3461,8 +3724,9 @@ } }); } - function ForInStatement(node, scope) { + function ForInStatement(node, scope, options) { var _a, _b, _i, value, result; + if (options === void 0) { options = {}; } return __generator(this, function (_c) { switch (_c.label) { case 0: @@ -3480,10 +3744,16 @@ case 3: result = _c.sent(); if (result === BREAK) { - return [3, 5]; + if (result.LABEL === options.label) { + return [3, 5]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 4]; + if (result.LABEL === options.label) { + return [3, 4]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -3496,9 +3766,10 @@ } }); } - function ForOfStatement(node, scope) { + function ForOfStatement(node, scope, options) { var right, iterator, ret, result, right_1, right_1_1, value, result, e_1_1; var e_1, _a; + if (options === void 0) { options = {}; } return __generator(this, function (_b) { switch (_b.label) { case 0: return [5, __values(evaluate(node.right, scope))]; @@ -3518,10 +3789,16 @@ case 4: result = _b.sent(); if (result === BREAK) { - return [3, 7]; + if (result.LABEL === options.label) { + return [3, 7]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 5]; + if (result.LABEL === options.label) { + return [3, 5]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -3545,10 +3822,16 @@ case 10: result = _b.sent(); if (result === BREAK) { - return [3, 12]; + if (result.LABEL === options.label) { + return [3, 12]; + } + return [2, result]; } else if (result === CONTINUE) { - return [3, 11]; + if (result.LABEL === options.label) { + return [3, 11]; + } + return [2, result]; } else if (result === RETURN) { return [2, result]; @@ -4261,15 +4544,16 @@ }); } function createFunc$1(node, scope, options) { + var _a; if (options === void 0) { options = {}; } if (!node.generator && !node.async) { return createFunc(node, scope, options); } var superClass = options.superClass, construct = options.construct; var params = node.params; - var tmpFunc = function _a() { + var tmpFunc = function _b() { var _i, subScope, i, param, result; - var _newTarget = this && this instanceof _a ? this.constructor : void 0; + var _newTarget = this && this instanceof _b ? this.constructor : void 0; var args = []; for (_i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; @@ -4388,6 +4672,13 @@ value: params.length, configurable: true }); + var source = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.source; + if (source) { + define(func, 'toString', { + value: function () { return source.substring(node.start, node.end); }, + configurable: true + }); + } return func; } function createClass$1(node, scope) { @@ -4593,14 +4884,15 @@ } } function createFunc(node, scope, options) { + var _a; if (options === void 0) { options = {}; } if (node.generator || node.async) { return createFunc$1(node, scope, options); } var superClass = options.superClass, construct = options.construct; var params = node.params; - var tmpFunc = function _a() { - var _newTarget = this && this instanceof _a ? this.constructor : void 0; + var tmpFunc = function _b() { + var _newTarget = this && this instanceof _b ? this.constructor : void 0; var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; @@ -4664,6 +4956,13 @@ value: params.length, configurable: true }); + var source = (_a = node.loc) === null || _a === void 0 ? void 0 : _a.source; + if (source) { + define(func, 'toString', { + value: function () { return source.substring(node.start, node.end); }, + configurable: true + }); + } return func; } function createClass(node, scope) { diff --git a/dist/sval.min.js b/dist/sval.min.js index 62ea8b4..d5b4c1b 100644 --- a/dist/sval.min.js +++ b/dist/sval.min.js @@ -1 +1 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).Sval=t()}(this,function(){"use strict";var O=Object.freeze({__proto__:null,get ExpressionStatement(){return Ft},get BlockStatement(){return jt},get EmptyStatement(){return Ut},get DebuggerStatement(){return qt},get ReturnStatement(){return Gt},get BreakStatement(){return Wt},get ContinueStatement(){return Ht},get IfStatement(){return zt},get SwitchStatement(){return Kt},get SwitchCase(){return Qt},get ThrowStatement(){return Xt},get TryStatement(){return Yt},get CatchClause(){return Zt},get WhileStatement(){return Jt},get DoWhileStatement(){return $t},get ForStatement(){return er},get ForInStatement(){return tr},get ForOfStatement(){return rr}}),B=Object.freeze({__proto__:null,get FunctionDeclaration(){return ir},get VariableDeclaration(){return nr},get VariableDeclarator(){return sr},get ClassDeclaration(){return ar},get ClassBody(){return or},get MethodDefinition(){return cr},get PropertyDefinition(){return hr},get StaticBlock(){return ur},get ImportDeclaration(){return lr},get ExportDefaultDeclaration(){return pr},get ExportNamedDeclaration(){return dr},get ExportAllDeclaration(){return fr}}),M=Object.freeze({__proto__:null,get ExpressionStatement(){return Tr},get BlockStatement(){return Vr},get EmptyStatement(){return Nr},get DebuggerStatement(){return Lr},get ReturnStatement(){return Rr},get BreakStatement(){return Dr},get ContinueStatement(){return Or},get IfStatement(){return Br},get SwitchStatement(){return Mr},get SwitchCase(){return Fr},get ThrowStatement(){return jr},get TryStatement(){return Ur},get CatchClause(){return qr},get WhileStatement(){return Gr},get DoWhileStatement(){return Wr},get ForStatement(){return Hr},get ForInStatement(){return zr},get ForOfStatement(){return Kr}}),F=Object.freeze({__proto__:null,get FunctionDeclaration(){return Qr},get VariableDeclaration(){return Xr},get VariableDeclarator(){return Yr},get ClassDeclaration(){return Zr},get ClassBody(){return Jr},get MethodDefinition(){return $r},get PropertyDefinition(){return ei},get StaticBlock(){return ti},get ImportDeclaration(){return ri},get ExportDefaultDeclaration(){return ii},get ExportNamedDeclaration(){return ni},get ExportAllDeclaration(){return si}}),j=Object.freeze,f=Object.defineProperty,U=Object.getOwnPropertyDescriptor,q=Object.prototype.hasOwnProperty;function G(e,t){return q.call(e,t)}var W=Object.getOwnPropertyNames,H=Object.setPrototypeOf;var z=Object.getPrototypeOf;var K=Object.getOwnPropertyDescriptor;function Q(e,t,r){for(;t;){var i=K(t,r),i=void 0!==i&&void 0===i.writable&&"function"==typeof i[e]&&i[e];if(i)return i;i=t,t=z?z(i):i.__proto__}}function X(e,t){return Q("get",e,t)}function Y(e,t){return Q("set",e,t)}var Z=Object.create;function J(e,t){var r,i;r=e,i=t,H?H(r,i):r.__proto__=i,e.prototype=Z(t.prototype,{constructor:{value:e,writable:!0}})}var m=Object.assign||function(e){for(var t=1;t",t),template:new r("template"),invalidTemplate:new r("invalidTemplate"),ellipsis:new r("...",t),backQuote:new r("`",e),dollarBraceL:new r("${",{beforeExpr:!0,startsExpr:!0}),eq:new r("=",{beforeExpr:!0,isAssign:!0}),assign:new r("_=",{beforeExpr:!0,isAssign:!0}),incDec:new r("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new r("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:n("||",1),logicalAND:n("&&",2),bitwiseOR:n("|",3),bitwiseXOR:n("^",4),bitwiseAND:n("&",5),equality:n("==/!=/===/!==",6),relational:n("/<=/>=",7),bitShift:n("<>/>>>",8),plusMin:new r("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:n("%",10),star:n("*",10),slash:n("/",10),starstar:new r("**",{beforeExpr:!0}),coalesce:n("??",1),_break:s("break"),_case:s("case",t),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",t),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",t),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",e),_if:s("if"),_return:s("return",t),_switch:s("switch"),_throw:s("throw",t),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",e),_super:s("super",e),_class:s("class",e),_extends:s("extends",t),_export:s("export"),_import:s("import",e),_null:s("null",e),_true:s("true",e),_false:s("false",e),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},o=/\r\n?|\n|\u2028|\u2029/,t=new RegExp(o.source,"g");function fe(e){return 10===e||13===e||8232===e||8233===e}function me(e,t,r){void 0===r&&(r=e.length);for(var i=t;i>10),56320+(1023&e)))}function _e(e,t){this.line=e,this.column=t}function Ee(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)}var Ce=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;function Ie(e,t){for(var r=1,i=0;;){var n=me(e,i,t);if(n<0)return new _e(r,t-i);++r,i=n}}var Ae={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!(_e.prototype.offset=function(e){return new _e(this.line,this.column+e)}),allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Pe=!1;function Te(e){var t,r,a,o,i={};for(t in Ae)i[t]=(e&&xe(e,t)?e:Ae)[t];return"latest"===i.ecmaVersion?i.ecmaVersion=1e8:null==i.ecmaVersion?(!Pe&&"object"==typeof console&&console.warn&&(Pe=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),i.ecmaVersion=11):2015<=i.ecmaVersion&&(i.ecmaVersion-=2009),null==i.allowReserved&&(i.allowReserved=i.ecmaVersion<5),e&&null!=e.allowHashBang||(i.allowHashBang=14<=i.ecmaVersion),be(i.onToken)&&(r=i.onToken,i.onToken=function(e){return r.push(e)}),be(i.onComment)&&(i.onComment=(o=(a=i).onComment,function(e,t,r,i,n,s){e={type:e?"Block":"Line",value:t,start:r,end:i};a.locations&&(e.loc=new Ee(this,n,s)),a.ranges&&(e.range=[r,i]),o.push(e)})),i}function Ve(e,t){return 2|(e?4:0)|(t?8:0)}function h(e,t,r){this.options=e=Te(e),this.sourceFile=e.sourceFile,this.keywords=ke(oe[6<=e.ecmaVersion?6:"module"===e.sourceType?"5module":5]);var i="",i=(!0!==e.allowReserved&&(i=ae[6<=e.ecmaVersion?6:5===e.ecmaVersion?5:3],"module"===e.sourceType)&&(i+=" await"),this.reservedWords=ke(i),(i?i+" ":"")+ae.strict);this.reservedWordsStrict=ke(i),this.reservedWordsStrictBind=ke(i+" "+ae.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(o).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=y.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]}function Ne(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}var e={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}},e=(h.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},e.inFunction.get=function(){return 0<(2&this.currentVarScope().flags)},e.inGenerator.get=function(){return 0<(8&this.currentVarScope().flags)&&!this.currentVarScope().inClassFieldInit},e.inAsync.get=function(){return 0<(4&this.currentVarScope().flags)&&!this.currentVarScope().inClassFieldInit},e.canAwait.get=function(){for(var e=this.scopeStack.length-1;0<=e;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||256&t.flags)return!1;if(2&t.flags)return 0<(4&t.flags)}return this.inModule&&13<=this.options.ecmaVersion||this.options.allowAwaitOutsideFunction},e.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,e=e.inClassFieldInit;return 0<(64&t)||e||this.options.allowSuperOutsideMethod},e.allowDirectSuper.get=function(){return 0<(128&this.currentThisScope().flags)},e.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},e.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,e=e.inClassFieldInit;return 0<(258&t)||e},e.inClassStaticBlock.get=function(){return 0<(256&this.currentVarScope().flags)},h.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,i=0;i=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1));e+=n[0].length,c.lastIndex=e,e+=c.exec(this.input)[0].length,";"===this.input[e]&&e++}},e.eat=function(e){return this.type===e&&(this.next(),!0)},e.isContextual=function(e){return this.type===y.name&&this.value===e&&!this.containsEsc},e.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},e.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},e.canInsertSemicolon=function(){return this.type===y.eof||this.type===y.braceR||o.test(this.input.slice(this.lastTokEnd,this.start))},e.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},e.semicolon=function(){this.eat(y.semi)||this.insertSemicolon()||this.unexpected()},e.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},e.expect=function(e){this.eat(e)||this.unexpected()},e.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},e.checkPatternErrors=function(e,t){e&&(-1e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;te.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},e.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},e.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},e.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},e.regexp_eatZero=function(e){return 48===e.current()&&!it(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},e.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},e.regexp_eatControlLetter=function(e){var t=e.current();return!!tt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},e.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){var r=e.pos,t=(t=void 0===t?!1:t)||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(t&&55296<=i&&i<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(56320<=s&&s<=57343)return e.lastIntValue=1024*(i-55296)+(s-56320)+65536,!0}e.pos=n,e.lastIntValue=i}return!0}if(t&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&0<=(s=e.lastIntValue)&&s<=1114111)return!0;t&&e.raise("Invalid unicode escape"),e.pos=r}return!1},e.regexp_eatIdentityEscape=function(e){var t;return e.switchU?!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0):!(99===(t=e.current())||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},e.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(49<=t&&t<=57){for(;e.lastIntValue=10*e.lastIntValue+(t-48),e.advance(),48<=(t=e.current())&&t<=57;);return!0}return!1};function rt(e){return tt(e)||95===e}function it(e){return 48<=e&&e<=57}function nt(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function st(e){return 65<=e&&e<=70?e-65+10:97<=e&&e<=102?e-97+10:e-48}function at(e){return 48<=e&&e<=55}e.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(100===(i=t)||68===i||115===i||83===i||119===i||87===i)return e.lastIntValue=-1,e.advance(),1;var r,i=!1;if(e.switchU&&9<=this.options.ecmaVersion&&((i=80===t)||112===t)){if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&2===r&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return 0},e.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r,i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e))return r=e.lastStringValue,this.regexp_validateUnicodePropertyNameAndValue(e,i,r),1}return e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)?(i=e.lastStringValue,this.regexp_validateUnicodePropertyNameOrValue(e,i)):0},e.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){xe(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},e.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},e.regexp_eatUnicodePropertyName=function(e){var t;for(e.lastStringValue="";rt(t=e.current());)e.lastStringValue+=Se(t),e.advance();return""!==e.lastStringValue},e.regexp_eatUnicodePropertyValue=function(e){var t,r;for(e.lastStringValue="";rt(r=t=e.current())||it(r);)e.lastStringValue+=Se(t),e.advance();return""!==e.lastStringValue},e.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},e.regexp_eatCharacterClass=function(e){var t,r;return!!e.eat(91)&&(t=e.eat(94),r=this.regexp_classContents(e),e.eat(93)||e.raise("Unterminated character class"),t&&2===r&&e.raise("Negated character class may contain strings"),!0)},e.regexp_classContents=function(e){if(93!==e.current()){if(e.switchV)return this.regexp_classSetExpression(e);this.regexp_nonEmptyClassRanges(e)}return 1},e.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t,r=e.lastIntValue;e.eat(45)&&this.regexp_eatClassAtom(e)&&(t=e.lastIntValue,!e.switchU||-1!==r&&-1!==t||e.raise("Invalid character class"),-1!==r)&&-1!==t&&t=this.input.length?this.finishToken(y.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},d.readToken=function(e){return a(e,6<=this.options.ecmaVersion)||92===e?this.readWord():this.getTokenFromCode(e)},d.fullCharCodeAtPos=function(){var e,t=this.input.charCodeAt(this.pos);return t<=55295||56320<=t||(e=this.input.charCodeAt(this.pos+1))<=56319||57344<=e?t:(t<<10)+e-56613888},d.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var i,n=t;-1<(i=me(this.input,n,this.pos));)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},d.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos=this.input.length&&this.raise(r,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(o.test(i)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++this.pos}var n=this.input.slice(r,this.pos),s=(++this.pos,this.pos),a=this.readWord1(),s=(this.containsEsc&&this.unexpected(s),this.regexpState||(this.regexpState=new v(this))),s=(s.reset(r,n,a),this.validateRegExpFlags(s),this.validateRegExpPattern(s),null);try{s=new RegExp(n,a)}catch(e){}return this.finishToken(y.regexp,{pattern:n,flags:a,value:s})},d.readInt=function(e,t,r){for(var i=12<=this.options.ecmaVersion&&void 0===t,n=r&&48===this.input.charCodeAt(this.pos),r=this.pos,s=0,a=0,o=0,c=null==t?1/0:t;o=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;92===i?(t=(t+=this.input.slice(r,this.pos))+this.readEscapedChar(!1),r=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(fe(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(y.string,t)};var ht={};d.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ht)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},d.invalidStringToken=function(e,t){if(this.inTemplateElement&&9<=this.options.ecmaVersion)throw ht;this.raise(e,t)},d.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==y.template&&this.type!==y.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(y.template,e)):36===r?(this.pos+=2,this.finishToken(y.dollarBraceL)):(++this.pos,this.finishToken(y.backQuote));if(92===r)e=(e+=this.input.slice(t,this.pos))+this.readEscapedChar(!0),t=this.pos;else if(fe(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},d.readInvalidTemplateToken=function(){for(;this.poso[0]&&t[1]=e.length?void 0:e)&&e[r++],done:!e}}}}function kt(){for(var e=[],t=0;t":return i=":return i<=r;case"<<":return r<>":return r>>i;case">>>":return r>>>i;case"+":return r+i;case"-":return r-i;case"*":return r*i;case"**":return Math.pow(r,i);case"/":return r/i;case"%":return r%i;case"|":return r|i;case"^":return r^i;case"&":return r&i;case"in":return r in i;case"instanceof":return r instanceof i;default:throw new SyntaxError("Unexpected token "+e.operator)}},AssignmentExpression:function(e,t){var r,i,n,s=e.left;if("Identifier"===s.type)(n=St(s,t,{getVar:!0,throwErr:!1}))||(i=t.global().find("window").get(),n=new bt(i,s.name));else{if("MemberExpression"!==s.type)return R(s,t,{feed:T(e.right,t)});n=It(s,t,{getVar:!0})}var a=T(e.right,t);switch(e.operator){case"=":return n.set(a),n.get();case"+=":return n.set(n.get()+a),n.get();case"-=":return n.set(n.get()-a),n.get();case"*=":return n.set(n.get()*a),n.get();case"/=":return n.set(n.get()/a),n.get();case"%=":return n.set(n.get()%a),n.get();case"**=":return n.set(Math.pow(n.get(),a)),n.get();case"<<=":return n.set(n.get()<>=":return n.set(n.get()>>a),n.get();case">>>=":return n.set(n.get()>>>a),n.get();case"|=":return n.set(n.get()|a),n.get();case"^=":return n.set(n.get()^a),n.get();case"&=":return n.set(n.get()&a),n.get();case"??=":return n.set(null!=(r=n.get())?r:a),n.get();case"&&=":return n.set(n.get()&&a),n.get();case"||=":return n.set(n.get()||a),n.get();default:throw new SyntaxError("Unexpected token "+e.operator)}},LogicalExpression:function(e,t){var r;switch(e.operator){case"||":return T(e.left,t)||T(e.right,t);case"&&":return T(e.left,t)&&T(e.right,t);case"??":return null!=(r=T(e.left,t))?r:T(e.right,t);default:throw new SyntaxError("Unexpected token "+e.operator)}},MemberExpression:It,ConditionalExpression:function(e,t){return T(e.test,t)?T(e.consequent,t):T(e.alternate,t)},CallExpression:function(e,t){var r,i;if("MemberExpression"===e.callee.type){if(r=It(e.callee,t,{getObj:!0}),e.callee.optional&&null==r)return;var n=void 0,s=!1,a=(e.callee.computed?n=T(e.callee.property,t):"PrivateIdentifier"===e.callee.property.type?(n=e.callee.property.name,s=!0):n=e.callee.property.name,r);if(s&&(a=a[k]),s="Super"===e.callee.object.type?(s=t.find("this").get(),a[n].bind(s)):a[n],e.optional&&null==s)return;if("function"!=typeof s)throw new TypeError(n+" is not a function");if(s[mt])throw new TypeError("Class constructor "+n+" cannot be invoked without 'new'")}else{if(r=t.find("this").get(),s=T(e.callee,t),e.optional&&null==s)return;if("function"!=typeof s||"Super"!==e.callee.type&&s[mt]){if("Identifier"===e.callee.type)i=e.callee.name;else try{i=JSON.stringify(s)}catch(e){i=""+s}throw"function"!=typeof s?new TypeError(i+" is not a function"):new TypeError("Class constructor "+i+" cannot be invoked without 'new'")}}for(var o=[],c=0;c":return[2,n=":return[2,n<=i];case"<<":return[2,i<>":return[2,i>>n];case">>>":return[2,i>>>n];case"+":return[2,i+n];case"-":return[2,i-n];case"*":return[2,i*n];case"**":return[2,Math.pow(i,n)];case"/":return[2,i/n];case"%":return[2,i%n];case"|":return[2,i|n];case"^":return[2,i^n];case"&":return[2,i&n];case"in":return[2,i in n];case"instanceof":return[2,i instanceof n];default:throw new SyntaxError("Unexpected token "+t.operator)}}})},AssignmentExpression:function(t,r){var i,n,s,a,o;return A(this,function(e){switch(e.label){case 0:return"Identifier"!==(i=t.left).type?[3,2]:[5,P(mr(i,r,{getVar:!0,throwErr:!1}))];case 1:return(n=e.sent())||(s=r.global().find("window").get(),n=new bt(s,i.name)),[3,7];case 2:return"MemberExpression"!==i.type?[3,4]:[5,P(xr(i,r,{getVar:!0}))];case 3:return n=e.sent(),[3,7];case 4:return[5,P(V(t.right,r))];case 5:return s=e.sent(),[5,P(N(i,r,{feed:s}))];case 6:return[2,e.sent()];case 7:return[5,P(V(t.right,r))];case 8:switch(a=e.sent(),t.operator){case"=":return n.set(a),[2,n.get()];case"+=":return n.set(n.get()+a),[2,n.get()];case"-=":return n.set(n.get()-a),[2,n.get()];case"*=":return n.set(n.get()*a),[2,n.get()];case"/=":return n.set(n.get()/a),[2,n.get()];case"%=":return n.set(n.get()%a),[2,n.get()];case"**=":return n.set(Math.pow(n.get(),a)),[2,n.get()];case"<<=":return n.set(n.get()<>=":return n.set(n.get()>>a),[2,n.get()];case">>>=":return n.set(n.get()>>>a),[2,n.get()];case"|=":return n.set(n.get()|a),[2,n.get()];case"^=":return n.set(n.get()^a),[2,n.get()];case"&=":return n.set(n.get()&a),[2,n.get()];case"??=":return n.set(null!=(o=n.get())?o:a),[2,n.get()];case"&&=":return n.set(n.get()&&a),[2,n.get()];case"||=":return n.set(n.get()||a),[2,n.get()];default:throw new SyntaxError("Unexpected token "+t.operator)}}})},LogicalExpression:function(t,r){var i,n,s,a;return A(this,function(e){switch(e.label){case 0:switch(t.operator){case"||":return[3,1];case"&&":return[3,5];case"??":return[3,9]}return[3,14];case 1:return[5,P(V(t.left,r))];case 2:return(i=e.sent())?[3,4]:[5,P(V(t.right,r))];case 3:i=e.sent(),e.label=4;case 4:return[2,i];case 5:return[5,P(V(t.left,r))];case 6:return(n=e.sent())?[5,P(V(t.right,r))]:[3,8];case 7:n=e.sent(),e.label=8;case 8:return[2,n];case 9:return[5,P(V(t.left,r))];case 10:return null==(a=e.sent())?[3,11]:(s=a,[3,13]);case 11:return[5,P(V(t.right,r))];case 12:s=e.sent(),e.label=13;case 13:return[2,s];case 14:throw new SyntaxError("Unexpected token "+t.operator)}})},MemberExpression:xr,ConditionalExpression:function(t,r){var i;return A(this,function(e){switch(e.label){case 0:return[5,P(V(t.test,r))];case 1:return e.sent()?[5,P(V(t.consequent,r))]:[3,3];case 2:return i=e.sent(),[3,5];case 3:return[5,P(V(t.alternate,r))];case 4:i=e.sent(),e.label=5;case 5:return[2,i]}})},CallExpression:function(t,r){var i,n,s,a,o,c,h,u,l,p,d,f,m;return A(this,function(e){switch(e.label){case 0:return"MemberExpression"!==t.callee.type?[3,5]:[5,P(xr(t.callee,r,{getObj:!0}))];case 1:return(i=e.sent(),t.callee.optional&&null==i)?[2,void 0]:(n=void 0,s=!1,t.callee.computed?[5,P(V(t.callee.property,r))]:[3,3]);case 2:return n=e.sent(),[3,4];case 3:"PrivateIdentifier"===t.callee.property.type?(n=t.callee.property.name,s=!0):n=t.callee.property.name,e.label=4;case 4:if(m=i,s&&(m=m[k]),a="Super"===t.callee.object.type?(a=r.find("this").get(),m[n].bind(a)):m[n],t.optional&&null==a)return[2,void 0];if("function"!=typeof a)throw new TypeError(n+" is not a function");if(a[mt])throw new TypeError("Class constructor "+n+" cannot be invoked without 'new'");return[3,7];case 5:return i=r.find("this").get(),[5,P(V(t.callee,r))];case 6:if(a=e.sent(),t.optional&&null==a)return[2,void 0];if("function"!=typeof a||"Super"!==t.callee.type&&a[mt]){if("Identifier"===t.callee.type)o=t.callee.name;else try{o=JSON.stringify(a)}catch(e){o=""+a}throw"function"!=typeof a?new TypeError(o+" is not a function"):new TypeError("Class constructor "+o+" cannot be invoked without 'new'")}e.label=7;case 7:c=[],h=0,e.label=8;case 8:return h=t.length?void 0:t)&&t[i++],done:!t}}}),c=void 0,lt.RES=o.next(),[4,lt]):[3,8];case 2:c=e.sent(),e.label=3;case 3:return c.done?[3,7]:[5,P(hi(n,s,{value:c.value}))];case 4:if((l=e.sent())===w)return[3,7];if(l===b)return[3,5];if(l===x)return[2,l];e.label=5;case 5:return lt.RES=o.next(),[4,lt];case 6:return c=e.sent(),[3,3];case 7:return[3,15];case 8:e.trys.push([8,13,14,15]),h=P(a),u=h.next(),e.label=9;case 9:return u.done?[3,12]:(p=u.value,[5,P(hi(n,s,{value:p}))]);case 10:if((l=e.sent())===w)return[3,12];if(l===b)return[3,11];if(l===x)return[2,l];e.label=11;case 11:return u=h.next(),[3,9];case 12:return[3,15];case 13:return p=e.sent(),d={error:p},[3,15];case 14:try{u&&!u.done&&(f=h.return)&&f.call(h)}finally{if(d)throw d.error}return[7];case 15:return[2]}var t,r,i})}function Qr(t,r){return A(this,function(e){return r.func(t.id.name,L(t,r)),[2]})}function Xr(t,r,i){var n;return void 0===i&&(i={}),A(this,function(e){switch(e.label){case 0:n=0,e.label=1;case 1:return n",t),template:new r("template"),invalidTemplate:new r("invalidTemplate"),ellipsis:new r("...",t),backQuote:new r("`",e),dollarBraceL:new r("${",{beforeExpr:!0,startsExpr:!0}),eq:new r("=",{beforeExpr:!0,isAssign:!0}),assign:new r("_=",{beforeExpr:!0,isAssign:!0}),incDec:new r("++/--",{prefix:!0,postfix:!0,startsExpr:!0}),prefix:new r("!/~",{beforeExpr:!0,prefix:!0,startsExpr:!0}),logicalOR:n("||",1),logicalAND:n("&&",2),bitwiseOR:n("|",3),bitwiseXOR:n("^",4),bitwiseAND:n("&",5),equality:n("==/!=/===/!==",6),relational:n("/<=/>=",7),bitShift:n("<>/>>>",8),plusMin:new r("+/-",{beforeExpr:!0,binop:9,prefix:!0,startsExpr:!0}),modulo:n("%",10),star:n("*",10),slash:n("/",10),starstar:new r("**",{beforeExpr:!0}),coalesce:n("??",1),_break:s("break"),_case:s("case",t),_catch:s("catch"),_continue:s("continue"),_debugger:s("debugger"),_default:s("default",t),_do:s("do",{isLoop:!0,beforeExpr:!0}),_else:s("else",t),_finally:s("finally"),_for:s("for",{isLoop:!0}),_function:s("function",e),_if:s("if"),_return:s("return",t),_switch:s("switch"),_throw:s("throw",t),_try:s("try"),_var:s("var"),_const:s("const"),_while:s("while",{isLoop:!0}),_with:s("with"),_new:s("new",{beforeExpr:!0,startsExpr:!0}),_this:s("this",e),_super:s("super",e),_class:s("class",e),_extends:s("extends",t),_export:s("export"),_import:s("import",e),_null:s("null",e),_true:s("true",e),_false:s("false",e),_in:s("in",{beforeExpr:!0,binop:7}),_instanceof:s("instanceof",{beforeExpr:!0,binop:7}),_typeof:s("typeof",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_void:s("void",{beforeExpr:!0,prefix:!0,startsExpr:!0}),_delete:s("delete",{beforeExpr:!0,prefix:!0,startsExpr:!0})},o=/\r\n?|\n|\u2028|\u2029/,t=new RegExp(o.source,"g");function fe(e){return 10===e||13===e||8232===e||8233===e}function me(e,t,r){void 0===r&&(r=e.length);for(var i=t;i>10),56320+(1023&e)))}function _e(e,t){this.line=e,this.column=t}function Ee(e,t,r){this.start=t,this.end=r,null!==e.sourceFile&&(this.source=e.sourceFile)}var Ce=/(?:[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/;function Ie(e,t){for(var r=1,i=0;;){var n=me(e,i,t);if(n<0)return new _e(r,t-i);++r,i=n}}var Ae={ecmaVersion:null,sourceType:"script",onInsertedSemicolon:null,onTrailingComma:null,allowReserved:null,allowReturnOutsideFunction:!(_e.prototype.offset=function(e){return new _e(this.line,this.column+e)}),allowImportExportEverywhere:!1,allowAwaitOutsideFunction:null,allowSuperOutsideMethod:null,allowHashBang:!1,checkPrivateFields:!0,locations:!1,onToken:null,onComment:null,ranges:!1,program:null,sourceFile:null,directSourceFile:null,preserveParens:!1},Pe=!1;function Le(e){var t,r,a,o,i={};for(t in Ae)i[t]=(e&&be(e,t)?e:Ae)[t];return"latest"===i.ecmaVersion?i.ecmaVersion=1e8:null==i.ecmaVersion?(!Pe&&"object"==typeof console&&console.warn&&(Pe=!0,console.warn("Since Acorn 8.0.0, options.ecmaVersion is required.\nDefaulting to 2020, but this will stop working in the future.")),i.ecmaVersion=11):2015<=i.ecmaVersion&&(i.ecmaVersion-=2009),null==i.allowReserved&&(i.allowReserved=i.ecmaVersion<5),e&&null!=e.allowHashBang||(i.allowHashBang=14<=i.ecmaVersion),xe(i.onToken)&&(r=i.onToken,i.onToken=function(e){return r.push(e)}),xe(i.onComment)&&(i.onComment=(o=(a=i).onComment,function(e,t,r,i,n,s){e={type:e?"Block":"Line",value:t,start:r,end:i};a.locations&&(e.loc=new Ee(this,n,s)),a.ranges&&(e.range=[r,i]),o.push(e)})),i}function Te(e,t){return 2|(e?4:0)|(t?8:0)}function h(e,t,r){this.options=e=Le(e),this.sourceFile=e.sourceFile,this.keywords=ke(oe[6<=e.ecmaVersion?6:"module"===e.sourceType?"5module":5]);var i="",i=(!0!==e.allowReserved&&(i=ae[6<=e.ecmaVersion?6:5===e.ecmaVersion?5:3],"module"===e.sourceType)&&(i+=" await"),this.reservedWords=ke(i),(i?i+" ":"")+ae.strict);this.reservedWordsStrict=ke(i),this.reservedWordsStrictBind=ke(i+" "+ae.strictBind),this.input=String(t),this.containsEsc=!1,r?(this.pos=r,this.lineStart=this.input.lastIndexOf("\n",r-1)+1,this.curLine=this.input.slice(0,this.lineStart).split(o).length):(this.pos=this.lineStart=0,this.curLine=1),this.type=g.eof,this.value=null,this.start=this.end=this.pos,this.startLoc=this.endLoc=this.curPosition(),this.lastTokEndLoc=this.lastTokStartLoc=null,this.lastTokStart=this.lastTokEnd=this.pos,this.context=this.initialContext(),this.exprAllowed=!0,this.inModule="module"===e.sourceType,this.strict=this.inModule||this.strictDirective(this.pos),this.potentialArrowAt=-1,this.potentialArrowInForAwait=!1,this.yieldPos=this.awaitPos=this.awaitIdentPos=0,this.labels=[],this.undefinedExports=Object.create(null),0===this.pos&&e.allowHashBang&&"#!"===this.input.slice(0,2)&&this.skipLineComment(2),this.scopeStack=[],this.enterScope(1),this.regexpState=null,this.privateNameStack=[]}function Ve(){this.shorthandAssign=this.trailingComma=this.parenthesizedAssign=this.parenthesizedBind=this.doubleProto=-1}var e={inFunction:{configurable:!0},inGenerator:{configurable:!0},inAsync:{configurable:!0},canAwait:{configurable:!0},allowSuper:{configurable:!0},allowDirectSuper:{configurable:!0},treatFunctionsAsVar:{configurable:!0},allowNewDotTarget:{configurable:!0},inClassStaticBlock:{configurable:!0}},e=(h.prototype.parse=function(){var e=this.options.program||this.startNode();return this.nextToken(),this.parseTopLevel(e)},e.inFunction.get=function(){return 0<(2&this.currentVarScope().flags)},e.inGenerator.get=function(){return 0<(8&this.currentVarScope().flags)&&!this.currentVarScope().inClassFieldInit},e.inAsync.get=function(){return 0<(4&this.currentVarScope().flags)&&!this.currentVarScope().inClassFieldInit},e.canAwait.get=function(){for(var e=this.scopeStack.length-1;0<=e;e--){var t=this.scopeStack[e];if(t.inClassFieldInit||256&t.flags)return!1;if(2&t.flags)return 0<(4&t.flags)}return this.inModule&&13<=this.options.ecmaVersion||this.options.allowAwaitOutsideFunction},e.allowSuper.get=function(){var e=this.currentThisScope(),t=e.flags,e=e.inClassFieldInit;return 0<(64&t)||e||this.options.allowSuperOutsideMethod},e.allowDirectSuper.get=function(){return 0<(128&this.currentThisScope().flags)},e.treatFunctionsAsVar.get=function(){return this.treatFunctionsAsVarInScope(this.currentScope())},e.allowNewDotTarget.get=function(){var e=this.currentThisScope(),t=e.flags,e=e.inClassFieldInit;return 0<(258&t)||e},e.inClassStaticBlock.get=function(){return 0<(256&this.currentVarScope().flags)},h.extend=function(){for(var e=[],t=arguments.length;t--;)e[t]=arguments[t];for(var r=this,i=0;i=,?^&]/.test(i)||"!"===i&&"="===this.input.charAt(r+1));e+=n[0].length,c.lastIndex=e,e+=c.exec(this.input)[0].length,";"===this.input[e]&&e++}},e.eat=function(e){return this.type===e&&(this.next(),!0)},e.isContextual=function(e){return this.type===g.name&&this.value===e&&!this.containsEsc},e.eatContextual=function(e){return!!this.isContextual(e)&&(this.next(),!0)},e.expectContextual=function(e){this.eatContextual(e)||this.unexpected()},e.canInsertSemicolon=function(){return this.type===g.eof||this.type===g.braceR||o.test(this.input.slice(this.lastTokEnd,this.start))},e.insertSemicolon=function(){if(this.canInsertSemicolon())return this.options.onInsertedSemicolon&&this.options.onInsertedSemicolon(this.lastTokEnd,this.lastTokEndLoc),!0},e.semicolon=function(){this.eat(g.semi)||this.insertSemicolon()||this.unexpected()},e.afterTrailingComma=function(e,t){if(this.type===e)return this.options.onTrailingComma&&this.options.onTrailingComma(this.lastTokStart,this.lastTokStartLoc),t||this.next(),!0},e.expect=function(e){this.eat(e)||this.unexpected()},e.unexpected=function(e){this.raise(null!=e?e:this.start,"Unexpected token")},e.checkPatternErrors=function(e,t){e&&(-1e.numCapturingParens&&e.raise("Invalid escape");for(var t=0,r=e.backReferenceNames;te.maxBackReference&&(e.maxBackReference=r),!0;if(r<=e.numCapturingParens)return!0;e.pos=t}return!1},e.regexp_eatKGroupName=function(e){if(e.eat(107)){if(this.regexp_eatGroupName(e))return e.backReferenceNames.push(e.lastStringValue),!0;e.raise("Invalid named reference")}return!1},e.regexp_eatCharacterEscape=function(e){return this.regexp_eatControlEscape(e)||this.regexp_eatCControlLetter(e)||this.regexp_eatZero(e)||this.regexp_eatHexEscapeSequence(e)||this.regexp_eatRegExpUnicodeEscapeSequence(e,!1)||!e.switchU&&this.regexp_eatLegacyOctalEscapeSequence(e)||this.regexp_eatIdentityEscape(e)},e.regexp_eatCControlLetter=function(e){var t=e.pos;if(e.eat(99)){if(this.regexp_eatControlLetter(e))return!0;e.pos=t}return!1},e.regexp_eatZero=function(e){return 48===e.current()&&!it(e.lookahead())&&(e.lastIntValue=0,e.advance(),!0)},e.regexp_eatControlEscape=function(e){var t=e.current();return 116===t?(e.lastIntValue=9,e.advance(),!0):110===t?(e.lastIntValue=10,e.advance(),!0):118===t?(e.lastIntValue=11,e.advance(),!0):102===t?(e.lastIntValue=12,e.advance(),!0):114===t&&(e.lastIntValue=13,e.advance(),!0)},e.regexp_eatControlLetter=function(e){var t=e.current();return!!tt(t)&&(e.lastIntValue=t%32,e.advance(),!0)},e.regexp_eatRegExpUnicodeEscapeSequence=function(e,t){var r=e.pos,t=(t=void 0===t?!1:t)||e.switchU;if(e.eat(117)){if(this.regexp_eatFixedHexDigits(e,4)){var i=e.lastIntValue;if(t&&55296<=i&&i<=56319){var n=e.pos;if(e.eat(92)&&e.eat(117)&&this.regexp_eatFixedHexDigits(e,4)){var s=e.lastIntValue;if(56320<=s&&s<=57343)return e.lastIntValue=1024*(i-55296)+(s-56320)+65536,!0}e.pos=n,e.lastIntValue=i}return!0}if(t&&e.eat(123)&&this.regexp_eatHexDigits(e)&&e.eat(125)&&0<=(s=e.lastIntValue)&&s<=1114111)return!0;t&&e.raise("Invalid unicode escape"),e.pos=r}return!1},e.regexp_eatIdentityEscape=function(e){var t;return e.switchU?!!this.regexp_eatSyntaxCharacter(e)||!!e.eat(47)&&(e.lastIntValue=47,!0):!(99===(t=e.current())||e.switchN&&107===t||(e.lastIntValue=t,e.advance(),0))},e.regexp_eatDecimalEscape=function(e){e.lastIntValue=0;var t=e.current();if(49<=t&&t<=57){for(;e.lastIntValue=10*e.lastIntValue+(t-48),e.advance(),48<=(t=e.current())&&t<=57;);return!0}return!1};function rt(e){return tt(e)||95===e}function it(e){return 48<=e&&e<=57}function nt(e){return 48<=e&&e<=57||65<=e&&e<=70||97<=e&&e<=102}function st(e){return 65<=e&&e<=70?e-65+10:97<=e&&e<=102?e-97+10:e-48}function at(e){return 48<=e&&e<=55}e.regexp_eatCharacterClassEscape=function(e){var t=e.current();if(100===(i=t)||68===i||115===i||83===i||119===i||87===i)return e.lastIntValue=-1,e.advance(),1;var r,i=!1;if(e.switchU&&9<=this.options.ecmaVersion&&((i=80===t)||112===t)){if(e.lastIntValue=-1,e.advance(),e.eat(123)&&(r=this.regexp_eatUnicodePropertyValueExpression(e))&&e.eat(125))return i&&2===r&&e.raise("Invalid property name"),r;e.raise("Invalid property name")}return 0},e.regexp_eatUnicodePropertyValueExpression=function(e){var t=e.pos;if(this.regexp_eatUnicodePropertyName(e)&&e.eat(61)){var r,i=e.lastStringValue;if(this.regexp_eatUnicodePropertyValue(e))return r=e.lastStringValue,this.regexp_validateUnicodePropertyNameAndValue(e,i,r),1}return e.pos=t,this.regexp_eatLoneUnicodePropertyNameOrValue(e)?(i=e.lastStringValue,this.regexp_validateUnicodePropertyNameOrValue(e,i)):0},e.regexp_validateUnicodePropertyNameAndValue=function(e,t,r){be(e.unicodeProperties.nonBinary,t)||e.raise("Invalid property name"),e.unicodeProperties.nonBinary[t].test(r)||e.raise("Invalid property value")},e.regexp_validateUnicodePropertyNameOrValue=function(e,t){return e.unicodeProperties.binary.test(t)?1:e.switchV&&e.unicodeProperties.binaryOfStrings.test(t)?2:void e.raise("Invalid property name")},e.regexp_eatUnicodePropertyName=function(e){var t;for(e.lastStringValue="";rt(t=e.current());)e.lastStringValue+=Se(t),e.advance();return""!==e.lastStringValue},e.regexp_eatUnicodePropertyValue=function(e){var t,r;for(e.lastStringValue="";rt(r=t=e.current())||it(r);)e.lastStringValue+=Se(t),e.advance();return""!==e.lastStringValue},e.regexp_eatLoneUnicodePropertyNameOrValue=function(e){return this.regexp_eatUnicodePropertyValue(e)},e.regexp_eatCharacterClass=function(e){var t,r;return!!e.eat(91)&&(t=e.eat(94),r=this.regexp_classContents(e),e.eat(93)||e.raise("Unterminated character class"),t&&2===r&&e.raise("Negated character class may contain strings"),!0)},e.regexp_classContents=function(e){if(93!==e.current()){if(e.switchV)return this.regexp_classSetExpression(e);this.regexp_nonEmptyClassRanges(e)}return 1},e.regexp_nonEmptyClassRanges=function(e){for(;this.regexp_eatClassAtom(e);){var t,r=e.lastIntValue;e.eat(45)&&this.regexp_eatClassAtom(e)&&(t=e.lastIntValue,!e.switchU||-1!==r&&-1!==t||e.raise("Invalid character class"),-1!==r)&&-1!==t&&t=this.input.length?this.finishToken(g.eof):e.override?e.override(this):void this.readToken(this.fullCharCodeAtPos())},d.readToken=function(e){return a(e,6<=this.options.ecmaVersion)||92===e?this.readWord():this.getTokenFromCode(e)},d.fullCharCodeAtPos=function(){var e,t=this.input.charCodeAt(this.pos);return t<=55295||56320<=t||(e=this.input.charCodeAt(this.pos+1))<=56319||57344<=e?t:(t<<10)+e-56613888},d.skipBlockComment=function(){var e=this.options.onComment&&this.curPosition(),t=this.pos,r=this.input.indexOf("*/",this.pos+=2);if(-1===r&&this.raise(this.pos-2,"Unterminated comment"),this.pos=r+2,this.options.locations)for(var i,n=t;-1<(i=me(this.input,n,this.pos));)++this.curLine,n=this.lineStart=i;this.options.onComment&&this.options.onComment(!0,this.input.slice(t+2,r),t,this.pos,e,this.curPosition())},d.skipLineComment=function(e){for(var t=this.pos,r=this.options.onComment&&this.curPosition(),i=this.input.charCodeAt(this.pos+=e);this.pos=this.input.length&&this.raise(r,"Unterminated regular expression");var i=this.input.charAt(this.pos);if(o.test(i)&&this.raise(r,"Unterminated regular expression"),e)e=!1;else{if("["===i)t=!0;else if("]"===i&&t)t=!1;else if("/"===i&&!t)break;e="\\"===i}++this.pos}var n=this.input.slice(r,this.pos),s=(++this.pos,this.pos),a=this.readWord1(),s=(this.containsEsc&&this.unexpected(s),this.regexpState||(this.regexpState=new v(this))),s=(s.reset(r,n,a),this.validateRegExpFlags(s),this.validateRegExpPattern(s),null);try{s=new RegExp(n,a)}catch(e){}return this.finishToken(g.regexp,{pattern:n,flags:a,value:s})},d.readInt=function(e,t,r){for(var i=12<=this.options.ecmaVersion&&void 0===t,n=r&&48===this.input.charCodeAt(this.pos),r=this.pos,s=0,a=0,o=0,c=null==t?1/0:t;o=this.input.length&&this.raise(this.start,"Unterminated string constant");var i=this.input.charCodeAt(this.pos);if(i===e)break;92===i?(t=(t+=this.input.slice(r,this.pos))+this.readEscapedChar(!1),r=this.pos):8232===i||8233===i?(this.options.ecmaVersion<10&&this.raise(this.start,"Unterminated string constant"),++this.pos,this.options.locations&&(this.curLine++,this.lineStart=this.pos)):(fe(i)&&this.raise(this.start,"Unterminated string constant"),++this.pos)}return t+=this.input.slice(r,this.pos++),this.finishToken(g.string,t)};var ht={};d.tryReadTemplateToken=function(){this.inTemplateElement=!0;try{this.readTmplToken()}catch(e){if(e!==ht)throw e;this.readInvalidTemplateToken()}this.inTemplateElement=!1},d.invalidStringToken=function(e,t){if(this.inTemplateElement&&9<=this.options.ecmaVersion)throw ht;this.raise(e,t)},d.readTmplToken=function(){for(var e="",t=this.pos;;){this.pos>=this.input.length&&this.raise(this.start,"Unterminated template");var r=this.input.charCodeAt(this.pos);if(96===r||36===r&&123===this.input.charCodeAt(this.pos+1))return this.pos!==this.start||this.type!==g.template&&this.type!==g.invalidTemplate?(e+=this.input.slice(t,this.pos),this.finishToken(g.template,e)):36===r?(this.pos+=2,this.finishToken(g.dollarBraceL)):(++this.pos,this.finishToken(g.backQuote));if(92===r)e=(e+=this.input.slice(t,this.pos))+this.readEscapedChar(!0),t=this.pos;else if(fe(r)){switch(e+=this.input.slice(t,this.pos),++this.pos,r){case 13:10===this.input.charCodeAt(this.pos)&&++this.pos;case 10:e+="\n";break;default:e+=String.fromCharCode(r)}this.options.locations&&(++this.curLine,this.lineStart=this.pos),t=this.pos}else++this.pos}},d.readInvalidTemplateToken=function(){for(;this.poso[0]&&t[1]=e.length?void 0:e)&&e[r++],done:!e}}}}function St(){for(var e=[],t=0;t":return i=":return i<=r;case"<<":return r<>":return r>>i;case">>>":return r>>>i;case"+":return r+i;case"-":return r-i;case"*":return r*i;case"**":return Math.pow(r,i);case"/":return r/i;case"%":return r%i;case"|":return r|i;case"^":return r^i;case"&":return r&i;case"in":return r in i;case"instanceof":return r instanceof i;default:throw new SyntaxError("Unexpected token "+e.operator)}},AssignmentExpression:function(e,t){var r,i,n,s=e.left;if("Identifier"===s.type)(n=_t(s,t,{getVar:!0,throwErr:!1}))||(i=t.global().find("window").get(),n=new xt(i,s.name));else{if("MemberExpression"!==s.type)return B(s,t,{feed:P(e.right,t)});n=At(s,t,{getVar:!0})}var a=P(e.right,t);switch(e.operator){case"=":return n.set(a),n.get();case"+=":return n.set(n.get()+a),n.get();case"-=":return n.set(n.get()-a),n.get();case"*=":return n.set(n.get()*a),n.get();case"/=":return n.set(n.get()/a),n.get();case"%=":return n.set(n.get()%a),n.get();case"**=":return n.set(Math.pow(n.get(),a)),n.get();case"<<=":return n.set(n.get()<>=":return n.set(n.get()>>a),n.get();case">>>=":return n.set(n.get()>>>a),n.get();case"|=":return n.set(n.get()|a),n.get();case"^=":return n.set(n.get()^a),n.get();case"&=":return n.set(n.get()&a),n.get();case"??=":return n.set(null!=(r=n.get())?r:a),n.get();case"&&=":return n.set(n.get()&&a),n.get();case"||=":return n.set(n.get()||a),n.get();default:throw new SyntaxError("Unexpected token "+e.operator)}},LogicalExpression:function(e,t){var r;switch(e.operator){case"||":return P(e.left,t)||P(e.right,t);case"&&":return P(e.left,t)&&P(e.right,t);case"??":return null!=(r=P(e.left,t))?r:P(e.right,t);default:throw new SyntaxError("Unexpected token "+e.operator)}},MemberExpression:At,ConditionalExpression:function(e,t){return P(e.test,t)?P(e.consequent,t):P(e.alternate,t)},CallExpression:function(e,t){var r,i;if("MemberExpression"===e.callee.type){if(r=At(e.callee,t,{getObj:!0}),e.callee.optional&&null==r)return;var n=void 0,s=!1,a=(e.callee.computed?n=P(e.callee.property,t):"PrivateIdentifier"===e.callee.property.type?(n=e.callee.property.name,s=!0):n=e.callee.property.name,r);if(s&&(a=a[k]),s="Super"===e.callee.object.type?(s=t.find("this").get(),a[n].bind(s)):a[n],e.optional&&null==s)return;if("function"!=typeof s)throw new TypeError(n+" is not a function");if(s[mt])throw new TypeError("Class constructor "+n+" cannot be invoked without 'new'")}else{if(r=t.find("this").get(),s=P(e.callee,t),e.optional&&null==s)return;if("function"!=typeof s||"Super"!==e.callee.type&&s[mt]){if("Identifier"===e.callee.type)i=e.callee.name;else try{i=JSON.stringify(s)}catch(e){i=""+s}throw"function"!=typeof s?new TypeError(i+" is not a function"):new TypeError("Class constructor "+i+" cannot be invoked without 'new'")}}for(var o=[],c=0;c":return[2,n=":return[2,n<=i];case"<<":return[2,i<>":return[2,i>>n];case">>>":return[2,i>>>n];case"+":return[2,i+n];case"-":return[2,i-n];case"*":return[2,i*n];case"**":return[2,Math.pow(i,n)];case"/":return[2,i/n];case"%":return[2,i%n];case"|":return[2,i|n];case"^":return[2,i^n];case"&":return[2,i&n];case"in":return[2,i in n];case"instanceof":return[2,i instanceof n];default:throw new SyntaxError("Unexpected token "+t.operator)}}})},AssignmentExpression:function(t,r){var i,n,s,a,o;return I(this,function(e){switch(e.label){case 0:return"Identifier"!==(i=t.left).type?[3,2]:[5,A(gr(i,r,{getVar:!0,throwErr:!1}))];case 1:return(n=e.sent())||(s=r.global().find("window").get(),n=new xt(s,i.name)),[3,7];case 2:return"MemberExpression"!==i.type?[3,4]:[5,A(wr(i,r,{getVar:!0}))];case 3:return n=e.sent(),[3,7];case 4:return[5,A(T(t.right,r))];case 5:return s=e.sent(),[5,A(V(i,r,{feed:s}))];case 6:return[2,e.sent()];case 7:return[5,A(T(t.right,r))];case 8:switch(a=e.sent(),t.operator){case"=":return n.set(a),[2,n.get()];case"+=":return n.set(n.get()+a),[2,n.get()];case"-=":return n.set(n.get()-a),[2,n.get()];case"*=":return n.set(n.get()*a),[2,n.get()];case"/=":return n.set(n.get()/a),[2,n.get()];case"%=":return n.set(n.get()%a),[2,n.get()];case"**=":return n.set(Math.pow(n.get(),a)),[2,n.get()];case"<<=":return n.set(n.get()<>=":return n.set(n.get()>>a),[2,n.get()];case">>>=":return n.set(n.get()>>>a),[2,n.get()];case"|=":return n.set(n.get()|a),[2,n.get()];case"^=":return n.set(n.get()^a),[2,n.get()];case"&=":return n.set(n.get()&a),[2,n.get()];case"??=":return n.set(null!=(o=n.get())?o:a),[2,n.get()];case"&&=":return n.set(n.get()&&a),[2,n.get()];case"||=":return n.set(n.get()||a),[2,n.get()];default:throw new SyntaxError("Unexpected token "+t.operator)}}})},LogicalExpression:function(t,r){var i,n,s,a;return I(this,function(e){switch(e.label){case 0:switch(t.operator){case"||":return[3,1];case"&&":return[3,5];case"??":return[3,9]}return[3,14];case 1:return[5,A(T(t.left,r))];case 2:return(i=e.sent())?[3,4]:[5,A(T(t.right,r))];case 3:i=e.sent(),e.label=4;case 4:return[2,i];case 5:return[5,A(T(t.left,r))];case 6:return(n=e.sent())?[5,A(T(t.right,r))]:[3,8];case 7:n=e.sent(),e.label=8;case 8:return[2,n];case 9:return[5,A(T(t.left,r))];case 10:return null==(a=e.sent())?[3,11]:(s=a,[3,13]);case 11:return[5,A(T(t.right,r))];case 12:s=e.sent(),e.label=13;case 13:return[2,s];case 14:throw new SyntaxError("Unexpected token "+t.operator)}})},MemberExpression:wr,ConditionalExpression:function(t,r){var i;return I(this,function(e){switch(e.label){case 0:return[5,A(T(t.test,r))];case 1:return e.sent()?[5,A(T(t.consequent,r))]:[3,3];case 2:return i=e.sent(),[3,5];case 3:return[5,A(T(t.alternate,r))];case 4:i=e.sent(),e.label=5;case 5:return[2,i]}})},CallExpression:function(t,r){var i,n,s,a,o,c,h,l,u,p,d,f,m;return I(this,function(e){switch(e.label){case 0:return"MemberExpression"!==t.callee.type?[3,5]:[5,A(wr(t.callee,r,{getObj:!0}))];case 1:return(i=e.sent(),t.callee.optional&&null==i)?[2,void 0]:(n=void 0,s=!1,t.callee.computed?[5,A(T(t.callee.property,r))]:[3,3]);case 2:return n=e.sent(),[3,4];case 3:"PrivateIdentifier"===t.callee.property.type?(n=t.callee.property.name,s=!0):n=t.callee.property.name,e.label=4;case 4:if(m=i,s&&(m=m[k]),a="Super"===t.callee.object.type?(a=r.find("this").get(),m[n].bind(a)):m[n],t.optional&&null==a)return[2,void 0];if("function"!=typeof a)throw new TypeError(n+" is not a function");if(a[mt])throw new TypeError("Class constructor "+n+" cannot be invoked without 'new'");return[3,7];case 5:return i=r.find("this").get(),[5,A(T(t.callee,r))];case 6:if(a=e.sent(),t.optional&&null==a)return[2,void 0];if("function"!=typeof a||"Super"!==t.callee.type&&a[mt]){if("Identifier"===t.callee.type)o=t.callee.name;else try{o=JSON.stringify(a)}catch(e){o=""+a}throw"function"!=typeof a?new TypeError(o+" is not a function"):new TypeError("Class constructor "+o+" cannot be invoked without 'new'")}e.label=7;case 7:c=[],h=0,e.label=8;case 8:return h=t.length?void 0:t)&&t[i++],done:!t}}}),h=void 0,ut.RES=c.next(),[4,ut]):[3,8];case 2:h=e.sent(),e.label=3;case 3:return h.done?[3,7]:[5,A(di(n,s,{value:h.value}))];case 4:if((p=e.sent())===w)return p.LABEL===a.label?[3,7]:[2,p];if(p===x)return p.LABEL===a.label?[3,5]:[2,p];if(p===b)return[2,p];e.label=5;case 5:return ut.RES=c.next(),[4,ut];case 6:return h=e.sent(),[3,3];case 7:return[3,15];case 8:e.trys.push([8,13,14,15]),l=A(o),u=l.next(),e.label=9;case 9:return u.done?[3,12]:(d=u.value,[5,A(di(n,s,{value:d}))]);case 10:if((p=e.sent())===w)return p.LABEL===a.label?[3,12]:[2,p];if(p===x)return p.LABEL===a.label?[3,11]:[2,p];if(p===b)return[2,p];e.label=11;case 11:return u=l.next(),[3,9];case 12:return[3,15];case 13:return d=e.sent(),f={error:d},[3,15];case 14:try{u&&!u.done&&(m=l.return)&&m.call(l)}finally{if(f)throw f.error}return[7];case 15:return[2]}var t,r,i})}function Jr(t,r){return I(this,function(e){return r.func(t.id.name,N(t,r)),[2]})}function $r(t,r,i){var n;return void 0===i&&(i={}),I(this,function(e){switch(e.label){case 0:n=0,e.label=1;case 1:return n