
'use strict';require('earlgrey-runtime/6');let $targ$5;let accum$0;let $targ$6;let accum$1;let $targ$7;let events$0;let EventEmitter$0;let StreamSource$0;events$0=require("events");EventEmitter$0=getProperty(events$0,"EventEmitter","events");StreamSource$0=(function StreamSource(temp$0$0,temp$1$0){let tmp$0;let $targ$0;let $targ$1;let __at___$0;if((!getChecker(StreamSource$0)(this))){__at___$0=Object.create(StreamSource$0.prototype);}else{__at___$0=this;}(__at___$0["inStream"]=temp$0$0);(__at___$0["outStream"]=temp$1$0);$targ$0=(new EventEmitter$0());(__at___$0["ee"]=$targ$0);$targ$1="";(__at___$0["currentChunk"]=$targ$1);tmp$0=send(send(__at___$0,"inStream", true),"setEncoding", true);if(((tmp$0===undefined)||(tmp$0===null))){tmp$0;}else{tmp$0("utf8");}return __at___$0;});(StreamSource$0.prototype["read"]=(function read(temp$2$0){let __at___$1;let self$0;__at___$1=this;self$0=this;(__at___$1["inCallback"]=temp$2$0);return __at___$1.inStream.on("data",(function(data$0,origin$0){let t0$0;let t1$0;let m$0;let acc$0;let temp$3;let $targ$3;let $targ$4;let $targ$2;let last$0;let lines$0;if(data$0){$targ$2=data$0.split(RegExp("\\n",""));t0$0=$targ$2;if((Array.isArray(t0$0)&&((t1$0=t0$0.length),(t1$0>=1)))){lines$0=Array.prototype.slice.call(t0$0,0,-1);last$0=t0$0[(t1$0-1)];}else{___match_error($targ$2,"{*lines, last}");}[last$0,lines$0];if((lines$0.length>0)){$targ$3=(__at___$1.currentChunk+lines$0[0]);(lines$0[0]=$targ$3);$targ$4="";(__at___$1["currentChunk"]=$targ$4);acc$0=[];temp$3=null;m$0=null;$0:for(m$0 of lines$0){let line$0;line$0=m$0;temp$3=__at___$1.processLine(line$0,origin$0);acc$0.push(temp$3);}acc$0;}return (__at___$1["currentChunk"]=(__at___$1.currentChunk+last$0));}}));}));(StreamSource$0.prototype["processLine"]=(function(line$1,origin$1){let rval$0;let result$0;let __at___$2;let self$1;__at___$2=this;self$1=this;rval$0=false;try{if((!line$1.startsWith("{"))){throw SyntaxError();}rval$0=JSON.parse(line$1);rval$0;}catch(excv$0){let e$1;let e$0;let t0$1;t0$1=excv$0;if(getChecker(SyntaxError)(t0$1)){e$0=t0$1;rval$0=({"command":"log","parent":("/"+origin$1),"format":"stdout","content":(line$1+"\n")});rval$0;}else{e$1=excv$0;throw e$1;rval$0;}}result$0=rval$0;return __at___$2.inCallback(result$0);}));(StreamSource$0.prototype["send"]=(function send(message$0){let __at___$3;let self$2;__at___$3=this;self$2=this;return __at___$3.outStream.write(JSON.stringify(message$0));}));__amp____colon__(StreamSource$0,__amp____colon__((($targ$5="StreamSource"),(accum$0=({})),(accum$0["::name"]=$targ$5),accum$0),(($targ$6=true),(accum$1=({})),(accum$1["::egclass"]=$targ$6),accum$1)));$targ$7=StreamSource$0;(exports["StreamSource"]=$targ$7);(void 0);
//# sourceMappingURL=source.js.map

