text: require=function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){(function(c,d){"use strict";function e(a,b,c){Error.call(this),Error.captureStackTrace(this,this.constructor),this.message=a,this.condition=b,this.description=a,this.connection=c}function f(a){return a.get_id_string?a.get_id_string():a.localAddress+":"+a.localPort+" -> "+a.remoteAddress+":"+a.remotePort}function g(a){var b=null;return{get_session:function(){return b||(b=a.create_session(),b.begin()),b}}}function h(a,b){if(a){var c,d=a;return function(e){return c!==e&&(d=a,c=e),d--?b(e):-1}}return b}function i(a,b){var c,d=a;return function(e){c!==e&&(d=a,c=e);var f=d,g=2*d;return d=b>g?g:b,f}}function j(a){if(void 0===a.transport||"tcp"===a.transport)return u.connect;if("tls"===a.transport||"ssl"===a.transport)return v.connect;throw Error("Unrecognised transport: "+a.transport)}function k(a){var b={};return b.connect=a.connect?a.connect:j(a),b.host=a.host?a.host:"localhost",b.port=a.port?a.port:5672,b.options=a,b}function l(a){return function(){return this.remote.open?this.remote.open[a]:void 0}}function m(a){A.prototype["on_"+a]=function(b){var c=this.remote_channel_map[b.channel];if(!c)throw Error(a+" received on invalid channel "+b.channel);c["on_"+a](b)}}var n=a("./frames.js"),o=a("./log.js"),p=a("./sasl.js"),q=a("./util.js"),r=a("./endpoint.js"),s=a("./session.js"),t=a("./transport.js"),u=a("net"),v=a("tls"),w=a("events").EventEmitter,x=0;a("util").inherits(e,Error);var y=["container_id","hostname","max_frame_size","channel_max","idle_time_out","outgoing_locales","incoming_locales","offered_capabilities","desired_capabilities","properties"],z=1,A=function(a,b){if(this.options={},a)for(var c in a)this.options[c]=a[c];if(this.container=b,this.options.id||(this.options.id="connection-"+z++),this.options.container_id||(this.options.container_id=b?b.id:q.generate_uuid()),!this.options.connection_details){var d=this;this.options.connection_details=function(){return k(d.options)}}var e=this.get_option("reconnect",!0);if("boolean"==typeof e&&e){var f=this.get_option("initial_reconnect_delay",100),j=this.get_option("max_reconnect_delay",6e4);this.options.reconnect=h(this.get_option("reconnect_limit"),i(f,j))}else if("number"==typeof e){var m=this.options.reconnect;this.options.reconnect=h(this.get_option("reconnect_limit"),function(){return m})}this.registered=!1,this.state=new r,this.local_channel_map={},this.remote_channel_map={},this.local={},this.remote={},this.local.open=n.open(this.options),this.local.close=n.close({}),this.session_policy=g(this),this.amqp_transport=new t(this.options.id,x,n.TYPE_AMQP,this),this.sasl_transport=void 0,this.transport=this.amqp_transport,this.conn_established_counter=0,this.heartbeat_out=void 0,this.heartbeat_in=void 0,this.abort_idle=!1,this.socket_ready=!1,this.scheduled_reconnect=void 0,this.default_sender=void 0;for(var o in y){var p=y[o];Object.defineProperty(this,p,{get:l(p)})}Object.defineProperty(this,"error",{get:function(){return this.remote.close?this.remote.close.error:void 0}})};A.prototype=Object.create(w.prototype),A.prototype.constructor=A,A.prototype.dispatch=function(a){return o.events("Connection got event: "+a),this.listeners(a).length?(w.prototype.emit.apply(this,arguments),!0):this.container?this.container.dispatch.apply(this.container,arguments):!1},A.prototype.reset=function(){this.abort_idle&&(this.abort_idle=!1,this.local.close.error=void 0,this.state=new r,this.state.open()),this.amqp_transport=new t(this.options.id,x,n.TYPE_AMQP,this),this.sasl_transport=void 0,this.transport=this.amqp_transport,this.state.disconnected(),this.remote={},this.remote_channel_map={};for(var a in this.local_channel_map)this.local_channel_map[a].reset();this.socket_ready=!1},A.prototype.connect=function(){return this.is_server=!1,this._connect(this.options.connection_details(this.conn_established_counter)),this.open(),this},A.prototype.reconnect=function(){return this.scheduled_reconnect=void 0,o.reconnect("reconnecting..."),this.reset(),this._connect(this.options.connection_details(this.conn_established_counter)),c.nextTick(this._process.bind(this)),this},A.prototype._connect=function(a){return a.connect?this.init(a.connect(a.port,a.host,a.options,this.connected.bind(this))):this.init(j(a)(a.port,a.host,a.options,this.connected.bind(this))),this},A.prototype.accept=function(a){return this.is_server=!0,o.io("["+this.id+"] client accepted: "+f(a)),this.socket_ready=!0,this.init(a)},A.prototype.init=function(a){if(this.socket=a,this.socket.on("data",this.input.bind(this)),this.socket.on("error",this.on_error.bind(this)),this.socket.on("end",this.eof.bind(this)),this.is_server){var b;this.container&&Object.getOwnPropertyNames(this.container.sasl_server_mechanisms).length&&(b=this.container.sasl_server_mechanisms),this.socket.encrypted&&this.socket.authorized&&this.get_option("enable_sasl_external",!1)&&(b=p.server_add_external(b?q.clone(b):{})),b&&(this.sasl_transport=new p.Server(this,b))}else{var c=this.get_option("sasl_mechanisms");if(!c){var d=this.get_option("username"),e=this.get_option("password");d&&(c=p.client_mechanisms(),e?c.enable_plain(d,e):c.enable_anonymous(d))}this.socket.encrypted&&this.options.cert&&this.get_option("enable_sasl_external",!1)&&(c||(c=p.client_mechanisms()),c.enable_external()),c&&(this.sasl_transport=new p.Client(this,c))}return this.transport=this.sasl_transport?this.sasl_transport:this.amqp_transport,this},A.prototype.attach_sender=function(a){return this.session_policy.get_session().attach_sender(a)},A.prototype.open_sender=A.prototype.attach_sender,A.prototype.attach_receiver=function(a){return this.session_policy.get_session().attach_receiver(a)},A.prototype.open_receiver=A.prototype.attach_receiver,A.prototype.get_option=function(a,b){return void 0!==this.options[a]?this.options[a]:this.container?this.container.get_option(a,b):b},A.prototype.send=function(a){return void 0===this.default_sender&&(this.default_sender=this.open_sender({target:{}})),this.default_sender.send(a)},A.prototype.connected=function(){this.socket_ready=!0,this.conn_established_counter++,o.io("["+this.options.id+"] connected "+f(this.socket)),this.output()},A.prototype.sasl_failed=function(a){this.transport_error={condition:"amqp:unauthorized-access",description:a},this._handle_error()},A.prototype._handle_error=function(){var a=this.get_error();if(a){var b=this.dispatch("connection_error",this._context());return b=this.dispatch("connection_close",this._context())||b,b||w.prototype.emit.call(this.container,"error",new e(a.description,a.condition,this)),!0}return!1},A.prototype.get_error=function(){return this.transport_error?this.transport_error:this.remote.close&&this.remote.close.error?this.remote.close.error:void 0},A.prototype.output=function(){this.socket&&this.socket_ready&&(this.heartbeat_out&&clearTimeout(this.heartbeat_out),this.transport.write(this.socket),(this.is_closed()&&this.state.has_settled()||this.abort_idle||this.transport_error)&&!this.transport.has_writes_pending()?this.socket.end():this.is_open()&&this.remote.open.idle_time_out&&(this.heartbeat_out=setTimeout(this._write_frame.bind(this),this.remote.open.idle_time_out/2)))},A.prototype.input=function(a){this.heartbeat_in&&clearTimeout(this.heartbeat_in),o.io("["+this.options.id+"] read "+a.length+" bytes");var b;this.previous_input?(b=d.concat([this.previous_input,a],this.previous_input.length+a.length),this.previous_input=null):b=a;var c=this.transport.read(b,this);c<b.length&&(this.previous_input=b.slice(c)),this.local.open.idle_time_out&&(this.heartbeat_in=setTimeout(this.idle.bind(this),this.local.open.idle_time_out)),this.transport.has_writes_pending()?this.output():this.is_closed()&&this.state.has_settled()?this.socket.end():this.is_open()&&this.remote.open.idle_time_out&&!this.heartbeat_out&&(this.heartbeat_out=setTimeout(this._write_frame.bind(this),this.remote.open.idle_time_out/2))},A.prototype.idle=function(){this.is_open()&&(this.abort_idle=!0,this.local.close.error={condition:"amqp:resource-limit-exceeded",description:"max idle time exceeded"},this.close())},A.prototype.on_error=function(a){console.log("["+this.options.id+"] error: "+a),this._disconnected()},A.prototype.eof=function(){this._disconnected()},A.prototype._disconnected=function(){if(this.heartbeat_out&&clearTimeout(this.heartbeat_out),this.heartbeat_in&&clearTimeout(this.heartbeat_in),!this.is_closed()&&void 0===this.scheduled_reconnect&&(this.dispatch("disconnected",this._context())||console.log("["+this.options.id+"] disconnected "),!this.is_server&&!this.transport_error&&this.options.reconnect)){var a=this.options.reconnect(this.conn_established_counter);a>=0&&(o.reconnect("Scheduled reconnect in "+a+"ms"),this.scheduled_reconnect=setTimeout(this.reconnect.bind(this),a))}},A.prototype.open=function(){this.state.open()&&this._register()},A.prototype.close=function(a){a&&(this.local.close.error=a),this.state.close()&&this._register()},A.prototype.is_open=function(){return this.state.is_open()},A.prototype.is_closed=function(){return this.state.is_closed()},A.prototype.create_session=function(){for(var a=0;this.local_channel_map[a];)a++;var b=new s(this,a);return this.local_channel_map[a]=b,b},A.prototype.on_open=function(a){if(!this.state.remote_opened())throw Error("Open already received");this.remote.open=a.performative,this.open(),this.dispatch("connection_open",this._context())},A.prototype.on_close=function(a){if(!this.state.remote_closed())throw Error("Close already received");this.remote.close=a.performative,this.close(),this.remote.close.error?this._handle_error():this.dispatch("connection_close",this._context()),this.heartbeat_out&&clearTimeout(this.heartbeat_out)},A.prototype._register=function(){this.registered||(this.registered=!0,c.nextTick(this._process.bind(this)))},A.prototype._process=function(){this.registered=!1;do{this.state.need_open()&&this._write_open();for(var a in this.local_channel_map)this.local_channel_map[a]._process();this.state.need_close()&&this._write_close()}while(!this.state.has_settled())},A.prototype._write_frame=function(a,b,c){this.amqp_transport.encode(n.amqp_frame(a,b,c)),this.output()},A.prototype._write_open=function(){this._write_frame(0,this.local.open.described())},A.prototype._write_close=function(){this._write_frame(0,this.local.close.described())},A.prototype.on_begin=function(a){var b;if(null===a.performative.remote_channel||void 0===a.performative.remote_channel)b=this.create_session(),b.local.begin.remote_channel=a.channel;else if(b=this.local_channel_map[a.performative.remote_channel],!b)throw Error("Invalid value for remote channel "+a.performative.remote_channel);b.on_begin(a),this.remote_channel_map[a.channel]=b},A.prototype.get_peer_certificate=function(){return this.socket&&this.socket.getPeerCertificate?this.socket.getPeerCertificate():void 0},A.prototype.get_tls_socket=function(){return!this.socket||"tls"!==this.options.transport&&"ssl"!==this.options.transport?void 0:this.socket},A.prototype._context=function(a){var b=a?a:{};return b.connection=this,this.container&&(b.container=this.container),b},m("end"),m("attach"),m("detach"),m("transfer"),m("disposition"),m("flow"),b.exports=A}).call(this,a("_process"),a("buffer").Buffer)},{"./endpoint.js":2,"./frames.js":3,"./log.js":5,"./sasl.js":8,"./session.js":9,"./transport.js":11,"./util.js":13,_process:21,buffer:16,events:20,net:15,tls:15,util:30}],2:[function(a,b,c){"use strict";var d=function(){this.init()};d.prototype.init=function(){this.local_open=!1,this.remote_open=!1,this.open_requests=0,this.close_requests=0,this.initialised=!1},d.prototype.open=function(){return this.initialised=!0,this.local_open?!1:(this.local_open=!0,this.open_requests++,!0)},d.prototype.close=function(){return this.local_open?(this.local_open=!1,this.close_requests++,!0):!1},d.prototype.disconnected=function(){var a=this.local_open;this.init(),a?this.open():this.close()},d.prototype.remote_opened=function(){return this.remote_open?!1:(this.remote_open=!0,!0)},d.prototype.remote_closed=function(){return this.remote_open?(this.remote_open=!1,!0):!1},d.prototype.is_open=function(){return this.local_open&&this.remote_open},d.prototype.is_closed=function(){return this.initialised&&!this.local_open&&!this.remote_open},d.prototype.has_settled=function(){return 0===this.open_requests&&0===this.close_requests},d.prototype.need_open=function(){return this.open_requests>0?(this.open_requests--,!0):!1},d.prototype.need_close=function(){return this.close_requests>0?(this.close_requests--,!0):!1},b.exports=d},{}],3:[function(a,b,c){"use strict";function d(a,b){var c=e.define_composite(b);f[b.name]=c.create,g[Number(c.descriptor.numeric).toString(10)]=c,g[c.descriptor.symbolic]=c}var e=a("./types.js"),f={},g={};f.read_header=function(a){var b=4,c={},d=a.toString("ascii",0,b);if("AMQP"!==d)throw Error("Invalid protocol header for AMQP "+d);if(c.protocol_id=a.readUInt8(b++),c.major=a.readUInt8(b++),c.minor=a.readUInt8(b++),c.revision=a.readUInt8(b++),1!==c.major||0!==c.minor)throw Error("Unsupported AMQP version: "+JSON.stringify(c));return c},f.write_header=function(a,b){var c=4;return a.write("AMQP",0,c,"ascii"),a.writeUInt8(b.protocol_id,c++),a.writeUInt8(b.major,c++),a.writeUInt8(b.minor,c++),a.writeUInt8(b.revision,c++),8},f.TYPE_AMQP=0,f.TYPE_SASL=1,f.read_frame=function(a){var b=new e.Reader(a),c={};if(c.size=b.read_uint(4),b.remaining<c.size)return null;var d=b.read_uint(1);if(2>d)throw Error("Invalid data offset, must be at least 2 was "+d);if(c.type=b.read_uint(1),c.type===f.TYPE_AMQP)c.channel=b.read_uint(2);else{if(c.type!==f.TYPE_SASL)throw Error("Unknown frame type "+c.type);b.skip(2)}if(d>1&&b.skip(4*d-8),b.remaining()){c.performative=b.read();var h=g[c.performative.descriptor.value];h&&(c.performative=new h(c.performative.value)),b.remaining()&&(c.payload=b.read_bytes(b.remaining()))}return c},f.write_frame=function(a){var b=new e.Writer;if(b.skip(4),b.write_uint(2,1),b.write_uint(a.type,1),a.type===f.TYPE_AMQP)b.write_uint(a.channel,2);else{if(a.type!==f.TYPE_SASL)throw Error("Unknown frame type "+a.type);b.write_uint(0,2)}a.performative&&(b.write(a.performative),a.payload&&b.write_bytes(a.payload));var c=b.toBuffer();return c.writeUInt32BE(c.length,0),c},f.amqp_frame=function(a,b,c){return{channel:a||0,type:f.TYPE_AMQP,performative:b,payload:c}},f.sasl_frame=function(a){return{channel:0,type:f.TYPE_SASL,performative:a}};var h={name:"open",code:16,fields:[{name:"container_id",type:"string",mandatory:!0},{name:"hostname",type:"string"},{name:"max_frame_size",type:"uint",default_value:4294967295},{name:"channel_max",type:"ushort",default_value:65535},{name:"idle_time_out",type:"uint"},{name:"outgoing_locales",type:"symbol",multiple:!0},{name:"incoming_locales",type:"symbol",multiple:!0},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},i={name:"begin",code:17,fields:[{name:"remote_channel",type:"ushort"},{name:"next_outgoing_id",type:"uint",mandatory:!0},{name:"incoming_window",type:"uint",mandatory:!0},{name:"outgoing_window",type:"uint",mandatory:!0},{name:"handle_max",type:"uint",default_value:"4294967295"},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},j={name:"attach",code:18,fields:[{name:"name",type:"string",mandatory:!0},{name:"handle",type:"uint",mandatory:!0},{name:"role",type:"boolean",mandatory:!0},{name:"snd_settle_mode",type:"ubyte",default_value:2},{name:"rcv_settle_mode",type:"ubyte",default_value:0},{name:"source",type:"*"},{name:"target",type:"*"},{name:"unsettled",type:"map"},{name:"incomplete_unsettled",type:"boolean",default_value:!1},{name:"initial_delivery_count",type:"uint"},{name:"max_message_size",type:"ulong"},{name:"offered_capabilities",type:"symbol",multiple:!0},{name:"desired_capabilities",type:"symbol",multiple:!0},{name:"properties",type:"symbolic_map"}]},k={name:"flow",code:19,fields:[{name:"next_incoming_id",type:"uint"},{name:"incoming_window",type:"uint",mandatory:!0},{name:"next_outgoing_id",type:"uint",mandatory:!0},{name:"outgoing_window",type:"uint",mandatory:!0},{name:"handle",type:"uint"},{name:"delivery_count",type:"uint"},{name:"link_credit",type:"uint"},{name:"available",type:"uint"},{name:"drain",type:"boolean",default_value:!1},{name:"echo",type:"boolean",default_value:!1},{name:"properties",type:"symbolic_map"}]},l={name:"transfer",code:20,fields:[{name:"handle",type:"uint",mandatory:!0},{name:"delivery_id",type:"uint"},{name:"delivery_tag",type:"binary"},{name:"message_format",type:"uint"},{name:"settled",type:"boolean"},{name:"more",type:"boolean",default_value:!1},{name:"rcv_settle_mode",type:"ubyte"},{name:"state",type:"delivery_state"},{name:"resume",type:"boolean",default_value:!1},{name:"aborted",type:"boolean",default_value:!1},{name:"batchable",type:"boolean",default_value:!1}]},m={name:"disposition",code:21,fields:[{name:"role",type:"boolean",mandatory:!0},{name:"first",type:"uint",mandatory:!0},{name:"last",type:"uint"},{name:"settled",type:"boolean",default_value:!1},{name:"state",type:"*"},{name:"batchable",type:"boolean",default_value:!1}]},n={name:"detach",code:22,fields:[{name:"handle",type:"uint",mandatory:!0},{name:"closed",type:"boolean",default_value:!1},{name:"error",type:"error"}]},o={name:"end",code:23,fields:[{name:"error",type:"error"}]},p={name:"close",code:24,fields:[{name:"error",type:"error"}]};d(f.TYPE_AMQP,h),d(f.TYPE_AMQP,i),d(f.TYPE_AMQP,j),d(f.TYPE_AMQP,k),d(f.TYPE_AMQP,l),d(f.TYPE_AMQP,m),d(f.TYPE_AMQP,n),d(f.TYPE_AMQP,o),d(f.TYPE_AMQP,p);var q={name:"sasl_mechanisms",code:64,fields:[{name:"sasl_server_mechanisms",type:"symbol",multiple:!0,mandatory:!0}]},r={name:"sasl_init",code:65,fields:[{name:"mechanism",type:"symbol",mandatory:!0},{name:"initial_response",type:"binary"},{name:"hostname",type:"string"}]},s={name:"sasl_challenge",code:66,fields:[{name:"challenge",type:"binary",mandatory:!0}]},t={name:"sasl_response",code:67,fields:[{name:"response",type:"binary",mandatory:!0}]},u={name:"sasl_outcome",code:68,fields:[{name:"code",type:"ubyte",mandatory:!0},{name:"additional_data",type:"binary"}]};d(f.TYPE_SASL,q),d(f.TYPE_SASL,r),d(f.TYPE_SASL,s),d(f.TYPE_SASL,t),d(f.TYPE_SASL,u),b.exports=f},{"./types.js":12}],4:[function(a,b,c){(function(c){"use strict";function d(a){a.delivery.settled=!0}function e(a){a.delivery.update(void 0,k.accepted().described())}function f(a,b,c){Error.call(this),Error.captureStackTrace(this,this.constructor),this.message=a,this.condition=b,this.description=a,this.link=c}function g(a){switch(a){case"name":case"handle":case"role":case"initial_delivery_count":return!0;default:return!1}}function h(a){return function(){return this.remote.attach?this.remote.attach[a]:void 0}}var i=a("./frames.js"),j=a("./log.js"),k=a("./message.js"),l=a("./terminus.js"),m=a("./endpoint.js"),n=function(a){this.window=a};n.prototype.update=function(a){var b=this.window-a.receiver.credit;a.receiver.flow(b)},a("util").inherits(f,Error);var o=a("events").EventEmitter,p=Object.create(o.prototype);p.dispatch=function(a){return j.events("Link got event: "+a),o.prototype.emit.apply(this.observers,arguments),this.listeners(a).length?(o.prototype.emit.apply(this,arguments),!0):this.session.dispatch.apply(this.session,arguments)},p.set_source=function(a){this.local.attach.source=l.source(a).described()},p.set_target=function(a){this.local.attach.target=l.target(a).described()},p.attach=function(){this.state.open()&&this.connection._register()},p.open=p.attach,p.detach=function(){this.local.detach.closed=!1,this.state.close()&&this.connection._register()},p.close=function(a){a&&(this.local.detach.error=a),this.local.detach.closed=!0,this.state.close()&&this.connection._register()},p.is_open=function(){return this.session.is_open()&&this.state.is_open()},p.is_closed=function(){return this.session.is_closed()||this.state.is_closed()},p._process=function(){do this.state.need_open()&&this.session.output(this.local.attach.described()),this.issue_flow&&(this.session._write_flow(this),this.issue_flow=!1),this.state.need_close()&&this.session.output(this.local.detach.described());while(!this.state.has_settled())},p.on_attach=function(a){if(!this.state.remote_opened())throw Error("Attach already received");this.remote.handle||(this.remote.handle=a.handle),a.performative.source=l.unwrap(a.performative.source),a.performative.target=l.unwrap(a.performative.target),this.remote.attach=a.performative,this.open(),this.dispatch(this.is_receiver()?"receiver_open":"sender_open",this._context())},p.prefix_event=function(a){return(this.local.attach.role?"receiver_":"sender_")+a},p.on_detach=function(a){if(!this.state.remote_closed())throw Error("Detach already received");this.remote.detach=a.performative,this.close();var b=this.remote.detach.error;if(b){var c=this.dispatch(this.prefix_event("error"),this._context());c=this.dispatch(this.prefix_event("close"),this._context())||c,c||o.prototype.emit.call(this.connection.container,"error",new f(b.description,b.condition,this))}else this.dispatch(this.prefix_event("close"),this._context())};var q=["snd_settle_mode","rcv_settle_mode","source","target","max_message_size","offered_capabilities","desired_capabilities","properties"];p.init=function(a,b,c,d,e){this.session=a,this.connection=a.connection,this.name=b,this.options=void 0===d?{}:d,this.state=new m,this.issue_flow=!1,this.local={handle:c},this.local.attach=i.attach({handle:c,name:b,role:e});for(var f in this.local.attach)g(f)||void 0===this.options[f]||(this.local.attach[f]=this.options[f]);this.local.detach=i.detach({handle:c,closed:!0}),this.remote={handle:void 0},this.delivery_count=0,this.credit=0,this.observers=new o;for(var j in q){var k=q[j];Object.defineProperty(this,k,{get:h(k)})}Object.defineProperty(this,"error",{get:function(){return this.remote.detach?this.remote.detach.error:void 0}})},p.reset=function(){this.state.disconnected(),this.remote={handle:void 0},this.delivery_count=0,this.credit=0},p.has_credit=function(){return this.credit>0},p.is_receiver=function(){return this.local.attach.role},p._context=function(a){var b=a?a:{};return this.is_receiver()?b.receiver=this:b.sender=this,this.session._context(b)},p.get_option=function(a,b){return void 0!==this.options[a]?this.options[a]:this.session.get_option(a,b)};var r=function(a,b,c,e){this.init(a,b,c,e,!1),this._draining=!1,this._drained=!1,this.local.attach.initial_delivery_count=0,this.tag=0,this.get_option("autosettle",!0)&&this.observers.on("settled",d);var f=this;this.get_option("treat_modified_as_released",!0)&&this.observers.on("modified",function(a){f.dispatch("released",a)})};r.prototype=Object.create(p),r.prototype.constructor=r,r.prototype._get_drain=function(){if(this._draining&&this._drained&&this.credit){for(;this.credit;)++this.delivery_count,--this.credit;return!0}return!1},r.prototype.set_drained=function(a){this._drained=a,this._draining&&this._drained&&(this.issue_flow=!0)},r.prototype.next_tag=function(){return new c(new String(this.tag++))},r.prototype.sendable=function(){return this.credit&&this.session.outgoing.available()},r.prototype.on_flow=function(a){var b=a.performative;this.credit=b.delivery_count+b.link_credit-this.delivery_count,this._draining=b.drain,this._drained=this.credit>0,this.is_open()&&(this.dispatch("sender_flow",this._context()),this._draining&&this.dispatch("sender_draining",this._context()),this.sendable()&&this.dispatch("sendable",this._context()))},r.prototype.on_transfer=function(){throw Error("got transfer on sending link")},r.prototype.send=function(a,b){var c=this.session.send(this,b?b:this.next_tag(),k.encode(a),0);return 1===this.local.attach.snd_settle_mode&&(c.settled=!0),c};var s=function(a,b,c,d){this.init(a,b,c,d,!0),this.drain=!1,this.set_credit_window(this.get_option("credit_window",100)),this.get_option("autoaccept",!0)&&this.observers.on("message",e)};s.prototype=Object.create(p),s.prototype.constructor=s,s.prototype.on_flow=function(a){this.dispatch("receiver_flow",this._context()),a.performative.drain&&(a.performative.link_credit>0?console.log("ERROR: received flow with drain set, but non zero credit"):this.dispatch("receiver_drained",this._context()))},s.prototype.flow=function(a){a>0&&(this.credit+=a,this.issue_flow=!0,this.connection._register())},s.prototype.add_credit=s.prototype.flow,s.prototype._get_drain=function(){return this.drain},s.prototype.set_credit_window=function(a){if(a>0){var b=new n(a),c=b.update.bind(b);this.observers.on("message",c),this.observers.on("receiver_open",c)}},b.exports={Sender:r,Receiver:s}}).call(this,a("buffer").Buffer)},{"./endpoint.js":2,"./frames.js":3,"./log.js":5,"./message.js":6,"./terminus.js":10,buffer:16,events:20,util:30}],5:[function(a,b,c){"use strict";var d=a("debug");b.exports={frames:d("rhea:frames"),raw:d("rhea:raw"),reconnect:d("rhea:reconnect"),events:d("rhea:events"),message:d("rhea:message"),flow:d("rhea:flow"),io:d("rhea:io")}},{debug:31}],6:[function(a,b,c){"use strict";function d(a,b,c){b.descriptor=a,p[a.symbolic]=b,p[Number(a.numeric).toString(10)]=b,c&&q.push(c)}function e(a){var b=n.define_composite(a);r[a.name]=b.create,o[Number(b.descriptor.numeric).toString(10)]=b,o[b.descriptor.symbolic]=b;var c=function(c,d){c[a.name]=new b(d.value)},e=function(c,d){d[a.name]&&(d[a.name].described?c.push(d[a.name].described()):c.push(b.create(d[a.name]).described()))};d(b.descriptor,c,e)}function f(a){var b={numeric:a.code};b.symbolic="amqp:"+a.name.replace(/_/g,"-")+":map";var c=function(b,c){b[a.name]=n.unwrap(c)},e=function(c,d){d[a.name]&&c.push(n.described(n.wrap_ulong(b.numeric),n.wrap_map(d[a.name])))};d(b,c,e)}function g(a){var b={};for(var c in a){var d=a[c];for(var e in d)b[d[e]]=c}return b}function h(a,b){for(var c in a){var d=a[c];"object"==typeof d?h(d,b[c]):b[c]=d}}function i(a,b,c){Object.defineProperty(a,c,{get:function(){return this[b]?this[b][c]:void 0},set:function(a){void 0===this[b]&&(this[b]={}),this[b][c]=a}})}function j(a){var b={toJSON:function(){var a={};for(var b in u){var c=u[b];if("function"!=typeof this[c]){var d=s[c];if(d)for(var e in d)void 0!==this[d[e]]&&(void 0===a[c]&&(a[c]={}),a[c][d[e]]=this[d[e]]);else this[c]&&(a[c]=this[c])}}return a},inspect:function(){return JSON.stringify(this.toJSON())},toString:function(){return JSON.stringify(this.toJSON())}};for(var c in t)i(b,t[c],c);return a&&h(a,b),b}function k(a){var b=void 0;for(var c in a)if("function"!=typeof a[c]&&u.indexOf(c)<0){void 0===b&&(b={});var d=t[c]||"application_properties";void 0===b[d]&&(b[d]={}),b[d][c]=a[c]}else void 0!==b&&(b[c]=a[c]);return b||a}function l(a){var b=n.define_composite(a);b.composite_type=a.name,r[a.name]=b.create,v[Number(b.descriptor.numeric).toString(10)]=b,v[b.descriptor.symbolic]=b,r["is_"+a.name]=function(b){if(b&&b.descriptor){var c=v[b.descriptor.value];if(c)return c.descriptor.numeric===a.code}return!1}}var m=a("./log.js"),n=a("./types.js"),o={},p={},q=[],r={};e({name:"header",code:112,fields:[{name:"durable",type:"boolean",default_value:!1},{name:"priority",type:"ubyte",default_value:4},{name:"ttl",type:"uint"},{name:"first_acquirer",type:"boolean",default_value:!1},{name:"delivery_count",type:"uint",default_value:0}]}),f({name:"delivery_annotations",code:113}),f({name:"message_annotations",code:114}),e({name:"properties",code:115,fields:[{name:"message_id",type:"message_id"},{name:"user_id",type:"binary"},{name:"to",type:"string"},{name:"subject",type:"string"},{name:"reply_to",type:"string"},{name:"correlation_id",type:"message_id"},{name:"content_type",type:"symbol"},{name:"content_encoding",type:"symbol"},{name:"absolute_expiry_time",type:"timestamp"},{name:"creation_time",type:"timestamp"},{name:"group_id",type:"string"},{name:"group_sequence",type:"uint"},{name:"reply_to_group_id",type:"string"}]}),f({name:"application_properties",code:116}),d({numeric:119,symbolic:"amqp:value:*"},function(a,b){a.body=n.unwrap(b)},function(a,b){a.push(n.described(n.wrap_ulong(119),n.wrap(b.body)))}),f({name:"footer",code:120});var s={properties:["message_id","user_id","to","subject","reply_to","correlation_id","content_type","content_encoding","absolute_expiry_time","creation_time","group_id","group_sequence","reply_to_group_id"],header:["durable","priority","ttl","first_acquirer","delivery_count"]},t=g(s),u=["header","delivery_annotations","message_annotations","properties","application_properties","body","footer"];r.encode=function(a){var b=[],c=k(a);q.forEach(function(a){a(b,c)});for(var d=new n.Writer,e=0;e<b.length;e++)m.message("Encoding section "+(e+1)+" of "+b.length+": "+b[e]),d.write(b[e]);var f=d.toBuffer();return m.message("encoded "+f.length+" bytes"),f},r.decode=function(a){for(var b=j(),c=new n.Reader(a);c.remaining();){var d=c.read();if(m.message("decoding section: "+JSON.stringify(d)+" of type: "+JSON.stringify(d.descriptor)),d.descriptor){var e=p[d.descriptor.value];e?e(b,d):console.log("WARNING: did not recognise message section with descriptor "+d.descriptor)}else console.log("WARNING: expected described message section got "+JSON.stringify(d))}if(b.application_properties)for(var f in b.application_properties)i(b,"application_properties",f);return b};var v={};r.unwrap_outcome=function(a){if(a&&a.descriptor){var b=v[a.descriptor.value];if(b)return new b(n.unwrap(a))}return console.log("unrecognised outcome: "+JSON.stringify(a)),a},r.are_outcomes_equivalent=function(a,b){return void 0===a&&void 0===b?!0:void 0===a||void 0===b?!1:a.descriptor.value===b.descriptor.value&&JSON.stringify(a)===JSON.stringify(b)},l({name:"received",code:35,fields:[{name:"section_number",type:"uint",mandatory:!0},{name:"section_offset",type:"ulong",mandatory:!0}]}),l({name:"accepted",code:36,fields:[]}),l({name:"rejected",code:37,fields:[{name:"error",type:"error"}]}),l({name:"released",code:38,fields:[]}),l({name:"modified",code:39,fields:[{name:"delivery_failed",type:"boolean"},{name:"undeliverable_here",type:"boolean"},{name:"message_annotations",type:"map"}]}),b.exports=r},{"./log.js":5,"./types.js":12}],7:[function(a,b,c){"use strict";function d(a,b){return b?Array.isArray(b)?b.indexOf(a)>-1:a===b:!1}var e=a("url"),f={counter:1,next:function(){return this.counter++}},g=function(a,b){var c=e.parse(b);this.connection=a.connect({host:c.hostname,port:c.port}),this.connection.on("message",this._response.bind(this)),this.connection.on("receiver_open",this._ready.bind(this)),this.sender=this.connection.attach_sender(c.path.substr(1)),this.receiver=this.connection.attach_receiver({source:{dynamic:!0}}),this.id_generator=f,this.pending=[],this.outstanding={}};g.prototype._request=function(a,b,c,d){var e={properties:{}};e.properties.subject=b,e.body=c,e.properties.message_id=a,e.properties.reply_to=this.receiver.remote.attach.source.address,this.outstanding[a]=d,this.sender.send(e)},g.prototype._response=function(a){var b=a.message.properties.correlation_id,c=this.outstanding[b];c?"ok"===a.message.properties.subject?c(a.message.body):c(void 0,{name:a.message.properties.subject,description:a.message.body}):console.log("no request pending for "+b+", ignoring response")},g.prototype._ready=function(){this._process_pending()},g.prototype._process_pending=function(){for(var a=0;a<this.pending.length;a++){var b=this.pending[a];this._request(b.id,b.name,b.args,b.callback)}this.pending=[]},g.prototype.call=function(a,b,c){var d=this.id_generator.next();this.receiver.is_open()&&0===this.pending.length?this._request(d,a,b,c):this.pending.push({
  name:a,args:b,callback:c,id:d})},g.prototype.close=function(){this.receiver.close(),this.sender.close(),this.connection.close()},g.prototype.define=function(a){this[a]=function(b,c){this.call(a,b,c)}};var h=function(a,b){this.ttl=a,this.purged=b,this.entries={},this.timeout=void 0};h.prototype.clear=function(){this.timeout&&clearTimeout(this.timeout),this.entries={}},h.prototype.put=function(a,b){this.entries[a]={value:b,last_accessed:Date.now()},this.timeout||(this.timeout=setTimeout(this.purge.bind(this),this.ttl))},h.prototype.get=function(a){var b=this.entries[a];return b?(b.last_accessed=Date.now(),b.value):void 0},h.prototype.purge=function(){var a=Date.now(),b=[],c=0;for(var d in this.entries)a-this.entries[d].last_accessed>=this.ttl?b.push(d):c++;for(var e=0;e<b.length;e++){var f=this.entries[b[e]];delete this.entries[b[e]],this.purged(f.value)}c&&!this.timeout&&(this.timeout=setTimeout(this.purge.bind(this),this.ttl))};var i=function(a,b){this.factory=a,this.cache=new h(b,function(a){a.close()})};i.prototype.clear=function(){this.cache.clear()},i.prototype.get=function(a){var b=this.cache.get(a);return void 0===b&&(b=this.factory(a),this.cache.put(a,b)),b};var j=function(a,b,c){this.options=c||{};var d=e.parse(b);this.connection=a.connect({host:d.hostname,port:d.port}),this.connection.on("connection_open",this._connection_open.bind(this)),this.connection.on("message",this._request.bind(this)),this.receiver=this.connection.attach_receiver(d.path.substr(1)),this.callbacks={},this._send=void 0,this._clear=void 0};j.prototype._connection_open=function(){if(d("ANONYMOUS-RELAY",this.connection.remote.open.offered_capabilities)){var a=this.connection.attach_sender({target:{}});this._send=function(b){a.send(b)}}else{var b=new i(this.connection.attach_sender.bind(this.connection),this.options.cache_ttl||6e4);this._send=function(a){var c=b.get(a.properties.to);c&&c.send(a)},this._clear=function(){b.clear()}}},j.prototype._respond=function(a){var b=this;return function(c,d){d?(a.properties.subject=d.name||"error",a.body=d.description||d):(a.properties.subject="ok",a.body=c),b._send(a)}},j.prototype._request=function(a){var b=a.message,c={properties:{}};c.properties.to=b.properties.reply_to,c.properties.correlation_id=b.properties.message_id;var d=this.callbacks[b.properties.subject];d?d(b.body,this._respond(c)):(c.properties.subject="bad-method",c.body="Unrecognised method "+b.properties.subject,this._send(c))},j.prototype.bind_sync=function(a,b){this.callbacks[b||a.name]=function(b,c){var d=a(b);c(d)}},j.prototype.bind=function(a,b){this.callbacks[b||a.name]=a},j.prototype.close=function(){this._clear&&this._clear(),this.receiver.close(),this.connection.close()},b.exports={server:function(a,b,c){return new j(a,b,c)},client:function(a,b){return new g(a,b)}}},{url:26}],8:[function(a,b,c){(function(c){"use strict";function d(a){for(var b=[],c=0,d=0;d<a.length;)0===a[d]?(d>c?b.push(a.toString("utf8",c,d)):b.push(null),c=++d):++d;return d>c?b.push(a.toString("utf8",c,d)):b.push(null),b}var e=a("./frames.js"),f=a("./transport.js"),g={OK:0,AUTH:1,SYS:2,SYS_PERM:3,SYS_TEMP:4},h=3,i=function(a){this.callback=a,this.outcome=void 0,this.username=void 0};i.prototype.start=function(a){var b=d(a);3!==b.length&&this.connection.sasl_failed("Unexpected response in PLAIN, got "+b.length+" fields, expected 3"),this.callback(b[1],b[2])?(this.outcome=!0,this.username=b[1]):this.outcome=!1};var j=function(a,b){this.username=a,this.password=b};j.prototype.start=function(){var a=new c(1+this.username.length+1+this.password.length);return a.writeUInt8(0,0),a.write(this.username,1),a.writeUInt8(0,1+this.username.length),a.write(this.password,1+this.username.length+1),a};var k=function(){this.outcome=void 0,this.username=void 0};k.prototype.start=function(a){this.outcome=!0,this.username=a?a.toString("utf8"):"anonymous"};var l=function(a){this.username=a?a:"anonymous"};l.prototype.start=function(){var a=new c(1+this.username.length);return a.writeUInt8(0,0),a.write(this.username,1),a};var m=function(){this.outcome=void 0,this.username=void 0};m.prototype.start=function(){this.outcome=!0};var n=function(){this.username=void 0};n.prototype.start=function(){return null};var o=function(a,b){this.connection=a,this.transport=new f(a.amqp_transport.identifier,h,e.TYPE_SASL,this),this.next=a.amqp_transport,this.mechanisms=b,this.mechanism=void 0,this.outcome=void 0,this.username=void 0;var c=Object.getOwnPropertyNames(b);this.transport.encode(e.sasl_frame(e.sasl_mechanisms({sasl_server_mechanisms:c}).described()))};o.prototype.do_step=function(a){void 0===this.mechanism.outcome?this.transport.encode(e.sasl_frame(e.sasl_challenge({challenge:a}).described())):(this.outcome=this.mechanism.outcome?g.OK:g.AUTH,this.transport.encode(e.sasl_frame(e.sasl_outcome({code:this.outcome}).described())),this.outcome===g.OK&&(this.username=this.mechanism.username,this.transport.write_complete=!0,this.transport.read_complete=!0))},o.prototype.on_sasl_init=function(a){var b=this.mechanisms[a.performative.mechanism];if(b){this.mechanism=b();var c=this.mechanism.start(a.performative.initial_response);this.do_step(c)}else this.outcome=g.AUTH,this.transport.encode(e.sasl_frame(e.sasl_outcome({code:this.outcome}).described()))},o.prototype.on_sasl_response=function(a){this.do_step(this.mechanism.step(a.performative.response))},o.prototype.has_writes_pending=function(){return this.transport.has_writes_pending()||this.next.has_writes_pending()},o.prototype.write=function(a){return this.transport.write_complete&&0===this.transport.pending.length?this.next.write(a):this.transport.write(a)},o.prototype.read=function(a){return this.transport.read_complete?this.next.read(a):this.transport.read(a)};var p=function(a,b){this.connection=a,this.transport=new f(a.amqp_transport.identifier,h,e.TYPE_SASL,this),this.next=a.amqp_transport,this.mechanisms=b,this.mechanism=void 0,this.mechanism_name=void 0,this.failed=!1};p.prototype.on_sasl_mechanisms=function(a){for(var b=0;void 0===this.mechanism&&b<a.performative.sasl_server_mechanisms.length;b++){var c=a.performative.sasl_server_mechanisms[b],d=this.mechanisms[c];d&&(this.mechanism=d(),this.mechanism_name=c)}if(this.mechanism){var f=this.mechanism.start();this.transport.encode(e.sasl_frame(e.sasl_init({mechanism:this.mechanism_name,initial_response:f}).described()))}else this.failed=!0,this.connection.sasl_failed("No suitable mechanism; server supports "+a.performative.sasl_server_mechanisms)},p.prototype.on_sasl_challenge=function(a){var b=this.mechanism.step(a.performative.challenge);this.transport.encode(e.sasl_frame(e.sasl_response({response:b}).described()))},p.prototype.on_sasl_outcome=function(a){switch(a.performative.code){case g.OK:this.transport.read_complete=!0,this.transport.write_complete=!0;break;default:this.transport.write_complete=!0,this.connection.sasl_failed("Failed to authenticate: "+a.performative.code)}},p.prototype.has_writes_pending=function(){return this.transport.has_writes_pending()||this.next.has_writes_pending()},p.prototype.write=function(a){return this.transport.write_complete?this.next.write(a):this.transport.write(a)},p.prototype.read=function(a){return this.transport.read_complete?this.next.read(a):this.transport.read(a)};var q={enable_anonymous:function(){this.ANONYMOUS=function(){return new k}},enable_plain:function(a){this.PLAIN=function(){return new i(a)}}},r={enable_anonymous:function(a){this.ANONYMOUS=function(){return new l(a)}},enable_plain:function(a,b){this.PLAIN=function(){return new j(a,b)}},enable_external:function(){this.EXTERNAL=function(){return new n}}};b.exports={Client:p,Server:o,server_mechanisms:function(){return Object.create(q)},client_mechanisms:function(){return Object.create(r)},server_add_external:function(a){return a.EXTERNAL=function(){return new m},a}}}).call(this,a("buffer").Buffer)},{"./frames.js":3,"./transport.js":11,buffer:16}],9:[function(a,b,c){(function(c){"use strict";function d(a){var b,c,d,e,g;for(e=0;e<a.length;e++)g=a[e],void 0===b&&(b=g,c=g,d=g.id),i.are_outcomes_equivalent(c.state,g.state)&&c.settled===g.settled&&d===g.id?(c.id!==g.id&&(c=g),d++):(b.link.session.output(f.disposition({role:b.link.is_receiver(),first:b.id,last:c.id,state:b.state,settled:b.settled}).described()),b=g,c=g,d=g.id);void 0!==b&&void 0!==c&&b.link.session.output(f.disposition({role:b.link.is_receiver(),first:b.id,last:c.id,state:b.state,settled:b.settled}).described())}function e(a,b,c){var d=b?b:{};"string"==typeof b&&(d={},d[c]=b),d.name||(d.name=k.generate_uuid());var e=a(d.name,d);for(var f in{source:0,target:0})d[f]&&("string"==typeof d[f]&&(d[f]={address:d[f]}),e["set_"+f](d[f]));return e.attach(),e}var f=a("./frames.js"),g=a("./link.js"),h=a("./log.js"),i=a("./message.js"),j=a("./types.js"),k=a("./util.js"),l=a("./endpoint.js"),m=a("events").EventEmitter,n=function(a){this.capacity=a,this.size=0,this.head=0,this.tail=0,this.entries=[]};n.prototype.available=function(){return this.capacity-this.size},n.prototype.push=function(a){if(!(this.size<this.capacity))throw Error("circular buffer overflow: head="+this.head+" tail="+this.tail+" size="+this.size+" capacity="+this.capacity);this.entries[this.tail]=a,this.tail=(this.tail+1)%this.capacity,this.size++},n.prototype.pop_if=function(a){for(var b=0;this.size&&a(this.entries[this.head]);)this.entries[this.head]=void 0,this.head=(this.head+1)%this.capacity,this.size--,b++;return b},n.prototype.by_id=function(a){if(this.size>0){var b=a-this.entries[this.head].id;if(b<this.size)return this.entries[(this.head+b)%this.capacity]}return void 0},n.prototype.get_head=function(){return this.size>0?this.entries[this.head]:void 0};var o=function(){this.deliveries=new n(2048),this.updated=[],this.pending_dispositions=[],this.next_delivery_id=0,this.next_pending_delivery=0,this.next_transfer_id=0,this.window=j.MAX_UINT,this.remote_next_transfer_id=void 0,this.remote_window=void 0};o.prototype.available=function(){return this.deliveries.available()},o.prototype.send=function(a,b,c,d){var e={id:this.next_delivery_id++,tag:b,link:a,data:c,format:d?d:0,sent:!1,settled:!1,state:void 0,remote_settled:!1,remote_state:void 0},f=this;return e.update=function(a,b){f.update(e,a,b)},this.deliveries.push(e),e},o.prototype.on_begin=function(a){this.remote_window=a.incoming_window},o.prototype.on_flow=function(a){this.remote_next_transfer_id=a.next_incoming_id,this.remote_window=a.incoming_window},o.prototype.on_disposition=function(a){for(var b=a.last?a.last:a.first,c=a.first;b>=c;c++){var d=this.deliveries.by_id(c);if(d&&!d.remote_settled){var e=!1;a.settled&&(d.remote_settled=a.settled,e=!0),a.state&&a.state!==d.remote_state&&(d.remote_state=i.unwrap_outcome(a.state),e=!0),e&&this.updated.push(d)}}},o.prototype.update=function(a,b,c){a&&(a.settled=b,void 0!==c&&(a.state=c),a.remote_settled||this.pending_dispositions.push(a),a.link.connection._register())},o.prototype.transfer_window=function(){return this.remote_window?this.remote_window-(this.next_transfer_id-this.remote_next_transfer_id):0},o.prototype.process=function(){for(var a;this.next_pending_delivery<this.next_delivery_id;){if(a=this.deliveries.by_id(this.next_pending_delivery),!a){console.log("ERROR: Next pending delivery not found: "+this.next_pending_delivery);break}if(!a.link.has_credit()){h.flow("Link has no credit");break}if(a.link.delivery_count++,a.transfers_required=1,!(this.transfer_window()>=a.transfers_required)){h.flow("Incoming window of peer preventing sending further transfers: remote_window="+this.remote_window+", remote_next_transfer_id="+this.remote_next_transfer_id+", next_transfer_id="+this.next_transfer_id);break}this.next_transfer_id+=a.transfers_required,this.window-=a.transfers_required,a.link.session.output(f.transfer({handle:a.link.local.handle,message_format:a.format,delivery_id:a.id,delivery_tag:a.tag,settled:a.settled}).described(),a.data),a.link.credit--,this.next_pending_delivery++}for(var b=0;b<this.updated.length;b++)a=this.updated[b],a.remote_state&&a.remote_state.constructor.composite_type&&a.link.dispatch(a.remote_state.constructor.composite_type,a.link._context({delivery:a})),a.remote_settled&&a.link.dispatch("settled",a.link._context({delivery:a}));this.updated=[],this.pending_dispositions.length&&(d(this.pending_dispositions),this.pending_dispositions=[]),this.deliveries.pop_if(function(a){return a.settled&&a.remote_settled})};var p=function(){this.deliveries=new n(2048),this.updated=[],this.next_transfer_id=0,this.next_delivery_id=void 0,this.window=2048,this.remote_next_transfer_id=void 0,this.remote_window=void 0};p.prototype.update=function(a,b,c){a&&(a.settled=b,void 0!==c&&(a.state=c),a.remote_settled||this.updated.push(a),a.link.connection._register())},p.prototype.on_transfer=function(a,b){if(this.next_transfer_id++,b.is_open()){void 0===this.next_delivery_id&&(this.next_delivery_id=a.performative.delivery_id);var d,e,f=this.deliveries.get_head();if(f&&f.incomplete){if(void 0!==a.performative.delivery_id&&this.next_delivery_id!==a.performative.delivery_id)throw Error("frame sequence error: delivery "+this.next_delivery_id+" not complete, got "+a.performative.delivery_id);d=f,e=c.concat([d.data,a.payload],d.data.size()+a.payload.size())}else{if(this.next_delivery_id!==a.performative.delivery_id)throw Error("frame sequence error: expected "+this.next_delivery_id+", got "+a.performative.delivery_id);d={id:a.performative.delivery_id,tag:a.performative.delivery_tag,link:b,settled:!1,state:void 0,remote_settled:void 0===a.performative.settled?!1:a.performative.settled,remote_state:a.performative.state};var g=this;d.update=function(a,c){var e=a;void 0===e&&(e=1!==b.local.attach.rcv_settle_mode),g.update(d,e,c)},d.accept=function(){this.update(void 0,i.accepted().described())},d.release=function(a){a?this.update(void 0,i.modified(a).described()):this.update(void 0,i.released().described())},d.reject=function(a){this.update(!0,i.rejected({error:a}).described())},d.modified=function(a){this.update(!0,i.modified(a).described())},this.deliveries.push(d),e=a.payload}d.incomplete=a.performative.more,d.incomplete?d.data=e:(b.credit--,b.delivery_count++,this.next_delivery_id++,b.dispatch("message",b._context({message:i.decode(e),delivery:d})))}},p.prototype.process=function(){this.updated.length>0&&(d(this.updated),this.updated=[]),this.deliveries.pop_if(function(a){return a.settled})},p.prototype.on_begin=function(a){this.remote_window=a.outgoing_window},p.prototype.on_flow=function(a){this.remote_next_transfer_id=a.next_outgoing_id,this.remote_window=a.outgoing_window},p.prototype.on_disposition=function(a){for(var b=a.last?a.last:a.first,c=a.first;b>=c;c++){var d=this.deliveries.by_id(c);d&&!d.remote_settled&&a.settled&&(d.remote_settled=a.settled,d.link.dispatch("settled",d.link._context({delivery:d})))}};var q=function(a,b){this.connection=a,this.outgoing=new o,this.incoming=new p,this.state=new l,this.local={channel:b,handles:{}},this.local.begin=f.begin({next_outgoing_id:this.outgoing.next_transfer_id,incoming_window:this.incoming.window,outgoing_window:this.outgoing.window}),this.local.end=f.end(),this.remote={handles:{}},this.links={},this.options={}};q.prototype=Object.create(m.prototype),q.prototype.constructor=q,q.prototype.reset=function(){this.state.disconnected(),this.outgoing=new o,this.incoming=new p,this.remote={handles:{}};for(var a in this.links)this.links[a].reset()},q.prototype.dispatch=function(a){return h.events("Session got event: "+a),this.listeners(a).length?(m.prototype.emit.apply(this,arguments),!0):this.connection.dispatch.apply(this.connection,arguments)},q.prototype.output=function(a,b){this.connection._write_frame(this.local.channel,a,b)},q.prototype.create_sender=function(a,b){return this.create_link(a,g.Sender,b)},q.prototype.create_receiver=function(a,b){return this.create_link(a,g.Receiver,b)},q.prototype.get_option=function(a,b){return void 0!==this.options[a]?this.options[a]:this.connection.get_option(a,b)},q.prototype.attach_sender=function(a){return e(this.create_sender.bind(this),a,"target")},q.prototype.open_sender=q.prototype.attach_sender,q.prototype.attach_receiver=function(a){return e(this.create_receiver.bind(this),a,"source")},q.prototype.open_receiver=q.prototype.attach_receiver,q.prototype.create_link=function(a,b,c){for(var d=0;this.local.handles[d];)d++;var e=new b(this,a,d,c);return this.links[a]=e,this.local.handles[d]=e,e},q.prototype.begin=function(){this.state.open()&&this.connection._register()},q.prototype.open=q.prototype.begin,q.prototype.end=function(a){a&&(this.local.end.error=a),this.state.close()&&this.connection._register()},q.prototype.close=q.prototype.end,q.prototype.is_open=function(){return this.connection.is_open()&&this.state.is_open()},q.prototype.is_closed=function(){return this.connection.is_closed()||this.state.is_closed()},q.prototype._process=function(){do{this.state.need_open()&&this.output(this.local.begin.described()),this.outgoing.process(),this.incoming.process();for(var a in this.links)this.links[a]._process();this.state.need_close()&&this.output(this.local.end.described())}while(!this.state.has_settled())},q.prototype.send=function(a,b,c,d){var e=this.outgoing.send(a,b,c,d);return this.connection._register(),e},q.prototype._write_flow=function(a){var b={next_incoming_id:this.incoming.next_transfer_id,incoming_window:this.incoming.window,next_outgoing_id:this.outgoing.next_transfer_id,outgoing_window:this.outgoing.window};a&&(a._get_drain()&&(b.drain=!0),b.delivery_count=a.delivery_count,b.handle=a.local.handle,b.link_credit=a.credit),this.output(f.flow(b).described())},q.prototype.on_begin=function(a){if(!this.state.remote_opened())throw Error("Begin already received");this.remote.channel||(this.remote.channel=a.channel),this.remote.begin=a.performative,this.outgoing.on_begin(a.performative),this.incoming.on_begin(a.performative),this.open(),this.dispatch("session_open",this._context())},q.prototype.on_end=function(a){if(!this.state.remote_closed())throw Error("End already received");this.remote.end=a.performative,this.close(),this.dispatch("session_close",this._context())},q.prototype.on_attach=function(a){var b=a.performative.name,c=this.links[b];c||(c=a.performative.role?this.create_sender(b):this.create_receiver(b)),this.remote.handles[a.performative.handle]=c,c.on_attach(a),c.remote.attach=a.performative},q.prototype.on_disposition=function(a){a.performative.role?(h.events("Received disposition for outgoing transfers"),this.outgoing.on_disposition(a.performative)):(h.events("Received disposition for incoming transfers"),this.incoming.on_disposition(a.performative)),this.connection._register()},q.prototype.on_flow=function(a){this.outgoing.on_flow(a.performative),this.incoming.on_flow(a.performative),void 0!==a.performative.handle&&this._get_link(a).on_flow(a),this.connection._register()},q.prototype._context=function(a){var b=a?a:{};return b.session=this,this.connection._context(b)},q.prototype._get_link=function(a){var b=a.performative.handle,c=this.remote.handles[b];if(!c)throw Error("Invalid handle "+b);return c},q.prototype.on_detach=function(a){this._get_link(a).on_detach(a);var b=a.performative.handle,c=this.remote.handles[b];delete this.remote.handles[b],delete this.local.handles[c.local.handle],delete this.links[c.name]},q.prototype.on_transfer=function(a){this.incoming.on_transfer(a,this._get_link(a))},b.exports=q}).call(this,a("buffer").Buffer)},{"./endpoint.js":2,"./frames.js":3,"./link.js":4,"./log.js":5,"./message.js":6,"./types.js":12,"./util.js":13,buffer:16,events:20}],10:[function(a,b,c){"use strict";function d(a){var b=e.define_composite(a);f[a.name]=b.create,g[Number(b.descriptor.numeric).toString(10)]=b,g[b.descriptor.symbolic]=b}var e=a("./types.js"),f={},g={};f.unwrap=function(a){if(a&&a.descriptor){var b=g[a.descriptor.value];if(b)return new b(a.value);console.log("Unknown terminus: "+a.descriptor)}return null},d({name:"source",code:40,fields:[{name:"address",type:"string"},{name:"durable",type:"uint",default_value:0},{name:"expiry_policy",type:"symbol",default_value:"session-end"},{name:"timeout",type:"uint",default_value:0},{name:"dynamic",type:"boolean",default_value:!1},{name:"dynamic_node_properties",type:"symbolic_map"},{name:"distribution_mode",type:"symbol"},{name:"filter",type:"symbolic_map"},{name:"default_outcome",type:"*"},{name:"outcomes",type:"symbol",multiple:!0},{name:"capabilities",type:"symbol",multiple:!0}]}),d({name:"target",code:41,fields:[{name:"address",type:"string"},{name:"durable",type:"uint",default_value:0},{name:"expiry_policy",type:"symbol",default_value:"session-end"},{name:"timeout",type:"uint",default_value:0},{name:"dynamic",type:"boolean",default_value:!1},{name:"dynamic_node_properties",type:"symbolic_map"},{name:"capabilities",type:"symbol",multiple:!0}]}),b.exports=f},{"./types.js":12}],11:[function(a,b,c){(function(c){"use strict";var d=a("./frames.js"),e=a("./log.js"),f=function(a,b,c,d){this.identifier=a,this.protocol_id=b,this.frame_type=c,this.handler=d,this.pending=[],this.header_sent=void 0,this.header_received=void 0,this.write_complete=!1,this.read_complete=!1};f.prototype.has_writes_pending=function(){return this.pending.length>0},f.prototype.encode=function(a){var b=d.write_frame(a);e.frames("["+this.identifier+"] PENDING: "+JSON.stringify(a)),this.pending.push(b)},f.prototype.write=function(a){if(!this.header_sent){var b=new c(8),f={protocol_id:this.protocol_id,major:1,minor:0,revision:0};d.write_header(b,f),a.write(b),this.header_sent=f}for(var g=0;g<this.pending.length;g++)a.write(this.pending[g]),e.raw("["+this.identifier+"] SENT: "+JSON.stringify(this.pending[g]));this.pending=[]},f.prototype.read=function(a){var b=0;if(!this.header_received){if(a.length<8)return b;if(this.header_received=d.read_header(a),e.frames("["+this.identifier+"] RECV: "+JSON.stringify(this.header_received)),this.header_received.protocol_id!==this.protocol_id)throw Error("Invalid AMQP protocol id "+this.header_received.protocol_id+" expecting: "+this.protocol_id);b=8}for(;b<a.length&&!this.read_complete;){var c=a.readUInt32BE(b);if(e.io("["+this.identifier+"] got frame of size "+c),a.length<b+c){e.io("["+this.identifier+"] incomplete frame; have only "+(a.length-b)+" of "+c);break}var f=d.read_frame(a.slice(b,b+c));if(e.frames("["+this.identifier+"] RECV: "+JSON.stringify(f)),f.type!==this.frame_type)throw Error("Invalid frame type: "+f.type);b+=c,f.performative&&f.performative.dispatch(this.handler,f)}return b},b.exports=f}).call(this,a("buffer").Buffer)},{"./frames.js":3,"./log.js":5,buffer:16}],12:[function(a,b,c){(function(a){"use strict";function c(a,b){this.type=a,this.value=b}function d(a){return Number(a).toString(16)}function e(a,b,e,f){var g,h=b>>>4;switch(g=4===h?function(){this.type=g,this.value=f}:14===h||15===h?function(a,b,c){this.type=g,this.value=a,this.array_constructor={typecode:b},c&&(this.array_constructor.descriptor=c)}:function(a){this.type=g,this.value=a},g.typecode=b,g.prototype=Object.create(c.prototype),g.toString=function(){return a+"#"+d(b)},h){case 4:g.width=0,g.category="fixed";break;case 5:g.width=1,g.category="fixed";break;case 6:g.width=2,g.category="fixed";break;case 7:g.width=4,g.category="fixed";break;case 8:g.width=8,g.category="fixed";break;case 9:g.width=16,g.category="fixed";break;case 10:g.width=1,g.category="variable";break;case 11:g.width=4,g.category="variable";break;case 12:g.width=1,g.category="compound";break;case 13:g.width=4,g.category="compound";break;case 14:g.width=1,g.category="array";break;case 15:g.width=4,g.category="array"}if(e)for(var i in e)g[i]=e[i];return t.by_code[g.typecode]=g,t[a]=g,g}function f(a){return{read:function(b,c){return b["read"+a](c)},write:function(b,c,d){b["write"+a](c,d)}}}function g(a){return{read:function(b,c){return b["read"+a+"BE"](c)},write:function(b,c,d){b["write"+a+"BE"](c,d)}}}function h(a,b,c){if("number"==typeof b||b instanceof Number){var d=Math.floor(b/u),e=b%u;a.writeUInt32BE(d,c),a.writeUInt32BE(e,c+4)}else b.copy(a,c)}function i(a,b){var c=a.readUInt32BE(b),d=a.readUInt32BE(b+4);return 2097153>c?c*u+d:a.slice(b,b+8)}function j(a,b,c){if("number"==typeof b||b instanceof Number){var d=Math.abs(b),e=Math.floor(d/u),f=d%u;if(a.writeInt32BE(e,c),a.writeUInt32BE(f,c+4),0>b)for(var g=1,h=0;8>h;h++){var i=c+(7-h),j=(255^a[i])+g;a[i]=255&j,g=j>>8}}else b.copy(a,c)}function k(a,b){var c=a.readInt32BE(b),d=a.readUInt32BE(b+4);return 2097153>c&&c>-2097153?c*u+d:a.slice(b,b+8)}function l(a,b){for(var c=0;c<b.length;c++)if(a.type.typecode===b[c].typecode)return!0;return!1}function m(a){for(var b={},c=0;c+1<a.length;)b[a[c++]]=a[c++];return b}function n(a){var b=t.by_code[a];if(!b)throw Error("Unrecognised typecode: "+d(a));return b}function o(a,b){return a>b?a:b}function p(a){if("symbol"===a)return{typecode:t.Sym8.typecode};throw Error("TODO: Array of type "+a+" not yet supported")}function q(a,b){if(void 0!==b&&null!==b){if(Array.isArray(b)){if(!a.multiple)throw Error("Field "+a.name+" does not support multiple values, got "+JSON.stringify(b));var c=p(a.type);return t.wrap_array(b,c.typecode,c.descriptor)}if("*"===a.type)return b;var d=t["wrap_"+a.type];if(d)return d(b);throw Error("No wrapper for field "+a.name+" of type "+a.type)}if(a.mandatory)throw Error("Field "+a.name+" is mandatory");return new t.Null}function r(a,b){var c=function(){return"*"===b.type?this.value[a]:t.unwrap(this.value[a])},d=function(c){this.value[a]=q(b,c)};return{get:c,set:d,enumerable:!0,configurable:!1}}function s(a){var b=t.define_composite(a);t["wrap_"+a.name]=function(a){return b.create(a).described()},w[Number(b.descriptor.numeric).toString(10)]=b,w[b.descriptor.symbolic]=b}c.prototype.toString=function(){return this.value?this.value.toString():null},c.prototype.toLocaleString=function(){return this.value?this.value.toLocaleString():null},c.prototype.valueOf=function(){return this.value},c.prototype.toJSON=function(){return this.value&&this.value.toJSON?this.value.toJSON():this.value};var t={by_code:{}};Object.defineProperty(t,"MAX_UINT",{value:4294967295,writable:!1,configurable:!1}),Object.defineProperty(t,"MAX_USHORT",{value:65535,writable:!1,configurable:!1});var u=4294967296,v=-2147483647;e("Null",64,void 0,null),e("Boolean",86,f("UInt8")),e("True",65,void 0,!0),e("False",66,void 0,!1),e("Ubyte",80,f("UInt8")),e("Ushort",96,f("UInt16BE")),e("Uint",112,f("UInt32BE")),e("SmallUint",82,f("UInt8")),e("Uint0",67,void 0,0),e("Ulong",128,{write:h,read:i}),e("SmallUlong",83,f("UInt8")),e("Ulong0",68,void 0,0),e("Byte",81,f("Int8")),e("Short",97,f("Int16BE")),e("Int",113,f("Int32BE")),e("SmallInt",84,f("Int8")),e("Long",129,{write:j,read:k}),e("SmallLong",85,f("Int8")),e("Float",114,g("Float")),e("Double",130,g("Double")),e("Decimal32",116),e("Decimal64",132),e("Decimal128",148),e("CharUTF32",115),e("Timestamp",131,{write:j,read:k}),e("Uuid",152),e("Vbin8",160),e("Vbin32",176),e("Str8",161,{encoding:"utf8"}),e("Str32",177,{encoding:"utf8"}),e("Sym8",163,{encoding:"ascii"}),e("Sym32",179,{encoding:"ascii"}),e("List0",69,void 0,[]),e("List8",192),e("List32",208),e("Map8",193),e("Map32",209),e("Array8",224),e("Array32",240),t.is_ulong=function(a){return l(a,[t.Ulong,t.Ulong0,t.SmallUlong])},t.is_string=function(a){return l(a,[t.Str8,t.Str32])},t.is_symbol=function(a){return l(a,[t.Sym8,t.Sym32])},t.is_list=function(a){return l(a,[t.List0,t.List8,t.List32])},t.is_map=function(a){return l(a,[t.Map8,t.Map32])},t.wrap_boolean=function(a){return a?new t.True:new t.False},t.wrap_ulong=function(a){return 0===a?new t.Ulong0:a>255?new t.Ulong(a):new t.SmallUlong(a)},t.wrap_uint=function(a){return 0===a?new t.Uint0:a>255?new t.Uint(a):new t.SmallUint(a)},t.wrap_ushort=function(a){return new t.Ushort(a)},t.wrap_ubyte=function(a){return new t.Ubyte(a)},t.wrap_long=function(a){return a>127||-128>a?new t.Long(a):new t.SmallLong(a)},t.wrap_int=function(a){return a>127||-128>a?new t.Int(a):new t.SmallInt(a)},t.wrap_short=function(a){return new t.Short(a)},t.wrap_byte=function(a){return new t.Byte(a)},t.wrap_float=function(a){return new t.Float(a)},t.wrap_double=function(a){return new t.Double(a)},t.wrap_timestamp=function(a){return new t.Timestamp(a)},t.wrap_binary=function(a){return a.length>255?new t.Vbin32(a):new t.Vbin8(a)},t.wrap_string=function(a){return a.length>255?new t.Str32(a):new t.Str8(a)},t.wrap_symbol=function(a){return a.length>255?new t.Sym32(a):new t.Sym8(a)},t.wrap_list=function(a){if(0===a.length)return new t.List0;var b=a.map(t.wrap);return new t.List32(b)},t.wrap_map=function(a,b){var c=[];for(var d in a)c.push(b?b(d):t.wrap(d)),c.push(t.wrap(a[d]));return new t.Map32(c)},t.wrap_symbolic_map=function(a){return t.wrap_map(a,t.wrap_symbol)},t.wrap_array=function(a,b,c){if(b)return new t.Array32(a,b,c);throw Error("An array must specify a type for its elements")},t.wrap=function(a){var b=typeof a;if("string"===b)return t.wrap_string(a);if("boolean"===b)return a?new t.True:new t.False;if("number"===b||a instanceof Number){if(isNaN(a))throw Error("Cannot wrap NaN! "+a);return Math.floor(a)-a!==0?new t.Double(a):a>0?u>a?t.wrap_uint(a):t.wrap_ulong(a):a>v?t.wrap_int(a):t.wrap_long(a)}return a instanceof Date?t.wrap_timestamp(a.getTime()):a instanceof c?a:"undefined"===b||null===a?new t.Null:Array.isArray(a)?t.wrap_list(a):t.wrap_map(a)},t.wrap_described=function(a,b){var c=t.wrap(a);return b&&("string"==typeof b?c=t.described(t.wrap_string(b),c):("number"==typeof b||b instanceof Number)&&(c=t.described(t.wrap_ulong(b),c))),c},t.wrap_message_id=function(a){var b=typeof a;if("string"===b)return t.wrap_string(a);if("number"===b||a instanceof Number)return t.wrap_ulong(a);throw Error("invalid message id:"+a)};var w={};t.unwrap=function(a,b){if(a instanceof c){if(a.descriptor){var d=w[a.descriptor.value];if(d)return new d(a.value);if(b)return a}var e=t.unwrap(a.value,!0);return t.is_map(a)?m(e):e}return Array.isArray(a)?a.map(function(a){return t.unwrap(a,!0)}):a},t.described=function(a,b){var c=Object.create(b);return a.length?(c.descriptor=a.shift(),t.described(a,c)):(c.descriptor=a,c)},t.Reader=function(a){this.buffer=a,this.position=0},t.Reader.prototype.read_typecode=function(){return this.read_uint(1)},t.Reader.prototype.read_uint=function(a){var b=this.position;this.position+=a;var c=a>1?"readUInt"+8*a+"BE":"readUInt8";return this.buffer[c](b)},t.Reader.prototype.read_fixed_width=function(a){var b=this.position;return this.position+=a.width,a.read?a.read(this.buffer,b):this.buffer.slice(b,this.position)},t.Reader.prototype.read_variable_width=function(a){var b=this.read_uint(a.width),c=this.read_bytes(b);return a.encoding?c.toString(a.encoding):c},t.Reader.prototype.read=function(){var a=this.read_constructor(),b=this.read_value(n(a.typecode));return a.descriptor?t.described(a.descriptor,b):b},t.Reader.prototype.read_constructor=function(){var a=this.read_typecode();if(0===a){var b=[];b.push(this.read());for(var c=this.read_constructor();c.descriptor;)b.push(c.descriptor),c=this.read_constructor();return{typecode:c.typecode,descriptor:1===b.length?b[0]:b}}return{typecode:a}},t.Reader.prototype.read_value=function(a){if(0===a.width)return new a;if("fixed"===a.category)return new a(this.read_fixed_width(a));if("variable"===a.category)return new a(this.read_variable_width(a));if("compound"===a.category)return this.read_compound(a);if("array"===a.category)return this.read_array(a);throw Error("Invalid category for type: "+a)},t.Reader.prototype.read_multiple=function(a,b){for(var c=b?b:this.read.bind(this),d=[];d.length<a;)d.push(c.apply(this));return d},t.Reader.prototype.read_size_count=function(a){return{size:this.read_uint(a),count:this.read_uint(a)}},t.Reader.prototype.read_compound=function(a){var b=this.read_size_count(a.width);return new a(this.read_multiple(b.count))},t.Reader.prototype.read_array=function(a){var b=this.read_size_count(a.width),c=this.read_constructor(),d=new a(this.read_multiple(b.count,this.read_value.bind(this,n(c.typecode))),c.typecode,c.descriptor);
  return d},t.Reader.prototype.toString=function(){var a="buffer@"+this.position;this.position&&(a+=": ");for(var b=this.position;b<this.buffer.length;b++)b>0&&(a+=","),a+="0x"+Number(this.buffer[b]).toString(16);return a},t.Reader.prototype.reset=function(){this.position=0},t.Reader.prototype.skip=function(a){this.position+=a},t.Reader.prototype.read_bytes=function(a){var b=this.position;return this.position+=a,this.buffer.slice(b,this.position)},t.Reader.prototype.remaining=function(){return this.buffer.length-this.position},t.Writer=function(b){this.buffer=b?b:new a(1024),this.position=0},t.Writer.prototype.toBuffer=function(){return this.buffer.slice(0,this.position)},t.Writer.prototype.ensure=function(b){if(this.buffer.length<b){var c=new a(o(2*this.buffer.length,b));this.buffer.copy(c),this.buffer=c}},t.Writer.prototype.write_typecode=function(a){this.write_uint(a,1)},t.Writer.prototype.write_uint=function(a,b){var c=this.position;this.ensure(this.position+b),this.position+=b;var d=b>1?"writeUInt"+8*b+"BE":"writeUInt8";if(!this.buffer[d])throw Error("Buffer does not define "+d);return this.buffer[d](a,c)},t.Writer.prototype.write_fixed_width=function(a,b){var c=this.position;if(this.ensure(this.position+a.width),this.position+=a.width,a.write)a.write(this.buffer,b,c);else{if(!b.copy)throw Error("Cannot handle write for "+a);b.copy(this.buffer,c)}},t.Writer.prototype.write_variable_width=function(b,c){var d=b.encoding?new a(c,b.encoding):new a(c);this.write_uint(d.length,b.width),this.write_bytes(d)},t.Writer.prototype.write_bytes=function(a){var b=this.position;this.ensure(this.position+a.length),this.position+=a.length,a.copy(this.buffer,b)},t.Writer.prototype.write_constructor=function(a,b){b&&(this.write_typecode(0),this.write(b)),this.write_typecode(a)},t.Writer.prototype.write=function(a){if(!(a instanceof c))throw Error("Cannot write "+JSON.stringify(a));this.write_constructor(a.type.typecode,a.descriptor),this.write_value(a.type,a.value,a.array_constructor)},t.Writer.prototype.write_value=function(a,b,c){if(0!==a.width)if("fixed"===a.category)this.write_fixed_width(a,b);else if("variable"===a.category)this.write_variable_width(a,b);else if("compound"===a.category)this.write_compound(a,b);else{if("array"!==a.category)throw Error("Invalid category "+a.category+" for type: "+a);this.write_array(a,b,c)}},t.Writer.prototype.backfill_size=function(a,b){var c=this.position-b;this.position=b,this.write_uint(c-a,a),this.position+=c-a},t.Writer.prototype.write_compound=function(a,b){var c=this.position;this.position+=a.width,this.write_uint(b.length,a.width);for(var d=0;d<b.length;d++)void 0===b[d]||null===b[d]?this.write(new t.Null):this.write(b[d]);this.backfill_size(a.width,c)},t.Writer.prototype.write_array=function(a,b,c){var d=this.position;this.position+=a.width,this.write_uint(b.length,a.width),this.write_constructor(c.typecode,c.descriptor);for(var e=n(c.typecode),f=0;f<b.length;f++)this.write_value(e,b[f]);this.backfill_size(a.width,d)},t.Writer.prototype.toString=function(){var a="buffer@"+this.position;this.position&&(a+=": ");for(var b=0;b<this.position;b++)b>0&&(a+=","),a+=("00"+Number(this.buffer[b]).toString(16)).slice(-2);return a},t.Writer.prototype.skip=function(a){this.ensure(this.position+a),this.position+=a},t.Writer.prototype.clear=function(){this.buffer.fill(0),this.position=0},t.Writer.prototype.remaining=function(){return this.buffer.length-this.position},t.define_composite=function(a){var b=function(a){this.value=a?a:[]};b.descriptor={numeric:a.code,symbolic:"amqp:"+a.name+":list"},b.prototype.dispatch=function(b,c){b["on_"+a.name](c)};for(var c=0;c<a.fields.length;c++){var d=a.fields[c];Object.defineProperty(b.prototype,d.name,r(c,d))}return b.toString=function(){return a.name+"#"+Number(a.code).toString(16)},b.prototype.toJSON=function(){var a={};for(var b in this)"value"!==b&&this[b]&&(a[b]=this[b]);return a},b.create=function(a){var c=new b;for(var d in a)c[d]=a[d];return c},b.prototype.described=function(){return t.described(t.wrap_ulong(b.descriptor.numeric),t.wrap_list(this.value))},b},s({name:"error",code:29,fields:[{name:"condition",type:"symbol",mandatory:!0},{name:"description",type:"string"},{name:"info",type:"map"}]}),b.exports=t}).call(this,a("buffer").Buffer)},{buffer:16}],13:[function(a,b,c){"use strict";var d={};d.generate_uuid=function(){var a="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"===a?b:3&b|8;return c.toString(16)});return a},d.clone=function(a){for(var b=Object.create(a.prototype||{}),c=Object.getOwnPropertyNames(a),d=0;d<c.length;d++){var e=c[d];b[e]=a[e]}return b},b.exports=d},{}],14:[function(a,b,c){(function(a){"use strict";function c(a){return a}function d(b){return new a(b instanceof ArrayBuffer?new Uint8Array(b):b)}function e(a){return new Uint8Array(a)}function f(a){var b=c,f=c;return a.binaryType&&(a.binaryType="arraybuffer",b=d,f=e),{end:function(){a.close()},write:function(b){try{a.send(f(b),{binary:!0})}catch(c){a.onerror(c)}},on:function(c,d){"data"===c?a.onmessage=function(a){d(b(a.data))}:"end"===c?a.onclose=d:"error"===c?a.onerror=d:console.log("ERROR: Attempt to set unrecognised handler on websocket wrapper: "+c)},get_id_string:function(){return a.url}}}b.exports={connect:function(a){return function(b,c,d){return function(){return{connect:function(e,g,h,i){var j=new a(b,c,d);return j.onopen=i,f(j)}}}}},wrap:f}}).call(this,a("buffer").Buffer)},{buffer:16}],15:[function(a,b,c){},{}],16:[function(a,b,c){(function(b){"use strict";function d(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===a.foo()&&"function"==typeof a.subarray&&0===a.subarray(1,1).byteLength}catch(b){return!1}}function e(){return g.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function f(a,b){if(e()<b)throw new RangeError("Invalid typed array length");return g.TYPED_ARRAY_SUPPORT?(a=new Uint8Array(b),a.__proto__=g.prototype):(null===a&&(a=new g(b)),a.length=b),a}function g(a,b,c){if(!(g.TYPED_ARRAY_SUPPORT||this instanceof g))return new g(a,b,c);if("number"==typeof a){if("string"==typeof b)throw new Error("If encoding is specified then the first argument must be a string");return k(this,a)}return h(this,a,b,c)}function h(a,b,c,d){if("number"==typeof b)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&b instanceof ArrayBuffer?n(a,b,c,d):"string"==typeof b?l(a,b,c):o(a,b)}function i(a){if("number"!=typeof a)throw new TypeError('"size" argument must be a number');if(0>a)throw new RangeError('"size" argument must not be negative')}function j(a,b,c,d){return i(b),0>=b?f(a,b):void 0!==c?"string"==typeof d?f(a,b).fill(c,d):f(a,b).fill(c):f(a,b)}function k(a,b){if(i(b),a=f(a,0>b?0:0|p(b)),!g.TYPED_ARRAY_SUPPORT)for(var c=0;b>c;++c)a[c]=0;return a}function l(a,b,c){if(("string"!=typeof c||""===c)&&(c="utf8"),!g.isEncoding(c))throw new TypeError('"encoding" must be a valid string encoding');var d=0|r(b,c);a=f(a,d);var e=a.write(b,c);return e!==d&&(a=a.slice(0,e)),a}function m(a,b){var c=b.length<0?0:0|p(b.length);a=f(a,c);for(var d=0;c>d;d+=1)a[d]=255&b[d];return a}function n(a,b,c,d){if(b.byteLength,0>c||b.byteLength<c)throw new RangeError("'offset' is out of bounds");if(b.byteLength<c+(d||0))throw new RangeError("'length' is out of bounds");return b=void 0===c&&void 0===d?new Uint8Array(b):void 0===d?new Uint8Array(b,c):new Uint8Array(b,c,d),g.TYPED_ARRAY_SUPPORT?(a=b,a.__proto__=g.prototype):a=m(a,b),a}function o(a,b){if(g.isBuffer(b)){var c=0|p(b.length);return a=f(a,c),0===a.length?a:(b.copy(a,0,0,c),a)}if(b){if("undefined"!=typeof ArrayBuffer&&b.buffer instanceof ArrayBuffer||"length"in b)return"number"!=typeof b.length||Y(b.length)?f(a,0):m(a,b);if("Buffer"===b.type&&_(b.data))return m(a,b.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function p(a){if(a>=e())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+e().toString(16)+" bytes");return 0|a}function q(a){return+a!=a&&(a=0),g.alloc(+a)}function r(a,b){if(g.isBuffer(a))return a.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;"string"!=typeof a&&(a=""+a);var c=a.length;if(0===c)return 0;for(var d=!1;;)switch(b){case"ascii":case"latin1":case"binary":return c;case"utf8":case"utf-8":case void 0:return T(a).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*c;case"hex":return c>>>1;case"base64":return W(a).length;default:if(d)return T(a).length;b=(""+b).toLowerCase(),d=!0}}function s(a,b,c){var d=!1;if((void 0===b||0>b)&&(b=0),b>this.length)return"";if((void 0===c||c>this.length)&&(c=this.length),0>=c)return"";if(c>>>=0,b>>>=0,b>=c)return"";for(a||(a="utf8");;)switch(a){case"hex":return H(this,b,c);case"utf8":case"utf-8":return D(this,b,c);case"ascii":return F(this,b,c);case"latin1":case"binary":return G(this,b,c);case"base64":return C(this,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,b,c);default:if(d)throw new TypeError("Unknown encoding: "+a);a=(a+"").toLowerCase(),d=!0}}function t(a,b,c){var d=a[b];a[b]=a[c],a[c]=d}function u(a,b,c,d,e){if(0===a.length)return-1;if("string"==typeof c?(d=c,c=0):c>2147483647?c=2147483647:-2147483648>c&&(c=-2147483648),c=+c,isNaN(c)&&(c=e?0:a.length-1),0>c&&(c=a.length+c),c>=a.length){if(e)return-1;c=a.length-1}else if(0>c){if(!e)return-1;c=0}if("string"==typeof b&&(b=g.from(b,d)),g.isBuffer(b))return 0===b.length?-1:v(a,b,c,d,e);if("number"==typeof b)return b=255&b,g.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?e?Uint8Array.prototype.indexOf.call(a,b,c):Uint8Array.prototype.lastIndexOf.call(a,b,c):v(a,[b],c,d,e);throw new TypeError("val must be string, number or Buffer")}function v(a,b,c,d,e){function f(a,b){return 1===g?a[b]:a.readUInt16BE(b*g)}var g=1,h=a.length,i=b.length;if(void 0!==d&&(d=String(d).toLowerCase(),"ucs2"===d||"ucs-2"===d||"utf16le"===d||"utf-16le"===d)){if(a.length<2||b.length<2)return-1;g=2,h/=2,i/=2,c/=2}var j;if(e){var k=-1;for(j=c;h>j;j++)if(f(a,j)===f(b,-1===k?0:j-k)){if(-1===k&&(k=j),j-k+1===i)return k*g}else-1!==k&&(j-=j-k),k=-1}else for(c+i>h&&(c=h-i),j=c;j>=0;j--){for(var l=!0,m=0;i>m;m++)if(f(a,j+m)!==f(b,m)){l=!1;break}if(l)return j}return-1}function w(a,b,c,d){c=Number(c)||0;var e=a.length-c;d?(d=Number(d),d>e&&(d=e)):d=e;var f=b.length;if(f%2!==0)throw new TypeError("Invalid hex string");d>f/2&&(d=f/2);for(var g=0;d>g;++g){var h=parseInt(b.substr(2*g,2),16);if(isNaN(h))return g;a[c+g]=h}return g}function x(a,b,c,d){return X(T(b,a.length-c),a,c,d)}function y(a,b,c,d){return X(U(b),a,c,d)}function z(a,b,c,d){return y(a,b,c,d)}function A(a,b,c,d){return X(W(b),a,c,d)}function B(a,b,c,d){return X(V(b,a.length-c),a,c,d)}function C(a,b,c){return 0===b&&c===a.length?Z.fromByteArray(a):Z.fromByteArray(a.slice(b,c))}function D(a,b,c){c=Math.min(a.length,c);for(var d=[],e=b;c>e;){var f=a[e],g=null,h=f>239?4:f>223?3:f>191?2:1;if(c>=e+h){var i,j,k,l;switch(h){case 1:128>f&&(g=f);break;case 2:i=a[e+1],128===(192&i)&&(l=(31&f)<<6|63&i,l>127&&(g=l));break;case 3:i=a[e+1],j=a[e+2],128===(192&i)&&128===(192&j)&&(l=(15&f)<<12|(63&i)<<6|63&j,l>2047&&(55296>l||l>57343)&&(g=l));break;case 4:i=a[e+1],j=a[e+2],k=a[e+3],128===(192&i)&&128===(192&j)&&128===(192&k)&&(l=(15&f)<<18|(63&i)<<12|(63&j)<<6|63&k,l>65535&&1114112>l&&(g=l))}}null===g?(g=65533,h=1):g>65535&&(g-=65536,d.push(g>>>10&1023|55296),g=56320|1023&g),d.push(g),e+=h}return E(d)}function E(a){var b=a.length;if(aa>=b)return String.fromCharCode.apply(String,a);for(var c="",d=0;b>d;)c+=String.fromCharCode.apply(String,a.slice(d,d+=aa));return c}function F(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;++e)d+=String.fromCharCode(127&a[e]);return d}function G(a,b,c){var d="";c=Math.min(a.length,c);for(var e=b;c>e;++e)d+=String.fromCharCode(a[e]);return d}function H(a,b,c){var d=a.length;(!b||0>b)&&(b=0),(!c||0>c||c>d)&&(c=d);for(var e="",f=b;c>f;++f)e+=S(a[f]);return e}function I(a,b,c){for(var d=a.slice(b,c),e="",f=0;f<d.length;f+=2)e+=String.fromCharCode(d[f]+256*d[f+1]);return e}function J(a,b,c){if(a%1!==0||0>a)throw new RangeError("offset is not uint");if(a+b>c)throw new RangeError("Trying to access beyond buffer length")}function K(a,b,c,d,e,f){if(!g.isBuffer(a))throw new TypeError('"buffer" argument must be a Buffer instance');if(b>e||f>b)throw new RangeError('"value" argument is out of bounds');if(c+d>a.length)throw new RangeError("Index out of range")}function L(a,b,c,d){0>b&&(b=65535+b+1);for(var e=0,f=Math.min(a.length-c,2);f>e;++e)a[c+e]=(b&255<<8*(d?e:1-e))>>>8*(d?e:1-e)}function M(a,b,c,d){0>b&&(b=4294967295+b+1);for(var e=0,f=Math.min(a.length-c,4);f>e;++e)a[c+e]=b>>>8*(d?e:3-e)&255}function N(a,b,c,d,e,f){if(c+d>a.length)throw new RangeError("Index out of range");if(0>c)throw new RangeError("Index out of range")}function O(a,b,c,d,e){return e||N(a,b,c,4,3.4028234663852886e38,-3.4028234663852886e38),$.write(a,b,c,d,23,4),c+4}function P(a,b,c,d,e){return e||N(a,b,c,8,1.7976931348623157e308,-1.7976931348623157e308),$.write(a,b,c,d,52,8),c+8}function Q(a){if(a=R(a).replace(ba,""),a.length<2)return"";for(;a.length%4!==0;)a+="=";return a}function R(a){return a.trim?a.trim():a.replace(/^\s+|\s+$/g,"")}function S(a){return 16>a?"0"+a.toString(16):a.toString(16)}function T(a,b){b=b||1/0;for(var c,d=a.length,e=null,f=[],g=0;d>g;++g){if(c=a.charCodeAt(g),c>55295&&57344>c){if(!e){if(c>56319){(b-=3)>-1&&f.push(239,191,189);continue}if(g+1===d){(b-=3)>-1&&f.push(239,191,189);continue}e=c;continue}if(56320>c){(b-=3)>-1&&f.push(239,191,189),e=c;continue}c=(e-55296<<10|c-56320)+65536}else e&&(b-=3)>-1&&f.push(239,191,189);if(e=null,128>c){if((b-=1)<0)break;f.push(c)}else if(2048>c){if((b-=2)<0)break;f.push(c>>6|192,63&c|128)}else if(65536>c){if((b-=3)<0)break;f.push(c>>12|224,c>>6&63|128,63&c|128)}else{if(!(1114112>c))throw new Error("Invalid code point");if((b-=4)<0)break;f.push(c>>18|240,c>>12&63|128,c>>6&63|128,63&c|128)}}return f}function U(a){for(var b=[],c=0;c<a.length;++c)b.push(255&a.charCodeAt(c));return b}function V(a,b){for(var c,d,e,f=[],g=0;g<a.length&&!((b-=2)<0);++g)c=a.charCodeAt(g),d=c>>8,e=c%256,f.push(e),f.push(d);return f}function W(a){return Z.toByteArray(Q(a))}function X(a,b,c,d){for(var e=0;d>e&&!(e+c>=b.length||e>=a.length);++e)b[e+c]=a[e];return e}function Y(a){return a!==a}var Z=a("base64-js"),$=a("ieee754"),_=a("isarray");c.Buffer=g,c.SlowBuffer=q,c.INSPECT_MAX_BYTES=50,g.TYPED_ARRAY_SUPPORT=void 0!==b.TYPED_ARRAY_SUPPORT?b.TYPED_ARRAY_SUPPORT:d(),c.kMaxLength=e(),g.poolSize=8192,g._augment=function(a){return a.__proto__=g.prototype,a},g.from=function(a,b,c){return h(null,a,b,c)},g.TYPED_ARRAY_SUPPORT&&(g.prototype.__proto__=Uint8Array.prototype,g.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&g[Symbol.species]===g&&Object.defineProperty(g,Symbol.species,{value:null,configurable:!0})),g.alloc=function(a,b,c){return j(null,a,b,c)},g.allocUnsafe=function(a){return k(null,a)},g.allocUnsafeSlow=function(a){return k(null,a)},g.isBuffer=function(a){return!(null==a||!a._isBuffer)},g.compare=function(a,b){if(!g.isBuffer(a)||!g.isBuffer(b))throw new TypeError("Arguments must be Buffers");if(a===b)return 0;for(var c=a.length,d=b.length,e=0,f=Math.min(c,d);f>e;++e)if(a[e]!==b[e]){c=a[e],d=b[e];break}return d>c?-1:c>d?1:0},g.isEncoding=function(a){switch(String(a).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},g.concat=function(a,b){if(!_(a))throw new TypeError('"list" argument must be an Array of Buffers');if(0===a.length)return g.alloc(0);var c;if(void 0===b)for(b=0,c=0;c<a.length;++c)b+=a[c].length;var d=g.allocUnsafe(b),e=0;for(c=0;c<a.length;++c){var f=a[c];if(!g.isBuffer(f))throw new TypeError('"list" argument must be an Array of Buffers');f.copy(d,e),e+=f.length}return d},g.byteLength=r,g.prototype._isBuffer=!0,g.prototype.swap16=function(){var a=this.length;if(a%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var b=0;a>b;b+=2)t(this,b,b+1);return this},g.prototype.swap32=function(){var a=this.length;if(a%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var b=0;a>b;b+=4)t(this,b,b+3),t(this,b+1,b+2);return this},g.prototype.swap64=function(){var a=this.length;if(a%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var b=0;a>b;b+=8)t(this,b,b+7),t(this,b+1,b+6),t(this,b+2,b+5),t(this,b+3,b+4);return this},g.prototype.toString=function(){var a=0|this.length;return 0===a?"":0===arguments.length?D(this,0,a):s.apply(this,arguments)},g.prototype.equals=function(a){if(!g.isBuffer(a))throw new TypeError("Argument must be a Buffer");return this===a?!0:0===g.compare(this,a)},g.prototype.inspect=function(){var a="",b=c.INSPECT_MAX_BYTES;return this.length>0&&(a=this.toString("hex",0,b).match(/.{2}/g).join(" "),this.length>b&&(a+=" ... ")),"<Buffer "+a+">"},g.prototype.compare=function(a,b,c,d,e){if(!g.isBuffer(a))throw new TypeError("Argument must be a Buffer");if(void 0===b&&(b=0),void 0===c&&(c=a?a.length:0),void 0===d&&(d=0),void 0===e&&(e=this.length),0>b||c>a.length||0>d||e>this.length)throw new RangeError("out of range index");if(d>=e&&b>=c)return 0;if(d>=e)return-1;if(b>=c)return 1;if(b>>>=0,c>>>=0,d>>>=0,e>>>=0,this===a)return 0;for(var f=e-d,h=c-b,i=Math.min(f,h),j=this.slice(d,e),k=a.slice(b,c),l=0;i>l;++l)if(j[l]!==k[l]){f=j[l],h=k[l];break}return h>f?-1:f>h?1:0},g.prototype.includes=function(a,b,c){return-1!==this.indexOf(a,b,c)},g.prototype.indexOf=function(a,b,c){return u(this,a,b,c,!0)},g.prototype.lastIndexOf=function(a,b,c){return u(this,a,b,c,!1)},g.prototype.write=function(a,b,c,d){if(void 0===b)d="utf8",c=this.length,b=0;else if(void 0===c&&"string"==typeof b)d=b,c=this.length,b=0;else{if(!isFinite(b))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");b=0|b,isFinite(c)?(c=0|c,void 0===d&&(d="utf8")):(d=c,c=void 0)}var e=this.length-b;if((void 0===c||c>e)&&(c=e),a.length>0&&(0>c||0>b)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");d||(d="utf8");for(var f=!1;;)switch(d){case"hex":return w(this,a,b,c);case"utf8":case"utf-8":return x(this,a,b,c);case"ascii":return y(this,a,b,c);case"latin1":case"binary":return z(this,a,b,c);case"base64":return A(this,a,b,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return B(this,a,b,c);default:if(f)throw new TypeError("Unknown encoding: "+d);d=(""+d).toLowerCase(),f=!0}},g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var aa=4096;g.prototype.slice=function(a,b){var c=this.length;a=~~a,b=void 0===b?c:~~b,0>a?(a+=c,0>a&&(a=0)):a>c&&(a=c),0>b?(b+=c,0>b&&(b=0)):b>c&&(b=c),a>b&&(b=a);var d;if(g.TYPED_ARRAY_SUPPORT)d=this.subarray(a,b),d.__proto__=g.prototype;else{var e=b-a;d=new g(e,void 0);for(var f=0;e>f;++f)d[f]=this[f+a]}return d},g.prototype.readUIntLE=function(a,b,c){a=0|a,b=0|b,c||J(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return d},g.prototype.readUIntBE=function(a,b,c){a=0|a,b=0|b,c||J(a,b,this.length);for(var d=this[a+--b],e=1;b>0&&(e*=256);)d+=this[a+--b]*e;return d},g.prototype.readUInt8=function(a,b){return b||J(a,1,this.length),this[a]},g.prototype.readUInt16LE=function(a,b){return b||J(a,2,this.length),this[a]|this[a+1]<<8},g.prototype.readUInt16BE=function(a,b){return b||J(a,2,this.length),this[a]<<8|this[a+1]},g.prototype.readUInt32LE=function(a,b){return b||J(a,4,this.length),(this[a]|this[a+1]<<8|this[a+2]<<16)+16777216*this[a+3]},g.prototype.readUInt32BE=function(a,b){return b||J(a,4,this.length),16777216*this[a]+(this[a+1]<<16|this[a+2]<<8|this[a+3])},g.prototype.readIntLE=function(a,b,c){a=0|a,b=0|b,c||J(a,b,this.length);for(var d=this[a],e=1,f=0;++f<b&&(e*=256);)d+=this[a+f]*e;return e*=128,d>=e&&(d-=Math.pow(2,8*b)),d},g.prototype.readIntBE=function(a,b,c){a=0|a,b=0|b,c||J(a,b,this.length);for(var d=b,e=1,f=this[a+--d];d>0&&(e*=256);)f+=this[a+--d]*e;return e*=128,f>=e&&(f-=Math.pow(2,8*b)),f},g.prototype.readInt8=function(a,b){return b||J(a,1,this.length),128&this[a]?-1*(255-this[a]+1):this[a]},g.prototype.readInt16LE=function(a,b){b||J(a,2,this.length);var c=this[a]|this[a+1]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt16BE=function(a,b){b||J(a,2,this.length);var c=this[a+1]|this[a]<<8;return 32768&c?4294901760|c:c},g.prototype.readInt32LE=function(a,b){return b||J(a,4,this.length),this[a]|this[a+1]<<8|this[a+2]<<16|this[a+3]<<24},g.prototype.readInt32BE=function(a,b){return b||J(a,4,this.length),this[a]<<24|this[a+1]<<16|this[a+2]<<8|this[a+3]},g.prototype.readFloatLE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!0,23,4)},g.prototype.readFloatBE=function(a,b){return b||J(a,4,this.length),$.read(this,a,!1,23,4)},g.prototype.readDoubleLE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!0,52,8)},g.prototype.readDoubleBE=function(a,b){return b||J(a,8,this.length),$.read(this,a,!1,52,8)},g.prototype.writeUIntLE=function(a,b,c,d){if(a=+a,b=0|b,c=0|c,!d){var e=Math.pow(2,8*c)-1;K(this,a,b,c,e,0)}var f=1,g=0;for(this[b]=255&a;++g<c&&(f*=256);)this[b+g]=a/f&255;return b+c},g.prototype.writeUIntBE=function(a,b,c,d){if(a=+a,b=0|b,c=0|c,!d){var e=Math.pow(2,8*c)-1;K(this,a,b,c,e,0)}var f=c-1,g=1;for(this[b+f]=255&a;--f>=0&&(g*=256);)this[b+f]=a/g&255;return b+c},g.prototype.writeUInt8=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,1,255,0),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),this[b]=255&a,b+1},g.prototype.writeUInt16LE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeUInt16BE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,2,65535,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeUInt32LE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b+3]=a>>>24,this[b+2]=a>>>16,this[b+1]=a>>>8,this[b]=255&a):M(this,a,b,!0),b+4},g.prototype.writeUInt32BE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,4,4294967295,0),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeIntLE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=0,g=1,h=0;for(this[b]=255&a;++f<c&&(g*=256);)0>a&&0===h&&0!==this[b+f-1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},g.prototype.writeIntBE=function(a,b,c,d){if(a=+a,b=0|b,!d){var e=Math.pow(2,8*c-1);K(this,a,b,c,e-1,-e)}var f=c-1,g=1,h=0;for(this[b+f]=255&a;--f>=0&&(g*=256);)0>a&&0===h&&0!==this[b+f+1]&&(h=1),this[b+f]=(a/g>>0)-h&255;return b+c},g.prototype.writeInt8=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,1,127,-128),g.TYPED_ARRAY_SUPPORT||(a=Math.floor(a)),0>a&&(a=255+a+1),this[b]=255&a,b+1},g.prototype.writeInt16LE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8):L(this,a,b,!0),b+2},g.prototype.writeInt16BE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,2,32767,-32768),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>8,this[b+1]=255&a):L(this,a,b,!1),b+2},g.prototype.writeInt32LE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,4,2147483647,-2147483648),g.TYPED_ARRAY_SUPPORT?(this[b]=255&a,this[b+1]=a>>>8,this[b+2]=a>>>16,this[b+3]=a>>>24):M(this,a,b,!0),b+4},g.prototype.writeInt32BE=function(a,b,c){return a=+a,b=0|b,c||K(this,a,b,4,2147483647,-2147483648),0>a&&(a=4294967295+a+1),g.TYPED_ARRAY_SUPPORT?(this[b]=a>>>24,this[b+1]=a>>>16,this[b+2]=a>>>8,this[b+3]=255&a):M(this,a,b,!1),b+4},g.prototype.writeFloatLE=function(a,b,c){return O(this,a,b,!0,c)},g.prototype.writeFloatBE=function(a,b,c){return O(this,a,b,!1,c)},g.prototype.writeDoubleLE=function(a,b,c){return P(this,a,b,!0,c)},g.prototype.writeDoubleBE=function(a,b,c){return P(this,a,b,!1,c)},g.prototype.copy=function(a,b,c,d){if(c||(c=0),d||0===d||(d=this.length),b>=a.length&&(b=a.length),b||(b=0),d>0&&c>d&&(d=c),d===c)return 0;if(0===a.length||0===this.length)return 0;if(0>b)throw new RangeError("targetStart out of bounds");if(0>c||c>=this.length)throw new RangeError("sourceStart out of bounds");if(0>d)throw new RangeError("sourceEnd out of bounds");d>this.length&&(d=this.length),a.length-b<d-c&&(d=a.length-b+c);var e,f=d-c;if(this===a&&b>c&&d>b)for(e=f-1;e>=0;--e)a[e+b]=this[e+c];else if(1e3>f||!g.TYPED_ARRAY_SUPPORT)for(e=0;f>e;++e)a[e+b]=this[e+c];else Uint8Array.prototype.set.call(a,this.subarray(c,c+f),b);return f},g.prototype.fill=function(a,b,c,d){if("string"==typeof a){if("string"==typeof b?(d=b,b=0,c=this.length):"string"==typeof c&&(d=c,c=this.length),1===a.length){var e=a.charCodeAt(0);256>e&&(a=e)}if(void 0!==d&&"string"!=typeof d)throw new TypeError("encoding must be a string");if("string"==typeof d&&!g.isEncoding(d))throw new TypeError("Unknown encoding: "+d)}else"number"==typeof a&&(a=255&a);if(0>b||this.length<b||this.length<c)throw new RangeError("Out of range index");if(b>=c)return this;b>>>=0,c=void 0===c?this.length:c>>>0,a||(a=0);var f;if("number"==typeof a)for(f=b;c>f;++f)this[f]=a;else{var h=g.isBuffer(a)?a:T(new g(a,d).toString()),i=h.length;for(f=0;c-b>f;++f)this[f+b]=h[f%i]}return this};var ba=/[^+\/0-9A-Za-z-_]/g}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"base64-js":17,ieee754:18,isarray:19}],17:[function(a,b,c){"use strict";function d(a){var b=a.length;if(b%4>0)throw new Error("Invalid string. Length must be a multiple of 4");return"="===a[b-2]?2:"="===a[b-1]?1:0}function e(a){return 3*a.length/4-d(a)}function f(a){var b,c,e,f,g,h,i=a.length;g=d(a),h=new l(3*i/4-g),e=g>0?i-4:i;var j=0;for(b=0,c=0;e>b;b+=4,c+=3)f=k[a.charCodeAt(b)]<<18|k[a.charCodeAt(b+1)]<<12|k[a.charCodeAt(b+2)]<<6|k[a.charCodeAt(b+3)],h[j++]=f>>16&255,h[j++]=f>>8&255,h[j++]=255&f;return 2===g?(f=k[a.charCodeAt(b)]<<2|k[a.charCodeAt(b+1)]>>4,h[j++]=255&f):1===g&&(f=k[a.charCodeAt(b)]<<10|k[a.charCodeAt(b+1)]<<4|k[a.charCodeAt(b+2)]>>2,h[j++]=f>>8&255,h[j++]=255&f),h}function g(a){return j[a>>18&63]+j[a>>12&63]+j[a>>6&63]+j[63&a]}function h(a,b,c){for(var d,e=[],f=b;c>f;f+=3)d=(a[f]<<16)+(a[f+1]<<8)+a[f+2],e.push(g(d));return e.join("")}function i(a){for(var b,c=a.length,d=c%3,e="",f=[],g=16383,i=0,k=c-d;k>i;i+=g)f.push(h(a,i,i+g>k?k:i+g));return 1===d?(b=a[c-1],e+=j[b>>2],e+=j[b<<4&63],e+="=="):2===d&&(b=(a[c-2]<<8)+a[c-1],e+=j[b>>10],e+=j[b>>4&63],e+=j[b<<2&63],e+="="),f.push(e),f.join("")}c.byteLength=e,c.toByteArray=f,c.fromByteArray=i;for(var j=[],k=[],l="undefined"!=typeof Uint8Array?Uint8Array:Array,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,o=m.length;o>n;++n)j[n]=m[n],k[m.charCodeAt(n)]=n;k["-".charCodeAt(0)]=62,k["_".charCodeAt(0)]=63},{}],18:[function(a,b,c){c.read=function(a,b,c,d,e){var f,g,h=8*e-d-1,i=(1<<h)-1,j=i>>1,k=-7,l=c?e-1:0,m=c?-1:1,n=a[b+l];for(l+=m,f=n&(1<<-k)-1,n>>=-k,k+=h;k>0;f=256*f+a[b+l],l+=m,k-=8);for(g=f&(1<<-k)-1,f>>=-k,k+=d;k>0;g=256*g+a[b+l],l+=m,k-=8);if(0===f)f=1-j;else{if(f===i)return g?NaN:(n?-1:1)*(1/0);g+=Math.pow(2,d),f-=j}return(n?-1:1)*g*Math.pow(2,f-d)},c.write=function(a,b,c,d,e,f){var g,h,i,j=8*f-e-1,k=(1<<j)-1,l=k>>1,m=23===e?Math.pow(2,-24)-Math.pow(2,-77):0,n=d?0:f-1,o=d?1:-1,p=0>b||0===b&&0>1/b?1:0;for(b=Math.abs(b),isNaN(b)||b===1/0?(h=isNaN(b)?1:0,g=k):(g=Math.floor(Math.log(b)/Math.LN2),b*(i=Math.pow(2,-g))<1&&(g--,i*=2),b+=g+l>=1?m/i:m*Math.pow(2,1-l),b*i>=2&&(g++,i/=2),g+l>=k?(h=0,g=k):g+l>=1?(h=(b*i-1)*Math.pow(2,e),g+=l):(h=b*Math.pow(2,l-1)*Math.pow(2,e),g=0));e>=8;a[c+n]=255&h,n+=o,h/=256,e-=8);for(g=g<<e|h,j+=e;j>0;a[c+n]=255&g,n+=o,g/=256,j-=8);a[c+n-o]|=128*p}},{}],19:[function(a,b,c){var d={}.toString;b.exports=Array.isArray||function(a){return"[object Array]"==d.call(a)}},{}],20:[function(a,b,c){function d(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function e(a){return"function"==typeof a}function f(a){return"number"==typeof a}function g(a){return"object"==typeof a&&null!==a}function h(a){return void 0===a}b.exports=d,d.EventEmitter=d,d.prototype._events=void 0,d.prototype._maxListeners=void 0,d.defaultMaxListeners=10,d.prototype.setMaxListeners=function(a){if(!f(a)||0>a||isNaN(a))throw TypeError("n must be a positive number");return this._maxListeners=a,this},d.prototype.emit=function(a){var b,c,d,f,i,j;if(this._events||(this._events={}),"error"===a&&(!this._events.error||g(this._events.error)&&!this._events.error.length)){if(b=arguments[1],b instanceof Error)throw b;var k=new Error('Uncaught, unspecified "error" event. ('+b+")");throw k.context=b,k}if(c=this._events[a],h(c))return!1;if(e(c))switch(arguments.length){case 1:c.call(this);break;case 2:c.call(this,arguments[1]);break;case 3:c.call(this,arguments[1],arguments[2]);break;default:f=Array.prototype.slice.call(arguments,1),c.apply(this,f)}else if(g(c))for(f=Array.prototype.slice.call(arguments,1),j=c.slice(),d=j.length,i=0;d>i;i++)j[i].apply(this,f);return!0},d.prototype.addListener=function(a,b){var c;if(!e(b))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",a,e(b.listener)?b.listener:b),this._events[a]?g(this._events[a])?this._events[a].push(b):this._events[a]=[this._events[a],b]:this._events[a]=b,g(this._events[a])&&!this._events[a].warned&&(c=h(this._maxListeners)?d.defaultMaxListeners:this._maxListeners,c&&c>0&&this._events[a].length>c&&(this._events[a].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[a].length),"function"==typeof console.trace&&console.trace())),this},d.prototype.on=d.prototype.addListener,d.prototype.once=function(a,b){function c(){this.removeListener(a,c),d||(d=!0,b.apply(this,arguments))}if(!e(b))throw TypeError("listener must be a function");var d=!1;return c.listener=b,this.on(a,c),this},d.prototype.removeListener=function(a,b){var c,d,f,h;if(!e(b))throw TypeError("listener must be a function");if(!this._events||!this._events[a])return this;if(c=this._events[a],f=c.length,d=-1,c===b||e(c.listener)&&c.listener===b)delete this._events[a],this._events.removeListener&&this.emit("removeListener",a,b);else if(g(c)){for(h=f;h-->0;)if(c[h]===b||c[h].listener&&c[h].listener===b){d=h;break}if(0>d)return this;1===c.length?(c.length=0,delete this._events[a]):c.splice(d,1),this._events.removeListener&&this.emit("removeListener",a,b)}return this},d.prototype.removeAllListeners=function(a){var b,c;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[a]&&delete this._events[a],this;if(0===arguments.length){for(b in this._events)"removeListener"!==b&&this.removeAllListeners(b);return this.removeAllListeners("removeListener"),this._events={},this}if(c=this._events[a],e(c))this.removeListener(a,c);else if(c)for(;c.length;)this.removeListener(a,c[c.length-1]);return delete this._events[a],this},d.prototype.listeners=function(a){var b;return b=this._events&&this._events[a]?e(this._events[a])?[this._events[a]]:this._events[a].slice():[]},d.prototype.listenerCount=function(a){if(this._events){var b=this._events[a];if(e(b))return 1;if(b)return b.length}return 0},d.listenerCount=function(a,b){return a.listenerCount(b)}},{}],21:[function(a,b,c){function d(){throw new Error("setTimeout has not been defined")}function e(){throw new Error("clearTimeout has not been defined")}function f(a){if(l===setTimeout)return setTimeout(a,0);if((l===d||!l)&&setTimeout)return l=setTimeout,setTimeout(a,0);try{return l(a,0)}catch(b){try{return l.call(null,a,0)}catch(b){return l.call(this,a,0)}}}function g(a){if(m===clearTimeout)return clearTimeout(a);if((m===e||!m)&&clearTimeout)return m=clearTimeout,
  clearTimeout(a);try{return m(a)}catch(b){try{return m.call(null,a)}catch(b){return m.call(this,a)}}}function h(){q&&o&&(q=!1,o.length?p=o.concat(p):r=-1,p.length&&i())}function i(){if(!q){var a=f(h);q=!0;for(var b=p.length;b;){for(o=p,p=[];++r<b;)o&&o[r].run();r=-1,b=p.length}o=null,q=!1,g(a)}}function j(a,b){this.fun=a,this.array=b}function k(){}var l,m,n=b.exports={};!function(){try{l="function"==typeof setTimeout?setTimeout:d}catch(a){l=d}try{m="function"==typeof clearTimeout?clearTimeout:e}catch(a){m=e}}();var o,p=[],q=!1,r=-1;n.nextTick=function(a){var b=new Array(arguments.length-1);if(arguments.length>1)for(var c=1;c<arguments.length;c++)b[c-1]=arguments[c];p.push(new j(a,b)),1!==p.length||q||f(i)},j.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=k,n.addListener=k,n.once=k,n.off=k,n.removeListener=k,n.removeAllListeners=k,n.emit=k,n.binding=function(a){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(a){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},{}],22:[function(a,b,c){(function(a){!function(d){function e(a){throw new RangeError(H[a])}function f(a,b){for(var c=a.length,d=[];c--;)d[c]=b(a[c]);return d}function g(a,b){var c=a.split("@"),d="";c.length>1&&(d=c[0]+"@",a=c[1]),a=a.replace(G,".");var e=a.split("."),g=f(e,b).join(".");return d+g}function h(a){for(var b,c,d=[],e=0,f=a.length;f>e;)b=a.charCodeAt(e++),b>=55296&&56319>=b&&f>e?(c=a.charCodeAt(e++),56320==(64512&c)?d.push(((1023&b)<<10)+(1023&c)+65536):(d.push(b),e--)):d.push(b);return d}function i(a){return f(a,function(a){var b="";return a>65535&&(a-=65536,b+=K(a>>>10&1023|55296),a=56320|1023&a),b+=K(a)}).join("")}function j(a){return 10>a-48?a-22:26>a-65?a-65:26>a-97?a-97:w}function k(a,b){return a+22+75*(26>a)-((0!=b)<<5)}function l(a,b,c){var d=0;for(a=c?J(a/A):a>>1,a+=J(a/b);a>I*y>>1;d+=w)a=J(a/I);return J(d+(I+1)*a/(a+z))}function m(a){var b,c,d,f,g,h,k,m,n,o,p=[],q=a.length,r=0,s=C,t=B;for(c=a.lastIndexOf(D),0>c&&(c=0),d=0;c>d;++d)a.charCodeAt(d)>=128&&e("not-basic"),p.push(a.charCodeAt(d));for(f=c>0?c+1:0;q>f;){for(g=r,h=1,k=w;f>=q&&e("invalid-input"),m=j(a.charCodeAt(f++)),(m>=w||m>J((v-r)/h))&&e("overflow"),r+=m*h,n=t>=k?x:k>=t+y?y:k-t,!(n>m);k+=w)o=w-n,h>J(v/o)&&e("overflow"),h*=o;b=p.length+1,t=l(r-g,b,0==g),J(r/b)>v-s&&e("overflow"),s+=J(r/b),r%=b,p.splice(r++,0,s)}return i(p)}function n(a){var b,c,d,f,g,i,j,m,n,o,p,q,r,s,t,u=[];for(a=h(a),q=a.length,b=C,c=0,g=B,i=0;q>i;++i)p=a[i],128>p&&u.push(K(p));for(d=f=u.length,f&&u.push(D);q>d;){for(j=v,i=0;q>i;++i)p=a[i],p>=b&&j>p&&(j=p);for(r=d+1,j-b>J((v-c)/r)&&e("overflow"),c+=(j-b)*r,b=j,i=0;q>i;++i)if(p=a[i],b>p&&++c>v&&e("overflow"),p==b){for(m=c,n=w;o=g>=n?x:n>=g+y?y:n-g,!(o>m);n+=w)t=m-o,s=w-o,u.push(K(k(o+t%s,0))),m=J(t/s);u.push(K(k(m,0))),g=l(c,r,d==f),c=0,++d}++c,++b}return u.join("")}function o(a){return g(a,function(a){return E.test(a)?m(a.slice(4).toLowerCase()):a})}function p(a){return g(a,function(a){return F.test(a)?"xn--"+n(a):a})}var q="object"==typeof c&&c&&!c.nodeType&&c,r="object"==typeof b&&b&&!b.nodeType&&b,s="object"==typeof a&&a;(s.global===s||s.window===s||s.self===s)&&(d=s);var t,u,v=2147483647,w=36,x=1,y=26,z=38,A=700,B=72,C=128,D="-",E=/^xn--/,F=/[^\x20-\x7E]/,G=/[\x2E\u3002\uFF0E\uFF61]/g,H={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},I=w-x,J=Math.floor,K=String.fromCharCode;if(t={version:"1.4.1",ucs2:{decode:h,encode:i},decode:m,encode:n,toASCII:p,toUnicode:o},"function"==typeof define&&"object"==typeof define.amd&&define.amd)define("punycode",function(){return t});else if(q&&r)if(b.exports==q)r.exports=t;else for(u in t)t.hasOwnProperty(u)&&(q[u]=t[u]);else d.punycode=t}(this)}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],23:[function(a,b,c){"use strict";function d(a,b){return Object.prototype.hasOwnProperty.call(a,b)}b.exports=function(a,b,c,f){b=b||"&",c=c||"=";var g={};if("string"!=typeof a||0===a.length)return g;var h=/\+/g;a=a.split(b);var i=1e3;f&&"number"==typeof f.maxKeys&&(i=f.maxKeys);var j=a.length;i>0&&j>i&&(j=i);for(var k=0;j>k;++k){var l,m,n,o,p=a[k].replace(h,"%20"),q=p.indexOf(c);q>=0?(l=p.substr(0,q),m=p.substr(q+1)):(l=p,m=""),n=decodeURIComponent(l),o=decodeURIComponent(m),d(g,n)?e(g[n])?g[n].push(o):g[n]=[g[n],o]:g[n]=o}return g};var e=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)}},{}],24:[function(a,b,c){"use strict";function d(a,b){if(a.map)return a.map(b);for(var c=[],d=0;d<a.length;d++)c.push(b(a[d],d));return c}var e=function(a){switch(typeof a){case"string":return a;case"boolean":return a?"true":"false";case"number":return isFinite(a)?a:"";default:return""}};b.exports=function(a,b,c,h){return b=b||"&",c=c||"=",null===a&&(a=void 0),"object"==typeof a?d(g(a),function(g){var h=encodeURIComponent(e(g))+c;return f(a[g])?d(a[g],function(a){return h+encodeURIComponent(e(a))}).join(b):h+encodeURIComponent(e(a[g]))}).join(b):h?encodeURIComponent(e(h))+c+encodeURIComponent(e(a)):""};var f=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)},g=Object.keys||function(a){var b=[];for(var c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b}},{}],25:[function(a,b,c){"use strict";c.decode=c.parse=a("./decode"),c.encode=c.stringify=a("./encode")},{"./decode":23,"./encode":24}],26:[function(a,b,c){"use strict";function d(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}function e(a,b,c){if(a&&j.isObject(a)&&a instanceof d)return a;var e=new d;return e.parse(a,b,c),e}function f(a){return j.isString(a)&&(a=e(a)),a instanceof d?a.format():d.prototype.format.call(a)}function g(a,b){return e(a,!1,!0).resolve(b)}function h(a,b){return a?e(a,!1,!0).resolveObject(b):b}var i=a("punycode"),j=a("./util");c.parse=e,c.resolve=g,c.resolveObject=h,c.format=f,c.Url=d;var k=/^([a-z0-9.+-]+:)/i,l=/:[0-9]*$/,m=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,n=["<",">",'"',"`"," ","\r","\n","	"],o=["{","}","|","\\","^","`"].concat(n),p=["'"].concat(o),q=["%","/","?",";","#"].concat(p),r=["/","?","#"],s=255,t=/^[+a-z0-9A-Z_-]{0,63}$/,u=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,v={javascript:!0,"javascript:":!0},w={javascript:!0,"javascript:":!0},x={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},y=a("querystring");d.prototype.parse=function(a,b,c){if(!j.isString(a))throw new TypeError("Parameter 'url' must be a string, not "+typeof a);var d=a.indexOf("?"),e=-1!==d&&d<a.indexOf("#")?"?":"#",f=a.split(e),g=/\\/g;f[0]=f[0].replace(g,"/"),a=f.join(e);var h=a;if(h=h.trim(),!c&&1===a.split("#").length){var l=m.exec(h);if(l)return this.path=h,this.href=h,this.pathname=l[1],l[2]?(this.search=l[2],b?this.query=y.parse(this.search.substr(1)):this.query=this.search.substr(1)):b&&(this.search="",this.query={}),this}var n=k.exec(h);if(n){n=n[0];var o=n.toLowerCase();this.protocol=o,h=h.substr(n.length)}if(c||n||h.match(/^\/\/[^@\/]+@[^@\/]+/)){var z="//"===h.substr(0,2);!z||n&&w[n]||(h=h.substr(2),this.slashes=!0)}if(!w[n]&&(z||n&&!x[n])){for(var A=-1,B=0;B<r.length;B++){var C=h.indexOf(r[B]);-1!==C&&(-1===A||A>C)&&(A=C)}var D,E;E=-1===A?h.lastIndexOf("@"):h.lastIndexOf("@",A),-1!==E&&(D=h.slice(0,E),h=h.slice(E+1),this.auth=decodeURIComponent(D)),A=-1;for(var B=0;B<q.length;B++){var C=h.indexOf(q[B]);-1!==C&&(-1===A||A>C)&&(A=C)}-1===A&&(A=h.length),this.host=h.slice(0,A),h=h.slice(A),this.parseHost(),this.hostname=this.hostname||"";var F="["===this.hostname[0]&&"]"===this.hostname[this.hostname.length-1];if(!F)for(var G=this.hostname.split(/\./),B=0,H=G.length;H>B;B++){var I=G[B];if(I&&!I.match(t)){for(var J="",K=0,L=I.length;L>K;K++)J+=I.charCodeAt(K)>127?"x":I[K];if(!J.match(t)){var M=G.slice(0,B),N=G.slice(B+1),O=I.match(u);O&&(M.push(O[1]),N.unshift(O[2])),N.length&&(h="/"+N.join(".")+h),this.hostname=M.join(".");break}}}this.hostname.length>s?this.hostname="":this.hostname=this.hostname.toLowerCase(),F||(this.hostname=i.toASCII(this.hostname));var P=this.port?":"+this.port:"",Q=this.hostname||"";this.host=Q+P,this.href+=this.host,F&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==h[0]&&(h="/"+h))}if(!v[o])for(var B=0,H=p.length;H>B;B++){var R=p[B];if(-1!==h.indexOf(R)){var S=encodeURIComponent(R);S===R&&(S=escape(R)),h=h.split(R).join(S)}}var T=h.indexOf("#");-1!==T&&(this.hash=h.substr(T),h=h.slice(0,T));var U=h.indexOf("?");if(-1!==U?(this.search=h.substr(U),this.query=h.substr(U+1),b&&(this.query=y.parse(this.query)),h=h.slice(0,U)):b&&(this.search="",this.query={}),h&&(this.pathname=h),x[o]&&this.hostname&&!this.pathname&&(this.pathname="/"),this.pathname||this.search){var P=this.pathname||"",V=this.search||"";this.path=P+V}return this.href=this.format(),this},d.prototype.format=function(){var a=this.auth||"";a&&(a=encodeURIComponent(a),a=a.replace(/%3A/i,":"),a+="@");var b=this.protocol||"",c=this.pathname||"",d=this.hash||"",e=!1,f="";this.host?e=a+this.host:this.hostname&&(e=a+(-1===this.hostname.indexOf(":")?this.hostname:"["+this.hostname+"]"),this.port&&(e+=":"+this.port)),this.query&&j.isObject(this.query)&&Object.keys(this.query).length&&(f=y.stringify(this.query));var g=this.search||f&&"?"+f||"";return b&&":"!==b.substr(-1)&&(b+=":"),this.slashes||(!b||x[b])&&e!==!1?(e="//"+(e||""),c&&"/"!==c.charAt(0)&&(c="/"+c)):e||(e=""),d&&"#"!==d.charAt(0)&&(d="#"+d),g&&"?"!==g.charAt(0)&&(g="?"+g),c=c.replace(/[?#]/g,function(a){return encodeURIComponent(a)}),g=g.replace("#","%23"),b+e+c+g+d},d.prototype.resolve=function(a){return this.resolveObject(e(a,!1,!0)).format()},d.prototype.resolveObject=function(a){if(j.isString(a)){var b=new d;b.parse(a,!1,!0),a=b}for(var c=new d,e=Object.keys(this),f=0;f<e.length;f++){var g=e[f];c[g]=this[g]}if(c.hash=a.hash,""===a.href)return c.href=c.format(),c;if(a.slashes&&!a.protocol){for(var h=Object.keys(a),i=0;i<h.length;i++){var k=h[i];"protocol"!==k&&(c[k]=a[k])}return x[c.protocol]&&c.hostname&&!c.pathname&&(c.path=c.pathname="/"),c.href=c.format(),c}if(a.protocol&&a.protocol!==c.protocol){if(!x[a.protocol]){for(var l=Object.keys(a),m=0;m<l.length;m++){var n=l[m];c[n]=a[n]}return c.href=c.format(),c}if(c.protocol=a.protocol,a.host||w[a.protocol])c.pathname=a.pathname;else{for(var o=(a.pathname||"").split("/");o.length&&!(a.host=o.shift()););a.host||(a.host=""),a.hostname||(a.hostname=""),""!==o[0]&&o.unshift(""),o.length<2&&o.unshift(""),c.pathname=o.join("/")}if(c.search=a.search,c.query=a.query,c.host=a.host||"",c.auth=a.auth,c.hostname=a.hostname||a.host,c.port=a.port,c.pathname||c.search){var p=c.pathname||"",q=c.search||"";c.path=p+q}return c.slashes=c.slashes||a.slashes,c.href=c.format(),c}var r=c.pathname&&"/"===c.pathname.charAt(0),s=a.host||a.pathname&&"/"===a.pathname.charAt(0),t=s||r||c.host&&a.pathname,u=t,v=c.pathname&&c.pathname.split("/")||[],o=a.pathname&&a.pathname.split("/")||[],y=c.protocol&&!x[c.protocol];if(y&&(c.hostname="",c.port=null,c.host&&(""===v[0]?v[0]=c.host:v.unshift(c.host)),c.host="",a.protocol&&(a.hostname=null,a.port=null,a.host&&(""===o[0]?o[0]=a.host:o.unshift(a.host)),a.host=null),t=t&&(""===o[0]||""===v[0])),s)c.host=a.host||""===a.host?a.host:c.host,c.hostname=a.hostname||""===a.hostname?a.hostname:c.hostname,c.search=a.search,c.query=a.query,v=o;else if(o.length)v||(v=[]),v.pop(),v=v.concat(o),c.search=a.search,c.query=a.query;else if(!j.isNullOrUndefined(a.search)){if(y){c.hostname=c.host=v.shift();var z=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return c.search=a.search,c.query=a.query,j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.href=c.format(),c}if(!v.length)return c.pathname=null,c.search?c.path="/"+c.search:c.path=null,c.href=c.format(),c;for(var A=v.slice(-1)[0],B=(c.host||a.host||v.length>1)&&("."===A||".."===A)||""===A,C=0,D=v.length;D>=0;D--)A=v[D],"."===A?v.splice(D,1):".."===A?(v.splice(D,1),C++):C&&(v.splice(D,1),C--);if(!t&&!u)for(;C--;C)v.unshift("..");!t||""===v[0]||v[0]&&"/"===v[0].charAt(0)||v.unshift(""),B&&"/"!==v.join("/").substr(-1)&&v.push("");var E=""===v[0]||v[0]&&"/"===v[0].charAt(0);if(y){c.hostname=c.host=E?"":v.length?v.shift():"";var z=c.host&&c.host.indexOf("@")>0?c.host.split("@"):!1;z&&(c.auth=z.shift(),c.host=c.hostname=z.shift())}return t=t||c.host&&v.length,t&&!E&&v.unshift(""),v.length?c.pathname=v.join("/"):(c.pathname=null,c.path=null),j.isNull(c.pathname)&&j.isNull(c.search)||(c.path=(c.pathname?c.pathname:"")+(c.search?c.search:"")),c.auth=a.auth||c.auth,c.slashes=c.slashes||a.slashes,c.href=c.format(),c},d.prototype.parseHost=function(){var a=this.host,b=l.exec(a);b&&(b=b[0],":"!==b&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)}},{"./util":27,punycode:22,querystring:25}],27:[function(a,b,c){"use strict";b.exports={isString:function(a){return"string"==typeof a},isObject:function(a){return"object"==typeof a&&null!==a},isNull:function(a){return null===a},isNullOrUndefined:function(a){return null==a}}},{}],28:[function(a,b,c){"function"==typeof Object.create?b.exports=function(a,b){a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}})}:b.exports=function(a,b){a.super_=b;var c=function(){};c.prototype=b.prototype,a.prototype=new c,a.prototype.constructor=a}},{}],29:[function(a,b,c){b.exports=function(a){return a&&"object"==typeof a&&"function"==typeof a.copy&&"function"==typeof a.fill&&"function"==typeof a.readUInt8}},{}],30:[function(a,b,c){(function(b,d){function e(a,b){var d={seen:[],stylize:g};return arguments.length>=3&&(d.depth=arguments[2]),arguments.length>=4&&(d.colors=arguments[3]),p(b)?d.showHidden=b:b&&c._extend(d,b),v(d.showHidden)&&(d.showHidden=!1),v(d.depth)&&(d.depth=2),v(d.colors)&&(d.colors=!1),v(d.customInspect)&&(d.customInspect=!0),d.colors&&(d.stylize=f),i(d,a,d.depth)}function f(a,b){var c=e.styles[b];return c?"["+e.colors[c][0]+"m"+a+"["+e.colors[c][1]+"m":a}function g(a,b){return a}function h(a){var b={};return a.forEach(function(a,c){b[a]=!0}),b}function i(a,b,d){if(a.customInspect&&b&&A(b.inspect)&&b.inspect!==c.inspect&&(!b.constructor||b.constructor.prototype!==b)){var e=b.inspect(d,a);return t(e)||(e=i(a,e,d)),e}var f=j(a,b);if(f)return f;var g=Object.keys(b),p=h(g);if(a.showHidden&&(g=Object.getOwnPropertyNames(b)),z(b)&&(g.indexOf("message")>=0||g.indexOf("description")>=0))return k(b);if(0===g.length){if(A(b)){var q=b.name?": "+b.name:"";return a.stylize("[Function"+q+"]","special")}if(w(b))return a.stylize(RegExp.prototype.toString.call(b),"regexp");if(y(b))return a.stylize(Date.prototype.toString.call(b),"date");if(z(b))return k(b)}var r="",s=!1,u=["{","}"];if(o(b)&&(s=!0,u=["[","]"]),A(b)){var v=b.name?": "+b.name:"";r=" [Function"+v+"]"}if(w(b)&&(r=" "+RegExp.prototype.toString.call(b)),y(b)&&(r=" "+Date.prototype.toUTCString.call(b)),z(b)&&(r=" "+k(b)),0===g.length&&(!s||0==b.length))return u[0]+r+u[1];if(0>d)return w(b)?a.stylize(RegExp.prototype.toString.call(b),"regexp"):a.stylize("[Object]","special");a.seen.push(b);var x;return x=s?l(a,b,d,p,g):g.map(function(c){return m(a,b,d,p,c,s)}),a.seen.pop(),n(x,r,u)}function j(a,b){if(v(b))return a.stylize("undefined","undefined");if(t(b)){var c="'"+JSON.stringify(b).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return a.stylize(c,"string")}return s(b)?a.stylize(""+b,"number"):p(b)?a.stylize(""+b,"boolean"):q(b)?a.stylize("null","null"):void 0}function k(a){return"["+Error.prototype.toString.call(a)+"]"}function l(a,b,c,d,e){for(var f=[],g=0,h=b.length;h>g;++g)F(b,String(g))?f.push(m(a,b,c,d,String(g),!0)):f.push("");return e.forEach(function(e){e.match(/^\d+$/)||f.push(m(a,b,c,d,e,!0))}),f}function m(a,b,c,d,e,f){var g,h,j;if(j=Object.getOwnPropertyDescriptor(b,e)||{value:b[e]},j.get?h=j.set?a.stylize("[Getter/Setter]","special"):a.stylize("[Getter]","special"):j.set&&(h=a.stylize("[Setter]","special")),F(d,e)||(g="["+e+"]"),h||(a.seen.indexOf(j.value)<0?(h=q(c)?i(a,j.value,null):i(a,j.value,c-1),h.indexOf("\n")>-1&&(h=f?h.split("\n").map(function(a){return"  "+a}).join("\n").substr(2):"\n"+h.split("\n").map(function(a){return"   "+a}).join("\n"))):h=a.stylize("[Circular]","special")),v(g)){if(f&&e.match(/^\d+$/))return h;g=JSON.stringify(""+e),g.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(g=g.substr(1,g.length-2),g=a.stylize(g,"name")):(g=g.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),g=a.stylize(g,"string"))}return g+": "+h}function n(a,b,c){var d=0,e=a.reduce(function(a,b){return d++,b.indexOf("\n")>=0&&d++,a+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return e>60?c[0]+(""===b?"":b+"\n ")+" "+a.join(",\n  ")+" "+c[1]:c[0]+b+" "+a.join(", ")+" "+c[1]}function o(a){return Array.isArray(a)}function p(a){return"boolean"==typeof a}function q(a){return null===a}function r(a){return null==a}function s(a){return"number"==typeof a}function t(a){return"string"==typeof a}function u(a){return"symbol"==typeof a}function v(a){return void 0===a}function w(a){return x(a)&&"[object RegExp]"===C(a)}function x(a){return"object"==typeof a&&null!==a}function y(a){return x(a)&&"[object Date]"===C(a)}function z(a){return x(a)&&("[object Error]"===C(a)||a instanceof Error)}function A(a){return"function"==typeof a}function B(a){return null===a||"boolean"==typeof a||"number"==typeof a||"string"==typeof a||"symbol"==typeof a||"undefined"==typeof a}function C(a){return Object.prototype.toString.call(a)}function D(a){return 10>a?"0"+a.toString(10):a.toString(10)}function E(){var a=new Date,b=[D(a.getHours()),D(a.getMinutes()),D(a.getSeconds())].join(":");return[a.getDate(),J[a.getMonth()],b].join(" ")}function F(a,b){return Object.prototype.hasOwnProperty.call(a,b)}var G=/%[sdj%]/g;c.format=function(a){if(!t(a)){for(var b=[],c=0;c<arguments.length;c++)b.push(e(arguments[c]));return b.join(" ")}for(var c=1,d=arguments,f=d.length,g=String(a).replace(G,function(a){if("%%"===a)return"%";if(c>=f)return a;switch(a){case"%s":return String(d[c++]);case"%d":return Number(d[c++]);case"%j":try{return JSON.stringify(d[c++])}catch(b){return"[Circular]"}default:return a}}),h=d[c];f>c;h=d[++c])g+=q(h)||!x(h)?" "+h:" "+e(h);return g},c.deprecate=function(a,e){function f(){if(!g){if(b.throwDeprecation)throw new Error(e);b.traceDeprecation?console.trace(e):console.error(e),g=!0}return a.apply(this,arguments)}if(v(d.process))return function(){return c.deprecate(a,e).apply(this,arguments)};if(b.noDeprecation===!0)return a;var g=!1;return f};var H,I={};c.debuglog=function(a){if(v(H)&&(H=b.env.NODE_DEBUG||""),a=a.toUpperCase(),!I[a])if(new RegExp("\\b"+a+"\\b","i").test(H)){var d=b.pid;I[a]=function(){var b=c.format.apply(c,arguments);console.error("%s %d: %s",a,d,b)}}else I[a]=function(){};return I[a]},c.inspect=e,e.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},e.styles={special:"cyan",number:"yellow","boolean":"yellow",undefined:"grey","null":"bold",string:"green",date:"magenta",regexp:"red"},c.isArray=o,c.isBoolean=p,c.isNull=q,c.isNullOrUndefined=r,c.isNumber=s,c.isString=t,c.isSymbol=u,c.isUndefined=v,c.isRegExp=w,c.isObject=x,c.isDate=y,c.isError=z,c.isFunction=A,c.isPrimitive=B,c.isBuffer=a("./support/isBuffer");var J=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];c.log=function(){console.log("%s - %s",E(),c.format.apply(c,arguments))},c.inherits=a("inherits"),c._extend=function(a,b){if(!b||!x(b))return a;for(var c=Object.keys(b),d=c.length;d--;)a[c[d]]=b[c[d]];return a}}).call(this,a("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./support/isBuffer":29,_process:21,inherits:28}],31:[function(a,b,c){function d(){return"WebkitAppearance"in document.documentElement.style||window.console&&(console.firebug||console.exception&&console.table)||navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31}function e(){var a=arguments,b=this.useColors;if(a[0]=(b?"%c":"")+this.namespace+(b?" %c":" ")+a[0]+(b?"%c ":" ")+"+"+c.humanize(this.diff),!b)return a;var d="color: "+this.color;a=[a[0],d,"color: inherit"].concat(Array.prototype.slice.call(a,1));var e=0,f=0;return a[0].replace(/%[a-z%]/g,function(a){"%%"!==a&&(e++,"%c"===a&&(f=e))}),a.splice(f,0,d),a}function f(){return"object"==typeof console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}function g(a){try{null==a?c.storage.removeItem("debug"):c.storage.debug=a}catch(b){}}function h(){var a;try{a=c.storage.debug}catch(b){}return a}function i(){try{return window.localStorage}catch(a){}}c=b.exports=a("./debug"),c.log=f,c.formatArgs=e,c.save=g,c.load=h,c.useColors=d,c.storage="undefined"!=typeof chrome&&"undefined"!=typeof chrome.storage?chrome.storage.local:i(),c.colors=["lightseagreen","forestgreen","goldenrod","dodgerblue","darkorchid","crimson"],c.formatters.j=function(a){return JSON.stringify(a)},c.enable(h())},{"./debug":32}],32:[function(a,b,c){function d(){return c.colors[k++%c.colors.length]}function e(a){function b(){}function e(){var a=e,b=+new Date,f=b-(j||b);a.diff=f,a.prev=j,a.curr=b,j=b,null==a.useColors&&(a.useColors=c.useColors()),null==a.color&&a.useColors&&(a.color=d());var g=Array.prototype.slice.call(arguments);g[0]=c.coerce(g[0]),"string"!=typeof g[0]&&(g=["%o"].concat(g));var h=0;g[0]=g[0].replace(/%([a-z%])/g,function(b,d){if("%%"===b)return b;h++;var e=c.formatters[d];if("function"==typeof e){var f=g[h];b=e.call(a,f),g.splice(h,1),h--}return b}),"function"==typeof c.formatArgs&&(g=c.formatArgs.apply(a,g));var i=e.log||c.log||console.log.bind(console);i.apply(a,g)}b.enabled=!1,e.enabled=!0;var f=c.enabled(a)?e:b;return f.namespace=a,f}function f(a){c.save(a);for(var b=(a||"").split(/[\s,]+/),d=b.length,e=0;d>e;e++)b[e]&&(a=b[e].replace(/\*/g,".*?"),"-"===a[0]?c.skips.push(new RegExp("^"+a.substr(1)+"$")):c.names.push(new RegExp("^"+a+"$")))}function g(){c.enable("")}function h(a){var b,d;for(b=0,d=c.skips.length;d>b;b++)if(c.skips[b].test(a))return!1;for(b=0,d=c.names.length;d>b;b++)if(c.names[b].test(a))return!0;return!1}function i(a){return a instanceof Error?a.stack||a.message:a}c=b.exports=e,c.coerce=i,c.disable=g,c.enable=f,c.enabled=h,c.humanize=a("ms"),c.names=[],c.skips=[],c.formatters={};var j,k=0},{ms:33}],33:[function(a,b,c){function d(a){if(a=""+a,!(a.length>1e4)){var b=/^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|y)?$/i.exec(a);if(b){var c=parseFloat(b[1]),d=(b[2]||"ms").toLowerCase();switch(d){case"years":case"year":case"yrs":case"yr":case"y":return c*l;case"days":case"day":case"d":return c*k;case"hours":case"hour":case"hrs":case"hr":case"h":return c*j;case"minutes":case"minute":case"mins":case"min":case"m":return c*i;case"seconds":case"second":case"secs":case"sec":case"s":return c*h;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c}}}}function e(a){return a>=k?Math.round(a/k)+"d":a>=j?Math.round(a/j)+"h":a>=i?Math.round(a/i)+"m":a>=h?Math.round(a/h)+"s":a+"ms"}function f(a){return g(a,k,"day")||g(a,j,"hour")||g(a,i,"minute")||g(a,h,"second")||a+" ms"}function g(a,b,c){return b>a?void 0:1.5*b>a?Math.floor(a/b)+" "+c:Math.ceil(a/b)+" "+c+"s"}var h=1e3,i=60*h,j=60*i,k=24*j,l=365.25*k;b.exports=function(a,b){return b=b||{},"string"==typeof a?d(a):b["long"]?f(a):e(a)}},{}],rhea:[function(a,b,c){(function(c){"use strict";var d=a("./connection.js"),e=a("./log.js"),f=a("./rpc.js"),g=a("./sasl.js"),h=a("./util.js"),i=a("net"),j=a("tls"),k=a("events").EventEmitter,l=function(a){this.options=a?Object.create(a):{},this.options.id||(this.options.id=h.generate_uuid()),this.id=this.options.id,this.sasl_server_mechanisms=g.server_mechanisms()};l.prototype=Object.create(k.prototype),l.prototype.constructor=l,l.prototype.dispatch=function(a){return e.events("Container got event: "+a),this.listeners(a).length?(k.prototype.emit.apply(this,arguments),!0):!1},l.prototype.connect=function(a){return new d(a,this).connect()},l.prototype.listen=function(a){var b,e=this;if(void 0===a.transport||"tcp"===a.transport)b=i.createServer(),b.on("connection",function(b){new d(a,e).accept(b)});else{if("tls"!==a.transport&&"ssl"!==a.transport)throw Error("Unrecognised transport: "+a.transport);b=j.createServer(a),b.on("secureConnection",function(b){new d(a,e).accept(b)})}return c.version.match(/v0\.10\.\d+/)?b.listen(a.port,a.host):b.listen(a),b},l.prototype.create_container=function(a){return new l(a)},l.prototype.get_option=function(a,b){return void 0!==this.options[a]?this.options[a]:b},l.prototype.generate_uuid=h.generate_uuid,l.prototype.rpc_server=function(a,b){return f.server(this,a,b)},l.prototype.rpc_client=function(a){return f.client(this,a)};var m=a("./ws.js");l.prototype.websocket_accept=function(a,b){new d(b,this).accept(m.wrap(a))},l.prototype.websocket_connect=m.connect,b.exports=new l}).call(this,a("_process"))},{"./connection.js":1,"./log.js":5,"./rpc.js":7,"./sasl.js":8,"./util.js":13,"./ws.js":14,_process:21,events:20,net:15,tls:15}]},{},[]);