qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eal...@apache.org
Subject [07/10] qpid-dispatch git commit: DISPATCH-531 Initial version of openstack horizon plugin
Date Wed, 19 Oct 2016 12:49:06 GMT
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/0c58c381/console/dispatch-dashboard/dispatch/static/dashboard/dispatch/lib/rhea-min.js
----------------------------------------------------------------------
diff --git a/console/dispatch-dashboard/dispatch/static/dashboard/dispatch/lib/rhea-min.js b/console/dispatch-dashboard/dispatch/static/dashboard/dispatch/lib/rhea-min.js
new file mode 100644
index 0000000..939f401
--- /dev/null
+++ b/console/dispatch-dashboard/dispatch/static/dashboard/dispatch/lib/rhea-min.js
@@ -0,0 +1,4 @@
+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;re
 turn 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_capabili
 ties","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.op
 tions.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,thi
 s.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.o
 n_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,t
 his)),!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.heartb
 eat_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&&!th
 is.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(),thi
 s.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.o
 pen_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",cod
 e: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.tar
 get=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,th
 is._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("se
 nder_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=functi
 on(){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_annotation
 s","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.stri
 ngify(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=func
 tion(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,f
 unction(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 f
 unction(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.o
 n_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_mech
 anisms=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";funct
 ion 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=functi
 on(){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=functio
 n(){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(){retur
 n 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();i
 f(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.rejec
 ted({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={chan
 nel: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(thi
 s.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_o
 pen",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:{};retur
 n 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.descri
 ptor)}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";v
 ar 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_r
 eceived.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 sup
 ported")}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("str
 ing"===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_typec
 ode();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_cou
 nt(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;va
 r 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_cons
 tructor)},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.protot
 ype.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 Ra
 ngeError("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":re
 turn 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)}va
 r 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.from
 CharCode(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("I
 ndex 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&&Obje
 ct.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.proto
 type.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){retur
 n 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(t
 his,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.l

<TRUNCATED>

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message