comprodls-sdk 2.42.3 → 2.43.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.
@@ -25,6 +25,7 @@
25
25
  var token_manager = require('./token');
26
26
  var helpers = require('./helpers');
27
27
  var auth = require('./services/auth');
28
+ var authextn = require('./services/authextn');
28
29
  var activity = require('./services/activity');
29
30
  var analytics = require('./services/analytics');
30
31
  var collab = require('./services/collab');
@@ -131,6 +132,7 @@ comproDLS.prototype.request = helpers.api.genericAPICaller;
131
132
 
132
133
  //Custom Service Adaptors
133
134
  comproDLS.prototype.Auth = auth;
135
+ comproDLS.prototype.AuthExtn = authextn;
134
136
  comproDLS.prototype.Activity = activity;
135
137
  comproDLS.prototype.Analytics = analytics;
136
138
  comproDLS.prototype.Collab = collab;
@@ -152,7 +154,7 @@ comproDLS.prototype.Taxonomy = taxonomy;
152
154
  comproDLS.prototype.Rules = rules;
153
155
  comproDLS.prototype.Datasyncmanager = datasyncmanager;
154
156
 
155
- },{"./config":2,"./helpers":3,"./open_access":10,"./services/activity":13,"./services/analytics":14,"./services/attempts":15,"./services/auth":16,"./services/collab":17,"./services/datasyncmanager":18,"./services/drive":19,"./services/integrations":20,"./services/invitations":21,"./services/lrs":22,"./services/product":23,"./services/pub":24,"./services/push":27,"./services/pushX":25,"./services/rules":28,"./services/sisevents":29,"./services/spaces":30,"./services/superuser":31,"./services/taxonomy":32,"./services/workflows":33,"./services/xapi":34,"./token":35,"./token/validations":36}],2:[function(require,module,exports){
157
+ },{"./config":2,"./helpers":3,"./open_access":10,"./services/activity":13,"./services/analytics":14,"./services/attempts":15,"./services/auth":16,"./services/authextn":17,"./services/collab":18,"./services/datasyncmanager":19,"./services/drive":20,"./services/integrations":21,"./services/invitations":22,"./services/lrs":23,"./services/product":24,"./services/pub":25,"./services/push":28,"./services/pushX":26,"./services/rules":29,"./services/sisevents":30,"./services/spaces":31,"./services/superuser":32,"./services/taxonomy":33,"./services/workflows":34,"./services/xapi":35,"./token":36,"./token/validations":37}],2:[function(require,module,exports){
156
158
  /*************************************************************************
157
159
  *
158
160
  * COMPRO CONFIDENTIAL
@@ -187,6 +189,7 @@ exports.REALM_HOSTS = {
187
189
  PROD1: {
188
190
  PUB: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-pub',
189
191
  AUTH: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-auth',
192
+ AUTHEXTN: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-authextn',
190
193
  PUSHX: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-pushx',
191
194
  XAPI: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-xapi',
192
195
  ATTEMPTS: 'http://internal-dls-global-prod1-1755536919.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -200,6 +203,7 @@ exports.REALM_HOSTS = {
200
203
  THOR: {
201
204
  PUB: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-pub',
202
205
  AUTH: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-auth',
206
+ AUTHEXTN: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-authextn',
203
207
  PUSHX: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-pushx',
204
208
  XAPI: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-xapi',
205
209
  ATTEMPTS: 'http://dls-asgard-thor-1453383019.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -213,6 +217,7 @@ exports.REALM_HOSTS = {
213
217
  ALPHA: {
214
218
  PUB: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-pub',
215
219
  AUTH: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-auth',
220
+ AUTHEXTN: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-authextn',
216
221
  PUSHX: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-pushx',
217
222
  XAPI: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-xapi',
218
223
  ATTEMPTS: 'http://dls-cup-alpha-2093819659.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -224,6 +229,7 @@ exports.REALM_HOSTS = {
224
229
  PROD1: {
225
230
  PUB: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-pub',
226
231
  AUTH: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-auth',
232
+ AUTHEXTN: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-authextn',
227
233
  PUSHX: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-pushx',
228
234
  XAPI: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-xapi',
229
235
  ATTEMPTS: 'http://internal-dls-cup-prod1-284466545.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -235,6 +241,7 @@ exports.REALM_HOSTS = {
235
241
  QA: {
236
242
  PUB: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-pub',
237
243
  AUTH: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-auth',
244
+ AUTHEXTN: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-authextn',
238
245
  PUSHX: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-pushx',
239
246
  XAPI: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-xapi',
240
247
  ATTEMPTS: 'http://internal-dls-cup-qa-41690511.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -246,6 +253,7 @@ exports.REALM_HOSTS = {
246
253
  HFX: {
247
254
  PUB: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-pub',
248
255
  AUTH: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-auth',
256
+ AUTHEXTN: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-authextn',
249
257
  PUSHX: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-pushx',
250
258
  XAPI: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-xapi',
251
259
  ATTEMPTS: 'http://internal-dls-cup-hfx-908523553.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -257,6 +265,7 @@ exports.REALM_HOSTS = {
257
265
  REL: {
258
266
  PUB: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-pub',
259
267
  AUTH: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-auth',
268
+ AUTHEXTN: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-authextn',
260
269
  PUSHX: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-pushx',
261
270
  XAPI: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-xapi',
262
271
  ATTEMPTS: 'http://internal-dls-cup-rel-1458752944.us-west-2.elb.amazonaws.com/lb-attempts',
@@ -375,6 +384,15 @@ exports.AUTH_API_URLS = {
375
384
  particularCustomComponent: '/org/{orgid}/custom-components/{custom_component_code}'
376
385
  };
377
386
 
387
+ exports.AUTHEXTN_API_URLS = {
388
+ // Grade Formats related APIs
389
+ gradeFormat: '/org/{orgid}/gradeformats',
390
+ particularGradeFormat: '/org/{orgid}/gradeformats/{gradeformat_id}',
391
+ classGradeformatAssociation: '/org/{orgid}/classes/{classid}/associate-gradeformats/{gradeformat_id}',
392
+ classGradeformats: '/org/{orgid}/classes/{classid}/gradeformats',
393
+ gradeformatClasses: '/org/{orgid}/gradeformats/{gradeformat_id}/classes'
394
+ };
395
+
378
396
  exports.ACTIVITY_API_URLS = {
379
397
  newAttemptAPI: '/{orgId}/products/{productId}/activities/{activityId}/start',
380
398
  activityDetailsAPI: '/{orgId}/products/{productId}/activities/{activityId}',
@@ -789,7 +807,7 @@ function addClassIdQueryParam(url, classId) {
789
807
  function setupAPIToken(request, token) {
790
808
  return request.set('Authorization', token.access_token);
791
809
  };
792
- },{"../../../config":2,"../../../helpers":3,"../errors":7,"./validations":6,"q":90,"string-template":134,"superagent":135}],6:[function(require,module,exports){
810
+ },{"../../../config":2,"../../../helpers":3,"../errors":7,"./validations":6,"q":91,"string-template":135,"superagent":136}],6:[function(require,module,exports){
793
811
  /*************************************************************************
794
812
  *
795
813
  * COMPRO CONFIDENTIAL
@@ -1121,7 +1139,7 @@ validator.validators.contains = function(value, options) {
1121
1139
  }
1122
1140
  }
1123
1141
  };
1124
- },{"./errors":7,"validate.js":142}],10:[function(require,module,exports){
1142
+ },{"./errors":7,"validate.js":143}],10:[function(require,module,exports){
1125
1143
  /*************************************************************************
1126
1144
  *
1127
1145
  * COMPRO CONFIDENTIAL
@@ -1244,7 +1262,7 @@ function getSingleInvitation(organizationId, options) {
1244
1262
  }
1245
1263
 
1246
1264
 
1247
- },{"../helpers":3,"q":90,"superagent":135}],11:[function(require,module,exports){
1265
+ },{"../helpers":3,"q":91,"superagent":136}],11:[function(require,module,exports){
1248
1266
  /*************************************************************************
1249
1267
  *
1250
1268
  * COMPRO CONFIDENTIAL
@@ -1455,7 +1473,7 @@ Activity.prototype.getQuestionsCount = function () {
1455
1473
  return dfd.promise;
1456
1474
  }
1457
1475
 
1458
- },{"../../helpers":3,"./attempt":12,"extend":70,"q":90,"superagent":135}],12:[function(require,module,exports){
1476
+ },{"../../helpers":3,"./attempt":12,"extend":71,"q":91,"superagent":136}],12:[function(require,module,exports){
1459
1477
  /*************************************************************************
1460
1478
  *
1461
1479
  * COMPRO CONFIDENTIAL
@@ -1888,7 +1906,7 @@ Attempt.prototype.submit = function (userresponse) {
1888
1906
  return dfd.promise;
1889
1907
  };
1890
1908
 
1891
- },{"../../helpers":3,"extend":70,"q":90,"superagent":135}],13:[function(require,module,exports){
1909
+ },{"../../helpers":3,"extend":71,"q":91,"superagent":136}],13:[function(require,module,exports){
1892
1910
  /*************************************************************************
1893
1911
  *
1894
1912
  * COMPRO CONFIDENTIAL
@@ -3812,7 +3830,7 @@ function postProgressTimeseries(options) {
3812
3830
  return dfd.promise;
3813
3831
  }
3814
3832
 
3815
- },{"../../helpers":3,"agentkeepalive":38,"q":90,"superagent":135}],15:[function(require,module,exports){
3833
+ },{"../../helpers":3,"agentkeepalive":39,"q":91,"superagent":136}],15:[function(require,module,exports){
3816
3834
  /*************************************************************************
3817
3835
  *
3818
3836
  * COMPRO CONFIDENTIAL
@@ -4156,7 +4174,7 @@ function getUserLastAttemptForActivity(options) {
4156
4174
  return dfd.promise;
4157
4175
  }
4158
4176
 
4159
- },{"../../helpers":3,"q":90,"superagent":135}],16:[function(require,module,exports){
4177
+ },{"../../helpers":3,"q":91,"superagent":136}],16:[function(require,module,exports){
4160
4178
  /*************************************************************************
4161
4179
  *
4162
4180
  * COMPRO CONFIDENTIAL
@@ -4192,7 +4210,7 @@ var converter = require('../../helpers/lib/api/converter');
4192
4210
  var DLSError = helpers.errors.DLSError;
4193
4211
 
4194
4212
  /*********************************
4195
- * Setting Up Module Entry Point
4213
+ * Setting Up Module Entry Point
4196
4214
  **********************************/
4197
4215
  module.exports = auth;
4198
4216
 
@@ -4921,7 +4939,7 @@ function getClassUsers(options) {
4921
4939
  // upFile: '' // path to csv file to be uploaded
4922
4940
  //}
4923
4941
  function pisImport(options) {
4924
- var self = this;
4942
+ var self = this;
4925
4943
  // Initializing promise
4926
4944
  var dfd = q.defer();
4927
4945
  // Validations
@@ -4931,7 +4949,7 @@ function pisImport(options) {
4931
4949
  // Passed all validations, Construct API url
4932
4950
  var url = self.config.DEFAULT_HOSTS.AUTH +
4933
4951
  self.config.AUTH_API_URLS.pisImportAPI;
4934
- url = helpers.api.constructAPIUrl(url, {"orgId" : self.orgId});
4952
+ url = helpers.api.constructAPIUrl(url, {'orgId' : self.orgId});
4935
4953
  // Contruct parameters
4936
4954
  var params = {};
4937
4955
  var upfile;
@@ -4966,7 +4984,7 @@ function pisImport(options) {
4966
4984
  // field: '' // apps / lti / sis / pis / product[ANY ONE]
4967
4985
  //}
4968
4986
  function getOrgSettings(options) {
4969
- var self = this;
4987
+ var self = this;
4970
4988
  // Initializing promise
4971
4989
  var dfd = q.defer();
4972
4990
  // Validations
@@ -5011,7 +5029,7 @@ function getOrgSettings(options) {
5011
5029
  // body: {} // the top level settings field to be updated.
5012
5030
  //}
5013
5031
  function updateOrgSettings(options) {
5014
- var self = this;
5032
+ var self = this;
5015
5033
  // Initializing promise
5016
5034
  var dfd = q.defer();
5017
5035
  // Validations
@@ -5107,7 +5125,7 @@ function getAllJobs(options) {
5107
5125
  // Passed all validations, Contruct API url
5108
5126
  var url = self.config.DEFAULT_HOSTS.AUTH + self.config.AUTH_API_URLS.getAllJobs;
5109
5127
  url = helpers.api.constructAPIUrl(url, { accountId : options.accountId, extUserId: options.extUserId });
5110
-
5128
+
5111
5129
  var params = {};
5112
5130
  if(options.jobType) { params.jobType = options.jobType; }
5113
5131
  if(options.details) { params.details = options.details; }
@@ -5408,7 +5426,7 @@ function getParticularShadowClass(options) {
5408
5426
  if(err) {
5409
5427
  err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5410
5428
  dfd.reject(err);
5411
- }
5429
+ }
5412
5430
  else {
5413
5431
  dfd.resolve(response.body);
5414
5432
  }
@@ -5591,21 +5609,21 @@ function getClassAppdata(options) {
5591
5609
  orgId: self.orgId, classid: options.classid
5592
5610
  });
5593
5611
  //Setup request with URL
5594
- var requestAPI = request.get(url);
5612
+ var requestAPI = request.get(url);
5595
5613
  if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
5596
5614
 
5597
- //Setup token in Authorization header
5598
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5615
+ //Setup token in Authorization header
5616
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5599
5617
 
5600
- //Call Class Appdata Api
5601
- requestAPI.end(function(err, response) {
5602
- if(err) {
5603
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5604
- dfd.reject(err);
5605
- } else {
5606
- dfd.resolve(response.body);
5607
- }
5608
- });
5618
+ //Call Class Appdata Api
5619
+ requestAPI.end(function(err, response) {
5620
+ if(err) {
5621
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5622
+ dfd.reject(err);
5623
+ } else {
5624
+ dfd.resolve(response.body);
5625
+ }
5626
+ });
5609
5627
  } else {
5610
5628
  err = {};
5611
5629
  err.message = err.description = 'classid not found in request options.';
@@ -5714,26 +5732,26 @@ function deleteClassAppdata(options) {
5714
5732
  //};
5715
5733
  function enrollUsertoClass(options) {
5716
5734
  var self = this;
5717
- var err = {};
5735
+ var err = {};
5718
5736
  //Initializing promise
5719
5737
  var dfd = q.defer();
5720
- if(options && options.classid && options.userid) {
5721
- //Validations
5722
- err = helpers.validations.isAuthenticated(self.orgId, self.token);
5723
- if(err) {
5724
- dfd.reject(err);
5725
- } else {
5726
- //Passed all validations, Construct API url
5727
- var url = self.config.DEFAULT_HOSTS.AUTH +
5738
+ if(options && options.classid && options.userid) {
5739
+ //Validations
5740
+ err = helpers.validations.isAuthenticated(self.orgId, self.token);
5741
+ if(err) {
5742
+ dfd.reject(err);
5743
+ } else {
5744
+ //Passed all validations, Construct API url
5745
+ var url = self.config.DEFAULT_HOSTS.AUTH +
5728
5746
  self.config.AUTH_API_URLS.enrollUsertoClass;
5729
- url = helpers.api.constructAPIUrl(url, {
5730
- orgId: self.orgId,
5731
- classId: options.classid,
5747
+ url = helpers.api.constructAPIUrl(url, {
5748
+ orgId: self.orgId,
5749
+ classId: options.classid,
5732
5750
  userId: options.userid
5733
- });
5751
+ });
5734
5752
 
5735
- //Contruct parameters
5736
- var params = {};
5753
+ //Contruct parameters
5754
+ var params = {};
5737
5755
 
5738
5756
  //Setup request with URL and Params
5739
5757
  var requestAPI = request.post(url)
@@ -5742,24 +5760,24 @@ function enrollUsertoClass(options) {
5742
5760
  .query(params);
5743
5761
  if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
5744
5762
 
5745
- //Setup token in Authorization header
5746
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5763
+ //Setup token in Authorization header
5764
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5747
5765
 
5748
- //Call GET Product by it's code Api
5749
- requestAPI.end(function(err, response) {
5750
- if(err) {
5751
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5752
- dfd.reject(err);
5753
- } else {
5754
- dfd.resolve(response.body);
5755
- }
5756
- });
5757
- }
5758
- } else {
5759
- err.message = err.description = 'Mandatory parameter classid or userid not found in request options';
5760
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
5761
- dfd.reject(err);
5762
- }
5766
+ //Call GET Product by it's code Api
5767
+ requestAPI.end(function(err, response) {
5768
+ if(err) {
5769
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5770
+ dfd.reject(err);
5771
+ } else {
5772
+ dfd.resolve(response.body);
5773
+ }
5774
+ });
5775
+ }
5776
+ } else {
5777
+ err.message = err.description = 'Mandatory parameter classid or userid not found in request options';
5778
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
5779
+ dfd.reject(err);
5780
+ }
5763
5781
  return dfd.promise;
5764
5782
  }
5765
5783
 
@@ -5935,49 +5953,49 @@ function unEnrollMultiUserstoClass(options) {
5935
5953
  //};
5936
5954
  function unEnrollUsertoClass(options) {
5937
5955
  var self = this;
5938
- var err = {};
5956
+ var err = {};
5939
5957
  //Initializing promise
5940
5958
  var dfd = q.defer();
5941
- if(options && options.classid && options.userid) {
5942
- //Validations
5943
- err = helpers.validations.isAuthenticated(self.orgId, self.token);
5944
- if(err) {
5945
- dfd.reject(err);
5946
- } else {
5947
- //Passed all validations, Construct API url
5948
- var url = self.config.DEFAULT_HOSTS.AUTH +
5959
+ if(options && options.classid && options.userid) {
5960
+ //Validations
5961
+ err = helpers.validations.isAuthenticated(self.orgId, self.token);
5962
+ if(err) {
5963
+ dfd.reject(err);
5964
+ } else {
5965
+ //Passed all validations, Construct API url
5966
+ var url = self.config.DEFAULT_HOSTS.AUTH +
5949
5967
  self.config.AUTH_API_URLS.enrollUsertoClass;
5950
- url = helpers.api.constructAPIUrl(url, {
5951
- orgId: self.orgId,
5952
- classId: options.classid,
5968
+ url = helpers.api.constructAPIUrl(url, {
5969
+ orgId: self.orgId,
5970
+ classId: options.classid,
5953
5971
  userId: options.userid
5954
- });
5972
+ });
5955
5973
 
5956
- //Contruct parameters
5957
- var params = {};
5974
+ //Contruct parameters
5975
+ var params = {};
5958
5976
 
5959
5977
  //Setup request with URL and Params
5960
5978
  var requestAPI = request.delete(url).query(params);
5961
5979
  if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
5962
5980
 
5963
- //Setup token in Authorization header
5964
- requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5981
+ //Setup token in Authorization header
5982
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
5965
5983
 
5966
- //Call GET Product by it's code Api
5967
- requestAPI.end(function(err, response) {
5968
- if(err) {
5969
- err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5970
- dfd.reject(err);
5971
- } else {
5972
- dfd.resolve(response.body);
5973
- }
5974
- });
5975
- }
5976
- } else {
5977
- err.message = err.description = 'Mandatory parameter classid or userid not found in request options';
5978
- err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
5979
- dfd.reject(err);
5980
- }
5984
+ //Call GET Product by it's code Api
5985
+ requestAPI.end(function(err, response) {
5986
+ if(err) {
5987
+ err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, err);
5988
+ dfd.reject(err);
5989
+ } else {
5990
+ dfd.resolve(response.body);
5991
+ }
5992
+ });
5993
+ }
5994
+ } else {
5995
+ err.message = err.description = 'Mandatory parameter classid or userid not found in request options';
5996
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
5997
+ dfd.reject(err);
5998
+ }
5981
5999
  return dfd.promise;
5982
6000
  }
5983
6001
 
@@ -6409,8 +6427,8 @@ function deleteAssignedPath(options) {
6409
6427
  options = {
6410
6428
  classid: 'string' //mandatory
6411
6429
  assignedpathid: 'string' //mandatory
6412
- data:
6413
- {
6430
+ data:
6431
+ {
6414
6432
  title: 'string' //optional
6415
6433
  startdate: 'string' //optional
6416
6434
  duedate: 'string' //optional
@@ -6432,7 +6450,7 @@ function updateAssignedPath(options) {
6432
6450
  // Setup request with URL and Params
6433
6451
  var requestAPI = request.put(url);
6434
6452
  if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
6435
- if(options.data) { requestAPI.send(options.data); }
6453
+ if(options.data) { requestAPI.send(options.data); }
6436
6454
 
6437
6455
  //Setup token in Authorization header
6438
6456
  requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
@@ -6710,10 +6728,10 @@ function getAllMembersOfAGroup(options) {
6710
6728
  orgId: self.orgId,
6711
6729
  groupId: options.groupId
6712
6730
  });
6713
-
6731
+
6714
6732
  // Setup request with URL and Param
6715
- if(options.cursor){ params.cursor = options.cursor };
6716
-
6733
+ if(options.cursor){ params.cursor = options.cursor; };
6734
+
6717
6735
  var requestAPI = request.get(url)
6718
6736
  .set('Content-Type', 'application/json')
6719
6737
  .set('Accept', 'application/json')
@@ -6722,7 +6740,7 @@ function getAllMembersOfAGroup(options) {
6722
6740
 
6723
6741
  //Setup token in Authorization header
6724
6742
  requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
6725
-
6743
+
6726
6744
  requestAPI.end(function(error, response) {
6727
6745
  if(error) {
6728
6746
  err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
@@ -6761,11 +6779,11 @@ function getAllGroupMembersByPath(options) {
6761
6779
  url = helpers.api.constructAPIUrl(url, {
6762
6780
  orgId: self.orgId
6763
6781
  });
6764
-
6782
+
6765
6783
  // Setup request with URL and Params
6766
6784
  params.path = options.path;
6767
- if(options.cursor){ params.cursor = options.cursor };
6768
-
6785
+ if(options.cursor){ params.cursor = options.cursor; };
6786
+
6769
6787
  var requestAPI = request.get(url)
6770
6788
  .set('Content-Type', 'application/json')
6771
6789
  .set('Accept', 'application/json')
@@ -6774,7 +6792,7 @@ function getAllGroupMembersByPath(options) {
6774
6792
 
6775
6793
  //Setup token in Authorization header
6776
6794
  requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
6777
-
6795
+
6778
6796
  requestAPI.end(function(error, response) {
6779
6797
  if(error) {
6780
6798
  err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
@@ -6825,10 +6843,10 @@ function createMultiUserGroupMembership(options) {
6825
6843
  var url = self.config.DEFAULT_HOSTS.AUTH +
6826
6844
  self.config.AUTH_API_URLS.userGroupMembership;
6827
6845
  url = helpers.api.constructAPIUrl(url, { orgId: self.orgId, groupId: options.groupId });
6828
-
6846
+
6829
6847
  // Setup request with URL and Params
6830
6848
  params = options.body;
6831
-
6849
+
6832
6850
  var requestAPI = request.post(url)
6833
6851
  .set('Content-Type', 'application/json')
6834
6852
  .set('Accept', 'application/json')
@@ -6836,7 +6854,7 @@ function createMultiUserGroupMembership(options) {
6836
6854
  if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
6837
6855
  //Setup token in Authorization header
6838
6856
  requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
6839
-
6857
+
6840
6858
  requestAPI.end(function(error, response) {
6841
6859
  if(error) {
6842
6860
  err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
@@ -6847,7 +6865,7 @@ function createMultiUserGroupMembership(options) {
6847
6865
  } else {
6848
6866
  err = {};
6849
6867
  err.message = err.description = 'Mandatory param - groupId or body or body.users(min. 1 user) ' +
6850
- 'not found in request options.'
6868
+ 'not found in request options.';
6851
6869
  err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
6852
6870
  dfd.reject(err);
6853
6871
  }
@@ -6882,7 +6900,7 @@ function deleteMultiUserGroupMembership(options) {
6882
6900
  orgId: self.orgId,
6883
6901
  groupId: options.groupId
6884
6902
  });
6885
-
6903
+
6886
6904
  // Setup request with URL and Params
6887
6905
  params = options.body;
6888
6906
  var requestAPI = request.delete(url)
@@ -6903,7 +6921,7 @@ function deleteMultiUserGroupMembership(options) {
6903
6921
  } else {
6904
6922
  err = {};
6905
6923
  err.message = err.description = 'Mandatory param - groupId or body or body.users(min. 1 user) ' +
6906
- 'not found in request options.'
6924
+ 'not found in request options.';
6907
6925
  err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
6908
6926
  dfd.reject(err);
6909
6927
  }
@@ -7030,11 +7048,11 @@ function getMyAllMemberships(options) {
7030
7048
  orgId: self.orgId,
7031
7049
  userId: options.userId
7032
7050
  });
7033
-
7051
+
7034
7052
  // Setup request with URL and Params
7035
7053
  params.path = options.path;
7036
- if(options.cursor){ params.cursor = options.cursor };
7037
-
7054
+ if(options.cursor){ params.cursor = options.cursor; };
7055
+
7038
7056
  var requestAPI = request.get(url)
7039
7057
  .set('Content-Type', 'application/json')
7040
7058
  .set('Accept', 'application/json')
@@ -7043,7 +7061,7 @@ function getMyAllMemberships(options) {
7043
7061
 
7044
7062
  //Setup token in Authorization header
7045
7063
  requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
7046
-
7064
+
7047
7065
  requestAPI.end(function(error, response) {
7048
7066
  if(error) {
7049
7067
  err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
@@ -8207,7 +8225,7 @@ function getAllCustomComponents(options) {
8207
8225
 
8208
8226
  // Setup request with URL and Params
8209
8227
  var params = {};
8210
- if (options.cursor) { params.cursor = options.cursor; }
8228
+ if (options && options.cursor) { params.cursor = options.cursor; }
8211
8229
 
8212
8230
  var requestAPI = request.get(url).query(params);
8213
8231
  if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
@@ -8230,7 +8248,718 @@ function getAllCustomComponents(options) {
8230
8248
  return deferred.promise;
8231
8249
  }
8232
8250
 
8233
- },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":38,"q":90,"superagent":135}],17:[function(require,module,exports){
8251
+ },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":39,"q":91,"superagent":136}],17:[function(require,module,exports){
8252
+ /*************************************************************************
8253
+ *
8254
+ * COMPRO CONFIDENTIAL
8255
+ * __________________
8256
+ *
8257
+ * [2015] - [2020] Compro Technologies Private Limited
8258
+ * All Rights Reserved.
8259
+ *
8260
+ * NOTICE: All information contained herein is, and remains
8261
+ * the property of Compro Technologies Private Limited. The
8262
+ * intellectual and technical concepts contained herein are
8263
+ * proprietary to Compro Technologies Private Limited and may
8264
+ * be covered by U.S. and Foreign Patents, patents in process,
8265
+ * and are protected by trade secret or copyright law.
8266
+ *
8267
+ * Dissemination of this information or reproduction of this material
8268
+ * is strictly forbidden unless prior written permission is obtained
8269
+ * from Compro Technologies Pvt. Ltd..
8270
+ ***************************************************************************/
8271
+
8272
+ /***********************************************************
8273
+ * comproDLS SDK AUTHEXTN Adaptor
8274
+ * Functions for calling AUTHEXTN API.
8275
+ ************************************************************/
8276
+
8277
+ var q = require('q');
8278
+ var request = require('superagent');
8279
+ var helpers = require('../../helpers');
8280
+ var Agent = require('agentkeepalive');
8281
+
8282
+ var DLSError = helpers.errors.DLSError;
8283
+
8284
+ /*********************************
8285
+ * Setting Up Module Entry Point
8286
+ **********************************/
8287
+ module.exports = authextn;
8288
+
8289
+ var keepaliveAgent = new Agent({
8290
+ timeout: 60000,
8291
+ freeSocketTimeout: 30000
8292
+ });
8293
+
8294
+ //AuthExtn Adaptor Contsructor
8295
+ function authextn() {
8296
+ return {
8297
+ createGradeformat: createGradeformat.bind(this),
8298
+ updateGradeformat: updateGradeformat.bind(this),
8299
+ deleteGradeformat: deleteGradeformat.bind(this),
8300
+ getAllGradeformats: getAllGradeformats.bind(this),
8301
+ getParticularGradeformat: getParticularGradeformat.bind(this),
8302
+ associateGradeformatToClass: associateGradeformatToClass.bind(this),
8303
+ unassociateGradeformatFromClass: unassociateGradeformatFromClass.bind(this),
8304
+ updateClassGradeformatAssociation: updateClassGradeformatAssociation.bind(this),
8305
+ getParticularGradeformatOfAClass: getParticularGradeformatOfAClass.bind(this),
8306
+ getAllGradeformatsOfAClass: getAllGradeformatsOfAClass.bind(this),
8307
+ getClassesOfAGradeformat: getClassesOfAGradeformat.bind(this)
8308
+ };
8309
+ }
8310
+
8311
+ /*********************************
8312
+ * Public Function definitions
8313
+ **********************************/
8314
+
8315
+ /*
8316
+ options = {
8317
+ body : {
8318
+ gradeformat_id: "string", //mandatory
8319
+ grades:[ { //mandatory
8320
+ id: "string",
8321
+ title: "string",
8322
+ min_threshold: "string",
8323
+ max_threshold: "string",
8324
+ target: boolean
8325
+ }, ...]
8326
+ data: {}
8327
+ }
8328
+ }
8329
+ */
8330
+ function createGradeformat(options) {
8331
+ var self = this;
8332
+ // Initializing promise
8333
+ var dfd = q.defer();
8334
+
8335
+ //Validations
8336
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8337
+ if(error) {
8338
+ dfd.reject(error);
8339
+ } else {
8340
+ if(options && options.body) {
8341
+ // Passed all validations, Contruct API url
8342
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.gradeFormat;
8343
+ url = helpers.api.constructAPIUrl(url, {
8344
+ orgid: self.orgId
8345
+ });
8346
+
8347
+ var requestAPI = request.post(url)
8348
+ .set('Content-Type', 'application/json')
8349
+ .set('Accept', 'application/json')
8350
+ .send(options.body);
8351
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8352
+
8353
+ //Setup token in Authorization header
8354
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8355
+
8356
+ requestAPI
8357
+ .agent(keepaliveAgent)
8358
+ .end(function(error, response) {
8359
+ if(error) {
8360
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8361
+ dfd.reject(err);
8362
+ }
8363
+ else { dfd.resolve(response.body); }
8364
+ });
8365
+ } else {
8366
+ var err = {};
8367
+ err.message = err.description = 'Mandatory param - body' +
8368
+ ' not found in request options.';
8369
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
8370
+ dfd.reject(err);
8371
+ }
8372
+ }
8373
+ return dfd.promise;
8374
+ }
8375
+
8376
+ /*
8377
+ options = {
8378
+ gradeformat_id: "string", // Mandatory
8379
+ body : {
8380
+ grades: [ {
8381
+ id: "string",
8382
+ title: "string",
8383
+ min_threshold: "string",
8384
+ max_threshold: "string",
8385
+ target: boolean
8386
+ }, ...]
8387
+ data: {...}
8388
+ }
8389
+ }
8390
+ */
8391
+ function updateGradeformat(options) {
8392
+ // Initializing promise
8393
+ var deferred = q.defer();
8394
+ var self = this;
8395
+ var error = {};
8396
+
8397
+ //Validations
8398
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
8399
+ if(err) {
8400
+ deferred.reject(err);
8401
+ } else {
8402
+ if (options && options.gradeformat_id && options.body) {
8403
+ if (Object.keys(options.body).length !== 0) {
8404
+ // Passed all validations, Contruct API url
8405
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.particularGradeFormat;
8406
+
8407
+ url = helpers.api.constructAPIUrl(url, {
8408
+ orgid: self.orgId, gradeformat_id: options.gradeformat_id
8409
+ });
8410
+
8411
+ var params = options.body;
8412
+ // Setup request with URL and Params
8413
+ var requestAPI = request.put(url)
8414
+ .set('Content-Type', 'application/json')
8415
+ .set('Accept', 'application/json')
8416
+ .send(params);
8417
+
8418
+ if (self.traceid) {
8419
+ requestAPI.set('X-Amzn-Trace-Id', self.traceid);
8420
+ }
8421
+
8422
+ //Setup token in Authorization header
8423
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8424
+
8425
+ requestAPI
8426
+ .agent(keepaliveAgent)
8427
+ .end(function(error, response) {
8428
+ if (error) {
8429
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8430
+ deferred.reject(error);
8431
+ } else {
8432
+ deferred.resolve(response.body);
8433
+ }
8434
+ });
8435
+ } else {
8436
+ error.message = error.description = 'Body of the request cannot be empty.';
8437
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8438
+ deferred.reject(error);
8439
+ }
8440
+ } else {
8441
+ error.message = error.description = 'Mandatory params: gradeformat_id or body' +
8442
+ ' not found in the request options.';
8443
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8444
+ deferred.reject(error);
8445
+ }
8446
+ }
8447
+
8448
+ return deferred.promise;
8449
+ }
8450
+
8451
+ /*
8452
+ options = {
8453
+ gradeformat_id: "string" //mandatory
8454
+ }
8455
+ */
8456
+ function deleteGradeformat(options) {
8457
+ var self = this;
8458
+ var dfd = q.defer();
8459
+
8460
+ //Validations
8461
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8462
+ if(error) {
8463
+ dfd.reject(error);
8464
+ } else {
8465
+ if(options && options.gradeformat_id) {
8466
+ // Passed all validations, Contruct API url
8467
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.particularGradeFormat;
8468
+ url = helpers.api.constructAPIUrl(url, {
8469
+ orgid: self.orgId, gradeformat_id: options.gradeformat_id
8470
+ });
8471
+
8472
+ // Setup request with URL and Params
8473
+ var requestAPI = request.delete(url);
8474
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8475
+
8476
+ //Setup token in Authorization header
8477
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8478
+
8479
+ requestAPI
8480
+ .agent(keepaliveAgent)
8481
+ .end(function (error, response) {
8482
+ if(error) {
8483
+ var err = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8484
+ dfd.reject(err);
8485
+ }
8486
+ else { dfd.resolve(response.body); }
8487
+ });
8488
+ }
8489
+ else {
8490
+ var err = {};
8491
+ err.message = err.description = 'Mandatory params - gradeformat_id' +
8492
+ ' not found in request options.';
8493
+ err = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, err);
8494
+ dfd.reject(err);
8495
+ }
8496
+ }
8497
+
8498
+ return dfd.promise;
8499
+ }
8500
+
8501
+ /*
8502
+ options = {
8503
+ gradeformat_id: "string" //mandatory
8504
+ }
8505
+ */
8506
+ function getParticularGradeformat (options) {
8507
+ // Initializing promise
8508
+ var deferred = q.defer();
8509
+ var self = this;
8510
+
8511
+ //Validations
8512
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
8513
+ if(err) {
8514
+ deferred.reject(err);
8515
+ } else {
8516
+ if (options && options.gradeformat_id) {
8517
+ // Passed all validations, Contruct API url
8518
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.gradeFormat ;
8519
+
8520
+ url = helpers.api.constructAPIUrl(url, {
8521
+ orgid: self.orgId
8522
+ });
8523
+
8524
+ // Setup request with URL and Params
8525
+ var params = {gradeformat_id: options.gradeformat_id};
8526
+ var requestAPI = request.get(url).query(params);
8527
+ if(self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8528
+
8529
+ //Setup token in Authorization header
8530
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8531
+
8532
+ requestAPI
8533
+ .agent(keepaliveAgent)
8534
+ .end(function(error, response) {
8535
+ if (error) {
8536
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8537
+ deferred.reject(error);
8538
+ } else {
8539
+ deferred.resolve(response.body.entities[0]);
8540
+ }
8541
+ });
8542
+ } else {
8543
+ var error = {};
8544
+ error.message = error.description = 'Mandatory params: gradeformat_id' +
8545
+ ' not found in request options.';
8546
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8547
+ deferred.reject(error);
8548
+ }
8549
+ }
8550
+ return deferred.promise;
8551
+ }
8552
+
8553
+ /*
8554
+ options = {
8555
+ cursor: "string"
8556
+ }
8557
+ */
8558
+ function getAllGradeformats (options) {
8559
+ // Initializing promise
8560
+ var deferred = q.defer();
8561
+ var self = this;
8562
+
8563
+ //Validations
8564
+ var err = helpers.validations.isAuthenticated(self.orgId, self.token);
8565
+ if(err) {
8566
+ deferred.reject(err);
8567
+ } else {
8568
+ // Passed all validations, Contruct API url
8569
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.gradeFormat;
8570
+
8571
+ url = helpers.api.constructAPIUrl(url, {
8572
+ orgid: self.orgId
8573
+ });
8574
+
8575
+ // Setup request with URL and Params
8576
+ var params = {};
8577
+ if(options && options.cursor){ params.cursor = options.cursor; }
8578
+
8579
+ var requestAPI = request.get(url).query(params);
8580
+
8581
+ if (self.traceid) {
8582
+ requestAPI.set('X-Amzn-Trace-Id', self.traceid);
8583
+ }
8584
+
8585
+ //Setup token in Authorization header
8586
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8587
+
8588
+ requestAPI
8589
+ .agent(keepaliveAgent)
8590
+ .end(function(error, response) {
8591
+ if (error) {
8592
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8593
+ deferred.reject(error);
8594
+ } else {
8595
+ deferred.resolve(response.body);
8596
+ }
8597
+ });
8598
+ }
8599
+ return deferred.promise;
8600
+ }
8601
+
8602
+ /**
8603
+ * @param {
8604
+ * *classid: 'string',
8605
+ * *gradeformat_id: 'string',
8606
+ * *body: {
8607
+ * *grades: [{
8608
+ * id: 'string',
8609
+ * title: 'string',
8610
+ * min_threshold: 'string',
8611
+ * max_threshold: 'string',
8612
+ * target: <boolean>
8613
+ * }],
8614
+ * data: {}
8615
+ * }
8616
+ * } options
8617
+ */
8618
+ function associateGradeformatToClass(options) {
8619
+ var self = this;
8620
+ // Initializing promise
8621
+ var deferred = q.defer();
8622
+ // Validations
8623
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8624
+ if (error) {
8625
+ deferred.reject(error);
8626
+ } else {
8627
+ if (options && options.classid && options.gradeformat_id && options.body) {
8628
+ // Passed all validations, Contruct API url
8629
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
8630
+ self.config.AUTHEXTN_API_URLS.classGradeformatAssociation;
8631
+
8632
+ url = helpers.api.constructAPIUrl(url, {
8633
+ orgid: self.orgId,
8634
+ classid: options.classid,
8635
+ gradeformat_id: options.gradeformat_id
8636
+ });
8637
+
8638
+ // Setup request with URL and Params
8639
+ var requestAPI = request
8640
+ .post(url)
8641
+ .set('Content-Type', 'application/json')
8642
+ .set('Accept', 'application/json')
8643
+ .send(options.body);
8644
+
8645
+ // Setup traceid in request header
8646
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8647
+
8648
+ // Setup token in Authorization header
8649
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8650
+
8651
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8652
+ if (error) {
8653
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8654
+ deferred.reject(error);
8655
+ } else {
8656
+ deferred.resolve(response.body);
8657
+ }
8658
+ });
8659
+ } else {
8660
+ error = {};
8661
+ error.message = error.description = 'Mandatory params - classid or gradeformat_id or body' +
8662
+ ' not found in request options.';
8663
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8664
+ deferred.reject(error);
8665
+ }
8666
+ }
8667
+
8668
+ return deferred.promise;
8669
+ }
8670
+
8671
+ /**
8672
+ * @param {
8673
+ * *classid: 'string',
8674
+ * *gradeformat_id: 'string'
8675
+ * } options
8676
+ */
8677
+ function unassociateGradeformatFromClass(options) {
8678
+ var self = this;
8679
+ // Initializing promise
8680
+ var deferred = q.defer();
8681
+ // Validations
8682
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8683
+ if (error) {
8684
+ deferred.reject(error);
8685
+ } else {
8686
+ if (options && options.classid && options.gradeformat_id) {
8687
+ // Passed all validations, Contruct API url
8688
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
8689
+ self.config.AUTHEXTN_API_URLS.classGradeformatAssociation;
8690
+
8691
+ url = helpers.api.constructAPIUrl(url, {
8692
+ orgid: self.orgId,
8693
+ classid: options.classid,
8694
+ gradeformat_id: options.gradeformat_id
8695
+ });
8696
+
8697
+ // Setup request with URL
8698
+ var requestAPI = request.delete(url);
8699
+
8700
+ // Setup traceid in request header
8701
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8702
+
8703
+ // Setup token in Authorization header
8704
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8705
+
8706
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8707
+ if (error) {
8708
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8709
+ deferred.reject(error);
8710
+ } else {
8711
+ deferred.resolve(response.body);
8712
+ }
8713
+ });
8714
+ } else {
8715
+ error = {};
8716
+ error.message = error.description = 'Mandatory params - classid or gradeformat_id' +
8717
+ ' not found in request options.';
8718
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8719
+ deferred.reject(error);
8720
+ }
8721
+ }
8722
+
8723
+ return deferred.promise;
8724
+ }
8725
+
8726
+ /**
8727
+ * @param {
8728
+ * *classid: 'string',
8729
+ * *gradeformat_id: 'string',
8730
+ * *body: {
8731
+ * grades: [{
8732
+ * id: 'string',
8733
+ * title: 'string',
8734
+ * min_threshold: 'string',
8735
+ * max_threshold: 'string',
8736
+ * target: <boolean>
8737
+ * }],
8738
+ * data: {}
8739
+ * }
8740
+ * } options
8741
+ */
8742
+ function updateClassGradeformatAssociation(options) {
8743
+ var self = this;
8744
+ // Initializing promise
8745
+ var deferred = q.defer();
8746
+ // Validations
8747
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8748
+ if (error) {
8749
+ deferred.reject(error);
8750
+ } else {
8751
+ if (options && options.classid && options.gradeformat_id && options.body) {
8752
+ // Passed all validations, Contruct API url
8753
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
8754
+ self.config.AUTHEXTN_API_URLS.classGradeformatAssociation;
8755
+
8756
+ url = helpers.api.constructAPIUrl(url, {
8757
+ orgid: self.orgId,
8758
+ classid: options.classid,
8759
+ gradeformat_id: options.gradeformat_id
8760
+ });
8761
+
8762
+ // Setup request with URL and Params
8763
+ var params = options.body;
8764
+ var requestAPI = request.put(url)
8765
+ .set('Content-Type', 'application/json')
8766
+ .set('Accept', 'application/json')
8767
+ .send(params);
8768
+
8769
+ // Setup traceid in request header
8770
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8771
+
8772
+ // Setup token in Authorization header
8773
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8774
+
8775
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8776
+ if (error) {
8777
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8778
+ deferred.reject(error);
8779
+ } else {
8780
+ deferred.resolve(response.body);
8781
+ }
8782
+ });
8783
+ } else {
8784
+ error = {};
8785
+ error.message = error.description = 'Mandatory params: classid or gradeformat_id or body' +
8786
+ ' not found in the request options.';
8787
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8788
+ deferred.reject(error);
8789
+ }
8790
+ }
8791
+
8792
+ return deferred.promise;
8793
+ }
8794
+
8795
+ /**
8796
+ * @param {
8797
+ * *classid: 'string',
8798
+ * *gradeformat_id: 'string'
8799
+ * } options
8800
+ */
8801
+ function getParticularGradeformatOfAClass(options) {
8802
+ var self = this;
8803
+ // Initializing promise
8804
+ var deferred = q.defer();
8805
+ // Validations
8806
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8807
+ if (error) {
8808
+ deferred.reject(error);
8809
+ } else {
8810
+ if (options && options.classid && options.gradeformat_id) {
8811
+ // Passed all validations, Contruct API url
8812
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.classGradeformats;
8813
+
8814
+ url = helpers.api.constructAPIUrl(url, {
8815
+ orgid: self.orgId,
8816
+ classid: options.classid
8817
+ });
8818
+
8819
+ // Setup request with URL and Params
8820
+ var params = { gradeformat_id: options.gradeformat_id };
8821
+ var requestAPI = request.get(url).query(params);
8822
+
8823
+ // Setup traceid in request header
8824
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8825
+
8826
+ // Setup token in Authorization header
8827
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8828
+
8829
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8830
+ if (error) {
8831
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8832
+ deferred.reject(error);
8833
+ } else {
8834
+ deferred.resolve(response.body.entities[0]);
8835
+ }
8836
+ });
8837
+ } else {
8838
+ error = {};
8839
+ error.message = error.description = 'Mandatory params: classid or gradeformat_id' +
8840
+ ' not found in request options.';
8841
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8842
+ deferred.reject(error);
8843
+ }
8844
+ }
8845
+
8846
+ return deferred.promise;
8847
+ }
8848
+
8849
+ /**
8850
+ * @param {
8851
+ * *classid: 'string',
8852
+ * cursor: 'string'
8853
+ * } options
8854
+ */
8855
+ function getAllGradeformatsOfAClass(options) {
8856
+ var self = this;
8857
+ // Initializing promise
8858
+ var deferred = q.defer();
8859
+ // Validations
8860
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8861
+ if (error) {
8862
+ deferred.reject(error);
8863
+ } else {
8864
+ if (options && options.classid) {
8865
+ // Passed all validations, Contruct API url
8866
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN + self.config.AUTHEXTN_API_URLS.classGradeformats;
8867
+
8868
+ url = helpers.api.constructAPIUrl(url, {
8869
+ orgid: self.orgId,
8870
+ classid: options.classid
8871
+ });
8872
+
8873
+ // Setup request with URL and Query Params
8874
+ var params = {};
8875
+ if (options.cursor) { params.cursor = options.cursor; }
8876
+
8877
+ var requestAPI = request.get(url).query(params);
8878
+
8879
+ // Setup traceid in request header
8880
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8881
+
8882
+ // Setup token in Authorization header
8883
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8884
+
8885
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8886
+ if (error) {
8887
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8888
+ deferred.reject(error);
8889
+ } else {
8890
+ deferred.resolve(response.body);
8891
+ }
8892
+ });
8893
+ } else {
8894
+ error = {};
8895
+ error.message = error.description = 'Mandatory params: classid' +
8896
+ ' not found in request options.';
8897
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8898
+ deferred.reject(error);
8899
+ }
8900
+ }
8901
+
8902
+ return deferred.promise;
8903
+ }
8904
+
8905
+ /**
8906
+ * @param {
8907
+ * *gradeformat_id: 'string',
8908
+ * cursor: 'string'
8909
+ * } options
8910
+ */
8911
+ function getClassesOfAGradeformat(options) {
8912
+ var self = this;
8913
+ // Initializing promise
8914
+ var deferred = q.defer();
8915
+ // Validations
8916
+ var error = helpers.validations.isAuthenticated(self.orgId, self.token);
8917
+ if (error) {
8918
+ deferred.reject(error);
8919
+ } else {
8920
+ if (options && options.gradeformat_id) {
8921
+ // Passed all validations, Contruct API url
8922
+ var url = self.config.DEFAULT_HOSTS.AUTHEXTN +
8923
+ self.config.AUTHEXTN_API_URLS.gradeformatClasses;
8924
+
8925
+ url = helpers.api.constructAPIUrl(url, {
8926
+ orgid: self.orgId,
8927
+ gradeformat_id: options.gradeformat_id
8928
+ });
8929
+
8930
+ // Setup request with URL and Query Params
8931
+ var params = {};
8932
+ if (options.cursor) { params.cursor = options.cursor; }
8933
+
8934
+ var requestAPI = request.get(url).query(params);
8935
+
8936
+ // Setup traceid in request header
8937
+ if (self.traceid) { requestAPI.set('X-Amzn-Trace-Id', self.traceid); }
8938
+
8939
+ // Setup token in Authorization header
8940
+ requestAPI = helpers.api.setupAPIToken(requestAPI, self.token);
8941
+
8942
+ requestAPI.agent(keepaliveAgent).end(function (error, response) {
8943
+ if (error) {
8944
+ error = new DLSError(helpers.errors.ERROR_TYPES.API_ERROR, error);
8945
+ deferred.reject(error);
8946
+ } else {
8947
+ deferred.resolve(response.body);
8948
+ }
8949
+ });
8950
+ } else {
8951
+ error = {};
8952
+ error.message = error.description = 'Mandatory params: gradeformat_id' +
8953
+ ' not found in request options.';
8954
+ error = new DLSError(helpers.errors.ERROR_TYPES.SDK_ERROR, error);
8955
+ deferred.reject(error);
8956
+ }
8957
+ }
8958
+
8959
+ return deferred.promise;
8960
+ }
8961
+
8962
+ },{"../../helpers":3,"agentkeepalive":39,"q":91,"superagent":136}],18:[function(require,module,exports){
8234
8963
  /*************************************************************************
8235
8964
  *
8236
8965
  * COMPRO CONFIDENTIAL
@@ -8700,7 +9429,7 @@ function updateConnectionForUser(orgid, token, config, options, action) {
8700
9429
  return dfd.promise;
8701
9430
  }
8702
9431
 
8703
- },{"../../helpers":3,"q":90,"superagent":135}],18:[function(require,module,exports){
9432
+ },{"../../helpers":3,"q":91,"superagent":136}],19:[function(require,module,exports){
8704
9433
  /*************************************************************************
8705
9434
  *
8706
9435
  * COMPRO CONFIDENTIAL
@@ -9012,7 +9741,7 @@ function getAllDataSyncManagersOfAGroup(options) {
9012
9741
  return deferred.promise;
9013
9742
  }
9014
9743
 
9015
- },{"../../helpers":3,"agentkeepalive":38,"q":90,"superagent":135}],19:[function(require,module,exports){
9744
+ },{"../../helpers":3,"agentkeepalive":39,"q":91,"superagent":136}],20:[function(require,module,exports){
9016
9745
  /*************************************************************************
9017
9746
  *
9018
9747
  * COMPRO CONFIDENTIAL
@@ -9158,7 +9887,7 @@ function getAllDocumentsInAFolder(options) {
9158
9887
  return dfd.promise;
9159
9888
  }
9160
9889
 
9161
- },{"../../helpers":3,"q":90,"superagent":135}],20:[function(require,module,exports){
9890
+ },{"../../helpers":3,"q":91,"superagent":136}],21:[function(require,module,exports){
9162
9891
  /*************************************************************************
9163
9892
  *
9164
9893
  * COMPRO CONFIDENTIAL
@@ -9715,7 +10444,7 @@ function deleteSchedule(options) {
9715
10444
  return deferred.promise;
9716
10445
  }
9717
10446
 
9718
- },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":38,"q":90,"superagent":135}],21:[function(require,module,exports){
10447
+ },{"../../helpers":3,"../../helpers/lib/api/converter":4,"agentkeepalive":39,"q":91,"superagent":136}],22:[function(require,module,exports){
9719
10448
  /*************************************************************************
9720
10449
  *
9721
10450
  * COMPRO CONFIDENTIAL
@@ -10040,7 +10769,7 @@ function resendSingleInvitation(options) {
10040
10769
  return dfd.promise;
10041
10770
  }
10042
10771
 
10043
- },{"../../helpers":3,"q":90,"superagent":135}],22:[function(require,module,exports){
10772
+ },{"../../helpers":3,"q":91,"superagent":136}],23:[function(require,module,exports){
10044
10773
  /*************************************************************************
10045
10774
  *
10046
10775
  * COMPRO CONFIDENTIAL
@@ -10501,7 +11230,7 @@ function createStatement(options) {
10501
11230
  }*/
10502
11231
 
10503
11232
 
10504
- },{"../../helpers":3,"q":90,"tincanjs":136}],23:[function(require,module,exports){
11233
+ },{"../../helpers":3,"q":91,"tincanjs":137}],24:[function(require,module,exports){
10505
11234
  /*************************************************************************
10506
11235
  *
10507
11236
  * COMPRO CONFIDENTIAL
@@ -10849,7 +11578,7 @@ function getSingleProductFamily(options) {
10849
11578
  return dfd.promise;
10850
11579
  }
10851
11580
 
10852
- },{"../../helpers":3,"q":90,"superagent":135}],24:[function(require,module,exports){
11581
+ },{"../../helpers":3,"q":91,"superagent":136}],25:[function(require,module,exports){
10853
11582
  /*************************************************************************
10854
11583
  *
10855
11584
  * COMPRO CONFIDENTIAL
@@ -11449,7 +12178,7 @@ function getAllProductFamilies(options) {
11449
12178
  return dfd.promise;
11450
12179
  }
11451
12180
 
11452
- },{"../../helpers":3,"q":90,"superagent":135}],25:[function(require,module,exports){
12181
+ },{"../../helpers":3,"q":91,"superagent":136}],26:[function(require,module,exports){
11453
12182
  /*************************************************************************
11454
12183
  *
11455
12184
  * COMPRO CONFIDENTIAL
@@ -11649,7 +12378,7 @@ function grantByAccountIdOnExtUserId(options) {
11649
12378
  }
11650
12379
 
11651
12380
 
11652
- },{"../../helpers":3,"./pubnubClientWrapper":26,"q":90,"superagent":135}],26:[function(require,module,exports){
12381
+ },{"../../helpers":3,"./pubnubClientWrapper":27,"q":91,"superagent":136}],27:[function(require,module,exports){
11653
12382
  var pubNub = require("pubnub");
11654
12383
  var EventEmitter = require("events").EventEmitter;
11655
12384
  var helpers = require('../../helpers');
@@ -11862,7 +12591,7 @@ module.exports = function () {
11862
12591
 
11863
12592
  }; //End of Client Wrapper module
11864
12593
 
11865
- },{"../../helpers":3,"events":69,"pubnub":88}],27:[function(require,module,exports){
12594
+ },{"../../helpers":3,"events":70,"pubnub":89}],28:[function(require,module,exports){
11866
12595
  /*************************************************************************
11867
12596
  *
11868
12597
  * COMPRO CONFIDENTIAL
@@ -12051,7 +12780,7 @@ function _setup(orgId, userId) {
12051
12780
  return dfd.promise;
12052
12781
  }
12053
12782
 
12054
- },{"../../helpers":3,"events":69,"q":90,"socket.io-client":112}],28:[function(require,module,exports){
12783
+ },{"../../helpers":3,"events":70,"q":91,"socket.io-client":113}],29:[function(require,module,exports){
12055
12784
  /*************************************************************************
12056
12785
  *
12057
12786
  * COMPRO CONFIDENTIAL
@@ -12518,7 +13247,7 @@ function deleteRule(options) {
12518
13247
  return dfd.promise;
12519
13248
  }
12520
13249
 
12521
- },{"../../helpers":3,"q":90,"superagent":135}],29:[function(require,module,exports){
13250
+ },{"../../helpers":3,"q":91,"superagent":136}],30:[function(require,module,exports){
12522
13251
  /*************************************************************************
12523
13252
  *
12524
13253
  * COMPRO CONFIDENTIAL
@@ -12633,7 +13362,7 @@ function postSISEvent(options) {
12633
13362
  return dfd.promise;
12634
13363
  }
12635
13364
 
12636
- },{"../../helpers":3,"q":90,"superagent":135,"underscore":138}],30:[function(require,module,exports){
13365
+ },{"../../helpers":3,"q":91,"superagent":136,"underscore":139}],31:[function(require,module,exports){
12637
13366
  /*************************************************************************
12638
13367
  *
12639
13368
  * COMPRO CONFIDENTIAL
@@ -13787,7 +14516,7 @@ function updateInstituteTitle(options){
13787
14516
  return dfd.promise;
13788
14517
  }
13789
14518
 
13790
- },{"../../helpers":3,"agentkeepalive":38,"q":90,"superagent":135}],31:[function(require,module,exports){
14519
+ },{"../../helpers":3,"agentkeepalive":39,"q":91,"superagent":136}],32:[function(require,module,exports){
13791
14520
  /*************************************************************************
13792
14521
  *
13793
14522
  * COMPRO CONFIDENTIAL
@@ -13964,7 +14693,7 @@ function provisionSpacesToSuperAdmin(options) {
13964
14693
  return dfd.promise;
13965
14694
  }
13966
14695
 
13967
- },{"../../helpers":3,"q":90,"superagent":135}],32:[function(require,module,exports){
14696
+ },{"../../helpers":3,"q":91,"superagent":136}],33:[function(require,module,exports){
13968
14697
  /*************************************************************************
13969
14698
  *
13970
14699
  * COMPRO CONFIDENTIAL
@@ -14401,7 +15130,7 @@ function getAllTags(options) {
14401
15130
  return dfd.promise;
14402
15131
  }
14403
15132
 
14404
- },{"../../helpers":3,"q":90,"superagent":135}],33:[function(require,module,exports){
15133
+ },{"../../helpers":3,"q":91,"superagent":136}],34:[function(require,module,exports){
14405
15134
  /*************************************************************************
14406
15135
  *
14407
15136
  * COMPRO CONFIDENTIAL
@@ -14867,7 +15596,7 @@ function updateWorkflowRequest(options) {
14867
15596
  }
14868
15597
  return dfd.promise;
14869
15598
  }
14870
- },{"./../../helpers":3,"q":90,"superagent":135}],34:[function(require,module,exports){
15599
+ },{"./../../helpers":3,"q":91,"superagent":136}],35:[function(require,module,exports){
14871
15600
  /*************************************************************************
14872
15601
  *
14873
15602
  * COMPRO CONFIDENTIAL
@@ -15144,7 +15873,7 @@ function resetUserProductProgress(options) {
15144
15873
  return dfd.promise;
15145
15874
  }
15146
15875
 
15147
- },{"../../helpers":3,"q":90,"superagent":135}],35:[function(require,module,exports){
15876
+ },{"../../helpers":3,"q":91,"superagent":136}],36:[function(require,module,exports){
15148
15877
  /*************************************************************************
15149
15878
  *
15150
15879
  * COMPRO CONFIDENTIAL
@@ -15260,7 +15989,7 @@ function authWithToken(organizationId, token, options) {
15260
15989
  return dfd.promise;
15261
15990
  };
15262
15991
 
15263
- },{"../helpers":3,"./validations":36,"q":90,"superagent":135}],36:[function(require,module,exports){
15992
+ },{"../helpers":3,"./validations":37,"q":91,"superagent":136}],37:[function(require,module,exports){
15264
15993
  /*************************************************************************
15265
15994
  *
15266
15995
  * COMPRO CONFIDENTIAL
@@ -15350,7 +16079,7 @@ function validateAuthWithExtUser(organizationId, options) {
15350
16079
  };
15351
16080
 
15352
16081
 
15353
- },{"../helpers":3}],37:[function(require,module,exports){
16082
+ },{"../helpers":3}],38:[function(require,module,exports){
15354
16083
  module.exports = after
15355
16084
 
15356
16085
  function after(count, callback, err_cb) {
@@ -15380,14 +16109,14 @@ function after(count, callback, err_cb) {
15380
16109
 
15381
16110
  function noop() {}
15382
16111
 
15383
- },{}],38:[function(require,module,exports){
16112
+ },{}],39:[function(require,module,exports){
15384
16113
  module.exports = noop;
15385
16114
  module.exports.HttpsAgent = noop;
15386
16115
 
15387
16116
  // Noop function for browser since native api's don't use agents.
15388
16117
  function noop () {}
15389
16118
 
15390
- },{}],39:[function(require,module,exports){
16119
+ },{}],40:[function(require,module,exports){
15391
16120
  /**
15392
16121
  * An abstraction for slicing an arraybuffer even when
15393
16122
  * ArrayBuffer.prototype.slice is not supported
@@ -15418,7 +16147,7 @@ module.exports = function(arraybuffer, start, end) {
15418
16147
  return result.buffer;
15419
16148
  };
15420
16149
 
15421
- },{}],40:[function(require,module,exports){
16150
+ },{}],41:[function(require,module,exports){
15422
16151
 
15423
16152
  /**
15424
16153
  * Expose `Backoff`.
@@ -15505,7 +16234,7 @@ Backoff.prototype.setJitter = function(jitter){
15505
16234
  };
15506
16235
 
15507
16236
 
15508
- },{}],41:[function(require,module,exports){
16237
+ },{}],42:[function(require,module,exports){
15509
16238
  /*
15510
16239
  * base64-arraybuffer
15511
16240
  * https://github.com/niklasvh/base64-arraybuffer
@@ -15566,7 +16295,7 @@ Backoff.prototype.setJitter = function(jitter){
15566
16295
  };
15567
16296
  })("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/");
15568
16297
 
15569
- },{}],42:[function(require,module,exports){
16298
+ },{}],43:[function(require,module,exports){
15570
16299
  var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
15571
16300
 
15572
16301
  ;(function (exports) {
@@ -15692,7 +16421,7 @@ var lookup = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
15692
16421
  exports.fromByteArray = uint8ToBase64
15693
16422
  }(typeof exports === 'undefined' ? (this.base64js = {}) : exports))
15694
16423
 
15695
- },{}],43:[function(require,module,exports){
16424
+ },{}],44:[function(require,module,exports){
15696
16425
  (function (global){
15697
16426
  /**
15698
16427
  * Create a blob builder even when vendor prefixes exist
@@ -15792,9 +16521,9 @@ module.exports = (function() {
15792
16521
  })();
15793
16522
 
15794
16523
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
15795
- },{}],44:[function(require,module,exports){
15796
-
15797
16524
  },{}],45:[function(require,module,exports){
16525
+
16526
+ },{}],46:[function(require,module,exports){
15798
16527
  (function (global){
15799
16528
  /*!
15800
16529
  * The buffer module from node.js, for the browser.
@@ -17346,14 +18075,14 @@ function blitBuffer (src, dst, offset, length) {
17346
18075
  }
17347
18076
 
17348
18077
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
17349
- },{"base64-js":42,"ieee754":75,"isarray":46}],46:[function(require,module,exports){
18078
+ },{"base64-js":43,"ieee754":76,"isarray":47}],47:[function(require,module,exports){
17350
18079
  var toString = {}.toString;
17351
18080
 
17352
18081
  module.exports = Array.isArray || function (arr) {
17353
18082
  return toString.call(arr) == '[object Array]';
17354
18083
  };
17355
18084
 
17356
- },{}],47:[function(require,module,exports){
18085
+ },{}],48:[function(require,module,exports){
17357
18086
  module.exports = {
17358
18087
  "100": "Continue",
17359
18088
  "101": "Switching Protocols",
@@ -17414,7 +18143,7 @@ module.exports = {
17414
18143
  "511": "Network Authentication Required"
17415
18144
  }
17416
18145
 
17417
- },{}],48:[function(require,module,exports){
18146
+ },{}],49:[function(require,module,exports){
17418
18147
  /**
17419
18148
  * Slice reference.
17420
18149
  */
@@ -17439,7 +18168,7 @@ module.exports = function(obj, fn){
17439
18168
  }
17440
18169
  };
17441
18170
 
17442
- },{}],49:[function(require,module,exports){
18171
+ },{}],50:[function(require,module,exports){
17443
18172
 
17444
18173
  /**
17445
18174
  * Expose `Emitter`.
@@ -17602,7 +18331,7 @@ Emitter.prototype.hasListeners = function(event){
17602
18331
  return !! this.listeners(event).length;
17603
18332
  };
17604
18333
 
17605
- },{}],50:[function(require,module,exports){
18334
+ },{}],51:[function(require,module,exports){
17606
18335
 
17607
18336
  module.exports = function(a, b){
17608
18337
  var fn = function(){};
@@ -17610,7 +18339,7 @@ module.exports = function(a, b){
17610
18339
  a.prototype = new fn;
17611
18340
  a.prototype.constructor = a;
17612
18341
  };
17613
- },{}],51:[function(require,module,exports){
18342
+ },{}],52:[function(require,module,exports){
17614
18343
  // Copyright Joyent, Inc. and other Node contributors.
17615
18344
  //
17616
18345
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -17719,11 +18448,11 @@ function objectToString(o) {
17719
18448
  return Object.prototype.toString.call(o);
17720
18449
  }
17721
18450
 
17722
- },{"buffer":45}],52:[function(require,module,exports){
18451
+ },{"buffer":46}],53:[function(require,module,exports){
17723
18452
 
17724
18453
  module.exports = require('./lib/');
17725
18454
 
17726
- },{"./lib/":53}],53:[function(require,module,exports){
18455
+ },{"./lib/":54}],54:[function(require,module,exports){
17727
18456
 
17728
18457
  module.exports = require('./socket');
17729
18458
 
@@ -17735,7 +18464,7 @@ module.exports = require('./socket');
17735
18464
  */
17736
18465
  module.exports.parser = require('engine.io-parser');
17737
18466
 
17738
- },{"./socket":54,"engine.io-parser":66}],54:[function(require,module,exports){
18467
+ },{"./socket":55,"engine.io-parser":67}],55:[function(require,module,exports){
17739
18468
  (function (global){
17740
18469
  /**
17741
18470
  * Module dependencies.
@@ -18467,7 +19196,7 @@ Socket.prototype.filterUpgrades = function (upgrades) {
18467
19196
  };
18468
19197
 
18469
19198
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18470
- },{"./transport":55,"./transports":56,"component-emitter":62,"debug":63,"engine.io-parser":66,"indexof":76,"parsejson":83,"parseqs":84,"parseuri":85}],55:[function(require,module,exports){
19199
+ },{"./transport":56,"./transports":57,"component-emitter":63,"debug":64,"engine.io-parser":67,"indexof":77,"parsejson":84,"parseqs":85,"parseuri":86}],56:[function(require,module,exports){
18471
19200
  /**
18472
19201
  * Module dependencies.
18473
19202
  */
@@ -18624,7 +19353,7 @@ Transport.prototype.onClose = function () {
18624
19353
  this.emit('close');
18625
19354
  };
18626
19355
 
18627
- },{"component-emitter":62,"engine.io-parser":66}],56:[function(require,module,exports){
19356
+ },{"component-emitter":63,"engine.io-parser":67}],57:[function(require,module,exports){
18628
19357
  (function (global){
18629
19358
  /**
18630
19359
  * Module dependencies
@@ -18681,7 +19410,7 @@ function polling(opts){
18681
19410
  }
18682
19411
 
18683
19412
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18684
- },{"./polling-jsonp":57,"./polling-xhr":58,"./websocket":60,"xmlhttprequest-ssl":61}],57:[function(require,module,exports){
19413
+ },{"./polling-jsonp":58,"./polling-xhr":59,"./websocket":61,"xmlhttprequest-ssl":62}],58:[function(require,module,exports){
18685
19414
  (function (global){
18686
19415
 
18687
19416
  /**
@@ -18923,7 +19652,7 @@ JSONPPolling.prototype.doWrite = function (data, fn) {
18923
19652
  };
18924
19653
 
18925
19654
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
18926
- },{"./polling":59,"component-inherit":50}],58:[function(require,module,exports){
19655
+ },{"./polling":60,"component-inherit":51}],59:[function(require,module,exports){
18927
19656
  (function (global){
18928
19657
  /**
18929
19658
  * Module requirements.
@@ -19339,7 +20068,7 @@ function unloadHandler() {
19339
20068
  }
19340
20069
 
19341
20070
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
19342
- },{"./polling":59,"component-emitter":62,"component-inherit":50,"debug":63,"xmlhttprequest-ssl":61}],59:[function(require,module,exports){
20071
+ },{"./polling":60,"component-emitter":63,"component-inherit":51,"debug":64,"xmlhttprequest-ssl":62}],60:[function(require,module,exports){
19343
20072
  /**
19344
20073
  * Module dependencies.
19345
20074
  */
@@ -19588,7 +20317,7 @@ Polling.prototype.uri = function(){
19588
20317
  return schema + '://' + (ipv6 ? '[' + this.hostname + ']' : this.hostname) + port + this.path + query;
19589
20318
  };
19590
20319
 
19591
- },{"../transport":55,"component-inherit":50,"debug":63,"engine.io-parser":66,"parseqs":84,"xmlhttprequest-ssl":61,"yeast":145}],60:[function(require,module,exports){
20320
+ },{"../transport":56,"component-inherit":51,"debug":64,"engine.io-parser":67,"parseqs":85,"xmlhttprequest-ssl":62,"yeast":146}],61:[function(require,module,exports){
19592
20321
  (function (global){
19593
20322
  /**
19594
20323
  * Module dependencies.
@@ -19880,7 +20609,7 @@ WS.prototype.check = function(){
19880
20609
  };
19881
20610
 
19882
20611
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
19883
- },{"../transport":55,"component-inherit":50,"debug":63,"engine.io-parser":66,"parseqs":84,"ws":44,"yeast":145}],61:[function(require,module,exports){
20612
+ },{"../transport":56,"component-inherit":51,"debug":64,"engine.io-parser":67,"parseqs":85,"ws":45,"yeast":146}],62:[function(require,module,exports){
19884
20613
  // browser shim for xmlhttprequest module
19885
20614
  var hasCORS = require('has-cors');
19886
20615
 
@@ -19918,7 +20647,7 @@ module.exports = function(opts) {
19918
20647
  }
19919
20648
  }
19920
20649
 
19921
- },{"has-cors":73}],62:[function(require,module,exports){
20650
+ },{"has-cors":74}],63:[function(require,module,exports){
19922
20651
 
19923
20652
  /**
19924
20653
  * Expose `Emitter`.
@@ -20084,7 +20813,7 @@ Emitter.prototype.hasListeners = function(event){
20084
20813
  return !! this.listeners(event).length;
20085
20814
  };
20086
20815
 
20087
- },{}],63:[function(require,module,exports){
20816
+ },{}],64:[function(require,module,exports){
20088
20817
 
20089
20818
  /**
20090
20819
  * This is the web browser implementation of `debug()`.
@@ -20254,7 +20983,7 @@ function localstorage(){
20254
20983
  } catch (e) {}
20255
20984
  }
20256
20985
 
20257
- },{"./debug":64}],64:[function(require,module,exports){
20986
+ },{"./debug":65}],65:[function(require,module,exports){
20258
20987
 
20259
20988
  /**
20260
20989
  * This is the common logic for both the Node.js and web browser
@@ -20453,7 +21182,7 @@ function coerce(val) {
20453
21182
  return val;
20454
21183
  }
20455
21184
 
20456
- },{"ms":65}],65:[function(require,module,exports){
21185
+ },{"ms":66}],66:[function(require,module,exports){
20457
21186
  /**
20458
21187
  * Helpers.
20459
21188
  */
@@ -20580,7 +21309,7 @@ function plural(ms, n, name) {
20580
21309
  return Math.ceil(ms / n) + ' ' + name + 's';
20581
21310
  }
20582
21311
 
20583
- },{}],66:[function(require,module,exports){
21312
+ },{}],67:[function(require,module,exports){
20584
21313
  (function (global){
20585
21314
  /**
20586
21315
  * Module dependencies.
@@ -21178,7 +21907,7 @@ exports.decodePayloadAsBinary = function (data, binaryType, callback) {
21178
21907
  };
21179
21908
 
21180
21909
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21181
- },{"./keys":67,"after":37,"arraybuffer.slice":39,"base64-arraybuffer":41,"blob":43,"has-binary":68,"utf8":140}],67:[function(require,module,exports){
21910
+ },{"./keys":68,"after":38,"arraybuffer.slice":40,"base64-arraybuffer":42,"blob":44,"has-binary":69,"utf8":141}],68:[function(require,module,exports){
21182
21911
 
21183
21912
  /**
21184
21913
  * Gets the keys for an object.
@@ -21199,7 +21928,7 @@ module.exports = Object.keys || function keys (obj){
21199
21928
  return arr;
21200
21929
  };
21201
21930
 
21202
- },{}],68:[function(require,module,exports){
21931
+ },{}],69:[function(require,module,exports){
21203
21932
  (function (global){
21204
21933
 
21205
21934
  /*
@@ -21261,7 +21990,7 @@ function hasBinary(data) {
21261
21990
  }
21262
21991
 
21263
21992
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21264
- },{"isarray":77}],69:[function(require,module,exports){
21993
+ },{"isarray":78}],70:[function(require,module,exports){
21265
21994
  // Copyright Joyent, Inc. and other Node contributors.
21266
21995
  //
21267
21996
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -21564,7 +22293,7 @@ function isUndefined(arg) {
21564
22293
  return arg === void 0;
21565
22294
  }
21566
22295
 
21567
- },{}],70:[function(require,module,exports){
22296
+ },{}],71:[function(require,module,exports){
21568
22297
  var hasOwn = Object.prototype.hasOwnProperty;
21569
22298
  var toStr = Object.prototype.toString;
21570
22299
  var defineProperty = Object.defineProperty;
@@ -21685,7 +22414,7 @@ module.exports = function extend() {
21685
22414
  return target;
21686
22415
  };
21687
22416
 
21688
- },{}],71:[function(require,module,exports){
22417
+ },{}],72:[function(require,module,exports){
21689
22418
 
21690
22419
  var hasOwn = Object.prototype.hasOwnProperty;
21691
22420
  var toString = Object.prototype.toString;
@@ -21709,7 +22438,7 @@ module.exports = function forEach (obj, fn, ctx) {
21709
22438
  };
21710
22439
 
21711
22440
 
21712
- },{}],72:[function(require,module,exports){
22441
+ },{}],73:[function(require,module,exports){
21713
22442
  (function (global){
21714
22443
 
21715
22444
  /*
@@ -21772,7 +22501,7 @@ function hasBinary(data) {
21772
22501
  }
21773
22502
 
21774
22503
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
21775
- },{"isarray":77}],73:[function(require,module,exports){
22504
+ },{"isarray":78}],74:[function(require,module,exports){
21776
22505
 
21777
22506
  /**
21778
22507
  * Module exports.
@@ -21791,7 +22520,7 @@ try {
21791
22520
  module.exports = false;
21792
22521
  }
21793
22522
 
21794
- },{}],74:[function(require,module,exports){
22523
+ },{}],75:[function(require,module,exports){
21795
22524
  var http = require('http');
21796
22525
 
21797
22526
  var https = module.exports;
@@ -21807,7 +22536,7 @@ https.request = function (params, cb) {
21807
22536
  return http.request.call(this, params, cb);
21808
22537
  }
21809
22538
 
21810
- },{"http":129}],75:[function(require,module,exports){
22539
+ },{"http":130}],76:[function(require,module,exports){
21811
22540
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
21812
22541
  exports.read = function (buffer, offset, isLE, mLen, nBytes) {
21813
22542
  var e, m
@@ -21894,7 +22623,7 @@ exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
21894
22623
  buffer[offset + i - d] |= s * 128
21895
22624
  }
21896
22625
 
21897
- },{}],76:[function(require,module,exports){
22626
+ },{}],77:[function(require,module,exports){
21898
22627
 
21899
22628
  var indexOf = [].indexOf;
21900
22629
 
@@ -21905,12 +22634,12 @@ module.exports = function(arr, obj){
21905
22634
  }
21906
22635
  return -1;
21907
22636
  };
21908
- },{}],77:[function(require,module,exports){
22637
+ },{}],78:[function(require,module,exports){
21909
22638
  module.exports = Array.isArray || function (arr) {
21910
22639
  return Object.prototype.toString.call(arr) == '[object Array]';
21911
22640
  };
21912
22641
 
21913
- },{}],78:[function(require,module,exports){
22642
+ },{}],79:[function(require,module,exports){
21914
22643
  (function (global){
21915
22644
  /*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */
21916
22645
  ;(function () {
@@ -22816,7 +23545,7 @@ module.exports = Array.isArray || function (arr) {
22816
23545
  }).call(this);
22817
23546
 
22818
23547
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
22819
- },{}],79:[function(require,module,exports){
23548
+ },{}],80:[function(require,module,exports){
22820
23549
  'use strict';
22821
23550
 
22822
23551
  var keysShim;
@@ -22940,7 +23669,7 @@ if (!Object.keys) {
22940
23669
  }
22941
23670
  module.exports = keysShim;
22942
23671
 
22943
- },{"./isArguments":81}],80:[function(require,module,exports){
23672
+ },{"./isArguments":82}],81:[function(require,module,exports){
22944
23673
  'use strict';
22945
23674
 
22946
23675
  var slice = Array.prototype.slice;
@@ -22974,7 +23703,7 @@ keysShim.shim = function shimObjectKeys() {
22974
23703
 
22975
23704
  module.exports = keysShim;
22976
23705
 
22977
- },{"./implementation":79,"./isArguments":81}],81:[function(require,module,exports){
23706
+ },{"./implementation":80,"./isArguments":82}],82:[function(require,module,exports){
22978
23707
  'use strict';
22979
23708
 
22980
23709
  var toStr = Object.prototype.toString;
@@ -22993,7 +23722,7 @@ module.exports = function isArguments(value) {
22993
23722
  return isArgs;
22994
23723
  };
22995
23724
 
22996
- },{}],82:[function(require,module,exports){
23725
+ },{}],83:[function(require,module,exports){
22997
23726
  exports.endianness = function () { return 'LE' };
22998
23727
 
22999
23728
  exports.hostname = function () {
@@ -23040,7 +23769,7 @@ exports.tmpdir = exports.tmpDir = function () {
23040
23769
 
23041
23770
  exports.EOL = '\n';
23042
23771
 
23043
- },{}],83:[function(require,module,exports){
23772
+ },{}],84:[function(require,module,exports){
23044
23773
  (function (global){
23045
23774
  /**
23046
23775
  * JSON parse.
@@ -23075,7 +23804,7 @@ module.exports = function parsejson(data) {
23075
23804
  }
23076
23805
  };
23077
23806
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
23078
- },{}],84:[function(require,module,exports){
23807
+ },{}],85:[function(require,module,exports){
23079
23808
  /**
23080
23809
  * Compiles a querystring
23081
23810
  * Returns string representation of the object
@@ -23114,7 +23843,7 @@ exports.decode = function(qs){
23114
23843
  return qry;
23115
23844
  };
23116
23845
 
23117
- },{}],85:[function(require,module,exports){
23846
+ },{}],86:[function(require,module,exports){
23118
23847
  /**
23119
23848
  * Parses an URI
23120
23849
  *
@@ -23155,7 +23884,7 @@ module.exports = function parseuri(str) {
23155
23884
  return uri;
23156
23885
  };
23157
23886
 
23158
- },{}],86:[function(require,module,exports){
23887
+ },{}],87:[function(require,module,exports){
23159
23888
  (function (process){
23160
23889
  'use strict';
23161
23890
 
@@ -23204,7 +23933,7 @@ function nextTick(fn, arg1, arg2, arg3) {
23204
23933
 
23205
23934
 
23206
23935
  }).call(this,require('_process'))
23207
- },{"_process":87}],87:[function(require,module,exports){
23936
+ },{"_process":88}],88:[function(require,module,exports){
23208
23937
  // shim for using process in browser
23209
23938
  var process = module.exports = {};
23210
23939
 
@@ -23390,7 +24119,7 @@ process.chdir = function (dir) {
23390
24119
  };
23391
24120
  process.umask = function() { return 0; };
23392
24121
 
23393
- },{}],88:[function(require,module,exports){
24122
+ },{}],89:[function(require,module,exports){
23394
24123
  (function (global,Buffer){
23395
24124
  !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).PubNub=t()}(this,(function(){"use strict";
23396
24125
  /*! *****************************************************************************
@@ -23411,7 +24140,7 @@ process.umask = function() { return 0; };
23411
24140
  !function(e,t){!function(e){var t="0.1.0",n={3:/^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[0-9A-F]{4}-[0-9A-F]{12}$/i,4:/^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,5:/^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i,all:/^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i};function r(){var e,t,n="";for(e=0;e<32;e++)t=16*Math.random()|0,8!==e&&12!==e&&16!==e&&20!==e||(n+="-"),n+=(12===e?4:16===e?3&t|8:t).toString(16);return n}function i(e,t){var r=n[t||"all"];return r&&r.test(e)||!1}r.isUUID=i,r.VERSION=t,e.uuid=r,e.isUUID=i}(t),null!==e&&(e.exports=t.uuid)}(p,p.exports);var h,f,d,g,y,b=p.exports,v=function(){return b.uuid?b.uuid():b()},m=function(){function e(e){var t,n,r,i=e.setup;if(this._PNSDKSuffix={},this.instanceId="pn-".concat(v()),this.secretKey=i.secretKey||i.secret_key,this.subscribeKey=i.subscribeKey||i.subscribe_key,this.publishKey=i.publishKey||i.publish_key,this.sdkName=i.sdkName,this.sdkFamily=i.sdkFamily,this.partnerId=i.partnerId,this.setAuthKey(i.authKey),this.setCipherKey(i.cipherKey),this.setFilterExpression(i.filterExpression),"string"!=typeof i.origin&&!Array.isArray(i.origin)&&void 0!==i.origin)throw new Error("Origin must be either undefined, a string or a list of strings.");this.origin=i.origin||Array.from({length:20},(function(e,t){return"ps".concat(t+1,".pndsn.com")})),this.secure=i.ssl||!1,this.restore=i.restore||!1,this.proxy=i.proxy,this.keepAlive=i.keepAlive,this.keepAliveSettings=i.keepAliveSettings,this.autoNetworkDetection=i.autoNetworkDetection||!1,this.dedupeOnSubscribe=i.dedupeOnSubscribe||!1,this.maximumCacheSize=i.maximumCacheSize||100,this.customEncrypt=i.customEncrypt,this.customDecrypt=i.customDecrypt,this.fileUploadPublishRetryLimit=null!==(t=i.fileUploadPublishRetryLimit)&&void 0!==t?t:5,this.useRandomIVs=null===(n=i.useRandomIVs)||void 0===n||n,this.enableSubscribeBeta=null!==(r=i.enableSubscribeBeta)&&void 0!==r&&r,"undefined"!=typeof location&&"https:"===location.protocol&&(this.secure=!0),this.logVerbosity=i.logVerbosity||!1,this.suppressLeaveEvents=i.suppressLeaveEvents||!1,this.announceFailedHeartbeats=i.announceFailedHeartbeats||!0,this.announceSuccessfulHeartbeats=i.announceSuccessfulHeartbeats||!1,this.useInstanceId=i.useInstanceId||!1,this.useRequestId=i.useRequestId||!1,this.requestMessageCountThreshold=i.requestMessageCountThreshold,this.setTransactionTimeout(i.transactionalRequestTimeout||15e3),this.setSubscribeTimeout(i.subscribeRequestTimeout||31e4),this.setSendBeaconConfig(i.useSendBeacon||!0),i.presenceTimeout?this.setPresenceTimeout(i.presenceTimeout):this._presenceTimeout=300,null!=i.heartbeatInterval&&this.setHeartbeatInterval(i.heartbeatInterval),this.setUUID(i.uuid)}return e.prototype.getAuthKey=function(){return this.authKey},e.prototype.setAuthKey=function(e){return this.authKey=e,this},e.prototype.setCipherKey=function(e){return this.cipherKey=e,this},e.prototype.getUUID=function(){return this.UUID},e.prototype.setUUID=function(e){if(!e||"string"!=typeof e||0===e.trim().length)throw new Error("Missing uuid parameter. Provide a valid string uuid");return this.UUID=e,this},e.prototype.getFilterExpression=function(){return this.filterExpression},e.prototype.setFilterExpression=function(e){return this.filterExpression=e,this},e.prototype.getPresenceTimeout=function(){return this._presenceTimeout},e.prototype.setPresenceTimeout=function(e){return e>=20?this._presenceTimeout=e:(this._presenceTimeout=20,console.log("WARNING: Presence timeout is less than the minimum. Using minimum value: ",this._presenceTimeout)),this.setHeartbeatInterval(this._presenceTimeout/2-1),this},e.prototype.setProxy=function(e){this.proxy=e},e.prototype.getHeartbeatInterval=function(){return this._heartbeatInterval},e.prototype.setHeartbeatInterval=function(e){return this._heartbeatInterval=e,this},e.prototype.getSubscribeTimeout=function(){return this._subscribeRequestTimeout},e.prototype.setSubscribeTimeout=function(e){return this._subscribeRequestTimeout=e,this},e.prototype.getTransactionTimeout=function(){return this._transactionalRequestTimeout},e.prototype.setTransactionTimeout=function(e){return this._transactionalRequestTimeout=e,this},e.prototype.isSendBeaconEnabled=function(){return this._useSendBeacon},e.prototype.setSendBeaconConfig=function(e){return this._useSendBeacon=e,this},e.prototype.getVersion=function(){return"7.0.1"},e.prototype._addPnsdkSuffix=function(e,t){this._PNSDKSuffix[e]=t},e.prototype._getPnsdkSuffix=function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,r){return n+e+t._PNSDKSuffix[r]}),"")},e}(),_=_||function(e,t){var n={},r=n.lib={},i=function(){},o=r.Base={extend:function(e){i.prototype=this;var t=new i;return e&&t.mixIn(e),t.hasOwnProperty("init")||(t.init=function(){t.$super.init.apply(this,arguments)}),t.init.prototype=t,t.$super=this,t},create:function(){var e=this.extend();return e.init.apply(e,arguments),e},init:function(){},mixIn:function(e){for(var t in e)e.hasOwnProperty(t)&&(this[t]=e[t]);e.hasOwnProperty("toString")&&(this.toString=e.toString)},clone:function(){return this.init.prototype.extend(this)}},s=r.WordArray=o.extend({init:function(e,t){e=this.words=e||[],this.sigBytes=null!=t?t:4*e.length},toString:function(e){return(e||u).stringify(this)},concat:function(e){var t=this.words,n=e.words,r=this.sigBytes;if(e=e.sigBytes,this.clamp(),r%4)for(var i=0;i<e;i++)t[r+i>>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535<n.length)for(i=0;i<e;i+=4)t[r+i>>>2]=n[i>>>2];else t.push.apply(t,n);return this.sigBytes+=e,this},clamp:function(){var t=this.words,n=this.sigBytes;t[n>>>2]&=4294967295<<32-n%4*8,t.length=e.ceil(n/4)},clone:function(){var e=o.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;r<t;r+=4)n.push(4294967296*e.random()|0);return new s.init(n,t)}}),a=n.enc={},u=a.Hex={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++){var i=t[r>>>2]>>>24-r%4*8&255;n.push((i>>>4).toString(16)),n.push((15&i).toString(16))}return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r+=2)n[r>>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new s.init(n,t/2)}},c=a.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r<e;r++)n.push(String.fromCharCode(t[r>>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r<t;r++)n[r>>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new s.init(n,t)}},l=a.Utf8={stringify:function(e){try{return decodeURIComponent(escape(c.stringify(e)))}catch(e){throw Error("Malformed UTF-8 data")}},parse:function(e){return c.parse(unescape(encodeURIComponent(e)))}},p=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new s.init,this._nDataBytes=0},_append:function(e){"string"==typeof e&&(e=l.parse(e)),this._data.concat(e),this._nDataBytes+=e.sigBytes},_process:function(t){var n=this._data,r=n.words,i=n.sigBytes,o=this.blockSize,a=i/(4*o);if(t=(a=t?e.ceil(a):e.max((0|a)-this._minBufferSize,0))*o,i=e.min(4*t,i),t){for(var u=0;u<t;u+=o)this._doProcessBlock(r,u);u=r.splice(0,t),n.sigBytes-=i}return new s.init(u,i)},clone:function(){var e=o.clone.call(this);return e._data=this._data.clone(),e},_minBufferSize:0});r.Hasher=p.extend({cfg:o.extend(),init:function(e){this.cfg=this.cfg.extend(e),this.reset()},reset:function(){p.reset.call(this),this._doReset()},update:function(e){return this._append(e),this._process(),this},finalize:function(e){return e&&this._append(e),this._doFinalize()},blockSize:16,_createHelper:function(e){return function(t,n){return new e.init(n).finalize(t)}},_createHmacHelper:function(e){return function(t,n){return new h.HMAC.init(e,n).finalize(t)}}});var h=n.algo={};return n}(Math);!function(e){for(var t=_,n=(i=t.lib).WordArray,r=i.Hasher,i=t.algo,o=[],s=[],a=function(e){return 4294967296*(e-(0|e))|0},u=2,c=0;64>c;){var l;e:{l=u;for(var p=e.sqrt(l),h=2;h<=p;h++)if(!(l%h)){l=!1;break e}l=!0}l&&(8>c&&(o[c]=a(e.pow(u,.5))),s[c]=a(e.pow(u,1/3)),c++),u++}var f=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(o.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],o=n[2],a=n[3],u=n[4],c=n[5],l=n[6],p=n[7],h=0;64>h;h++){if(16>h)f[h]=0|e[t+h];else{var d=f[h-15],g=f[h-2];f[h]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+f[h-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+f[h-16]}d=p+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+s[h]+f[h],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),p=l,l=c,c=u,u=a+d|0,a=o,o=i,i=r,r=d+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+a|0,n[4]=n[4]+u|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+p|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=e.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,t.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var e=r.clone.call(this);return e._hash=this._hash.clone(),e}});t.SHA256=r._createHelper(i),t.HmacSHA256=r._createHmacHelper(i)}(Math),f=(h=_).enc.Utf8,h.algo.HMAC=h.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=f.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var i=this._oKey=t.clone(),o=this._iKey=t.clone(),s=i.words,a=o.words,u=0;u<n;u++)s[u]^=1549556828,a[u]^=909522486;i.sigBytes=o.sigBytes=r,this.reset()},reset:function(){var e=this._hasher;e.reset(),e.update(this._iKey)},update:function(e){return this._hasher.update(e),this},finalize:function(e){var t=this._hasher;return e=t.finalize(e),t.reset(),t.finalize(this._oKey.clone().concat(e))}}),g=(d=_).lib.WordArray,d.enc.Base64={stringify:function(e){var t=e.words,n=e.sigBytes,r=this._map;e.clamp(),e=[];for(var i=0;i<n;i+=3)for(var o=(t[i>>>2]>>>24-i%4*8&255)<<16|(t[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|t[i+2>>>2]>>>24-(i+2)%4*8&255,s=0;4>s&&i+.75*s<n;s++)e.push(r.charAt(o>>>6*(3-s)&63));if(t=r.charAt(64))for(;e.length%4;)e.push(t);return e.join("")},parse:function(e){var t=e.length,n=this._map;(r=n.charAt(64))&&-1!=(r=e.indexOf(r))&&(t=r);for(var r=[],i=0,o=0;o<t;o++)if(o%4){var s=n.indexOf(e.charAt(o-1))<<o%4*2,a=n.indexOf(e.charAt(o))>>>6-o%4*2;r[i>>>2]|=(s|a)<<24-i%4*8,i++}return g.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,r,i,o,s){return((e=e+(t&n|~t&r)+i+s)<<o|e>>>32-o)+t}function n(e,t,n,r,i,o,s){return((e=e+(t&r|n&~r)+i+s)<<o|e>>>32-o)+t}function r(e,t,n,r,i,o,s){return((e=e+(t^n^r)+i+s)<<o|e>>>32-o)+t}function i(e,t,n,r,i,o,s){return((e=e+(n^(t|~r))+i+s)<<o|e>>>32-o)+t}for(var o=_,s=(u=o.lib).WordArray,a=u.Hasher,u=o.algo,c=[],l=0;64>l;l++)c[l]=4294967296*e.abs(e.sin(l+1))|0;u=u.MD5=a.extend({_doReset:function(){this._hash=new s.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var s=0;16>s;s++){var a=e[u=o+s];e[u]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>8)}s=this._hash.words;var u=e[o+0],l=(a=e[o+1],e[o+2]),p=e[o+3],h=e[o+4],f=e[o+5],d=e[o+6],g=e[o+7],y=e[o+8],b=e[o+9],v=e[o+10],m=e[o+11],_=e[o+12],O=e[o+13],P=e[o+14],S=e[o+15],w=t(w=s[0],N=s[1],k=s[2],T=s[3],u,7,c[0]),T=t(T,w,N,k,a,12,c[1]),k=t(k,T,w,N,l,17,c[2]),N=t(N,k,T,w,p,22,c[3]);w=t(w,N,k,T,h,7,c[4]),T=t(T,w,N,k,f,12,c[5]),k=t(k,T,w,N,d,17,c[6]),N=t(N,k,T,w,g,22,c[7]),w=t(w,N,k,T,y,7,c[8]),T=t(T,w,N,k,b,12,c[9]),k=t(k,T,w,N,v,17,c[10]),N=t(N,k,T,w,m,22,c[11]),w=t(w,N,k,T,_,7,c[12]),T=t(T,w,N,k,O,12,c[13]),k=t(k,T,w,N,P,17,c[14]),w=n(w,N=t(N,k,T,w,S,22,c[15]),k,T,a,5,c[16]),T=n(T,w,N,k,d,9,c[17]),k=n(k,T,w,N,m,14,c[18]),N=n(N,k,T,w,u,20,c[19]),w=n(w,N,k,T,f,5,c[20]),T=n(T,w,N,k,v,9,c[21]),k=n(k,T,w,N,S,14,c[22]),N=n(N,k,T,w,h,20,c[23]),w=n(w,N,k,T,b,5,c[24]),T=n(T,w,N,k,P,9,c[25]),k=n(k,T,w,N,p,14,c[26]),N=n(N,k,T,w,y,20,c[27]),w=n(w,N,k,T,O,5,c[28]),T=n(T,w,N,k,l,9,c[29]),k=n(k,T,w,N,g,14,c[30]),w=r(w,N=n(N,k,T,w,_,20,c[31]),k,T,f,4,c[32]),T=r(T,w,N,k,y,11,c[33]),k=r(k,T,w,N,m,16,c[34]),N=r(N,k,T,w,P,23,c[35]),w=r(w,N,k,T,a,4,c[36]),T=r(T,w,N,k,h,11,c[37]),k=r(k,T,w,N,g,16,c[38]),N=r(N,k,T,w,v,23,c[39]),w=r(w,N,k,T,O,4,c[40]),T=r(T,w,N,k,u,11,c[41]),k=r(k,T,w,N,p,16,c[42]),N=r(N,k,T,w,d,23,c[43]),w=r(w,N,k,T,b,4,c[44]),T=r(T,w,N,k,_,11,c[45]),k=r(k,T,w,N,S,16,c[46]),w=i(w,N=r(N,k,T,w,l,23,c[47]),k,T,u,6,c[48]),T=i(T,w,N,k,g,10,c[49]),k=i(k,T,w,N,P,15,c[50]),N=i(N,k,T,w,f,21,c[51]),w=i(w,N,k,T,_,6,c[52]),T=i(T,w,N,k,p,10,c[53]),k=i(k,T,w,N,v,15,c[54]),N=i(N,k,T,w,a,21,c[55]),w=i(w,N,k,T,y,6,c[56]),T=i(T,w,N,k,S,10,c[57]),k=i(k,T,w,N,d,15,c[58]),N=i(N,k,T,w,O,21,c[59]),w=i(w,N,k,T,h,6,c[60]),T=i(T,w,N,k,m,10,c[61]),k=i(k,T,w,N,l,15,c[62]),N=i(N,k,T,w,b,21,c[63]);s[0]=s[0]+w|0,s[1]=s[1]+N|0,s[2]=s[2]+k|0,s[3]=s[3]+T|0},_doFinalize:function(){var t=this._data,n=t.words,r=8*this._nDataBytes,i=8*t.sigBytes;n[i>>>5]|=128<<24-i%32;var o=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(n.length+1),this._process(),n=(t=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return t},clone:function(){var e=a.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=a._createHelper(u),o.HmacMD5=a._createHmacHelper(u)}(Math),function(){var e,t=_,n=(e=t.lib).Base,r=e.WordArray,i=(e=t.algo).EvpKDF=n.extend({cfg:n.extend({keySize:4,hasher:e.MD5,iterations:1}),init:function(e){this.cfg=this.cfg.extend(e)},compute:function(e,t){for(var n=(a=this.cfg).hasher.create(),i=r.create(),o=i.words,s=a.keySize,a=a.iterations;o.length<s;){u&&n.update(u);var u=n.update(e).finalize(t);n.reset();for(var c=1;c<a;c++)u=n.finalize(u),n.reset();i.concat(u)}return i.sigBytes=4*s,i}});t.EvpKDF=function(e,t,n){return i.create(n).compute(e,t)}}(),_.lib.Cipher||function(e){var t=(f=_).lib,n=t.Base,r=t.WordArray,i=t.BufferedBlockAlgorithm,o=f.enc.Base64,s=f.algo.EvpKDF,a=t.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(e,t){return this.create(this._ENC_XFORM_MODE,e,t)},createDecryptor:function(e,t){return this.create(this._DEC_XFORM_MODE,e,t)},init:function(e,t,n){this.cfg=this.cfg.extend(n),this._xformMode=e,this._key=t,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(e){return this._append(e),this._process()},finalize:function(e){return e&&this._append(e),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(e){return{encrypt:function(t,n,r){return("string"==typeof n?d:h).encrypt(e,t,n,r)},decrypt:function(t,n,r){return("string"==typeof n?d:h).decrypt(e,t,n,r)}}}});t.StreamCipher=a.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=f.mode={},c=function(e,t,n){var r=this._iv;r?this._iv=undefined:r=this._prevBlock;for(var i=0;i<n;i++)e[t+i]^=r[i]},l=(t.BlockCipherMode=n.extend({createEncryptor:function(e,t){return this.Encryptor.create(e,t)},createDecryptor:function(e,t){return this.Decryptor.create(e,t)},init:function(e,t){this._cipher=e,this._iv=t}})).extend();l.Encryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize;c.call(this,e,t,r),n.encryptBlock(e,t),this._prevBlock=e.slice(t,t+r)}}),l.Decryptor=l.extend({processBlock:function(e,t){var n=this._cipher,r=n.blockSize,i=e.slice(t,t+r);n.decryptBlock(e,t),c.call(this,e,t,r),this._prevBlock=i}}),u=u.CBC=l,l=(f.pad={}).Pkcs7={pad:function(e,t){for(var n,i=(n=(n=4*t)-e.sigBytes%n)<<24|n<<16|n<<8|n,o=[],s=0;s<n;s+=4)o.push(i);n=r.create(o,n),e.concat(n)},unpad:function(e){e.sigBytes-=255&e.words[e.sigBytes-1>>>2]}},t.BlockCipher=a.extend({cfg:a.cfg.extend({mode:u,padding:l}),reset:function(){a.reset.call(this);var e=(t=this.cfg).iv,t=t.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=t.createEncryptor;else n=t.createDecryptor,this._minBufferSize=1;this._mode=n.call(t,this,e&&e.words)},_doProcessBlock:function(e,t){this._mode.processBlock(e,t)},_doFinalize:function(){var e=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){e.pad(this._data,this.blockSize);var t=this._process(!0)}else t=this._process(!0),e.unpad(t);return t},blockSize:4});var p=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),h=(u=(f.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(o)},parse:function(e){var t=(e=o.parse(e)).words;if(1398893684==t[0]&&1701076831==t[1]){var n=r.create(t.slice(2,4));t.splice(0,4),e.sigBytes-=16}return p.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(e,t,n,r){r=this.cfg.extend(r);var i=e.createEncryptor(n,r);return t=i.finalize(t),i=i.cfg,p.create({ciphertext:t,key:n,iv:i.iv,algorithm:e,mode:i.mode,padding:i.padding,blockSize:e.blockSize,formatter:r.format})},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),e.createDecryptor(n,r).finalize(t.ciphertext)},_parse:function(e,t){return"string"==typeof e?t.parse(e,this):e}})),f=(f.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=s.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,p.create({key:e,iv:n,salt:i})}},d=t.PasswordBasedCipher=h.extend({cfg:h.cfg.extend({kdf:f}),encrypt:function(e,t,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,e.keySize,e.ivSize),r.iv=n.iv,(e=h.encrypt.call(this,e,t,n.key,r)).mixIn(n),e},decrypt:function(e,t,n,r){return r=this.cfg.extend(r),t=this._parse(t,r.format),n=r.kdf.execute(n,e.keySize,e.ivSize,t.salt),r.iv=n.iv,h.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=_,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],s=[],a=[],u=[],c=[],l=[],p=[],h=[],f=[],d=0;256>d;d++)f[d]=128>d?d<<1:d<<1^283;var g=0,y=0;for(d=0;256>d;d++){var b=(b=y^y<<1^y<<2^y<<3^y<<4)>>>8^255&b^99;r[g]=b,i[b]=g;var v=f[g],m=f[v],O=f[m],P=257*f[b]^16843008*b;o[g]=P<<24|P>>>8,s[g]=P<<16|P>>>16,a[g]=P<<8|P>>>24,u[g]=P,P=16843009*O^65537*m^257*v^16843008*g,c[b]=P<<24|P>>>8,l[b]=P<<16|P>>>16,p[b]=P<<8|P>>>24,h[b]=P,g?(g=v^f[f[f[O^v]]],y^=f[f[y]]):g=y=1}var S=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=t.extend({_doReset:function(){for(var e=(n=this._key).words,t=n.sigBytes/4,n=4*((this._nRounds=t+6)+1),i=this._keySchedule=[],o=0;o<n;o++)if(o<t)i[o]=e[o];else{var s=i[o-1];o%t?6<t&&4==o%t&&(s=r[s>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s]):(s=r[(s=s<<8|s>>>24)>>>24]<<24|r[s>>>16&255]<<16|r[s>>>8&255]<<8|r[255&s],s^=S[o/t|0]<<24),i[o]=i[o-t]^s}for(e=this._invKeySchedule=[],t=0;t<n;t++)o=n-t,s=t%4?i[o]:i[o-4],e[t]=4>t||4>=o?s:c[r[s>>>24]]^l[r[s>>>16&255]]^p[r[s>>>8&255]]^h[r[255&s]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,s,a,u,r)},decryptBlock:function(e,t){var n=e[t+1];e[t+1]=e[t+3],e[t+3]=n,this._doCryptBlock(e,t,this._invKeySchedule,c,l,p,h,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,s,a){for(var u=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],p=e[t+2]^n[2],h=e[t+3]^n[3],f=4,d=1;d<u;d++){var g=r[c>>>24]^i[l>>>16&255]^o[p>>>8&255]^s[255&h]^n[f++],y=r[l>>>24]^i[p>>>16&255]^o[h>>>8&255]^s[255&c]^n[f++],b=r[p>>>24]^i[h>>>16&255]^o[c>>>8&255]^s[255&l]^n[f++];h=r[h>>>24]^i[c>>>16&255]^o[l>>>8&255]^s[255&p]^n[f++],c=g,l=y,p=b}g=(a[c>>>24]<<24|a[l>>>16&255]<<16|a[p>>>8&255]<<8|a[255&h])^n[f++],y=(a[l>>>24]<<24|a[p>>>16&255]<<16|a[h>>>8&255]<<8|a[255&c])^n[f++],b=(a[p>>>24]<<24|a[h>>>16&255]<<16|a[c>>>8&255]<<8|a[255&l])^n[f++],h=(a[h>>>24]<<24|a[c>>>16&255]<<16|a[l>>>8&255]<<8|a[255&p])^n[f++],e[t]=g,e[t+1]=y,e[t+2]=b,e[t+3]=h},keySize:8});e.AES=t._createHelper(n)}(),_.mode.ECB=((y=_.lib.BlockCipherMode.extend()).Encryptor=y.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),y.Decryptor=y.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),y);var O=_;function P(e){var t,n=[];for(t=0;t<e.length;t+=1)n[t/4|0]|=e[t]<<24-8*t;return O.lib.WordArray.create(n,e.length)}var S=function(){function e(e){var t=e.config;this._config=t,this._iv="0123456789012345",this._allowedKeyEncodings=["hex","utf8","base64","binary"],this._allowedKeyLengths=[128,256],this._allowedModes=["ecb","cbc"],this._defaultOptions={encryptKey:!0,keyEncoding:"utf8",keyLength:256,mode:"cbc"}}return e.prototype.HMACSHA256=function(e){return O.HmacSHA256(e,this._config.secretKey).toString(O.enc.Base64)},e.prototype.SHA256=function(e){return O.SHA256(e).toString(O.enc.Hex)},e.prototype._parseOptions=function(e){var t=e||{};return t.hasOwnProperty("encryptKey")||(t.encryptKey=this._defaultOptions.encryptKey),t.hasOwnProperty("keyEncoding")||(t.keyEncoding=this._defaultOptions.keyEncoding),t.hasOwnProperty("keyLength")||(t.keyLength=this._defaultOptions.keyLength),t.hasOwnProperty("mode")||(t.mode=this._defaultOptions.mode),-1===this._allowedKeyEncodings.indexOf(t.keyEncoding.toLowerCase())&&(t.keyEncoding=this._defaultOptions.keyEncoding),-1===this._allowedKeyLengths.indexOf(parseInt(t.keyLength,10))&&(t.keyLength=this._defaultOptions.keyLength),-1===this._allowedModes.indexOf(t.mode.toLowerCase())&&(t.mode=this._defaultOptions.mode),t},e.prototype._decodeKey=function(e,t){return"base64"===t.keyEncoding?O.enc.Base64.parse(e):"hex"===t.keyEncoding?O.enc.Hex.parse(e):e},e.prototype._getPaddedKey=function(e,t){return e=this._decodeKey(e,t),t.encryptKey?O.enc.Utf8.parse(this.SHA256(e).slice(0,32)):e},e.prototype._getMode=function(e){return"ecb"===e.mode?O.mode.ECB:O.mode.CBC},e.prototype._getIV=function(e){return"cbc"===e.mode?O.enc.Utf8.parse(this._iv):null},e.prototype._getRandomIV=function(){return O.lib.WordArray.random(16)},e.prototype.encrypt=function(e,t,n){return this._config.customEncrypt?this._config.customEncrypt(e):this.pnEncrypt(e,t,n)},e.prototype.decrypt=function(e,t,n){return this._config.customDecrypt?this._config.customDecrypt(e):this.pnDecrypt(e,t,n)},e.prototype.pnEncrypt=function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var r=this._getMode(n),i=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var o=this._getRandomIV(),s=O.AES.encrypt(e,i,{iv:o,mode:r}).ciphertext;return o.clone().concat(s.clone()).toString(O.enc.Base64)}var a=this._getIV(n);return O.AES.encrypt(e,i,{iv:a,mode:r}).ciphertext.toString(O.enc.Base64)||e},e.prototype.pnDecrypt=function(e,t,n){if(!t&&!this._config.cipherKey)return e;n=this._parseOptions(n);var r=this._getMode(n),i=this._getPaddedKey(t||this._config.cipherKey,n);if(this._config.useRandomIVs){var o=P((u=Buffer.from(e,"base64")).slice(0,16)),s=P(u.slice(16));try{var a=O.AES.decrypt({ciphertext:s},i,{iv:o,mode:r}).toString(O.enc.Utf8);return JSON.parse(a)}catch(e){return null}}else{o=this._getIV(n);try{var u=O.enc.Base64.parse(e);a=O.AES.decrypt({ciphertext:u},i,{iv:o,mode:r}).toString(O.enc.Utf8);return JSON.parse(a)}catch(e){return null}}},e}(),w=function(){function e(e){var t=e.timeEndpoint;this._timeEndpoint=t}return e.prototype.onReconnection=function(e){this._reconnectionCallback=e},e.prototype.startPolling=function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)},e.prototype.stopPolling=function(){clearInterval(this._timeTimer)},e.prototype._performTimeLoop=function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))},e}(),T=function(){function e(e){var t=e.config;this.hashHistory=[],this._config=t}return e.prototype.getKey=function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t&=t;return t}(JSON.stringify(e.payload)).toString(),n=e.publishMetaData.publishTimetoken;return"".concat(n,"-").concat(t)},e.prototype.isDuplicate=function(e){return this.hashHistory.includes(this.getKey(e))},e.prototype.addEntry=function(e){this.hashHistory.length>=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))},e.prototype.clearHistory=function(){this.hashHistory=[]},e}();function k(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function N(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var C={signPamFromParams:function(e){return N(e).map((function(t){return"".concat(t,"=").concat(k(e[t]))})).join("&")},endsWith:function(e,t){return-1!==e.indexOf(t,this.length-t.length)},createPromise:function(){var e,t;return{promise:new Promise((function(n,r){e=n,t=r})),reject:t,fulfill:e}},encodeString:k},E={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},A=function(){function e(e){var t=e.subscribeEndpoint,n=e.leaveEndpoint,r=e.heartbeatEndpoint,i=e.setStateEndpoint,o=e.timeEndpoint,s=e.getFileUrl,a=e.config,u=e.crypto,c=e.listenerManager;this._listenerManager=c,this._config=a,this._leaveEndpoint=n,this._heartbeatEndpoint=r,this._setStateEndpoint=i,this._subscribeEndpoint=t,this._getFileUrl=s,this._crypto=u,this._channels={},this._presenceChannels={},this._heartbeatChannels={},this._heartbeatChannelGroups={},this._channelGroups={},this._presenceChannelGroups={},this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[],this._currentTimetoken=0,this._lastTimetoken=0,this._storedTimetoken=null,this._subscriptionStatusAnnounced=!1,this._isOnline=!0,this._reconnectionManager=new w({timeEndpoint:o}),this._dedupingManager=new T({config:a})}return e.prototype.adaptStateChange=function(e,t){var n=this,r=e.state,i=e.channels,o=void 0===i?[]:i,s=e.channelGroups,a=void 0===s?[]:s;return o.forEach((function(e){e in n._channels&&(n._channels[e].state=r)})),a.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)})),this._setStateEndpoint({state:r,channels:o,channelGroups:a},t)},e.prototype.adaptPresenceChange=function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,s=void 0===o?[]:o;n?(i.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),s.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(i.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),s.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:s},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()},e.prototype.adaptSubscribeChange=function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,s=void 0===o?[]:o,a=e.withPresence,u=void 0!==a&&a,c=e.withHeartbeats,l=void 0!==c&&c;this._config.subscribeKey&&""!==this._config.subscribeKey?(n&&(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=n),"0"!==this._currentTimetoken&&0!==this._currentTimetoken&&(this._storedTimetoken=this._currentTimetoken,this._currentTimetoken=0),i.forEach((function(e){t._channels[e]={state:{}},u&&(t._presenceChannels[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),s.forEach((function(e){t._channelGroups[e]={state:{}},u&&(t._presenceChannelGroups[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannelGroups[e]={}),t._pendingChannelGroupSubscriptions.push(e)})),this._subscriptionStatusAnnounced=!1,this.reconnect()):console&&console.log&&console.log("subscribe key missing; aborting subscribe")},e.prototype.adaptUnsubscribeChange=function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,s=void 0===o?[]:o,a=[],u=[];i.forEach((function(e){e in n._channels&&(delete n._channels[e],a.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],a.push(e))})),s.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],u.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._presenceChannelGroups[e],u.push(e))})),0===a.length&&0===u.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:a,channelGroups:u},(function(e){e.affectedChannels=a,e.affectedChannelGroups=u,e.currentTimetoken=n._currentTimetoken,e.lastTimetoken=n._lastTimetoken,n._listenerManager.announceStatus(e)})),0===Object.keys(this._channels).length&&0===Object.keys(this._presenceChannels).length&&0===Object.keys(this._channelGroups).length&&0===Object.keys(this._presenceChannelGroups).length&&(this._lastTimetoken=0,this._currentTimetoken=0,this._storedTimetoken=null,this._region=null,this._reconnectionManager.stopPolling()),this.reconnect())},e.prototype.unsubscribeAll=function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)},e.prototype.getHeartbeatChannels=function(){return Object.keys(this._heartbeatChannels)},e.prototype.getHeartbeatChannelGroups=function(){return Object.keys(this._heartbeatChannelGroups)},e.prototype.getSubscribedChannels=function(){return Object.keys(this._channels)},e.prototype.getSubscribedChannelGroups=function(){return Object.keys(this._channelGroups)},e.prototype.reconnect=function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()},e.prototype.disconnect=function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()},e.prototype._registerHeartbeatTimer=function(){this._stopHeartbeatTimer(),0!==this._config.getHeartbeatInterval()&&void 0!==this._config.getHeartbeatInterval()&&(this._performHeartbeatLoop(),this._heartbeatTimer=setInterval(this._performHeartbeatLoop.bind(this),1e3*this._config.getHeartbeatInterval()))},e.prototype._stopHeartbeatTimer=function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)},e.prototype._performHeartbeatLoop=function(){var e=this,t=this.getHeartbeatChannels(),n=this.getHeartbeatChannelGroups(),r={};if(0!==t.length||0!==n.length){this.getSubscribedChannels().forEach((function(t){var n=e._channels[t].state;Object.keys(n).length&&(r[t]=n)})),this.getSubscribedChannelGroups().forEach((function(t){var n=e._channelGroups[t].state;Object.keys(n).length&&(r[t]=n)}));this._heartbeatEndpoint({channels:t,channelGroups:n,state:r},function(t){t.error&&e._config.announceFailedHeartbeats&&e._listenerManager.announceStatus(t),t.error&&e._config.autoNetworkDetection&&e._isOnline&&(e._isOnline=!1,e.disconnect(),e._listenerManager.announceNetworkDown(),e.reconnect()),!t.error&&e._config.announceSuccessfulHeartbeats&&e._listenerManager.announceStatus(t)}.bind(this))}},e.prototype._startSubscribeLoop=function(){var e=this;this._stopSubscribeLoop();var t={},n=[],r=[];if(Object.keys(this._channels).forEach((function(r){var i=e._channels[r].state;Object.keys(i).length&&(t[r]=i),n.push(r)})),Object.keys(this._presenceChannels).forEach((function(e){n.push("".concat(e,"-pnpres"))})),Object.keys(this._channelGroups).forEach((function(n){var i=e._channelGroups[n].state;Object.keys(i).length&&(t[n]=i),r.push(n)})),Object.keys(this._presenceChannelGroups).forEach((function(e){r.push("".concat(e,"-pnpres"))})),0!==n.length||0!==r.length){var i={channels:n,channelGroups:r,state:t,timetoken:this._currentTimetoken,filterExpression:this._config.filterExpression,region:this._region};this._subscribeCall=this._subscribeEndpoint(i,this._processSubscribeResponse.bind(this))}},e.prototype._processSubscribeResponse=function(e,t){var n=this;if(e.error){if(e.errorData&&"Aborted"===e.errorData.message)return;e.category===E.PNTimeoutCategory?this._startSubscribeLoop():e.category===E.PNNetworkIssuesCategory?(this.disconnect(),e.error&&this._config.autoNetworkDetection&&this._isOnline&&(this._isOnline=!1,this._listenerManager.announceNetworkDown()),this._reconnectionManager.onReconnection((function(){n._config.autoNetworkDetection&&!n._isOnline&&(n._isOnline=!0,n._listenerManager.announceNetworkUp()),n.reconnect(),n._subscriptionStatusAnnounced=!0;var t={category:E.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===E.PNBadRequestCategory?(this._stopHeartbeatTimer(),this._listenerManager.announceStatus(e)):this._listenerManager.announceStatus(e)}else{if(this._storedTimetoken?(this._currentTimetoken=this._storedTimetoken,this._storedTimetoken=null):(this._lastTimetoken=this._currentTimetoken,this._currentTimetoken=t.metadata.timetoken),!this._subscriptionStatusAnnounced){var r={};r.category=E.PNConnectedCategory,r.operation=e.operation,r.affectedChannels=this._pendingChannelSubscriptions,r.subscribedChannels=this.getSubscribedChannels(),r.affectedChannelGroups=this._pendingChannelGroupSubscriptions,r.lastTimetoken=this._lastTimetoken,r.currentTimetoken=this._currentTimetoken,this._subscriptionStatusAnnounced=!0,this._listenerManager.announceStatus(r),this._pendingChannelSubscriptions=[],this._pendingChannelGroupSubscriptions=[]}var i=t.messages||[],o=this._config,s=o.requestMessageCountThreshold,a=o.dedupeOnSubscribe;if(s&&i.length>=s){var u={};u.category=E.PNRequestMessageCountExceededCategory,u.operation=e.operation,this._listenerManager.announceStatus(u)}i.forEach((function(e){var t=e.channel,r=e.subscriptionMatch,i=e.publishMetaData;if(t===r&&(r=null),a){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(C.endsWith(e.channel,"-pnpres"))(u={channel:null,subscription:null}).actualChannel=null!=r?t:null,u.subscribedChannel=null!=r?r:t,t&&(u.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(u.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),u.action=e.payload.action,u.state=e.payload.data,u.timetoken=i.publishTimetoken,u.occupancy=e.payload.occupancy,u.uuid=e.payload.uuid,u.timestamp=e.payload.timestamp,e.payload.join&&(u.join=e.payload.join),e.payload.leave&&(u.leave=e.payload.leave),e.payload.timeout&&(u.timeout=e.payload.timeout),n._listenerManager.announcePresence(u);else if(1===e.messageType){(u={channel:null,subscription:null}).channel=t,u.subscription=r,u.timetoken=i.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=e.payload,n._listenerManager.announceSignal(u)}else if(2===e.messageType){(u={channel:null,subscription:null}).channel=t,u.subscription=r,u.timetoken=i.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(u),"user"===e.payload.type?n._listenerManager.announceUser(u):"space"===e.payload.type?n._listenerManager.announceSpace(u):"membership"===e.payload.type&&n._listenerManager.announceMembership(u)}else if(3===e.messageType){(u={}).channel=t,u.subscription=r,u.timetoken=i.publishTimetoken,u.publisher=e.issuingClientId,u.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},u.event=e.payload.event,n._listenerManager.announceMessageAction(u)}else if(4===e.messageType){(u={}).channel=t,u.subscription=r,u.timetoken=i.publishTimetoken,u.publisher=e.issuingClientId;var o=e.payload;if(n._config.cipherKey){var s=n._crypto.decrypt(e.payload);"object"==typeof s&&null!==s&&(o=s)}e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=o.message,u.file={id:o.file.id,name:o.file.name,url:n._getFileUrl({id:o.file.id,name:o.file.name,channel:t})},n._listenerManager.announceFile(u)}else{var u;(u={channel:null,subscription:null}).actualChannel=null!=r?t:null,u.subscribedChannel=null!=r?r:t,u.channel=t,u.subscription=r,u.timetoken=i.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),n._config.cipherKey?u.message=n._crypto.decrypt(e.payload):u.message=e.payload,n._listenerManager.announceMessage(u)}})),this._region=t.metadata.region,this._startSubscribeLoop()}},e.prototype._stopSubscribeLoop=function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)},e}(),M={PNTimeOperation:"PNTimeOperation",PNHistoryOperation:"PNHistoryOperation",PNDeleteMessagesOperation:"PNDeleteMessagesOperation",PNFetchMessagesOperation:"PNFetchMessagesOperation",PNMessageCounts:"PNMessageCountsOperation",PNSubscribeOperation:"PNSubscribeOperation",PNUnsubscribeOperation:"PNUnsubscribeOperation",PNPublishOperation:"PNPublishOperation",PNSignalOperation:"PNSignalOperation",PNAddMessageActionOperation:"PNAddActionOperation",PNRemoveMessageActionOperation:"PNRemoveMessageActionOperation",PNGetMessageActionsOperation:"PNGetMessageActionsOperation",PNCreateUserOperation:"PNCreateUserOperation",PNUpdateUserOperation:"PNUpdateUserOperation",PNDeleteUserOperation:"PNDeleteUserOperation",PNGetUserOperation:"PNGetUsersOperation",PNGetUsersOperation:"PNGetUsersOperation",PNCreateSpaceOperation:"PNCreateSpaceOperation",PNUpdateSpaceOperation:"PNUpdateSpaceOperation",PNDeleteSpaceOperation:"PNDeleteSpaceOperation",PNGetSpaceOperation:"PNGetSpacesOperation",PNGetSpacesOperation:"PNGetSpacesOperation",PNGetMembersOperation:"PNGetMembersOperation",PNUpdateMembersOperation:"PNUpdateMembersOperation",PNGetMembershipsOperation:"PNGetMembershipsOperation",PNUpdateMembershipsOperation:"PNUpdateMembershipsOperation",PNListFilesOperation:"PNListFilesOperation",PNGenerateUploadUrlOperation:"PNGenerateUploadUrlOperation",PNPublishFileOperation:"PNPublishFileOperation",PNGetFileUrlOperation:"PNGetFileUrlOperation",PNDownloadFileOperation:"PNDownloadFileOperation",PNGetAllUUIDMetadataOperation:"PNGetAllUUIDMetadataOperation",PNGetUUIDMetadataOperation:"PNGetUUIDMetadataOperation",PNSetUUIDMetadataOperation:"PNSetUUIDMetadataOperation",PNRemoveUUIDMetadataOperation:"PNRemoveUUIDMetadataOperation",PNGetAllChannelMetadataOperation:"PNGetAllChannelMetadataOperation",PNGetChannelMetadataOperation:"PNGetChannelMetadataOperation",PNSetChannelMetadataOperation:"PNSetChannelMetadataOperation",PNRemoveChannelMetadataOperation:"PNRemoveChannelMetadataOperation",PNSetMembersOperation:"PNSetMembersOperation",PNSetMembershipsOperation:"PNSetMembershipsOperation",PNPushNotificationEnabledChannelsOperation:"PNPushNotificationEnabledChannelsOperation",PNRemoveAllPushNotificationsOperation:"PNRemoveAllPushNotificationsOperation",PNWhereNowOperation:"PNWhereNowOperation",PNSetStateOperation:"PNSetStateOperation",PNHereNowOperation:"PNHereNowOperation",PNGetStateOperation:"PNGetStateOperation",PNHeartbeatOperation:"PNHeartbeatOperation",PNChannelGroupsOperation:"PNChannelGroupsOperation",PNRemoveGroupOperation:"PNRemoveGroupOperation",PNChannelsForGroupOperation:"PNChannelsForGroupOperation",PNAddChannelsToGroupOperation:"PNAddChannelsToGroupOperation",PNRemoveChannelsFromGroupOperation:"PNRemoveChannelsFromGroupOperation",PNAccessManagerGrant:"PNAccessManagerGrant",PNAccessManagerGrantToken:"PNAccessManagerGrantToken",PNAccessManagerAudit:"PNAccessManagerAudit",PNAccessManagerRevokeToken:"PNAccessManagerRevokeToken",PNHandshakeOperation:"PNHandshakeOperation",PNReceiveMessagesOperation:"PNReceiveMessagesOperation"},R=function(){function e(e){this._maximumSamplesCount=100,this._trackedLatencies={},this._latencies={},this._maximumSamplesCount=e.maximumSamplesCount||this._maximumSamplesCount}return e.prototype.operationsLatencyForRequest=function(){var e=this,t={};return Object.keys(this._latencies).forEach((function(n){var r=e._latencies[n],i=e._averageLatency(r);i>0&&(t["l_".concat(n)]=i)})),t},e.prototype.startLatencyMeasure=function(e,t){e!==M.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())},e.prototype.stopLatencyMeasure=function(e,t){if(e!==M.PNSubscribeOperation&&t){var n=this._endpointName(e),r=this._latencies[n],i=this._trackedLatencies[t];r||(this._latencies[n]=[],r=this._latencies[n]),r.push(Date.now()-i),r.length>this._maximumSamplesCount&&r.splice(0,r.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}},e.prototype._averageLatency=function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)},e.prototype._endpointName=function(e){var t=null;switch(e){case M.PNPublishOperation:t="pub";break;case M.PNSignalOperation:t="sig";break;case M.PNHistoryOperation:case M.PNFetchMessagesOperation:case M.PNDeleteMessagesOperation:case M.PNMessageCounts:t="hist";break;case M.PNUnsubscribeOperation:case M.PNWhereNowOperation:case M.PNHereNowOperation:case M.PNHeartbeatOperation:case M.PNSetStateOperation:case M.PNGetStateOperation:t="pres";break;case M.PNAddChannelsToGroupOperation:case M.PNRemoveChannelsFromGroupOperation:case M.PNChannelGroupsOperation:case M.PNRemoveGroupOperation:case M.PNChannelsForGroupOperation:t="cg";break;case M.PNPushNotificationEnabledChannelsOperation:case M.PNRemoveAllPushNotificationsOperation:t="push";break;case M.PNCreateUserOperation:case M.PNUpdateUserOperation:case M.PNDeleteUserOperation:case M.PNGetUserOperation:case M.PNGetUsersOperation:case M.PNCreateSpaceOperation:case M.PNUpdateSpaceOperation:case M.PNDeleteSpaceOperation:case M.PNGetSpaceOperation:case M.PNGetSpacesOperation:case M.PNGetMembersOperation:case M.PNUpdateMembersOperation:case M.PNGetMembershipsOperation:case M.PNUpdateMembershipsOperation:t="obj";break;case M.PNAddMessageActionOperation:case M.PNRemoveMessageActionOperation:case M.PNGetMessageActionsOperation:t="msga";break;case M.PNAccessManagerGrant:case M.PNAccessManagerAudit:t="pam";break;case M.PNAccessManagerGrantToken:case M.PNAccessManagerRevokeToken:t="pamv3";break;default:t="time"}return t},e}(),j=function(){function e(e,t,n){this._payload=e,this._setDefaultPayloadStructure(),this.title=t,this.body=n}return Object.defineProperty(e.prototype,"payload",{get:function(){return this._payload},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{set:function(e){this._title=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subtitle",{set:function(e){this._subtitle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{set:function(e){this._body=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"badge",{set:function(e){this._badge=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sound",{set:function(e){this._sound=e},enumerable:!1,configurable:!0}),e.prototype._setDefaultPayloadStructure=function(){},e.prototype.toObject=function(){return{}},e}(),U=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),Object.defineProperty(r.prototype,"configurations",{set:function(e){e&&e.length&&(this._configurations=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"notification",{get:function(){return this._payload.aps},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"title",{get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.aps.alert.title=e,this._title=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"subtitle",{get:function(){return this._subtitle},set:function(e){e&&e.length&&(this._payload.aps.alert.subtitle=e,this._subtitle=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"body",{get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.aps.alert.body=e,this._body=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"badge",{get:function(){return this._badge},set:function(e){null!=e&&(this._payload.aps.badge=e,this._badge=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sound",{get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.aps.sound=e,this._sound=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"silent",{set:function(e){this._isSilent=e},enumerable:!1,configurable:!0}),r.prototype._setDefaultPayloadStructure=function(){this._payload.aps={alert:{}}},r.prototype.toObject=function(){var e=this,t=n({},this._payload),r=t.aps,i=r.alert;if(this._isSilent&&(r["content-available"]=1),"apns2"===this._apnsPushType){if(!this._configurations||!this._configurations.length)throw new ReferenceError("APNS2 configuration is missing");var o=[];this._configurations.forEach((function(t){o.push(e._objectFromAPNS2Configuration(t))})),o.length&&(t.pn_push=o)}return i&&Object.keys(i).length||delete r.alert,this._isSilent&&(delete r.alert,delete r.badge,delete r.sound,i={}),this._isSilent||Object.keys(i).length?t:null},r.prototype._objectFromAPNS2Configuration=function(e){var t=this;if(!e.targets||!e.targets.length)throw new ReferenceError("At least one APNS2 target should be provided");var n=[];e.targets.forEach((function(e){n.push(t._objectFromAPNSTarget(e))}));var r=e.collapseId,i=e.expirationDate,o={auth_method:"token",targets:n,version:"v2"};return r&&r.length&&(o.collapse_id=r),i&&(o.expiration=i.toISOString()),o},r.prototype._objectFromAPNSTarget=function(e){if(!e.topic||!e.topic.length)throw new TypeError("Target 'topic' undefined.");var t=e.topic,n=e.environment,r=void 0===n?"development":n,i=e.excludedDevices,o=void 0===i?[]:i,s={topic:t,environment:r};return o.length&&(s.excluded_devices=o),s},r}(j),x=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),Object.defineProperty(r.prototype,"backContent",{get:function(){return this._backContent},set:function(e){e&&e.length&&(this._payload.back_content=e,this._backContent=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"backTitle",{get:function(){return this._backTitle},set:function(e){e&&e.length&&(this._payload.back_title=e,this._backTitle=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"count",{get:function(){return this._count},set:function(e){null!=e&&(this._payload.count=e,this._count=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"title",{get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.title=e,this._title=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"type",{get:function(){return this._type},set:function(e){e&&e.length&&(this._payload.type=e,this._type=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"subtitle",{get:function(){return this.backTitle},set:function(e){this.backTitle=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"body",{get:function(){return this.backContent},set:function(e){this.backContent=e},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"badge",{get:function(){return this.count},set:function(e){this.count=e},enumerable:!1,configurable:!0}),r.prototype.toObject=function(){return Object.keys(this._payload).length?n({},this._payload):null},r}(j),D=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),Object.defineProperty(r.prototype,"notification",{get:function(){return this._payload.notification},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"data",{get:function(){return this._payload.data},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"title",{get:function(){return this._title},set:function(e){e&&e.length&&(this._payload.notification.title=e,this._title=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"body",{get:function(){return this._body},set:function(e){e&&e.length&&(this._payload.notification.body=e,this._body=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"sound",{get:function(){return this._sound},set:function(e){e&&e.length&&(this._payload.notification.sound=e,this._sound=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"icon",{get:function(){return this._icon},set:function(e){e&&e.length&&(this._payload.notification.icon=e,this._icon=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tag",{get:function(){return this._tag},set:function(e){e&&e.length&&(this._payload.notification.tag=e,this._tag=e)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"silent",{set:function(e){this._isSilent=e},enumerable:!1,configurable:!0}),r.prototype._setDefaultPayloadStructure=function(){this._payload.notification={},this._payload.data={}},r.prototype.toObject=function(){var e=n({},this._payload.data),t=null,r={};if(Object.keys(this._payload).length>2){var i=this._payload;i.notification,i.data;var o=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(i,["notification","data"]);e=n(n({},e),o)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(r.data=e),t&&Object.keys(t).length&&(r.notification=t),Object.keys(r).length?r:null},r}(j),I=function(){function e(e,t){this._payload={apns:{},mpns:{},fcm:{}},this._title=e,this._body=t,this.apns=new U(this._payload.apns,e,t),this.mpns=new x(this._payload.mpns,e,t),this.fcm=new D(this._payload.fcm,e,t)}return Object.defineProperty(e.prototype,"debugging",{set:function(e){this._debugging=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"title",{get:function(){return this._title},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"body",{get:function(){return this._body},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"subtitle",{get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"badge",{get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sound",{get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e},enumerable:!1,configurable:!0}),e.prototype.buildPayload=function(e){var t={};if(e.includes("apns")||e.includes("apns2")){this.apns._apnsPushType=e.includes("apns")?"apns":"apns2";var n=this.apns.toObject();n&&Object.keys(n).length&&(t.pn_apns=n)}if(e.includes("mpns")){var r=this.mpns.toObject();r&&Object.keys(r).length&&(t.pn_mpns=r)}if(e.includes("fcm")){var i=this.fcm.toObject();i&&Object.keys(i).length&&(t.pn_gcm=i)}return Object.keys(t).length&&this._debugging&&(t.pn_debug=!0),t},e}(),G=function(){function e(){this._listeners=[]}return e.prototype.addListener=function(e){this._listeners.push(e)},e.prototype.removeListener=function(e){var t=[];this._listeners.forEach((function(n){n!==e&&t.push(n)})),this._listeners=t},e.prototype.removeAllListeners=function(){this._listeners=[]},e.prototype.announcePresence=function(e){this._listeners.forEach((function(t){t.presence&&t.presence(e)}))},e.prototype.announceStatus=function(e){this._listeners.forEach((function(t){t.status&&t.status(e)}))},e.prototype.announceMessage=function(e){this._listeners.forEach((function(t){t.message&&t.message(e)}))},e.prototype.announceSignal=function(e){this._listeners.forEach((function(t){t.signal&&t.signal(e)}))},e.prototype.announceMessageAction=function(e){this._listeners.forEach((function(t){t.messageAction&&t.messageAction(e)}))},e.prototype.announceFile=function(e){this._listeners.forEach((function(t){t.file&&t.file(e)}))},e.prototype.announceObjects=function(e){this._listeners.forEach((function(t){t.objects&&t.objects(e)}))},e.prototype.announceUser=function(e){this._listeners.forEach((function(t){t.user&&t.user(e)}))},e.prototype.announceSpace=function(e){this._listeners.forEach((function(t){t.space&&t.space(e)}))},e.prototype.announceMembership=function(e){this._listeners.forEach((function(t){t.membership&&t.membership(e)}))},e.prototype.announceNetworkUp=function(){var e={};e.category=E.PNNetworkUpCategory,this.announceStatus(e)},e.prototype.announceNetworkDown=function(){var e={};e.category=E.PNNetworkDownCategory,this.announceStatus(e)},e}(),K=function(){function e(e,t){this._config=e,this._cbor=t}return e.prototype.setToken=function(e){e&&e.length>0?this._token=e:this._token=void 0},e.prototype.getToken=function(){return this._token},e.prototype.extractPermissions=function(e){var t={read:!1,write:!1,manage:!1,delete:!1,get:!1,update:!1,join:!1};return 128==(128&e)&&(t.join=!0),64==(64&e)&&(t.update=!0),32==(32&e)&&(t.get=!0),8==(8&e)&&(t.delete=!0),4==(4&e)&&(t.manage=!0),2==(2&e)&&(t.write=!0),1==(1&e)&&(t.read=!0),t},e.prototype.parseToken=function(e){var t=this,n=this._cbor.decodeToken(e);if(void 0!==n){var r=n.res.uuid?Object.keys(n.res.uuid):[],i=Object.keys(n.res.chan),o=Object.keys(n.res.grp),s=n.pat.uuid?Object.keys(n.pat.uuid):[],a=Object.keys(n.pat.chan),u=Object.keys(n.pat.grp),c={version:n.v,timestamp:n.t,ttl:n.ttl,authorized_uuid:n.uuid},l=r.length>0,p=i.length>0,h=o.length>0;(l||p||h)&&(c.resources={},l&&(c.resources.uuids={},r.forEach((function(e){c.resources.uuids[e]=t.extractPermissions(n.res.uuid[e])}))),p&&(c.resources.channels={},i.forEach((function(e){c.resources.channels[e]=t.extractPermissions(n.res.chan[e])}))),h&&(c.resources.groups={},o.forEach((function(e){c.resources.groups[e]=t.extractPermissions(n.res.grp[e])}))));var f=s.length>0,d=a.length>0,g=u.length>0;return(f||d||g)&&(c.patterns={},f&&(c.patterns.uuids={},s.forEach((function(e){c.patterns.uuids[e]=t.extractPermissions(n.pat.uuid[e])}))),d&&(c.patterns.channels={},a.forEach((function(e){c.patterns.channels[e]=t.extractPermissions(n.pat.chan[e])}))),g&&(c.patterns.groups={},u.forEach((function(e){c.patterns.groups[e]=t.extractPermissions(n.pat.grp[e])})))),Object.keys(n.meta).length>0&&(c.meta=n.meta),c.signature=n.sig,c}},e}(),F=function(e){function n(t,n){var r=this.constructor,i=e.call(this,t)||this;return i.name=i.constructor.name,i.status=n,i.message=t,Object.setPrototypeOf(i,r.prototype),i}return t(n,e),n}(Error);function L(e){return(t={message:e}).type="validationError",t.error=!0,t;var t}function B(e,t,n){return e.usePost&&e.usePost(t,n)?e.postURL(t,n):e.usePatch&&e.usePatch(t,n)?e.patchURL(t,n):e.useGetFile&&e.useGetFile(t,n)?e.getFileURL(t,n):e.getURL(t,n)}function H(e){if(e.sdkName)return e.sdkName;var t="PubNub-JS-".concat(e.sdkFamily);e.partnerId&&(t+="-".concat(e.partnerId)),t+="/".concat(e.getVersion());var n=e._getPnsdkSuffix(" ");return n.length>0&&(t+=n),t}function q(e,t,n){return t.usePost&&t.usePost(e,n)?"POST":t.usePatch&&t.usePatch(e,n)?"PATCH":t.useDelete&&t.useDelete(e,n)?"DELETE":t.useGetFile&&t.useGetFile(e,n)?"GETFILE":"GET"}function z(e,t,n,r,i){var o=e.config,s=e.crypto,a=q(e,i,r);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===i.getOperation()&&i.usePost&&i.usePost(e,r)&&(a="GET"),"GETFILE"===a&&(a="GET");var u="".concat(a,"\n").concat(o.publishKey,"\n").concat(t,"\n").concat(C.signPamFromParams(n),"\n");if("POST"===a)u+="string"==typeof(c=i.postPayload(e,r))?c:JSON.stringify(c);else if("PATCH"===a){var c;u+="string"==typeof(c=i.patchPayload(e,r))?c:JSON.stringify(c)}var l="v2.".concat(s.HMACSHA256(u));l=(l=(l=l.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=l}function V(e,t){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var o=e.networking,s=e.config,a=e.telemetryManager,u=e.tokenManager,c=v(),l=null,p=null,h={};t.getOperation()===M.PNTimeOperation||t.getOperation()===M.PNChannelGroupsOperation?l=r[0]:(h=r[0],l=r[1]),"undefined"==typeof Promise||l||(p=C.createPromise());var f=t.validateParams(e,h);if(f)return l?l(L(f)):p?(p.reject(new F("Validation failed, check status for details",L(f))),p.promise):void 0;var d,g=t.prepareParams(e,h),y=B(t,e,h),b={url:y,operation:t.getOperation(),timeout:t.getRequestTimeout(e),headers:t.getRequestHeaders?t.getRequestHeaders():{},ignoreBody:"function"==typeof t.ignoreBody&&t.ignoreBody(e),forceBuffered:"function"==typeof t.forceBuffered?t.forceBuffered(e,h):null,abortSignal:"function"==typeof t.getAbortSignal?t.getAbortSignal(e,h):null};g.uuid=s.UUID,g.pnsdk=H(s);var m=a.operationsLatencyForRequest();if(Object.keys(m).length&&(g=n(n({},g),m)),s.useInstanceId&&(g.instanceid=s.instanceId),s.useRequestId&&(g.requestid=c),t.isAuthSupported()){var _=u.getToken()||s.getAuthKey();_&&(g.auth=_)}s.secretKey&&z(e,y,g,h,t);var O=function(n,r){if(n.error)return t.handleError&&t.handleError(e,h,n),void(l?l(n):p&&p.reject(new F("PubNub call failed, check status for details",n)));a.stopLatencyMeasure(t.getOperation(),c);var i=t.handleResponse(e,r,h);"function"!=typeof(null==i?void 0:i.then)&&(i=Promise.resolve(i)),i.then((function(e){l?l(n,e):p&&p.fulfill(e)})).catch((function(e){if(l){var n=e;t.getOperation()===M.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:E.PNUnknownCategory}),l(n,null)}else p&&p.reject(new F("PubNub call failed, check status for details",e))}))};if(a.startLatencyMeasure(t.getOperation(),c),"POST"===q(e,t,h)){var P=t.postPayload(e,h);d=o.POST(g,P,b,O)}else if("PATCH"===q(e,t,h)){P=t.patchPayload(e,h);d=o.PATCH(g,P,b,O)}else d="DELETE"===q(e,t,h)?o.DELETE(g,b,O):"GETFILE"===q(e,t,h)?o.GETFILE(g,b,O):o.GET(g,b,O);return t.getOperation()===M.PNSubscribeOperation?d:p?p.promise:void 0}var J=Object.freeze({__proto__:null,getOperation:function(){return M.PNAddChannelsToGroupOperation},validateParams:function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},getURL:function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(C.encodeString(n))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},handleResponse:function(){return{}}});var W=Object.freeze({__proto__:null,getOperation:function(){return M.PNRemoveChannelsFromGroupOperation},validateParams:function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;return r?n&&0!==n.length?i.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing Channel Group"},getURL:function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(C.encodeString(n))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},handleResponse:function(){return{}}});var X=Object.freeze({__proto__:null,getOperation:function(){return M.PNRemoveGroupOperation},validateParams:function(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},getURL:function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(C.encodeString(n),"/remove")},isAuthSupported:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},prepareParams:function(){return{}},handleResponse:function(){return{}}});var $=Object.freeze({__proto__:null,getOperation:function(){return M.PNChannelGroupsOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{groups:t.payload.groups}}});var Q=Object.freeze({__proto__:null,getOperation:function(){return M.PNChannelsForGroupOperation},validateParams:function(e,t){var n=t.channelGroup,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channel Group"},getURL:function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(C.encodeString(n))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{channels:t.payload.channels}}});var Y=Object.freeze({__proto__:null,getOperation:function(){return M.PNPushNotificationEnabledChannelsOperation},validateParams:function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,s=e.config;return n?r?"apns2"!==r||o?i&&0!==i.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},getURL:function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return"apns2"===r?"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var r=t.pushGateway,i=t.channels,o=void 0===i?[]:i,s=t.environment,a=void 0===s?"development":s,u=t.topic,c={type:r,add:o.join(",")};return"apns2"===r&&delete(c=n(n({},c),{environment:a,topic:u})).type,c},handleResponse:function(){return{}}});var Z=Object.freeze({__proto__:null,getOperation:function(){return M.PNPushNotificationEnabledChannelsOperation},validateParams:function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,s=e.config;return n?r?"apns2"!==r||o?i&&0!==i.length?s.subscribeKey?void 0:"Missing Subscribe Key":"Missing Channels":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},getURL:function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return"apns2"===r?"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var r=t.pushGateway,i=t.channels,o=void 0===i?[]:i,s=t.environment,a=void 0===s?"development":s,u=t.topic,c={type:r,remove:o.join(",")};return"apns2"===r&&delete(c=n(n({},c),{environment:a,topic:u})).type,c},handleResponse:function(){return{}}});var ee=Object.freeze({__proto__:null,getOperation:function(){return M.PNPushNotificationEnabledChannelsOperation},validateParams:function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;return n?r?"apns2"!==r||i?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},getURL:function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return"apns2"===r?"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n):"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var r=t.pushGateway,i=t.environment,o=void 0===i?"development":i,s=t.topic,a={type:r};return"apns2"===r&&delete(a=n(n({},a),{environment:o,topic:s})).type,a},handleResponse:function(e,t){return{channels:t}}});var te=Object.freeze({__proto__:null,getOperation:function(){return M.PNRemoveAllPushNotificationsOperation},validateParams:function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;return n?r?"apns2"!==r||i?o.subscribeKey?void 0:"Missing Subscribe Key":"Missing APNS2 topic":"Missing GW Type (pushGateway: gcm, apns or apns2)":"Missing Device ID (device)"},getURL:function(e,t){var n=t.device,r=t.pushGateway,i=e.config;return"apns2"===r?"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n,"/remove"):"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n,"/remove")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var r=t.pushGateway,i=t.environment,o=void 0===i?"development":i,s=t.topic,a={type:r};return"apns2"===r&&delete(a=n(n({},a),{environment:o,topic:s})).type,a},handleResponse:function(){return{}}});var ne=Object.freeze({__proto__:null,getOperation:function(){return M.PNUnsubscribeOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(o),"/leave")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i},handleResponse:function(){return{}}});var re=Object.freeze({__proto__:null,getOperation:function(){return M.PNWhereNowOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r;return"/v2/presence/sub-key/".concat(n.subscribeKey,"/uuid/").concat(C.encodeString(i))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return t.payload?{channels:t.payload.channels}:{channels:[]}}});var ie=Object.freeze({__proto__:null,getOperation:function(){return M.PNHeartbeatOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(o),"/heartbeat")},isAuthSupported:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},prepareParams:function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,o=void 0===i?{}:i,s=e.config,a={};return r.length>0&&(a["channel-group"]=r.join(",")),a.state=JSON.stringify(o),a.heartbeat=s.getPresenceTimeout(),a},handleResponse:function(){return{}}});var oe=Object.freeze({__proto__:null,getOperation:function(){return M.PNGetStateOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,o=t.channels,s=void 0===o?[]:o,a=s.length>0?s.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(a),"/uuid/").concat(i)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};return r.length>0&&(i["channel-group"]=r.join(",")),i},handleResponse:function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,a={};return 1===i.length&&0===s.length?a[i[0]]=t.payload:a=t.payload,{channels:a}}});var se=Object.freeze({__proto__:null,getOperation:function(){return M.PNSetStateOperation},validateParams:function(e,t){var n=e.config,r=t.state,i=t.channels,o=void 0===i?[]:i,s=t.channelGroups,a=void 0===s?[]:s;return r?n.subscribeKey?0===o.length&&0===a.length?"Please provide a list of channels and/or channel-groups":void 0:"Missing Subscribe Key":"Missing State"},getURL:function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(o),"/uuid/").concat(C.encodeString(n.UUID),"/data")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,o={};return o.state=JSON.stringify(n),i.length>0&&(o["channel-group"]=i.join(",")),o},handleResponse:function(e,t){return{state:t.payload}}});var ae=Object.freeze({__proto__:null,getOperation:function(){return M.PNHereNowOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=t.channelGroups,s=void 0===o?[]:o,a="/v2/presence/sub-key/".concat(n.subscribeKey);if(i.length>0||s.length>0){var u=i.length>0?i.join(","):",";a+="/channel/".concat(C.encodeString(u))}return a},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var r=t.channelGroups,i=void 0===r?[]:r,o=t.includeUUIDs,s=void 0===o||o,a=t.includeState,u=void 0!==a&&a,c=t.queryParameters,l=void 0===c?{}:c,p={};return s||(p.disable_uuids=1),u&&(p.state=1),i.length>0&&(p["channel-group"]=i.join(",")),p=n(n({},p),l)},handleResponse:function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,s=void 0===o?[]:o,a=n.includeUUIDs,u=void 0===a||a,c=n.includeState,l=void 0!==c&&c;return i.length>1||s.length>0||0===s.length&&0===i.length?function(){var e={};return e.totalChannels=t.payload.total_channels,e.totalOccupancy=t.payload.total_occupancy,e.channels={},Object.keys(t.payload.channels).forEach((function(n){var r=t.payload.channels[n],i=[];return e.channels[n]={occupants:i,name:n,occupancy:r.occupancy},u&&r.uuids.forEach((function(e){l?i.push({state:e.state,uuid:e.uuid}):i.push({state:null,uuid:e})})),e})),e}():function(){var e={},n=[];return e.totalChannels=1,e.totalOccupancy=t.occupancy,e.channels={},e.channels[i[0]]={occupants:n,name:i[0],occupancy:t.occupancy},u&&t.uuids&&t.uuids.forEach((function(e){l?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}()},handleError:function(e,t,n){402!==n.statusCode||this.getURL(e,t).includes("channel")||(n.errorData.message="You have tried to perform a Global Here Now operation, your keyset configuration does not support that. Please provide a channel, or enable the Global Here Now feature from the Portal.")}});var ue=Object.freeze({__proto__:null,getOperation:function(){return M.PNAddMessageActionOperation},validateParams:function(e,t){var n=e.config,r=t.action,i=t.channel;return t.messageTimetoken?n.subscribeKey?i?r?r.value?r.type?r.type.length>15?"Action.type value exceed maximum length of 15":void 0:"Missing Action.type":"Missing Action.value":"Missing Action":"Missing message channel":"Missing Subscribe Key":"Missing message timetoken"},usePost:function(){return!0},postURL:function(e,t){var n=e.config,r=t.channel,i=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(r),"/message/").concat(i)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},getRequestHeaders:function(){return{"Content-Type":"application/json"}},isAuthSupported:function(){return!0},prepareParams:function(){return{}},postPayload:function(e,t){return t.action},handleResponse:function(e,t){return{data:t.data}}});var ce=Object.freeze({__proto__:null,getOperation:function(){return M.PNRemoveMessageActionOperation},validateParams:function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken;return t.messageTimetoken?i?n.subscribeKey?r?void 0:"Missing message channel":"Missing Subscribe Key":"Missing action timetoken":"Missing message timetoken"},useDelete:function(){return!0},getURL:function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken,o=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(r),"/message/").concat(o,"/action/").concat(i)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{data:t.data}}});var le=Object.freeze({__proto__:null,getOperation:function(){return M.PNGetMessageActionsOperation},validateParams:function(e,t){var n=e.config,r=t.channel;return n.subscribeKey?r?void 0:"Missing message channel":"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(C.encodeString(r))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.limit,r=t.start,i=t.end,o={};return n&&(o.limit=n),r&&(o.start=r),i&&(o.end=i),o},handleResponse:function(e,t){var n={data:t.data,start:null,end:null};return n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken),n}}),pe={getOperation:function(){return M.PNListFilesOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/files")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n={};return t.limit&&(n.limit=t.limit),t.next&&(n.next=t.next),n},handleResponse:function(e,t){return{status:t.status,data:t.data,next:t.next,count:t.count}}},he={getOperation:function(){return M.PNGenerateUploadUrlOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?void 0:"name can't be empty":"channel can't be empty"},usePost:function(){return!0},postURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/generate-upload-url")},postPayload:function(e,t){return{name:t.name}},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data,file_upload_request:t.file_upload_request}}},fe={getOperation:function(){return M.PNPublishFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.fileId)?(null==t?void 0:t.fileName)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},getURL:function(e,t){var n=e.config,r=n.publishKey,i=n.subscribeKey,o=function(e,t){var n=e.crypto,r=e.config,i=JSON.stringify(t);return r.cipherKey&&(i=n.encrypt(i),i=JSON.stringify(i)),i||""}(e,{message:t.message,file:{name:t.fileName,id:t.fileId}});return"/v1/files/publish-file/".concat(r,"/").concat(i,"/0/").concat(C.encodeString(t.channel),"/0/").concat(C.encodeString(o))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n={};return t.ttl&&(n.ttl=t.ttl),void 0!==t.storeInHistory&&(n.store=t.storeInHistory?"1":"0"),t.meta&&"object"==typeof t.meta&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}},de=function(e){var t=function(e){var t=this,n=e.generateUploadUrl,o=e.publishFile,s=e.modules,a=s.PubNubFile,u=s.config,c=s.cryptography,l=s.networking;return function(e){var s=e.channel,p=e.file,h=e.message,f=e.cipherKey,d=e.meta,g=e.ttl,y=e.storeInHistory;return r(t,void 0,void 0,(function(){var e,t,r,b,v,m,_,O,P,S,w,T,k,N,C,E,A,M,R,j,U,x,D,I,G,K,B,H;return i(this,(function(i){switch(i.label){case 0:if(!s)throw new F("Validation failed, check status for details",L("channel can't be empty"));if(!p)throw new F("Validation failed, check status for details",L("file can't be empty"));return e=a.create(p),[4,n({channel:s,name:e.name})];case 1:return t=i.sent(),r=t.file_upload_request,b=r.url,v=r.form_fields,m=t.data,_=m.id,O=m.name,a.supportsEncryptFile&&(null!=f?f:u.cipherKey)?[4,c.encryptFile(null!=f?f:u.cipherKey,e,a)]:[3,3];case 2:e=i.sent(),i.label=3;case 3:P=v,e.mimeType&&(P=v.map((function(t){return"Content-Type"===t.key?{key:t.key,value:e.mimeType}:t}))),i.label=4;case 4:return i.trys.push([4,18,,20]),a.supportsFileUri&&p.uri?(T=(w=l).POSTFILE,k=[b,P],[4,e.toFileUri()]):[3,7];case 5:return[4,T.apply(w,k.concat([i.sent()]))];case 6:return S=i.sent(),[3,17];case 7:return a.supportsFile?(C=(N=l).POSTFILE,E=[b,P],[4,e.toFile()]):[3,10];case 8:return[4,C.apply(N,E.concat([i.sent()]))];case 9:return S=i.sent(),[3,17];case 10:return a.supportsBuffer?(M=(A=l).POSTFILE,R=[b,P],[4,e.toBuffer()]):[3,13];case 11:return[4,M.apply(A,R.concat([i.sent()]))];case 12:return S=i.sent(),[3,17];case 13:return a.supportsBlob?(U=(j=l).POSTFILE,x=[b,P],[4,e.toBlob()]):[3,16];case 14:return[4,U.apply(j,x.concat([i.sent()]))];case 15:return S=i.sent(),[3,17];case 16:throw new Error("Unsupported environment");case 17:return[3,20];case 18:return D=i.sent(),[4,(q=D.response,new Promise((function(e){var t="";q.on("data",(function(e){t+=e.toString("utf8")})),q.on("end",(function(){e(t)}))})))];case 19:throw I=i.sent(),G=/<Message>(.*)<\/Message>/gi.exec(I),new F(G?"Upload to bucket failed: ".concat(G[1]):"Upload to bucket failed.",D);case 20:if(204!==S.status)throw new F("Upload to bucket was unsuccessful",S);K=u.fileUploadPublishRetryLimit,B=!1,H={timetoken:"0"},i.label=21;case 21:return i.trys.push([21,23,,24]),[4,o({channel:s,message:h,fileId:_,fileName:O,meta:d,storeInHistory:y,ttl:g})];case 22:return H=i.sent(),B=!0,[3,24];case 23:return i.sent(),K-=1,[3,24];case 24:if(!B&&K>0)return[3,21];i.label=25;case 25:if(B)return[2,{timetoken:H.timetoken,id:_,name:O}];throw new F("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:s,id:_,name:O})}var q}))}))}}(e);return function(e,n){var r=t(e);return"function"==typeof n?(r.then((function(e){return n(null,e)})).catch((function(e){return n(e,null)})),r):r}},ge=function(e,t){var n=t.channel,r=t.id,i=t.name,o=e.config,s=e.networking;if(!n)throw new F("Validation failed, check status for details",L("channel can't be empty"));if(!r)throw new F("Validation failed, check status for details",L("file id can't be empty"));if(!i)throw new F("Validation failed, check status for details",L("file name can't be empty"));var a="/v1/files/".concat(o.subscribeKey,"/channels/").concat(C.encodeString(n),"/files/").concat(r,"/").concat(i),u={};u.uuid=o.getUUID(),u.pnsdk=H(o),o.getAuthKey()&&(u.auth=o.getAuthKey()),o.secretKey&&z(e,a,u,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var c=Object.keys(u).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(u[e]))})).join("&");return""!==c?"".concat(s.getStandardOrigin()).concat(a,"?").concat(c):"".concat(s.getStandardOrigin()).concat(a)},ye={getOperation:function(){return M.PNDownloadFileOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.name)?(null==t?void 0:t.id)?void 0:"id can't be empty":"name can't be empty":"channel can't be empty"},useGetFile:function(){return!0},getFileURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},ignoreBody:function(){return!0},forceBuffered:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t,n){var o=e.PubNubFile,s=e.config,a=e.cryptography;return r(void 0,void 0,void 0,(function(){var e,r,u,c;return i(this,(function(i){switch(i.label){case 0:return e=t.response.body,o.supportsEncryptFile&&(null!==(r=n.cipherKey)&&void 0!==r?r:s.cipherKey)?[4,a.decrypt(null!==(u=n.cipherKey)&&void 0!==u?u:s.cipherKey,e)]:[3,2];case 1:e=i.sent(),i.label=2;case 2:return[2,o.create({data:e,name:null!==(c=t.response.name)&&void 0!==c?c:n.name,mimeType:t.response.type})]}}))}))}},be={getOperation:function(){return M.PNListFilesOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.id)?(null==t?void 0:t.name)?void 0:"file name can't be empty":"file id can't be empty":"channel can't be empty"},useDelete:function(){return!0},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/files/").concat(t.id,"/").concat(t.name)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status}}},ve={getOperation:function(){return M.PNGetAllUUIDMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h={};return(null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.customFields)&&(h.include="custom"),(null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.totalCount)&&(h.count=null===(i=t.include)||void 0===i?void 0:i.totalCount),(null===(o=null==t?void 0:t.page)||void 0===o?void 0:o.next)&&(h.start=null===(a=t.page)||void 0===a?void 0:a.next),(null===(u=null==t?void 0:t.page)||void 0===u?void 0:u.prev)&&(h.end=null===(c=t.page)||void 0===c?void 0:c.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),h.limit=null!==(l=null==t?void 0:t.limit)&&void 0!==l?l:100,(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}},me={getOperation:function(){return M.PNGetUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,r=e.config;return"/v2/objects/".concat(r.subscribeKey,"/uuids/").concat(C.encodeString(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:r.getUUID()))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},_e={getOperation:function(){return M.PNSetUUIDMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.data))return"Data cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,r=e.config;return"/v2/objects/".concat(r.subscribeKey,"/uuids/").concat(C.encodeString(null!==(n=t.uuid)&&void 0!==n?n:r.getUUID()))},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:o.getUUID(),include:(null===(i=null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.customFields)||void 0===i||i)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},Oe={getOperation:function(){return M.PNRemoveUUIDMetadataOperation},validateParams:function(){},getURL:function(e,t){var n,r=e.config;return"/v2/objects/".concat(r.subscribeKey,"/uuids/").concat(C.encodeString(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:r.getUUID()))},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r=e.config;return{uuid:null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:r.getUUID()}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},Pe={getOperation:function(){return M.PNGetAllChannelMetadataOperation},validateParams:function(){},getURL:function(e){var t=e.config;return"/v2/objects/".concat(t.subscribeKey,"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h={};return(null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.customFields)&&(h.include="custom"),(null===(r=null==t?void 0:t.include)||void 0===r?void 0:r.totalCount)&&(h.count=null===(i=t.include)||void 0===i?void 0:i.totalCount),(null===(o=null==t?void 0:t.page)||void 0===o?void 0:o.next)&&(h.start=null===(a=t.page)||void 0===a?void 0:a.next),(null===(u=null==t?void 0:t.page)||void 0===u?void 0:u.prev)&&(h.end=null===(c=t.page)||void 0===c?void 0:c.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),h.limit=null!==(l=null==t?void 0:t.limit)&&void 0!==l?l:100,(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}},Se={getOperation:function(){return M.PNGetChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r;return{include:(null===(r=null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.customFields)||void 0===r||r)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},we={getOperation:function(){return M.PNSetChannelMetadataOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.data)?void 0:"Data cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel))},patchPayload:function(e,t){return t.data},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r;return{include:(null===(r=null===(n=null==t?void 0:t.include)||void 0===n?void 0:n.customFields)||void 0===r||r)&&"custom"}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},Te={getOperation:function(){return M.PNRemoveChannelMetadataOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"Channel cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel))},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{status:t.status,data:t.data}}},ke={getOperation:function(){return M.PNGetMembersOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channel))return"UUID cannot be empty"},getURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/uuids")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h,f,d,g={};return(null==t?void 0:t.include)&&(g.include=[],(null===(n=t.include)||void 0===n?void 0:n.customFields)&&g.include.push("custom"),(null===(r=t.include)||void 0===r?void 0:r.customUUIDFields)&&g.include.push("uuid.custom"),(null===(o=null===(i=t.include)||void 0===i?void 0:i.UUIDFields)||void 0===o||o)&&g.include.push("uuid"),g.include=g.include.join(",")),(null===(a=null==t?void 0:t.include)||void 0===a?void 0:a.totalCount)&&(g.count=null===(u=t.include)||void 0===u?void 0:u.totalCount),(null===(c=null==t?void 0:t.page)||void 0===c?void 0:c.next)&&(g.start=null===(l=t.page)||void 0===l?void 0:l.next),(null===(p=null==t?void 0:t.page)||void 0===p?void 0:p.prev)&&(g.end=null===(h=t.page)||void 0===h?void 0:h.prev),(null==t?void 0:t.filter)&&(g.filter=t.filter),g.limit=null!==(f=null==t?void 0:t.limit)&&void 0!==f?f:100,(null==t?void 0:t.sort)&&(g.sort=Object.entries(null!==(d=t.sort)&&void 0!==d?d:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),g},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}},Ne={getOperation:function(){return M.PNSetMembersOperation},validateParams:function(e,t){return(null==t?void 0:t.channel)?(null==t?void 0:t.uuids)&&0!==(null==t?void 0:t.uuids.length)?void 0:"UUIDs cannot be empty":"Channel cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n=e.config;return"/v2/objects/".concat(n.subscribeKey,"/channels/").concat(C.encodeString(t.channel),"/uuids")},patchPayload:function(e,t){var n;return(n={set:[],remove:[]})[t.type]=t.uuids.map((function(e){return"string"==typeof e?{uuid:{id:e}}:{uuid:{id:e.id},custom:e.custom}})),n},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(n=t.include)||void 0===n?void 0:n.customFields)&&h.include.push("custom"),(null===(r=t.include)||void 0===r?void 0:r.customUUIDFields)&&h.include.push("uuid.custom"),(null===(i=t.include)||void 0===i?void 0:i.UUIDFields)&&h.include.push("uuid"),h.include=h.include.join(",")),(null===(o=null==t?void 0:t.include)||void 0===o?void 0:o.totalCount)&&(h.count=!0),(null===(a=null==t?void 0:t.page)||void 0===a?void 0:a.next)&&(h.start=null===(u=t.page)||void 0===u?void 0:u.next),(null===(c=null==t?void 0:t.page)||void 0===c?void 0:c.prev)&&(h.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}},Ce={getOperation:function(){return M.PNGetMembershipsOperation},validateParams:function(){},getURL:function(e,t){var n,r=e.config;return"/v2/objects/".concat(r.subscribeKey,"/uuids/").concat(C.encodeString(null!==(n=null==t?void 0:t.uuid)&&void 0!==n?n:r.getUUID()),"/channels")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h,f,d={};return(null==t?void 0:t.include)&&(d.include=[],(null===(n=t.include)||void 0===n?void 0:n.customFields)&&d.include.push("custom"),(null===(r=t.include)||void 0===r?void 0:r.customChannelFields)&&d.include.push("channel.custom"),(null===(i=t.include)||void 0===i?void 0:i.channelFields)&&d.include.push("channel"),d.include=d.include.join(",")),(null===(o=null==t?void 0:t.include)||void 0===o?void 0:o.totalCount)&&(d.count=null===(a=t.include)||void 0===a?void 0:a.totalCount),(null===(u=null==t?void 0:t.page)||void 0===u?void 0:u.next)&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next),(null===(l=null==t?void 0:t.page)||void 0===l?void 0:l.prev)&&(d.end=null===(p=t.page)||void 0===p?void 0:p.prev),(null==t?void 0:t.filter)&&(d.filter=t.filter),d.limit=null!==(h=null==t?void 0:t.limit)&&void 0!==h?h:100,(null==t?void 0:t.sort)&&(d.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}},Ee={getOperation:function(){return M.PNSetMembershipsOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channels)||0===(null==t?void 0:t.channels.length))return"Channels cannot be empty"},usePatch:function(){return!0},patchURL:function(e,t){var n,r=e.config;return"/v2/objects/".concat(r.subscribeKey,"/uuids/").concat(C.encodeString(null!==(n=t.uuid)&&void 0!==n?n:r.getUUID()),"/channels")},patchPayload:function(e,t){var n;return(n={set:[],remove:[]})[t.type]=t.channels.map((function(e){return"string"==typeof e?{channel:{id:e}}:{channel:{id:e.id},custom:e.custom}})),n},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n,r,i,o,a,u,c,l,p,h={};return(null==t?void 0:t.include)&&(h.include=[],(null===(n=t.include)||void 0===n?void 0:n.customFields)&&h.include.push("custom"),(null===(r=t.include)||void 0===r?void 0:r.customChannelFields)&&h.include.push("channel.custom"),(null===(i=t.include)||void 0===i?void 0:i.channelFields)&&h.include.push("channel"),h.include=h.include.join(",")),(null===(o=null==t?void 0:t.include)||void 0===o?void 0:o.totalCount)&&(h.count=!0),(null===(a=null==t?void 0:t.page)||void 0===a?void 0:a.next)&&(h.start=null===(u=t.page)||void 0===u?void 0:u.next),(null===(c=null==t?void 0:t.page)||void 0===c?void 0:c.prev)&&(h.end=null===(l=t.page)||void 0===l?void 0:l.prev),(null==t?void 0:t.filter)&&(h.filter=t.filter),(null==t?void 0:t.limit)&&(h.limit=t.limit),(null==t?void 0:t.sort)&&(h.sort=Object.entries(null!==(p=t.sort)&&void 0!==p?p:{}).map((function(e){var t=s(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n}))),h},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,prev:t.prev,next:t.next}}};var Ae=Object.freeze({__proto__:null,getOperation:function(){return M.PNAccessManagerAudit},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!1},prepareParams:function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,o=void 0===i?[]:i,s={};return n&&(s.channel=n),r&&(s["channel-group"]=r),o.length>0&&(s.auth=o.join(",")),s},handleResponse:function(e,t){return t.payload}});var Me=Object.freeze({__proto__:null,getOperation:function(){return M.PNAccessManagerGrant},validateParams:function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?null==t.uuids||t.authKeys?null==t.uuids||null==t.channels&&null==t.channelGroups?void 0:"Both channel/channelgroup and uuid cannot be used in the same request":"authKeys are required for grant request on uuids":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},getURL:function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!1},prepareParams:function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,o=void 0===i?[]:i,s=t.uuids,a=void 0===s?[]:s,u=t.ttl,c=t.read,l=void 0!==c&&c,p=t.write,h=void 0!==p&&p,f=t.manage,d=void 0!==f&&f,g=t.get,y=void 0!==g&&g,b=t.join,v=void 0!==b&&b,m=t.update,_=void 0!==m&&m,O=t.authKeys,P=void 0===O?[]:O,S=t.delete,w={};return w.r=l?"1":"0",w.w=h?"1":"0",w.m=d?"1":"0",w.d=S?"1":"0",w.g=y?"1":"0",w.j=v?"1":"0",w.u=_?"1":"0",r.length>0&&(w.channel=r.join(",")),o.length>0&&(w["channel-group"]=o.join(",")),P.length>0&&(w.auth=P.join(",")),a.length>0&&(w["target-uuid"]=a.join(",")),(u||0===u)&&(w.ttl=u),w},handleResponse:function(){return{}}});function Re(e){var t=0;return e.join&&(t|=128),e.update&&(t|=64),e.get&&(t|=32),e.delete&&(t|=8),e.manage&&(t|=4),e.write&&(t|=2),e.read&&(t|=1),t}var je=Object.freeze({__proto__:null,getOperation:function(){return M.PNAccessManagerGrantToken},extractPermissions:Re,validateParams:function(e,t){var n=e.config;return n.subscribeKey?n.publishKey?n.secretKey?t.resources||t.patterns?(!t.resources||t.resources.uuids&&0!==Object.keys(t.resources.uuids).length||t.resources.channels&&0!==Object.keys(t.resources.channels).length||t.resources.groups&&0!==Object.keys(t.resources.groups).length)&&(!t.patterns||t.patterns.uuids&&0!==Object.keys(t.patterns.uuids).length||t.patterns.channels&&0!==Object.keys(t.patterns.channels).length||t.patterns.groups&&0!==Object.keys(t.patterns.groups).length)?void 0:"Missing values for either Resources or Patterns.":"Missing either Resources or Patterns.":"Missing Secret Key":"Missing Publish Key":"Missing Subscribe Key"},postURL:function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},usePost:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!1},prepareParams:function(){return{}},postPayload:function(e,t){return function(e,t){var n=t.ttl,r=t.resources,i=t.patterns,o=t.meta,s=t.authorized_uuid,a={ttl:0,permissions:{resources:{channels:{},groups:{},uuids:{},users:{},spaces:{}},patterns:{channels:{},groups:{},uuids:{},users:{},spaces:{}},meta:{}}};if(r){var u=r.uuids,c=r.channels,l=r.groups;u&&Object.keys(u).forEach((function(e){a.permissions.resources.uuids[e]=Re(u[e])})),c&&Object.keys(c).forEach((function(e){a.permissions.resources.channels[e]=Re(c[e])})),l&&Object.keys(l).forEach((function(e){a.permissions.resources.groups[e]=Re(l[e])}))}if(i){var p=i.uuids,h=i.channels,f=i.groups;p&&Object.keys(p).forEach((function(e){a.permissions.patterns.uuids[e]=Re(p[e])})),h&&Object.keys(h).forEach((function(e){a.permissions.patterns.channels[e]=Re(h[e])})),f&&Object.keys(f).forEach((function(e){a.permissions.patterns.groups[e]=Re(f[e])}))}return(n||0===n)&&(a.ttl=n),o&&(a.permissions.meta=o),s&&(a.permissions.uuid="".concat(s)),a}(0,t)},handleResponse:function(e,t){return t.data.token}}),Ue={getOperation:function(){return M.PNAccessManagerRevokeToken},validateParams:function(e,t){return e.config.secretKey?t?void 0:"token can't be empty":"Missing Secret Key"},getURL:function(e,t){var n=e.config;return"/v3/pam/".concat(n.subscribeKey,"/grant/").concat(C.encodeString(t))},useDelete:function(){return!0},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!1},prepareParams:function(e){return{uuid:e.config.getUUID()}},handleResponse:function(e,t){return{status:t.status,data:t.data}}};function xe(e,t){var n=e.crypto,r=e.config,i=JSON.stringify(t);return r.cipherKey&&(i=n.encrypt(i),i=JSON.stringify(i)),i}var De=Object.freeze({__proto__:null,getOperation:function(){return M.PNPublishOperation},validateParams:function(e,t){var n=e.config,r=t.message;return t.channel?r?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},usePost:function(e,t){var n=t.sendByPost;return void 0!==n&&n},getURL:function(e,t){var n=e.config,r=t.channel,i=xe(e,t.message);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(C.encodeString(r),"/0/").concat(C.encodeString(i))},postURL:function(e,t){var n=e.config,r=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(C.encodeString(r),"/0")},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},postPayload:function(e,t){return xe(e,t.message)},prepareParams:function(e,t){var n=t.meta,r=t.replicate,i=void 0===r||r,o=t.storeInHistory,s=t.ttl,a={};return null!=o&&(a.store=o?"1":"0"),s&&(a.ttl=s),!1===i&&(a.norep="true"),n&&"object"==typeof n&&(a.meta=JSON.stringify(n)),a},handleResponse:function(e,t){return{timetoken:t[2]}}});var Ie=Object.freeze({__proto__:null,getOperation:function(){return M.PNSignalOperation},validateParams:function(e,t){var n=e.config,r=t.message;return t.channel?r?n.subscribeKey?void 0:"Missing Subscribe Key":"Missing Message":"Missing Channel"},getURL:function(e,t){var n,r=e.config,i=t.channel,o=t.message,s=(n=o,JSON.stringify(n));return"/signal/".concat(r.publishKey,"/").concat(r.subscribeKey,"/0/").concat(C.encodeString(i),"/0/").concat(C.encodeString(s))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(){return{}},handleResponse:function(e,t){return{timetoken:t[2]}}});function Ge(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}var Ke=Object.freeze({__proto__:null,getOperation:function(){return M.PNHistoryOperation},validateParams:function(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},getURL:function(e,t){var n=t.channel,r=e.config;return"/v2/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(C.encodeString(n))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.start,r=t.end,i=t.reverse,o=t.count,s=void 0===o?100:o,a=t.stringifiedTimeToken,u=void 0!==a&&a,c=t.includeMeta,l=void 0!==c&&c,p={include_token:"true"};return p.count=s,n&&(p.start=n),r&&(p.end=r),u&&(p.string_message_token="true"),null!=i&&(p.reverse=i.toString()),l&&(p.include_meta="true"),p},handleResponse:function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};return Array.isArray(t[0])&&t[0].forEach((function(t){var r={timetoken:t.timetoken,entry:Ge(e,t.message)};t.meta&&(r.meta=t.meta),n.messages.push(r)})),n}});var Fe=Object.freeze({__proto__:null,getOperation:function(){return M.PNDeleteMessagesOperation},validateParams:function(e,t){var n=t.channel,r=e.config;return n?r.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},useDelete:function(){return!0},getURL:function(e,t){var n=t.channel,r=e.config;return"/v3/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(C.encodeString(n))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.start,r=t.end,i={};return n&&(i.start=n),r&&(i.end=r),i},handleResponse:function(e,t){return t.payload}});var Le=Object.freeze({__proto__:null,getOperation:function(){return M.PNMessageCounts},validateParams:function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,o=e.config;return n?r&&i?"timetoken and channelTimetokens are incompatible together":r&&i&&i.length>1&&n.length!==i.length?"Length of channelTimetokens and channels do not match":o.subscribeKey?void 0:"Missing Subscribe Key":"Missing channel"},getURL:function(e,t){var n=t.channels,r=e.config,i=n.join(",");return"/v3/history/sub-key/".concat(r.subscribeKey,"/message-counts/").concat(C.encodeString(i))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.timetoken,r=t.channelTimetokens,i={};if(r&&1===r.length){var o=s(r,1)[0];i.timetoken=o}else r?i.channelsTimetoken=r.join(","):n&&(i.timetoken=n);return i},handleResponse:function(e,t){return{channels:t.channels}}});var Be=Object.freeze({__proto__:null,getOperation:function(){return M.PNFetchMessagesOperation},validateParams:function(e,t){var n=t.channels,r=t.includeMessageActions,i=void 0!==r&&r,o=e.config;if(!n||0===n.length)return"Missing channels";if(!o.subscribeKey)return"Missing Subscribe Key";if(i&&n.length>1)throw new TypeError("History can return actions data for a single channel only. Either pass a single channel or disable the includeMessageActions flag.")},getURL:function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.includeMessageActions,o=void 0!==i&&i,s=e.config,a=o?"history-with-actions":"history",u=r.length>0?r.join(","):",";return"/v3/".concat(a,"/sub-key/").concat(s.subscribeKey,"/channel/").concat(C.encodeString(u))},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=t.channels,r=t.start,i=t.end,o=t.includeMessageActions,s=t.count,a=t.stringifiedTimeToken,u=void 0!==a&&a,c=t.includeMeta,l=void 0!==c&&c,p=t.includeUuid,h=t.includeUUID,f=void 0===h||h,d=t.includeMessageType,g=void 0===d||d,y={};return y.max=s||(n.length>1||!0===o?25:100),r&&(y.start=r),i&&(y.end=i),u&&(y.string_message_token="true"),l&&(y.include_meta="true"),f&&!1!==p&&(y.include_uuid="true"),g&&(y.include_message_type="true"),y},handleResponse:function(e,t){var n={channels:{}};return Object.keys(t.channels||{}).forEach((function(r){n.channels[r]=[],(t.channels[r]||[]).forEach((function(t){var i={};i.channel=r,i.timetoken=t.timetoken,i.message=function(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}(e,t.message),i.messageType=t.message_type,i.uuid=t.uuid,t.actions&&(i.actions=t.actions,i.data=t.actions),t.meta&&(i.meta=t.meta),n.channels[r].push(i)}))})),t.more&&(n.more=t.more),n}});var He=Object.freeze({__proto__:null,getOperation:function(){return M.PNTimeOperation},getURL:function(){return"/time/0"},getRequestTimeout:function(e){return e.config.getTransactionTimeout()},prepareParams:function(){return{}},isAuthSupported:function(){return!1},handleResponse:function(e,t){return{timetoken:t[0]}},validateParams:function(){}});var qe=Object.freeze({__proto__:null,getOperation:function(){return M.PNSubscribeOperation},validateParams:function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"},getURL:function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=i.length>0?i.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(C.encodeString(o),"/0")},getRequestTimeout:function(e){return e.config.getSubscribeTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n=e.config,r=t.state,i=t.channelGroups,o=void 0===i?[]:i,s=t.timetoken,a=t.filterExpression,u=t.region,c={heartbeat:n.getPresenceTimeout()};return o.length>0&&(c["channel-group"]=o.join(",")),a&&a.length>0&&(c["filter-expr"]=a),Object.keys(r).length&&(c.state=JSON.stringify(r)),s&&(c.tt=s),u&&(c.tr=u),c},handleResponse:function(e,t){var n=[];t.m.forEach((function(e){var t={publishTimetoken:e.p.t,region:e.p.r},r={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,messageType:e.e,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,userMetadata:e.u,publishMetaData:t};n.push(r)}));var r={timetoken:t.t.t,region:t.t.r};return{messages:n,metadata:r}}}),ze={getOperation:function(){return M.PNHandshakeOperation},validateParams:function(e,t){if(!(null==t?void 0:t.channels)&&!(null==t?void 0:t.channelGroups))return"channels and channleGroups both should not be empty"},getURL:function(e,t){var n=e.config,r=t.channels?t.channels.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(C.encodeString(r),"/0")},getRequestTimeout:function(e){return e.config.getSubscribeTimeout()},isAuthSupported:function(){return!0},prepareParams:function(e,t){var n={};return t.channelGroups&&t.channelGroups.length>0&&(n["channel-group"]=t.channelGroups.join(",")),n.tt=0,n},handleResponse:function(e,t){return{region:t.t.r,timetoken:t.t.t}}},Ve={getOperation:function(){return M.PNReceiveMessagesOperation},validateParams:function(e,t){return(null==t?void 0:t.channels)||(null==t?void 0:t.channelGroups)?(null==t?void 0:t.timetoken)?(null==t?void 0:t.region)?void 0:"region can not be empty":"timetoken can not be empty":"channels and channleGroups both should not be empty"},getURL:function(e,t){var n=e.config,r=t.channels?t.channels.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(C.encodeString(r),"/0")},getRequestTimeout:function(e){return e.config.getSubscribeTimeout()},isAuthSupported:function(){return!0},getAbortSignal:function(e,t){return t.abortSignal},prepareParams:function(e,t){var n={};return t.channelGroups&&t.channelGroups.length>0&&(n["channel-group"]=t.channelGroups.join(",")),n.tt=t.timetoken,n.tr=t.region,n},handleResponse:function(e,t){var n=[];return t.m.forEach((function(e){var t={shard:parseInt(e.a,10),subscriptionMatch:e.b,channel:e.c,messageType:e.e,payload:e.d,flags:e.f,issuingClientId:e.i,subscribeKey:e.k,originationTimetoken:e.o,publishMetaData:{timetoken:e.p.t,region:e.p.r}};n.push(t)})),{messages:n,metadata:{region:t.t.r,timetoken:t.t.t}}}},Je=function(){function e(e){void 0===e&&(e=!1),this.sync=e,this.listeners=new Set}return e.prototype.subscribe=function(e){var t=this;return this.listeners.add(e),function(){t.listeners.delete(e)}},e.prototype.notify=function(e){var t=this,n=function(){t.listeners.forEach((function(t){t(e)}))};this.sync?n():setTimeout(n,0)},e}(),We=function(){function e(e){this.label=e,this.transitionMap=new Map,this.enterEffects=[],this.exitEffects=[]}return e.prototype.transition=function(e,t){var n;if(this.transitionMap.has(t.type))return null===(n=this.transitionMap.get(t.type))||void 0===n?void 0:n(e,t)},e.prototype.on=function(e,t){return this.transitionMap.set(e,t),this},e.prototype.with=function(e,t){return[this,e,null!=t?t:[]]},e.prototype.onEnter=function(e){return this.enterEffects.push(e),this},e.prototype.onExit=function(e){return this.exitEffects.push(e),this},e}(),Xe=function(e){function n(){return null!==e&&e.apply(this,arguments)||this}return t(n,e),n.prototype.describe=function(e){return new We(e)},n.prototype.start=function(e,t){this.currentState=e,this.currentContext=t,this.notify({type:"engineStarted",state:e,context:t})},n.prototype.transition=function(e){var t,n,r,i,a,u;if(!this.currentState)throw new Error("Start the engine first");this.notify({type:"eventReceived",event:e});var c=this.currentState.transition(this.currentContext,e);if(c){var l=s(c,3),p=l[0],h=l[1],f=l[2];try{for(var d=o(this.currentState.exitEffects),g=d.next();!g.done;g=d.next()){var y=g.value;this.notify({type:"invocationDispatched",invocation:y(this.currentContext)})}}catch(e){t={error:e}}finally{try{g&&!g.done&&(n=d.return)&&n.call(d)}finally{if(t)throw t.error}}var b=this.currentState;this.currentState=p;var v=this.currentContext;this.currentContext=h,this.notify({type:"transitionDone",fromState:b,fromContext:v,toState:p,toContext:h,event:e});try{for(var m=o(f),_=m.next();!_.done;_=m.next()){y=_.value;this.notify({type:"invocationDispatched",invocation:y})}}catch(e){r={error:e}}finally{try{_&&!_.done&&(i=m.return)&&i.call(m)}finally{if(r)throw r.error}}try{for(var O=o(this.currentState.enterEffects),P=O.next();!P.done;P=O.next()){y=P.value;this.notify({type:"invocationDispatched",invocation:y(this.currentContext)})}}catch(e){a={error:e}}finally{try{P&&!P.done&&(u=O.return)&&u.call(O)}finally{if(a)throw a.error}}}},n}(Je),$e=function(){function e(e){this.dependencies=e,this.instances=new Map,this.handlers=new Map}return e.prototype.on=function(e,t){this.handlers.set(e,t)},e.prototype.dispatch=function(e){if("CANCEL"!==e.type){var t=this.handlers.get(e.type);if(!t)throw new Error("Unhandled invocation '".concat(e.type,"'"));var n=t(e.payload,this.dependencies);e.managed&&this.instances.set(e.type,n),n.start()}else if(this.instances.has(e.payload)){var r=this.instances.get(e.payload);null==r||r.cancel(),this.instances.delete(e.payload)}},e}();function Qe(e,t){var n=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return{type:e,payload:null==t?void 0:t.apply(void 0,a([],s(n),!1))}};return n.type=e,n}function Ye(e,t){var n=function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];return{type:e,payload:t.apply(void 0,a([],s(n),!1)),managed:!0}};return n.type=e,n.cancel={type:"CANCEL",payload:e,managed:!1},n}var Ze,et,tt,nt=function(e){function n(){var t=this.constructor,n=e.call(this,"The operation was aborted.")||this;return n.name="AbortError",Object.setPrototypeOf(n,t.prototype),n}return t(n,e),n}(Error),rt=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t._aborted=!1,t}return t(n,e),Object.defineProperty(n.prototype,"aborted",{get:function(){return this._aborted},enumerable:!1,configurable:!0}),n.prototype.throwIfAborted=function(){if(this._aborted)throw new nt},n.prototype.abort=function(){this._aborted=!0,this.notify(new nt)},n}(Je),it=function(e){function n(t,n,r){var i=e.call(this,t,n)||this;return i.asyncFunction=r,i.abortSignal=new rt,i}return t(n,e),n.prototype.start=function(){this.asyncFunction(this.payload,this.abortSignal,this.dependencies)},n.prototype.cancel=function(){this.abortSignal.abort()},n}((function(e,t){this.payload=e,this.dependencies=t})),ot=function(e){return function(t,n){return new it(t,n,e)}},st=Ye("HANDSHAKE",(function(e,t){return{channels:e,groups:t}})),at=Ye("RECEIVE_EVENTS",(function(e,t,n){return{channels:e,groups:t,cursor:n}})),ut=(et=function(e){return e},tt=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return{type:Ze,payload:et.apply(void 0,a([],s(e),!1)),managed:!1}},tt.type=Ze="EMIT_EVENTS",tt),ct=Ye("RECONNECT",(function(e){return e})),lt=Ye("HANDSHAKE_RECONNECT",(function(e){return e})),pt=Qe("SUBSCRIPTION_CHANGE",(function(e,t){return{channels:e,groups:t}})),ht=Qe("DISCONNECT",(function(){return{}})),ft=Qe("RECONNECT",(function(){return{}}));Qe("RESTORE",(function(e,t,n,r){return{channels:e,groups:t,timetoken:n,region:r}}));var dt=Qe("HANDSHAKING_SUCCESS",(function(e){return e})),gt=Qe("HANDSHAKING_FAILURE",(function(e){return e})),yt=Qe("HANDSHAKING_RECONNECTING_SUCCESS",(function(e){return{cursor:e}})),bt=Qe("HANDSHAKING_RECONNECTING_FAILURE",(function(e){return e})),vt=Qe("HANDSHAKING_RECONNECTING_GIVEUP",(function(){return{}})),mt=Qe("HANDSHAKING_RECONNECTING_RETRY",(function(){return{}})),_t=Qe("RECEIVING_SUCCESS",(function(e,t){return{cursor:e,events:t}})),Ot=Qe("RECEIVING_FAILURE",(function(e){return e})),Pt=Qe("RECONNECTING_SUCCESS",(function(e,t){return{cursor:e,events:t}})),St=Qe("RECONNECTING_FAILURE",(function(e){return e})),wt=Qe("RECONNECTING_GIVEUP",(function(){return{}})),Tt=Qe("RECONNECTING_RETRY",(function(){return{}})),kt=function(e){function n(t,n){var o=e.call(this,n)||this;return o.on(st.type,ot((function(e,n,s){var a=s.handshake;return r(o,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:n.throwIfAborted(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,a({abortSignal:n,channels:e.channels,channelGroups:e.groups})];case 2:return r=i.sent(),t.transition(dt(r)),[3,4];case 3:return(o=i.sent())instanceof Error&&"Aborted"===o.message?[2]:o instanceof F?[2,t.transition(gt(o))]:[3,4];case 4:return[2]}}))}))}))),o.on(at.type,ot((function(e,n,s){var a=s.receiveEvents;return r(o,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:n.throwIfAborted(),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,a({abortSignal:n,channels:e.channels,channelGroups:e.groups,timetoken:e.cursor.timetoken,region:e.cursor.region})];case 2:return r=i.sent(),t.transition(_t(r.metadata,r.messages)),[3,4];case 3:return(o=i.sent())instanceof Error&&"Aborted"===o.message?[2]:o instanceof F?[2,t.transition(Ot(o))]:[3,4];case 4:return[2]}}))}))}))),o.on(ut.type,ot((function(e,t,n){return n.receiveEvents,r(o,void 0,void 0,(function(){return i(this,(function(t){return e.length>0&&console.log(e),[2]}))}))}))),o.on(ct.type,ot((function(e,n,s){var a=s.receiveEvents,u=s.shouldRetry,c=s.getRetryDelay,l=s.delay;return r(o,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return u(e.reason,e.attempts)?(n.throwIfAborted(),[4,l(c(e.attempts))]):[2,t.transition(wt())];case 1:i.sent(),n.throwIfAborted(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,a({abortSignal:n,channels:e.channels,channelGroups:e.groups,timetoken:e.cursor.timetoken,region:e.cursor.region})];case 3:return r=i.sent(),[2,t.transition(Pt(r.metadata,r.messages))];case 4:return(o=i.sent())instanceof Error&&"Aborted"===o.message?[2]:o instanceof F?[2,t.transition(St(o))]:[3,5];case 5:return[2]}}))}))}))),o.on(lt.type,ot((function(e,n,s){var a=s.handshake,u=s.shouldRetry,c=s.getRetryDelay,l=s.delay;return r(o,void 0,void 0,(function(){var r,o;return i(this,(function(i){switch(i.label){case 0:return u(e.reason,e.attempts)?(n.throwIfAborted(),[4,l(c(e.attempts))]):[2,t.transition(vt())];case 1:i.sent(),n.throwIfAborted(),i.label=2;case 2:return i.trys.push([2,4,,5]),[4,a({abortSignal:n,channels:e.channels,channelGroups:e.groups})];case 3:return r=i.sent(),[2,t.transition(yt(r.metadata))];case 4:return(o=i.sent())instanceof Error&&"Aborted"===o.message?[2]:o instanceof F?[2,t.transition(bt(o))]:[3,5];case 5:return[2]}}))}))}))),o}return t(n,e),n}($e),Nt=new We("STOPPED");Nt.on(pt.type,(function(e,t){return Nt.with({channels:t.payload.channels,groups:t.payload.groups})})),Nt.on(ft.type,(function(e){return Ut.with(n({},e))}));var Ct=new We("HANDSHAKE_FAILURE");Ct.on(mt.type,(function(e){return jt.with(n(n({},e),{attempts:0}))})),Ct.on(ht.type,(function(e){return Nt.with({channels:e.channels,groups:e.groups})}));var Et=new We("STOPPED");Et.on(pt.type,(function(e,t){return Et.with({channels:t.payload.channels,groups:t.payload.groups,cursor:e.cursor})})),Et.on(ft.type,(function(e){return Rt.with(n({},e))}));var At=new We("RECEIVE_FAILURE");At.on(Tt.type,(function(e){return Mt.with(n(n({},e),{attempts:0}))})),At.on(ht.type,(function(e){return Et.with({channels:e.channels,groups:e.groups,cursor:e.cursor})}));var Mt=new We("RECEIVE_RECONNECTING");Mt.onEnter((function(e){return ct(e)})),Mt.onExit((function(){return ct.cancel})),Mt.on(Pt.type,(function(e,t){return Rt.with({channels:e.channels,groups:e.groups,cursor:t.payload.cursor},[ut(t.payload.events)])})),Mt.on(St.type,(function(e,t){return Mt.with(n(n({},e),{attempts:e.attempts+1,reason:t.payload}))})),Mt.on(wt.type,(function(e){return At.with({groups:e.groups,channels:e.channels,cursor:e.cursor,reason:e.reason})})),Mt.on(ht.type,(function(e){return Et.with({channels:e.channels,groups:e.groups,cursor:e.cursor})}));var Rt=new We("RECEIVING");Rt.onEnter((function(e){return at(e.channels,e.groups,e.cursor)})),Rt.onExit((function(){return at.cancel})),Rt.on(_t.type,(function(e,t){return Rt.with(n(n({},e),{cursor:t.payload.cursor}),[ut(t.payload.events)])})),Rt.on(pt.type,(function(e,t){return 0===t.payload.channels.length&&0===t.payload.groups.length?xt.with(void 0):Rt.with(n(n({},e),{channels:t.payload.channels,groups:t.payload.groups}))})),Rt.on(Ot.type,(function(e,t){return Mt.with(n(n({},e),{attempts:0,reason:t.payload}))})),Rt.on(ht.type,(function(e){return Et.with({channels:e.channels,groups:e.groups,cursor:e.cursor})}));var jt=new We("HANDSHAKE_RECONNECTING");jt.onEnter((function(e){return lt(e)})),jt.onExit((function(){return ct.cancel})),jt.on(Pt.type,(function(e,t){return Rt.with({channels:e.channels,groups:e.groups,cursor:t.payload.cursor},[ut(t.payload.events)])})),jt.on(St.type,(function(e,t){return jt.with(n(n({},e),{attempts:e.attempts+1,reason:t.payload}))})),jt.on(wt.type,(function(e){return Ct.with({groups:e.groups,channels:e.channels,reason:e.reason})})),jt.on(ht.type,(function(e){return Nt.with({channels:e.channels,groups:e.groups})}));var Ut=new We("HANDSHAKING");Ut.onEnter((function(e){return st(e.channels,e.groups)})),Ut.onExit((function(){return st.cancel})),Ut.on(pt.type,(function(e,t){return 0===t.payload.channels.length&&0===t.payload.groups.length?xt.with(void 0):Ut.with({channels:t.payload.channels,groups:t.payload.groups})})),Ut.on(dt.type,(function(e,t){return Rt.with({channels:e.channels,groups:e.groups,cursor:t.payload})})),Ut.on(gt.type,(function(e,t){return jt.with(n(n({},e),{attempts:0,reason:t.payload}))})),Ut.on(ht.type,(function(e){return Nt.with({channels:e.channels,groups:e.groups})}));var xt=new We("UNSUBSCRIBED");xt.on(pt.type,(function(e,t){return Ut.with({channels:t.payload.channels,groups:t.payload.groups})}));var Dt=function(){function e(e){var t=this;this.engine=new Xe,this.channels=[],this.groups=[],this.dispatcher=new kt(this.engine,e),this.engine.subscribe((function(e){"invocationDispatched"===e.type&&t.dispatcher.dispatch(e.invocation)})),this.engine.start(xt,void 0)}return Object.defineProperty(e.prototype,"_engine",{get:function(){return this.engine},enumerable:!1,configurable:!0}),e.prototype.subscribe=function(e){var t=e.channels,n=e.groups;this.channels=a(a([],s(this.channels),!1),s(null!=t?t:[]),!1),this.groups=a(a([],s(this.groups),!1),s(null!=n?n:[]),!1),this.engine.transition(pt(this.channels,this.groups))},e.prototype.unsubscribe=function(e){var t=e.channels,n=e.groups;this.channels=this.channels.filter((function(e){var n;return null===(n=!(null==t?void 0:t.includes(e)))||void 0===n||n})),this.groups=this.groups.filter((function(e){var t;return null===(t=!(null==n?void 0:n.includes(e)))||void 0===t||t})),this.engine.transition(pt(this.channels.slice(0),this.groups.slice(0)))},e.prototype.unsubscribeAll=function(){this.channels=[],this.groups=[],this.engine.transition(pt(this.channels.slice(0),this.groups.slice(0)))},e.prototype.reconnect=function(){this.engine.transition(ft())},e.prototype.disconnect=function(){this.engine.transition(ht())},e}(),It=function(){function e(e){var t=this,r=e.networking,i=e.cbor,o=new m({setup:e});this._config=o;var u=new S({config:o}),c=e.cryptography;r.init(o);var l=new K(o,i);this._tokenManager=l;var p=new R({maximumSamplesCount:6e4});this._telemetryManager=p;var h={config:o,networking:r,crypto:u,cryptography:c,tokenManager:l,telemetryManager:p,PubNubFile:e.PubNubFile};this.File=e.PubNubFile,this.encryptFile=function(e,n){return c.encryptFile(e,n,t.File)},this.decryptFile=function(e,n){return c.decryptFile(e,n,t.File)};var f=V.bind(this,h,He),d=V.bind(this,h,ne),g=V.bind(this,h,ie),y=V.bind(this,h,se),b=V.bind(this,h,qe),v=new G;if(this._listenerManager=v,this.iAmHere=V.bind(this,h,ie),this.iAmAway=V.bind(this,h,ne),this.setPresenceState=V.bind(this,h,se),this.handshake=V.bind(this,h,ze),this.receiveMessages=V.bind(this,h,Ve),!0===o.enableSubscribeBeta){var _=new Dt({handshake:this.handshake,receiveEvents:this.receiveMessages});this.subscribe=_.subscribe.bind(_),this.unsubscribe=_.unsubscribe.bind(_),this.eventEngine=_}else{var O=new A({timeEndpoint:f,leaveEndpoint:d,heartbeatEndpoint:g,setStateEndpoint:y,subscribeEndpoint:b,crypto:h.crypto,config:h.config,listenerManager:v,getFileUrl:function(e){return ge(h,e)}});this.subscribe=O.adaptSubscribeChange.bind(O),this.unsubscribe=O.adaptUnsubscribeChange.bind(O),this.disconnect=O.disconnect.bind(O),this.reconnect=O.reconnect.bind(O),this.unsubscribeAll=O.unsubscribeAll.bind(O),this.getSubscribedChannels=O.getSubscribedChannels.bind(O),this.getSubscribedChannelGroups=O.getSubscribedChannelGroups.bind(O),this.setState=O.adaptStateChange.bind(O),this.presence=O.adaptPresenceChange.bind(O),this.destroy=function(e){O.unsubscribeAll(e),O.disconnect()}}this.addListener=v.addListener.bind(v),this.removeListener=v.removeListener.bind(v),this.removeAllListeners=v.removeAllListeners.bind(v),this.parseToken=l.parseToken.bind(l),this.setToken=l.setToken.bind(l),this.getToken=l.getToken.bind(l),this.channelGroups={listGroups:V.bind(this,h,$),listChannels:V.bind(this,h,Q),addChannels:V.bind(this,h,J),removeChannels:V.bind(this,h,W),deleteGroup:V.bind(this,h,X)},this.push={addChannels:V.bind(this,h,Y),removeChannels:V.bind(this,h,Z),deleteDevice:V.bind(this,h,te),listChannels:V.bind(this,h,ee)},this.hereNow=V.bind(this,h,ae),this.whereNow=V.bind(this,h,re),this.getState=V.bind(this,h,oe),this.grant=V.bind(this,h,Me),this.grantToken=V.bind(this,h,je),this.audit=V.bind(this,h,Ae),this.revokeToken=V.bind(this,h,Ue),this.publish=V.bind(this,h,De),this.fire=function(e,n){return e.replicate=!1,e.storeInHistory=!1,t.publish(e,n)},this.signal=V.bind(this,h,Ie),this.history=V.bind(this,h,Ke),this.deleteMessages=V.bind(this,h,Fe),this.messageCounts=V.bind(this,h,Le),this.fetchMessages=V.bind(this,h,Be),this.addMessageAction=V.bind(this,h,ue),this.removeMessageAction=V.bind(this,h,ce),this.getMessageActions=V.bind(this,h,le),this.listFiles=V.bind(this,h,pe);var P=V.bind(this,h,he);this.publishFile=V.bind(this,h,fe),this.sendFile=de({generateUploadUrl:P,publishFile:this.publishFile,modules:h}),this.getFileUrl=function(e){return ge(h,e)},this.downloadFile=V.bind(this,h,ye),this.deleteFile=V.bind(this,h,be),this.objects={getAllUUIDMetadata:V.bind(this,h,ve),getUUIDMetadata:V.bind(this,h,me),setUUIDMetadata:V.bind(this,h,_e),removeUUIDMetadata:V.bind(this,h,Oe),getAllChannelMetadata:V.bind(this,h,Pe),getChannelMetadata:V.bind(this,h,Se),setChannelMetadata:V.bind(this,h,we),removeChannelMetadata:V.bind(this,h,Te),getChannelMembers:V.bind(this,h,ke),setChannelMembers:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return V.call.apply(V,a([t,h,Ne,n({type:"set"},e)],s(r),!1))},removeChannelMembers:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return V.call.apply(V,a([t,h,Ne,n({type:"delete"},e)],s(r),!1))},getMemberships:V.bind(this,h,Ce),setMemberships:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return V.call.apply(V,a([t,h,Ee,n({type:"set"},e)],s(r),!1))},removeMemberships:function(e){for(var r=[],i=1;i<arguments.length;i++)r[i-1]=arguments[i];return V.call.apply(V,a([t,h,Ee,n({type:"delete"},e)],s(r),!1))}},this.createUser=function(e){return t.objects.setUUIDMetadata({uuid:e.userId,data:e.data,include:e.include})},this.updateUser=this.createUser,this.removeUser=function(e){return t.objects.removeUUIDMetadata({uuid:null==e?void 0:e.userId})},this.fetchUser=function(e){return t.objects.getUUIDMetadata({uuid:null==e?void 0:e.userId,include:null==e?void 0:e.include})},this.fetchUsers=this.objects.getAllUUIDMetadata,this.createSpace=function(e){return t.objects.setChannelMetadata({channel:e.spaceId,data:e.data,include:e.include})},this.updateSpace=this.createSpace,this.removeSpace=function(e){return t.objects.removeChannelMetadata({channel:e.spaceId})},this.fetchSpace=function(e){return t.objects.getChannelMetadata({channel:e.spaceId,include:e.include})},this.fetchSpaces=this.objects.getAllChannelMetadata,this.time=f,this.stop=this.destroy,this.encrypt=u.encrypt.bind(u),this.decrypt=u.decrypt.bind(u),this.getAuthKey=h.config.getAuthKey.bind(h.config),this.setAuthKey=h.config.setAuthKey.bind(h.config),this.setCipherKey=h.config.setCipherKey.bind(h.config),this.getUUID=h.config.getUUID.bind(h.config),this.setUUID=h.config.setUUID.bind(h.config),this.getFilterExpression=h.config.getFilterExpression.bind(h.config),this.setFilterExpression=h.config.setFilterExpression.bind(h.config),this.setHeartbeatInterval=h.config.setHeartbeatInterval.bind(h.config),r.hasModule("proxy")&&(this.setProxy=function(e){h.config.setProxy(e),t.reconnect()})}return e.prototype.getVersion=function(){return this._config.getVersion()},e.prototype._addPnsdkSuffix=function(e,t){this._config._addPnsdkSuffix(e,t)},e.prototype.networkDownDetected=function(){this._listenerManager.announceNetworkDown(),this._config.restore?this.disconnect():this.destroy(!0)},e.prototype.networkUpDetected=function(){this._listenerManager.announceNetworkUp(),this.reconnect()},e.notificationPayload=function(e,t){return new I(e,t)},e.generateUUID=function(){return v()},e.OPERATIONS=M,e.CATEGORIES=E,e}(),Gt=function(){function e(e){var t=this;this._modules={},Object.keys(e).forEach((function(n){t._modules[n]=e[n].bind(t)}))}return e.prototype.init=function(e){this._config=e,Array.isArray(this._config.origin)?this._currentSubDomain=Math.floor(Math.random()*this._config.origin.length):this._currentSubDomain=0,this._coreParams={},this.shiftStandardOrigin()},e.prototype.nextOrigin=function(){var e=this._config.secure?"https://":"http://";if("string"==typeof this._config.origin)return"".concat(e).concat(this._config.origin);this._currentSubDomain+=1,this._currentSubDomain>=this._config.origin.length&&(this._currentSubDomain=0);var t=this._config.origin[this._currentSubDomain];return"".concat(e).concat(t)},e.prototype.hasModule=function(e){return e in this._modules},e.prototype.shiftStandardOrigin=function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin},e.prototype.getStandardOrigin=function(){return this._standardOrigin},e.prototype.POSTFILE=function(e,t,n){return this._modules.postfile(e,t,n)},e.prototype.GETFILE=function(e,t,n){return this._modules.getfile(e,t,n)},e.prototype.POST=function(e,t,n,r){return this._modules.post(e,t,n,r)},e.prototype.PATCH=function(e,t,n,r){return this._modules.patch(e,t,n,r)},e.prototype.GET=function(e,t,n){return this._modules.get(e,t,n)},e.prototype.DELETE=function(e,t,n){return this._modules.del(e,t,n)},e.prototype._detectErrorCategory=function(e){if("ENOTFOUND"===e.code)return E.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return E.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return E.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return E.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return E.PNNetworkIssuesCategory;if(e.timeout)return E.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return E.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return E.PNBadRequestCategory;if(e.response.forbidden)return E.PNAccessDeniedCategory}return E.PNUnknownCategory},e}(),Kt=function(){function e(e,t){this._base64ToBinary=t,this._decode=e}return e.prototype.decodeToken=function(e){var t="";e.length%4==3?t="=":e.length%4==2&&(t="==");var n=e.replace(/-/gi,"+").replace(/_/gi,"/")+t,r=this._decode(this._base64ToBinary(n));if("object"==typeof r)return r},e}(),Ft={exports:{}},Lt={exports:{}};!function(e){function t(e){if(e)return function(e){for(var n in t.prototype)e[n]=t.prototype[n];return e}(e)}e.exports=t,t.prototype.on=t.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},t.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},t.prototype.off=t.prototype.removeListener=t.prototype.removeAllListeners=t.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n,r=this._callbacks["$"+e];if(!r)return this;if(1==arguments.length)return delete this._callbacks["$"+e],this;for(var i=0;i<r.length;i++)if((n=r[i])===t||n.fn===t){r.splice(i,1);break}return 0===r.length&&delete this._callbacks["$"+e],this},t.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),n=this._callbacks["$"+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){r=0;for(var i=(n=n.slice(0)).length;r<i;++r)n[r].apply(this,t)}return this},t.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]},t.prototype.hasListeners=function(e){return!!this.listeners(e).length}}(Lt);var Bt=Wt;Wt.default=Wt,Wt.stable=Yt,Wt.stableStringify=Yt;var Ht="[...]",qt="[Circular]",zt=[],Vt=[];function Jt(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function Wt(e,t,n,r){var i;void 0===r&&(r=Jt()),$t(e,"",0,[],void 0,0,r);try{i=0===Vt.length?JSON.stringify(e,t,n):JSON.stringify(e,en(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==zt.length;){var o=zt.pop();4===o.length?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function Xt(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);void 0!==i.get?i.configurable?(Object.defineProperty(r,n,{value:e}),zt.push([r,n,t,i])):Vt.push([t,n,e]):(r[n]=e,zt.push([r,n,t]))}function $t(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void Xt(qt,e,t,i);if(void 0!==s.depthLimit&&o>s.depthLimit)return void Xt(Ht,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void Xt(Ht,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)$t(e[a],a,a,r,e,o,s);else{var u=Object.keys(e);for(a=0;a<u.length;a++){var c=u[a];$t(e[c],c,a,r,e,o,s)}}r.pop()}}function Qt(e,t){return e<t?-1:e>t?1:0}function Yt(e,t,n,r){void 0===r&&(r=Jt());var i,o=Zt(e,"",0,[],void 0,0,r)||e;try{i=0===Vt.length?JSON.stringify(o,t,n):JSON.stringify(o,en(t),n)}catch(e){return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;0!==zt.length;){var s=zt.pop();4===s.length?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return i}function Zt(e,t,n,r,i,o,s){var a;if(o+=1,"object"==typeof e&&null!==e){for(a=0;a<r.length;a++)if(r[a]===e)return void Xt(qt,e,t,i);try{if("function"==typeof e.toJSON)return}catch(e){return}if(void 0!==s.depthLimit&&o>s.depthLimit)return void Xt(Ht,e,t,i);if(void 0!==s.edgesLimit&&n+1>s.edgesLimit)return void Xt(Ht,e,t,i);if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)Zt(e[a],a,a,r,e,o,s);else{var u={},c=Object.keys(e).sort(Qt);for(a=0;a<c.length;a++){var l=c[a];Zt(e[l],l,a,r,e,o,s),u[l]=e[l]}if(void 0===i)return u;zt.push([i,t,e]),i[t]=u}r.pop()}}function en(e){return e=void 0!==e?e:function(e,t){return t},function(t,n){if(Vt.length>0)for(var r=0;r<Vt.length;r++){var i=Vt[r];if(i[1]===t&&i[0]===n){n=i[2],Vt.splice(r,1);break}}return e.call(this,t,n)}}var tn=String.prototype.replace,nn=/%20/g,rn="RFC3986",on={default:rn,formatters:{RFC1738:function(e){return tn.call(e,nn,"+")},RFC3986:function(e){return String(e)}},RFC1738:"RFC1738",RFC3986:rn},sn=on,an=Object.prototype.hasOwnProperty,un=Array.isArray,cn=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),ln=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r<e.length;++r)void 0!==e[r]&&(n[r]=e[r]);return n},pn={arrayToObject:ln,assign:function(e,t){return Object.keys(t).reduce((function(e,n){return e[n]=t[n],e}),e)},combine:function(e,t){return[].concat(e,t)},compact:function(e){for(var t=[{obj:{o:e},prop:"o"}],n=[],r=0;r<t.length;++r)for(var i=t[r],o=i.obj[i.prop],s=Object.keys(o),a=0;a<s.length;++a){var u=s[a],c=o[u];"object"==typeof c&&null!==c&&-1===n.indexOf(c)&&(t.push({obj:o,prop:u}),n.push(c))}return function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(un(n)){for(var r=[],i=0;i<n.length;++i)void 0!==n[i]&&r.push(n[i]);t.obj[t.prop]=r}}}(t),e},decode:function(e,t,n){var r=e.replace(/\+/g," ");if("iso-8859-1"===n)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch(e){return r}},encode:function(e,t,n,r,i){if(0===e.length)return e;var o=e;if("symbol"==typeof e?o=Symbol.prototype.toString.call(e):"string"!=typeof e&&(o=String(e)),"iso-8859-1"===n)return escape(o).replace(/%u[0-9a-f]{4}/gi,(function(e){return"%26%23"+parseInt(e.slice(2),16)+"%3B"}));for(var s="",a=0;a<o.length;++a){var u=o.charCodeAt(a);45===u||46===u||95===u||126===u||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||i===sn.RFC1738&&(40===u||41===u)?s+=o.charAt(a):u<128?s+=cn[u]:u<2048?s+=cn[192|u>>6]+cn[128|63&u]:u<55296||u>=57344?s+=cn[224|u>>12]+cn[128|u>>6&63]+cn[128|63&u]:(a+=1,u=65536+((1023&u)<<10|1023&o.charCodeAt(a)),s+=cn[240|u>>18]+cn[128|u>>12&63]+cn[128|u>>6&63]+cn[128|63&u])}return s},isBuffer:function(e){return!(!e||"object"!=typeof e)&&!!(e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer(e))},isRegExp:function(e){return"[object RegExp]"===Object.prototype.toString.call(e)},maybeMap:function(e,t){if(un(e)){for(var n=[],r=0;r<e.length;r+=1)n.push(t(e[r]));return n}return t(e)},merge:function e(t,n,r){if(!n)return t;if("object"!=typeof n){if(un(t))t.push(n);else{if(!t||"object"!=typeof t)return[t,n];(r&&(r.plainObjects||r.allowPrototypes)||!an.call(Object.prototype,n))&&(t[n]=!0)}return t}if(!t||"object"!=typeof t)return[t].concat(n);var i=t;return un(t)&&!un(n)&&(i=ln(t,r)),un(t)&&un(n)?(n.forEach((function(n,i){if(an.call(t,i)){var o=t[i];o&&"object"==typeof o&&n&&"object"==typeof n?t[i]=e(o,n,r):t.push(n)}else t[i]=n})),t):Object.keys(n).reduce((function(t,i){var o=n[i];return an.call(t,i)?t[i]=e(t[i],o,r):t[i]=o,t}),i)}},hn=pn,fn=on,dn=Object.prototype.hasOwnProperty,gn={brackets:function(e){return e+"[]"},comma:"comma",indices:function(e,t){return e+"["+t+"]"},repeat:function(e){return e}},yn=Array.isArray,bn=String.prototype.split,vn=Array.prototype.push,mn=function(e,t){vn.apply(e,yn(t)?t:[t])},_n=Date.prototype.toISOString,On=fn.default,Pn={addQueryPrefix:!1,allowDots:!1,charset:"utf-8",charsetSentinel:!1,delimiter:"&",encode:!0,encoder:hn.encode,encodeValuesOnly:!1,format:On,formatter:fn.formatters[On],indices:!1,serializeDate:function(e){return _n.call(e)},skipNulls:!1,strictNullHandling:!1},Sn=function e(t,n,r,i,o,s,a,u,c,l,p,h,f,d){var g,y=t;if("function"==typeof a?y=a(n,y):y instanceof Date?y=l(y):"comma"===r&&yn(y)&&(y=hn.maybeMap(y,(function(e){return e instanceof Date?l(e):e}))),null===y){if(i)return s&&!f?s(n,Pn.encoder,d,"key",p):n;y=""}if("string"==typeof(g=y)||"number"==typeof g||"boolean"==typeof g||"symbol"==typeof g||"bigint"==typeof g||hn.isBuffer(y)){if(s){var b=f?n:s(n,Pn.encoder,d,"key",p);if("comma"===r&&f){for(var v=bn.call(String(y),","),m="",_=0;_<v.length;++_)m+=(0===_?"":",")+h(s(v[_],Pn.encoder,d,"value",p));return[h(b)+"="+m]}return[h(b)+"="+h(s(y,Pn.encoder,d,"value",p))]}return[h(n)+"="+h(String(y))]}var O,P=[];if(void 0===y)return P;if("comma"===r&&yn(y))O=[{value:y.length>0?y.join(",")||null:void 0}];else if(yn(a))O=a;else{var S=Object.keys(y);O=u?S.sort(u):S}for(var w=0;w<O.length;++w){var T=O[w],k="object"==typeof T&&void 0!==T.value?T.value:y[T];if(!o||null!==k){var N=yn(y)?"function"==typeof r?r(n,T):n:n+(c?"."+T:"["+T+"]");mn(P,e(k,N,r,i,o,s,a,u,c,l,p,h,f,d))}}return P},wn=pn,Tn=Object.prototype.hasOwnProperty,kn=Array.isArray,Nn={allowDots:!1,allowPrototypes:!1,arrayLimit:20,charset:"utf-8",charsetSentinel:!1,comma:!1,decoder:wn.decode,delimiter:"&",depth:5,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictNullHandling:!1},Cn=function(e){return e.replace(/&#(\d+);/g,(function(e,t){return String.fromCharCode(parseInt(t,10))}))},En=function(e,t){return e&&"string"==typeof e&&t.comma&&e.indexOf(",")>-1?e.split(","):e},An=function(e,t,n,r){if(e){var i=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,o=/(\[[^[\]]*])/g,s=n.depth>0&&/(\[[^[\]]*])/.exec(i),a=s?i.slice(0,s.index):i,u=[];if(a){if(!n.plainObjects&&Tn.call(Object.prototype,a)&&!n.allowPrototypes)return;u.push(a)}for(var c=0;n.depth>0&&null!==(s=o.exec(i))&&c<n.depth;){if(c+=1,!n.plainObjects&&Tn.call(Object.prototype,s[1].slice(1,-1))&&!n.allowPrototypes)return;u.push(s[1])}return s&&u.push("["+i.slice(s.index)+"]"),function(e,t,n,r){for(var i=r?t:En(t,n),o=e.length-1;o>=0;--o){var s,a=e[o];if("[]"===a&&n.parseArrays)s=[].concat(i);else{s=n.plainObjects?Object.create(null):{};var u="["===a.charAt(0)&&"]"===a.charAt(a.length-1)?a.slice(1,-1):a,c=parseInt(u,10);n.parseArrays||""!==u?!isNaN(c)&&a!==u&&String(c)===u&&c>=0&&n.parseArrays&&c<=n.arrayLimit?(s=[])[c]=i:"__proto__"!==u&&(s[u]=i):s={0:i}}i=s}return i}(u,t,n,r)}},Mn={formats:on,parse:function(e,t){var n=function(e){if(!e)return Nn;if(null!==e.decoder&&void 0!==e.decoder&&"function"!=typeof e.decoder)throw new TypeError("Decoder has to be a function.");if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var t=void 0===e.charset?Nn.charset:e.charset;return{allowDots:void 0===e.allowDots?Nn.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:Nn.allowPrototypes,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:Nn.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:Nn.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:Nn.comma,decoder:"function"==typeof e.decoder?e.decoder:Nn.decoder,delimiter:"string"==typeof e.delimiter||wn.isRegExp(e.delimiter)?e.delimiter:Nn.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:Nn.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:Nn.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:Nn.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:Nn.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:Nn.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var r="string"==typeof e?function(e,t){var n,r={},i=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,o=t.parameterLimit===1/0?void 0:t.parameterLimit,s=i.split(t.delimiter,o),a=-1,u=t.charset;if(t.charsetSentinel)for(n=0;n<s.length;++n)0===s[n].indexOf("utf8=")&&("utf8=%E2%9C%93"===s[n]?u="utf-8":"utf8=%26%2310003%3B"===s[n]&&(u="iso-8859-1"),a=n,n=s.length);for(n=0;n<s.length;++n)if(n!==a){var c,l,p=s[n],h=p.indexOf("]="),f=-1===h?p.indexOf("="):h+1;-1===f?(c=t.decoder(p,Nn.decoder,u,"key"),l=t.strictNullHandling?null:""):(c=t.decoder(p.slice(0,f),Nn.decoder,u,"key"),l=wn.maybeMap(En(p.slice(f+1),t),(function(e){return t.decoder(e,Nn.decoder,u,"value")}))),l&&t.interpretNumericEntities&&"iso-8859-1"===u&&(l=Cn(l)),p.indexOf("[]=")>-1&&(l=kn(l)?[l]:l),Tn.call(r,c)?r[c]=wn.combine(r[c],l):r[c]=l}return r}(e,n):e,i=n.plainObjects?Object.create(null):{},o=Object.keys(r),s=0;s<o.length;++s){var a=o[s],u=An(a,r[a],n,"string"==typeof e);i=wn.merge(i,u,n)}return wn.compact(i)},stringify:function(e,t){var n,r=e,i=function(e){if(!e)return Pn;if(null!==e.encoder&&void 0!==e.encoder&&"function"!=typeof e.encoder)throw new TypeError("Encoder has to be a function.");var t=e.charset||Pn.charset;if(void 0!==e.charset&&"utf-8"!==e.charset&&"iso-8859-1"!==e.charset)throw new TypeError("The charset option must be either utf-8, iso-8859-1, or undefined");var n=fn.default;if(void 0!==e.format){if(!dn.call(fn.formatters,e.format))throw new TypeError("Unknown format option provided.");n=e.format}var r=fn.formatters[n],i=Pn.filter;return("function"==typeof e.filter||yn(e.filter))&&(i=e.filter),{addQueryPrefix:"boolean"==typeof e.addQueryPrefix?e.addQueryPrefix:Pn.addQueryPrefix,allowDots:void 0===e.allowDots?Pn.allowDots:!!e.allowDots,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:Pn.charsetSentinel,delimiter:void 0===e.delimiter?Pn.delimiter:e.delimiter,encode:"boolean"==typeof e.encode?e.encode:Pn.encode,encoder:"function"==typeof e.encoder?e.encoder:Pn.encoder,encodeValuesOnly:"boolean"==typeof e.encodeValuesOnly?e.encodeValuesOnly:Pn.encodeValuesOnly,filter:i,format:n,formatter:r,serializeDate:"function"==typeof e.serializeDate?e.serializeDate:Pn.serializeDate,skipNulls:"boolean"==typeof e.skipNulls?e.skipNulls:Pn.skipNulls,sort:"function"==typeof e.sort?e.sort:null,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:Pn.strictNullHandling}}(t);"function"==typeof i.filter?r=(0,i.filter)("",r):yn(i.filter)&&(n=i.filter);var o,s=[];if("object"!=typeof r||null===r)return"";o=t&&t.arrayFormat in gn?t.arrayFormat:t&&"indices"in t?t.indices?"indices":"repeat":"indices";var a=gn[o];n||(n=Object.keys(r)),i.sort&&n.sort(i.sort);for(var u=0;u<n.length;++u){var c=n[u];i.skipNulls&&null===r[c]||mn(s,Sn(r[c],c,a,i.strictNullHandling,i.skipNulls,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset))}var l=s.join(i.delimiter),p=!0===i.addQueryPrefix?"?":"";return i.charsetSentinel&&("iso-8859-1"===i.charset?p+="utf8=%26%2310003%3B&":p+="utf8=%E2%9C%93&"),l.length>0?p+l:""}};function Rn(e){return Rn="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Rn(e)}var jn=function(e){return null!==e&&"object"===Rn(e)};function Un(e){return Un="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Un(e)}var xn=jn,Dn=In;function In(e){if(e)return function(e){for(var t in In.prototype)Object.prototype.hasOwnProperty.call(In.prototype,t)&&(e[t]=In.prototype[t]);return e}(e)}In.prototype.clearTimeout=function(){return clearTimeout(this._timer),clearTimeout(this._responseTimeoutTimer),clearTimeout(this._uploadTimeoutTimer),delete this._timer,delete this._responseTimeoutTimer,delete this._uploadTimeoutTimer,this},In.prototype.parse=function(e){return this._parser=e,this},In.prototype.responseType=function(e){return this._responseType=e,this},In.prototype.serialize=function(e){return this._serializer=e,this},In.prototype.timeout=function(e){if(!e||"object"!==Un(e))return this._timeout=e,this._responseTimeout=0,this._uploadTimeout=0,this;for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))switch(t){case"deadline":this._timeout=e.deadline;break;case"response":this._responseTimeout=e.response;break;case"upload":this._uploadTimeout=e.upload;break;default:console.warn("Unknown timeout option",t)}return this},In.prototype.retry=function(e,t){return 0!==arguments.length&&!0!==e||(e=1),e<=0&&(e=0),this._maxRetries=e,this._retries=0,this._retryCallback=t,this};var Gn=new Set(["ETIMEDOUT","ECONNRESET","EADDRINUSE","ECONNREFUSED","EPIPE","ENOTFOUND","ENETUNREACH","EAI_AGAIN"]),Kn=new Set([408,413,429,500,502,503,504,521,522,524]);In.prototype._shouldRetry=function(e,t){if(!this._maxRetries||this._retries++>=this._maxRetries)return!1;if(this._retryCallback)try{var n=this._retryCallback(e,t);if(!0===n)return!0;if(!1===n)return!1}catch(e){console.error(e)}if(t&&t.status&&Kn.has(t.status))return!0;if(e){if(e.code&&Gn.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},In.prototype._retry=function(){return this.clearTimeout(),this.req&&(this.req=null,this.req=this.request()),this._aborted=!1,this.timedout=!1,this.timedoutError=null,this._end()},In.prototype.then=function(e,t){var n=this;if(!this._fullfilledPromise){var r=this;this._endCalled&&console.warn("Warning: superagent request was sent twice, because both .end() and .then() were called. Never call .end() if you use promises"),this._fullfilledPromise=new Promise((function(e,t){r.on("abort",(function(){if(!(n._maxRetries&&n._maxRetries>n._retries))if(n.timedout&&n.timedoutError)t(n.timedoutError);else{var e=new Error("Aborted");e.code="ABORTED",e.status=n.status,e.method=n.method,e.url=n.url,t(e)}})),r.end((function(n,r){n?t(n):e(r)}))}))}return this._fullfilledPromise.then(e,t)},In.prototype.catch=function(e){return this.then(void 0,e)},In.prototype.use=function(e){return e(this),this},In.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},In.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},In.prototype.get=function(e){return this._header[e.toLowerCase()]},In.prototype.getHeader=In.prototype.get,In.prototype.set=function(e,t){if(xn(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.set(n,e[n]);return this}return this._header[e.toLowerCase()]=t,this.header[e]=t,this},In.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},In.prototype.field=function(e,t){if(null==e)throw new Error(".field(name, val) name can not be empty");if(this._data)throw new Error(".field() can't be used if .send() is used. Please use only .send() or only .field() & .attach()");if(xn(e)){for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&this.field(n,e[n]);return this}if(Array.isArray(t)){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&this.field(e,t[r]);return this}if(null==t)throw new Error(".field(name, val) val can not be empty");return"boolean"==typeof t&&(t=String(t)),this._getFormData().append(e,t),this},In.prototype.abort=function(){return this._aborted||(this._aborted=!0,this.xhr&&this.xhr.abort(),this.req&&this.req.abort(),this.clearTimeout(),this.emit("abort")),this},In.prototype._auth=function(e,t,n,r){switch(n.type){case"basic":this.set("Authorization","Basic ".concat(r("".concat(e,":").concat(t))));break;case"auto":this.username=e,this.password=t;break;case"bearer":this.set("Authorization","Bearer ".concat(e))}return this},In.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},In.prototype.redirects=function(e){return this._maxRedirects=e,this},In.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},In.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},In.prototype.send=function(e){var t=xn(e),n=this._header["content-type"];if(this._formData)throw new Error(".send() can't be used if .attach() or .field() is used. Please use only .send() or only .field() & .attach()");if(t&&!this._data)Array.isArray(e)?this._data=[]:this._isHost(e)||(this._data={});else if(e&&this._data&&this._isHost(this._data))throw new Error("Can't merge these send calls");if(t&&xn(this._data))for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(this._data[r]=e[r]);else"string"==typeof e?(n||this.type("form"),(n=this._header["content-type"])&&(n=n.toLowerCase().trim()),this._data="application/x-www-form-urlencoded"===n?this._data?"".concat(this._data,"&").concat(e):e:(this._data||"")+e):this._data=e;return!t||this._isHost(e)||n||this.type("json"),this},In.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},In.prototype._finalizeQueryString=function(){var e=this._query.join("&");if(e&&(this.url+=(this.url.includes("?")?"&":"?")+e),this._query.length=0,this._sort){var t=this.url.indexOf("?");if(t>=0){var n=this.url.slice(t+1).split("&");"function"==typeof this._sort?n.sort(this._sort):n.sort(),this.url=this.url.slice(0,t)+"?"+n.join("&")}}},In.prototype._appendQueryString=function(){console.warn("Unsupported")},In.prototype._timeoutError=function(e,t,n){if(!this._aborted){var r=new Error("".concat(e+t,"ms exceeded"));r.timeout=t,r.code="ECONNABORTED",r.errno=n,this.timedout=!0,this.timedoutError=r,this.abort(),this.callback(r)}},In.prototype._setTimeouts=function(){var e=this;this._timeout&&!this._timer&&(this._timer=setTimeout((function(){e._timeoutError("Timeout of ",e._timeout,"ETIME")}),this._timeout)),this._responseTimeout&&!this._responseTimeoutTimer&&(this._responseTimeoutTimer=setTimeout((function(){e._timeoutError("Response timeout of ",e._responseTimeout,"ETIMEDOUT")}),this._responseTimeout))};var Fn={};function Ln(e,t){var n;if("undefined"==typeof Symbol||null==e[Symbol.iterator]){if(Array.isArray(e)||(n=function(e,t){if(!e)return;if("string"==typeof e)return Bn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Bn(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,a=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return s=e.done,e},e:function(e){a=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(a)throw o}}}}function Bn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}Fn.type=function(e){return e.split(/ *; */).shift()},Fn.params=function(e){var t,n={},r=Ln(e.split(/ *; */));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(/ *= */),o=i.shift(),s=i.shift();o&&s&&(n[o]=s)}}catch(e){r.e(e)}finally{r.f()}return n},Fn.parseLinks=function(e){var t,n={},r=Ln(e.split(/ *, */));try{for(r.s();!(t=r.n()).done;){var i=t.value.split(/ *; */),o=i[0].slice(1,-1);n[i[1].split(/ *= */)[1].slice(1,-1)]=o}}catch(e){r.e(e)}finally{r.f()}return n},Fn.cleanHeader=function(e,t){return delete e["content-type"],delete e["content-length"],delete e["transfer-encoding"],delete e.host,t&&(delete e.authorization,delete e.cookie),e};var Hn=Fn,qn=zn;function zn(e){if(e)return function(e){for(var t in zn.prototype)Object.prototype.hasOwnProperty.call(zn.prototype,t)&&(e[t]=zn.prototype[t]);return e}(e)}function Vn(e){return function(e){if(Array.isArray(e))return Jn(e)}(e)||function(e){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e))return Array.from(e)}(e)||function(e,t){if(!e)return;if("string"==typeof e)return Jn(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(e);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Jn(e,t)}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function Jn(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function Wn(){this._defaults=[]}zn.prototype.get=function(e){return this.header[e.toLowerCase()]},zn.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=Hn.type(t);var n=Hn.params(t);for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(this[r]=n[r]);this.links={};try{e.link&&(this.links=Hn.parseLinks(e.link))}catch(e){}},zn.prototype._setStatusProperties=function(e){var t=e/100|0;this.statusCode=e,this.status=this.statusCode,this.statusType=t,this.info=1===t,this.ok=2===t,this.redirect=3===t,this.clientError=4===t,this.serverError=5===t,this.error=(4===t||5===t)&&this.toError(),this.created=201===e,this.accepted=202===e,this.noContent=204===e,this.badRequest=400===e,this.unauthorized=401===e,this.notAcceptable=406===e,this.forbidden=403===e,this.notFound=404===e,this.unprocessableEntity=422===e},["use","on","once","set","query","type","accept","auth","withCredentials","sortQuery","retry","ok","redirects","timeout","buffer","serialize","parse","ca","key","pfx","cert","disableTLSCerts"].forEach((function(e){Wn.prototype[e]=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return this._defaults.push({fn:e,args:n}),this}})),Wn.prototype._setDefaults=function(e){this._defaults.forEach((function(t){e[t.fn].apply(e,Vn(t.args))}))};var Xn=Wn;!function(e,t){function n(e){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n(e)}var r;"undefined"!=typeof window?r=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),r=void 0):r=self;var i=Lt.exports,o=Bt,s=Mn,a=Dn,u=jn,c=qn,l=Xn;function p(){}e.exports=function(e,n){return"function"==typeof n?new t.Request("GET",e).end(n):1===arguments.length?new t.Request("GET",e):new t.Request(e,n)};var h=t=e.exports;t.Request=m,h.getXHR=function(){if(r.XMLHttpRequest&&(!r.location||"file:"!==r.location.protocol||!r.ActiveXObject))return new XMLHttpRequest;try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(e){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(e){}throw new Error("Browser-only version of superagent could not find XHR")};var f="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function d(e){if(!u(e))return e;var t=[];for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&g(t,n,e[n]);return t.join("&")}function g(e,t,n){if(void 0!==n)if(null!==n)if(Array.isArray(n))n.forEach((function(n){g(e,t,n)}));else if(u(n))for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&g(e,"".concat(t,"[").concat(r,"]"),n[r]);else e.push(encodeURI(t)+"="+encodeURIComponent(n));else e.push(encodeURI(t))}function y(e){for(var t,n,r={},i=e.split("&"),o=0,s=i.length;o<s;++o)-1===(n=(t=i[o]).indexOf("="))?r[decodeURIComponent(t)]="":r[decodeURIComponent(t.slice(0,n))]=decodeURIComponent(t.slice(n+1));return r}function b(e){return/[/+]json($|[^-\w])/i.test(e)}function v(e){this.req=e,this.xhr=this.req.xhr,this.text="HEAD"!==this.req.method&&(""===this.xhr.responseType||"text"===this.xhr.responseType)||void 0===this.xhr.responseType?this.xhr.responseText:null,this.statusText=this.req.xhr.statusText;var t=this.xhr.status;1223===t&&(t=204),this._setStatusProperties(t),this.headers=function(e){for(var t,n,r,i,o=e.split(/\r?\n/),s={},a=0,u=o.length;a<u;++a)-1!==(t=(n=o[a]).indexOf(":"))&&(r=n.slice(0,t).toLowerCase(),i=f(n.slice(t+1)),s[r]=i);return s}(this.xhr.getAllResponseHeaders()),this.header=this.headers,this.header["content-type"]=this.xhr.getResponseHeader("content-type"),this._setHeaderProperties(this.header),null===this.text&&e._responseType?this.body=this.xhr.response:this.body="HEAD"===this.req.method?null:this._parseBody(this.text?this.text:this.xhr.response)}function m(e,t){var n=this;this._query=this._query||[],this.method=e,this.url=t,this.header={},this._header={},this.on("end",(function(){var e,t=null,r=null;try{r=new v(n)}catch(e){return(t=new Error("Parser is unable to parse the response")).parse=!0,t.original=e,n.xhr?(t.rawResponse=void 0===n.xhr.responseType?n.xhr.responseText:n.xhr.response,t.status=n.xhr.status?n.xhr.status:null,t.statusCode=t.status):(t.rawResponse=null,t.status=null),n.callback(t)}n.emit("response",r);try{n._isResponseOK(r)||(e=new Error(r.statusText||r.text||"Unsuccessful HTTP response"))}catch(t){e=t}e?(e.original=t,e.response=r,e.status=r.status,n.callback(e,r)):n.callback(null,r)}))}function _(e,t,n){var r=h("DELETE",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}h.serializeObject=d,h.parseString=y,h.types={html:"text/html",json:"application/json",xml:"text/xml",urlencoded:"application/x-www-form-urlencoded",form:"application/x-www-form-urlencoded","form-data":"application/x-www-form-urlencoded"},h.serialize={"application/x-www-form-urlencoded":s.stringify,"application/json":o},h.parse={"application/x-www-form-urlencoded":y,"application/json":JSON.parse},c(v.prototype),v.prototype._parseBody=function(e){var t=h.parse[this.type];return this.req._parser?this.req._parser(this,e):(!t&&b(this.type)&&(t=h.parse["application/json"]),t&&e&&(e.length>0||e instanceof Object)?t(e):null)},v.prototype.toError=function(){var e=this.req,t=e.method,n=e.url,r="cannot ".concat(t," ").concat(n," (").concat(this.status,")"),i=new Error(r);return i.status=this.status,i.method=t,i.url=n,i},h.Response=v,i(m.prototype),a(m.prototype),m.prototype.type=function(e){return this.set("Content-Type",h.types[e]||e),this},m.prototype.accept=function(e){return this.set("Accept",h.types[e]||e),this},m.prototype.auth=function(e,t,r){1===arguments.length&&(t=""),"object"===n(t)&&null!==t&&(r=t,t=""),r||(r={type:"function"==typeof btoa?"basic":"auto"});var i=function(e){if("function"==typeof btoa)return btoa(e);throw new Error("Cannot use basic auth, btoa is not a function")};return this._auth(e,t,r,i)},m.prototype.query=function(e){return"string"!=typeof e&&(e=d(e)),e&&this._query.push(e),this},m.prototype.attach=function(e,t,n){if(t){if(this._data)throw new Error("superagent can't mix .send() and .attach()");this._getFormData().append(e,t,n||t.name)}return this},m.prototype._getFormData=function(){return this._formData||(this._formData=new r.FormData),this._formData},m.prototype.callback=function(e,t){if(this._shouldRetry(e,t))return this._retry();var n=this._callback;this.clearTimeout(),e&&(this._maxRetries&&(e.retries=this._retries-1),this.emit("error",e)),n(e,t)},m.prototype.crossDomainError=function(){var e=new Error("Request has been terminated\nPossible causes: the network is offline, Origin is not allowed by Access-Control-Allow-Origin, the page is being unloaded, etc.");e.crossDomain=!0,e.status=this.status,e.method=this.method,e.url=this.url,this.callback(e)},m.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},m.prototype.ca=m.prototype.agent,m.prototype.buffer=m.prototype.ca,m.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},m.prototype.pipe=m.prototype.write,m.prototype._isHost=function(e){return e&&"object"===n(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},m.prototype.end=function(e){this._endCalled&&console.warn("Warning: .end() was called twice. This is not supported in superagent"),this._endCalled=!0,this._callback=e||p,this._finalizeQueryString(),this._end()},m.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},m.prototype._end=function(){if(this._aborted)return this.callback(new Error("The request has been aborted even before .end() was called"));var e=this;this.xhr=h.getXHR();var t=this.xhr,n=this._formData||this._data;this._setTimeouts(),t.onreadystatechange=function(){var n=t.readyState;if(n>=2&&e._responseTimeoutTimer&&clearTimeout(e._responseTimeoutTimer),4===n){var r;try{r=t.status}catch(e){r=0}if(!r){if(e.timedout||e._aborted)return;return e.crossDomainError()}e.emit("end")}};var r=function(t,n){n.total>0&&(n.percent=n.loaded/n.total*100,100===n.percent&&clearTimeout(e._uploadTimeoutTimer)),n.direction=t,e.emit("progress",n)};if(this.hasListeners("progress"))try{t.addEventListener("progress",r.bind(null,"download")),t.upload&&t.upload.addEventListener("progress",r.bind(null,"upload"))}catch(e){}t.upload&&this._setUploadTimeout();try{this.username&&this.password?t.open(this.method,this.url,!0,this.username,this.password):t.open(this.method,this.url,!0)}catch(e){return this.callback(e)}if(this._withCredentials&&(t.withCredentials=!0),!this._formData&&"GET"!==this.method&&"HEAD"!==this.method&&"string"!=typeof n&&!this._isHost(n)){var i=this._header["content-type"],o=this._serializer||h.serialize[i?i.split(";")[0]:""];!o&&b(i)&&(o=h.serialize["application/json"]),o&&(n=o(n))}for(var s in this.header)null!==this.header[s]&&Object.prototype.hasOwnProperty.call(this.header,s)&&t.setRequestHeader(s,this.header[s]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},h.agent=function(){return new l},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){l.prototype[e.toLowerCase()]=function(t,n){var r=new h.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),l.prototype.del=l.prototype.delete,h.get=function(e,t,n){var r=h("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},h.head=function(e,t,n){var r=h("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},h.options=function(e,t,n){var r=h("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.del=_,h.delete=_,h.patch=function(e,t,n){var r=h("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.post=function(e,t,n){var r=h("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},h.put=function(e,t,n){var r=h("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}}(Ft,Ft.exports);var $n=Ft.exports;function Qn(e){var t=(new Date).getTime(),n=(new Date).toISOString(),r=console&&console.log?console:window&&window.console&&window.console.log?window.console:console;r.log("<<<<<"),r.log("[".concat(n,"]"),"\n",e.url,"\n",e.qs),r.log("-----"),e.on("response",(function(n){var i=(new Date).getTime()-t,o=(new Date).toISOString();r.log(">>>>>>"),r.log("[".concat(o," / ").concat(i,"]"),"\n",e.url,"\n",e.qs,"\n",n.text),r.log("-----")}))}function Yn(e,t,n){var r=this;this._config.logVerbosity&&(e=e.use(Qn)),this._config.proxy&&this._modules.proxy&&(e=this._modules.proxy.call(this,e)),this._config.keepAlive&&this._modules.keepAlive&&(e=this._modules.keepAlive(e));var i=e;if(t.abortSignal)var o=t.abortSignal.subscribe((function(){i.abort(),o()}));return!0===t.forceBuffered?i="undefined"==typeof Blob?i.buffer().responseType("arraybuffer"):i.responseType("arraybuffer"):!1===t.forceBuffered&&(i=i.buffer(!1)),(i=i.timeout(t.timeout)).on("abort",(function(){return n({category:E.PNUnknownCategory,error:!0,operation:t.operation,errorData:new Error("Aborted")},null)})),i.end((function(e,i){var o,s={};if(s.error=null!==e,s.operation=t.operation,i&&i.status&&(s.statusCode=i.status),e){if(e.response&&e.response.text&&!r._config.logVerbosity)try{s.errorData=JSON.parse(e.response.text)}catch(t){s.errorData=e}else s.errorData=e;return s.category=r._detectErrorCategory(e),n(s,null)}if(t.ignoreBody)o={headers:i.headers,redirects:i.redirects,response:i};else try{o=JSON.parse(i.text)}catch(e){return s.errorData=i,s.error=!0,n(s,null)}return o.error&&1===o.error&&o.status&&o.message&&o.service?(s.errorData=o,s.statusCode=o.status,s.error=!0,s.category=r._detectErrorCategory(s),n(s,null)):(o.error&&o.error.message&&(s.errorData=o.error),n(s,o))})),i}function Zn(e,t,n){return r(this,void 0,void 0,(function(){var r;return i(this,(function(i){switch(i.label){case 0:return r=$n.post(e),t.forEach((function(e){var t=e.key,n=e.value;r=r.field(t,n)})),r.attach("file",n,{contentType:"application/octet-stream"}),[4,r];case 1:return[2,i.sent()]}}))}))}function er(e,t,n){var r=$n.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return Yn.call(this,r,t,n)}function tr(e,t,n){var r=$n.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return Yn.call(this,r,t,n)}function nr(e,t,n,r){var i=$n.post(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return Yn.call(this,i,n,r)}function rr(e,t,n,r){var i=$n.patch(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return Yn.call(this,i,n,r)}function ir(e,t,n){var r=$n.delete(this.getStandardOrigin()+t.url).set(t.headers).query(e);return Yn.call(this,r,t,n)}function or(e,t){var n=new Uint8Array(e.byteLength+t.byteLength);return n.set(new Uint8Array(e),0),n.set(new Uint8Array(t),e.byteLength),n.buffer}var sr,ar=function(){function e(){}return Object.defineProperty(e.prototype,"algo",{get:function(){return"aes-256-cbc"},enumerable:!1,configurable:!0}),e.prototype.encrypt=function(e,t){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return[4,this.getKey(e)];case 1:if(n=r.sent(),t instanceof ArrayBuffer)return[2,this.encryptArrayBuffer(n,t)];if("string"==typeof t)return[2,this.encryptString(n,t)];throw new Error("Cannot encrypt this file. In browsers file encryption supports only string or ArrayBuffer")}}))}))},e.prototype.decrypt=function(e,t){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){switch(r.label){case 0:return[4,this.getKey(e)];case 1:if(n=r.sent(),t instanceof ArrayBuffer)return[2,this.decryptArrayBuffer(n,t)];if("string"==typeof t)return[2,this.decryptString(n,t)];throw new Error("Cannot decrypt this file. In browsers file decryption supports only string or ArrayBuffer")}}))}))},e.prototype.encryptFile=function(e,t,n){return r(this,void 0,void 0,(function(){var r,o,s;return i(this,(function(i){switch(i.label){case 0:return[4,this.getKey(e)];case 1:return r=i.sent(),[4,t.toArrayBuffer()];case 2:return o=i.sent(),[4,this.encryptArrayBuffer(r,o)];case 3:return s=i.sent(),[2,n.create({name:t.name,mimeType:"application/octet-stream",data:s})]}}))}))},e.prototype.decryptFile=function(e,t,n){return r(this,void 0,void 0,(function(){var r,o,s;return i(this,(function(i){switch(i.label){case 0:return[4,this.getKey(e)];case 1:return r=i.sent(),[4,t.toArrayBuffer()];case 2:return o=i.sent(),[4,this.decryptArrayBuffer(r,o)];case 3:return s=i.sent(),[2,n.create({name:t.name,data:s})]}}))}))},e.prototype.getKey=function(e){return r(this,void 0,void 0,(function(){var t,n,r;return i(this,(function(i){switch(i.label){case 0:return t=Buffer.from(e),[4,crypto.subtle.digest("SHA-256",t.buffer)];case 1:return n=i.sent(),r=Buffer.from(Buffer.from(n).toString("hex").slice(0,32),"utf8").buffer,[2,crypto.subtle.importKey("raw",r,"AES-CBC",!0,["encrypt","decrypt"])]}}))}))},e.prototype.encryptArrayBuffer=function(e,t){return r(this,void 0,void 0,(function(){var n,r,o;return i(this,(function(i){switch(i.label){case 0:return n=crypto.getRandomValues(new Uint8Array(16)),r=or,o=[n.buffer],[4,crypto.subtle.encrypt({name:"AES-CBC",iv:n},e,t)];case 1:return[2,r.apply(void 0,o.concat([i.sent()]))]}}))}))},e.prototype.decryptArrayBuffer=function(e,t){return r(this,void 0,void 0,(function(){var n;return i(this,(function(r){return n=t.slice(0,16),[2,crypto.subtle.decrypt({name:"AES-CBC",iv:n},e,t.slice(16))]}))}))},e.prototype.encryptString=function(e,t){return r(this,void 0,void 0,(function(){var n,r,o,s;return i(this,(function(i){switch(i.label){case 0:return n=crypto.getRandomValues(new Uint8Array(16)),r=Buffer.from(t).buffer,[4,crypto.subtle.encrypt({name:"AES-CBC",iv:n},e,r)];case 1:return o=i.sent(),s=or(n.buffer,o),[2,Buffer.from(s).toString("utf8")]}}))}))},e.prototype.decryptString=function(e,t){return r(this,void 0,void 0,(function(){var n,r,o,s;return i(this,(function(i){switch(i.label){case 0:return n=Buffer.from(t),r=n.slice(0,16),o=n.slice(16),[4,crypto.subtle.decrypt({name:"AES-CBC",iv:r},e,o)];case 1:return s=i.sent(),[2,Buffer.from(s).toString("utf8")]}}))}))},e.IV_LENGTH=16,e}(),ur=(sr=function(){function e(e){if(e instanceof File)this.data=e,this.name=this.data.name,this.mimeType=this.data.type;else if(e.data){var t=e.data;this.data=new File([t],e.name,{type:e.mimeType}),this.name=e.name,e.mimeType&&(this.mimeType=e.mimeType)}if(void 0===this.data)throw new Error("Couldn't construct a file out of supplied options.");if(void 0===this.name)throw new Error("Couldn't guess filename out of the options. Please provide one.")}return e.create=function(e){return new this(e)},e.prototype.toBuffer=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){throw new Error("This feature is only supported in Node.js environments.")}))}))},e.prototype.toStream=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){throw new Error("This feature is only supported in Node.js environments.")}))}))},e.prototype.toFileUri=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){throw new Error("This feature is only supported in react native environments.")}))}))},e.prototype.toBlob=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.data]}))}))},e.prototype.toArrayBuffer=function(){return r(this,void 0,void 0,(function(){var e=this;return i(this,(function(t){return[2,new Promise((function(t,n){var r=new FileReader;r.addEventListener("load",(function(){if(r.result instanceof ArrayBuffer)return t(r.result)})),r.addEventListener("error",(function(){n(r.error)})),r.readAsArrayBuffer(e.data)}))]}))}))},e.prototype.toString=function(){return r(this,void 0,void 0,(function(){var e=this;return i(this,(function(t){return[2,new Promise((function(t,n){var r=new FileReader;r.addEventListener("load",(function(){if("string"==typeof r.result)return t(r.result)})),r.addEventListener("error",(function(){n(r.error)})),r.readAsBinaryString(e.data)}))]}))}))},e.prototype.toFile=function(){return r(this,void 0,void 0,(function(){return i(this,(function(e){return[2,this.data]}))}))},e}(),sr.supportsFile="undefined"!=typeof File,sr.supportsBlob="undefined"!=typeof Blob,sr.supportsArrayBuffer="undefined"!=typeof ArrayBuffer,sr.supportsBuffer=!1,sr.supportsStream=!1,sr.supportsString=!0,sr.supportsEncryptFile=!0,sr.supportsFileUri=!1,sr);function cr(e){if(!navigator||!navigator.sendBeacon)return!1;navigator.sendBeacon(e)}function lr(e){for(var t=O.enc.Base64.parse(e).words,n=new ArrayBuffer(4*t.length),r=new Uint8Array(n),i=0,o=0,s=0;s<t.length;s+=1){var a=t[s];r[o=4*s]=(4278190080&a)>>24,r[o+1]=(16711680&a)>>16,r[o+2]=(65280&a)>>8,r[o+3]=255&a}for(var u=o+3;u>=o;u-=1)0===r[u]&&i<3&&(i+=1);return i>0?r.buffer.slice(0,r.byteLength-i):r.buffer}function pr(e){var t=function(e){return e&&"object"==typeof e&&e.constructor===Object};if(!t(e))return e;var n={};return Object.keys(e).forEach((function(r){var i=function(e){return"string"==typeof e||e instanceof String}(r),o=r,s=e[r];Array.isArray(r)||i&&r.indexOf(",")>=0?o=(i?r.split(","):r).reduce((function(e,t){return e+=String.fromCharCode(t)}),""):(function(e){return"number"==typeof e&&isFinite(e)}(r)||i&&!isNaN(r))&&(o=String.fromCharCode(i?parseInt(r,10):10));n[o]=t(s)?pr(s):s})),n}var hr=function(e){function n(t){var n=this,r=t.listenToBrowserNetworkEvents,i=void 0===r||r;return t.sdkFamily="Web",t.networking=new Gt({del:ir,get:tr,post:nr,patch:rr,sendBeacon:cr,getfile:er,postfile:Zn}),t.cbor=new Kt((function(e){return pr(l.decode(e))}),lr),t.PubNubFile=ur,t.cryptography=new ar,n=e.call(this,t)||this,i&&(window.addEventListener("offline",(function(){n.networkDownDetected()})),window.addEventListener("online",(function(){n.networkUpDetected()}))),n}return t(n,e),n}(It);return hr}));
23412
24141
 
23413
24142
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
23414
- },{"buffer":45}],89:[function(require,module,exports){
24143
+ },{"buffer":46}],90:[function(require,module,exports){
23415
24144
  (function (global){
23416
24145
  /*! https://mths.be/punycode v1.4.1 by @mathias */
23417
24146
  ;(function(root) {
@@ -23948,7 +24677,7 @@ process.umask = function() { return 0; };
23948
24677
  }(this));
23949
24678
 
23950
24679
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
23951
- },{}],90:[function(require,module,exports){
24680
+ },{}],91:[function(require,module,exports){
23952
24681
  (function (process){
23953
24682
  // vim:ts=4:sts=4:sw=4:
23954
24683
  /*!
@@ -26000,7 +26729,7 @@ return Q;
26000
26729
  });
26001
26730
 
26002
26731
  }).call(this,require('_process'))
26003
- },{"_process":87}],91:[function(require,module,exports){
26732
+ },{"_process":88}],92:[function(require,module,exports){
26004
26733
  // Copyright Joyent, Inc. and other Node contributors.
26005
26734
  //
26006
26735
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -26086,7 +26815,7 @@ var isArray = Array.isArray || function (xs) {
26086
26815
  return Object.prototype.toString.call(xs) === '[object Array]';
26087
26816
  };
26088
26817
 
26089
- },{}],92:[function(require,module,exports){
26818
+ },{}],93:[function(require,module,exports){
26090
26819
  // Copyright Joyent, Inc. and other Node contributors.
26091
26820
  //
26092
26821
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -26173,16 +26902,16 @@ var objectKeys = Object.keys || function (obj) {
26173
26902
  return res;
26174
26903
  };
26175
26904
 
26176
- },{}],93:[function(require,module,exports){
26905
+ },{}],94:[function(require,module,exports){
26177
26906
  'use strict';
26178
26907
 
26179
26908
  exports.decode = exports.parse = require('./decode');
26180
26909
  exports.encode = exports.stringify = require('./encode');
26181
26910
 
26182
- },{"./decode":91,"./encode":92}],94:[function(require,module,exports){
26911
+ },{"./decode":92,"./encode":93}],95:[function(require,module,exports){
26183
26912
  module.exports = require('./lib/_stream_duplex.js');
26184
26913
 
26185
- },{"./lib/_stream_duplex.js":95}],95:[function(require,module,exports){
26914
+ },{"./lib/_stream_duplex.js":96}],96:[function(require,module,exports){
26186
26915
  // Copyright Joyent, Inc. and other Node contributors.
26187
26916
  //
26188
26917
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -26314,7 +27043,7 @@ Duplex.prototype._destroy = function (err, cb) {
26314
27043
 
26315
27044
  pna.nextTick(cb, err);
26316
27045
  };
26317
- },{"./_stream_readable":97,"./_stream_writable":99,"core-util-is":51,"inherits":103,"process-nextick-args":86}],96:[function(require,module,exports){
27046
+ },{"./_stream_readable":98,"./_stream_writable":100,"core-util-is":52,"inherits":104,"process-nextick-args":87}],97:[function(require,module,exports){
26318
27047
  // Copyright Joyent, Inc. and other Node contributors.
26319
27048
  //
26320
27049
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -26362,7 +27091,7 @@ function PassThrough(options) {
26362
27091
  PassThrough.prototype._transform = function (chunk, encoding, cb) {
26363
27092
  cb(null, chunk);
26364
27093
  };
26365
- },{"./_stream_transform":98,"core-util-is":51,"inherits":103}],97:[function(require,module,exports){
27094
+ },{"./_stream_transform":99,"core-util-is":52,"inherits":104}],98:[function(require,module,exports){
26366
27095
  (function (process,global){
26367
27096
  // Copyright Joyent, Inc. and other Node contributors.
26368
27097
  //
@@ -27384,7 +28113,7 @@ function indexOf(xs, x) {
27384
28113
  return -1;
27385
28114
  }
27386
28115
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
27387
- },{"./_stream_duplex":95,"./internal/streams/BufferList":100,"./internal/streams/destroy":101,"./internal/streams/stream":102,"_process":87,"core-util-is":51,"events":69,"inherits":103,"isarray":104,"process-nextick-args":86,"safe-buffer":105,"string_decoder/":106,"util":44}],98:[function(require,module,exports){
28116
+ },{"./_stream_duplex":96,"./internal/streams/BufferList":101,"./internal/streams/destroy":102,"./internal/streams/stream":103,"_process":88,"core-util-is":52,"events":70,"inherits":104,"isarray":105,"process-nextick-args":87,"safe-buffer":106,"string_decoder/":107,"util":45}],99:[function(require,module,exports){
27388
28117
  // Copyright Joyent, Inc. and other Node contributors.
27389
28118
  //
27390
28119
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -27599,7 +28328,7 @@ function done(stream, er, data) {
27599
28328
 
27600
28329
  return stream.push(null);
27601
28330
  }
27602
- },{"./_stream_duplex":95,"core-util-is":51,"inherits":103}],99:[function(require,module,exports){
28331
+ },{"./_stream_duplex":96,"core-util-is":52,"inherits":104}],100:[function(require,module,exports){
27603
28332
  (function (process,global){
27604
28333
  // Copyright Joyent, Inc. and other Node contributors.
27605
28334
  //
@@ -28289,7 +29018,7 @@ Writable.prototype._destroy = function (err, cb) {
28289
29018
  cb(err);
28290
29019
  };
28291
29020
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
28292
- },{"./_stream_duplex":95,"./internal/streams/destroy":101,"./internal/streams/stream":102,"_process":87,"core-util-is":51,"inherits":103,"process-nextick-args":86,"safe-buffer":105,"util-deprecate":141}],100:[function(require,module,exports){
29021
+ },{"./_stream_duplex":96,"./internal/streams/destroy":102,"./internal/streams/stream":103,"_process":88,"core-util-is":52,"inherits":104,"process-nextick-args":87,"safe-buffer":106,"util-deprecate":142}],101:[function(require,module,exports){
28293
29022
  'use strict';
28294
29023
 
28295
29024
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
@@ -28369,7 +29098,7 @@ if (util && util.inspect && util.inspect.custom) {
28369
29098
  return this.constructor.name + ' ' + obj;
28370
29099
  };
28371
29100
  }
28372
- },{"safe-buffer":105,"util":44}],101:[function(require,module,exports){
29101
+ },{"safe-buffer":106,"util":45}],102:[function(require,module,exports){
28373
29102
  'use strict';
28374
29103
 
28375
29104
  /*<replacement>*/
@@ -28444,10 +29173,10 @@ module.exports = {
28444
29173
  destroy: destroy,
28445
29174
  undestroy: undestroy
28446
29175
  };
28447
- },{"process-nextick-args":86}],102:[function(require,module,exports){
29176
+ },{"process-nextick-args":87}],103:[function(require,module,exports){
28448
29177
  module.exports = require('events').EventEmitter;
28449
29178
 
28450
- },{"events":69}],103:[function(require,module,exports){
29179
+ },{"events":70}],104:[function(require,module,exports){
28451
29180
  if (typeof Object.create === 'function') {
28452
29181
  // implementation from standard node.js 'util' module
28453
29182
  module.exports = function inherits(ctor, superCtor) {
@@ -28476,9 +29205,9 @@ if (typeof Object.create === 'function') {
28476
29205
  }
28477
29206
  }
28478
29207
 
28479
- },{}],104:[function(require,module,exports){
28480
- arguments[4][46][0].apply(exports,arguments)
28481
- },{"dup":46}],105:[function(require,module,exports){
29208
+ },{}],105:[function(require,module,exports){
29209
+ arguments[4][47][0].apply(exports,arguments)
29210
+ },{"dup":47}],106:[function(require,module,exports){
28482
29211
  /* eslint-disable node/no-deprecated-api */
28483
29212
  var buffer = require('buffer')
28484
29213
  var Buffer = buffer.Buffer
@@ -28542,7 +29271,7 @@ SafeBuffer.allocUnsafeSlow = function (size) {
28542
29271
  return buffer.SlowBuffer(size)
28543
29272
  }
28544
29273
 
28545
- },{"buffer":45}],106:[function(require,module,exports){
29274
+ },{"buffer":46}],107:[function(require,module,exports){
28546
29275
  // Copyright Joyent, Inc. and other Node contributors.
28547
29276
  //
28548
29277
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -28839,10 +29568,10 @@ function simpleWrite(buf) {
28839
29568
  function simpleEnd(buf) {
28840
29569
  return buf && buf.length ? this.write(buf) : '';
28841
29570
  }
28842
- },{"safe-buffer":105}],107:[function(require,module,exports){
29571
+ },{"safe-buffer":106}],108:[function(require,module,exports){
28843
29572
  module.exports = require('./readable').PassThrough
28844
29573
 
28845
- },{"./readable":108}],108:[function(require,module,exports){
29574
+ },{"./readable":109}],109:[function(require,module,exports){
28846
29575
  exports = module.exports = require('./lib/_stream_readable.js');
28847
29576
  exports.Stream = exports;
28848
29577
  exports.Readable = exports;
@@ -28851,13 +29580,13 @@ exports.Duplex = require('./lib/_stream_duplex.js');
28851
29580
  exports.Transform = require('./lib/_stream_transform.js');
28852
29581
  exports.PassThrough = require('./lib/_stream_passthrough.js');
28853
29582
 
28854
- },{"./lib/_stream_duplex.js":95,"./lib/_stream_passthrough.js":96,"./lib/_stream_readable.js":97,"./lib/_stream_transform.js":98,"./lib/_stream_writable.js":99}],109:[function(require,module,exports){
29583
+ },{"./lib/_stream_duplex.js":96,"./lib/_stream_passthrough.js":97,"./lib/_stream_readable.js":98,"./lib/_stream_transform.js":99,"./lib/_stream_writable.js":100}],110:[function(require,module,exports){
28855
29584
  module.exports = require('./readable').Transform
28856
29585
 
28857
- },{"./readable":108}],110:[function(require,module,exports){
29586
+ },{"./readable":109}],111:[function(require,module,exports){
28858
29587
  module.exports = require('./lib/_stream_writable.js');
28859
29588
 
28860
- },{"./lib/_stream_writable.js":99}],111:[function(require,module,exports){
29589
+ },{"./lib/_stream_writable.js":100}],112:[function(require,module,exports){
28861
29590
 
28862
29591
  /**
28863
29592
  * Reduce `arr` with `fn`.
@@ -28882,7 +29611,7 @@ module.exports = function(arr, fn, initial){
28882
29611
 
28883
29612
  return curr;
28884
29613
  };
28885
- },{}],112:[function(require,module,exports){
29614
+ },{}],113:[function(require,module,exports){
28886
29615
 
28887
29616
  /**
28888
29617
  * Module dependencies.
@@ -28976,7 +29705,7 @@ exports.connect = lookup;
28976
29705
  exports.Manager = require('./manager');
28977
29706
  exports.Socket = require('./socket');
28978
29707
 
28979
- },{"./manager":113,"./socket":115,"./url":116,"debug":117,"socket.io-parser":121}],113:[function(require,module,exports){
29708
+ },{"./manager":114,"./socket":116,"./url":117,"debug":118,"socket.io-parser":122}],114:[function(require,module,exports){
28980
29709
 
28981
29710
  /**
28982
29711
  * Module dependencies.
@@ -29535,7 +30264,7 @@ Manager.prototype.onreconnect = function(){
29535
30264
  this.emitAll('reconnect', attempt);
29536
30265
  };
29537
30266
 
29538
- },{"./on":114,"./socket":115,"backo2":40,"component-bind":48,"component-emitter":49,"debug":117,"engine.io-client":52,"indexof":76,"socket.io-parser":121}],114:[function(require,module,exports){
30267
+ },{"./on":115,"./socket":116,"backo2":41,"component-bind":49,"component-emitter":50,"debug":118,"engine.io-client":53,"indexof":77,"socket.io-parser":122}],115:[function(require,module,exports){
29539
30268
 
29540
30269
  /**
29541
30270
  * Module exports.
@@ -29561,7 +30290,7 @@ function on(obj, ev, fn) {
29561
30290
  };
29562
30291
  }
29563
30292
 
29564
- },{}],115:[function(require,module,exports){
30293
+ },{}],116:[function(require,module,exports){
29565
30294
 
29566
30295
  /**
29567
30296
  * Module dependencies.
@@ -29975,7 +30704,7 @@ Socket.prototype.compress = function(compress){
29975
30704
  return this;
29976
30705
  };
29977
30706
 
29978
- },{"./on":114,"component-bind":48,"component-emitter":49,"debug":117,"has-binary":72,"socket.io-parser":121,"to-array":137}],116:[function(require,module,exports){
30707
+ },{"./on":115,"component-bind":49,"component-emitter":50,"debug":118,"has-binary":73,"socket.io-parser":122,"to-array":138}],117:[function(require,module,exports){
29979
30708
  (function (global){
29980
30709
 
29981
30710
  /**
@@ -30055,13 +30784,13 @@ function url(uri, loc){
30055
30784
  }
30056
30785
 
30057
30786
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
30058
- },{"debug":117,"parseuri":85}],117:[function(require,module,exports){
30059
- arguments[4][63][0].apply(exports,arguments)
30060
- },{"./debug":118,"dup":63}],118:[function(require,module,exports){
30787
+ },{"debug":118,"parseuri":86}],118:[function(require,module,exports){
30061
30788
  arguments[4][64][0].apply(exports,arguments)
30062
- },{"dup":64,"ms":119}],119:[function(require,module,exports){
30789
+ },{"./debug":119,"dup":64}],119:[function(require,module,exports){
30063
30790
  arguments[4][65][0].apply(exports,arguments)
30064
- },{"dup":65}],120:[function(require,module,exports){
30791
+ },{"dup":65,"ms":120}],120:[function(require,module,exports){
30792
+ arguments[4][66][0].apply(exports,arguments)
30793
+ },{"dup":66}],121:[function(require,module,exports){
30065
30794
  (function (global){
30066
30795
  /*global Blob,File*/
30067
30796
 
@@ -30206,7 +30935,7 @@ exports.removeBlobs = function(data, callback) {
30206
30935
  };
30207
30936
 
30208
30937
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
30209
- },{"./is-buffer":122,"isarray":77}],121:[function(require,module,exports){
30938
+ },{"./is-buffer":123,"isarray":78}],122:[function(require,module,exports){
30210
30939
 
30211
30940
  /**
30212
30941
  * Module dependencies.
@@ -30608,7 +31337,7 @@ function error(data){
30608
31337
  };
30609
31338
  }
30610
31339
 
30611
- },{"./binary":120,"./is-buffer":122,"component-emitter":123,"debug":124,"isarray":77,"json3":78}],122:[function(require,module,exports){
31340
+ },{"./binary":121,"./is-buffer":123,"component-emitter":124,"debug":125,"isarray":78,"json3":79}],123:[function(require,module,exports){
30612
31341
  (function (global){
30613
31342
 
30614
31343
  module.exports = isBuf;
@@ -30625,15 +31354,15 @@ function isBuf(obj) {
30625
31354
  }
30626
31355
 
30627
31356
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
30628
- },{}],123:[function(require,module,exports){
30629
- arguments[4][62][0].apply(exports,arguments)
30630
- },{"dup":62}],124:[function(require,module,exports){
31357
+ },{}],124:[function(require,module,exports){
30631
31358
  arguments[4][63][0].apply(exports,arguments)
30632
- },{"./debug":125,"dup":63}],125:[function(require,module,exports){
31359
+ },{"dup":63}],125:[function(require,module,exports){
30633
31360
  arguments[4][64][0].apply(exports,arguments)
30634
- },{"dup":64,"ms":126}],126:[function(require,module,exports){
31361
+ },{"./debug":126,"dup":64}],126:[function(require,module,exports){
30635
31362
  arguments[4][65][0].apply(exports,arguments)
30636
- },{"dup":65}],127:[function(require,module,exports){
31363
+ },{"dup":65,"ms":127}],127:[function(require,module,exports){
31364
+ arguments[4][66][0].apply(exports,arguments)
31365
+ },{"dup":66}],128:[function(require,module,exports){
30637
31366
  // Copyright Joyent, Inc. and other Node contributors.
30638
31367
  //
30639
31368
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -30762,9 +31491,9 @@ Stream.prototype.pipe = function(dest, options) {
30762
31491
  return dest;
30763
31492
  };
30764
31493
 
30765
- },{"events":69,"inherits":128,"readable-stream/duplex.js":94,"readable-stream/passthrough.js":107,"readable-stream/readable.js":108,"readable-stream/transform.js":109,"readable-stream/writable.js":110}],128:[function(require,module,exports){
30766
- arguments[4][103][0].apply(exports,arguments)
30767
- },{"dup":103}],129:[function(require,module,exports){
31494
+ },{"events":70,"inherits":129,"readable-stream/duplex.js":95,"readable-stream/passthrough.js":108,"readable-stream/readable.js":109,"readable-stream/transform.js":110,"readable-stream/writable.js":111}],129:[function(require,module,exports){
31495
+ arguments[4][104][0].apply(exports,arguments)
31496
+ },{"dup":104}],130:[function(require,module,exports){
30768
31497
  var ClientRequest = require('./lib/request')
30769
31498
  var extend = require('xtend')
30770
31499
  var statusCodes = require('builtin-status-codes')
@@ -30839,7 +31568,7 @@ http.METHODS = [
30839
31568
  'UNLOCK',
30840
31569
  'UNSUBSCRIBE'
30841
31570
  ]
30842
- },{"./lib/request":131,"builtin-status-codes":47,"url":139,"xtend":144}],130:[function(require,module,exports){
31571
+ },{"./lib/request":132,"builtin-status-codes":48,"url":140,"xtend":145}],131:[function(require,module,exports){
30843
31572
  (function (global){
30844
31573
  exports.fetch = isFunction(global.fetch) && isFunction(global.ReadableByteStream)
30845
31574
 
@@ -30883,7 +31612,7 @@ function isFunction (value) {
30883
31612
  xhr = null // Help gc
30884
31613
 
30885
31614
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
30886
- },{}],131:[function(require,module,exports){
31615
+ },{}],132:[function(require,module,exports){
30887
31616
  (function (process,global,Buffer){
30888
31617
  // var Base64 = require('Base64')
30889
31618
  var capability = require('./capability')
@@ -31165,7 +31894,7 @@ var unsafeHeaders = [
31165
31894
  ]
31166
31895
 
31167
31896
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
31168
- },{"./capability":130,"./response":132,"_process":87,"buffer":45,"foreach":71,"indexof":76,"inherits":133,"object-keys":80,"stream":127}],132:[function(require,module,exports){
31897
+ },{"./capability":131,"./response":133,"_process":88,"buffer":46,"foreach":72,"indexof":77,"inherits":134,"object-keys":81,"stream":128}],133:[function(require,module,exports){
31169
31898
  (function (process,global,Buffer){
31170
31899
  var capability = require('./capability')
31171
31900
  var foreach = require('foreach')
@@ -31342,9 +32071,9 @@ IncomingMessage.prototype._onXHRProgress = function () {
31342
32071
  }
31343
32072
 
31344
32073
  }).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {},require("buffer").Buffer)
31345
- },{"./capability":130,"_process":87,"buffer":45,"foreach":71,"inherits":133,"stream":127}],133:[function(require,module,exports){
31346
- arguments[4][103][0].apply(exports,arguments)
31347
- },{"dup":103}],134:[function(require,module,exports){
32074
+ },{"./capability":131,"_process":88,"buffer":46,"foreach":72,"inherits":134,"stream":128}],134:[function(require,module,exports){
32075
+ arguments[4][104][0].apply(exports,arguments)
32076
+ },{"dup":104}],135:[function(require,module,exports){
31348
32077
  var nargs = /\{([0-9a-zA-Z_]+)\}/g
31349
32078
 
31350
32079
  module.exports = template
@@ -31382,7 +32111,7 @@ function template(string) {
31382
32111
  })
31383
32112
  }
31384
32113
 
31385
- },{}],135:[function(require,module,exports){
32114
+ },{}],136:[function(require,module,exports){
31386
32115
  /**
31387
32116
  * Module dependencies.
31388
32117
  */
@@ -32575,7 +33304,7 @@ request.put = function(url, data, fn){
32575
33304
 
32576
33305
  module.exports = request;
32577
33306
 
32578
- },{"emitter":49,"reduce":111}],136:[function(require,module,exports){
33307
+ },{"emitter":50,"reduce":112}],137:[function(require,module,exports){
32579
33308
  (function (Buffer){
32580
33309
  "0.50.0";
32581
33310
  /*
@@ -40772,7 +41501,7 @@ TinCan client library
40772
41501
  }());
40773
41502
 
40774
41503
  }).call(this,require("buffer").Buffer)
40775
- },{"buffer":45,"querystring":93,"xhr2":143}],137:[function(require,module,exports){
41504
+ },{"buffer":46,"querystring":94,"xhr2":144}],138:[function(require,module,exports){
40776
41505
  module.exports = toArray
40777
41506
 
40778
41507
  function toArray(list, index) {
@@ -40787,7 +41516,7 @@ function toArray(list, index) {
40787
41516
  return array
40788
41517
  }
40789
41518
 
40790
- },{}],138:[function(require,module,exports){
41519
+ },{}],139:[function(require,module,exports){
40791
41520
  // Underscore.js 1.8.3
40792
41521
  // http://underscorejs.org
40793
41522
  // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
@@ -42337,7 +43066,7 @@ function toArray(list, index) {
42337
43066
  }
42338
43067
  }.call(this));
42339
43068
 
42340
- },{}],139:[function(require,module,exports){
43069
+ },{}],140:[function(require,module,exports){
42341
43070
  // Copyright Joyent, Inc. and other Node contributors.
42342
43071
  //
42343
43072
  // Permission is hereby granted, free of charge, to any person obtaining a
@@ -43046,7 +43775,7 @@ function isNullOrUndefined(arg) {
43046
43775
  return arg == null;
43047
43776
  }
43048
43777
 
43049
- },{"punycode":89,"querystring":93}],140:[function(require,module,exports){
43778
+ },{"punycode":90,"querystring":94}],141:[function(require,module,exports){
43050
43779
  (function (global){
43051
43780
  /*! https://mths.be/utf8js v2.0.0 by @mathias */
43052
43781
  ;(function(root) {
@@ -43294,7 +44023,7 @@ function isNullOrUndefined(arg) {
43294
44023
  }(this));
43295
44024
 
43296
44025
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
43297
- },{}],141:[function(require,module,exports){
44026
+ },{}],142:[function(require,module,exports){
43298
44027
  (function (global){
43299
44028
 
43300
44029
  /**
@@ -43365,7 +44094,7 @@ function config (name) {
43365
44094
  }
43366
44095
 
43367
44096
  }).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
43368
- },{}],142:[function(require,module,exports){
44097
+ },{}],143:[function(require,module,exports){
43369
44098
  /*!
43370
44099
  * validate.js 0.9.0
43371
44100
  *
@@ -44453,7 +45182,7 @@ function config (name) {
44453
45182
  typeof module !== 'undefined' ? /* istanbul ignore next */ module : null,
44454
45183
  typeof define !== 'undefined' ? /* istanbul ignore next */ define : null);
44455
45184
 
44456
- },{}],143:[function(require,module,exports){
45185
+ },{}],144:[function(require,module,exports){
44457
45186
  (function (process,Buffer){
44458
45187
  // Generated by CoffeeScript 1.6.3
44459
45188
  (function() {
@@ -45291,7 +46020,7 @@ function config (name) {
45291
46020
  }).call(this);
45292
46021
 
45293
46022
  }).call(this,require('_process'),require("buffer").Buffer)
45294
- },{"_process":87,"buffer":45,"http":129,"https":74,"os":82,"url":139}],144:[function(require,module,exports){
46023
+ },{"_process":88,"buffer":46,"http":130,"https":75,"os":83,"url":140}],145:[function(require,module,exports){
45295
46024
  module.exports = extend
45296
46025
 
45297
46026
  var hasOwnProperty = Object.prototype.hasOwnProperty;
@@ -45312,7 +46041,7 @@ function extend() {
45312
46041
  return target
45313
46042
  }
45314
46043
 
45315
- },{}],145:[function(require,module,exports){
46044
+ },{}],146:[function(require,module,exports){
45316
46045
  'use strict';
45317
46046
 
45318
46047
  var alphabet = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_'.split('')