change it

This commit is contained in:
numbbbbb
2014-06-03 12:21:35 +08:00
parent 0cd6f031bd
commit 999404b3e8
82 changed files with 0 additions and 0 deletions

View File

@ -0,0 +1,32 @@
/*
Copyright Joyent, Inc. and other Node contributors.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the
following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
USE OR OTHER DEALINGS IN THE SOFTWARE.
Original at: https://github.com/joyent/node/blob/master/lib/util.js
*/
(function(){function o(c){return c instanceof Array||Array.isArray(c)||c&&c!==Object.prototype&&o(c.__proto__)}function p(c){return c instanceof RegExp||typeof c==="function"&&c.constructor.name==="RegExp"&&c.compile&&c.test&&c.exec&&(""+c).match(/^\/.*\/[gim]{0,3}$/)}var q=80,l=function(c,h,b,f){function m(a,c){switch(typeof a){case "undefined":return d("undefined","undefined");case "string":var b="'"+JSON.stringify(a).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return d(b,"string");
case "number":return d(""+a,"number");case "boolean":return d(""+a,"boolean")}if(a===null)return d("null","null");var f=Object.keys(a),i=h?Object.getOwnPropertyNames(a):f;if(typeof a==="function"&&i.length===0)return p(a)?d(""+a,"regexp"):d("[Function"+(a.name?": "+a.name:"")+"]","special");if(a instanceof Date&&i.length===0)return d(a.toUTCString(),"date");var j,l;o(a)?(l="Array",b=["[","]"]):(l="Object",b=["{","}"]);typeof a==="function"?(j=a.name?": "+a.name:"",j=p(a)?" "+a:" [Function"+j+"]"):
j="";a instanceof Date&&(j=" "+a.toUTCString());if(i.length===0)return b[0]+j+b[1];if(c<0)return p(a)?d(""+a,"regexp"):d("[Object]","special");k.push(a);i=i.map(function(b){var e,g;a.__lookupGetter__&&(a.__lookupGetter__(b)?g=a.__lookupSetter__(b)?d("[Getter/Setter]","special"):d("[Getter]","special"):a.__lookupSetter__(b)&&(g=d("[Setter]","special")));f.indexOf(b)<0&&(e="["+b+"]");g||(k.indexOf(a[b])<0?(g=c===null?m(a[b]):m(a[b],c-1),g.indexOf("\n")>-1&&(g=o(a)?g.split("\n").map(function(a){return" "+
a}).join("\n").substr(2):"\n"+g.split("\n").map(function(a){return" "+a}).join("\n"))):g=d("[Circular]","special"));if(typeof e==="undefined"){if(l==="Array"&&b.match(/^\d+$/))return g;e=JSON.stringify(""+b);e.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(e=e.substr(1,e.length-2),e=d(e,"name")):(e=e.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),e=d(e,"string"))}return e+": "+g});k.pop();var n=0;return i=i.reduce(function(a,b){n++;b.indexOf("\n")>=0&&n++;return a+b.length+1},0)>q?b[0]+
(j===""?"":j+"\n ")+" "+i.join(",\n ")+" "+b[1]:b[0]+j+" "+i.join(", ")+" "+b[1]}var k=[],d=function(a,b){var c={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},d={special:"cyan",number:"blue","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"}[b];return d?"\u001b["+c[d][0]+"m"+a+"\u001b["+c[d][1]+"m":a};f||(d=function(a){return a});
return m(c,typeof b==="undefined"?2:b)},r=/%[sdj%]/g,s=function(c){if(typeof c!=="string"){for(var h=[],b=0;b<arguments.length;b++)h.push(l(arguments[b]));return h.join(" ")}for(var b=1,f=arguments,m=f.length,h=String(c).replace(r,function(c){if(b>=m)return c;switch(c){case "%s":return String(f[b++]);case "%d":return Number(f[b++]);case "%j":return JSON.stringify(f[b++]);case "%%":return"%";default:return c}}),k=f[b];b<m;k=f[++b])h+=k===null||typeof k!=="object"?" "+k:" "+l(k);return h},n={};self.console=
{log:function(){Sandboss.out(s.apply(this,arguments)+"\n")},dir:function(c){Sandboss.out(l(c)+"\n")},time:function(c){n[c]=Date.now()},timeEnd:function(c){var h=Date.now()-n[c];self.console.log("%s: %dms",c,h)},read:function(c){Sandboss.input(c||function(){})},inspect:l}})();

27
gitbook/jsrepl/jsrepl.js Executable file
View File

@ -0,0 +1,27 @@
window.__BAKED_JSREPL_BUILD__ = true;
(function(){var l,j,k,m,p,n,q,r,o=[].slice,i=function(h,a){return function(){return h.apply(a,arguments)}},u={}.hasOwnProperty,s=function(h,a){function c(){this.constructor=h}for(var b in a)u.call(a,b)&&(h[b]=a[b]);c.prototype=a.prototype;h.prototype=new c;h.__super__=a.prototype;return h};j=document.getElementById("jsrepl-script");if(j!=null)l=j.src.split("/").slice(0,-1).join("/"),p=""+l+"/sandbox.html";else throw Error('JSREPL script element cannot be found. Make sure you have the ID "jsrepl-script" on it.');
m=function(){function h(){var a;a=function(c){return function(){c.head=document.getElementsByTagName("head")[0];return c.body=document.getElementsByTagName("body")[0]}}(this);a();this.loadfns=[a];window.onload=function(c){return function(){var b,a,d,e,g;e=c.loadfns;g=[];for(a=0,d=e.length;a<d;a++)b=e[a],g.push(b());return g}}(this);this.iframe=null}h.prototype._appendChild=function(a,c){var b;b=function(b){return function(){return b[a].appendChild(c)}}(this);return this[a]!=null?b():this.loadfns.push(b)};
h.prototype.createSandbox=function(a){this.iframe!=null&&this.body.removeChild(this.iframe);this.iframe=document.createElement("iframe");this.iframe.src=p;this.iframe.style.display="none";this.iframe.onload=function(c){return function(){return a(c.iframe.contentWindow)}}(this);return this._appendChild("body",this.iframe)};return h}();j=function(){function h(){this.listeners={}}h.prototype.makeArray=function(a){Object.prototype.toString.call(a)!=="[object Array]"&&(a=[a]);return a};h.prototype.on=
function(a,c){var b,f,d,e;if(typeof c==="function"){a=this.makeArray(a);e=[];for(f=0,d=a.length;f<d;f++)b=a[f],this.listeners[b]==null?e.push(this.listeners[b]=[c]):e.push(this.listeners[b].push(c));return e}};h.prototype.off=function(a,c){var b,f,d,e,g,a=this.makeArray(a);g=[];for(d=0,e=a.length;d<e;d++)b=a[d],f=this.listeners[b],f!=null&&(c!=null?(b=f.indexOf(c),b>-1?g.push(f.splice(b,1)):g.push(void 0)):g.push(this.listeners[b]=[]));return g};h.prototype.fire=function(a,c){var b,f,d,e,c=this.makeArray(c);
f=this.listeners[a];if(f!=null){c.push(a);var g;g=[];for(d=0,e=f.length;d<e;d++)b=f[d],g.push(b);e=[];for(f=0,d=g.length;f<d;f++)b=g[f],e.push(b.apply(this,c));return e}};h.prototype.once=function(a,c){var b,f,d,e,g,a=this.makeArray(a);b=function(g){return function(){var f,d,e,h;f=1<=arguments.length?o.call(arguments,0):[];for(e=0,h=a.length;e<h;e++)d=a[e],g.off(d,b);return c.apply(null,f)}}(this);g=[];for(d=0,e=a.length;d<e;d++)f=a[d],g.push(this.on(f,b));return g};return h}();r="Worker"in window;
n=function(h){function a(c,b,a){var d;this.input_server=b;a==null&&(a={});this.onmsg=i(this.onmsg,this);var e,g,h;h=[];for(e=0,g=c.length;e<g;e++)b=c[e],h.push(l+"/"+b);this.baseScripts=h;this.loader=new m;for(d in a)c=a[d],typeof c==="function"&&(a[d]=[c]);this.listeners=a}s(a,h);a.prototype.onmsg=function(a){var b;try{return b=JSON.parse(a.data),this.fire(b.type,[b.data])}catch(f){}};a.prototype.load=function(a,b){var f,d,e;b==null&&(b=true);f=this.baseScripts.concat(a);d=f.shift();this.worker!=
null&&this.kill();e=function(a){return function(){a.post({type:"importScripts",data:f});if(a.input_server!=null)return a.post({type:"set_input_server",data:a.input_server})}}(this);window.removeEventListener("message",this.onmsg,false);return!r||!b?this.loader.createSandbox(function(a){return function(b){a.worker=b;a.workerIsIframe=true;window.addEventListener("message",a.onmsg,false);return e()}}(this)):(this.worker=new Worker(d),this.workerIsIframe=false,this.worker.addEventListener("message",this.onmsg,
false),e())};a.prototype.post=function(a){a=JSON.stringify(a);return this.workerIsIframe?this.worker.postMessage(a,"*"):this.worker.postMessage(a)};a.prototype.kill=function(){var a;typeof(a=this.worker).terminate==="function"&&a.terminate();if(this.loader.body!=null&&this.loader.iframe)return this.loader.body.removeChild(this.loader.iframe),delete this.loader.iframe};return a}(j);q=function(){var h,a,c;h={firefox_3:/firefox\/3/i,opera:/opera/i,chrome:/chrome/i};for(a in h)if(c=h[a],c.test(window.navigator.userAgent))return a}();
k=function(h){function a(c){var b,f,d,e,g,h,t;b=c!=null?c:{};t=b.result;c=b.error;d=b.input;g=b.output;h=b.progress;this.timeout=b.timeout;e=b.input_server;this.getLangConfig=i(this.getLangConfig,this);this.rawEval=i(this.rawEval,this);this.eval=i(this.eval,this);this.checkLineEnd=i(this.checkLineEnd,this);this.loadLanguage=i(this.loadLanguage,this);this.off=i(this.off,this);this.on=i(this.on,this);a.__super__.constructor.call(this);window.openDatabase!=null&&(f=openDatabase("replit_input","1.0",
"Emscripted input",1024),f.transaction(function(a){a.executeSql("DROP TABLE IF EXISTS input");return a.executeSql("CREATE TABLE input (text)")}));e==null&&(e={});e.input_id=Math.floor(Math.random()*9007199254740992)+1;this.lang=null;this.on("input",d);b=["sandbox.js"];window.__BAKED_JSREPL_BUILD__||(b=b.concat(["util/polyfills.js","util/mtwister.js"]));this.sandbox=new n(b,e,{output:g,input:function(a){return function(){return a.fire("input",function(b){return a.sandbox.post({type:"input.write",data:b})})}}(this),
error:c,result:t,progress:h,db_input:function(a){return function(){return a.fire("input",function(b){a.sandbox.fire("recieved_input",[b]);return f.transaction(function(a){return a.executeSql("INSERT INTO input (text) VALUES ('"+b+"')",[])})})}}(this),server_input:function(a){return function(){return a.fire("input",function(b){var c,d;a.sandbox.fire("recieved_input",[b]);c=(e.url||"/emscripten/input/")+e.input_id;if(e.cors)if(d=new XMLHttpRequest,"withCredentials"in d)d.open("POST",c,true);else if(typeof XDomainRequest!==
"undefined"&&XDomainRequest!==null)d=new XDomainRequest,d.open("POST",c);else throw Error("CORS not supported on your browser");else d=new XMLHttpRequest,d.open("POST",c,true);return d.send("input="+b)})}}(this)})}s(a,h);a.prototype.on=function(c,b){var f,d,e,g,c=this.makeArray(c);g=[];for(d=0,e=c.length;d<e;d++)f=c[d],f==="input"?g.push(a.__super__.on.call(this,"input",b)):g.push(this.sandbox.on(f,b));return g};a.prototype.off=function(c,b){var f,d,e,g,c=this.makeArray(c);g=[];for(d=0,e=c.length;d<
e;d++)f=c[d],f==="input"?g.push(a.__super__.off.call(this,"input",b)):g.push(this.sandbox.off(f,b));return g};a.prototype.loadLanguage=function(c,b,f){var d,e;typeof b==="function"&&(e=[b,void 0],f=e[0],b=e[1]);if(a.prototype.Languages.prototype[c]==null)throw Error("Language "+c+" not supported.");this.current_lang_name=c;this.lang=a.prototype.Languages.prototype[c];if(f!=null)this.sandbox.once("ready",f);return this.sandbox.load(function(){var a,b,c,e;c=this.lang.scripts;e=[];for(a=0,b=c.length;a<
b;a++)d=c[a],typeof d==="object"?e.push(d[q]||d["default"]):e.push(d);return e}.call(this).concat([this.lang.engine]),b)};a.prototype.checkLineEnd=function(a,b){return/\n\s*$/.test(a)?b(false):(this.sandbox.once("indent",b),this.sandbox.post({type:"getNextLineIndent",data:a}))};a.prototype.eval=function(a,b){var f,d,e,g,h;!this.sandbox.workerIsIframe&&this.timeout!=null&&this.timeout.time&&this.timeout.callback&&(g=null,d=function(a){return function(){a.sandbox.fire("timeout");return a.timeout.callback()?
h():g=setTimeout(d,a.timeout.time)}}(this),g=setTimeout(d,this.timeout.time),e=function(a){return function(){var b,c;2<=arguments.length?o.call(arguments,0,c=arguments.length-1):c=0;b=arguments[c++];clearTimeout(g);if(b==="input")return a.once("recieved_input",function(){return g=setTimeout(d,a.timeout.time)}),f()}}(this),f=function(a){return function(){return a.once(["result","error","input"],e)}}(this),h=function(a){return function(){return a.off(["result","error","input"],e)}}(this),f());if(typeof b===
"function")this.once(["result","error"],function(){return function(){var a,c,d;a=2<=arguments.length?o.call(arguments,0,d=arguments.length-1):(d=0,[]);c=arguments[d++];return c==="error"?b(a[0],null):b(null,a[0])}}(this));return this.sandbox.post({type:"engine.Eval",data:a})};a.prototype.rawEval=function(a){return this.sandbox.post({type:"engine.RawEval",data:a})};a.prototype.getLangConfig=function(c){return a.prototype.Languages.prototype[c||this.current_lang_name]||null};return a}(j);k.prototype.Languages=
function(){return function(){}}();k.prototype.__test__=function(){return function(){}}();k.prototype.__test__.prototype.Loader=m;k.prototype.__test__.prototype.EventEmitter=j;k.prototype.__test__.prototype.Sandbox=n;this.JSREPL=k}).call(this);
JSREPL.prototype.Languages.prototype={qbasic:{system_name:"qbasic",name:"Quick Basic",extension:"bas",matchings:[],scripts:[{"default":["engines/qbasic-default.js"]}],includes:[],engine:"langs/qbasic/jsrepl_qbasic.js",minifier:"closure"},scheme:{system_name:"scheme",name:"Scheme",extension:"scm",matchings:[["(",")"],["[","]"]],scripts:[{"default":["engines/scheme-default.js"]}],includes:[],engine:"langs/scheme/jsrepl_scheme.js",minifier:"closure_es5"},apl:{system_name:"apl",name:"APL",extension:"apl",
matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/apl-default.js"]}],includes:[],engine:"langs/apl/jsrepl_apl.js",minifier:"yui"},javascript:{system_name:"javascript",name:"JavaScript",extension:"js",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/javascript-default.js"]}],includes:[],engine:"langs/javascript/jsrepl_js.js",minifier:"closure"},coffeescript:{system_name:"coffeescript",name:"CoffeeScript",extension:"coffee",matchings:[["(",")"],["[","]"],
["{","}"]],scripts:[{"default":["engines/coffeescript-default.js"]}],includes:[],engine:"langs/coffee-script/jsrepl_coffee.js",minifier:"uglify"},brainfuck:{system_name:"brainfuck",name:"Brainfuck",extension:"bf",matchings:[["[","]"]],scripts:[{"default":["engines/brainfuck-default.js"]}],includes:[],engine:"langs/brainfuck/jsrepl_brainfuck.js",minifier:"closure"},unlambda:{system_name:"unlambda",name:"Unlambda",extension:"unl",matchings:[],scripts:[{"default":["engines/unlambda-default.js"]}],includes:[],
engine:"langs/unlambda/jsrepl_unlambda.js",minifier:"closure"},lolcode:{system_name:"lolcode",name:"LOLCODE",extension:"lol",matchings:[],scripts:[{"default":["engines/lolcode-default.js"]}],includes:[],engine:"langs/lolcode/jsrepl_lolcode.js",minifier:"closure"},kaffeine:{system_name:"kaffeine",name:"Kaffeine",extension:"k",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/kaffeine-default.js"]}],includes:[],engine:"langs/kaffeine/jsrepl_kaffeine.js",minifier:"closure"},move:{system_name:"move",
name:"Move",extension:"mv",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/move-default.js"]}],includes:[],engine:"langs/move/jsrepl_move.js",minifier:"closure"},traceur:{system_name:"traceur",name:"Traceur",extension:"js",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/traceur-default.js"]}],includes:[],engine:"langs/traceur/jsrepl_traceur.js",minifier:"closure_es5"},emoticon:{system_name:"emoticon",name:"Emoticon",extension:"emo",matchings:[["(",")"]],
scripts:[{"default":["engines/emoticon-default.js"]}],includes:[],engine:"langs/emoticon/jsrepl_emoticon.js",minifier:"closure"},bloop:{system_name:"bloop",name:"Bloop/Floop",extensions:"bloop",matchings:[],scripts:[{"default":["engines/bloop-default.js"]}],includes:[],engine:"langs/bloop/jsrepl_bloop.js",minifier:"closure"},forth:{system_name:"forth",name:"Forth",extensions:"4th",matchings:[["(",")"],[":",";"]],scripts:[{"default":["engines/forth-default.js"]}],includes:[],engine:"langs/forth/jsrepl_forth.js",
minifier:"closure"},lua:{system_name:"lua",name:"Lua",extension:"lua",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/lua-default.js"]}],includes:[],engine:"langs/lua/jsrepl_lua.js",minifier:"none",emscripted:true},python:{system_name:"python",name:"Python",extension:"py",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{opera:["engines/python-opera.js"],"default":["engines/python-default.js"]}],includes:["extern/python/unclosured","extern/python/closured","extern/python/reloop-closured"],
engine:"langs/python/jsrepl_python.js",minifier:"none",emscripted:true},ruby:{system_name:"ruby",name:"Ruby",extension:"rb",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{opera:["engines/ruby-opera.js"],firefox_3:["engines/ruby-firefox_3.js"],"default":["engines/ruby-default.js"]}],includes:["extern/ruby/dist/lib"],engine:"langs/ruby/jsrepl_ruby.js",minifier:"none",emscripted:true},roy:{system_name:"roy",name:"Roy",extension:"roy",matchings:[["(",")"],["[","]"],["{","}"]],scripts:[{"default":["engines/roy-default.js"]}],
includes:[],engine:"langs/roy/jsrepl_roy.js",minifier:"closure"}};

View File

@ -0,0 +1,2 @@
(function(){self.JSREPLEngine=function(){function a(d,b,c,a,e,f){this.result=c;this.error=a;this.sandbox=e;this.inspect=this.sandbox.console.inspect;this.functionClass=this.sandbox.Function;this.sandbox.__eval=this.sandbox.eval;f()}a.prototype.Eval=function(d){var b;try{return b=this.sandbox.__eval(d),this.result(b===void 0?"":this.inspect(b))}catch(a){return this.error(a)}};a.prototype.RawEval=function(a){var b;try{return b=this.sandbox.__eval(a),this.result(b)}catch(c){return this.error(c)}};a.prototype.GetNextLineIndent=
function(a){try{return new this.functionClass(a),false}catch(b){return/[\[\{\(]$/.test(a)?1:0}};return a}()}).call(this);

9
gitbook/jsrepl/sandbox.html Executable file
View File

@ -0,0 +1,9 @@
<!DOCTYPE html>
<html>
<head>
<title>jsREPL Sandbox</title>
</head>
<body>
<script src="sandbox.js"></script>
</body>
</html>

52
gitbook/jsrepl/sandbox.js Executable file
View File

@ -0,0 +1,52 @@
/*
Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The names of its contributors may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Any feedback is very welcome.
http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/emt.html
email: m-mat @ math.sci.hiroshima-u.ac.jp (remove space)
*/
(function(c){try{c.window=c.window||c}catch(b){}try{c.self=c.self||c}catch(e){}var a;c.addEventListener("message",function(d){for(var d=JSON.parse(d.data),b=a,c=d.type.split("."),e=0;e<c.length;e++)b=b[c[e]];b(d.data)},false);(function(){var d=function(){},a="debug,error,info,log,warn,dir,dirxml,trace,assert,count,markTimeline,profile,profileEnd,time,timeEnd,timeStamp,group,groupCollapsed,groupEnd".split(",");if(typeof console==="undefined")c.console={};for(var b=0;b<a.length;b++)if(typeof c.console[a[b]]!==
"function")try{c.console[a[b]]=d}catch(e){}})();a={outTimeout:0,output_buffer:[],OUT_EVERY_MS:50,syncTimeout:Infinity,isFrame:typeof document!=="undefined",post:function(d){d=JSON.stringify(d);this.isFrame?window.parent.postMessage(d,"*"):self.postMessage(d)},importScripts:function(d){for(var b=[],c=0,e=[],f=[],j=0,g=this,m=XMLHttpRequest||ActiveXObject("Microsoft.XMLHTTP"),k=function(b){return function(a){var a=a.loaded||a.position,h=e[b]||0;e[b]=a;j+=a-h;a=j/c*100;f.length===d.length&&g.progress(a)}},
l=d.length,n=function(){var d;if(l===0){for(d=0;d<b.length;d++)(self.execScript||function(b){self.eval.call(self,b)})(b[d].responseText);g.engine=new self.JSREPLEngine(g.input,g.out,g.result,g.err,self,g.ready);g.bindAll(a.engine);g.hide("JSREPLEngine")}},i=0;i<d.length;i++)(function(a){b[a]=new m;b[a].addEventListener&&b[a].addEventListener("progress",k(a),false);b[a].onprogress=k(a);b[a].onreadystatechange=function(){if(b[a].readyState===2){var d=b[a];f.indexOf(d)===-1&&(f.push(d),c+=parseInt(d.getResponseHeader("X-Raw-Length"),
10))}else b[a].readyState===4&&(l--,n())};b[a].open("GET",d[a],true);b[a].send(null)})(i)},out:function(a){this.output_buffer.push(a);this.outTimeout===0?(this.outTimeout=setTimeout(this.flush,this.OUT_EVERY_MS),this.syncTimeout=Date.now()):Date.now()-this.syncTimeout>this.OUT_EVERY_MS&&(clearTimeout(this.outTimeout),this.flush())},flush:function(){if(this.output_buffer.length)this.post({type:"output",data:this.output_buffer.join("")}),this.outTimeout=0,this.output_buffer=[]},err:function(a){a={type:"error",
data:a.toString()};this.flush();this.post(a)},input:function(a){this.input.write=a;this.flush();this.post({type:"input"})},result:function(a){a={type:"result",data:a};this.flush();this.post(a)},ready:function(){this.post({type:"ready"})},getNextLineIndent:function(a){this.post({type:"indent",data:this.engine.GetNextLineIndent(a)})},progress:function(a){this.post({type:"progress",data:a})},dbInput:function(){this.flush();this.post({type:"db_input"})},serverInput:function(){this.flush();this.post({type:"server_input"})},
bindAll:function(a){for(var b in a)(function(b){var c=a[b];typeof c=="function"&&(a[b]=function(){var b=[].slice.call(arguments);return c.apply(a,b)})})(b)},hide:function(a){try{Object.defineProperty(c,a,{writable:false,enumerable:false,configurable:false,value:c[a]})}catch(b){}},set_input_server:function(a){this.input_server={url:(a.url||"/emscripten/input/")+a.input_id,cors:a.cors||false}}};a.bindAll(a);c.Sandboss=a;a.hide("Sandboss");if(self.openDatabaseSync){var f=self.openDatabaseSync("replit_input",
"1.0","Emscripted input",1024);self.prompt=function(){a.dbInput();var b=null;f.transaction(function(a){b=a});for(var c;!(c=b.executeSql("SELECT * FROM input").rows).length;)for(c=0;c<1E8;c++);b.executeSql("DELETE FROM input");return c.item(0).text};a.hide("prompt")}else if(!a.isFrame)self.prompt=function(){a.serverInput();var b;b=a.input_server.url;var c=new XMLHttpRequest;if(a.input_server.cors)if("withCredentials"in c)c.open("GET",b,false);else if(typeof XDomainRequest!="undefined")c=new XDomainRequest,
c.open("GET",b);else throw Error("Your browser doesn' support CORS");else c.open("GET",b,false);b=c;b.send(null);return b.status===200?b.responseText:"ERROR: ON NON-WEBKIT BROWSERS CONNECTION TO THE SERVER IS NEEDED FOR INPUT"}})(this);
(function(){var c=function(b){b==void 0&&(b=Date.now());this.N=624;this.M=397;this.MATRIX_A=2567483615;this.UPPER_MASK=2147483648;this.LOWER_MASK=2147483647;this.mt=Array(this.N);this.mti=this.N+1;this.init_genrand(b)};c.prototype.init_genrand=function(b){this.mt[0]=b>>>0;for(this.mti=1;this.mti<this.N;this.mti++)b=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(((b&4294901760)>>>16)*1812433253<<16)+(b&65535)*1812433253+this.mti,this.mt[this.mti]>>>=0};c.prototype.init_by_array=function(b,
c){var a,f,d;this.init_genrand(19650218);a=1;f=0;for(d=this.N>c?this.N:c;d;d--){var h=this.mt[a-1]^this.mt[a-1]>>>30;this.mt[a]=(this.mt[a]^(((h&4294901760)>>>16)*1664525<<16)+(h&65535)*1664525)+b[f]+f;this.mt[a]>>>=0;a++;f++;a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1);f>=c&&(f=0)}for(d=this.N-1;d;d--)h=this.mt[a-1]^this.mt[a-1]>>>30,this.mt[a]=(this.mt[a]^(((h&4294901760)>>>16)*1566083941<<16)+(h&65535)*1566083941)-a,this.mt[a]>>>=0,a++,a>=this.N&&(this.mt[0]=this.mt[this.N-1],a=1);this.mt[0]=
2147483648};c.prototype.genrand_int32=function(){var b,c=[0,this.MATRIX_A];if(this.mti>=this.N){var a;this.mti==this.N+1&&this.init_genrand(5489);for(a=0;a<this.N-this.M;a++)b=this.mt[a]&this.UPPER_MASK|this.mt[a+1]&this.LOWER_MASK,this.mt[a]=this.mt[a+this.M]^b>>>1^c[b&1];for(;a<this.N-1;a++)b=this.mt[a]&this.UPPER_MASK|this.mt[a+1]&this.LOWER_MASK,this.mt[a]=this.mt[a+(this.M-this.N)]^b>>>1^c[b&1];b=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK;this.mt[this.N-1]=this.mt[this.M-1]^
b>>>1^c[b&1];this.mti=0}b=this.mt[this.mti++];b^=b>>>11;b^=b<<7&2636928640;b^=b<<15&4022730752;b^=b>>>18;return b>>>0};c.prototype.genrand_int31=function(){return this.genrand_int32()>>>1};c.prototype.genrand_real1=function(){return this.genrand_int32()*(1/4294967295)};c.prototype.random=function(){return this.genrand_int32()*(1/4294967296)};c.prototype.genrand_real3=function(){return(this.genrand_int32()+0.5)*(1/4294967296)};c.prototype.genrand_res53=function(){var b=this.genrand_int32()>>>5,c=this.genrand_int32()>>>
6;return(b*67108864+c)*1.1102230246251565E-16};(function(){Math._random=Math.random;var b=new c(42);Math.random=function(){return b.random()};Math.seed=function(e){b=new c(e)}})()})();if(!Date.now)Date.now=function(){return+new Date};if(!Object.keys)Object.keys=function(c){if(c!==Object(c))throw new TypeError("Object.keys called on non-object");var b=[],e;for(e in c)Object.prototype.hasOwnProperty.call(c,e)&&b.push(e);return b};if(!Object.getOwnPropertyNames)Object.getOwnPropertyNames=Object.keys;
if(!Object.create)Object.create=function(c){function b(){}b.prototype=c;return new b};if(!Array.isArray)Array.isArray=function(c){return{}.toString.call(c)=="[object Array]"};
if(!Function.prototype.bind)Function.prototype.bind=function(c){if(typeof this!=="function")throw new TypeError("Function.prototype.bind - what is trying to be fBound is not callable");var b=Array.prototype.slice.call(arguments,1),e=this,a=function(){},f=function(){try{return e.apply(this instanceof a?this:c||window,b.concat(Array.prototype.slice.call(arguments)))}catch(d){return e.apply(c||window,b.concat(Array.prototype.slice.call(arguments)))}};a.prototype=this.prototype;f.prototype=new a;return f};
if(!Object.freeze)Object.freeze=function(c){return c.___frozen___=true};if(!Object.isFrozen)Object.isFrozen=function(c){return Boolean(c.___frozen___)};