autobahn-browser
Version:
[BROWSER BUILD] An implementation of The Web Application Messaging Protocol (WAMP).
117 lines (110 loc) • 358 kB
JavaScript
/*
Counter block mode compatible with Dr Brian Gladman fileenc.c
derived from CryptoJS.mode.CTR
Jan Hruby jhruby.web@gmail.com
(c) 2012 by C?dric Mesnil. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The buffer module from node.js, for the browser.
@author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
@license MIT
The buffer module from node.js, for the browser.
@author Feross Aboukhadijeh <https://feross.org>
@license MIT
ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> MIT License (c) copyright 2010-2014 original author or authors */
(function(z){"object"===typeof exports&&"undefined"!==typeof module?module.exports=z():"function"===typeof define&&define.amd?define([],z):("undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:this).autobahn=z()})(function(){return function(){function z(O,A,f){function e(b,d){if(!A[b]){if(!O[b]){var v="function"==typeof require&&require;if(!d&&v)return v(b,!0);if(g)return g(b,!0);d=Error("Cannot find module '"+b+"'");throw d.code="MODULE_NOT_FOUND",
d;}d=A[b]={exports:{}};O[b][0].call(d.exports,function(m){return e(O[b][1][m]||m)},d,d.exports,z,O,A,f)}return A[b].exports}for(var g="function"==typeof require&&require,a=0;a<f.length;a++)e(f[a]);return e}return z}()({1:[function(z,O,A){var f=z("crypto-js");A.sign=function(e,g){return f.HmacSHA256(g,e).toString(f.enc.Base64)};A.derive_key=function(e,g,a,b){return f.PBKDF2(e,g,{keySize:(b||32)/4,iterations:a||1E3,hasher:f.algo.SHA256}).toString(f.enc.Base64)}},{"crypto-js":68}],2:[function(z,O,A){function f(v,
m){m=a.htob(m.challenge);v=g.sign.detached(m,v.secretKey);return a.btoh(v)+a.btoh(m)}function e(v){return a.btoh(v.publicKey)}var g=z("tweetnacl"),a=z("../util.js"),b=z("../log.js"),d=z("../connection.js");A.load_private_key=function(v,m){var r=a.atob(localStorage.getItem(v));!r||m?(r=g.randomBytes(g.sign.seedLength),localStorage.setItem(v,a.btoa(r)),b.debug('new key seed "'+v+'" saved to local storage!')):b.debug('key seed "'+v+'" loaded from local storage!');return g.sign.keyPair.fromSeed(r)};A.delete_private_key=
function(v){for(var m=0;5>m;++m)seed=g.randomBytes(g.sign.seedLength),localStorage.setItem(v,a.btoa(seed)),localStorage.setItem(v,""),localStorage.setItem(v,null)};A.sign_challenge=f;A.public_key=e;A.create_connection=function(v){var m=v.url,r=v.realm,h=v.authid,l=v.pkey,k=v.activation_code,n=v.request_new_activation_code,w=v.serializers;v.debug&&(console.log(m),console.log(r),console.log(h),console.log(l),console.log(k),console.log(n),console.log(w));authextra={pubkey:e(l),trustroot:null,challenge:null,
channel_binding:null,activation_code:k,request_new_activation_code:n};return new d.Connection({url:m,realm:r,authid:h,authmethods:["cryptosign"],onchallenge:function(t,u,y){if("cryptosign"==u)return f(l,y);throw"don't know how to authenticate using '"+u+"'";},authextra,serializers:v.serializers})}},{"../connection.js":6,"../log.js":7,"../util.js":20,tweetnacl:151}],3:[function(z,O,A){A.auth=function(f,e,g){var a=f.defer();navigator.id.watch({loggedInUser:e,onlogin:function(b){a.resolve(b)},onlogout:function(){f.leave("wamp.close.logout")}});
return a.promise.then?a.promise:a}},{}],4:[function(z,O,A){var f="undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{};z("./polyfill.js");O=z("../package.json");let e,g;try{e=z("when"),g=!0}catch(w){g=!1}var a=z("msgpack5"),b=z("cbor"),d=z("tweetnacl");"AUTOBAHN_DEBUG"in f&&AUTOBAHN_DEBUG&&(z("when/monitor/console"),"console"in f&&console.log("AutobahnJS debug enabled"));f=z("./util.js");var v=z("./log.js"),m=z("./session.js"),r=z("./connection.js"),
h=z("./configure.js"),l=z("./serializer.js"),k=z("./auth/persona.js"),n=z("./auth/cra.js");z=z("./auth/cryptosign.js");A.version=O.version;A.transports=h.transports;A.Connection=r.Connection;A.Session=m.Session;A.Invocation=m.Invocation;A.Event=m.Event;A.Result=m.Result;A.Error=m.Error;A.Subscription=m.Subscription;A.Registration=m.Registration;A.Publication=m.Publication;A.serializer=l;A.auth_persona=k.auth;A.auth_cra=n;A.auth_cryptosign=z;g&&(A.when=e);A.msgpack=a;A.cbor=b;A.nacl=d;A.util=f;A.log=
v},{"../package.json":180,"./auth/cra.js":1,"./auth/cryptosign.js":2,"./auth/persona.js":3,"./configure.js":5,"./connection.js":6,"./log.js":7,"./polyfill.js":8,"./serializer.js":16,"./session.js":17,"./util.js":20,cbor:48,msgpack5:110,tweetnacl:151,when:178,"when/monitor/console":176}],5:[function(z,O,A){function f(){this._repository={}}f.prototype.register=function(g,a){this._repository[g]=a};f.prototype.isRegistered=function(g){return this._repository[g]?!0:!1};f.prototype.get=function(g){if(void 0!==
this._repository[g])return this._repository[g];throw"no such transport: "+g;};f.prototype.list=function(){var g=[],a;for(a in this._repository)g.push(a);return g};O=new f;var e=z("./transport/websocket.js");O.register("websocket",e.Factory);e=z("./transport/longpoll.js");O.register("longpoll",e.Factory);z=z("./transport/rawsocket.js");O.register("rawsocket",z.Factory);A.transports=O},{"./transport/longpoll.js":18,"./transport/rawsocket.js":44,"./transport/websocket.js":19}],6:[function(z,O,A){var f=
z("./session.js"),e=z("./util.js"),g=z("./log.js"),a=z("./autobahn.js");z=function(b){this._options=b;this._defer=e.deferred_factory(b);this._options.transports||(this._options.transports=[{type:"websocket",url:this._options.url,tlsConfiguration:this._options.tlsConfiguration}]);this._transport_factories=[];this._init_transport_factories();this._session_close_message=this._session_close_reason=this._session=null;this._retry_if_unreachable=void 0!==this._options.retry_if_unreachable?this._options.retry_if_unreachable:
!0;this._max_retries="undefined"!==typeof this._options.max_retries?this._options.max_retries:15;this._initial_retry_delay="undefined"!==typeof this._options.initial_retry_delay?this._options.initial_retry_delay:1.5;this._max_retry_delay=this._options.max_retry_delay||300;this._retry_delay_growth=this._options.retry_delay_growth||1.5;this._retry_delay_jitter=this._options.retry_delay_jitter||.1;this._connect_successes=0;this._retry=!1;this._retry_count=0;this._retry_delay=this._initial_retry_delay;
this._is_retrying=!1;this._retry_timer=null};z.prototype._create_transport=function(){for(var b=0;b<this._transport_factories.length;++b){var d=this._transport_factories[b];g.debug("trying to create WAMP transport of type: "+d.type);try{var v=d.create();if(v)return g.debug("using WAMP transport type: "+d.type),v}catch(m){e.handle_error(this._options.on_internal_error,m,"could not create WAMP transport '"+d.type+"': ")}}g.warn("could not create any WAMP transport");return null};z.prototype._init_transport_factories=
function(){var b;e.assert(this._options.transports,"No transport.factory specified");for(var d=0;d<this._options.transports.length;++d){var v=this._options.transports[d];v.url||(v.url=this._options.url);v.serializers||(v.serializers=this._options.serializers);v.protocols||(v.protocols=this._options.protocols);e.assert(v.type,"No transport.type specified");e.assert("string"===typeof v.type,"transport.type must be a string");try{if(b=a.transports.get(v.type)){var m=new b(v);this._transport_factories.push(m)}}catch(r){e.handle_error(this._options.on_internal_error,
r)}}};z.prototype._autoreconnect_reset_timer=function(){this._retry_timer&&clearTimeout(this._retry_timer);this._retry_timer=null};z.prototype._autoreconnect_reset=function(){this._autoreconnect_reset_timer();this._retry_count=0;this._retry_delay=this._initial_retry_delay;this._is_retrying=!1};z.prototype._autoreconnect_advance=function(){this._retry_delay_jitter&&(this._retry_delay=e.rand_normal(this._retry_delay,this._retry_delay*this._retry_delay_jitter));this._retry_delay>this._max_retry_delay&&
(this._retry_delay=this._max_retry_delay);this._retry_count+=1;var b=this._retry&&(-1===this._max_retries||this._retry_count<=this._max_retries)?{count:this._retry_count,delay:this._retry_delay,will_retry:!0}:{count:null,delay:null,will_retry:!1};this._retry_delay_growth&&(this._retry_delay*=this._retry_delay_growth);return b};z.prototype.open=function(){function b(){try{d._transport=d._create_transport()}catch(v){e.handle_error(d._options.on_internal_error,v)}if(d._transport)d._session=new f.Session(d._transport,
d._defer,d._options.onchallenge,d._options.on_user_error,d._options.on_internal_error),d._session_close_reason=null,d._session_close_message=null,d._transport.onopen=function(){d._autoreconnect_reset();d._connect_successes+=1;d._session.join(d._options.realm,d._options.authmethods,d._options.authid,d._options.authextra)},d._session.onjoin=function(v){if(d.onopen)try{v.transport=d._transport.info,d.onopen(d._session,v)}catch(m){e.handle_error(d._options.on_user_error,m,"Exception raised from app code while firing Connection.onopen()")}},
d._session.onleave=function(v,m){d._session_close_reason=v;d._session_close_message=m.message||"";d._retry=!1;d._transport.close()},d._transport.onclose=function(v){d._autoreconnect_reset_timer();d._transport=null;0===d._connect_successes?(v="unreachable",d._retry_if_unreachable||(d._retry=!1)):v=v.wasClean?"closed":"lost";var m=d._autoreconnect_advance(),r={reason:d._session_close_reason,message:d._session_close_message,retry_delay:m.delay,retry_count:m.count,will_retry:m.will_retry};g.warn("connection closed",
v,r);if(d.onclose)try{var h=d.onclose(v,r)}catch(l){e.handle_error(d._options.on_user_error,l,"Exception raised from app code while firing Connection.onclose()")}d._session&&(d._session._id=null,d._session=null,d._session_close_reason=null,d._session_close_message=null);d._retry&&!h?m.will_retry?(d._is_retrying=!0,g.warn("auto-reconnecting in "+m.delay+"s .."),d._retry_timer=setTimeout(b,1E3*m.delay)):g.warn("giving up trying to auto-reconnect!"):g.warn("auto-reconnect disabled!",d._retry,h)};else if(d._retry=
!1,d.onclose)d.onclose("unsupported",{reason:null,message:null,retry_delay:null,retry_count:null,will_retry:!1})}var d=this;if(d._transport)throw"connection already open (or opening)";d._autoreconnect_reset();d._retry=!0;b()};z.prototype.close=function(b,d){if(!this._transport&&!this._is_retrying)throw"connection already closed";this._retry=!1;this._session&&this._session.isOpen?this._session.leave(b,d):this._transport&&this._transport.close()};Object.defineProperty(z.prototype,"defer",{get:function(){return this._defer}});
Object.defineProperty(z.prototype,"session",{get:function(){return this._session}});Object.defineProperty(z.prototype,"isOpen",{get:function(){return this._session&&this._session.isOpen?!0:!1}});Object.defineProperty(z.prototype,"isConnected",{get:function(){return this._transport?!0:!1}});Object.defineProperty(z.prototype,"transport",{get:function(){return this._transport?this._transport:{info:{type:"none",url:null,protocol:null}}}});Object.defineProperty(z.prototype,"isRetrying",{get:function(){return this._is_retrying}});
A.Connection=z},{"./autobahn.js":4,"./log.js":7,"./session.js":17,"./util.js":20}],7:[function(z,O,A){(function(f){(function(){let e=function(){};"AUTOBAHN_DEBUG"in f&&AUTOBAHN_DEBUG&&"console"in f&&(e=function(){console.log.apply(console,arguments)});let g=console.warn.bind(console);A.debug=e;A.warn=g}).call(this)}).call(this,"undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})},{}],8:[function(z,O,A){z("./polyfill/object.js");z("./polyfill/array.js");
z("./polyfill/string.js");z("./polyfill/function.js");z("./polyfill/console.js");z("./polyfill/typedarray.js");z("./polyfill/json.js")},{"./polyfill/array.js":9,"./polyfill/console.js":10,"./polyfill/function.js":11,"./polyfill/json.js":12,"./polyfill/object.js":13,"./polyfill/string.js":14,"./polyfill/typedarray.js":15}],9:[function(z,O,A){"function"!==typeof Array.prototype.reduce&&(Array.prototype.reduce=function(f){if(null===this||"undefined"===typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");
if("function"!==typeof f)throw new TypeError(f+" is not a function");var e=Object(this);var g=e.length>>>0;var a=0;if(2<=arguments.length)var b=arguments[1];else{for(;a<g&&!a in e;)a++;if(a>=g)throw new TypeError("Reduce of empty array with no initial value");b=e[a++]}for(;a<g;a++)a in e&&(b=f(b,e[a],a,e));return b});"indexOf"in Array.prototype||(Array.prototype.indexOf=function(f,e){void 0===e&&(e=0);0>e&&(e+=this.length);0>e&&(e=0);for(var g=this.length;e<g;e++)if(e in this&&this[e]===f)return e;
return-1});"lastIndexOf"in Array.prototype||(Array.prototype.lastIndexOf=function(f,e){void 0===e&&(e=this.length-1);0>e&&(e+=this.length);e>this.length-1&&(e=this.length-1);for(e++;0<e--;)if(e in this&&this[e]===f)return e;return-1});"forEach"in Array.prototype||(Array.prototype.forEach=function(f,e){for(var g=0,a=this.length;g<a;g++)g in this&&f.call(e,this[g],g,this)});"map"in Array.prototype||(Array.prototype.map=function(f,e){for(var g=Array(this.length),a=0,b=this.length;a<b;a++)a in this&&
(g[a]=f.call(e,this[a],a,this));return g});"filter"in Array.prototype||(Array.prototype.filter=function(f,e){for(var g=[],a,b=0,d=this.length;b<d;b++)b in this&&f.call(e,a=this[b],b,this)&&g.push(a);return g});"every"in Array.prototype||(Array.prototype.every=function(f,e){for(var g=0,a=this.length;g<a;g++)if(g in this&&!f.call(e,this[g],g,this))return!1;return!0});"some"in Array.prototype||(Array.prototype.some=function(f,e){for(var g=0,a=this.length;g<a;g++)if(g in this&&f.call(e,this[g],g,this))return!0;
return!1});"function"!==typeof Array.prototype.reduceRight&&(Array.prototype.reduceRight=function(f){if(null===this||"undefined"===typeof this)throw new TypeError("Array.prototype.reduce called on null or undefined");if("function"!==typeof f)throw new TypeError(f+" is not a function");var e=Object(this),g=(e.length>>>0)-1;if(2<=arguments.length)var a=arguments[1];else{for(;0<=g&&!g in e;)g--;if(0>g)throw new TypeError("Reduce of empty array with no initial value");a=e[g--]}for(;0<=g;g--)g in e&&(a=
f(a,e[g],g,e));return a})},{}],10:[function(z,O,A){(function(f){f||(f=window.console={log:function(e,g,a,b,d){},info:function(e,g,a,b,d){},warn:function(e,g,a,b,d){},error:function(e,g,a,b,d){},assert:function(e,g){}});"object"===typeof f.log&&(f.log=Function.prototype.call.bind(f.log,f),f.info=Function.prototype.call.bind(f.info,f),f.warn=Function.prototype.call.bind(f.warn,f),f.error=Function.prototype.call.bind(f.error,f),f.debug=Function.prototype.call.bind(f.info,f));"group"in f||(f.group=function(e){f.info("\n--- "+
e+" ---\n")});"groupEnd"in f||(f.groupEnd=function(){f.log("\n")});"assert"in f||(f.assert=function(e,g){if(!e)try{throw Error("assertion failed: "+g);}catch(a){setTimeout(function(){throw a;},0)}});"time"in f||function(){var e={};f.time=function(g){e[g]=(new Date).getTime()};f.timeEnd=function(g){var a=(new Date).getTime();f.info(g+": "+(g in e?a-e[g]:0)+"ms")}}()})("undefined"!==typeof console?console:void 0)},{}],11:[function(z,O,A){Function.prototype.bind||(Function.prototype.bind=function(f){var e=
this,g=Array.prototype.slice.call(arguments,1);return function(){return e.apply(f,Array.prototype.concat.apply(g,arguments))}})},{}],12:[function(z,O,A){"object"!==typeof JSON&&(JSON={});(function(){function f(h){return 10>h?"0"+h:h}function e(h){v.lastIndex=0;return v.test(h)?'"'+h.replace(v,function(l){var k=m[l];return"string"===typeof k?k:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+h+'"'}function g(h,l){var k=a,n=l[h];n&&"object"===typeof n&&"function"===typeof n.toJSON&&(n=
n.toJSON(h));"function"===typeof d&&(n=d.call(l,h,n));switch(typeof n){case "string":return e(n);case "number":return isFinite(n)?String(n):"null";case "boolean":case "null":return String(n);case "object":if(!n)return"null";a+=b;var w=[];if("[object Array]"===Object.prototype.toString.apply(n)){var t=n.length;for(h=0;h<t;h+=1)w[h]=g(h,n)||"null";l=0===w.length?"[]":a?"[\n"+a+w.join(",\n"+a)+"\n"+k+"]":"["+w.join(",")+"]";a=k;return l}if(d&&"object"===typeof d)for(t=d.length,h=0;h<t;h+=1){if("string"===
typeof d[h]){var u=d[h];(l=g(u,n))&&w.push(e(u)+(a?": ":":")+l)}}else for(u in n)Object.prototype.hasOwnProperty.call(n,u)&&(l=g(u,n))&&w.push(e(u)+(a?": ":":")+l);l=0===w.length?"{}":a?"{\n"+a+w.join(",\n"+a)+"\n"+k+"}":"{"+w.join(",")+"}";a=k;return l}}"function"!==typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+
"Z":null},String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(){return this.valueOf()});var a,b,d;if("function"!==typeof JSON.stringify){var v=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;var m={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};JSON.stringify=function(h,l,k){var n;b=a="";if("number"===typeof k)for(n=0;n<k;n+=1)b+=" ";else"string"===typeof k&&(b=k);
if((d=l)&&"function"!==typeof l&&("object"!==typeof l||"number"!==typeof l.length))throw Error("JSON.stringify");return g("",{"":h})}}if("function"!==typeof JSON.parse){var r=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;JSON.parse=function(h,l){function k(n,w){var t,u=n[w];if(u&&"object"===typeof u)for(t in u)if(Object.prototype.hasOwnProperty.call(u,t)){var y=k(u,t);void 0!==y?u[t]=y:delete u[t]}return l.call(n,w,u)}h=String(h);r.lastIndex=
0;r.test(h)&&(h=h.replace(r,function(n){return"\\u"+("0000"+n.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(h.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return h=eval("("+h+")"),"function"===typeof l?k({"":h},""):h;throw new SyntaxError("JSON.parse");}}})();A.JSON=JSON},{}],13:[function(z,O,A){Object.create||(Object.create=function(){function f(){}return function(e){if(1!=
arguments.length)throw Error("Object.create implementation only accepts one parameter.");f.prototype=e;return new f}}());Object.keys||(Object.keys=function(){var f=Object.prototype.hasOwnProperty,e=!{toString:null}.propertyIsEnumerable("toString"),g="toString toLocaleString valueOf hasOwnProperty isPrototypeOf propertyIsEnumerable constructor".split(" "),a=g.length;return function(b){if("object"!==typeof b&&("function"!==typeof b||null===b))throw new TypeError("Object.keys called on non-object");
var d=[],v;for(v in b)f.call(b,v)&&d.push(v);if(e)for(v=0;v<a;v++)f.call(b,g[v])&&d.push(g[v]);return d}}())},{}],14:[function(z,O,A){"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")})},{}],15:[function(z,O,A){"undefined"===typeof Uint8Array&&function(f,e){function g(X){switch(typeof X){case "undefined":return"undefined";case "boolean":return"boolean";case "number":return"number";case "string":return"string";default:return null===X?"null":
"object"}}function a(X){return Object.prototype.toString.call(X).replace(/^\[object *|\]$/g,"")}function b(X){return"function"===typeof X}function d(X){if(null===X||void 0===X)throw TypeError();return Object(X)}function v(X){function ba(L){Object.defineProperty(X,L,{get:function(){return X._getter(L)},set:function(M){X._setter(L,M)},enumerable:!0,configurable:!1})}if(1E5<X.length)throw RangeError("Array too large for polyfill");var Q;for(Q=0;Q<X.length;Q+=1)ba(Q)}function m(X,ba){ba=32-ba;return X<<
ba>>ba}function r(X,ba){ba=32-ba;return X<<ba>>>ba}function h(X){return[X&255]}function l(X){return m(X[0],8)}function k(X){return[X&255]}function n(X){return r(X[0],8)}function w(X){X=ia(Number(X));return[0>X?0:255<X?255:X&255]}function t(X){return[X>>8&255,X&255]}function u(X){return m(X[0]<<8|X[1],16)}function y(X){return[X>>8&255,X&255]}function x(X){return r(X[0]<<8|X[1],16)}function F(X){return[X>>24&255,X>>16&255,X>>8&255,X&255]}function D(X){return m(X[0]<<24|X[1]<<16|X[2]<<8|X[3],32)}function I(X){return[X>>
24&255,X>>16&255,X>>8&255,X&255]}function S(X){return r(X[0]<<24|X[1]<<16|X[2]<<8|X[3],32)}function Z(X,ba,Q){function L(sa){var Ua=c(sa);sa-=Ua;return.5>sa?Ua:.5<sa?Ua+1:Ua%2?Ua+1:Ua}var M=(1<<ba-1)-1;if(X!==X){var Y=(1<<ba)-1;var oa=T(2,Q-1);var ta=0}else Infinity===X||-Infinity===X?(Y=(1<<ba)-1,oa=0,ta=0>X?1:0):0===X?(oa=Y=0,ta=-Infinity===1/X?1:0):(ta=0>X,X=J(X),X>=T(2,1-M)?(Y=H(c(p(X)/K),1023),oa=L(X/T(2,Y)*T(2,Q)),2<=oa/T(2,Q)&&(Y+=1,oa=1),Y>M?(Y=(1<<ba)-1,oa=0):(Y+=M,oa-=T(2,Q))):(Y=0,oa=L(X/
T(2,1-M-Q))));for(X=[];Q;--Q)X.push(oa%2?1:0),oa=c(oa/2);for(Q=ba;Q;--Q)X.push(Y%2?1:0),Y=c(Y/2);X.push(ta?1:0);X.reverse();ba=X.join("");for(ta=[];ba.length;)ta.push(parseInt(ba.substring(0,8),2)),ba=ba.substring(8);return ta}function aa(X,ba,Q){var L=[],M,Y;for(M=X.length;M;--M){var oa=X[M-1];for(Y=8;Y;--Y)L.push(oa%2?1:0),oa>>=1}L.reverse();Y=L.join("");X=(1<<ba-1)-1;L=parseInt(Y.substring(0,1),2)?-1:1;M=parseInt(Y.substring(1,1+ba),2);Y=parseInt(Y.substring(1+ba),2);return M===(1<<ba)-1?0!==Y?
NaN:Infinity*L:0<M?L*T(2,M-X)*(1+Y/T(2,Q)):0!==Y?L*T(2,-(X-1))*(Y/T(2,Q)):0>L?-0:0}function P(X){return aa(X,11,52)}function R(X){return Z(X,11,52)}function V(X){return aa(X,8,23)}function G(X){return Z(X,8,23)}var K=Math.LN2,J=Math.abs,c=Math.floor,p=Math.log,B=Math.max,H=Math.min,T=Math.pow,ia=Math.round;(function(){var X=Object.defineProperty;try{var ba=Object.defineProperty({},"x",{})}catch(Q){ba=!1}X&&ba||(Object.defineProperty=function(Q,L,M){if(X)try{return X(Q,L,M)}catch(Y){}if(Q!==Object(Q))throw TypeError("Object.defineProperty called on non-object");
Object.prototype.__defineGetter__&&"get"in M&&Object.prototype.__defineGetter__.call(Q,L,M.get);Object.prototype.__defineSetter__&&"set"in M&&Object.prototype.__defineSetter__.call(Q,L,M.set);"value"in M&&(Q[L]=M.value);return Q})})();(function(){function X(da){da>>=0;if(0>da)throw RangeError("ArrayBuffer size is not a small enough positive integer.");Object.defineProperty(this,"byteLength",{value:da});Object.defineProperty(this,"_bytes",{value:Array(da)});for(var ea=0;ea<da;ea+=1)this._bytes[ea]=
0}function ba(){if(!arguments.length||"object"!==typeof arguments[0])return function(da){da>>=0;if(0>da)throw RangeError("length is not a small enough positive integer.");Object.defineProperty(this,"length",{value:da});Object.defineProperty(this,"byteLength",{value:da*this.BYTES_PER_ELEMENT});Object.defineProperty(this,"buffer",{value:new X(this.byteLength)});Object.defineProperty(this,"byteOffset",{value:0})}.apply(this,arguments);if(1<=arguments.length&&"object"===g(arguments[0])&&arguments[0]instanceof
ba)return function(da){if(this.constructor!==da.constructor)throw TypeError();var ea=da.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new X(ea)});Object.defineProperty(this,"byteLength",{value:ea});Object.defineProperty(this,"byteOffset",{value:0});Object.defineProperty(this,"length",{value:da.length});for(ea=0;ea<this.length;ea+=1)this._setter(ea,da._getter(ea))}.apply(this,arguments);if(1<=arguments.length&&"object"===g(arguments[0])&&!(arguments[0]instanceof ba)&&!(arguments[0]instanceof
X||"ArrayBuffer"===a(arguments[0])))return function(da){var ea=da.length*this.BYTES_PER_ELEMENT;Object.defineProperty(this,"buffer",{value:new X(ea)});Object.defineProperty(this,"byteLength",{value:ea});Object.defineProperty(this,"byteOffset",{value:0});Object.defineProperty(this,"length",{value:da.length});for(ea=0;ea<this.length;ea+=1)this._setter(ea,Number(da[ea]))}.apply(this,arguments);if(1<=arguments.length&&"object"===g(arguments[0])&&(arguments[0]instanceof X||"ArrayBuffer"===a(arguments[0])))return function(da,
ea,la){ea>>>=0;if(ea>da.byteLength)throw RangeError("byteOffset out of range");if(ea%this.BYTES_PER_ELEMENT)throw RangeError("buffer length minus the byteOffset is not a multiple of the element size.");if(void 0===la){var ha=da.byteLength-ea;if(ha%this.BYTES_PER_ELEMENT)throw RangeError("length of buffer minus byteOffset not a multiple of the element size");la=ha/this.BYTES_PER_ELEMENT}else la>>>=0,ha=la*this.BYTES_PER_ELEMENT;if(ea+ha>da.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");
Object.defineProperty(this,"buffer",{value:da});Object.defineProperty(this,"byteLength",{value:ha});Object.defineProperty(this,"byteOffset",{value:ea});Object.defineProperty(this,"length",{value:la})}.apply(this,arguments);throw TypeError();}function Q(da,ea,la){var ha=function(){Object.defineProperty(this,"constructor",{value:ha});ba.apply(this,arguments);v(this)};"__proto__"in ha?ha.__proto__=ba:(ha.from=ba.from,ha.of=ba.of);ha.BYTES_PER_ELEMENT=da;var ja=function(){};ja.prototype=L;ha.prototype=
new ja;Object.defineProperty(ha.prototype,"BYTES_PER_ELEMENT",{value:da});Object.defineProperty(ha.prototype,"_pack",{value:ea});Object.defineProperty(ha.prototype,"_unpack",{value:la});return ha}f.ArrayBuffer=f.ArrayBuffer||X;Object.defineProperty(ba,"from",{value:function(da){return new this(da)}});Object.defineProperty(ba,"of",{value:function(){return new this(arguments)}});var L={};ba.prototype=L;Object.defineProperty(ba.prototype,"_getter",{value:function(da){if(1>arguments.length)throw SyntaxError("Not enough arguments");
da>>>=0;if(!(da>=this.length)){var ea=[],la;var ha=0;for(la=this.byteOffset+da*this.BYTES_PER_ELEMENT;ha<this.BYTES_PER_ELEMENT;ha+=1,la+=1)ea.push(this.buffer._bytes[la]);return this._unpack(ea)}}});Object.defineProperty(ba.prototype,"get",{value:ba.prototype._getter});Object.defineProperty(ba.prototype,"_setter",{value:function(da,ea){if(2>arguments.length)throw SyntaxError("Not enough arguments");da>>>=0;if(!(da>=this.length)){var la=this._pack(ea),ha;var ja=0;for(ha=this.byteOffset+da*this.BYTES_PER_ELEMENT;ja<
this.BYTES_PER_ELEMENT;ja+=1,ha+=1)this.buffer._bytes[ha]=la[ja]}}});Object.defineProperty(ba.prototype,"constructor",{value:ba});Object.defineProperty(ba.prototype,"copyWithin",{value:function(da,ea,la){var ha=d(this),ja=ha.length>>>0;ja=B(ja,0);da>>=0;da=0>da?B(ja+da,0):H(da,ja);ea>>=0;ea=0>ea?B(ja+ea,0):H(ea,ja);la=void 0===la?ja:la>>0;la=0>la?B(ja+la,0):H(la,ja);ja=H(la-ea,ja-da);from<da&&da<ea+ja?(la=-1,ea=ea+ja-1,da=da+ja-1):la=1;for(;0<count;)ha._setter(da,ha._getter(ea)),ea+=la,da+=la,--ja;
return ha}});Object.defineProperty(ba.prototype,"every",{value:function(da,ea){if(void 0===this||null===this)throw TypeError();var la=Object(this),ha=la.length>>>0;if(!b(da))throw TypeError();for(var ja=0;ja<ha;ja++)if(!da.call(ea,la._getter(ja),ja,la))return!1;return!0}});Object.defineProperty(ba.prototype,"fill",{value:function(da,ea,la){var ha=d(this),ja=ha.length>>>0;ja=B(ja,0);ea>>=0;ea=0>ea?B(ja+ea,0):H(ea,ja);la=void 0===la?ja:la>>0;for(ja=0>la?B(ja+la,0):H(la,ja);ea<ja;)ha._setter(ea,da),
ea+=1;return ha}});Object.defineProperty(ba.prototype,"filter",{value:function(da,ea){if(void 0===this||null===this)throw TypeError();var la=Object(this),ha=la.length>>>0;if(!b(da))throw TypeError();for(var ja=[],Ya=0;Ya<ha;Ya++){var bb=la._getter(Ya);da.call(ea,bb,Ya,la)&&ja.push(bb)}return new this.constructor(ja)}});Object.defineProperty(ba.prototype,"find",{value:function(da){var ea=d(this),la=ea.length>>>0;if(!b(da))throw TypeError();for(var ha=1<arguments.length?arguments[1]:void 0,ja=0;ja<
la;){var Ya=ea._getter(ja);if(da.call(ha,Ya,ja,ea))return Ya;++ja}}});Object.defineProperty(ba.prototype,"findIndex",{value:function(da){var ea=d(this),la=ea.length>>>0;if(!b(da))throw TypeError();for(var ha=1<arguments.length?arguments[1]:void 0,ja=0;ja<la;){var Ya=ea._getter(ja);if(da.call(ha,Ya,ja,ea))return ja;++ja}return-1}});Object.defineProperty(ba.prototype,"forEach",{value:function(da,ea){if(void 0===this||null===this)throw TypeError();var la=Object(this),ha=la.length>>>0;if(!b(da))throw TypeError();
for(var ja=0;ja<ha;ja++)da.call(ea,la._getter(ja),ja,la)}});Object.defineProperty(ba.prototype,"indexOf",{value:function(da){if(void 0===this||null===this)throw TypeError();var ea=Object(this),la=ea.length>>>0;if(0===la)return-1;var ha=0;if(0<arguments.length){var ja=Number(arguments[1]);ja!==ha?ha=0:0!==ja&&ja!==1/0&&ja!==-(1/0)&&(ha=(0<ja||-1)*c(J(ja)))}if(ha>=la)return-1;for(ha=0<=ha?ha:B(la-J(ha),0);ha<la;ha++)if(ea._getter(ha)===da)return ha;return-1}});Object.defineProperty(ba.prototype,"join",
{value:function(da){if(void 0===this||null===this)throw TypeError();for(var ea=Object(this),la=ea.length>>>0,ha=Array(la),ja=0;ja<la;++ja)ha[ja]=ea._getter(ja);return ha.join(void 0===da?",":da)}});Object.defineProperty(ba.prototype,"lastIndexOf",{value:function(da){if(void 0===this||null===this)throw TypeError();var ea=Object(this),la=ea.length>>>0;if(0===la)return-1;var ha=la;1<arguments.length&&(ha=Number(arguments[1]),ha!==ha?ha=0:0!==ha&&ha!==1/0&&ha!==-(1/0)&&(ha=(0<ha||-1)*c(J(ha))));for(la=
0<=ha?H(ha,la-1):la-J(ha);0<=la;la--)if(ea._getter(la)===da)return la;return-1}});Object.defineProperty(ba.prototype,"map",{value:function(da,ea){if(void 0===this||null===this)throw TypeError();var la=Object(this),ha=la.length>>>0;if(!b(da))throw TypeError();var ja=[];ja.length=ha;for(var Ya=0;Ya<ha;Ya++)ja[Ya]=da.call(ea,la._getter(Ya),Ya,la);return new this.constructor(ja)}});Object.defineProperty(ba.prototype,"reduce",{value:function(da){if(void 0===this||null===this)throw TypeError();var ea=Object(this),
la=ea.length>>>0;if(!b(da))throw TypeError();if(0===la&&1===arguments.length)throw TypeError();var ha=0,ja;for(ja=2<=arguments.length?arguments[1]:ea._getter(ha++);ha<la;)ja=da.call(void 0,ja,ea._getter(ha),ha,ea),ha++;return ja}});Object.defineProperty(ba.prototype,"reduceRight",{value:function(da){if(void 0===this||null===this)throw TypeError();var ea=Object(this),la=ea.length>>>0;if(!b(da))throw TypeError();if(0===la&&1===arguments.length)throw TypeError();--la;var ha;for(ha=2<=arguments.length?
arguments[1]:ea._getter(la--);0<=la;)ha=da.call(void 0,ha,ea._getter(la),la,ea),la--;return ha}});Object.defineProperty(ba.prototype,"reverse",{value:function(){if(void 0===this||null===this)throw TypeError();var da=Object(this),ea=da.length>>>0,la=c(ea/2),ha=0;for(--ea;ha<la;++ha,--ea){var ja=da._getter(ha);da._setter(ha,da._getter(ea));da._setter(ea,ja)}return da}});Object.defineProperty(ba.prototype,"set",{value:function(da,ea){if(1>arguments.length)throw SyntaxError("Not enough arguments");var la;
if("object"===typeof arguments[0]&&arguments[0].constructor===this.constructor){var ha=arguments[0];var ja=arguments[1]>>>0;if(ja+ha.length>this.length)throw RangeError("Offset plus length of array is out of range");var Ya=this.byteOffset+ja*this.BYTES_PER_ELEMENT;ja=ha.length*this.BYTES_PER_ELEMENT;if(ha.buffer===this.buffer){var bb=[];var Oa=0;for(la=ha.byteOffset;Oa<ja;Oa+=1,la+=1)bb[Oa]=ha.buffer._bytes[la];for(Oa=0;Oa<ja;Oa+=1,Ya+=1)this.buffer._bytes[Ya]=bb[Oa]}else for(Oa=0,la=ha.byteOffset;Oa<
ja;Oa+=1,la+=1,Ya+=1)this.buffer._bytes[Ya]=ha.buffer._bytes[la]}else if("object"===typeof arguments[0]&&"undefined"!==typeof arguments[0].length){ha=arguments[0];bb=ha.length>>>0;ja=arguments[1]>>>0;if(ja+bb>this.length)throw RangeError("Offset plus length of array is out of range");for(Oa=0;Oa<bb;Oa+=1)la=ha[Oa],this._setter(ja+Oa,Number(la))}else throw TypeError("Unexpected argument type(s)");}});Object.defineProperty(ba.prototype,"slice",{value:function(da,ea){var la=d(this),ha=la.length>>>0;
da>>=0;da=0>da?B(ha+da,0):H(da,ha);ea=void 0===ea?ha:ea>>0;ha=0>ea?B(ha+ea,0):H(ea,ha);ea=new la.constructor(ha-da);for(var ja=0;da<ha;){var Ya=la._getter(da);ea._setter(ja,Ya);++da;++ja}return ea}});Object.defineProperty(ba.prototype,"some",{value:function(da,ea){if(void 0===this||null===this)throw TypeError();var la=Object(this),ha=la.length>>>0;if(!b(da))throw TypeError();for(var ja=0;ja<ha;ja++)if(da.call(ea,la._getter(ja),ja,la))return!0;return!1}});Object.defineProperty(ba.prototype,"sort",
{value:function(da){if(void 0===this||null===this)throw TypeError();for(var ea=Object(this),la=ea.length>>>0,ha=Array(la),ja=0;ja<la;++ja)ha[ja]=ea._getter(ja);da?ha.sort(da):ha.sort();for(ja=0;ja<la;++ja)ea._setter(ja,ha[ja]);return ea}});Object.defineProperty(ba.prototype,"subarray",{value:function(da,ea){da>>=0;ea>>=0;1>arguments.length&&(da=0);2>arguments.length&&(ea=this.length);0>da&&(da=this.length+da);0>ea&&(ea=this.length+ea);var la=this.length;da=0>da?0:da>la?la:da;la=this.length;ea=0>ea?
0:ea>la?la:ea;la=ea-da;0>la&&(la=0);return new this.constructor(this.buffer,this.byteOffset+da*this.BYTES_PER_ELEMENT,la)}});var M=Q(1,h,l),Y=Q(1,k,n),oa=Q(1,w,n),ta=Q(2,t,u),sa=Q(2,y,x),Ua=Q(4,F,D),ua=Q(4,I,S),Za=Q(4,G,V),$a=Q(8,R,P);f.Int8Array=e.Int8Array=f.Int8Array||M;f.Uint8Array=e.Uint8Array=f.Uint8Array||Y;f.Uint8ClampedArray=e.Uint8ClampedArray=f.Uint8ClampedArray||oa;f.Int16Array=e.Int16Array=f.Int16Array||ta;f.Uint16Array=e.Uint16Array=f.Uint16Array||sa;f.Int32Array=e.Int32Array=f.Int32Array||
Ua;f.Uint32Array=e.Uint32Array=f.Uint32Array||ua;f.Float32Array=e.Float32Array=f.Float32Array||Za;f.Float64Array=e.Float64Array=f.Float64Array||$a})();(function(){function X(Y,oa){return b(Y.get)?Y.get(oa):Y[oa]}function ba(Y,oa,ta){if(!(Y instanceof ArrayBuffer||"ArrayBuffer"===a(Y)))throw TypeError();oa>>>=0;if(oa>Y.byteLength)throw RangeError("byteOffset out of range");ta=void 0===ta?Y.byteLength-oa:ta>>>0;if(oa+ta>Y.byteLength)throw RangeError("byteOffset and length reference an area beyond the end of the buffer");
Object.defineProperty(this,"buffer",{value:Y});Object.defineProperty(this,"byteLength",{value:ta});Object.defineProperty(this,"byteOffset",{value:oa})}function Q(Y){return function(oa,ta){oa>>>=0;if(oa+Y.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");oa+=this.byteOffset;oa=new f.Uint8Array(this.buffer,oa,Y.BYTES_PER_ELEMENT);for(var sa=[],Ua=0;Ua<Y.BYTES_PER_ELEMENT;Ua+=1)sa.push(X(oa,Ua));!!ta===!!M&&sa.reverse();return X(new Y((new f.Uint8Array(sa)).buffer),0)}}function L(Y){return function(oa,
ta,sa){oa>>>=0;if(oa+Y.BYTES_PER_ELEMENT>this.byteLength)throw RangeError("Array index out of range");ta=new Y([ta]);ta=new f.Uint8Array(ta.buffer);var Ua=[],ua;for(ua=0;ua<Y.BYTES_PER_ELEMENT;ua+=1)Ua.push(X(ta,ua));!!sa===!!M&&Ua.reverse();(new Uint8Array(this.buffer,oa,Y.BYTES_PER_ELEMENT)).set(Ua)}}var M=function(){var Y=new f.Uint16Array([4660]);Y=new f.Uint8Array(Y.buffer);return 18===X(Y,0)}();Object.defineProperty(ba.prototype,"getUint8",{value:Q(f.Uint8Array)});Object.defineProperty(ba.prototype,
"getInt8",{value:Q(f.Int8Array)});Object.defineProperty(ba.prototype,"getUint16",{value:Q(f.Uint16Array)});Object.defineProperty(ba.prototype,"getInt16",{value:Q(f.Int16Array)});Object.defineProperty(ba.prototype,"getUint32",{value:Q(f.Uint32Array)});Object.defineProperty(ba.prototype,"getInt32",{value:Q(f.Int32Array)});Object.defineProperty(ba.prototype,"getFloat32",{value:Q(f.Float32Array)});Object.defineProperty(ba.prototype,"getFloat64",{value:Q(f.Float64Array)});Object.defineProperty(ba.prototype,
"setUint8",{value:L(f.Uint8Array)});Object.defineProperty(ba.prototype,"setInt8",{value:L(f.Int8Array)});Object.defineProperty(ba.prototype,"setUint16",{value:L(f.Uint16Array)});Object.defineProperty(ba.prototype,"setInt16",{value:L(f.Int16Array)});Object.defineProperty(ba.prototype,"setUint32",{value:L(f.Uint32Array)});Object.defineProperty(ba.prototype,"setInt32",{value:L(f.Int32Array)});Object.defineProperty(ba.prototype,"setFloat32",{value:L(f.Float32Array)});Object.defineProperty(ba.prototype,
"setFloat64",{value:L(f.Float64Array)});f.DataView=f.DataView||ba})()}(A,window);"undefined"===typeof window||"Uint8ClampedArray"in window||(window.Uint8ClampedArray=window.Uint8Array)},{}],16:[function(z,O,A){function f(b,d){this.replacer=b;this.reviver=d;this.SERIALIZER_ID="json";this.BINARY=!1}var e=z("./log.js");f.prototype.serialize=function(b){try{return JSON.stringify(b,this.replacer)}catch(d){throw e.warn("JSON encoding error",d),d;}};f.prototype.unserialize=function(b){try{return JSON.parse(b,
this.reviver)}catch(d){throw e.warn("JSON decoding error",d),d;}};A.JSONSerializer=f;try{var g=z("msgpack5")({forceFloat64:!0});function b(){this.SERIALIZER_ID="msgpack";this.BINARY=!0}b.prototype.serialize=function(d){try{return g.encode(d)}catch(v){throw e.warn("MessagePack encoding error",v),v;}};b.prototype.unserialize=function(d){try{return g.decode(d)}catch(v){throw e.warn("MessagePack decoding error",v),v;}};A.MsgpackSerializer=b}catch(b){e.warn("msgpack serializer not available",b)}try{var a=
z("cbor");function b(){this.SERIALIZER_ID="cbor";this.BINARY=!0}b.prototype.serialize=async function(d){try{return await a.encodeAsync(d)}catch(v){throw e.warn("CBOR encoding error",v),v;}};b.prototype.unserialize=function(d){try{return a.decodeFirstSync(d)}catch(v){throw e.warn("CBOR decoding error",v),v;}};A.CBORSerializer=b}catch(b){e.warn("cbor serializer not available",b)}},{"./log.js":7,cbor:48,msgpack5:110}],17:[function(z,O,A){(function(f){(function(){const e=z("./log.js"),g=z("./util.js");
Date.now=Date.now||function(){return+new Date};var a={caller:{features:{caller_identification:!0,call_canceling:!0,progressive_call_results:!0}},callee:{features:{caller_identification:!0,pattern_based_registration:!0,shared_registration:!0,progressive_call_results:!0,registration_revocation:!0}},publisher:{features:{publisher_identification:!0,subscriber_blackwhite_listing:!0,publisher_exclusion:!0}},subscriber:{features:{publisher_identification:!0,pattern_based_subscription:!0,subscription_revocation:!0}}},
b=function(n,w,t,u,y){this.procedure=n;this.progress=w;this.caller=t;this.caller_authid=u;this.caller_authrole=y},d=function(n,w,t,u,y,x,F){this.publication=n;this.topic=w;this.publisher=t;this.publisher_authid=u;this.publisher_authrole=y;this.retained=x;this.forward_for=F},v=function(n,w){this.args=n||[];this.kwargs=w||{}},m=function(n,w,t){this.error=n;this.args=w||[];this.kwargs=t||{}},r=function(n,w,t,u,y){this.topic=n;this.handler=w;this.options=t||{};this.session=u;this.id=y;this.active=!0;
this._on_unsubscribe=u._defer();this.on_unsubscribe=this._on_unsubscribe.promise.then?this._on_unsubscribe.promise:this._on_unsubscribe};r.prototype.unsubscribe=function(){return this.session.unsubscribe(this)};var h=function(n,w,t,u,y){this.procedure=n;this.endpoint=w;this.options=t||{};this.session=u;this.id=y;this.active=!0;this._on_unregister=u._defer();this.on_unregister=this._on_unregister.promise.then?this._on_unregister.promise:this._on_unregister};h.prototype.unregister=function(){return this.session.unregister(this)};
var l=function(n){this.id=n},k=function(n,w,t,u,y){var x=this;x._socket=n;x._defer=w;x._onchallenge=t;x._on_user_error=u;x._on_internal_error=y;x._id=null;x._realm=null;x._features=null;x._goodbye_sent=!1;x._transport_is_closing=!1;x._publish_reqs={};x._subscribe_reqs={};x._unsubscribe_reqs={};x._call_reqs={};x._register_reqs={};x._unregister_reqs={};x._subscriptions={};x._registrations={};x._invocations={};x._prefixes={};x._caller_disclose_me=!1;x._publisher_disclose_me=!1;x._send_wamp=function(D){e.debug(D);
x._socket.send(D)};x._protocol_violation=function(D){x._socket.close(3002,"protocol violation: "+D);g.handle_error(x._on_internal_error,m("failing transport due to protocol violation: "+D))};x._MESSAGE_MAP={};x._MESSAGE_MAP[8]={};var F=0;x._new_request_id=function(){return F=9007199254740992>F?F+1:1};x._process_SUBSCRIBED=function(D){var I=D[1];D=D[2];if(I in x._subscribe_reqs){var S=x._subscribe_reqs[I],Z=S[0],aa=S[1],P=S[2];S=S[3];D in x._subscriptions||(x._subscriptions[D]=[]);aa=new r(aa,P,S,
x,D);x._subscriptions[D].push(aa);Z.resolve(aa);delete x._subscribe_reqs[I]}else x._protocol_violation("SUBSCRIBED received for non-pending request ID "+I)};x._MESSAGE_MAP[33]=x._process_SUBSCRIBED;x._process_SUBSCRIBE_ERROR=function(D){var I=D[2];I in x._subscribe_reqs?(D=new m(D[4],D[5],D[6]),x._subscribe_reqs[I][0].reject(D),delete x._subscribe_reqs[I]):x._protocol_violation("SUBSCRIBE-ERROR received for non-pending request ID "+I)};x._MESSAGE_MAP[8][32]=x._process_SUBSCRIBE_ERROR;x._process_UNSUBSCRIBED=
function(D){var I=D[1];if(I in x._unsubscribe_reqs){D=x._unsubscribe_reqs[I];var S=D[0];D=D[1];if(D in x._subscriptions){for(var Z=x._subscriptions[D],aa=0;aa<Z.length;++aa)Z[aa].active=!1,Z[aa]._on_unsubscribe.resolve();delete x._subscriptions[D]}S.resolve(!0);delete x._unsubscribe_reqs[I]}else if(0===I)if(I=D[2],D=I.subscription,I=I.reason,D in x._subscriptions){Z=x._subscriptions[D];for(aa=0;aa<Z.length;++aa)Z[aa].active=!1,Z[aa]._on_unsubscribe.resolve(I);delete x._subscriptions[D]}else x._protocol_violation("non-voluntary UNSUBSCRIBED received for non-existing subscription ID "+
D);else x._protocol_violation("UNSUBSCRIBED received for non-pending request ID "+I)};x._MESSAGE_MAP[35]=x._process_UNSUBSCRIBED;x._process_UNSUBSCRIBE_ERROR=function(D){var I=D[2];I in x._unsubscribe_reqs?(D=new m(D[4],D[5],D[6]),x._unsubscribe_reqs[I][0].reject(D),delete x._unsubscribe_reqs[I]):x._protocol_violation("UNSUBSCRIBE-ERROR received for non-pending request ID "+I)};x._MESSAGE_MAP[8][34]=x._process_UNSUBSCRIBE_ERROR;x._process_PUBLISHED=function(D){var I=D[1],S=D[2];I in x._publish_reqs?
(D=x._publish_reqs[I][0],S=new l(S),D.resolve(S),delete x._publish_reqs[I]):x._protocol_violation("PUBLISHED received for non-pending request ID "+I)};x._MESSAGE_MAP[17]=x._process_PUBLISHED;x._process_PUBLISH_ERROR=function(D){var I=D[2];I in x._publish_reqs?(D=new m(D[4],D[5],D[6]),x._publish_reqs[I][0].reject(D),delete x._publish_reqs[I]):x._protocol_violation("PUBLISH-ERROR received for non-pending request ID "+I)};x._MESSAGE_MAP[8][16]=x._process_PUBLISH_ERROR;x._process_EVENT=function(D){var I=
D[1];if(I in x._subscriptions){var S=D[3],Z=D[4]||[],aa=D[5]||{};I=x._subscriptions[I];D=new d(D[2],S.topic||I[0]&&I[0].topic,S.publisher,S.publisher_authid,S.publisher_authrole,S.retained||!1,S.forward_for);for(S=0;S<I.length;++S){var P=I[S];try{P.handler(Z,aa,D,P)}catch(R){g.handle_error(x._on_user_error,R,"Exception raised in event handler:")}}}else x._protocol_violation("EVENT received for non-subscribed subscription ID "+I)};x._MESSAGE_MAP[36]=x._process_EVENT;x._process_REGISTERED=function(D){var I=
D[1];D=D[2];if(I in x._register_reqs){var S=x._register_reqs[I],Z=S[0];S=new h(S[1],S[2],S[3],x,D);x._registrations[D]=S;Z.resolve(S);delete x._register_reqs[I]}else x._protocol_violation("REGISTERED received for non-pending request ID "+I)};x._MESSAGE_MAP[65]=x._process_REGISTERED;x._process_REGISTER_ERROR=function(D){var I=D[2];I in x._register_reqs?(D=new m(D[4],D[5],D[6]),x._register_reqs[I][0].reject(D),delete x._register_reqs[I]):x._protocol_violation("REGISTER-ERROR received for non-pending request ID "+
I)};x._MESSAGE_MAP[8][64]=x._process_REGISTER_ERROR;x._process_UNREGISTERED=function(D){var I=D[1];if(I in x._unregister_reqs){D=x._unregister_reqs[I];var S=D[0];D=D[1];D.id in x._registrations&&delete x._registrations[D.id];D.active=!1;S.resolve();delete x._unregister_reqs[I]}else 0===I?(D=D[2],I=D.registration,S=D.reason,I in x._registrations?(D=x._registrations[I],D.active=!1,D._on_unregister.resolve(S),delete x._registrations[I]):x._protocol_violation("non-voluntary UNREGISTERED received for non-existing registration ID "+
I)):x._protocol_violation("UNREGISTERED received for non-pending request ID "+I)};x._MESSAGE_MAP[67]=x._process_UNREGISTERED;x._process_UNREGISTER_ERROR=function(D){var I=D[2];I in x._unregister_reqs?(D=new m(D[4],D[5],D[6]),x._unregister_reqs[I][0].reject(D),delete x._unregister_reqs[I]):x._protocol_violation("UNREGISTER-ERROR received for non-pending request ID "+I)};x._MESSAGE_MAP[8][66]=x._process_UNREGISTER_ERROR;x._process_RESULT=function(D){var I=D[1];if(I in x._call_reqs){var S=D[2],Z=D[3]||
[],aa=D[4]||{};D=null;1<Z.length||0<Object.keys(aa).length?D=new v(Z,aa):0<Z.length&&(D=Z[0]);aa=x._call_reqs[I];Z=aa[0];aa=aa[1];S.progress?aa&&aa.receive_progress&&Z.notify(D):(Z.resolve(D),delete x._call_reqs[I])}else x._protocol_violation("CALL-RESULT received for non-pending request ID "+I)};x._MESSAGE_MAP[50]=x._process_RESULT;x._process_CALL_ERROR=function(D){var I=D[2];I in x._call_reqs?(D=new m(D[4],D[5],D[6]),x._call_reqs[I][0].reject(D),delete x._call_reqs[I]):x._protocol_violation("CALL-ERROR received for non-pending request ID "+
I)};x._MESSAGE_MAP[8][48]=x._process_CALL_ERROR;x._process_INVOCATION=function(D){var I=D[1],S=D[2],Z=D[3];if(S in x._registrations){S=x._registrations[S];var aa=D[4]||[];D=D[5]||{};var P=null;Z.receive_progress&&(P=function(R,V){var G=[70,I,{progress:!0}];R=R||[];V=V||{};var K=Object.keys(V).length;if(R.length||K)G.push(R),K&&G.push(V);x._send_wamp(G)});Z=new b(Z.procedure||S.procedure,P,Z.caller,Z.caller_authid,Z.caller_authrole);g.as_promise(S.endpoint,aa,D,Z).then(function(R){var V=[70,I,{}];
if(R instanceof v){var G=Object.keys(R.kwargs).length;if(R.args.length||G)V.push(R.args),G&&V.push(R.kwargs)}else V.push([R]);x._send_wamp(V)},function(R){var V=[8,68,I,{}];if(R instanceof m){V.push(R.error);var G=Object.keys(R.kwargs).length;if(R.args.length||G)V.push(R.args),G&&V.push(R.kwargs)}else V.push("wamp.error.runtime_error"),V.push([R]);x._send_wamp(V);g.handle_error(x._on_user_error,R,"Exception raised in invocation handler:")})}else x._protocol_violation("INVOCATION received for non-registered registration ID "+
I)};x._MESSAGE_MAP[68]=x._process_INVOCATION;x._socket.onmessage=function(D){var I=D[0];if(x._id)if(6===I){if(x._goodbye_sent||x._send_wamp([6,{},"wamp.error.goodbye_and_out"]),x._id=null,x._realm=null,x._features=null,I=D[1],D=D[2],x.onleave)x.onleave(D,I)}else if(8===I){var S=D[1];if(S in x._MESSAGE_MAP[8])x._MESSAGE_MAP[I][S](D);else x._protocol_violation("unexpected ERROR message with request_type "+S)}else if(I in x._MESSAGE_MAP)x._MESSAGE_MAP[I](D);else x._protocol_violation("unexpected message type "+
I);else if(2===I){x._id=D[1];I=D[2];x._features={};if(I.roles.broker&&(x._features.subscriber={},x._features.publisher={},I.roles.broker.features)){for(S in a.publisher.features)x._features.publisher[S]=a.publisher.features[S]&&I.roles.broker.features[S];for(S in a.subscriber.features)x._features.subscriber[S]=a.subscriber.features[S]&&I.roles.broker.features[S]}if(I.roles.dealer&&(x._features.caller={},x._features.callee={},I.roles.dealer.features)){for(S in a.caller.features)x._features.caller[S]=
a.caller.features[S]&&I.roles.dealer.features[S];for(S in a.callee.features)x._features.callee[S]=a.callee.features[S]&&I.roles.dealer.features[S]}if(x.onjoin)x.onjoin(D[2])}else if(3===I){if(I=D[1],D=D[2],x.onleave)x.onleave(D,I)}else 4===I?x._onchallenge?g.as_promise(x._onchallenge,x,D[1],D[2]).then(function(Z){if("string"===typeof Z)var aa=[5,Z,{}];else"object"===typeof Z&&(aa=[5,Z[0],Z[1]]);x._send_wamp(aa)},function(Z){g.handle_error(x._on_user_error,Z,"onchallenge() raised: ");x._send_wamp([3,
{message:"sorry, I cannot authenticate (onchallenge handler raised an exception)"},"wamp.error.cannot_authenticate"]);x._socket.close(3E3)}):(g.handle_error(x._on_internal_error,m("received WAMP challenge, but no onchallenge() handler set")),D=[3,{message:"sorry, I cannot authenticate (no onchallenge handler set)"},"wamp.error.cannot_authenticate"],x._send_wamp(D),x._socket.close(3E3)):x._protocol_violation("unexpected message type "+I)};x._created="performance"in f&&"now"in performance?performance.now():
Date.now()};Object.defineProperty(k.prototype,"defer",{get:function(){return this._defer}});Object.defineProperty(k.prototype,"id",{get:function(){return this._id}});Object.defineProperty(k.prototype,"realm",{get:function(){return this._realm}});Object.defineProperty(k.prototype,"isOpen",{get:function(){return null!==this.id}});Object.defineProperty(k.prototype,"features",{get:function(){return this._features}});Object.defineProperty(k.prototype,"caller_disclose_me",{get:function(){return this._caller_disclose_me},
set:function(n){this._caller_disclose_me=n}});Object.defineProperty(k.prototype,"publisher_disclose_me",{get:function(){return this._publisher_disclose_me},set:function(n){this._publisher_disclose_me=n}});Object.defineProperty(k.prototype,"subscriptions",{get:function(){for(var n=Object.keys(this._subscriptions),w=[],t=0;t<n.length;++t)w.push(this._subscriptions[n[t]]);return w}});Object.defineProperty(k.prototype,"registrations",{get:function(){for(var n=Object.keys(this._registrations),w=[],t=0;t<
n.length;++t)w.push(this._registrations[n[t]]);return w}});k.prototype.log=function(){if("console"in f){if(this._id&&this._created){var n="performance"in