made with requirebin
Created
June 23, 2014 20:43
-
-
Save netsensei/13b0b839d20bfd478204 to your computer and use it in GitHub Desktop.
requirebin sketch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var term = require('hypernal')() | |
var tablify = require('tablify').tablify | |
var request = require('browser-request') | |
var url = require('url') | |
var moment = require('moment') | |
term.appendTo(document.body) | |
// style fake terminal | |
var termEl = term.term.element | |
termEl.style['font'] = '13px Monaco, mono' | |
termEl.style.height = '100%' | |
termEl.style.padding = '5px' | |
termEl.style.overflow = 'auto' | |
termEl.style['white-space'] = 'pre' | |
var now = moment().format('YYYY/MM/DD/HH/mm') | |
var query = 'https://data.irail.be/Airports/Liveboard/BRU/' + now + '.json' | |
request({json: true, url: query}, function(err, resp, data) { | |
var docs = data.Liveboard.departures.map(function(doc) { | |
var departures = [] | |
doc.departure = moment(doc.iso8601, moment.ISO_8601).format('HH:mm') | |
doc.delay = delayFilter(doc.delay) | |
doc.city = doc.airport.city | |
doc.flight = doc.vehicle | |
return doc | |
}) | |
term.write(tablify(docs, {keys: ['departure', 'delay', 'city', 'flight']})) | |
}) | |
function delayFilter(time) { | |
var hours = parseInt( time / 3600, 10) % 24; | |
var minutes = parseInt( time / 60, 10) % 60; | |
return (hours < 10 ? "0" + hours : hours) + "h" + (minutes < 10 ? "0" + minutes : minutes); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){function EventEmitter(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}module.exports=EventEmitter;EventEmitter.EventEmitter=EventEmitter;EventEmitter.prototype._events=undefined;EventEmitter.prototype._maxListeners=undefined;EventEmitter.defaultMaxListeners=10;EventEmitter.prototype.setMaxListeners=function(n){if(!isNumber(n)||n<0||isNaN(n))throw TypeError("n must be a positive number");this._maxListeners=n;return this};EventEmitter.prototype.emit=function(type){var er,handler,len,args,i,listeners;if(!this._events)this._events={};if(type==="error"){if(!this._events.error||isObject(this._events.error)&&!this._events.error.length){er=arguments[1];if(er instanceof Error){throw er}else{throw TypeError('Uncaught, unspecified "error" event.')}return false}}handler=this._events[type];if(isUndefined(handler))return false;if(isFunction(handler)){switch(arguments.length){case 1:handler.call(this);break;case 2:handler.call(this,arguments[1]);break;case 3:handler.call(this,arguments[1],arguments[2]);break;default:len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];handler.apply(this,args)}}else if(isObject(handler)){len=arguments.length;args=new Array(len-1);for(i=1;i<len;i++)args[i-1]=arguments[i];listeners=handler.slice();len=listeners.length;for(i=0;i<len;i++)listeners[i].apply(this,args)}return true};EventEmitter.prototype.addListener=function(type,listener){var m;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events)this._events={};if(this._events.newListener)this.emit("newListener",type,isFunction(listener.listener)?listener.listener:listener);if(!this._events[type])this._events[type]=listener;else if(isObject(this._events[type]))this._events[type].push(listener);else this._events[type]=[this._events[type],listener];if(isObject(this._events[type])&&!this._events[type].warned){var m;if(!isUndefined(this._maxListeners)){m=this._maxListeners}else{m=EventEmitter.defaultMaxListeners}if(m&&m>0&&this._events[type].length>m){this._events[type].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[type].length);console.trace()}}return this};EventEmitter.prototype.on=EventEmitter.prototype.addListener;EventEmitter.prototype.once=function(type,listener){if(!isFunction(listener))throw TypeError("listener must be a function");var fired=false;function g(){this.removeListener(type,g);if(!fired){fired=true;listener.apply(this,arguments)}}g.listener=listener;this.on(type,g);return this};EventEmitter.prototype.removeListener=function(type,listener){var list,position,length,i;if(!isFunction(listener))throw TypeError("listener must be a function");if(!this._events||!this._events[type])return this;list=this._events[type];length=list.length;position=-1;if(list===listener||isFunction(list.listener)&&list.listener===listener){delete this._events[type];if(this._events.removeListener)this.emit("removeListener",type,listener)}else if(isObject(list)){for(i=length;i-->0;){if(list[i]===listener||list[i].listener&&list[i].listener===listener){position=i;break}}if(position<0)return this;if(list.length===1){list.length=0;delete this._events[type]}else{list.splice(position,1)}if(this._events.removeListener)this.emit("removeListener",type,listener)}return this};EventEmitter.prototype.removeAllListeners=function(type){var key,listeners;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[type])delete this._events[type];return this}if(arguments.length===0){for(key in this._events){if(key==="removeListener")continue;this.removeAllListeners(key)}this.removeAllListeners("removeListener");this._events={};return this}listeners=this._events[type];if(isFunction(listeners)){this.removeListener(type,listeners)}else{while(listeners.length)this.removeListener(type,listeners[listeners.length-1])}delete this._events[type];return this};EventEmitter.prototype.listeners=function(type){var ret;if(!this._events||!this._events[type])ret=[];else if(isFunction(this._events[type]))ret=[this._events[type]];else ret=this._events[type].slice();return ret};EventEmitter.listenerCount=function(emitter,type){var ret;if(!emitter._events||!emitter._events[type])ret=0;else if(isFunction(emitter._events[type]))ret=1;else ret=emitter._events[type].length;return ret};function isFunction(arg){return typeof arg==="function"}function isNumber(arg){return typeof arg==="number"}function isObject(arg){return typeof arg==="object"&&arg!==null}function isUndefined(arg){return arg===void 0}},{}],2:[function(require,module,exports){if(typeof Object.create==="function"){module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;ctor.prototype=Object.create(superCtor.prototype,{constructor:{value:ctor,enumerable:false,writable:true,configurable:true}})}}else{module.exports=function inherits(ctor,superCtor){ctor.super_=superCtor;var TempCtor=function(){};TempCtor.prototype=superCtor.prototype;ctor.prototype=new TempCtor;ctor.prototype.constructor=ctor}}},{}],3:[function(require,module,exports){var process=module.exports={};process.nextTick=function(){var canSetImmediate=typeof window!=="undefined"&&window.setImmediate;var canPost=typeof window!=="undefined"&&window.postMessage&&window.addEventListener;if(canSetImmediate){return function(f){return window.setImmediate(f)}}if(canPost){var queue=[];window.addEventListener("message",function(ev){var source=ev.source;if((source===window||source===null)&&ev.data==="process-tick"){ev.stopPropagation();if(queue.length>0){var fn=queue.shift();fn()}}},true);return function nextTick(fn){queue.push(fn);window.postMessage("process-tick","*")}}return function nextTick(fn){setTimeout(fn,0)}}();process.title="browser";process.browser=true;process.env={};process.argv=[];process.binding=function(name){throw new Error("process.binding is not supported")};process.cwd=function(){return"/"};process.chdir=function(dir){throw new Error("process.chdir is not supported")}},{}],4:[function(require,module,exports){var base64=require("base64-js");var ieee754=require("ieee754");exports.Buffer=Buffer;exports.SlowBuffer=Buffer;exports.INSPECT_MAX_BYTES=50;Buffer.poolSize=8192;Buffer._useTypedArrays=function(){if(typeof Uint8Array==="undefined"||typeof ArrayBuffer==="undefined")return false;try{var arr=new Uint8Array(0);arr.foo=function(){return 42};return 42===arr.foo()&&typeof arr.subarray==="function"}catch(e){return false}}();function Buffer(subject,encoding,noZero){if(!(this instanceof Buffer))return new Buffer(subject,encoding,noZero);var type=typeof subject;if(encoding==="base64"&&type==="string"){subject=stringtrim(subject);while(subject.length%4!==0){subject=subject+"="}}var length;if(type==="number")length=coerce(subject);else if(type==="string")length=Buffer.byteLength(subject,encoding);else if(type==="object")length=coerce(subject.length);else throw new Error("First argument needs to be a number, array or string.");var buf;if(Buffer._useTypedArrays){buf=augment(new Uint8Array(length))}else{buf=this;buf.length=length;buf._isBuffer=true}var i;if(Buffer._useTypedArrays&&typeof Uint8Array==="function"&&subject instanceof Uint8Array){buf._set(subject)}else if(isArrayish(subject)){for(i=0;i<length;i++){if(Buffer.isBuffer(subject))buf[i]=subject.readUInt8(i);else buf[i]=subject[i]}}else if(type==="string"){buf.write(subject,0,encoding)}else if(type==="number"&&!Buffer._useTypedArrays&&!noZero){for(i=0;i<length;i++){buf[i]=0}}return buf}Buffer.isEncoding=function(encoding){switch(String(encoding).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return true;default:return false}};Buffer.isBuffer=function(b){return!!(b!==null&&b!==undefined&&b._isBuffer)};Buffer.byteLength=function(str,encoding){var ret;str=str+"";switch(encoding||"utf8"){case"hex":ret=str.length/2;break;case"utf8":case"utf-8":ret=utf8ToBytes(str).length;break;case"ascii":case"binary":case"raw":ret=str.length;break;case"base64":ret=base64ToBytes(str).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":ret=str.length*2;break;default:throw new Error("Unknown encoding")}return ret};Buffer.concat=function(list,totalLength){assert(isArray(list),"Usage: Buffer.concat(list, [totalLength])\n"+"list should be an Array.");if(list.length===0){return new Buffer(0)}else if(list.length===1){return list[0]}var i;if(typeof totalLength!=="number"){totalLength=0;for(i=0;i<list.length;i++){totalLength+=list[i].length}}var buf=new Buffer(totalLength);var pos=0;for(i=0;i<list.length;i++){var item=list[i];item.copy(buf,pos);pos+=item.length}return buf};function _hexWrite(buf,string,offset,length){offset=Number(offset)||0;var remaining=buf.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}var strLen=string.length;assert(strLen%2===0,"Invalid hex string");if(length>strLen/2){length=strLen/2}for(var i=0;i<length;i++){var byte=parseInt(string.substr(i*2,2),16);assert(!isNaN(byte),"Invalid hex string");buf[offset+i]=byte}Buffer._charsWritten=i*2;return i}function _utf8Write(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(utf8ToBytes(string),buf,offset,length);return charsWritten}function _asciiWrite(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(asciiToBytes(string),buf,offset,length);return charsWritten}function _binaryWrite(buf,string,offset,length){return _asciiWrite(buf,string,offset,length)}function _base64Write(buf,string,offset,length){var charsWritten=Buffer._charsWritten=blitBuffer(base64ToBytes(string),buf,offset,length);return charsWritten}Buffer.prototype.write=function(string,offset,length,encoding){if(isFinite(offset)){if(!isFinite(length)){encoding=length;length=undefined}}else{var swap=encoding;encoding=offset;offset=length;length=swap}offset=Number(offset)||0;var remaining=this.length-offset;if(!length){length=remaining}else{length=Number(length);if(length>remaining){length=remaining}}encoding=String(encoding||"utf8").toLowerCase();switch(encoding){case"hex":return _hexWrite(this,string,offset,length);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _utf8Write(this,string,offset,length);case"ascii":return _asciiWrite(this,string,offset,length);case"binary":return _binaryWrite(this,string,offset,length);case"base64":return _base64Write(this,string,offset,length);default:throw new Error("Unknown encoding")}};Buffer.prototype.toString=function(encoding,start,end){var self=this;encoding=String(encoding||"utf8").toLowerCase();start=Number(start)||0;end=end!==undefined?Number(end):end=self.length;if(end===start)return"";switch(encoding){case"hex":return _hexSlice(self,start,end);case"utf8":case"utf-8":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _utf8Slice(self,start,end);case"ascii":return _asciiSlice(self,start,end);case"binary":return _binarySlice(self,start,end);case"base64":return _base64Slice(self,start,end);default:throw new Error("Unknown encoding")}};Buffer.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};Buffer.prototype.copy=function(target,target_start,start,end){var source=this;if(!start)start=0;if(!end&&end!==0)end=this.length;if(!target_start)target_start=0;if(end===start)return;if(target.length===0||source.length===0)return;assert(end>=start,"sourceEnd < sourceStart");assert(target_start>=0&&target_start<target.length,"targetStart out of bounds");assert(start>=0&&start<source.length,"sourceStart out of bounds");assert(end>=0&&end<=source.length,"sourceEnd out of bounds");if(end>this.length)end=this.length;if(target.length-target_start<end-start)end=target.length-target_start+start;for(var i=0;i<end-start;i++)target[i+target_start]=this[i+start]};function _base64Slice(buf,start,end){if(start===0&&end===buf.length){return base64.fromByteArray(buf)}else{return base64.fromByteArray(buf.slice(start,end))}}function _utf8Slice(buf,start,end){var res="";var tmp="";end=Math.min(buf.length,end);for(var i=start;i<end;i++){if(buf[i]<=127){res+=decodeUtf8Char(tmp)+String.fromCharCode(buf[i]);tmp=""}else{tmp+="%"+buf[i].toString(16)}}return res+decodeUtf8Char(tmp)}function _asciiSlice(buf,start,end){var ret="";end=Math.min(buf.length,end);for(var i=start;i<end;i++)ret+=String.fromCharCode(buf[i]);return ret}function _binarySlice(buf,start,end){return _asciiSlice(buf,start,end)}function _hexSlice(buf,start,end){var len=buf.length;if(!start||start<0)start=0;if(!end||end<0||end>len)end=len;var out="";for(var i=start;i<end;i++){out+=toHex(buf[i])}return out}Buffer.prototype.slice=function(start,end){var len=this.length;start=clamp(start,len,0);end=clamp(end,len,len);if(Buffer._useTypedArrays){return augment(this.subarray(start,end))}else{var sliceLen=end-start;var newBuf=new Buffer(sliceLen,undefined,true);for(var i=0;i<sliceLen;i++){newBuf[i]=this[i+start]}return newBuf}};Buffer.prototype.get=function(offset){console.log(".get() is deprecated. Access using array indexes instead.");return this.readUInt8(offset)};Buffer.prototype.set=function(v,offset){console.log(".set() is deprecated. Access using array indexes instead.");return this.writeUInt8(v,offset)};Buffer.prototype.readUInt8=function(offset,noAssert){if(!noAssert){assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to read beyond buffer length")}if(offset>=this.length)return;return this[offset]};function _readUInt16(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val;if(littleEndian){val=buf[offset];if(offset+1<len)val|=buf[offset+1]<<8}else{val=buf[offset]<<8;if(offset+1<len)val|=buf[offset+1]}return val}Buffer.prototype.readUInt16LE=function(offset,noAssert){return _readUInt16(this,offset,true,noAssert)};Buffer.prototype.readUInt16BE=function(offset,noAssert){return _readUInt16(this,offset,false,noAssert)};function _readUInt32(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val;if(littleEndian){if(offset+2<len)val=buf[offset+2]<<16;if(offset+1<len)val|=buf[offset+1]<<8;val|=buf[offset];if(offset+3<len)val=val+(buf[offset+3]<<24>>>0)}else{if(offset+1<len)val=buf[offset+1]<<16;if(offset+2<len)val|=buf[offset+2]<<8;if(offset+3<len)val|=buf[offset+3];val=val+(buf[offset]<<24>>>0)}return val}Buffer.prototype.readUInt32LE=function(offset,noAssert){return _readUInt32(this,offset,true,noAssert)};Buffer.prototype.readUInt32BE=function(offset,noAssert){return _readUInt32(this,offset,false,noAssert)};Buffer.prototype.readInt8=function(offset,noAssert){if(!noAssert){assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to read beyond buffer length")}if(offset>=this.length)return;var neg=this[offset]&128;if(neg)return(255-this[offset]+1)*-1;else return this[offset]};function _readInt16(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val=_readUInt16(buf,offset,littleEndian,true);var neg=val&32768;if(neg)return(65535-val+1)*-1;else return val}Buffer.prototype.readInt16LE=function(offset,noAssert){return _readInt16(this,offset,true,noAssert)};Buffer.prototype.readInt16BE=function(offset,noAssert){return _readInt16(this,offset,false,noAssert)};function _readInt32(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to read beyond buffer length")}var len=buf.length;if(offset>=len)return;var val=_readUInt32(buf,offset,littleEndian,true);var neg=val&2147483648;if(neg)return(4294967295-val+1)*-1;else return val}Buffer.prototype.readInt32LE=function(offset,noAssert){return _readInt32(this,offset,true,noAssert)};Buffer.prototype.readInt32BE=function(offset,noAssert){return _readInt32(this,offset,false,noAssert)};function _readFloat(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset+3<buf.length,"Trying to read beyond buffer length")}return ieee754.read(buf,offset,littleEndian,23,4)}Buffer.prototype.readFloatLE=function(offset,noAssert){return _readFloat(this,offset,true,noAssert)};Buffer.prototype.readFloatBE=function(offset,noAssert){return _readFloat(this,offset,false,noAssert)};function _readDouble(buf,offset,littleEndian,noAssert){if(!noAssert){assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset+7<buf.length,"Trying to read beyond buffer length")}return ieee754.read(buf,offset,littleEndian,52,8)}Buffer.prototype.readDoubleLE=function(offset,noAssert){return _readDouble(this,offset,true,noAssert)};Buffer.prototype.readDoubleBE=function(offset,noAssert){return _readDouble(this,offset,false,noAssert)};Buffer.prototype.writeUInt8=function(value,offset,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"trying to write beyond buffer length");verifuint(value,255)}if(offset>=this.length)return;this[offset]=value};function _writeUInt16(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"trying to write beyond buffer length");verifuint(value,65535)}var len=buf.length;if(offset>=len)return;for(var i=0,j=Math.min(len-offset,2);i<j;i++){buf[offset+i]=(value&255<<8*(littleEndian?i:1-i))>>>(littleEndian?i:1-i)*8}}Buffer.prototype.writeUInt16LE=function(value,offset,noAssert){_writeUInt16(this,value,offset,true,noAssert)};Buffer.prototype.writeUInt16BE=function(value,offset,noAssert){_writeUInt16(this,value,offset,false,noAssert)};function _writeUInt32(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"trying to write beyond buffer length");verifuint(value,4294967295)}var len=buf.length;if(offset>=len)return;for(var i=0,j=Math.min(len-offset,4);i<j;i++){buf[offset+i]=value>>>(littleEndian?i:3-i)*8&255}}Buffer.prototype.writeUInt32LE=function(value,offset,noAssert){_writeUInt32(this,value,offset,true,noAssert)};Buffer.prototype.writeUInt32BE=function(value,offset,noAssert){_writeUInt32(this,value,offset,false,noAssert)};Buffer.prototype.writeInt8=function(value,offset,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset<this.length,"Trying to write beyond buffer length");verifsint(value,127,-128)}if(offset>=this.length)return;if(value>=0)this.writeUInt8(value,offset,noAssert);else this.writeUInt8(255+value+1,offset,noAssert)};function _writeInt16(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+1<buf.length,"Trying to write beyond buffer length");verifsint(value,32767,-32768)}var len=buf.length;if(offset>=len)return;if(value>=0)_writeUInt16(buf,value,offset,littleEndian,noAssert);else _writeUInt16(buf,65535+value+1,offset,littleEndian,noAssert)}Buffer.prototype.writeInt16LE=function(value,offset,noAssert){_writeInt16(this,value,offset,true,noAssert)};Buffer.prototype.writeInt16BE=function(value,offset,noAssert){_writeInt16(this,value,offset,false,noAssert)};function _writeInt32(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to write beyond buffer length");verifsint(value,2147483647,-2147483648)}var len=buf.length;if(offset>=len)return;if(value>=0)_writeUInt32(buf,value,offset,littleEndian,noAssert);else _writeUInt32(buf,4294967295+value+1,offset,littleEndian,noAssert)}Buffer.prototype.writeInt32LE=function(value,offset,noAssert){_writeInt32(this,value,offset,true,noAssert)};Buffer.prototype.writeInt32BE=function(value,offset,noAssert){_writeInt32(this,value,offset,false,noAssert)};function _writeFloat(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+3<buf.length,"Trying to write beyond buffer length");verifIEEE754(value,3.4028234663852886e38,-3.4028234663852886e38)}var len=buf.length;if(offset>=len)return;ieee754.write(buf,value,offset,littleEndian,23,4)}Buffer.prototype.writeFloatLE=function(value,offset,noAssert){_writeFloat(this,value,offset,true,noAssert)};Buffer.prototype.writeFloatBE=function(value,offset,noAssert){_writeFloat(this,value,offset,false,noAssert)};function _writeDouble(buf,value,offset,littleEndian,noAssert){if(!noAssert){assert(value!==undefined&&value!==null,"missing value");assert(typeof littleEndian==="boolean","missing or invalid endian");assert(offset!==undefined&&offset!==null,"missing offset");assert(offset+7<buf.length,"Trying to write beyond buffer length");verifIEEE754(value,1.7976931348623157e308,-1.7976931348623157e308)}var len=buf.length;if(offset>=len)return;ieee754.write(buf,value,offset,littleEndian,52,8)}Buffer.prototype.writeDoubleLE=function(value,offset,noAssert){_writeDouble(this,value,offset,true,noAssert)};Buffer.prototype.writeDoubleBE=function(value,offset,noAssert){_writeDouble(this,value,offset,false,noAssert)};Buffer.prototype.fill=function(value,start,end){if(!value)value=0;if(!start)start=0;if(!end)end=this.length;if(typeof value==="string"){value=value.charCodeAt(0)}assert(typeof value==="number"&&!isNaN(value),"value is not a number");assert(end>=start,"end < start");if(end===start)return;if(this.length===0)return;assert(start>=0&&start<this.length,"start out of bounds");assert(end>=0&&end<=this.length,"end out of bounds");for(var i=start;i<end;i++){this[i]=value}};Buffer.prototype.inspect=function(){var out=[];var len=this.length;for(var i=0;i<len;i++){out[i]=toHex(this[i]);if(i===exports.INSPECT_MAX_BYTES){out[i+1]="...";break}}return"<Buffer "+out.join(" ")+">"};Buffer.prototype.toArrayBuffer=function(){if(typeof Uint8Array==="function"){if(Buffer._useTypedArrays){return new Buffer(this).buffer}else{var buf=new Uint8Array(this.length);for(var i=0,len=buf.length;i<len;i+=1)buf[i]=this[i];return buf.buffer}}else{throw new Error("Buffer.toArrayBuffer not supported in this browser")}};function stringtrim(str){if(str.trim)return str.trim();return str.replace(/^\s+|\s+$/g,"")}var BP=Buffer.prototype;function augment(arr){arr._isBuffer=true;arr._get=arr.get;arr._set=arr.set;arr.get=BP.get;arr.set=BP.set;arr.write=BP.write;arr.toString=BP.toString;arr.toLocaleString=BP.toString;arr.toJSON=BP.toJSON;arr.copy=BP.copy;arr.slice=BP.slice;arr.readUInt8=BP.readUInt8;arr.readUInt16LE=BP.readUInt16LE;arr.readUInt16BE=BP.readUInt16BE;arr.readUInt32LE=BP.readUInt32LE;arr.readUInt32BE=BP.readUInt32BE;arr.readInt8=BP.readInt8;arr.readInt16LE=BP.readInt16LE;arr.readInt16BE=BP.readInt16BE;arr.readInt32LE=BP.readInt32LE;arr.readInt32BE=BP.readInt32BE;arr.readFloatLE=BP.readFloatLE;arr.readFloatBE=BP.readFloatBE;arr.readDoubleLE=BP.readDoubleLE;arr.readDoubleBE=BP.readDoubleBE;arr.writeUInt8=BP.writeUInt8;arr.writeUInt16LE=BP.writeUInt16LE;arr.writeUInt16BE=BP.writeUInt16BE;arr.writeUInt32LE=BP.writeUInt32LE;arr.writeUInt32BE=BP.writeUInt32BE;arr.writeInt8=BP.writeInt8;arr.writeInt16LE=BP.writeInt16LE;arr.writeInt16BE=BP.writeInt16BE;arr.writeInt32LE=BP.writeInt32LE;arr.writeInt32BE=BP.writeInt32BE;arr.writeFloatLE=BP.writeFloatLE;arr.writeFloatBE=BP.writeFloatBE;arr.writeDoubleLE=BP.writeDoubleLE;arr.writeDoubleBE=BP.writeDoubleBE;arr.fill=BP.fill;arr.inspect=BP.inspect;arr.toArrayBuffer=BP.toArrayBuffer;return arr}function clamp(index,len,defaultValue){if(typeof index!=="number")return defaultValue;index=~~index;if(index>=len)return len;if(index>=0)return index;index+=len;if(index>=0)return index;return 0}function coerce(length){length=~~Math.ceil(+length);return length<0?0:length}function isArray(subject){return(Array.isArray||function(subject){return Object.prototype.toString.call(subject)==="[object Array]"})(subject)}function isArrayish(subject){return isArray(subject)||Buffer.isBuffer(subject)||subject&&typeof subject==="object"&&typeof subject.length==="number"}function toHex(n){if(n<16)return"0"+n.toString(16);return n.toString(16)}function utf8ToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){var b=str.charCodeAt(i);if(b<=127)byteArray.push(str.charCodeAt(i));else{var start=i;if(b>=55296&&b<=57343)i++;var h=encodeURIComponent(str.slice(start,i+1)).substr(1).split("%");for(var j=0;j<h.length;j++)byteArray.push(parseInt(h[j],16))}}return byteArray}function asciiToBytes(str){var byteArray=[];for(var i=0;i<str.length;i++){byteArray.push(str.charCodeAt(i)&255)}return byteArray}function base64ToBytes(str){return base64.toByteArray(str)}function blitBuffer(src,dst,offset,length){var pos;for(var i=0;i<length;i++){if(i+offset>=dst.length||i>=src.length)break;dst[i+offset]=src[i]}return i}function decodeUtf8Char(str){try{return decodeURIComponent(str)}catch(err){return String.fromCharCode(65533)}}function verifuint(value,max){assert(typeof value=="number","cannot write a non-number as a number");assert(value>=0,"specified a negative value for writing an unsigned value");assert(value<=max,"value is larger than maximum value for type");assert(Math.floor(value)===value,"value has a fractional component")}function verifsint(value,max,min){assert(typeof value=="number","cannot write a non-number as a number");assert(value<=max,"value larger than maximum allowed value");assert(value>=min,"value smaller than minimum allowed value");assert(Math.floor(value)===value,"value has a fractional component")}function verifIEEE754(value,max,min){assert(typeof value=="number","cannot write a non-number as a number");assert(value<=max,"value larger than maximum allowed value");assert(value>=min,"value smaller than minimum allowed value")}function assert(test,message){if(!test)throw new Error(message||"Failed assertion")}},{"base64-js":5,ieee754:6}],5:[function(require,module,exports){var lookup="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(exports){"use strict";var Arr=typeof Uint8Array!=="undefined"?Uint8Array:Array;var ZERO="0".charCodeAt(0);var PLUS="+".charCodeAt(0);var SLASH="/".charCodeAt(0);var NUMBER="0".charCodeAt(0);var LOWER="a".charCodeAt(0);var UPPER="A".charCodeAt(0);function decode(elt){var code=elt.charCodeAt(0);if(code===PLUS)return 62;if(code===SLASH)return 63;if(code<NUMBER)return-1;if(code<NUMBER+10)return code-NUMBER+26+26;if(code<UPPER+26)return code-UPPER;if(code<LOWER+26)return code-LOWER+26}function b64ToByteArray(b64){var i,j,l,tmp,placeHolders,arr;if(b64.length%4>0){throw new Error("Invalid string. Length must be a multiple of 4")}var len=b64.length;placeHolders="="===b64.charAt(len-2)?2:"="===b64.charAt(len-1)?1:0;arr=new Arr(b64.length*3/4-placeHolders);l=placeHolders>0?b64.length-4:b64.length;var L=0;function push(v){arr[L++]=v}for(i=0,j=0;i<l;i+=4,j+=3){tmp=decode(b64.charAt(i))<<18|decode(b64.charAt(i+1))<<12|decode(b64.charAt(i+2))<<6|decode(b64.charAt(i+3));push((tmp&16711680)>>16);push((tmp&65280)>>8);push(tmp&255)}if(placeHolders===2){tmp=decode(b64.charAt(i))<<2|decode(b64.charAt(i+1))>>4;push(tmp&255)}else if(placeHolders===1){tmp=decode(b64.charAt(i))<<10|decode(b64.charAt(i+1))<<4|decode(b64.charAt(i+2))>>2;push(tmp>>8&255);push(tmp&255)}return arr}function uint8ToBase64(uint8){var i,extraBytes=uint8.length%3,output="",temp,length;function encode(num){return lookup.charAt(num)}function tripletToBase64(num){return encode(num>>18&63)+encode(num>>12&63)+encode(num>>6&63)+encode(num&63)}for(i=0,length=uint8.length-extraBytes;i<length;i+=3){temp=(uint8[i]<<16)+(uint8[i+1]<<8)+uint8[i+2];output+=tripletToBase64(temp)}switch(extraBytes){case 1:temp=uint8[uint8.length-1];output+=encode(temp>>2);output+=encode(temp<<4&63);output+="==";break;case 2:temp=(uint8[uint8.length-2]<<8)+uint8[uint8.length-1];output+=encode(temp>>10);output+=encode(temp>>4&63);output+=encode(temp<<2&63);output+="=";break}return output}module.exports.toByteArray=b64ToByteArray;module.exports.fromByteArray=uint8ToBase64})()},{}],6:[function(require,module,exports){exports.read=function(buffer,offset,isLE,mLen,nBytes){var e,m,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,nBits=-7,i=isLE?nBytes-1:0,d=isLE?-1:1,s=buffer[offset+i];i+=d;e=s&(1<<-nBits)-1;s>>=-nBits;nBits+=eLen;for(;nBits>0;e=e*256+buffer[offset+i],i+=d,nBits-=8);m=e&(1<<-nBits)-1;e>>=-nBits;nBits+=mLen;for(;nBits>0;m=m*256+buffer[offset+i],i+=d,nBits-=8);if(e===0){e=1-eBias}else if(e===eMax){return m?NaN:(s?-1:1)*Infinity}else{m=m+Math.pow(2,mLen);e=e-eBias}return(s?-1:1)*m*Math.pow(2,e-mLen)};exports.write=function(buffer,value,offset,isLE,mLen,nBytes){var e,m,c,eLen=nBytes*8-mLen-1,eMax=(1<<eLen)-1,eBias=eMax>>1,rt=mLen===23?Math.pow(2,-24)-Math.pow(2,-77):0,i=isLE?0:nBytes-1,d=isLE?1:-1,s=value<0||value===0&&1/value<0?1:0;value=Math.abs(value);if(isNaN(value)||value===Infinity){m=isNaN(value)?1:0;e=eMax}else{e=Math.floor(Math.log(value)/Math.LN2);if(value*(c=Math.pow(2,-e))<1){e--;c*=2}if(e+eBias>=1){value+=rt/c}else{value+=rt*Math.pow(2,1-eBias)}if(value*c>=2){e++;c/=2}if(e+eBias>=eMax){m=0;e=eMax}else if(e+eBias>=1){m=(value*c-1)*Math.pow(2,mLen);e=e+eBias}else{m=value*Math.pow(2,eBias-1)*Math.pow(2,mLen);e=0}}for(;mLen>=8;buffer[offset+i]=m&255,i+=d,m/=256,mLen-=8);e=e<<mLen|m;eLen+=mLen;for(;eLen>0;buffer[offset+i]=e&255,i+=d,e/=256,eLen-=8);buffer[offset+i-d]|=s*128}},{}],7:[function(require,module,exports){module.exports=Duplex;var inherits=require("inherits");var setImmediate=require("process/browser.js").nextTick;var Readable=require("./readable.js");var Writable=require("./writable.js");inherits(Duplex,Readable);Duplex.prototype.write=Writable.prototype.write;Duplex.prototype.end=Writable.prototype.end;Duplex.prototype._write=Writable.prototype._write;function Duplex(options){if(!(this instanceof Duplex))return new Duplex(options);Readable.call(this,options);Writable.call(this,options);if(options&&options.readable===false)this.readable=false;if(options&&options.writable===false)this.writable=false; | |
this.allowHalfOpen=true;if(options&&options.allowHalfOpen===false)this.allowHalfOpen=false;this.once("end",onend)}function onend(){if(this.allowHalfOpen||this._writableState.ended)return;var self=this;setImmediate(function(){self.end()})}},{"./readable.js":11,"./writable.js":13,inherits:2,"process/browser.js":9}],8:[function(require,module,exports){module.exports=Stream;var EE=require("events").EventEmitter;var inherits=require("inherits");inherits(Stream,EE);Stream.Readable=require("./readable.js");Stream.Writable=require("./writable.js");Stream.Duplex=require("./duplex.js");Stream.Transform=require("./transform.js");Stream.PassThrough=require("./passthrough.js");Stream.Stream=Stream;function Stream(){EE.call(this)}Stream.prototype.pipe=function(dest,options){var source=this;function ondata(chunk){if(dest.writable){if(false===dest.write(chunk)&&source.pause){source.pause()}}}source.on("data",ondata);function ondrain(){if(source.readable&&source.resume){source.resume()}}dest.on("drain",ondrain);if(!dest._isStdio&&(!options||options.end!==false)){source.on("end",onend);source.on("close",onclose)}var didOnEnd=false;function onend(){if(didOnEnd)return;didOnEnd=true;dest.end()}function onclose(){if(didOnEnd)return;didOnEnd=true;if(typeof dest.destroy==="function")dest.destroy()}function onerror(er){cleanup();if(EE.listenerCount(this,"error")===0){throw er}}source.on("error",onerror);dest.on("error",onerror);function cleanup(){source.removeListener("data",ondata);dest.removeListener("drain",ondrain);source.removeListener("end",onend);source.removeListener("close",onclose);source.removeListener("error",onerror);dest.removeListener("error",onerror);source.removeListener("end",cleanup);source.removeListener("close",cleanup);dest.removeListener("close",cleanup)}source.on("end",cleanup);source.on("close",cleanup);dest.on("close",cleanup);dest.emit("pipe",source);return dest}},{"./duplex.js":7,"./passthrough.js":10,"./readable.js":11,"./transform.js":12,"./writable.js":13,events:1,inherits:2}],9:[function(require,module,exports){module.exports=require(3)},{}],10:[function(require,module,exports){module.exports=PassThrough;var Transform=require("./transform.js");var inherits=require("inherits");inherits(PassThrough,Transform);function PassThrough(options){if(!(this instanceof PassThrough))return new PassThrough(options);Transform.call(this,options)}PassThrough.prototype._transform=function(chunk,encoding,cb){cb(null,chunk)}},{"./transform.js":12,inherits:2}],11:[function(require,module,exports){(function(process){module.exports=Readable;Readable.ReadableState=ReadableState;var EE=require("events").EventEmitter;var Stream=require("./index.js");var Buffer=require("buffer").Buffer;var setImmediate=require("process/browser.js").nextTick;var StringDecoder;var inherits=require("inherits");inherits(Readable,Stream);function ReadableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.highWaterMark=~~this.highWaterMark;this.buffer=[];this.length=0;this.pipes=null;this.pipesCount=0;this.flowing=false;this.ended=false;this.endEmitted=false;this.reading=false;this.calledRead=false;this.sync=true;this.needReadable=false;this.emittedReadable=false;this.readableListening=false;this.objectMode=!!options.objectMode;this.defaultEncoding=options.defaultEncoding||"utf8";this.ranOut=false;this.awaitDrain=0;this.readingMore=false;this.decoder=null;this.encoding=null;if(options.encoding){if(!StringDecoder)StringDecoder=require("string_decoder").StringDecoder;this.decoder=new StringDecoder(options.encoding);this.encoding=options.encoding}}function Readable(options){if(!(this instanceof Readable))return new Readable(options);this._readableState=new ReadableState(options,this);this.readable=true;Stream.call(this)}Readable.prototype.push=function(chunk,encoding){var state=this._readableState;if(typeof chunk==="string"&&!state.objectMode){encoding=encoding||state.defaultEncoding;if(encoding!==state.encoding){chunk=new Buffer(chunk,encoding);encoding=""}}return readableAddChunk(this,state,chunk,encoding,false)};Readable.prototype.unshift=function(chunk){var state=this._readableState;return readableAddChunk(this,state,chunk,"",true)};function readableAddChunk(stream,state,chunk,encoding,addToFront){var er=chunkInvalid(state,chunk);if(er){stream.emit("error",er)}else if(chunk===null||chunk===undefined){state.reading=false;if(!state.ended)onEofChunk(stream,state)}else if(state.objectMode||chunk&&chunk.length>0){if(state.ended&&!addToFront){var e=new Error("stream.push() after EOF");stream.emit("error",e)}else if(state.endEmitted&&addToFront){var e=new Error("stream.unshift() after end event");stream.emit("error",e)}else{if(state.decoder&&!addToFront&&!encoding)chunk=state.decoder.write(chunk);state.length+=state.objectMode?1:chunk.length;if(addToFront){state.buffer.unshift(chunk)}else{state.reading=false;state.buffer.push(chunk)}if(state.needReadable)emitReadable(stream);maybeReadMore(stream,state)}}else if(!addToFront){state.reading=false}return needMoreData(state)}function needMoreData(state){return!state.ended&&(state.needReadable||state.length<state.highWaterMark||state.length===0)}Readable.prototype.setEncoding=function(enc){if(!StringDecoder)StringDecoder=require("string_decoder").StringDecoder;this._readableState.decoder=new StringDecoder(enc);this._readableState.encoding=enc};var MAX_HWM=8388608;function roundUpToNextPowerOf2(n){if(n>=MAX_HWM){n=MAX_HWM}else{n--;for(var p=1;p<32;p<<=1)n|=n>>p;n++}return n}function howMuchToRead(n,state){if(state.length===0&&state.ended)return 0;if(state.objectMode)return n===0?0:1;if(isNaN(n)||n===null){if(state.flowing&&state.buffer.length)return state.buffer[0].length;else return state.length}if(n<=0)return 0;if(n>state.highWaterMark)state.highWaterMark=roundUpToNextPowerOf2(n);if(n>state.length){if(!state.ended){state.needReadable=true;return 0}else return state.length}return n}Readable.prototype.read=function(n){var state=this._readableState;state.calledRead=true;var nOrig=n;if(typeof n!=="number"||n>0)state.emittedReadable=false;if(n===0&&state.needReadable&&(state.length>=state.highWaterMark||state.ended)){emitReadable(this);return null}n=howMuchToRead(n,state);if(n===0&&state.ended){if(state.length===0)endReadable(this);return null}var doRead=state.needReadable;if(state.length-n<=state.highWaterMark)doRead=true;if(state.ended||state.reading)doRead=false;if(doRead){state.reading=true;state.sync=true;if(state.length===0)state.needReadable=true;this._read(state.highWaterMark);state.sync=false}if(doRead&&!state.reading)n=howMuchToRead(nOrig,state);var ret;if(n>0)ret=fromList(n,state);else ret=null;if(ret===null){state.needReadable=true;n=0}state.length-=n;if(state.length===0&&!state.ended)state.needReadable=true;if(state.ended&&!state.endEmitted&&state.length===0)endReadable(this);return ret};function chunkInvalid(state,chunk){var er=null;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode&&!er){er=new TypeError("Invalid non-string/buffer chunk")}return er}function onEofChunk(stream,state){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length){state.buffer.push(chunk);state.length+=state.objectMode?1:chunk.length}}state.ended=true;if(state.length>0)emitReadable(stream);else endReadable(stream)}function emitReadable(stream){var state=stream._readableState;state.needReadable=false;if(state.emittedReadable)return;state.emittedReadable=true;if(state.sync)setImmediate(function(){emitReadable_(stream)});else emitReadable_(stream)}function emitReadable_(stream){stream.emit("readable")}function maybeReadMore(stream,state){if(!state.readingMore){state.readingMore=true;setImmediate(function(){maybeReadMore_(stream,state)})}}function maybeReadMore_(stream,state){var len=state.length;while(!state.reading&&!state.flowing&&!state.ended&&state.length<state.highWaterMark){stream.read(0);if(len===state.length)break;else len=state.length}state.readingMore=false}Readable.prototype._read=function(n){this.emit("error",new Error("not implemented"))};Readable.prototype.pipe=function(dest,pipeOpts){var src=this;var state=this._readableState;switch(state.pipesCount){case 0:state.pipes=dest;break;case 1:state.pipes=[state.pipes,dest];break;default:state.pipes.push(dest);break}state.pipesCount+=1;var doEnd=(!pipeOpts||pipeOpts.end!==false)&&dest!==process.stdout&&dest!==process.stderr;var endFn=doEnd?onend:cleanup;if(state.endEmitted)setImmediate(endFn);else src.once("end",endFn);dest.on("unpipe",onunpipe);function onunpipe(readable){if(readable!==src)return;cleanup()}function onend(){dest.end()}var ondrain=pipeOnDrain(src);dest.on("drain",ondrain);function cleanup(){dest.removeListener("close",onclose);dest.removeListener("finish",onfinish);dest.removeListener("drain",ondrain);dest.removeListener("error",onerror);dest.removeListener("unpipe",onunpipe);src.removeListener("end",onend);src.removeListener("end",cleanup);if(!dest._writableState||dest._writableState.needDrain)ondrain()}var errListeners=EE.listenerCount(dest,"error");function onerror(er){unpipe();if(errListeners===0&&EE.listenerCount(dest,"error")===0)dest.emit("error",er)}dest.once("error",onerror);function onclose(){dest.removeListener("finish",onfinish);unpipe()}dest.once("close",onclose);function onfinish(){dest.removeListener("close",onclose);unpipe()}dest.once("finish",onfinish);function unpipe(){src.unpipe(dest)}dest.emit("pipe",src);if(!state.flowing){this.on("readable",pipeOnReadable);state.flowing=true;setImmediate(function(){flow(src)})}return dest};function pipeOnDrain(src){return function(){var dest=this;var state=src._readableState;state.awaitDrain--;if(state.awaitDrain===0)flow(src)}}function flow(src){var state=src._readableState;var chunk;state.awaitDrain=0;function write(dest,i,list){var written=dest.write(chunk);if(false===written){state.awaitDrain++}}while(state.pipesCount&&null!==(chunk=src.read())){if(state.pipesCount===1)write(state.pipes,0,null);else forEach(state.pipes,write);src.emit("data",chunk);if(state.awaitDrain>0)return}if(state.pipesCount===0){state.flowing=false;if(EE.listenerCount(src,"data")>0)emitDataEvents(src);return}state.ranOut=true}function pipeOnReadable(){if(this._readableState.ranOut){this._readableState.ranOut=false;flow(this)}}Readable.prototype.unpipe=function(dest){var state=this._readableState;if(state.pipesCount===0)return this;if(state.pipesCount===1){if(dest&&dest!==state.pipes)return this;if(!dest)dest=state.pipes;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;if(dest)dest.emit("unpipe",this);return this}if(!dest){var dests=state.pipes;var len=state.pipesCount;state.pipes=null;state.pipesCount=0;this.removeListener("readable",pipeOnReadable);state.flowing=false;for(var i=0;i<len;i++)dests[i].emit("unpipe",this);return this}var i=indexOf(state.pipes,dest);if(i===-1)return this;state.pipes.splice(i,1);state.pipesCount-=1;if(state.pipesCount===1)state.pipes=state.pipes[0];dest.emit("unpipe",this);return this};Readable.prototype.on=function(ev,fn){var res=Stream.prototype.on.call(this,ev,fn);if(ev==="data"&&!this._readableState.flowing)emitDataEvents(this);if(ev==="readable"&&this.readable){var state=this._readableState;if(!state.readableListening){state.readableListening=true;state.emittedReadable=false;state.needReadable=true;if(!state.reading){this.read(0)}else if(state.length){emitReadable(this,state)}}}return res};Readable.prototype.addListener=Readable.prototype.on;Readable.prototype.resume=function(){emitDataEvents(this);this.read(0);this.emit("resume")};Readable.prototype.pause=function(){emitDataEvents(this,true);this.emit("pause")};function emitDataEvents(stream,startPaused){var state=stream._readableState;if(state.flowing){throw new Error("Cannot switch to old mode now.")}var paused=startPaused||false;var readable=false;stream.readable=true;stream.pipe=Stream.prototype.pipe;stream.on=stream.addListener=Stream.prototype.on;stream.on("readable",function(){readable=true;var c;while(!paused&&null!==(c=stream.read()))stream.emit("data",c);if(c===null){readable=false;stream._readableState.needReadable=true}});stream.pause=function(){paused=true;this.emit("pause")};stream.resume=function(){paused=false;if(readable)setImmediate(function(){stream.emit("readable")});else this.read(0);this.emit("resume")};stream.emit("readable")}Readable.prototype.wrap=function(stream){var state=this._readableState;var paused=false;var self=this;stream.on("end",function(){if(state.decoder&&!state.ended){var chunk=state.decoder.end();if(chunk&&chunk.length)self.push(chunk)}self.push(null)});stream.on("data",function(chunk){if(state.decoder)chunk=state.decoder.write(chunk);if(!chunk||!state.objectMode&&!chunk.length)return;var ret=self.push(chunk);if(!ret){paused=true;stream.pause()}});for(var i in stream){if(typeof stream[i]==="function"&&typeof this[i]==="undefined"){this[i]=function(method){return function(){return stream[method].apply(stream,arguments)}}(i)}}var events=["error","close","destroy","pause","resume"];forEach(events,function(ev){stream.on(ev,function(x){return self.emit.apply(self,ev,x)})});self._read=function(n){if(paused){paused=false;stream.resume()}};return self};Readable._fromList=fromList;function fromList(n,state){var list=state.buffer;var length=state.length;var stringMode=!!state.decoder;var objectMode=!!state.objectMode;var ret;if(list.length===0)return null;if(length===0)ret=null;else if(objectMode)ret=list.shift();else if(!n||n>=length){if(stringMode)ret=list.join("");else ret=Buffer.concat(list,length);list.length=0}else{if(n<list[0].length){var buf=list[0];ret=buf.slice(0,n);list[0]=buf.slice(n)}else if(n===list[0].length){ret=list.shift()}else{if(stringMode)ret="";else ret=new Buffer(n);var c=0;for(var i=0,l=list.length;i<l&&c<n;i++){var buf=list[0];var cpy=Math.min(n-c,buf.length);if(stringMode)ret+=buf.slice(0,cpy);else buf.copy(ret,c,0,cpy);if(cpy<buf.length)list[0]=buf.slice(cpy);else list.shift();c+=cpy}}}return ret}function endReadable(stream){var state=stream._readableState;if(state.length>0)throw new Error("endReadable called on non-empty stream");if(!state.endEmitted&&state.calledRead){state.ended=true;setImmediate(function(){if(!state.endEmitted&&state.length===0){state.endEmitted=true;stream.readable=false;stream.emit("end")}})}}function forEach(xs,f){for(var i=0,l=xs.length;i<l;i++){f(xs[i],i)}}function indexOf(xs,x){for(var i=0,l=xs.length;i<l;i++){if(xs[i]===x)return i}return-1}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"./index.js":8,"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":3,buffer:4,events:1,inherits:2,"process/browser.js":9,string_decoder:14}],12:[function(require,module,exports){module.exports=Transform;var Duplex=require("./duplex.js");var inherits=require("inherits");inherits(Transform,Duplex);function TransformState(options,stream){this.afterTransform=function(er,data){return afterTransform(stream,er,data)};this.needTransform=false;this.transforming=false;this.writecb=null;this.writechunk=null}function afterTransform(stream,er,data){var ts=stream._transformState;ts.transforming=false;var cb=ts.writecb;if(!cb)return stream.emit("error",new Error("no writecb in Transform class"));ts.writechunk=null;ts.writecb=null;if(data!==null&&data!==undefined)stream.push(data);if(cb)cb(er);var rs=stream._readableState;rs.reading=false;if(rs.needReadable||rs.length<rs.highWaterMark){stream._read(rs.highWaterMark)}}function Transform(options){if(!(this instanceof Transform))return new Transform(options);Duplex.call(this,options);var ts=this._transformState=new TransformState(options,this);var stream=this;this._readableState.needReadable=true;this._readableState.sync=false;this.once("finish",function(){if("function"===typeof this._flush)this._flush(function(er){done(stream,er)});else done(stream)})}Transform.prototype.push=function(chunk,encoding){this._transformState.needTransform=false;return Duplex.prototype.push.call(this,chunk,encoding)};Transform.prototype._transform=function(chunk,encoding,cb){throw new Error("not implemented")};Transform.prototype._write=function(chunk,encoding,cb){var ts=this._transformState;ts.writecb=cb;ts.writechunk=chunk;ts.writeencoding=encoding;if(!ts.transforming){var rs=this._readableState;if(ts.needTransform||rs.needReadable||rs.length<rs.highWaterMark)this._read(rs.highWaterMark)}};Transform.prototype._read=function(n){var ts=this._transformState;if(ts.writechunk&&ts.writecb&&!ts.transforming){ts.transforming=true;this._transform(ts.writechunk,ts.writeencoding,ts.afterTransform)}else{ts.needTransform=true}};function done(stream,er){if(er)return stream.emit("error",er);var ws=stream._writableState;var rs=stream._readableState;var ts=stream._transformState;if(ws.length)throw new Error("calling transform done when ws.length != 0");if(ts.transforming)throw new Error("calling transform done when still transforming");return stream.push(null)}},{"./duplex.js":7,inherits:2}],13:[function(require,module,exports){module.exports=Writable;Writable.WritableState=WritableState;var isUint8Array=typeof Uint8Array!=="undefined"?function(x){return x instanceof Uint8Array}:function(x){return x&&x.constructor&&x.constructor.name==="Uint8Array"};var isArrayBuffer=typeof ArrayBuffer!=="undefined"?function(x){return x instanceof ArrayBuffer}:function(x){return x&&x.constructor&&x.constructor.name==="ArrayBuffer"};var inherits=require("inherits");var Stream=require("./index.js");var setImmediate=require("process/browser.js").nextTick;var Buffer=require("buffer").Buffer;inherits(Writable,Stream);function WriteReq(chunk,encoding,cb){this.chunk=chunk;this.encoding=encoding;this.callback=cb}function WritableState(options,stream){options=options||{};var hwm=options.highWaterMark;this.highWaterMark=hwm||hwm===0?hwm:16*1024;this.objectMode=!!options.objectMode;this.highWaterMark=~~this.highWaterMark;this.needDrain=false;this.ending=false;this.ended=false;this.finished=false;var noDecode=options.decodeStrings===false;this.decodeStrings=!noDecode;this.defaultEncoding=options.defaultEncoding||"utf8";this.length=0;this.writing=false;this.sync=true;this.bufferProcessing=false;this.onwrite=function(er){onwrite(stream,er)};this.writecb=null;this.writelen=0;this.buffer=[]}function Writable(options){if(!(this instanceof Writable)&&!(this instanceof Stream.Duplex))return new Writable(options);this._writableState=new WritableState(options,this);this.writable=true;Stream.call(this)}Writable.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe. Not readable."))};function writeAfterEnd(stream,state,cb){var er=new Error("write after end");stream.emit("error",er);setImmediate(function(){cb(er)})}function validChunk(stream,state,chunk,cb){var valid=true;if(!Buffer.isBuffer(chunk)&&"string"!==typeof chunk&&chunk!==null&&chunk!==undefined&&!state.objectMode){var er=new TypeError("Invalid non-string/buffer chunk");stream.emit("error",er);setImmediate(function(){cb(er)});valid=false}return valid}Writable.prototype.write=function(chunk,encoding,cb){var state=this._writableState;var ret=false;if(typeof encoding==="function"){cb=encoding;encoding=null}if(!Buffer.isBuffer(chunk)&&isUint8Array(chunk))chunk=new Buffer(chunk);if(isArrayBuffer(chunk)&&typeof Uint8Array!=="undefined")chunk=new Buffer(new Uint8Array(chunk));if(Buffer.isBuffer(chunk))encoding="buffer";else if(!encoding)encoding=state.defaultEncoding;if(typeof cb!=="function")cb=function(){};if(state.ended)writeAfterEnd(this,state,cb);else if(validChunk(this,state,chunk,cb))ret=writeOrBuffer(this,state,chunk,encoding,cb);return ret};function decodeChunk(state,chunk,encoding){if(!state.objectMode&&state.decodeStrings!==false&&typeof chunk==="string"){chunk=new Buffer(chunk,encoding)}return chunk}function writeOrBuffer(stream,state,chunk,encoding,cb){chunk=decodeChunk(state,chunk,encoding);var len=state.objectMode?1:chunk.length;state.length+=len;var ret=state.length<state.highWaterMark;state.needDrain=!ret;if(state.writing)state.buffer.push(new WriteReq(chunk,encoding,cb));else doWrite(stream,state,len,chunk,encoding,cb);return ret}function doWrite(stream,state,len,chunk,encoding,cb){state.writelen=len;state.writecb=cb;state.writing=true;state.sync=true;stream._write(chunk,encoding,state.onwrite);state.sync=false}function onwriteError(stream,state,sync,er,cb){if(sync)setImmediate(function(){cb(er)});else cb(er);stream.emit("error",er)}function onwriteStateUpdate(state){state.writing=false;state.writecb=null;state.length-=state.writelen;state.writelen=0}function onwrite(stream,er){var state=stream._writableState;var sync=state.sync;var cb=state.writecb;onwriteStateUpdate(state);if(er)onwriteError(stream,state,sync,er,cb);else{var finished=needFinish(stream,state);if(!finished&&!state.bufferProcessing&&state.buffer.length)clearBuffer(stream,state);if(sync){setImmediate(function(){afterWrite(stream,state,finished,cb)})}else{afterWrite(stream,state,finished,cb)}}}function afterWrite(stream,state,finished,cb){if(!finished)onwriteDrain(stream,state);cb();if(finished)finishMaybe(stream,state)}function onwriteDrain(stream,state){if(state.length===0&&state.needDrain){state.needDrain=false;stream.emit("drain")}}function clearBuffer(stream,state){state.bufferProcessing=true;for(var c=0;c<state.buffer.length;c++){var entry=state.buffer[c];var chunk=entry.chunk;var encoding=entry.encoding;var cb=entry.callback;var len=state.objectMode?1:chunk.length;doWrite(stream,state,len,chunk,encoding,cb);if(state.writing){c++;break}}state.bufferProcessing=false;if(c<state.buffer.length)state.buffer=state.buffer.slice(c);else state.buffer.length=0}Writable.prototype._write=function(chunk,encoding,cb){cb(new Error("not implemented"))};Writable.prototype.end=function(chunk,encoding,cb){var state=this._writableState;if(typeof chunk==="function"){cb=chunk;chunk=null;encoding=null}else if(typeof encoding==="function"){cb=encoding;encoding=null}if(typeof chunk!=="undefined"&&chunk!==null)this.write(chunk,encoding);if(!state.ending&&!state.finished)endWritable(this,state,cb)};function needFinish(stream,state){return state.ending&&state.length===0&&!state.finished&&!state.writing}function finishMaybe(stream,state){var need=needFinish(stream,state);if(need){state.finished=true;stream.emit("finish")}return need}function endWritable(stream,state,cb){state.ending=true;finishMaybe(stream,state);if(cb){if(state.finished)setImmediate(cb);else stream.once("finish",cb)}state.ended=true}},{"./index.js":8,buffer:4,inherits:2,"process/browser.js":9}],14:[function(require,module,exports){var Buffer=require("buffer").Buffer;function assertEncoding(encoding){if(encoding&&!Buffer.isEncoding(encoding)){throw new Error("Unknown encoding: "+encoding)}}var StringDecoder=exports.StringDecoder=function(encoding){this.encoding=(encoding||"utf8").toLowerCase().replace(/[-_]/,"");assertEncoding(encoding);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=utf16DetectIncompleteChar;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=base64DetectIncompleteChar;break;default:this.write=passThroughWrite;return}this.charBuffer=new Buffer(6);this.charReceived=0;this.charLength=0};StringDecoder.prototype.write=function(buffer){var charStr="";var offset=0;while(this.charLength){var i=buffer.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:buffer.length;buffer.copy(this.charBuffer,this.charReceived,offset,i);this.charReceived+=i-offset;offset=i;if(this.charReceived<this.charLength){return""}charStr=this.charBuffer.slice(0,this.charLength).toString(this.encoding);var charCode=charStr.charCodeAt(charStr.length-1);if(charCode>=55296&&charCode<=56319){this.charLength+=this.surrogateSize;charStr="";continue}this.charReceived=this.charLength=0;if(i==buffer.length)return charStr;buffer=buffer.slice(i,buffer.length);break}var lenIncomplete=this.detectIncompleteChar(buffer);var end=buffer.length;if(this.charLength){buffer.copy(this.charBuffer,0,buffer.length-lenIncomplete,end);this.charReceived=lenIncomplete;end-=lenIncomplete}charStr+=buffer.toString(this.encoding,0,end);var end=charStr.length-1;var charCode=charStr.charCodeAt(end);if(charCode>=55296&&charCode<=56319){var size=this.surrogateSize;this.charLength+=size;this.charReceived+=size;this.charBuffer.copy(this.charBuffer,size,0,size);this.charBuffer.write(charStr.charAt(charStr.length-1),this.encoding);return charStr.substring(0,end)}return charStr};StringDecoder.prototype.detectIncompleteChar=function(buffer){var i=buffer.length>=3?3:buffer.length;for(;i>0;i--){var c=buffer[buffer.length-i];if(i==1&&c>>5==6){this.charLength=2;break}if(i<=2&&c>>4==14){this.charLength=3;break}if(i<=3&&c>>3==30){this.charLength=4;break}}return i};StringDecoder.prototype.end=function(buffer){var res="";if(buffer&&buffer.length)res=this.write(buffer);if(this.charReceived){var cr=this.charReceived;var buf=this.charBuffer;var enc=this.encoding;res+=buf.slice(0,cr).toString(enc)}return res};function passThroughWrite(buffer){return buffer.toString(this.encoding)}function utf16DetectIncompleteChar(buffer){var incomplete=this.charReceived=buffer.length%2;this.charLength=incomplete?2:0;return incomplete}function base64DetectIncompleteChar(buffer){var incomplete=this.charReceived=buffer.length%3;this.charLength=incomplete?3:0;return incomplete}},{buffer:4}],hypernal:[function(require,module,exports){module.exports=require("2HXSAl")},{}],"2HXSAl":[function(require,module,exports){"use strict";var Terminal=require("./term"),through=require("through");function style(parentElem){var currentStyle=parentElem.getAttribute("style")||"";parentElem.setAttribute("style",currentStyle+"overflow-y: auto; /* white-space: pre; */")}function scroll(elem){if(!elem)return;elem.scrollTop=elem.scrollHeight}module.exports=function(opts){var term=new Terminal(opts);term.open();var hypernal=through(term.write.bind(term));hypernal.appendTo=function(parent){if(typeof parent==="string")parent=document.querySelector(parent);parent.appendChild(term.element);style(parent);hypernal.container=parent;term.element.style.position="relative"};hypernal.writeln=function(line){term.writeln(line);if(hypernal.tail)scroll(hypernal.container)};hypernal.write=function(data){term.write(data);if(hypernal.tail)scroll(hypernal.container)};hypernal.reset=term.reset.bind(term);hypernal.element=term.element;hypernal.term=term;return hypernal}},{"./term":44,through:43}],17:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.blankLine=function(cur){var attr=cur?this.curAttr:this.defAttr;var ch=[attr," "],line=[],i=0;for(;i<this.cols;i++){line[i]=ch}return line}}},{}],18:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.charsets={};Terminal.charsets.SCLD={"`":"◆",a:"▒",b:" ",c:"\f",d:"\r",e:"\n",f:"°",g:"±",h:"",i:"",j:"┘",k:"┐",l:"┌",m:"└",n:"┼",o:"⎺",p:"⎻",q:"─",r:"⎼",s:"⎽",t:"├",u:"┤",v:"┴",w:"┬",x:"│",y:"≤",z:"≥","{":"π","|":"≠","}":"£","~":"·"};Terminal.charsets.UK=null;Terminal.charsets.US=null;Terminal.charsets.Dutch=null;Terminal.charsets.Finnish=null;Terminal.charsets.French=null;Terminal.charsets.FrenchCanadian=null;Terminal.charsets.German=null;Terminal.charsets.Italian=null;Terminal.charsets.NorwegianDanish=null;Terminal.charsets.Spanish=null;Terminal.charsets.Swedish=null;Terminal.charsets.Swiss=null;Terminal.charsets.ISOLatin=null}},{}],19:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.colors=["#2e3436","#cc0000","#4e9a06","#c4a000","#3465a4","#75507b","#06989a","#d3d7cf","#555753","#ef2929","#8ae234","#fce94f","#729fcf","#ad7fa8","#34e2e2","#eeeeec"];Terminal.colors=function(){var colors=Terminal.colors,r=[0,95,135,175,215,255],i;i=0;for(;i<216;i++){out(r[i/36%6|0],r[i/6%6|0],r[i%6])}i=0;for(;i<24;i++){r=8+i*10;out(r,r,r)}function out(r,g,b){colors.push("#"+hex(r)+hex(g)+hex(b))}function hex(c){c=c.toString(16);return c.length<2?"0"+c:c}return colors}();Terminal.defaultColors={bg:"#000000",fg:"#f0f0f0"};Terminal.colors[256]=Terminal.defaultColors.bg;Terminal.colors[257]=Terminal.defaultColors.fg}},{}],20:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.charAttributes=function(params){var l=params.length,i=0,bg,fg,p;for(;i<l;i++){p=params[i];if(p>=30&&p<=37){this.curAttr=this.curAttr&~(511<<9)|p-30<<9}else if(p>=40&&p<=47){this.curAttr=this.curAttr&~511|p-40}else if(p>=90&&p<=97){p+=8;this.curAttr=this.curAttr&~(511<<9)|p-90<<9}else if(p>=100&&p<=107){p+=8;this.curAttr=this.curAttr&~511|p-100}else if(p===0){this.curAttr=this.defAttr}else if(p===1){this.curAttr=this.curAttr|1<<18}else if(p===4){this.curAttr=this.curAttr|2<<18}else if(p===7||p===27){if(p===7){if(this.curAttr>>18&4)continue;this.curAttr=this.curAttr|4<<18}else if(p===27){if(~(this.curAttr>>18)&4)continue;this.curAttr=this.curAttr&~(4<<18)}bg=this.curAttr&511;fg=this.curAttr>>9&511;this.curAttr=this.curAttr&~262143|(bg<<9|fg)}else if(p===22){this.curAttr=this.curAttr&~(1<<18)}else if(p===24){this.curAttr=this.curAttr&~(2<<18)}else if(p===39){this.curAttr=this.curAttr&~(511<<9);this.curAttr=this.curAttr|(this.defAttr>>9&511)<<9}else if(p===49){this.curAttr=this.curAttr&~511;this.curAttr=this.curAttr|this.defAttr&511}else if(p===38){if(params[i+1]!==5)continue;i+=2;p=params[i]&255;this.curAttr=this.curAttr&~(511<<9)|p<<9}else if(p===48){if(params[i+1]!==5)continue;i+=2;p=params[i]&255;this.curAttr=this.curAttr&~511|p}}}}},{}],21:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.saveCursor=function(params){this.savedX=this.x;this.savedY=this.y};Terminal.prototype.restoreCursor=function(params){this.x=this.savedX||0;this.y=this.savedY||0};Terminal.prototype.cursorUp=function(params){var param=params[0];if(param<1)param=1;this.y-=param;if(this.y<0)this.y=0};Terminal.prototype.cursorDown=function(params){var param=params[0];if(param<1)param=1;this.y+=param;if(this.y>=this.rows){this.y=this.rows-1}};Terminal.prototype.cursorForward=function(params){var param=params[0];if(param<1)param=1;this.x+=param;if(this.x>=this.cols){this.x=this.cols-1}};Terminal.prototype.cursorBackward=function(params){var param=params[0];if(param<1)param=1;this.x-=param;if(this.x<0)this.x=0};Terminal.prototype.cursorPos=function(params){var row,col;row=params[0]-1;if(params.length>=2){col=params[1]-1}else{col=0}if(row<0){row=0}else if(row>=this.rows){row=this.rows-1}if(col<0){col=0}else if(col>=this.cols){col=this.cols-1}this.x=col;this.y=row};Terminal.prototype.cursorNextLine=function(params){var param=params[0];if(param<1)param=1;this.y+=param;if(this.y>=this.rows){this.y=this.rows-1}this.x=0};Terminal.prototype.cursorPrecedingLine=function(params){var param=params[0];if(param<1)param=1;this.y-=param;if(this.y<0)this.y=0;this.x=0};Terminal.prototype.cursorCharAbsolute=function(params){var param=params[0];if(param<1)param=1;this.x=param-1};Terminal.prototype.cursorForwardTab=function(params){var param=params[0]||1;while(param--){this.x=this.nextStop()}};Terminal.prototype.cursorBackwardTab=function(params){var param=params[0]||1;while(param--){this.x=this.prevStop()}}}},{}],22:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.insertChars=function(params){var param,row,j,ch;param=params[0];if(param<1)param=1;row=this.y+this.ybase;j=this.x;ch=[this.curAttr," "];while(param--&&j<this.cols){this.lines[row].splice(j++,0,ch);this.lines[row].pop()}};Terminal.prototype.insertLines=function(params){var param,row,j;param=params[0];if(param<1)param=1;row=this.y+this.ybase;j=this.rows-1-this.scrollBottom;j=this.rows-1+this.ybase-j+1; | |
while(param--){this.lines.splice(row,0,this.blankLine(true));this.lines.splice(j,1)}this.updateRange(this.y);this.updateRange(this.scrollBottom)};Terminal.prototype.deleteLines=function(params){var param,row,j;param=params[0];if(param<1)param=1;row=this.y+this.ybase;j=this.rows-1-this.scrollBottom;j=this.rows-1+this.ybase-j;while(param--){this.lines.splice(j+1,0,this.blankLine(true));this.lines.splice(row,1)}this.updateRange(this.y);this.updateRange(this.scrollBottom)};Terminal.prototype.deleteChars=function(params){var param,row,ch;param=params[0];if(param<1)param=1;row=this.y+this.ybase;ch=[this.curAttr," "];while(param--){this.lines[row].splice(this.x,1);this.lines[row].push(ch)}};Terminal.prototype.eraseChars=function(params){var param,row,j,ch;param=params[0];if(param<1)param=1;row=this.y+this.ybase;j=this.x;ch=[this.curAttr," "];while(param--&&j<this.cols){this.lines[row][j++]=ch}}}},{}],23:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.charPosAbsolute=function(params){var param=params[0];if(param<1)param=1;this.x=param-1;if(this.x>=this.cols){this.x=this.cols-1}};Terminal.prototype.HPositionRelative=function(params){var param=params[0];if(param<1)param=1;this.x+=param;if(this.x>=this.cols){this.x=this.cols-1}};Terminal.prototype.linePosAbsolute=function(params){var param=params[0];if(param<1)param=1;this.y=param-1;if(this.y>=this.rows){this.y=this.rows-1}};Terminal.prototype.VPositionRelative=function(params){var param=params[0];if(param<1)param=1;this.y+=param;if(this.y>=this.rows){this.y=this.rows-1}};Terminal.prototype.HVPosition=function(params){if(params[0]<1)params[0]=1;if(params[1]<1)params[1]=1;this.y=params[0]-1;if(this.y>=this.rows){this.y=this.rows-1}this.x=params[1]-1;if(this.x>=this.cols){this.x=this.cols-1}}}},{}],24:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.repeatPrecedingCharacter=function(params){var param=params[0]||1,line=this.lines[this.ybase+this.y],ch=line[this.x-1]||[this.defAttr," "];while(param--)line[this.x++]=ch}}},{}],25:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.softReset=function(params){this.cursorHidden=false;this.insertMode=false;this.originMode=false;this.wraparoundMode=false;this.applicationKeypad=false;this.scrollTop=0;this.scrollBottom=this.rows-1;this.curAttr=this.defAttr;this.x=this.y=0;this.charset=null;this.glevel=0;this.charsets=[null]}}},{}],26:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.tabClear=function(params){var param=params[0];if(param<=0){delete this.tabs[this.x]}else if(param===3){this.tabs={}}}}},{}],27:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.log=function(){if(!Terminal.debug)return;if(!window.console||!window.console.log)return;var args=Array.prototype.slice.call(arguments);window.console.log.apply(window.console,args)};Terminal.prototype.error=function(){if(!Terminal.debug)return;if(!window.console||!window.console.error)return;var args=Array.prototype.slice.call(arguments);window.console.error.apply(window.console,args)}}},{}],28:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.destroy=function(){this.readable=false;this.writable=false;this._events={};this.handler=function(){};this.write=function(){}}}},{}],29:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.eraseRight=function(x,y){var line=this.lines[this.ybase+y],ch=[this.curAttr," "];for(;x<this.cols;x++){line[x]=ch}this.updateRange(y)};Terminal.prototype.eraseLeft=function(x,y){var line=this.lines[this.ybase+y],ch=[this.curAttr," "];x++;while(x--)line[x]=ch;this.updateRange(y)};Terminal.prototype.eraseLine=function(y){this.eraseRight(0,y)};Terminal.prototype.eraseInDisplay=function(params){var j;switch(params[0]){case 0:this.eraseRight(this.x,this.y);j=this.y+1;for(;j<this.rows;j++){this.eraseLine(j)}break;case 1:this.eraseLeft(this.x,this.y);j=this.y;while(j--){this.eraseLine(j)}break;case 2:j=this.rows;while(j--)this.eraseLine(j);break;case 3:;break}};Terminal.prototype.eraseInLine=function(params){switch(params[0]){case 0:this.eraseRight(this.x,this.y);break;case 1:this.eraseLeft(this.x,this.y);break;case 2:this.eraseLine(this.y);break}}}},{}],30:[function(require,module,exports){"use strict";var states=require("../states");module.exports=function(Terminal){Terminal.prototype.index=function(){this.y++;if(this.y>this.scrollBottom){this.y--;this.scroll()}this.state=states.normal};Terminal.prototype.reverseIndex=function(){var j;this.y--;if(this.y<this.scrollTop){this.y++;this.lines.splice(this.y+this.ybase,0,this.blankLine(true));j=this.rows-1-this.scrollBottom;this.lines.splice(this.rows-1+this.ybase-j+1,1);this.updateRange(this.scrollTop);this.updateRange(this.scrollBottom)}this.state=states.normal}}},{"../states":39}],31:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.reset=function(){Terminal.call(this,this.cols,this.rows);this.refresh(0,this.rows-1)}}},{}],32:[function(require,module,exports){"use strict";var states=require("../states");module.exports=function(Terminal){Terminal.prototype.tabSet=function(){this.tabs[this.x]=true;this.state=states.normal}}},{"../states":39}],33:[function(require,module,exports){"use strict";function isBoldBroken(){var el=document.createElement("span");el.innerHTML="hello world";document.body.appendChild(el);var w1=el.scrollWidth;el.style.fontWeight="bold";var w2=el.scrollWidth;document.body.removeChild(el);return w1!==w2}module.exports=function(Terminal){Terminal.prototype.open=function(){var self=this,i=0,div;this.element=document.createElement("div");this.element.className="terminal";this.children=[];for(;i<this.rows;i++){div=document.createElement("div");this.element.appendChild(div);this.children.push(div)}this.refresh(0,this.rows-1);if(Terminal.brokenBold===null){Terminal.brokenBold=isBoldBroken()}this.element.style.backgroundColor=Terminal.defaultColors.bg;this.element.style.color=Terminal.defaultColors.fg}}},{}],34:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.termName="xterm";Terminal.geometry=[80,24];Terminal.cursorBlink=true;Terminal.visualBell=false;Terminal.popOnBell=false;Terminal.scrollback=1e3;Terminal.screenKeys=false;Terminal.programFeatures=false;Terminal.debug=false}},{}],35:[function(require,module,exports){"use strict";function addRowsOnDemand(){while(this.y>=this.rows){this.lines.push(this.blankLine());var div=document.createElement("div");this.element.appendChild(div);this.children.push(div);this.rows++}}module.exports=function(Terminal){Terminal.prototype.updateRange=function(y){if(y<this.refreshStart)this.refreshStart=y;if(y>this.refreshEnd)this.refreshEnd=y;addRowsOnDemand.bind(this)()};Terminal.prototype.maxRange=function(){this.refreshStart=0;this.refreshEnd=this.rows-1}}},{}],36:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.refresh=function(start,end){var x,y,i,line,out,ch,width,data,attr,fgColor,bgColor,flags,row,parent;width=this.cols;y=start;for(;y<=end;y++){row=y+this.ydisp;line=this.lines[row];if(!line){return this.reset()}out="";if(y===this.y&&this.cursorState&&this.ydisp===this.ybase&&!this.cursorHidden){x=this.x}else{x=-1}attr=this.defAttr;i=0;for(;i<width;i++){data=line[i][0];ch=line[i][1];if(i===x)data=-1;if(data!==attr){if(attr!==this.defAttr){out+="</span>"}if(data!==this.defAttr){if(data===-1){out+='<span class="reverse-video">'}else{out+='<span style="';bgColor=data&511;fgColor=data>>9&511;flags=data>>18;if(flags&1){if(!Terminal.brokenBold){out+="font-weight:bold;"}if(fgColor<8)fgColor+=8}if(flags&2){out+="text-decoration:underline;"}if(bgColor!==256){out+="background-color:"+Terminal.colors[bgColor]+";"}if(fgColor!==257){out+="color:"+Terminal.colors[fgColor]+";"}out+='">'}}}switch(ch){case"&":out+="&";break;case"<":out+="<";break;case">":out+=">";break;default:if(ch<=" "){out+=" "}else{out+=ch}break}attr=data}if(attr!==this.defAttr){out+="</span>"}this.children[y].innerHTML=out}if(parent)parent.appendChild(this.element)}}},{}],37:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.setgCharset=function(g,charset){this.charsets[g]=charset;if(this.glevel===g){this.charset=charset}}}},{}],38:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.setgLevel=function(g){this.glevel=g;this.charset=this.charsets[g]}}},{}],39:[function(require,module,exports){"use strict";module.exports={normal:0,escaped:1,csi:2,osc:3,charset:4,dcs:5,ignore:6}},{}],40:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.setupStops=function(i){if(i!=null){if(!this.tabs[i]){i=this.prevStop(i)}}else{this.tabs={};i=0}for(;i<this.cols;i+=8){this.tabs[i]=true}};Terminal.prototype.prevStop=function(x){if(x==null)x=this.x;while(!this.tabs[--x]&&x>0);return x>=this.cols?this.cols-1:x<0?0:x};Terminal.prototype.nextStop=function(x){if(x==null)x=this.x;while(!this.tabs[++x]&&x<this.cols);return x>=this.cols?this.cols-1:x<0?0:x}}},{}],41:[function(require,module,exports){"use strict";module.exports=function(Terminal){Terminal.prototype.ch=function(cur){return cur?[this.curAttr," "]:[this.defAttr," "]};Terminal.prototype.is=function(term){var name=this.termName||Terminal.termName;return(name+"").indexOf(term)===0}}},{}],42:[function(require,module,exports){"use strict";var states=require("./states");function fixLinefeed(data){return data.replace(/([^\r])\n/g,"$1\r\n")}function fixIndent(data){if(!/(^|\n) /.test(data))return data;return data.split("\n").map(function(line){var count=0;while(line.charAt(0)===" "){line=line.slice(1);count++}while(count--){line=" "+line}return line}).join("\r\n")}module.exports=function(Terminal){Terminal.prototype.write=function(data){data=fixLinefeed(data);data=fixIndent(data);var l=data.length,i=0,cs,ch;this.refreshStart=this.y;this.refreshEnd=this.y;if(this.ybase!==this.ydisp){this.ydisp=this.ybase;this.maxRange()}for(;i<l;i++){ch=data[i];switch(this.state){case states.normal:switch(ch){case"":this.bell();break;case"\n":case"":case"\f":if(this.convertEol){this.x=0}this.y++;break;case"\r":this.x=0;break;case"\b":if(this.x>0){this.x--}break;case" ":this.x=this.nextStop();break;case"":this.setgLevel(1);break;case"":this.setgLevel(0);break;case"":this.state=states.escaped;break;default:if(ch>=" "){if(this.charset&&this.charset[ch]){ch=this.charset[ch]}if(this.x>=this.cols){this.x=0;this.y++}if(this.lines[this.y+this.ybase])this.lines[this.y+this.ybase][this.x]=[this.curAttr,ch];this.x++;this.updateRange(this.y)}break}break;case states.escaped:switch(ch){case"[":this.params=[];this.currentParam=0;this.state=states.csi;break;case"]":this.params=[];this.currentParam=0;this.state=states.osc;break;case"P":this.params=[];this.currentParam=0;this.state=states.dcs;break;case"_":this.stateType="apc";this.state=states.ignore;break;case"^":this.stateType="pm";this.state=states.ignore;break;case"c":this.reset();break;case"E":this.x=0;break;case"D":this.index();break;case"M":this.reverseIndex();break;case"%":this.setgLevel(0);this.setgCharset(0,Terminal.charsets.US);this.state=states.normal;i++;break;case"(":case")":case"*":case"+":case"-":case".":switch(ch){case"(":this.gcharset=0;break;case")":this.gcharset=1;break;case"*":this.gcharset=2;break;case"+":this.gcharset=3;break;case"-":this.gcharset=1;break;case".":this.gcharset=2;break}this.state=states.charset;break;case"/":this.gcharset=3;this.state=states.charset;i--;break;case"N":break;case"O":break;case"n":this.setgLevel(2);break;case"o":this.setgLevel(3);break;case"|":this.setgLevel(3);break;case"}":this.setgLevel(2);break;case"~":this.setgLevel(1);break;case"7":this.saveCursor();this.state=states.normal;break;case"8":this.restoreCursor();this.state=states.normal;break;case"#":this.state=states.normal;i++;break;case"H":this.tabSet();break;case"=":this.log("Serial port requested application keypad.");this.applicationKeypad=true;this.state=states.normal;break;case">":this.log("Switching back to normal keypad.");this.applicationKeypad=false;this.state=states.normal;break;default:this.state=states.normal;this.error("Unknown ESC control: %s.",ch);break}break;case states.charset:switch(ch){case"0":cs=Terminal.charsets.SCLD;break;case"A":cs=Terminal.charsets.UK;break;case"B":cs=Terminal.charsets.US;break;case"4":cs=Terminal.charsets.Dutch;break;case"C":case"5":cs=Terminal.charsets.Finnish;break;case"R":cs=Terminal.charsets.French;break;case"Q":cs=Terminal.charsets.FrenchCanadian;break;case"K":cs=Terminal.charsets.German;break;case"Y":cs=Terminal.charsets.Italian;break;case"E":case"6":cs=Terminal.charsets.NorwegianDanish;break;case"Z":cs=Terminal.charsets.Spanish;break;case"H":case"7":cs=Terminal.charsets.Swedish;break;case"=":cs=Terminal.charsets.Swiss;break;case"/":cs=Terminal.charsets.ISOLatin;i++;break;default:cs=Terminal.charsets.US;break}this.setgCharset(this.gcharset,cs);this.gcharset=null;this.state=states.normal;break;case states.osc:if(ch===""||ch===""){if(ch==="")i++;this.params.push(this.currentParam);switch(this.params[0]){case 0:case 1:case 2:if(this.params[1]){this.title=this.params[1];this.handleTitle(this.title)}break;case 3:break;case 4:case 5:break;case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:break;case 46:break;case 50:break;case 51:break;case 52:break;case 104:case 105:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:break}this.params=[];this.currentParam=0;this.state=states.normal}else{if(!this.params.length){if(ch>="0"&&ch<="9"){this.currentParam=this.currentParam*10+ch.charCodeAt(0)-48}else if(ch===";"){this.params.push(this.currentParam);this.currentParam=""}}else{this.currentParam+=ch}}break;case states.csi:if(ch==="?"||ch===">"||ch==="!"){this.prefix=ch;break}if(ch>="0"&&ch<="9"){this.currentParam=this.currentParam*10+ch.charCodeAt(0)-48;break}if(ch==="$"||ch==='"'||ch===" "||ch==="'"){this.postfix=ch;break}this.params.push(this.currentParam);this.currentParam=0;if(ch===";")break;this.state=states.normal;switch(ch){case"A":this.cursorUp(this.params);break;case"B":this.cursorDown(this.params);break;case"C":this.cursorForward(this.params);break;case"D":this.cursorBackward(this.params);break;case"H":this.cursorPos(this.params);break;case"J":this.eraseInDisplay(this.params);break;case"K":this.eraseInLine(this.params);break;case"m":this.charAttributes(this.params);break;case"n":this.deviceStatus(this.params);break;case"@":this.insertChars(this.params);break;case"E":this.cursorNextLine(this.params);break;case"F":this.cursorPrecedingLine(this.params);break;case"G":this.cursorCharAbsolute(this.params);break;case"L":this.insertLines(this.params);break;case"M":this.deleteLines(this.params);break;case"P":this.deleteChars(this.params);break;case"X":this.eraseChars(this.params);break;case"`":this.charPosAbsolute(this.params);break;case"a":this.HPositionRelative(this.params);break;case"c":break;case"d":this.linePosAbsolute(this.params);break;case"e":this.VPositionRelative(this.params);break;case"f":this.HVPosition(this.params);break;case"h":break;case"l":break;case"r":break;case"s":this.saveCursor(this.params);break;case"u":this.restoreCursor(this.params);break;case"I":this.cursorForwardTab(this.params);break;case"S":break;case"T":if(this.params.length<2&&!this.prefix){}break;case"Z":this.cursorBackwardTab(this.params);break;case"b":this.repeatPrecedingCharacter(this.params);break;case"g":this.tabClear(this.params);break;case"p":switch(this.prefix){case"!":this.softReset(this.params);break}break;default:this.error("Unknown CSI code: %s.",ch);break}this.prefix="";this.postfix="";break;case states.dcs:if(ch===""||ch===""){if(ch==="")i++;switch(this.prefix){case"":break;case"$q":var pt=this.currentParam,valid=false;switch(pt){case'"q':pt='0"q';break;case'"p':pt='61"p';break;case"r":pt=""+(this.scrollTop+1)+";"+(this.scrollBottom+1)+"r";break;case"m":pt="0m";break;default:this.error("Unknown DCS Pt: %s.",pt);pt="";break}break;case"+p":break;default:this.error("Unknown DCS prefix: %s.",this.prefix);break}this.currentParam=0;this.prefix="";this.state=states.normal}else if(!this.currentParam){if(!this.prefix&&ch!=="$"&&ch!=="+"){this.currentParam=ch}else if(this.prefix.length===2){this.currentParam=ch}else{this.prefix+=ch}}else{this.currentParam+=ch}break;case states.ignore:if(ch===""||ch===""){if(ch==="")i++;this.stateData="";this.state=states.normal}else{if(!this.stateData)this.stateData="";this.stateData+=ch}break}}this.updateRange(this.y);this.refresh(this.refreshStart,this.refreshEnd)};Terminal.prototype.writeln=function(data){data=data.replace(/ /g," ");this.write(data+" \r\n")}}},{"./states":39}],43:[function(require,module,exports){(function(process){var Stream=require("stream");exports=module.exports=through;through.through=through;function through(write,end,opts){write=write||function(data){this.queue(data)};end=end||function(){this.queue(null)};var ended=false,destroyed=false,buffer=[],_ended=false;var stream=new Stream;stream.readable=stream.writable=true;stream.paused=false;stream.autoDestroy=!(opts&&opts.autoDestroy===false);stream.write=function(data){write.call(this,data);return!stream.paused};function drain(){while(buffer.length&&!stream.paused){var data=buffer.shift();if(null===data)return stream.emit("end");else stream.emit("data",data)}}stream.queue=stream.push=function(data){if(_ended)return stream;if(data==null)_ended=true;buffer.push(data);drain();return stream};stream.on("end",function(){stream.readable=false;if(!stream.writable&&stream.autoDestroy)process.nextTick(function(){stream.destroy()})});function _end(){stream.writable=false;end.call(stream);if(!stream.readable&&stream.autoDestroy)stream.destroy()}stream.end=function(data){if(ended)return;ended=true;if(arguments.length)stream.write(data);_end();return stream};stream.destroy=function(){if(destroyed)return;destroyed=true;ended=true;buffer.length=0;stream.writable=stream.readable=false;stream.emit("close");return stream};stream.pause=function(){if(stream.paused)return;stream.paused=true;return stream};stream.resume=function(){if(stream.paused){stream.paused=false;stream.emit("resume")}drain();if(!stream.paused)stream.emit("drain");return stream};return stream}}).call(this,require("/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js"))},{"/home/admin/browserify-cdn/node_modules/browserify/node_modules/insert-module-globals/node_modules/process/browser.js":3,stream:8}],44:[function(require,module,exports){"use strict";var states=require("./lib/states");module.exports=Terminal;function Terminal(opts){opts=opts||{};if(!(this instanceof Terminal))return new Terminal(opts);this.cols=opts.cols||500;this.rows=opts.rows||100;this.ybase=0;this.ydisp=0;this.x=0;this.y=0;this.cursorState=0;this.cursorHidden=false;this.convertEol=false;this.state=states.normal;this.queue="";this.scrollTop=0;this.scrollBottom=this.rows-1;this.applicationKeypad=false;this.originMode=false;this.insertMode=false;this.wraparoundMode=false;this.normal=null;this.charset=null;this.gcharset=null;this.glevel=0;this.charsets=[null];this.element;this.children;this.refreshStart;this.refreshEnd;this.savedX;this.savedY;this.savedCols;this.readable=true;this.writable=true;this.defAttr=257<<9|256;this.curAttr=this.defAttr;this.params=[];this.currentParam=0;this.prefix="";this.postfix="";this.lines=[];var i=this.rows;while(i--){this.lines.push(this.blankLine())}this.tabs;this.setupStops()}require("./lib/colors")(Terminal);require("./lib/options")(Terminal);require("./lib/open")(Terminal);require("./lib/destroy")(Terminal);require("./lib/refresh")(Terminal);require("./lib/write")(Terminal);require("./lib/setgLevel");require("./lib/setgCharset");require("./lib/debug")(Terminal);require("./lib/stops")(Terminal);require("./lib/erase")(Terminal);require("./lib/blankLine")(Terminal);require("./lib/range")(Terminal);require("./lib/util")(Terminal);require("./lib/esc/index.js")(Terminal);require("./lib/esc/reset.js")(Terminal);require("./lib/esc/tabSet.js")(Terminal);require("./lib/csi/charAttributes")(Terminal);require("./lib/csi/insert-delete")(Terminal);require("./lib/csi/position")(Terminal);require("./lib/csi/cursor")(Terminal);require("./lib/csi/repeatPrecedingCharacter")(Terminal);require("./lib/csi/tabClear")(Terminal);require("./lib/csi/softReset")(Terminal);require("./lib/charsets.js")(Terminal)},{"./lib/blankLine":17,"./lib/charsets.js":18,"./lib/colors":19,"./lib/csi/charAttributes":20,"./lib/csi/cursor":21,"./lib/csi/insert-delete":22,"./lib/csi/position":23,"./lib/csi/repeatPrecedingCharacter":24,"./lib/csi/softReset":25,"./lib/csi/tabClear":26,"./lib/debug":27,"./lib/destroy":28,"./lib/erase":29,"./lib/esc/index.js":30,"./lib/esc/reset.js":31,"./lib/esc/tabSet.js":32,"./lib/open":33,"./lib/options":34,"./lib/range":35,"./lib/refresh":36,"./lib/setgCharset":37,"./lib/setgLevel":38,"./lib/states":39,"./lib/stops":40,"./lib/util":41,"./lib/write":42}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({q1fZ45:[function(require,module,exports){(function(){var exports,isArrayOfArrays,printer;exports=module.exports=function(arr,opts){if(typeof arr==="object"){if(!Array.isArray(arr)){return exports.tablifySingleDict(arr,opts)}else if(isArrayOfArrays(arr)){return exports.tablifyArrays(arr,opts)}else{return exports.tablifyDicts(arr,opts)}}else{throw new Error("tablify cannot handle non-objects")}};exports.tablify=exports;exports.tablifySingleDict=function(o,opts){var arr,k,v;arr=[];for(k in o){v=o[k];arr.push([k,v])}arr.sort(function(r1,r2){return r1[0].localeCompare(r2[0])});return exports.tablifyArrays(arr,opts)};exports.tablifyArrays=function(arr,opts){var c,row,_i,_len;c=new printer(opts);for(_i=0,_len=arr.length;_i<_len;_i++){row=arr[_i];c.push(row)}return c.stringify()};exports.tablifyDicts=function(arr,opts){var c,dict,i,k,known_keys,row,_i,_j,_k,_len,_len1,_len2,_ref;opts=opts||{};if(opts.has_header==null){opts.has_header=true}if(opts.show_index==null){opts.show_index=true}if(!opts.keys){known_keys={};for(_i=0,_len=arr.length;_i<_len;_i++){dict=arr[_i];for(k in dict){known_keys[k]=true}}opts.keys=function(){var _results;_results=[];for(k in known_keys){_results.push(k)}return _results}();opts.keys.sort()}c=new printer(opts);if(opts.has_header){row=function(){var _j,_len1,_ref,_results;_ref=opts.keys;_results=[];for(_j=0,_len1=_ref.length;_j<_len1;_j++){k=_ref[_j];_results.push(k)}return _results}();c.push(row)}for(i=_j=0,_len1=arr.length;_j<_len1;i=++_j){dict=arr[i];row=[];_ref=opts.keys;for(_k=0,_len2=_ref.length;_k<_len2;_k++){k=_ref[_k];row.push(dict[k]!=null?dict[k]:null)}c.push(row)}return c.stringify()};printer=function(){function printer(opts){this.opts=opts||{};this.opts.spacer=this.opts.spacer!=null?this.opts.spacer:" | ";this.opts.row_start=this.opts.row_start!=null?this.opts.row_start:"| ";this.opts.row_end=this.opts.row_end!=null?this.opts.row_end:" |";this.opts.row_sep_char=this.opts.row_sep_char!=null?this.opts.row_sep_char:"-";this.opts.has_header=this.opts.has_header!=null?this.opts.has_header:false;this.opts.show_index=this.opts.show_index!=null?this.opts.show_index:false;this.rows=[];this.col_widths=[];if(this.opts.border===false){opts.spacer=" ";this.opts.row_start=this.opts.row_end=this.opts.row_sep_char=""}}printer.prototype.push=function(row_to_push){var cell,i,row,row_num,_i,_len,_results;row=function(){var _i,_len,_results;_results=[];for(_i=0,_len=row_to_push.length;_i<_len;_i++){cell=row_to_push[_i];_results.push(cell)}return _results}();if(this.opts.show_index){row_num=this.rows.length;if(this.opts.has_header){row_num--}if(row_num<0){row.splice(0,0,"#")}else{row.splice(0,0,row_num)}}this.rows.push(row);_results=[];for(i=_i=0,_len=row.length;_i<_len;i=++_i){cell=row[i];if(this.col_widths[i]==null||this.col_widths[i]<this.len(cell)){_results.push(this.col_widths[i]=this.len(cell))}else{_results.push(void 0)}}return _results};printer.prototype.stringify=function(){var i,j,line,row,strs,total_width,width,_i,_j,_k,_len,_len1,_len2,_ref,_ref1,_ref2;strs=[];total_width=this.opts.row_start.length+this.opts.row_end.length;_ref=this.col_widths;for(_i=0,_len=_ref.length;_i<_len;_i++){width=_ref[_i];total_width+=width}total_width+=this.opts.spacer.length*(this.col_widths.length-1);if(this.opts.row_sep_char.length){strs.push(this.chars(this.opts.row_sep_char,total_width))}_ref1=this.rows;for(j=_j=0,_len1=_ref1.length;_j<_len1;j=++_j){row=_ref1[j];line=this.opts.row_start;_ref2=this.col_widths;for(i=_k=0,_len2=_ref2.length;_k<_len2;i=++_k){width=_ref2[i];line+=this.ljust(row[i]!=null?row[i]:"",width);if(i<this.col_widths.length-1){line+=this.opts.spacer}}line+=this.opts.row_end;strs.push(line);if(this.opts.row_sep_char){if(j===0&&this.opts.has_header){strs.push(this.chars(this.opts.row_sep_char,total_width))}}}if(this.opts.row_sep_char.length){strs.push(this.chars(this.opts.row_sep_char,total_width))}return strs.join("\n")};printer.prototype.toStr=function(o){var e;if(o===null){return"null"}else if(typeof o==="undefined"){return""}else if(typeof o==="object"){try{return JSON.stringify(o)}catch(_error){e=_error;return"["+e.message+"]"}}else{return o.toString()}};printer.prototype.len=function(o){return this.toStr(o).length};printer.prototype.chars=function(c,num){var i;return function(){var _i,_results;_results=[];for(i=_i=0;0<=num?_i<num:_i>num;i=0<=num?++_i:--_i){_results.push(c)}return _results}().join("")};printer.prototype.ljust=function(o,num){return""+this.toStr(o)+this.chars(" ",num-this.len(o))};printer.prototype.rjust=function(o,num){return""+this.chars(" ",num-this.len(o))+this.toStr(o)};return printer}();isArrayOfArrays=function(arr){var x,_i,_len;for(_i=0,_len=arr.length;_i<_len;_i++){x=arr[_i];if(!Array.isArray(x)){return false}}return true}}).call(this)},{}],tablify:[function(require,module,exports){module.exports=require("q1fZ45")},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({"8iH0Vg":[function(require,module,exports){var XHR=XMLHttpRequest;if(!XHR)throw new Error("missing XMLHttpRequest");module.exports=request;request.log={trace:noop,debug:noop,info:noop,warn:noop,error:noop};var DEFAULT_TIMEOUT=3*60*1e3;function request(options,callback){if(typeof callback!=="function")throw new Error("Bad callback given: "+callback);if(!options)throw new Error("No options given");var options_onResponse=options.onResponse;if(typeof options==="string")options={uri:options};else options=JSON.parse(JSON.stringify(options));options.onResponse=options_onResponse;if(options.verbose)request.log=getLogger();if(options.url){options.uri=options.url;delete options.url}if(!options.uri&&options.uri!=="")throw new Error("options.uri is a required argument");if(typeof options.uri!="string")throw new Error("options.uri must be a string");var unsupported_options=["proxy","_redirectsFollowed","maxRedirects","followRedirect"];for(var i=0;i<unsupported_options.length;i++)if(options[unsupported_options[i]])throw new Error("options."+unsupported_options[i]+" is not supported");options.callback=callback;options.method=options.method||"GET";options.headers=options.headers||{};options.body=options.body||null;options.timeout=options.timeout||request.DEFAULT_TIMEOUT;if(options.headers.host)throw new Error("Options.headers.host is not supported");if(options.json){options.headers.accept=options.headers.accept||"application/json";if(options.method!=="GET")options.headers["content-type"]="application/json";if(typeof options.json!=="boolean")options.body=JSON.stringify(options.json);else if(typeof options.body!=="string")options.body=JSON.stringify(options.body)}options.onResponse=options.onResponse||noop;if(options.onResponse===true){options.onResponse=callback;options.callback=noop}if(!options.headers.authorization&&options.auth)options.headers.authorization="Basic "+b64_enc(options.auth.username+":"+options.auth.password);return run_xhr(options)}var req_seq=0;function run_xhr(options){var xhr=new XHR,timed_out=false,is_cors=is_crossDomain(options.uri),supports_cors="withCredentials"in xhr;req_seq+=1;xhr.seq_id=req_seq;xhr.id=req_seq+": "+options.method+" "+options.uri;xhr._id=xhr.id;if(is_cors&&!supports_cors){var cors_err=new Error("Browser does not support cross-origin request: "+options.uri);cors_err.cors="unsupported";return options.callback(cors_err,xhr)}xhr.timeoutTimer=setTimeout(too_late,options.timeout);function too_late(){timed_out=true;var er=new Error("ETIMEDOUT");er.code="ETIMEDOUT";er.duration=options.timeout;request.log.error("Timeout",{id:xhr._id,milliseconds:options.timeout});return options.callback(er,xhr)}var did={response:false,loading:false,end:false};xhr.onreadystatechange=on_state_change;xhr.open(options.method,options.uri,true);if(is_cors)xhr.withCredentials=!!options.withCredentials;xhr.send(options.body);return xhr;function on_state_change(event){if(timed_out)return request.log.debug("Ignoring timed out state change",{state:xhr.readyState,id:xhr.id});request.log.debug("State change",{state:xhr.readyState,id:xhr.id,timed_out:timed_out});if(xhr.readyState===XHR.OPENED){request.log.debug("Request started",{id:xhr.id});for(var key in options.headers)xhr.setRequestHeader(key,options.headers[key])}else if(xhr.readyState===XHR.HEADERS_RECEIVED)on_response();else if(xhr.readyState===XHR.LOADING){on_response();on_loading()}else if(xhr.readyState===XHR.DONE){on_response();on_loading();on_end()}}function on_response(){if(did.response)return;did.response=true;request.log.debug("Got response",{id:xhr.id,status:xhr.status});clearTimeout(xhr.timeoutTimer);xhr.statusCode=xhr.status;if(is_cors&&xhr.statusCode==0){var cors_err=new Error("CORS request rejected: "+options.uri);cors_err.cors="rejected";did.loading=true;did.end=true;return options.callback(cors_err,xhr)}options.onResponse(null,xhr)}function on_loading(){if(did.loading)return;did.loading=true;request.log.debug("Response body loading",{id:xhr.id})}function on_end(){if(did.end)return;did.end=true;request.log.debug("Request done",{id:xhr.id});xhr.body=xhr.responseText;if(options.json){try{xhr.body=JSON.parse(xhr.responseText)}catch(er){return options.callback(er,xhr)}}options.callback(null,xhr,xhr.body)}}request.withCredentials=false;request.DEFAULT_TIMEOUT=DEFAULT_TIMEOUT;request.defaults=function(options,requester){var def=function(method){var d=function(params,callback){if(typeof params==="string")params={uri:params};else{params=JSON.parse(JSON.stringify(params))}for(var i in options){if(params[i]===undefined)params[i]=options[i]}return method(params,callback)};return d};var de=def(request);de.get=def(request.get);de.post=def(request.post);de.put=def(request.put);de.head=def(request.head);return de};var shortcuts=["get","put","post","head"];shortcuts.forEach(function(shortcut){var method=shortcut.toUpperCase();var func=shortcut.toLowerCase();request[func]=function(opts){if(typeof opts==="string")opts={method:method,uri:opts}; | |
else{opts=JSON.parse(JSON.stringify(opts));opts.method=method}var args=[opts].concat(Array.prototype.slice.apply(arguments,[1]));return request.apply(this,args)}});request.couch=function(options,callback){if(typeof options==="string")options={uri:options};options.json=true;if(options.body)options.json=options.body;delete options.body;callback=callback||noop;var xhr=request(options,couch_handler);return xhr;function couch_handler(er,resp,body){if(er)return callback(er,resp,body);if((resp.statusCode<200||resp.statusCode>299)&&body.error){er=new Error("CouchDB error: "+(body.error.reason||body.error.error));for(var key in body)er[key]=body[key];return callback(er,resp,body)}return callback(er,resp,body)}};function noop(){}function getLogger(){var logger={},levels=["trace","debug","info","warn","error"],level,i;for(i=0;i<levels.length;i++){level=levels[i];logger[level]=noop;if(typeof console!=="undefined"&&console&&console[level])logger[level]=formatted(console,level)}return logger}function formatted(obj,method){return formatted_logger;function formatted_logger(str,context){if(typeof context==="object")str+=" "+JSON.stringify(context);return obj[method].call(obj,str)}}function is_crossDomain(url){var rurl=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/;var ajaxLocation;try{ajaxLocation=location.href}catch(e){ajaxLocation=document.createElement("a");ajaxLocation.href="";ajaxLocation=ajaxLocation.href}var ajaxLocParts=rurl.exec(ajaxLocation.toLowerCase())||[],parts=rurl.exec(url.toLowerCase());var result=!!(parts&&(parts[1]!=ajaxLocParts[1]||parts[2]!=ajaxLocParts[2]||(parts[3]||(parts[1]==="http:"?80:443))!=(ajaxLocParts[3]||(ajaxLocParts[1]==="http:"?80:443))));return result}function b64_enc(data){var b64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc="",tmp_arr=[];if(!data){return data}do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&63;h2=bits>>12&63;h3=bits>>6&63;h4=bits&63;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4)}while(i<data.length);enc=tmp_arr.join("");switch(data.length%3){case 1:enc=enc.slice(0,-2)+"==";break;case 2:enc=enc.slice(0,-1)+"=";break}return enc}},{}],"browser-request":[function(require,module,exports){module.exports=require("8iH0Vg")},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){(function(global){(function(root){var freeExports=typeof exports=="object"&&exports;var freeModule=typeof module=="object"&&module&&module.exports==freeExports&&module;var freeGlobal=typeof global=="object"&&global;if(freeGlobal.global===freeGlobal||freeGlobal.window===freeGlobal){root=freeGlobal}var punycode,maxInt=2147483647,base=36,tMin=1,tMax=26,skew=38,damp=700,initialBias=72,initialN=128,delimiter="-",regexPunycode=/^xn--/,regexNonASCII=/[^ -~]/,regexSeparators=/\x2E|\u3002|\uFF0E|\uFF61/g,errors={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},baseMinusTMin=base-tMin,floor=Math.floor,stringFromCharCode=String.fromCharCode,key;function error(type){throw RangeError(errors[type])}function map(array,fn){var length=array.length;while(length--){array[length]=fn(array[length])}return array}function mapDomain(string,fn){return map(string.split(regexSeparators),fn).join(".")}function ucs2decode(string){var output=[],counter=0,length=string.length,value,extra;while(counter<length){value=string.charCodeAt(counter++);if(value>=55296&&value<=56319&&counter<length){extra=string.charCodeAt(counter++);if((extra&64512)==56320){output.push(((value&1023)<<10)+(extra&1023)+65536)}else{output.push(value);counter--}}else{output.push(value)}}return output}function ucs2encode(array){return map(array,function(value){var output="";if(value>65535){value-=65536;output+=stringFromCharCode(value>>>10&1023|55296);value=56320|value&1023}output+=stringFromCharCode(value);return output}).join("")}function basicToDigit(codePoint){if(codePoint-48<10){return codePoint-22}if(codePoint-65<26){return codePoint-65}if(codePoint-97<26){return codePoint-97}return base}function digitToBasic(digit,flag){return digit+22+75*(digit<26)-((flag!=0)<<5)}function adapt(delta,numPoints,firstTime){var k=0;delta=firstTime?floor(delta/damp):delta>>1;delta+=floor(delta/numPoints);for(;delta>baseMinusTMin*tMax>>1;k+=base){delta=floor(delta/baseMinusTMin)}return floor(k+(baseMinusTMin+1)*delta/(delta+skew))}function decode(input){var output=[],inputLength=input.length,out,i=0,n=initialN,bias=initialBias,basic,j,index,oldi,w,k,digit,t,baseMinusT;basic=input.lastIndexOf(delimiter);if(basic<0){basic=0}for(j=0;j<basic;++j){if(input.charCodeAt(j)>=128){error("not-basic")}output.push(input.charCodeAt(j))}for(index=basic>0?basic+1:0;index<inputLength;){for(oldi=i,w=1,k=base;;k+=base){if(index>=inputLength){error("invalid-input")}digit=basicToDigit(input.charCodeAt(index++));if(digit>=base||digit>floor((maxInt-i)/w)){error("overflow")}i+=digit*w;t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(digit<t){break}baseMinusT=base-t;if(w>floor(maxInt/baseMinusT)){error("overflow")}w*=baseMinusT}out=output.length+1;bias=adapt(i-oldi,out,oldi==0);if(floor(i/out)>maxInt-n){error("overflow")}n+=floor(i/out);i%=out;output.splice(i++,0,n)}return ucs2encode(output)}function encode(input){var n,delta,handledCPCount,basicLength,bias,j,m,q,k,t,currentValue,output=[],inputLength,handledCPCountPlusOne,baseMinusT,qMinusT;input=ucs2decode(input);inputLength=input.length;n=initialN;delta=0;bias=initialBias;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<128){output.push(stringFromCharCode(currentValue))}}handledCPCount=basicLength=output.length;if(basicLength){output.push(delimiter)}while(handledCPCount<inputLength){for(m=maxInt,j=0;j<inputLength;++j){currentValue=input[j];if(currentValue>=n&¤tValue<m){m=currentValue}}handledCPCountPlusOne=handledCPCount+1;if(m-n>floor((maxInt-delta)/handledCPCountPlusOne)){error("overflow")}delta+=(m-n)*handledCPCountPlusOne;n=m;for(j=0;j<inputLength;++j){currentValue=input[j];if(currentValue<n&&++delta>maxInt){error("overflow")}if(currentValue==n){for(q=delta,k=base;;k+=base){t=k<=bias?tMin:k>=bias+tMax?tMax:k-bias;if(q<t){break}qMinusT=q-t;baseMinusT=base-t;output.push(stringFromCharCode(digitToBasic(t+qMinusT%baseMinusT,0)));q=floor(qMinusT/baseMinusT)}output.push(stringFromCharCode(digitToBasic(q,0)));bias=adapt(delta,handledCPCountPlusOne,handledCPCount==basicLength);delta=0;++handledCPCount}}++delta;++n}return output.join("")}function toUnicode(domain){return mapDomain(domain,function(string){return regexPunycode.test(string)?decode(string.slice(4).toLowerCase()):string})}function toASCII(domain){return mapDomain(domain,function(string){return regexNonASCII.test(string)?"xn--"+encode(string):string})}punycode={version:"1.2.4",ucs2:{decode:ucs2decode,encode:ucs2encode},decode:decode,encode:encode,toASCII:toASCII,toUnicode:toUnicode};if(typeof define=="function"&&typeof define.amd=="object"&&define.amd){define("punycode",function(){return punycode})}else if(freeExports&&!freeExports.nodeType){if(freeModule){freeModule.exports=punycode}else{for(key in punycode){punycode.hasOwnProperty(key)&&(freeExports[key]=punycode[key])}}}else{root.punycode=punycode}})(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],2:[function(require,module,exports){"use strict";function hasOwnProperty(obj,prop){return Object.prototype.hasOwnProperty.call(obj,prop)}module.exports=function(qs,sep,eq,options){sep=sep||"&";eq=eq||"=";var obj={};if(typeof qs!=="string"||qs.length===0){return obj}var regexp=/\+/g;qs=qs.split(sep);var maxKeys=1e3;if(options&&typeof options.maxKeys==="number"){maxKeys=options.maxKeys}var len=qs.length;if(maxKeys>0&&len>maxKeys){len=maxKeys}for(var i=0;i<len;++i){var x=qs[i].replace(regexp,"%20"),idx=x.indexOf(eq),kstr,vstr,k,v;if(idx>=0){kstr=x.substr(0,idx);vstr=x.substr(idx+1)}else{kstr=x;vstr=""}k=decodeURIComponent(kstr);v=decodeURIComponent(vstr);if(!hasOwnProperty(obj,k)){obj[k]=v}else if(isArray(obj[k])){obj[k].push(v)}else{obj[k]=[obj[k],v]}}return obj};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"}},{}],3:[function(require,module,exports){"use strict";var stringifyPrimitive=function(v){switch(typeof v){case"string":return v;case"boolean":return v?"true":"false";case"number":return isFinite(v)?v:"";default:return""}};module.exports=function(obj,sep,eq,name){sep=sep||"&";eq=eq||"=";if(obj===null){obj=undefined}if(typeof obj==="object"){return map(objectKeys(obj),function(k){var ks=encodeURIComponent(stringifyPrimitive(k))+eq;if(isArray(obj[k])){return obj[k].map(function(v){return ks+encodeURIComponent(stringifyPrimitive(v))}).join(sep)}else{return ks+encodeURIComponent(stringifyPrimitive(obj[k]))}}).join(sep)}if(!name)return"";return encodeURIComponent(stringifyPrimitive(name))+eq+encodeURIComponent(stringifyPrimitive(obj))};var isArray=Array.isArray||function(xs){return Object.prototype.toString.call(xs)==="[object Array]"};function map(xs,f){if(xs.map)return xs.map(f);var res=[];for(var i=0;i<xs.length;i++){res.push(f(xs[i],i))}return res}var objectKeys=Object.keys||function(obj){var res=[];for(var key in obj){if(Object.prototype.hasOwnProperty.call(obj,key))res.push(key)}return res}},{}],4:[function(require,module,exports){"use strict";exports.decode=exports.parse=require("./decode");exports.encode=exports.stringify=require("./encode")},{"./decode":2,"./encode":3}],Vhv19d:[function(require,module,exports){(function(){"use strict";var punycode=require("punycode");exports.parse=urlParse;exports.resolve=urlResolve;exports.resolveObject=urlResolveObject;exports.format=urlFormat;var protocolPattern=/^([a-z0-9.+-]+:)/i,portPattern=/:[0-9]*$/,delims=["<",">",'"',"`"," ","\r","\n"," "],unwise=["{","}","|","\\","^","~","`"].concat(delims),autoEscape=["'"].concat(delims),nonHostChars=["%","/","?",";","#"].concat(unwise).concat(autoEscape),nonAuthChars=["/","@","?","#"].concat(delims),hostnameMaxLen=255,hostnamePartPattern=/^[a-zA-Z0-9][a-z0-9A-Z_-]{0,62}$/,hostnamePartStart=/^([a-zA-Z0-9][a-z0-9A-Z_-]{0,62})(.*)$/,unsafeProtocol={javascript:true,"javascript:":true},hostlessProtocol={javascript:true,"javascript:":true},pathedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"ftp:":true,"gopher:":true,"file:":true},slashedProtocol={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},querystring=require("querystring");function urlParse(url,parseQueryString,slashesDenoteHost){if(url&&typeof url==="object"&&url.href)return url;if(typeof url!=="string"){throw new TypeError("Parameter 'url' must be a string, not "+typeof url)}var out={},rest=url;rest=rest.trim();var proto=protocolPattern.exec(rest);if(proto){proto=proto[0];var lowerProto=proto.toLowerCase();out.protocol=lowerProto;rest=rest.substr(proto.length)}if(slashesDenoteHost||proto||rest.match(/^\/\/[^@\/]+@[^@\/]+/)){var slashes=rest.substr(0,2)==="//";if(slashes&&!(proto&&hostlessProtocol[proto])){rest=rest.substr(2);out.slashes=true}}if(!hostlessProtocol[proto]&&(slashes||proto&&!slashedProtocol[proto])){var atSign=rest.indexOf("@");if(atSign!==-1){var auth=rest.slice(0,atSign);var hasAuth=true;for(var i=0,l=nonAuthChars.length;i<l;i++){if(auth.indexOf(nonAuthChars[i])!==-1){hasAuth=false;break}}if(hasAuth){out.auth=decodeURIComponent(auth);rest=rest.substr(atSign+1)}}var firstNonHost=-1;for(var i=0,l=nonHostChars.length;i<l;i++){var index=rest.indexOf(nonHostChars[i]);if(index!==-1&&(firstNonHost<0||index<firstNonHost))firstNonHost=index}if(firstNonHost!==-1){out.host=rest.substr(0,firstNonHost);rest=rest.substr(firstNonHost)}else{out.host=rest;rest=""}var p=parseHost(out.host);var keys=Object.keys(p);for(var i=0,l=keys.length;i<l;i++){var key=keys[i];out[key]=p[key]}out.hostname=out.hostname||"";var ipv6Hostname=out.hostname[0]==="["&&out.hostname[out.hostname.length-1]==="]";if(out.hostname.length>hostnameMaxLen){out.hostname=""}else if(!ipv6Hostname){var hostparts=out.hostname.split(/\./);for(var i=0,l=hostparts.length;i<l;i++){var part=hostparts[i];if(!part)continue;if(!part.match(hostnamePartPattern)){var newpart="";for(var j=0,k=part.length;j<k;j++){if(part.charCodeAt(j)>127){newpart+="x"}else{newpart+=part[j]}}if(!newpart.match(hostnamePartPattern)){var validParts=hostparts.slice(0,i);var notHost=hostparts.slice(i+1);var bit=part.match(hostnamePartStart);if(bit){validParts.push(bit[1]);notHost.unshift(bit[2])}if(notHost.length){rest="/"+notHost.join(".")+rest}out.hostname=validParts.join(".");break}}}}out.hostname=out.hostname.toLowerCase();if(!ipv6Hostname){var domainArray=out.hostname.split(".");var newOut=[];for(var i=0;i<domainArray.length;++i){var s=domainArray[i];newOut.push(s.match(/[^A-Za-z0-9_-]/)?"xn--"+punycode.encode(s):s)}out.hostname=newOut.join(".")}out.host=(out.hostname||"")+(out.port?":"+out.port:"");out.href+=out.host;if(ipv6Hostname){out.hostname=out.hostname.substr(1,out.hostname.length-2);if(rest[0]!=="/"){rest="/"+rest}}}if(!unsafeProtocol[lowerProto]){for(var i=0,l=autoEscape.length;i<l;i++){var ae=autoEscape[i];var esc=encodeURIComponent(ae);if(esc===ae){esc=escape(ae)}rest=rest.split(ae).join(esc)}}var hash=rest.indexOf("#");if(hash!==-1){out.hash=rest.substr(hash);rest=rest.slice(0,hash)}var qm=rest.indexOf("?");if(qm!==-1){out.search=rest.substr(qm);out.query=rest.substr(qm+1);if(parseQueryString){out.query=querystring.parse(out.query)}rest=rest.slice(0,qm)}else if(parseQueryString){out.search="";out.query={}}if(rest)out.pathname=rest;if(slashedProtocol[proto]&&out.hostname&&!out.pathname){out.pathname="/"}if(out.pathname||out.search){out.path=(out.pathname?out.pathname:"")+(out.search?out.search:"")}out.href=urlFormat(out);return out}function urlFormat(obj){if(typeof obj==="string")obj=urlParse(obj);var auth=obj.auth||"";if(auth){auth=encodeURIComponent(auth);auth=auth.replace(/%3A/i,":");auth+="@"}var protocol=obj.protocol||"",pathname=obj.pathname||"",hash=obj.hash||"",host=false,query="";if(obj.host!==undefined){host=auth+obj.host}else if(obj.hostname!==undefined){host=auth+(obj.hostname.indexOf(":")===-1?obj.hostname:"["+obj.hostname+"]");if(obj.port){host+=":"+obj.port}}if(obj.query&&typeof obj.query==="object"&&Object.keys(obj.query).length){query=querystring.stringify(obj.query)}var search=obj.search||query&&"?"+query||"";if(protocol&&protocol.substr(-1)!==":")protocol+=":";if(obj.slashes||(!protocol||slashedProtocol[protocol])&&host!==false){host="//"+(host||"");if(pathname&&pathname.charAt(0)!=="/")pathname="/"+pathname}else if(!host){host=""}if(hash&&hash.charAt(0)!=="#")hash="#"+hash;if(search&&search.charAt(0)!=="?")search="?"+search;return protocol+host+pathname+search+hash}function urlResolve(source,relative){return urlFormat(urlResolveObject(source,relative))}function urlResolveObject(source,relative){if(!source)return relative;source=urlParse(urlFormat(source),false,true);relative=urlParse(urlFormat(relative),false,true);source.hash=relative.hash;if(relative.href===""){source.href=urlFormat(source);return source}if(relative.slashes&&!relative.protocol){relative.protocol=source.protocol;if(slashedProtocol[relative.protocol]&&relative.hostname&&!relative.pathname){relative.path=relative.pathname="/"}relative.href=urlFormat(relative);return relative}if(relative.protocol&&relative.protocol!==source.protocol){if(!slashedProtocol[relative.protocol]){relative.href=urlFormat(relative);return relative}source.protocol=relative.protocol;if(!relative.host&&!hostlessProtocol[relative.protocol]){var relPath=(relative.pathname||"").split("/");while(relPath.length&&!(relative.host=relPath.shift()));if(!relative.host)relative.host="";if(!relative.hostname)relative.hostname="";if(relPath[0]!=="")relPath.unshift("");if(relPath.length<2)relPath.unshift("");relative.pathname=relPath.join("/")}source.pathname=relative.pathname;source.search=relative.search;source.query=relative.query;source.host=relative.host||"";source.auth=relative.auth;source.hostname=relative.hostname||relative.host;source.port=relative.port;if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.slashes=source.slashes||relative.slashes;source.href=urlFormat(source);return source}var isSourceAbs=source.pathname&&source.pathname.charAt(0)==="/",isRelAbs=relative.host!==undefined||relative.pathname&&relative.pathname.charAt(0)==="/",mustEndAbs=isRelAbs||isSourceAbs||source.host&&relative.pathname,removeAllDots=mustEndAbs,srcPath=source.pathname&&source.pathname.split("/")||[],relPath=relative.pathname&&relative.pathname.split("/")||[],psychotic=source.protocol&&!slashedProtocol[source.protocol];if(psychotic){delete source.hostname;delete source.port;if(source.host){if(srcPath[0]==="")srcPath[0]=source.host;else srcPath.unshift(source.host)}delete source.host;if(relative.protocol){delete relative.hostname;delete relative.port;if(relative.host){if(relPath[0]==="")relPath[0]=relative.host;else relPath.unshift(relative.host)}delete relative.host}mustEndAbs=mustEndAbs&&(relPath[0]===""||srcPath[0]==="")}if(isRelAbs){source.host=relative.host||relative.host===""?relative.host:source.host;source.hostname=relative.hostname||relative.hostname===""?relative.hostname:source.hostname;source.search=relative.search;source.query=relative.query;srcPath=relPath}else if(relPath.length){if(!srcPath)srcPath=[];srcPath.pop();srcPath=srcPath.concat(relPath);source.search=relative.search;source.query=relative.query}else if("search"in relative){if(psychotic){source.hostname=source.host=srcPath.shift();var authInHost=source.host&&source.host.indexOf("@")>0?source.host.split("@"):false;if(authInHost){source.auth=authInHost.shift();source.host=source.hostname=authInHost.shift()}}source.search=relative.search;source.query=relative.query;if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.href=urlFormat(source);return source}if(!srcPath.length){delete source.pathname;if(!source.search){source.path="/"+source.search}else{delete source.path}source.href=urlFormat(source);return source}var last=srcPath.slice(-1)[0];var hasTrailingSlash=(source.host||relative.host)&&(last==="."||last==="..")||last==="";var up=0;for(var i=srcPath.length;i>=0;i--){last=srcPath[i];if(last=="."){srcPath.splice(i,1)}else if(last===".."){srcPath.splice(i,1);up++}else if(up){srcPath.splice(i,1);up--}}if(!mustEndAbs&&!removeAllDots){for(;up--;up){srcPath.unshift("..")}}if(mustEndAbs&&srcPath[0]!==""&&(!srcPath[0]||srcPath[0].charAt(0)!=="/")){srcPath.unshift("")}if(hasTrailingSlash&&srcPath.join("/").substr(-1)!=="/"){srcPath.push("")}var isAbsolute=srcPath[0]===""||srcPath[0]&&srcPath[0].charAt(0)==="/";if(psychotic){source.hostname=source.host=isAbsolute?"":srcPath.length?srcPath.shift():"";var authInHost=source.host&&source.host.indexOf("@")>0?source.host.split("@"):false;if(authInHost){source.auth=authInHost.shift();source.host=source.hostname=authInHost.shift()}}mustEndAbs=mustEndAbs||source.host&&srcPath.length;if(mustEndAbs&&!isAbsolute){srcPath.unshift("")}source.pathname=srcPath.join("/");if(source.pathname!==undefined||source.search!==undefined){source.path=(source.pathname?source.pathname:"")+(source.search?source.search:"")}source.auth=relative.auth||source.auth;source.slashes=source.slashes||relative.slashes;source.href=urlFormat(source);return source}function parseHost(host){var out={};var port=portPattern.exec(host);if(port){port=port[0];if(port!==":"){out.port=port.substr(1)}host=host.substr(0,host.length-port.length)}if(host)out.hostname=host;return out}})()},{punycode:1,querystring:4}],url:[function(require,module,exports){module.exports=require("Vhv19d")},{}]},{},[]);require=function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({iROhDJ:[function(require,module,exports){(function(global){(function(undefined){var moment,VERSION="2.6.0",globalScope=typeof global!=="undefined"?global:this,oldGlobalMoment,round=Math.round,i,YEAR=0,MONTH=1,DATE=2,HOUR=3,MINUTE=4,SECOND=5,MILLISECOND=6,languages={},momentProperties={_isAMomentObject:null,_i:null,_f:null,_l:null,_strict:null,_isUTC:null,_offset:null,_pf:null,_lang:null},hasModule=typeof module!=="undefined"&&module.exports,aspNetJsonRegex=/^\/?Date\((\-?\d+)/i,aspNetTimeSpanJsonRegex=/(\-)?(?:(\d*)\.)?(\d+)\:(\d+)(?:\:(\d+)\.?(\d{3})?)?/,isoDurationRegex=/^(-)?P(?:(?:([0-9,.]*)Y)?(?:([0-9,.]*)M)?(?:([0-9,.]*)D)?(?:T(?:([0-9,.]*)H)?(?:([0-9,.]*)M)?(?:([0-9,.]*)S)?)?|([0-9,.]*)W)$/,formattingTokens=/(\[[^\[]*\])|(\\)?(Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Q|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|mm?|ss?|S{1,4}|X|zz?|ZZ?|.)/g,localFormattingTokens=/(\[[^\[]*\])|(\\)?(LT|LL?L?L?|l{1,4})/g,parseTokenOneOrTwoDigits=/\d\d?/,parseTokenOneToThreeDigits=/\d{1,3}/,parseTokenOneToFourDigits=/\d{1,4}/,parseTokenOneToSixDigits=/[+\-]?\d{1,6}/,parseTokenDigits=/\d+/,parseTokenWord=/[0-9]*['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+|[\u0600-\u06FF\/]+(\s*?[\u0600-\u06FF]+){1,2}/i,parseTokenTimezone=/Z|[\+\-]\d\d:?\d\d/gi,parseTokenT=/T/i,parseTokenTimestampMs=/[\+\-]?\d+(\.\d{1,3})?/,parseTokenOrdinal=/\d{1,2}/,parseTokenOneDigit=/\d/,parseTokenTwoDigits=/\d\d/,parseTokenThreeDigits=/\d{3}/,parseTokenFourDigits=/\d{4}/,parseTokenSixDigits=/[+-]?\d{6}/,parseTokenSignedNumber=/[+-]?\d+/,isoRegex=/^\s*(?:[+-]\d{6}|\d{4})-(?:(\d\d-\d\d)|(W\d\d$)|(W\d\d-\d)|(\d\d\d))((T| )(\d\d(:\d\d(:\d\d(\.\d+)?)?)?)?([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/,isoFormat="YYYY-MM-DDTHH:mm:ssZ",isoDates=[["YYYYYY-MM-DD",/[+-]\d{6}-\d{2}-\d{2}/],["YYYY-MM-DD",/\d{4}-\d{2}-\d{2}/],["GGGG-[W]WW-E",/\d{4}-W\d{2}-\d/],["GGGG-[W]WW",/\d{4}-W\d{2}/],["YYYY-DDD",/\d{4}-\d{3}/]],isoTimes=[["HH:mm:ss.SSSS",/(T| )\d\d:\d\d:\d\d\.\d+/],["HH:mm:ss",/(T| )\d\d:\d\d:\d\d/],["HH:mm",/(T| )\d\d:\d\d/],["HH",/(T| )\d\d/]],parseTimezoneChunker=/([\+\-]|\d\d)/gi,proxyGettersAndSetters="Date|Hours|Minutes|Seconds|Milliseconds".split("|"),unitMillisecondFactors={Milliseconds:1,Seconds:1e3,Minutes:6e4,Hours:36e5,Days:864e5,Months:2592e6,Years:31536e6},unitAliases={ms:"millisecond",s:"second",m:"minute",h:"hour",d:"day",D:"date",w:"week",W:"isoWeek",M:"month",Q:"quarter",y:"year",DDD:"dayOfYear",e:"weekday",E:"isoWeekday",gg:"weekYear",GG:"isoWeekYear"},camelFunctions={dayofyear:"dayOfYear",isoweekday:"isoWeekday",isoweek:"isoWeek",weekyear:"weekYear",isoweekyear:"isoWeekYear"},formatFunctions={},ordinalizeTokens="DDD w W M D d".split(" "),paddedTokens="M D H h m s w W".split(" "),formatTokenFunctions={M:function(){return this.month()+1},MMM:function(format){return this.lang().monthsShort(this,format)},MMMM:function(format){return this.lang().months(this,format)},D:function(){return this.date()},DDD:function(){return this.dayOfYear()},d:function(){return this.day()},dd:function(format){return this.lang().weekdaysMin(this,format)},ddd:function(format){return this.lang().weekdaysShort(this,format)},dddd:function(format){return this.lang().weekdays(this,format)},w:function(){return this.week()},W:function(){return this.isoWeek()},YY:function(){return leftZeroFill(this.year()%100,2)},YYYY:function(){return leftZeroFill(this.year(),4)},YYYYY:function(){return leftZeroFill(this.year(),5)},YYYYYY:function(){var y=this.year(),sign=y>=0?"+":"-";return sign+leftZeroFill(Math.abs(y),6)},gg:function(){return leftZeroFill(this.weekYear()%100,2)},gggg:function(){return leftZeroFill(this.weekYear(),4)},ggggg:function(){return leftZeroFill(this.weekYear(),5)},GG:function(){return leftZeroFill(this.isoWeekYear()%100,2)},GGGG:function(){return leftZeroFill(this.isoWeekYear(),4)},GGGGG:function(){return leftZeroFill(this.isoWeekYear(),5)},e:function(){return this.weekday()},E:function(){return this.isoWeekday()},a:function(){return this.lang().meridiem(this.hours(),this.minutes(),true)},A:function(){return this.lang().meridiem(this.hours(),this.minutes(),false)},H:function(){return this.hours()},h:function(){return this.hours()%12||12},m:function(){return this.minutes()},s:function(){return this.seconds()},S:function(){return toInt(this.milliseconds()/100)},SS:function(){return leftZeroFill(toInt(this.milliseconds()/10),2)},SSS:function(){return leftZeroFill(this.milliseconds(),3)},SSSS:function(){return leftZeroFill(this.milliseconds(),3)},Z:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+leftZeroFill(toInt(a/60),2)+":"+leftZeroFill(toInt(a)%60,2)},ZZ:function(){var a=-this.zone(),b="+";if(a<0){a=-a;b="-"}return b+leftZeroFill(toInt(a/60),2)+leftZeroFill(toInt(a)%60,2)},z:function(){return this.zoneAbbr()},zz:function(){return this.zoneName()},X:function(){return this.unix()},Q:function(){return this.quarter()}},lists=["months","monthsShort","weekdays","weekdaysShort","weekdaysMin"];function defaultParsingFlags(){return{empty:false,unusedTokens:[],unusedInput:[],overflow:-2,charsLeftOver:0,nullInput:false,invalidMonth:null,invalidFormat:false,userInvalidated:false,iso:false}}function deprecate(msg,fn){var firstTime=true;function printMsg(){if(moment.suppressDeprecationWarnings===false&&typeof console!=="undefined"&&console.warn){console.warn("Deprecation warning: "+msg)}}return extend(function(){if(firstTime){printMsg();firstTime=false}return fn.apply(this,arguments)},fn)}function padToken(func,count){return function(a){return leftZeroFill(func.call(this,a),count)}}function ordinalizeToken(func,period){return function(a){return this.lang().ordinal(func.call(this,a),period)}}while(ordinalizeTokens.length){i=ordinalizeTokens.pop();formatTokenFunctions[i+"o"]=ordinalizeToken(formatTokenFunctions[i],i)}while(paddedTokens.length){i=paddedTokens.pop();formatTokenFunctions[i+i]=padToken(formatTokenFunctions[i],2)}formatTokenFunctions.DDDD=padToken(formatTokenFunctions.DDD,3);function Language(){}function Moment(config){checkOverflow(config);extend(this,config)}function Duration(duration){var normalizedInput=normalizeObjectUnits(duration),years=normalizedInput.year||0,quarters=normalizedInput.quarter||0,months=normalizedInput.month||0,weeks=normalizedInput.week||0,days=normalizedInput.day||0,hours=normalizedInput.hour||0,minutes=normalizedInput.minute||0,seconds=normalizedInput.second||0,milliseconds=normalizedInput.millisecond||0;this._milliseconds=+milliseconds+seconds*1e3+minutes*6e4+hours*36e5;this._days=+days+weeks*7;this._months=+months+quarters*3+years*12;this._data={};this._bubble()}function extend(a,b){for(var i in b){if(b.hasOwnProperty(i)){a[i]=b[i]}}if(b.hasOwnProperty("toString")){a.toString=b.toString}if(b.hasOwnProperty("valueOf")){a.valueOf=b.valueOf}return a}function cloneMoment(m){var result={},i;for(i in m){if(m.hasOwnProperty(i)&&momentProperties.hasOwnProperty(i)){result[i]=m[i]}}return result}function absRound(number){if(number<0){return Math.ceil(number)}else{return Math.floor(number)}}function leftZeroFill(number,targetLength,forceSign){var output=""+Math.abs(number),sign=number>=0;while(output.length<targetLength){output="0"+output}return(sign?forceSign?"+":"":"-")+output}function addOrSubtractDurationFromMoment(mom,duration,isAdding,updateOffset){var milliseconds=duration._milliseconds,days=duration._days,months=duration._months;updateOffset=updateOffset==null?true:updateOffset;if(milliseconds){mom._d.setTime(+mom._d+milliseconds*isAdding)}if(days){rawSetter(mom,"Date",rawGetter(mom,"Date")+days*isAdding)}if(months){rawMonthSetter(mom,rawGetter(mom,"Month")+months*isAdding)}if(updateOffset){moment.updateOffset(mom,days||months)}}function isArray(input){return Object.prototype.toString.call(input)==="[object Array]"}function isDate(input){return Object.prototype.toString.call(input)==="[object Date]"||input instanceof Date}function compareArrays(array1,array2,dontConvert){var len=Math.min(array1.length,array2.length),lengthDiff=Math.abs(array1.length-array2.length),diffs=0,i;for(i=0;i<len;i++){if(dontConvert&&array1[i]!==array2[i]||!dontConvert&&toInt(array1[i])!==toInt(array2[i])){diffs++}}return diffs+lengthDiff}function normalizeUnits(units){if(units){var lowered=units.toLowerCase().replace(/(.)s$/,"$1");units=unitAliases[units]||camelFunctions[lowered]||lowered}return units}function normalizeObjectUnits(inputObject){var normalizedInput={},normalizedProp,prop;for(prop in inputObject){if(inputObject.hasOwnProperty(prop)){normalizedProp=normalizeUnits(prop);if(normalizedProp){normalizedInput[normalizedProp]=inputObject[prop]}}}return normalizedInput}function makeList(field){var count,setter;if(field.indexOf("week")===0){count=7;setter="day"}else if(field.indexOf("month")===0){count=12;setter="month"}else{return}moment[field]=function(format,index){var i,getter,method=moment.fn._lang[field],results=[];if(typeof format==="number"){index=format;format=undefined}getter=function(i){var m=moment().utc().set(setter,i);return method.call(moment.fn._lang,m,format||"")};if(index!=null){return getter(index)}else{for(i=0;i<count;i++){results.push(getter(i))}return results}}}function toInt(argumentForCoercion){var coercedNumber=+argumentForCoercion,value=0;if(coercedNumber!==0&&isFinite(coercedNumber)){if(coercedNumber>=0){value=Math.floor(coercedNumber)}else{value=Math.ceil(coercedNumber)}}return value}function daysInMonth(year,month){return new Date(Date.UTC(year,month+1,0)).getUTCDate()}function weeksInYear(year,dow,doy){return weekOfYear(moment([year,11,31+dow-doy]),dow,doy).week}function daysInYear(year){return isLeapYear(year)?366:365}function isLeapYear(year){return year%4===0&&year%100!==0||year%400===0}function checkOverflow(m){var overflow;if(m._a&&m._pf.overflow===-2){overflow=m._a[MONTH]<0||m._a[MONTH]>11?MONTH:m._a[DATE]<1||m._a[DATE]>daysInMonth(m._a[YEAR],m._a[MONTH])?DATE:m._a[HOUR]<0||m._a[HOUR]>23?HOUR:m._a[MINUTE]<0||m._a[MINUTE]>59?MINUTE:m._a[SECOND]<0||m._a[SECOND]>59?SECOND:m._a[MILLISECOND]<0||m._a[MILLISECOND]>999?MILLISECOND:-1;if(m._pf._overflowDayOfYear&&(overflow<YEAR||overflow>DATE)){overflow=DATE}m._pf.overflow=overflow}}function isValid(m){if(m._isValid==null){m._isValid=!isNaN(m._d.getTime())&&m._pf.overflow<0&&!m._pf.empty&&!m._pf.invalidMonth&&!m._pf.nullInput&&!m._pf.invalidFormat&&!m._pf.userInvalidated;if(m._strict){m._isValid=m._isValid&&m._pf.charsLeftOver===0&&m._pf.unusedTokens.length===0}}return m._isValid}function normalizeLanguage(key){return key?key.toLowerCase().replace("_","-"):key}function makeAs(input,model){return model._isUTC?moment(input).zone(model._offset||0):moment(input).local()}extend(Language.prototype,{set:function(config){var prop,i;for(i in config){prop=config[i];if(typeof prop==="function"){this[i]=prop}else{this["_"+i]=prop}}},_months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),months:function(m){return this._months[m.month()]},_monthsShort:"Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"),monthsShort:function(m){return this._monthsShort[m.month()]},monthsParse:function(monthName){var i,mom,regex;if(!this._monthsParse){this._monthsParse=[]}for(i=0;i<12;i++){if(!this._monthsParse[i]){mom=moment.utc([2e3,i]); | |
regex="^"+this.months(mom,"")+"|^"+this.monthsShort(mom,"");this._monthsParse[i]=new RegExp(regex.replace(".",""),"i")}if(this._monthsParse[i].test(monthName)){return i}}},_weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),weekdays:function(m){return this._weekdays[m.day()]},_weekdaysShort:"Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"),weekdaysShort:function(m){return this._weekdaysShort[m.day()]},_weekdaysMin:"Su_Mo_Tu_We_Th_Fr_Sa".split("_"),weekdaysMin:function(m){return this._weekdaysMin[m.day()]},weekdaysParse:function(weekdayName){var i,mom,regex;if(!this._weekdaysParse){this._weekdaysParse=[]}for(i=0;i<7;i++){if(!this._weekdaysParse[i]){mom=moment([2e3,1]).day(i);regex="^"+this.weekdays(mom,"")+"|^"+this.weekdaysShort(mom,"")+"|^"+this.weekdaysMin(mom,"");this._weekdaysParse[i]=new RegExp(regex.replace(".",""),"i")}if(this._weekdaysParse[i].test(weekdayName)){return i}}},_longDateFormat:{LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D YYYY",LLL:"MMMM D YYYY LT",LLLL:"dddd, MMMM D YYYY LT"},longDateFormat:function(key){var output=this._longDateFormat[key];if(!output&&this._longDateFormat[key.toUpperCase()]){output=this._longDateFormat[key.toUpperCase()].replace(/MMMM|MM|DD|dddd/g,function(val){return val.slice(1)});this._longDateFormat[key]=output}return output},isPM:function(input){return(input+"").toLowerCase().charAt(0)==="p"},_meridiemParse:/[ap]\.?m?\.?/i,meridiem:function(hours,minutes,isLower){if(hours>11){return isLower?"pm":"PM"}else{return isLower?"am":"AM"}},_calendar:{sameDay:"[Today at] LT",nextDay:"[Tomorrow at] LT",nextWeek:"dddd [at] LT",lastDay:"[Yesterday at] LT",lastWeek:"[Last] dddd [at] LT",sameElse:"L"},calendar:function(key,mom){var output=this._calendar[key];return typeof output==="function"?output.apply(mom):output},_relativeTime:{future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"},relativeTime:function(number,withoutSuffix,string,isFuture){var output=this._relativeTime[string];return typeof output==="function"?output(number,withoutSuffix,string,isFuture):output.replace(/%d/i,number)},pastFuture:function(diff,output){var format=this._relativeTime[diff>0?"future":"past"];return typeof format==="function"?format(output):format.replace(/%s/i,output)},ordinal:function(number){return this._ordinal.replace("%d",number)},_ordinal:"%d",preparse:function(string){return string},postformat:function(string){return string},week:function(mom){return weekOfYear(mom,this._week.dow,this._week.doy).week},_week:{dow:0,doy:6},_invalidDate:"Invalid date",invalidDate:function(){return this._invalidDate}});function loadLang(key,values){values.abbr=key;if(!languages[key]){languages[key]=new Language}languages[key].set(values);return languages[key]}function unloadLang(key){delete languages[key]}function getLangDefinition(key){var i=0,j,lang,next,split,get=function(k){if(!languages[k]&&hasModule){try{require("./lang/"+k)}catch(e){}}return languages[k]};if(!key){return moment.fn._lang}if(!isArray(key)){lang=get(key);if(lang){return lang}key=[key]}while(i<key.length){split=normalizeLanguage(key[i]).split("-");j=split.length;next=normalizeLanguage(key[i+1]);next=next?next.split("-"):null;while(j>0){lang=get(split.slice(0,j).join("-"));if(lang){return lang}if(next&&next.length>=j&&compareArrays(split,next,true)>=j-1){break}j--}i++}return moment.fn._lang}function removeFormattingTokens(input){if(input.match(/\[[\s\S]/)){return input.replace(/^\[|\]$/g,"")}return input.replace(/\\/g,"")}function makeFormatFunction(format){var array=format.match(formattingTokens),i,length;for(i=0,length=array.length;i<length;i++){if(formatTokenFunctions[array[i]]){array[i]=formatTokenFunctions[array[i]]}else{array[i]=removeFormattingTokens(array[i])}}return function(mom){var output="";for(i=0;i<length;i++){output+=array[i]instanceof Function?array[i].call(mom,format):array[i]}return output}}function formatMoment(m,format){if(!m.isValid()){return m.lang().invalidDate()}format=expandFormat(format,m.lang());if(!formatFunctions[format]){formatFunctions[format]=makeFormatFunction(format)}return formatFunctions[format](m)}function expandFormat(format,lang){var i=5;function replaceLongDateFormatTokens(input){return lang.longDateFormat(input)||input}localFormattingTokens.lastIndex=0;while(i>=0&&localFormattingTokens.test(format)){format=format.replace(localFormattingTokens,replaceLongDateFormatTokens);localFormattingTokens.lastIndex=0;i-=1}return format}function getParseRegexForToken(token,config){var a,strict=config._strict;switch(token){case"Q":return parseTokenOneDigit;case"DDDD":return parseTokenThreeDigits;case"YYYY":case"GGGG":case"gggg":return strict?parseTokenFourDigits:parseTokenOneToFourDigits;case"Y":case"G":case"g":return parseTokenSignedNumber;case"YYYYYY":case"YYYYY":case"GGGGG":case"ggggg":return strict?parseTokenSixDigits:parseTokenOneToSixDigits;case"S":if(strict){return parseTokenOneDigit}case"SS":if(strict){return parseTokenTwoDigits}case"SSS":if(strict){return parseTokenThreeDigits}case"DDD":return parseTokenOneToThreeDigits;case"MMM":case"MMMM":case"dd":case"ddd":case"dddd":return parseTokenWord;case"a":case"A":return getLangDefinition(config._l)._meridiemParse;case"X":return parseTokenTimestampMs;case"Z":case"ZZ":return parseTokenTimezone;case"T":return parseTokenT;case"SSSS":return parseTokenDigits;case"MM":case"DD":case"YY":case"GG":case"gg":case"HH":case"hh":case"mm":case"ss":case"ww":case"WW":return strict?parseTokenTwoDigits:parseTokenOneOrTwoDigits;case"M":case"D":case"d":case"H":case"h":case"m":case"s":case"w":case"W":case"e":case"E":return parseTokenOneOrTwoDigits;case"Do":return parseTokenOrdinal;default:a=new RegExp(regexpEscape(unescapeFormat(token.replace("\\","")),"i"));return a}}function timezoneMinutesFromString(string){string=string||"";var possibleTzMatches=string.match(parseTokenTimezone)||[],tzChunk=possibleTzMatches[possibleTzMatches.length-1]||[],parts=(tzChunk+"").match(parseTimezoneChunker)||["-",0,0],minutes=+(parts[1]*60)+toInt(parts[2]);return parts[0]==="+"?-minutes:minutes}function addTimeToArrayFromToken(token,input,config){var a,datePartArray=config._a;switch(token){case"Q":if(input!=null){datePartArray[MONTH]=(toInt(input)-1)*3}break;case"M":case"MM":if(input!=null){datePartArray[MONTH]=toInt(input)-1}break;case"MMM":case"MMMM":a=getLangDefinition(config._l).monthsParse(input);if(a!=null){datePartArray[MONTH]=a}else{config._pf.invalidMonth=input}break;case"D":case"DD":if(input!=null){datePartArray[DATE]=toInt(input)}break;case"Do":if(input!=null){datePartArray[DATE]=toInt(parseInt(input,10))}break;case"DDD":case"DDDD":if(input!=null){config._dayOfYear=toInt(input)}break;case"YY":datePartArray[YEAR]=moment.parseTwoDigitYear(input);break;case"YYYY":case"YYYYY":case"YYYYYY":datePartArray[YEAR]=toInt(input);break;case"a":case"A":config._isPm=getLangDefinition(config._l).isPM(input);break;case"H":case"HH":case"h":case"hh":datePartArray[HOUR]=toInt(input);break;case"m":case"mm":datePartArray[MINUTE]=toInt(input);break;case"s":case"ss":datePartArray[SECOND]=toInt(input);break;case"S":case"SS":case"SSS":case"SSSS":datePartArray[MILLISECOND]=toInt(("0."+input)*1e3);break;case"X":config._d=new Date(parseFloat(input)*1e3);break;case"Z":case"ZZ":config._useUTC=true;config._tzm=timezoneMinutesFromString(input);break;case"w":case"ww":case"W":case"WW":case"d":case"dd":case"ddd":case"dddd":case"e":case"E":token=token.substr(0,1);case"gg":case"gggg":case"GG":case"GGGG":case"GGGGG":token=token.substr(0,2);if(input){config._w=config._w||{};config._w[token]=input}break}}function dateFromConfig(config){var i,date,input=[],currentDate,yearToUse,fixYear,w,temp,lang,weekday,week;if(config._d){return}currentDate=currentDateArray(config);if(config._w&&config._a[DATE]==null&&config._a[MONTH]==null){fixYear=function(val){var intVal=parseInt(val,10);return val?val.length<3?intVal>68?1900+intVal:2e3+intVal:intVal:config._a[YEAR]==null?moment().weekYear():config._a[YEAR]};w=config._w;if(w.GG!=null||w.W!=null||w.E!=null){temp=dayOfYearFromWeeks(fixYear(w.GG),w.W||1,w.E,4,1)}else{lang=getLangDefinition(config._l);weekday=w.d!=null?parseWeekday(w.d,lang):w.e!=null?parseInt(w.e,10)+lang._week.dow:0;week=parseInt(w.w,10)||1;if(w.d!=null&&weekday<lang._week.dow){week++}temp=dayOfYearFromWeeks(fixYear(w.gg),week,weekday,lang._week.doy,lang._week.dow)}config._a[YEAR]=temp.year;config._dayOfYear=temp.dayOfYear}if(config._dayOfYear){yearToUse=config._a[YEAR]==null?currentDate[YEAR]:config._a[YEAR];if(config._dayOfYear>daysInYear(yearToUse)){config._pf._overflowDayOfYear=true}date=makeUTCDate(yearToUse,0,config._dayOfYear);config._a[MONTH]=date.getUTCMonth();config._a[DATE]=date.getUTCDate()}for(i=0;i<3&&config._a[i]==null;++i){config._a[i]=input[i]=currentDate[i]}for(;i<7;i++){config._a[i]=input[i]=config._a[i]==null?i===2?1:0:config._a[i]}input[HOUR]+=toInt((config._tzm||0)/60);input[MINUTE]+=toInt((config._tzm||0)%60);config._d=(config._useUTC?makeUTCDate:makeDate).apply(null,input)}function dateFromObject(config){var normalizedInput;if(config._d){return}normalizedInput=normalizeObjectUnits(config._i);config._a=[normalizedInput.year,normalizedInput.month,normalizedInput.day,normalizedInput.hour,normalizedInput.minute,normalizedInput.second,normalizedInput.millisecond];dateFromConfig(config)}function currentDateArray(config){var now=new Date;if(config._useUTC){return[now.getUTCFullYear(),now.getUTCMonth(),now.getUTCDate()]}else{return[now.getFullYear(),now.getMonth(),now.getDate()]}}function makeDateFromStringAndFormat(config){config._a=[];config._pf.empty=true;var lang=getLangDefinition(config._l),string=""+config._i,i,parsedInput,tokens,token,skipped,stringLength=string.length,totalParsedInputLength=0;tokens=expandFormat(config._f,lang).match(formattingTokens)||[];for(i=0;i<tokens.length;i++){token=tokens[i];parsedInput=(string.match(getParseRegexForToken(token,config))||[])[0];if(parsedInput){skipped=string.substr(0,string.indexOf(parsedInput));if(skipped.length>0){config._pf.unusedInput.push(skipped)}string=string.slice(string.indexOf(parsedInput)+parsedInput.length);totalParsedInputLength+=parsedInput.length}if(formatTokenFunctions[token]){if(parsedInput){config._pf.empty=false}else{config._pf.unusedTokens.push(token)}addTimeToArrayFromToken(token,parsedInput,config)}else if(config._strict&&!parsedInput){config._pf.unusedTokens.push(token)}}config._pf.charsLeftOver=stringLength-totalParsedInputLength;if(string.length>0){config._pf.unusedInput.push(string)}if(config._isPm&&config._a[HOUR]<12){config._a[HOUR]+=12}if(config._isPm===false&&config._a[HOUR]===12){config._a[HOUR]=0}dateFromConfig(config);checkOverflow(config)}function unescapeFormat(s){return s.replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,function(matched,p1,p2,p3,p4){return p1||p2||p3||p4})}function regexpEscape(s){return s.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")}function makeDateFromStringAndArray(config){var tempConfig,bestMoment,scoreToBeat,i,currentScore;if(config._f.length===0){config._pf.invalidFormat=true;config._d=new Date(NaN);return}for(i=0;i<config._f.length;i++){currentScore=0;tempConfig=extend({},config);tempConfig._pf=defaultParsingFlags();tempConfig._f=config._f[i];makeDateFromStringAndFormat(tempConfig);if(!isValid(tempConfig)){continue}currentScore+=tempConfig._pf.charsLeftOver;currentScore+=tempConfig._pf.unusedTokens.length*10;tempConfig._pf.score=currentScore;if(scoreToBeat==null||currentScore<scoreToBeat){scoreToBeat=currentScore;bestMoment=tempConfig}}extend(config,bestMoment||tempConfig)}function makeDateFromString(config){var i,l,string=config._i,match=isoRegex.exec(string);if(match){config._pf.iso=true;for(i=0,l=isoDates.length;i<l;i++){if(isoDates[i][1].exec(string)){config._f=isoDates[i][0]+(match[6]||" ");break}}for(i=0,l=isoTimes.length;i<l;i++){if(isoTimes[i][1].exec(string)){config._f+=isoTimes[i][0];break}}if(string.match(parseTokenTimezone)){config._f+="Z"}makeDateFromStringAndFormat(config)}else{moment.createFromInputFallback(config)}}function makeDateFromInput(config){var input=config._i,matched=aspNetJsonRegex.exec(input);if(input===undefined){config._d=new Date}else if(matched){config._d=new Date(+matched[1])}else if(typeof input==="string"){makeDateFromString(config)}else if(isArray(input)){config._a=input.slice(0);dateFromConfig(config)}else if(isDate(input)){config._d=new Date(+input)}else if(typeof input==="object"){dateFromObject(config)}else if(typeof input==="number"){config._d=new Date(input)}else{moment.createFromInputFallback(config)}}function makeDate(y,m,d,h,M,s,ms){var date=new Date(y,m,d,h,M,s,ms);if(y<1970){date.setFullYear(y)}return date}function makeUTCDate(y){var date=new Date(Date.UTC.apply(null,arguments));if(y<1970){date.setUTCFullYear(y)}return date}function parseWeekday(input,language){if(typeof input==="string"){if(!isNaN(input)){input=parseInt(input,10)}else{input=language.weekdaysParse(input);if(typeof input!=="number"){return null}}}return input}function substituteTimeAgo(string,number,withoutSuffix,isFuture,lang){return lang.relativeTime(number||1,!!withoutSuffix,string,isFuture)}function relativeTime(milliseconds,withoutSuffix,lang){var seconds=round(Math.abs(milliseconds)/1e3),minutes=round(seconds/60),hours=round(minutes/60),days=round(hours/24),years=round(days/365),args=seconds<45&&["s",seconds]||minutes===1&&["m"]||minutes<45&&["mm",minutes]||hours===1&&["h"]||hours<22&&["hh",hours]||days===1&&["d"]||days<=25&&["dd",days]||days<=45&&["M"]||days<345&&["MM",round(days/30)]||years===1&&["y"]||["yy",years];args[2]=withoutSuffix;args[3]=milliseconds>0;args[4]=lang;return substituteTimeAgo.apply({},args)}function weekOfYear(mom,firstDayOfWeek,firstDayOfWeekOfYear){var end=firstDayOfWeekOfYear-firstDayOfWeek,daysToDayOfWeek=firstDayOfWeekOfYear-mom.day(),adjustedMoment;if(daysToDayOfWeek>end){daysToDayOfWeek-=7}if(daysToDayOfWeek<end-7){daysToDayOfWeek+=7}adjustedMoment=moment(mom).add("d",daysToDayOfWeek);return{week:Math.ceil(adjustedMoment.dayOfYear()/7),year:adjustedMoment.year()}}function dayOfYearFromWeeks(year,week,weekday,firstDayOfWeekOfYear,firstDayOfWeek){var d=makeUTCDate(year,0,1).getUTCDay(),daysToAdd,dayOfYear;weekday=weekday!=null?weekday:firstDayOfWeek;daysToAdd=firstDayOfWeek-d+(d>firstDayOfWeekOfYear?7:0)-(d<firstDayOfWeek?7:0);dayOfYear=7*(week-1)+(weekday-firstDayOfWeek)+daysToAdd+1;return{year:dayOfYear>0?year:year-1,dayOfYear:dayOfYear>0?dayOfYear:daysInYear(year-1)+dayOfYear}}function makeMoment(config){var input=config._i,format=config._f;if(input===null||format===undefined&&input===""){return moment.invalid({nullInput:true})}if(typeof input==="string"){config._i=input=getLangDefinition().preparse(input)}if(moment.isMoment(input)){config=cloneMoment(input);config._d=new Date(+input._d)}else if(format){if(isArray(format)){makeDateFromStringAndArray(config)}else{makeDateFromStringAndFormat(config)}}else{makeDateFromInput(config)}return new Moment(config)}moment=function(input,format,lang,strict){var c;if(typeof lang==="boolean"){strict=lang;lang=undefined}c={};c._isAMomentObject=true;c._i=input;c._f=format;c._l=lang;c._strict=strict;c._isUTC=false;c._pf=defaultParsingFlags();return makeMoment(c)};moment.suppressDeprecationWarnings=false;moment.createFromInputFallback=deprecate("moment construction falls back to js Date. This is "+"discouraged and will be removed in upcoming major "+"release. Please refer to "+"https://github.com/moment/moment/issues/1407 for more info.",function(config){config._d=new Date(config._i)});moment.utc=function(input,format,lang,strict){var c;if(typeof lang==="boolean"){strict=lang;lang=undefined}c={};c._isAMomentObject=true;c._useUTC=true;c._isUTC=true;c._l=lang;c._i=input;c._f=format;c._strict=strict;c._pf=defaultParsingFlags();return makeMoment(c).utc()};moment.unix=function(input){return moment(input*1e3)};moment.duration=function(input,key){var duration=input,match=null,sign,ret,parseIso;if(moment.isDuration(input)){duration={ms:input._milliseconds,d:input._days,M:input._months}}else if(typeof input==="number"){duration={};if(key){duration[key]=input}else{duration.milliseconds=input}}else if(!!(match=aspNetTimeSpanJsonRegex.exec(input))){sign=match[1]==="-"?-1:1;duration={y:0,d:toInt(match[DATE])*sign,h:toInt(match[HOUR])*sign,m:toInt(match[MINUTE])*sign,s:toInt(match[SECOND])*sign,ms:toInt(match[MILLISECOND])*sign}}else if(!!(match=isoDurationRegex.exec(input))){sign=match[1]==="-"?-1:1;parseIso=function(inp){var res=inp&&parseFloat(inp.replace(",","."));return(isNaN(res)?0:res)*sign};duration={y:parseIso(match[2]),M:parseIso(match[3]),d:parseIso(match[4]),h:parseIso(match[5]),m:parseIso(match[6]),s:parseIso(match[7]),w:parseIso(match[8])}}ret=new Duration(duration);if(moment.isDuration(input)&&input.hasOwnProperty("_lang")){ret._lang=input._lang}return ret};moment.version=VERSION;moment.defaultFormat=isoFormat;moment.momentProperties=momentProperties;moment.updateOffset=function(){};moment.lang=function(key,values){var r;if(!key){return moment.fn._lang._abbr}if(values){loadLang(normalizeLanguage(key),values)}else if(values===null){unloadLang(key);key="en"}else if(!languages[key]){getLangDefinition(key)}r=moment.duration.fn._lang=moment.fn._lang=getLangDefinition(key);return r._abbr};moment.langData=function(key){if(key&&key._lang&&key._lang._abbr){key=key._lang._abbr}return getLangDefinition(key)};moment.isMoment=function(obj){return obj instanceof Moment||obj!=null&&obj.hasOwnProperty("_isAMomentObject")};moment.isDuration=function(obj){return obj instanceof Duration};for(i=lists.length-1;i>=0;--i){makeList(lists[i])}moment.normalizeUnits=function(units){return normalizeUnits(units)};moment.invalid=function(flags){var m=moment.utc(NaN);if(flags!=null){extend(m._pf,flags)}else{m._pf.userInvalidated=true}return m};moment.parseZone=function(){return moment.apply(null,arguments).parseZone()};moment.parseTwoDigitYear=function(input){return toInt(input)+(toInt(input)>68?1900:2e3)};extend(moment.fn=Moment.prototype,{clone:function(){return moment(this)},valueOf:function(){return+this._d+(this._offset||0)*6e4},unix:function(){return Math.floor(+this/1e3)},toString:function(){return this.clone().lang("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ")},toDate:function(){return this._offset?new Date(+this):this._d},toISOString:function(){var m=moment(this).utc();if(0<m.year()&&m.year()<=9999){return formatMoment(m,"YYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}else{return formatMoment(m,"YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]")}},toArray:function(){var m=this;return[m.year(),m.month(),m.date(),m.hours(),m.minutes(),m.seconds(),m.milliseconds()]},isValid:function(){return isValid(this)},isDSTShifted:function(){if(this._a){return this.isValid()&&compareArrays(this._a,(this._isUTC?moment.utc(this._a):moment(this._a)).toArray())>0}return false},parsingFlags:function(){return extend({},this._pf)},invalidAt:function(){return this._pf.overflow},utc:function(){return this.zone(0)},local:function(){this.zone(0);this._isUTC=false;return this},format:function(inputString){var output=formatMoment(this,inputString||moment.defaultFormat);return this.lang().postformat(output)},add:function(input,val){var dur;if(typeof input==="string"){dur=moment.duration(+val,input)}else{dur=moment.duration(input,val)}addOrSubtractDurationFromMoment(this,dur,1);return this},subtract:function(input,val){var dur;if(typeof input==="string"){dur=moment.duration(+val,input)}else{dur=moment.duration(input,val)}addOrSubtractDurationFromMoment(this,dur,-1);return this},diff:function(input,units,asFloat){var that=makeAs(input,this),zoneDiff=(this.zone()-that.zone())*6e4,diff,output;units=normalizeUnits(units);if(units==="year"||units==="month"){diff=(this.daysInMonth()+that.daysInMonth())*432e5;output=(this.year()-that.year())*12+(this.month()-that.month());output+=(this-moment(this).startOf("month")-(that-moment(that).startOf("month")))/diff;output-=(this.zone()-moment(this).startOf("month").zone()-(that.zone()-moment(that).startOf("month").zone()))*6e4/diff;if(units==="year"){output=output/12}}else{diff=this-that;output=units==="second"?diff/1e3:units==="minute"?diff/6e4:units==="hour"?diff/36e5:units==="day"?(diff-zoneDiff)/864e5:units==="week"?(diff-zoneDiff)/6048e5:diff}return asFloat?output:absRound(output)},from:function(time,withoutSuffix){return moment.duration(this.diff(time)).lang(this.lang()._abbr).humanize(!withoutSuffix)},fromNow:function(withoutSuffix){return this.from(moment(),withoutSuffix)},calendar:function(){var sod=makeAs(moment(),this).startOf("day"),diff=this.diff(sod,"days",true),format=diff<-6?"sameElse":diff<-1?"lastWeek":diff<0?"lastDay":diff<1?"sameDay":diff<2?"nextDay":diff<7?"nextWeek":"sameElse";return this.format(this.lang().calendar(format,this))},isLeapYear:function(){return isLeapYear(this.year())},isDST:function(){return this.zone()<this.clone().month(0).zone()||this.zone()<this.clone().month(5).zone()},day:function(input){var day=this._isUTC?this._d.getUTCDay():this._d.getDay();if(input!=null){input=parseWeekday(input,this.lang());return this.add({d:input-day})}else{return day}},month:makeAccessor("Month",true),startOf:function(units){units=normalizeUnits(units);switch(units){case"year":this.month(0);case"quarter":case"month":this.date(1);case"week":case"isoWeek":case"day":this.hours(0);case"hour":this.minutes(0);case"minute":this.seconds(0);case"second":this.milliseconds(0)}if(units==="week"){this.weekday(0)}else if(units==="isoWeek"){this.isoWeekday(1)}if(units==="quarter"){this.month(Math.floor(this.month()/3)*3)}return this},endOf:function(units){units=normalizeUnits(units);return this.startOf(units).add(units==="isoWeek"?"week":units,1).subtract("ms",1)},isAfter:function(input,units){units=typeof units!=="undefined"?units:"millisecond";return+this.clone().startOf(units)>+moment(input).startOf(units)},isBefore:function(input,units){units=typeof units!=="undefined"?units:"millisecond";return+this.clone().startOf(units)<+moment(input).startOf(units)},isSame:function(input,units){units=units||"ms";return+this.clone().startOf(units)===+makeAs(input,this).startOf(units)},min:function(other){other=moment.apply(null,arguments);return other<this?this:other},max:function(other){other=moment.apply(null,arguments);return other>this?this:other},zone:function(input,keepTime){var offset=this._offset||0;if(input!=null){if(typeof input==="string"){input=timezoneMinutesFromString(input)}if(Math.abs(input)<16){input=input*60}this._offset=input;this._isUTC=true;if(offset!==input){if(!keepTime||this._changeInProgress){addOrSubtractDurationFromMoment(this,moment.duration(offset-input,"m"),1,false)}else if(!this._changeInProgress){this._changeInProgress=true;moment.updateOffset(this,true);this._changeInProgress=null}}}else{return this._isUTC?offset:this._d.getTimezoneOffset()}return this},zoneAbbr:function(){return this._isUTC?"UTC":""},zoneName:function(){return this._isUTC?"Coordinated Universal Time":""},parseZone:function(){if(this._tzm){this.zone(this._tzm)}else if(typeof this._i==="string"){this.zone(this._i)}return this},hasAlignedHourOffset:function(input){if(!input){input=0}else{input=moment(input).zone()}return(this.zone()-input)%60===0},daysInMonth:function(){return daysInMonth(this.year(),this.month())},dayOfYear:function(input){var dayOfYear=round((moment(this).startOf("day")-moment(this).startOf("year"))/864e5)+1;return input==null?dayOfYear:this.add("d",input-dayOfYear)},quarter:function(input){return input==null?Math.ceil((this.month()+1)/3):this.month((input-1)*3+this.month()%3)},weekYear:function(input){var year=weekOfYear(this,this.lang()._week.dow,this.lang()._week.doy).year;return input==null?year:this.add("y",input-year)},isoWeekYear:function(input){var year=weekOfYear(this,1,4).year;return input==null?year:this.add("y",input-year)},week:function(input){var week=this.lang().week(this);return input==null?week:this.add("d",(input-week)*7)},isoWeek:function(input){var week=weekOfYear(this,1,4).week;return input==null?week:this.add("d",(input-week)*7)},weekday:function(input){var weekday=(this.day()+7-this.lang()._week.dow)%7;return input==null?weekday:this.add("d",input-weekday)},isoWeekday:function(input){return input==null?this.day()||7:this.day(this.day()%7?input:input-7)},isoWeeksInYear:function(){return weeksInYear(this.year(),1,4)},weeksInYear:function(){var weekInfo=this._lang._week;return weeksInYear(this.year(),weekInfo.dow,weekInfo.doy)},get:function(units){units=normalizeUnits(units);return this[units]()},set:function(units,value){units=normalizeUnits(units);if(typeof this[units]==="function"){this[units](value)}return this},lang:function(key){if(key===undefined){return this._lang}else{this._lang=getLangDefinition(key);return this}}});function rawMonthSetter(mom,value){var dayOfMonth;if(typeof value==="string"){value=mom.lang().monthsParse(value);if(typeof value!=="number"){return mom}}dayOfMonth=Math.min(mom.date(),daysInMonth(mom.year(),value));mom._d["set"+(mom._isUTC?"UTC":"")+"Month"](value,dayOfMonth);return mom}function rawGetter(mom,unit){return mom._d["get"+(mom._isUTC?"UTC":"")+unit]()}function rawSetter(mom,unit,value){if(unit==="Month"){return rawMonthSetter(mom,value)}else{return mom._d["set"+(mom._isUTC?"UTC":"")+unit](value)}}function makeAccessor(unit,keepTime){return function(value){if(value!=null){rawSetter(this,unit,value);moment.updateOffset(this,keepTime);return this}else{return rawGetter(this,unit)}}}moment.fn.millisecond=moment.fn.milliseconds=makeAccessor("Milliseconds",false);moment.fn.second=moment.fn.seconds=makeAccessor("Seconds",false);moment.fn.minute=moment.fn.minutes=makeAccessor("Minutes",false);moment.fn.hour=moment.fn.hours=makeAccessor("Hours",true);moment.fn.date=makeAccessor("Date",true);moment.fn.dates=deprecate("dates accessor is deprecated. Use date instead.",makeAccessor("Date",true));moment.fn.year=makeAccessor("FullYear",true);moment.fn.years=deprecate("years accessor is deprecated. Use year instead.",makeAccessor("FullYear",true));moment.fn.days=moment.fn.day;moment.fn.months=moment.fn.month;moment.fn.weeks=moment.fn.week;moment.fn.isoWeeks=moment.fn.isoWeek;moment.fn.quarters=moment.fn.quarter;moment.fn.toJSON=moment.fn.toISOString;extend(moment.duration.fn=Duration.prototype,{_bubble:function(){var milliseconds=this._milliseconds,days=this._days,months=this._months,data=this._data,seconds,minutes,hours,years;data.milliseconds=milliseconds%1e3;seconds=absRound(milliseconds/1e3);data.seconds=seconds%60;minutes=absRound(seconds/60);data.minutes=minutes%60;hours=absRound(minutes/60);data.hours=hours%24;days+=absRound(hours/24);data.days=days%30;months+=absRound(days/30);data.months=months%12;years=absRound(months/12);data.years=years},weeks:function(){return absRound(this.days()/7)},valueOf:function(){return this._milliseconds+this._days*864e5+this._months%12*2592e6+toInt(this._months/12)*31536e6},humanize:function(withSuffix){var difference=+this,output=relativeTime(difference,!withSuffix,this.lang());if(withSuffix){output=this.lang().pastFuture(difference,output)}return this.lang().postformat(output)},add:function(input,val){var dur=moment.duration(input,val);this._milliseconds+=dur._milliseconds;this._days+=dur._days;this._months+=dur._months;this._bubble();return this},subtract:function(input,val){var dur=moment.duration(input,val);this._milliseconds-=dur._milliseconds;this._days-=dur._days;this._months-=dur._months;this._bubble();return this},get:function(units){units=normalizeUnits(units);return this[units.toLowerCase()+"s"]()},as:function(units){units=normalizeUnits(units);return this["as"+units.charAt(0).toUpperCase()+units.slice(1)+"s"]()},lang:moment.fn.lang,toIsoString:function(){var years=Math.abs(this.years()),months=Math.abs(this.months()),days=Math.abs(this.days()),hours=Math.abs(this.hours()),minutes=Math.abs(this.minutes()),seconds=Math.abs(this.seconds()+this.milliseconds()/1e3);if(!this.asSeconds()){return"P0D"}return(this.asSeconds()<0?"-":"")+"P"+(years?years+"Y":"")+(months?months+"M":"")+(days?days+"D":"")+(hours||minutes||seconds?"T":"")+(hours?hours+"H":"")+(minutes?minutes+"M":"")+(seconds?seconds+"S":"")}});function makeDurationGetter(name){moment.duration.fn[name]=function(){return this._data[name]}}function makeDurationAsGetter(name,factor){moment.duration.fn["as"+name]=function(){return+this/factor}}for(i in unitMillisecondFactors){if(unitMillisecondFactors.hasOwnProperty(i)){makeDurationAsGetter(i,unitMillisecondFactors[i]);makeDurationGetter(i.toLowerCase())}}makeDurationAsGetter("Weeks",6048e5);moment.duration.fn.asMonths=function(){return(+this-this.years()*31536e6)/2592e6+this.years()*12};moment.lang("en",{ordinal:function(number){var b=number%10,output=toInt(number%100/10)===1?"th":b===1?"st":b===2?"nd":b===3?"rd":"th";return number+output}});function makeGlobal(shouldDeprecate){if(typeof ender!=="undefined"){return}oldGlobalMoment=globalScope.moment;if(shouldDeprecate){globalScope.moment=deprecate("Accessing Moment through the global scope is "+"deprecated, and will be removed in an upcoming "+"release.",moment)}else{globalScope.moment=moment}}if(hasModule){module.exports=moment}else if(typeof define==="function"&&define.amd){define("moment",function(require,exports,module){if(module.config&&module.config()&&module.config().noGlobal===true){globalScope.moment=oldGlobalMoment}return moment});makeGlobal(true)}else{makeGlobal()}}).call(this)}).call(this,typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{}],moment:[function(require,module,exports){module.exports=require("iROhDJ")},{}]},{},[]);var term=require("hypernal")();var tablify=require("tablify").tablify;var request=require("browser-request");var url=require("url");var moment=require("moment");term.appendTo(document.body);var termEl=term.term.element;termEl.style["font"]="13px Monaco, mono";termEl.style.height="100%";termEl.style.padding="5px";termEl.style.overflow="auto";termEl.style["white-space"]="pre";var now=moment().format("YYYY/MM/DD/HH/mm");var query="https://data.irail.be/Airports/Liveboard/BRU/"+now+".json";request({json:true,url:query},function(err,resp,data){var docs=data.Liveboard.departures.map(function(doc){var departures=[];doc.departure=moment(doc.iso8601,moment.ISO_8601).format("HH:mm");doc.delay=delayFilter(doc.delay);doc.city=doc.airport.city;doc.flight=doc.vehicle;return doc});term.write(tablify(docs,{keys:["departure","delay","city","flight"]}))});function delayFilter(time){var hours=parseInt(time/3600,10)%24;var minutes=parseInt(time/60,10)%60;return(hours<10?"0"+hours:hours)+"h"+(minutes<10?"0"+minutes:minutes)} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "requirebin-sketch", | |
"version": "1.0.0", | |
"dependencies": { | |
"hypernal": "0.2.7", | |
"tablify": "0.1.5", | |
"browser-request": "0.3.1", | |
"moment": "2.6.0" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style type='text/css'>html, body { margin: 0; padding: 0; border: 0; } | |
body, html { height: 100%; width: 100%; }</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment