@quotemedia.com/streamer 2.66.0 → 2.67.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -12,7 +12,7 @@ The JavaScript streaming client is a library that contains all the necessary dep
12
12
 
13
13
  Include the library file in your HTML page:
14
14
  ```html
15
- <script src="qmci-streamer-2.65.0.min.js"></script>
15
+ <script src="qmci-streamer-2.67.0.min.js"></script>
16
16
  <script>
17
17
  var Streamer = qmci.Streamer;
18
18
  </script>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -2,7 +2,7 @@
2
2
  <html lang="en">
3
3
 
4
4
  <head>
5
- <script src="qmci-streamer-2.66.0.min.js"></script>
5
+ <script src="qmci-streamer-2.67.0.min.js"></script>
6
6
  <script src="https://cdnjs.cloudflare.com/ajax/libs/stomp.js/2.3.3/stomp.min.js"></script>
7
7
  </head>
8
8
 
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -33,7 +33,7 @@
33
33
  * Step 3: Add the event listeners and the handlers for the messages
34
34
  * Step 4: Open News connection via openNews() to obtain a newsClientId
35
35
  * Step 5: Subscribe to News Filters with the newsClientId (skipHeavyInitialLoad: false)
36
- * Step 6: Subscribe a second filter concurrently (skipHeavyInitialLoad: true)
36
+ * Step 6: Subscribe a second filter sequentially (skipHeavyInitialLoad: true)
37
37
  * Step 7: Query current News Filter status
38
38
  * Step 8: Update News Filters
39
39
  * Step 9: Unsubscribe from News Filter 1 (keep filter 2 active)
@@ -42,364 +42,365 @@
42
42
  * Step 12: Close stream
43
43
  */
44
44
 
45
- // Log in to get an SID.
46
- // This can be done by directly calling to QuoteMedia's auth service.
47
- Streamer.login({
48
- host: 'https://app.quotemedia.com/auth',
49
- credentials: {
50
- wmid: "YourWebmasterID",
51
- username: "YourUsername",
52
- password: "YourPassword"
53
- }
54
- }, handleResult(function(sid) {
55
- Streamer.open({
45
+ // --- Promise wrappers for callback-based Streamer APIs ---
46
+ function loginAsync(opts) {
47
+ return new Promise((resolve, reject) => {
48
+ Streamer.login(opts, (err, result) => err ? reject(err) : resolve(result));
49
+ });
50
+ }
51
+
52
+ function openAsync(opts) {
53
+ return new Promise((resolve, reject) => {
54
+ Streamer.open(opts, (err, result) => err ? reject(err) : resolve(result));
55
+ });
56
+ }
57
+
58
+ function openNewsAsync(stream, newsClientId) {
59
+ return new Promise((resolve, reject) => {
60
+ stream.openNews(newsClientId, (err, result) => err ? reject(err) : resolve(result));
61
+ });
62
+ }
63
+
64
+ function subscribeNewsAsync(stream, filter, filterId, skipHeavy, newsClientId) {
65
+ return new Promise((resolve, reject) => {
66
+ stream.subscribeNews(filter, filterId, skipHeavy, newsClientId, (err, result) => err ? reject(err) : resolve(result));
67
+ });
68
+ }
69
+
70
+ function fltGetNewsAsync(stream) {
71
+ return new Promise((resolve) => {
72
+ let done = false;
73
+ stream.on("newsRemoteMessage", function(msg) {
74
+ if (!done && msg["@T"] === "C37") {
75
+ done = true;
76
+ // resolve on next tick so the existing newsRemoteMessage handler prints first
77
+ setTimeout(() => resolve(msg), 0);
78
+ }
79
+ });
80
+ stream.fltGetNews((err) => {
81
+ if (err && !done) {
82
+ done = true;
83
+ print("err: " + err, "red");
84
+ resolve();
85
+ }
86
+ });
87
+ });
88
+ }
89
+
90
+ function fltUpdateNewsAsync(stream, filter, filterId) {
91
+ return new Promise((resolve, reject) => {
92
+ stream.fltUpdateNews(filter, filterId, (err, result) => err ? reject(err) : resolve(result));
93
+ });
94
+ }
95
+
96
+ function unsubscribeNewsAsync(stream, filterId) {
97
+ return new Promise((resolve) => {
98
+ let done = false;
99
+ stream.on("filter delete", function(msg) {
100
+ if (!done) {
101
+ done = true;
102
+ resolve(msg);
103
+ }
104
+ });
105
+ stream.unsubscribeNews(filterId, (err) => {
106
+ if (err && !done) {
107
+ done = true;
108
+ print("Failed to unsubscribe News filter: " + err, "red");
109
+ resolve();
110
+ }
111
+ });
112
+ });
113
+ }
114
+
115
+ function closeAsync(stream) {
116
+ return new Promise((resolve, reject) => {
117
+ stream.close((err, result) => err ? reject(err) : resolve(result));
118
+ });
119
+ }
120
+
121
+ // --- Main async flow ---
122
+ run().catch(err => print("Unexpected error: " + err, "red"));
123
+
124
+ async function run() {
125
+ // Step 1: Log in to get an SID
126
+ const sid = await loginAsync({
127
+ host: 'https://app.quotemedia.com/auth',
128
+ credentials: {
129
+ wmid: "YourWebmasterID",
130
+ username: "YourUsername",
131
+ password: "YourPassword"
132
+ }
133
+ });
134
+
135
+ // Step 2: Open the streaming connection
136
+ const stream = await openAsync({
56
137
  host: 'https://app.quotemedia.com/cache',
57
138
  cors: true,
58
139
  rejectExcessiveConnection: false,
59
140
  conflation: null,
60
141
  format: 'application/json',
61
142
  credentials: { sid: sid }
62
- }, handleResult(function(stream) {
63
- // After successfully opening the stream,
64
- // listen for its events.
65
- stream
66
- // The stream will asynchronously callback with
67
- // incoming market data messages.
68
- .on("message", function(message) {
69
- /**
70
- * # News Data Message Fields (type "D18").
71
- *
72
- * Available fields on the message object:
73
- * headline, summary, source, sourceId, symbol,
74
- * storyId, storyUrl, newsUrl, timestamp, epochtime,
75
- * lang, excode, exgroup, topic, sector,
76
- * thumbnailUrl, videoUrl, videoImageUrl,
77
- * vendorDateId, filterId
78
- */
79
- if (message["@T"] === "D18") {
80
- // Display rich News data fields
81
- print("--- News Article Received ---", "dodgerblue");
82
- print(" Headline: " + message.headline, "dodgerblue");
83
- print(" Source: " + message.source + " (" + message.sourceId + ")", "dodgerblue");
84
- print(" Symbol: " + message.symbol, "dodgerblue");
85
- print(" Topic: " + message.topic, "dodgerblue");
86
- print(" Sector: " + message.sector, "dodgerblue");
87
- print(" Time: " + new Date(message.timestamp).toLocaleString(), "dodgerblue");
88
- print(" FilterId: " + message.filterId, "dodgerblue");
89
- if (message.summary) {
90
- print(" Summary: " + message.summary.substring(0, 200) + "...", "dodgerblue");
91
- }
92
- if (message.storyUrl) {
93
- print(" Story URL: " + message.storyUrl, "dodgerblue");
94
- }
95
- if (message.thumbnailUrl) {
96
- print(" Thumbnail: " + message.thumbnailUrl, "dodgerblue");
97
- }
98
- if (message.videoUrl) {
99
- print(" Video: " + message.videoUrl, "dodgerblue");
100
- }
101
- } else {
102
- print(msgFmt.fmt(message), "dodgerblue");
103
- }
104
- })
105
- // It's recommended to attach an error handler
106
- // to help diagnose unexpected errors.
107
- .on("error", function(err) {
108
- print(err, "red");
109
- }).on("close", function(msg) {
110
- print("Closed: " + msg);
111
- })
143
+ });
144
+
145
+ // Step 3: Set up event listeners
146
+ stream
147
+ .on("message", function(message) {
112
148
  /**
113
- * # Differentiate News Message Types.
114
- *
115
- * The "newsRemoteMessage" event can carry different message types:
116
- * - "C37" (NEWS_FILTER_MESSAGE): Normal news filter notification
117
- * - "C38" (NEWS_ERROR_MESSAGE): Error notification with event, code, message fields
118
- * - "C39" (NEWS_SUCCESS_MESSAGE): Success notification with code, message fields
149
+ * # News Data Message Fields (type "D18").
119
150
  *
120
- * Use the "@T" field to differentiate and handle each type accordingly.
151
+ * Available fields on the message object:
152
+ * headline, summary, source, sourceId, symbol,
153
+ * storyId, storyUrl, newsUrl, timestamp, epochtime,
154
+ * lang, excode, exgroup, topic, sector,
155
+ * thumbnailUrl, videoUrl, videoImageUrl,
156
+ * vendorDateId, filterId
121
157
  */
122
- .on("newsRemoteMessage", function(msg) {
123
- switch (msg["@T"]) {
124
- case "C37": // NEWS_FILTER_MESSAGE
125
- print("[NEWS FILTER] " + msg.message, "green");
126
- break;
127
- case "C38": // NEWS_ERROR_MESSAGE
128
- print("[NEWS ERROR] Event: " + msg.event + ", Code: " + msg.code + ", Message: " + msg.message, "red");
129
- break;
130
- case "C39": // NEWS_SUCCESS_MESSAGE
131
- print("[NEWS SUCCESS] Code: " + msg.code + ", Message: " + msg.message, "limegreen");
132
- break;
133
- default:
134
- print("newsRemoteMessage: " + msgFmt.fmt(msg), "green");
135
- break;
158
+ if (message["@T"] === "D18") {
159
+ // Display rich News data fields
160
+ print("--- News Article Received ---", "dodgerblue");
161
+ print(" Headline: " + message.headline, "dodgerblue");
162
+ print(" Source: " + message.source + " (" + message.sourceId + ")", "dodgerblue");
163
+ print(" Symbol: " + message.symbol, "dodgerblue");
164
+ print(" Topic: " + message.topic, "dodgerblue");
165
+ print(" Sector: " + message.sector, "dodgerblue");
166
+ print(" Time: " + new Date(message.timestamp).toLocaleString(), "dodgerblue");
167
+ print(" FilterId: " + message.filterId, "dodgerblue");
168
+ if (message.summary) {
169
+ print(" Summary: " + message.summary.substring(0, 200) + "...", "dodgerblue");
136
170
  }
137
- });
138
-
171
+ if (message.storyUrl) {
172
+ print(" Story URL: " + message.storyUrl, "dodgerblue");
173
+ }
174
+ if (message.thumbnailUrl) {
175
+ print(" Thumbnail: " + message.thumbnailUrl, "dodgerblue");
176
+ }
177
+ if (message.videoUrl) {
178
+ print(" Video: " + message.videoUrl, "dodgerblue");
179
+ }
180
+ } else {
181
+ print(msgFmt.fmt(message), "dodgerblue");
182
+ }
183
+ })
184
+ .on("error", function(err) {
185
+ print(err, "red");
186
+ }).on("close", function(msg) {
187
+ print("Closed: " + msg);
188
+ })
139
189
  /**
140
- * Supported filter parameters for Streaming News:
190
+ * # Differentiate News Message Types.
141
191
  *
142
- * Array filters (use association: "OR" or "AND"):
143
- * @param src Array of news source identifiers (e.g., "djns", "bwi", "mtn").
144
- * @param topic Array of topic names (e.g., "Market and Economy").
145
- * @param sector Array of sector codes (e.g., "101", "103").
146
- * @param symbol Array of stock symbols (e.g., "AAPL", "GOOG", "^DJT").
147
- * @param excode Array of exchange codes (e.g., "TSX", "NYE").
148
- * @param exgroup Array of exchange group identifiers (e.g., "NSD", "DOW").
149
- * @param keyword Array of keyword strings to match in news content (e.g., "analyst", "sell", "exchange offer").
192
+ * The "newsRemoteMessage" event can carry different message types:
193
+ * - "C37" (NEWS_FILTER_MESSAGE): Normal news filter notification
194
+ * - "C38" (NEWS_ERROR_MESSAGE): Error notification with event, code, message fields
195
+ * - "C39" (NEWS_SUCCESS_MESSAGE): Success notification with code, message fields
150
196
  *
151
- * Boolean/value parameters (use association: null):
152
- * @param summary Boolean. If true, include article summary in the response.
153
- * @param summlen Number. Maximum length of the summary text (e.g., 100).
154
- * @param constituent Boolean. If true, include constituent-related news.
155
- * @param searchByExchange Boolean. If true, search news by exchange.
197
+ * Use the "@T" field to differentiate and handle each type accordingly.
156
198
  */
199
+ .on("newsRemoteMessage", function(msg) {
200
+ switch (msg["@T"]) {
201
+ case "C37": // NEWS_FILTER_MESSAGE
202
+ print("[NEWS FILTER] " + msg.message, "green");
203
+ break;
204
+ case "C38": // NEWS_ERROR_MESSAGE
205
+ print("[NEWS ERROR] Event: " + msg.event + ", Code: " + msg.code + ", Message: " + msg.message, "red");
206
+ break;
207
+ case "C39": // NEWS_SUCCESS_MESSAGE
208
+ print("[NEWS SUCCESS] Code: " + msg.code + ", Message: " + msg.message, "limegreen");
209
+ break;
210
+ default:
211
+ print("newsRemoteMessage: " + msgFmt.fmt(msg), "green");
212
+ break;
213
+ }
214
+ });
157
215
 
158
- /**
159
- * The Below filter will return the News from
160
- * "source" bwi OR djns, and contains
161
- * "topic" Market and Economy, and contains
162
- * "sector" 101 OR 103, and contains
163
- * "symbol" AAPL OR GOOG OR ^DJT, and contains
164
- * "excode" TSX, and contains
165
- * "exgroup" NSD, and contains
166
- * "keyword" analyst OR sell OR exchange offer.
167
- * Additionally, includes summary (max 100 chars),
168
- * constituent news, and searches by exchange.
169
- */
170
- const newsFilterExampleJson1 = [
171
- { name: "src", value: ["bwi", "djns"], association: "OR" },
172
- { name: "topic", value: ["Market and Economy"], association: "OR" },
173
- { name: "sector", value: ["101", "103"], association: "OR" },
174
- { name: "symbol", value: ["AAPL", "GOOG", "^DJT"], association: "OR" },
175
- { name: "excode", value: ["TSX"], association: "OR" },
176
- { name: "exgroup", value: ["NSD"], association: "OR" },
177
- { name: "keyword", value: ["analyst", "sell", "exchange offer"], association: "OR" },
178
- { name: "summary", value: true, association: null },
179
- { name: "summlen", value: 100, association: null },
180
- { name: "constituent", value: true, association: null },
181
- { name: "searchByExchange", value: true, association: null }
182
- ];
216
+ /**
217
+ * Supported filter parameters for Streaming News:
218
+ *
219
+ * Array filters (use association: "OR" or "AND"):
220
+ * @param src Array of news source identifiers (e.g., "djns", "bwi", "mtn").
221
+ * @param topic Array of topic names (e.g., "Market and Economy").
222
+ * @param sector Array of sector codes (e.g., "101", "103").
223
+ * @param symbol Array of stock symbols (e.g., "AAPL", "GOOG", "^DJT").
224
+ * @param excode Array of exchange codes (e.g., "TSX", "NYE").
225
+ * @param exgroup Array of exchange group identifiers (e.g., "NSD", "DOW").
226
+ * @param keyword Array of keyword strings to match in news content (e.g., "analyst", "sell", "exchange offer").
227
+ *
228
+ * Boolean/value parameters (use association: null):
229
+ * @param summary Boolean. If true, include article summary in the response.
230
+ * @param summlen Number. Maximum length of the summary text (e.g., 100).
231
+ * @param constituent Boolean. If true, include constituent-related news.
232
+ * @param searchByExchange Boolean. If true, search news by exchange.
233
+ */
183
234
 
184
- /**
185
- * The Below filter will return the News from
186
- * "source" djns OR mtn OR bwi, and contains
187
- * "topic" Market and Economy OR Entertainment, and contains
188
- * "sector" 101, and contains
189
- * "symbol" GOOG OR AAPL OR COST, and contains
190
- * "excode" TSX OR NYE, and contains
191
- * "exgroup" DOW OR NSD, and contains
192
- * "keyword" earnings OR merger.
193
- * Additionally, includes summary (max 200 chars).
194
- */
195
- const newsFilterExampleJson2 = [
196
- { name: "src", value: ["djns", "mtn", "bwi"], association: "OR" },
197
- { name: "topic", value: ["Market and Economy", "Entertainment"], association: "OR" },
198
- { name: "sector", value: ["101"], association: "OR" },
199
- { name: "symbol", value: ["GOOG", "AAPL", "COST"], association: "OR" },
200
- { name: "excode", value: ["TSX", "NYE"], association: "OR" },
201
- { name: "exgroup", value: ["DOW", "NSD"], association: "OR" },
202
- { name: "keyword", value: ["earnings", "merger"], association: "OR" },
203
- { name: "summary", value: true, association: null },
204
- { name: "summlen", value: 200, association: null }
205
- ];
235
+ /**
236
+ * The Below filter will return the News from
237
+ * "source" bwi OR djns, and contains
238
+ * "topic" Market and Economy, and contains
239
+ * "sector" 101 OR 103, and contains
240
+ * "symbol" AAPL OR GOOG OR ^DJT, and contains
241
+ * "excode" TSX, and contains
242
+ * "exgroup" NSD, and contains
243
+ * "keyword" analyst OR sell OR exchange offer.
244
+ * Additionally, includes summary (max 100 chars),
245
+ * constituent news, and searches by exchange.
246
+ */
247
+ const newsFilterExampleJson1 = [
248
+ { name: "src", value: ["bwi", "djns"], association: "OR" },
249
+ { name: "topic", value: ["Market and Economy"], association: "OR" },
250
+ { name: "sector", value: ["101", "103"], association: "OR" },
251
+ { name: "symbol", value: ["AAPL", "GOOG", "^DJT"], association: "OR" },
252
+ { name: "excode", value: ["TSX"], association: "OR" },
253
+ { name: "exgroup", value: ["NSD"], association: "OR" },
254
+ { name: "keyword", value: ["analyst", "sell", "exchange offer"], association: "OR" },
255
+ { name: "summary", value: true, association: null },
256
+ { name: "summlen", value: 100, association: null },
257
+ { name: "constituent", value: true, association: null },
258
+ { name: "searchByExchange", value: true, association: null }
259
+ ];
206
260
 
207
- /**
208
- * A minimal filter targeting only source and symbols,
209
- * used to demonstrate multiple concurrent filter subscriptions.
210
- * Not all parameters are required you can use as few as needed.
211
- */
212
- const newsFilterExampleJson3 = [
213
- { name: "src", value: ["djns"], association: "OR" },
214
- { name: "symbol", value: ["MSFT", "AMZN", "TSLA"], association: "OR" }
215
- ];
261
+ /**
262
+ * The Below filter will return the News from
263
+ * "source" djns OR mtn OR bwi, and contains
264
+ * "topic" Market and Economy OR Entertainment, and contains
265
+ * "sector" 101, and contains
266
+ * "symbol" GOOG OR AAPL OR COST, and contains
267
+ * "excode" TSX OR NYE, and contains
268
+ * "exgroup" DOW OR NSD, and contains
269
+ * "keyword" earnings OR merger.
270
+ * Additionally, includes summary (max 200 chars).
271
+ */
272
+ const newsFilterExampleJson2 = [
273
+ { name: "src", value: ["djns", "mtn", "bwi"], association: "OR" },
274
+ { name: "topic", value: ["Market and Economy", "Entertainment"], association: "OR" },
275
+ { name: "sector", value: ["101"], association: "OR" },
276
+ { name: "symbol", value: ["GOOG", "AAPL", "COST"], association: "OR" },
277
+ { name: "excode", value: ["TSX", "NYE"], association: "OR" },
278
+ { name: "exgroup", value: ["DOW", "NSD"], association: "OR" },
279
+ { name: "keyword", value: ["earnings", "merger"], association: "OR" },
280
+ { name: "summary", value: true, association: null },
281
+ { name: "summlen", value: 200, association: null }
282
+ ];
216
283
 
217
- const filterId1 = crypto.randomUUID();
218
- const filterId2 = crypto.randomUUID();
219
- print("News FilterId 1: " + filterId1, "green");
220
- print("News FilterId 2: " + filterId2, "green");
284
+ /**
285
+ * A minimal filter targeting only source and symbols,
286
+ * used to demonstrate multiple concurrent filter subscriptions.
287
+ * Not all parameters are required — you can use as few as needed.
288
+ */
289
+ const newsFilterExampleJson3 = [
290
+ { name: "src", value: ["djns"], association: "OR" },
291
+ { name: "symbol", value: ["MSFT", "AMZN", "TSLA"], association: "OR" }
292
+ ];
221
293
 
222
- /**
223
- * # Step 4: Open a News connection.
224
- *
225
- * openNews() establishes a News connection and returns a newsClientId.
226
- * - newsClientId: Can be null for a new connection, or pass an existing
227
- * newsClientId to reconnect to a previous News session.
228
- * - The returned newsClientId should be saved for potential reconnection.
229
- */
230
- stream.openNews(null, (err, openResult) => {
231
- if (err) {
232
- print("Failed to open News connection: " + err, "red");
233
- return;
234
- }
294
+ const filterId1 = crypto.randomUUID();
295
+ const filterId2 = crypto.randomUUID();
296
+ print("News FilterId 1: " + filterId1, null, true);
297
+ print("News FilterId 2: " + filterId2, null, true);
235
298
 
236
- const newsClientId = openResult.newsClientId;
237
- print("News connection opened, newsClientId: " + newsClientId, "green");
299
+ /**
300
+ * # Step 4: Open a News connection.
301
+ *
302
+ * openNews() establishes a News connection and returns a newsClientId.
303
+ * - newsClientId: Can be null for a new connection, or pass an existing
304
+ * newsClientId to reconnect to a previous News session.
305
+ * - The returned newsClientId should be saved for potential reconnection.
306
+ */
307
+ const openResult = await openNewsAsync(stream, null);
308
+ const newsClientId = openResult.newsClientId;
309
+ print("News connection opened, newsClientId: " + newsClientId, "green", true);
238
310
 
239
- /**
240
- * # Step 5: Subscribe to the first News Filter.
241
- *
242
- * skipHeavyInitialLoad: false
243
- * - The server will send all buffered/initial news data upon subscription.
244
- * - This is useful when the client needs the full initial dataset.
245
- */
246
- stream.subscribeNews(newsFilterExampleJson1, filterId1, false, newsClientId, (err, result) => {
247
- if (err) {
248
- print("Failed to subscribe News filter 1: " + err, "red");
249
- return;
250
- }
311
+ /**
312
+ * # Step 5: Subscribe to the first News Filter.
313
+ *
314
+ * skipHeavyInitialLoad: false
315
+ * - The server will skip sending buffered/initial news data.
316
+ * - Only new incoming news after subscription will be delivered.
317
+ * - Note: Setting this to false will cause the server to send all
318
+ * buffered/initial news data upon subscription, which may significantly
319
+ * increase the subscription response time.
320
+ *
321
+ * skipHeavyInitialLoad: true
322
+ * - The server will skip sending buffered/initial news data.
323
+ * - Only new incoming news after subscription will be delivered.
324
+ * - This reduces initial bandwidth and is recommended when historical data is not needed.
325
+ */
326
+ const subResult1 = await subscribeNewsAsync(stream, newsFilterExampleJson1, filterId1, true, newsClientId);
327
+ print("News filter 1 subscribed (skipHeavyInitialLoad: true)", null, true);
328
+ print("SubscribeResponse 1: " + JSON.stringify(subResult1), "green");
251
329
 
252
- print("News filter 1 subscribed (skipHeavyInitialLoad: false)");
253
- print("SubscribeResponse 1: " + JSON.stringify(result), "green");
254
- });
330
+ /**
331
+ * # Step 6: Subscribe a second filter with a different filterId.
332
+ *
333
+ * Multiple filters can be active simultaneously, each identified by a unique filterId.
334
+ * Each filter operates independently and can be updated or removed separately.
335
+ */
336
+ const subResult2 = await subscribeNewsAsync(stream, newsFilterExampleJson3, filterId2, true, newsClientId);
337
+ print("News filter 2 subscribed (skipHeavyInitialLoad: true)", null, true);
338
+ print("SubscribeResponse 2: " + JSON.stringify(subResult2), "green");
255
339
 
256
- /**
257
- * # Step 6: Subscribe a second filter concurrently with a different filterId.
258
- *
259
- * skipHeavyInitialLoad: true
260
- * - The server will skip sending buffered/initial news data.
261
- * - Only new incoming news after subscription will be delivered.
262
- * - This reduces initial bandwidth and is recommended when historical data is not needed.
263
- *
264
- * Multiple filters can be active simultaneously, each identified by a unique filterId.
265
- * Each filter operates independently and can be updated or removed separately.
266
- */
267
- stream.subscribeNews(newsFilterExampleJson3, filterId2, true, newsClientId, (err, result) => {
268
- if (err) {
269
- print("Failed to subscribe News filter 2: " + err, "red");
270
- return;
271
- }
340
+ // Step 7: Query current News Filter status (should show both filters)
341
+ print("Get Current Subscription Filter Status", null, true);
342
+ await fltGetNewsAsync(stream);
272
343
 
273
- print("News filter 2 subscribed (skipHeavyInitialLoad: true)");
274
- print("SubscribeResponse 2: " + JSON.stringify(result), "green");
275
- });
276
-
277
- // Step 7: Query current News Filter status (should show both filters)
278
- setTimeout(() => {
279
- print("Get Current Subscription Filter Status");
280
- stream.fltGetNews((err) => {
281
- if (err) {
282
- print("err: " + err, "red");
283
- }
284
- });
285
- }, 3000);
286
-
287
- // Step 8: Update filter 1 with new criteria
288
- setTimeout(() => {
289
- print("Update News Filter 1");
290
- stream.fltUpdateNews(newsFilterExampleJson2, filterId1, (err, result) => {
291
- if (err) {
292
- print("Failed to update News filter: " + err, "red");
293
- } else {
294
- print("News filter 1 updated");
295
- print("Filter Update Response: " + JSON.stringify(result), "green");
296
- }
297
- });
298
- }, 5000);
299
-
300
- // Query filter status after update
301
- setTimeout(() => {
302
- print("Get Current Subscription Filter Status");
303
- stream.fltGetNews((err) => {
304
- if (err) {
305
- print("err: " + err, "red");
306
- }
307
- });
308
- }, 7000);
309
-
310
- // Step 9: Unsubscribe from both filters
311
- setTimeout(() => {
312
- print("Unsubscribe News Filter 1");
313
- stream.unsubscribeNews(filterId1, (err, result) => {
314
- if (err) {
315
- print("Failed to unsubscribe News filter 1: " + err, "red");
316
- } else {
317
- print("News filter 1 unsubscribed");
318
- print("UnsubscribeResponse: " + JSON.stringify(result), "green");
319
- }
320
- });
321
- }, 9000);
322
-
323
- // Query filter status after unsubscribe (filter 2 should still be active)
324
- setTimeout(() => {
325
- print("Get Current Subscription Filter Status");
326
- stream.fltGetNews((err) => {
327
- if (err) {
328
- print("err: " + err, "red");
329
- }
330
- });
331
- }, 11000);
332
-
333
- // Step 10: Demonstrate News reconnection with existing newsClientId
334
- setTimeout(() => {
335
- print("--- Reconnecting News with existing newsClientId ---", "orange");
336
- stream.openNews(newsClientId, (err, reconnectResult) => {
337
- if (err) {
338
- print("Failed to reconnect News: " + err, "red");
339
- return;
340
- }
341
- print("News reconnected, newsClientId: " + reconnectResult.newsClientId, "green");
342
-
343
- // Query filter status after reconnect (filter 2 should still be active)
344
- print("Get Current Subscription Filter Status");
345
- stream.fltGetNews((err) => {
346
- if (err) {
347
- print("err: " + err, "red");
348
- }
349
- });
350
-
351
- // Subscribe a new filter after reconnect
352
- const reconnectFilterId = crypto.randomUUID();
353
- print("Reconnect FilterId: " + reconnectFilterId, "green");
354
-
355
- stream.subscribeNews(newsFilterExampleJson1, reconnectFilterId, true, reconnectResult.newsClientId, (err, result) => {
356
- if (err) {
357
- print("Failed to subscribe after reconnect: " + err, "red");
358
- return;
359
- }
360
- print("News filter subscribed after reconnect");
361
- print("ReconnectSubscribeResponse: " + JSON.stringify(result), "green");
362
-
363
- // Query filter status again (should show filter 2 + new filter)
364
- print("Get Current Subscription Filter Status");
365
- stream.fltGetNews((err) => {
366
- if (err) {
367
- print("err: " + err, "red");
368
- }
369
- });
370
- });
371
- });
372
- }, 13000);
373
-
374
- // Step 11: Close stream
375
- setTimeout(() => {
376
- stream.close(handleResult(function() {
377
- print("Connection closed");
378
- }));
379
- }, 17000);
380
- });
344
+ // Step 8: Update filter 1 with new criteria
345
+ print("Update News Filter 1", null, true);
346
+ try {
347
+ const updateResult = await fltUpdateNewsAsync(stream, newsFilterExampleJson2, filterId1);
348
+ print("News filter 1 updated", null, true);
349
+ print("Filter Update Response: " + JSON.stringify(updateResult), "green");
350
+ } catch (e) {
351
+ print("Failed to update News filter: " + e, "red", true);
352
+ }
353
+
354
+ // Query filter status after update
355
+ print("Get Current Subscription Filter Status", null, true);
356
+ await fltGetNewsAsync(stream);
357
+
358
+ // Step 9: Unsubscribe from filter 1
359
+ print("Unsubscribe News Filter 1", null, true);
360
+ await unsubscribeNewsAsync(stream, filterId1);
361
+ print("News filter 1 unsubscribed", null, true);
362
+
363
+ // Query filter status after unsubscribe (filter 2 should still be active)
364
+ print("Get Current Subscription Filter Status", null, true);
365
+ await fltGetNewsAsync(stream);
366
+
367
+ // Step 10: Demonstrate News reconnection with existing newsClientId
368
+ print("--- Reconnecting News with existing newsClientId ---", "orange", true);
369
+ const reconnectResult = await openNewsAsync(stream, newsClientId);
370
+ print("News reconnected, newsClientId: " + reconnectResult.newsClientId, null, true);
371
+
372
+ // Query filter status after reconnect (filter 2 should still be active)
373
+ print("Get Current Subscription Filter Status", null, true);
374
+ await fltGetNewsAsync(stream);
381
375
 
382
- }));
376
+ // Subscribe a new filter after reconnect
377
+ const reconnectFilterId = crypto.randomUUID();
378
+ print("Reconnect FilterId: " + reconnectFilterId, "green");
383
379
 
384
- }));
380
+ const reconnectSubResult = await subscribeNewsAsync(stream, newsFilterExampleJson1, reconnectFilterId, true, reconnectResult.newsClientId);
381
+ print("News filter subscribed after reconnect", null, true);
382
+ print("ReconnectSubscribeResponse: " + JSON.stringify(reconnectSubResult), "green");
385
383
 
386
- function print(msg, color) {
384
+ // Query filter status again (should show filter 2 + new filter)
385
+ print("Get Current Subscription Filter Status", null, true);
386
+ await fltGetNewsAsync(stream);
387
+
388
+ // Step 11: Close stream
389
+ await closeAsync(stream);
390
+ print("Connection closed", null, true);
391
+ }
392
+
393
+ function print(msg, color, bold) {
387
394
  var el = document.createElement("div");
388
395
  el.innerText = msg;
389
396
  if (color) {
390
397
  el.style.color = color;
391
398
  }
392
- document.body.appendChild(el);
393
- }
394
-
395
- function handleResult(onSuccess) {
396
- return function(err, result) {
397
- if (err) {
398
- print(err, "red");
399
- } else {
400
- onSuccess(result);
401
- }
399
+ if (bold) {
400
+ el.style.fontWeight = "bold";
401
+ el.style.fontSize = "1.15em";
402
402
  }
403
+ document.body.appendChild(el);
403
404
  }
404
405
  };
405
406
  </script>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
@@ -1,7 +1,7 @@
1
1
  <html>
2
2
 
3
3
  <head>
4
- <script src="qmci-streamer-2.66.0.min.js"></script>
4
+ <script src="qmci-streamer-2.67.0.min.js"></script>
5
5
  </head>
6
6
 
7
7
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quotemedia.com/streamer",
3
- "version": "2.66.0",
3
+ "version": "2.67.0",
4
4
  "description": "A JavaScript client for QuoteMedia's streaming data service.",
5
5
  "main": "lib/index.js",
6
6
  "author": "QuoteMedia",
@@ -16191,7 +16191,7 @@ exports.__esModule = true;
16191
16191
  */
16192
16192
 
16193
16193
  var LIBRARY_NAME = exports.LIBRARY_NAME = "JavaScript";
16194
- var VERSION = exports.VERSION = "2.66.0";
16194
+ var VERSION = exports.VERSION = "2.67.0";
16195
16195
 
16196
16196
  /**
16197
16197
  * Streamer API namespace.
@@ -44,7 +44,7 @@ D(460,"Websocket error")};o.onclose=function(e){if(y("websocket.onclose"),clearT
44
44
  Copyright (C) 2010-2013 [Jeff Mesnil](http://jmesnil.net/)
45
45
  Copyright (C) 2012 [FuseSource, Inc.](http://fusesource.com)
46
46
  */
47
- (function(){var T,r,E,l,o={}.hasOwnProperty,s=[].slice;T={LF:"\n",NULL:"\0"},E=function(){var s;function g(e,t,n){this.command=e,this.headers=null!=t?t:{},this.body=null!=n?n:""}return g.prototype.toString=function(){var e,t,n,r,i;for(t in(n=!(e=[this.command])===this.headers["content-length"])&&delete this.headers["content-length"],i=this.headers)o.call(i,t)&&(r=i[t],e.push(t+":"+r));return this.body&&!n&&e.push("content-length:"+g.sizeOfUTF8(this.body)),e.push(T.LF+this.body),e.join(T.LF)},g.sizeOfUTF8=function(e){return e?encodeURI(e).match(/%..|./g).length:0},s=function(e){var t,n,r,i,o,s,a,u,l,c,f,d,p,h,m,E,_;for(i=e.search(RegExp(""+T.LF+T.LF)),r=(o=e.substring(0,i).split(T.LF)).shift(),s={},d=function(e){return e.replace(/^\s+|\s+$/g,"")},p=0,m=(E=o.reverse()).length;p<m;p++)u=(c=E[p]).indexOf(":"),s[d(c.substring(0,u))]=d(c.substring(u+1));if(t="",f=i+2,s["content-length"])l=parseInt(s["content-length"]),t=(""+e).substring(f,f+l);else for(n=null,a=h=f,_=e.length;(f<=_?h<_:_<h)&&(n=e.charAt(a))!==T.NULL;a=f<=_?++h:--h)t+=n;return new g(r,s,t)},g.unmarshall=function(i){var o;return function(){var e,t,n,r;for(r=[],e=0,t=(n=i.split(RegExp(""+T.NULL+T.LF+"*"))).length;e<t;e++)0<(null!=(o=n[e])?o.length:void 0)&&r.push(s(o));return r}()},g.marshall=function(e,t,n){return new g(e,t,n).toString()+T.NULL},g}(),r=function(){var m;function e(e){this.ws=e,this.ws.binaryType="arraybuffer",this.counter=0,this.connected=!1,this.heartbeat={outgoing:1e4,incoming:1e4},this.maxWebSocketFrameSize=16384,this.subscriptions={}}return e.prototype.debug=function(e){var t;return"undefined"!=typeof window&&null!==window&&null!=(t=window.console)?t.log(e):void 0},m=function(){return Date.now?Date.now():(new Date).valueOf},e.prototype._transmit=function(e,t,n){var r;for(r=E.marshall(e,t,n),"function"==typeof this.debug&&this.debug(">>> "+r);;){if(!(r.length>this.maxWebSocketFrameSize))return this.ws.send(r);this.ws.send(r.substring(0,this.maxWebSocketFrameSize)),r=r.substring(this.maxWebSocketFrameSize),"function"==typeof this.debug&&this.debug("remaining = "+r.length)}},e.prototype._setupHeartbeat=function(i){var e,t,n,o,r,s,a,u;if((r=i.version)===l.VERSIONS.V1_1||r===l.VERSIONS.V1_2)return t=(s=function(){var e,t,n,r;for(r=[],e=0,t=(n=i["heart-beat"].split(",")).length;e<t;e++)o=n[e],r.push(parseInt(o));return r}())[0],e=s[1],0!==this.heartbeat.outgoing&&0!==e&&(n=Math.max(this.heartbeat.outgoing,e),"function"==typeof this.debug&&this.debug("send PING every "+n+"ms"),this.pinger=l.setInterval(n,(a=this,function(){return a.ws.send(T.LF),"function"==typeof a.debug?a.debug(">>> PING"):void 0}))),0!==this.heartbeat.incoming&&0!==t?(n=Math.max(this.heartbeat.incoming,t),"function"==typeof this.debug&&this.debug("check PONG every "+n+"ms"),this.ponger=l.setInterval(n,(u=this,function(){var e;if(e=m()-u.serverActivity,2*n<e)return"function"==typeof u.debug&&u.debug("did not receive server activity for the last "+e+"ms"),u.ws.close()}))):void 0},e.prototype._parseConnect=function(){var e,t,n,r;switch(r={},(e=1<=arguments.length?s.call(arguments,0):[]).length){case 2:r=e[0],t=e[1];break;case 3:e[1]instanceof Function?(r=e[0],t=e[1],n=e[2]):(r.login=e[0],r.passcode=e[1],t=e[2]);break;case 4:r.login=e[0],r.passcode=e[1],t=e[2],n=e[3];break;default:r.login=e[0],r.passcode=e[1],t=e[2],n=e[3],r.host=e[4]}return[r,t,n]},e.prototype.connect=function(){var e,p,t,n,h,r,i;return e=1<=arguments.length?s.call(arguments,0):[],n=this._parseConnect.apply(this,e),t=n[0],this.connectCallback=n[1],p=n[2],"function"==typeof this.debug&&this.debug("Opening Web Socket..."),this.ws.onmessage=(h=this,function(e){var r,i,t,n,o,s,a,u,l,c,f,d;if(n="undefined"!=typeof ArrayBuffer&&e.data instanceof ArrayBuffer?(r=new Uint8Array(e.data),"function"==typeof h.debug&&h.debug("--- got data length: "+r.length),function(){var e,t,n;for(n=[],e=0,t=r.length;e<t;e++)i=r[e],n.push(String.fromCharCode(i));return n}().join("")):e.data,h.serverActivity=m(),n!==T.LF){for("function"==typeof h.debug&&h.debug("<<< "+n),d=[],l=0,c=(f=E.unmarshall(n)).length;l<c;l++)switch((o=f[l]).command){case"CONNECTED":"function"==typeof h.debug&&h.debug("connected to server "+o.headers.server),h.connected=!0,h._setupHeartbeat(o.headers),d.push("function"==typeof h.connectCallback?h.connectCallback(o):void 0);break;case"MESSAGE":u=o.headers.subscription,(a=h.subscriptions[u]||h.onreceive)?(t=h,s=o.headers["message-id"],o.ack=function(e){return null==e&&(e={}),t.ack(s,u,e)},o.nack=function(e){return null==e&&(e={}),t.nack(s,u,e)},d.push(a(o))):d.push("function"==typeof h.debug?h.debug("Unhandled received MESSAGE: "+o):void 0);break;case"RECEIPT":d.push("function"==typeof h.onreceipt?h.onreceipt(o):void 0);break;case"ERROR":d.push("function"==typeof p?p(o):void 0);break;default:d.push("function"==typeof h.debug?h.debug("Unhandled frame: "+o):void 0)}return d}"function"==typeof h.debug&&h.debug("<<< PONG")}),this.ws.onclose=(r=this,function(){var e;return e="Whoops! Lost connection to "+r.ws.url,"function"==typeof r.debug&&r.debug(e),r._cleanUp(),"function"==typeof p?p(e):void 0}),this.ws.onopen=(i=this,function(){return"function"==typeof i.debug&&i.debug("Web Socket Opened..."),t["accept-version"]=l.VERSIONS.supportedVersions(),t["heart-beat"]=[i.heartbeat.outgoing,i.heartbeat.incoming].join(","),i._transmit("CONNECT",t)})},e.prototype.disconnect=function(e,t){return null==t&&(t={}),this._transmit("DISCONNECT",t),this.ws.onclose=null,this.ws.close(),this._cleanUp(),"function"==typeof e?e():void 0},e.prototype._cleanUp=function(){if(this.connected=!1,this.pinger&&l.clearInterval(this.pinger),this.ponger)return l.clearInterval(this.ponger)},e.prototype.sendCustomFrame=function(e,t,n,r){return null==n&&(n={}),null==r&&(r=""),n.destination=e,this._transmit(t,n,r)},e.prototype.send=function(e,t,n){return null==t&&(t={}),null==n&&(n=""),t.destination=e,this._transmit("SEND",t,n)},e.prototype.subscribe=function(e,t,n){var r;return null==n&&(n={}),n.id||(n.id="sub-"+this.counter++),n.destination=e,this.subscriptions[n.id]=t,this._transmit("SUBSCRIBE",n),r=this,{id:n.id,unsubscribe:function(){return r.unsubscribe(n.id)}}},e.prototype.unsubscribe=function(e){return delete this.subscriptions[e],this._transmit("UNSUBSCRIBE",{id:e})},e.prototype.begin=function(e){var t,n;return n=e||"tx-"+this.counter++,this._transmit("BEGIN",{transaction:n}),t=this,{id:n,commit:function(){return t.commit(n)},abort:function(){return t.abort(n)}}},e.prototype.commit=function(e){return this._transmit("COMMIT",{transaction:e})},e.prototype.abort=function(e){return this._transmit("ABORT",{transaction:e})},e.prototype.ack=function(e,t,n){return null==n&&(n={}),n["message-id"]=e,n.subscription=t,this._transmit("ACK",n)},e.prototype.nack=function(e,t,n){return null==n&&(n={}),n["message-id"]=e,n.subscription=t,this._transmit("NACK",n)},e}(),l={VERSIONS:{V1_0:"1.0",V1_1:"1.1",V1_2:"1.2",supportedVersions:function(){return"1.1,1.0"}},client:function(e,t){var n;return null==t&&(t=["v10.stomp","v11.stomp"]),n=new(l.WebSocketClass||WebSocket)(e,t),new r(n)},over:function(e){return new r(e)},Frame:E},null!=f&&(f.Stomp=l),"undefined"!=typeof window&&null!==window?(l.setInterval=function(e,t){return window.setInterval(t,e)},l.clearInterval=function(e){return window.clearInterval(e)},window.Stomp=l):f||(self.Stomp=l)}).call(undefined)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/stomp.js/lib/stomp.js","/lib/stomp.js/lib")},{_process:131,buffer:121,timers:152}],105:[function(_,e,g){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";g.__esModule=!0;var f=_("../logging.js"),d=m(_("../EventSupport.js")),p=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}}(_("../streamer-events.js")),h=m(_("../http.js"));function m(e){return e&&e.__esModule?e:{"default":e}}var E=function(){function o(e,t,n){var r=3<arguments.length&&arguments[3]!==undefined?arguments[3]:3,i=arguments[4];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.openSocket=t,this.createTransmitter=e,this.log=(0,f.asLogger)(n),this.events=new d["default"](this),this.currentConn="",this.maxReconnectAttempts=r,this.maxReconnectsTotal=3,this.isFirstConnection=!0,this.pingUrl=i}return o.prototype.open=function(){var i=this,e={send:function(e){return i.socket.send(e)},sendCustomFrame:function(e,t,n,r){return i.socket.sendCustomFrame(e,t,n,r)}};this.isFirstConnection&&(this.on("reopen",function(e){var t=i.currentConn;i.currentConn=e.connectionId,i.events.fire("reconnect",p.event("Reconnection success",{previousConnectionId:t,currentConnectionId:i.currentConn}))}),this.transmitter=this.createTransmitter(e),this.transmitter.on("message",function(e){i.events.fire("message",e)})),this.socket=this.openSocket(function(e){return i.request=e,i.reconnect=!1,{onOpen:function(e){if("CONNECTED"===e.command){i.isConnectionUp=!0;var t=p.event("open",{connectionId:e.headers["user-name"]});i.log.info(t),i.events.fire("open",t),i.isFirstConnection||(i.maxReconnectsTotal--,i.events.fire("reopen",t)),i.currentConn=e.headers["user-name"]}},onError:function(e){i.isConnectionUp=!1,i.isServerUp(function(e,t){null!==e?(i.reconnect=!1,i.log.warn("Connection lost, Streamer Server isn't Up")):(i.reconnect=!0,i.log.warn("Connection lost, Streamer Server is Up"))})},onClose:function(){i.isConnectionUp=!1},onMessage:function(e){var t=JSON.parse(e.body);t.code!==undefined&&(401!=t.code&&403!=t.code||(i.log.info("Unable to reconnect with code: "+t.code+", reason: "+t.reason),i.reconnect=!1,i.isConnectionUp=!1)),i.transmitter.onMessage(e.body)}}},this.currentConn)},o.prototype.close=function(){if(this.socket)try{this.socket.close(),this.socket=null,this.reconnect&&this.tryReopen()}catch(e){this.events.fire("error",p.error("Error closing",{reason:e.message,cause:e,code:-3}))}},o.prototype.tryReopen=function(){var t=this;if(this.isConnectionUp||this.maxReconnectsTotal<=0)this.log.error("Connection is already open or max reconnects was reached, won't try to reconnect");else{this.isFirstConnection=!1;var n=this.maxReconnectAttempts;setTimeout(function e(){if(n<=0)return t.reconnect=!1,t.log.error("Error while reconnecting. No attempts left."),void(t.maxReconnectAttempts=0);!t.isConnectionUp&&t.reconnect&&(t.log.info("Attempting reconnect. Attempts left: "+n),t.reopen(n),n--,setTimeout(e,500))},500)}},o.prototype.reopen=function(e){try{this.open()}catch(t){this.log.warn("There was an error while reopening attempt #"+e),this.events.fire("error",t)}},o.prototype.send=function(e){try{this.transmitter.send(e)}catch(t){this.events.fire("error",p.error("Error sending message",{reason:t.message,cause:t,code:-4}))}},o.prototype.sendCustomFrame=function(e,t,n,r){try{this.transmitter.sendCustomFrame(e,t,n,r)}catch(i){this.events.fire("error",p.error("Error sending custom frame message",{reason:i.message,cause:i,code:-4}))}},o.prototype.isReconnect=function(){return this.request["x-Stream-isReconnect"]},o.prototype.setReconnect=function(e){this.reconnect=e},o.prototype.setServer=function(e){this.request["X-Stream-Instance"]=e},o.prototype.isClosed=function(){return null==this.socket},o.prototype.isServerUp=function(t){(0,h["default"])({url:this.pingUrl,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.setConnectionUp=function(e){this.isConnectionUp=e},o.prototype.on=function(e,t){return this.events.on(e,t)},o}();g["default"]=E}).call(this,_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],_("timers").setImmediate,_("timers").clearImmediate,"/lib/stomp/StompConnection.js","/lib/stomp")},{"../EventSupport.js":2,"../http.js":14,"../logging.js":16,"../streamer-events.js":109,_process:131,buffer:121,timers:152}],106:[function(T,e,b){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";b.__esModule=!0,T("../polyfills.js");var f=T("../streamer-api.js"),d=T("../streamer-utils.js"),p=T("../logging.js"),O=T("../utils.js"),h=_(T("../UShortId.js")),m=_(T("../EventSupport.js")),E=T("../formatting.js"),w=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}}(T("../streamer-events.js"));function _(e){return e&&e.__esModule?e:{"default":e}}var g=function(){function i(e,t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.events=new m["default"],this.streamingService=e,this.format=t,this.log=(0,p.asLogger)(n),this.conn=e.createStompConnection(),this.conn.on("message",function(e){r._handlejsonmsg(e)}).on("close",function(e){r.doClose(e)}).on("error",function(e){r.pendingConnection&&r.pendingConnection(e),r.events.fire("error",e)}).on("reconnect",function(e){r.reconnectSuccess(e)}),this.requestid=new h["default"],this.pendingsubscriptions={},this.pendingUnsubscriptions={},this.pendingExchangeSubscriptions={},this.pendingExchangeUnsubscriptions={},this.pendingNewsSubscriptions={},this.pendingNewsUnsubscriptions={},this.pendingAlertSubscription={},this.pendingTradeSubscription={},this.pendingTradeUnsubscription={},this.pendingSCFMessages={},this.pendingCorpEventSubscription={},this.on("error",function(e){r.log.warn(e)})}return i.prototype.openStomp=function(e){try{this.pendingConnection=e,this.conn.open()}catch(t){e&&e(t)}},i.prototype.reconnectSuccess=function(e){this.events.fire("reconnectSuccess",e),this.log.info("Successful reconnection. Previous Id: "+e.previousConnectionId+" Current Id = "+e.currentConnectionId)},i.prototype.on=function(e,t){return this.events.on(e,t)},i.prototype.SCFSendMessage=function(e,t,n,r,i){var o=i||(optsOrCallback&&"function"==typeof optsOrCallback?optsOrCallback:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={ids:[],callback:o},u=this.requestid.next(),l=void 0;if(r&&""!==r){try{l=JSON.parse(r)}catch(c){return this.log.info("Error parsing message content: "+c.message),void o(null,null)}a.dataTypes=l["@T"],a.action=l.action,l.id=u}a.ids.push(u),this.pendingSCFMessages[u]=a,this.sendCustomFrame(e,t,n,l)},i.prototype.subscribe=function(e,t,n,r){var i=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()}),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=n&&"function"!=typeof n?n:null,s=r||(n&&"function"==typeof n?n:null);if(this.isClosed()){var a=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",a),void(s&&s(a))}var u={ids:[],types:t,mimetype:this.format,callback:s,result:{subscribed:[],rejected:[],unentitled:[],invalidSymbols:[],messageFilters:[]}};0!==e.length&&0!==t.length?this._prepareSubscriptionRequests(e,u,f.messages.control.Action.SUBSCRIBE,o).forEach(function(e){var t=i.requestid.next();u.ids.push(t),i.pendingsubscriptions[t]=u,e.id=t,i.send(e)}):s(null,u.result)},i.prototype.subscribeExchange=function(e,t,n){var r=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()});var i=t&&"function"!=typeof t?t:null,o=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={callback:o,mimetype:this.format,id:[],result:{subscribed:[],rejected:[]}};0===e.length&&o(null,a.result),this.prepareExchangeSubscriptionRequest(e,a,f.messages.control.Action.SUBSCRIBE,i).forEach(function(e){var t=r.requestid.next();a.id.push(t),a.exchange=e.exchange,a.conflation=e.conflation,r.pendingExchangeSubscriptions[t]=a,e.id=t,r.send(e)})},i.prototype.openNews=function(e,t){if("function"==typeof e&&(t=e,e=null),this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r=new f.messages.control.NewsSubscribeMessage;r.newsAction=f.messages.control.NewsAction.NEWS_OPEN,r.newsClientId=e||null,r.mimetype=this.format;var i=this.requestid.next();this.pendingNewsSubscriptions[i]={callback:t,result:{newsClientId:null}},r.id=i,this.send(r)},i.prototype.subscribeNews=function(e,t,n,r,i){if(this.isClosed()){var o=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",o),void(i&&i(o))}""!==t&&t!=undefined&&null!==t||(t=crypto.randomUUID(),console.log("News FilterId Created: ",t));var s={callback:i,mimetype:this.format,id:[],result:{newsFilters:[],rejectedNewsFilters:[],unentitledNewsFilters:[],filterId:t,newsClientId:null}};if(0!==e.length){var a=this.buildNewsSubscribeRequest(e,t,s,n,r,f.messages.control.NewsAction.NEWS_FLT_ADD),u=this.requestid.next();this.pendingNewsSubscriptions[u]=s,a.id=u,this.send(a)}else i(null,s.result)},i.prototype.fltUpdateNews=function(e,t,n){if(this.isClosed()){var r=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",r),void(n&&n(r))}var i={callback:n,mimetype:this.format,id:[],result:{newsFilters:[],rejectedNewsFilters:[],unentitledNewsFilters:[],filterId:t}},o=this.buildNewsSubscribeRequest(e,t,i,null,null,f.messages.control.NewsAction.NEWS_FLT_UPDATE),s=this.requestid.next();this.pendingNewsSubscriptions[s]=i,o.id=s,this.send(o)},i.prototype.fltDeleteNews=function(e,t){if(this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r={callback:t,mimetype:this.format},i=this.buildNewsSubscribeRequest(null,e,r,null,null,f.messages.control.NewsAction.NEWS_FLT_DELETE);this.send(i)},i.prototype.fltGetNews=function(e){if(this.isClosed()){var t=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",t),void(e&&e(t))}var n={callback:e,mimetype:this.format},r=this.buildNewsCommandRequest(n,f.messages.control.NewsAction.NEWS_FLT_GET);this.send(r)},i.prototype.fltMockBasicNews=function(e){if(this.isClosed()){var t=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",t),void(e&&e(t))}var n={callback:e,mimetype:this.format},r=this.buildNewsCommandRequest(n,f.messages.control.NewsAction.NEWS_FLT_MOCK_BASIC);this.send(r)},i.prototype.subscribeCorpEvents=function(e,t,n,r,i){e&&(e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()})),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=i||(r&&"function"==typeof r?r:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",s)}else{var a={id:[],symbols:e,corpEventTypes:t,allCorpEvents:n,mimeType:this.format,callback:o,result:{subscribed:[],unsubscribed:[],invalid:[]}};0===t.length&&o(null,a.result);var u=this.buildCorpEventRequest(e,a,f.messages.control.Action.SUBSCRIBE),l=this.requestid.next();a.id.push(l),this.pendingCorpEventSubscription[l]=a,u.id=l,this.send(u)}},i.prototype.subUnsubAlerts=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{operation:""}},s=this.buildAlertsSubUnsubRequest(e,o),a=this.requestid.next();o.id.push(a),this.pendingAlertSubscription[a]=o,s.id=a,this.send(s)}},i.prototype.subscribeTrade=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{notificationType:""}},s=this.buildTradeSubscribeRequest(e,o,f.messages.control.Action.SUBSCRIBE),a=this.requestid.next();o.id.push(a),this.pendingTradeSubscription[a]=o,s.id=a,this.send(s)}},i.prototype.getSessionStats=function(){if(this.isClosed()){var e=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",e)}else{var t=new f.messages.control.StatsMessage;this.send(t)}},i.prototype.updateOAuthToken=function(e,t,n){var r=n||(optsOrCallback&&"function"==typeof optsOrCallback?optsOrCallback:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={mimetype:this.format,callback:r},s=this.buildUpdateAuthTokenRequest("oauth",e,t,o),a=this.requestid.next();s.id=a,this.send(s)}},i.prototype.unsubscribe=function(e,t,n,r){var i=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()}),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=n&&"function"!=typeof n?n:null,s=r||(n&&"function"==typeof n?n:null);if(this.isClosed()){var a=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",a),void(s&&s(a))}var u={ids:[],types:t,mimetype:this.format,callback:s,result:{unsubscribed:[]}};0!==e.length&&0!==t.length||s&&s(null,u.result),this._prepareSubscriptionRequests(e,u,f.messages.control.Action.UNSUBSCRIBE,o).forEach(function(e){var t=i.requestid.next();u.ids.push(t),i.pendingUnsubscriptions[t]=u,e.id=t,i.send(e)})},i.prototype.unsubscribeExchange=function(e,t,n){var r=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()});var i=t&&"function"!=typeof t?t:null,o=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={callback:o,mimetype:this.format,id:[],result:{subscribed:[],rejected:[]}};0===e.length&&o(null,a.result),this.prepareExchangeSubscriptionRequest(e,a,f.messages.control.Action.UNSUBSCRIBE,i).forEach(function(e){var t=r.requestid.next();a.id.push(t),a.exchange=e.exchange,a.conflation=e.conflation,r.pendingExchangeUnsubscriptions[t]=a,e.id=t,r.send(e)})},i.prototype.unsubscribeNews=function(e,t){if(this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r={callback:t,mimetype:this.format,id:[],result:{unsubscribed:[]}},i=this.buildNewsSubscribeRequest(null,e,r,null,null,f.messages.control.NewsAction.NEWS_FLT_DELETE),o=this.requestid.next();r.id.push(o),this.pendingNewsUnsubscriptions[o]=r,i.id=o,this.send(i)},i.prototype.unsubscribeCorpEvents=function(e,t,n,r,i){e&&(e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()})),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=i||(r&&"function"==typeof r?r:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",s)}else{var a={id:[],symbols:e,corpEventTypes:t,allCorpEvents:n,mimeType:this.format,callback:o,result:{subscribed:[],unsubscribed:[],invalid:[]}};0===t.length&&o(null,a.result);var u=this.buildCorpEventRequest(e,a,f.messages.control.Action.UNSUBSCRIBE),l=this.requestid.next();a.id.push(l),this.pendingCorpEventSubscription[l]=a,u.id=l,this.send(u)}},i.prototype.unsubscribeTrade=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{notificationType:""}},s=this.buildTradeSubscribeRequest(e,o,f.messages.control.Action.UNSUBSCRIBE),a=this.requestid.next();o.id.push(a),this.pendingTradeUnsubscription[a]=o,s.id=a,this.send(s)}},i.prototype._handlejsonmsg=function(e){(0,d.iscontrolmessage)(e)&&e.__id in this.pendingSCFMessages?this.SCFHandlectrlmsg(e):(0,d.iscontrolmessage)(e)?this.handlectrlmsg(e):(0,d.isdatamessage)(e)?this._handledatamsg(e):this.events.fire("error",e)},i.prototype._prepareSubscriptionRequests=function(e,t,n,r){for(var i=0,o=-1,s=e.length,a=t.types.includes("ORDERBOOK"),u=[],l=0;l<s;l++)((i=this._getUpdatedNumberOfEntitlements(t.types.length,i,e[l],a))>=this.maxEntitlementsPerSubscription||l===s-1)&&(u.push(this._buildRequest(e.slice(o+1,l+1),t,n,r)),o=l,i=0);return u},i.prototype._buildRequest=function(e,t,n,r){var i=new f.messages.control.SubscribeMessage;return i.action=n,i.symbols=e,i.types=t.types,i.mimetype=t.mimetype,r&&r.skipHeavyInitialLoad&&(i.skipHeavyInitialLoad=!0),r&&(i.conflation=r.conflation,i.intervalPeriod=r.intervalPeriod),i},i.prototype.prepareExchangeSubscriptionRequest=function(e,t,n,r){for(var i=[],o=e.length,s=0;s<o;s++)i.push(this.buildExchangeRequest(e[s],t,n,r));return i},i.prototype.buildExchangeRequest=function(e,t,n,r){var i=new f.messages.control.ExchangeSubscribeMessage;return i.action=n,i.exchange=e,i.mimetype=t.mimetype,r&&(i.conflation=r.conflation),i},i.prototype.buildNewsSubscribeRequest=function(e,t,n,r,i,o){var s=new f.messages.control.NewsSubscribeMessage;return s.newsAction=o,s.newsFilters=e,s.filterId=t,s.skipHeavyInitialLoad=r,s.mimetype=n.mimetype,s.newsClientId=i||null,s},i.prototype.buildCorpEventRequest=function(e,t,n){var r=new f.messages.control.CorpEventSubscribeMessage;return r.symbols=e,r.action=n,r.corpEventTypes=t.corpEventTypes,r.allCorpEvents=t.allCorpEvents,r.mimeType=t.mimeType,r},i.prototype.buildAlertsSubUnsubRequest=function(e,t){var n=new f.messages.control.AlertsSubUnsubMessage;return n.operation=e,n.mimetype=t.mimetype,n},i.prototype.buildTradeSubscribeRequest=function(e,t,n){var r=new f.messages.control.TradeSubscribeMessage;return r.action=n,r.notificationType=e,r.mimetype=t.mimetype,r},i.prototype.buildUpdateAuthTokenRequest=function(e,t,n,r){var i=new f.messages.control.AuthTokenMessage;return i.authMethod=e,i.authParams={oauthToken:t,previousToken:n},i.mimetype=r.mimetype,i},i.prototype.buildNewsCommandRequest=function(e,t){var n=new f.messages.control.NewsCommandMessage;return n.newsAction=t,n.mimetype=e.mimetype,n},i.prototype._getUpdatedNumberOfEntitlements=function(e,t,n,r){var i=t;return r&&n.endsWith(":CC")?i+=14*e:i+=e,i},i.prototype.handlectrlmsg=function(e){switch(this.log.debug(E.msgfmt.fmt(e)),(0,d.messagetype)(e)){case f.messages.MessageTypeNames.ctrl.HEARTBEAT:this.onHeartbeat(e);break;case f.messages.MessageTypeNames.ctrl.SUBSCRIBE_RESPONSE:this.onSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.EXCHANGE_RESPONSE:this.onExchangeSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.ALERTS_SUBUNSUB_RESPONSE:this.onAlertsSubUnsubResponse(e);break;case f.messages.MessageTypeNames.ctrl.TRADE_SUBSCRIBE_RESPONSE:this.onTradeSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.UNSUBSCRIBE_RESPONSE:this.onUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.EXCHANGE_UNSUBSCRIBE_RESPONSE:this.onExchangeUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_OPEN_RESPONSE:this.onNewsOpenResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_ADD_RESPONSE:this.onNewsFltAddResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_UPDATE_RESPONSE:this.onNewsFltUpdateMessage(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_DELETE_RESPONSE:this.onNewsFltDeleteResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_GET_RESPONSE:this.onNewsFltGetResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FILTER_MESSAGE:this.onNewsFilterRemoteMessage(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_ERROR_MESSAGE:this.onNewsErrorRemoteMessage(e);break;case f.messages.MessageTypeNames.ctrl.CORP_EVENT_RESPONSE:this.onCorpEventResponse(e);break;case f.messages.MessageTypeNames.ctrl.TRADE_UNSUBSCRIBE_RESPONSE:this.onTradeUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.CONNECT_RESPONSE:this.onConnectResponse(e);break;case f.messages.MessageTypeNames.ctrl.CONNECTION_CLOSE:this.onConnectionClose(e);break;case f.messages.MessageTypeNames.ctrl.SLOW_CONNECTION:this.onSlowConnection(e);break;case f.messages.MessageTypeNames.ctrl.STATS_RESPONSE:this.onStatsResponse(e);break;case f.messages.MessageTypeNames.ctrl.INITIAL_DATA_SENT:this.onInitialDataSent(e);break;case f.messages.MessageTypeNames.ctrl.RESUBSCRIBE_MESSAGE:this.onResubscribeMessage(e);break;case f.messages.MessageTypeNames.ctrl.OPEN_FLOW:this.onOpenFlow(e);break;case f.messages.MessageTypeNames.ctrl.RECONNECT_RESPONSE:this.onReconnectMessage(e);break;case f.messages.MessageTypeNames.ctrl.MISSED_DATA_SENT:this.onMissedDataSent(e);break;case f.messages.MessageTypeNames.ctrl.AUTH_TOKEN_RESPONSE:this.onAuthTokenResponse(e)}},i.prototype.SCFHandlectrlmsg=function(e){this.log.debug(E.msgfmt.fmt(e));var t=this.pendingSCFMessages[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingSCFMessages[e.__id],200!=e.code){var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.ids.length&&n&&n(null,t)},i.prototype.onHeartbeat=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("heartbeat",e)},i.prototype.onSubscribeResponse=function(e){var t=this.pendingsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingsubscriptions[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;if(e.entitlements){var o=e.entitlements,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u,c=l,f=c.symbol,d=c.marketdatatype,p=c.entitlement;l={symbol:f,type:d},"NA"!==p?(this.log.debug("SUBSCRIBED <"+f+", "+d+">"),l.entitlement=p,i.subscribed.push(l)):(this.log.warn("NOT ENTITLED <"+f+","+d+">"),i.unentitled.push(l))}}if(e.rejectedSymbols){var h=e.rejectedSymbols,m=Array.isArray(h),E=0;for(h=m?h:h[Symbol.iterator]();;){var _;if(m){if(E>=h.length)break;_=h[E++]}else{if((E=h.next()).done)break;_=E.value}f=_;this.log.warn("REJECTED "+f),i.rejected.push(f)}}if(e.invalidSymbols){var g=e.invalidSymbols,T=Array.isArray(g),b=0;for(g=T?g:g[Symbol.iterator]();;){var y,S;if(T){if(b>=g.length)break;S=g[b++]}else{if((b=g.next()).done)break;S=b.value}var v=S;this.log.warn("INVALID SYMBOL "+v),(y=i.invalidSymbols).push.apply(y,e.invalidSymbols)}}0!==t.ids.length||t.failed||n&&n(null,t.result)},i.prototype.onExchangeSubscribeResponse=function(e){var t=this.pendingExchangeSubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingExchangeSubscriptions[e.__id],200!=e.code){var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.id.length&&n&&n(null,t)},i.prototype.onCorpEventResponse=function(e){var t=this.pendingCorpEventSubscription[e.__id],n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingCorpEventSubscription[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error subscribing to Corporate Events",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.subscribed){var o=e.subscribed,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.subscribed.push(l)}}if(e.unsubscribed){var c=e.unsubscribed,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.unsubscribed.push(h)}}if(e.invalid){var m=e.invalid,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.invalid.push(T)}}0===t.id.length&&n&&n(null,t.result)},i.prototype.onAlertsSubUnsubResponse=function(e){var t=this.pendingAlertSubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingAlertSubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.operation&&(this.log.debug("Alerts "+e.operation),i.operation=e.operation),0===t.id.length&&n&&n(null,t.result)},i.prototype.onTradeSubscribeResponse=function(e){var t=this.pendingTradeSubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingTradeSubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.notificationType&&(this.log.debug("Trade "+e.notificationType),i.notificationType=e.notificationType),0===t.id.length&&n&&n(null,t.result)},i.prototype.onNewsOpenResponse=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error opening news connection",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&n(i))}r.newsClientId=e.newsClientId,n&&n(null,r)}},i.prototype.onNewsFltAddResponse=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error subscribing to news",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.newsFilters){var o=e.newsFilters,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.newsFilters.push(l)}}if(e.rejectedNewsFilters){var c=e.rejectedNewsFilters,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.rejectedNewsFilters.push(h)}}if(e.unentitledNewsFilters){var m=e.unentitledNewsFilters,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.unentitledNewsFilters.push(T)}}e.filterId&&(r.filterId=e.filterId),e.newsClientId&&(r.newsClientId=e.newsClientId),0===t.id.length&&n&&n(null,t.result)}},i.prototype.onNewsFltUpdateMessage=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error updating news filters",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.newsFilters){var o=e.newsFilters,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.newsFilters.push(l)}}if(e.rejectedNewsFilters){var c=e.rejectedNewsFilters,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.rejectedNewsFilters.push(h)}}if(e.unentitledNewsFilters){var m=e.unentitledNewsFilters,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.unentitledNewsFilters.push(T)}}e.filterId&&(r.filterId=e.filterId),0===t.id.length&&n&&n(null,t.result)}},i.prototype.onNewsFltDeleteResponse=function(e){if(console.log("News_flt_delete Response",e),200==e.code)this.events.fire("filterDelete",e);else{var t=w.error("Error deleting news filter",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onNewsFltGetResponse=function(e){if(200==e.code)this.events.fire("filterStatus",e);else{var t=w.error("Error getting news filters status",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onNewsFilterRemoteMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("newsRemoteMessage",e)},i.prototype.onNewsErrorRemoteMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("newsRemoteMessage",e)},i.prototype.onTradeUnsubscribeResponse=function(e){var t=this.pendingTradeUnsubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingTradeUnsubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.notificationType&&(this.log.debug("Trade "+e.notificationType),i.notificationType=e.notificationType),0===t.id.length&&n&&n(null,t.result)},i.prototype.onUnsubscribeResponse=function(e){var t=this.pendingUnsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingUnsubscriptions[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&n(r))}for(var i=0;i<e.unsubscribed.length;++i){var o=t.result,s=e.unsubscribed[i],a=s.symbol,u=s.marketdatatype;this.log.debug("UNSUBSCRIBED <"+a+", "+u+">"),o.unsubscribed.push({symbol:a,type:u})}0!==t.ids.length||t.failed||n&&n(null,t.result)},i.prototype.onExchangeUnsubscribeResponse=function(e){var t=this.pendingExchangeUnsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingExchangeUnsubscriptions[e.__id],200!=e.code){var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.id.length&&n&&n(null,t)},i.prototype.onReconnectMessage=function(e){450===e.code&&(this.events.fire("slow","Reconnection recieved a slow code: "+e.code),this._isSlowConnection=!0,this.conn.setReconnect=!1),this.events.fire("reconnectMessage",e)},i.prototype.onConnectResponse=function(e){if(200!==e.code){var t=w.error("Connection failed",{code:e.code,reason:e.reason});return this.events.fire("error",t),this.pendingConnection&&this.pendingConnection(t),void this.doClose(t)}if(this._serverversion=e.version,this.maxEntitlementsPerSubscription=e.maxEntitlementsPerSubscription,this.isClosed()){var n=w.error("Connection was already closed",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(this.pendingConnection&&this.pendingConnection(n))}this.conn.setServer(e.serverInstance),this.pendingConnection&&this.pendingConnection(null,this)},i.prototype.onConnectionClose=function(e){this.doClose(w.close({reason:e.reason,code:e.code}))},i.prototype.onSlowConnection=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("slow",e)},i.prototype.onStatsResponse=function(e){if(200==e.code)this.events.fire("stats",e);else{var t=w.error("Error getting stats",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onInitialDataSent=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("initialDataSent",e)},i.prototype.onResubscribeMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("resubscribeMessage",e)},i.prototype.onMissedDataSent=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("missedDataSent",e)},i.prototype.onOpenFlow=function(e){this.conn.send(e)},i.prototype.onAuthTokenResponse=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("authTokenResponse",e)},i.prototype._handledatamsg=function(e){this.events.fire("message",e)},i.prototype.send=function(e){this.conn&&this.conn.send(e)},i.prototype.sendCustomFrame=function(e,t,n,r){this.conn&&this.conn.sendCustomFrame(e,t,n,r)},i.prototype.doClose=function(e){if(!this.isClosed()){var t=this.conn;this.conn=null,t.close(),this.events.fire("close",e),t.isReconnect()&&(this.events=new m["default"],this.conn=t)}},i.prototype.performReconnect=function(e){if(null!=this.conn&&this.conn.isReconnect()){if(this.conn.isConnectionUp)return void this.log.warn("Connection is not closed and won't try reconnect.");this.conn.setReconnect(!0),this.conn.tryReopen(),e&&e()}else this.log.warn("Reconnect flag is set to false")},i.prototype.close=function(e){this.doClose(w.close({reason:"Manually closed",code:200})),e&&e()},i.prototype.isClosed=function(){return null==this.conn},i}();b["default"]=g}).call(this,T("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},T("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],T("timers").setImmediate,T("timers").clearImmediate,"/lib/stomp/StompStream.js","/lib/stomp")},{"../EventSupport.js":2,"../UShortId.js":9,"../formatting.js":13,"../logging.js":16,"../polyfills.js":18,"../streamer-api.js":108,"../streamer-events.js":109,"../streamer-utils.js":110,"../utils.js":115,_process:131,buffer:121,timers:152}],107:[function(v,e,O){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";O.__esModule=!0,v("../polyfills.js");var f=v("../logging.js"),p=v("../streamer-api.js"),h=v("../message.js"),d=_(v("../transmission/JsonStompTransmitter.js")),m=_(v("./StompConnection.js")),E=_(v("./StompStream.js"));function _(e){return e&&e.__esModule?e:{"default":e}}var g="/ping/v1",T="/version/v1",b="/stream/connect",y="",S=function(){function o(e,t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.http=e,this.stompJs=t,this.log=(0,f.asLogger)(n),this.config=r||{},this.maxReconnectAttempts=this.config.maxReconnectAttempts,this.format=this.config.format,"application/json"===this.config.format&&(this.createTransmitter=function(e){return new d["default"](e,i.log)})}return o.prototype.openStompSocket=function(t,e){y="";var n={"X-Stream-Version":p.VERSION,"X-Stream-Lib":p.LIBRARY_NAME};this.addToHeaderParams("X-Stream-Version",p.VERSION),this.addToHeaderParams("X-Stream-Lib",p.LIBRARY_NAME);var r=this.config.conflation;null!=r&&""!==r&&(n["X-Stream-Conflation"]=r,this.addToHeaderParams("X-Stream-Conflation",r)),null!=e&&""!==e&&(n["X-Stream-Previous-Connection-Id"]=e,this.addToHeaderParams("X-Stream-Previous-Connection-Id",e));var i=this.config.intervalPeriod;null!=i&&""!==i&&(n["X-Stream-Interval-Period"]=i,this.addToHeaderParams("X-Stream-Interval-Period",i));var o=this.config.rejectExcessiveConnection;null!=o&&""!==o&&(n["X-Stream-Reject"]=o,this.addToHeaderParams("X-Stream-Reject",o)),"application/json"!==this.config.format&&this.config.format!==h.MimeTypes.QITCH||(n["X-Stream-Format"]=this.format,this.addToHeaderParams("X-Stream-Format",this.format)),"true"===this.config.updatesOnly&&(n["X-Stream-UpdatesOnly"]=!0,this.addToHeaderParams("X-Stream-UpdatesOnly",!0));var s=this.config.isReconnect;null!=s&&""!==s&&(n["x-Stream-isReconnect"]=s,this.addToHeaderParams("x-Stream-isReconnect",s));var a=this.config.alwaysReconnect;null!=a&&""!==a&&(n["x-Stream-isAlwaysReopen"]=a,this.addToHeaderParams("x-Stream-isAlwaysReopen",a)),"ALL"===this.config.isMissedData?(n["X-Stream-isReceiveAllMissedData"]=!0,this.addToHeaderParams("X-Stream-isReceiveAllMissedData",!0)):"LATEST"===this.config.isMissedData&&(n["X-Stream-isReceiveLatestMissedData"]=!0,this.addToHeaderParams("X-Stream-isReceiveLatestMissedData",!0));var u=this.config.stompWmid;null!=u&&(n.wmid=u,this.addToHeaderParams("wmid",u));var l=this.config.userSymbology;null!=l&&""!==l&&(n["X-Stream-User-Symbology"]=l,this.addToHeaderParams("X-Stream-User-Symbology",l)),Object.assign(n,this.config.credentials.getHeaders());var c=this.config.url+b+y,f=this.stompJs.Stomp.client(c),d=new p.messages.control.AuthenticationMessage;return this.config.credentials.sid!==undefined?(d.authenticationMethod="sid",d.authorization=this.config.credentials.sid):this.config.credentials.wmid!==undefined&&this.config.credentials.token!==undefined?(d.authenticationMethod="enterprise",d.wmid=this.config.credentials.wmid,d.authorization=this.config.credentials.token):this.config.credentials.wmid!==undefined?(d.authenticationMethod="wmid",d.authorization=this.config.credentials.wmid):this.config.credentials.data_token!==undefined?(d.authenticationMethod="datatool",d.authorization=this.config.credentials.data_token):this.config.credentials.oauth_token!==undefined&&(d.authenticationMethod="oauth",d.authorization=this.config.credentials.oauth_token),null!=this.config.conflation&&""!==this.config.conflation&&(d.conflation=this.config.conflation),null!=this.config.rejectExcessiveConnection&&""!==this.config.rejectExcessiveConnection&&(d.rejectExcessiveConnection=this.config.rejectExcessiveConnection),null!=this.config.entMax&&""!==this.config.entMax&&(d.entMax=this.config.entMax),f.connect(n,function(e){f.subscribe("/user/queue/messages",function(e){t(n).onMessage(e)}),t(n).onOpen(e),f.send("/stream/message",n,JSON.stringify(d))},function(e){t(n).onError(e)}),{send:function(e){f.send("/stream/message",n,e)},close:function(){f.disconnect(function(){t(n).onClose()})},sendCustomFrame:function(e,t,n,r){f.sendCustomFrame(e,t,n,r)}}},o.prototype.createStompConnection=function(){var n=this;return new m["default"](function(e){return n.createTransmitter(e)},function(e,t){return n.openStompSocket(e,t)},this.log,this.maxReconnectAttempts,this.config.host+g)},o.prototype.openStompStream=function(e){new E["default"](this,this.format,this.log).openStomp(e)},o.prototype.ping=function(t){this.http({url:this.config.host+g,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.getVersion=function(t){this.http({url:this.config.host+T,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.addToHeaderParams=function(e,t){y=""===y?y+"?"+e+"="+t:y+"&"+e+"="+t},o}();O["default"]=S}).call(this,v("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},v("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],v("timers").setImmediate,v("timers").clearImmediate,"/lib/stomp/StompStreamingService.js","/lib/stomp")},{"../logging.js":16,"../message.js":17,"../polyfills.js":18,"../streamer-api.js":108,"../transmission/JsonStompTransmitter.js":111,"./StompConnection.js":105,"./StompStream.js":106,_process:131,buffer:121,timers:152}],108:[function(e,t,d){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";d.__esModule=!0;d.LIBRARY_NAME="JavaScript",d.VERSION="2.66.0";var f=d.messages={};f.control={},f.market={},f.JSON_TYPE_PROPERTY="@T",f.MessageTypeNames={ctrl:{HEARTBEAT:"C1",SUBSCRIBE:"C2",SUBSCRIBE_RESPONSE:"C3",UNSUBSCRIBE_RESPONSE:"C4",CONNECT_RESPONSE:"C5",CONNECTION_CLOSE:"C6",FLOW:"C7",SLOW_CONNECTION:"C8",INITIAL_DATA_SENT:"C9",RESUBSCRIBE_MESSAGE:"C10",STATS:"C12",STATS_RESPONSE:"C13",EXCHANGE_SUBSCRIBE:"C14",EXCHANGE_RESPONSE:"C15",EXCHANGE_UNSUBSCRIBE_RESPONSE:"C16",NEWS_SUBSCRIBE:"C17",NEWS_FLT_ADD_RESPONSE:"C18",ALERTS_SUBUNSUB:"C19",ALERTS_SUBUNSUB_RESPONSE:"C20",TRADE_SUBSCRIBE:"C21",TRADE_SUBSCRIBE_RESPONSE:"C22",NEWS_FLT_DELETE_RESPONSE:"C23",NEWS_COMMAND:"C24",NEWS_FLT_GET_RESPONSE:"C26",AUTHENTICATION:"C27",OPEN_FLOW:"C28",RECONNECT_RESPONSE:"C29",TRADE_UNSUBSCRIBE_RESPONSE:"C30",MISSED_DATA_SENT:"C31",CORP_EVENT_MESSAGE:"C33",CORP_EVENT_RESPONSE:"C34",NEWS_FLT_MOCK_BASIC_RESPONSE:"C35",NEWS_FLT_UPDATE_RESPONSE:"C36",NEWS_FILTER_MESSAGE:"C37",NEWS_ERROR_MESSAGE:"C38",NEWS_SUCCESS_MESSAGE:"C39",AUTH_TOKEN:"C41",AUTH_TOKEN_RESPONSE:"C42",NEWS_OPEN_RESPONSE:"C43"},data:{QUOTE:"D1",PRICEDATA:"D2",TRADE:"D3",BOOKORDER:"D4",BOOKDELETE:"D5",PURGEBOOK:"D6",MMQUOTE:"D7",INTERVAL:"D8",NETHOUSEPOSITION:"D9",SYMBOLINFO:"D10",SYMBOLSTATUS:"D11",DERIVATIVEINFO:"D12",LASTSALE:"D13",LIMITUPLIMITDOWN:"D14",IVGREEKS:"D15",IMBALANCESTATUS:"D16",ALERT:"D17",NEWS:"D18",TRADENOTIFICATION:"D19",DIVIDEND:"D22",EARNINGS:"D23",SPLIT:"D24",SYMBOLCHANGED:"D25",PRICELEVEL:"D26",MMPRICELEVEL:"D27",ORDEREXECUTED:"D28"}},f.Message=function(){},f.Message.prototype.init=function(e){this[f.JSON_TYPE_PROPERTY]=e},f.control.CtrlMessage=function(){},f.control.CtrlMessage.prototype=new f.Message,f.control.Heartbeat=function(){this.init(f.MessageTypeNames.ctrl.HEARTBEAT),this.timestamp=null},f.control.Heartbeat.prototype=new f.control.CtrlMessage,f.control.StatsMessage=function(){this.init(f.MessageTypeNames.ctrl.STATS)},f.control.StatsMessage.prototype=new f.control.CtrlMessage,f.control.SubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.SUBSCRIBE),this.action=null,this.symbols=[],this.types=[],this.mimetype=null,this.conflation=null},f.control.SubscribeMessage.prototype=new f.control.CtrlMessage,f.control.ExchangeSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_SUBSCRIBE),this.action=null,this.exchange=null,this.mimetype=null,this.conflation=null},f.control.ExchangeSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.NewsSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.NEWS_SUBSCRIBE),this.newsAction=null,this.newsFilters=null,this.filtersId=null,this.mimetype=null,this.newsClientId=null},f.control.NewsSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.NewsCommandMessage=function(){this.init(f.MessageTypeNames.ctrl.NEWS_COMMAND),this.newsAction=null,this.mimetype=null},f.control.NewsCommandMessage.prototype=new f.control.CtrlMessage,f.control.CorpEventSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.CORP_EVENT_MESSAGE),this.action=null,this.symbols=[],this.corpEventTypes=[],this.allCorpEvents=null,this.mimeType=null},f.control.CorpEventSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.AlertsSubUnsubMessage=function(){this.init(f.MessageTypeNames.ctrl.ALERTS_SUBUNSUB),this.operation=null,this.mimetype=null},f.control.AlertsSubUnsubMessage.prototype=new f.control.CtrlMessage,f.control.TradeSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.TRADE_SUBSCRIBE),this.action=null,this.notificationType=null,this.mimetype=null},f.control.TradeSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.AuthTokenMessage=function(){this.init(f.MessageTypeNames.ctrl.AUTH_TOKEN),this.authMethod=null,this.authParams=null,this.mimetype=null},f.control.AuthTokenMessage.prototype=new f.control.CtrlMessage,f.control.BaseResponse=function(){this.code=null,this.reason=null},f.control.BaseResponse.prototype=new f.control.CtrlMessage,f.control.SubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.SUBSCRIBE_RESPONSE),this.entitlements=null,this.invalidsymbols=null,this.rejectedsymbols=null,this.messagefilters=null},f.control.SubscribeResponse.prototype=new f.control.BaseResponse,f.control.ExchangeSubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_RESPONSE)},f.control.ExchangeSubscribeResponse.prototype=new f.control.BaseResponse,f.control.AlertSubUnsubResponse=function(){this.init(f.MessageTypeNames.ctrl.ALERTS_SUBUNSUB_RESPONSE)},f.control.AlertSubUnsubResponse.prototype=new f.control.BaseResponse,f.control.TradeSubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.TRADE_SUBSCRIBE_RESPONSE)},f.control.TradeSubscribeResponse.prototype=new f.control.BaseResponse,f.control.UnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.UNSUBSCRIBE_RESPONSE),this.unsubscribed=null},f.control.UnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.ExchangeUnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_UNSUBSCRIBE_RESPONSE)},f.control.ExchangeUnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.CorporateEventResponse=function(){this.init(f.MessageTypeNames.ctrl.CORP_EVENT_RESPONSE),this.subscribed=[],this.unsubscribed=[],this.invalid=[]},f.control.CorporateEventResponse.prototype=new f.control.BaseResponse,f.control.TradeUnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.TRADE_UNSUBSCRIBE_RESPONSE)},f.control.TradeUnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.StreamEntitlement=function(){this.symbol=null,this.marketdatatype=null,this.entitlement=null},f.control.ConnectResponse=function(){this.init(f.MessageTypeNames.ctrl.CONNECT_RESPONSE),this.version=null,this.flowControlCheckInterval=null,this.serverInstance=null,this.conflationMs=null},f.control.ConnectResponse.prototype=new f.control.BaseResponse,f.control.ReconnectResponse=function(){undefined.init(f.MessageTypeNames.ctrl.RECONNECT_RESPONSE),undefined.version=null,undefined.flowControlCheckInterval=null,undefined.serverInstance=null,undefined.conflationMs=null,undefined.previousSubscriptions=null},f.control.ConnectionClose=function(){this.init(f.MessageTypeNames.ctrl.CONNECTION_CLOSE),this.code=null,this.reason=null},f.control.ConnectionClose.prototype=new f.control.CtrlMessage,f.control.SlowConnection=function(){this.init(f.MessageTypeNames.ctrl.SLOW_CONNECTION),this.timesExceeded=null,this.maxExceed=null,this.currentDelta=null,this.sendingRate=null},f.control.SlowConnection.prototype=new f.control.CtrlMessage,f.control.FlowMessage=function(){this.init(f.MessageTypeNames.ctrl.FLOW),this.sequence=null},f.control.FlowMessage.prototype=new f.control.CtrlMessage,f.control.AuthenticationMessage=function(){this.init(f.MessageTypeNames.ctrl.AUTHENTICATION),this.authenticationMethod=null,this.wmid=null,this.authorization=null,this.conflation=150,this.rejectExcessiveConnection=!1,this.entMax=null},f.control.AuthenticationMessage.prototype=new f.control.CtrlMessage,f.control.StatsResponse=function(){this.init(f.MessageTypeNames.ctrl.STATS_RESPONSE),this.numberOfSubscribedSymbolsL1=null,this.numberOfAvailableSymbolsL1=null,this.numberOfSubscribedSymbolsL2=null,this.numberOfAvailableSymbolsL2=null,this.numberOfOpenedConnections=null,this.numberOfAvailableConnections=null,this.numberOfSubscribedExchanges=null,this.numberOfSubscribedTrades=null},f.control.StatsResponse.prototype=new f.control.BaseResponse,f.control.InitialDataSent=function(){this.init(f.MessageTypeNames.ctrl.INITIAL_DATA_SENT),this.timestamp=null},f.control.InitialDataSent.prototype=new f.control.CtrlMessage,f.control.ResubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.RESUBSCRIBE_MESSAGE),this.timestamp=null},f.control.ResubscribeMessage.prototype=new f.control.CtrlMessage,f.control.MissedDataSent=function(){this.init(f.MessageTypeNames.ctrl.MISSED_DATA_SENT),this.timestamp=null},f.control.MissedDataSent.prototype=new f.control.CtrlMessage,f.control.StreamEntitlementType={RT:"Realtime",RTO:"Realtime CBOE ONE",RTN:"Realtime NASDAQ",RTB:"Realtime BATS",DL:"Delayed",DLO:"Delayed CBOE One",DLN:"Delayed NASDAQ",RTQ:"QM Zero",NA:"Not Entitled"},f.control.Action={SUBSCRIBE:"SUBSCRIBE",UNSUBSCRIBE:"UNSUBSCRIBE"},f.control.NewsAction={NEWS_OPEN:"NEWS_OPEN",NEWS_FLT_ADD:"NEWS_FLT_ADD",NEWS_FLT_DELETE:"NEWS_FLT_DELETE",NEWS_FLT_UPDATE:"NEWS_FLT_UPDATE",NEWS_FLT_GET:"NEWS_FLT_GET",NEWS_FLT_MOCK_BASIC:"NEWS_FLT_MOCK_BASIC"},f.control.Association={AND:"AND",OR:"OR",NOT:"NOT"},f.control.MarketdataType={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",MMQUOTE:"MMQUOTE",ORDERBOOK:"ORDERBOOK",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",LASTSALE:"LASTSALE",BOOKORDER:"BOOKORDER",BOOKDELETE:"BOOKDELETE",PRICELEVEL:"PRICELEVEL",MMPRICELEVEL:"MMPRICELEVEL",PURGEBOOK:"PURGEBOOK",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS"},f.market.SubscriptionTypes={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",MMQUOTE:"MMQUOTE",ORDERBOOK:"ORDERBOOK",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",LASTSALE:"LASTSALE",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS",ORDEREXECUTED:"ORDEREXECUTED"},f.market.CorporateEventTypes={DIVIDEND:"DIVIDEND",SPLIT:"SPLIT",EARNINGS:"EARNINGS",SYMBOLCHANGED:"SYMBOLCHANGED"},f.market.MarketDataResponseTypes={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",MMQUOTE:"MMQUOTE",PRICELEVEL:"PRICELEVEL",MMPRICELEVEL:"MMPRICELEVEL",BOOKORDER:"BOOKORDER",PURGEBOOK:"PURGEBOOK",BOOKDELETE:"BOOKDELETE",SYMBOLINFO:"SYMBOLINFO",SYMBOLSTATUS:"SYMBOLSTATUS",DERIVATIVEINFO:"DERIVATIVEINFO",LASTSALE:"LASTSALE",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS",ALERT:"ALERT",NEWS:"NEWS",TRADENOTIFICATION:"TRADENOTIFICATION",NEWSERROR:"NEWSERROR",DIVIDEND:"DIVIDEND",ORDEREXECUTED:"ORDEREXECUTED"},f.control.ResponseCodes={OK_CODE:200,OK_REASON:"OK",BADREQUEST_CODE:400,BADREQUEST_REASON:"Bad Request",UNAUTHORIZED_CODE:401,UNAUTHORIZED_REASON:"Unauthorized",TOOSLOW_CODE:450,TOOSLOW_REASON:"Too slow",DATA_SOURCE_RESET:454,DATA_SOURCE_RESET_REASON:"Data Source Was Reset",CONNECTION_LIMIT_EXCEEDED_CODE:452,CONNECTION_LIMIT_EXCEEDED_REASON:"Connection Limit Exceeded",INTERNALSERVERERROR_CODE:500,INTERNALSERVERERROR_REASON:"Internal Server Error"},f.market.DataMessage=function(){this.messageType=null},f.market.DataMessage.prototype=new f.Message,f.market.Quote=function(){this.init(f.MessageTypeNames.data.QUOTE)},f.market.Quote.prototype=new f.market.DataMessage,f.market.PriceData=function(){this.init(f.MessageTypeNames.data.PRICEDATA)},f.market.PriceData.prototype=new f.market.DataMessage,f.market.Trade=function(){this.init(f.MessageTypeNames.data.TRADE)},f.market.Trade.prototype=new f.market.DataMessage,f.market.MMQuote=function(){this.init(f.MessageTypeNames.data.MMQUOTE)},f.market.MMQuote.prototype=new f.market.DataMessage,f.market.PurgeBook=function(){this.init(f.MessageTypeNames.data.PURGEBOOK)},f.market.PurgeBook.prototype=new f.market.DataMessage,f.market.BookOrder=function(){this.init(f.MessageTypeNames.data.BOOKORDER)},f.market.BookOrder.prototype=new f.market.DataMessage,f.market.BookDelete=function(){this.init(f.MessageTypeNames.data.BOOKDELETE)},f.market.BookDelete.prototype=new f.market.DataMessage,f.market.PriceLevel=function(){this.init(f.MessageTypeNames.data.PRICELEVEL)},f.market.PriceLevel.prototype=new f.market.DataMessage,f.market.MMPriceLevel=function(){this.init(f.MessageTypeNames.data.MMPRICELEVEL)},f.market.MMPriceLevel.prototype=new f.market.DataMessage,f.market.Interval=function(){this.init(f.MessageTypeNames.data.INTERVAL)},f.market.Interval.prototype=new f.market.DataMessage,f.market.NethousePosition=function(){this.init(f.MessageTypeNames.data.NETHOUSEPOSITION)},f.market.NethousePosition.prototype=new f.market.DataMessage,f.market.SymbolInfo=function(){this.init(f.MessageTypeNames.data.SYMBOLINFO)},f.market.SymbolInfo.prototype=new f.market.DataMessage,f.market.SymbolStatus=function(){this.init(f.MessageTypeNames.data.SYMBOLSTATUS)},f.market.SymbolStatus.prototype=new f.market.DataMessage,f.market.DerivativeInfo=function(){this.init(f.MessageTypeNames.data.DERIVATIVEINFO)},f.market.DerivativeInfo.prototype=new f.market.DataMessage,f.market.IVGreeks=function(){this.init(f.MessageTypeNames.data.IVGREEKS)},f.market.IVGreeks.prototype=new f.market.DataMessage,f.market.LastSale=function(){this.init(f.MessageTypeNames.data.LASTSALE)},f.market.LastSale.prototype=new f.market.DataMessage,f.market.LimitUpLimitDown=function(){this.init(f.MessageTypeNames.data.LIMITUPLIMITDOWN)},f.market.LimitUpLimitDown.prototype=new f.market.DataMessage,f.market.ImbalanceStatus=function(){this.init(f.MessageTypeNames.data.IMBALANCESTATUS)},f.market.ImbalanceStatus.prototype=new f.market.DataMessage,f.market.Alert=function(){this.init(f.MessageTypeNames.data.ALERT)},f.market.Alert.prototype=new f.market.DataMessage,f.market.OrderExecuted=function(){this.init(f.MessageTypeNames.data.ORDEREXECUTED)},f.market.OrderExecuted.prototype=new f.market.DataMessage,f.market.InstrumentType={1:"CASH",2:"BOND",3:"COMPOSITE",4:"FUTURE",5:"FUTURE_OPTION",6:"FOREX",7:"INDEX",8:"MUTUAL_FUND",9:"MONEY_MARKET_FUND",10:"MARKET_STAT",11:"EQUITY",12:"EQUITY_OPTION",13:"GOVT_BOND",14:"MUNI_BOND",15:"CORP_BOND",16:"ETF",17:"FUTURE_SPREAD",97:"OPTION_ROOT",98:"UNKNOWN",99:"RATE"},f.market.OrderSide={BUYSIDE:"B",SELLSIDE:"S"},f.market.ImbalanceType={0:"NONE",1:"MARKET",2:"MOC",3:"REGULATORY_IMBALANCE",4:"OPENING_IMBALANCE",5:"CLOSING_IMBALANCE",6:"IPO_IMBALANCE",7:"HALT_IMBALANCE",8:"EQUILIBRIUM"},f.market.OrderChangeType={A:"ADD",M:"MODIFY",C:"CANCEL",E:"EXECUTE"}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/streamer-api.js","/lib")},{_process:131,buffer:121,timers:152}],109:[function(p,e,h){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";h.__esModule=!0,p("./polyfills");var f=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e)}return t.prototype.toString=function(){var e=this.type+"{",t=!0;for(var n in this)"type"!==n&&"function"!=typeof this[n]&&(t||(e+=", "),e+=n+": "+JSON.stringify(this[n]),t=!1);return e+="}"},t}(),d=h.event=function(e,t){return new f(Object.assign({type:e},t))};h.error=function(e,t){return d("error",Object.assign({description:e},t))},h.close=function(e){return d("close",e)}}).call(this,p("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],p("timers").setImmediate,p("timers").clearImmediate,"/lib/streamer-events.js","/lib")},{"./polyfills":18,_process:131,buffer:121,timers:152}],110:[function(p,e,h){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";h.__esModule=!0,h.getMessageName=h.entitlement=h.isvalid=h.iscontrolmessage=h.isdatamessage=h.messagetype=undefined;var f,d=p("./streamer-api.js");h.messagetype=function(e){return null===e?null:e[d.messages.JSON_TYPE_PROPERTY]},h.isdatamessage=function(e){if(null===e)return!1;var t=h.messagetype(e);return null!==t&&t.startsWith("D")},h.iscontrolmessage=function(e){if(null===e)return!1;var t=h.messagetype(e);return null!==t&&t.startsWith("C")},h.isvalid=function(e,t){var n=t.invalidSymbols;if(null==n)return!0;for(var r=0;r<n.length;r++){if(n[r]===e)return!1}return!0},h.entitlement=function(e,t,n){var r=n.entitlements;if(null!=r)for(var i=0;i<r.length;i++){var o=r[i];if(o.symbol===e&&o.marketdatatype===t)return o.entitlement}return null},h.getMessageName=(f={},function(e){var t=e[d.messages.JSON_TYPE_PROPERTY];if(!f[t]){var n=d.messages.MessageTypeNames.ctrl;for(var r in n)if(n[r]===t)return f[t]=r;var i=d.messages.MessageTypeNames.data;for(var o in i)if(i[o]===t)return f[t]=o;return f[t]=t}return f[t]})}).call(this,p("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],p("timers").setImmediate,p("timers").clearImmediate,"/lib/streamer-utils.js","/lib")},{"./streamer-api.js":108,_process:131,buffer:121,timers:152}],111:[function(m,e,E){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";E.__esModule=!0;var f,d=m("../EventSupport.js"),p=(f=d)&&f.__esModule?f:{"default":f};var h=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.socket=e,this.log=t,this.events=new p["default"](this)}return n.prototype.send=function(e,t){this.socket.send(JSON.stringify(e))},n.prototype.sendCustomFrame=function(e,t,n,r){this.socket.sendCustomFrame(e.toString(),t.toString(),JSON.parse(n),JSON.stringify(r))},n.prototype.onMessage=function(e){var t=null;try{t=JSON.parse(e)}catch(r){return void this.log.error(r)}var n=t;n.__id=n.requestId,this.events.fire("message",n)},n.prototype.on=function(e,t){return this.events.on(e,t)},n}();E["default"]=h}).call(this,m("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],m("timers").setImmediate,m("timers").clearImmediate,"/lib/transmission/JsonStompTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,_process:131,buffer:121,timers:152}],112:[function(m,e,E){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";E.__esModule=!0;m("../message.js");var f,d=m("../EventSupport.js"),p=(f=d)&&f.__esModule?f:{"default":f};var h=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.socket=e,this.log=t,this.events=new p["default"](this)}return n.prototype.send=function(e,t){this.socket.push({trackMessageLength:!0,data:JSON.stringify(e)})},n.prototype.onMessage=function(e){var t=null;try{t=JSON.parse(e)}catch(o){return void this.log.error(o)}this.events.fire("sequence",t.seq);for(var n=t.data.length,r=0;r<n;r++){var i=t.data[r];i.__id=i.requestId,this.events.fire("message",i)}},n.prototype.on=function(e,t){return this.events.on(e,t)},n}();E["default"]=h}).call(this,m("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],m("timers").setImmediate,m("timers").clearImmediate,"/lib/transmission/JsonTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../message.js":17,_process:131,buffer:121,timers:152}],113:[function(S,e,v){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";v.__esModule=!0;var f=b(S("../EventSupport.js")),d=b(S("../SMessage")),p=S("../qitch/decoder/QitchDecoder"),h=b(p),m=b(S("../qitch/encoder/QitchEncoder")),E=b(S("../UShortId.js")),_=S("../message.js"),g=b(S("../qitch/LocateCodeInjector")),T=S("../utils");function b(e){return e&&e.__esModule?e:{"default":e}}var y=function(){function r(e,t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.socket=e,!(t instanceof m["default"]))throw"Wrong encoder";this.encoder=t,this.log=n,this.events=new f["default"](this),this.decoder=new h["default"](r.prototype.DEFAULT_BUFFERSIZE),this.locateCodeInjector=new g["default"]}return r.prototype.send=function(e,t){var n=new d["default"];n.sequencenumber=e.sequenceNumber,n.timestamp=(new Date).getTime(),n.id=null!=t?t:E["default"].NULL,n.encoding=_.Encodings.NONE_CHAR,n.mimetype=_.MimeTypes.QITCH_CHAR,n.payload=e;var r={trackMessageLength:!1,data:this.encoder.encode(n,0)};this.socket.push(r)},r.prototype.onMessage=function(e){var t=void 0;t=e instanceof ArrayBuffer?e:(0,T.asciiStringToArrayBuffer)(e);var n=null;try{n=this.decoder.decode(new Int8Array(t))}catch(o){return void this.log.error(o)}if(null!=n)for(var r=0;r<n.length;r++)if(n[r]instanceof p.MessageBlock)for(var i=0;i<n[r].messages.length;i++)this._processMessage(n[r].messages[i]);else this._processMessage(n[r]);else this.log.debug("Couldn't decode message. Ignoring unsupported message")},r.prototype.on=function(e,t){return this.events.on(e,t)},r.prototype._processMessage=function(e){this.locateCodeInjector.injectLocateCode(e.decodedPayload),this.events.fire("sequence",e.sequencenumber),e.decodedPayload.__id=e.id,this.events.fire("message",e.decodedPayload)},r}();y.prototype.DEFAULT_BUFFERSIZE=4096,v["default"]=y}).call(this,S("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},S("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],S("timers").setImmediate,S("timers").clearImmediate,"/lib/transmission/QitchTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../SMessage":5,"../UShortId.js":9,"../message.js":17,"../qitch/LocateCodeInjector":23,"../qitch/decoder/QitchDecoder":46,"../qitch/encoder/QitchEncoder":76,"../utils":115,_process:131,buffer:121,timers:152}],114:[function(_,e,g){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";g.__esModule=!0;var f=_("../message.js"),d=m(_("../SMessage.js")),p=m(_("../UShortId.js")),h=m(_("../EventSupport.js"));_("../formatting.js");function m(e){return e&&e.__esModule?e:{"default":e}}var E=function(){function i(e,t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.socket=e,this.encoder=t,this.decoder=n,this.log=r,this.events=new h["default"](this)}return i.prototype.send=function(e,t){var n=new d["default"];n.sequencenumber=e.sequenceNumber,n.timestamp=(new Date).getTime(),n.id=null!=t?t:p["default"].NULL,n.encoding=f.Encodings.NONE_CHAR,n.mimetype=f.MimeTypes.JSON_CHAR,n.payload=JSON.stringify(e);var r={trackMessageLength:!0,data:this.encoder.encode(n)};this.socket.push(r)},i.prototype.onMessage=function(e){var t=this.decoder.decode(e);if(this.events.fire("sequence",t.sequencenumber),t.encoding===f.Encodings.NONE_CHAR)if(t.mimetype===f.MimeTypes.JSON_CHAR){var n=null;try{n=JSON.parse(t.payload)}catch(r){return void this.log.error(r)}n.__id=t.id,this.events.fire("message",n)}else this.log.debug("Unhandled mimetype: "+t.mimeType+" - "+t.payload);else this.log.debug("Unhandled encoding: "+t.encoding+" - "+t.payload)},i.prototype.on=function(e,t){return this.events.on(e,t)},i}();g["default"]=E}).call(this,_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],_("timers").setImmediate,_("timers").clearImmediate,"/lib/transmission/SMessageTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../SMessage.js":5,"../UShortId.js":9,"../formatting.js":13,"../message.js":17,_process:131,buffer:121,timers:152}],115:[function(e,t,d){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";d.__esModule=!0;d.forEachPartition=function(e,t,n){if(e)for(var r=0;r<e.length;r+=t){n(e.slice(r,r+t))}};var f=d.indexOf=function(e,t){for(var n=e.length,r=0;r<n;++r)if(t===e[r])return r;return-1};d.removeFromArray=function(e){for(var t,n,r=arguments.length<=1?0:arguments.length-1;0<r&&e.length;){var i;for(i=1+--r,t=arguments.length<=i?undefined:arguments[i];-1!==(n=f(e,t));)e.splice(n,1)}return e},d.asciiStringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/utils.js","/lib")},{_process:131,buffer:121,timers:152}],116:[function(e,f,t){(function(e,t,n,r,i,o,s,a,u,l,c){f.exports=function(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/node_modules/array-equal/index.js","/node_modules/array-equal")},{_process:131,buffer:121,timers:152}],117:[function(e,t,T){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";T.byteLength=function(e){var t=_(e),n=t[0],r=t[1];return 3*(n+r)/4-r},T.toByteArray=function(e){for(var t,n=_(e),r=n[0],i=n[1],o=new p((l=r,c=i,3*(l+c)/4-c)),s=0,a=0<i?r-4:r,u=0;u<a;u+=4)t=d[e.charCodeAt(u)]<<18|d[e.charCodeAt(u+1)]<<12|d[e.charCodeAt(u+2)]<<6|d[e.charCodeAt(u+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=255&t;var l,c;2===i&&(t=d[e.charCodeAt(u)]<<2|d[e.charCodeAt(u+1)]>>4,o[s++]=255&t);1===i&&(t=d[e.charCodeAt(u)]<<10|d[e.charCodeAt(u+1)]<<4|d[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},T.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],o=0,s=n-r;o<s;o+=16383)i.push(g(e,o,s<o+16383?s:o+16383));1===r?(t=e[n-1],i.push(f[t>>2]+f[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"="));return i.join("")};for(var f=[],d=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,E=h.length;m<E;++m)f[m]=h[m],d[h.charCodeAt(m)]=m;function _(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function g(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(f[(i=r)>>18&63]+f[i>>12&63]+f[i>>6&63]+f[63&i]);return o.join("")}d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/node_modules/base64-js/index.js","/node_modules/base64-js")},{_process:131,buffer:121,timers:152}],118:[function(e,f,t){(function(e,t,n,r,i,o,s,a,u,l,c){!function(t){"use strict";
47
+ (function(){var T,r,E,l,o={}.hasOwnProperty,s=[].slice;T={LF:"\n",NULL:"\0"},E=function(){var s;function g(e,t,n){this.command=e,this.headers=null!=t?t:{},this.body=null!=n?n:""}return g.prototype.toString=function(){var e,t,n,r,i;for(t in(n=!(e=[this.command])===this.headers["content-length"])&&delete this.headers["content-length"],i=this.headers)o.call(i,t)&&(r=i[t],e.push(t+":"+r));return this.body&&!n&&e.push("content-length:"+g.sizeOfUTF8(this.body)),e.push(T.LF+this.body),e.join(T.LF)},g.sizeOfUTF8=function(e){return e?encodeURI(e).match(/%..|./g).length:0},s=function(e){var t,n,r,i,o,s,a,u,l,c,f,d,p,h,m,E,_;for(i=e.search(RegExp(""+T.LF+T.LF)),r=(o=e.substring(0,i).split(T.LF)).shift(),s={},d=function(e){return e.replace(/^\s+|\s+$/g,"")},p=0,m=(E=o.reverse()).length;p<m;p++)u=(c=E[p]).indexOf(":"),s[d(c.substring(0,u))]=d(c.substring(u+1));if(t="",f=i+2,s["content-length"])l=parseInt(s["content-length"]),t=(""+e).substring(f,f+l);else for(n=null,a=h=f,_=e.length;(f<=_?h<_:_<h)&&(n=e.charAt(a))!==T.NULL;a=f<=_?++h:--h)t+=n;return new g(r,s,t)},g.unmarshall=function(i){var o;return function(){var e,t,n,r;for(r=[],e=0,t=(n=i.split(RegExp(""+T.NULL+T.LF+"*"))).length;e<t;e++)0<(null!=(o=n[e])?o.length:void 0)&&r.push(s(o));return r}()},g.marshall=function(e,t,n){return new g(e,t,n).toString()+T.NULL},g}(),r=function(){var m;function e(e){this.ws=e,this.ws.binaryType="arraybuffer",this.counter=0,this.connected=!1,this.heartbeat={outgoing:1e4,incoming:1e4},this.maxWebSocketFrameSize=16384,this.subscriptions={}}return e.prototype.debug=function(e){var t;return"undefined"!=typeof window&&null!==window&&null!=(t=window.console)?t.log(e):void 0},m=function(){return Date.now?Date.now():(new Date).valueOf},e.prototype._transmit=function(e,t,n){var r;for(r=E.marshall(e,t,n),"function"==typeof this.debug&&this.debug(">>> "+r);;){if(!(r.length>this.maxWebSocketFrameSize))return this.ws.send(r);this.ws.send(r.substring(0,this.maxWebSocketFrameSize)),r=r.substring(this.maxWebSocketFrameSize),"function"==typeof this.debug&&this.debug("remaining = "+r.length)}},e.prototype._setupHeartbeat=function(i){var e,t,n,o,r,s,a,u;if((r=i.version)===l.VERSIONS.V1_1||r===l.VERSIONS.V1_2)return t=(s=function(){var e,t,n,r;for(r=[],e=0,t=(n=i["heart-beat"].split(",")).length;e<t;e++)o=n[e],r.push(parseInt(o));return r}())[0],e=s[1],0!==this.heartbeat.outgoing&&0!==e&&(n=Math.max(this.heartbeat.outgoing,e),"function"==typeof this.debug&&this.debug("send PING every "+n+"ms"),this.pinger=l.setInterval(n,(a=this,function(){return a.ws.send(T.LF),"function"==typeof a.debug?a.debug(">>> PING"):void 0}))),0!==this.heartbeat.incoming&&0!==t?(n=Math.max(this.heartbeat.incoming,t),"function"==typeof this.debug&&this.debug("check PONG every "+n+"ms"),this.ponger=l.setInterval(n,(u=this,function(){var e;if(e=m()-u.serverActivity,2*n<e)return"function"==typeof u.debug&&u.debug("did not receive server activity for the last "+e+"ms"),u.ws.close()}))):void 0},e.prototype._parseConnect=function(){var e,t,n,r;switch(r={},(e=1<=arguments.length?s.call(arguments,0):[]).length){case 2:r=e[0],t=e[1];break;case 3:e[1]instanceof Function?(r=e[0],t=e[1],n=e[2]):(r.login=e[0],r.passcode=e[1],t=e[2]);break;case 4:r.login=e[0],r.passcode=e[1],t=e[2],n=e[3];break;default:r.login=e[0],r.passcode=e[1],t=e[2],n=e[3],r.host=e[4]}return[r,t,n]},e.prototype.connect=function(){var e,p,t,n,h,r,i;return e=1<=arguments.length?s.call(arguments,0):[],n=this._parseConnect.apply(this,e),t=n[0],this.connectCallback=n[1],p=n[2],"function"==typeof this.debug&&this.debug("Opening Web Socket..."),this.ws.onmessage=(h=this,function(e){var r,i,t,n,o,s,a,u,l,c,f,d;if(n="undefined"!=typeof ArrayBuffer&&e.data instanceof ArrayBuffer?(r=new Uint8Array(e.data),"function"==typeof h.debug&&h.debug("--- got data length: "+r.length),function(){var e,t,n;for(n=[],e=0,t=r.length;e<t;e++)i=r[e],n.push(String.fromCharCode(i));return n}().join("")):e.data,h.serverActivity=m(),n!==T.LF){for("function"==typeof h.debug&&h.debug("<<< "+n),d=[],l=0,c=(f=E.unmarshall(n)).length;l<c;l++)switch((o=f[l]).command){case"CONNECTED":"function"==typeof h.debug&&h.debug("connected to server "+o.headers.server),h.connected=!0,h._setupHeartbeat(o.headers),d.push("function"==typeof h.connectCallback?h.connectCallback(o):void 0);break;case"MESSAGE":u=o.headers.subscription,(a=h.subscriptions[u]||h.onreceive)?(t=h,s=o.headers["message-id"],o.ack=function(e){return null==e&&(e={}),t.ack(s,u,e)},o.nack=function(e){return null==e&&(e={}),t.nack(s,u,e)},d.push(a(o))):d.push("function"==typeof h.debug?h.debug("Unhandled received MESSAGE: "+o):void 0);break;case"RECEIPT":d.push("function"==typeof h.onreceipt?h.onreceipt(o):void 0);break;case"ERROR":d.push("function"==typeof p?p(o):void 0);break;default:d.push("function"==typeof h.debug?h.debug("Unhandled frame: "+o):void 0)}return d}"function"==typeof h.debug&&h.debug("<<< PONG")}),this.ws.onclose=(r=this,function(){var e;return e="Whoops! Lost connection to "+r.ws.url,"function"==typeof r.debug&&r.debug(e),r._cleanUp(),"function"==typeof p?p(e):void 0}),this.ws.onopen=(i=this,function(){return"function"==typeof i.debug&&i.debug("Web Socket Opened..."),t["accept-version"]=l.VERSIONS.supportedVersions(),t["heart-beat"]=[i.heartbeat.outgoing,i.heartbeat.incoming].join(","),i._transmit("CONNECT",t)})},e.prototype.disconnect=function(e,t){return null==t&&(t={}),this._transmit("DISCONNECT",t),this.ws.onclose=null,this.ws.close(),this._cleanUp(),"function"==typeof e?e():void 0},e.prototype._cleanUp=function(){if(this.connected=!1,this.pinger&&l.clearInterval(this.pinger),this.ponger)return l.clearInterval(this.ponger)},e.prototype.sendCustomFrame=function(e,t,n,r){return null==n&&(n={}),null==r&&(r=""),n.destination=e,this._transmit(t,n,r)},e.prototype.send=function(e,t,n){return null==t&&(t={}),null==n&&(n=""),t.destination=e,this._transmit("SEND",t,n)},e.prototype.subscribe=function(e,t,n){var r;return null==n&&(n={}),n.id||(n.id="sub-"+this.counter++),n.destination=e,this.subscriptions[n.id]=t,this._transmit("SUBSCRIBE",n),r=this,{id:n.id,unsubscribe:function(){return r.unsubscribe(n.id)}}},e.prototype.unsubscribe=function(e){return delete this.subscriptions[e],this._transmit("UNSUBSCRIBE",{id:e})},e.prototype.begin=function(e){var t,n;return n=e||"tx-"+this.counter++,this._transmit("BEGIN",{transaction:n}),t=this,{id:n,commit:function(){return t.commit(n)},abort:function(){return t.abort(n)}}},e.prototype.commit=function(e){return this._transmit("COMMIT",{transaction:e})},e.prototype.abort=function(e){return this._transmit("ABORT",{transaction:e})},e.prototype.ack=function(e,t,n){return null==n&&(n={}),n["message-id"]=e,n.subscription=t,this._transmit("ACK",n)},e.prototype.nack=function(e,t,n){return null==n&&(n={}),n["message-id"]=e,n.subscription=t,this._transmit("NACK",n)},e}(),l={VERSIONS:{V1_0:"1.0",V1_1:"1.1",V1_2:"1.2",supportedVersions:function(){return"1.1,1.0"}},client:function(e,t){var n;return null==t&&(t=["v10.stomp","v11.stomp"]),n=new(l.WebSocketClass||WebSocket)(e,t),new r(n)},over:function(e){return new r(e)},Frame:E},null!=f&&(f.Stomp=l),"undefined"!=typeof window&&null!==window?(l.setInterval=function(e,t){return window.setInterval(t,e)},l.clearInterval=function(e){return window.clearInterval(e)},window.Stomp=l):f||(self.Stomp=l)}).call(undefined)}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/stomp.js/lib/stomp.js","/lib/stomp.js/lib")},{_process:131,buffer:121,timers:152}],105:[function(_,e,g){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";g.__esModule=!0;var f=_("../logging.js"),d=m(_("../EventSupport.js")),p=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}}(_("../streamer-events.js")),h=m(_("../http.js"));function m(e){return e&&e.__esModule?e:{"default":e}}var E=function(){function o(e,t,n){var r=3<arguments.length&&arguments[3]!==undefined?arguments[3]:3,i=arguments[4];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.openSocket=t,this.createTransmitter=e,this.log=(0,f.asLogger)(n),this.events=new d["default"](this),this.currentConn="",this.maxReconnectAttempts=r,this.maxReconnectsTotal=3,this.isFirstConnection=!0,this.pingUrl=i}return o.prototype.open=function(){var i=this,e={send:function(e){return i.socket.send(e)},sendCustomFrame:function(e,t,n,r){return i.socket.sendCustomFrame(e,t,n,r)}};this.isFirstConnection&&(this.on("reopen",function(e){var t=i.currentConn;i.currentConn=e.connectionId,i.events.fire("reconnect",p.event("Reconnection success",{previousConnectionId:t,currentConnectionId:i.currentConn}))}),this.transmitter=this.createTransmitter(e),this.transmitter.on("message",function(e){i.events.fire("message",e)})),this.socket=this.openSocket(function(e){return i.request=e,i.reconnect=!1,{onOpen:function(e){if("CONNECTED"===e.command){i.isConnectionUp=!0;var t=p.event("open",{connectionId:e.headers["user-name"]});i.log.info(t),i.events.fire("open",t),i.isFirstConnection||(i.maxReconnectsTotal--,i.events.fire("reopen",t)),i.currentConn=e.headers["user-name"]}},onError:function(e){i.isConnectionUp=!1,i.isServerUp(function(e,t){null!==e?(i.reconnect=!1,i.log.warn("Connection lost, Streamer Server isn't Up")):(i.reconnect=!0,i.log.warn("Connection lost, Streamer Server is Up"))})},onClose:function(){i.isConnectionUp=!1},onMessage:function(e){var t=JSON.parse(e.body);t.code!==undefined&&(401!=t.code&&403!=t.code||(i.log.info("Unable to reconnect with code: "+t.code+", reason: "+t.reason),i.reconnect=!1,i.isConnectionUp=!1)),i.transmitter.onMessage(e.body)}}},this.currentConn)},o.prototype.close=function(){if(this.socket)try{this.socket.close(),this.socket=null,this.reconnect&&this.tryReopen()}catch(e){this.events.fire("error",p.error("Error closing",{reason:e.message,cause:e,code:-3}))}},o.prototype.tryReopen=function(){var t=this;if(this.isConnectionUp||this.maxReconnectsTotal<=0)this.log.error("Connection is already open or max reconnects was reached, won't try to reconnect");else{this.isFirstConnection=!1;var n=this.maxReconnectAttempts;setTimeout(function e(){if(n<=0)return t.reconnect=!1,t.log.error("Error while reconnecting. No attempts left."),void(t.maxReconnectAttempts=0);!t.isConnectionUp&&t.reconnect&&(t.log.info("Attempting reconnect. Attempts left: "+n),t.reopen(n),n--,setTimeout(e,500))},500)}},o.prototype.reopen=function(e){try{this.open()}catch(t){this.log.warn("There was an error while reopening attempt #"+e),this.events.fire("error",t)}},o.prototype.send=function(e){try{this.transmitter.send(e)}catch(t){this.events.fire("error",p.error("Error sending message",{reason:t.message,cause:t,code:-4}))}},o.prototype.sendCustomFrame=function(e,t,n,r){try{this.transmitter.sendCustomFrame(e,t,n,r)}catch(i){this.events.fire("error",p.error("Error sending custom frame message",{reason:i.message,cause:i,code:-4}))}},o.prototype.isReconnect=function(){return this.request["x-Stream-isReconnect"]},o.prototype.setReconnect=function(e){this.reconnect=e},o.prototype.setServer=function(e){this.request["X-Stream-Instance"]=e},o.prototype.isClosed=function(){return null==this.socket},o.prototype.isServerUp=function(t){(0,h["default"])({url:this.pingUrl,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.setConnectionUp=function(e){this.isConnectionUp=e},o.prototype.on=function(e,t){return this.events.on(e,t)},o}();g["default"]=E}).call(this,_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],_("timers").setImmediate,_("timers").clearImmediate,"/lib/stomp/StompConnection.js","/lib/stomp")},{"../EventSupport.js":2,"../http.js":14,"../logging.js":16,"../streamer-events.js":109,_process:131,buffer:121,timers:152}],106:[function(T,e,b){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";b.__esModule=!0,T("../polyfills.js");var f=T("../streamer-api.js"),d=T("../streamer-utils.js"),p=T("../logging.js"),O=T("../utils.js"),h=_(T("../UShortId.js")),m=_(T("../EventSupport.js")),E=T("../formatting.js"),w=function(e){{if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t["default"]=e,t}}(T("../streamer-events.js"));function _(e){return e&&e.__esModule?e:{"default":e}}var g=function(){function i(e,t,n){var r=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.events=new m["default"],this.streamingService=e,this.format=t,this.log=(0,p.asLogger)(n),this.conn=e.createStompConnection(),this.conn.on("message",function(e){r._handlejsonmsg(e)}).on("close",function(e){r.doClose(e)}).on("error",function(e){r.pendingConnection&&r.pendingConnection(e),r.events.fire("error",e)}).on("reconnect",function(e){r.reconnectSuccess(e)}),this.requestid=new h["default"],this.pendingsubscriptions={},this.pendingUnsubscriptions={},this.pendingExchangeSubscriptions={},this.pendingExchangeUnsubscriptions={},this.pendingNewsSubscriptions={},this.pendingNewsUnsubscriptions={},this.pendingAlertSubscription={},this.pendingTradeSubscription={},this.pendingTradeUnsubscription={},this.pendingSCFMessages={},this.pendingCorpEventSubscription={},this.on("error",function(e){r.log.warn(e)})}return i.prototype.openStomp=function(e){try{this.pendingConnection=e,this.conn.open()}catch(t){e&&e(t)}},i.prototype.reconnectSuccess=function(e){this.events.fire("reconnectSuccess",e),this.log.info("Successful reconnection. Previous Id: "+e.previousConnectionId+" Current Id = "+e.currentConnectionId)},i.prototype.on=function(e,t){return this.events.on(e,t)},i.prototype.SCFSendMessage=function(e,t,n,r,i){var o=i||(optsOrCallback&&"function"==typeof optsOrCallback?optsOrCallback:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={ids:[],callback:o},u=this.requestid.next(),l=void 0;if(r&&""!==r){try{l=JSON.parse(r)}catch(c){return this.log.info("Error parsing message content: "+c.message),void o(null,null)}a.dataTypes=l["@T"],a.action=l.action,l.id=u}a.ids.push(u),this.pendingSCFMessages[u]=a,this.sendCustomFrame(e,t,n,l)},i.prototype.subscribe=function(e,t,n,r){var i=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()}),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=n&&"function"!=typeof n?n:null,s=r||(n&&"function"==typeof n?n:null);if(this.isClosed()){var a=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",a),void(s&&s(a))}var u={ids:[],types:t,mimetype:this.format,callback:s,result:{subscribed:[],rejected:[],unentitled:[],invalidSymbols:[],messageFilters:[]}};0!==e.length&&0!==t.length?this._prepareSubscriptionRequests(e,u,f.messages.control.Action.SUBSCRIBE,o).forEach(function(e){var t=i.requestid.next();u.ids.push(t),i.pendingsubscriptions[t]=u,e.id=t,i.send(e)}):s(null,u.result)},i.prototype.subscribeExchange=function(e,t,n){var r=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()});var i=t&&"function"!=typeof t?t:null,o=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={callback:o,mimetype:this.format,id:[],result:{subscribed:[],rejected:[]}};0===e.length&&o(null,a.result),this.prepareExchangeSubscriptionRequest(e,a,f.messages.control.Action.SUBSCRIBE,i).forEach(function(e){var t=r.requestid.next();a.id.push(t),a.exchange=e.exchange,a.conflation=e.conflation,r.pendingExchangeSubscriptions[t]=a,e.id=t,r.send(e)})},i.prototype.openNews=function(e,t){if("function"==typeof e&&(t=e,e=null),this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r=new f.messages.control.NewsSubscribeMessage;r.newsAction=f.messages.control.NewsAction.NEWS_OPEN,r.newsClientId=e||null,r.mimetype=this.format;var i=this.requestid.next();this.pendingNewsSubscriptions[i]={callback:t,result:{newsClientId:null}},r.id=i,this.send(r)},i.prototype.subscribeNews=function(e,t,n,r,i){if(this.isClosed()){var o=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",o),void(i&&i(o))}""!==t&&t!=undefined&&null!==t||(t=crypto.randomUUID(),console.log("News FilterId Created: ",t));var s={callback:i,mimetype:this.format,id:[],result:{newsFilters:[],rejectedNewsFilters:[],unentitledNewsFilters:[],filterId:t,newsClientId:null}};if(0!==e.length){var a=this.buildNewsSubscribeRequest(e,t,s,n,r,f.messages.control.NewsAction.NEWS_FLT_ADD),u=this.requestid.next();this.pendingNewsSubscriptions[u]=s,a.id=u,this.send(a)}else i(null,s.result)},i.prototype.fltUpdateNews=function(e,t,n){if(this.isClosed()){var r=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",r),void(n&&n(r))}var i={callback:n,mimetype:this.format,id:[],result:{newsFilters:[],rejectedNewsFilters:[],unentitledNewsFilters:[],filterId:t}},o=this.buildNewsSubscribeRequest(e,t,i,null,null,f.messages.control.NewsAction.NEWS_FLT_UPDATE),s=this.requestid.next();this.pendingNewsSubscriptions[s]=i,o.id=s,this.send(o)},i.prototype.fltDeleteNews=function(e,t){if(this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r={callback:t,mimetype:this.format},i=this.buildNewsSubscribeRequest(null,e,r,null,null,f.messages.control.NewsAction.NEWS_FLT_DELETE);this.send(i)},i.prototype.fltGetNews=function(e){if(this.isClosed()){var t=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",t),void(e&&e(t))}var n={callback:e,mimetype:this.format},r=this.buildNewsCommandRequest(n,f.messages.control.NewsAction.NEWS_FLT_GET);this.send(r)},i.prototype.fltMockBasicNews=function(e){if(this.isClosed()){var t=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",t),void(e&&e(t))}var n={callback:e,mimetype:this.format},r=this.buildNewsCommandRequest(n,f.messages.control.NewsAction.NEWS_FLT_MOCK_BASIC);this.send(r)},i.prototype.subscribeCorpEvents=function(e,t,n,r,i){e&&(e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()})),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=i||(r&&"function"==typeof r?r:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",s)}else{var a={id:[],symbols:e,corpEventTypes:t,allCorpEvents:n,mimeType:this.format,callback:o,result:{subscribed:[],unsubscribed:[],invalid:[]}};0===t.length&&o(null,a.result);var u=this.buildCorpEventRequest(e,a,f.messages.control.Action.SUBSCRIBE),l=this.requestid.next();a.id.push(l),this.pendingCorpEventSubscription[l]=a,u.id=l,this.send(u)}},i.prototype.subUnsubAlerts=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{operation:""}},s=this.buildAlertsSubUnsubRequest(e,o),a=this.requestid.next();o.id.push(a),this.pendingAlertSubscription[a]=o,s.id=a,this.send(s)}},i.prototype.subscribeTrade=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{notificationType:""}},s=this.buildTradeSubscribeRequest(e,o,f.messages.control.Action.SUBSCRIBE),a=this.requestid.next();o.id.push(a),this.pendingTradeSubscription[a]=o,s.id=a,this.send(s)}},i.prototype.getSessionStats=function(){if(this.isClosed()){var e=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",e)}else{var t=new f.messages.control.StatsMessage;this.send(t)}},i.prototype.updateOAuthToken=function(e,t,n){var r=n||(optsOrCallback&&"function"==typeof optsOrCallback?optsOrCallback:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={mimetype:this.format,callback:r},s=this.buildUpdateAuthTokenRequest("oauth",e,t,o),a=this.requestid.next();s.id=a,this.send(s)}},i.prototype.unsubscribe=function(e,t,n,r){var i=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()}),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=n&&"function"!=typeof n?n:null,s=r||(n&&"function"==typeof n?n:null);if(this.isClosed()){var a=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",a),void(s&&s(a))}var u={ids:[],types:t,mimetype:this.format,callback:s,result:{unsubscribed:[]}};0!==e.length&&0!==t.length||s&&s(null,u.result),this._prepareSubscriptionRequests(e,u,f.messages.control.Action.UNSUBSCRIBE,o).forEach(function(e){var t=i.requestid.next();u.ids.push(t),i.pendingUnsubscriptions[t]=u,e.id=t,i.send(e)})},i.prototype.unsubscribeExchange=function(e,t,n){var r=this;e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()});var i=t&&"function"!=typeof t?t:null,o=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",s),void(o&&o(s))}var a={callback:o,mimetype:this.format,id:[],result:{subscribed:[],rejected:[]}};0===e.length&&o(null,a.result),this.prepareExchangeSubscriptionRequest(e,a,f.messages.control.Action.UNSUBSCRIBE,i).forEach(function(e){var t=r.requestid.next();a.id.push(t),a.exchange=e.exchange,a.conflation=e.conflation,r.pendingExchangeUnsubscriptions[t]=a,e.id=t,r.send(e)})},i.prototype.unsubscribeNews=function(e,t){if(this.isClosed()){var n=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(t&&t(n))}var r={callback:t,mimetype:this.format,id:[],result:{unsubscribed:[]}},i=this.buildNewsSubscribeRequest(null,e,r,null,null,f.messages.control.NewsAction.NEWS_FLT_DELETE),o=this.requestid.next();r.id.push(o),this.pendingNewsUnsubscriptions[o]=r,i.id=o,this.send(i)},i.prototype.unsubscribeCorpEvents=function(e,t,n,r,i){e&&(e=(Array.isArray(e)?e:[e]).map(function(e){return e.toUpperCase()})),t=Array.isArray(t)?t:[t].map(function(e){return e.toUpperCase()});var o=i||(r&&"function"==typeof r?r:null);if(this.isClosed()){var s=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",s)}else{var a={id:[],symbols:e,corpEventTypes:t,allCorpEvents:n,mimeType:this.format,callback:o,result:{subscribed:[],unsubscribed:[],invalid:[]}};0===t.length&&o(null,a.result);var u=this.buildCorpEventRequest(e,a,f.messages.control.Action.UNSUBSCRIBE),l=this.requestid.next();a.id.push(l),this.pendingCorpEventSubscription[l]=a,u.id=l,this.send(u)}},i.prototype.unsubscribeTrade=function(e,t,n){var r=n||(t&&"function"==typeof t?t:null);if(this.isClosed()){var i=w.error("Stream is disconnected",{code:-1,reason:"Already disconnected"});this.events.fire("error",i)}else{var o={id:[],mimetype:this.format,callback:r,result:{notificationType:""}},s=this.buildTradeSubscribeRequest(e,o,f.messages.control.Action.UNSUBSCRIBE),a=this.requestid.next();o.id.push(a),this.pendingTradeUnsubscription[a]=o,s.id=a,this.send(s)}},i.prototype._handlejsonmsg=function(e){(0,d.iscontrolmessage)(e)&&e.__id in this.pendingSCFMessages?this.SCFHandlectrlmsg(e):(0,d.iscontrolmessage)(e)?this.handlectrlmsg(e):(0,d.isdatamessage)(e)?this._handledatamsg(e):this.events.fire("error",e)},i.prototype._prepareSubscriptionRequests=function(e,t,n,r){for(var i=0,o=-1,s=e.length,a=t.types.includes("ORDERBOOK"),u=[],l=0;l<s;l++)((i=this._getUpdatedNumberOfEntitlements(t.types.length,i,e[l],a))>=this.maxEntitlementsPerSubscription||l===s-1)&&(u.push(this._buildRequest(e.slice(o+1,l+1),t,n,r)),o=l,i=0);return u},i.prototype._buildRequest=function(e,t,n,r){var i=new f.messages.control.SubscribeMessage;return i.action=n,i.symbols=e,i.types=t.types,i.mimetype=t.mimetype,r&&r.skipHeavyInitialLoad&&(i.skipHeavyInitialLoad=!0),r&&(i.conflation=r.conflation,i.intervalPeriod=r.intervalPeriod),i},i.prototype.prepareExchangeSubscriptionRequest=function(e,t,n,r){for(var i=[],o=e.length,s=0;s<o;s++)i.push(this.buildExchangeRequest(e[s],t,n,r));return i},i.prototype.buildExchangeRequest=function(e,t,n,r){var i=new f.messages.control.ExchangeSubscribeMessage;return i.action=n,i.exchange=e,i.mimetype=t.mimetype,r&&(i.conflation=r.conflation),i},i.prototype.buildNewsSubscribeRequest=function(e,t,n,r,i,o){var s=new f.messages.control.NewsSubscribeMessage;return s.newsAction=o,s.newsFilters=e,s.filterId=t,s.skipHeavyInitialLoad=r,s.mimetype=n.mimetype,s.newsClientId=i||null,s},i.prototype.buildCorpEventRequest=function(e,t,n){var r=new f.messages.control.CorpEventSubscribeMessage;return r.symbols=e,r.action=n,r.corpEventTypes=t.corpEventTypes,r.allCorpEvents=t.allCorpEvents,r.mimeType=t.mimeType,r},i.prototype.buildAlertsSubUnsubRequest=function(e,t){var n=new f.messages.control.AlertsSubUnsubMessage;return n.operation=e,n.mimetype=t.mimetype,n},i.prototype.buildTradeSubscribeRequest=function(e,t,n){var r=new f.messages.control.TradeSubscribeMessage;return r.action=n,r.notificationType=e,r.mimetype=t.mimetype,r},i.prototype.buildUpdateAuthTokenRequest=function(e,t,n,r){var i=new f.messages.control.AuthTokenMessage;return i.authMethod=e,i.authParams={oauthToken:t,previousToken:n},i.mimetype=r.mimetype,i},i.prototype.buildNewsCommandRequest=function(e,t){var n=new f.messages.control.NewsCommandMessage;return n.newsAction=t,n.mimetype=e.mimetype,n},i.prototype._getUpdatedNumberOfEntitlements=function(e,t,n,r){var i=t;return r&&n.endsWith(":CC")?i+=14*e:i+=e,i},i.prototype.handlectrlmsg=function(e){switch(this.log.debug(E.msgfmt.fmt(e)),(0,d.messagetype)(e)){case f.messages.MessageTypeNames.ctrl.HEARTBEAT:this.onHeartbeat(e);break;case f.messages.MessageTypeNames.ctrl.SUBSCRIBE_RESPONSE:this.onSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.EXCHANGE_RESPONSE:this.onExchangeSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.ALERTS_SUBUNSUB_RESPONSE:this.onAlertsSubUnsubResponse(e);break;case f.messages.MessageTypeNames.ctrl.TRADE_SUBSCRIBE_RESPONSE:this.onTradeSubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.UNSUBSCRIBE_RESPONSE:this.onUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.EXCHANGE_UNSUBSCRIBE_RESPONSE:this.onExchangeUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_OPEN_RESPONSE:this.onNewsOpenResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_ADD_RESPONSE:this.onNewsFltAddResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_UPDATE_RESPONSE:this.onNewsFltUpdateMessage(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_DELETE_RESPONSE:this.onNewsFltDeleteResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FLT_GET_RESPONSE:this.onNewsFltGetResponse(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_FILTER_MESSAGE:this.onNewsFilterRemoteMessage(e);break;case f.messages.MessageTypeNames.ctrl.NEWS_ERROR_MESSAGE:this.onNewsErrorRemoteMessage(e);break;case f.messages.MessageTypeNames.ctrl.CORP_EVENT_RESPONSE:this.onCorpEventResponse(e);break;case f.messages.MessageTypeNames.ctrl.TRADE_UNSUBSCRIBE_RESPONSE:this.onTradeUnsubscribeResponse(e);break;case f.messages.MessageTypeNames.ctrl.CONNECT_RESPONSE:this.onConnectResponse(e);break;case f.messages.MessageTypeNames.ctrl.CONNECTION_CLOSE:this.onConnectionClose(e);break;case f.messages.MessageTypeNames.ctrl.SLOW_CONNECTION:this.onSlowConnection(e);break;case f.messages.MessageTypeNames.ctrl.STATS_RESPONSE:this.onStatsResponse(e);break;case f.messages.MessageTypeNames.ctrl.INITIAL_DATA_SENT:this.onInitialDataSent(e);break;case f.messages.MessageTypeNames.ctrl.RESUBSCRIBE_MESSAGE:this.onResubscribeMessage(e);break;case f.messages.MessageTypeNames.ctrl.OPEN_FLOW:this.onOpenFlow(e);break;case f.messages.MessageTypeNames.ctrl.RECONNECT_RESPONSE:this.onReconnectMessage(e);break;case f.messages.MessageTypeNames.ctrl.MISSED_DATA_SENT:this.onMissedDataSent(e);break;case f.messages.MessageTypeNames.ctrl.AUTH_TOKEN_RESPONSE:this.onAuthTokenResponse(e)}},i.prototype.SCFHandlectrlmsg=function(e){this.log.debug(E.msgfmt.fmt(e));var t=this.pendingSCFMessages[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingSCFMessages[e.__id],200!=e.code){var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.ids.length&&n&&n(null,t)},i.prototype.onHeartbeat=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("heartbeat",e)},i.prototype.onSubscribeResponse=function(e){var t=this.pendingsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingsubscriptions[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;if(e.entitlements){var o=e.entitlements,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u,c=l,f=c.symbol,d=c.marketdatatype,p=c.entitlement;l={symbol:f,type:d},"NA"!==p?(this.log.debug("SUBSCRIBED <"+f+", "+d+">"),l.entitlement=p,i.subscribed.push(l)):(this.log.warn("NOT ENTITLED <"+f+","+d+">"),i.unentitled.push(l))}}if(e.rejectedSymbols){var h=e.rejectedSymbols,m=Array.isArray(h),E=0;for(h=m?h:h[Symbol.iterator]();;){var _;if(m){if(E>=h.length)break;_=h[E++]}else{if((E=h.next()).done)break;_=E.value}f=_;this.log.warn("REJECTED "+f),i.rejected.push(f)}}if(e.invalidSymbols){var g=e.invalidSymbols,T=Array.isArray(g),b=0;for(g=T?g:g[Symbol.iterator]();;){var y,S;if(T){if(b>=g.length)break;S=g[b++]}else{if((b=g.next()).done)break;S=b.value}var v=S;this.log.warn("INVALID SYMBOL "+v),(y=i.invalidSymbols).push.apply(y,e.invalidSymbols)}}0!==t.ids.length||t.failed||n&&n(null,t.result)},i.prototype.onExchangeSubscribeResponse=function(e){var t=this.pendingExchangeSubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingExchangeSubscriptions[e.__id],200!=e.code){var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.id.length&&n&&n(null,t)},i.prototype.onCorpEventResponse=function(e){var t=this.pendingCorpEventSubscription[e.__id],n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingCorpEventSubscription[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error subscribing to Corporate Events",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.subscribed){var o=e.subscribed,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.subscribed.push(l)}}if(e.unsubscribed){var c=e.unsubscribed,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.unsubscribed.push(h)}}if(e.invalid){var m=e.invalid,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.invalid.push(T)}}0===t.id.length&&n&&n(null,t.result)},i.prototype.onAlertsSubUnsubResponse=function(e){var t=this.pendingAlertSubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingAlertSubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.operation&&(this.log.debug("Alerts "+e.operation),i.operation=e.operation),0===t.id.length&&n&&n(null,t.result)},i.prototype.onTradeSubscribeResponse=function(e){var t=this.pendingTradeSubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingTradeSubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error subscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.notificationType&&(this.log.debug("Trade "+e.notificationType),i.notificationType=e.notificationType),0===t.id.length&&n&&n(null,t.result)},i.prototype.onNewsOpenResponse=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error opening news connection",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&n(i))}r.newsClientId=e.newsClientId,n&&n(null,r)}},i.prototype.onNewsFltAddResponse=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error subscribing to news",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.newsFilters){var o=e.newsFilters,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.newsFilters.push(l)}}if(e.rejectedNewsFilters){var c=e.rejectedNewsFilters,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.rejectedNewsFilters.push(h)}}if(e.unentitledNewsFilters){var m=e.unentitledNewsFilters,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.unentitledNewsFilters.push(T)}}e.filterId&&(r.filterId=e.filterId),e.newsClientId&&(r.newsClientId=e.newsClientId),0===t.id.length&&n&&n(null,t.result)}},i.prototype.onNewsFltUpdateMessage=function(e){var t=this.pendingNewsSubscriptions[e.__id];if(t){var n=t.callback;(0,O.removeFromArray)(t.id,e.__id),delete this.pendingNewsSubscriptions[e.__id];var r=t.result;if(200!=e.code){var i=w.error("Error updating news filters",{code:e.code,reason:e.reason});return this.events.fire("error",i),void(n&&t.callback(i))}if(e.newsFilters){var o=e.newsFilters,s=Array.isArray(o),a=0;for(o=s?o:o[Symbol.iterator]();;){var u;if(s){if(a>=o.length)break;u=o[a++]}else{if((a=o.next()).done)break;u=a.value}var l=u;r.newsFilters.push(l)}}if(e.rejectedNewsFilters){var c=e.rejectedNewsFilters,f=Array.isArray(c),d=0;for(c=f?c:c[Symbol.iterator]();;){var p;if(f){if(d>=c.length)break;p=c[d++]}else{if((d=c.next()).done)break;p=d.value}var h=p;r.rejectedNewsFilters.push(h)}}if(e.unentitledNewsFilters){var m=e.unentitledNewsFilters,E=Array.isArray(m),_=0;for(m=E?m:m[Symbol.iterator]();;){var g;if(E){if(_>=m.length)break;g=m[_++]}else{if((_=m.next()).done)break;g=_.value}var T=g;r.unentitledNewsFilters.push(T)}}e.filterId&&(r.filterId=e.filterId),0===t.id.length&&n&&n(null,t.result)}},i.prototype.onNewsFltDeleteResponse=function(e){if(console.log("News_flt_delete Response",e),200==e.code)this.events.fire("filterDelete",e);else{var t=w.error("Error deleting news filter",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onNewsFltGetResponse=function(e){if(200==e.code)this.events.fire("filterStatus",e);else{var t=w.error("Error getting news filters status",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onNewsFilterRemoteMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("newsRemoteMessage",e)},i.prototype.onNewsErrorRemoteMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("newsRemoteMessage",e)},i.prototype.onTradeUnsubscribeResponse=function(e){var t=this.pendingTradeUnsubscription[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingTradeUnsubscription[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}var i=t.result;e.notificationType&&(this.log.debug("Trade "+e.notificationType),i.notificationType=e.notificationType),0===t.id.length&&n&&n(null,t.result)},i.prototype.onUnsubscribeResponse=function(e){var t=this.pendingUnsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.ids,e.__id),delete this.pendingUnsubscriptions[e.__id],200!=e.code&&!t.failed){t.failed=!0;var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&n(r))}for(var i=0;i<e.unsubscribed.length;++i){var o=t.result,s=e.unsubscribed[i],a=s.symbol,u=s.marketdatatype;this.log.debug("UNSUBSCRIBED <"+a+", "+u+">"),o.unsubscribed.push({symbol:a,type:u})}0!==t.ids.length||t.failed||n&&n(null,t.result)},i.prototype.onExchangeUnsubscribeResponse=function(e){var t=this.pendingExchangeUnsubscriptions[e.__id],n=t.callback;if((0,O.removeFromArray)(t.id,e.__id),delete this.pendingExchangeUnsubscriptions[e.__id],200!=e.code){var r=w.error("Error unsubscribing",{code:e.code,reason:e.reason});return this.events.fire("error",r),void(n&&t.callback(r))}0===t.id.length&&n&&n(null,t)},i.prototype.onReconnectMessage=function(e){450===e.code&&(this.events.fire("slow","Reconnection recieved a slow code: "+e.code),this._isSlowConnection=!0,this.conn.setReconnect=!1),this.events.fire("reconnectMessage",e)},i.prototype.onConnectResponse=function(e){if(200!==e.code){var t=w.error("Connection failed",{code:e.code,reason:e.reason});return this.events.fire("error",t),this.pendingConnection&&this.pendingConnection(t),void this.doClose(t)}if(this._serverversion=e.version,this.maxEntitlementsPerSubscription=e.maxEntitlementsPerSubscription,this.isClosed()){var n=w.error("Connection was already closed",{code:-1,reason:"Already disconnected"});return this.events.fire("error",n),void(this.pendingConnection&&this.pendingConnection(n))}this.conn.setServer(e.serverInstance),this.pendingConnection&&this.pendingConnection(null,this)},i.prototype.onConnectionClose=function(e){this.doClose(w.close({reason:e.reason,code:e.code}))},i.prototype.onSlowConnection=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("slow",e)},i.prototype.onStatsResponse=function(e){if(200==e.code)this.events.fire("stats",e);else{var t=w.error("Error getting stats",{code:e.code,reason:e.reason});this.events.fire("error",t)}},i.prototype.onInitialDataSent=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("initialDataSent",e)},i.prototype.onResubscribeMessage=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("resubscribeMessage",e)},i.prototype.onMissedDataSent=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("missedDataSent",e)},i.prototype.onOpenFlow=function(e){this.conn.send(e)},i.prototype.onAuthTokenResponse=function(e){this.log.debug(E.msgfmt.fmt(e)),this.events.fire("authTokenResponse",e)},i.prototype._handledatamsg=function(e){this.events.fire("message",e)},i.prototype.send=function(e){this.conn&&this.conn.send(e)},i.prototype.sendCustomFrame=function(e,t,n,r){this.conn&&this.conn.sendCustomFrame(e,t,n,r)},i.prototype.doClose=function(e){if(!this.isClosed()){var t=this.conn;this.conn=null,t.close(),this.events.fire("close",e),t.isReconnect()&&(this.events=new m["default"],this.conn=t)}},i.prototype.performReconnect=function(e){if(null!=this.conn&&this.conn.isReconnect()){if(this.conn.isConnectionUp)return void this.log.warn("Connection is not closed and won't try reconnect.");this.conn.setReconnect(!0),this.conn.tryReopen(),e&&e()}else this.log.warn("Reconnect flag is set to false")},i.prototype.close=function(e){this.doClose(w.close({reason:"Manually closed",code:200})),e&&e()},i.prototype.isClosed=function(){return null==this.conn},i}();b["default"]=g}).call(this,T("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},T("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],T("timers").setImmediate,T("timers").clearImmediate,"/lib/stomp/StompStream.js","/lib/stomp")},{"../EventSupport.js":2,"../UShortId.js":9,"../formatting.js":13,"../logging.js":16,"../polyfills.js":18,"../streamer-api.js":108,"../streamer-events.js":109,"../streamer-utils.js":110,"../utils.js":115,_process:131,buffer:121,timers:152}],107:[function(v,e,O){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";O.__esModule=!0,v("../polyfills.js");var f=v("../logging.js"),p=v("../streamer-api.js"),h=v("../message.js"),d=_(v("../transmission/JsonStompTransmitter.js")),m=_(v("./StompConnection.js")),E=_(v("./StompStream.js"));function _(e){return e&&e.__esModule?e:{"default":e}}var g="/ping/v1",T="/version/v1",b="/stream/connect",y="",S=function(){function o(e,t,n,r){var i=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,o),this.http=e,this.stompJs=t,this.log=(0,f.asLogger)(n),this.config=r||{},this.maxReconnectAttempts=this.config.maxReconnectAttempts,this.format=this.config.format,"application/json"===this.config.format&&(this.createTransmitter=function(e){return new d["default"](e,i.log)})}return o.prototype.openStompSocket=function(t,e){y="";var n={"X-Stream-Version":p.VERSION,"X-Stream-Lib":p.LIBRARY_NAME};this.addToHeaderParams("X-Stream-Version",p.VERSION),this.addToHeaderParams("X-Stream-Lib",p.LIBRARY_NAME);var r=this.config.conflation;null!=r&&""!==r&&(n["X-Stream-Conflation"]=r,this.addToHeaderParams("X-Stream-Conflation",r)),null!=e&&""!==e&&(n["X-Stream-Previous-Connection-Id"]=e,this.addToHeaderParams("X-Stream-Previous-Connection-Id",e));var i=this.config.intervalPeriod;null!=i&&""!==i&&(n["X-Stream-Interval-Period"]=i,this.addToHeaderParams("X-Stream-Interval-Period",i));var o=this.config.rejectExcessiveConnection;null!=o&&""!==o&&(n["X-Stream-Reject"]=o,this.addToHeaderParams("X-Stream-Reject",o)),"application/json"!==this.config.format&&this.config.format!==h.MimeTypes.QITCH||(n["X-Stream-Format"]=this.format,this.addToHeaderParams("X-Stream-Format",this.format)),"true"===this.config.updatesOnly&&(n["X-Stream-UpdatesOnly"]=!0,this.addToHeaderParams("X-Stream-UpdatesOnly",!0));var s=this.config.isReconnect;null!=s&&""!==s&&(n["x-Stream-isReconnect"]=s,this.addToHeaderParams("x-Stream-isReconnect",s));var a=this.config.alwaysReconnect;null!=a&&""!==a&&(n["x-Stream-isAlwaysReopen"]=a,this.addToHeaderParams("x-Stream-isAlwaysReopen",a)),"ALL"===this.config.isMissedData?(n["X-Stream-isReceiveAllMissedData"]=!0,this.addToHeaderParams("X-Stream-isReceiveAllMissedData",!0)):"LATEST"===this.config.isMissedData&&(n["X-Stream-isReceiveLatestMissedData"]=!0,this.addToHeaderParams("X-Stream-isReceiveLatestMissedData",!0));var u=this.config.stompWmid;null!=u&&(n.wmid=u,this.addToHeaderParams("wmid",u));var l=this.config.userSymbology;null!=l&&""!==l&&(n["X-Stream-User-Symbology"]=l,this.addToHeaderParams("X-Stream-User-Symbology",l)),Object.assign(n,this.config.credentials.getHeaders());var c=this.config.url+b+y,f=this.stompJs.Stomp.client(c),d=new p.messages.control.AuthenticationMessage;return this.config.credentials.sid!==undefined?(d.authenticationMethod="sid",d.authorization=this.config.credentials.sid):this.config.credentials.wmid!==undefined&&this.config.credentials.token!==undefined?(d.authenticationMethod="enterprise",d.wmid=this.config.credentials.wmid,d.authorization=this.config.credentials.token):this.config.credentials.wmid!==undefined?(d.authenticationMethod="wmid",d.authorization=this.config.credentials.wmid):this.config.credentials.data_token!==undefined?(d.authenticationMethod="datatool",d.authorization=this.config.credentials.data_token):this.config.credentials.oauth_token!==undefined&&(d.authenticationMethod="oauth",d.authorization=this.config.credentials.oauth_token),null!=this.config.conflation&&""!==this.config.conflation&&(d.conflation=this.config.conflation),null!=this.config.rejectExcessiveConnection&&""!==this.config.rejectExcessiveConnection&&(d.rejectExcessiveConnection=this.config.rejectExcessiveConnection),null!=this.config.entMax&&""!==this.config.entMax&&(d.entMax=this.config.entMax),f.connect(n,function(e){f.subscribe("/user/queue/messages",function(e){t(n).onMessage(e)}),t(n).onOpen(e),f.send("/stream/message",n,JSON.stringify(d))},function(e){t(n).onError(e)}),{send:function(e){f.send("/stream/message",n,e)},close:function(){f.disconnect(function(){t(n).onClose()})},sendCustomFrame:function(e,t,n,r){f.sendCustomFrame(e,t,n,r)}}},o.prototype.createStompConnection=function(){var n=this;return new m["default"](function(e){return n.createTransmitter(e)},function(e,t){return n.openStompSocket(e,t)},this.log,this.maxReconnectAttempts,this.config.host+g)},o.prototype.openStompStream=function(e){new E["default"](this,this.format,this.log).openStomp(e)},o.prototype.ping=function(t){this.http({url:this.config.host+g,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.getVersion=function(t){this.http({url:this.config.host+T,success:function(e){return t(null,e)},type:"GET",failure:t})},o.prototype.addToHeaderParams=function(e,t){y=""===y?y+"?"+e+"="+t:y+"&"+e+"="+t},o}();O["default"]=S}).call(this,v("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},v("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],v("timers").setImmediate,v("timers").clearImmediate,"/lib/stomp/StompStreamingService.js","/lib/stomp")},{"../logging.js":16,"../message.js":17,"../polyfills.js":18,"../streamer-api.js":108,"../transmission/JsonStompTransmitter.js":111,"./StompConnection.js":105,"./StompStream.js":106,_process:131,buffer:121,timers:152}],108:[function(e,t,d){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";d.__esModule=!0;d.LIBRARY_NAME="JavaScript",d.VERSION="2.67.0";var f=d.messages={};f.control={},f.market={},f.JSON_TYPE_PROPERTY="@T",f.MessageTypeNames={ctrl:{HEARTBEAT:"C1",SUBSCRIBE:"C2",SUBSCRIBE_RESPONSE:"C3",UNSUBSCRIBE_RESPONSE:"C4",CONNECT_RESPONSE:"C5",CONNECTION_CLOSE:"C6",FLOW:"C7",SLOW_CONNECTION:"C8",INITIAL_DATA_SENT:"C9",RESUBSCRIBE_MESSAGE:"C10",STATS:"C12",STATS_RESPONSE:"C13",EXCHANGE_SUBSCRIBE:"C14",EXCHANGE_RESPONSE:"C15",EXCHANGE_UNSUBSCRIBE_RESPONSE:"C16",NEWS_SUBSCRIBE:"C17",NEWS_FLT_ADD_RESPONSE:"C18",ALERTS_SUBUNSUB:"C19",ALERTS_SUBUNSUB_RESPONSE:"C20",TRADE_SUBSCRIBE:"C21",TRADE_SUBSCRIBE_RESPONSE:"C22",NEWS_FLT_DELETE_RESPONSE:"C23",NEWS_COMMAND:"C24",NEWS_FLT_GET_RESPONSE:"C26",AUTHENTICATION:"C27",OPEN_FLOW:"C28",RECONNECT_RESPONSE:"C29",TRADE_UNSUBSCRIBE_RESPONSE:"C30",MISSED_DATA_SENT:"C31",CORP_EVENT_MESSAGE:"C33",CORP_EVENT_RESPONSE:"C34",NEWS_FLT_MOCK_BASIC_RESPONSE:"C35",NEWS_FLT_UPDATE_RESPONSE:"C36",NEWS_FILTER_MESSAGE:"C37",NEWS_ERROR_MESSAGE:"C38",NEWS_SUCCESS_MESSAGE:"C39",AUTH_TOKEN:"C41",AUTH_TOKEN_RESPONSE:"C42",NEWS_OPEN_RESPONSE:"C43"},data:{QUOTE:"D1",PRICEDATA:"D2",TRADE:"D3",BOOKORDER:"D4",BOOKDELETE:"D5",PURGEBOOK:"D6",MMQUOTE:"D7",INTERVAL:"D8",NETHOUSEPOSITION:"D9",SYMBOLINFO:"D10",SYMBOLSTATUS:"D11",DERIVATIVEINFO:"D12",LASTSALE:"D13",LIMITUPLIMITDOWN:"D14",IVGREEKS:"D15",IMBALANCESTATUS:"D16",ALERT:"D17",NEWS:"D18",TRADENOTIFICATION:"D19",DIVIDEND:"D22",EARNINGS:"D23",SPLIT:"D24",SYMBOLCHANGED:"D25",PRICELEVEL:"D26",MMPRICELEVEL:"D27",ORDEREXECUTED:"D28"}},f.Message=function(){},f.Message.prototype.init=function(e){this[f.JSON_TYPE_PROPERTY]=e},f.control.CtrlMessage=function(){},f.control.CtrlMessage.prototype=new f.Message,f.control.Heartbeat=function(){this.init(f.MessageTypeNames.ctrl.HEARTBEAT),this.timestamp=null},f.control.Heartbeat.prototype=new f.control.CtrlMessage,f.control.StatsMessage=function(){this.init(f.MessageTypeNames.ctrl.STATS)},f.control.StatsMessage.prototype=new f.control.CtrlMessage,f.control.SubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.SUBSCRIBE),this.action=null,this.symbols=[],this.types=[],this.mimetype=null,this.conflation=null},f.control.SubscribeMessage.prototype=new f.control.CtrlMessage,f.control.ExchangeSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_SUBSCRIBE),this.action=null,this.exchange=null,this.mimetype=null,this.conflation=null},f.control.ExchangeSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.NewsSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.NEWS_SUBSCRIBE),this.newsAction=null,this.newsFilters=null,this.filtersId=null,this.mimetype=null,this.newsClientId=null},f.control.NewsSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.NewsCommandMessage=function(){this.init(f.MessageTypeNames.ctrl.NEWS_COMMAND),this.newsAction=null,this.mimetype=null},f.control.NewsCommandMessage.prototype=new f.control.CtrlMessage,f.control.CorpEventSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.CORP_EVENT_MESSAGE),this.action=null,this.symbols=[],this.corpEventTypes=[],this.allCorpEvents=null,this.mimeType=null},f.control.CorpEventSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.AlertsSubUnsubMessage=function(){this.init(f.MessageTypeNames.ctrl.ALERTS_SUBUNSUB),this.operation=null,this.mimetype=null},f.control.AlertsSubUnsubMessage.prototype=new f.control.CtrlMessage,f.control.TradeSubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.TRADE_SUBSCRIBE),this.action=null,this.notificationType=null,this.mimetype=null},f.control.TradeSubscribeMessage.prototype=new f.control.CtrlMessage,f.control.AuthTokenMessage=function(){this.init(f.MessageTypeNames.ctrl.AUTH_TOKEN),this.authMethod=null,this.authParams=null,this.mimetype=null},f.control.AuthTokenMessage.prototype=new f.control.CtrlMessage,f.control.BaseResponse=function(){this.code=null,this.reason=null},f.control.BaseResponse.prototype=new f.control.CtrlMessage,f.control.SubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.SUBSCRIBE_RESPONSE),this.entitlements=null,this.invalidsymbols=null,this.rejectedsymbols=null,this.messagefilters=null},f.control.SubscribeResponse.prototype=new f.control.BaseResponse,f.control.ExchangeSubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_RESPONSE)},f.control.ExchangeSubscribeResponse.prototype=new f.control.BaseResponse,f.control.AlertSubUnsubResponse=function(){this.init(f.MessageTypeNames.ctrl.ALERTS_SUBUNSUB_RESPONSE)},f.control.AlertSubUnsubResponse.prototype=new f.control.BaseResponse,f.control.TradeSubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.TRADE_SUBSCRIBE_RESPONSE)},f.control.TradeSubscribeResponse.prototype=new f.control.BaseResponse,f.control.UnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.UNSUBSCRIBE_RESPONSE),this.unsubscribed=null},f.control.UnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.ExchangeUnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.EXCHANGE_UNSUBSCRIBE_RESPONSE)},f.control.ExchangeUnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.CorporateEventResponse=function(){this.init(f.MessageTypeNames.ctrl.CORP_EVENT_RESPONSE),this.subscribed=[],this.unsubscribed=[],this.invalid=[]},f.control.CorporateEventResponse.prototype=new f.control.BaseResponse,f.control.TradeUnsubscribeResponse=function(){this.init(f.MessageTypeNames.ctrl.TRADE_UNSUBSCRIBE_RESPONSE)},f.control.TradeUnsubscribeResponse.prototype=new f.control.BaseResponse,f.control.StreamEntitlement=function(){this.symbol=null,this.marketdatatype=null,this.entitlement=null},f.control.ConnectResponse=function(){this.init(f.MessageTypeNames.ctrl.CONNECT_RESPONSE),this.version=null,this.flowControlCheckInterval=null,this.serverInstance=null,this.conflationMs=null},f.control.ConnectResponse.prototype=new f.control.BaseResponse,f.control.ReconnectResponse=function(){undefined.init(f.MessageTypeNames.ctrl.RECONNECT_RESPONSE),undefined.version=null,undefined.flowControlCheckInterval=null,undefined.serverInstance=null,undefined.conflationMs=null,undefined.previousSubscriptions=null},f.control.ConnectionClose=function(){this.init(f.MessageTypeNames.ctrl.CONNECTION_CLOSE),this.code=null,this.reason=null},f.control.ConnectionClose.prototype=new f.control.CtrlMessage,f.control.SlowConnection=function(){this.init(f.MessageTypeNames.ctrl.SLOW_CONNECTION),this.timesExceeded=null,this.maxExceed=null,this.currentDelta=null,this.sendingRate=null},f.control.SlowConnection.prototype=new f.control.CtrlMessage,f.control.FlowMessage=function(){this.init(f.MessageTypeNames.ctrl.FLOW),this.sequence=null},f.control.FlowMessage.prototype=new f.control.CtrlMessage,f.control.AuthenticationMessage=function(){this.init(f.MessageTypeNames.ctrl.AUTHENTICATION),this.authenticationMethod=null,this.wmid=null,this.authorization=null,this.conflation=150,this.rejectExcessiveConnection=!1,this.entMax=null},f.control.AuthenticationMessage.prototype=new f.control.CtrlMessage,f.control.StatsResponse=function(){this.init(f.MessageTypeNames.ctrl.STATS_RESPONSE),this.numberOfSubscribedSymbolsL1=null,this.numberOfAvailableSymbolsL1=null,this.numberOfSubscribedSymbolsL2=null,this.numberOfAvailableSymbolsL2=null,this.numberOfOpenedConnections=null,this.numberOfAvailableConnections=null,this.numberOfSubscribedExchanges=null,this.numberOfSubscribedTrades=null},f.control.StatsResponse.prototype=new f.control.BaseResponse,f.control.InitialDataSent=function(){this.init(f.MessageTypeNames.ctrl.INITIAL_DATA_SENT),this.timestamp=null},f.control.InitialDataSent.prototype=new f.control.CtrlMessage,f.control.ResubscribeMessage=function(){this.init(f.MessageTypeNames.ctrl.RESUBSCRIBE_MESSAGE),this.timestamp=null},f.control.ResubscribeMessage.prototype=new f.control.CtrlMessage,f.control.MissedDataSent=function(){this.init(f.MessageTypeNames.ctrl.MISSED_DATA_SENT),this.timestamp=null},f.control.MissedDataSent.prototype=new f.control.CtrlMessage,f.control.StreamEntitlementType={RT:"Realtime",RTO:"Realtime CBOE ONE",RTN:"Realtime NASDAQ",RTB:"Realtime BATS",DL:"Delayed",DLO:"Delayed CBOE One",DLN:"Delayed NASDAQ",RTQ:"QM Zero",NA:"Not Entitled"},f.control.Action={SUBSCRIBE:"SUBSCRIBE",UNSUBSCRIBE:"UNSUBSCRIBE"},f.control.NewsAction={NEWS_OPEN:"NEWS_OPEN",NEWS_FLT_ADD:"NEWS_FLT_ADD",NEWS_FLT_DELETE:"NEWS_FLT_DELETE",NEWS_FLT_UPDATE:"NEWS_FLT_UPDATE",NEWS_FLT_GET:"NEWS_FLT_GET",NEWS_FLT_MOCK_BASIC:"NEWS_FLT_MOCK_BASIC"},f.control.Association={AND:"AND",OR:"OR",NOT:"NOT"},f.control.MarketdataType={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",MMQUOTE:"MMQUOTE",ORDERBOOK:"ORDERBOOK",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",LASTSALE:"LASTSALE",BOOKORDER:"BOOKORDER",BOOKDELETE:"BOOKDELETE",PRICELEVEL:"PRICELEVEL",MMPRICELEVEL:"MMPRICELEVEL",PURGEBOOK:"PURGEBOOK",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS"},f.market.SubscriptionTypes={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",MMQUOTE:"MMQUOTE",ORDERBOOK:"ORDERBOOK",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",LASTSALE:"LASTSALE",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS",ORDEREXECUTED:"ORDEREXECUTED"},f.market.CorporateEventTypes={DIVIDEND:"DIVIDEND",SPLIT:"SPLIT",EARNINGS:"EARNINGS",SYMBOLCHANGED:"SYMBOLCHANGED"},f.market.MarketDataResponseTypes={QUOTE:"QUOTE",PRICEDATA:"PRICEDATA",TRADE:"TRADE",INTERVAL:"INTERVAL",NETHOUSEPOSITION:"NETHOUSEPOSITION",MMQUOTE:"MMQUOTE",PRICELEVEL:"PRICELEVEL",MMPRICELEVEL:"MMPRICELEVEL",BOOKORDER:"BOOKORDER",PURGEBOOK:"PURGEBOOK",BOOKDELETE:"BOOKDELETE",SYMBOLINFO:"SYMBOLINFO",SYMBOLSTATUS:"SYMBOLSTATUS",DERIVATIVEINFO:"DERIVATIVEINFO",LASTSALE:"LASTSALE",LIMITUPLIMITDOWN:"LIMITUPLIMITDOWN",IVGREEKS:"IVGREEKS",IMBALANCESTATUS:"IMBALANCESTATUS",ALERT:"ALERT",NEWS:"NEWS",TRADENOTIFICATION:"TRADENOTIFICATION",NEWSERROR:"NEWSERROR",DIVIDEND:"DIVIDEND",ORDEREXECUTED:"ORDEREXECUTED"},f.control.ResponseCodes={OK_CODE:200,OK_REASON:"OK",BADREQUEST_CODE:400,BADREQUEST_REASON:"Bad Request",UNAUTHORIZED_CODE:401,UNAUTHORIZED_REASON:"Unauthorized",TOOSLOW_CODE:450,TOOSLOW_REASON:"Too slow",DATA_SOURCE_RESET:454,DATA_SOURCE_RESET_REASON:"Data Source Was Reset",CONNECTION_LIMIT_EXCEEDED_CODE:452,CONNECTION_LIMIT_EXCEEDED_REASON:"Connection Limit Exceeded",INTERNALSERVERERROR_CODE:500,INTERNALSERVERERROR_REASON:"Internal Server Error"},f.market.DataMessage=function(){this.messageType=null},f.market.DataMessage.prototype=new f.Message,f.market.Quote=function(){this.init(f.MessageTypeNames.data.QUOTE)},f.market.Quote.prototype=new f.market.DataMessage,f.market.PriceData=function(){this.init(f.MessageTypeNames.data.PRICEDATA)},f.market.PriceData.prototype=new f.market.DataMessage,f.market.Trade=function(){this.init(f.MessageTypeNames.data.TRADE)},f.market.Trade.prototype=new f.market.DataMessage,f.market.MMQuote=function(){this.init(f.MessageTypeNames.data.MMQUOTE)},f.market.MMQuote.prototype=new f.market.DataMessage,f.market.PurgeBook=function(){this.init(f.MessageTypeNames.data.PURGEBOOK)},f.market.PurgeBook.prototype=new f.market.DataMessage,f.market.BookOrder=function(){this.init(f.MessageTypeNames.data.BOOKORDER)},f.market.BookOrder.prototype=new f.market.DataMessage,f.market.BookDelete=function(){this.init(f.MessageTypeNames.data.BOOKDELETE)},f.market.BookDelete.prototype=new f.market.DataMessage,f.market.PriceLevel=function(){this.init(f.MessageTypeNames.data.PRICELEVEL)},f.market.PriceLevel.prototype=new f.market.DataMessage,f.market.MMPriceLevel=function(){this.init(f.MessageTypeNames.data.MMPRICELEVEL)},f.market.MMPriceLevel.prototype=new f.market.DataMessage,f.market.Interval=function(){this.init(f.MessageTypeNames.data.INTERVAL)},f.market.Interval.prototype=new f.market.DataMessage,f.market.NethousePosition=function(){this.init(f.MessageTypeNames.data.NETHOUSEPOSITION)},f.market.NethousePosition.prototype=new f.market.DataMessage,f.market.SymbolInfo=function(){this.init(f.MessageTypeNames.data.SYMBOLINFO)},f.market.SymbolInfo.prototype=new f.market.DataMessage,f.market.SymbolStatus=function(){this.init(f.MessageTypeNames.data.SYMBOLSTATUS)},f.market.SymbolStatus.prototype=new f.market.DataMessage,f.market.DerivativeInfo=function(){this.init(f.MessageTypeNames.data.DERIVATIVEINFO)},f.market.DerivativeInfo.prototype=new f.market.DataMessage,f.market.IVGreeks=function(){this.init(f.MessageTypeNames.data.IVGREEKS)},f.market.IVGreeks.prototype=new f.market.DataMessage,f.market.LastSale=function(){this.init(f.MessageTypeNames.data.LASTSALE)},f.market.LastSale.prototype=new f.market.DataMessage,f.market.LimitUpLimitDown=function(){this.init(f.MessageTypeNames.data.LIMITUPLIMITDOWN)},f.market.LimitUpLimitDown.prototype=new f.market.DataMessage,f.market.ImbalanceStatus=function(){this.init(f.MessageTypeNames.data.IMBALANCESTATUS)},f.market.ImbalanceStatus.prototype=new f.market.DataMessage,f.market.Alert=function(){this.init(f.MessageTypeNames.data.ALERT)},f.market.Alert.prototype=new f.market.DataMessage,f.market.OrderExecuted=function(){this.init(f.MessageTypeNames.data.ORDEREXECUTED)},f.market.OrderExecuted.prototype=new f.market.DataMessage,f.market.InstrumentType={1:"CASH",2:"BOND",3:"COMPOSITE",4:"FUTURE",5:"FUTURE_OPTION",6:"FOREX",7:"INDEX",8:"MUTUAL_FUND",9:"MONEY_MARKET_FUND",10:"MARKET_STAT",11:"EQUITY",12:"EQUITY_OPTION",13:"GOVT_BOND",14:"MUNI_BOND",15:"CORP_BOND",16:"ETF",17:"FUTURE_SPREAD",97:"OPTION_ROOT",98:"UNKNOWN",99:"RATE"},f.market.OrderSide={BUYSIDE:"B",SELLSIDE:"S"},f.market.ImbalanceType={0:"NONE",1:"MARKET",2:"MOC",3:"REGULATORY_IMBALANCE",4:"OPENING_IMBALANCE",5:"CLOSING_IMBALANCE",6:"IPO_IMBALANCE",7:"HALT_IMBALANCE",8:"EQUILIBRIUM"},f.market.OrderChangeType={A:"ADD",M:"MODIFY",C:"CANCEL",E:"EXECUTE"}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/streamer-api.js","/lib")},{_process:131,buffer:121,timers:152}],109:[function(p,e,h){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";h.__esModule=!0,p("./polyfills");var f=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),Object.assign(this,e)}return t.prototype.toString=function(){var e=this.type+"{",t=!0;for(var n in this)"type"!==n&&"function"!=typeof this[n]&&(t||(e+=", "),e+=n+": "+JSON.stringify(this[n]),t=!1);return e+="}"},t}(),d=h.event=function(e,t){return new f(Object.assign({type:e},t))};h.error=function(e,t){return d("error",Object.assign({description:e},t))},h.close=function(e){return d("close",e)}}).call(this,p("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],p("timers").setImmediate,p("timers").clearImmediate,"/lib/streamer-events.js","/lib")},{"./polyfills":18,_process:131,buffer:121,timers:152}],110:[function(p,e,h){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";h.__esModule=!0,h.getMessageName=h.entitlement=h.isvalid=h.iscontrolmessage=h.isdatamessage=h.messagetype=undefined;var f,d=p("./streamer-api.js");h.messagetype=function(e){return null===e?null:e[d.messages.JSON_TYPE_PROPERTY]},h.isdatamessage=function(e){if(null===e)return!1;var t=h.messagetype(e);return null!==t&&t.startsWith("D")},h.iscontrolmessage=function(e){if(null===e)return!1;var t=h.messagetype(e);return null!==t&&t.startsWith("C")},h.isvalid=function(e,t){var n=t.invalidSymbols;if(null==n)return!0;for(var r=0;r<n.length;r++){if(n[r]===e)return!1}return!0},h.entitlement=function(e,t,n){var r=n.entitlements;if(null!=r)for(var i=0;i<r.length;i++){var o=r[i];if(o.symbol===e&&o.marketdatatype===t)return o.entitlement}return null},h.getMessageName=(f={},function(e){var t=e[d.messages.JSON_TYPE_PROPERTY];if(!f[t]){var n=d.messages.MessageTypeNames.ctrl;for(var r in n)if(n[r]===t)return f[t]=r;var i=d.messages.MessageTypeNames.data;for(var o in i)if(i[o]===t)return f[t]=o;return f[t]=t}return f[t]})}).call(this,p("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},p("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],p("timers").setImmediate,p("timers").clearImmediate,"/lib/streamer-utils.js","/lib")},{"./streamer-api.js":108,_process:131,buffer:121,timers:152}],111:[function(m,e,E){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";E.__esModule=!0;var f,d=m("../EventSupport.js"),p=(f=d)&&f.__esModule?f:{"default":f};var h=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.socket=e,this.log=t,this.events=new p["default"](this)}return n.prototype.send=function(e,t){this.socket.send(JSON.stringify(e))},n.prototype.sendCustomFrame=function(e,t,n,r){this.socket.sendCustomFrame(e.toString(),t.toString(),JSON.parse(n),JSON.stringify(r))},n.prototype.onMessage=function(e){var t=null;try{t=JSON.parse(e)}catch(r){return void this.log.error(r)}var n=t;n.__id=n.requestId,this.events.fire("message",n)},n.prototype.on=function(e,t){return this.events.on(e,t)},n}();E["default"]=h}).call(this,m("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],m("timers").setImmediate,m("timers").clearImmediate,"/lib/transmission/JsonStompTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,_process:131,buffer:121,timers:152}],112:[function(m,e,E){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";E.__esModule=!0;m("../message.js");var f,d=m("../EventSupport.js"),p=(f=d)&&f.__esModule?f:{"default":f};var h=function(){function n(e,t){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,n),this.socket=e,this.log=t,this.events=new p["default"](this)}return n.prototype.send=function(e,t){this.socket.push({trackMessageLength:!0,data:JSON.stringify(e)})},n.prototype.onMessage=function(e){var t=null;try{t=JSON.parse(e)}catch(o){return void this.log.error(o)}this.events.fire("sequence",t.seq);for(var n=t.data.length,r=0;r<n;r++){var i=t.data[r];i.__id=i.requestId,this.events.fire("message",i)}},n.prototype.on=function(e,t){return this.events.on(e,t)},n}();E["default"]=h}).call(this,m("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},m("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],m("timers").setImmediate,m("timers").clearImmediate,"/lib/transmission/JsonTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../message.js":17,_process:131,buffer:121,timers:152}],113:[function(S,e,v){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";v.__esModule=!0;var f=b(S("../EventSupport.js")),d=b(S("../SMessage")),p=S("../qitch/decoder/QitchDecoder"),h=b(p),m=b(S("../qitch/encoder/QitchEncoder")),E=b(S("../UShortId.js")),_=S("../message.js"),g=b(S("../qitch/LocateCodeInjector")),T=S("../utils");function b(e){return e&&e.__esModule?e:{"default":e}}var y=function(){function r(e,t,n){if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.socket=e,!(t instanceof m["default"]))throw"Wrong encoder";this.encoder=t,this.log=n,this.events=new f["default"](this),this.decoder=new h["default"](r.prototype.DEFAULT_BUFFERSIZE),this.locateCodeInjector=new g["default"]}return r.prototype.send=function(e,t){var n=new d["default"];n.sequencenumber=e.sequenceNumber,n.timestamp=(new Date).getTime(),n.id=null!=t?t:E["default"].NULL,n.encoding=_.Encodings.NONE_CHAR,n.mimetype=_.MimeTypes.QITCH_CHAR,n.payload=e;var r={trackMessageLength:!1,data:this.encoder.encode(n,0)};this.socket.push(r)},r.prototype.onMessage=function(e){var t=void 0;t=e instanceof ArrayBuffer?e:(0,T.asciiStringToArrayBuffer)(e);var n=null;try{n=this.decoder.decode(new Int8Array(t))}catch(o){return void this.log.error(o)}if(null!=n)for(var r=0;r<n.length;r++)if(n[r]instanceof p.MessageBlock)for(var i=0;i<n[r].messages.length;i++)this._processMessage(n[r].messages[i]);else this._processMessage(n[r]);else this.log.debug("Couldn't decode message. Ignoring unsupported message")},r.prototype.on=function(e,t){return this.events.on(e,t)},r.prototype._processMessage=function(e){this.locateCodeInjector.injectLocateCode(e.decodedPayload),this.events.fire("sequence",e.sequencenumber),e.decodedPayload.__id=e.id,this.events.fire("message",e.decodedPayload)},r}();y.prototype.DEFAULT_BUFFERSIZE=4096,v["default"]=y}).call(this,S("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},S("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],S("timers").setImmediate,S("timers").clearImmediate,"/lib/transmission/QitchTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../SMessage":5,"../UShortId.js":9,"../message.js":17,"../qitch/LocateCodeInjector":23,"../qitch/decoder/QitchDecoder":46,"../qitch/encoder/QitchEncoder":76,"../utils":115,_process:131,buffer:121,timers:152}],114:[function(_,e,g){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";g.__esModule=!0;var f=_("../message.js"),d=m(_("../SMessage.js")),p=m(_("../UShortId.js")),h=m(_("../EventSupport.js"));_("../formatting.js");function m(e){return e&&e.__esModule?e:{"default":e}}var E=function(){function i(e,t,n,r){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,i),this.socket=e,this.encoder=t,this.decoder=n,this.log=r,this.events=new h["default"](this)}return i.prototype.send=function(e,t){var n=new d["default"];n.sequencenumber=e.sequenceNumber,n.timestamp=(new Date).getTime(),n.id=null!=t?t:p["default"].NULL,n.encoding=f.Encodings.NONE_CHAR,n.mimetype=f.MimeTypes.JSON_CHAR,n.payload=JSON.stringify(e);var r={trackMessageLength:!0,data:this.encoder.encode(n)};this.socket.push(r)},i.prototype.onMessage=function(e){var t=this.decoder.decode(e);if(this.events.fire("sequence",t.sequencenumber),t.encoding===f.Encodings.NONE_CHAR)if(t.mimetype===f.MimeTypes.JSON_CHAR){var n=null;try{n=JSON.parse(t.payload)}catch(r){return void this.log.error(r)}n.__id=t.id,this.events.fire("message",n)}else this.log.debug("Unhandled mimetype: "+t.mimeType+" - "+t.payload);else this.log.debug("Unhandled encoding: "+t.encoding+" - "+t.payload)},i.prototype.on=function(e,t){return this.events.on(e,t)},i}();g["default"]=E}).call(this,_("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},_("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],_("timers").setImmediate,_("timers").clearImmediate,"/lib/transmission/SMessageTransmitter.js","/lib/transmission")},{"../EventSupport.js":2,"../SMessage.js":5,"../UShortId.js":9,"../formatting.js":13,"../message.js":17,_process:131,buffer:121,timers:152}],115:[function(e,t,d){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";d.__esModule=!0;d.forEachPartition=function(e,t,n){if(e)for(var r=0;r<e.length;r+=t){n(e.slice(r,r+t))}};var f=d.indexOf=function(e,t){for(var n=e.length,r=0;r<n;++r)if(t===e[r])return r;return-1};d.removeFromArray=function(e){for(var t,n,r=arguments.length<=1?0:arguments.length-1;0<r&&e.length;){var i;for(i=1+--r,t=arguments.length<=i?undefined:arguments[i];-1!==(n=f(e,t));)e.splice(n,1)}return e},d.asciiStringToArrayBuffer=function(e){for(var t=new ArrayBuffer(e.length),n=new Uint8Array(t),r=0,i=e.length;r<i;r++)n[r]=e.charCodeAt(r);return t}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/lib/utils.js","/lib")},{_process:131,buffer:121,timers:152}],116:[function(e,f,t){(function(e,t,n,r,i,o,s,a,u,l,c){f.exports=function(e,t){var n=e.length;if(n!==t.length)return!1;for(var r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/node_modules/array-equal/index.js","/node_modules/array-equal")},{_process:131,buffer:121,timers:152}],117:[function(e,t,T){(function(e,t,n,r,i,o,s,a,u,l,c){"use strict";T.byteLength=function(e){var t=_(e),n=t[0],r=t[1];return 3*(n+r)/4-r},T.toByteArray=function(e){for(var t,n=_(e),r=n[0],i=n[1],o=new p((l=r,c=i,3*(l+c)/4-c)),s=0,a=0<i?r-4:r,u=0;u<a;u+=4)t=d[e.charCodeAt(u)]<<18|d[e.charCodeAt(u+1)]<<12|d[e.charCodeAt(u+2)]<<6|d[e.charCodeAt(u+3)],o[s++]=t>>16&255,o[s++]=t>>8&255,o[s++]=255&t;var l,c;2===i&&(t=d[e.charCodeAt(u)]<<2|d[e.charCodeAt(u+1)]>>4,o[s++]=255&t);1===i&&(t=d[e.charCodeAt(u)]<<10|d[e.charCodeAt(u+1)]<<4|d[e.charCodeAt(u+2)]>>2,o[s++]=t>>8&255,o[s++]=255&t);return o},T.fromByteArray=function(e){for(var t,n=e.length,r=n%3,i=[],o=0,s=n-r;o<s;o+=16383)i.push(g(e,o,s<o+16383?s:o+16383));1===r?(t=e[n-1],i.push(f[t>>2]+f[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(f[t>>10]+f[t>>4&63]+f[t<<2&63]+"="));return i.join("")};for(var f=[],d=[],p="undefined"!=typeof Uint8Array?Uint8Array:Array,h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",m=0,E=h.length;m<E;++m)f[m]=h[m],d[h.charCodeAt(m)]=m;function _(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function g(e,t,n){for(var r,i,o=[],s=t;s<n;s+=3)r=(e[s]<<16&16711680)+(e[s+1]<<8&65280)+(255&e[s+2]),o.push(f[(i=r)>>18&63]+f[i>>12&63]+f[i>>6&63]+f[63&i]);return o.join("")}d["-".charCodeAt(0)]=62,d["_".charCodeAt(0)]=63}).call(this,e("_process"),"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{},e("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],e("timers").setImmediate,e("timers").clearImmediate,"/node_modules/base64-js/index.js","/node_modules/base64-js")},{_process:131,buffer:121,timers:152}],118:[function(e,f,t){(function(e,t,n,r,i,o,s,a,u,l,c){!function(t){"use strict";
48
48
  /*
49
49
  * bignumber.js v9.0.0
50
50
  * A JavaScript library for arbitrary-precision arithmetic.