From 954d409b8d2898f27a1be4b14636641e61654a4f Mon Sep 17 00:00:00 2001 From: James Lees Date: Tue, 11 Feb 2020 11:17:04 +0000 Subject: [PATCH] Prepare release 5.1.0 - update changelog - add built bundles - update versions in README - bump package.json and package-lock.json version --- CHANGELOG.md | 12 + README.md | 18 +- dist/react-native/pusher.js | 4 +- dist/web/pusher.js | 548 +++++++++++++++++-------------- dist/web/pusher.min.js | 4 +- dist/worker/pusher.worker.js | 476 +++++++++++++++------------ dist/worker/pusher.worker.min.js | 4 +- package-lock.json | 2 +- package.json | 2 +- 9 files changed, 585 insertions(+), 485 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b3016bd5d..40e3fe208 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## 5.1.0 (2020-02-11) + +[NEW] Include typescript declarations + +[CHANGED] Make stats opt in rather than opt out - Previously we sent some +metrics about connection strategies to stats.pusher.com by default, it could be +disabled by passing the `disableStats` option. This functionality is now off by +default and can be enabled by passing the `enableStats` option + +[FIXED] An issue where local tests would hang for 300s if a browser wasn't +available + ## 5.0.3 (2019-11-18) [NEW] Log a warning when there is an auth error diff --git a/README.md b/README.md index f05603b35..5fdb79057 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ const Pusher = require('pusher-js'); #### CDN ```html - + ``` You can also use [cdnjs.com](https://cdnjs.com/libraries/pusher) if you prefer @@ -129,7 +129,7 @@ Notes: You can import the worker script (`pusher.worker.js`, not `pusher.js`) from the CDN: ```javascript -importScripts('https://js.pusher.com/5.0/pusher.worker.min.js'); +importScripts('https://js.pusher.com/5.1/pusher.worker.min.js'); ``` ### Node.js @@ -552,17 +552,17 @@ First, clone this repository and run `npm install && git submodule init && git s In the `dist/web` folder, you should see the files you need: `pusher.js`, `pusher.min.js`, `json2.js`, `json.min.js`, `sockjs.js` and `sockjs.min.js`. `pusher.js` should be built referencing your URLs as the dependency hosts. -First, make sure you expose all files from the `dist` directory. They need to be in a directory with named after the version number. For example, if you're hosting version 5.0.3 under `http://example.com/pusher-js` (and https for SSL), files should be accessible under following URL's: +First, make sure you expose all files from the `dist` directory. They need to be in a directory with named after the version number. For example, if you're hosting version 5.1.0 under `http://example.com/pusher-js` (and https for SSL), files should be accessible under following URL's: - http://example.com/pusher-js/5.0.3/pusher.js - http://example.com/pusher-js/5.0.3/json2.js - http://example.com/pusher-js/5.0.3/sockjs.js + http://example.com/pusher-js/5.1.0/pusher.js + http://example.com/pusher-js/5.1.0/json2.js + http://example.com/pusher-js/5.1.0/sockjs.js Minified files should have `.min` in their names, as in the `dist/web` directory: - http://example.com/pusher-js/5.0.3/pusher.min.js - http://example.com/pusher-js/5.0.3/json2.min.js - http://example.com/pusher-js/5.0.3/sockjs.min.js + http://example.com/pusher-js/5.1.0/pusher.min.js + http://example.com/pusher-js/5.1.0/json2.min.js + http://example.com/pusher-js/5.1.0/sockjs.min.js ## SockJS compatibility diff --git a/dist/react-native/pusher.js b/dist/react-native/pusher.js index a3a075060..02ae9419e 100644 --- a/dist/react-native/pusher.js +++ b/dist/react-native/pusher.js @@ -1,8 +1,8 @@ /*! - * Pusher JavaScript Library v5.0.3 + * Pusher JavaScript Library v5.1.0 * https://pusher.com/ * * Copyright 2017, Pusher * Released under the MIT licence. */ -module.exports=function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1)}([function(t,e){t.exports=require("@react-native-community/netinfo")},function(t,e,n){t.exports=n(2).default},function(t,e,n){"use strict";n.r(e);for(var o=String.fromCharCode,i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r={},s=0,c=i.length;s>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e)},h=function(t){return t.replace(/[^\x00-\x7F]/g,u)},p=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[i.charAt(n>>>18),i.charAt(n>>>12&63),e>=2?"=":i.charAt(n>>>6&63),e>=1?"=":i.charAt(63&n)].join("")},l=global.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,p)},f=function(){function t(t,e,n,o){var i=this;this.clear=e,this.timer=t((function(){i.timer&&(i.timer=o(i.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),d=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function y(t){global.clearTimeout(t)}function g(t){global.clearInterval(t)}var b=function(t){function e(e,n){return t.call(this,setTimeout,y,e,(function(t){return n(),null}))||this}return d(e,t),e}(f),v=function(t){function e(e,n){return t.call(this,setInterval,g,e,(function(t){return n(),t}))||this}return d(e,t),e}(f),m={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new b(0,t)},method:function(t){for(var e=[],n=1;n0)for(o=0;o=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},Z=K,tt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),et=function(t){function e(e,n){var o=t.call(this)||this;return o.id=e,o.transport=n,o.activityTimeout=n.activityTimeout,o.bindListeners(),o}return tt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var o={event:t,data:e};return n&&(o.channel=n),F.debug("Event sent",o),this.send(Z.encodeMessage(o))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=Z.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(F.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){w(e,(function(e,n){t.transport.unbind(n,e)}))};w(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=Z.getCloseAction(t),n=Z.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(z),nt=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=Z.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new et(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=Z.getCloseAction(e)||"backoff",o=Z.getCloseError(e);t.finish(n,{error:o})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(_({transport:this.transport,action:t},e))},t}(),ot=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===ie.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){return t.authorizers=t.authorizers||ie.getAuthorizers(),t.authorizers[this.type].call(this,ie,e,n)},t}(),it=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(ie.TimelineTransport.getAgent(this,t),e)},t}(),rt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),st=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ct=(function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}rt(e,t)}(Error),function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error)),at=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ut=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ht=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),pt=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),lt={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/authenticating_users"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"}}},ft={buildLogSuffix:function(t){var e,n=lt.urls[t];return n?(n.fullUrl?e=n.fullUrl:n.path&&(e=lt.baseUrl+n.path),e?"See: "+e:""):""}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),yt=function(t){function e(e,n){var o=t.call(this,(function(t,n){F.debug("No callbacks on "+e+" for "+t)}))||this;return o.name=e,o.pusher=n,o.subscribed=!1,o.subscriptionPending=!1,o.subscriptionCancelled=!1,o}return dt(e,t),e.prototype.authorize=function(t,e){return e(!1,{})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new st("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=ft.buildLogSuffix("triggeringClientEvents");F.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(F.error(n),t.emit("pusher:subscription_error",n)):t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name})})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(z),gt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),bt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return gt(e,t),e.prototype.authorize=function(t,e){return Ct.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(yt),vt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;w(this.members,(function(n,o){t(e.get(o))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),_t=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.members=new vt,o}return mt(e,t),e.prototype.authorize=function(e,n){var o=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===e.channel_data){var i=ft.buildLogSuffix("authenticationEndpoint");return F.error("Invalid auth response for channel '"+o.name+"',expected 'channel_data' field. "+i),void n("Invalid auth response")}var r=JSON.parse(e.channel_data);o.members.setMyID(r.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,o={};t.user_id&&(o.user_id=t.user_id),this.emit(e,n,o)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var o=this.members.addMember(n);this.emit("pusher:member_added",o);break;case"pusher_internal:member_removed":var i=this.members.removeMember(n);i&&this.emit("pusher:member_removed",i)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(bt),St=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return St(e,t),e.prototype.authorize=function(e,n){var o=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var i=e.shared_secret;if(i)o.key=(void 0)(i),delete e.shared_secret,n(!1,e);else{var r="No shared_secret key in auth payload for encrypted channel: "+o.name;n(!0,r)}}}))},e.prototype.trigger=function(t,e){throw new ut("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,o=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,o):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var o=(void 0)(e.ciphertext);if(o.length<(void 0).overheadLength)F.error("Expected encrypted event ciphertext length to be "+(void 0).overheadLength+", got: "+o.length);else{var i=(void 0)(e.nonce);if(i.length<(void 0).nonceLength)F.error("Expected encrypted event nonce length to be "+(void 0).nonceLength+", got: "+i.length);else{var r=(void 0).open(o,i,this.key);if(null===r)return F.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),void this.authorize(this.pusher.connection.socket_id,(function(e,s){e?F.error("Failed to make a request to the authEndpoint: "+s+". Unable to fetch new key, so dropping encrypted event"):null!==(r=(void 0).open(o,i,n.key))?n.emitJSON(t,(void 0)(r)):F.error("Failed to decrypt event with new key. Dropping encrypted event")}));this.emitJSON(t,(void 0)(r))}}}else F.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+e);else F.debug("Received encrypted event before key has been retrieved from the authEndpoint")},e.prototype.emitJSON=function(t,e){try{this.emit(t,JSON.parse(e))}catch(n){this.emit(t,e)}return this},e}(bt),wt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ot=function(t){function e(e,n){var o=t.call(this)||this;o.key=e,o.options=n||{},o.state="initialized",o.connection=null,o.usingTLS=!!n.useTLS,o.timeline=o.options.timeline,o.errorCallbacks=o.buildErrorCallbacks(),o.connectionCallbacks=o.buildConnectionCallbacks(o.errorCallbacks),o.handshakeCallbacks=o.buildHandshakeCallbacks(o.errorCallbacks);var i=ie.getNetwork();return i.bind("online",(function(){o.timeline.info({netinfo:"online"}),"connecting"!==o.state&&"unavailable"!==o.state||o.retryIn(0)})),i.bind("offline",(function(){o.timeline.info({netinfo:"offline"}),o.connection&&o.sendActivityCheck()})),o.updateStrategy(),o}return wt(e,t),e.prototype.connect=function(){this.connection||this.runner||(this.strategy.isSupported()?(this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()):this.updateState("failed"))},e.prototype.send=function(t){return!!this.connection&&this.connection.send(t)},e.prototype.send_event=function(t,e,n){return!!this.connection&&this.connection.send_event(t,e,n)},e.prototype.disconnect=function(){this.disconnectInternally(),this.updateState("disconnected")},e.prototype.isUsingTLS=function(){return this.usingTLS},e.prototype.startConnecting=function(){var t=this,e=function(n,o){n?t.runner=t.strategy.connect(0,e):"error"===o.action?(t.emit("error",{type:"HandshakeError",error:o.error}),t.timeline.error({handshakeError:o.error})):(t.abortConnecting(),t.handshakeCallbacks[o.action](o))};this.runner=this.strategy.connect(0,e)},e.prototype.abortConnecting=function(){this.runner&&(this.runner.abort(),this.runner=null)},e.prototype.disconnectInternally=function(){(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection)&&this.abandonConnection().close()},e.prototype.updateStrategy=function(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})},e.prototype.retryIn=function(t){var e=this;this.timeline.info({action:"retry",delay:t}),t>0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new b(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new b(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new b(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new b(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return _({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return _({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var o=t;"connected"===o&&(o+=" with new socket ID "+e.socket_id),F.debug("State changed",n+" -> "+o),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(z),Tt=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){if(0===t.indexOf("private-encrypted-")){throw new ut("Encrypted channels are not yet supported when using React Native builds.")}return 0===t.indexOf("private-")?Ct.createPrivateChannel(t,e):0===t.indexOf("presence-")?Ct.createPresenceChannel(t,e):Ct.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return w(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){w(this.channels,(function(t){t.disconnect()}))},t}();var Ct={createChannels:function(){return new Tt},createConnectionManager:function(t,e){return new Ot(t,e)},createChannel:function(t,e){return new yt(t,e)},createPrivateChannel:function(t,e){return new bt(t,e)},createPresenceChannel:function(t,e){return new _t(t,e)},createEncryptedChannel:function(t,e){return new kt(t,e)},createTimelineSender:function(t,e){return new it(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new ot(t,e)},createHandshake:function(t,e){return new nt(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new $(t,e,n)}},Pt=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Ct.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),Lt=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,o=this.strategies,i=0,r=this.timeout,s=null,c=function(a,u){u?e(null,u):(i+=1,n.loop&&(i%=o.length),i0&&(i=new b(n.timeout,(function(){r.abort(),o(!0)}))),r=t.connect(e,(function(t,e){t&&i&&i.isRunning()&&!n.failFast||(i&&i.ensureAborted(),o(t,e))})),{abort:function(){i&&i.ensureAborted(),r.abort()},forceMinPriority:function(t){r.forceMinPriority(t)}}},t}(),Et=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var o=C(t,(function(t,o,i,r){return t.connect(e,n(o,r))}));return{abort:function(){T(o,xt)},forceMinPriority:function(t){T(o,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(o,i){n[t].error=o,o?function(t){return function(t,e){for(var n=0;n=m.now()){var r=this.transports[o.transport];r&&(this.timeline.info({cached:!0,transport:o.transport,latency:o.latency}),i.push(new Lt([r],{timeout:2*o.latency+1e3,failFast:!0})))}var s=m.now(),c=i.pop().connect(t,(function o(r,a){r?(jt(n),i.length>0?(s=m.now(),c=i.pop().connect(t,o)):e(r)):(!function(t,e,n){var o=ie.getLocalStorage();if(o)try{o[Rt(t)]=R({timestamp:m.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,m.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function Rt(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function jt(t){var e=ie.getLocalStorage();if(e)try{delete e[Rt(t)]}catch(t){}}var It=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,o=this.strategy,i=new b(this.options.delay,(function(){n=o.connect(t,e)}));return{abort:function(){i.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),Nt=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),Mt=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,o){o&&n.abort(),e(t,o)}));return n},t}();function Ht(t){return function(){return t.isSupported()}}var Dt,Ut=function(t,e){var n={};function o(o,i,r,s,c){var a=e(t,o,i,r,s,c);return n[o]=a,a}var i,r={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=_({},r,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Pt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Pt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),p=o("ws","ws",3,r,u),l=o("wss","ws",3,s,u),f=o("xhr_streaming","xhr_streaming",1,c,h),d=o("xhr_polling","xhr_polling",1,c),y=new Lt([p],a),g=new Lt([l],a),b=new Lt([f],a),v=new Lt([d],a),m=new Lt([new Nt(Ht(b),new Et([b,new It(v,{delay:4e3})]),v)],a);return i=t.useTLS?new Et([y,new It(m,{delay:2e3})]):new Et([y,new It(g,{delay:2e3}),new It(m,{delay:5e3})]),new At(new Mt(new Nt(Ht(p),i,m)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},zt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ft=function(t){function e(e,n,o){var i=t.call(this)||this;return i.hooks=e,i.method=n,i.url=o,i}return zt(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},ie.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(ie.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(z);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(Dt||(Dt={}));var qt=Dt,Bt=1;function Jt(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+Bt++}function Wt(t){return Math.floor(Math.random()*t)}var Xt=function(){function t(t,e){this.hooks=t,this.session=Wt(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},Yt={getDefaultStrategy:Ut,Transports:Y,transportConnectionInitializer:function(){this.timeline.info(this.buildTimelineMessage({transport:this.name+(this.options.useTLS?"s":"")})),this.hooks.isInitialized()?this.changeState("initialized"):this.onClose()},HTTPFactory:{createStreamingSocket:function(t){return this.createSocket(Gt,t)},createPollingSocket:function(t){return this.createSocket(Qt,t)},createSocket:function(t,e){return new Xt(t,e)},createXHR:function(t,e){return this.createRequest(Vt,t,e)},createRequest:function(t,e,n){return new Ft(t,e,n)}},setup:function(t){t.ready()},getLocalStorage:function(){},getClientFeatures:function(){return O(L({ws:Y.ws},(function(t){return t.isSupported({})})))},getProtocol:function(){return"http:"},isXHRSupported:function(){return!0},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);throw"Cross-origin HTTP requests are not supported"},createXHR:function(){return new(this.getXHRAPI())},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},addUnloadListener:function(t){},removeUnloadListener:function(t){}},$t=n(0),Kt=n.n($t),Zt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();function te(t){return"none"!==t.type.toLowerCase()}var ee,ne=new(function(t){function e(){var e=t.call(this)||this;return e.online=!0,Kt.a.fetch().then((function(t){e.online=te(t)})),Kt.a.addEventListener((function(t){var n=te(t);e.online!==n&&(e.online=n,e.online?e.emit("online"):e.emit("offline"))})),e}return Zt(e,t),e.prototype.isOnline=function(){return this.online},e}(z)),oe=function(t,e,n){var o,i=this;for(var r in(o=ie.createXHR()).open("POST",i.options.authEndpoint,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),this.authOptions.headers)o.setRequestHeader(r,this.authOptions.headers[r]);return o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status){var t,e=!1;try{t=JSON.parse(o.responseText),e=!0}catch(t){n(!0,"JSON returned from auth endpoint was invalid, yet status code was 200. Data was: "+o.responseText)}e&&n(!1,t)}else{var r=ft.buildLogSuffix("authenticationEndpoint");F.error("Unable to retrieve auth string from auth endpoint - received status "+o.status+" from "+i.options.authEndpoint+". Clients must be authenticated to join private or presence channels. "+r),n(!0,o.status)}},o.send(this.composeQuery(e)),o},ie={getDefaultStrategy:Yt.getDefaultStrategy,Transports:Yt.Transports,setup:Yt.setup,getProtocol:Yt.getProtocol,isXHRSupported:Yt.isXHRSupported,getLocalStorage:Yt.getLocalStorage,createXHR:Yt.createXHR,createWebSocket:Yt.createWebSocket,addUnloadListener:Yt.addUnloadListener,removeUnloadListener:Yt.removeUnloadListener,transportConnectionInitializer:Yt.transportConnectionInitializer,createSocketRequest:Yt.createSocketRequest,HTTPFactory:Yt.HTTPFactory,TimelineTransport:{name:"xhr",getAgent:function(t,e){return function(n,o){var i="http"+(e?"s":"")+"://"+(t.host||t.options.host)+t.options.path;i+="/2?"+A(n);var r=ie.createXHR();r.open("GET",i,!0),r.onreadystatechange=function(){if(4===r.readyState){var e=r.status,n=r.responseText;if(200!==e)return void F.debug("TimelineSender Error: received "+e+" from stats.pusher.com");try{var o=JSON.parse(n).host}catch(t){F.debug("TimelineSenderError: invalid response "+n)}o&&(t.host=o)}},r.send()}}},getAuthorizers:function(){return{ajax:oe}},getWebSocketAPI:function(){return WebSocket},getXHRAPI:function(){return XMLHttpRequest},getNetwork:function(){return ne}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(ee||(ee={}));var re=ee,se=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(_({},e,{timestamp:m.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(re.ERROR,t)},t.prototype.info=function(t){this.log(re.INFO,t)},t.prototype.debug=function(t){this.log(re.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,o=_({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(o,(function(t,o){t||n.sent++,e&&e(t,o)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),ce=function(){function t(t,e,n,o){this.name=t,this.priority=e,this.transport=n,this.options=o||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return ae(new pt,e);if(this.priority>>6)+o(128|63&e):o(224|e>>>12&15)+o(128|e>>>6&63)+o(128|63&e)},h=function(t){return t.replace(/[^\x00-\x7F]/g,u)},p=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[i.charAt(n>>>18),i.charAt(n>>>12&63),e>=2?"=":i.charAt(n>>>6&63),e>=1?"=":i.charAt(63&n)].join("")},l=global.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,p)},f=function(){function t(t,e,n,o){var i=this;this.clear=e,this.timer=t((function(){i.timer&&(i.timer=o(i.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),d=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function y(t){global.clearTimeout(t)}function b(t){global.clearInterval(t)}var g=function(t){function e(e,n){return t.call(this,setTimeout,y,e,(function(t){return n(),null}))||this}return d(e,t),e}(f),v=function(t){function e(e,n){return t.call(this,setInterval,b,e,(function(t){return n(),t}))||this}return d(e,t),e}(f),m={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new g(0,t)},method:function(t){for(var e=[],n=1;n0)for(o=0;o=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},Z=K,tt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),et=function(t){function e(e,n){var o=t.call(this)||this;return o.id=e,o.transport=n,o.activityTimeout=n.activityTimeout,o.bindListeners(),o}return tt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var o={event:t,data:e};return n&&(o.channel=n),F.debug("Event sent",o),this.send(Z.encodeMessage(o))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=Z.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(F.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){w(e,(function(e,n){t.transport.unbind(n,e)}))};w(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=Z.getCloseAction(t),n=Z.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(z),nt=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=Z.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new et(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=Z.getCloseAction(e)||"backoff",o=Z.getCloseError(e);t.finish(n,{error:o})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(_({transport:this.transport,action:t},e))},t}(),ot=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===ie.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){t.authorizers=t.authorizers||ie.getAuthorizers(),t.authorizers[this.type].call(this,ie,e,n)},t}(),it=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(ie.TimelineTransport.getAgent(this,t),e)},t}(),rt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),st=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ct=(function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}rt(e,t)}(Error),function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error)),at=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ut=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),ht=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),pt=function(t){function e(e){var n=this.constructor,o=t.call(this,e)||this;return Object.setPrototypeOf(o,n.prototype),o}return rt(e,t),e}(Error),lt={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/authenticating_users"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"}}},ft=function(t){var e,n=lt.urls[t];return n?(n.fullUrl?e=n.fullUrl:n.path&&(e=lt.baseUrl+n.path),e?"See: "+e:""):""},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),yt=function(t){function e(e,n){var o=t.call(this,(function(t,n){F.debug("No callbacks on "+e+" for "+t)}))||this;return o.name=e,o.pusher=n,o.subscribed=!1,o.subscriptionPending=!1,o.subscriptionCancelled=!1,o}return dt(e,t),e.prototype.authorize=function(t,e){return e(!1,{auth:""})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new st("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=ft("triggeringClientEvents");F.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(F.error(n),t.emit("pusher:subscription_error",n)):(n=n,t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name}))})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(z),bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bt(e,t),e.prototype.authorize=function(t,e){return Ct.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(yt),vt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;w(this.members,(function(n,o){t(e.get(o))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),_t=function(t){function e(e,n){var o=t.call(this,e,n)||this;return o.members=new vt,o}return mt(e,t),e.prototype.authorize=function(e,n){var o=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===(e=e).channel_data){var i=ft("authenticationEndpoint");return F.error("Invalid auth response for channel '"+o.name+"',expected 'channel_data' field. "+i),void n("Invalid auth response")}var r=JSON.parse(e.channel_data);o.members.setMyID(r.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,o={};t.user_id&&(o.user_id=t.user_id),this.emit(e,n,o)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var o=this.members.addMember(n);this.emit("pusher:member_added",o);break;case"pusher_internal:member_removed":var i=this.members.removeMember(n);i&&this.emit("pusher:member_removed",i)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(gt),St=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),kt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return St(e,t),e.prototype.authorize=function(e,n){var o=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var i=e.shared_secret;if(i)o.key=(void 0)(i),delete e.shared_secret,n(!1,e);else{var r="No shared_secret key in auth payload for encrypted channel: "+o.name;n(!0,r)}}}))},e.prototype.trigger=function(t,e){throw new ut("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,o=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,o):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var o=(void 0)(e.ciphertext);if(o.length<(void 0).overheadLength)F.error("Expected encrypted event ciphertext length to be "+(void 0).overheadLength+", got: "+o.length);else{var i=(void 0)(e.nonce);if(i.length<(void 0).nonceLength)F.error("Expected encrypted event nonce length to be "+(void 0).nonceLength+", got: "+i.length);else{var r=(void 0).open(o,i,this.key);if(null===r)return F.debug("Failed to decrypt an event, probably because it was encrypted with a different key. Fetching a new key from the authEndpoint..."),void this.authorize(this.pusher.connection.socket_id,(function(e,s){e?F.error("Failed to make a request to the authEndpoint: "+s+". Unable to fetch new key, so dropping encrypted event"):null!==(r=(void 0).open(o,i,n.key))?n.emitJSON(t,(void 0)(r)):F.error("Failed to decrypt event with new key. Dropping encrypted event")}));this.emitJSON(t,(void 0)(r))}}}else F.error("Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: "+e);else F.debug("Received encrypted event before key has been retrieved from the authEndpoint")},e.prototype.emitJSON=function(t,e){try{this.emit(t,JSON.parse(e))}catch(n){this.emit(t,e)}return this},e}(gt),wt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Tt=function(t){function e(e,n){var o=t.call(this)||this;o.key=e,o.options=n||{},o.state="initialized",o.connection=null,o.usingTLS=!!n.useTLS,o.timeline=o.options.timeline,o.errorCallbacks=o.buildErrorCallbacks(),o.connectionCallbacks=o.buildConnectionCallbacks(o.errorCallbacks),o.handshakeCallbacks=o.buildHandshakeCallbacks(o.errorCallbacks);var i=ie.getNetwork();return i.bind("online",(function(){o.timeline.info({netinfo:"online"}),"connecting"!==o.state&&"unavailable"!==o.state||o.retryIn(0)})),i.bind("offline",(function(){o.timeline.info({netinfo:"offline"}),o.connection&&o.sendActivityCheck()})),o.updateStrategy(),o}return wt(e,t),e.prototype.connect=function(){this.connection||this.runner||(this.strategy.isSupported()?(this.updateState("connecting"),this.startConnecting(),this.setUnavailableTimer()):this.updateState("failed"))},e.prototype.send=function(t){return!!this.connection&&this.connection.send(t)},e.prototype.send_event=function(t,e,n){return!!this.connection&&this.connection.send_event(t,e,n)},e.prototype.disconnect=function(){this.disconnectInternally(),this.updateState("disconnected")},e.prototype.isUsingTLS=function(){return this.usingTLS},e.prototype.startConnecting=function(){var t=this,e=function(n,o){n?t.runner=t.strategy.connect(0,e):"error"===o.action?(t.emit("error",{type:"HandshakeError",error:o.error}),t.timeline.error({handshakeError:o.error})):(t.abortConnecting(),t.handshakeCallbacks[o.action](o))};this.runner=this.strategy.connect(0,e)},e.prototype.abortConnecting=function(){this.runner&&(this.runner.abort(),this.runner=null)},e.prototype.disconnectInternally=function(){(this.abortConnecting(),this.clearRetryTimer(),this.clearUnavailableTimer(),this.connection)&&this.abandonConnection().close()},e.prototype.updateStrategy=function(){this.strategy=this.options.getStrategy({key:this.key,timeline:this.timeline,useTLS:this.usingTLS})},e.prototype.retryIn=function(t){var e=this;this.timeline.info({action:"retry",delay:t}),t>0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new g(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new g(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new g(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new g(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return _({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return _({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var o=t;"connected"===o&&(o+=" with new socket ID "+e.socket_id),F.debug("State changed",n+" -> "+o),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(z),Ot=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){if(0===t.indexOf("private-encrypted-")){throw new ut("Encrypted channels are not yet supported when using React Native builds.")}return 0===t.indexOf("private-")?Ct.createPrivateChannel(t,e):0===t.indexOf("presence-")?Ct.createPresenceChannel(t,e):Ct.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return w(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){w(this.channels,(function(t){t.disconnect()}))},t}();var Ct={createChannels:function(){return new Ot},createConnectionManager:function(t,e){return new Tt(t,e)},createChannel:function(t,e){return new yt(t,e)},createPrivateChannel:function(t,e){return new gt(t,e)},createPresenceChannel:function(t,e){return new _t(t,e)},createEncryptedChannel:function(t,e){return new kt(t,e)},createTimelineSender:function(t,e){return new it(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new ot(t,e)},createHandshake:function(t,e){return new nt(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new $(t,e,n)}},Pt=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Ct.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),Et=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return L(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,o=this.strategies,i=0,r=this.timeout,s=null,c=function(a,u){u?e(null,u):(i+=1,n.loop&&(i%=o.length),i0&&(i=new g(n.timeout,(function(){r.abort(),o(!0)}))),r=t.connect(e,(function(t,e){t&&i&&i.isRunning()&&!n.failFast||(i&&i.ensureAborted(),o(t,e))})),{abort:function(){i&&i.ensureAborted(),r.abort()},forceMinPriority:function(t){r.forceMinPriority(t)}}},t}(),Lt=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return L(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var o=C(t,(function(t,o,i,r){return t.connect(e,n(o,r))}));return{abort:function(){O(o,At)},forceMinPriority:function(t){O(o,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(o,i){n[t].error=o,o?function(t){return function(t,e){for(var n=0;n=m.now()){var r=this.transports[o.transport];r&&(this.timeline.info({cached:!0,transport:o.transport,latency:o.latency}),i.push(new Et([r],{timeout:2*o.latency+1e3,failFast:!0})))}var s=m.now(),c=i.pop().connect(t,(function o(r,a){r?(jt(n),i.length>0?(s=m.now(),c=i.pop().connect(t,o)):e(r)):(!function(t,e,n){var o=ie.getLocalStorage();if(o)try{o[Rt(t)]=R({timestamp:m.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,m.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function Rt(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function jt(t){var e=ie.getLocalStorage();if(e)try{delete e[Rt(t)]}catch(t){}}var It=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,o=this.strategy,i=new g(this.options.delay,(function(){n=o.connect(t,e)}));return{abort:function(){i.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),Nt=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),Mt=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,o){o&&n.abort(),e(t,o)}));return n},t}();function Ht(t){return function(){return t.isSupported()}}var Dt,Ut=function(t,e){var n={};function o(o,i,r,s,c){var a=e(t,o,i,r,s,c);return n[o]=a,a}var i,r={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=_({},r,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Pt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Pt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),p=o("ws","ws",3,r,u),l=o("wss","ws",3,s,u),f=o("xhr_streaming","xhr_streaming",1,c,h),d=o("xhr_polling","xhr_polling",1,c),y=new Et([p],a),b=new Et([l],a),g=new Et([f],a),v=new Et([d],a),m=new Et([new Nt(Ht(g),new Lt([g,new It(v,{delay:4e3})]),v)],a);return i=t.useTLS?new Lt([y,new It(m,{delay:2e3})]):new Lt([y,new It(b,{delay:2e3}),new It(m,{delay:5e3})]),new xt(new Mt(new Nt(Ht(p),i,m)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},zt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}(),Ft=function(t){function e(e,n,o){var i=t.call(this)||this;return i.hooks=e,i.method=n,i.url=o,i}return zt(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},ie.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(ie.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(z);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(Dt||(Dt={}));var qt=Dt,Bt=1;function Jt(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+Bt++}function Wt(t){return Math.floor(Math.random()*t)}var Xt=function(){function t(t,e){this.hooks=t,this.session=Wt(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},Yt={getDefaultStrategy:Ut,Transports:Y,transportConnectionInitializer:function(){this.timeline.info(this.buildTimelineMessage({transport:this.name+(this.options.useTLS?"s":"")})),this.hooks.isInitialized()?this.changeState("initialized"):this.onClose()},HTTPFactory:{createStreamingSocket:function(t){return this.createSocket(Gt,t)},createPollingSocket:function(t){return this.createSocket(Qt,t)},createSocket:function(t,e){return new Xt(t,e)},createXHR:function(t,e){return this.createRequest(Vt,t,e)},createRequest:function(t,e,n){return new Ft(t,e,n)}},setup:function(t){t.ready()},getLocalStorage:function(){},getClientFeatures:function(){return T(E({ws:Y.ws},(function(t){return t.isSupported({})})))},getProtocol:function(){return"http:"},isXHRSupported:function(){return!0},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);throw"Cross-origin HTTP requests are not supported"},createXHR:function(){return new(this.getXHRAPI())},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},addUnloadListener:function(t){},removeUnloadListener:function(t){}},$t=n(0),Kt=n.n($t),Zt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function o(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(o.prototype=n.prototype,new o)}}();function te(t){return"none"!==t.type.toLowerCase()}var ee,ne=new(function(t){function e(){var e=t.call(this)||this;return e.online=!0,Kt.a.fetch().then((function(t){e.online=te(t)})),Kt.a.addEventListener((function(t){var n=te(t);e.online!==n&&(e.online=n,e.online?e.emit("online"):e.emit("offline"))})),e}return Zt(e,t),e.prototype.isOnline=function(){return this.online},e}(z)),oe=function(t,e,n){var o,i=this;for(var r in(o=ie.createXHR()).open("POST",i.options.authEndpoint,!0),o.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),this.authOptions.headers)o.setRequestHeader(r,this.authOptions.headers[r]);return o.onreadystatechange=function(){if(4===o.readyState)if(200===o.status){var t,e=!1;try{t=JSON.parse(o.responseText),e=!0}catch(t){n(!0,"JSON returned from auth endpoint was invalid, yet status code was 200. Data was: "+o.responseText)}e&&n(!1,t)}else{var r=ft("authenticationEndpoint");F.error("Unable to retrieve auth string from auth endpoint - received status "+o.status+" from "+i.options.authEndpoint+". Clients must be authenticated to join private or presence channels. "+r),n(!0,o.status)}},o.send(this.composeQuery(e)),o},ie={getDefaultStrategy:Yt.getDefaultStrategy,Transports:Yt.Transports,setup:Yt.setup,getProtocol:Yt.getProtocol,isXHRSupported:Yt.isXHRSupported,getLocalStorage:Yt.getLocalStorage,createXHR:Yt.createXHR,createWebSocket:Yt.createWebSocket,addUnloadListener:Yt.addUnloadListener,removeUnloadListener:Yt.removeUnloadListener,transportConnectionInitializer:Yt.transportConnectionInitializer,createSocketRequest:Yt.createSocketRequest,HTTPFactory:Yt.HTTPFactory,TimelineTransport:{name:"xhr",getAgent:function(t,e){return function(n,o){var i="http"+(e?"s":"")+"://"+(t.host||t.options.host)+t.options.path;i+="/2?"+x(n);var r=ie.createXHR();r.open("GET",i,!0),r.onreadystatechange=function(){if(4===r.readyState){var e=r.status,n=r.responseText;if(200!==e)return void F.debug("TimelineSender Error: received "+e+" from stats.pusher.com");try{var o=JSON.parse(n).host}catch(t){F.debug("TimelineSenderError: invalid response "+n)}o&&(t.host=o)}},r.send()}}},getAuthorizers:function(){return{ajax:oe}},getWebSocketAPI:function(){return WebSocket},getXHRAPI:function(){return XMLHttpRequest},getNetwork:function(){return ne}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(ee||(ee={}));var re=ee,se=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(_({},e,{timestamp:m.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(re.ERROR,t)},t.prototype.info=function(t){this.log(re.INFO,t)},t.prototype.debug=function(t){this.log(re.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,o=_({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(o,(function(t,o){t||n.sent++,e&&e(t,o)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),ce=function(){function t(t,e,n,o){this.name=t,this.priority=e,this.transport=n,this.options=o||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return ae(new pt,e);if(this.priority= 1002 && closeEvent.code <= 1004) { - return "backoff"; + return 'backoff'; } else { return null; } } else if (closeEvent.code === 4000) { - return "tls_only"; + return 'tls_only'; } else if (closeEvent.code < 4100) { - return "refused"; + return 'refused'; } else if (closeEvent.code < 4200) { - return "backoff"; + return 'backoff'; } else if (closeEvent.code < 4300) { - return "retry"; + return 'retry'; } else { - return "refused"; + return 'refused'; } }, getCloseError: function (closeEvent) { @@ -4001,23 +4029,26 @@ var connection_Connection = (function (_super) { logger.debug('Event recd', pusherEvent); switch (pusherEvent.event) { case 'pusher:error': - _this.emit('error', { type: 'PusherError', data: pusherEvent.data }); + _this.emit('error', { + type: 'PusherError', + data: pusherEvent.data + }); break; case 'pusher:ping': - _this.emit("ping"); + _this.emit('ping'); break; case 'pusher:pong': - _this.emit("pong"); + _this.emit('pong'); break; } _this.emit('message', pusherEvent); } }, activity: function () { - _this.emit("activity"); + _this.emit('activity'); }, error: function (error) { - _this.emit("error", { type: "WebSocketError", error: error }); + _this.emit('error', { type: 'WebSocketError', error: error }); }, closed: function (closeEvent) { unbindListeners(); @@ -4025,7 +4056,7 @@ var connection_Connection = (function (_super) { _this.handleCloseEvent(closeEvent); } _this.transport = null; - _this.emit("closed"); + _this.emit('closed'); } }; var unbindListeners = function () { @@ -4074,12 +4105,12 @@ var handshake_Handshake = (function () { result = protocol_protocol.processHandshake(m); } catch (e) { - _this.finish("error", { error: e }); + _this.finish('error', { error: e }); _this.transport.close(); return; } - if (result.action === "connected") { - _this.finish("connected", { + if (result.action === 'connected') { + _this.finish('connected', { connection: new connection_connection(result.id, _this.transport), activityTimeout: result.activityTimeout }); @@ -4091,16 +4122,16 @@ var handshake_Handshake = (function () { }; this.onClosed = function (closeEvent) { _this.unbindListeners(); - var action = protocol_protocol.getCloseAction(closeEvent) || "backoff"; + var action = protocol_protocol.getCloseAction(closeEvent) || 'backoff'; var error = protocol_protocol.getCloseError(closeEvent); _this.finish(action, { error: error }); }; - this.transport.bind("message", this.onMessage); - this.transport.bind("closed", this.onClosed); + this.transport.bind('message', this.onMessage); + this.transport.bind('closed', this.onClosed); }; Handshake.prototype.unbindListeners = function () { - this.transport.unbind("message", this.onMessage); - this.transport.unbind("closed", this.onClosed); + this.transport.unbind('message', this.onMessage); + this.transport.unbind('closed', this.onClosed); }; Handshake.prototype.finish = function (action, params) { this.callback(extend({ transport: this.transport, action: action }, params)); @@ -4115,7 +4146,7 @@ var pusher_authorizer_PusherAuthorizer = (function () { function PusherAuthorizer(channel, options) { this.channel = channel; var authTransport = options.authTransport; - if (typeof runtime.getAuthorizers()[authTransport] === "undefined") { + if (typeof runtime.getAuthorizers()[authTransport] === 'undefined') { throw "'" + authTransport + "' is not a recognized auth transport"; } this.type = authTransport; @@ -4123,16 +4154,23 @@ var pusher_authorizer_PusherAuthorizer = (function () { this.authOptions = (options || {}).auth || {}; } PusherAuthorizer.prototype.composeQuery = function (socketId) { - var query = 'socket_id=' + encodeURIComponent(socketId) + - '&channel_name=' + encodeURIComponent(this.channel.name); + var query = 'socket_id=' + + encodeURIComponent(socketId) + + '&channel_name=' + + encodeURIComponent(this.channel.name); for (var i in this.authOptions.params) { - query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]); + query += + '&' + + encodeURIComponent(i) + + '=' + + encodeURIComponent(this.authOptions.params[i]); } return query; }; PusherAuthorizer.prototype.authorize = function (socketId, callback) { - PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || runtime.getAuthorizers(); - return PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback); + PusherAuthorizer.authorizers = + PusherAuthorizer.authorizers || runtime.getAuthorizers(); + PusherAuthorizer.authorizers[this.type].call(this, runtime, socketId, callback); }; return PusherAuthorizer; }()); @@ -4279,14 +4317,14 @@ var channel_Channel = (function (_super) { return _this; } Channel.prototype.authorize = function (socketId, callback) { - return callback(false, {}); + return callback(false, { auth: '' }); }; Channel.prototype.trigger = function (event, data) { - if (event.indexOf("client-") !== 0) { + if (event.indexOf('client-') !== 0) { throw new BadEventName("Event '" + event + "' does not start with 'client-'"); } if (!this.subscribed) { - var suffix = url_store.buildLogSuffix("triggeringClientEvents"); + var suffix = url_store.buildLogSuffix('triggeringClientEvents'); logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix); } return this.pusher.send_event(event, data, this.name); @@ -4298,10 +4336,10 @@ var channel_Channel = (function (_super) { Channel.prototype.handleEvent = function (event) { var eventName = event.event; var data = event.data; - if (eventName === "pusher_internal:subscription_succeeded") { + if (eventName === 'pusher_internal:subscription_succeeded') { this.handleSubscriptionSucceededEvent(event); } - else if (eventName.indexOf("pusher_internal:") !== 0) { + else if (eventName.indexOf('pusher_internal:') !== 0) { var metadata = {}; this.emit(eventName, data, metadata); } @@ -4313,7 +4351,7 @@ var channel_Channel = (function (_super) { this.pusher.unsubscribe(this.name); } else { - this.emit("pusher:subscription_succeeded", event.data); + this.emit('pusher:subscription_succeeded', event.data); } }; Channel.prototype.subscribe = function () { @@ -4329,6 +4367,7 @@ var channel_Channel = (function (_super) { _this.emit('pusher:subscription_error', data); } else { + data = data; _this.pusher.send_event('pusher:subscribe', { auth: data.auth, channel_data: data.channel_data, @@ -4467,11 +4506,12 @@ var presence_channel_PresenceChannel = (function (_super) { var _this = this; _super.prototype.authorize.call(this, socketId, function (error, authData) { if (!error) { + authData = authData; if (authData.channel_data === undefined) { - var suffix = url_store.buildLogSuffix("authenticationEndpoint"); + var suffix = url_store.buildLogSuffix('authenticationEndpoint'); logger.error("Invalid auth response for channel '" + _this.name + "'," + ("expected 'channel_data' field. " + suffix)); - callback("Invalid auth response"); + callback('Invalid auth response'); return; } var channelData = JSON.parse(authData.channel_data); @@ -4482,7 +4522,7 @@ var presence_channel_PresenceChannel = (function (_super) { }; PresenceChannel.prototype.handleEvent = function (event) { var eventName = event.event; - if (eventName.indexOf("pusher_internal:") === 0) { + if (eventName.indexOf('pusher_internal:') === 0) { this.handleInternalEvent(event); } else { @@ -4498,14 +4538,14 @@ var presence_channel_PresenceChannel = (function (_super) { var eventName = event.event; var data = event.data; switch (eventName) { - case "pusher_internal:subscription_succeeded": + case 'pusher_internal:subscription_succeeded': this.handleSubscriptionSucceededEvent(event); break; - case "pusher_internal:member_added": + case 'pusher_internal:member_added': var addedMember = this.members.addMember(data); this.emit('pusher:member_added', addedMember); break; - case "pusher_internal:member_removed": + case 'pusher_internal:member_removed': var removedMember = this.members.removeMember(data); if (removedMember) { this.emit('pusher:member_removed', removedMember); @@ -4521,7 +4561,7 @@ var presence_channel_PresenceChannel = (function (_super) { } else { this.members.onSubscription(event.data); - this.emit("pusher:subscription_succeeded", this.members); + this.emit('pusher:subscription_succeeded', this.members); } }; PresenceChannel.prototype.disconnect = function () { @@ -4571,14 +4611,14 @@ var encrypted_channel_EncryptedChannel = (function (_super) { callback(true, authData); return; } - var sharedSecret = authData["shared_secret"]; + var sharedSecret = authData['shared_secret']; if (!sharedSecret) { var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name; callback(true, errorMsg); return; } _this.key = Object(nacl_util["decodeBase64"])(sharedSecret); - delete authData["shared_secret"]; + delete authData['shared_secret']; callback(false, authData); }); }; @@ -4588,7 +4628,8 @@ var encrypted_channel_EncryptedChannel = (function (_super) { EncryptedChannel.prototype.handleEvent = function (event) { var eventName = event.event; var data = event.data; - if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) { + if (eventName.indexOf('pusher_internal:') === 0 || + eventName.indexOf('pusher:') === 0) { _super.prototype.handleEvent.call(this, event); return; } @@ -4601,7 +4642,8 @@ var encrypted_channel_EncryptedChannel = (function (_super) { return; } if (!data.ciphertext || !data.nonce) { - logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data); + logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + + data); return; } var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext); @@ -4672,7 +4714,7 @@ var connection_manager_ConnectionManager = (function (_super) { var _this = _super.call(this) || this; _this.key = key; _this.options = options || {}; - _this.state = "initialized"; + _this.state = 'initialized'; _this.connection = null; _this.usingTLS = !!options.useTLS; _this.timeline = _this.options.timeline; @@ -4680,14 +4722,14 @@ var connection_manager_ConnectionManager = (function (_super) { _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks); _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks); var Network = runtime.getNetwork(); - Network.bind("online", function () { - _this.timeline.info({ netinfo: "online" }); - if (_this.state === "connecting" || _this.state === "unavailable") { + Network.bind('online', function () { + _this.timeline.info({ netinfo: 'online' }); + if (_this.state === 'connecting' || _this.state === 'unavailable') { _this.retryIn(0); } }); - Network.bind("offline", function () { - _this.timeline.info({ netinfo: "offline" }); + Network.bind('offline', function () { + _this.timeline.info({ netinfo: 'offline' }); if (_this.connection) { _this.sendActivityCheck(); } @@ -4700,14 +4742,13 @@ var connection_manager_ConnectionManager = (function (_super) { return; } if (!this.strategy.isSupported()) { - this.updateState("failed"); + this.updateState('failed'); return; } - this.updateState("connecting"); + this.updateState('connecting'); this.startConnecting(); this.setUnavailableTimer(); }; - ; ConnectionManager.prototype.send = function (data) { if (this.connection) { return this.connection.send(data); @@ -4716,7 +4757,6 @@ var connection_manager_ConnectionManager = (function (_super) { return false; } }; - ; ConnectionManager.prototype.send_event = function (name, data, channel) { if (this.connection) { return this.connection.send_event(name, data, channel); @@ -4725,16 +4765,13 @@ var connection_manager_ConnectionManager = (function (_super) { return false; } }; - ; ConnectionManager.prototype.disconnect = function () { this.disconnectInternally(); - this.updateState("disconnected"); + this.updateState('disconnected'); }; - ; ConnectionManager.prototype.isUsingTLS = function () { return this.usingTLS; }; - ; ConnectionManager.prototype.startConnecting = function () { var _this = this; var callback = function (error, handshake) { @@ -4742,8 +4779,11 @@ var connection_manager_ConnectionManager = (function (_super) { _this.runner = _this.strategy.connect(0, callback); } else { - if (handshake.action === "error") { - _this.emit("error", { type: "HandshakeError", error: handshake.error }); + if (handshake.action === 'error') { + _this.emit('error', { + type: 'HandshakeError', + error: handshake.error + }); _this.timeline.error({ handshakeError: handshake.error }); } else { @@ -4754,14 +4794,12 @@ var connection_manager_ConnectionManager = (function (_super) { }; this.runner = this.strategy.connect(0, callback); }; - ; ConnectionManager.prototype.abortConnecting = function () { if (this.runner) { this.runner.abort(); this.runner = null; } }; - ; ConnectionManager.prototype.disconnectInternally = function () { this.abortConnecting(); this.clearRetryTimer(); @@ -4771,7 +4809,6 @@ var connection_manager_ConnectionManager = (function (_super) { connection.close(); } }; - ; ConnectionManager.prototype.updateStrategy = function () { this.strategy = this.options.getStrategy({ key: this.key, @@ -4779,39 +4816,34 @@ var connection_manager_ConnectionManager = (function (_super) { useTLS: this.usingTLS }); }; - ; ConnectionManager.prototype.retryIn = function (delay) { var _this = this; - this.timeline.info({ action: "retry", delay: delay }); + this.timeline.info({ action: 'retry', delay: delay }); if (delay > 0) { - this.emit("connecting_in", Math.round(delay / 1000)); + this.emit('connecting_in', Math.round(delay / 1000)); } this.retryTimer = new OneOffTimer(delay || 0, function () { _this.disconnectInternally(); _this.connect(); }); }; - ; ConnectionManager.prototype.clearRetryTimer = function () { if (this.retryTimer) { this.retryTimer.ensureAborted(); this.retryTimer = null; } }; - ; ConnectionManager.prototype.setUnavailableTimer = function () { var _this = this; this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () { - _this.updateState("unavailable"); + _this.updateState('unavailable'); }); }; - ; ConnectionManager.prototype.clearUnavailableTimer = function () { if (this.unavailableTimer) { this.unavailableTimer.ensureAborted(); } }; - ; ConnectionManager.prototype.sendActivityCheck = function () { var _this = this; this.stopActivityCheck(); @@ -4821,7 +4853,6 @@ var connection_manager_ConnectionManager = (function (_super) { _this.retryIn(0); }); }; - ; ConnectionManager.prototype.resetActivityCheck = function () { var _this = this; this.stopActivityCheck(); @@ -4831,13 +4862,11 @@ var connection_manager_ConnectionManager = (function (_super) { }); } }; - ; ConnectionManager.prototype.stopActivityCheck = function () { if (this.activityTimer) { this.activityTimer.ensureAborted(); } }; - ; ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) { var _this = this; return extend({}, errorCallbacks, { @@ -4852,7 +4881,7 @@ var connection_manager_ConnectionManager = (function (_super) { _this.resetActivityCheck(); }, error: function (error) { - _this.emit("error", { type: "WebSocketError", error: error }); + _this.emit('error', { type: 'WebSocketError', error: error }); }, closed: function () { _this.abandonConnection(); @@ -4862,7 +4891,6 @@ var connection_manager_ConnectionManager = (function (_super) { } }); }; - ; ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) { var _this = this; return extend({}, errorCallbacks, { @@ -4871,17 +4899,16 @@ var connection_manager_ConnectionManager = (function (_super) { _this.clearUnavailableTimer(); _this.setConnection(handshake.connection); _this.socket_id = _this.connection.id; - _this.updateState("connected", { socket_id: _this.socket_id }); + _this.updateState('connected', { socket_id: _this.socket_id }); } }); }; - ; ConnectionManager.prototype.buildErrorCallbacks = function () { var _this = this; var withErrorEmitted = function (callback) { return function (result) { if (result.error) { - _this.emit("error", { type: "WebSocketError", error: result.error }); + _this.emit('error', { type: 'WebSocketError', error: result.error }); } callback(result); }; @@ -4903,7 +4930,6 @@ var connection_manager_ConnectionManager = (function (_super) { }) }; }; - ; ConnectionManager.prototype.setConnection = function (connection) { this.connection = connection; for (var event in this.connectionCallbacks) { @@ -4911,7 +4937,6 @@ var connection_manager_ConnectionManager = (function (_super) { } this.resetActivityCheck(); }; - ; ConnectionManager.prototype.abandonConnection = function () { if (!this.connection) { return; @@ -4929,8 +4954,8 @@ var connection_manager_ConnectionManager = (function (_super) { this.state = newState; if (previousState !== newState) { var newStateDescription = newState; - if (newStateDescription === "connected") { - newStateDescription += " with new socket ID " + data.socket_id; + if (newStateDescription === 'connected') { + newStateDescription += ' with new socket ID ' + data.socket_id; } logger.debug('State changed', previousState + ' -> ' + newStateDescription); this.timeline.info({ state: newState, params: data }); @@ -4939,7 +4964,7 @@ var connection_manager_ConnectionManager = (function (_super) { } }; ConnectionManager.prototype.shouldRetry = function () { - return this.state === "connecting" || this.state === "connected"; + return this.state === 'connecting' || this.state === 'connected'; }; return ConnectionManager; }(dispatcher)); @@ -5078,7 +5103,7 @@ var sequential_strategy_SequentialStrategy = (function () { this.timeoutLimit = options.timeoutLimit; } SequentialStrategy.prototype.isSupported = function () { - return any(this.strategies, util.method("isSupported")); + return any(this.strategies, util.method('isSupported')); }; SequentialStrategy.prototype.connect = function (minPriority, callback) { var _this = this; @@ -5164,7 +5189,7 @@ var best_connected_ever_strategy_BestConnectedEverStrategy = (function () { this.strategies = strategies; } BestConnectedEverStrategy.prototype.isSupported = function () { - return any(this.strategies, util.method("isSupported")); + return any(this.strategies, util.method('isSupported')); }; BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) { return connect(this.strategies, minPriority, function (i, runners) { @@ -5248,7 +5273,9 @@ var cached_strategy_CachedStrategy = (function () { } } var startTimestamp = util.now(); - var runner = strategies.pop().connect(minPriority, function cb(error, handshake) { + var runner = strategies + .pop() + .connect(minPriority, function cb(error, handshake) { if (error) { flushTransportCache(usingTLS); if (strategies.length > 0) { @@ -5280,7 +5307,7 @@ var cached_strategy_CachedStrategy = (function () { }()); /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy); function getTransportCacheKey(usingTLS) { - return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS"); + return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS'); } function fetchTransportCache(usingTLS) { var storage = runtime.getLocalStorage(); @@ -5420,16 +5447,16 @@ var getDefaultStrategy = function (config, defineTransport) { return transport; } var ws_options = { - hostNonTLS: config.wsHost + ":" + config.wsPort, - hostTLS: config.wsHost + ":" + config.wssPort, + hostNonTLS: config.wsHost + ':' + config.wsPort, + hostTLS: config.wsHost + ':' + config.wssPort, httpPath: config.wsPath }; var wss_options = extend({}, ws_options, { useTLS: true }); var sockjs_options = { - hostNonTLS: config.httpHost + ":" + config.httpPort, - hostTLS: config.httpHost + ":" + config.httpsPort, + hostNonTLS: config.httpHost + ':' + config.httpPort, + hostTLS: config.httpHost + ':' + config.httpsPort, httpPath: config.httpPath }; var timeouts = { @@ -5447,23 +5474,35 @@ var getDefaultStrategy = function (config, defineTransport) { minPingDelay: 10000, maxPingDelay: config.activity_timeout }); - var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager); - var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager); - var sockjs_transport = defineTransportStrategy("sockjs", "sockjs", 1, sockjs_options); - var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, sockjs_options, streaming_manager); - var xdr_streaming_transport = defineTransportStrategy("xdr_streaming", "xdr_streaming", 1, sockjs_options, streaming_manager); - var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, sockjs_options); - var xdr_polling_transport = defineTransportStrategy("xdr_polling", "xdr_polling", 1, sockjs_options); + var ws_transport = defineTransportStrategy('ws', 'ws', 3, ws_options, ws_manager); + var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager); + var sockjs_transport = defineTransportStrategy('sockjs', 'sockjs', 1, sockjs_options); + var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, sockjs_options, streaming_manager); + var xdr_streaming_transport = defineTransportStrategy('xdr_streaming', 'xdr_streaming', 1, sockjs_options, streaming_manager); + var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, sockjs_options); + var xdr_polling_transport = defineTransportStrategy('xdr_polling', 'xdr_polling', 1, sockjs_options); var ws_loop = new sequential_strategy([ws_transport], timeouts); var wss_loop = new sequential_strategy([wss_transport], timeouts); var sockjs_loop = new sequential_strategy([sockjs_transport], timeouts); - var streaming_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport)], timeouts); - var polling_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport)], timeouts); - var http_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([streaming_loop, new delayed_strategy(polling_loop, { delay: 4000 })]), polling_loop)], timeouts); + var streaming_loop = new sequential_strategy([ + new if_strategy(testSupportsStrategy(xhr_streaming_transport), xhr_streaming_transport, xdr_streaming_transport) + ], timeouts); + var polling_loop = new sequential_strategy([ + new if_strategy(testSupportsStrategy(xhr_polling_transport), xhr_polling_transport, xdr_polling_transport) + ], timeouts); + var http_loop = new sequential_strategy([ + new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([ + streaming_loop, + new delayed_strategy(polling_loop, { delay: 4000 }) + ]), polling_loop) + ], timeouts); var http_fallback_loop = new if_strategy(testSupportsStrategy(http_loop), http_loop, sockjs_loop); var wsStrategy; if (config.useTLS) { - wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_fallback_loop, { delay: 2000 })]); + wsStrategy = new best_connected_ever_strategy([ + ws_loop, + new delayed_strategy(http_fallback_loop, { delay: 2000 }) + ]); } else { wsStrategy = new best_connected_ever_strategy([ @@ -5485,16 +5524,16 @@ var getDefaultStrategy = function (config, defineTransport) { /* harmony default export */ var transport_connection_initializer = (function () { var self = this; self.timeline.info(self.buildTimelineMessage({ - transport: self.name + (self.options.useTLS ? "s" : "") + transport: self.name + (self.options.useTLS ? 's' : '') })); if (self.hooks.isInitialized()) { - self.changeState("initialized"); + self.changeState('initialized'); } else if (self.hooks.file) { - self.changeState("initializing"); + self.changeState('initializing'); Dependencies.load(self.hooks.file, { useTLS: self.options.useTLS }, function (error, callback) { if (self.hooks.isInitialized()) { - self.changeState("initialized"); + self.changeState('initialized'); callback(true); } else { @@ -5517,11 +5556,11 @@ var http_xdomain_request_hooks = { getRequest: function (socket) { var xdr = new window.XDomainRequest(); xdr.ontimeout = function () { - socket.emit("error", new RequestTimedOut()); + socket.emit('error', new RequestTimedOut()); socket.close(); }; xdr.onerror = function (e) { - socket.emit("error", e); + socket.emit('error', e); socket.close(); }; xdr.onprogress = function () { @@ -5533,7 +5572,7 @@ var http_xdomain_request_hooks = { if (xdr.responseText && xdr.responseText.length > 0) { socket.onChunk(200, xdr.responseText); } - socket.emit("finished", 200); + socket.emit('finished', 200); socket.close(); }; return xdr; @@ -5581,7 +5620,7 @@ var http_request_HTTPRequest = (function (_super) { runtime.addUnloadListener(this.unloader); this.xhr.open(this.method, this.url, true); if (this.xhr.setRequestHeader) { - this.xhr.setRequestHeader("Content-Type", "application/json"); + this.xhr.setRequestHeader('Content-Type', 'application/json'); } this.xhr.send(payload); }; @@ -5599,19 +5638,19 @@ var http_request_HTTPRequest = (function (_super) { while (true) { var chunk = this.advanceBuffer(data); if (chunk) { - this.emit("chunk", { status: status, data: chunk }); + this.emit('chunk', { status: status, data: chunk }); } else { break; } } if (this.isBufferTooLong(data)) { - this.emit("buffer_too_long"); + this.emit('buffer_too_long'); } }; HTTPRequest.prototype.advanceBuffer = function (buffer) { var unreadData = buffer.slice(this.position); - var endOfLinePosition = unreadData.indexOf("\n"); + var endOfLinePosition = unreadData.indexOf('\n'); if (endOfLinePosition !== -1) { this.position += endOfLinePosition + 1; return unreadData.slice(0, endOfLinePosition); @@ -5644,7 +5683,7 @@ var autoIncrement = 1; var http_socket_HTTPSocket = (function () { function HTTPSocket(hooks, url) { this.hooks = hooks; - this.session = randomNumber(1000) + "/" + randomString(8); + this.session = randomNumber(1000) + '/' + randomString(8); this.location = getLocation(url); this.readyState = state.CONNECTING; this.openStream(); @@ -5661,7 +5700,7 @@ var http_socket_HTTPSocket = (function () { HTTPSocket.prototype.sendRaw = function (payload) { if (this.readyState === state.OPEN) { try { - runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload); + runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload); return true; } catch (e) { @@ -5676,7 +5715,6 @@ var http_socket_HTTPSocket = (function () { this.closeStream(); this.openStream(); }; - ; HTTPSocket.prototype.onClose = function (code, reason, wasClean) { this.closeStream(); this.readyState = state.CLOSED; @@ -5732,7 +5770,7 @@ var http_socket_HTTPSocket = (function () { } } else { - this.onClose(1006, "Server lost session", true); + this.onClose(1006, 'Server lost session', true); } }; HTTPSocket.prototype.onEvent = function (event) { @@ -5752,14 +5790,14 @@ var http_socket_HTTPSocket = (function () { }; HTTPSocket.prototype.openStream = function () { var _this = this; - this.stream = runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session))); - this.stream.bind("chunk", function (chunk) { + this.stream = runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session))); + this.stream.bind('chunk', function (chunk) { _this.onChunk(chunk); }); - this.stream.bind("finished", function (status) { + this.stream.bind('finished', function (status) { _this.hooks.onFinished(_this, status); }); - this.stream.bind("buffer_too_long", function () { + this.stream.bind('buffer_too_long', function () { _this.reconnect(); }); try { @@ -5768,7 +5806,7 @@ var http_socket_HTTPSocket = (function () { catch (error) { util.defer(function () { _this.onError(error); - _this.onClose(1006, "Could not start streaming", false); + _this.onClose(1006, 'Could not start streaming', false); }); } }; @@ -5789,11 +5827,11 @@ function getLocation(url) { }; } function getSendURL(url, session) { - return url.base + "/" + session + "/xhr_send"; + return url.base + '/' + session + '/xhr_send'; } function getUniqueURL(url) { - var separator = (url.indexOf('?') === -1) ? "?" : "&"; - return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++; + var separator = url.indexOf('?') === -1 ? '?' : '&'; + return url + separator + 't=' + +new Date() + '&n=' + autoIncrement++; } function replaceHost(url, hostname) { var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url); @@ -5814,16 +5852,16 @@ function randomString(length) { // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts var http_streaming_socket_hooks = { getReceiveURL: function (url, session) { - return url.base + "/" + session + "/xhr_streaming" + url.queryString; + return url.base + '/' + session + '/xhr_streaming' + url.queryString; }, onHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, sendHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, onFinished: function (socket, status) { - socket.onClose(1006, "Connection interrupted (" + status + ")", false); + socket.onClose(1006, 'Connection interrupted (' + status + ')', false); } }; /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks); @@ -5831,19 +5869,19 @@ var http_streaming_socket_hooks = { // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts var http_polling_socket_hooks = { getReceiveURL: function (url, session) { - return url.base + "/" + session + "/xhr" + url.queryString; + return url.base + '/' + session + '/xhr' + url.queryString; }, onHeartbeat: function () { }, sendHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, onFinished: function (socket, status) { if (status === 200) { socket.reconnect(); } else { - socket.onClose(1006, "Connection interrupted (" + status + ")", false); + socket.onClose(1006, 'Connection interrupted (' + status + ')', false); } } }; @@ -5866,7 +5904,7 @@ var http_xhr_request_hooks = { if (xhr.responseText && xhr.responseText.length > 0) { socket.onChunk(xhr.status, xhr.responseText); } - socket.emit("finished", xhr.status); + socket.emit('finished', xhr.status); socket.close(); break; } @@ -5949,7 +5987,7 @@ var Runtime = { _this.onDocumentBody(PusherClass.ready); }; if (!window.JSON) { - Dependencies.load("json2", {}, initializeOnDocumentBody); + Dependencies.load('json2', {}, initializeOnDocumentBody); } else { initializeOnDocumentBody(); @@ -6002,7 +6040,7 @@ var Runtime = { return new Constructor(); }, createMicrosoftXHR: function () { - return new ActiveXObject("Microsoft.XMLHTTP"); + return new ActiveXObject('Microsoft.XMLHTTP'); }, getNetwork: function () { return net_info_Network; @@ -6015,36 +6053,36 @@ var Runtime = { if (this.isXHRSupported()) { return this.HTTPFactory.createXHR(method, url); } - else if (this.isXDRSupported(url.indexOf("https:") === 0)) { + else if (this.isXDRSupported(url.indexOf('https:') === 0)) { return this.HTTPFactory.createXDR(method, url); } else { - throw "Cross-origin HTTP requests are not supported"; + throw 'Cross-origin HTTP requests are not supported'; } }, isXHRSupported: function () { var Constructor = this.getXHRAPI(); - return Boolean(Constructor) && (new Constructor()).withCredentials !== undefined; + return (Boolean(Constructor) && new Constructor().withCredentials !== undefined); }, isXDRSupported: function (useTLS) { - var protocol = useTLS ? "https:" : "http:"; + var protocol = useTLS ? 'https:' : 'http:'; var documentProtocol = this.getProtocol(); - return Boolean((window['XDomainRequest'])) && documentProtocol === protocol; + return (Boolean(window['XDomainRequest']) && documentProtocol === protocol); }, addUnloadListener: function (listener) { if (window.addEventListener !== undefined) { - window.addEventListener("unload", listener, false); + window.addEventListener('unload', listener, false); } else if (window.attachEvent !== undefined) { - window.attachEvent("onunload", listener); + window.attachEvent('onunload', listener); } }, removeUnloadListener: function (listener) { if (window.addEventListener !== undefined) { - window.removeEventListener("unload", listener, false); + window.removeEventListener('unload', listener, false); } else if (window.detachEvent !== undefined) { - window.detachEvent("onunload", listener); + window.detachEvent('onunload', listener); } } }; @@ -6098,7 +6136,7 @@ var timeline_Timeline = (function () { session: this.session, bundle: this.sent + 1, key: this.key, - lib: "js", + lib: 'js', version: this.options.version, cluster: this.options.cluster, features: this.options.features, @@ -6152,7 +6190,7 @@ var transport_strategy_TransportStrategy = (function () { var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options); var handshake = null; var onInitialized = function () { - transport.unbind("initialized", onInitialized); + transport.unbind('initialized', onInitialized); transport.connect(); }; var onOpen = function () { @@ -6173,15 +6211,15 @@ var transport_strategy_TransportStrategy = (function () { callback(new TransportClosed(serializedTransport)); }; var unbindListeners = function () { - transport.unbind("initialized", onInitialized); - transport.unbind("open", onOpen); - transport.unbind("error", onError); - transport.unbind("closed", onClosed); + transport.unbind('initialized', onInitialized); + transport.unbind('open', onOpen); + transport.unbind('error', onError); + transport.unbind('closed', onClosed); }; - transport.bind("initialized", onInitialized); - transport.bind("open", onOpen); - transport.bind("error", onError); - transport.bind("closed", onClosed); + transport.bind('initialized', onInitialized); + transport.bind('open', onOpen); + transport.bind('error', onError); + transport.bind('closed', onClosed); transport.initialize(); return { abort: function () { @@ -6320,6 +6358,12 @@ var pusher_Pusher = (function () { var suffix = url_store.buildLogSuffix('javascriptQuickStart'); logger.warn("You should always specify a cluster when connecting. " + suffix); } + if ('disableStats' in options) { + logger.warn('The disableStats option is deprecated in favor of enableStats'); + if (!('enableStats' in options)) { + options.enableStats = !options.disableStats; + } + } this.key = app_key; this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options); this.channels = factory.createChannels(); @@ -6333,7 +6377,7 @@ var pusher_Pusher = (function () { level: timeline_level.INFO, version: defaults.VERSION }); - if (!this.config.disableStats) { + if (this.config.enableStats) { this.timelineSender = factory.createTimelineSender(this.timeline, { host: this.config.statsHost, path: '/timeline/v2/' + runtime.TimelineTransport.name diff --git a/dist/web/pusher.min.js b/dist/web/pusher.min.js index 89d596c8e..0b900b4f7 100644 --- a/dist/web/pusher.min.js +++ b/dist/web/pusher.min.js @@ -1,8 +1,8 @@ /*! - * Pusher JavaScript Library v5.0.3 + * Pusher JavaScript Library v5.1.0 * https://pusher.com/ * * Copyright 2017, Pusher * Released under the MIT licence. */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Pusher=e():t.Pusher=e()}(window,(function(){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){!function(t){"use strict";var e=function(t){var e,n=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n,t[e+4]=r>>24&255,t[e+5]=r>>16&255,t[e+6]=r>>8&255,t[e+7]=255&r}function y(t,e,n,r,o){var i,s=0;for(i=0;i>>8)-1}function v(t,e,n,r){return y(t,e,n,r,16)}function g(t,e,n,r){return y(t,e,n,r,32)}function b(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,w=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,S=s,k=c,T=a,O=u,C=h,A=p,E=f,P=l,x=d,L=y,R=v,U=g,M=b,j=m,I=w,N=0;N<20;N+=2)_^=(o=(U^=(o=(P^=(o=(O^=(o=_+U|0)<<7|o>>>25)+_|0)<<9|o>>>23)+O|0)<<13|o>>>19)+P|0)<<18|o>>>14,C^=(o=(S^=(o=(M^=(o=(x^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+M|0)<<18|o>>>14,L^=(o=(A^=(o=(k^=(o=(j^=(o=L+A|0)<<7|o>>>25)+L|0)<<9|o>>>23)+j|0)<<13|o>>>19)+k|0)<<18|o>>>14,I^=(o=(R^=(o=(E^=(o=(T^=(o=I+R|0)<<7|o>>>25)+I|0)<<9|o>>>23)+T|0)<<13|o>>>19)+E|0)<<18|o>>>14,_^=(o=(T^=(o=(k^=(o=(S^=(o=_+T|0)<<7|o>>>25)+_|0)<<9|o>>>23)+S|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(O^=(o=(E^=(o=(A^=(o=C+O|0)<<7|o>>>25)+C|0)<<9|o>>>23)+A|0)<<13|o>>>19)+E|0)<<18|o>>>14,L^=(o=(x^=(o=(P^=(o=(R^=(o=L+x|0)<<7|o>>>25)+L|0)<<9|o>>>23)+R|0)<<13|o>>>19)+P|0)<<18|o>>>14,I^=(o=(j^=(o=(M^=(o=(U^=(o=I+j|0)<<7|o>>>25)+I|0)<<9|o>>>23)+U|0)<<13|o>>>19)+M|0)<<18|o>>>14;_=_+i|0,S=S+s|0,k=k+c|0,T=T+a|0,O=O+u|0,C=C+h|0,A=A+p|0,E=E+f|0,P=P+l|0,x=x+d|0,L=L+y|0,R=R+v|0,U=U+g|0,M=M+b|0,j=j+m|0,I=I+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=S>>>0&255,t[5]=S>>>8&255,t[6]=S>>>16&255,t[7]=S>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=T>>>0&255,t[13]=T>>>8&255,t[14]=T>>>16&255,t[15]=T>>>24&255,t[16]=O>>>0&255,t[17]=O>>>8&255,t[18]=O>>>16&255,t[19]=O>>>24&255,t[20]=C>>>0&255,t[21]=C>>>8&255,t[22]=C>>>16&255,t[23]=C>>>24&255,t[24]=A>>>0&255,t[25]=A>>>8&255,t[26]=A>>>16&255,t[27]=A>>>24&255,t[28]=E>>>0&255,t[29]=E>>>8&255,t[30]=E>>>16&255,t[31]=E>>>24&255,t[32]=P>>>0&255,t[33]=P>>>8&255,t[34]=P>>>16&255,t[35]=P>>>24&255,t[36]=x>>>0&255,t[37]=x>>>8&255,t[38]=x>>>16&255,t[39]=x>>>24&255,t[40]=L>>>0&255,t[41]=L>>>8&255,t[42]=L>>>16&255,t[43]=L>>>24&255,t[44]=R>>>0&255,t[45]=R>>>8&255,t[46]=R>>>16&255,t[47]=R>>>24&255,t[48]=U>>>0&255,t[49]=U>>>8&255,t[50]=U>>>16&255,t[51]=U>>>24&255,t[52]=M>>>0&255,t[53]=M>>>8&255,t[54]=M>>>16&255,t[55]=M>>>24&255,t[56]=j>>>0&255,t[57]=j>>>8&255,t[58]=j>>>16&255,t[59]=j>>>24&255,t[60]=I>>>0&255,t[61]=I>>>8&255,t[62]=I>>>16&255,t[63]=I>>>24&255}(t,e,n,r)}function m(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,w=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=0;_<20;_+=2)i^=(o=(g^=(o=(l^=(o=(u^=(o=i+g|0)<<7|o>>>25)+i|0)<<9|o>>>23)+u|0)<<13|o>>>19)+l|0)<<18|o>>>14,h^=(o=(s^=(o=(b^=(o=(d^=(o=h+s|0)<<7|o>>>25)+h|0)<<9|o>>>23)+d|0)<<13|o>>>19)+b|0)<<18|o>>>14,y^=(o=(p^=(o=(c^=(o=(m^=(o=y+p|0)<<7|o>>>25)+y|0)<<9|o>>>23)+m|0)<<13|o>>>19)+c|0)<<18|o>>>14,w^=(o=(v^=(o=(f^=(o=(a^=(o=w+v|0)<<7|o>>>25)+w|0)<<9|o>>>23)+a|0)<<13|o>>>19)+f|0)<<18|o>>>14,i^=(o=(a^=(o=(c^=(o=(s^=(o=i+a|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+c|0)<<18|o>>>14,h^=(o=(u^=(o=(f^=(o=(p^=(o=h+u|0)<<7|o>>>25)+h|0)<<9|o>>>23)+p|0)<<13|o>>>19)+f|0)<<18|o>>>14,y^=(o=(d^=(o=(l^=(o=(v^=(o=y+d|0)<<7|o>>>25)+y|0)<<9|o>>>23)+v|0)<<13|o>>>19)+l|0)<<18|o>>>14,w^=(o=(m^=(o=(b^=(o=(g^=(o=w+m|0)<<7|o>>>25)+w|0)<<9|o>>>23)+g|0)<<13|o>>>19)+b|0)<<18|o>>>14;t[0]=i>>>0&255,t[1]=i>>>8&255,t[2]=i>>>16&255,t[3]=i>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=p>>>0&255,t[17]=p>>>8&255,t[18]=p>>>16&255,t[19]=p>>>24&255,t[20]=f>>>0&255,t[21]=f>>>8&255,t[22]=f>>>16&255,t[23]=f>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255}(t,e,n,r)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,n,r,o,i,s){var c,a,u=new Uint8Array(16),h=new Uint8Array(64);for(a=0;a<16;a++)u[a]=0;for(a=0;a<8;a++)u[a]=i[a];for(;o>=64;){for(b(h,u,s,w),a=0;a<64;a++)t[e+a]=n[r+a]^h[a];for(c=1,a=8;a<16;a++)c=c+(255&u[a])|0,u[a]=255&c,c>>>=8;o-=64,e+=64,r+=64}if(o>0)for(b(h,u,s,w),a=0;a=64;){for(b(a,c,o,w),s=0;s<64;s++)t[e+s]=a[s];for(i=1,s=8;s<16;s++)i=i+(255&c[s])|0,c[s]=255&i,i>>>=8;n-=64,e+=64}if(n>0)for(b(a,c,o,w),s=0;s>>13|n<<3),r=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&t[8]|(255&t[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(i>>>14|s<<2),c=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|c<<5),a=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(c>>>8|a<<8),this.r[9]=a>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function C(t,e,n,r,o,i){var s=new O(i);return s.update(n,r,o),s.finish(t,e),0}function A(t,e,n,r,o,i){var s=new Uint8Array(16);return C(s,0,n,r,o,i),v(t,e,s,0)}function E(t,e,n,r,o){var i;if(n<32)return-1;for(T(t,0,e,0,n,r,o),C(t,16,t,32,n-32,t),i=0;i<16;i++)t[i]=0;return 0}function P(t,e,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==A(e,16,e,32,n-32,s))return-1;for(T(t,0,e,0,n,r,o),i=0;i<32;i++)t[i]=0;return 0}function x(t,e){var n;for(n=0;n<16;n++)t[n]=0|e[n]}function L(t){var e,n,r=1;for(e=0;e<16;e++)n=t[e]+r+65535,r=Math.floor(n/65536),t[e]=n-65536*r;t[0]+=r-1+37*(r-1)}function R(t,e,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(t[i]^e[i]),t[i]^=r,e[i]^=r}function U(t,n){var r,o,i,s=e(),c=e();for(r=0;r<16;r++)c[r]=n[r];for(L(c),L(c),L(c),o=0;o<2;o++){for(s[0]=c[0]-65517,r=1;r<15;r++)s[r]=c[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=c[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,R(c,s,1-i)}for(r=0;r<16;r++)t[2*r]=255&c[r],t[2*r+1]=c[r]>>8}function M(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return U(n,t),U(r,e),g(n,0,r,0)}function j(t){var e=new Uint8Array(32);return U(e,t),1&e[0]}function I(t,e){var n;for(n=0;n<16;n++)t[n]=e[2*n]+(e[2*n+1]<<8);t[15]&=32767}function N(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]+n[r]}function B(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]-n[r]}function D(t,e,n){var r,o,i=0,s=0,c=0,a=0,u=0,h=0,p=0,f=0,l=0,d=0,y=0,v=0,g=0,b=0,m=0,w=0,_=0,S=0,k=0,T=0,O=0,C=0,A=0,E=0,P=0,x=0,L=0,R=0,U=0,M=0,j=0,I=n[0],N=n[1],B=n[2],D=n[3],z=n[4],H=n[5],q=n[6],F=n[7],X=n[8],J=n[9],Y=n[10],K=n[11],W=n[12],G=n[13],Z=n[14],V=n[15];i+=(r=e[0])*I,s+=r*N,c+=r*B,a+=r*D,u+=r*z,h+=r*H,p+=r*q,f+=r*F,l+=r*X,d+=r*J,y+=r*Y,v+=r*K,g+=r*W,b+=r*G,m+=r*Z,w+=r*V,s+=(r=e[1])*I,c+=r*N,a+=r*B,u+=r*D,h+=r*z,p+=r*H,f+=r*q,l+=r*F,d+=r*X,y+=r*J,v+=r*Y,g+=r*K,b+=r*W,m+=r*G,w+=r*Z,_+=r*V,c+=(r=e[2])*I,a+=r*N,u+=r*B,h+=r*D,p+=r*z,f+=r*H,l+=r*q,d+=r*F,y+=r*X,v+=r*J,g+=r*Y,b+=r*K,m+=r*W,w+=r*G,_+=r*Z,S+=r*V,a+=(r=e[3])*I,u+=r*N,h+=r*B,p+=r*D,f+=r*z,l+=r*H,d+=r*q,y+=r*F,v+=r*X,g+=r*J,b+=r*Y,m+=r*K,w+=r*W,_+=r*G,S+=r*Z,k+=r*V,u+=(r=e[4])*I,h+=r*N,p+=r*B,f+=r*D,l+=r*z,d+=r*H,y+=r*q,v+=r*F,g+=r*X,b+=r*J,m+=r*Y,w+=r*K,_+=r*W,S+=r*G,k+=r*Z,T+=r*V,h+=(r=e[5])*I,p+=r*N,f+=r*B,l+=r*D,d+=r*z,y+=r*H,v+=r*q,g+=r*F,b+=r*X,m+=r*J,w+=r*Y,_+=r*K,S+=r*W,k+=r*G,T+=r*Z,O+=r*V,p+=(r=e[6])*I,f+=r*N,l+=r*B,d+=r*D,y+=r*z,v+=r*H,g+=r*q,b+=r*F,m+=r*X,w+=r*J,_+=r*Y,S+=r*K,k+=r*W,T+=r*G,O+=r*Z,C+=r*V,f+=(r=e[7])*I,l+=r*N,d+=r*B,y+=r*D,v+=r*z,g+=r*H,b+=r*q,m+=r*F,w+=r*X,_+=r*J,S+=r*Y,k+=r*K,T+=r*W,O+=r*G,C+=r*Z,A+=r*V,l+=(r=e[8])*I,d+=r*N,y+=r*B,v+=r*D,g+=r*z,b+=r*H,m+=r*q,w+=r*F,_+=r*X,S+=r*J,k+=r*Y,T+=r*K,O+=r*W,C+=r*G,A+=r*Z,E+=r*V,d+=(r=e[9])*I,y+=r*N,v+=r*B,g+=r*D,b+=r*z,m+=r*H,w+=r*q,_+=r*F,S+=r*X,k+=r*J,T+=r*Y,O+=r*K,C+=r*W,A+=r*G,E+=r*Z,P+=r*V,y+=(r=e[10])*I,v+=r*N,g+=r*B,b+=r*D,m+=r*z,w+=r*H,_+=r*q,S+=r*F,k+=r*X,T+=r*J,O+=r*Y,C+=r*K,A+=r*W,E+=r*G,P+=r*Z,x+=r*V,v+=(r=e[11])*I,g+=r*N,b+=r*B,m+=r*D,w+=r*z,_+=r*H,S+=r*q,k+=r*F,T+=r*X,O+=r*J,C+=r*Y,A+=r*K,E+=r*W,P+=r*G,x+=r*Z,L+=r*V,g+=(r=e[12])*I,b+=r*N,m+=r*B,w+=r*D,_+=r*z,S+=r*H,k+=r*q,T+=r*F,O+=r*X,C+=r*J,A+=r*Y,E+=r*K,P+=r*W,x+=r*G,L+=r*Z,R+=r*V,b+=(r=e[13])*I,m+=r*N,w+=r*B,_+=r*D,S+=r*z,k+=r*H,T+=r*q,O+=r*F,C+=r*X,A+=r*J,E+=r*Y,P+=r*K,x+=r*W,L+=r*G,R+=r*Z,U+=r*V,m+=(r=e[14])*I,w+=r*N,_+=r*B,S+=r*D,k+=r*z,T+=r*H,O+=r*q,C+=r*F,A+=r*X,E+=r*J,P+=r*Y,x+=r*K,L+=r*W,R+=r*G,U+=r*Z,M+=r*V,w+=(r=e[15])*I,s+=38*(S+=r*B),c+=38*(k+=r*D),a+=38*(T+=r*z),u+=38*(O+=r*H),h+=38*(C+=r*q),p+=38*(A+=r*F),f+=38*(E+=r*X),l+=38*(P+=r*J),d+=38*(x+=r*Y),y+=38*(L+=r*K),v+=38*(R+=r*W),g+=38*(U+=r*G),b+=38*(M+=r*Z),m+=38*(j+=r*V),i=(r=(i+=38*(_+=r*N))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),t[0]=i,t[1]=s,t[2]=c,t[3]=a,t[4]=u,t[5]=h,t[6]=p,t[7]=f,t[8]=l,t[9]=d,t[10]=y,t[11]=v,t[12]=g,t[13]=b,t[14]=m,t[15]=w}function z(t,e){D(t,e,e)}function H(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)z(o,o),2!==r&&4!==r&&D(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function q(t,n,r){var o,i,s=new Uint8Array(32),c=new Float64Array(80),u=e(),h=e(),p=e(),f=e(),l=e(),d=e();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,I(c,r),i=0;i<16;i++)h[i]=c[i],f[i]=u[i]=p[i]=0;for(u[0]=f[0]=1,i=254;i>=0;--i)R(u,h,o=s[i>>>3]>>>(7&i)&1),R(p,f,o),N(l,u,p),B(u,u,p),N(p,h,f),B(h,h,f),z(f,l),z(d,u),D(u,p,u),D(p,h,l),N(l,u,p),B(u,u,p),z(h,u),B(p,f,d),D(u,p,a),N(u,u,f),D(p,p,u),D(u,f,d),D(f,h,c),z(h,l),R(u,h,o),R(p,f,o);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=p[i],c[i+48]=h[i],c[i+64]=f[i];var y=c.subarray(32),v=c.subarray(16);return H(y,y),D(v,v,y),U(t,v),0}function F(t,e){return q(t,e,i)}function X(t,e){return r(e,32),F(t,e)}function J(t,e,n){var r=new Uint8Array(32);return q(r,n,e),m(t,o,r,w)}O.prototype.blocks=function(t,e,n){for(var r,o,i,s,c,a,u,h,p,f,l,d,y,v,g,b,m,w,_,S=this.fin?0:2048,k=this.h[0],T=this.h[1],O=this.h[2],C=this.h[3],A=this.h[4],E=this.h[5],P=this.h[6],x=this.h[7],L=this.h[8],R=this.h[9],U=this.r[0],M=this.r[1],j=this.r[2],I=this.r[3],N=this.r[4],B=this.r[5],D=this.r[6],z=this.r[7],H=this.r[8],q=this.r[9];n>=16;)f=p=0,f+=(k+=8191&(r=255&t[e+0]|(255&t[e+1])<<8))*U,f+=(T+=8191&(r>>>13|(o=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*q),f+=(O+=8191&(o>>>10|(i=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*H),f+=(C+=8191&(i>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*z),p=(f+=(A+=8191&(s>>>4|(c=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*D))>>>13,f&=8191,f+=(E+=c>>>1&8191)*(5*B),f+=(P+=8191&(c>>>14|(a=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),f+=(x+=8191&(a>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*I),f+=(L+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*j),l=p+=(f+=(R+=h>>>5|S)*(5*M))>>>13,l+=k*M,l+=T*U,l+=O*(5*q),l+=C*(5*H),p=(l+=A*(5*z))>>>13,l&=8191,l+=E*(5*D),l+=P*(5*B),l+=x*(5*N),l+=L*(5*I),p+=(l+=R*(5*j))>>>13,l&=8191,d=p,d+=k*j,d+=T*M,d+=O*U,d+=C*(5*q),p=(d+=A*(5*H))>>>13,d&=8191,d+=E*(5*z),d+=P*(5*D),d+=x*(5*B),d+=L*(5*N),y=p+=(d+=R*(5*I))>>>13,y+=k*I,y+=T*j,y+=O*M,y+=C*U,p=(y+=A*(5*q))>>>13,y&=8191,y+=E*(5*H),y+=P*(5*z),y+=x*(5*D),y+=L*(5*B),v=p+=(y+=R*(5*N))>>>13,v+=k*N,v+=T*I,v+=O*j,v+=C*M,p=(v+=A*U)>>>13,v&=8191,v+=E*(5*q),v+=P*(5*H),v+=x*(5*z),v+=L*(5*D),g=p+=(v+=R*(5*B))>>>13,g+=k*B,g+=T*N,g+=O*I,g+=C*j,p=(g+=A*M)>>>13,g&=8191,g+=E*U,g+=P*(5*q),g+=x*(5*H),g+=L*(5*z),b=p+=(g+=R*(5*D))>>>13,b+=k*D,b+=T*B,b+=O*N,b+=C*I,p=(b+=A*j)>>>13,b&=8191,b+=E*M,b+=P*U,b+=x*(5*q),b+=L*(5*H),m=p+=(b+=R*(5*z))>>>13,m+=k*z,m+=T*D,m+=O*B,m+=C*N,p=(m+=A*I)>>>13,m&=8191,m+=E*j,m+=P*M,m+=x*U,m+=L*(5*q),w=p+=(m+=R*(5*H))>>>13,w+=k*H,w+=T*z,w+=O*D,w+=C*B,p=(w+=A*N)>>>13,w&=8191,w+=E*I,w+=P*j,w+=x*M,w+=L*U,_=p+=(w+=R*(5*q))>>>13,_+=k*q,_+=T*H,_+=O*z,_+=C*D,p=(_+=A*B)>>>13,_&=8191,_+=E*N,_+=P*I,_+=x*j,_+=L*M,k=f=8191&(p=(p=((p+=(_+=R*U)>>>13)<<2)+p|0)+(f&=8191)|0),T=l+=p>>>=13,O=d&=8191,C=y&=8191,A=v&=8191,E=g&=8191,P=b&=8191,x=m&=8191,L=w&=8191,R=_&=8191,e+=16,n-=16;this.h[0]=k,this.h[1]=T,this.h[2]=O,this.h[3]=C,this.h[4]=A,this.h[5]=E,this.h[6]=P,this.h[7]=x,this.h[8]=L,this.h[9]=R},O.prototype.finish=function(t,e){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},O.prototype.update=function(t,e,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r=16&&(o=n-n%16,this.blocks(t,e,o),e+=o,n-=o),n){for(r=0;r=128;){for(S=0;S<16;S++)k=8*S+G,x[S]=n[k+0]<<24|n[k+1]<<16|n[k+2]<<8|n[k+3],L[S]=n[k+4]<<24|n[k+5]<<16|n[k+6]<<8|n[k+7];for(S=0;S<80;S++)if(o=R,i=U,s=M,c=j,a=I,u=N,h=B,D,f=z,l=H,d=q,y=F,v=X,g=J,b=Y,K,C=65535&(O=K),A=O>>>16,E=65535&(T=D),P=T>>>16,C+=65535&(O=(X>>>14|I<<18)^(X>>>18|I<<14)^(I>>>9|X<<23)),A+=O>>>16,E+=65535&(T=(I>>>14|X<<18)^(I>>>18|X<<14)^(X>>>9|I<<23)),P+=T>>>16,C+=65535&(O=X&J^~X&Y),A+=O>>>16,E+=65535&(T=I&N^~I&B),P+=T>>>16,T=W[2*S],C+=65535&(O=W[2*S+1]),A+=O>>>16,E+=65535&T,P+=T>>>16,T=x[S%16],A+=(O=L[S%16])>>>16,E+=65535&T,P+=T>>>16,E+=(A+=(C+=65535&O)>>>16)>>>16,C=65535&(O=_=65535&C|A<<16),A=O>>>16,E=65535&(T=w=65535&E|(P+=E>>>16)<<16),P=T>>>16,C+=65535&(O=(z>>>28|R<<4)^(R>>>2|z<<30)^(R>>>7|z<<25)),A+=O>>>16,E+=65535&(T=(R>>>28|z<<4)^(z>>>2|R<<30)^(z>>>7|R<<25)),P+=T>>>16,A+=(O=z&H^z&q^H&q)>>>16,E+=65535&(T=R&U^R&M^U&M),P+=T>>>16,p=65535&(E+=(A+=(C+=65535&O)>>>16)>>>16)|(P+=E>>>16)<<16,m=65535&C|A<<16,C=65535&(O=y),A=O>>>16,E=65535&(T=c),P=T>>>16,A+=(O=_)>>>16,E+=65535&(T=w),P+=T>>>16,U=o,M=i,j=s,I=c=65535&(E+=(A+=(C+=65535&O)>>>16)>>>16)|(P+=E>>>16)<<16,N=a,B=u,D=h,R=p,H=f,q=l,F=d,X=y=65535&C|A<<16,J=v,Y=g,K=b,z=m,S%16==15)for(k=0;k<16;k++)T=x[k],C=65535&(O=L[k]),A=O>>>16,E=65535&T,P=T>>>16,T=x[(k+9)%16],C+=65535&(O=L[(k+9)%16]),A+=O>>>16,E+=65535&T,P+=T>>>16,w=x[(k+1)%16],C+=65535&(O=((_=L[(k+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),A+=O>>>16,E+=65535&(T=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),P+=T>>>16,w=x[(k+14)%16],A+=(O=((_=L[(k+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,E+=65535&(T=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,x[k]=65535&E|P<<16,L[k]=65535&C|A<<16;C=65535&(O=z),A=O>>>16,E=65535&(T=R),P=T>>>16,T=t[0],A+=(O=e[0])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[0]=R=65535&E|P<<16,e[0]=z=65535&C|A<<16,C=65535&(O=H),A=O>>>16,E=65535&(T=U),P=T>>>16,T=t[1],A+=(O=e[1])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[1]=U=65535&E|P<<16,e[1]=H=65535&C|A<<16,C=65535&(O=q),A=O>>>16,E=65535&(T=M),P=T>>>16,T=t[2],A+=(O=e[2])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[2]=M=65535&E|P<<16,e[2]=q=65535&C|A<<16,C=65535&(O=F),A=O>>>16,E=65535&(T=j),P=T>>>16,T=t[3],A+=(O=e[3])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[3]=j=65535&E|P<<16,e[3]=F=65535&C|A<<16,C=65535&(O=X),A=O>>>16,E=65535&(T=I),P=T>>>16,T=t[4],A+=(O=e[4])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[4]=I=65535&E|P<<16,e[4]=X=65535&C|A<<16,C=65535&(O=J),A=O>>>16,E=65535&(T=N),P=T>>>16,T=t[5],A+=(O=e[5])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[5]=N=65535&E|P<<16,e[5]=J=65535&C|A<<16,C=65535&(O=Y),A=O>>>16,E=65535&(T=B),P=T>>>16,T=t[6],A+=(O=e[6])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[6]=B=65535&E|P<<16,e[6]=Y=65535&C|A<<16,C=65535&(O=K),A=O>>>16,E=65535&(T=D),P=T>>>16,T=t[7],A+=(O=e[7])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[7]=D=65535&E|P<<16,e[7]=K=65535&C|A<<16,G+=128,r-=128}return r}function Z(t,e,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),c=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,G(o,i,e,n),n%=128,r=0;r=0;--o)Q(t,e,r=n[o/8|0]>>(7&o)&1),V(e,t),V(t,t),Q(t,e,r)}function et(t,n){var r=[e(),e(),e(),e()];x(r[0],p),x(r[1],f),x(r[2],c),D(r[3],p,f),tt(t,r,n)}function nt(t,n,o){var i,s=new Uint8Array(64),c=[e(),e(),e(),e()];for(o||r(n,32),Z(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,et(c,s),$(t,c),i=0;i<32;i++)n[i+32]=t[i];return 0}var rt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(t,e){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o>8,e[o]-=256*n;e[o]+=n,e[r]=0}for(n=0,o=0;o<32;o++)e[o]+=n-(e[31]>>4)*rt[o],n=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=n*rt[o];for(r=0;r<32;r++)e[r+1]+=e[r]>>8,t[r]=255&e[r]}function it(t){var e,n=new Float64Array(64);for(e=0;e<64;e++)n[e]=t[e];for(e=0;e<64;e++)t[e]=0;ot(t,n)}function st(t,n,r,o){var i,s,c=new Uint8Array(64),a=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),p=[e(),e(),e(),e()];Z(c,o,32),c[0]&=248,c[31]&=127,c[31]|=64;var f=r+64;for(i=0;i=0;r--)z(o,o),1!==r&&D(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}(r,r),D(r,r,i),D(r,r,a),D(r,r,a),D(t[0],r,a),z(o,t[0]),D(o,o,a),M(o,i)&&D(t[0],t[0],l),z(o,t[0]),D(o,o,a),M(o,i)?-1:(j(t[0])===n[31]>>7&&B(t[0],s,t[0]),D(t[3],t[0],t[1]),0)}function at(t,n,r,o){var i,s=new Uint8Array(32),c=new Uint8Array(64),a=[e(),e(),e(),e()],u=[e(),e(),e(),e()];if(-1,r<64)return-1;if(ct(u,o))return-1;for(i=0;i=0},t.sign.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(64);return nt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(yt(t),64!==t.length)throw new Error("bad secret key size");for(var e=new Uint8Array(32),n=0;n0)r.loading[t].push(n);else{r.loading[t]=[n];var o=we.createScriptRequest(r.getPath(t,e)),i=r.receivers.create((function(e){if(r.receivers.remove(i),r.loading[t]){var n=r.loading[t];delete r.loading[t];for(var s=function(t){t||o.cleanup()},c=0;c>>6)+u(128|63&e):u(224|e>>>12&15)+u(128|e>>>6&63)+u(128|63&e)},v=function(t){return t.replace(/[^\x00-\x7F]/g,y)},g=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[h.charAt(n>>>18),h.charAt(n>>>12&63),e>=2?"=":h.charAt(n>>>6&63),e>=1?"=":h.charAt(63&n)].join("")},b=window.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,g)},m=function(){function t(t,e,n,r){var o=this;this.clear=e,this.timer=t((function(){o.timer&&(o.timer=r(o.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),w=(d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function _(t){window.clearTimeout(t)}function S(t){window.clearInterval(t)}var k=function(t){function e(e,n){return t.call(this,setTimeout,_,e,(function(t){return n(),null}))||this}return w(e,t),e}(m),T=function(t){function e(e,n){return t.call(this,setInterval,S,e,(function(t){return n(),t}))||this}return w(e,t),e}(m),O={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new k(0,t)},method:function(t){for(var e=[],n=1;n0)for(r=0;r=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},mt=bt,wt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_t=function(t){function e(e,n){var r=t.call(this)||this;return r.id=e,r.transport=n,r.activityTimeout=n.activityTimeout,r.bindListeners(),r}return wt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var r={event:t,data:e};return n&&(r.channel=n),D.debug("Event sent",r),this.send(mt.encodeMessage(r))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=mt.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(D.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){P(e,(function(e,n){t.transport.unbind(n,e)}))};P(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=mt.getCloseAction(t),n=mt.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(tt),St=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=mt.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new _t(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=mt.getCloseAction(e)||"backoff",r=mt.getCloseError(e);t.finish(n,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(C({transport:this.transport,action:t},e))},t}(),kt=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===we.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){return t.authorizers=t.authorizers||we.getAuthorizers(),t.authorizers[this.type].call(this,we,e,n)},t}(),Tt=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(we.TimelineTransport.getAgent(this,t),e)},t}(),Ot=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ct=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),At=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Et=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Pt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),xt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Lt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Rt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Ut=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mt=function(t){function e(e,n){var r=t.call(this,(function(t,n){D.debug("No callbacks on "+e+" for "+t)}))||this;return r.name=e,r.pusher=n,r.subscribed=!1,r.subscriptionPending=!1,r.subscriptionCancelled=!1,r}return Ut(e,t),e.prototype.authorize=function(t,e){return e(!1,{})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new Ct("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=H.buildLogSuffix("triggeringClientEvents");D.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(D.error(n),t.emit("pusher:subscription_error",n)):t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name})})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(tt),jt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),It=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return jt(e,t),e.prototype.authorize=function(t,e){return Kt.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(Mt),Nt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;P(this.members,(function(n,r){t(e.get(r))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),Bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.members=new Nt,r}return Bt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===e.channel_data){var o=H.buildLogSuffix("authenticationEndpoint");return D.error("Invalid auth response for channel '"+r.name+"',expected 'channel_data' field. "+o),void n("Invalid auth response")}var i=JSON.parse(e.channel_data);r.members.setMyID(i.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,r={};t.user_id&&(r.user_id=t.user_id),this.emit(e,n,r)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var r=this.members.addMember(n);this.emit("pusher:member_added",r);break;case"pusher_internal:member_removed":var o=this.members.removeMember(n);o&&this.emit("pusher:member_removed",o)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(It),zt=n(0),Ht=n(1),qt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return qt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var o=e.shared_secret;if(o)r.key=Object(Ht.decodeBase64)(o),delete e.shared_secret,n(!1,e);else{var i="No shared_secret key in auth payload for encrypted channel: "+r.name;n(!0,i)}}}))},e.prototype.trigger=function(t,e){throw new xt("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,r=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,r):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var r=Object(Ht.decodeBase64)(e.ciphertext);if(r.length0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new k(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new k(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new k(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new k(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return C({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return C({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var r=t;"connected"===r&&(r+=" with new socket ID "+e.socket_id),D.debug("State changed",n+" -> "+r),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(tt),Yt=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){return 0===t.indexOf("private-encrypted-")?Kt.createEncryptedChannel(t,e):0===t.indexOf("private-")?Kt.createPrivateChannel(t,e):0===t.indexOf("presence-")?Kt.createPresenceChannel(t,e):Kt.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return P(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){P(this.channels,(function(t){t.disconnect()}))},t}();var Kt={createChannels:function(){return new Yt},createConnectionManager:function(t,e){return new Jt(t,e)},createChannel:function(t,e){return new Mt(t,e)},createPrivateChannel:function(t,e){return new It(t,e)},createPresenceChannel:function(t,e){return new Dt(t,e)},createEncryptedChannel:function(t,e){return new Ft(t,e)},createTimelineSender:function(t,e){return new Tt(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new kt(t,e)},createHandshake:function(t,e){return new St(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new gt(t,e,n)}},Wt=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Kt.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),Gt=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return j(this.strategies,O.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,r=this.strategies,o=0,i=this.timeout,s=null,c=function(a,u){u?e(null,u):(o+=1,n.loop&&(o%=r.length),o0&&(o=new k(n.timeout,(function(){i.abort(),r(!0)}))),i=t.connect(e,(function(t,e){t&&o&&o.isRunning()&&!n.failFast||(o&&o.ensureAborted(),r(t,e))})),{abort:function(){o&&o.ensureAborted(),i.abort()},forceMinPriority:function(t){i.forceMinPriority(t)}}},t}(),Zt=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return j(this.strategies,O.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var r=R(t,(function(t,r,o,i){return t.connect(e,n(r,i))}));return{abort:function(){L(r,Vt)},forceMinPriority:function(t){L(r,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(r,o){n[t].error=r,r?function(t){return function(t,e){for(var n=0;n=O.now()){var i=this.transports[r.transport];i&&(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),o.push(new Gt([i],{timeout:2*r.latency+1e3,failFast:!0})))}var s=O.now(),c=o.pop().connect(t,(function r(i,a){i?(te(n),o.length>0?(s=O.now(),c=o.pop().connect(t,r)):e(i)):(!function(t,e,n){var r=we.getLocalStorage();if(r)try{r[$t(t)]=B({timestamp:O.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,O.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function $t(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function te(t){var e=we.getLocalStorage();if(e)try{delete e[$t(t)]}catch(t){}}var ee=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,r=this.strategy,o=new k(this.options.delay,(function(){n=r.connect(t,e)}));return{abort:function(){o.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),ne=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),re=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,r){r&&n.abort(),e(t,r)}));return n},t}();function oe(t){return function(){return t.isSupported()}}var ie,se=function(t,e){var n={};function r(r,o,i,s,c){var a=e(t,r,o,i,s,c);return n[r]=a,a}var o,i={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=C({},i,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Wt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Wt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),p=r("ws","ws",3,i,u),f=r("wss","ws",3,s,u),l=r("sockjs","sockjs",1,c),d=r("xhr_streaming","xhr_streaming",1,c,h),y=r("xdr_streaming","xdr_streaming",1,c,h),v=r("xhr_polling","xhr_polling",1,c),g=r("xdr_polling","xdr_polling",1,c),b=new Gt([p],a),m=new Gt([f],a),w=new Gt([l],a),_=new Gt([new ne(oe(d),d,y)],a),S=new Gt([new ne(oe(v),v,g)],a),k=new Gt([new ne(oe(_),new Zt([_,new ee(S,{delay:4e3})]),S)],a),T=new ne(oe(k),k,w);return o=t.useTLS?new Zt([b,new ee(T,{delay:2e3})]):new Zt([b,new ee(m,{delay:2e3}),new ee(T,{delay:5e3})]),new Qt(new re(new ne(oe(p),o,T)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},ce={getRequest:function(t){var e=new window.XDomainRequest;return e.ontimeout=function(){t.emit("error",new At),t.close()},e.onerror=function(e){t.emit("error",e),t.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText),t.emit("finished",200),t.close()},e},abortRequest:function(t){t.ontimeout=t.onerror=t.onprogress=t.onload=null,t.abort()}},ae=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(t){function e(e,n,r){var o=t.call(this)||this;return o.hooks=e,o.method=n,o.url=r,o}return ae(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},we.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(we.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(tt);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(ie||(ie={}));var he=ie,pe=1;function fe(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+pe++}function le(t){return Math.floor(Math.random()*t)}var de,ye=function(){function t(t,e){this.hooks=t,this.session=le(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},me={createStreamingSocket:function(t){return this.createSocket(ve,t)},createPollingSocket:function(t){return this.createSocket(ge,t)},createSocket:function(t,e){return new ye(t,e)},createXHR:function(t,e){return this.createRequest(be,t,e)},createRequest:function(t,e,n){return new ue(t,e,n)},createXDR:function(t,e){return this.createRequest(ce,t,e)}},we={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:o,DependenciesReceivers:c,getDefaultStrategy:se,Transports:dt,transportConnectionInitializer:function(){var t=this;t.timeline.info(t.buildTimelineMessage({transport:t.name+(t.options.useTLS?"s":"")})),t.hooks.isInitialized()?t.changeState("initialized"):t.hooks.file?(t.changeState("initializing"),a.load(t.hooks.file,{useTLS:t.options.useTLS},(function(e,n){t.hooks.isInitialized()?(t.changeState("initialized"),n(!0)):(e&&t.onError(e),t.onClose(),n(!1))}))):t.onClose()},HTTPFactory:me,TimelineTransport:Y,getXHRAPI:function(){return window.XMLHttpRequest},getWebSocketAPI:function(){return window.WebSocket||window.MozWebSocket},setup:function(t){var e=this;window.Pusher=t;var n=function(){e.onDocumentBody(t.ready)};window.JSON?n():a.load("json2",{},n)},getDocument:function(){return document},getProtocol:function(){return this.getDocument().location.protocol},getAuthorizers:function(){return{ajax:q,jsonp:F}},onDocumentBody:function(t){var e=this;document.body?t():setTimeout((function(){e.onDocumentBody(t)}),0)},createJSONPRequest:function(t,e){return new J(t,e)},createScriptRequest:function(t){return new X(t)},getLocalStorage:function(){try{return window.localStorage}catch(t){return}},createXHR:function(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest:function(){return new(this.getXHRAPI())},createMicrosoftXHR:function(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork:function(){return vt},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);if(this.isXDRSupported(0===e.indexOf("https:")))return this.HTTPFactory.createXDR(t,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported:function(){var t=this.getXHRAPI();return Boolean(t)&&void 0!==(new t).withCredentials},isXDRSupported:function(t){var e=t?"https:":"http:",n=this.getProtocol();return Boolean(window.XDomainRequest)&&n===e},addUnloadListener:function(t){void 0!==window.addEventListener?window.addEventListener("unload",t,!1):void 0!==window.attachEvent&&window.attachEvent("onunload",t)},removeUnloadListener:function(t){void 0!==window.addEventListener?window.removeEventListener("unload",t,!1):void 0!==window.detachEvent&&window.detachEvent("onunload",t)}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(de||(de={}));var _e=de,Se=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(C({},e,{timestamp:O.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(_e.ERROR,t)},t.prototype.info=function(t){this.log(_e.INFO,t)},t.prototype.debug=function(t){this.log(_e.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,r=C({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(r,(function(t,r){t||n.sent++,e&&e(t,r)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),ke=function(){function t(t,e,n,r){this.name=t,this.priority=e,this.transport=n,this.options=r||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return Te(new Rt,e);if(this.priority>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n,t[e+4]=r>>24&255,t[e+5]=r>>16&255,t[e+6]=r>>8&255,t[e+7]=255&r}function y(t,e,n,r,o){var i,s=0;for(i=0;i>>8)-1}function v(t,e,n,r){return y(t,e,n,r,16)}function g(t,e,n,r){return y(t,e,n,r,32)}function b(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,w=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=i,S=s,k=c,T=a,O=u,C=h,A=p,E=f,P=l,x=d,L=y,R=v,U=g,M=b,j=m,I=w,N=0;N<20;N+=2)_^=(o=(U^=(o=(P^=(o=(O^=(o=_+U|0)<<7|o>>>25)+_|0)<<9|o>>>23)+O|0)<<13|o>>>19)+P|0)<<18|o>>>14,C^=(o=(S^=(o=(M^=(o=(x^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+M|0)<<18|o>>>14,L^=(o=(A^=(o=(k^=(o=(j^=(o=L+A|0)<<7|o>>>25)+L|0)<<9|o>>>23)+j|0)<<13|o>>>19)+k|0)<<18|o>>>14,I^=(o=(R^=(o=(E^=(o=(T^=(o=I+R|0)<<7|o>>>25)+I|0)<<9|o>>>23)+T|0)<<13|o>>>19)+E|0)<<18|o>>>14,_^=(o=(T^=(o=(k^=(o=(S^=(o=_+T|0)<<7|o>>>25)+_|0)<<9|o>>>23)+S|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(O^=(o=(E^=(o=(A^=(o=C+O|0)<<7|o>>>25)+C|0)<<9|o>>>23)+A|0)<<13|o>>>19)+E|0)<<18|o>>>14,L^=(o=(x^=(o=(P^=(o=(R^=(o=L+x|0)<<7|o>>>25)+L|0)<<9|o>>>23)+R|0)<<13|o>>>19)+P|0)<<18|o>>>14,I^=(o=(j^=(o=(M^=(o=(U^=(o=I+j|0)<<7|o>>>25)+I|0)<<9|o>>>23)+U|0)<<13|o>>>19)+M|0)<<18|o>>>14;_=_+i|0,S=S+s|0,k=k+c|0,T=T+a|0,O=O+u|0,C=C+h|0,A=A+p|0,E=E+f|0,P=P+l|0,x=x+d|0,L=L+y|0,R=R+v|0,U=U+g|0,M=M+b|0,j=j+m|0,I=I+w|0,t[0]=_>>>0&255,t[1]=_>>>8&255,t[2]=_>>>16&255,t[3]=_>>>24&255,t[4]=S>>>0&255,t[5]=S>>>8&255,t[6]=S>>>16&255,t[7]=S>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=T>>>0&255,t[13]=T>>>8&255,t[14]=T>>>16&255,t[15]=T>>>24&255,t[16]=O>>>0&255,t[17]=O>>>8&255,t[18]=O>>>16&255,t[19]=O>>>24&255,t[20]=C>>>0&255,t[21]=C>>>8&255,t[22]=C>>>16&255,t[23]=C>>>24&255,t[24]=A>>>0&255,t[25]=A>>>8&255,t[26]=A>>>16&255,t[27]=A>>>24&255,t[28]=E>>>0&255,t[29]=E>>>8&255,t[30]=E>>>16&255,t[31]=E>>>24&255,t[32]=P>>>0&255,t[33]=P>>>8&255,t[34]=P>>>16&255,t[35]=P>>>24&255,t[36]=x>>>0&255,t[37]=x>>>8&255,t[38]=x>>>16&255,t[39]=x>>>24&255,t[40]=L>>>0&255,t[41]=L>>>8&255,t[42]=L>>>16&255,t[43]=L>>>24&255,t[44]=R>>>0&255,t[45]=R>>>8&255,t[46]=R>>>16&255,t[47]=R>>>24&255,t[48]=U>>>0&255,t[49]=U>>>8&255,t[50]=U>>>16&255,t[51]=U>>>24&255,t[52]=M>>>0&255,t[53]=M>>>8&255,t[54]=M>>>16&255,t[55]=M>>>24&255,t[56]=j>>>0&255,t[57]=j>>>8&255,t[58]=j>>>16&255,t[59]=j>>>24&255,t[60]=I>>>0&255,t[61]=I>>>8&255,t[62]=I>>>16&255,t[63]=I>>>24&255}(t,e,n,r)}function m(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,p=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,f=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,w=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,_=0;_<20;_+=2)i^=(o=(g^=(o=(l^=(o=(u^=(o=i+g|0)<<7|o>>>25)+i|0)<<9|o>>>23)+u|0)<<13|o>>>19)+l|0)<<18|o>>>14,h^=(o=(s^=(o=(b^=(o=(d^=(o=h+s|0)<<7|o>>>25)+h|0)<<9|o>>>23)+d|0)<<13|o>>>19)+b|0)<<18|o>>>14,y^=(o=(p^=(o=(c^=(o=(m^=(o=y+p|0)<<7|o>>>25)+y|0)<<9|o>>>23)+m|0)<<13|o>>>19)+c|0)<<18|o>>>14,w^=(o=(v^=(o=(f^=(o=(a^=(o=w+v|0)<<7|o>>>25)+w|0)<<9|o>>>23)+a|0)<<13|o>>>19)+f|0)<<18|o>>>14,i^=(o=(a^=(o=(c^=(o=(s^=(o=i+a|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+c|0)<<18|o>>>14,h^=(o=(u^=(o=(f^=(o=(p^=(o=h+u|0)<<7|o>>>25)+h|0)<<9|o>>>23)+p|0)<<13|o>>>19)+f|0)<<18|o>>>14,y^=(o=(d^=(o=(l^=(o=(v^=(o=y+d|0)<<7|o>>>25)+y|0)<<9|o>>>23)+v|0)<<13|o>>>19)+l|0)<<18|o>>>14,w^=(o=(m^=(o=(b^=(o=(g^=(o=w+m|0)<<7|o>>>25)+w|0)<<9|o>>>23)+g|0)<<13|o>>>19)+b|0)<<18|o>>>14;t[0]=i>>>0&255,t[1]=i>>>8&255,t[2]=i>>>16&255,t[3]=i>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=w>>>0&255,t[13]=w>>>8&255,t[14]=w>>>16&255,t[15]=w>>>24&255,t[16]=p>>>0&255,t[17]=p>>>8&255,t[18]=p>>>16&255,t[19]=p>>>24&255,t[20]=f>>>0&255,t[21]=f>>>8&255,t[22]=f>>>16&255,t[23]=f>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255}(t,e,n,r)}var w=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function _(t,e,n,r,o,i,s){var c,a,u=new Uint8Array(16),h=new Uint8Array(64);for(a=0;a<16;a++)u[a]=0;for(a=0;a<8;a++)u[a]=i[a];for(;o>=64;){for(b(h,u,s,w),a=0;a<64;a++)t[e+a]=n[r+a]^h[a];for(c=1,a=8;a<16;a++)c=c+(255&u[a])|0,u[a]=255&c,c>>>=8;o-=64,e+=64,r+=64}if(o>0)for(b(h,u,s,w),a=0;a=64;){for(b(a,c,o,w),s=0;s<64;s++)t[e+s]=a[s];for(i=1,s=8;s<16;s++)i=i+(255&c[s])|0,c[s]=255&i,i>>>=8;n-=64,e+=64}if(n>0)for(b(a,c,o,w),s=0;s>>13|n<<3),r=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&t[8]|(255&t[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(i>>>14|s<<2),c=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|c<<5),a=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(c>>>8|a<<8),this.r[9]=a>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function C(t,e,n,r,o,i){var s=new O(i);return s.update(n,r,o),s.finish(t,e),0}function A(t,e,n,r,o,i){var s=new Uint8Array(16);return C(s,0,n,r,o,i),v(t,e,s,0)}function E(t,e,n,r,o){var i;if(n<32)return-1;for(T(t,0,e,0,n,r,o),C(t,16,t,32,n-32,t),i=0;i<16;i++)t[i]=0;return 0}function P(t,e,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==A(e,16,e,32,n-32,s))return-1;for(T(t,0,e,0,n,r,o),i=0;i<32;i++)t[i]=0;return 0}function x(t,e){var n;for(n=0;n<16;n++)t[n]=0|e[n]}function L(t){var e,n,r=1;for(e=0;e<16;e++)n=t[e]+r+65535,r=Math.floor(n/65536),t[e]=n-65536*r;t[0]+=r-1+37*(r-1)}function R(t,e,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(t[i]^e[i]),t[i]^=r,e[i]^=r}function U(t,n){var r,o,i,s=e(),c=e();for(r=0;r<16;r++)c[r]=n[r];for(L(c),L(c),L(c),o=0;o<2;o++){for(s[0]=c[0]-65517,r=1;r<15;r++)s[r]=c[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=c[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,R(c,s,1-i)}for(r=0;r<16;r++)t[2*r]=255&c[r],t[2*r+1]=c[r]>>8}function M(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return U(n,t),U(r,e),g(n,0,r,0)}function j(t){var e=new Uint8Array(32);return U(e,t),1&e[0]}function I(t,e){var n;for(n=0;n<16;n++)t[n]=e[2*n]+(e[2*n+1]<<8);t[15]&=32767}function N(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]+n[r]}function B(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]-n[r]}function D(t,e,n){var r,o,i=0,s=0,c=0,a=0,u=0,h=0,p=0,f=0,l=0,d=0,y=0,v=0,g=0,b=0,m=0,w=0,_=0,S=0,k=0,T=0,O=0,C=0,A=0,E=0,P=0,x=0,L=0,R=0,U=0,M=0,j=0,I=n[0],N=n[1],B=n[2],D=n[3],z=n[4],H=n[5],q=n[6],F=n[7],X=n[8],J=n[9],Y=n[10],K=n[11],W=n[12],G=n[13],Z=n[14],V=n[15];i+=(r=e[0])*I,s+=r*N,c+=r*B,a+=r*D,u+=r*z,h+=r*H,p+=r*q,f+=r*F,l+=r*X,d+=r*J,y+=r*Y,v+=r*K,g+=r*W,b+=r*G,m+=r*Z,w+=r*V,s+=(r=e[1])*I,c+=r*N,a+=r*B,u+=r*D,h+=r*z,p+=r*H,f+=r*q,l+=r*F,d+=r*X,y+=r*J,v+=r*Y,g+=r*K,b+=r*W,m+=r*G,w+=r*Z,_+=r*V,c+=(r=e[2])*I,a+=r*N,u+=r*B,h+=r*D,p+=r*z,f+=r*H,l+=r*q,d+=r*F,y+=r*X,v+=r*J,g+=r*Y,b+=r*K,m+=r*W,w+=r*G,_+=r*Z,S+=r*V,a+=(r=e[3])*I,u+=r*N,h+=r*B,p+=r*D,f+=r*z,l+=r*H,d+=r*q,y+=r*F,v+=r*X,g+=r*J,b+=r*Y,m+=r*K,w+=r*W,_+=r*G,S+=r*Z,k+=r*V,u+=(r=e[4])*I,h+=r*N,p+=r*B,f+=r*D,l+=r*z,d+=r*H,y+=r*q,v+=r*F,g+=r*X,b+=r*J,m+=r*Y,w+=r*K,_+=r*W,S+=r*G,k+=r*Z,T+=r*V,h+=(r=e[5])*I,p+=r*N,f+=r*B,l+=r*D,d+=r*z,y+=r*H,v+=r*q,g+=r*F,b+=r*X,m+=r*J,w+=r*Y,_+=r*K,S+=r*W,k+=r*G,T+=r*Z,O+=r*V,p+=(r=e[6])*I,f+=r*N,l+=r*B,d+=r*D,y+=r*z,v+=r*H,g+=r*q,b+=r*F,m+=r*X,w+=r*J,_+=r*Y,S+=r*K,k+=r*W,T+=r*G,O+=r*Z,C+=r*V,f+=(r=e[7])*I,l+=r*N,d+=r*B,y+=r*D,v+=r*z,g+=r*H,b+=r*q,m+=r*F,w+=r*X,_+=r*J,S+=r*Y,k+=r*K,T+=r*W,O+=r*G,C+=r*Z,A+=r*V,l+=(r=e[8])*I,d+=r*N,y+=r*B,v+=r*D,g+=r*z,b+=r*H,m+=r*q,w+=r*F,_+=r*X,S+=r*J,k+=r*Y,T+=r*K,O+=r*W,C+=r*G,A+=r*Z,E+=r*V,d+=(r=e[9])*I,y+=r*N,v+=r*B,g+=r*D,b+=r*z,m+=r*H,w+=r*q,_+=r*F,S+=r*X,k+=r*J,T+=r*Y,O+=r*K,C+=r*W,A+=r*G,E+=r*Z,P+=r*V,y+=(r=e[10])*I,v+=r*N,g+=r*B,b+=r*D,m+=r*z,w+=r*H,_+=r*q,S+=r*F,k+=r*X,T+=r*J,O+=r*Y,C+=r*K,A+=r*W,E+=r*G,P+=r*Z,x+=r*V,v+=(r=e[11])*I,g+=r*N,b+=r*B,m+=r*D,w+=r*z,_+=r*H,S+=r*q,k+=r*F,T+=r*X,O+=r*J,C+=r*Y,A+=r*K,E+=r*W,P+=r*G,x+=r*Z,L+=r*V,g+=(r=e[12])*I,b+=r*N,m+=r*B,w+=r*D,_+=r*z,S+=r*H,k+=r*q,T+=r*F,O+=r*X,C+=r*J,A+=r*Y,E+=r*K,P+=r*W,x+=r*G,L+=r*Z,R+=r*V,b+=(r=e[13])*I,m+=r*N,w+=r*B,_+=r*D,S+=r*z,k+=r*H,T+=r*q,O+=r*F,C+=r*X,A+=r*J,E+=r*Y,P+=r*K,x+=r*W,L+=r*G,R+=r*Z,U+=r*V,m+=(r=e[14])*I,w+=r*N,_+=r*B,S+=r*D,k+=r*z,T+=r*H,O+=r*q,C+=r*F,A+=r*X,E+=r*J,P+=r*Y,x+=r*K,L+=r*W,R+=r*G,U+=r*Z,M+=r*V,w+=(r=e[15])*I,s+=38*(S+=r*B),c+=38*(k+=r*D),a+=38*(T+=r*z),u+=38*(O+=r*H),h+=38*(C+=r*q),p+=38*(A+=r*F),f+=38*(E+=r*X),l+=38*(P+=r*J),d+=38*(x+=r*Y),y+=38*(L+=r*K),v+=38*(R+=r*W),g+=38*(U+=r*G),b+=38*(M+=r*Z),m+=38*(j+=r*V),i=(r=(i+=38*(_+=r*N))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),w=(r=w+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),t[0]=i,t[1]=s,t[2]=c,t[3]=a,t[4]=u,t[5]=h,t[6]=p,t[7]=f,t[8]=l,t[9]=d,t[10]=y,t[11]=v,t[12]=g,t[13]=b,t[14]=m,t[15]=w}function z(t,e){D(t,e,e)}function H(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)z(o,o),2!==r&&4!==r&&D(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function q(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=250;r>=0;r--)z(o,o),1!==r&&D(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function F(t,n,r){var o,i,s=new Uint8Array(32),c=new Float64Array(80),u=e(),h=e(),p=e(),f=e(),l=e(),d=e();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,I(c,r),i=0;i<16;i++)h[i]=c[i],f[i]=u[i]=p[i]=0;for(u[0]=f[0]=1,i=254;i>=0;--i)R(u,h,o=s[i>>>3]>>>(7&i)&1),R(p,f,o),N(l,u,p),B(u,u,p),N(p,h,f),B(h,h,f),z(f,l),z(d,u),D(u,p,u),D(p,h,l),N(l,u,p),B(u,u,p),z(h,u),B(p,f,d),D(u,p,a),N(u,u,f),D(p,p,u),D(u,f,d),D(f,h,c),z(h,l),R(u,h,o),R(p,f,o);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=p[i],c[i+48]=h[i],c[i+64]=f[i];var y=c.subarray(32),v=c.subarray(16);return H(y,y),D(v,v,y),U(t,v),0}function X(t,e){return F(t,e,i)}function J(t,e){return r(e,32),X(t,e)}function Y(t,e,n){var r=new Uint8Array(32);return F(r,n,e),m(t,o,r,w)}O.prototype.blocks=function(t,e,n){for(var r,o,i,s,c,a,u,h,p,f,l,d,y,v,g,b,m,w,_,S=this.fin?0:2048,k=this.h[0],T=this.h[1],O=this.h[2],C=this.h[3],A=this.h[4],E=this.h[5],P=this.h[6],x=this.h[7],L=this.h[8],R=this.h[9],U=this.r[0],M=this.r[1],j=this.r[2],I=this.r[3],N=this.r[4],B=this.r[5],D=this.r[6],z=this.r[7],H=this.r[8],q=this.r[9];n>=16;)f=p=0,f+=(k+=8191&(r=255&t[e+0]|(255&t[e+1])<<8))*U,f+=(T+=8191&(r>>>13|(o=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*q),f+=(O+=8191&(o>>>10|(i=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*H),f+=(C+=8191&(i>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*z),p=(f+=(A+=8191&(s>>>4|(c=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*D))>>>13,f&=8191,f+=(E+=c>>>1&8191)*(5*B),f+=(P+=8191&(c>>>14|(a=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),f+=(x+=8191&(a>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*I),f+=(L+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*j),l=p+=(f+=(R+=h>>>5|S)*(5*M))>>>13,l+=k*M,l+=T*U,l+=O*(5*q),l+=C*(5*H),p=(l+=A*(5*z))>>>13,l&=8191,l+=E*(5*D),l+=P*(5*B),l+=x*(5*N),l+=L*(5*I),p+=(l+=R*(5*j))>>>13,l&=8191,d=p,d+=k*j,d+=T*M,d+=O*U,d+=C*(5*q),p=(d+=A*(5*H))>>>13,d&=8191,d+=E*(5*z),d+=P*(5*D),d+=x*(5*B),d+=L*(5*N),y=p+=(d+=R*(5*I))>>>13,y+=k*I,y+=T*j,y+=O*M,y+=C*U,p=(y+=A*(5*q))>>>13,y&=8191,y+=E*(5*H),y+=P*(5*z),y+=x*(5*D),y+=L*(5*B),v=p+=(y+=R*(5*N))>>>13,v+=k*N,v+=T*I,v+=O*j,v+=C*M,p=(v+=A*U)>>>13,v&=8191,v+=E*(5*q),v+=P*(5*H),v+=x*(5*z),v+=L*(5*D),g=p+=(v+=R*(5*B))>>>13,g+=k*B,g+=T*N,g+=O*I,g+=C*j,p=(g+=A*M)>>>13,g&=8191,g+=E*U,g+=P*(5*q),g+=x*(5*H),g+=L*(5*z),b=p+=(g+=R*(5*D))>>>13,b+=k*D,b+=T*B,b+=O*N,b+=C*I,p=(b+=A*j)>>>13,b&=8191,b+=E*M,b+=P*U,b+=x*(5*q),b+=L*(5*H),m=p+=(b+=R*(5*z))>>>13,m+=k*z,m+=T*D,m+=O*B,m+=C*N,p=(m+=A*I)>>>13,m&=8191,m+=E*j,m+=P*M,m+=x*U,m+=L*(5*q),w=p+=(m+=R*(5*H))>>>13,w+=k*H,w+=T*z,w+=O*D,w+=C*B,p=(w+=A*N)>>>13,w&=8191,w+=E*I,w+=P*j,w+=x*M,w+=L*U,_=p+=(w+=R*(5*q))>>>13,_+=k*q,_+=T*H,_+=O*z,_+=C*D,p=(_+=A*B)>>>13,_&=8191,_+=E*N,_+=P*I,_+=x*j,_+=L*M,k=f=8191&(p=(p=((p+=(_+=R*U)>>>13)<<2)+p|0)+(f&=8191)|0),T=l+=p>>>=13,O=d&=8191,C=y&=8191,A=v&=8191,E=g&=8191,P=b&=8191,x=m&=8191,L=w&=8191,R=_&=8191,e+=16,n-=16;this.h[0]=k,this.h[1]=T,this.h[2]=O,this.h[3]=C,this.h[4]=A,this.h[5]=E,this.h[6]=P,this.h[7]=x,this.h[8]=L,this.h[9]=R},O.prototype.finish=function(t,e){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},O.prototype.update=function(t,e,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r=16&&(o=n-n%16,this.blocks(t,e,o),e+=o,n-=o),n){for(r=0;r=128;){for(S=0;S<16;S++)k=8*S+W,x[S]=n[k+0]<<24|n[k+1]<<16|n[k+2]<<8|n[k+3],L[S]=n[k+4]<<24|n[k+5]<<16|n[k+6]<<8|n[k+7];for(S=0;S<80;S++)if(o=R,i=U,s=M,c=j,a=I,u=N,h=B,D,f=z,l=H,d=q,y=F,v=X,g=J,b=Y,K,C=65535&(O=K),A=O>>>16,E=65535&(T=D),P=T>>>16,C+=65535&(O=(X>>>14|I<<18)^(X>>>18|I<<14)^(I>>>9|X<<23)),A+=O>>>16,E+=65535&(T=(I>>>14|X<<18)^(I>>>18|X<<14)^(X>>>9|I<<23)),P+=T>>>16,C+=65535&(O=X&J^~X&Y),A+=O>>>16,E+=65535&(T=I&N^~I&B),P+=T>>>16,C+=65535&(O=G[2*S+1]),A+=O>>>16,E+=65535&(T=G[2*S]),P+=T>>>16,T=x[S%16],A+=(O=L[S%16])>>>16,E+=65535&T,P+=T>>>16,E+=(A+=(C+=65535&O)>>>16)>>>16,C=65535&(O=_=65535&C|A<<16),A=O>>>16,E=65535&(T=w=65535&E|(P+=E>>>16)<<16),P=T>>>16,C+=65535&(O=(z>>>28|R<<4)^(R>>>2|z<<30)^(R>>>7|z<<25)),A+=O>>>16,E+=65535&(T=(R>>>28|z<<4)^(z>>>2|R<<30)^(z>>>7|R<<25)),P+=T>>>16,A+=(O=z&H^z&q^H&q)>>>16,E+=65535&(T=R&U^R&M^U&M),P+=T>>>16,p=65535&(E+=(A+=(C+=65535&O)>>>16)>>>16)|(P+=E>>>16)<<16,m=65535&C|A<<16,C=65535&(O=y),A=O>>>16,E=65535&(T=c),P=T>>>16,A+=(O=_)>>>16,E+=65535&(T=w),P+=T>>>16,U=o,M=i,j=s,I=c=65535&(E+=(A+=(C+=65535&O)>>>16)>>>16)|(P+=E>>>16)<<16,N=a,B=u,D=h,R=p,H=f,q=l,F=d,X=y=65535&C|A<<16,J=v,Y=g,K=b,z=m,S%16==15)for(k=0;k<16;k++)T=x[k],C=65535&(O=L[k]),A=O>>>16,E=65535&T,P=T>>>16,T=x[(k+9)%16],C+=65535&(O=L[(k+9)%16]),A+=O>>>16,E+=65535&T,P+=T>>>16,w=x[(k+1)%16],C+=65535&(O=((_=L[(k+1)%16])>>>1|w<<31)^(_>>>8|w<<24)^(_>>>7|w<<25)),A+=O>>>16,E+=65535&(T=(w>>>1|_<<31)^(w>>>8|_<<24)^w>>>7),P+=T>>>16,w=x[(k+14)%16],A+=(O=((_=L[(k+14)%16])>>>19|w<<13)^(w>>>29|_<<3)^(_>>>6|w<<26))>>>16,E+=65535&(T=(w>>>19|_<<13)^(_>>>29|w<<3)^w>>>6),P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,x[k]=65535&E|P<<16,L[k]=65535&C|A<<16;C=65535&(O=z),A=O>>>16,E=65535&(T=R),P=T>>>16,T=t[0],A+=(O=e[0])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[0]=R=65535&E|P<<16,e[0]=z=65535&C|A<<16,C=65535&(O=H),A=O>>>16,E=65535&(T=U),P=T>>>16,T=t[1],A+=(O=e[1])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[1]=U=65535&E|P<<16,e[1]=H=65535&C|A<<16,C=65535&(O=q),A=O>>>16,E=65535&(T=M),P=T>>>16,T=t[2],A+=(O=e[2])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[2]=M=65535&E|P<<16,e[2]=q=65535&C|A<<16,C=65535&(O=F),A=O>>>16,E=65535&(T=j),P=T>>>16,T=t[3],A+=(O=e[3])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[3]=j=65535&E|P<<16,e[3]=F=65535&C|A<<16,C=65535&(O=X),A=O>>>16,E=65535&(T=I),P=T>>>16,T=t[4],A+=(O=e[4])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[4]=I=65535&E|P<<16,e[4]=X=65535&C|A<<16,C=65535&(O=J),A=O>>>16,E=65535&(T=N),P=T>>>16,T=t[5],A+=(O=e[5])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[5]=N=65535&E|P<<16,e[5]=J=65535&C|A<<16,C=65535&(O=Y),A=O>>>16,E=65535&(T=B),P=T>>>16,T=t[6],A+=(O=e[6])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[6]=B=65535&E|P<<16,e[6]=Y=65535&C|A<<16,C=65535&(O=K),A=O>>>16,E=65535&(T=D),P=T>>>16,T=t[7],A+=(O=e[7])>>>16,E+=65535&T,P+=T>>>16,P+=(E+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[7]=D=65535&E|P<<16,e[7]=K=65535&C|A<<16,W+=128,r-=128}return r}function V(t,e,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),c=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Z(o,i,e,n),n%=128,r=0;r=0;--o)$(t,e,r=n[o/8|0]>>(7&o)&1),Q(e,t),Q(t,t),$(t,e,r)}function nt(t,n){var r=[e(),e(),e(),e()];x(r[0],p),x(r[1],f),x(r[2],c),D(r[3],p,f),et(t,r,n)}function rt(t,n,o){var i,s=new Uint8Array(64),c=[e(),e(),e(),e()];for(o||r(n,32),V(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,nt(c,s),tt(t,c),i=0;i<32;i++)n[i+32]=t[i];return 0}var ot=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,e){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o>8,e[o]-=256*n;e[o]+=n,e[r]=0}for(n=0,o=0;o<32;o++)e[o]+=n-(e[31]>>4)*ot[o],n=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=n*ot[o];for(r=0;r<32;r++)e[r+1]+=e[r]>>8,t[r]=255&e[r]}function st(t){var e,n=new Float64Array(64);for(e=0;e<64;e++)n[e]=t[e];for(e=0;e<64;e++)t[e]=0;it(t,n)}function ct(t,n,r,o){var i,s,c=new Uint8Array(64),a=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),p=[e(),e(),e(),e()];V(c,o,32),c[0]&=248,c[31]&=127,c[31]|=64;var f=r+64;for(i=0;i>7&&B(t[0],s,t[0]),D(t[3],t[0],t[1]),0)}(f,o))return-1;for(i=0;i=0},t.sign.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(64);return rt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(ht(t),64!==t.length)throw new Error("bad secret key size");for(var e=new Uint8Array(32),n=0;n0)r.loading[t].push(n);else{r.loading[t]=[n];var o=we.createScriptRequest(r.getPath(t,e)),i=r.receivers.create((function(e){if(r.receivers.remove(i),r.loading[t]){var n=r.loading[t];delete r.loading[t];for(var s=function(t){t||o.cleanup()},c=0;c>>6)+u(128|63&e):u(224|e>>>12&15)+u(128|e>>>6&63)+u(128|63&e)},v=function(t){return t.replace(/[^\x00-\x7F]/g,y)},g=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[h.charAt(n>>>18),h.charAt(n>>>12&63),e>=2?"=":h.charAt(n>>>6&63),e>=1?"=":h.charAt(63&n)].join("")},b=window.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,g)},m=function(){function t(t,e,n,r){var o=this;this.clear=e,this.timer=t((function(){o.timer&&(o.timer=r(o.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),w=(d=function(t,e){return(d=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}d(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function _(t){window.clearTimeout(t)}function S(t){window.clearInterval(t)}var k=function(t){function e(e,n){return t.call(this,setTimeout,_,e,(function(t){return n(),null}))||this}return w(e,t),e}(m),T=function(t){function e(e,n){return t.call(this,setInterval,S,e,(function(t){return n(),t}))||this}return w(e,t),e}(m),O={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new k(0,t)},method:function(t){for(var e=[],n=1;n0)for(r=0;r=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},mt=bt,wt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_t=function(t){function e(e,n){var r=t.call(this)||this;return r.id=e,r.transport=n,r.activityTimeout=n.activityTimeout,r.bindListeners(),r}return wt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var r={event:t,data:e};return n&&(r.channel=n),D.debug("Event sent",r),this.send(mt.encodeMessage(r))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=mt.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(D.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){P(e,(function(e,n){t.transport.unbind(n,e)}))};P(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=mt.getCloseAction(t),n=mt.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(tt),St=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=mt.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new _t(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=mt.getCloseAction(e)||"backoff",r=mt.getCloseError(e);t.finish(n,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(C({transport:this.transport,action:t},e))},t}(),kt=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===we.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){t.authorizers=t.authorizers||we.getAuthorizers(),t.authorizers[this.type].call(this,we,e,n)},t}(),Tt=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(we.TimelineTransport.getAgent(this,t),e)},t}(),Ot=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ct=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),At=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Et=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Pt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),xt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Lt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Rt=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return Ot(e,t),e}(Error),Ut=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Mt=function(t){function e(e,n){var r=t.call(this,(function(t,n){D.debug("No callbacks on "+e+" for "+t)}))||this;return r.name=e,r.pusher=n,r.subscribed=!1,r.subscriptionPending=!1,r.subscriptionCancelled=!1,r}return Ut(e,t),e.prototype.authorize=function(t,e){return e(!1,{auth:""})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new Ct("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=H("triggeringClientEvents");D.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(D.error(n),t.emit("pusher:subscription_error",n)):(n=n,t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name}))})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(tt),jt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),It=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return jt(e,t),e.prototype.authorize=function(t,e){return Kt.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(Mt),Nt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;P(this.members,(function(n,r){t(e.get(r))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),Bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Dt=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.members=new Nt,r}return Bt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===(e=e).channel_data){var o=H("authenticationEndpoint");return D.error("Invalid auth response for channel '"+r.name+"',expected 'channel_data' field. "+o),void n("Invalid auth response")}var i=JSON.parse(e.channel_data);r.members.setMyID(i.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,r={};t.user_id&&(r.user_id=t.user_id),this.emit(e,n,r)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var r=this.members.addMember(n);this.emit("pusher:member_added",r);break;case"pusher_internal:member_removed":var o=this.members.removeMember(n);o&&this.emit("pusher:member_removed",o)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(It),zt=n(0),Ht=n(1),qt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Ft=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return qt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var o=e.shared_secret;if(o)r.key=Object(Ht.decodeBase64)(o),delete e.shared_secret,n(!1,e);else{var i="No shared_secret key in auth payload for encrypted channel: "+r.name;n(!0,i)}}}))},e.prototype.trigger=function(t,e){throw new xt("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,r=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,r):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var r=Object(Ht.decodeBase64)(e.ciphertext);if(r.length0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new k(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new k(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new k(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new k(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return C({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return C({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var r=t;"connected"===r&&(r+=" with new socket ID "+e.socket_id),D.debug("State changed",n+" -> "+r),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(tt),Yt=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){return 0===t.indexOf("private-encrypted-")?Kt.createEncryptedChannel(t,e):0===t.indexOf("private-")?Kt.createPrivateChannel(t,e):0===t.indexOf("presence-")?Kt.createPresenceChannel(t,e):Kt.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return P(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){P(this.channels,(function(t){t.disconnect()}))},t}();var Kt={createChannels:function(){return new Yt},createConnectionManager:function(t,e){return new Jt(t,e)},createChannel:function(t,e){return new Mt(t,e)},createPrivateChannel:function(t,e){return new It(t,e)},createPresenceChannel:function(t,e){return new Dt(t,e)},createEncryptedChannel:function(t,e){return new Ft(t,e)},createTimelineSender:function(t,e){return new Tt(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new kt(t,e)},createHandshake:function(t,e){return new St(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new gt(t,e,n)}},Wt=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Kt.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),Gt=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return j(this.strategies,O.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,r=this.strategies,o=0,i=this.timeout,s=null,c=function(a,u){u?e(null,u):(o+=1,n.loop&&(o%=r.length),o0&&(o=new k(n.timeout,(function(){i.abort(),r(!0)}))),i=t.connect(e,(function(t,e){t&&o&&o.isRunning()&&!n.failFast||(o&&o.ensureAborted(),r(t,e))})),{abort:function(){o&&o.ensureAborted(),i.abort()},forceMinPriority:function(t){i.forceMinPriority(t)}}},t}(),Zt=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return j(this.strategies,O.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var r=R(t,(function(t,r,o,i){return t.connect(e,n(r,i))}));return{abort:function(){L(r,Vt)},forceMinPriority:function(t){L(r,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(r,o){n[t].error=r,r?function(t){return function(t,e){for(var n=0;n=O.now()){var i=this.transports[r.transport];i&&(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),o.push(new Gt([i],{timeout:2*r.latency+1e3,failFast:!0})))}var s=O.now(),c=o.pop().connect(t,(function r(i,a){i?(te(n),o.length>0?(s=O.now(),c=o.pop().connect(t,r)):e(i)):(!function(t,e,n){var r=we.getLocalStorage();if(r)try{r[$t(t)]=B({timestamp:O.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,O.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function $t(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function te(t){var e=we.getLocalStorage();if(e)try{delete e[$t(t)]}catch(t){}}var ee=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,r=this.strategy,o=new k(this.options.delay,(function(){n=r.connect(t,e)}));return{abort:function(){o.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),ne=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),re=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,r){r&&n.abort(),e(t,r)}));return n},t}();function oe(t){return function(){return t.isSupported()}}var ie,se=function(t,e){var n={};function r(r,o,i,s,c){var a=e(t,r,o,i,s,c);return n[r]=a,a}var o,i={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=C({},i,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Wt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Wt({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),p=r("ws","ws",3,i,u),f=r("wss","ws",3,s,u),l=r("sockjs","sockjs",1,c),d=r("xhr_streaming","xhr_streaming",1,c,h),y=r("xdr_streaming","xdr_streaming",1,c,h),v=r("xhr_polling","xhr_polling",1,c),g=r("xdr_polling","xdr_polling",1,c),b=new Gt([p],a),m=new Gt([f],a),w=new Gt([l],a),_=new Gt([new ne(oe(d),d,y)],a),S=new Gt([new ne(oe(v),v,g)],a),k=new Gt([new ne(oe(_),new Zt([_,new ee(S,{delay:4e3})]),S)],a),T=new ne(oe(k),k,w);return o=t.useTLS?new Zt([b,new ee(T,{delay:2e3})]):new Zt([b,new ee(m,{delay:2e3}),new ee(T,{delay:5e3})]),new Qt(new re(new ne(oe(p),o,T)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},ce={getRequest:function(t){var e=new window.XDomainRequest;return e.ontimeout=function(){t.emit("error",new At),t.close()},e.onerror=function(e){t.emit("error",e),t.close()},e.onprogress=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText)},e.onload=function(){e.responseText&&e.responseText.length>0&&t.onChunk(200,e.responseText),t.emit("finished",200),t.close()},e},abortRequest:function(t){t.ontimeout=t.onerror=t.onprogress=t.onload=null,t.abort()}},ae=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ue=function(t){function e(e,n,r){var o=t.call(this)||this;return o.hooks=e,o.method=n,o.url=r,o}return ae(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},we.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(we.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(tt);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(ie||(ie={}));var he=ie,pe=1;function fe(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+pe++}function le(t){return Math.floor(Math.random()*t)}var de,ye=function(){function t(t,e){this.hooks=t,this.session=le(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},me={createStreamingSocket:function(t){return this.createSocket(ve,t)},createPollingSocket:function(t){return this.createSocket(ge,t)},createSocket:function(t,e){return new ye(t,e)},createXHR:function(t,e){return this.createRequest(be,t,e)},createRequest:function(t,e,n){return new ue(t,e,n)},createXDR:function(t,e){return this.createRequest(ce,t,e)}},we={nextAuthCallbackID:1,auth_callbacks:{},ScriptReceivers:o,DependenciesReceivers:c,getDefaultStrategy:se,Transports:dt,transportConnectionInitializer:function(){var t=this;t.timeline.info(t.buildTimelineMessage({transport:t.name+(t.options.useTLS?"s":"")})),t.hooks.isInitialized()?t.changeState("initialized"):t.hooks.file?(t.changeState("initializing"),a.load(t.hooks.file,{useTLS:t.options.useTLS},(function(e,n){t.hooks.isInitialized()?(t.changeState("initialized"),n(!0)):(e&&t.onError(e),t.onClose(),n(!1))}))):t.onClose()},HTTPFactory:me,TimelineTransport:Y,getXHRAPI:function(){return window.XMLHttpRequest},getWebSocketAPI:function(){return window.WebSocket||window.MozWebSocket},setup:function(t){var e=this;window.Pusher=t;var n=function(){e.onDocumentBody(t.ready)};window.JSON?n():a.load("json2",{},n)},getDocument:function(){return document},getProtocol:function(){return this.getDocument().location.protocol},getAuthorizers:function(){return{ajax:q,jsonp:F}},onDocumentBody:function(t){var e=this;document.body?t():setTimeout((function(){e.onDocumentBody(t)}),0)},createJSONPRequest:function(t,e){return new J(t,e)},createScriptRequest:function(t){return new X(t)},getLocalStorage:function(){try{return window.localStorage}catch(t){return}},createXHR:function(){return this.getXHRAPI()?this.createXMLHttpRequest():this.createMicrosoftXHR()},createXMLHttpRequest:function(){return new(this.getXHRAPI())},createMicrosoftXHR:function(){return new ActiveXObject("Microsoft.XMLHTTP")},getNetwork:function(){return vt},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);if(this.isXDRSupported(0===e.indexOf("https:")))return this.HTTPFactory.createXDR(t,e);throw"Cross-origin HTTP requests are not supported"},isXHRSupported:function(){var t=this.getXHRAPI();return Boolean(t)&&void 0!==(new t).withCredentials},isXDRSupported:function(t){var e=t?"https:":"http:",n=this.getProtocol();return Boolean(window.XDomainRequest)&&n===e},addUnloadListener:function(t){void 0!==window.addEventListener?window.addEventListener("unload",t,!1):void 0!==window.attachEvent&&window.attachEvent("onunload",t)},removeUnloadListener:function(t){void 0!==window.addEventListener?window.removeEventListener("unload",t,!1):void 0!==window.detachEvent&&window.detachEvent("onunload",t)}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(de||(de={}));var _e=de,Se=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(C({},e,{timestamp:O.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(_e.ERROR,t)},t.prototype.info=function(t){this.log(_e.INFO,t)},t.prototype.debug=function(t){this.log(_e.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,r=C({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(r,(function(t,r){t||n.sent++,e&&e(t,r)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),ke=function(){function t(t,e,n,r){this.name=t,this.priority=e,this.transport=n,this.options=r||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return Te(new Rt,e);if(this.priority= 1002 && closeEvent.code <= 1004) { - return "backoff"; + return 'backoff'; } else { return null; } } else if (closeEvent.code === 4000) { - return "tls_only"; + return 'tls_only'; } else if (closeEvent.code < 4100) { - return "refused"; + return 'refused'; } else if (closeEvent.code < 4200) { - return "backoff"; + return 'backoff'; } else if (closeEvent.code < 4300) { - return "retry"; + return 'retry'; } else { - return "refused"; + return 'refused'; } }, getCloseError: function (closeEvent) { @@ -3593,23 +3619,26 @@ var connection_Connection = (function (_super) { logger.debug('Event recd', pusherEvent); switch (pusherEvent.event) { case 'pusher:error': - _this.emit('error', { type: 'PusherError', data: pusherEvent.data }); + _this.emit('error', { + type: 'PusherError', + data: pusherEvent.data + }); break; case 'pusher:ping': - _this.emit("ping"); + _this.emit('ping'); break; case 'pusher:pong': - _this.emit("pong"); + _this.emit('pong'); break; } _this.emit('message', pusherEvent); } }, activity: function () { - _this.emit("activity"); + _this.emit('activity'); }, error: function (error) { - _this.emit("error", { type: "WebSocketError", error: error }); + _this.emit('error', { type: 'WebSocketError', error: error }); }, closed: function (closeEvent) { unbindListeners(); @@ -3617,7 +3646,7 @@ var connection_Connection = (function (_super) { _this.handleCloseEvent(closeEvent); } _this.transport = null; - _this.emit("closed"); + _this.emit('closed'); } }; var unbindListeners = function () { @@ -3666,12 +3695,12 @@ var handshake_Handshake = (function () { result = protocol.processHandshake(m); } catch (e) { - _this.finish("error", { error: e }); + _this.finish('error', { error: e }); _this.transport.close(); return; } - if (result.action === "connected") { - _this.finish("connected", { + if (result.action === 'connected') { + _this.finish('connected', { connection: new connection_connection(result.id, _this.transport), activityTimeout: result.activityTimeout }); @@ -3683,16 +3712,16 @@ var handshake_Handshake = (function () { }; this.onClosed = function (closeEvent) { _this.unbindListeners(); - var action = protocol.getCloseAction(closeEvent) || "backoff"; + var action = protocol.getCloseAction(closeEvent) || 'backoff'; var error = protocol.getCloseError(closeEvent); _this.finish(action, { error: error }); }; - this.transport.bind("message", this.onMessage); - this.transport.bind("closed", this.onClosed); + this.transport.bind('message', this.onMessage); + this.transport.bind('closed', this.onClosed); }; Handshake.prototype.unbindListeners = function () { - this.transport.unbind("message", this.onMessage); - this.transport.unbind("closed", this.onClosed); + this.transport.unbind('message', this.onMessage); + this.transport.unbind('closed', this.onClosed); }; Handshake.prototype.finish = function (action, params) { this.callback(extend({ transport: this.transport, action: action }, params)); @@ -3707,7 +3736,7 @@ var pusher_authorizer_PusherAuthorizer = (function () { function PusherAuthorizer(channel, options) { this.channel = channel; var authTransport = options.authTransport; - if (typeof worker_runtime.getAuthorizers()[authTransport] === "undefined") { + if (typeof worker_runtime.getAuthorizers()[authTransport] === 'undefined') { throw "'" + authTransport + "' is not a recognized auth transport"; } this.type = authTransport; @@ -3715,16 +3744,23 @@ var pusher_authorizer_PusherAuthorizer = (function () { this.authOptions = (options || {}).auth || {}; } PusherAuthorizer.prototype.composeQuery = function (socketId) { - var query = 'socket_id=' + encodeURIComponent(socketId) + - '&channel_name=' + encodeURIComponent(this.channel.name); + var query = 'socket_id=' + + encodeURIComponent(socketId) + + '&channel_name=' + + encodeURIComponent(this.channel.name); for (var i in this.authOptions.params) { - query += "&" + encodeURIComponent(i) + "=" + encodeURIComponent(this.authOptions.params[i]); + query += + '&' + + encodeURIComponent(i) + + '=' + + encodeURIComponent(this.authOptions.params[i]); } return query; }; PusherAuthorizer.prototype.authorize = function (socketId, callback) { - PusherAuthorizer.authorizers = PusherAuthorizer.authorizers || worker_runtime.getAuthorizers(); - return PusherAuthorizer.authorizers[this.type].call(this, worker_runtime, socketId, callback); + PusherAuthorizer.authorizers = + PusherAuthorizer.authorizers || worker_runtime.getAuthorizers(); + PusherAuthorizer.authorizers[this.type].call(this, worker_runtime, socketId, callback); }; return PusherAuthorizer; }()); @@ -3841,24 +3877,24 @@ var UnsupportedStrategy = (function (_super) { // CONCATENATED MODULE: ./src/core/utils/url_store.ts var urlStore = { - baseUrl: "https://pusher.com", + baseUrl: 'https://pusher.com', urls: { authenticationEndpoint: { - path: "/docs/authenticating_users", + path: '/docs/authenticating_users' }, javascriptQuickStart: { - path: "/docs/javascript_quick_start" + path: '/docs/javascript_quick_start' }, triggeringClientEvents: { - path: "/docs/client_api_guide/client_events#trigger-events" + path: '/docs/client_api_guide/client_events#trigger-events' } } }; var buildLogSuffix = function (key) { - var urlPrefix = "See:"; + var urlPrefix = 'See:'; var urlObj = urlStore.urls[key]; if (!urlObj) - return ""; + return ''; var url; if (urlObj.fullUrl) { url = urlObj.fullUrl; @@ -3867,7 +3903,7 @@ var buildLogSuffix = function (key) { url = urlStore.baseUrl + urlObj.path; } if (!url) - return ""; + return ''; return urlPrefix + " " + url; }; /* harmony default export */ var url_store = ({ buildLogSuffix: buildLogSuffix }); @@ -3904,14 +3940,14 @@ var channel_Channel = (function (_super) { return _this; } Channel.prototype.authorize = function (socketId, callback) { - return callback(false, {}); + return callback(false, { auth: '' }); }; Channel.prototype.trigger = function (event, data) { - if (event.indexOf("client-") !== 0) { + if (event.indexOf('client-') !== 0) { throw new BadEventName("Event '" + event + "' does not start with 'client-'"); } if (!this.subscribed) { - var suffix = url_store.buildLogSuffix("triggeringClientEvents"); + var suffix = url_store.buildLogSuffix('triggeringClientEvents'); logger.warn("Client event triggered before channel 'subscription_succeeded' event . " + suffix); } return this.pusher.send_event(event, data, this.name); @@ -3923,10 +3959,10 @@ var channel_Channel = (function (_super) { Channel.prototype.handleEvent = function (event) { var eventName = event.event; var data = event.data; - if (eventName === "pusher_internal:subscription_succeeded") { + if (eventName === 'pusher_internal:subscription_succeeded') { this.handleSubscriptionSucceededEvent(event); } - else if (eventName.indexOf("pusher_internal:") !== 0) { + else if (eventName.indexOf('pusher_internal:') !== 0) { var metadata = {}; this.emit(eventName, data, metadata); } @@ -3938,7 +3974,7 @@ var channel_Channel = (function (_super) { this.pusher.unsubscribe(this.name); } else { - this.emit("pusher:subscription_succeeded", event.data); + this.emit('pusher:subscription_succeeded', event.data); } }; Channel.prototype.subscribe = function () { @@ -3954,6 +3990,7 @@ var channel_Channel = (function (_super) { _this.emit('pusher:subscription_error', data); } else { + data = data; _this.pusher.send_event('pusher:subscribe', { auth: data.auth, channel_data: data.channel_data, @@ -4092,11 +4129,12 @@ var presence_channel_PresenceChannel = (function (_super) { var _this = this; _super.prototype.authorize.call(this, socketId, function (error, authData) { if (!error) { + authData = authData; if (authData.channel_data === undefined) { - var suffix = url_store.buildLogSuffix("authenticationEndpoint"); + var suffix = url_store.buildLogSuffix('authenticationEndpoint'); logger.error("Invalid auth response for channel '" + _this.name + "'," + ("expected 'channel_data' field. " + suffix)); - callback("Invalid auth response"); + callback('Invalid auth response'); return; } var channelData = JSON.parse(authData.channel_data); @@ -4107,7 +4145,7 @@ var presence_channel_PresenceChannel = (function (_super) { }; PresenceChannel.prototype.handleEvent = function (event) { var eventName = event.event; - if (eventName.indexOf("pusher_internal:") === 0) { + if (eventName.indexOf('pusher_internal:') === 0) { this.handleInternalEvent(event); } else { @@ -4123,14 +4161,14 @@ var presence_channel_PresenceChannel = (function (_super) { var eventName = event.event; var data = event.data; switch (eventName) { - case "pusher_internal:subscription_succeeded": + case 'pusher_internal:subscription_succeeded': this.handleSubscriptionSucceededEvent(event); break; - case "pusher_internal:member_added": + case 'pusher_internal:member_added': var addedMember = this.members.addMember(data); this.emit('pusher:member_added', addedMember); break; - case "pusher_internal:member_removed": + case 'pusher_internal:member_removed': var removedMember = this.members.removeMember(data); if (removedMember) { this.emit('pusher:member_removed', removedMember); @@ -4146,7 +4184,7 @@ var presence_channel_PresenceChannel = (function (_super) { } else { this.members.onSubscription(event.data); - this.emit("pusher:subscription_succeeded", this.members); + this.emit('pusher:subscription_succeeded', this.members); } }; PresenceChannel.prototype.disconnect = function () { @@ -4196,14 +4234,14 @@ var encrypted_channel_EncryptedChannel = (function (_super) { callback(true, authData); return; } - var sharedSecret = authData["shared_secret"]; + var sharedSecret = authData['shared_secret']; if (!sharedSecret) { var errorMsg = "No shared_secret key in auth payload for encrypted channel: " + _this.name; callback(true, errorMsg); return; } _this.key = Object(nacl_util["decodeBase64"])(sharedSecret); - delete authData["shared_secret"]; + delete authData['shared_secret']; callback(false, authData); }); }; @@ -4213,7 +4251,8 @@ var encrypted_channel_EncryptedChannel = (function (_super) { EncryptedChannel.prototype.handleEvent = function (event) { var eventName = event.event; var data = event.data; - if (eventName.indexOf("pusher_internal:") === 0 || eventName.indexOf("pusher:") === 0) { + if (eventName.indexOf('pusher_internal:') === 0 || + eventName.indexOf('pusher:') === 0) { _super.prototype.handleEvent.call(this, event); return; } @@ -4226,7 +4265,8 @@ var encrypted_channel_EncryptedChannel = (function (_super) { return; } if (!data.ciphertext || !data.nonce) { - logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + data); + logger.error('Unexpected format for encrypted event, expected object with `ciphertext` and `nonce` fields, got: ' + + data); return; } var cipherText = Object(nacl_util["decodeBase64"])(data.ciphertext); @@ -4297,7 +4337,7 @@ var connection_manager_ConnectionManager = (function (_super) { var _this = _super.call(this) || this; _this.key = key; _this.options = options || {}; - _this.state = "initialized"; + _this.state = 'initialized'; _this.connection = null; _this.usingTLS = !!options.useTLS; _this.timeline = _this.options.timeline; @@ -4305,14 +4345,14 @@ var connection_manager_ConnectionManager = (function (_super) { _this.connectionCallbacks = _this.buildConnectionCallbacks(_this.errorCallbacks); _this.handshakeCallbacks = _this.buildHandshakeCallbacks(_this.errorCallbacks); var Network = worker_runtime.getNetwork(); - Network.bind("online", function () { - _this.timeline.info({ netinfo: "online" }); - if (_this.state === "connecting" || _this.state === "unavailable") { + Network.bind('online', function () { + _this.timeline.info({ netinfo: 'online' }); + if (_this.state === 'connecting' || _this.state === 'unavailable') { _this.retryIn(0); } }); - Network.bind("offline", function () { - _this.timeline.info({ netinfo: "offline" }); + Network.bind('offline', function () { + _this.timeline.info({ netinfo: 'offline' }); if (_this.connection) { _this.sendActivityCheck(); } @@ -4325,14 +4365,13 @@ var connection_manager_ConnectionManager = (function (_super) { return; } if (!this.strategy.isSupported()) { - this.updateState("failed"); + this.updateState('failed'); return; } - this.updateState("connecting"); + this.updateState('connecting'); this.startConnecting(); this.setUnavailableTimer(); }; - ; ConnectionManager.prototype.send = function (data) { if (this.connection) { return this.connection.send(data); @@ -4341,7 +4380,6 @@ var connection_manager_ConnectionManager = (function (_super) { return false; } }; - ; ConnectionManager.prototype.send_event = function (name, data, channel) { if (this.connection) { return this.connection.send_event(name, data, channel); @@ -4350,16 +4388,13 @@ var connection_manager_ConnectionManager = (function (_super) { return false; } }; - ; ConnectionManager.prototype.disconnect = function () { this.disconnectInternally(); - this.updateState("disconnected"); + this.updateState('disconnected'); }; - ; ConnectionManager.prototype.isUsingTLS = function () { return this.usingTLS; }; - ; ConnectionManager.prototype.startConnecting = function () { var _this = this; var callback = function (error, handshake) { @@ -4367,8 +4402,11 @@ var connection_manager_ConnectionManager = (function (_super) { _this.runner = _this.strategy.connect(0, callback); } else { - if (handshake.action === "error") { - _this.emit("error", { type: "HandshakeError", error: handshake.error }); + if (handshake.action === 'error') { + _this.emit('error', { + type: 'HandshakeError', + error: handshake.error + }); _this.timeline.error({ handshakeError: handshake.error }); } else { @@ -4379,14 +4417,12 @@ var connection_manager_ConnectionManager = (function (_super) { }; this.runner = this.strategy.connect(0, callback); }; - ; ConnectionManager.prototype.abortConnecting = function () { if (this.runner) { this.runner.abort(); this.runner = null; } }; - ; ConnectionManager.prototype.disconnectInternally = function () { this.abortConnecting(); this.clearRetryTimer(); @@ -4396,7 +4432,6 @@ var connection_manager_ConnectionManager = (function (_super) { connection.close(); } }; - ; ConnectionManager.prototype.updateStrategy = function () { this.strategy = this.options.getStrategy({ key: this.key, @@ -4404,39 +4439,34 @@ var connection_manager_ConnectionManager = (function (_super) { useTLS: this.usingTLS }); }; - ; ConnectionManager.prototype.retryIn = function (delay) { var _this = this; - this.timeline.info({ action: "retry", delay: delay }); + this.timeline.info({ action: 'retry', delay: delay }); if (delay > 0) { - this.emit("connecting_in", Math.round(delay / 1000)); + this.emit('connecting_in', Math.round(delay / 1000)); } this.retryTimer = new OneOffTimer(delay || 0, function () { _this.disconnectInternally(); _this.connect(); }); }; - ; ConnectionManager.prototype.clearRetryTimer = function () { if (this.retryTimer) { this.retryTimer.ensureAborted(); this.retryTimer = null; } }; - ; ConnectionManager.prototype.setUnavailableTimer = function () { var _this = this; this.unavailableTimer = new OneOffTimer(this.options.unavailableTimeout, function () { - _this.updateState("unavailable"); + _this.updateState('unavailable'); }); }; - ; ConnectionManager.prototype.clearUnavailableTimer = function () { if (this.unavailableTimer) { this.unavailableTimer.ensureAborted(); } }; - ; ConnectionManager.prototype.sendActivityCheck = function () { var _this = this; this.stopActivityCheck(); @@ -4446,7 +4476,6 @@ var connection_manager_ConnectionManager = (function (_super) { _this.retryIn(0); }); }; - ; ConnectionManager.prototype.resetActivityCheck = function () { var _this = this; this.stopActivityCheck(); @@ -4456,13 +4485,11 @@ var connection_manager_ConnectionManager = (function (_super) { }); } }; - ; ConnectionManager.prototype.stopActivityCheck = function () { if (this.activityTimer) { this.activityTimer.ensureAborted(); } }; - ; ConnectionManager.prototype.buildConnectionCallbacks = function (errorCallbacks) { var _this = this; return extend({}, errorCallbacks, { @@ -4477,7 +4504,7 @@ var connection_manager_ConnectionManager = (function (_super) { _this.resetActivityCheck(); }, error: function (error) { - _this.emit("error", { type: "WebSocketError", error: error }); + _this.emit('error', { type: 'WebSocketError', error: error }); }, closed: function () { _this.abandonConnection(); @@ -4487,7 +4514,6 @@ var connection_manager_ConnectionManager = (function (_super) { } }); }; - ; ConnectionManager.prototype.buildHandshakeCallbacks = function (errorCallbacks) { var _this = this; return extend({}, errorCallbacks, { @@ -4496,17 +4522,16 @@ var connection_manager_ConnectionManager = (function (_super) { _this.clearUnavailableTimer(); _this.setConnection(handshake.connection); _this.socket_id = _this.connection.id; - _this.updateState("connected", { socket_id: _this.socket_id }); + _this.updateState('connected', { socket_id: _this.socket_id }); } }); }; - ; ConnectionManager.prototype.buildErrorCallbacks = function () { var _this = this; var withErrorEmitted = function (callback) { return function (result) { if (result.error) { - _this.emit("error", { type: "WebSocketError", error: result.error }); + _this.emit('error', { type: 'WebSocketError', error: result.error }); } callback(result); }; @@ -4528,7 +4553,6 @@ var connection_manager_ConnectionManager = (function (_super) { }) }; }; - ; ConnectionManager.prototype.setConnection = function (connection) { this.connection = connection; for (var event in this.connectionCallbacks) { @@ -4536,7 +4560,6 @@ var connection_manager_ConnectionManager = (function (_super) { } this.resetActivityCheck(); }; - ; ConnectionManager.prototype.abandonConnection = function () { if (!this.connection) { return; @@ -4554,8 +4577,8 @@ var connection_manager_ConnectionManager = (function (_super) { this.state = newState; if (previousState !== newState) { var newStateDescription = newState; - if (newStateDescription === "connected") { - newStateDescription += " with new socket ID " + data.socket_id; + if (newStateDescription === 'connected') { + newStateDescription += ' with new socket ID ' + data.socket_id; } logger.debug('State changed', previousState + ' -> ' + newStateDescription); this.timeline.info({ state: newState, params: data }); @@ -4564,7 +4587,7 @@ var connection_manager_ConnectionManager = (function (_super) { } }; ConnectionManager.prototype.shouldRetry = function () { - return this.state === "connecting" || this.state === "connected"; + return this.state === 'connecting' || this.state === 'connected'; }; return ConnectionManager; }(dispatcher)); @@ -4703,7 +4726,7 @@ var sequential_strategy_SequentialStrategy = (function () { this.timeoutLimit = options.timeoutLimit; } SequentialStrategy.prototype.isSupported = function () { - return any(this.strategies, util.method("isSupported")); + return any(this.strategies, util.method('isSupported')); }; SequentialStrategy.prototype.connect = function (minPriority, callback) { var _this = this; @@ -4789,7 +4812,7 @@ var best_connected_ever_strategy_BestConnectedEverStrategy = (function () { this.strategies = strategies; } BestConnectedEverStrategy.prototype.isSupported = function () { - return any(this.strategies, util.method("isSupported")); + return any(this.strategies, util.method('isSupported')); }; BestConnectedEverStrategy.prototype.connect = function (minPriority, callback) { return connect(this.strategies, minPriority, function (i, runners) { @@ -4873,7 +4896,9 @@ var cached_strategy_CachedStrategy = (function () { } } var startTimestamp = util.now(); - var runner = strategies.pop().connect(minPriority, function cb(error, handshake) { + var runner = strategies + .pop() + .connect(minPriority, function cb(error, handshake) { if (error) { flushTransportCache(usingTLS); if (strategies.length > 0) { @@ -4905,7 +4930,7 @@ var cached_strategy_CachedStrategy = (function () { }()); /* harmony default export */ var cached_strategy = (cached_strategy_CachedStrategy); function getTransportCacheKey(usingTLS) { - return "pusherTransport" + (usingTLS ? "TLS" : "NonTLS"); + return 'pusherTransport' + (usingTLS ? 'TLS' : 'NonTLS'); } function fetchTransportCache(usingTLS) { var storage = worker_runtime.getLocalStorage(); @@ -5045,16 +5070,16 @@ var getDefaultStrategy = function (config, defineTransport) { return transport; } var ws_options = { - hostNonTLS: config.wsHost + ":" + config.wsPort, - hostTLS: config.wsHost + ":" + config.wssPort, + hostNonTLS: config.wsHost + ':' + config.wsPort, + hostTLS: config.wsHost + ':' + config.wssPort, httpPath: config.wsPath }; var wss_options = extend({}, ws_options, { useTLS: true }); var http_options = { - hostNonTLS: config.httpHost + ":" + config.httpPort, - hostTLS: config.httpHost + ":" + config.httpsPort, + hostNonTLS: config.httpHost + ':' + config.httpPort, + hostTLS: config.httpHost + ':' + config.httpsPort, httpPath: config.httpPath }; var timeouts = { @@ -5072,18 +5097,26 @@ var getDefaultStrategy = function (config, defineTransport) { minPingDelay: 10000, maxPingDelay: config.activity_timeout }); - var ws_transport = defineTransportStrategy("ws", "ws", 3, ws_options, ws_manager); - var wss_transport = defineTransportStrategy("wss", "ws", 3, wss_options, ws_manager); - var xhr_streaming_transport = defineTransportStrategy("xhr_streaming", "xhr_streaming", 1, http_options, streaming_manager); - var xhr_polling_transport = defineTransportStrategy("xhr_polling", "xhr_polling", 1, http_options); + var ws_transport = defineTransportStrategy('ws', 'ws', 3, ws_options, ws_manager); + var wss_transport = defineTransportStrategy('wss', 'ws', 3, wss_options, ws_manager); + var xhr_streaming_transport = defineTransportStrategy('xhr_streaming', 'xhr_streaming', 1, http_options, streaming_manager); + var xhr_polling_transport = defineTransportStrategy('xhr_polling', 'xhr_polling', 1, http_options); var ws_loop = new sequential_strategy([ws_transport], timeouts); var wss_loop = new sequential_strategy([wss_transport], timeouts); var streaming_loop = new sequential_strategy([xhr_streaming_transport], timeouts); var polling_loop = new sequential_strategy([xhr_polling_transport], timeouts); - var http_loop = new sequential_strategy([new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([streaming_loop, new delayed_strategy(polling_loop, { delay: 4000 })]), polling_loop)], timeouts); + var http_loop = new sequential_strategy([ + new if_strategy(testSupportsStrategy(streaming_loop), new best_connected_ever_strategy([ + streaming_loop, + new delayed_strategy(polling_loop, { delay: 4000 }) + ]), polling_loop) + ], timeouts); var wsStrategy; if (config.useTLS) { - wsStrategy = new best_connected_ever_strategy([ws_loop, new delayed_strategy(http_loop, { delay: 2000 })]); + wsStrategy = new best_connected_ever_strategy([ + ws_loop, + new delayed_strategy(http_loop, { delay: 2000 }) + ]); } else { wsStrategy = new best_connected_ever_strategy([ @@ -5104,10 +5137,10 @@ var getDefaultStrategy = function (config, defineTransport) { /* harmony default export */ var transport_connection_initializer = (function () { var self = this; self.timeline.info(self.buildTimelineMessage({ - transport: self.name + (self.options.useTLS ? "s" : "") + transport: self.name + (self.options.useTLS ? 's' : '') })); if (self.hooks.isInitialized()) { - self.changeState("initialized"); + self.changeState('initialized'); } else { self.onClose(); @@ -5150,7 +5183,7 @@ var http_request_HTTPRequest = (function (_super) { worker_runtime.addUnloadListener(this.unloader); this.xhr.open(this.method, this.url, true); if (this.xhr.setRequestHeader) { - this.xhr.setRequestHeader("Content-Type", "application/json"); + this.xhr.setRequestHeader('Content-Type', 'application/json'); } this.xhr.send(payload); }; @@ -5168,19 +5201,19 @@ var http_request_HTTPRequest = (function (_super) { while (true) { var chunk = this.advanceBuffer(data); if (chunk) { - this.emit("chunk", { status: status, data: chunk }); + this.emit('chunk', { status: status, data: chunk }); } else { break; } } if (this.isBufferTooLong(data)) { - this.emit("buffer_too_long"); + this.emit('buffer_too_long'); } }; HTTPRequest.prototype.advanceBuffer = function (buffer) { var unreadData = buffer.slice(this.position); - var endOfLinePosition = unreadData.indexOf("\n"); + var endOfLinePosition = unreadData.indexOf('\n'); if (endOfLinePosition !== -1) { this.position += endOfLinePosition + 1; return unreadData.slice(0, endOfLinePosition); @@ -5213,7 +5246,7 @@ var autoIncrement = 1; var http_socket_HTTPSocket = (function () { function HTTPSocket(hooks, url) { this.hooks = hooks; - this.session = randomNumber(1000) + "/" + randomString(8); + this.session = randomNumber(1000) + '/' + randomString(8); this.location = getLocation(url); this.readyState = state.CONNECTING; this.openStream(); @@ -5230,7 +5263,7 @@ var http_socket_HTTPSocket = (function () { HTTPSocket.prototype.sendRaw = function (payload) { if (this.readyState === state.OPEN) { try { - worker_runtime.createSocketRequest("POST", getUniqueURL(getSendURL(this.location, this.session))).start(payload); + worker_runtime.createSocketRequest('POST', getUniqueURL(getSendURL(this.location, this.session))).start(payload); return true; } catch (e) { @@ -5245,7 +5278,6 @@ var http_socket_HTTPSocket = (function () { this.closeStream(); this.openStream(); }; - ; HTTPSocket.prototype.onClose = function (code, reason, wasClean) { this.closeStream(); this.readyState = state.CLOSED; @@ -5301,7 +5333,7 @@ var http_socket_HTTPSocket = (function () { } } else { - this.onClose(1006, "Server lost session", true); + this.onClose(1006, 'Server lost session', true); } }; HTTPSocket.prototype.onEvent = function (event) { @@ -5321,14 +5353,14 @@ var http_socket_HTTPSocket = (function () { }; HTTPSocket.prototype.openStream = function () { var _this = this; - this.stream = worker_runtime.createSocketRequest("POST", getUniqueURL(this.hooks.getReceiveURL(this.location, this.session))); - this.stream.bind("chunk", function (chunk) { + this.stream = worker_runtime.createSocketRequest('POST', getUniqueURL(this.hooks.getReceiveURL(this.location, this.session))); + this.stream.bind('chunk', function (chunk) { _this.onChunk(chunk); }); - this.stream.bind("finished", function (status) { + this.stream.bind('finished', function (status) { _this.hooks.onFinished(_this, status); }); - this.stream.bind("buffer_too_long", function () { + this.stream.bind('buffer_too_long', function () { _this.reconnect(); }); try { @@ -5337,7 +5369,7 @@ var http_socket_HTTPSocket = (function () { catch (error) { util.defer(function () { _this.onError(error); - _this.onClose(1006, "Could not start streaming", false); + _this.onClose(1006, 'Could not start streaming', false); }); } }; @@ -5358,11 +5390,11 @@ function getLocation(url) { }; } function getSendURL(url, session) { - return url.base + "/" + session + "/xhr_send"; + return url.base + '/' + session + '/xhr_send'; } function getUniqueURL(url) { - var separator = (url.indexOf('?') === -1) ? "?" : "&"; - return url + separator + "t=" + (+new Date()) + "&n=" + autoIncrement++; + var separator = url.indexOf('?') === -1 ? '?' : '&'; + return url + separator + 't=' + +new Date() + '&n=' + autoIncrement++; } function replaceHost(url, hostname) { var urlParts = /(https?:\/\/)([^\/:]+)((\/|:)?.*)/.exec(url); @@ -5383,16 +5415,16 @@ function randomString(length) { // CONCATENATED MODULE: ./src/core/http/http_streaming_socket.ts var http_streaming_socket_hooks = { getReceiveURL: function (url, session) { - return url.base + "/" + session + "/xhr_streaming" + url.queryString; + return url.base + '/' + session + '/xhr_streaming' + url.queryString; }, onHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, sendHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, onFinished: function (socket, status) { - socket.onClose(1006, "Connection interrupted (" + status + ")", false); + socket.onClose(1006, 'Connection interrupted (' + status + ')', false); } }; /* harmony default export */ var http_streaming_socket = (http_streaming_socket_hooks); @@ -5400,19 +5432,19 @@ var http_streaming_socket_hooks = { // CONCATENATED MODULE: ./src/core/http/http_polling_socket.ts var http_polling_socket_hooks = { getReceiveURL: function (url, session) { - return url.base + "/" + session + "/xhr" + url.queryString; + return url.base + '/' + session + '/xhr' + url.queryString; }, onHeartbeat: function () { }, sendHeartbeat: function (socket) { - socket.sendRaw("[]"); + socket.sendRaw('[]'); }, onFinished: function (socket, status) { if (status === 200) { socket.reconnect(); } else { - socket.onClose(1006, "Connection interrupted (" + status + ")", false); + socket.onClose(1006, 'Connection interrupted (' + status + ')', false); } } }; @@ -5435,7 +5467,7 @@ var http_xhr_request_hooks = { if (xhr.responseText && xhr.responseText.length > 0) { socket.onChunk(xhr.status, xhr.responseText); } - socket.emit("finished", xhr.status); + socket.emit('finished', xhr.status); socket.close(); break; } @@ -5492,10 +5524,12 @@ var Isomorphic = { return undefined; }, getClientFeatures: function () { - return keys(filterObject({ "ws": transports.ws }, function (t) { return t.isSupported({}); })); + return keys(filterObject({ ws: transports.ws }, function (t) { + return t.isSupported({}); + })); }, getProtocol: function () { - return "http:"; + return 'http:'; }, isXHRSupported: function () { return true; @@ -5505,7 +5539,7 @@ var Isomorphic = { return this.HTTPFactory.createXHR(method, url); } else { - throw "Cross-origin HTTP requests are not supported"; + throw 'Cross-origin HTTP requests are not supported'; } }, createXHR: function () { @@ -5553,7 +5587,7 @@ var net_info_Network = new NetInfo(); var fetchAuth = function (context, socketId, callback) { var headers = new Headers(); - headers.set("Content-Type", "application/x-www-form-urlencoded"); + headers.set('Content-Type', 'application/x-www-form-urlencoded'); for (var headerName in this.authOptions.headers) { headers.set(headerName, this.authOptions.headers[headerName]); } @@ -5561,10 +5595,11 @@ var fetchAuth = function (context, socketId, callback) { var request = new Request(this.options.authEndpoint, { headers: headers, body: body, - credentials: "same-origin", - method: "POST", + credentials: 'same-origin', + method: 'POST' }); - return fetch(request).then(function (response) { + return fetch(request) + .then(function (response) { var status = response.status; if (status === 200) { return response.text(); @@ -5573,12 +5608,14 @@ var fetchAuth = function (context, socketId, callback) { logger.error("Couldn't get auth info from your auth endpoint", status); throw status; } - }).then(function (data) { + }) + .then(function (data) { try { data = JSON.parse(data); } catch (e) { - var message = 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + data; + var message = 'JSON returned from auth endpoint was invalid, yet status code was 200. Data was: ' + + data; logger.error(message); throw message; } @@ -5594,23 +5631,24 @@ var fetchAuth = function (context, socketId, callback) { var getAgent = function (sender, useTLS) { return function (data, callback) { - var scheme = "http" + (useTLS ? "s" : "") + "://"; + var scheme = 'http' + (useTLS ? 's' : '') + '://'; var url = scheme + (sender.host || sender.options.host) + sender.options.path; var query = buildQueryString(data); - url += ("/" + 2 + "?" + query); - fetch(url). - then(function (response) { + url += '/' + 2 + '?' + query; + fetch(url) + .then(function (response) { if (response.status !== 200) { - throw ("received " + response.status + " from stats.pusher.com"); + throw "received " + response.status + " from stats.pusher.com"; } return response.json(); - }).then(function (_a) { + }) + .then(function (_a) { var host = _a.host; if (host) { sender.host = host; } })["catch"](function (err) { - logger.debug("TimelineSender Error: ", err); + logger.debug('TimelineSender Error: ', err); }); }; }; @@ -5704,7 +5742,7 @@ var timeline_Timeline = (function () { session: this.session, bundle: this.sent + 1, key: this.key, - lib: "js", + lib: 'js', version: this.options.version, cluster: this.options.cluster, features: this.options.features, @@ -5758,7 +5796,7 @@ var transport_strategy_TransportStrategy = (function () { var transport = this.transport.createConnection(this.name, this.priority, this.options.key, this.options); var handshake = null; var onInitialized = function () { - transport.unbind("initialized", onInitialized); + transport.unbind('initialized', onInitialized); transport.connect(); }; var onOpen = function () { @@ -5779,15 +5817,15 @@ var transport_strategy_TransportStrategy = (function () { callback(new TransportClosed(serializedTransport)); }; var unbindListeners = function () { - transport.unbind("initialized", onInitialized); - transport.unbind("open", onOpen); - transport.unbind("error", onError); - transport.unbind("closed", onClosed); + transport.unbind('initialized', onInitialized); + transport.unbind('open', onOpen); + transport.unbind('error', onError); + transport.unbind('closed', onClosed); }; - transport.bind("initialized", onInitialized); - transport.bind("open", onOpen); - transport.bind("error", onError); - transport.bind("closed", onClosed); + transport.bind('initialized', onInitialized); + transport.bind('open', onOpen); + transport.bind('error', onError); + transport.bind('closed', onClosed); transport.initialize(); return { abort: function () { @@ -5926,6 +5964,12 @@ var pusher_Pusher = (function () { var suffix = url_store.buildLogSuffix('javascriptQuickStart'); logger.warn("You should always specify a cluster when connecting. " + suffix); } + if ('disableStats' in options) { + logger.warn('The disableStats option is deprecated in favor of enableStats'); + if (!('enableStats' in options)) { + options.enableStats = !options.disableStats; + } + } this.key = app_key; this.config = extend(getGlobalConfig(), options.cluster ? getClusterConfig(options.cluster) : {}, options); this.channels = factory.createChannels(); @@ -5939,7 +5983,7 @@ var pusher_Pusher = (function () { level: timeline_level.INFO, version: defaults.VERSION }); - if (!this.config.disableStats) { + if (this.config.enableStats) { this.timelineSender = factory.createTimelineSender(this.timeline, { host: this.config.statsHost, path: '/timeline/v2/' + worker_runtime.TimelineTransport.name diff --git a/dist/worker/pusher.worker.min.js b/dist/worker/pusher.worker.min.js index 21ef3b6a3..ee5ae57da 100644 --- a/dist/worker/pusher.worker.min.js +++ b/dist/worker/pusher.worker.min.js @@ -1,8 +1,8 @@ /*! - * Pusher JavaScript Library v5.0.3 + * Pusher JavaScript Library v5.1.0 * https://pusher.com/ * * Copyright 2017, Pusher * Released under the MIT licence. */ -var Pusher=function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=2)}([function(t,e,n){!function(t){"use strict";var e=function(t){var e,n=new Float64Array(16);if(t)for(e=0;e>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n,t[e+4]=r>>24&255,t[e+5]=r>>16&255,t[e+6]=r>>8&255,t[e+7]=255&r}function y(t,e,n,r,o){var i,s=0;for(i=0;i>>8)-1}function b(t,e,n,r){return y(t,e,n,r,16)}function g(t,e,n,r){return y(t,e,n,r,32)}function v(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,p=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,b=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,S=s,k=c,T=a,O=u,C=h,A=f,P=p,E=l,x=d,L=y,U=b,M=g,R=v,j=m,I=_,N=0;N<20;N+=2)w^=(o=(M^=(o=(E^=(o=(O^=(o=w+M|0)<<7|o>>>25)+w|0)<<9|o>>>23)+O|0)<<13|o>>>19)+E|0)<<18|o>>>14,C^=(o=(S^=(o=(R^=(o=(x^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+R|0)<<18|o>>>14,L^=(o=(A^=(o=(k^=(o=(j^=(o=L+A|0)<<7|o>>>25)+L|0)<<9|o>>>23)+j|0)<<13|o>>>19)+k|0)<<18|o>>>14,I^=(o=(U^=(o=(P^=(o=(T^=(o=I+U|0)<<7|o>>>25)+I|0)<<9|o>>>23)+T|0)<<13|o>>>19)+P|0)<<18|o>>>14,w^=(o=(T^=(o=(k^=(o=(S^=(o=w+T|0)<<7|o>>>25)+w|0)<<9|o>>>23)+S|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(O^=(o=(P^=(o=(A^=(o=C+O|0)<<7|o>>>25)+C|0)<<9|o>>>23)+A|0)<<13|o>>>19)+P|0)<<18|o>>>14,L^=(o=(x^=(o=(E^=(o=(U^=(o=L+x|0)<<7|o>>>25)+L|0)<<9|o>>>23)+U|0)<<13|o>>>19)+E|0)<<18|o>>>14,I^=(o=(j^=(o=(R^=(o=(M^=(o=I+j|0)<<7|o>>>25)+I|0)<<9|o>>>23)+M|0)<<13|o>>>19)+R|0)<<18|o>>>14;w=w+i|0,S=S+s|0,k=k+c|0,T=T+a|0,O=O+u|0,C=C+h|0,A=A+f|0,P=P+p|0,E=E+l|0,x=x+d|0,L=L+y|0,U=U+b|0,M=M+g|0,R=R+v|0,j=j+m|0,I=I+_|0,t[0]=w>>>0&255,t[1]=w>>>8&255,t[2]=w>>>16&255,t[3]=w>>>24&255,t[4]=S>>>0&255,t[5]=S>>>8&255,t[6]=S>>>16&255,t[7]=S>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=T>>>0&255,t[13]=T>>>8&255,t[14]=T>>>16&255,t[15]=T>>>24&255,t[16]=O>>>0&255,t[17]=O>>>8&255,t[18]=O>>>16&255,t[19]=O>>>24&255,t[20]=C>>>0&255,t[21]=C>>>8&255,t[22]=C>>>16&255,t[23]=C>>>24&255,t[24]=A>>>0&255,t[25]=A>>>8&255,t[26]=A>>>16&255,t[27]=A>>>24&255,t[28]=P>>>0&255,t[29]=P>>>8&255,t[30]=P>>>16&255,t[31]=P>>>24&255,t[32]=E>>>0&255,t[33]=E>>>8&255,t[34]=E>>>16&255,t[35]=E>>>24&255,t[36]=x>>>0&255,t[37]=x>>>8&255,t[38]=x>>>16&255,t[39]=x>>>24&255,t[40]=L>>>0&255,t[41]=L>>>8&255,t[42]=L>>>16&255,t[43]=L>>>24&255,t[44]=U>>>0&255,t[45]=U>>>8&255,t[46]=U>>>16&255,t[47]=U>>>24&255,t[48]=M>>>0&255,t[49]=M>>>8&255,t[50]=M>>>16&255,t[51]=M>>>24&255,t[52]=R>>>0&255,t[53]=R>>>8&255,t[54]=R>>>16&255,t[55]=R>>>24&255,t[56]=j>>>0&255,t[57]=j>>>8&255,t[58]=j>>>16&255,t[59]=j>>>24&255,t[60]=I>>>0&255,t[61]=I>>>8&255,t[62]=I>>>16&255,t[63]=I>>>24&255}(t,e,n,r)}function m(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,p=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,b=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,g=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,v=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=0;w<20;w+=2)i^=(o=(g^=(o=(l^=(o=(u^=(o=i+g|0)<<7|o>>>25)+i|0)<<9|o>>>23)+u|0)<<13|o>>>19)+l|0)<<18|o>>>14,h^=(o=(s^=(o=(v^=(o=(d^=(o=h+s|0)<<7|o>>>25)+h|0)<<9|o>>>23)+d|0)<<13|o>>>19)+v|0)<<18|o>>>14,y^=(o=(f^=(o=(c^=(o=(m^=(o=y+f|0)<<7|o>>>25)+y|0)<<9|o>>>23)+m|0)<<13|o>>>19)+c|0)<<18|o>>>14,_^=(o=(b^=(o=(p^=(o=(a^=(o=_+b|0)<<7|o>>>25)+_|0)<<9|o>>>23)+a|0)<<13|o>>>19)+p|0)<<18|o>>>14,i^=(o=(a^=(o=(c^=(o=(s^=(o=i+a|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+c|0)<<18|o>>>14,h^=(o=(u^=(o=(p^=(o=(f^=(o=h+u|0)<<7|o>>>25)+h|0)<<9|o>>>23)+f|0)<<13|o>>>19)+p|0)<<18|o>>>14,y^=(o=(d^=(o=(l^=(o=(b^=(o=y+d|0)<<7|o>>>25)+y|0)<<9|o>>>23)+b|0)<<13|o>>>19)+l|0)<<18|o>>>14,_^=(o=(m^=(o=(v^=(o=(g^=(o=_+m|0)<<7|o>>>25)+_|0)<<9|o>>>23)+g|0)<<13|o>>>19)+v|0)<<18|o>>>14;t[0]=i>>>0&255,t[1]=i>>>8&255,t[2]=i>>>16&255,t[3]=i>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=_>>>0&255,t[13]=_>>>8&255,t[14]=_>>>16&255,t[15]=_>>>24&255,t[16]=f>>>0&255,t[17]=f>>>8&255,t[18]=f>>>16&255,t[19]=f>>>24&255,t[20]=p>>>0&255,t[21]=p>>>8&255,t[22]=p>>>16&255,t[23]=p>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255}(t,e,n,r)}var _=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(t,e,n,r,o,i,s){var c,a,u=new Uint8Array(16),h=new Uint8Array(64);for(a=0;a<16;a++)u[a]=0;for(a=0;a<8;a++)u[a]=i[a];for(;o>=64;){for(v(h,u,s,_),a=0;a<64;a++)t[e+a]=n[r+a]^h[a];for(c=1,a=8;a<16;a++)c=c+(255&u[a])|0,u[a]=255&c,c>>>=8;o-=64,e+=64,r+=64}if(o>0)for(v(h,u,s,_),a=0;a=64;){for(v(a,c,o,_),s=0;s<64;s++)t[e+s]=a[s];for(i=1,s=8;s<16;s++)i=i+(255&c[s])|0,c[s]=255&i,i>>>=8;n-=64,e+=64}if(n>0)for(v(a,c,o,_),s=0;s>>13|n<<3),r=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&t[8]|(255&t[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(i>>>14|s<<2),c=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|c<<5),a=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(c>>>8|a<<8),this.r[9]=a>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function C(t,e,n,r,o,i){var s=new O(i);return s.update(n,r,o),s.finish(t,e),0}function A(t,e,n,r,o,i){var s=new Uint8Array(16);return C(s,0,n,r,o,i),b(t,e,s,0)}function P(t,e,n,r,o){var i;if(n<32)return-1;for(T(t,0,e,0,n,r,o),C(t,16,t,32,n-32,t),i=0;i<16;i++)t[i]=0;return 0}function E(t,e,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==A(e,16,e,32,n-32,s))return-1;for(T(t,0,e,0,n,r,o),i=0;i<32;i++)t[i]=0;return 0}function x(t,e){var n;for(n=0;n<16;n++)t[n]=0|e[n]}function L(t){var e,n,r=1;for(e=0;e<16;e++)n=t[e]+r+65535,r=Math.floor(n/65536),t[e]=n-65536*r;t[0]+=r-1+37*(r-1)}function U(t,e,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(t[i]^e[i]),t[i]^=r,e[i]^=r}function M(t,n){var r,o,i,s=e(),c=e();for(r=0;r<16;r++)c[r]=n[r];for(L(c),L(c),L(c),o=0;o<2;o++){for(s[0]=c[0]-65517,r=1;r<15;r++)s[r]=c[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=c[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,U(c,s,1-i)}for(r=0;r<16;r++)t[2*r]=255&c[r],t[2*r+1]=c[r]>>8}function R(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return M(n,t),M(r,e),g(n,0,r,0)}function j(t){var e=new Uint8Array(32);return M(e,t),1&e[0]}function I(t,e){var n;for(n=0;n<16;n++)t[n]=e[2*n]+(e[2*n+1]<<8);t[15]&=32767}function N(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]+n[r]}function B(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]-n[r]}function z(t,e,n){var r,o,i=0,s=0,c=0,a=0,u=0,h=0,f=0,p=0,l=0,d=0,y=0,b=0,g=0,v=0,m=0,_=0,w=0,S=0,k=0,T=0,O=0,C=0,A=0,P=0,E=0,x=0,L=0,U=0,M=0,R=0,j=0,I=n[0],N=n[1],B=n[2],z=n[3],D=n[4],H=n[5],F=n[6],q=n[7],Y=n[8],K=n[9],J=n[10],W=n[11],X=n[12],G=n[13],Z=n[14],V=n[15];i+=(r=e[0])*I,s+=r*N,c+=r*B,a+=r*z,u+=r*D,h+=r*H,f+=r*F,p+=r*q,l+=r*Y,d+=r*K,y+=r*J,b+=r*W,g+=r*X,v+=r*G,m+=r*Z,_+=r*V,s+=(r=e[1])*I,c+=r*N,a+=r*B,u+=r*z,h+=r*D,f+=r*H,p+=r*F,l+=r*q,d+=r*Y,y+=r*K,b+=r*J,g+=r*W,v+=r*X,m+=r*G,_+=r*Z,w+=r*V,c+=(r=e[2])*I,a+=r*N,u+=r*B,h+=r*z,f+=r*D,p+=r*H,l+=r*F,d+=r*q,y+=r*Y,b+=r*K,g+=r*J,v+=r*W,m+=r*X,_+=r*G,w+=r*Z,S+=r*V,a+=(r=e[3])*I,u+=r*N,h+=r*B,f+=r*z,p+=r*D,l+=r*H,d+=r*F,y+=r*q,b+=r*Y,g+=r*K,v+=r*J,m+=r*W,_+=r*X,w+=r*G,S+=r*Z,k+=r*V,u+=(r=e[4])*I,h+=r*N,f+=r*B,p+=r*z,l+=r*D,d+=r*H,y+=r*F,b+=r*q,g+=r*Y,v+=r*K,m+=r*J,_+=r*W,w+=r*X,S+=r*G,k+=r*Z,T+=r*V,h+=(r=e[5])*I,f+=r*N,p+=r*B,l+=r*z,d+=r*D,y+=r*H,b+=r*F,g+=r*q,v+=r*Y,m+=r*K,_+=r*J,w+=r*W,S+=r*X,k+=r*G,T+=r*Z,O+=r*V,f+=(r=e[6])*I,p+=r*N,l+=r*B,d+=r*z,y+=r*D,b+=r*H,g+=r*F,v+=r*q,m+=r*Y,_+=r*K,w+=r*J,S+=r*W,k+=r*X,T+=r*G,O+=r*Z,C+=r*V,p+=(r=e[7])*I,l+=r*N,d+=r*B,y+=r*z,b+=r*D,g+=r*H,v+=r*F,m+=r*q,_+=r*Y,w+=r*K,S+=r*J,k+=r*W,T+=r*X,O+=r*G,C+=r*Z,A+=r*V,l+=(r=e[8])*I,d+=r*N,y+=r*B,b+=r*z,g+=r*D,v+=r*H,m+=r*F,_+=r*q,w+=r*Y,S+=r*K,k+=r*J,T+=r*W,O+=r*X,C+=r*G,A+=r*Z,P+=r*V,d+=(r=e[9])*I,y+=r*N,b+=r*B,g+=r*z,v+=r*D,m+=r*H,_+=r*F,w+=r*q,S+=r*Y,k+=r*K,T+=r*J,O+=r*W,C+=r*X,A+=r*G,P+=r*Z,E+=r*V,y+=(r=e[10])*I,b+=r*N,g+=r*B,v+=r*z,m+=r*D,_+=r*H,w+=r*F,S+=r*q,k+=r*Y,T+=r*K,O+=r*J,C+=r*W,A+=r*X,P+=r*G,E+=r*Z,x+=r*V,b+=(r=e[11])*I,g+=r*N,v+=r*B,m+=r*z,_+=r*D,w+=r*H,S+=r*F,k+=r*q,T+=r*Y,O+=r*K,C+=r*J,A+=r*W,P+=r*X,E+=r*G,x+=r*Z,L+=r*V,g+=(r=e[12])*I,v+=r*N,m+=r*B,_+=r*z,w+=r*D,S+=r*H,k+=r*F,T+=r*q,O+=r*Y,C+=r*K,A+=r*J,P+=r*W,E+=r*X,x+=r*G,L+=r*Z,U+=r*V,v+=(r=e[13])*I,m+=r*N,_+=r*B,w+=r*z,S+=r*D,k+=r*H,T+=r*F,O+=r*q,C+=r*Y,A+=r*K,P+=r*J,E+=r*W,x+=r*X,L+=r*G,U+=r*Z,M+=r*V,m+=(r=e[14])*I,_+=r*N,w+=r*B,S+=r*z,k+=r*D,T+=r*H,O+=r*F,C+=r*q,A+=r*Y,P+=r*K,E+=r*J,x+=r*W,L+=r*X,U+=r*G,M+=r*Z,R+=r*V,_+=(r=e[15])*I,s+=38*(S+=r*B),c+=38*(k+=r*z),a+=38*(T+=r*D),u+=38*(O+=r*H),h+=38*(C+=r*F),f+=38*(A+=r*q),p+=38*(P+=r*Y),l+=38*(E+=r*K),d+=38*(x+=r*J),y+=38*(L+=r*W),b+=38*(U+=r*X),g+=38*(M+=r*G),v+=38*(R+=r*Z),m+=38*(j+=r*V),i=(r=(i+=38*(w+=r*N))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),_=(r=_+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),_=(r=_+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),t[0]=i,t[1]=s,t[2]=c,t[3]=a,t[4]=u,t[5]=h,t[6]=f,t[7]=p,t[8]=l,t[9]=d,t[10]=y,t[11]=b,t[12]=g,t[13]=v,t[14]=m,t[15]=_}function D(t,e){z(t,e,e)}function H(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)D(o,o),2!==r&&4!==r&&z(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function F(t,n,r){var o,i,s=new Uint8Array(32),c=new Float64Array(80),u=e(),h=e(),f=e(),p=e(),l=e(),d=e();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,I(c,r),i=0;i<16;i++)h[i]=c[i],p[i]=u[i]=f[i]=0;for(u[0]=p[0]=1,i=254;i>=0;--i)U(u,h,o=s[i>>>3]>>>(7&i)&1),U(f,p,o),N(l,u,f),B(u,u,f),N(f,h,p),B(h,h,p),D(p,l),D(d,u),z(u,f,u),z(f,h,l),N(l,u,f),B(u,u,f),D(h,u),B(f,p,d),z(u,f,a),N(u,u,p),z(f,f,u),z(u,p,d),z(p,h,c),D(h,l),U(u,h,o),U(f,p,o);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=f[i],c[i+48]=h[i],c[i+64]=p[i];var y=c.subarray(32),b=c.subarray(16);return H(y,y),z(b,b,y),M(t,b),0}function q(t,e){return F(t,e,i)}function Y(t,e){return r(e,32),q(t,e)}function K(t,e,n){var r=new Uint8Array(32);return F(r,n,e),m(t,o,r,_)}O.prototype.blocks=function(t,e,n){for(var r,o,i,s,c,a,u,h,f,p,l,d,y,b,g,v,m,_,w,S=this.fin?0:2048,k=this.h[0],T=this.h[1],O=this.h[2],C=this.h[3],A=this.h[4],P=this.h[5],E=this.h[6],x=this.h[7],L=this.h[8],U=this.h[9],M=this.r[0],R=this.r[1],j=this.r[2],I=this.r[3],N=this.r[4],B=this.r[5],z=this.r[6],D=this.r[7],H=this.r[8],F=this.r[9];n>=16;)p=f=0,p+=(k+=8191&(r=255&t[e+0]|(255&t[e+1])<<8))*M,p+=(T+=8191&(r>>>13|(o=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*F),p+=(O+=8191&(o>>>10|(i=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*H),p+=(C+=8191&(i>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*D),f=(p+=(A+=8191&(s>>>4|(c=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*z))>>>13,p&=8191,p+=(P+=c>>>1&8191)*(5*B),p+=(E+=8191&(c>>>14|(a=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),p+=(x+=8191&(a>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*I),p+=(L+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*j),l=f+=(p+=(U+=h>>>5|S)*(5*R))>>>13,l+=k*R,l+=T*M,l+=O*(5*F),l+=C*(5*H),f=(l+=A*(5*D))>>>13,l&=8191,l+=P*(5*z),l+=E*(5*B),l+=x*(5*N),l+=L*(5*I),f+=(l+=U*(5*j))>>>13,l&=8191,d=f,d+=k*j,d+=T*R,d+=O*M,d+=C*(5*F),f=(d+=A*(5*H))>>>13,d&=8191,d+=P*(5*D),d+=E*(5*z),d+=x*(5*B),d+=L*(5*N),y=f+=(d+=U*(5*I))>>>13,y+=k*I,y+=T*j,y+=O*R,y+=C*M,f=(y+=A*(5*F))>>>13,y&=8191,y+=P*(5*H),y+=E*(5*D),y+=x*(5*z),y+=L*(5*B),b=f+=(y+=U*(5*N))>>>13,b+=k*N,b+=T*I,b+=O*j,b+=C*R,f=(b+=A*M)>>>13,b&=8191,b+=P*(5*F),b+=E*(5*H),b+=x*(5*D),b+=L*(5*z),g=f+=(b+=U*(5*B))>>>13,g+=k*B,g+=T*N,g+=O*I,g+=C*j,f=(g+=A*R)>>>13,g&=8191,g+=P*M,g+=E*(5*F),g+=x*(5*H),g+=L*(5*D),v=f+=(g+=U*(5*z))>>>13,v+=k*z,v+=T*B,v+=O*N,v+=C*I,f=(v+=A*j)>>>13,v&=8191,v+=P*R,v+=E*M,v+=x*(5*F),v+=L*(5*H),m=f+=(v+=U*(5*D))>>>13,m+=k*D,m+=T*z,m+=O*B,m+=C*N,f=(m+=A*I)>>>13,m&=8191,m+=P*j,m+=E*R,m+=x*M,m+=L*(5*F),_=f+=(m+=U*(5*H))>>>13,_+=k*H,_+=T*D,_+=O*z,_+=C*B,f=(_+=A*N)>>>13,_&=8191,_+=P*I,_+=E*j,_+=x*R,_+=L*M,w=f+=(_+=U*(5*F))>>>13,w+=k*F,w+=T*H,w+=O*D,w+=C*z,f=(w+=A*B)>>>13,w&=8191,w+=P*N,w+=E*I,w+=x*j,w+=L*R,k=p=8191&(f=(f=((f+=(w+=U*M)>>>13)<<2)+f|0)+(p&=8191)|0),T=l+=f>>>=13,O=d&=8191,C=y&=8191,A=b&=8191,P=g&=8191,E=v&=8191,x=m&=8191,L=_&=8191,U=w&=8191,e+=16,n-=16;this.h[0]=k,this.h[1]=T,this.h[2]=O,this.h[3]=C,this.h[4]=A,this.h[5]=P,this.h[6]=E,this.h[7]=x,this.h[8]=L,this.h[9]=U},O.prototype.finish=function(t,e){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},O.prototype.update=function(t,e,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r=16&&(o=n-n%16,this.blocks(t,e,o),e+=o,n-=o),n){for(r=0;r=128;){for(S=0;S<16;S++)k=8*S+G,x[S]=n[k+0]<<24|n[k+1]<<16|n[k+2]<<8|n[k+3],L[S]=n[k+4]<<24|n[k+5]<<16|n[k+6]<<8|n[k+7];for(S=0;S<80;S++)if(o=U,i=M,s=R,c=j,a=I,u=N,h=B,z,p=D,l=H,d=F,y=q,b=Y,g=K,v=J,W,C=65535&(O=W),A=O>>>16,P=65535&(T=z),E=T>>>16,C+=65535&(O=(Y>>>14|I<<18)^(Y>>>18|I<<14)^(I>>>9|Y<<23)),A+=O>>>16,P+=65535&(T=(I>>>14|Y<<18)^(I>>>18|Y<<14)^(Y>>>9|I<<23)),E+=T>>>16,C+=65535&(O=Y&K^~Y&J),A+=O>>>16,P+=65535&(T=I&N^~I&B),E+=T>>>16,T=X[2*S],C+=65535&(O=X[2*S+1]),A+=O>>>16,P+=65535&T,E+=T>>>16,T=x[S%16],A+=(O=L[S%16])>>>16,P+=65535&T,E+=T>>>16,P+=(A+=(C+=65535&O)>>>16)>>>16,C=65535&(O=w=65535&C|A<<16),A=O>>>16,P=65535&(T=_=65535&P|(E+=P>>>16)<<16),E=T>>>16,C+=65535&(O=(D>>>28|U<<4)^(U>>>2|D<<30)^(U>>>7|D<<25)),A+=O>>>16,P+=65535&(T=(U>>>28|D<<4)^(D>>>2|U<<30)^(D>>>7|U<<25)),E+=T>>>16,A+=(O=D&H^D&F^H&F)>>>16,P+=65535&(T=U&M^U&R^M&R),E+=T>>>16,f=65535&(P+=(A+=(C+=65535&O)>>>16)>>>16)|(E+=P>>>16)<<16,m=65535&C|A<<16,C=65535&(O=y),A=O>>>16,P=65535&(T=c),E=T>>>16,A+=(O=w)>>>16,P+=65535&(T=_),E+=T>>>16,M=o,R=i,j=s,I=c=65535&(P+=(A+=(C+=65535&O)>>>16)>>>16)|(E+=P>>>16)<<16,N=a,B=u,z=h,U=f,H=p,F=l,q=d,Y=y=65535&C|A<<16,K=b,J=g,W=v,D=m,S%16==15)for(k=0;k<16;k++)T=x[k],C=65535&(O=L[k]),A=O>>>16,P=65535&T,E=T>>>16,T=x[(k+9)%16],C+=65535&(O=L[(k+9)%16]),A+=O>>>16,P+=65535&T,E+=T>>>16,_=x[(k+1)%16],C+=65535&(O=((w=L[(k+1)%16])>>>1|_<<31)^(w>>>8|_<<24)^(w>>>7|_<<25)),A+=O>>>16,P+=65535&(T=(_>>>1|w<<31)^(_>>>8|w<<24)^_>>>7),E+=T>>>16,_=x[(k+14)%16],A+=(O=((w=L[(k+14)%16])>>>19|_<<13)^(_>>>29|w<<3)^(w>>>6|_<<26))>>>16,P+=65535&(T=(_>>>19|w<<13)^(w>>>29|_<<3)^_>>>6),E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,x[k]=65535&P|E<<16,L[k]=65535&C|A<<16;C=65535&(O=D),A=O>>>16,P=65535&(T=U),E=T>>>16,T=t[0],A+=(O=e[0])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[0]=U=65535&P|E<<16,e[0]=D=65535&C|A<<16,C=65535&(O=H),A=O>>>16,P=65535&(T=M),E=T>>>16,T=t[1],A+=(O=e[1])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[1]=M=65535&P|E<<16,e[1]=H=65535&C|A<<16,C=65535&(O=F),A=O>>>16,P=65535&(T=R),E=T>>>16,T=t[2],A+=(O=e[2])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[2]=R=65535&P|E<<16,e[2]=F=65535&C|A<<16,C=65535&(O=q),A=O>>>16,P=65535&(T=j),E=T>>>16,T=t[3],A+=(O=e[3])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[3]=j=65535&P|E<<16,e[3]=q=65535&C|A<<16,C=65535&(O=Y),A=O>>>16,P=65535&(T=I),E=T>>>16,T=t[4],A+=(O=e[4])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[4]=I=65535&P|E<<16,e[4]=Y=65535&C|A<<16,C=65535&(O=K),A=O>>>16,P=65535&(T=N),E=T>>>16,T=t[5],A+=(O=e[5])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[5]=N=65535&P|E<<16,e[5]=K=65535&C|A<<16,C=65535&(O=J),A=O>>>16,P=65535&(T=B),E=T>>>16,T=t[6],A+=(O=e[6])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[6]=B=65535&P|E<<16,e[6]=J=65535&C|A<<16,C=65535&(O=W),A=O>>>16,P=65535&(T=z),E=T>>>16,T=t[7],A+=(O=e[7])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[7]=z=65535&P|E<<16,e[7]=W=65535&C|A<<16,G+=128,r-=128}return r}function Z(t,e,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),c=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,G(o,i,e,n),n%=128,r=0;r=0;--o)Q(t,e,r=n[o/8|0]>>(7&o)&1),V(e,t),V(t,t),Q(t,e,r)}function et(t,n){var r=[e(),e(),e(),e()];x(r[0],f),x(r[1],p),x(r[2],c),z(r[3],f,p),tt(t,r,n)}function nt(t,n,o){var i,s=new Uint8Array(64),c=[e(),e(),e(),e()];for(o||r(n,32),Z(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,et(c,s),$(t,c),i=0;i<32;i++)n[i+32]=t[i];return 0}var rt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(t,e){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o>8,e[o]-=256*n;e[o]+=n,e[r]=0}for(n=0,o=0;o<32;o++)e[o]+=n-(e[31]>>4)*rt[o],n=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=n*rt[o];for(r=0;r<32;r++)e[r+1]+=e[r]>>8,t[r]=255&e[r]}function it(t){var e,n=new Float64Array(64);for(e=0;e<64;e++)n[e]=t[e];for(e=0;e<64;e++)t[e]=0;ot(t,n)}function st(t,n,r,o){var i,s,c=new Uint8Array(64),a=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),f=[e(),e(),e(),e()];Z(c,o,32),c[0]&=248,c[31]&=127,c[31]|=64;var p=r+64;for(i=0;i=0;r--)D(o,o),1!==r&&z(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}(r,r),z(r,r,i),z(r,r,a),z(r,r,a),z(t[0],r,a),D(o,t[0]),z(o,o,a),R(o,i)&&z(t[0],t[0],l),D(o,t[0]),z(o,o,a),R(o,i)?-1:(j(t[0])===n[31]>>7&&B(t[0],s,t[0]),z(t[3],t[0],t[1]),0)}function at(t,n,r,o){var i,s=new Uint8Array(32),c=new Uint8Array(64),a=[e(),e(),e(),e()],u=[e(),e(),e(),e()];if(-1,r<64)return-1;if(ct(u,o))return-1;for(i=0;i=0},t.sign.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(64);return nt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(yt(t),64!==t.length)throw new Error("bad secret key size");for(var e=new Uint8Array(32),n=0;n>>6)+r(128|63&e):r(224|e>>>12&15)+r(128|e>>>6&63)+r(128|63&e)},h=function(t){return t.replace(/[^\x00-\x7F]/g,u)},f=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),e>=2?"=":o.charAt(n>>>6&63),e>=1?"=":o.charAt(63&n)].join("")},p=self.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,f)},l=function(){function t(t,e,n,r){var o=this;this.clear=e,this.timer=t((function(){o.timer&&(o.timer=r(o.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),d=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function y(t){self.clearTimeout(t)}function b(t){self.clearInterval(t)}var g=function(t){function e(e,n){return t.call(this,setTimeout,y,e,(function(t){return n(),null}))||this}return d(e,t),e}(l),v=function(t){function e(e,n){return t.call(this,setInterval,b,e,(function(t){return n(),t}))||this}return d(e,t),e}(l),m={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new g(0,t)},method:function(t){for(var e=[],n=1;n0)for(r=0;r=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},$=Q,tt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),et=function(t){function e(e,n){var r=t.call(this)||this;return r.id=e,r.transport=n,r.activityTimeout=n.activityTimeout,r.bindListeners(),r}return tt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var r={event:t,data:e};return n&&(r.channel=n),H.debug("Event sent",r),this.send($.encodeMessage(r))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=$.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(H.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){k(e,(function(e,n){t.transport.unbind(n,e)}))};k(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=$.getCloseAction(t),n=$.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(D),nt=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=$.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new et(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=$.getCloseAction(e)||"backoff",r=$.getCloseError(e);t.finish(n,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(_({transport:this.transport,action:t},e))},t}(),rt=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===re.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){return t.authorizers=t.authorizers||re.getAuthorizers(),t.authorizers[this.type].call(this,re,e,n)},t}(),ot=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(re.TimelineTransport.getAgent(this,t),e)},t}(),it=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),st=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ct=(function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}it(e,t)}(Error),function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error)),at=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ut=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ht=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ft=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),pt={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/authenticating_users"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"}}},lt={buildLogSuffix:function(t){var e,n=pt.urls[t];return n?(n.fullUrl?e=n.fullUrl:n.path&&(e=pt.baseUrl+n.path),e?"See: "+e:""):""}},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yt=function(t){function e(e,n){var r=t.call(this,(function(t,n){H.debug("No callbacks on "+e+" for "+t)}))||this;return r.name=e,r.pusher=n,r.subscribed=!1,r.subscriptionPending=!1,r.subscriptionCancelled=!1,r}return dt(e,t),e.prototype.authorize=function(t,e){return e(!1,{})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new st("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=lt.buildLogSuffix("triggeringClientEvents");H.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(H.error(n),t.emit("pusher:subscription_error",n)):t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name})})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(D),bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),gt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bt(e,t),e.prototype.authorize=function(t,e){return Pt.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(yt),vt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;k(this.members,(function(n,r){t(e.get(r))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.members=new vt,r}return mt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===e.channel_data){var o=lt.buildLogSuffix("authenticationEndpoint");return H.error("Invalid auth response for channel '"+r.name+"',expected 'channel_data' field. "+o),void n("Invalid auth response")}var i=JSON.parse(e.channel_data);r.members.setMyID(i.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,r={};t.user_id&&(r.user_id=t.user_id),this.emit(e,n,r)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var r=this.members.addMember(n);this.emit("pusher:member_added",r);break;case"pusher_internal:member_removed":var o=this.members.removeMember(n);o&&this.emit("pusher:member_removed",o)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(gt),wt=n(0),St=n(1),kt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return kt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var o=e.shared_secret;if(o)r.key=Object(St.decodeBase64)(o),delete e.shared_secret,n(!1,e);else{var i="No shared_secret key in auth payload for encrypted channel: "+r.name;n(!0,i)}}}))},e.prototype.trigger=function(t,e){throw new ut("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,r=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,r):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var r=Object(St.decodeBase64)(e.ciphertext);if(r.length0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new g(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new g(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new g(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new g(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return _({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return _({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var r=t;"connected"===r&&(r+=" with new socket ID "+e.socket_id),H.debug("State changed",n+" -> "+r),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(D),At=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){return 0===t.indexOf("private-encrypted-")?Pt.createEncryptedChannel(t,e):0===t.indexOf("private-")?Pt.createPrivateChannel(t,e):0===t.indexOf("presence-")?Pt.createPresenceChannel(t,e):Pt.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return k(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){k(this.channels,(function(t){t.disconnect()}))},t}();var Pt={createChannels:function(){return new At},createConnectionManager:function(t,e){return new Ct(t,e)},createChannel:function(t,e){return new yt(t,e)},createPrivateChannel:function(t,e){return new gt(t,e)},createPresenceChannel:function(t,e){return new _t(t,e)},createEncryptedChannel:function(t,e){return new Tt(t,e)},createTimelineSender:function(t,e){return new ot(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new rt(t,e)},createHandshake:function(t,e){return new nt(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new V(t,e,n)}},Et=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Pt.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),xt=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,r=this.strategies,o=0,i=this.timeout,s=null,c=function(a,u){u?e(null,u):(o+=1,n.loop&&(o%=r.length),o0&&(o=new g(n.timeout,(function(){i.abort(),r(!0)}))),i=t.connect(e,(function(t,e){t&&o&&o.isRunning()&&!n.failFast||(o&&o.ensureAborted(),r(t,e))})),{abort:function(){o&&o.ensureAborted(),i.abort()},forceMinPriority:function(t){i.forceMinPriority(t)}}},t}(),Lt=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var r=C(t,(function(t,r,o,i){return t.connect(e,n(r,i))}));return{abort:function(){O(r,Ut)},forceMinPriority:function(t){O(r,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(r,o){n[t].error=r,r?function(t){return function(t,e){for(var n=0;n=m.now()){var i=this.transports[r.transport];i&&(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),o.push(new xt([i],{timeout:2*r.latency+1e3,failFast:!0})))}var s=m.now(),c=o.pop().connect(t,(function r(i,a){i?(jt(n),o.length>0?(s=m.now(),c=o.pop().connect(t,r)):e(i)):(!function(t,e,n){var r=re.getLocalStorage();if(r)try{r[Rt(t)]=U({timestamp:m.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,m.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function Rt(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function jt(t){var e=re.getLocalStorage();if(e)try{delete e[Rt(t)]}catch(t){}}var It=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,r=this.strategy,o=new g(this.options.delay,(function(){n=r.connect(t,e)}));return{abort:function(){o.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),Nt=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),Bt=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,r){r&&n.abort(),e(t,r)}));return n},t}();function zt(t){return function(){return t.isSupported()}}var Dt,Ht=function(t,e){var n={};function r(r,o,i,s,c){var a=e(t,r,o,i,s,c);return n[r]=a,a}var o,i={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=_({},i,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Et({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Et({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),f=r("ws","ws",3,i,u),p=r("wss","ws",3,s,u),l=r("xhr_streaming","xhr_streaming",1,c,h),d=r("xhr_polling","xhr_polling",1,c),y=new xt([f],a),b=new xt([p],a),g=new xt([l],a),v=new xt([d],a),m=new xt([new Nt(zt(g),new Lt([g,new It(v,{delay:4e3})]),v)],a);return o=t.useTLS?new Lt([y,new It(m,{delay:2e3})]):new Lt([y,new It(b,{delay:2e3}),new It(m,{delay:5e3})]),new Mt(new Bt(new Nt(zt(f),o,m)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},Ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qt=function(t){function e(e,n,r){var o=t.call(this)||this;return o.hooks=e,o.method=n,o.url=r,o}return Ft(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},re.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(re.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(D);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(Dt||(Dt={}));var Yt=Dt,Kt=1;function Jt(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+Kt++}function Wt(t){return Math.floor(Math.random()*t)}var Xt,Gt=function(){function t(t,e){this.hooks=t,this.session=Wt(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},$t={getDefaultStrategy:Ht,Transports:Z,transportConnectionInitializer:function(){this.timeline.info(this.buildTimelineMessage({transport:this.name+(this.options.useTLS?"s":"")})),this.hooks.isInitialized()?this.changeState("initialized"):this.onClose()},HTTPFactory:{createStreamingSocket:function(t){return this.createSocket(Zt,t)},createPollingSocket:function(t){return this.createSocket(Vt,t)},createSocket:function(t,e){return new Gt(t,e)},createXHR:function(t,e){return this.createRequest(Qt,t,e)},createRequest:function(t,e,n){return new qt(t,e,n)}},setup:function(t){t.ready()},getLocalStorage:function(){},getClientFeatures:function(){return T(P({ws:Z.ws},(function(t){return t.isSupported({})})))},getProtocol:function(){return"http:"},isXHRSupported:function(){return!0},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);throw"Cross-origin HTTP requests are not supported"},createXHR:function(){return new(this.getXHRAPI())},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},addUnloadListener:function(t){},removeUnloadListener:function(t){}},te=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ee=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return te(e,t),e.prototype.isOnline=function(){return!0},e}(D)),ne=function(t,e,n){var r=new Headers;for(var o in r.set("Content-Type","application/x-www-form-urlencoded"),this.authOptions.headers)r.set(o,this.authOptions.headers[o]);var i=this.composeQuery(e),s=new Request(this.options.authEndpoint,{headers:r,body:i,credentials:"same-origin",method:"POST"});return fetch(s).then((function(t){var e=t.status;if(200===e)return t.text();throw H.error("Couldn't get auth info from your auth endpoint",e),e})).then((function(t){try{t=JSON.parse(t)}catch(n){var e="JSON returned from auth endpoint was invalid, yet status code was 200. Data was: "+t;throw H.error(e),e}n(!1,t)})).catch((function(t){n(!0,t)}))},re={getDefaultStrategy:$t.getDefaultStrategy,Transports:$t.Transports,setup:$t.setup,getProtocol:$t.getProtocol,isXHRSupported:$t.isXHRSupported,getLocalStorage:$t.getLocalStorage,createXHR:$t.createXHR,createWebSocket:$t.createWebSocket,addUnloadListener:$t.addUnloadListener,removeUnloadListener:$t.removeUnloadListener,transportConnectionInitializer:$t.transportConnectionInitializer,createSocketRequest:$t.createSocketRequest,HTTPFactory:$t.HTTPFactory,TimelineTransport:{name:"xhr",getAgent:function(t,e){return function(n,r){var o="http"+(e?"s":"")+"://"+(t.host||t.options.host)+t.options.path,i=L(n);fetch(o+="/2?"+i).then((function(t){if(200!==t.status)throw"received "+t.status+" from stats.pusher.com";return t.json()})).then((function(e){var n=e.host;n&&(t.host=n)})).catch((function(t){H.debug("TimelineSender Error: ",t)}))}}},getAuthorizers:function(){return{ajax:ne}},getWebSocketAPI:function(){return WebSocket},getXHRAPI:function(){return XMLHttpRequest},getNetwork:function(){return ee}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(Xt||(Xt={}));var oe=Xt,ie=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(_({},e,{timestamp:m.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(oe.ERROR,t)},t.prototype.info=function(t){this.log(oe.INFO,t)},t.prototype.debug=function(t){this.log(oe.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,r=_({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(r,(function(t,r){t||n.sent++,e&&e(t,r)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),se=function(){function t(t,e,n,r){this.name=t,this.priority=e,this.transport=n,this.options=r||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return ce(new ft,e);if(this.priority>24&255,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=255&n,t[e+4]=r>>24&255,t[e+5]=r>>16&255,t[e+6]=r>>8&255,t[e+7]=255&r}function y(t,e,n,r,o){var i,s=0;for(i=0;i>>8)-1}function b(t,e,n,r){return y(t,e,n,r,16)}function v(t,e,n,r){return y(t,e,n,r,32)}function g(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,p=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,b=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=i,S=s,k=c,T=a,O=u,C=h,A=f,P=p,E=l,x=d,L=y,U=b,M=v,R=g,j=m,I=_,N=0;N<20;N+=2)w^=(o=(M^=(o=(E^=(o=(O^=(o=w+M|0)<<7|o>>>25)+w|0)<<9|o>>>23)+O|0)<<13|o>>>19)+E|0)<<18|o>>>14,C^=(o=(S^=(o=(R^=(o=(x^=(o=C+S|0)<<7|o>>>25)+C|0)<<9|o>>>23)+x|0)<<13|o>>>19)+R|0)<<18|o>>>14,L^=(o=(A^=(o=(k^=(o=(j^=(o=L+A|0)<<7|o>>>25)+L|0)<<9|o>>>23)+j|0)<<13|o>>>19)+k|0)<<18|o>>>14,I^=(o=(U^=(o=(P^=(o=(T^=(o=I+U|0)<<7|o>>>25)+I|0)<<9|o>>>23)+T|0)<<13|o>>>19)+P|0)<<18|o>>>14,w^=(o=(T^=(o=(k^=(o=(S^=(o=w+T|0)<<7|o>>>25)+w|0)<<9|o>>>23)+S|0)<<13|o>>>19)+k|0)<<18|o>>>14,C^=(o=(O^=(o=(P^=(o=(A^=(o=C+O|0)<<7|o>>>25)+C|0)<<9|o>>>23)+A|0)<<13|o>>>19)+P|0)<<18|o>>>14,L^=(o=(x^=(o=(E^=(o=(U^=(o=L+x|0)<<7|o>>>25)+L|0)<<9|o>>>23)+U|0)<<13|o>>>19)+E|0)<<18|o>>>14,I^=(o=(j^=(o=(R^=(o=(M^=(o=I+j|0)<<7|o>>>25)+I|0)<<9|o>>>23)+M|0)<<13|o>>>19)+R|0)<<18|o>>>14;w=w+i|0,S=S+s|0,k=k+c|0,T=T+a|0,O=O+u|0,C=C+h|0,A=A+f|0,P=P+p|0,E=E+l|0,x=x+d|0,L=L+y|0,U=U+b|0,M=M+v|0,R=R+g|0,j=j+m|0,I=I+_|0,t[0]=w>>>0&255,t[1]=w>>>8&255,t[2]=w>>>16&255,t[3]=w>>>24&255,t[4]=S>>>0&255,t[5]=S>>>8&255,t[6]=S>>>16&255,t[7]=S>>>24&255,t[8]=k>>>0&255,t[9]=k>>>8&255,t[10]=k>>>16&255,t[11]=k>>>24&255,t[12]=T>>>0&255,t[13]=T>>>8&255,t[14]=T>>>16&255,t[15]=T>>>24&255,t[16]=O>>>0&255,t[17]=O>>>8&255,t[18]=O>>>16&255,t[19]=O>>>24&255,t[20]=C>>>0&255,t[21]=C>>>8&255,t[22]=C>>>16&255,t[23]=C>>>24&255,t[24]=A>>>0&255,t[25]=A>>>8&255,t[26]=A>>>16&255,t[27]=A>>>24&255,t[28]=P>>>0&255,t[29]=P>>>8&255,t[30]=P>>>16&255,t[31]=P>>>24&255,t[32]=E>>>0&255,t[33]=E>>>8&255,t[34]=E>>>16&255,t[35]=E>>>24&255,t[36]=x>>>0&255,t[37]=x>>>8&255,t[38]=x>>>16&255,t[39]=x>>>24&255,t[40]=L>>>0&255,t[41]=L>>>8&255,t[42]=L>>>16&255,t[43]=L>>>24&255,t[44]=U>>>0&255,t[45]=U>>>8&255,t[46]=U>>>16&255,t[47]=U>>>24&255,t[48]=M>>>0&255,t[49]=M>>>8&255,t[50]=M>>>16&255,t[51]=M>>>24&255,t[52]=R>>>0&255,t[53]=R>>>8&255,t[54]=R>>>16&255,t[55]=R>>>24&255,t[56]=j>>>0&255,t[57]=j>>>8&255,t[58]=j>>>16&255,t[59]=j>>>24&255,t[60]=I>>>0&255,t[61]=I>>>8&255,t[62]=I>>>16&255,t[63]=I>>>24&255}(t,e,n,r)}function m(t,e,n,r){!function(t,e,n,r){for(var o,i=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,s=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,c=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,a=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,u=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,h=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,f=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,p=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,l=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,d=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,y=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,b=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,m=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,_=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,w=0;w<20;w+=2)i^=(o=(v^=(o=(l^=(o=(u^=(o=i+v|0)<<7|o>>>25)+i|0)<<9|o>>>23)+u|0)<<13|o>>>19)+l|0)<<18|o>>>14,h^=(o=(s^=(o=(g^=(o=(d^=(o=h+s|0)<<7|o>>>25)+h|0)<<9|o>>>23)+d|0)<<13|o>>>19)+g|0)<<18|o>>>14,y^=(o=(f^=(o=(c^=(o=(m^=(o=y+f|0)<<7|o>>>25)+y|0)<<9|o>>>23)+m|0)<<13|o>>>19)+c|0)<<18|o>>>14,_^=(o=(b^=(o=(p^=(o=(a^=(o=_+b|0)<<7|o>>>25)+_|0)<<9|o>>>23)+a|0)<<13|o>>>19)+p|0)<<18|o>>>14,i^=(o=(a^=(o=(c^=(o=(s^=(o=i+a|0)<<7|o>>>25)+i|0)<<9|o>>>23)+s|0)<<13|o>>>19)+c|0)<<18|o>>>14,h^=(o=(u^=(o=(p^=(o=(f^=(o=h+u|0)<<7|o>>>25)+h|0)<<9|o>>>23)+f|0)<<13|o>>>19)+p|0)<<18|o>>>14,y^=(o=(d^=(o=(l^=(o=(b^=(o=y+d|0)<<7|o>>>25)+y|0)<<9|o>>>23)+b|0)<<13|o>>>19)+l|0)<<18|o>>>14,_^=(o=(m^=(o=(g^=(o=(v^=(o=_+m|0)<<7|o>>>25)+_|0)<<9|o>>>23)+v|0)<<13|o>>>19)+g|0)<<18|o>>>14;t[0]=i>>>0&255,t[1]=i>>>8&255,t[2]=i>>>16&255,t[3]=i>>>24&255,t[4]=h>>>0&255,t[5]=h>>>8&255,t[6]=h>>>16&255,t[7]=h>>>24&255,t[8]=y>>>0&255,t[9]=y>>>8&255,t[10]=y>>>16&255,t[11]=y>>>24&255,t[12]=_>>>0&255,t[13]=_>>>8&255,t[14]=_>>>16&255,t[15]=_>>>24&255,t[16]=f>>>0&255,t[17]=f>>>8&255,t[18]=f>>>16&255,t[19]=f>>>24&255,t[20]=p>>>0&255,t[21]=p>>>8&255,t[22]=p>>>16&255,t[23]=p>>>24&255,t[24]=l>>>0&255,t[25]=l>>>8&255,t[26]=l>>>16&255,t[27]=l>>>24&255,t[28]=d>>>0&255,t[29]=d>>>8&255,t[30]=d>>>16&255,t[31]=d>>>24&255}(t,e,n,r)}var _=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function w(t,e,n,r,o,i,s){var c,a,u=new Uint8Array(16),h=new Uint8Array(64);for(a=0;a<16;a++)u[a]=0;for(a=0;a<8;a++)u[a]=i[a];for(;o>=64;){for(g(h,u,s,_),a=0;a<64;a++)t[e+a]=n[r+a]^h[a];for(c=1,a=8;a<16;a++)c=c+(255&u[a])|0,u[a]=255&c,c>>>=8;o-=64,e+=64,r+=64}if(o>0)for(g(h,u,s,_),a=0;a=64;){for(g(a,c,o,_),s=0;s<64;s++)t[e+s]=a[s];for(i=1,s=8;s<16;s++)i=i+(255&c[s])|0,c[s]=255&i,i>>>=8;n-=64,e+=64}if(n>0)for(g(a,c,o,_),s=0;s>>13|n<<3),r=255&t[4]|(255&t[5])<<8,this.r[2]=7939&(n>>>10|r<<6),o=255&t[6]|(255&t[7])<<8,this.r[3]=8191&(r>>>7|o<<9),i=255&t[8]|(255&t[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,s=255&t[10]|(255&t[11])<<8,this.r[6]=8191&(i>>>14|s<<2),c=255&t[12]|(255&t[13])<<8,this.r[7]=8065&(s>>>11|c<<5),a=255&t[14]|(255&t[15])<<8,this.r[8]=8191&(c>>>8|a<<8),this.r[9]=a>>>5&127,this.pad[0]=255&t[16]|(255&t[17])<<8,this.pad[1]=255&t[18]|(255&t[19])<<8,this.pad[2]=255&t[20]|(255&t[21])<<8,this.pad[3]=255&t[22]|(255&t[23])<<8,this.pad[4]=255&t[24]|(255&t[25])<<8,this.pad[5]=255&t[26]|(255&t[27])<<8,this.pad[6]=255&t[28]|(255&t[29])<<8,this.pad[7]=255&t[30]|(255&t[31])<<8};function C(t,e,n,r,o,i){var s=new O(i);return s.update(n,r,o),s.finish(t,e),0}function A(t,e,n,r,o,i){var s=new Uint8Array(16);return C(s,0,n,r,o,i),b(t,e,s,0)}function P(t,e,n,r,o){var i;if(n<32)return-1;for(T(t,0,e,0,n,r,o),C(t,16,t,32,n-32,t),i=0;i<16;i++)t[i]=0;return 0}function E(t,e,n,r,o){var i,s=new Uint8Array(32);if(n<32)return-1;if(k(s,0,32,r,o),0!==A(e,16,e,32,n-32,s))return-1;for(T(t,0,e,0,n,r,o),i=0;i<32;i++)t[i]=0;return 0}function x(t,e){var n;for(n=0;n<16;n++)t[n]=0|e[n]}function L(t){var e,n,r=1;for(e=0;e<16;e++)n=t[e]+r+65535,r=Math.floor(n/65536),t[e]=n-65536*r;t[0]+=r-1+37*(r-1)}function U(t,e,n){for(var r,o=~(n-1),i=0;i<16;i++)r=o&(t[i]^e[i]),t[i]^=r,e[i]^=r}function M(t,n){var r,o,i,s=e(),c=e();for(r=0;r<16;r++)c[r]=n[r];for(L(c),L(c),L(c),o=0;o<2;o++){for(s[0]=c[0]-65517,r=1;r<15;r++)s[r]=c[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=c[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,U(c,s,1-i)}for(r=0;r<16;r++)t[2*r]=255&c[r],t[2*r+1]=c[r]>>8}function R(t,e){var n=new Uint8Array(32),r=new Uint8Array(32);return M(n,t),M(r,e),v(n,0,r,0)}function j(t){var e=new Uint8Array(32);return M(e,t),1&e[0]}function I(t,e){var n;for(n=0;n<16;n++)t[n]=e[2*n]+(e[2*n+1]<<8);t[15]&=32767}function N(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]+n[r]}function B(t,e,n){for(var r=0;r<16;r++)t[r]=e[r]-n[r]}function z(t,e,n){var r,o,i=0,s=0,c=0,a=0,u=0,h=0,f=0,p=0,l=0,d=0,y=0,b=0,v=0,g=0,m=0,_=0,w=0,S=0,k=0,T=0,O=0,C=0,A=0,P=0,E=0,x=0,L=0,U=0,M=0,R=0,j=0,I=n[0],N=n[1],B=n[2],z=n[3],D=n[4],H=n[5],F=n[6],q=n[7],Y=n[8],K=n[9],J=n[10],W=n[11],X=n[12],G=n[13],Z=n[14],V=n[15];i+=(r=e[0])*I,s+=r*N,c+=r*B,a+=r*z,u+=r*D,h+=r*H,f+=r*F,p+=r*q,l+=r*Y,d+=r*K,y+=r*J,b+=r*W,v+=r*X,g+=r*G,m+=r*Z,_+=r*V,s+=(r=e[1])*I,c+=r*N,a+=r*B,u+=r*z,h+=r*D,f+=r*H,p+=r*F,l+=r*q,d+=r*Y,y+=r*K,b+=r*J,v+=r*W,g+=r*X,m+=r*G,_+=r*Z,w+=r*V,c+=(r=e[2])*I,a+=r*N,u+=r*B,h+=r*z,f+=r*D,p+=r*H,l+=r*F,d+=r*q,y+=r*Y,b+=r*K,v+=r*J,g+=r*W,m+=r*X,_+=r*G,w+=r*Z,S+=r*V,a+=(r=e[3])*I,u+=r*N,h+=r*B,f+=r*z,p+=r*D,l+=r*H,d+=r*F,y+=r*q,b+=r*Y,v+=r*K,g+=r*J,m+=r*W,_+=r*X,w+=r*G,S+=r*Z,k+=r*V,u+=(r=e[4])*I,h+=r*N,f+=r*B,p+=r*z,l+=r*D,d+=r*H,y+=r*F,b+=r*q,v+=r*Y,g+=r*K,m+=r*J,_+=r*W,w+=r*X,S+=r*G,k+=r*Z,T+=r*V,h+=(r=e[5])*I,f+=r*N,p+=r*B,l+=r*z,d+=r*D,y+=r*H,b+=r*F,v+=r*q,g+=r*Y,m+=r*K,_+=r*J,w+=r*W,S+=r*X,k+=r*G,T+=r*Z,O+=r*V,f+=(r=e[6])*I,p+=r*N,l+=r*B,d+=r*z,y+=r*D,b+=r*H,v+=r*F,g+=r*q,m+=r*Y,_+=r*K,w+=r*J,S+=r*W,k+=r*X,T+=r*G,O+=r*Z,C+=r*V,p+=(r=e[7])*I,l+=r*N,d+=r*B,y+=r*z,b+=r*D,v+=r*H,g+=r*F,m+=r*q,_+=r*Y,w+=r*K,S+=r*J,k+=r*W,T+=r*X,O+=r*G,C+=r*Z,A+=r*V,l+=(r=e[8])*I,d+=r*N,y+=r*B,b+=r*z,v+=r*D,g+=r*H,m+=r*F,_+=r*q,w+=r*Y,S+=r*K,k+=r*J,T+=r*W,O+=r*X,C+=r*G,A+=r*Z,P+=r*V,d+=(r=e[9])*I,y+=r*N,b+=r*B,v+=r*z,g+=r*D,m+=r*H,_+=r*F,w+=r*q,S+=r*Y,k+=r*K,T+=r*J,O+=r*W,C+=r*X,A+=r*G,P+=r*Z,E+=r*V,y+=(r=e[10])*I,b+=r*N,v+=r*B,g+=r*z,m+=r*D,_+=r*H,w+=r*F,S+=r*q,k+=r*Y,T+=r*K,O+=r*J,C+=r*W,A+=r*X,P+=r*G,E+=r*Z,x+=r*V,b+=(r=e[11])*I,v+=r*N,g+=r*B,m+=r*z,_+=r*D,w+=r*H,S+=r*F,k+=r*q,T+=r*Y,O+=r*K,C+=r*J,A+=r*W,P+=r*X,E+=r*G,x+=r*Z,L+=r*V,v+=(r=e[12])*I,g+=r*N,m+=r*B,_+=r*z,w+=r*D,S+=r*H,k+=r*F,T+=r*q,O+=r*Y,C+=r*K,A+=r*J,P+=r*W,E+=r*X,x+=r*G,L+=r*Z,U+=r*V,g+=(r=e[13])*I,m+=r*N,_+=r*B,w+=r*z,S+=r*D,k+=r*H,T+=r*F,O+=r*q,C+=r*Y,A+=r*K,P+=r*J,E+=r*W,x+=r*X,L+=r*G,U+=r*Z,M+=r*V,m+=(r=e[14])*I,_+=r*N,w+=r*B,S+=r*z,k+=r*D,T+=r*H,O+=r*F,C+=r*q,A+=r*Y,P+=r*K,E+=r*J,x+=r*W,L+=r*X,U+=r*G,M+=r*Z,R+=r*V,_+=(r=e[15])*I,s+=38*(S+=r*B),c+=38*(k+=r*z),a+=38*(T+=r*D),u+=38*(O+=r*H),h+=38*(C+=r*F),f+=38*(A+=r*q),p+=38*(P+=r*Y),l+=38*(E+=r*K),d+=38*(x+=r*J),y+=38*(L+=r*W),b+=38*(U+=r*X),v+=38*(M+=r*G),g+=38*(R+=r*Z),m+=38*(j+=r*V),i=(r=(i+=38*(w+=r*N))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),_=(r=_+o+65535)-65536*(o=Math.floor(r/65536)),i=(r=(i+=o-1+37*(o-1))+(o=1)+65535)-65536*(o=Math.floor(r/65536)),s=(r=s+o+65535)-65536*(o=Math.floor(r/65536)),c=(r=c+o+65535)-65536*(o=Math.floor(r/65536)),a=(r=a+o+65535)-65536*(o=Math.floor(r/65536)),u=(r=u+o+65535)-65536*(o=Math.floor(r/65536)),h=(r=h+o+65535)-65536*(o=Math.floor(r/65536)),f=(r=f+o+65535)-65536*(o=Math.floor(r/65536)),p=(r=p+o+65535)-65536*(o=Math.floor(r/65536)),l=(r=l+o+65535)-65536*(o=Math.floor(r/65536)),d=(r=d+o+65535)-65536*(o=Math.floor(r/65536)),y=(r=y+o+65535)-65536*(o=Math.floor(r/65536)),b=(r=b+o+65535)-65536*(o=Math.floor(r/65536)),v=(r=v+o+65535)-65536*(o=Math.floor(r/65536)),g=(r=g+o+65535)-65536*(o=Math.floor(r/65536)),m=(r=m+o+65535)-65536*(o=Math.floor(r/65536)),_=(r=_+o+65535)-65536*(o=Math.floor(r/65536)),i+=o-1+37*(o-1),t[0]=i,t[1]=s,t[2]=c,t[3]=a,t[4]=u,t[5]=h,t[6]=f,t[7]=p,t[8]=l,t[9]=d,t[10]=y,t[11]=b,t[12]=v,t[13]=g,t[14]=m,t[15]=_}function D(t,e){z(t,e,e)}function H(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=253;r>=0;r--)D(o,o),2!==r&&4!==r&&z(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function F(t,n){var r,o=e();for(r=0;r<16;r++)o[r]=n[r];for(r=250;r>=0;r--)D(o,o),1!==r&&z(o,o,n);for(r=0;r<16;r++)t[r]=o[r]}function q(t,n,r){var o,i,s=new Uint8Array(32),c=new Float64Array(80),u=e(),h=e(),f=e(),p=e(),l=e(),d=e();for(i=0;i<31;i++)s[i]=n[i];for(s[31]=127&n[31]|64,s[0]&=248,I(c,r),i=0;i<16;i++)h[i]=c[i],p[i]=u[i]=f[i]=0;for(u[0]=p[0]=1,i=254;i>=0;--i)U(u,h,o=s[i>>>3]>>>(7&i)&1),U(f,p,o),N(l,u,f),B(u,u,f),N(f,h,p),B(h,h,p),D(p,l),D(d,u),z(u,f,u),z(f,h,l),N(l,u,f),B(u,u,f),D(h,u),B(f,p,d),z(u,f,a),N(u,u,p),z(f,f,u),z(u,p,d),z(p,h,c),D(h,l),U(u,h,o),U(f,p,o);for(i=0;i<16;i++)c[i+16]=u[i],c[i+32]=f[i],c[i+48]=h[i],c[i+64]=p[i];var y=c.subarray(32),b=c.subarray(16);return H(y,y),z(b,b,y),M(t,b),0}function Y(t,e){return q(t,e,i)}function K(t,e){return r(e,32),Y(t,e)}function J(t,e,n){var r=new Uint8Array(32);return q(r,n,e),m(t,o,r,_)}O.prototype.blocks=function(t,e,n){for(var r,o,i,s,c,a,u,h,f,p,l,d,y,b,v,g,m,_,w,S=this.fin?0:2048,k=this.h[0],T=this.h[1],O=this.h[2],C=this.h[3],A=this.h[4],P=this.h[5],E=this.h[6],x=this.h[7],L=this.h[8],U=this.h[9],M=this.r[0],R=this.r[1],j=this.r[2],I=this.r[3],N=this.r[4],B=this.r[5],z=this.r[6],D=this.r[7],H=this.r[8],F=this.r[9];n>=16;)p=f=0,p+=(k+=8191&(r=255&t[e+0]|(255&t[e+1])<<8))*M,p+=(T+=8191&(r>>>13|(o=255&t[e+2]|(255&t[e+3])<<8)<<3))*(5*F),p+=(O+=8191&(o>>>10|(i=255&t[e+4]|(255&t[e+5])<<8)<<6))*(5*H),p+=(C+=8191&(i>>>7|(s=255&t[e+6]|(255&t[e+7])<<8)<<9))*(5*D),f=(p+=(A+=8191&(s>>>4|(c=255&t[e+8]|(255&t[e+9])<<8)<<12))*(5*z))>>>13,p&=8191,p+=(P+=c>>>1&8191)*(5*B),p+=(E+=8191&(c>>>14|(a=255&t[e+10]|(255&t[e+11])<<8)<<2))*(5*N),p+=(x+=8191&(a>>>11|(u=255&t[e+12]|(255&t[e+13])<<8)<<5))*(5*I),p+=(L+=8191&(u>>>8|(h=255&t[e+14]|(255&t[e+15])<<8)<<8))*(5*j),l=f+=(p+=(U+=h>>>5|S)*(5*R))>>>13,l+=k*R,l+=T*M,l+=O*(5*F),l+=C*(5*H),f=(l+=A*(5*D))>>>13,l&=8191,l+=P*(5*z),l+=E*(5*B),l+=x*(5*N),l+=L*(5*I),f+=(l+=U*(5*j))>>>13,l&=8191,d=f,d+=k*j,d+=T*R,d+=O*M,d+=C*(5*F),f=(d+=A*(5*H))>>>13,d&=8191,d+=P*(5*D),d+=E*(5*z),d+=x*(5*B),d+=L*(5*N),y=f+=(d+=U*(5*I))>>>13,y+=k*I,y+=T*j,y+=O*R,y+=C*M,f=(y+=A*(5*F))>>>13,y&=8191,y+=P*(5*H),y+=E*(5*D),y+=x*(5*z),y+=L*(5*B),b=f+=(y+=U*(5*N))>>>13,b+=k*N,b+=T*I,b+=O*j,b+=C*R,f=(b+=A*M)>>>13,b&=8191,b+=P*(5*F),b+=E*(5*H),b+=x*(5*D),b+=L*(5*z),v=f+=(b+=U*(5*B))>>>13,v+=k*B,v+=T*N,v+=O*I,v+=C*j,f=(v+=A*R)>>>13,v&=8191,v+=P*M,v+=E*(5*F),v+=x*(5*H),v+=L*(5*D),g=f+=(v+=U*(5*z))>>>13,g+=k*z,g+=T*B,g+=O*N,g+=C*I,f=(g+=A*j)>>>13,g&=8191,g+=P*R,g+=E*M,g+=x*(5*F),g+=L*(5*H),m=f+=(g+=U*(5*D))>>>13,m+=k*D,m+=T*z,m+=O*B,m+=C*N,f=(m+=A*I)>>>13,m&=8191,m+=P*j,m+=E*R,m+=x*M,m+=L*(5*F),_=f+=(m+=U*(5*H))>>>13,_+=k*H,_+=T*D,_+=O*z,_+=C*B,f=(_+=A*N)>>>13,_&=8191,_+=P*I,_+=E*j,_+=x*R,_+=L*M,w=f+=(_+=U*(5*F))>>>13,w+=k*F,w+=T*H,w+=O*D,w+=C*z,f=(w+=A*B)>>>13,w&=8191,w+=P*N,w+=E*I,w+=x*j,w+=L*R,k=p=8191&(f=(f=((f+=(w+=U*M)>>>13)<<2)+f|0)+(p&=8191)|0),T=l+=f>>>=13,O=d&=8191,C=y&=8191,A=b&=8191,P=v&=8191,E=g&=8191,x=m&=8191,L=_&=8191,U=w&=8191,e+=16,n-=16;this.h[0]=k,this.h[1]=T,this.h[2]=O,this.h[3]=C,this.h[4]=A,this.h[5]=P,this.h[6]=E,this.h[7]=x,this.h[8]=L,this.h[9]=U},O.prototype.finish=function(t,e){var n,r,o,i,s=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,s[0]=this.h[0]+5,n=s[0]>>>13,s[0]&=8191,i=1;i<10;i++)s[i]=this.h[i]+n,n=s[i]>>>13,s[i]&=8191;for(s[9]-=8192,r=(1^n)-1,i=0;i<10;i++)s[i]&=r;for(r=~r,i=0;i<10;i++)this.h[i]=this.h[i]&r|s[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;t[e+0]=this.h[0]>>>0&255,t[e+1]=this.h[0]>>>8&255,t[e+2]=this.h[1]>>>0&255,t[e+3]=this.h[1]>>>8&255,t[e+4]=this.h[2]>>>0&255,t[e+5]=this.h[2]>>>8&255,t[e+6]=this.h[3]>>>0&255,t[e+7]=this.h[3]>>>8&255,t[e+8]=this.h[4]>>>0&255,t[e+9]=this.h[4]>>>8&255,t[e+10]=this.h[5]>>>0&255,t[e+11]=this.h[5]>>>8&255,t[e+12]=this.h[6]>>>0&255,t[e+13]=this.h[6]>>>8&255,t[e+14]=this.h[7]>>>0&255,t[e+15]=this.h[7]>>>8&255},O.prototype.update=function(t,e,n){var r,o;if(this.leftover){for((o=16-this.leftover)>n&&(o=n),r=0;r=16&&(o=n-n%16,this.blocks(t,e,o),e+=o,n-=o),n){for(r=0;r=128;){for(S=0;S<16;S++)k=8*S+X,x[S]=n[k+0]<<24|n[k+1]<<16|n[k+2]<<8|n[k+3],L[S]=n[k+4]<<24|n[k+5]<<16|n[k+6]<<8|n[k+7];for(S=0;S<80;S++)if(o=U,i=M,s=R,c=j,a=I,u=N,h=B,z,p=D,l=H,d=F,y=q,b=Y,v=K,g=J,W,C=65535&(O=W),A=O>>>16,P=65535&(T=z),E=T>>>16,C+=65535&(O=(Y>>>14|I<<18)^(Y>>>18|I<<14)^(I>>>9|Y<<23)),A+=O>>>16,P+=65535&(T=(I>>>14|Y<<18)^(I>>>18|Y<<14)^(Y>>>9|I<<23)),E+=T>>>16,C+=65535&(O=Y&K^~Y&J),A+=O>>>16,P+=65535&(T=I&N^~I&B),E+=T>>>16,C+=65535&(O=G[2*S+1]),A+=O>>>16,P+=65535&(T=G[2*S]),E+=T>>>16,T=x[S%16],A+=(O=L[S%16])>>>16,P+=65535&T,E+=T>>>16,P+=(A+=(C+=65535&O)>>>16)>>>16,C=65535&(O=w=65535&C|A<<16),A=O>>>16,P=65535&(T=_=65535&P|(E+=P>>>16)<<16),E=T>>>16,C+=65535&(O=(D>>>28|U<<4)^(U>>>2|D<<30)^(U>>>7|D<<25)),A+=O>>>16,P+=65535&(T=(U>>>28|D<<4)^(D>>>2|U<<30)^(D>>>7|U<<25)),E+=T>>>16,A+=(O=D&H^D&F^H&F)>>>16,P+=65535&(T=U&M^U&R^M&R),E+=T>>>16,f=65535&(P+=(A+=(C+=65535&O)>>>16)>>>16)|(E+=P>>>16)<<16,m=65535&C|A<<16,C=65535&(O=y),A=O>>>16,P=65535&(T=c),E=T>>>16,A+=(O=w)>>>16,P+=65535&(T=_),E+=T>>>16,M=o,R=i,j=s,I=c=65535&(P+=(A+=(C+=65535&O)>>>16)>>>16)|(E+=P>>>16)<<16,N=a,B=u,z=h,U=f,H=p,F=l,q=d,Y=y=65535&C|A<<16,K=b,J=v,W=g,D=m,S%16==15)for(k=0;k<16;k++)T=x[k],C=65535&(O=L[k]),A=O>>>16,P=65535&T,E=T>>>16,T=x[(k+9)%16],C+=65535&(O=L[(k+9)%16]),A+=O>>>16,P+=65535&T,E+=T>>>16,_=x[(k+1)%16],C+=65535&(O=((w=L[(k+1)%16])>>>1|_<<31)^(w>>>8|_<<24)^(w>>>7|_<<25)),A+=O>>>16,P+=65535&(T=(_>>>1|w<<31)^(_>>>8|w<<24)^_>>>7),E+=T>>>16,_=x[(k+14)%16],A+=(O=((w=L[(k+14)%16])>>>19|_<<13)^(_>>>29|w<<3)^(w>>>6|_<<26))>>>16,P+=65535&(T=(_>>>19|w<<13)^(w>>>29|_<<3)^_>>>6),E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,x[k]=65535&P|E<<16,L[k]=65535&C|A<<16;C=65535&(O=D),A=O>>>16,P=65535&(T=U),E=T>>>16,T=t[0],A+=(O=e[0])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[0]=U=65535&P|E<<16,e[0]=D=65535&C|A<<16,C=65535&(O=H),A=O>>>16,P=65535&(T=M),E=T>>>16,T=t[1],A+=(O=e[1])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[1]=M=65535&P|E<<16,e[1]=H=65535&C|A<<16,C=65535&(O=F),A=O>>>16,P=65535&(T=R),E=T>>>16,T=t[2],A+=(O=e[2])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[2]=R=65535&P|E<<16,e[2]=F=65535&C|A<<16,C=65535&(O=q),A=O>>>16,P=65535&(T=j),E=T>>>16,T=t[3],A+=(O=e[3])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[3]=j=65535&P|E<<16,e[3]=q=65535&C|A<<16,C=65535&(O=Y),A=O>>>16,P=65535&(T=I),E=T>>>16,T=t[4],A+=(O=e[4])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[4]=I=65535&P|E<<16,e[4]=Y=65535&C|A<<16,C=65535&(O=K),A=O>>>16,P=65535&(T=N),E=T>>>16,T=t[5],A+=(O=e[5])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[5]=N=65535&P|E<<16,e[5]=K=65535&C|A<<16,C=65535&(O=J),A=O>>>16,P=65535&(T=B),E=T>>>16,T=t[6],A+=(O=e[6])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[6]=B=65535&P|E<<16,e[6]=J=65535&C|A<<16,C=65535&(O=W),A=O>>>16,P=65535&(T=z),E=T>>>16,T=t[7],A+=(O=e[7])>>>16,P+=65535&T,E+=T>>>16,E+=(P+=(A+=(C+=65535&O)>>>16)>>>16)>>>16,t[7]=z=65535&P|E<<16,e[7]=W=65535&C|A<<16,X+=128,r-=128}return r}function V(t,e,n){var r,o=new Int32Array(8),i=new Int32Array(8),s=new Uint8Array(256),c=n;for(o[0]=1779033703,o[1]=3144134277,o[2]=1013904242,o[3]=2773480762,o[4]=1359893119,o[5]=2600822924,o[6]=528734635,o[7]=1541459225,i[0]=4089235720,i[1]=2227873595,i[2]=4271175723,i[3]=1595750129,i[4]=2917565137,i[5]=725511199,i[6]=4215389547,i[7]=327033209,Z(o,i,e,n),n%=128,r=0;r=0;--o)$(t,e,r=n[o/8|0]>>(7&o)&1),Q(e,t),Q(t,t),$(t,e,r)}function nt(t,n){var r=[e(),e(),e(),e()];x(r[0],f),x(r[1],p),x(r[2],c),z(r[3],f,p),et(t,r,n)}function rt(t,n,o){var i,s=new Uint8Array(64),c=[e(),e(),e(),e()];for(o||r(n,32),V(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,nt(c,s),tt(t,c),i=0;i<32;i++)n[i+32]=t[i];return 0}var ot=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(t,e){var n,r,o,i;for(r=63;r>=32;--r){for(n=0,o=r-32,i=r-12;o>8,e[o]-=256*n;e[o]+=n,e[r]=0}for(n=0,o=0;o<32;o++)e[o]+=n-(e[31]>>4)*ot[o],n=e[o]>>8,e[o]&=255;for(o=0;o<32;o++)e[o]-=n*ot[o];for(r=0;r<32;r++)e[r+1]+=e[r]>>8,t[r]=255&e[r]}function st(t){var e,n=new Float64Array(64);for(e=0;e<64;e++)n[e]=t[e];for(e=0;e<64;e++)t[e]=0;it(t,n)}function ct(t,n,r,o){var i,s,c=new Uint8Array(64),a=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),f=[e(),e(),e(),e()];V(c,o,32),c[0]&=248,c[31]&=127,c[31]|=64;var p=r+64;for(i=0;i>7&&B(t[0],s,t[0]),z(t[3],t[0],t[1]),0)}(p,o))return-1;for(i=0;i=0},t.sign.keyPair=function(){var t=new Uint8Array(32),e=new Uint8Array(64);return rt(t,e),{publicKey:t,secretKey:e}},t.sign.keyPair.fromSecretKey=function(t){if(ht(t),64!==t.length)throw new Error("bad secret key size");for(var e=new Uint8Array(32),n=0;n>>6)+r(128|63&e):r(224|e>>>12&15)+r(128|e>>>6&63)+r(128|63&e)},h=function(t){return t.replace(/[^\x00-\x7F]/g,u)},f=function(t){var e=[0,2,1][t.length%3],n=t.charCodeAt(0)<<16|(t.length>1?t.charCodeAt(1):0)<<8|(t.length>2?t.charCodeAt(2):0);return[o.charAt(n>>>18),o.charAt(n>>>12&63),e>=2?"=":o.charAt(n>>>6&63),e>=1?"=":o.charAt(63&n)].join("")},p=self.btoa||function(t){return t.replace(/[\s\S]{1,3}/g,f)},l=function(){function t(t,e,n,r){var o=this;this.clear=e,this.timer=t((function(){o.timer&&(o.timer=r(o.timer))}),n)}return t.prototype.isRunning=function(){return null!==this.timer},t.prototype.ensureAborted=function(){this.timer&&(this.clear(this.timer),this.timer=null)},t}(),d=(a=function(t,e){return(a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}a(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});function y(t){self.clearTimeout(t)}function b(t){self.clearInterval(t)}var v=function(t){function e(e,n){return t.call(this,setTimeout,y,e,(function(t){return n(),null}))||this}return d(e,t),e}(l),g=function(t){function e(e,n){return t.call(this,setInterval,b,e,(function(t){return n(),t}))||this}return d(e,t),e}(l),m={now:function(){return Date.now?Date.now():(new Date).valueOf()},defer:function(t){return new v(0,t)},method:function(t){for(var e=[],n=1;n0)for(r=0;r=1002&&t.code<=1004?"backoff":null:4e3===t.code?"tls_only":t.code<4100?"refused":t.code<4200?"backoff":t.code<4300?"retry":"refused"},getCloseError:function(t){return 1e3!==t.code&&1001!==t.code?{type:"PusherError",data:{code:t.code,message:t.reason||t.message}}:null}},$=Q,tt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),et=function(t){function e(e,n){var r=t.call(this)||this;return r.id=e,r.transport=n,r.activityTimeout=n.activityTimeout,r.bindListeners(),r}return tt(e,t),e.prototype.handlesActivityChecks=function(){return this.transport.handlesActivityChecks()},e.prototype.send=function(t){return this.transport.send(t)},e.prototype.send_event=function(t,e,n){var r={event:t,data:e};return n&&(r.channel=n),H.debug("Event sent",r),this.send($.encodeMessage(r))},e.prototype.ping=function(){this.transport.supportsPing()?this.transport.ping():this.send_event("pusher:ping",{})},e.prototype.close=function(){this.transport.close()},e.prototype.bindListeners=function(){var t=this,e={message:function(e){var n;try{n=$.decodeMessage(e)}catch(n){t.emit("error",{type:"MessageParseError",error:n,data:e.data})}if(void 0!==n){switch(H.debug("Event recd",n),n.event){case"pusher:error":t.emit("error",{type:"PusherError",data:n.data});break;case"pusher:ping":t.emit("ping");break;case"pusher:pong":t.emit("pong")}t.emit("message",n)}},activity:function(){t.emit("activity")},error:function(e){t.emit("error",{type:"WebSocketError",error:e})},closed:function(e){n(),e&&e.code&&t.handleCloseEvent(e),t.transport=null,t.emit("closed")}},n=function(){k(e,(function(e,n){t.transport.unbind(n,e)}))};k(e,(function(e,n){t.transport.bind(n,e)}))},e.prototype.handleCloseEvent=function(t){var e=$.getCloseAction(t),n=$.getCloseError(t);n&&this.emit("error",n),e&&this.emit(e,{action:e,error:n})},e}(D),nt=function(){function t(t,e){this.transport=t,this.callback=e,this.bindListeners()}return t.prototype.close=function(){this.unbindListeners(),this.transport.close()},t.prototype.bindListeners=function(){var t=this;this.onMessage=function(e){var n;t.unbindListeners();try{n=$.processHandshake(e)}catch(e){return t.finish("error",{error:e}),void t.transport.close()}"connected"===n.action?t.finish("connected",{connection:new et(n.id,t.transport),activityTimeout:n.activityTimeout}):(t.finish(n.action,{error:n.error}),t.transport.close())},this.onClosed=function(e){t.unbindListeners();var n=$.getCloseAction(e)||"backoff",r=$.getCloseError(e);t.finish(n,{error:r})},this.transport.bind("message",this.onMessage),this.transport.bind("closed",this.onClosed)},t.prototype.unbindListeners=function(){this.transport.unbind("message",this.onMessage),this.transport.unbind("closed",this.onClosed)},t.prototype.finish=function(t,e){this.callback(_({transport:this.transport,action:t},e))},t}(),rt=function(){function t(t,e){this.channel=t;var n=e.authTransport;if(void 0===re.getAuthorizers()[n])throw"'"+n+"' is not a recognized auth transport";this.type=n,this.options=e,this.authOptions=(e||{}).auth||{}}return t.prototype.composeQuery=function(t){var e="socket_id="+encodeURIComponent(t)+"&channel_name="+encodeURIComponent(this.channel.name);for(var n in this.authOptions.params)e+="&"+encodeURIComponent(n)+"="+encodeURIComponent(this.authOptions.params[n]);return e},t.prototype.authorize=function(e,n){t.authorizers=t.authorizers||re.getAuthorizers(),t.authorizers[this.type].call(this,re,e,n)},t}(),ot=function(){function t(t,e){this.timeline=t,this.options=e||{}}return t.prototype.send=function(t,e){this.timeline.isEmpty()||this.timeline.send(re.TimelineTransport.getAgent(this,t),e)},t}(),it=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),st=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ct=(function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}it(e,t)}(Error),function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error)),at=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ut=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ht=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),ft=function(t){function e(e){var n=this.constructor,r=t.call(this,e)||this;return Object.setPrototypeOf(r,n.prototype),r}return it(e,t),e}(Error),pt={baseUrl:"https://pusher.com",urls:{authenticationEndpoint:{path:"/docs/authenticating_users"},javascriptQuickStart:{path:"/docs/javascript_quick_start"},triggeringClientEvents:{path:"/docs/client_api_guide/client_events#trigger-events"}}},lt=function(t){var e,n=pt.urls[t];return n?(n.fullUrl?e=n.fullUrl:n.path&&(e=pt.baseUrl+n.path),e?"See: "+e:""):""},dt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),yt=function(t){function e(e,n){var r=t.call(this,(function(t,n){H.debug("No callbacks on "+e+" for "+t)}))||this;return r.name=e,r.pusher=n,r.subscribed=!1,r.subscriptionPending=!1,r.subscriptionCancelled=!1,r}return dt(e,t),e.prototype.authorize=function(t,e){return e(!1,{auth:""})},e.prototype.trigger=function(t,e){if(0!==t.indexOf("client-"))throw new st("Event '"+t+"' does not start with 'client-'");if(!this.subscribed){var n=lt("triggeringClientEvents");H.warn("Client event triggered before channel 'subscription_succeeded' event . "+n)}return this.pusher.send_event(t,e,this.name)},e.prototype.disconnect=function(){this.subscribed=!1,this.subscriptionPending=!1},e.prototype.handleEvent=function(t){var e=t.event,n=t.data;if("pusher_internal:subscription_succeeded"===e)this.handleSubscriptionSucceededEvent(t);else if(0!==e.indexOf("pusher_internal:")){this.emit(e,n,{})}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):this.emit("pusher:subscription_succeeded",t.data)},e.prototype.subscribe=function(){var t=this;this.subscribed||(this.subscriptionPending=!0,this.subscriptionCancelled=!1,this.authorize(this.pusher.connection.socket_id,(function(e,n){e?(H.error(n),t.emit("pusher:subscription_error",n)):(n=n,t.pusher.send_event("pusher:subscribe",{auth:n.auth,channel_data:n.channel_data,channel:t.name}))})))},e.prototype.unsubscribe=function(){this.subscribed=!1,this.pusher.send_event("pusher:unsubscribe",{channel:this.name})},e.prototype.cancelSubscription=function(){this.subscriptionCancelled=!0},e.prototype.reinstateSubscription=function(){this.subscriptionCancelled=!1},e}(D),bt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),vt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return bt(e,t),e.prototype.authorize=function(t,e){return Pt.createAuthorizer(this,this.pusher.config).authorize(t,e)},e}(yt),gt=function(){function t(){this.reset()}return t.prototype.get=function(t){return Object.prototype.hasOwnProperty.call(this.members,t)?{id:t,info:this.members[t]}:null},t.prototype.each=function(t){var e=this;k(this.members,(function(n,r){t(e.get(r))}))},t.prototype.setMyID=function(t){this.myID=t},t.prototype.onSubscription=function(t){this.members=t.presence.hash,this.count=t.presence.count,this.me=this.get(this.myID)},t.prototype.addMember=function(t){return null===this.get(t.user_id)&&this.count++,this.members[t.user_id]=t.user_info,this.get(t.user_id)},t.prototype.removeMember=function(t){var e=this.get(t.user_id);return e&&(delete this.members[t.user_id],this.count--),e},t.prototype.reset=function(){this.members={},this.count=0,this.myID=null,this.me=null},t}(),mt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),_t=function(t){function e(e,n){var r=t.call(this,e,n)||this;return r.members=new gt,r}return mt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(!t){if(void 0===(e=e).channel_data){var o=lt("authenticationEndpoint");return H.error("Invalid auth response for channel '"+r.name+"',expected 'channel_data' field. "+o),void n("Invalid auth response")}var i=JSON.parse(e.channel_data);r.members.setMyID(i.user_id)}n(t,e)}))},e.prototype.handleEvent=function(t){var e=t.event;if(0===e.indexOf("pusher_internal:"))this.handleInternalEvent(t);else{var n=t.data,r={};t.user_id&&(r.user_id=t.user_id),this.emit(e,n,r)}},e.prototype.handleInternalEvent=function(t){var e=t.event,n=t.data;switch(e){case"pusher_internal:subscription_succeeded":this.handleSubscriptionSucceededEvent(t);break;case"pusher_internal:member_added":var r=this.members.addMember(n);this.emit("pusher:member_added",r);break;case"pusher_internal:member_removed":var o=this.members.removeMember(n);o&&this.emit("pusher:member_removed",o)}},e.prototype.handleSubscriptionSucceededEvent=function(t){this.subscriptionPending=!1,this.subscribed=!0,this.subscriptionCancelled?this.pusher.unsubscribe(this.name):(this.members.onSubscription(t.data),this.emit("pusher:subscription_succeeded",this.members))},e.prototype.disconnect=function(){this.members.reset(),t.prototype.disconnect.call(this)},e}(vt),wt=n(0),St=n(1),kt=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),Tt=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.key=null,e}return kt(e,t),e.prototype.authorize=function(e,n){var r=this;t.prototype.authorize.call(this,e,(function(t,e){if(t)n(!0,e);else{var o=e.shared_secret;if(o)r.key=Object(St.decodeBase64)(o),delete e.shared_secret,n(!1,e);else{var i="No shared_secret key in auth payload for encrypted channel: "+r.name;n(!0,i)}}}))},e.prototype.trigger=function(t,e){throw new ut("Client events are not currently supported for encrypted channels")},e.prototype.handleEvent=function(e){var n=e.event,r=e.data;0!==n.indexOf("pusher_internal:")&&0!==n.indexOf("pusher:")?this.handleEncryptedEvent(n,r):t.prototype.handleEvent.call(this,e)},e.prototype.handleEncryptedEvent=function(t,e){var n=this;if(this.key)if(e.ciphertext&&e.nonce){var r=Object(St.decodeBase64)(e.ciphertext);if(r.length0&&this.emit("connecting_in",Math.round(t/1e3)),this.retryTimer=new v(t||0,(function(){e.disconnectInternally(),e.connect()}))},e.prototype.clearRetryTimer=function(){this.retryTimer&&(this.retryTimer.ensureAborted(),this.retryTimer=null)},e.prototype.setUnavailableTimer=function(){var t=this;this.unavailableTimer=new v(this.options.unavailableTimeout,(function(){t.updateState("unavailable")}))},e.prototype.clearUnavailableTimer=function(){this.unavailableTimer&&this.unavailableTimer.ensureAborted()},e.prototype.sendActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection.ping(),this.activityTimer=new v(this.options.pongTimeout,(function(){t.timeline.error({pong_timed_out:t.options.pongTimeout}),t.retryIn(0)}))},e.prototype.resetActivityCheck=function(){var t=this;this.stopActivityCheck(),this.connection&&!this.connection.handlesActivityChecks()&&(this.activityTimer=new v(this.activityTimeout,(function(){t.sendActivityCheck()})))},e.prototype.stopActivityCheck=function(){this.activityTimer&&this.activityTimer.ensureAborted()},e.prototype.buildConnectionCallbacks=function(t){var e=this;return _({},t,{message:function(t){e.resetActivityCheck(),e.emit("message",t)},ping:function(){e.send_event("pusher:pong",{})},activity:function(){e.resetActivityCheck()},error:function(t){e.emit("error",{type:"WebSocketError",error:t})},closed:function(){e.abandonConnection(),e.shouldRetry()&&e.retryIn(1e3)}})},e.prototype.buildHandshakeCallbacks=function(t){var e=this;return _({},t,{connected:function(t){e.activityTimeout=Math.min(e.options.activityTimeout,t.activityTimeout,t.connection.activityTimeout||1/0),e.clearUnavailableTimer(),e.setConnection(t.connection),e.socket_id=e.connection.id,e.updateState("connected",{socket_id:e.socket_id})}})},e.prototype.buildErrorCallbacks=function(){var t=this,e=function(e){return function(n){n.error&&t.emit("error",{type:"WebSocketError",error:n.error}),e(n)}};return{tls_only:e((function(){t.usingTLS=!0,t.updateStrategy(),t.retryIn(0)})),refused:e((function(){t.disconnect()})),backoff:e((function(){t.retryIn(1e3)})),retry:e((function(){t.retryIn(0)}))}},e.prototype.setConnection=function(t){for(var e in this.connection=t,this.connectionCallbacks)this.connection.bind(e,this.connectionCallbacks[e]);this.resetActivityCheck()},e.prototype.abandonConnection=function(){if(this.connection){for(var t in this.stopActivityCheck(),this.connectionCallbacks)this.connection.unbind(t,this.connectionCallbacks[t]);var e=this.connection;return this.connection=null,e}},e.prototype.updateState=function(t,e){var n=this.state;if(this.state=t,n!==t){var r=t;"connected"===r&&(r+=" with new socket ID "+e.socket_id),H.debug("State changed",n+" -> "+r),this.timeline.info({state:t,params:e}),this.emit("state_change",{previous:n,current:t}),this.emit(t,e)}},e.prototype.shouldRetry=function(){return"connecting"===this.state||"connected"===this.state},e}(D),At=function(){function t(){this.channels={}}return t.prototype.add=function(t,e){return this.channels[t]||(this.channels[t]=function(t,e){return 0===t.indexOf("private-encrypted-")?Pt.createEncryptedChannel(t,e):0===t.indexOf("private-")?Pt.createPrivateChannel(t,e):0===t.indexOf("presence-")?Pt.createPresenceChannel(t,e):Pt.createChannel(t,e)}(t,e)),this.channels[t]},t.prototype.all=function(){return function(t){var e=[];return k(t,(function(t){e.push(t)})),e}(this.channels)},t.prototype.find=function(t){return this.channels[t]},t.prototype.remove=function(t){var e=this.channels[t];return delete this.channels[t],e},t.prototype.disconnect=function(){k(this.channels,(function(t){t.disconnect()}))},t}();var Pt={createChannels:function(){return new At},createConnectionManager:function(t,e){return new Ct(t,e)},createChannel:function(t,e){return new yt(t,e)},createPrivateChannel:function(t,e){return new vt(t,e)},createPresenceChannel:function(t,e){return new _t(t,e)},createEncryptedChannel:function(t,e){return new Tt(t,e)},createTimelineSender:function(t,e){return new ot(t,e)},createAuthorizer:function(t,e){return e.authorizer?e.authorizer(t,e):new rt(t,e)},createHandshake:function(t,e){return new nt(t,e)},createAssistantToTheTransportManager:function(t,e,n){return new V(t,e,n)}},Et=function(){function t(t){this.options=t||{},this.livesLeft=this.options.lives||1/0}return t.prototype.getAssistant=function(t){return Pt.createAssistantToTheTransportManager(this,t,{minPingDelay:this.options.minPingDelay,maxPingDelay:this.options.maxPingDelay})},t.prototype.isAlive=function(){return this.livesLeft>0},t.prototype.reportDeath=function(){this.livesLeft-=1},t}(),xt=function(){function t(t,e){this.strategies=t,this.loop=Boolean(e.loop),this.failFast=Boolean(e.failFast),this.timeout=e.timeout,this.timeoutLimit=e.timeoutLimit}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){var n=this,r=this.strategies,o=0,i=this.timeout,s=null,c=function(a,u){u?e(null,u):(o+=1,n.loop&&(o%=r.length),o0&&(o=new v(n.timeout,(function(){i.abort(),r(!0)}))),i=t.connect(e,(function(t,e){t&&o&&o.isRunning()&&!n.failFast||(o&&o.ensureAborted(),r(t,e))})),{abort:function(){o&&o.ensureAborted(),i.abort()},forceMinPriority:function(t){i.forceMinPriority(t)}}},t}(),Lt=function(){function t(t){this.strategies=t}return t.prototype.isSupported=function(){return E(this.strategies,m.method("isSupported"))},t.prototype.connect=function(t,e){return function(t,e,n){var r=C(t,(function(t,r,o,i){return t.connect(e,n(r,i))}));return{abort:function(){O(r,Ut)},forceMinPriority:function(t){O(r,(function(e){e.forceMinPriority(t)}))}}}(this.strategies,t,(function(t,n){return function(r,o){n[t].error=r,r?function(t){return function(t,e){for(var n=0;n=m.now()){var i=this.transports[r.transport];i&&(this.timeline.info({cached:!0,transport:r.transport,latency:r.latency}),o.push(new xt([i],{timeout:2*r.latency+1e3,failFast:!0})))}var s=m.now(),c=o.pop().connect(t,(function r(i,a){i?(jt(n),o.length>0?(s=m.now(),c=o.pop().connect(t,r)):e(i)):(!function(t,e,n){var r=re.getLocalStorage();if(r)try{r[Rt(t)]=U({timestamp:m.now(),transport:e,latency:n})}catch(t){}}(n,a.transport.name,m.now()-s),e(null,a))}));return{abort:function(){c.abort()},forceMinPriority:function(e){t=e,c&&c.forceMinPriority(e)}}},t}();function Rt(t){return"pusherTransport"+(t?"TLS":"NonTLS")}function jt(t){var e=re.getLocalStorage();if(e)try{delete e[Rt(t)]}catch(t){}}var It=function(){function t(t,e){var n=e.delay;this.strategy=t,this.options={delay:n}}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n,r=this.strategy,o=new v(this.options.delay,(function(){n=r.connect(t,e)}));return{abort:function(){o.ensureAborted(),n&&n.abort()},forceMinPriority:function(e){t=e,n&&n.forceMinPriority(e)}}},t}(),Nt=function(){function t(t,e,n){this.test=t,this.trueBranch=e,this.falseBranch=n}return t.prototype.isSupported=function(){return(this.test()?this.trueBranch:this.falseBranch).isSupported()},t.prototype.connect=function(t,e){return(this.test()?this.trueBranch:this.falseBranch).connect(t,e)},t}(),Bt=function(){function t(t){this.strategy=t}return t.prototype.isSupported=function(){return this.strategy.isSupported()},t.prototype.connect=function(t,e){var n=this.strategy.connect(t,(function(t,r){r&&n.abort(),e(t,r)}));return n},t}();function zt(t){return function(){return t.isSupported()}}var Dt,Ht=function(t,e){var n={};function r(r,o,i,s,c){var a=e(t,r,o,i,s,c);return n[r]=a,a}var o,i={hostNonTLS:t.wsHost+":"+t.wsPort,hostTLS:t.wsHost+":"+t.wssPort,httpPath:t.wsPath},s=_({},i,{useTLS:!0}),c={hostNonTLS:t.httpHost+":"+t.httpPort,hostTLS:t.httpHost+":"+t.httpsPort,httpPath:t.httpPath},a={loop:!0,timeout:15e3,timeoutLimit:6e4},u=new Et({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),h=new Et({lives:2,minPingDelay:1e4,maxPingDelay:t.activity_timeout}),f=r("ws","ws",3,i,u),p=r("wss","ws",3,s,u),l=r("xhr_streaming","xhr_streaming",1,c,h),d=r("xhr_polling","xhr_polling",1,c),y=new xt([f],a),b=new xt([p],a),v=new xt([l],a),g=new xt([d],a),m=new xt([new Nt(zt(v),new Lt([v,new It(g,{delay:4e3})]),g)],a);return o=t.useTLS?new Lt([y,new It(m,{delay:2e3})]):new Lt([y,new It(b,{delay:2e3}),new It(m,{delay:5e3})]),new Mt(new Bt(new Nt(zt(f),o,m)),n,{ttl:18e5,timeline:t.timeline,useTLS:t.useTLS})},Ft=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),qt=function(t){function e(e,n,r){var o=t.call(this)||this;return o.hooks=e,o.method=n,o.url=r,o}return Ft(e,t),e.prototype.start=function(t){var e=this;this.position=0,this.xhr=this.hooks.getRequest(this),this.unloader=function(){e.close()},re.addUnloadListener(this.unloader),this.xhr.open(this.method,this.url,!0),this.xhr.setRequestHeader&&this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.send(t)},e.prototype.close=function(){this.unloader&&(re.removeUnloadListener(this.unloader),this.unloader=null),this.xhr&&(this.hooks.abortRequest(this.xhr),this.xhr=null)},e.prototype.onChunk=function(t,e){for(;;){var n=this.advanceBuffer(e);if(!n)break;this.emit("chunk",{status:t,data:n})}this.isBufferTooLong(e)&&this.emit("buffer_too_long")},e.prototype.advanceBuffer=function(t){var e=t.slice(this.position),n=e.indexOf("\n");return-1!==n?(this.position+=n+1,e.slice(0,n)):null},e.prototype.isBufferTooLong=function(t){return this.position===t.length&&t.length>262144},e}(D);!function(t){t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSED=3]="CLOSED"}(Dt||(Dt={}));var Yt=Dt,Kt=1;function Jt(t){var e=-1===t.indexOf("?")?"?":"&";return t+e+"t="+ +new Date+"&n="+Kt++}function Wt(t){return Math.floor(Math.random()*t)}var Xt,Gt=function(){function t(t,e){this.hooks=t,this.session=Wt(1e3)+"/"+function(t){for(var e=[],n=0;n0&&t.onChunk(e.status,e.responseText);break;case 4:e.responseText&&e.responseText.length>0&&t.onChunk(e.status,e.responseText),t.emit("finished",e.status),t.close()}},e},abortRequest:function(t){t.onreadystatechange=null,t.abort()}},$t={getDefaultStrategy:Ht,Transports:Z,transportConnectionInitializer:function(){this.timeline.info(this.buildTimelineMessage({transport:this.name+(this.options.useTLS?"s":"")})),this.hooks.isInitialized()?this.changeState("initialized"):this.onClose()},HTTPFactory:{createStreamingSocket:function(t){return this.createSocket(Zt,t)},createPollingSocket:function(t){return this.createSocket(Vt,t)},createSocket:function(t,e){return new Gt(t,e)},createXHR:function(t,e){return this.createRequest(Qt,t,e)},createRequest:function(t,e,n){return new qt(t,e,n)}},setup:function(t){t.ready()},getLocalStorage:function(){},getClientFeatures:function(){return T(P({ws:Z.ws},(function(t){return t.isSupported({})})))},getProtocol:function(){return"http:"},isXHRSupported:function(){return!0},createSocketRequest:function(t,e){if(this.isXHRSupported())return this.HTTPFactory.createXHR(t,e);throw"Cross-origin HTTP requests are not supported"},createXHR:function(){return new(this.getXHRAPI())},createWebSocket:function(t){return new(this.getWebSocketAPI())(t)},addUnloadListener:function(t){},removeUnloadListener:function(t){}},te=function(){var t=function(e,n){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(e,n)};return function(e,n){function r(){this.constructor=e}t(e,n),e.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),ee=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return te(e,t),e.prototype.isOnline=function(){return!0},e}(D)),ne=function(t,e,n){var r=new Headers;for(var o in r.set("Content-Type","application/x-www-form-urlencoded"),this.authOptions.headers)r.set(o,this.authOptions.headers[o]);var i=this.composeQuery(e),s=new Request(this.options.authEndpoint,{headers:r,body:i,credentials:"same-origin",method:"POST"});return fetch(s).then((function(t){var e=t.status;if(200===e)return t.text();throw H.error("Couldn't get auth info from your auth endpoint",e),e})).then((function(t){try{t=JSON.parse(t)}catch(n){var e="JSON returned from auth endpoint was invalid, yet status code was 200. Data was: "+t;throw H.error(e),e}n(!1,t)})).catch((function(t){n(!0,t)}))},re={getDefaultStrategy:$t.getDefaultStrategy,Transports:$t.Transports,setup:$t.setup,getProtocol:$t.getProtocol,isXHRSupported:$t.isXHRSupported,getLocalStorage:$t.getLocalStorage,createXHR:$t.createXHR,createWebSocket:$t.createWebSocket,addUnloadListener:$t.addUnloadListener,removeUnloadListener:$t.removeUnloadListener,transportConnectionInitializer:$t.transportConnectionInitializer,createSocketRequest:$t.createSocketRequest,HTTPFactory:$t.HTTPFactory,TimelineTransport:{name:"xhr",getAgent:function(t,e){return function(n,r){var o="http"+(e?"s":"")+"://"+(t.host||t.options.host)+t.options.path,i=L(n);fetch(o+="/2?"+i).then((function(t){if(200!==t.status)throw"received "+t.status+" from stats.pusher.com";return t.json()})).then((function(e){var n=e.host;n&&(t.host=n)})).catch((function(t){H.debug("TimelineSender Error: ",t)}))}}},getAuthorizers:function(){return{ajax:ne}},getWebSocketAPI:function(){return WebSocket},getXHRAPI:function(){return XMLHttpRequest},getNetwork:function(){return ee}};!function(t){t[t.ERROR=3]="ERROR",t[t.INFO=6]="INFO",t[t.DEBUG=7]="DEBUG"}(Xt||(Xt={}));var oe=Xt,ie=function(){function t(t,e,n){this.key=t,this.session=e,this.events=[],this.options=n||{},this.sent=0,this.uniqueID=0}return t.prototype.log=function(t,e){t<=this.options.level&&(this.events.push(_({},e,{timestamp:m.now()})),this.options.limit&&this.events.length>this.options.limit&&this.events.shift())},t.prototype.error=function(t){this.log(oe.ERROR,t)},t.prototype.info=function(t){this.log(oe.INFO,t)},t.prototype.debug=function(t){this.log(oe.DEBUG,t)},t.prototype.isEmpty=function(){return 0===this.events.length},t.prototype.send=function(t,e){var n=this,r=_({session:this.session,bundle:this.sent+1,key:this.key,lib:"js",version:this.options.version,cluster:this.options.cluster,features:this.options.features,timeline:this.events},this.options.params);return this.events=[],t(r,(function(t,r){t||n.sent++,e&&e(t,r)})),!0},t.prototype.generateUniqueID=function(){return this.uniqueID++,this.uniqueID},t}(),se=function(){function t(t,e,n,r){this.name=t,this.priority=e,this.transport=n,this.options=r||{}}return t.prototype.isSupported=function(){return this.transport.isSupported({useTLS:this.options.useTLS})},t.prototype.connect=function(t,e){var n=this;if(!this.isSupported())return ce(new ft,e);if(this.priority