From f6022de5dbbbcb9e43e9f646d273df65f1e9e8b2 Mon Sep 17 00:00:00 2001 From: Neil Fraser Date: Tue, 1 Mar 2022 10:10:15 -0800 Subject: [PATCH] Update JS-Interpreter to latest version. --- demos/interpreter/acorn_interpreter.js | 224 +++++++++++++------------ 1 file changed, 119 insertions(+), 105 deletions(-) diff --git a/demos/interpreter/acorn_interpreter.js b/demos/interpreter/acorn_interpreter.js index 19db1c3ef..80406b3fd 100644 --- a/demos/interpreter/acorn_interpreter.js +++ b/demos/interpreter/acorn_interpreter.js @@ -1,6 +1,5 @@ // Acorn: Copyright 2012 Marijn Haverbeke, MIT License -var mod$$inline_58=function(a){function b(a){n=a||{};for(var b in Ua)Object.prototype.hasOwnProperty.call(n,b)||(n[b]=Ua[b]);wa=n.sourceFile||null}function c(a,b){var c=Ab(k,a);b+=" ("+c.line+":"+c.column+")";var d=new SyntaxError(b);d.pos=a;d.loc=c;d.raisedAt=f;throw d;}function d(a){function b(a){if(1==a.length)return c+="return str === "+JSON.stringify(a[0])+";";c+="switch(str){";for(var va=0;vaa)++f;else if(47===a)if(a=k.charCodeAt(f+1),42===a){var a=n.onComment&&n.locations&&new e,b=f,d=k.indexOf("*/",f+=2);-1===d&&c(f-2,"Unterminated comment"); f=d+2;if(n.locations){Y.lastIndex=b;for(var g=void 0;(g=Y.exec(k))&&g.index=a?a=P(!0):(++f,a=g(xa)),a;case 40:return++f,g(I);case 41:return++f,g(E);case 59:return++f,g(J);case 44:return++f,g(L);case 91:return++f,g(ja); case 93:return++f,g(ka);case 123:return++f,g(Z);case 125:return++f,g(T);case 58:return++f,g(aa);case 63:return++f,g(ya);case 48:if(a=k.charCodeAt(f+1),120===a||88===a)return f+=2,a=B(16),null==a&&c(x+2,"Expected hexadecimal number"),la(k.charCodeAt(f))&&c(f,"Identifier directly after number"),a=g(ba,a);case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return P(!1);case 34:case 39:a:{f++;for(var b="";;){f>=S&&c(x,"Unterminated string constant");var d=k.charCodeAt(f);if(d===a){++f; @@ -38,106 +37,121 @@ Pb=RegExp("[\u00aa\u00b5\u00ba\u00c0-\u00d6\u00d8-\u00f6\u00f8-\u02c1\u02c6-\u02 na=/[\n\r\u2028\u2029]/,Y=/\r\n|[\n\r\u2028\u2029]/g,la=a.isIdentifierStart=function(a){return 65>a?36===a:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Za.test(String.fromCharCode(a))},ab=a.isIdentifierChar=function(a){return 48>a?36===a:58>a?!0:65>a?!1:91>a?!0:97>a?95===a:123>a?!0:170<=a&&Pb.test(String.fromCharCode(a))},ca,Ia={kind:"loop"},Ob={kind:"switch"}}; "object"==typeof exports&&"object"==typeof module?mod$$inline_58(exports):"function"==typeof define&&define.amd?define(["exports"],mod$$inline_58):mod$$inline_58(this.acorn||(this.acorn={})); // JS-Interpreter: Copyright 2013 Google LLC, Apache 2.0 -function u(a,b){"string"===typeof a&&(a=acorn.parse(a,ha));this.Ha=a.constructor;var c=new this.Ha({options:{}});for(d in a)c[d]="body"===d?a[d].slice():a[d];this.fa=c;this.kb=b;this.wa=!1;this.U=[];this.Sa=0;this.pb=Object.create(null);var d=/^step([A-Z]\w*)$/;var e,g;for(g in this)"function"===typeof this[g]&&(e=g.match(d))&&(this.pb[e[1]]=this[g].bind(this));this.M=ia(this,this.fa,null);this.Da=this.M.object;this.fa=acorn.parse(this.U.join("\n"),ha);this.U=void 0;ra(this.fa,void 0,void 0);e=new v(this.fa, -this.M);e.done=!1;this.j=[e];this.nb();this.value=void 0;this.fa=c;e=new v(this.fa,this.M);e.done=!1;this.j.length=0;this.j[0]=e;this.stateStack=this.j} -var ha={Ca:5},ya={configurable:!0,enumerable:!0,writable:!1},B={configurable:!0,enumerable:!1,writable:!0},E={configurable:!0,enumerable:!1,writable:!1},za={configurable:!1,enumerable:!0,writable:!0},Aa={STEP_ERROR:!0},Ba={SCOPE_REFERENCE:!0},Ia={VALUE_IN_DESCRIPTOR:!0},Ja={REGEXP_TIMEOUT:!0},Ka=[],La=null,Ma=["onmessage = function(e) {","var result;","var data = e.data;","switch (data[0]) {","case 'split':","result = data[1].split(data[2], data[3]);","break;","case 'match':","result = data[1].match(data[2]);", -"break;","case 'search':","result = data[1].search(data[2]);","break;","case 'replace':","result = data[1].replace(data[2], data[3]);","break;","case 'exec':","var regexp = data[1];","regexp.lastIndex = data[2];","result = [regexp.exec(data[3]), data[1].lastIndex];","break;","default:","throw 'Unknown RegExp operation: ' + data[0];","}","postMessage(result);","};"];function Na(a){var b=a>>>0;return b===Number(a)?b:NaN}function Oa(a){var b=a>>>0;return String(b)===String(a)&&4294967295!==b?b:NaN} -function ra(a,b,c){b?a.start=b:delete a.start;c?a.end=c:delete a.end;for(var d in a)if(a.hasOwnProperty(d)){var e=a[d];e&&"object"===typeof e&&ra(e,b,c)}}u.prototype.REGEXP_MODE=2;u.prototype.REGEXP_THREAD_TIMEOUT=1E3;q=u.prototype;q.I=!1;q.ya=!1; -q.ub=function(a){var b=this.j[0];if(!b||"Program"!==b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"===typeof a&&(a=acorn.parse(a,ha));if(!a||"Program"!==a.type)throw Error("Expecting new AST to start with a Program node.");Pa(this,a,b.scope);Array.prototype.push.apply(b.node.body,a.body);b.done=!1}; -q.step=function(){var a=this.j;do{var b=a[a.length-1];if(!b)return!1;var c=b.node,d=c.type;if("Program"===d&&b.done)return!1;if(this.wa)break;try{var e=this.pb[d](a,b,c)}catch(g){if(g!==Aa)throw g;}e&&a.push(e);if(this.I)throw Error("Getter not supported in this context");if(this.ya)throw Error("Setter not supported in this context");}while(!c.end);return!0};q.nb=function(){for(;!this.wa&&this.step(););return this.wa}; -function Qa(a,b){a.setProperty(b,"NaN",NaN,ya);a.setProperty(b,"Infinity",Infinity,ya);a.setProperty(b,"undefined",void 0,ya);a.setProperty(b,"window",b,ya);a.setProperty(b,"this",b,ya);a.setProperty(b,"self",b);a.B=new F(null);a.W=new F(a.B);db(a,b);eb(a,b);b.la=a.B;a.setProperty(b,"constructor",a.m,B);Fb(a,b);Gb(a,b);Hb(a,b);Ib(a,b);Jb(a,b);Kb(a,b);Lb(a,b);Mb(a,b);Nb(a,b);var c=a.b(function(){throw EvalError("Can't happen");},!1);c.eval=!0;a.setProperty(b,"eval",c);a.setProperty(b,"parseInt",a.b(parseInt, -!1));a.setProperty(b,"parseFloat",a.b(parseFloat,!1));a.setProperty(b,"isNaN",a.b(isNaN,!1));a.setProperty(b,"isFinite",a.b(isFinite,!1));c=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]];for(var d=0;d>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;", -"while (k < len) {","if (k in O && !callbackfn.call(T, O[k], k, O)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t) {", -"var val = t[i];","if (fun.call(thisArg, val, i, t)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var T, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","k = 0;","while (k < len) {","if (k in O) callback.call(T, O[k], k, O);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',", -"{configurable: true, writable: true, value:","function(callback, thisArg) {","if (!this || typeof callback !== 'function') new TypeError;","var T, A, k;","var O = Object(this);","var len = O.length >>> 0;","if (arguments.length > 1) T = thisArg;","A = new Array(len);","k = 0;","while (k < len) {","if (k in O) A[k] = callback.call(T, O[k], k, O);","k++;","}","return A;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {", -"if (!this || typeof callback !== 'function') throw TypeError();","var t = Object(this), len = t.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in t)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k++];","}","for (; k < len; k++) {","if (k in t) value = callback(value, t[k], k, t);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',", -"{configurable: true, writable: true, value:","function(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var t = Object(this), len = t.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];","} else {","while (k >= 0 && !(k in t)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = t[k--];","}","for (; k >= 0; k--) {","if (k in t) value = callback(value, t[k], k, t);", -"}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var t = Object(this);","var len = t.length >>> 0;","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in t && fun.call(thisArg, t[i], i, t)) {","return true;","}","}","return false;","}","});","(function() {","var sort_ = Array.prototype.sort;", -"Array.prototype.sort = function(opt_comp) {","if (typeof opt_comp !== 'function') {","return sort_.call(this);","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {","if (opt_comp(this[j], this[j + 1]) > 0) {","var swap = this[j];","this[j] = this[j + 1];","this[j + 1] = swap;","changes++;","}","}","if (!changes) break;","}","return this;","};","})();","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:", -"function() {","var out = [];","for (var i = 0; i < this.length; i++) {","out[i] = (this[i] === null || this[i] === undefined) ? '' : this[i].toLocaleString();","}","return out.join(',');","}","});","")} -function Gb(a,b){var c=function(e){e=arguments.length?String(e):"";return zc(a)?(this.data=e,this):e};a.w=a.b(c,!0);a.setProperty(b,"String",a.w);a.setProperty(a.w,"fromCharCode",a.b(String.fromCharCode,!1),B);c="charAt charCodeAt concat indexOf lastIndexOf slice substr substring toLocaleLowerCase toLocaleUpperCase toLowerCase toUpperCase trim".split(" ");for(var d=0;d= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);", -"}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")}function Hb(a,b){a.Ya=a.b(function(c){c=!!c;return zc(a)?(this.data=c,this):c},!0);a.setProperty(b,"Boolean",a.Ya)} -function Ib(a,b){var c=function(e){e=arguments.length?Number(e):0;return zc(a)?(this.data=e,this):e};a.S=a.b(c,!0);a.setProperty(b,"Number",a.S);c=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"];for(var d=0;db.charCodeAt(0)&&U(this,a,this.w)){var c=Oa(b);if(!isNaN(c)&&c>=":d>>=e;break;case ">>>=":d>>>=e;break;case "&=":d&=e;break;case "^=":d^=e;break;case "|=":d|=e;break;default:throw SyntaxError("Unknown assignment expression: "+c.operator);}if(c=cd(this,b.ra,d))return b.ia=!0,b.Wa=d,fd(this,c,b.ra,d);a.pop();a[a.length-1].value=d}}; -u.prototype.stepBinaryExpression=function(a,b,c){if(!b.Y)return b.Y=!0,new v(c.left,b.scope);if(!b.pa)return b.pa=!0,b.$=b.value,new v(c.right,b.scope);a.pop();var d=b.$;b=b.value;switch(c.operator){case "==":c=d==b;break;case "!=":c=d!=b;break;case "===":c=d===b;break;case "!==":c=d!==b;break;case ">":c=d>b;break;case ">=":c=d>=b;break;case "<":c=d>":c=d>>b;break;case ">>>":c=d>>>b;break;case "in":b instanceof F||I(this,this.g,"'in' expects an object, not '"+b+"'");c=Bc(this,b,d);break;case "instanceof":U(this,b,this.H)||I(this,this.g,"Right-hand side of instanceof is not an object");c=d instanceof F?U(this,d,b):!1;break;default:throw SyntaxError("Unknown binary operator: "+c.operator);}a[a.length-1].value=c}; -u.prototype.stepBlockStatement=function(a,b,c){var d=b.o||0;if(c=c.body[d])return b.o=d+1,new v(c,b.scope);a.pop()};u.prototype.stepBreakStatement=function(a,b,c){dd(this,1,void 0,c.label&&c.label.name)}; -u.prototype.stepCallExpression=function(a,b,c){if(!b.ha){b.ha=1;var d=new v(c.callee,b.scope);d.ga=!0;return d}if(1===b.ha){b.ha=2;d=b.value;if(Array.isArray(d)){if(b.Z=bd(this,d),d[0]===Ba?b.yb="eval"===d[1]:b.G=d[0],d=b.Z,this.I)return b.ha=1,ed(this,d,b.value)}else b.Z=d;b.A=[];b.o=0}d=b.Z;if(!b.Qa){0!==b.o&&b.A.push(b.value);if(c.arguments[b.o])return new v(c.arguments[b.o++],b.scope);if("NewExpression"===c.type){d.Hb&&I(this,this.g,d+" is not a constructor");if(d===this.l)b.G=Ac(this);else{var e= -d.a.prototype;if("object"!==typeof e||null===e)e=this.B;b.G=this.h(e)}b.isConstructor=!0}else void 0===b.G&&(b.G=b.scope.P?void 0:this.Da);b.Qa=!0}if(b.Ra)a.pop(),a[a.length-1].value=b.isConstructor&&"object"!==typeof b.value?b.G:b.value;else{b.Ra=!0;d instanceof F||I(this,this.g,d+" is not a function");if(a=d.node){c=ia(this,a.body,d.va);for(var g=0;gg?b.A[g]:void 0);e=Ac(this);for(g=0;g>>0;return b===Number(a)?b:NaN}function Ib(a){var b=a>>>0;return String(b)===String(a)&&4294967295!==b?b:NaN}function Ia(a,b,d){b?a.start=b:delete a.start;d?a.end=d:delete a.end;for(var c in a)if("loc"!==c&&a.hasOwnProperty(c)){var e=a[c];e&&"object"===typeof e&&Ia(e,b,d)}}r.prototype.REGEXP_MODE=2;r.prototype.REGEXP_THREAD_TIMEOUT=1E3;r.prototype.POLYFILL_TIMEOUT=1E3;p=r.prototype;p.N=!1;p.Da=!1;p.Cb=0; +function Ga(a,b){var d={},c;for(c in Ja)d[c]=Ja[c];d.sourceFile=b;return acorn.parse(a,d)}p.Bb=function(a){var b=this.o[0];if(!b||"Program"!==b.node.type)throw Error("Expecting original AST to start with a Program node.");"string"===typeof a&&(a=Ga(a,"appendCode"+this.Cb++));if(!a||"Program"!==a.type)throw Error("Expecting new AST to start with a Program node.");Jb(this,a,b.scope);Array.prototype.push.apply(b.node.body,a.body);b.done=!1}; +p.fb=function(){var a=this.o,b=Date.now();do{var d=a[a.length-1];if(!d)return!1;var c=d.node,e=c.type;if("Program"===e&&d.done)return!1;if(this.sa)break;try{var g=this.lb[e](a,d,c)}catch(l){if(l!==Na)throw l;}g&&a.push(g);if(this.N)throw Error("Getter not supported in this context");if(this.Da)throw Error("Setter not supported in this context");}while(!c.end&&b+this.POLYFILL_TIMEOUT>Date.now());return!0};p.xb=function(){for(;!this.sa&&this.fb(););return this.sa}; +function Kb(a,b){a.g(b,"NaN",NaN,La);a.g(b,"Infinity",Infinity,La);a.g(b,"undefined",void 0,La);a.g(b,"window",b,Ka);a.g(b,"this",b,La);a.g(b,"self",b);a.L=new C(null);a.X=new C(a.L);Lb(a,b);Mb(a,b);b.ra=a.L;a.g(b,"constructor",a.v,u);Nb(a,b);Ob(a,b);Pb(a,b);Qb(a,b);Rb(a,b);Sb(a,b);Tb(a,b);Ub(a,b);Cc(a,b);var d=a.i(function(){throw EvalError("Can't happen");},!1);d.eval=!0;a.g(b,"eval",d,u);a.g(b,"parseInt",a.i(parseInt,!1),u);a.g(b,"parseFloat",a.i(parseFloat,!1),u);a.g(b,"isNaN",a.i(isNaN,!1),u); +a.g(b,"isFinite",a.i(isFinite,!1),u);d=[[escape,"escape"],[unescape,"unescape"],[decodeURI,"decodeURI"],[decodeURIComponent,"decodeURIComponent"],[encodeURI,"encodeURI"],[encodeURIComponent,"encodeURIComponent"]];for(var c=0;c>> 0;","if (!len || len < 0) {","o.length = 0;","return undefined;","}","len--;","var x = o[len];","delete o[len];","o.length = len;","return x;","}","});","Object.defineProperty(Array.prototype, 'push',","{configurable: true, writable: true, value:","function push(var_args) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;", +"for (var i = 0; i < arguments.length; i++) {","o[len] = arguments[i];","len++;","}","o.length = len;","return len;","}","});","Object.defineProperty(Array.prototype, 'shift',","{configurable: true, writable: true, value:","function shift() {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","if (!len || len < 0) {","o.length = 0;","return undefined;","}","var value = o[0];","for (var i = 0; i < len - 1; i++) {","if ((i + 1) in o) {","o[i] = o[i + 1];","} else {", +"delete o[i];","}","}","delete o[i];","o.length = len - 1;","return value;","}","});","Object.defineProperty(Array.prototype, 'unshift',","{configurable: true, writable: true, value:","function unshift(var_args) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","if (!len || len < 0) {","len = 0;","}","for (var i = len - 1; i >= 0; i--) {","if (i in o) {","o[i + arguments.length] = o[i];","} else {","delete o[i + arguments.length];","}","}","for (var i = 0; i < arguments.length; i++) {", +"o[i] = arguments[i];","}","return (o.length = len + arguments.length);","}","});","Object.defineProperty(Array.prototype, 'reverse',","{configurable: true, writable: true, value:","function reverse() {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","if (!len || len < 2) {","return o;","}","for (var i = 0; i < len / 2 - 0.5; i++) {","var x = o[i];","var hasX = i in o;","if ((len - i - 1) in o) {","o[i] = o[len - i - 1];","} else {","delete o[i];","}","if (hasX) {", +"o[len - i - 1] = x;","} else {","delete o[len - i - 1];","}","}","return o;","}","});","Object.defineProperty(Array.prototype, 'indexOf',","{configurable: true, writable: true, value:","function indexOf(searchElement, fromIndex) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","var n = fromIndex | 0;","if (!len || n >= len) {","return -1;","}","var i = Math.max(n >= 0 ? n : len - Math.abs(n), 0);","while (i < len) {","if (i in o && o[i] === searchElement) {", +"return i;","}","i++;","}","return -1;","}","});","Object.defineProperty(Array.prototype, 'lastIndexOf',","{configurable: true, writable: true, value:","function lastIndexOf(searchElement, fromIndex) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","if (!len) {","return -1;","}","var n = len - 1;","if (arguments.length > 1) {","n = fromIndex | 0;","if (n) {","n = (n > 0 || -1) * Math.floor(Math.abs(n));","}","}","var i = n >= 0 ? Math.min(n, len - 1) : len - Math.abs(n);", +"while (i >= 0) {","if (i in o && o[i] === searchElement) {","return i;","}","i--;","}","return -1;","}","});","Object.defineProperty(Array.prototype, 'slice',","{configurable: true, writable: true, value:","function slice(start, end) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","start |= 0;","start = (start >= 0) ? start : Math.max(0, len + start);","if (typeof end !== 'undefined') {","if (end !== Infinity) {","end |= 0;","}","if (end < 0) {","end = len + end;", +"} else {","end = Math.min(end, len);","}","} else {","end = len;","}","var size = end - start;","var cloned = new Array(size);","for (var i = 0; i < size; i++) {","if ((start + i) in o) {","cloned[i] = o[start + i];","}","}","return cloned;","}","});","Object.defineProperty(Array.prototype, 'splice',","{configurable: true, writable: true, value:","function splice(start, deleteCount, var_args) {","if (!this) throw TypeError();","var o = Object(this);","var len = o.length >>> 0;","start |= 0;","if (start < 0) {", +"start = Math.max(len + start, 0);","} else {","start = Math.min(start, len);","}","if (arguments.length < 1) {","deleteCount = len - start;","} else {","deleteCount |= 0;","deleteCount = Math.max(0, Math.min(deleteCount, len - start));","}","var removed = [];","for (var i = start; i < start + deleteCount; i++) {","if (i in o) {","removed.push(o[i]);","} else {","removed.length++;","}","if ((i + deleteCount) in o) {","o[i] = o[i + deleteCount];","} else {","delete o[i];","}","}","for (var i = start + deleteCount; i < len - deleteCount; i++) {", +"if ((i + deleteCount) in o) {","o[i] = o[i + deleteCount];","} else {","delete o[i];","}","}","for (var i = len - deleteCount; i < len; i++) {","delete o[i];","}","len -= deleteCount;","var arl = arguments.length - 2;","for (var i = len - 1; i >= start; i--) {","if (i in o) {","o[i + arl] = o[i];","} else {","delete o[i + arl];","}","}","len += arl;","for (var i = 2; i < arguments.length; i++) {","o[start + i - 2] = arguments[i];","}","o.length = len;","return removed;","}","});","Object.defineProperty(Array.prototype, 'concat',", +"{configurable: true, writable: true, value:","function concat(var_args) {","if (!this) throw TypeError();","var o = Object(this);","var cloned = [];","for (var i = -1; i < arguments.length; i++) {","var value = (i === -1) ? o : arguments[i];","if (Array.isArray(value)) {","for (var j = 0, l = value.length; j < l; j++) {","if (j in value) {","cloned.push(value[j]);","} else {","cloned.length++;","}","}","} else {","cloned.push(value);","}","}","return cloned;","}","});","Object.defineProperty(Array.prototype, 'join',", +"{configurable: true, writable: true, value:","function join(opt_separator) {","if (!this) throw TypeError();","var o = Object(this);","var sep = typeof opt_separator === 'undefined' ?","',' : ('' + opt_separator);","var str = '';","for (var i = 0; i < o.length; i++) {","if (i && sep) {","str += sep;","}","str += (o[i] === null || o[i] === undefined) ? '' : o[i];","}","return str;","}","});","Object.defineProperty(Array.prototype, 'every',","{configurable: true, writable: true, value:","function every(callbackfn, thisArg) {", +"if (!this || typeof callbackfn !== 'function') throw TypeError();","var t, k;","var o = Object(this);","var len = o.length >>> 0;","if (arguments.length > 1) t = thisArg;","k = 0;","while (k < len) {","if (k in o && !callbackfn.call(t, o[k], k, o)) return false;","k++;","}","return true;","}","});","Object.defineProperty(Array.prototype, 'filter',","{configurable: true, writable: true, value:","function filter(fun, var_args) {","if (this === void 0 || this === null || typeof fun !== 'function') throw TypeError();", +"var o = Object(this);","var len = o.length >>> 0;","var res = [];","var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in o) {","var val = o[i];","if (fun.call(thisArg, val, i, o)) res.push(val);","}","}","return res;","}","});","Object.defineProperty(Array.prototype, 'forEach',","{configurable: true, writable: true, value:","function forEach(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var t, k;","var o = Object(this);", +"var len = o.length >>> 0;","if (arguments.length > 1) t = thisArg;","k = 0;","while (k < len) {","if (k in o) callback.call(t, o[k], k, o);","k++;","}","}","});","Object.defineProperty(Array.prototype, 'map',","{configurable: true, writable: true, value:","function map(callback, thisArg) {","if (!this || typeof callback !== 'function') throw TypeError();","var t, a, k;","var o = Object(this);","var len = o.length >>> 0;","if (arguments.length > 1) t = thisArg;","a = new Array(len);","k = 0;","while (k < len) {", +"if (k in o) a[k] = callback.call(t, o[k], k, o);","k++;","}","return a;","}","});","Object.defineProperty(Array.prototype, 'reduce',","{configurable: true, writable: true, value:","function reduce(callback /*, initialValue*/) {","if (!this || typeof callback !== 'function') throw TypeError();","var o = Object(this), len = o.length >>> 0, k = 0, value;","if (arguments.length === 2) {","value = arguments[1];","} else {","while (k < len && !(k in o)) k++;","if (k >= len) {","throw TypeError('Reduce of empty array with no initial value');", +"}","value = o[k++];","}","for (; k < len; k++) {","if (k in o) value = callback(value, o[k], k, o);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'reduceRight',","{configurable: true, writable: true, value:","function reduceRight(callback /*, initialValue*/) {","if (null === this || 'undefined' === typeof this || 'function' !== typeof callback) throw TypeError();","var o = Object(this), len = o.length >>> 0, k = len - 1, value;","if (arguments.length >= 2) {","value = arguments[1];", +"} else {","while (k >= 0 && !(k in o)) k--;","if (k < 0) {","throw TypeError('Reduce of empty array with no initial value');","}","value = o[k--];","}","for (; k >= 0; k--) {","if (k in o) value = callback(value, o[k], k, o);","}","return value;","}","});","Object.defineProperty(Array.prototype, 'some',","{configurable: true, writable: true, value:","function some(fun/*, thisArg*/) {","if (!this || typeof fun !== 'function') throw TypeError();","var o = Object(this);","var len = o.length >>> 0;", +"var thisArg = arguments.length >= 2 ? arguments[1] : void 0;","for (var i = 0; i < len; i++) {","if (i in o && fun.call(thisArg, o[i], i, o)) {","return true;","}","}","return false;","}","});","Object.defineProperty(Array.prototype, 'sort',","{configurable: true, writable: true, value:","function sort(opt_comp) {","if (!this) throw TypeError();","if (typeof opt_comp !== 'function') {","opt_comp = undefined;","}","for (var i = 0; i < this.length; i++) {","var changes = 0;","for (var j = 0; j < this.length - i - 1; j++) {", +"if (opt_comp ? (opt_comp(this[j], this[j + 1]) > 0) :","(String(this[j]) > String(this[j + 1]))) {","var swap = this[j];","var hasSwap = j in this;","if ((j + 1) in this) {","this[j] = this[j + 1];","} else {","delete this[j];","}","if (hasSwap) {","this[j + 1] = swap;","} else {","delete this[j + 1];","}","changes++;","}","}","if (!changes) break;","}","return this;","}","});","Object.defineProperty(Array.prototype, 'toLocaleString',","{configurable: true, writable: true, value:","function toLocaleString() {", +"if (!this) throw TypeError();","var o = Object(this);","var out = [];","for (var i = 0; i < o.length; i++) {","out[i] = (o[i] === null || o[i] === undefined) ? '' : o[i].toLocaleString();","}","return out.join(',');","}","});","")} +function Ob(a,b){var d=function(c){c=arguments.length?gb.String(c):"";return Fc(a)?(this.data=c,this):c};a.J=a.i(d,!0);a.g(b,"String",a.J,u);a.g(a.J,"fromCharCode",a.i(String.fromCharCode,!1),u);b="charAt charCodeAt concat indexOf lastIndexOf slice substr substring toLocaleLowerCase toLocaleUpperCase toLowerCase toUpperCase trim".split(" ");for(d=0;d= 0; i--) {","str = str.substring(0, subs[i][0]) + subs[i][2] + str.substring(subs[i][0] + subs[i][1]);","}","} else {","var i = str.indexOf(substr);","if (i !== -1) {","var inject = newSubstr(str.substr(i, substr.length), i, str);","str = str.substring(0, i) + inject + str.substring(i + substr.length);","}","}","return str;","};","})();","")}function Pb(a,b){a.gb=a.i(function(d){d=gb.Boolean(d);return Fc(a)?(this.data=d,this):d},!0);a.g(b,"Boolean",a.gb,u)} +function Qb(a,b){var d=function(c){c=arguments.length?gb.Number(c):0;return Fc(a)?(this.data=c,this):c};a.Z=a.i(d,!0);a.g(b,"Number",a.Z,u);b=["MAX_VALUE","MIN_VALUE","NaN","NEGATIVE_INFINITY","POSITIVE_INFINITY"];for(d=0;db.charCodeAt(0)&&P(this,a,this.J)){var d=Ib(b);if(!isNaN(d)&&d>=":c>>=e;break;case ">>>=":c>>>=e;break;case "&=":c&=e;break;case "^=":c^=e;break;case "|=":c|=e;break;default:throw SyntaxError("Unknown assignment expression: "+d.operator);}if(d=md(this,b.ya,c))return b.oa=!0,b.cb=c,pd(this,d,b.ya,c);a.pop();a[a.length-1].value=c}}; +r.prototype.stepBinaryExpression=function(a,b,d){if(!b.ea)return b.ea=!0,new t(d.left,b.scope);if(!b.wa)return b.wa=!0,b.fa=b.value,new t(d.right,b.scope);a.pop();var c=b.fa;b=b.value;switch(d.operator){case "==":d=c==b;break;case "!=":d=c!=b;break;case "===":d=c===b;break;case "!==":d=c!==b;break;case ">":d=c>b;break;case ">=":d=c>=b;break;case "<":d=c>":d=c>>b;break;case ">>>":d=c>>>b;break;case "in":b instanceof C||J(this,this.m,"'in' expects an object, not '"+b+"'");d=fd(this,b,c);break;case "instanceof":P(this,b,this.M)||J(this,this.m,"Right-hand side of instanceof is not an object");d=c instanceof C?P(this,c,b):!1;break;default:throw SyntaxError("Unknown binary operator: "+d.operator);}a[a.length-1].value=d}; +r.prototype.stepBlockStatement=function(a,b,d){var c=b.A||0;if(d=d.body[c])return b.A=c+1,new t(d,b.scope);a.pop()};r.prototype.stepBreakStatement=function(a,b,d){nd(this,1,void 0,d.label&&d.label.name)};r.prototype.Ab=0; +r.prototype.stepCallExpression=function(a,b,d){if(!b.na){b.na=1;var c=new t(d.callee,b.scope);c.ma=!0;return c}if(1===b.na){b.na=2;c=b.value;if(Array.isArray(c)){if(b.ba=ld(this,c),c[0]===Oa?b.Gb="eval"===c[1]:b.B=c[0],c=b.ba,this.N)return b.na=1,od(this,c,b.value)}else b.ba=c;b.G=[];b.A=0}c=b.ba;if(!b.Xa){0!==b.A&&b.G.push(b.value);if(d.arguments[b.A])return new t(d.arguments[b.A++],b.scope);if("NewExpression"===d.type){c instanceof C&&!c.ub||J(this,this.m,c+" is not a constructor");if(c===this.ia)b.B= +Ic(this);else{var e=c.h.prototype;if("object"!==typeof e||null===e)e=this.L;b.B=this.s(e)}b.isConstructor=!0}b.Xa=!0}if(b.Ya)a.pop(),a[a.length-1].value=b.isConstructor&&"object"!==typeof b.value?b.B:b.value;else{b.Ya=!0;c instanceof C||J(this,this.m,c+" is not a function");if(a=c.node){d=Ha(this,a.body,c.Oa);for(var g=0;gg?b.G[g]:void 0);e=Ic(this);for(g=0;g