Socket
Socket
Sign inDemoInstall

faye

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

faye - npm Package Compare versions

Comparing version 1.2.5 to 1.3.0

LICENSE.md

578

CHANGELOG.md

@@ -0,5 +1,30 @@

### 1.3.0 / 2020-06-08
- Support `user:pass@` authorization in URIs and send `Authorization` headers
from the Node HTTP transport
- Support IPv6 hostnames in URIs
- Allow credentials (cookies and `Authorization` headers) in cross-origin
requests, by:
- setting `Access-Control-Allow-Origin` to the value of the `Origin` header
(not `*`)
- enabling `Access-Control-Allow-Credentials`
- Enable credentials when sending cross-origin requests
- Don't disconnect WebSocket on page unload if `autodisconnect` is turned off
- Catch errors when creating a WebSocket, which happens when Content Security
Policy blocks it, allowing other transports to be tried
- Fix a bug in the client where it handles messages from other clients as though
they're the server's response to its own messages, based on the `id` field;
now we only treat messages as server responses if they contain `successful:
true`
- Stop sending an empty message list `[]` from the WebSocket client as a
keep-alive mechanism since CometD does not accept this message
- Fix deprecation warnings for using the `new Buffer()` constructor
- Switch to the Apache 2.0 license
### 1.2.5 / 2020-04-28
* Fix `/meta/*` channel recognition bug in the server that enables authentication bypass
* https://blog.jcoglan.com/2020/04/28/authentication-bypass-in-faye/
- Fix `/meta/*` channel recognition bug in the server that enables
authentication bypass
- https://blog.jcoglan.com/2020/04/28/authentication-bypass-in-faye/

@@ -9,5 +34,5 @@

* Fix `RackAdapter#get_client` that was failing due to a URI error
* Define `Promise#catch` in a safe way for old browsers
* Log errors in the Node HTTP transport
- Fix `RackAdapter#get_client` that was failing due to a URI error
- Define `Promise#catch` in a safe way for old browsers
- Log errors in the Node HTTP transport

@@ -17,4 +42,5 @@

* Return an error if the `data` field is missing on published messages
* Fix errors that occur in the new `websocket` util when the browser does not support WebSocket
- Return an error if the `data` field is missing on published messages
- Fix errors that occur in the new `websocket` util when the browser does not
support WebSocket

@@ -24,3 +50,3 @@

* Mitigate the HTTPoxy vulnerability: https://httpoxy.org/
- Mitigate the HTTPoxy vulnerability: https://httpoxy.org/

@@ -30,3 +56,3 @@

* Fix a missing variable error in `NodeAdapter`
- Fix a missing variable error in `NodeAdapter`

@@ -36,24 +62,36 @@

* Add `client.subscribe().withChannel()` to yield the message channel for wildcard subscriptions
* Restructure the JavaScript codebase around Node modules (require/exports) rather than globals
* Update the Promise shim to reflect the standard API, including `catch()` and `all()`
* Support connecting to servers that use SNI in the Ruby client
* Make the JavaScript client work inside React Native and Web Workers
* Remove JSON2; you should import a JSON shim yourself if necessary
* Handle errors that occur when a message is partially delivered via EventSource
* Reject requests with invalid (non-array or -object) top-level JSON values
* Make local client requests asynchronous to avoid re-entrant request handling errors
* Remove `Connection: Close` from HTTP responses to allow use of keep-alive
* Use `XMLHttpRequest` in preference to the ActiveX API in IE10
* Fix bug where flushing large message batches puts promises in an invalid state
- Add `client.subscribe().withChannel()` to yield the message channel for
wildcard subscriptions
- Restructure the JavaScript codebase around Node modules (require/exports)
rather than globals
- Update the Promise shim to reflect the standard API, including `catch()` and
`all()`
- Support connecting to servers that use SNI in the Ruby client
- Make the JavaScript client work inside React Native and Web Workers
- Remove JSON2; you should import a JSON shim yourself if necessary
- Handle errors that occur when a message is partially delivered via EventSource
- Reject requests with invalid (non-array or -object) top-level JSON values
- Make local client requests asynchronous to avoid re-entrant request handling
errors
- Remove `Connection: Close` from HTTP responses to allow use of keep-alive
- Use `XMLHttpRequest` in preference to the ActiveX API in IE10
- Fix bug where flushing large message batches puts promises in an invalid state
### 1.1.3 / 2020-04-28
- Fix `/meta/*` channel recognition bug in the server that enables
authentication bypass
- https://blog.jcoglan.com/2020/04/28/authentication-bypass-in-faye/
### 1.1.2 / 2015-07-19
* Allow the `Authorization` header to be used on CORS requests
* Disallow unused methods like PUT and DELETE on CORS requests
* Stop IE prematurely garbage-collecting `XDomainRequest` objects
* Make sure messages can be sent if they overflow the request size limit and the outbox is empty
* Don't send messages over WebSockets unless they are in the 'open' ready-state
* Fix a bug preventing use of the in-process transport in Ruby
- Allow the `Authorization` header to be used on CORS requests
- Disallow unused methods like PUT and DELETE on CORS requests
- Stop IE prematurely garbage-collecting `XDomainRequest` objects
- Make sure messages can be sent if they overflow the request size limit and the
outbox is empty
- Don't send messages over WebSockets unless they are in the 'open' ready-state
- Fix a bug preventing use of the in-process transport in Ruby

@@ -63,6 +101,7 @@

* Make sure the client ID associated with a WebSocket is not dropped, so the socket can be closed properly
* Handle cases where a JSON-P endpoint returns no response argument
* Stop trying to retry messages after the client has been disconnected
* Remove duplication of the client ID in EventSource URLs
- Make sure the client ID associated with a WebSocket is not dropped, so the
socket can be closed properly
- Handle cases where a JSON-P endpoint returns no response argument
- Stop trying to retry messages after the client has been disconnected
- Remove duplication of the client ID in EventSource URLs

@@ -72,19 +111,32 @@

* Allow the server and client to use WebSocket extensions, for example permessage-deflate
* Support the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to send all client connections through an HTTP proxy
* Introduce the `Scheduler` API to allow the user to control message retries
* Add the `attempts` and `deadline` options to `Client#publish()`
* Let `RackAdapter` take a block that yields the instance, so extensions can be added to middleware
* Allow monitoring listeners to see the `clientId` on publishd messages but still avoid sending it to subscribers
* Return a promise from `Client#disconnect()`
* Fix client-side retry bugs causing the client to flood the server with duplicate messages
* Send all transport types in the `supportedConnectionTypes` handshake parameter
* Don't close WebSockets when the client recovers from an error and sends a new `clientId`
* Replace `cookiejar` with `tough-cookie` to avoid global variable leaks
- Allow the server and client to use WebSocket extensions, for example
permessage-deflate
- Support the `HTTP_PROXY` and `HTTPS_PROXY` environment variables to send all
client connections through an HTTP proxy
- Introduce the `Scheduler` API to allow the user to control message retries
- Add the `attempts` and `deadline` options to `Client#publish()`
- Let `RackAdapter` take a block that yields the instance, so extensions can be
added to middleware
- Allow monitoring listeners to see the `clientId` on publishd messages but
still avoid sending it to subscribers
- Return a promise from `Client#disconnect()`
- Fix client-side retry bugs causing the client to flood the server with
duplicate messages
- Send all transport types in the `supportedConnectionTypes` handshake parameter
- Don't close WebSockets when the client recovers from an error and sends a new
`clientId`
- Replace `cookiejar` with `tough-cookie` to avoid global variable leaks
### 1.0.4 / 2020-04-28
- Fix `/meta/*` channel recognition bug in the server that enables
authentication bypass
- https://blog.jcoglan.com/2020/04/28/authentication-bypass-in-faye/
### 1.0.3 / 2014-07-08
* Make some changes to JSON-P responses to mitigate the Rosetta Flash attack
* http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
- Make some changes to JSON-P responses to mitigate the Rosetta Flash attack
- http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/

@@ -97,7 +149,8 @@

* Add `Adapter#close()` method for gracefully shutting down the server
* Fix error recover bug in WebSocket that made transport cycle through `up`/`down` state
* Update Promise implementation to pass `promises-aplus-tests 2.0`
* Correct some incorrect variable names in the Ruby transports
* Make logging methods public to fix a problem on Ruby 2.1
- Add `Adapter#close()` method for gracefully shutting down the server
- Fix error recover bug in WebSocket that made transport cycle through
`up`/`down` state
- Update Promise implementation to pass `promises-aplus-tests 2.0`
- Correct some incorrect variable names in the Ruby transports
- Make logging methods public to fix a problem on Ruby 2.1

@@ -107,44 +160,64 @@

* Client changes:
* Allow clients to be instantiated with URI objects rather than strings
* Add a `ca` option to the Node `Client` class for passing in trusted server certificates
* Objects supporting the `callback()` method in JavaScript are now Promises
* Fix protocol-relative URI parsing in the client
* Remove the `getClientId()` and `getState()` methods from the `Client` class
* Transport changes:
* Add request-size limiting to all batching transports
* Make the WebSocket transport more robust against quiet network periods and clients going to sleep
* Support cookies across all transports when using the client on Node.js or Ruby
* Support custom headers in the `cross-origin-long-polling` and server-side `websocket` transports
* Adapter changes:
* Support the `rack.hijack` streaming API
* Migrate to MultiJson for JSON handling on Ruby, allowing use of JRuby
* Escape U+2028 and U+2029 in JSON-P output
* Fix a bug stopping requests being routed when the mount point is `/`
* Fix various bugs that cause errors to be thrown if we try to send a message over a closed socket
* Remove the `listen()` method from `Adapter` in favour of using server-specific APIs
* Server changes:
* Use cryptographically secure random number generators to create client IDs
* Allow extensions to access request properties by using 3-ary methods
* Objects supporting the `bind()` method now implement the full `EventEmitter` API
* Stop the server from forwarding the `clientId` property of published messages
* Miscellaneous:
* Support Browserify by returning the client module
* `Faye.logger` can now be a logger object rather than a function
- Client changes:
- Allow clients to be instantiated with URI objects rather than strings
- Add a `ca` option to the Node `Client` class for passing in trusted server
certificates
- Objects supporting the `callback()` method in JavaScript are now Promises
- Fix protocol-relative URI parsing in the client
- Remove the `getClientId()` and `getState()` methods from the `Client` class
- Transport changes:
- Add request-size limiting to all batching transports
- Make the WebSocket transport more robust against quiet network periods and
clients going to sleep
- Support cookies across all transports when using the client on Node.js or
Ruby
- Support custom headers in the `cross-origin-long-polling` and server-side
`websocket` transports
- Adapter changes:
- Support the `rack.hijack` streaming API
- Migrate to MultiJson for JSON handling on Ruby, allowing use of JRuby
- Escape U+2028 and U+2029 in JSON-P output
- Fix a bug stopping requests being routed when the mount point is `/`
- Fix various bugs that cause errors to be thrown if we try to send a message
over a closed socket
- Remove the `listen()` method from `Adapter` in favour of using
server-specific APIs
- Server changes:
- Use cryptographically secure random number generators to create client IDs
- Allow extensions to access request properties by using 3-ary methods
- Objects supporting the `bind()` method now implement the full `EventEmitter`
API
- Stop the server from forwarding the `clientId` property of published
messages
- Miscellaneous:
- Support Browserify by returning the client module
- `Faye.logger` can now be a logger object rather than a function
### 0.8.11 / 2014-07-08
- Make some changes to JSON-P responses to mitigate the Rosetta Flash attack
- http://miki.it/blog/2014/7/8/abusing-jsonp-with-rosetta-flash/
### 0.8.10 -- removed due to error while publishing
### 0.8.9 / 2013-02-26
* Specify ciphers for SSL on Node to mitigate the BEAST attack
* Mitigate increased risk of socket hang-up errors in Node v0.8.20
* Fix race condition when processing outgoing extensions in the Node server
* Fix problem loading the client script when using `{mount: '/'}`
* Clean up connection objects when a WebSocket is re-used with a new clientId
* All JavaScript code now runs in strict mode
* Select transport on handshake, instead of on client creation to allow time for `disable()` calls
* Do not speculatively open WebSocket/EventSource connections if they are disabled
* Gracefully handle WebSocket messages with no data on the client side
* Close and reconnect WebSocket when onerror is fired, not just when onclose is fired
* Fix problem with caching of EventSource connections with stale clientIds
* Don't parse query strings when checking if a URL is same-origin or not
- Specify ciphers for SSL on Node to mitigate the BEAST attack
- Mitigate increased risk of socket hang-up errors in Node v0.8.20
- Fix race condition when processing outgoing extensions in the Node server
- Fix problem loading the client script when using `{mount: '/'}`
- Clean up connection objects when a WebSocket is re-used with a new clientId
- All JavaScript code now runs in strict mode
- Select transport on handshake, instead of on client creation to allow time for
`disable()` calls
- Do not speculatively open WebSocket/EventSource connections if they are
disabled
- Gracefully handle WebSocket messages with no data on the client side
- Close and reconnect WebSocket when onerror is fired, not just when onclose is
fired
- Fix problem with caching of EventSource connections with stale clientIds
- Don't parse query strings when checking if a URL is same-origin or not

@@ -154,3 +227,3 @@

* Patch security hole allowing remote execution of arbitrary Server methods
- Patch security hole allowing remote execution of arbitrary Server methods

@@ -163,3 +236,4 @@

* Make sure messages pushed to the client over a socket pass through outgoing extensions
- Make sure messages pushed to the client over a socket pass through outgoing
extensions

@@ -169,3 +243,4 @@

* Fix a bug in `URI.parse()` that caused Faye endpoints to inherit search and hash from `window.location`
- Fix a bug in `URI.parse()` that caused Faye endpoints to inherit search and
hash from `window.location`

@@ -175,10 +250,13 @@

* Optimise upgrade process so that WebSocket is tested earlier and the connection is cached
* Check that EventSource actually works to work around broken Opera implementation
* Emit `connection:open` and `connection:close` events from the Engine proxy
* Increase size of client IDs from 128 to 160 bits
* Fix bug with relative URL resolution in IE
* Limit the JSON-P transport's message buffer so it doesn't create over-long URLs
* Send `Pragma: no-cache` with XHR requests to guard against iOS 6 POST caching
* Add `charset=utf-8` to response Content-Type headers
- Optimise upgrade process so that WebSocket is tested earlier and the
connection is cached
- Check that EventSource actually works to work around broken Opera
implementation
- Emit `connection:open` and `connection:close` events from the Engine proxy
- Increase size of client IDs from 128 to 160 bits
- Fix bug with relative URL resolution in IE
- Limit the JSON-P transport's message buffer so it doesn't create over-long
URLs
- Send `Pragma: no-cache` with XHR requests to guard against iOS 6 POST caching
- Add `charset=utf-8` to response Content-Type headers

@@ -188,9 +266,10 @@

* `Client#subscribe` returns an array of Subscriptions if given an array of channels
* Allow different endpoints to be specified per-transport
* Only use IE's `XDomainRequest` for same-protocol requests
* Replace URL parser with one that treats relative URLs the same as the browser
* Improve logging of malformed requests and detect problems earlier
* Make sure socket connections are closed when a client session is timed out
* Stop WebSocket reconnecting after `window.onbeforeunload`
- `Client#subscribe` returns an array of Subscriptions if given an array of
channels
- Allow different endpoints to be specified per-transport
- Only use IE's `XDomainRequest` for same-protocol requests
- Replace URL parser with one that treats relative URLs the same as the browser
- Improve logging of malformed requests and detect problems earlier
- Make sure socket connections are closed when a client session is timed out
- Stop WebSocket reconnecting after `window.onbeforeunload`

@@ -200,7 +279,7 @@

* Fix replacement of `null` with `{}` in `copyObject()`
* Make EventSource transport trigger `transport:up/down` events
* Supply source map for minified JavaScript client, and include source in gem
* Return `Content-Length: 0` for 304 responses
* Handle pre-flight CORS requests from old versions of Safari
- Fix replacement of `null` with `{}` in `copyObject()`
- Make EventSource transport trigger `transport:up/down` events
- Supply source map for minified JavaScript client, and include source in gem
- Return `Content-Length: 0` for 304 responses
- Handle pre-flight CORS requests from old versions of Safari

@@ -210,9 +289,12 @@

* Make `Publisher#trigger` safe for event listeners that modify the listener list
* Make `Server#subscribe` return a response if the incoming message has an error
* Fix edge case in code that identifies the `clientId` of socket connections
* Return `Content-Length` headers for HTTP responses
* Don't send empty lists of messages from the WebSocket transport
* Stop client sending multiple `/meta/subscribe` messages for subscriptions made before handshaking
* Stop client treating incoming published messages as responses to `/meta/*` messages
- Make `Publisher#trigger` safe for event listeners that modify the listener
list
- Make `Server#subscribe` return a response if the incoming message has an error
- Fix edge case in code that identifies the `clientId` of socket connections
- Return `Content-Length` headers for HTTP responses
- Don't send empty lists of messages from the WebSocket transport
- Stop client sending multiple `/meta/subscribe` messages for subscriptions made
before handshaking
- Stop client treating incoming published messages as responses to `/meta/*`
messages

@@ -222,20 +304,30 @@

* Extract the Redis engine into a separate library, `faye-redis`
* Stabilize and document the Engine API so others can write backends
* Extract WebSocket and EventSource tools into a separate library, `faye-websocket`
* Improve use of WebSocket so messages are immediately pushed rather than polling
* Introduce new EventSource-based transport, for proxies that block WebSocket
* Support the Rainbows and Goliath web servers for Ruby, same as `faye-websocket`
* Improve detection of network errors and switch to fixed-interval for reconnecting
* Add `setHeader()` method to Client (e.g. for connecting to Salesforce API)
* Add `timeout()` method to `Faye.Deferrable` to match `EventMachine::Deferrable`
* Fix some bugs in client-side message handlers created with `subscribe()`
* Improve speed and memory consumption of `copyObject()`
* Switch from JSON to Yajl for JSON parsing in Ruby
- Extract the Redis engine into a separate library, `faye-redis`
- Stabilize and document the Engine API so others can write backends
- Extract WebSocket and EventSource tools into a separate library,
`faye-websocket`
- Improve use of WebSocket so messages are immediately pushed rather than
polling
- Introduce new EventSource-based transport, for proxies that block WebSocket
- Support the Rainbows and Goliath web servers for Ruby, same as
`faye-websocket`
- Improve detection of network errors and switch to fixed-interval for
reconnecting
- Add `setHeader()` method to Client (e.g. for connecting to Salesforce API)
- Add `timeout()` method to `Faye.Deferrable` to match
`EventMachine::Deferrable`
- Fix some bugs in client-side message handlers created with `subscribe()`
- Improve speed and memory consumption of `copyObject()`
- Switch from JSON to Yajl for JSON parsing in Ruby
### 0.7.2 / 2013-01-10
- Patch security hole allowing remote execution of arbitrary Server methods
### 0.7.1 / 2011-12-22
* Extension `added()` and `removed()` methods now receive the extended object
* Detection of WebSockets in RackAdapter is more strict
- Extension `added()` and `removed()` methods now receive the extended object
- Detection of WebSockets in RackAdapter is more strict

@@ -245,21 +337,27 @@

* Provide an event API for monitoring engine events on the server side
* Implement server-side WebSocket connections for improved latency
* Fix WebSocket protocol bugs and expose APIs for developers to use
* Make server-side HTTP transports support SSL and cookies
* Allow clients to disable selected transports and autodisconnection
* Add callback/errback API to `Client#publish()` interface
* Add `socket` setting for the Redis engine for connecting through a Unix socket
- Provide an event API for monitoring engine events on the server side
- Implement server-side WebSocket connections for improved latency
- Fix WebSocket protocol bugs and expose APIs for developers to use
- Make server-side HTTP transports support SSL and cookies
- Allow clients to disable selected transports and autodisconnection
- Add callback/errback API to `Client#publish()` interface
- Add `socket` setting for the Redis engine for connecting through a Unix socket
### 0.6.8 / 2013-01-10
- Patch security hole allowing remote execution of arbitrary Server methods
### 0.6.7 / 2011-10-20
* Cache client script in memory and add `ETag` and `Last-Modified` headers
* Fix bug in Node Redis engine where `undefined` was used if no namespace given
* Flush Redis message queues using a transaction to avoid re-delivery of messages
* Fix race condition and timing errors present in Redis locking code
* Use `Cache-Control: no-cache, no-store` on JSON-P responses
* Improvements to the CORS and JSON-P transports
* Prevent retry handlers in transports from being invoked multiple times
* Use the current page protocol by default when parsing relative URIs
- Cache client script in memory and add `ETag` and `Last-Modified` headers
- Fix bug in Node Redis engine where `undefined` was used if no namespace given
- Flush Redis message queues using a transaction to avoid re-delivery of
messages
- Fix race condition and timing errors present in Redis locking code
- Use `Cache-Control: no-cache, no-store` on JSON-P responses
- Improvements to the CORS and JSON-P transports
- Prevent retry handlers in transports from being invoked multiple times
- Use the current page protocol by default when parsing relative URIs

@@ -269,5 +367,6 @@

* Add `:key` and `:cert` options to the `Adapter#listen` methods for setting up SSL
* Fix error detection of CORS transport in IE9 running IE8 compatibility mode
* Fix dependency versions so that Rubygems lets Faye install
- Add `:key` and `:cert` options to the `Adapter#listen` methods for setting up
SSL
- Fix error detection of CORS transport in IE9 running IE8 compatibility mode
- Fix dependency versions so that Rubygems lets Faye install

@@ -277,6 +376,6 @@

* Fix UTF-8 encoding bugs in draft-75/76 and protocol-8 WebSocket parsers
* Switch to streaming parser for WebSocket protocol-8
* Remove an `SREM` operation that shouldn't have been in the Redis engine
* Move `thin_extensions.rb` so it's not on the Rubygems load path
- Fix UTF-8 encoding bugs in draft-75/76 and protocol-8 WebSocket parsers
- Switch to streaming parser for WebSocket protocol-8
- Remove an `SREM` operation that shouldn't have been in the Redis engine
- Move `thin_extensions.rb` so it's not on the Rubygems load path

@@ -286,5 +385,5 @@

* Support WebSocket protocol used by Chrome 14 and Firefox 6
* Fix handling of multibyte characters in WebSocket messages on Node
* Improve message routing in Node memory engine to avoid false duplicates
- Support WebSocket protocol used by Chrome 14 and Firefox 6
- Fix handling of multibyte characters in WebSocket messages on Node
- Improve message routing in Node memory engine to avoid false duplicates

@@ -294,10 +393,11 @@

* Use sequential message IDs to reduce memory usage on the client side
* Only send advice with handshake and connect responses
* Stop trying to publish `/meta/*` messages - no-one is listening and it breaks `/**`
* Fix bug causing invalid listeners to appear after a client reconnection
* Stop loading `rubygems` within our library code
* Make sure we only queue a message for each client once in the Redis engine
* Use lists instead of sets for message queues in Redis
* Improve clean-up of expired clients in Redis engine
- Use sequential message IDs to reduce memory usage on the client side
- Only send advice with handshake and connect responses
- Stop trying to publish `/meta/*` messages - no-one is listening and it breaks
`/**`
- Fix bug causing invalid listeners to appear after a client reconnection
- Stop loading `rubygems` within our library code
- Make sure we only queue a message for each client once in the Redis engine
- Use lists instead of sets for message queues in Redis
- Improve clean-up of expired clients in Redis engine

@@ -307,7 +407,7 @@

* Add authentication, database selection and namespacing to Redis engine
* Clean up all client data when removing clients from Redis
* Fix `cross-origin-long-polling` for `OPTIONS`-aware browsers
* Update secure WebSocket detection for recent Node versions
* Reinstate `faye.client` field in Rack environment
- Add authentication, database selection and namespacing to Redis engine
- Clean up all client data when removing clients from Redis
- Fix `cross-origin-long-polling` for `OPTIONS`-aware browsers
- Update secure WebSocket detection for recent Node versions
- Reinstate `faye.client` field in Rack environment

@@ -317,4 +417,4 @@

* Fix `cross-origin-long-polling` support in `RackAdapter`
* Plug some potential memory leaks in `Memory` engine
- Fix `cross-origin-long-polling` support in `RackAdapter`
- Plug some potential memory leaks in `Memory` engine

@@ -324,11 +424,12 @@

* Extract core logic into the `Engine` class to support swappable backends
* Introduce a Redis-backed engine to support clustered web front-ends
* Use CORS for `cross-domain long-polling`
* Make server more resilient against bad requests, including empty message lists
* Perform subscription validation on the server and use errbacks to signal errors
* Prohibit publishing to wildcard channels
* Unsubscribing from a channel is now O(1) instead of O(N)
* Much more thorough and consistent unit test coverage of both versions
* Automatic integration tests using Terminus and TestSwarm
- Extract core logic into the `Engine` class to support swappable backends
- Introduce a Redis-backed engine to support clustered web front-ends
- Use CORS for `cross-domain long-polling`
- Make server more resilient against bad requests, including empty message lists
- Perform subscription validation on the server and use errbacks to signal
errors
- Prohibit publishing to wildcard channels
- Unsubscribing from a channel is now O(1) instead of O(N)
- Much more thorough and consistent unit test coverage of both versions
- Automatic integration tests using Terminus and TestSwarm

@@ -338,4 +439,4 @@

* Open a real socket to check for WebSocket usability, not just object detection
* Catch server-side errors when handshaking with WebSockets
- Open a real socket to check for WebSocket usability, not just object detection
- Catch server-side errors when handshaking with WebSockets

@@ -345,7 +446,8 @@

* Add a `#callback` method to `Subscriptions` to detect when they become active
* Add `:extensions` option to `RackAdapter` to make it easier to extend middleware
* Detect secure WebSocket requests through the `HTTP_X_FORWARDED_PROTO` header
* Handle socket errors when sending WebSocket messages from `NodeAdapter`
* Use exponential backoff to reconnect client-side WebSockets to reduce CPU load
- Add a `#callback` method to `Subscriptions` to detect when they become active
- Add `:extensions` option to `RackAdapter` to make it easier to extend
middleware
- Detect secure WebSocket requests through the `HTTP_X_FORWARDED_PROTO` header
- Handle socket errors when sending WebSocket messages from `NodeAdapter`
- Use exponential backoff to reconnect client-side WebSockets to reduce CPU load

@@ -355,9 +457,9 @@

* Improve detection of `wss:` requirement for secure WebSocket connections
* Correctly use default ports (80,443) for server-side HTTP connections
* Support legacy `application/x-www-form-urlencoded` POST requests
* Delete unused Channel objects that have all their subscribers removed
* Fix resend/reconnect logic in WebSocket transport
* Keep client script in memory rather than reading it from disk every time
* Prevent error-adding extensions from breaking the core protocol
- Improve detection of `wss:` requirement for secure WebSocket connections
- Correctly use default ports (80,443) for server-side HTTP connections
- Support legacy `application/x-www-form-urlencoded` POST requests
- Delete unused Channel objects that have all their subscribers removed
- Fix resend/reconnect logic in WebSocket transport
- Keep client script in memory rather than reading it from disk every time
- Prevent error-adding extensions from breaking the core protocol

@@ -367,4 +469,4 @@

* Support draft-76 of the WebSocket protocol (FF4, Chrome 6)
* Reduce `Connection::MAX_DELAY` to improve latency
- Support draft-76 of the WebSocket protocol (FF4, Chrome 6)
- Reduce `Connection::MAX_DELAY` to improve latency

@@ -374,3 +476,3 @@

* Fix a publishing problem in Ruby `LocalTransport`
- Fix a publishing problem in Ruby `LocalTransport`

@@ -380,11 +482,11 @@

* Handle multiple event listeners bound to a channel
* Add extension system for adding domain-specific logic to the protocol
* Improve handling of client reconnections if the server goes down
* Change default polling interval to 0 (immediate reconnect)
* Add support for WebSockets (draft75 only) as a network transport
* Remove support for Ruby servers other than Thin
* Make client and server compatible with CometD (1.x and 2.0) components
* Improve clean-up of unused server-side connections
* Change Node API for adding Faye service to an HTTP server
- Handle multiple event listeners bound to a channel
- Add extension system for adding domain-specific logic to the protocol
- Improve handling of client reconnections if the server goes down
- Change default polling interval to 0 (immediate reconnect)
- Add support for WebSockets (draft75 only) as a network transport
- Remove support for Ruby servers other than Thin
- Make client and server compatible with CometD (1.x and 2.0) components
- Improve clean-up of unused server-side connections
- Change Node API for adding Faye service to an HTTP server

@@ -394,3 +496,4 @@

* Stop local clients going into an infinite loop if a subscription block causes a reconnect
- Stop local clients going into an infinite loop if a subscription block causes
a reconnect

@@ -400,5 +503,5 @@

* Bring Node APIs up to date with 0.1.97
* Catch `ECONNREFUSED` errors in Node clients to withstand server outages
* Refactor the `Server` internals
- Bring Node APIs up to date with 0.1.97
- Catch `ECONNREFUSED` errors in Node clients to withstand server outages
- Refactor the `Server` internals

@@ -408,10 +511,11 @@

* Fix problems with JSON serialization when Prototype, MooTools present
* Make the client reconnect if it doesn't hear from the server after a timeout
* Stop JavaScript server returning `NaN` for `advice.interval`
* Make Ruby server return an integer for `advice.interval`
* Ensure EventMachine is running before handling messages
* Handle `data` and `end` events properly in Node HTTP API
* Switch to `application/json` for content types and stop using querystring format in POST bodies
* Respond to any URL path under the mount point, not just the exact match
- Fix problems with JSON serialization when Prototype, MooTools present
- Make the client reconnect if it doesn't hear from the server after a timeout
- Stop JavaScript server returning `NaN` for `advice.interval`
- Make Ruby server return an integer for `advice.interval`
- Ensure EventMachine is running before handling messages
- Handle `data` and `end` events properly in Node HTTP API
- Switch to `application/json` for content types and stop using querystring
format in POST bodies
- Respond to any URL path under the mount point, not just the exact match

@@ -421,4 +525,4 @@

* Pass client down through Rack stack as `env['faye.client']`
* Refactor some JavaScript internals to mirror Ruby codebase
- Pass client down through Rack stack as `env['faye.client']`
- Refactor some JavaScript internals to mirror Ruby codebase

@@ -428,9 +532,9 @@

* Add server-side clients for Node.js and Ruby environments
* Clients support both HTTP and in-process transports
* Fix ID generation in JavaScript version to 128-bit IDs
* Fix bug in interpretation of `**` channel wildcard
* Users don't have to call `#connect()` on clients any more
* Fix timeout race conditions that were killing active connections
* Support new Node APIs from 0.1.29.
- Add server-side clients for Node.js and Ruby environments
- Clients support both HTTP and in-process transports
- Fix ID generation in JavaScript version to 128-bit IDs
- Fix bug in interpretation of `**` channel wildcard
- Users don't have to call `#connect()` on clients any more
- Fix timeout race conditions that were killing active connections
- Support new Node APIs from 0.1.29.

@@ -440,3 +544,3 @@

* Kick out requests with malformed JSON as 400s
- Kick out requests with malformed JSON as 400s

@@ -446,4 +550,4 @@

* Fix server-side flushing of callback-polling connections
* Backend can be used cross-domain if running on Node or Thin
- Fix server-side flushing of callback-polling connections
- Backend can be used cross-domain if running on Node or Thin

@@ -453,5 +557,5 @@

* Port server to JavaScript with an adapter for Node.js
* Support Thin's async responses in the Ruby version for complete non-blocking
* Fix some minor client-side bugs in transport choice
- Port server to JavaScript with an adapter for Node.js
- Support Thin's async responses in the Ruby version for complete non-blocking
- Fix some minor client-side bugs in transport choice

@@ -461,3 +565,3 @@

* Fix a broken client build
- Fix a broken client build

@@ -467,4 +571,4 @@

* Ruby Bayeux server and Rack adapter
* Internally evented using EventMachine, web frontend blocks
* JavaScript client with `long-polling` and `callback-polling`
- Ruby Bayeux server and Rack adapter
- Internally evented using EventMachine, web frontend blocks
- JavaScript client with `long-polling` and `callback-polling`

@@ -1,3 +0,2 @@

var Faye=function(t){function e(i){if(n[i])return n[i].exports;var s=n[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,e),s.l=!0,s.exports}var n={};return e.m=t,e.c=n,e.d=function(t,n,i){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:i})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=21)}([function(t,e,n){"use strict";t.exports=function(t,e,n){if(!e)return t;for(var i in e)e.hasOwnProperty(i)&&(t.hasOwnProperty(i)&&!1===n||t[i]!==e[i]&&(t[i]=e[i]));return t}},function(t,e,n){"use strict";var i=n(0);t.exports=function(t,e){"function"!=typeof t&&(e=t,t=Object);var n=function(){return this.initialize?this.initialize.apply(this,arguments)||this:this},s=function(){};return s.prototype=t.prototype,n.prototype=new s,i(n.prototype,e),n}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";t.exports={isURI:function(t){return t&&t.protocol&&t.host&&t.path},isSameOrigin:function(t){return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port},parse:function(t){if("string"!=typeof t)return t;var e,n,i,s,r,o,c={},a=function(e,n){t=t.replace(n,function(t){return c[e]=t,""}),c[e]=c[e]||""};for(a("protocol",/^[a-z]+\:/i),a("host",/^\/\/[^\/\?#]+/),/^\//.test(t)||c.host||(t=location.pathname.replace(/[^\/]*$/,"")+t),a("pathname",/^[^\?#]*/),a("search",/^\?[^#]*/),a("hash",/^#.*/),c.protocol=c.protocol||location.protocol,c.host?(c.host=c.host.substr(2),e=c.host.split(":"),c.hostname=e[0],c.port=e[1]||""):(c.host=location.host,c.hostname=location.hostname,c.port=location.port),c.pathname=c.pathname||"/",c.path=c.pathname+c.search,n=c.search.replace(/^\?/,""),i=n?n.split("&"):[],o={},s=0,r=i.length;s<r;s++)e=i[s].split("="),o[decodeURIComponent(e[0]||"")]=decodeURIComponent(e[1]||"");return c.query=o,c.href=this.stringify(c),c},stringify:function(t){var e=t.protocol+"//"+t.hostname;return t.port&&(e+=":"+t.port),e+=t.pathname+this.queryString(t.query)+(t.hash||"")},queryString:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return 0===e.length?"":"?"+e.join("&")}}},function(t,e,n){"use strict";var i=n(1),s=n(17).Cookie,r=n(8),o=n(3),c=n(9),a=n(0),h=n(5),u=n(28),l=n(15),f=a(i({className:"Transport",DEFAULT_PORTS:{"http:":80,"https:":443,"ws:":80,"wss:":443},MAX_DELAY:0,batching:!0,initialize:function(t,e){this._dispatcher=t,this.endpoint=e,this._outbox=[],this._proxy=a({},this._dispatcher.proxy),this._proxy.origin||(this._proxy.origin=this._findProxy())},close:function(){},encode:function(t){return""},sendMessage:function(t){return this.debug("Client ? sending message to ?: ?",this._dispatcher.clientId,o.stringify(this.endpoint),t),this.batching?(this._outbox.push(t),this._flushLargeBatch(),t.channel===l.HANDSHAKE?this._publish(.01):(t.channel===l.CONNECT&&(this._connectMessage=t),this._publish(this.MAX_DELAY))):r.resolve(this.request([t]))},_makePromise:function(){var t=this;this._requestPromise=this._requestPromise||new r(function(e){t._resolvePromise=e})},_publish:function(t){return this._makePromise(),this.addTimeout("publish",t,function(){this._flush(),delete this._requestPromise},this),this._requestPromise},_flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this._resolvePromise(this.request(this._outbox)),this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){if(!(this.encode(this._outbox).length<this._dispatcher.maxRequestSize)){var t=this._outbox.pop();this._makePromise(),this._flush(),t&&this._outbox.push(t)}},_receive:function(t){if(t){t=[].concat(t),this.debug("Client ? received from ? via ?: ?",this._dispatcher.clientId,o.stringify(this.endpoint),this.connectionType,t);for(var e=0,n=t.length;e<n;e++)this._dispatcher.handleResponse(t[e])}},_handleError:function(t,e){t=[].concat(t),this.debug("Client ? failed to send to ? via ?: ?",this._dispatcher.clientId,o.stringify(this.endpoint),this.connectionType,t);for(var n=0,i=t.length;n<i;n++)this._dispatcher.handleError(t[n])},_getCookies:function(){var t=this._dispatcher.cookies,e=o.stringify(this.endpoint);return t?c.map(t.getCookiesSync(e),function(t){return t.cookieString()}).join("; "):""},_storeCookies:function(t){var e,n=this._dispatcher.cookies,i=o.stringify(this.endpoint);if(t&&n){t=[].concat(t);for(var r=0,c=t.length;r<c;r++)e=s.parse(t[r]),n.setCookieSync(e,i)}},_findProxy:function(){if("undefined"!=typeof process){var t=this.endpoint.protocol;if(t){var e,n,i=t.replace(/:$/,"").toLowerCase()+"_proxy",s=i.toUpperCase(),r=process.env;return"http_proxy"===i&&r.REQUEST_METHOD?(e=Object.keys(r).filter(function(t){return/^http_proxy$/i.test(t)}),1===e.length?e[0]===i&&void 0===r[s]&&(n=r[i]):e.length>1&&(n=r[i]),n=n||r["CGI_"+s]):(n=r[i]||r[s])&&!r[i]&&console.warn("The environment variable "+s+" is discouraged. Use "+i+"."),n}}}}),{get:function(t,e,n,i,s){var r=t.endpoint;c.asyncEach(this._transports,function(r,o){var a=r[0],h=r[1],u=t.endpointFor(a);return c.indexOf(n,a)>=0?o():c.indexOf(e,a)<0?(h.isUsable(t,u,function(){}),o()):void h.isUsable(t,u,function(e){if(!e)return o();var n=h.hasOwnProperty("create")?h.create(t,u):new h(t,u);i.call(s,n)})},function(){throw new Error("Could not find a usable connection type for "+o.stringify(r))})},register:function(t,e){this._transports.push([t,e]),e.prototype.connectionType=t},getConnectionTypes:function(){return c.map(this._transports,function(t){return t[0]})},_transports:[]});a(f.prototype,h),a(f.prototype,u),t.exports=f},function(t,e,n){"use strict";var i=n(6),s={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(t,e){var n=s.logger||(s.wrapper||s).logger;if(n){var r=Array.prototype.slice.apply(t),o="[Faye",c=this.className,a=r.shift().replace(/\?/g,function(){try{return i(r.shift())}catch(t){return"[Object]"}});c&&(o+="."+c),o+="] ","function"==typeof n[e]?n[e](o+a):"function"==typeof n&&n(o+a)}}};for(var r in s.LOG_LEVELS)!function(t){s[t]=function(){this.writeLog(arguments,t)}}(r);t.exports=s},function(t,e,n){"use strict";t.exports=function(t){return JSON.stringify(t,function(t,e){return this[t]instanceof Array?this[t]:e})}},function(t,e,n){"use strict";(function(e){var i=n(8);t.exports={then:function(t,e){var n=this;return this._promise||(this._promise=new i(function(t,e){n._resolve=t,n._reject=e})),0===arguments.length?this._promise:this._promise.then(t,e)},callback:function(t,e){return this.then(function(n){t.call(e,n)})},errback:function(t,e){return this.then(null,function(n){t.call(e,n)})},timeout:function(t,n){this.then();var i=this;this._timer=e.setTimeout(function(){i._reject(n)},1e3*t)},setDeferredStatus:function(t,n){this._timer&&e.clearTimeout(this._timer),this.then(),"succeeded"===t?this._resolve(n):"failed"===t?this._reject(n):delete this._promise}}}).call(e,n(2))},function(t,e,n){"use strict";var i=n(14),s=function(t){return t},r=function(t){throw t},o=function(t){if(this._state=0,this._onFulfilled=[],this._onRejected=[],"function"==typeof t){var e=this;t(function(t){l(e,t)},function(t){p(e,t)})}};o.prototype.then=function(t,e){var n=new o;return c(this,t,n),a(this,e,n),n},o.prototype.catch=function(t){return this.then(null,t)};var c=function(t,e,n){"function"!=typeof e&&(e=s);var i=function(t){h(e,t,n)};0===t._state?t._onFulfilled.push(i):1===t._state&&i(t._value)},a=function(t,e,n){"function"!=typeof e&&(e=r);var i=function(t){h(e,t,n)};0===t._state?t._onRejected.push(i):2===t._state&&i(t._reason)},h=function(t,e,n){i(function(){u(t,e,n)})},u=function(t,e,n){var i;try{i=t(e)}catch(t){return p(n,t)}i===n?p(n,new TypeError("Recursive promise chain detected")):l(n,i)},l=function(t,e){var n,i,s=!1;try{if(n=typeof e,"function"!=typeof(i=null!==e&&("function"===n||"object"===n)&&e.then))return f(t,e);i.call(e,function(e){s^(s=!0)&&l(t,e)},function(e){s^(s=!0)&&p(t,e)})}catch(e){if(!(s^(s=!0)))return;p(t,e)}},f=function(t,e){if(0===t._state){t._state=1,t._value=e,t._onRejected=[];for(var n,i=t._onFulfilled;n=i.shift();)n(e)}},p=function(t,e){if(0===t._state){t._state=2,t._reason=e,t._onFulfilled=[];for(var n,i=t._onRejected;n=i.shift();)n(e)}};o.resolve=function(t){return new o(function(e,n){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.all=function(t){return new o(function(e,n){var i,s=[],r=t.length;if(0===r)return e(s);for(i=0;i<r;i++)!function(t,i){o.resolve(t).then(function(t){s[i]=t,0==--r&&e(s)},n)}(t[i],i)})},o.race=function(t){return new o(function(e,n){for(var i=0,s=t.length;i<s;i++)o.resolve(t[i]).then(e,n)})},o.deferred=o.pending=function(){var t={};return t.promise=new o(function(e,n){t.resolve=e,t.reject=n}),t},t.exports=o},function(t,e,n){"use strict";t.exports={commonElement:function(t,e){for(var n=0,i=t.length;n<i;n++)if(-1!==this.indexOf(e,t[n]))return t[n];return null},indexOf:function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},map:function(t,e,n){if(t.map)return t.map(e,n);var i=[];if(t instanceof Array)for(var s=0,r=t.length;s<r;s++)i.push(e.call(n||null,t[s],s));else for(var o in t)t.hasOwnProperty(o)&&i.push(e.call(n||null,o,t[o]));return i},filter:function(t,e,n){if(t.filter)return t.filter(e,n);for(var i=[],s=0,r=t.length;s<r;s++)e.call(n||null,t[s],s)&&i.push(t[s]);return i},asyncEach:function(t,e,n,i){var s=t.length,r=-1,o=0,c=!1,a=function(){if(o-=1,(r+=1)===s)return n&&n.call(i);e(t[r],u)},h=function(){if(!c){for(c=!0;o>0;)a();c=!1}},u=function(){o+=1,h()};u()}}},function(t,e,n){"use strict";(function(e){var n={_registry:[],on:function(t,e,n,i){var s=function(){n.call(i)};t.addEventListener?t.addEventListener(e,s,!1):t.attachEvent("on"+e,s),this._registry.push({_element:t,_type:e,_callback:n,_context:i,_handler:s})},detach:function(t,e,n,i){for(var s,r=this._registry.length;r--;)s=this._registry[r],t&&t!==s._element||e&&e!==s._type||n&&n!==s._callback||i&&i!==s._context||(s._element.removeEventListener?s._element.removeEventListener(s._type,s._handler,!1):s._element.detachEvent("on"+s._type,s._handler),this._registry.splice(r,1),s=null)}};void 0!==e.onunload&&n.on(e,"unload",n.detach,n),t.exports={Event:n}}).call(e,n(2))},function(t,e,n){"use strict";var i=n(0),s=n(25),r={countListeners:function(t){return this.listeners(t).length},bind:function(t,e,n){var i=Array.prototype.slice,s=function(){e.apply(n,i.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([t,e,n,s]),this.on(t,s)},unbind:function(t,e,n){this._listeners=this._listeners||[];for(var i,s=this._listeners.length;s--;)i=this._listeners[s],i[0]===t&&(!e||i[1]===e&&i[2]===n)&&(this._listeners.splice(s,1),this.removeListener(t,i[3]))}};i(r,s.prototype),r.trigger=r.emit,t.exports=r},function(t,e,n){"use strict";var i=function(t){var e,n,s;if(t instanceof Array){for(e=[],n=t.length;n--;)e[n]=i(t[n]);return e}if("object"==typeof t){e=null===t?null:{};for(s in t)e[s]=i(t[s]);return e}return t};t.exports=i},function(t,e){t.exports={VERSION:"1.2.5",BAYEUX_VERSION:"1.0",ID_LENGTH:160,JSONP_CALLBACK:"jsonpcallback",CONNECTION_TYPES:["long-polling","cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],MANDATORY_CONNECTION_TYPES:["long-polling","callback-polling","in-process"]}},function(t,e,n){"use strict";function i(){if(a.length)throw a.shift()}function s(t){var e;e=c.length?c.pop():new r,e.task=t,o(e)}function r(){this.task=null}var o=n(23),c=[],a=[],h=o.makeRequestCallFromTimer(i);t.exports=s,r.prototype.call=function(){try{this.task.call()}catch(t){s.onerror?s.onerror(t):(a.push(t),h())}finally{this.task=null,c[c.length]=this}}},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(11),o=n(16),c=i({initialize:function(t){this.id=this.name=t},push:function(t){this.trigger("message",t)},isUnused:function(){return 0===this.countListeners("message")}});s(c.prototype,r),s(c,{HANDSHAKE:"/meta/handshake",CONNECT:"/meta/connect",SUBSCRIBE:"/meta/subscribe",UNSUBSCRIBE:"/meta/unsubscribe",DISCONNECT:"/meta/disconnect",META:"meta",SERVICE:"service",expand:function(t){var e=this.parse(t),n=["/**",t],i=e.slice();i[i.length-1]="*",n.push(this.unparse(i));for(var s=1,r=e.length;s<r;s++)i=e.slice(0,s),i.push("**"),n.push(this.unparse(i));return n},isValid:function(t){return o.CHANNEL_NAME.test(t)||o.CHANNEL_PATTERN.test(t)},parse:function(t){return this.isValid(t)?t.split("/").slice(1):null},unparse:function(t){return"/"+t.join("/")},isMeta:function(t){var e=this.parse(t);return e?e[0]===this.META:null},isService:function(t){var e=this.parse(t);return e?e[0]===this.SERVICE:null},isSubscribable:function(t){return this.isValid(t)?!this.isMeta(t)&&!this.isService(t):null},Set:i({initialize:function(){this._channels={}},getKeys:function(){var t=[];for(var e in this._channels)t.push(e);return t},remove:function(t){delete this._channels[t]},hasSubscription:function(t){return this._channels.hasOwnProperty(t)},subscribe:function(t,e){for(var n,i=0,s=t.length;i<s;i++){n=t[i];(this._channels[n]=this._channels[n]||new c(n)).bind("message",e)}},unsubscribe:function(t,e){var n=this._channels[t];return!!n&&(n.unbind("message",e),!!n.isUnused()&&(this.remove(t),!0))},distributeMessage:function(t){for(var e=c.expand(t.channel),n=0,i=e.length;n<i;n++){var s=this._channels[e[n]];s&&s.trigger("message",t)}}})}),t.exports=c},function(t,e,n){"use strict";t.exports={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/}},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";var i=n(1);t.exports=i({initialize:function(){this._index={}},add:function(t){var e=void 0!==t.id?t.id:t;return!this._index.hasOwnProperty(e)&&(this._index[e]=t,!0)},forEach:function(t,e){for(var n in this._index)this._index.hasOwnProperty(n)&&t.call(e,this._index[n])},isEmpty:function(){for(var t in this._index)if(this._index.hasOwnProperty(t))return!1;return!0},member:function(t){for(var e in this._index)if(this._index[e]===t)return!0;return!1},remove:function(t){var e=void 0!==t.id?t.id:t,n=this._index[e];return delete this._index[e],n},toArray:function(){var t=[];return this.forEach(function(e){t.push(e)}),t}})},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(10),o=n(0),c=n(6),a=n(4),h=o(i(a,{encode:function(t){return c(t)},request:function(t){var n,i=this.endpoint.href,s=this;if(e.XMLHttpRequest)n=new XMLHttpRequest;else{if(!e.ActiveXObject)return this._handleError(t);n=new ActiveXObject("Microsoft.XMLHTTP")}n.open("POST",i,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Pragma","no-cache"),n.setRequestHeader("X-Requested-With","XMLHttpRequest");var o=this._dispatcher.headers;for(var c in o)o.hasOwnProperty(c)&&n.setRequestHeader(c,o[c]);var a=function(){n.abort()};return void 0!==e.onbeforeunload&&r.Event.on(e,"beforeunload",a),n.onreadystatechange=function(){if(n&&4===n.readyState){var i=null,o=n.status,c=n.responseText,h=o>=200&&o<300||304===o||1223===o;if(void 0!==e.onbeforeunload&&r.Event.detach(e,"beforeunload",a),n.onreadystatechange=function(){},n=null,!h)return s._handleError(t);try{i=JSON.parse(c)}catch(t){}i?s._receive(i):s._handleError(t)}},n.send(this.encode(t)),n}}),{isUsable:function(t,e,n,i){var r="ReactNative"===navigator.product||s.isSameOrigin(e);n.call(i,r)}});t.exports=h}).call(e,n(2))},function(t,e,n){"use strict";var i=n(0),s=function(t,e){this.message=t,this.options=e,this.attempts=0};i(s.prototype,{getTimeout:function(){return this.options.timeout},getInterval:function(){return this.options.interval},isDeliverable:function(){var t=this.options.attempts,e=this.attempts,n=this.options.deadline,i=(new Date).getTime();return!(void 0!==t&&e>=t)&&!(void 0!==n&&i>n)},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),t.exports=s},function(t,e,n){"use strict";var i=n(13),s=n(5),r={VERSION:i.VERSION,Client:n(22),Scheduler:n(20)};s.wrapper=r,t.exports=r},function(t,e,n){"use strict";(function(e){var i=n(14),s=n(1),r=(n(8),n(3)),o=n(9),c=n(10),a=n(13),h=n(0),u=n(24),l=n(7),f=n(5),p=n(11),d=n(15),_=n(26),v=n(34),g=n(35),m=n(36),y=n(37),E=s({className:"Client",UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:"handshake",RETRY:"retry",NONE:"none",CONNECTION_TIMEOUT:60,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(t,n){this.info("New client created for ?",t),n=n||{},u(n,["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._channels=new d.Set,this._dispatcher=_.create(this,t||this.DEFAULT_ENDPOINT,n),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(n.interval||this.INTERVAL),timeout:1e3*(n.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),c.Event&&void 0!==e.onbeforeunload&&c.Event.on(e,"beforeunload",function(){o.indexOf(this._dispatcher._disabled,"autodisconnect")<0&&this.disconnect()},this)},addWebsocketExtension:function(t){return this._dispatcher.addWebsocketExtension(t)},disable:function(t){return this._dispatcher.disable(t)},setHeader:function(t,e){return this._dispatcher.setHeader(t,e)},handshake:function(t,n){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var s=this;this.info("Initiating handshake with ?",r.stringify(this._dispatcher.endpoint)),this._dispatcher.selectTransport(a.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:d.HANDSHAKE,version:a.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},function(r){r.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=r.clientId,this._dispatcher.selectTransport(r.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),t&&i(function(){t.call(n)})):(this.info("Handshake unsuccessful"),e.setTimeout(function(){s.handshake(t,n)},1e3*this._dispatcher.retry),this._state=this.UNCONNECTED)},this)}},connect:function(t,e){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake(function(){this.connect(t,e)},this);this.callback(t,e),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._dispatcher.clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._dispatcher.clientId),this._sendMessage({channel:d.CONNECT,clientId:this._dispatcher.clientId,connectionType:this._dispatcher.connectionType},{},this._cycleConnection,this)))}},disconnect:function(){if(this._state===this.CONNECTED){this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._dispatcher.clientId);var t=new m;return this._sendMessage({channel:d.DISCONNECT,clientId:this._dispatcher.clientId},{},function(e){e.successful?(this._dispatcher.close(),t.setDeferredStatus("succeeded")):t.setDeferredStatus("failed",v.parse(e.error))},this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new d.Set,t}},subscribe:function(t,e,n){if(t instanceof Array)return o.map(t,function(t){return this.subscribe(t,e,n)},this);var i=new y(this,t,e,n),s=!0===e;return this._channels.hasSubscription(t)&&!s?(this._channels.subscribe([t],i),i.setDeferredStatus("succeeded"),i):(this.connect(function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,t),s||this._channels.subscribe([t],i),this._sendMessage({channel:d.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},function(e){if(!e.successful)return i.setDeferredStatus("failed",v.parse(e.error)),this._channels.unsubscribe(t,i);var n=[].concat(e.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,n),i.setDeferredStatus("succeeded")},this)},this),i)},unsubscribe:function(t,e){if(t instanceof Array)return o.map(t,function(t){return this.unsubscribe(t,e)},this);this._channels.unsubscribe(t,e)&&this.connect(function(){this.info("Client ? attempting to unsubscribe from ?",this._dispatcher.clientId,t),this._sendMessage({channel:d.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},function(t){if(t.successful){var e=[].concat(t.subscription);this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,e)}},this)},this)},publish:function(t,e,n){u(n||{},["attempts","deadline"]);var i=new m;return this.connect(function(){this.info("Client ? queueing published message to ?: ?",this._dispatcher.clientId,t,e),this._sendMessage({channel:t,data:e,clientId:this._dispatcher.clientId},n,function(t){t.successful?i.setDeferredStatus("succeeded"):i.setDeferredStatus("failed",v.parse(t.error))},this)},this),i},_sendMessage:function(t,e,n,i){t.id=this._generateMessageId();var s=this._advice.timeout?1.2*this._advice.timeout/1e3:1.2*this._dispatcher.retry;this.pipeThroughExtensions("outgoing",t,null,function(t){t&&(n&&(this._responseCallbacks[t.id]=[n,i]),this._dispatcher.sendMessage(t,s,e||{}))},this)},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_receiveMessage:function(t){var e,n=t.id;void 0!==t.successful&&(e=this._responseCallbacks[n],delete this._responseCallbacks[n]),this.pipeThroughExtensions("incoming",t,null,function(t){t&&(t.advice&&this._handleAdvice(t.advice),this._deliverMessage(t),e&&e[0].call(e[1],t))},this)},_handleAdvice:function(t){h(this._advice,t),this._dispatcher.timeout=this._advice.timeout/1e3,this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._dispatcher.clientId=null,this._cycleConnection())},_deliverMessage:function(t){t.channel&&void 0!==t.data&&(this.info("Client ? calling listeners for ? with ?",this._dispatcher.clientId,t.channel,t.data),this._channels.distributeMessage(t))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._dispatcher.clientId));var t=this;e.setTimeout(function(){t.connect()},this._advice.interval)}});h(E.prototype,l),h(E.prototype,p),h(E.prototype,f),h(E.prototype,g),t.exports=E}).call(e,n(2))},function(t,e,n){"use strict";(function(e){function n(t){o.length||(r(),c=!0),o[o.length]=t}function i(){for(;a<o.length;){var t=a;if(a+=1,o[t].call(),a>h){for(var e=0,n=o.length-a;e<n;e++)o[e]=o[e+a];o.length-=a,a=0}}o.length=0,a=0,c=!1}function s(t){return function(){function e(){clearTimeout(n),clearInterval(i),t()}var n=setTimeout(e,0),i=setInterval(e,50)}}t.exports=n;var r,o=[],c=!1,a=0,h=1024,u=void 0!==e?e:self,l=u.MutationObserver||u.WebKitMutationObserver;r="function"==typeof l?function(t){var e=1,n=new l(t),i=document.createTextNode("");return n.observe(i,{characterData:!0}),function(){e=-e,i.data=e}}(i):s(i),n.requestFlush=r,n.makeRequestCallFromTimer=s}).call(e,n(2))},function(t,e,n){"use strict";var i=n(9);t.exports=function(t,e){for(var n in t)if(i.indexOf(e,n)<0)throw new Error("Unrecognized option: "+n)}},function(t,e){function n(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(e===t[n])return n;return-1}function i(){}var s="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};t.exports=i,i.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||s(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var e=this._events[t];if(!e)return!1;if("function"==typeof e){switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:var n=Array.prototype.slice.call(arguments,1);e.apply(this,n)}return!0}if(s(e)){for(var n=Array.prototype.slice.call(arguments,1),i=e.slice(),r=0,o=i.length;r<o;r++)i[r].apply(this,n);return!0}return!1},i.prototype.addListener=function(t,e){if("function"!=typeof e)throw new Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",t,e),this._events[t]?s(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){var n=this;return n.on(t,function i(){n.removeListener(t,i),e.apply(this,arguments)}),this},i.prototype.removeListener=function(t,e){if("function"!=typeof e)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var i=this._events[t];if(s(i)){var r=n(i,e);if(r<0)return this;i.splice(r,1),0==i.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},i.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},i.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),s(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(17),o=n(0),c=n(5),a=n(11),h=n(27),u=n(20),l=i({className:"Dispatcher",MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(t,e,n){this._client=t,this.endpoint=s.parse(e),this._alternates=n.endpoints||{},this.cookies=r.CookieJar&&new r.CookieJar,this._disabled=[],this._envelopes={},this.headers={},this.retry=n.retry||this.DEFAULT_RETRY,this._scheduler=n.scheduler||u,this._state=0,this.transports={},this.wsExtensions=[],this.proxy=n.proxy||{},"string"==typeof this._proxy&&(this._proxy={origin:this._proxy});var i=n.websocketExtensions;if(i){i=[].concat(i);for(var o=0,c=i.length;o<c;o++)this.addWebsocketExtension(i[o])}this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca;for(var a in this._alternates)this._alternates[a]=s.parse(this._alternates[a]);this.maxRequestSize=this.MAX_REQUEST_SIZE},endpointFor:function(t){return this._alternates[t]||this.endpoint},addWebsocketExtension:function(t){this.wsExtensions.push(t)},disable:function(t){this._disabled.push(t)},setHeader:function(t,e){this.headers[t]=e},close:function(){var t=this._transport;delete this._transport,t&&t.close()},getConnectionTypes:function(){return h.getConnectionTypes()},selectTransport:function(t){h.get(this,t,this._disabled,function(t){this.debug("Selected ? transport for ?",t.connectionType,s.stringify(t.endpoint)),t!==this._transport&&(this._transport&&this._transport.close(),this._transport=t,this.connectionType=t.connectionType)},this)},sendMessage:function(t,e,n){n=n||{};var i,s=t.id,r=n.attempts,o=n.deadline&&(new Date).getTime()+1e3*n.deadline,c=this._envelopes[s];c||(i=new this._scheduler(t,{timeout:e,interval:this.retry,attempts:r,deadline:o}),c=this._envelopes[s]={message:t,scheduler:i}),this._sendEnvelope(c)},_sendEnvelope:function(t){if(this._transport&&!t.request&&!t.timer){var n=t.message,i=t.scheduler,s=this;if(!i.isDeliverable())return i.abort(),void delete this._envelopes[n.id];t.timer=e.setTimeout(function(){s.handleError(n)},1e3*i.getTimeout()),i.send(),t.request=this._transport.sendMessage(n)}},handleResponse:function(t){var n=this._envelopes[t.id];void 0!==t.successful&&n&&(n.scheduler.succeed(),delete this._envelopes[t.id],e.clearTimeout(n.timer)),this.trigger("message",t),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(t,n){var i=this._envelopes[t.id],s=i&&i.request,r=this;if(s){s.then(function(t){t&&t.abort&&t.abort()});var o=i.scheduler;o.fail(),e.clearTimeout(i.timer),i.request=i.timer=null,n?this._sendEnvelope(i):i.timer=e.setTimeout(function(){i.timer=null,r._sendEnvelope(i)},1e3*o.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down"))}}});l.create=function(t,e,n){return new l(t,e,n)},o(l.prototype,a),o(l.prototype,c),t.exports=l}).call(e,n(2))},function(t,e,n){"use strict";var i=n(4);i.register("websocket",n(29)),i.register("eventsource",n(31)),i.register("long-polling",n(19)),i.register("cross-origin-long-polling",n(32)),i.register("callback-polling",n(33)),t.exports=i},function(t,e,n){"use strict";(function(e){t.exports={addTimeout:function(t,n,i,s){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(t)){var r=this;this._timeouts[t]=e.setTimeout(function(){delete r._timeouts[t],i.call(s)},1e3*n)}},removeTimeout:function(t){this._timeouts=this._timeouts||{};var n=this._timeouts[t];n&&(e.clearTimeout(n),delete this._timeouts[t])},removeAllTimeouts:function(){this._timeouts=this._timeouts||{};for(var t in this._timeouts)this.removeTimeout(t)}}}).call(e,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(8),r=n(18),o=n(3),c=n(10),a=n(12),h=n(0),u=n(6),l=n(30),f=n(7),p=n(4),d=h(i(p,{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(t,e){this.callback(function(){t.call(e,!0)}),this.errback(function(){t.call(e,!1)}),this.connect()},request:function(t){this._pending=this._pending||new r;for(var e=0,n=t.length;e<n;e++)this._pending.add(t[e]);var i=this,o=new s(function(e,n){i.callback(function(n){n&&1===n.readyState&&(n.send(u(t)),e(n))}),i.connect()});return{abort:function(){o.then(function(t){t.close()})}}},connect:function(){if(!d._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var t=this._createSocket();if(!t)return this.setDeferredStatus("failed");var e=this;t.onopen=function(){t.headers&&e._storeCookies(t.headers["set-cookie"]),e._socket=t,e._state=e.CONNECTED,e._everConnected=!0,e._ping(),e.setDeferredStatus("succeeded",t)};var n=!1;t.onclose=t.onerror=function(){if(!n){n=!0;var i=e._state===e.CONNECTED;t.onopen=t.onclose=t.onerror=t.onmessage=null,delete e._socket,e._state=e.UNCONNECTED,e.removeTimeout("ping");var s=e._pending?e._pending.toArray():[];delete e._pending,i||e._everConnected?(e.setDeferredStatus("unknown"),e._handleError(s,i)):e.setDeferredStatus("failed")}},t.onmessage=function(t){var n;try{n=JSON.parse(t.data)}catch(t){}if(n){n=[].concat(n);for(var i=0,s=n.length;i<s;i++)void 0!==n[i].successful&&e._pending.remove(n[i]);e._receive(n)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var t=d.getSocketUrl(this.endpoint),e=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,r={extensions:n,headers:e,proxy:this._proxy,tls:s};return""!==i&&(r.headers.Cookie=i),l.create(t,[],r)},_ping:function(){this._socket&&1===this._socket.readyState&&(this._socket.send("[]"),this.addTimeout("ping",this._dispatcher.timeout/2,this._ping,this))}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(t,e){var n=t.transports.websocket=t.transports.websocket||{};return n[e.href]=n[e.href]||new this(t,e),n[e.href]},getSocketUrl:function(t){return t=a(t),t.protocol=this.PROTOCOLS[t.protocol],o.stringify(t)},isUsable:function(t,e,n,i){this.create(t,e).isUsable(n,i)}})
;h(d.prototype,f),c.Event&&void 0!==e.onbeforeunload&&c.Event.on(e,"beforeunload",function(){d._unloaded=!0}),t.exports=d}).call(e,n(2))},function(t,e,n){"use strict";(function(e){var n=e.MozWebSocket||e.WebSocket;t.exports={create:function(t,e,i){return"function"!=typeof n?null:new n(t)}}}).call(e,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(7),a=n(4),h=n(19),u=o(i(a,{initialize:function(t,n){if(a.prototype.initialize.call(this,t,n),!e.EventSource)return this.setDeferredStatus("failed");this._xhr=new h(t,n),n=r(n),n.pathname+="/"+t.clientId;var i=new e.EventSource(s.stringify(n)),o=this;i.onopen=function(){o._everConnected=!0,o.setDeferredStatus("succeeded")},i.onerror=function(){o._everConnected?o._handleError([]):(o.setDeferredStatus("failed"),i.close())},i.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}e?o._receive(e):o._handleError([])},this._socket=i},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(t,e){this.callback(function(){t.call(e,!0)}),this.errback(function(){t.call(e,!1)})},encode:function(t){return this._xhr.encode(t)},request:function(t){return this._xhr.request(t)}}),{isUsable:function(t,e,n,i){if(!t.clientId)return n.call(i,!1);h.isUsable(t,e,function(s){if(!s)return n.call(i,!1);this.create(t,e).isUsable(n,i)},this)},create:function(t,e){var n=t.transports.eventsource=t.transports.eventsource||{},i=t.clientId,o=r(e);return o.pathname+="/"+(i||""),o=s.stringify(o),n[o]=n[o]||new this(t,e),n[o]}});o(u.prototype,c),t.exports=u}).call(e,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(18),r=n(3),o=n(0),c=n(6),a=n(4),h=o(i(a,{encode:function(t){return"message="+encodeURIComponent(c(t))},request:function(t){var n,i=e.XDomainRequest?XDomainRequest:XMLHttpRequest,s=new i,o=++h._id,c=this._dispatcher.headers,a=this;if(s.open("POST",r.stringify(this.endpoint),!0),s.setRequestHeader){s.setRequestHeader("Pragma","no-cache");for(n in c)c.hasOwnProperty(n)&&s.setRequestHeader(n,c[n])}var u=function(){if(!s)return!1;h._pending.remove(o),s.onload=s.onerror=s.ontimeout=s.onprogress=null,s=null};return s.onload=function(){var e;try{e=JSON.parse(s.responseText)}catch(t){}u(),e?a._receive(e):a._handleError(t)},s.onerror=s.ontimeout=function(){u(),a._handleError(t)},s.onprogress=function(){},i===e.XDomainRequest&&h._pending.add({id:o,xhr:s}),s.send(this.encode(t)),s}}),{_id:0,_pending:new s,isUsable:function(t,n,i,s){if(r.isSameOrigin(n))return i.call(s,!1);if(e.XDomainRequest)return i.call(s,n.protocol===location.protocol);if(e.XMLHttpRequest){var o=new XMLHttpRequest;return i.call(s,void 0!==o.withCredentials)}return i.call(s,!1)}});t.exports=h}).call(e,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(6),a=n(4),h=o(i(a,{encode:function(t){var e=r(this.endpoint);return e.query.message=c(t),e.query.jsonp="__jsonp"+h._cbCount+"__",s.stringify(e)},request:function(t){var n=document.getElementsByTagName("head")[0],i=document.createElement("script"),o=h.getCallbackName(),a=r(this.endpoint),u=this;a.query.message=c(t),a.query.jsonp=o;var l=function(){if(!e[o])return!1;e[o]=void 0;try{delete e[o]}catch(t){}i.parentNode.removeChild(i)};return e[o]=function(t){l(),u._receive(t)},i.type="text/javascript",i.src=s.stringify(a),n.appendChild(i),i.onerror=function(){l(),u._handleError(t)},{abort:l}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(t,e,n,i){n.call(i,!0)}});t.exports=h}).call(e,n(2))},function(t,e,n){"use strict";var i=n(1),s=n(16),r=i({initialize:function(t,e,n){this.code=t,this.params=Array.prototype.slice.call(e),this.message=n},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}});r.parse=function(t){if(t=t||"",!s.ERROR.test(t))return new r(null,[],t);var e=t.split(":"),n=parseInt(e[0]),i=e[1].split(","),t=e[2];return new r(n,i,t)};var o={versionMismatch:[300,"Version mismatch"],conntypeMismatch:[301,"Connection types not supported"],extMismatch:[302,"Extension mismatch"],badRequest:[400,"Bad request"],clientUnknown:[401,"Unknown client"],parameterMissing:[402,"Missing required parameter"],channelForbidden:[403,"Forbidden channel"],channelUnknown:[404,"Unknown channel"],channelInvalid:[405,"Invalid channel"],extUnknown:[406,"Unknown extension"],publishFailed:[407,"Failed to publish"],serverError:[500,"Internal server error"]};for(var c in o)!function(t){r[t]=function(){return new r(o[t][0],arguments,o[t][1]).toString()}}(c);t.exports=r},function(t,e,n){"use strict";var i=n(0),s=n(5),r={addExtension:function(t){this._extensions=this._extensions||[],this._extensions.push(t),t.added&&t.added(this)},removeExtension:function(t){if(this._extensions)for(var e=this._extensions.length;e--;)this._extensions[e]===t&&(this._extensions.splice(e,1),t.removed&&t.removed(this))},pipeThroughExtensions:function(t,e,n,i,s){if(this.debug("Passing through ? extensions: ?",t,e),!this._extensions)return i.call(s,e);var r=this._extensions.slice(),o=function(e){if(!e)return i.call(s,e);var c=r.shift();if(!c)return i.call(s,e);var a=c[t];if(!a)return o(e);a.length>=3?c[t](e,n,o):c[t](e,o)};o(e)}};i(r,s),t.exports=r},function(t,e,n){"use strict";var i=n(1),s=n(7);t.exports=i(s)},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(7),o=i({initialize:function(t,e,n,i){this._client=t,this._channels=e,this._callback=n,this._context=i,this._cancelled=!1},withChannel:function(t,e){return this._withChannel=[t,e],this},apply:function(t,e){var n=e[0];this._callback&&this._callback.call(this._context,n.data),this._withChannel&&this._withChannel[0].call(this._withChannel[1],n.channel,n.data)},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this),this._cancelled=!0)},unsubscribe:function(){this.cancel()}});s(o.prototype,r),t.exports=o}]);
var Faye=function(t){var e={};function n(i){if(e[i])return e[i].exports;var s=e[i]={i:i,l:!1,exports:{}};return t[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=t,n.c=e,n.d=function(t,e,i){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:i})},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 i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var s in t)n.d(i,s,function(e){return t[e]}.bind(null,s));return i},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=38)}([function(t,e,n){"use strict";var i=Array.prototype.forEach,s=Object.prototype.hasOwnProperty;t.exports=function(t){return i.call(arguments,(function(e,n){if(0!==n)for(var i in e)s.call(e,i)&&(t[i]=e[i])})),t}},function(t,e,n){"use strict";var i=n(0);t.exports=function(t,e){"function"!=typeof t&&(e=t,t=Object);var n=function(){return this.initialize&&this.initialize.apply(this,arguments)||this},s=function(){};return s.prototype=t.prototype,n.prototype=new s,i(n.prototype,e),n}},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";t.exports={isURI:function(t){return t&&t.protocol&&t.host&&t.path},isSameOrigin:function(t){return t.protocol===location.protocol&&t.hostname===location.hostname&&t.port===location.port},parse:function(t){if("string"!=typeof t)return t;var e,n,i,s,r,o,c={},a=function(e,n){t=t.replace(n,(function(t){return c[e]=t,""})),c[e]=c[e]||""};for(a("protocol",/^[a-z]+\:/i),a("host",/^\/\/[^\/\?#]+/),/^\//.test(t)||c.host||(t=location.pathname.replace(/[^\/]*$/,"")+t),a("pathname",/^[^\?#]*/),a("search",/^\?[^#]*/),a("hash",/^#.*/),c.protocol=c.protocol||location.protocol,c.host?(c.host=c.host.substr(2),/@/.test(c.host)&&(c.auth=c.host.split("@")[0],c.host=c.host.split("@")[1]),e=c.host.match(/^\[([^\]]+)\]|^[^:]+/),c.hostname=e[1]||e[0],c.port=(c.host.match(/:(\d+)$/)||[])[1]||""):(c.host=location.host,c.hostname=location.hostname,c.port=location.port),c.pathname=c.pathname||"/",c.path=c.pathname+c.search,o={},s=0,r=(i=(n=c.search.replace(/^\?/,""))?n.split("&"):[]).length;s<r;s++)e=i[s].split("="),o[decodeURIComponent(e[0]||"")]=decodeURIComponent(e[1]||"");return c.query=o,c.href=this.stringify(c),c},stringify:function(t){var e=t.auth?t.auth+"@":"",n=t.protocol+"//"+e+t.host;return n+=t.pathname+this.queryString(t.query)+(t.hash||"")},queryString:function(t){var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return 0===e.length?"":"?"+e.join("&")}}},function(t,e,n){"use strict";var i=n(1),s=n(18).Cookie,r=n(6),o=n(11),c=n(0),a=n(8),h=n(29),u=n(15),l=c(i({className:"Transport",DEFAULT_PORTS:{"http:":80,"https:":443,"ws:":80,"wss:":443},MAX_DELAY:0,batching:!0,initialize:function(t,e){this._dispatcher=t,this.endpoint=e,this._outbox=[],this._proxy=c({},this._dispatcher.proxy),this._proxy.origin||(this._proxy.origin=this._findProxy())},close:function(){},encode:function(t){return""},sendMessage:function(t){return this.debug("Client ? sending message to ?: ?",this._dispatcher.clientId,this.endpoint.href,t),this.batching?(this._outbox.push(t),this._flushLargeBatch(),t.channel===u.HANDSHAKE?this._publish(.01):(t.channel===u.CONNECT&&(this._connectMessage=t),this._publish(this.MAX_DELAY))):r.resolve(this.request([t]))},_makePromise:function(){var t=this;this._requestPromise=this._requestPromise||new r((function(e){t._resolvePromise=e}))},_publish:function(t){return this._makePromise(),this.addTimeout("publish",t,(function(){this._flush(),delete this._requestPromise}),this),this._requestPromise},_flush:function(){this.removeTimeout("publish"),this._outbox.length>1&&this._connectMessage&&(this._connectMessage.advice={timeout:0}),this._resolvePromise(this.request(this._outbox)),this._connectMessage=null,this._outbox=[]},_flushLargeBatch:function(){if(!(this.encode(this._outbox).length<this._dispatcher.maxRequestSize)){var t=this._outbox.pop();this._makePromise(),this._flush(),t&&this._outbox.push(t)}},_receive:function(t){if(t){t=[].concat(t),this.debug("Client ? received from ? via ?: ?",this._dispatcher.clientId,this.endpoint.href,this.connectionType,t);for(var e=0,n=t.length;e<n;e++)this._dispatcher.handleResponse(t[e])}},_handleError:function(t,e){t=[].concat(t),this.debug("Client ? failed to send to ? via ?: ?",this._dispatcher.clientId,this.endpoint.href,this.connectionType,t);for(var n=0,i=t.length;n<i;n++)this._dispatcher.handleError(t[n])},_getCookies:function(){var t=this._dispatcher.cookies,e=this.endpoint.href;return t?o.map(t.getCookiesSync(e),(function(t){return t.cookieString()})).join("; "):""},_storeCookies:function(t){var e,n=this._dispatcher.cookies,i=this.endpoint.href;if(t&&n)for(var r=0,o=(t=[].concat(t)).length;r<o;r++)e=s.parse(t[r]),n.setCookieSync(e,i)},_findProxy:function(){if("undefined"!=typeof process){var t=this.endpoint.protocol;if(t){var e,n,i=t.replace(/:$/,"").toLowerCase()+"_proxy",s=i.toUpperCase(),r=process.env;return"http_proxy"===i&&r.REQUEST_METHOD?(1===(e=Object.keys(r).filter((function(t){return/^http_proxy$/i.test(t)}))).length?e[0]===i&&void 0===r[s]&&(n=r[i]):e.length>1&&(n=r[i]),n=n||r["CGI_"+s]):(n=r[i]||r[s])&&!r[i]&&console.warn("The environment variable "+s+" is discouraged. Use "+i+"."),n}}}}),{get:function(t,e,n,i,s){var r=t.endpoint;o.asyncEach(this._transports,(function(r,c){var a=r[0],h=r[1],u=t.endpointFor(a);return o.indexOf(n,a)>=0?c():o.indexOf(e,a)<0?(h.isUsable(t,u,(function(){})),c()):void h.isUsable(t,u,(function(e){if(!e)return c();var n=h.hasOwnProperty("create")?h.create(t,u):new h(t,u);i.call(s,n)}))}),(function(){throw new Error("Could not find a usable connection type for "+r.href)}))},register:function(t,e){this._transports.push([t,e]),e.prototype.connectionType=t},getConnectionTypes:function(){return o.map(this._transports,(function(t){return t[0]}))},disable:function(t){if("autodisconnect"===t)for(var e=0;e<this._transports.length;e++)this._transports[e][1]._unloaded=!1},_transports:[]});c(l.prototype,a),c(l.prototype,h),t.exports=l},function(t,e,n){"use strict";t.exports=function(t){return JSON.stringify(t,(function(t,e){return this[t]instanceof Array?this[t]:e}))}},function(t,e,n){"use strict";var i=n(13),s=function(t){this._state=-1,this._value=null,this._defer=[],r(this,t)};s.prototype.then=function(t,e){var n=new s,i={promise:n,onFulfilled:t,onRejected:e};return-1===this._state?this._defer.push(i):o(this,i),n},s.prototype.catch=function(t){return this.then(null,t)};var r=function(t,e){if("function"==typeof e){var n=0,i=function(e){0==n++&&u(t,e)};try{e((function(e){0==n++&&c(t,e)}),i)}catch(t){i(t)}}},o=function(t,e){var n=t._state,s=t._value,r=e.promise,o=[e.onFulfilled,e.onRejected][n];if("function"!=typeof o)return(0,[c,u][n])(r,s);i((function(){try{c(r,o(s))}catch(t){u(r,t)}}))},c=function(t,e){if(t===e)return u(t,new TypeError("Recursive promise chain detected"));var n;try{n=a(e)}catch(e){return u(t,e)}if(!n)return h(t,e);r(t,(function(t,i){n.call(e,t,i)}))},a=function(t){var e=typeof t,n=("object"===e||"function"===e)&&t&&t.then;return"function"==typeof n?n:null},h=function(t,e){l(t,0,e)},u=function(t,e){l(t,1,e)},l=function(t,e,n){var i=t._defer,s=0;if(t._state=e,t._value=n,t._defer=null,0!==i.length)for(;s<i.length;)o(t,i[s++])};s.resolve=function(t){try{if(a(t))return t}catch(t){return s.reject(t)}return new s((function(e,n){e(t)}))},s.reject=function(t){return new s((function(e,n){n(t)}))},s.all=function(t){return new s((function(e,n){var i,r=[],o=t.length;if(0===o)return e(r);var c=function(t,i){s.resolve(t).then((function(t){r[i]=t,0==--o&&e(r)}),n)};for(i=0;i<o;i++)c(t[i],i)}))},s.race=function(t){return new s((function(e,n){for(var i=0,r=t.length;i<r;i++)s.resolve(t[i]).then(e,n)}))},s.deferred=function(){var t={};return t.promise=new s((function(e,n){t.resolve=e,t.reject=n})),t},t.exports=s},function(t,e,n){"use strict";(function(e){var i=n(6);t.exports={then:function(t,e){var n=this;return this._promise||(this._promise=new i((function(t,e){n._resolve=t,n._reject=e}))),0===arguments.length?this._promise:this._promise.then(t,e)},callback:function(t,e){return this.then((function(n){t.call(e,n)}))},errback:function(t,e){return this.then(null,(function(n){t.call(e,n)}))},timeout:function(t,n){this.then();var i=this;this._timer=e.setTimeout((function(){i._reject(n)}),1e3*t)},setDeferredStatus:function(t,n){this._timer&&e.clearTimeout(this._timer),this.then(),"succeeded"===t?this._resolve(n):"failed"===t?this._reject(n):delete this._promise}}}).call(this,n(2))},function(t,e,n){"use strict";var i=n(5),s={LOG_LEVELS:{fatal:4,error:3,warn:2,info:1,debug:0},writeLog:function(t,e){var n=s.logger||(s.wrapper||s).logger;if(n){var r=Array.prototype.slice.apply(t),o="[Faye",c=this.className,a=r.shift().replace(/\?/g,(function(){try{return i(r.shift())}catch(t){return"[Object]"}}));c&&(o+="."+c),o+="] ","function"==typeof n[e]?n[e](o+a):"function"==typeof n&&n(o+a)}}};for(var r in s.LOG_LEVELS)!function(t){s[t]=function(){this.writeLog(arguments,t)}}(r);t.exports=s},function(t,e,n){"use strict";var i={countListeners:function(t){return this.listeners(t).length},bind:function(t,e,n){var i=Array.prototype.slice,s=function(){e.apply(n,i.call(arguments))};return this._listeners=this._listeners||[],this._listeners.push([t,e,n,s]),this.on(t,s)},unbind:function(t,e,n){this._listeners=this._listeners||[];for(var i,s=this._listeners.length;s--;)(i=this._listeners[s])[0]===t&&(!e||i[1]===e&&i[2]===n)&&(this._listeners.splice(s,1),this.removeListener(t,i[3]))}};n(0)(i,n(28).prototype),i.trigger=i.emit,t.exports=i},,function(t,e,n){"use strict";t.exports={commonElement:function(t,e){for(var n=0,i=t.length;n<i;n++)if(-1!==this.indexOf(e,t[n]))return t[n];return null},indexOf:function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0,i=t.length;n<i;n++)if(t[n]===e)return n;return-1},map:function(t,e,n){if(t.map)return t.map(e,n);var i=[];if(t instanceof Array)for(var s=0,r=t.length;s<r;s++)i.push(e.call(n||null,t[s],s));else for(var o in t)t.hasOwnProperty(o)&&i.push(e.call(n||null,o,t[o]));return i},filter:function(t,e,n){if(t.filter)return t.filter(e,n);for(var i=[],s=0,r=t.length;s<r;s++)e.call(n||null,t[s],s)&&i.push(t[s]);return i},asyncEach:function(t,e,n,i){var s=t.length,r=-1,o=0,c=!1,a=function(){if(o-=1,(r+=1)===s)return n&&n.call(i);e(t[r],h)},h=function(){o+=1,function(){if(!c){for(c=!0;o>0;)a();c=!1}}()};h()}}},function(t,e,n){"use strict";var i=function(t){var e,n,s;if(t instanceof Array){for(e=[],n=t.length;n--;)e[n]=i(t[n]);return e}if("object"==typeof t){for(s in e=null===t?null:{},t)e[s]=i(t[s]);return e}return t};t.exports=i},function(t,e,n){"use strict";var i=n(26),s=[],r=[],o=i.makeRequestCallFromTimer((function(){if(r.length)throw r.shift()}));function c(t){var e;(e=s.length?s.pop():new a).task=t,i(e)}function a(){this.task=null}t.exports=c,a.prototype.call=function(){try{this.task.call()}catch(t){c.onerror?c.onerror(t):(r.push(t),o())}finally{this.task=null,s[s.length]=this}}},function(t,e,n){"use strict";(function(e){var n={_registry:[],on:function(t,e,n,i){var s=function(){n.call(i)};t.addEventListener?t.addEventListener(e,s,!1):t.attachEvent("on"+e,s),this._registry.push({_element:t,_type:e,_callback:n,_context:i,_handler:s})},detach:function(t,e,n,i){for(var s,r=this._registry.length;r--;)s=this._registry[r],t&&t!==s._element||e&&e!==s._type||n&&n!==s._callback||i&&i!==s._context||(s._element.removeEventListener?s._element.removeEventListener(s._type,s._handler,!1):s._element.detachEvent("on"+s._type,s._handler),this._registry.splice(r,1),s=null)}};void 0!==e.onunload&&n.on(e,"unload",n.detach,n),t.exports={Event:n}}).call(this,n(2))},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(9),o=n(16),c=i({initialize:function(t){this.id=this.name=t},push:function(t){this.trigger("message",t)},isUnused:function(){return 0===this.countListeners("message")}});s(c.prototype,r),s(c,{HANDSHAKE:"/meta/handshake",CONNECT:"/meta/connect",SUBSCRIBE:"/meta/subscribe",UNSUBSCRIBE:"/meta/unsubscribe",DISCONNECT:"/meta/disconnect",META:"meta",SERVICE:"service",expand:function(t){var e=this.parse(t),n=["/**",t],i=e.slice();i[i.length-1]="*",n.push(this.unparse(i));for(var s=1,r=e.length;s<r;s++)(i=e.slice(0,s)).push("**"),n.push(this.unparse(i));return n},isValid:function(t){return o.CHANNEL_NAME.test(t)||o.CHANNEL_PATTERN.test(t)},parse:function(t){return this.isValid(t)?t.split("/").slice(1):null},unparse:function(t){return"/"+t.join("/")},isMeta:function(t){var e=this.parse(t);return e?e[0]===this.META:null},isService:function(t){var e=this.parse(t);return e?e[0]===this.SERVICE:null},isSubscribable:function(t){return this.isValid(t)?!this.isMeta(t)&&!this.isService(t):null},Set:i({initialize:function(){this._channels={}},getKeys:function(){var t=[];for(var e in this._channels)t.push(e);return t},remove:function(t){delete this._channels[t]},hasSubscription:function(t){return this._channels.hasOwnProperty(t)},subscribe:function(t,e){for(var n,i=0,s=t.length;i<s;i++){n=t[i],(this._channels[n]=this._channels[n]||new c(n)).bind("message",e)}},unsubscribe:function(t,e){var n=this._channels[t];return!!n&&(n.unbind("message",e),!!n.isUnused()&&(this.remove(t),!0))},distributeMessage:function(t){for(var e=c.expand(t.channel),n=0,i=e.length;n<i;n++){var s=this._channels[e[n]];s&&s.trigger("message",t)}}})}),t.exports=c},function(t,e,n){"use strict";t.exports={CHANNEL_NAME:/^\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*$/,CHANNEL_PATTERN:/^(\/(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)))+)*\/\*{1,2}$/,ERROR:/^([0-9][0-9][0-9]:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*(,(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)*:(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*|[0-9][0-9][0-9]::(((([a-z]|[A-Z])|[0-9])|(\-|\_|\!|\~|\(|\)|\$|\@)| |\/|\*|\.))*)$/,VERSION:/^([0-9])+(\.(([a-z]|[A-Z])|[0-9])(((([a-z]|[A-Z])|[0-9])|\-|\_))*)*$/}},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(18),o=n(0),c=n(8),a=n(9),h=n(19),u=n(22),l=i({className:"Dispatcher",MAX_REQUEST_SIZE:2048,DEFAULT_RETRY:5,UP:1,DOWN:2,initialize:function(t,e,n){this._client=t,this.endpoint=s.parse(e),this._alternates=n.endpoints||{},this.cookies=r.CookieJar&&new r.CookieJar,this._disabled=[],this._envelopes={},this.headers={},this.retry=n.retry||this.DEFAULT_RETRY,this._scheduler=n.scheduler||u,this._state=0,this.transports={},this.wsExtensions=[],this.proxy=n.proxy||{},"string"==typeof this._proxy&&(this._proxy={origin:this._proxy});var i=n.websocketExtensions;if(i)for(var o=0,c=(i=[].concat(i)).length;o<c;o++)this.addWebsocketExtension(i[o]);for(var a in this.tls=n.tls||{},this.tls.ca=this.tls.ca||n.ca,this._alternates)this._alternates[a]=s.parse(this._alternates[a]);this.maxRequestSize=this.MAX_REQUEST_SIZE},endpointFor:function(t){return this._alternates[t]||this.endpoint},addWebsocketExtension:function(t){this.wsExtensions.push(t)},disable:function(t){this._disabled.push(t),h.disable(t)},setHeader:function(t,e){this.headers[t]=e},close:function(){var t=this._transport;delete this._transport,t&&t.close()},getConnectionTypes:function(){return h.getConnectionTypes()},selectTransport:function(t){h.get(this,t,this._disabled,(function(t){this.debug("Selected ? transport for ?",t.connectionType,t.endpoint.href),t!==this._transport&&(this._transport&&this._transport.close(),this._transport=t,this.connectionType=t.connectionType)}),this)},sendMessage:function(t,e,n){n=n||{};var i,s=t.id,r=n.attempts,o=n.deadline&&(new Date).getTime()+1e3*n.deadline,c=this._envelopes[s];c||(i=new this._scheduler(t,{timeout:e,interval:this.retry,attempts:r,deadline:o}),c=this._envelopes[s]={message:t,scheduler:i}),this._sendEnvelope(c)},_sendEnvelope:function(t){if(this._transport&&!t.request&&!t.timer){var n=t.message,i=t.scheduler,s=this;if(!i.isDeliverable())return i.abort(),void delete this._envelopes[n.id];t.timer=e.setTimeout((function(){s.handleError(n)}),1e3*i.getTimeout()),i.send(),t.request=this._transport.sendMessage(n)}},handleResponse:function(t){var n=this._envelopes[t.id];void 0!==t.successful&&n&&(n.scheduler.succeed(),delete this._envelopes[t.id],e.clearTimeout(n.timer)),this.trigger("message",t),this._state!==this.UP&&(this._state=this.UP,this._client.trigger("transport:up"))},handleError:function(t,n){var i=this._envelopes[t.id],s=i&&i.request,r=this;if(s){s.then((function(t){t&&t.abort&&t.abort()}));var o=i.scheduler;o.fail(),e.clearTimeout(i.timer),i.request=i.timer=null,n?this._sendEnvelope(i):i.timer=e.setTimeout((function(){i.timer=null,r._sendEnvelope(i)}),1e3*o.getInterval()),this._state!==this.DOWN&&(this._state=this.DOWN,this._client.trigger("transport:down"))}}});l.create=function(t,e,n){return new l(t,e,n)},o(l.prototype,a),o(l.prototype,c),t.exports=l}).call(this,n(2))},function(t,e,n){"use strict";t.exports={}},function(t,e,n){"use strict";var i=n(4);i.register("websocket",n(30)),i.register("eventsource",n(32)),i.register("long-polling",n(21)),i.register("cross-origin-long-polling",n(33)),i.register("callback-polling",n(34)),t.exports=i},function(t,e,n){"use strict";var i=n(1);t.exports=i({initialize:function(){this._index={}},add:function(t){var e=void 0!==t.id?t.id:t;return!this._index.hasOwnProperty(e)&&(this._index[e]=t,!0)},forEach:function(t,e){for(var n in this._index)this._index.hasOwnProperty(n)&&t.call(e,this._index[n])},isEmpty:function(){for(var t in this._index)if(this._index.hasOwnProperty(t))return!1;return!0},member:function(t){for(var e in this._index)if(this._index[e]===t)return!0;return!1},remove:function(t){var e=void 0!==t.id?t.id:t,n=this._index[e];return delete this._index[e],n},toArray:function(){var t=[];return this.forEach((function(e){t.push(e)})),t}})},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(14),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){return c(t)},request:function(t){var n,i=this.endpoint.href,s=this;if(e.XMLHttpRequest)n=new XMLHttpRequest;else{if(!e.ActiveXObject)return this._handleError(t);n=new ActiveXObject("Microsoft.XMLHTTP")}n.open("POST",i,!0),n.setRequestHeader("Content-Type","application/json"),n.setRequestHeader("Pragma","no-cache"),n.setRequestHeader("X-Requested-With","XMLHttpRequest");var o=this._dispatcher.headers;for(var c in o)o.hasOwnProperty(c)&&n.setRequestHeader(c,o[c]);var a=function(){n.abort()};return void 0!==e.onbeforeunload&&r.Event.on(e,"beforeunload",a),n.onreadystatechange=function(){if(n&&4===n.readyState){var i=null,o=n.status,c=n.responseText,h=o>=200&&o<300||304===o||1223===o;if(void 0!==e.onbeforeunload&&r.Event.detach(e,"beforeunload",a),n.onreadystatechange=function(){},n=null,!h)return s._handleError(t);try{i=JSON.parse(c)}catch(t){}i?s._receive(i):s._handleError(t)}},n.send(this.encode(t)),n}}),{isUsable:function(t,e,n,i){var r="ReactNative"===navigator.product||s.isSameOrigin(e);n.call(i,r)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";var i=function(t,e){this.message=t,this.options=e,this.attempts=0};n(0)(i.prototype,{getTimeout:function(){return this.options.timeout},getInterval:function(){return this.options.interval},isDeliverable:function(){var t=this.options.attempts,e=this.attempts,n=this.options.deadline,i=(new Date).getTime();return!(void 0!==t&&e>=t)&&!(void 0!==n&&i>n)},send:function(){this.attempts+=1},succeed:function(){},fail:function(){},abort:function(){}}),t.exports=i},function(t,e){t.exports={VERSION:"1.3.0",BAYEUX_VERSION:"1.0",ID_LENGTH:160,JSONP_CALLBACK:"jsonpcallback",CONNECTION_TYPES:["long-polling","cross-origin-long-polling","callback-polling","websocket","eventsource","in-process"],MANDATORY_CONNECTION_TYPES:["long-polling","callback-polling","in-process"]}},function(t,e,n){"use strict";var i=n(1),s=n(0),r=n(7),o=i({initialize:function(t,e,n,i){this._client=t,this._channels=e,this._callback=n,this._context=i,this._cancelled=!1},withChannel:function(t,e){return this._withChannel=[t,e],this},apply:function(t,e){var n=e[0];this._callback&&this._callback.call(this._context,n.data),this._withChannel&&this._withChannel[0].call(this._withChannel[1],n.channel,n.data)},cancel:function(){this._cancelled||(this._client.unsubscribe(this._channels,this),this._cancelled=!0)},unsubscribe:function(){this.cancel()}});s(o.prototype,r),t.exports=o},function(t,e,n){"use strict";(function(e){var i=n(13),s=n(1),r=(n(6),n(11)),o=n(14),c=n(23),a=n(0),h=n(27),u=n(7),l=n(8),f=n(9),d=n(15),p=n(17),_=n(35),v=n(36),g=n(37),m=n(24),y=s({className:"Client",UNCONNECTED:1,CONNECTING:2,CONNECTED:3,DISCONNECTED:4,HANDSHAKE:"handshake",RETRY:"retry",NONE:"none",CONNECTION_TIMEOUT:60,DEFAULT_ENDPOINT:"/bayeux",INTERVAL:0,initialize:function(t,n){this.info("New client created for ?",t),h(n=n||{},["interval","timeout","endpoints","proxy","retry","scheduler","websocketExtensions","tls","ca"]),this._channels=new d.Set,this._dispatcher=p.create(this,t||this.DEFAULT_ENDPOINT,n),this._messageId=0,this._state=this.UNCONNECTED,this._responseCallbacks={},this._advice={reconnect:this.RETRY,interval:1e3*(n.interval||this.INTERVAL),timeout:1e3*(n.timeout||this.CONNECTION_TIMEOUT)},this._dispatcher.timeout=this._advice.timeout/1e3,this._dispatcher.bind("message",this._receiveMessage,this),o.Event&&void 0!==e.onbeforeunload&&o.Event.on(e,"beforeunload",(function(){r.indexOf(this._dispatcher._disabled,"autodisconnect")<0&&this.disconnect()}),this)},addWebsocketExtension:function(t){return this._dispatcher.addWebsocketExtension(t)},disable:function(t){return this._dispatcher.disable(t)},setHeader:function(t,e){return this._dispatcher.setHeader(t,e)},handshake:function(t,n){if(this._advice.reconnect!==this.NONE&&this._state===this.UNCONNECTED){this._state=this.CONNECTING;var s=this;this.info("Initiating handshake with ?",this._dispatcher.endpoint.href),this._dispatcher.selectTransport(c.MANDATORY_CONNECTION_TYPES),this._sendMessage({channel:d.HANDSHAKE,version:c.BAYEUX_VERSION,supportedConnectionTypes:this._dispatcher.getConnectionTypes()},{},(function(r){r.successful?(this._state=this.CONNECTED,this._dispatcher.clientId=r.clientId,this._dispatcher.selectTransport(r.supportedConnectionTypes),this.info("Handshake successful: ?",this._dispatcher.clientId),this.subscribe(this._channels.getKeys(),!0),t&&i((function(){t.call(n)}))):(this.info("Handshake unsuccessful"),e.setTimeout((function(){s.handshake(t,n)}),1e3*this._dispatcher.retry),this._state=this.UNCONNECTED)}),this)}},connect:function(t,e){if(this._advice.reconnect!==this.NONE&&this._state!==this.DISCONNECTED){if(this._state===this.UNCONNECTED)return this.handshake((function(){this.connect(t,e)}),this);this.callback(t,e),this._state===this.CONNECTED&&(this.info("Calling deferred actions for ?",this._dispatcher.clientId),this.setDeferredStatus("succeeded"),this.setDeferredStatus("unknown"),this._connectRequest||(this._connectRequest=!0,this.info("Initiating connection for ?",this._dispatcher.clientId),this._sendMessage({channel:d.CONNECT,clientId:this._dispatcher.clientId,connectionType:this._dispatcher.connectionType},{},this._cycleConnection,this)))}},disconnect:function(){if(this._state===this.CONNECTED){this._state=this.DISCONNECTED,this.info("Disconnecting ?",this._dispatcher.clientId);var t=new g;return this._sendMessage({channel:d.DISCONNECT,clientId:this._dispatcher.clientId},{},(function(e){e.successful?(this._dispatcher.close(),t.setDeferredStatus("succeeded")):t.setDeferredStatus("failed",_.parse(e.error))}),this),this.info("Clearing channel listeners for ?",this._dispatcher.clientId),this._channels=new d.Set,t}},subscribe:function(t,e,n){if(t instanceof Array)return r.map(t,(function(t){return this.subscribe(t,e,n)}),this);var i=new m(this,t,e,n),s=!0===e;return this._channels.hasSubscription(t)&&!s?(this._channels.subscribe([t],i),i.setDeferredStatus("succeeded"),i):(this.connect((function(){this.info("Client ? attempting to subscribe to ?",this._dispatcher.clientId,t),s||this._channels.subscribe([t],i),this._sendMessage({channel:d.SUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},(function(e){if(!e.successful)return i.setDeferredStatus("failed",_.parse(e.error)),this._channels.unsubscribe(t,i);var n=[].concat(e.subscription);this.info("Subscription acknowledged for ? to ?",this._dispatcher.clientId,n),i.setDeferredStatus("succeeded")}),this)}),this),i)},unsubscribe:function(t,e){if(t instanceof Array)return r.map(t,(function(t){return this.unsubscribe(t,e)}),this);this._channels.unsubscribe(t,e)&&this.connect((function(){this.info("Client ? attempting to unsubscribe from ?",this._dispatcher.clientId,t),this._sendMessage({channel:d.UNSUBSCRIBE,clientId:this._dispatcher.clientId,subscription:t},{},(function(t){if(t.successful){var e=[].concat(t.subscription);this.info("Unsubscription acknowledged for ? from ?",this._dispatcher.clientId,e)}}),this)}),this)},publish:function(t,e,n){h(n||{},["attempts","deadline"]);var i=new g;return this.connect((function(){this.info("Client ? queueing published message to ?: ?",this._dispatcher.clientId,t,e),this._sendMessage({channel:t,data:e,clientId:this._dispatcher.clientId},n,(function(t){t.successful?i.setDeferredStatus("succeeded"):i.setDeferredStatus("failed",_.parse(t.error))}),this)}),this),i},_sendMessage:function(t,e,n,i){t.id=this._generateMessageId();var s=this._advice.timeout?1.2*this._advice.timeout/1e3:1.2*this._dispatcher.retry;this.pipeThroughExtensions("outgoing",t,null,(function(t){t&&(n&&(this._responseCallbacks[t.id]=[n,i]),this._dispatcher.sendMessage(t,s,e||{}))}),this)},_generateMessageId:function(){return this._messageId+=1,this._messageId>=Math.pow(2,32)&&(this._messageId=0),this._messageId.toString(36)},_receiveMessage:function(t){var e,n=t.id;void 0!==t.successful&&(e=this._responseCallbacks[n],delete this._responseCallbacks[n]),this.pipeThroughExtensions("incoming",t,null,(function(t){t&&(t.advice&&this._handleAdvice(t.advice),this._deliverMessage(t),e&&e[0].call(e[1],t))}),this)},_handleAdvice:function(t){a(this._advice,t),this._dispatcher.timeout=this._advice.timeout/1e3,this._advice.reconnect===this.HANDSHAKE&&this._state!==this.DISCONNECTED&&(this._state=this.UNCONNECTED,this._dispatcher.clientId=null,this._cycleConnection())},_deliverMessage:function(t){t.channel&&void 0!==t.data&&(this.info("Client ? calling listeners for ? with ?",this._dispatcher.clientId,t.channel,t.data),this._channels.distributeMessage(t))},_cycleConnection:function(){this._connectRequest&&(this._connectRequest=null,this.info("Closed connection for ?",this._dispatcher.clientId));var t=this;e.setTimeout((function(){t.connect()}),this._advice.interval)}});a(y.prototype,u),a(y.prototype,f),a(y.prototype,l),a(y.prototype,v),t.exports=y}).call(this,n(2))},function(t,e,n){"use strict";(function(e){function n(t){s.length||(i(),!0),s[s.length]=t}t.exports=n;var i,s=[],r=0;function o(){for(;r<s.length;){var t=r;if(r+=1,s[t].call(),r>1024){for(var e=0,n=s.length-r;e<n;e++)s[e]=s[e+r];s.length-=r,r=0}}s.length=0,r=0,!1}var c,a,h,u=void 0!==e?e:self,l=u.MutationObserver||u.WebKitMutationObserver;function f(t){return function(){var e=setTimeout(i,0),n=setInterval(i,50);function i(){clearTimeout(e),clearInterval(n),t()}}}"function"==typeof l?(c=1,a=new l(o),h=document.createTextNode(""),a.observe(h,{characterData:!0}),i=function(){c=-c,h.data=c}):i=f(o),n.requestFlush=i,n.makeRequestCallFromTimer=f}).call(this,n(2))},function(t,e,n){"use strict";var i=n(11);t.exports=function(t,e){for(var n in t)if(i.indexOf(e,n)<0)throw new Error("Unrecognized option: "+n)}},function(t,e){var n="function"==typeof Array.isArray?Array.isArray:function(t){return"[object Array]"===Object.prototype.toString.call(t)};function i(){}t.exports=i,i.prototype.emit=function(t){if("error"===t&&(!this._events||!this._events.error||n(this._events.error)&&!this._events.error.length))throw arguments[1]instanceof Error?arguments[1]:new Error("Uncaught, unspecified 'error' event.");if(!this._events)return!1;var e=this._events[t];if(!e)return!1;if("function"==typeof e){switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:var i=Array.prototype.slice.call(arguments,1);e.apply(this,i)}return!0}if(n(e)){i=Array.prototype.slice.call(arguments,1);for(var s=e.slice(),r=0,o=s.length;r<o;r++)s[r].apply(this,i);return!0}return!1},i.prototype.addListener=function(t,e){if("function"!=typeof e)throw new Error("addListener only takes instances of Function");return this._events||(this._events={}),this.emit("newListener",t,e),this._events[t]?n(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,this},i.prototype.on=i.prototype.addListener,i.prototype.once=function(t,e){var n=this;return n.on(t,(function i(){n.removeListener(t,i),e.apply(this,arguments)})),this},i.prototype.removeListener=function(t,e){if("function"!=typeof e)throw new Error("removeListener only takes instances of Function");if(!this._events||!this._events[t])return this;var i=this._events[t];if(n(i)){var s=function(t,e){if(t.indexOf)return t.indexOf(e);for(var n=0;n<t.length;n++)if(e===t[n])return n;return-1}(i,e);if(s<0)return this;i.splice(s,1),0==i.length&&delete this._events[t]}else this._events[t]===e&&delete this._events[t];return this},i.prototype.removeAllListeners=function(t){return 0===arguments.length?(this._events={},this):(t&&this._events&&this._events[t]&&(this._events[t]=null),this)},i.prototype.listeners=function(t){return this._events||(this._events={}),this._events[t]||(this._events[t]=[]),n(this._events[t])||(this._events[t]=[this._events[t]]),this._events[t]}},function(t,e,n){"use strict";(function(e){t.exports={addTimeout:function(t,n,i,s){if(this._timeouts=this._timeouts||{},!this._timeouts.hasOwnProperty(t)){var r=this;this._timeouts[t]=e.setTimeout((function(){delete r._timeouts[t],i.call(s)}),1e3*n)}},removeTimeout:function(t){this._timeouts=this._timeouts||{};var n=this._timeouts[t];n&&(e.clearTimeout(n),delete this._timeouts[t])},removeAllTimeouts:function(){for(var t in this._timeouts=this._timeouts||{},this._timeouts)this.removeTimeout(t)}}}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(6),r=n(20),o=n(3),c=n(14),a=n(12),h=n(0),u=n(5),l=n(31),f=n(7),d=h(i(n(4),{UNCONNECTED:1,CONNECTING:2,CONNECTED:3,batching:!1,isUsable:function(t,e){this.callback((function(){t.call(e,!0)})),this.errback((function(){t.call(e,!1)})),this.connect()},request:function(t){this._pending=this._pending||new r;for(var e=0,n=t.length;e<n;e++)this._pending.add(t[e]);var i=this,o=new s((function(e,n){i.callback((function(n){n&&1===n.readyState&&(n.send(u(t)),e(n))})),i.connect()}));return{abort:function(){o.then((function(t){t.close()}))}}},connect:function(){if(!d._unloaded&&(this._state=this._state||this.UNCONNECTED,this._state===this.UNCONNECTED)){this._state=this.CONNECTING;var t=this._createSocket();if(!t)return this.setDeferredStatus("failed");var e=this;t.onopen=function(){t.headers&&e._storeCookies(t.headers["set-cookie"]),e._socket=t,e._state=e.CONNECTED,e._everConnected=!0,e.setDeferredStatus("succeeded",t)};var n=!1;t.onclose=t.onerror=function(){if(!n){n=!0;var i=e._state===e.CONNECTED;t.onopen=t.onclose=t.onerror=t.onmessage=null,delete e._socket,e._state=e.UNCONNECTED;var s=e._pending?e._pending.toArray():[];delete e._pending,i||e._everConnected?(e.setDeferredStatus("unknown"),e._handleError(s,i)):e.setDeferredStatus("failed")}},t.onmessage=function(t){var n;try{n=JSON.parse(t.data)}catch(t){}if(n){for(var i=0,s=(n=[].concat(n)).length;i<s;i++)void 0!==n[i].successful&&e._pending.remove(n[i]);e._receive(n)}}}},close:function(){this._socket&&this._socket.close()},_createSocket:function(){var t=d.getSocketUrl(this.endpoint),e=this._dispatcher.headers,n=this._dispatcher.wsExtensions,i=this._getCookies(),s=this._dispatcher.tls,r={extensions:n,headers:e,proxy:this._proxy,tls:s};""!==i&&(r.headers.Cookie=i);try{return l.create(t,[],r)}catch(t){}}}),{PROTOCOLS:{"http:":"ws:","https:":"wss:"},create:function(t,e){var n=t.transports.websocket=t.transports.websocket||{};return n[e.href]=n[e.href]||new this(t,e),n[e.href]},getSocketUrl:function(t){return(t=a(t)).protocol=this.PROTOCOLS[t.protocol],o.stringify(t)},isUsable:function(t,e,n,i){this.create(t,e).isUsable(n,i)}});h(d.prototype,f),c.Event&&void 0!==e.onbeforeunload&&c.Event.on(e,"beforeunload",(function(){void 0===d._unloaded&&(d._unloaded=!0)})),t.exports=d}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var n=e.MozWebSocket||e.WebSocket;t.exports={create:function(t,e,i){return"function"!=typeof n?null:new n(t)}}}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(7),a=n(4),h=n(21),u=o(i(a,{initialize:function(t,n){if(a.prototype.initialize.call(this,t,n),!e.EventSource)return this.setDeferredStatus("failed");this._xhr=new h(t,n),(n=r(n)).pathname+="/"+t.clientId;var i=new e.EventSource(s.stringify(n)),o=this;i.onopen=function(){o._everConnected=!0,o.setDeferredStatus("succeeded")},i.onerror=function(){o._everConnected?o._handleError([]):(o.setDeferredStatus("failed"),i.close())},i.onmessage=function(t){var e;try{e=JSON.parse(t.data)}catch(t){}e?o._receive(e):o._handleError([])},this._socket=i},close:function(){this._socket&&(this._socket.onopen=this._socket.onerror=this._socket.onmessage=null,this._socket.close(),delete this._socket)},isUsable:function(t,e){this.callback((function(){t.call(e,!0)})),this.errback((function(){t.call(e,!1)}))},encode:function(t){return this._xhr.encode(t)},request:function(t){return this._xhr.request(t)}}),{isUsable:function(t,e,n,i){if(!t.clientId)return n.call(i,!1);h.isUsable(t,e,(function(s){if(!s)return n.call(i,!1);this.create(t,e).isUsable(n,i)}),this)},create:function(t,e){var n=t.transports.eventsource=t.transports.eventsource||{},i=t.clientId,o=r(e);return o.pathname+="/"+(i||""),n[o=s.stringify(o)]=n[o]||new this(t,e),n[o]}});o(u.prototype,c),t.exports=u}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(20),r=n(3),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){return"message="+encodeURIComponent(c(t))},request:function(t){var n,i=e.XDomainRequest?XDomainRequest:XMLHttpRequest,s=new i,r=++a._id,o=this._dispatcher.headers,c=this;if(s.open("POST",this.endpoint.href,!0),s.withCredentials=!0,s.setRequestHeader)for(n in s.setRequestHeader("Pragma","no-cache"),o)o.hasOwnProperty(n)&&s.setRequestHeader(n,o[n]);var h=function(){if(!s)return!1;a._pending.remove(r),s.onload=s.onerror=s.ontimeout=s.onprogress=null,s=null};return s.onload=function(){var e;try{e=JSON.parse(s.responseText)}catch(t){}h(),e?c._receive(e):c._handleError(t)},s.onerror=s.ontimeout=function(){h(),c._handleError(t)},s.onprogress=function(){},i===e.XDomainRequest&&a._pending.add({id:r,xhr:s}),s.send(this.encode(t)),s}}),{_id:0,_pending:new s,isUsable:function(t,n,i,s){if(r.isSameOrigin(n))return i.call(s,!1);if(e.XDomainRequest)return i.call(s,n.protocol===location.protocol);if(e.XMLHttpRequest){var o=new XMLHttpRequest;return i.call(s,void 0!==o.withCredentials)}return i.call(s,!1)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";(function(e){var i=n(1),s=n(3),r=n(12),o=n(0),c=n(5),a=o(i(n(4),{encode:function(t){var e=r(this.endpoint);return e.query.message=c(t),e.query.jsonp="__jsonp"+a._cbCount+"__",s.stringify(e)},request:function(t){var n=document.getElementsByTagName("head")[0],i=document.createElement("script"),o=a.getCallbackName(),h=r(this.endpoint),u=this;h.query.message=c(t),h.query.jsonp=o;var l=function(){if(!e[o])return!1;e[o]=void 0;try{delete e[o]}catch(t){}i.parentNode.removeChild(i)};return e[o]=function(t){l(),u._receive(t)},i.type="text/javascript",i.src=s.stringify(h),n.appendChild(i),i.onerror=function(){l(),u._handleError(t)},{abort:l}}}),{_cbCount:0,getCallbackName:function(){return this._cbCount+=1,"__jsonp"+this._cbCount+"__"},isUsable:function(t,e,n,i){n.call(i,!0)}});t.exports=a}).call(this,n(2))},function(t,e,n){"use strict";var i=n(1),s=n(16),r=i({initialize:function(t,e,n){this.code=t,this.params=Array.prototype.slice.call(e),this.message=n},toString:function(){return this.code+":"+this.params.join(",")+":"+this.message}});r.parse=function(t){if(t=t||"",!s.ERROR.test(t))return new r(null,[],t);var e=t.split(":"),n=parseInt(e[0]),i=e[1].split(",");t=e[2];return new r(n,i,t)};var o={versionMismatch:[300,"Version mismatch"],conntypeMismatch:[301,"Connection types not supported"],extMismatch:[302,"Extension mismatch"],badRequest:[400,"Bad request"],clientUnknown:[401,"Unknown client"],parameterMissing:[402,"Missing required parameter"],channelForbidden:[403,"Forbidden channel"],channelUnknown:[404,"Unknown channel"],channelInvalid:[405,"Invalid channel"],extUnknown:[406,"Unknown extension"],publishFailed:[407,"Failed to publish"],serverError:[500,"Internal server error"]};for(var c in o)!function(t){r[t]=function(){return new r(o[t][0],arguments,o[t][1]).toString()}}(c);t.exports=r},function(t,e,n){"use strict";var i={addExtension:function(t){this._extensions=this._extensions||[],this._extensions.push(t),t.added&&t.added(this)},removeExtension:function(t){if(this._extensions)for(var e=this._extensions.length;e--;)this._extensions[e]===t&&(this._extensions.splice(e,1),t.removed&&t.removed(this))},pipeThroughExtensions:function(t,e,n,i,s){if(this.debug("Passing through ? extensions: ?",t,e),!this._extensions)return i.call(s,e);var r=this._extensions.slice(),o=function(e){if(!e)return i.call(s,e);var c=r.shift();if(!c)return i.call(s,e);var a=c[t];if(!a)return o(e);a.length>=3?c[t](e,n,o):c[t](e,o)};o(e)}};n(0)(i,n(8)),t.exports=i},function(t,e,n){"use strict";var i=n(1),s=n(7);t.exports=i(s)},function(t,e,n){"use strict";var i=n(23),s=n(8),r={VERSION:i.VERSION,Client:n(25),Scheduler:n(22)};s.wrapper=r,t.exports=r}]);
//# sourceMappingURL=faye-browser-min.js.map

@@ -1,37 +0,48 @@

{ "name" : "faye"
, "description" : "Simple pub/sub messaging for the web"
, "homepage" : "https://faye.jcoglan.com"
, "author" : "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)"
, "keywords" : ["comet", "websocket", "pubsub", "bayeux", "ajax", "http"]
, "license" : "MIT"
, "version" : "1.2.5"
, "engines" : {"node": ">=0.6.0"}
, "main" : "src/faye_node"
, "browser" : "src/faye_browser"
, "dependencies" : { "asap": "*"
, "csprng": "*"
, "faye-websocket": ">=0.9.1"
, "tough-cookie": "*"
, "tunnel-agent": "*"
}
, "devDependencies" : { "jstest": "~1.0.0"
, "mime": "~1.2.0"
, "permessage-deflate": ">=0.1.0"
, "promises-aplus-tests": "~2.1.0"
, "uglifyjs": "*"
, "webpack": "<4.0.0"
, "imports-loader": "*"
}
, "scripts" : { "test" : "find spec -name '*_spec.js' | xargs jstest"
, "promise" : "promises-aplus-tests src/util/promise.js"
}
, "repository" : { "type" : "git"
, "url" : "git://github.com/faye/faye.git"
}
, "bugs" : "https://github.com/faye/faye/issues"
{
"name": "faye",
"description": "Simple pub/sub messaging for the web",
"homepage": "https://faye.jcoglan.com",
"author": "James Coglan <jcoglan@gmail.com> (http://jcoglan.com/)",
"keywords": [
"comet",
"websocket",
"pubsub",
"bayeux",
"ajax",
"http"
],
"license": "Apache-2.0",
"version": "1.3.0",
"engines": {
"node": ">=0.8.0"
},
"main": "src/faye_node",
"browser": "src/faye_browser",
"dependencies": {
"asap": "*",
"csprng": "*",
"faye-websocket": ">=0.9.1",
"safe-buffer": "*",
"tough-cookie": "*",
"tunnel-agent": "*"
},
"devDependencies": {
"jstest": "~1.0.0",
"mime": "~1.2.0",
"permessage-deflate": ">=0.1.0",
"promises-aplus-tests": "~2.1.0",
"webpack": "*",
"webpack-cli": "*",
"imports-loader": "*"
},
"scripts": {
"start": "webpack --watch",
"test": "find spec -name '*_spec.js' | xargs jstest",
"promise": "promises-aplus-tests src/util/promise.js"
},
"repository": {
"type": "git",
"url": "git://github.com/faye/faye.git"
},
"bugs": "https://github.com/faye/faye/issues"
}

@@ -7,29 +7,5 @@ # Faye

* Documentation: http://faye.jcoglan.com
* Mailing list: http://groups.google.com/group/faye-users
* Bug tracker: http://github.com/faye/faye/issues
* Source code: http://github.com/faye/faye
## License
(The MIT License)
Copyright (c) 2009-2020 James Coglan and contributors
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
- Documentation: http://faye.jcoglan.com
- Mailing list: http://groups.google.com/group/faye-users
- Bug tracker: http://github.com/faye/faye/issues
- Source code: http://github.com/faye/faye
module.exports = {
TYPE_JSON: {'Content-Type': 'application/json; charset=utf-8'},
TYPE_SCRIPT: {'Content-Type': 'text/javascript; charset=utf-8'},
TYPE_TEXT: {'Content-Type': 'text/plain; charset=utf-8'}
TYPE_JSON: { 'Content-Type': 'application/json; charset=utf-8' },
TYPE_SCRIPT: { 'Content-Type': 'text/javascript; charset=utf-8' },
TYPE_TEXT: { 'Content-Type': 'text/plain; charset=utf-8' }
};
'use strict';
var path = require('path'),
var Buffer = require('safe-buffer').Buffer,
path = require('path'),
querystring = require('querystring'),

@@ -10,3 +11,3 @@ url = require('url'),

var constants = require('../util/constants'),
extend = require('../util/extend'),
assign = require('../util/assign'),
idFromMessages = require('../util/id_from_messages'),

@@ -122,3 +123,3 @@ toJSON = require('../util/to_json'),

if (requestMethod === 'OPTIONS' || request.headers['access-control-request-method'] === 'POST')
return this._handleOptions(response);
return this._handleOptions(request, response);

@@ -135,3 +136,3 @@ if (EventSource.isEventSource(request))

params = (type === 'application/json')
? {message: data}
? { message: data }
: querystring.parse(data);

@@ -143,3 +144,3 @@

this._returnError(response, {message: 'Unrecognized request type'});
this._returnError(response, { message: 'Unrecognized request type' });
},

@@ -149,3 +150,3 @@

if (!params.message)
return this._returnError(response, {message: 'Received request with no message: ' + this._formatRequest(request)});
return this._returnError(response, { message: 'Received request with no message: ' + this._formatRequest(request) });

@@ -159,12 +160,16 @@ try {

type = isGet ? contenttypes.TYPE_SCRIPT : contenttypes.TYPE_JSON,
headers = extend({}, type),
headers = assign({}, type),
origin = request.headers.origin;
if (!this.VALID_JSONP_CALLBACK.test(jsonp))
return this._returnError(response, {message: 'Invalid JSON-P callback: ' + jsonp});
return this._returnError(response, { message: 'Invalid JSON-P callback: ' + jsonp });
if (origin) headers['Access-Control-Allow-Origin'] = origin;
headers['Cache-Control'] = 'no-cache, no-store';
headers['X-Content-Type-Options'] = 'nosniff';
if (origin) {
headers['Access-Control-Allow-Credentials'] = 'true';
headers['Access-Control-Allow-Origin'] = origin;
}
this._server.process(message, request, function(replies) {

@@ -178,3 +183,3 @@ var body = toJSON(replies);

headers['Content-Length'] = new Buffer(body, 'utf8').length.toString();
headers['Content-Length'] = Buffer.from(body, 'utf8').length.toString();

@@ -195,3 +200,3 @@ this.debug('HTTP response: ?', body);

handleUpgrade: function(request, socket, head) {
var options = {extensions: this._extensions, ping: this._options.ping},
var options = { extensions: this._extensions, ping: this._options.ping },
ws = new WebSocket(request, socket, head, [], options),

@@ -230,3 +235,3 @@ clientId = null,

handleEventSource: function(request, response) {
var es = new EventSource(request, response, {ping: this._options.ping}),
var es = new EventSource(request, response, { ping: this._options.ping }),
clientId = es.url.split('/').pop(),

@@ -244,8 +249,9 @@ self = this;

_handleOptions: function(response) {
_handleOptions: function(request, response) {
var origin = request.headers.origin || request.headers.referer;
var headers = {
'Access-Control-Allow-Credentials': 'false',
'Access-Control-Allow-Credentials': 'true',
'Access-Control-Allow-Headers': 'Accept, Authorization, Content-Type, Pragma, X-Requested-With',
'Access-Control-Allow-Methods': 'POST, GET',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Origin': origin || '*',
'Access-Control-Max-Age': '86400'

@@ -268,3 +274,3 @@ };

stream.on('end', function() {
var buffer = new Buffer(length),
var buffer = Buffer.alloc(length),
offset = 0;

@@ -316,4 +322,4 @@

extend(NodeAdapter.prototype, Logging);
assign(NodeAdapter.prototype, Logging);
module.exports = NodeAdapter;

@@ -9,3 +9,3 @@ 'use strict';

var Class = require('../util/class'),
extend = require('../util/extend'),
assign = require('../util/assign'),
contenttypes = require('./content_types');

@@ -66,3 +66,3 @@

headers['Content-Length'] = cache.content.length;
extend(headers, contenttypes[type]);
assign(headers, contenttypes[type]);
response.writeHead(200, headers);

@@ -69,0 +69,0 @@ response.end(cache.content);

'use strict';
var Class = require('../util/class'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Deferrable = require('../mixins/deferrable'),

@@ -54,5 +54,5 @@ Timeouts = require('../mixins/timeouts');

extend(Connection.prototype, Deferrable);
extend(Connection.prototype, Timeouts);
assign(Connection.prototype, Deferrable);
assign(Connection.prototype, Timeouts);
module.exports = Connection;
'use strict';
var copyObject = require('../util/copy_object'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Namespace = require('../util/namespace'),

@@ -135,4 +135,4 @@ Set = require('../util/set'),

extend(Memory.prototype, Timeouts);
assign(Memory.prototype, Timeouts);
module.exports = Memory;
'use strict';
var asap = require('asap'),
extend = require('../util/extend'),
assign = require('../util/assign'),
random = require('../util/random'),

@@ -14,3 +14,3 @@ Class = require('../util/class'),

var Proxy = extend(Class({ className: 'Engine.Proxy',
var Proxy = assign(Class({ className: 'Engine.Proxy',
MAX_DELAY: 0,

@@ -124,5 +124,5 @@ INTERVAL: 0,

extend(Proxy.prototype, Publisher);
extend(Proxy.prototype, Logging);
assign(Proxy.prototype, Publisher);
assign(Proxy.prototype, Logging);
module.exports = Proxy;
'use strict';
var extend = require('../util/extend'),
var assign = require('../util/assign'),
EventEmitter = require('../util/event_emitter');

@@ -34,5 +34,5 @@

extend(Publisher, EventEmitter.prototype);
assign(Publisher, EventEmitter.prototype);
Publisher.trigger = Publisher.emit;
module.exports = Publisher;
'use strict';
var Class = require('../util/class'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Publisher = require('../mixins/publisher'),

@@ -22,5 +22,5 @@ Grammar = require('./grammar');

extend(Channel.prototype, Publisher);
assign(Channel.prototype, Publisher);
extend(Channel, {
assign(Channel, {
HANDSHAKE: '/meta/handshake',

@@ -27,0 +27,0 @@ CONNECT: '/meta/connect',

@@ -6,7 +6,6 @@ 'use strict';

Promise = require('../util/promise'),
URI = require('../util/uri'),
array = require('../util/array'),
browser = require('../util/browser'),
constants = require('../util/constants'),
extend = require('../util/extend'),
assign = require('../util/assign'),
validateOptions = require('../util/validate_options'),

@@ -24,15 +23,15 @@ Deferrable = require('../mixins/deferrable'),

var Client = Class({ className: 'Client',
UNCONNECTED: 1,
CONNECTING: 2,
CONNECTED: 3,
DISCONNECTED: 4,
UNCONNECTED: 1,
CONNECTING: 2,
CONNECTED: 3,
DISCONNECTED: 4,
HANDSHAKE: 'handshake',
RETRY: 'retry',
NONE: 'none',
HANDSHAKE: 'handshake',
RETRY: 'retry',
NONE: 'none',
CONNECTION_TIMEOUT: 60,
DEFAULT_ENDPOINT: '/bayeux',
INTERVAL: 0,
DEFAULT_ENDPOINT: '/bayeux',
INTERVAL: 0,

@@ -107,3 +106,3 @@ initialize: function(endpoint, options) {

this.info('Initiating handshake with ?', URI.stringify(this._dispatcher.endpoint));
this.info('Initiating handshake with ?', this._dispatcher.endpoint.href);
this._dispatcher.selectTransport(constants.MANDATORY_CONNECTION_TYPES);

@@ -358,3 +357,3 @@

_handleAdvice: function(advice) {
extend(this._advice, advice);
assign(this._advice, advice);
this._dispatcher.timeout = this._advice.timeout / 1000;

@@ -385,7 +384,7 @@

extend(Client.prototype, Deferrable);
extend(Client.prototype, Publisher);
extend(Client.prototype, Logging);
extend(Client.prototype, Extensible);
assign(Client.prototype, Deferrable);
assign(Client.prototype, Publisher);
assign(Client.prototype, Logging);
assign(Client.prototype, Extensible);
module.exports = Client;

@@ -6,3 +6,3 @@ 'use strict';

cookies = require('../util/cookies'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Logging = require('../mixins/logging'),

@@ -36,3 +36,3 @@ Publisher = require('../mixins/publisher'),

this.proxy = options.proxy || {};
if (typeof this._proxy === 'string') this._proxy = {origin: this._proxy};
if (typeof this._proxy === 'string') this._proxy = { origin: this._proxy };

@@ -65,2 +65,3 @@ var exts = options.websocketExtensions;

this._disabled.push(feature);
Transport.disable(feature);
},

@@ -84,3 +85,3 @@

Transport.get(this, transportTypes, this._disabled, function(transport) {
this.debug('Selected ? transport for ?', transport.connectionType, URI.stringify(transport.endpoint));
this.debug('Selected ? transport for ?', transport.connectionType, transport.endpoint.href);

@@ -105,4 +106,4 @@ if (transport === this._transport) return;

if (!envelope) {
scheduler = new this._scheduler(message, {timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline});
envelope = this._envelopes[id] = {message: message, scheduler: scheduler};
scheduler = new this._scheduler(message, { timeout: timeout, interval: this.retry, attempts: attempts, deadline: deadline });
envelope = this._envelopes[id] = { message: message, scheduler: scheduler };
}

@@ -187,5 +188,5 @@

extend(Dispatcher.prototype, Publisher);
extend(Dispatcher.prototype, Logging);
assign(Dispatcher.prototype, Publisher);
assign(Dispatcher.prototype, Logging);
module.exports = Dispatcher;
'use strict';
var extend = require('../util/extend'),
var assign = require('../util/assign'),
Logging = require('../mixins/logging');

@@ -45,4 +45,4 @@

extend(Extensible, Logging);
assign(Extensible, Logging);
module.exports = Extensible;
'use strict';
var extend = require('../util/extend');
var assign = require('../util/assign');

@@ -11,3 +11,3 @@ var Scheduler = function(message, options) {

extend(Scheduler.prototype, {
assign(Scheduler.prototype, {
getTimeout: function() {

@@ -14,0 +14,0 @@ return this.options.timeout;

@@ -5,3 +5,3 @@ 'use strict';

array = require('../util/array'),
extend = require('../util/extend'),
assign = require('../util/assign'),
constants = require('../util/constants'),

@@ -62,3 +62,3 @@ Logging = require('../mixins/logging'),

var handleReply = function(replies) {
var extended = 0, expected = replies.length;
var assigned = 0, expected = replies.length;
if (expected === 0) gatherReplies(replies);

@@ -71,4 +71,4 @@

replies[index] = message;
extended += 1;
if (extended === expected) gatherReplies(replies);
assigned += 1;
if (assigned === expected) gatherReplies(replies);
});

@@ -168,5 +168,5 @@ })(i);

if (response.error) {
extend(response.advice, {reconnect: 'handshake'}, false);
assign(response.advice, { reconnect: 'handshake' }, false);
} else {
extend(response.advice, {
assign(response.advice, {
reconnect: 'retry',

@@ -344,5 +344,5 @@ interval: interval,

extend(Server.prototype, Logging);
extend(Server.prototype, Extensible);
assign(Server.prototype, Logging);
assign(Server.prototype, Extensible);
module.exports = Server;
'use strict';
var Class = require('../util/class'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Deferrable = require('../mixins/deferrable');

@@ -42,4 +42,4 @@

extend(Subscription.prototype, Deferrable);
assign(Subscription.prototype, Deferrable);
module.exports = Subscription;

@@ -6,7 +6,7 @@ 'use strict';

URI = require('../util/uri'),
extend = require('../util/extend'),
assign = require('../util/assign'),
toJSON = require('../util/to_json'),
Transport = require('./transport');
var CORS = extend(Class(Transport, {
var CORS = assign(Class(Transport, {
encode: function(messages) {

@@ -24,3 +24,4 @@ return 'message=' + encodeURIComponent(toJSON(messages));

xhr.open('POST', URI.stringify(this.endpoint), true);
xhr.open('POST', this.endpoint.href, true);
xhr.withCredentials = true;

@@ -62,3 +63,3 @@ if (xhr.setRequestHeader) {

if (xhrClass === global.XDomainRequest)
CORS._pending.add({id: id, xhr: xhr});
CORS._pending.add({ id: id, xhr: xhr });

@@ -65,0 +66,0 @@ xhr.send(this.encode(messages));

@@ -6,3 +6,3 @@ 'use strict';

copyObject = require('../util/copy_object'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Deferrable = require('../mixins/deferrable'),

@@ -12,3 +12,3 @@ Transport = require('./transport'),

var EventSource = extend(Class(Transport, {
var EventSource = assign(Class(Transport, {
initialize: function(dispatcher, endpoint) {

@@ -97,4 +97,4 @@ Transport.prototype.initialize.call(this, dispatcher, endpoint);

extend(EventSource.prototype, Deferrable);
assign(EventSource.prototype, Deferrable);
module.exports = EventSource;

@@ -6,7 +6,7 @@ 'use strict';

copyObject = require('../util/copy_object'),
extend = require('../util/extend'),
assign = require('../util/assign'),
toJSON = require('../util/to_json'),
Transport = require('./transport');
var JSONP = extend(Class(Transport, {
var JSONP = assign(Class(Transport, {
encode: function(messages) {

@@ -50,3 +50,3 @@ var url = copyObject(this.endpoint);

return {abort: cleanup};
return { abort: cleanup };
}

@@ -53,0 +53,0 @@ }), {

'use strict';
var http = require('http'),
var Buffer = require('safe-buffer').Buffer,
http = require('http'),
https = require('https'),

@@ -9,7 +10,7 @@ tunnel = require('tunnel-agent');

URI = require('../util/uri'),
extend = require('../util/extend'),
assign = require('../util/assign'),
toJSON = require('../util/to_json'),
Transport = require('./transport');
var NodeHttp = extend(Class(Transport, { className: 'NodeHttp',
var NodeHttp = assign(Class(Transport, { className: 'NodeHttp',
SECURE_PROTOCOLS: ['https:', 'wss:'],

@@ -34,3 +35,3 @@

var options = extend({
var options = assign({
proxy: {

@@ -40,3 +41,3 @@ host: this._proxyUri.hostname,

proxyAuth: this._proxyUri.auth,
headers: extend({host: this.endpoint.host}, proxy.headers)
headers: assign({ host: this.endpoint.host }, proxy.headers)
}

@@ -46,3 +47,3 @@ }, this._dispatcher.tls);

if (this._proxySecure) {
extend(options.proxy, proxy.tls);
assign(options.proxy, proxy.tls);
this._tunnel = tunnel.httpsOverHttps(options);

@@ -59,3 +60,3 @@ } else {

request: function(messages) {
var content = new Buffer(this.encode(messages), 'utf8'),
var content = Buffer.from(this.encode(messages), 'utf8'),
params = this._buildParams(content),

@@ -84,2 +85,11 @@ request = this._httpClient.request(params),

var headers = {
'Content-Length': content.length,
'Content-Type': 'application/json',
'Host': uri.host
};
if (uri.auth)
headers['Authorization'] = 'Basic ' + Buffer.from(uri.auth, 'utf8').toString('base64');
var params = {

@@ -90,7 +100,3 @@ method: 'POST',

path: uri.path,
headers: extend({
'Content-Length': content.length,
'Content-Type': 'application/json',
'Host': uri.host
}, this._dispatcher.headers)
headers: assign(headers, this._dispatcher.headers)
};

@@ -104,8 +110,8 @@

} else if (this._endpointSecure) {
extend(params, this._dispatcher.tls);
assign(params, this._dispatcher.tls);
} else if (proxy) {
params.path = this.endpoint.href;
extend(params, this._proxy.tls);
assign(params, this._proxy.tls);
if (proxy.auth)
params.headers['Proxy-Authorization'] = new Buffer(proxy.auth, 'utf8').toString('base64');
params.headers['Proxy-Authorization'] = Buffer.from(proxy.auth, 'utf8').toString('base64');
}

@@ -112,0 +118,0 @@

@@ -7,7 +7,7 @@ 'use strict';

copyObject = require('../util/copy_object'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Server = require('../protocol/server'),
Transport = require('./transport');
var NodeLocal = extend(Class(Transport, {
var NodeLocal = assign(Class(Transport, {
batching: false,

@@ -14,0 +14,0 @@

@@ -6,5 +6,4 @@ 'use strict';

Promise = require('../util/promise'),
URI = require('../util/uri'),
array = require('../util/array'),
extend = require('../util/extend'),
assign = require('../util/assign'),
Logging = require('../mixins/logging'),

@@ -14,4 +13,4 @@ Timeouts = require('../mixins/timeouts'),

var Transport = extend(Class({ className: 'Transport',
DEFAULT_PORTS: {'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443},
var Transport = assign(Class({ className: 'Transport',
DEFAULT_PORTS: { 'http:': 80, 'https:': 443, 'ws:': 80, 'wss:': 443 },
MAX_DELAY: 0,

@@ -25,3 +24,3 @@

this._outbox = [];
this._proxy = extend({}, this._dispatcher.proxy);
this._proxy = assign({}, this._dispatcher.proxy);

@@ -40,3 +39,3 @@ if (!this._proxy.origin)

this.debug('Client ? sending message to ?: ?',
this._dispatcher.clientId, URI.stringify(this.endpoint), message);
this._dispatcher.clientId, this.endpoint.href, message);

@@ -80,3 +79,3 @@ if (!this.batching) return Promise.resolve(this.request([message]));

if (this._outbox.length > 1 && this._connectMessage)
this._connectMessage.advice = {timeout: 0};
this._connectMessage.advice = { timeout: 0 };

@@ -105,3 +104,3 @@ this._resolvePromise(this.request(this._outbox));

this.debug('Client ? received from ? via ?: ?',
this._dispatcher.clientId, URI.stringify(this.endpoint), this.connectionType, replies);
this._dispatcher.clientId, this.endpoint.href, this.connectionType, replies);

@@ -116,3 +115,3 @@ for (var i = 0, n = replies.length; i < n; i++)

this.debug('Client ? failed to send to ? via ?: ?',
this._dispatcher.clientId, URI.stringify(this.endpoint), this.connectionType, messages);
this._dispatcher.clientId, this.endpoint.href, this.connectionType, messages);

@@ -125,3 +124,3 @@ for (var i = 0, n = messages.length; i < n; i++)

var cookies = this._dispatcher.cookies,
url = URI.stringify(this.endpoint);
url = this.endpoint.href;

@@ -137,3 +136,3 @@ if (!cookies) return '';

var cookies = this._dispatcher.cookies,
url = URI.stringify(this.endpoint),
url = this.endpoint.href,
cookie;

@@ -201,3 +200,3 @@

}, function() {
throw new Error('Could not find a usable connection type for ' + URI.stringify(endpoint));
throw new Error('Could not find a usable connection type for ' + endpoint.href);
});

@@ -215,8 +214,15 @@ },

disable: function(feature) {
if (feature !== 'autodisconnect') return;
for (var i = 0; i < this._transports.length; i++)
this._transports[i][1]._unloaded = false;
},
_transports: []
});
extend(Transport.prototype, Logging);
extend(Transport.prototype, Timeouts);
assign(Transport.prototype, Logging);
assign(Transport.prototype, Timeouts);
module.exports = Transport;

@@ -9,3 +9,3 @@ 'use strict';

copyObject = require('../util/copy_object'),
extend = require('../util/extend'),
assign = require('../util/assign'),
toJSON = require('../util/to_json'),

@@ -16,3 +16,3 @@ ws = require('../util/websocket'),

var WebSocket = extend(Class(Transport, {
var WebSocket = assign(Class(Transport, {
UNCONNECTED: 1,

@@ -68,3 +68,2 @@ CONNECTING: 2,

self._everConnected = true;
self._ping();
self.setDeferredStatus('succeeded', socket);

@@ -83,3 +82,2 @@ };

self._state = self.UNCONNECTED;
self.removeTimeout('ping');

@@ -124,13 +122,11 @@ var pending = self._pending ? self._pending.toArray() : [];

tls = this._dispatcher.tls,
options = {extensions: extensions, headers: headers, proxy: this._proxy, tls: tls};
options = { extensions: extensions, headers: headers, proxy: this._proxy, tls: tls };
if (cookie !== '') options.headers['Cookie'] = cookie;
return ws.create(url, [], options);
},
_ping: function() {
if (!this._socket || this._socket.readyState !== 1) return;
this._socket.send('[]');
this.addTimeout('ping', this._dispatcher.timeout / 2, this._ping, this);
try {
return ws.create(url, [], options);
} catch (e) {
// catch CSP error to allow transport to fallback to next connType
}
}

@@ -161,7 +157,11 @@

extend(WebSocket.prototype, Deferrable);
assign(WebSocket.prototype, Deferrable);
if (browser.Event && global.onbeforeunload !== undefined)
browser.Event.on(global, 'beforeunload', function() { WebSocket._unloaded = true });
if (browser.Event && global.onbeforeunload !== undefined) {
browser.Event.on(global, 'beforeunload', function() {
if (WebSocket._unloaded === undefined)
WebSocket._unloaded = true;
});
}
module.exports = WebSocket;

@@ -6,7 +6,7 @@ 'use strict';

browser = require('../util/browser'),
extend = require('../util/extend'),
assign = require('../util/assign'),
toJSON = require('../util/to_json'),
Transport = require('./transport');
var XHR = extend(Class(Transport, {
var XHR = assign(Class(Transport, {
encode: function(messages) {

@@ -13,0 +13,0 @@ return toJSON(messages);

'use strict';
var extend = require('./extend');
var assign = require('./assign');

@@ -20,5 +20,5 @@ module.exports = function(parent, methods) {

klass.prototype = new bridge();
extend(klass.prototype, methods);
assign(klass.prototype, methods);
return klass;
};
module.exports = {
VERSION: '1.2.5',
VERSION: '1.3.0',

@@ -4,0 +4,0 @@ BAYEUX_VERSION: '1.0',

@@ -5,26 +5,29 @@ 'use strict';

var PENDING = 0,
FULFILLED = 1,
REJECTED = 2;
var PENDING = -1,
FULFILLED = 0,
REJECTED = 1;
var RETURN = function(x) { return x },
THROW = function(x) { throw x };
var Promise = function(task) {
this._state = PENDING;
this._onFulfilled = [];
this._onRejected = [];
this._state = PENDING;
this._value = null;
this._defer = [];
if (typeof task !== 'function') return;
var self = this;
task(function(value) { resolve(self, value) },
function(reason) { reject(self, reason) });
execute(this, task);
};
Promise.prototype.then = function(onFulfilled, onRejected) {
var next = new Promise();
registerOnFulfilled(this, onFulfilled, next);
registerOnRejected(this, onRejected, next);
return next;
var promise = new Promise();
var deferred = {
promise: promise,
onFulfilled: onFulfilled,
onRejected: onRejected
};
if (this._state === PENDING)
this._defer.push(deferred);
else
propagate(this, deferred);
return promise;
};

@@ -36,89 +39,95 @@

var registerOnFulfilled = function(promise, onFulfilled, next) {
if (typeof onFulfilled !== 'function') onFulfilled = RETURN;
var handler = function(value) { invoke(onFulfilled, value, next) };
var execute = function(promise, task) {
if (typeof task !== 'function') return;
if (promise._state === PENDING) {
promise._onFulfilled.push(handler);
} else if (promise._state === FULFILLED) {
handler(promise._value);
}
};
var calls = 0;
var registerOnRejected = function(promise, onRejected, next) {
if (typeof onRejected !== 'function') onRejected = THROW;
var handler = function(reason) { invoke(onRejected, reason, next) };
var resolvePromise = function(value) {
if (calls++ === 0) resolve(promise, value);
};
if (promise._state === PENDING) {
promise._onRejected.push(handler);
} else if (promise._state === REJECTED) {
handler(promise._reason);
var rejectPromise = function(reason) {
if (calls++ === 0) reject(promise, reason);
};
try {
task(resolvePromise, rejectPromise);
} catch (error) {
rejectPromise(error);
}
};
var invoke = function(fn, value, next) {
asap(function() { _invoke(fn, value, next) });
var propagate = function(promise, deferred) {
var state = promise._state,
value = promise._value,
next = deferred.promise,
handler = [deferred.onFulfilled, deferred.onRejected][state],
pass = [resolve, reject][state];
if (typeof handler !== 'function')
return pass(next, value);
asap(function() {
try {
resolve(next, handler(value));
} catch (error) {
reject(next, error);
}
});
};
var _invoke = function(fn, value, next) {
var outcome;
var resolve = function(promise, value) {
if (promise === value)
return reject(promise, new TypeError('Recursive promise chain detected'));
var then;
try {
outcome = fn(value);
then = getThen(value);
} catch (error) {
return reject(next, error);
return reject(promise, error);
}
if (outcome === next) {
reject(next, new TypeError('Recursive promise chain detected'));
} else {
resolve(next, outcome);
}
if (!then) return fulfill(promise, value);
execute(promise, function(resolvePromise, rejectPromise) {
then.call(value, resolvePromise, rejectPromise);
});
};
var resolve = function(promise, value) {
var called = false, type, then;
var getThen = function(value) {
var type = typeof value,
then = (type === 'object' || type === 'function') && value && value.then;
try {
type = typeof value;
then = value !== null && (type === 'function' || type === 'object') && value.then;
if (typeof then !== 'function') return fulfill(promise, value);
then.call(value, function(v) {
if (!(called ^ (called = true))) return;
resolve(promise, v);
}, function(r) {
if (!(called ^ (called = true))) return;
reject(promise, r);
});
} catch (error) {
if (!(called ^ (called = true))) return;
reject(promise, error);
}
return (typeof then === 'function')
? then
: null;
};
var fulfill = function(promise, value) {
if (promise._state !== PENDING) return;
promise._state = FULFILLED;
promise._value = value;
promise._onRejected = [];
var onFulfilled = promise._onFulfilled, fn;
while (fn = onFulfilled.shift()) fn(value);
settle(promise, FULFILLED, value);
};
var reject = function(promise, reason) {
if (promise._state !== PENDING) return;
settle(promise, REJECTED, reason);
};
promise._state = REJECTED;
promise._reason = reason;
promise._onFulfilled = [];
var settle = function(promise, state, value) {
var defer = promise._defer, i = 0;
var onRejected = promise._onRejected, fn;
while (fn = onRejected.shift()) fn(reason);
promise._state = state;
promise._value = value;
promise._defer = null;
if (defer.length === 0) return;
while (i < defer.length) propagate(promise, defer[i++]);
};
Promise.resolve = function(value) {
try {
if (getThen(value)) return value;
} catch (error) {
return Promise.reject(error);
}
return new Promise(function(resolve, reject) { resolve(value) });

@@ -137,3 +146,3 @@ };

for (i = 0; i < n; i++) (function(promise, i) {
var push = function(promise, i) {
Promise.resolve(promise).then(function(value) {

@@ -143,3 +152,5 @@ list[i] = value;

}, reject);
})(promises[i], i);
};
for (i = 0; i < n; i++) push(promises[i], i);
});

@@ -155,3 +166,3 @@ };

Promise.deferred = Promise.pending = function() {
Promise.deferred = function() {
var tuple = {};

@@ -158,0 +169,0 @@

@@ -39,6 +39,11 @@ 'use strict';

if (uri.host) {
uri.host = uri.host.substr(2);
parts = uri.host.split(':');
uri.hostname = parts[0];
uri.port = parts[1] || '';
uri.host = uri.host.substr(2);
if (/@/.test(uri.host)) {
uri.auth = uri.host.split('@')[0];
uri.host = uri.host.split('@')[1];
}
parts = uri.host.match(/^\[([^\]]+)\]|^[^:]+/);
uri.hostname = parts[1] || parts[0];
uri.port = (uri.host.match(/:(\d+)$/) || [])[1] || '';
} else {

@@ -69,5 +74,7 @@ uri.host = location.host;

stringify: function(uri) {
var string = uri.protocol + '//' + uri.hostname;
if (uri.port) string += ':' + uri.port;
var auth = uri.auth ? uri.auth + '@' : '',
string = uri.protocol + '//' + auth + uri.host;
string += uri.pathname + this.queryString(uri.query) + (uri.hash || '');
return string;

@@ -74,0 +81,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc