diff --git a/.pubnub.yml b/.pubnub.yml index 053adbb55..7bf894ca1 100644 --- a/.pubnub.yml +++ b/.pubnub.yml @@ -1,5 +1,10 @@ --- changelog: + - date: 2022-01-12 + version: v5.0.0 + changes: + - type: improvement + text: "BREAKING CHANGES: `uuid` is required parameter in PubNub constructor." - date: 2021-12-16 version: v4.37.0 changes: @@ -1091,7 +1096,7 @@ supported-platforms: - "Ubuntu 14.04 and up" - "Windows 7 and up" version: "Pubnub Javascript for Node" -version: "4.37.0" +version: "5.0.0" sdks: - full-name: PubNub Javascript SDK @@ -1110,7 +1115,7 @@ sdks: distribution-type: source distribution-repository: GitHub release package-name: pubnub.js - location: https://github.com/pubnub/javascript/archive/refs/tags/v4.37.0.zip + location: https://github.com/pubnub/javascript/archive/refs/tags/v5.0.0.zip requires: - name: "agentkeepalive" @@ -1874,7 +1879,7 @@ sdks: distribution-type: library distribution-repository: GitHub release package-name: pubnub.js - location: https://github.com/pubnub/javascript/releases/download/v4.37.0/pubnub.4.37.0.js + location: https://github.com/pubnub/javascript/releases/download/v5.0.0/pubnub.5.0.0.js requires: - name: "agentkeepalive" diff --git a/CHANGELOG.md b/CHANGELOG.md index ecdb7eab3..29018804a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## v5.0.0 +January 12 2022 + +#### Modified +- BREAKING CHANGES: `uuid` is required parameter in PubNub constructor. + ## v4.37.0 December 16 2021 diff --git a/README.md b/README.md index 6c6870dc1..c9947e96a 100644 --- a/README.md +++ b/README.md @@ -22,8 +22,8 @@ You will need the publish and subscribe keys to authenticate your app. Get your npm install pubnub ``` * or download one of our builds from our CDN: - * https://cdn.pubnub.com/sdk/javascript/pubnub.4.37.0.js - * https://cdn.pubnub.com/sdk/javascript/pubnub.4.37.0.min.js + * https://cdn.pubnub.com/sdk/javascript/pubnub.5.0.0.js + * https://cdn.pubnub.com/sdk/javascript/pubnub.5.0.0.min.js 2. Configure your keys: diff --git a/dist/titanium/pubnub.js b/dist/titanium/pubnub.js index a2c0db6a3..b016daac5 100644 --- a/dist/titanium/pubnub.js +++ b/dist/titanium/pubnub.js @@ -1,4 +1,4 @@ -/*! 4.37.0 / Consumer */ +/*! 5.0.0 / Consumer */ exports["PubNub"] = /******/ (function(modules) { // webpackBootstrap /******/ // The module cache @@ -379,10 +379,8 @@ var _default = function () { function _default(_ref) { var _setup$fileUploadPubl, _setup$useRandomIVs; - var setup = _ref.setup, - db = _ref.db; + var setup = _ref.setup; (0, _classCallCheck2["default"])(this, _default); - (0, _defineProperty2["default"])(this, "_db", void 0); (0, _defineProperty2["default"])(this, "subscribeKey", void 0); (0, _defineProperty2["default"])(this, "publishKey", void 0); (0, _defineProperty2["default"])(this, "secretKey", void 0); @@ -421,7 +419,6 @@ var _default = function () { (0, _defineProperty2["default"])(this, "fileUploadPublishRetryLimit", void 0); (0, _defineProperty2["default"])(this, "useRandomIVs", void 0); this._PNSDKSuffix = {}; - this._db = db; this.instanceId = "pn-".concat(_uuid["default"].createUUID()); this.secretKey = setup.secretKey || setup.secret_key; this.subscribeKey = setup.subscribeKey || setup.subscribe_key; @@ -476,7 +473,7 @@ var _default = function () { this.setHeartbeatInterval(setup.heartbeatInterval); } - this.setUUID(this._decideUUID(setup.uuid)); + this.setUUID(setup.uuid); } (0, _createClass2["default"])(_default, [{ @@ -504,7 +501,10 @@ var _default = function () { }, { key: "setUUID", value: function setUUID(val) { - if (this._db && this._db.set) this._db.set("".concat(this.subscribeKey, "uuid"), val); + if (!val || typeof val !== 'string' || val.trim().length === 0) { + throw new Error('Missing uuid parameter. Provide a valid string uuid'); + } + this.UUID = val; return this; } @@ -589,7 +589,7 @@ var _default = function () { }, { key: "getVersion", value: function getVersion() { - return '4.37.0'; + return '5.0.0'; } }, { key: "_addPnsdkSuffix", @@ -605,19 +605,6 @@ var _default = function () { return result + separator + _this._PNSDKSuffix[key]; }, ''); } - }, { - key: "_decideUUID", - value: function _decideUUID(providedUUID) { - if (providedUUID) { - return providedUUID; - } - - if (this._db && this._db.get && this._db.get("".concat(this.subscribeKey, "uuid"))) { - return this._db.get("".concat(this.subscribeKey, "uuid")); - } - - return "pn-".concat(_uuid["default"].createUUID()); - } }]); return _default; }(); @@ -2579,12 +2566,10 @@ var _default = function () { (0, _defineProperty2["default"])(this, "setProxy", void 0); (0, _defineProperty2["default"])(this, "encrypt", void 0); (0, _defineProperty2["default"])(this, "decrypt", void 0); - var db = setup.db, - networking = setup.networking, + var networking = setup.networking, cbor = setup.cbor; var config = this._config = new _config["default"]({ - setup: setup, - db: db + setup: setup }); var crypto = new _index["default"]({ config: config diff --git a/dist/titanium/pubnub.min.js b/dist/titanium/pubnub.min.js index d968350e0..89d92abd0 100644 --- a/dist/titanium/pubnub.min.js +++ b/dist/titanium/pubnub.min.js @@ -1,2 +1,2 @@ -/*! 4.37.0 / Consumer */ -exports.PubNub=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={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"},e.exports=t.default},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function i(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var a="The Objects v1 API has been deprecated.\nYou can learn more about Objects v2 API at https://www.pubnub.com/docs/web-javascript/api-reference-objects.\nIf you have questions about the Objects v2 API or require additional help with migrating to the new data model, please contact PubNub Support at support@pubnub.com.";e.exports={signPamFromParams:function(e){return i(e).map((function(t){return"".concat(t,"=").concat(r(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:r,deprecated:function(e){return function(){var t,n;"undefined"!=typeof process&&("test"!==(null===(t=process)||void 0===t||null===(n=t.env)||void 0===n?void 0:"production")&&console.warn(a));return e.apply(void 0,arguments)}}}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n=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}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"4.37.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,r){return n+e+t._PNSDKSuffix[r]}),"")}},{key:"_decideUUID",value:function(e){return e||(this._db&&this._db.get&&this._db.get("".concat(this.subscribeKey,"uuid"))?this._db.get("".concat(this.subscribeKey,"uuid")):"pn-".concat(u.default.createUUID()))}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){var r=n(69),i=n(70),a=n(71),o=n(73);e.exports=function(e,t){return r(e)||i(e,t)||a(e,t)||o()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(7).default,i=n(17);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(26)),a={createUUID:function(){return i.default.uuid?i.default.uuid():(0,i.default)()}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.PubNubError=void 0,t.createValidationError=b,t.default=function(e,t){var n=e.networking,r=e.config,i=e.telemetryManager,a=e.tokenManager,o=l.default.createUUID(),u=null,s=null,c={};t.getOperation()===d.default.PNTimeOperation||t.getOperation()===d.default.PNChannelGroupsOperation?u=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],u=arguments.length<=3?void 0:arguments[3]);"undefined"==typeof Promise||u||(s=f.default.createPromise());var h=t.validateParams(e,c);if(h)return u?u(b(h)):s?(s.reject(new y("Validation failed, check status for details",b(h))),s.promise):void 0;var v,k=t.prepareParams(e,c),S=m(t,e,c),M={url:S,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,c):null};k.uuid=r.UUID,k.pnsdk=_(r);var T=i.operationsLatencyForRequest();Object.keys(T).length&&(k=g(g({},k),T));r.useInstanceId&&(k.instanceid=r.instanceId);r.useRequestId&&(k.requestid=o);if(t.isAuthSupported()){var x=a.getToken()||r.getAuthKey();x&&(k.auth=x)}r.secretKey&&O(e,S,k,c,t);var w=function(n,r){var a;if(n.error)return t.handleError&&t.handleError(e,c,n),void(u?u(n):s&&s.reject(new y("PubNub call failed, check status for details",n)));i.stopLatencyMeasure(t.getOperation(),o);var l=t.handleResponse(e,r,c);"function"!=typeof(null===(a=l)||void 0===a?void 0:a.then)&&(l=Promise.resolve(l)),l.then((function(e){u?u(n,e):s&&s.fulfill(e)})).catch((function(e){if(u){var n=e;t.getOperation()===d.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),u(n,null)}else s&&s.reject(new y("PubNub call failed, check status for details",e))}))};if(i.startLatencyMeasure(t.getOperation(),o),"POST"===P(e,t,c)){var N=t.postPayload(e,c);v=n.POST(k,N,M,w)}else if("PATCH"===P(e,t,c)){var j=t.patchPayload(e,c);v=n.PATCH(k,j,M,w)}else v="DELETE"===P(e,t,c)?n.DELETE(k,M,w):"GETFILE"===P(e,t,c)?n.GETFILE(k,M,w):n.GET(k,M,w);if(t.getOperation()===d.default.PNSubscribeOperation)return v;if(s)return s.promise},t.generatePNSDK=_,t.signRequest=O;var i=r(n(4)),a=r(n(5)),o=r(n(12)),u=r(n(14)),s=r(n(11)),c=r(n(36)),l=r(n(15)),f=(n(2),r(n(3))),d=(r(n(8)),r(n(1))),p=r(n(10));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t0&&(t+=n),t}function P(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 O(e,t,n,r,i){var a=e.config,o=e.crypto,u=P(e,i,r);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===i.getOperation()&&i.usePost&&i.usePost(e,r)&&(u="GET"),"GETFILE"===u&&(u="GET");var s="".concat(u,"\n").concat(a.publishKey,"\n").concat(t,"\n").concat(f.default.signPamFromParams(n),"\n");if("POST"===u){var c=i.postPayload(e,r);s+="string"==typeof c?c:JSON.stringify(c)}else if("PATCH"===u){var l=i.patchPayload(e,r);s+="string"==typeof l?l:JSON.stringify(l)}var d="v2.".concat(o.HMACSHA256(s));d=(d=(d=d.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=d}t.PubNubError=y},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),r(n(27)));function s(e){var t,n=[];for(t=0;t>10,n=1023&e,r=32768&e;if(31===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-25)*(1024+n):Math.pow(2,-24)*n;return r?-i:i},readFloat32:function(){var e=this.readUint32(),t=(2147483647&e)>>23,n=8388607&e,r=2147483648&e;if(255===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-23-127)*(8388608+n):Math.pow(2,-149)*n;return r?-i:i},readFloat64:function(){var e=this.readUint32(),t=e>>20&2047,n=4294967296*(1048575&e)+this.readUint32(),r=2147483648&e;if(2047===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-52-1023)*(4503599627370496+n):Math.pow(2,-1074)*n;return r?-i:i},readUint16:function(){return 256*this.readByte()+this.readByte()},readUint32:function(){return 65536*this.readUint16()+this.readUint16()},readUint64:function(){return 4294967296*this.readUint32()+this.readUint32()}},a.prototype={writeByte:r("writeByte"),result:r("result"),writeFloat16:r("writeFloat16"),writeFloat32:r("writeFloat32"),writeFloat64:r("writeFloat64"),writeUint16:function(e){this.writeByte(e>>8&255),this.writeByte(255&e)},writeUint32:function(e){this.writeUint16(e>>16&65535),this.writeUint16(65535&e)},writeUint64:function(e){if(e>=9007199254740992||e<=-9007199254740992)throw new Error("Cannot encode Uint64 of: "+e+" magnitude to big (floating point errors)");this.writeUint32(Math.floor(e/4294967296)),this.writeUint32(e%4294967296)},writeString:r("writeString"),canWriteBinary:function(e){return!1},writeBinary:r("writeChunk")};var s=new Error;function c(e){var t=function(e){var t=e.readByte();return{type:t>>5,value:31&t}}(e);switch(t.type){case 0:return o(t,e);case 1:return-1-o(t,e);case 2:return e.readChunk(o(t,e));case 3:return e.readChunk(o(t,e)).toString("utf-8");case 4:case 5:var r=o(t,e),i=[];if(null!==r){5===t.type&&(r*=2);for(var a=0;a-9007199254740992?e<0?u(1,-1-e,n):u(0,e,n):(function(e,t,n){n.writeByte(e<<5|t)}(7,27,n),n.writeFloat64(e));else if("string"==typeof e)n.writeString(e,(function(e){u(3,e,n)}));else if(n.canWriteBinary(e))n.writeBinary(e,(function(e){u(2,e,n)}));else{if("object"!=typeof e)throw new Error("CBOR encoding not supported: "+e);if(p.config.useToJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),Array.isArray(e))for(u(4,e.length,n),r=0;r=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0),this.byteLength++},g.prototype.writeFloat32=function(e){var t=Buffer.alloc(4);t.writeFloatBE(e,0),this.writeBuffer(t)},g.prototype.writeFloat64=function(e){var t=Buffer.alloc(8);t.writeDoubleBE(e,0),this.writeBuffer(t)},g.prototype.writeString=function(e,t){var n=Buffer.from(e,"utf-8");t(n.length),this.writeBuffer(n)},g.prototype.canWriteBinary=function(e){return e instanceof Buffer},g.prototype.writeBinary=function(e,t){t(e.length),this.writeBuffer(e)},g.prototype.writeBuffer=function(e){if(!(e instanceof Buffer))throw new TypeError("BufferWriter only accepts Buffers");this.latestBufferOffset?this.latestBuffer.length-this.latestBufferOffset>=e.length?(e.copy(this.latestBuffer,this.latestBufferOffset),this.latestBufferOffset+=e.length,this.latestBufferOffset>=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0)):(this.completeBuffers.push(this.latestBuffer.slice(0,this.latestBufferOffset)),this.completeBuffers.push(e),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0):this.completeBuffers.push(e),this.byteLength+=e.length},g.prototype.result=function(){for(var e=Buffer.alloc(this.byteLength),t=0,n=0;n255)throw new Error("Byte value out of range: "+e);var t=e.toString(16);1==t.length&&(t="0"+t),this.$hex+=t},y.prototype.canWriteBinary=function(t){return t instanceof e||"function"==typeof Buffer&&t instanceof Buffer},y.prototype.writeBinary=function(t,n){if(t instanceof e)n(t.length()),this.$hex+=t.$hex;else{if(!("function"==typeof Buffer&&t instanceof Buffer))throw new TypeError("HexWriter only accepts BinaryHex or Buffers");n(t.length),this.$hex+=t.toString("hex")}},y.prototype.result=function(){return"buffer"===this.finalFormat&&"function"==typeof Buffer?Buffer.from(this.$hex,"hex"):new e(this.$hex).toString(this.finalFormat)},y.prototype.writeString=function(t,n){var r=e.fromUtf8String(t);n(r.length()),this.$hex+=r.$hex},p.addReader((function(t,n){return t instanceof e||t.$hex?new v(t.$hex):"hex"===n?new v(t):void 0})),p.addWriter((function(e){if("hex"===e)return new y})),p}();return e.addSemanticEncode(0,(function(e){if(e instanceof Date)return e.toISOString()})).addSemanticDecode(0,(function(e){return new Date(e)})).addSemanticDecode(1,(function(e){return new Date(e)})),e})?r.apply(t,i):r)||(e.exports=a)},function(e,t,n){"use strict";var r=n(0),i=n(7);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(5)),o=r(n(6)),u=r(n(4)),s=r(n(8)),c=r(n(18)),l=r(n(28)),f=r(n(31)),d=r(n(32)),p=r(n(19)),h=r(n(35)),g=r(n(16)),v=n(3),y=Ee(n(40)),b=Ee(n(41)),m=Ee(n(42)),_=Ee(n(43)),P=Ee(n(44)),O=Ee(n(45)),k=Ee(n(46)),S=Ee(n(47)),M=Ee(n(48)),T=Ee(n(49)),x=Ee(n(50)),w=Ee(n(51)),N=Ee(n(52)),j=Ee(n(53)),U=Ee(n(54)),C=Ee(n(55)),R=Ee(n(56)),E=Ee(n(57)),A=(n(58),Ee(n(59)),r(n(60))),K=r(n(61)),F=r(n(62)),I=r(n(63)),B=r(n(65)),D=r(n(66)),G=r(n(67)),L=r(n(68)),q=r(n(74)),H=r(n(75)),z=r(n(76)),V=r(n(77)),W=r(n(78)),$=r(n(79)),J=r(n(80)),X=r(n(81)),Y=r(n(82)),Q=r(n(83)),Z=r(n(84)),ee=Ee(n(85)),te=Ee(n(86)),ne=Ee(n(87)),re=Ee(n(88)),ie=Ee(n(89)),ae=Ee(n(90)),oe=Ee(n(91)),ue=Ee(n(92)),se=Ee(n(93)),ce=Ee(n(94)),le=Ee(n(95)),fe=Ee(n(96)),de=Ee(n(97)),pe=Ee(n(98)),he=Ee(n(99)),ge=Ee(n(100)),ve=Ee(n(101)),ye=Ee(n(102)),be=Ee(n(103)),me=Ee(n(104)),_e=Ee(n(105)),Pe=r(n(106)),Oe=Ee(n(107)),ke=Ee(n(108)),Se=Ee(n(109)),Me=Ee(n(110)),Te=Ee(n(111)),xe=Ee(n(112)),we=Ee(n(20)),Ne=Ee(n(113)),je=r(n(1)),Ue=r(n(10)),Ce=(n(2),r(n(15)));function Re(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Re=function(e){return e?n:t})(e)}function Ee(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var n=Re(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var u=a?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ke(e){for(var t=1;t1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>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=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;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>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=u.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)))}},f=r.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.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,a=this.blockSize,u=i/(4*a);if(t=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*a,i=e.min(4*t,i),t){for(var s=0;sl;){var f;e:{f=c;for(var d=e.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>l&&(a[l]=u(e.pow(c,.5))),o[l]=u(e.pow(c,1/3)),l++),c++}var h=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],u=n[3],s=n[4],c=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)h[d]=0|e[t+d];else{var p=h[d-15],g=h[d-2];h[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+h[d-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+h[d-16]}p=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&l)+o[d]+h[d],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),f=l,l=c,c=s,s=u+p|0,u=a,a=i,i=r,r=p+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|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),i=(r=s).enc.Utf8,r.algo.HMAC=r.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),u=a.words,s=o.words,c=0;c>>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,o=0;4>o&&i+.75*o>>6*(3-o)&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,a=0;a>>6-a%4*2;r[i>>>2]|=(u|s)<<24-i%4*8,i++}return o.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,r,i,a,o){return((e=e+(t&n|~t&r)+i+o)<>>32-a)+t}function n(e,t,n,r,i,a,o){return((e=e+(t&r|n&~r)+i+o)<>>32-a)+t}function r(e,t,n,r,i,a,o){return((e=e+(t^n^r)+i+o)<>>32-a)+t}function i(e,t,n,r,i,a,o){return((e=e+(n^(t|~r))+i+o)<>>32-a)+t}for(var a=s,o=(c=a.lib).WordArray,u=c.Hasher,c=a.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var o=0;16>o;o++){var u=e[s=a+o];e[s]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}o=this._hash.words;var s=e[a+0],c=(u=e[a+1],e[a+2]),f=e[a+3],d=e[a+4],p=e[a+5],h=e[a+6],g=e[a+7],v=e[a+8],y=e[a+9],b=e[a+10],m=e[a+11],_=e[a+12],P=e[a+13],O=e[a+14],k=e[a+15],S=t(S=o[0],x=o[1],T=o[2],M=o[3],s,7,l[0]),M=t(M,S,x,T,u,12,l[1]),T=t(T,M,S,x,c,17,l[2]),x=t(x,T,M,S,f,22,l[3]);S=t(S,x,T,M,d,7,l[4]),M=t(M,S,x,T,p,12,l[5]),T=t(T,M,S,x,h,17,l[6]),x=t(x,T,M,S,g,22,l[7]),S=t(S,x,T,M,v,7,l[8]),M=t(M,S,x,T,y,12,l[9]),T=t(T,M,S,x,b,17,l[10]),x=t(x,T,M,S,m,22,l[11]),S=t(S,x,T,M,_,7,l[12]),M=t(M,S,x,T,P,12,l[13]),T=t(T,M,S,x,O,17,l[14]),S=n(S,x=t(x,T,M,S,k,22,l[15]),T,M,u,5,l[16]),M=n(M,S,x,T,h,9,l[17]),T=n(T,M,S,x,m,14,l[18]),x=n(x,T,M,S,s,20,l[19]),S=n(S,x,T,M,p,5,l[20]),M=n(M,S,x,T,b,9,l[21]),T=n(T,M,S,x,k,14,l[22]),x=n(x,T,M,S,d,20,l[23]),S=n(S,x,T,M,y,5,l[24]),M=n(M,S,x,T,O,9,l[25]),T=n(T,M,S,x,f,14,l[26]),x=n(x,T,M,S,v,20,l[27]),S=n(S,x,T,M,P,5,l[28]),M=n(M,S,x,T,c,9,l[29]),T=n(T,M,S,x,g,14,l[30]),S=r(S,x=n(x,T,M,S,_,20,l[31]),T,M,p,4,l[32]),M=r(M,S,x,T,v,11,l[33]),T=r(T,M,S,x,m,16,l[34]),x=r(x,T,M,S,O,23,l[35]),S=r(S,x,T,M,u,4,l[36]),M=r(M,S,x,T,d,11,l[37]),T=r(T,M,S,x,g,16,l[38]),x=r(x,T,M,S,b,23,l[39]),S=r(S,x,T,M,P,4,l[40]),M=r(M,S,x,T,s,11,l[41]),T=r(T,M,S,x,f,16,l[42]),x=r(x,T,M,S,h,23,l[43]),S=r(S,x,T,M,y,4,l[44]),M=r(M,S,x,T,_,11,l[45]),T=r(T,M,S,x,k,16,l[46]),S=i(S,x=r(x,T,M,S,c,23,l[47]),T,M,s,6,l[48]),M=i(M,S,x,T,g,10,l[49]),T=i(T,M,S,x,O,15,l[50]),x=i(x,T,M,S,p,21,l[51]),S=i(S,x,T,M,_,6,l[52]),M=i(M,S,x,T,f,10,l[53]),T=i(T,M,S,x,b,15,l[54]),x=i(x,T,M,S,u,21,l[55]),S=i(S,x,T,M,v,6,l[56]),M=i(M,S,x,T,k,10,l[57]),T=i(T,M,S,x,h,15,l[58]),x=i(x,T,M,S,P,21,l[59]),S=i(S,x,T,M,d,6,l[60]),M=i(M,S,x,T,m,10,l[61]),T=i(T,M,S,x,c,15,l[62]),x=i(x,T,M,S,y,21,l[63]);o[0]=o[0]+S|0,o[1]=o[1]+x|0,o[2]=o[2]+T|0,o[3]=o[3]+M|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 a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>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=u.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=u._createHelper(c),a.HmacMD5=u._createHmacHelper(c)}(Math),function(){var e,t=s,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=(u=this.cfg).hasher.create(),i=r.create(),a=i.words,o=u.keySize,u=u.iterations;a.length>>2]}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:c,padding:f}),reset:function(){u.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 d=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(c=(h.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.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 d.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:c}),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,d.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}})),h=(h.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=o.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:i})}},g=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),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=p.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,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=s,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],o=[],u=[],c=[],l=[],f=[],d=[],p=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;var v=0,y=0;for(g=0;256>g;g++){var b=(b=y^y<<1^y<<2^y<<3^y<<4)>>>8^255&b^99;r[v]=b,i[b]=v;var m=h[v],_=h[m],P=h[_],O=257*h[b]^16843008*b;a[v]=O<<24|O>>>8,o[v]=O<<16|O>>>16,u[v]=O<<8|O>>>24,c[v]=O,O=16843009*P^65537*_^257*m^16843008*v,l[b]=O<<24|O>>>8,f[b]=O<<16|O>>>16,d[b]=O<<8|O>>>24,p[b]=O,v?(v=m^h[h[h[P^m]]],y^=h[h[y]]):v=y=1}var k=[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=[],a=0;a>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[255&o]):(o=r[(o=o<<8|o>>>24)>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[255&o],o^=k[a/t|0]<<24),i[a]=i[a-t]^o}for(e=this._invKeySchedule=[],t=0;tt||4>=a?o:l[r[o>>>24]]^f[r[o>>>16&255]]^d[r[o>>>8&255]]^p[r[255&o]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,u,c,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,l,f,d,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,u){for(var s=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],d=e[t+3]^n[3],p=4,h=1;h>>24]^i[l>>>16&255]^a[f>>>8&255]^o[255&d]^n[p++],v=r[l>>>24]^i[f>>>16&255]^a[d>>>8&255]^o[255&c]^n[p++],y=r[f>>>24]^i[d>>>16&255]^a[c>>>8&255]^o[255&l]^n[p++];d=r[d>>>24]^i[c>>>16&255]^a[l>>>8&255]^o[255&f]^n[p++],c=g,l=v,f=y}g=(u[c>>>24]<<24|u[l>>>16&255]<<16|u[f>>>8&255]<<8|u[255&d])^n[p++],v=(u[l>>>24]<<24|u[f>>>16&255]<<16|u[d>>>8&255]<<8|u[255&c])^n[p++],y=(u[f>>>24]<<24|u[d>>>16&255]<<16|u[c>>>8&255]<<8|u[255&l])^n[p++],d=(u[d>>>24]<<24|u[c>>>16&255]<<16|u[l>>>8&255]<<8|u[255&f])^n[p++],e[t]=g,e[t+1]=v,e[t+2]=y,e[t+3]=d},keySize:8});e.AES=t._createHelper(n)}(),s.mode.ECB=((u=s.lib.BlockCipherMode.extend()).Encryptor=u.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),u.Decryptor=u.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),u),e.exports=s},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(5)),o=r(n(6)),u=r(n(4)),s=(r(n(18)),r(n(8)),r(n(19)),r(n(29))),c=r(n(30)),l=r(n(3)),f=(n(2),r(n(10))),d=function(){function e(t){var n=t.subscribeEndpoint,r=t.leaveEndpoint,i=t.heartbeatEndpoint,o=t.setStateEndpoint,l=t.timeEndpoint,f=t.getFileUrl,d=t.config,p=t.crypto,h=t.listenerManager;(0,a.default)(this,e),(0,u.default)(this,"_crypto",void 0),(0,u.default)(this,"_config",void 0),(0,u.default)(this,"_listenerManager",void 0),(0,u.default)(this,"_reconnectionManager",void 0),(0,u.default)(this,"_leaveEndpoint",void 0),(0,u.default)(this,"_heartbeatEndpoint",void 0),(0,u.default)(this,"_setStateEndpoint",void 0),(0,u.default)(this,"_subscribeEndpoint",void 0),(0,u.default)(this,"_getFileUrl",void 0),(0,u.default)(this,"_channels",void 0),(0,u.default)(this,"_presenceChannels",void 0),(0,u.default)(this,"_heartbeatChannels",void 0),(0,u.default)(this,"_heartbeatChannelGroups",void 0),(0,u.default)(this,"_channelGroups",void 0),(0,u.default)(this,"_presenceChannelGroups",void 0),(0,u.default)(this,"_currentTimetoken",void 0),(0,u.default)(this,"_lastTimetoken",void 0),(0,u.default)(this,"_storedTimetoken",void 0),(0,u.default)(this,"_region",void 0),(0,u.default)(this,"_subscribeCall",void 0),(0,u.default)(this,"_heartbeatTimer",void 0),(0,u.default)(this,"_subscriptionStatusAnnounced",void 0),(0,u.default)(this,"_autoNetworkDetection",void 0),(0,u.default)(this,"_isOnline",void 0),(0,u.default)(this,"_pendingChannelSubscriptions",void 0),(0,u.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,u.default)(this,"_dedupingManager",void 0),this._listenerManager=h,this._config=d,this._leaveEndpoint=r,this._heartbeatEndpoint=i,this._setStateEndpoint=o,this._subscribeEndpoint=n,this._getFileUrl=f,this._crypto=p,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 s.default({timeEndpoint:l}),this._dedupingManager=new c.default({config:d})}return(0,o.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,r=e.state,i=e.channels,a=void 0===i?[]:i,o=e.channelGroups,u=void 0===o?[]:o;return a.forEach((function(e){e in n._channels&&(n._channels[e].state=r)})),u.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)})),this._setStateEndpoint({state:r,channels:a,channelGroups:u},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a;n?(i.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),o.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(i.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),o.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:o},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a,u=e.withPresence,s=void 0!==u&&u,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:{}},s&&(t._presenceChannels[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),o.forEach((function(e){t._channelGroups[e]={state:{}},s&&(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")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a,u=[],s=[];i.forEach((function(e){e in n._channels&&(delete n._channels[e],u.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],u.push(e))})),o.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],s.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],s.push(e))})),0===u.length&&0===s.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:u,channelGroups:s},(function(e){e.affectedChannels=u,e.affectedChannelGroups=s,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())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value: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()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value: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))}}},{key:"_startSubscribeLoop",value: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))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===f.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===f.default.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:f.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===f.default.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=f.default.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 a=t.messages||[],o=this._config,u=o.requestMessageCountThreshold,s=o.dedupeOnSubscribe;if(u&&a.length>=u){var c={};c.category=f.default.PNRequestMessageCountExceededCategory,c.operation=e.operation,this._listenerManager.announceStatus(c)}a.forEach((function(e){var t=e.channel,r=e.subscriptionMatch,a=e.publishMetaData;if(t===r&&(r=null),s){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(l.default.endsWith(e.channel,"-pnpres")){var o={channel:null,subscription:null};o.actualChannel=null!=r?t:null,o.subscribedChannel=null!=r?r:t,t&&(o.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(o.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),o.action=e.payload.action,o.state=e.payload.data,o.timetoken=a.publishTimetoken,o.occupancy=e.payload.occupancy,o.uuid=e.payload.uuid,o.timestamp=e.payload.timestamp,e.payload.join&&(o.join=e.payload.join),e.payload.leave&&(o.leave=e.payload.leave),e.payload.timeout&&(o.timeout=e.payload.timeout),n._listenerManager.announcePresence(o)}else if(1===e.messageType){var u={channel:null,subscription:null};u.channel=t,u.subscription=r,u.timetoken=a.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=e.payload,n._listenerManager.announceSignal(u)}else if(2===e.messageType){var c={channel:null,subscription:null};c.channel=t,c.subscription=r,c.timetoken=a.publishTimetoken,c.publisher=e.issuingClientId,e.userMetadata&&(c.userMetadata=e.userMetadata),c.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(c),"user"===e.payload.type?n._listenerManager.announceUser(c):"space"===e.payload.type?n._listenerManager.announceSpace(c):"membership"===e.payload.type&&n._listenerManager.announceMembership(c)}else if(3===e.messageType){var f={};f.channel=t,f.subscription=r,f.timetoken=a.publishTimetoken,f.publisher=e.issuingClientId,f.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},f.event=e.payload.event,n._listenerManager.announceMessageAction(f)}else if(4===e.messageType){var d={};d.channel=t,d.subscription=r,d.timetoken=a.publishTimetoken,d.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var h=n._crypto.decrypt(e.payload);"object"===(0,i.default)(h)&&null!==h&&(p=h)}e.userMetadata&&(d.userMetadata=e.userMetadata),d.message=p.message,d.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(d)}else{var g={channel:null,subscription:null};g.actualChannel=null!=r?t:null,g.subscribedChannel=null!=r?r:t,g.channel=t,g.subscription=r,g.timetoken=a.publishTimetoken,g.publisher=e.issuingClientId,e.userMetadata&&(g.userMetadata=e.userMetadata),n._config.cipherKey?g.message=n._crypto.decrypt(e.payload):g.message=e.payload,n._listenerManager.announceMessage(g)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(20)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,i.default)(this,e),(0,o.default)(this,"_reconnectionCallback",void 0),(0,o.default)(this,"_timeEndpoint",void 0),(0,o.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,a.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),n(2),function(){function e(t){var n=t.config;(0,i.default)(this,e),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,a.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=r(n(1)),s=function(){function e(t){(0,i.default)(this,e),(0,o.default)(this,"_maximumSamplesCount",100),(0,o.default)(this,"_trackedLatencies",{}),(0,o.default)(this,"_latencies",{}),this._maximumSamplesCount=t.maximumSamplesCount||this._maximumSamplesCount}return(0,a.default)(e,[{key:"operationsLatencyForRequest",value: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}},{key:"startLatencyMeasure",value:function(e,t){e!==u.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==u.default.PNSubscribeOperation&&t){var n=this._endpointName(e),r=this._latencies[n],i=this._trackedLatencies[t];r||(r=this._latencies[n]=[]),r.push(Date.now()-i),r.length>this._maximumSamplesCount&&r.splice(0,r.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case u.default.PNPublishOperation:t="pub";break;case u.default.PNSignalOperation:t="sig";break;case u.default.PNHistoryOperation:case u.default.PNFetchMessagesOperation:case u.default.PNDeleteMessagesOperation:case u.default.PNMessageCounts:t="hist";break;case u.default.PNUnsubscribeOperation:case u.default.PNWhereNowOperation:case u.default.PNHereNowOperation:case u.default.PNHeartbeatOperation:case u.default.PNSetStateOperation:case u.default.PNGetStateOperation:t="pres";break;case u.default.PNAddChannelsToGroupOperation:case u.default.PNRemoveChannelsFromGroupOperation:case u.default.PNChannelGroupsOperation:case u.default.PNRemoveGroupOperation:case u.default.PNChannelsForGroupOperation:t="cg";break;case u.default.PNPushNotificationEnabledChannelsOperation:case u.default.PNRemoveAllPushNotificationsOperation:t="push";break;case u.default.PNCreateUserOperation:case u.default.PNUpdateUserOperation:case u.default.PNDeleteUserOperation:case u.default.PNGetUserOperation:case u.default.PNGetUsersOperation:case u.default.PNCreateSpaceOperation:case u.default.PNUpdateSpaceOperation:case u.default.PNDeleteSpaceOperation:case u.default.PNGetSpaceOperation:case u.default.PNGetSpacesOperation:case u.default.PNGetMembersOperation:case u.default.PNUpdateMembersOperation:case u.default.PNGetMembershipsOperation:case u.default.PNUpdateMembershipsOperation:t="obj";break;case u.default.PNAddMessageActionOperation:case u.default.PNRemoveMessageActionOperation:case u.default.PNGetMessageActionsOperation:t="msga";break;case u.default.PNAccessManagerGrant:case u.default.PNAccessManagerAudit:t="pam";break;case u.default.PNAccessManagerGrantToken:case u.default.PNAccessManagerRevokeToken:t="pamv3";break;default:t="time"}return t}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.MPNSNotificationPayload=t.FCMNotificationPayload=t.APNSNotificationPayload=void 0;var i=r(n(33)),a=r(n(17)),o=r(n(12)),u=r(n(14)),s=r(n(11)),c=r(n(5)),l=r(n(6)),f=r(n(4)),d=(n(2),["notification","data"]);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t2){var r=this._payload,a=(r.notification,r.data,(0,i.default)(r,d));e=h(h({},e),a)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}}]),n}(v);t.FCMNotificationPayload=m;var _=function(){function e(t,n){(0,c.default)(this,e),(0,f.default)(this,"_payload",void 0),(0,f.default)(this,"_debugging",void 0),(0,f.default)(this,"_subtitle",void 0),(0,f.default)(this,"_badge",void 0),(0,f.default)(this,"_sound",void 0),(0,f.default)(this,"_title",void 0),(0,f.default)(this,"_body",void 0),(0,f.default)(this,"apns",void 0),(0,f.default)(this,"mpns",void 0),(0,f.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new y(this._payload.apns,t,n),this.mpns=new b(this._payload.mpns,t,n),this.fcm=new m(this._payload.fcm,t,n)}return(0,l.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}},{key:"buildPayload",value: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}();t.default=_},function(e,t,n){var r=n(34);e.exports=function(e,t){if(null==e)return{};var n,i,a=r(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),n(2),function(){function e(t,n){(0,i.default)(this,e),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"_cbor",void 0),(0,o.default)(this,"_token",void 0),this._config=t,this._cbor=n}return(0,a.default)(e,[{key:"setToken",value:function(e){e&&e.length>0?this._token=e:this._token=void 0}},{key:"getToken",value:function(){return this._token}},{key:"extractPermissions",value: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}},{key:"parseToken",value: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),a=Object.keys(n.res.grp),o=n.pat.uuid?Object.keys(n.pat.uuid):[],u=Object.keys(n.pat.chan),s=Object.keys(n.pat.grp),c={version:n.v,timestamp:n.t,ttl:n.ttl,authorized_uuid:n.uuid},l=r.length>0,f=i.length>0,d=a.length>0;(l||f||d)&&(c.resources={},l&&(c.resources.uuids={},r.forEach((function(e){c.resources.uuids[e]=t.extractPermissions(n.res.uuid[e])}))),f&&(c.resources.channels={},i.forEach((function(e){c.resources.channels[e]=t.extractPermissions(n.res.chan[e])}))),d&&(c.resources.groups={},a.forEach((function(e){c.resources.groups[e]=t.extractPermissions(n.res.grp[e])}))));var p=o.length>0,h=u.length>0,g=s.length>0;return(p||h||g)&&(c.patterns={},p&&(c.patterns.uuids={},o.forEach((function(e){c.patterns.uuids[e]=t.extractPermissions(n.pat.uuid[e])}))),h&&(c.patterns.channels={},u.forEach((function(e){c.patterns.channels[e]=t.extractPermissions(n.pat.chan[e])}))),g&&(c.patterns.groups={},s.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}());t.default=u,e.exports=t.default},function(e,t,n){var r=n(11),i=n(13),a=n(37),o=n(38);function u(t){var n="function"==typeof Map?new Map:void 0;return e.exports=u=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,u(t)}e.exports=u,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13),i=n(39);function a(t,n,o){return i()?(e.exports=a=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},e.exports.default=e.exports,e.exports.__esModule=!0),a.apply(null,arguments)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAddChannelsToGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveChannelsFromGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n),"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelGroupsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.handleResponse=function(e,t){return{groups:t.payload.groups}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelsForGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,a=t.environment,o=void 0===a?"development":a,u=t.topic,s={type:n,add:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:o,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,a=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!a)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,a=t.environment,o=void 0===a?"development":a,u=t.topic,s={type:n,remove:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:o,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,a=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!a)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(e,t){return{channels:t}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,a=t.topic,o={type:n};"apns2"===n&&delete(o=Object.assign({},o,{environment:i,topic:a})).type;return o},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveAllPushNotificationsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n,"/remove");return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n,"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,a=t.topic,o={type:n};"apns2"===n&&delete(o=Object.assign({},o,{environment:i,topic:a})).type;return o},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUnsubscribeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/leave")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNWhereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(i))},t.handleResponse=function(e,t){if(!t.payload)return{channels:[]};return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHeartbeatOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/heartbeat")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,a=void 0===i?{}:i,o=e.config,u={};r.length>0&&(u["channel-group"]=r.join(","));return u.state=JSON.stringify(a),u.heartbeat=o.getPresenceTimeout(),u},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,o=t.channels,u=void 0===o?[]:o,s=u.length>0?u.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(a.default.encodeString(s),"/uuid/").concat(i)},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,a=n.channelGroups,o=void 0===a?[]:a,u={};1===i.length&&0===o.length?u[i[0]]=t.payload:u=t.payload;return{channels:u}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/uuid/").concat(a.default.encodeString(n.UUID),"/data")},t.handleResponse=function(e,t){return{state:t.payload}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,a={};a.state=JSON.stringify(n),i.length>0&&(a["channel-group"]=i.join(","));return a},t.validateParams=function(e,t){var n=e.config,r=t.state,i=t.channels,a=void 0===i?[]:i,o=t.channelGroups,u=void 0===o?[]:o;if(!r)return"Missing State";if(!n.subscribeKey)return"Missing Subscribe Key";if(0===a.length&&0===u.length)return"Please provide a list of channels and/or channel-groups"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNHereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=t.channelGroups,u=void 0===a?[]:a,s="/v2/presence/sub-key/".concat(n.subscribeKey);if(i.length>0||u.length>0){var c=i.length>0?i.join(","):",";s+="/channel/".concat(o.default.encodeString(c))}return s},t.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.")},t.handleResponse=function(e,t,n){var r,i=n.channels,a=void 0===i?[]:i,o=n.channelGroups,u=void 0===o?[]:o,s=n.includeUUIDs,c=void 0===s||s,l=n.includeState,f=void 0!==l&&l;r=a.length>1||u.length>0||0===u.length&&0===a.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},c&&r.uuids.forEach((function(e){f?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[a[0]]={occupants:n,name:a[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){f?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}();return r},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,a=void 0===i||i,o=t.includeState,u=void 0!==o&&o,c=t.queryParameters,l=void 0===c?{}:c,f={};a||(f.disable_uuids=1);u&&(f.state=1);r.length>0&&(f["channel-group"]=r.join(","));return f=s(s({},f),l)},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};var i=r(n(4)),a=(n(2),r(n(1))),o=r(n(3));function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t15)return"Action.type value exceed maximum length of 15"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveMessageActionOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(r),"/message/").concat(o,"/action/").concat(i)},t.handleResponse=function(e,t){return{data:t.data}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken;if(!t.messageTimetoken)return"Missing message timetoken";if(!i)return"Missing action timetoken";if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMessageActionsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,r=t.start,i=t.end,a={};n&&(a.limit=n);r&&(a.start=r);i&&(a.end=i);return a},t.validateParams=function(e,t){var n=e.config,r=t.channel;if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){if(null==t||!t.channel)return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(1)),o=r(n(3)),u={getOperation:function(){return a.default.PNPublishFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.fileId?null!=t&&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,a=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(o.default.encodeString(t.channel),"/0/").concat(o.default.encodeString(a))},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"===(0,i.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(21)),a=r(n(22)),o=n(16),u=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,r,s,c,l,f,d,p,h=(r=(t=e).generateUploadUrl,s=t.publishFile,c=t.modules,l=c.PubNubFile,f=c.config,d=c.cryptography,p=c.networking,n=(0,a.default)(i.default.mark((function e(t){var n,a,c,h,g,v,y,b,m,_,P,O,k,S,M,T,x,w,N,j,U,C;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,a=t.file,c=t.message,h=t.cipherKey,g=t.meta,v=t.ttl,y=t.storeInHistory,n){e.next=3;break}throw new o.PubNubError("Validation failed, check status for details",(0,o.createValidationError)("channel can't be empty"));case 3:if(a){e.next=5;break}throw new o.PubNubError("Validation failed, check status for details",(0,o.createValidationError)("file can't be empty"));case 5:return b=l.create(a),e.next=8,r({channel:n,name:b.name});case 8:if(m=e.sent,_=m.file_upload_request,P=_.url,O=_.form_fields,k=m.data,S=k.id,M=k.name,!l.supportsEncryptFile||!(null!=h?h:f.cipherKey)){e.next=19;break}return e.next=18,d.encryptFile(null!=h?h:f.cipherKey,b,l);case 18:b=e.sent;case 19:if(T=O,b.mimeType&&(T=O.map((function(e){return"Content-Type"===e.key?{key:e.key,value:b.mimeType}:e}))),e.prev=21,!l.supportsFileUri||!a.uri){e.next=34;break}return e.t0=p,e.t1=P,e.t2=T,e.next=28,b.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:x=e.sent,e.next=71;break;case 34:if(!l.supportsFile){e.next=46;break}return e.t4=p,e.t5=P,e.t6=T,e.next=40,b.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:x=e.sent,e.next=71;break;case 46:if(!l.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=P,e.t10=T,e.next=52,b.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:x=e.sent,e.next=71;break;case 58:if(!l.supportsBlob){e.next=70;break}return e.t12=p,e.t13=P,e.t14=T,e.next=64,b.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:x=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,u(e.t16.response);case 77:throw w=e.sent,N=/(.*)<\/Message>/gi.exec(w),new o.PubNubError(N?"Upload to bucket failed: ".concat(N[1]):"Upload to bucket failed.",e.t16);case 80:if(204===x.status){e.next=82;break}throw new o.PubNubError("Upload to bucket was unsuccessful",x);case 82:j=f.fileUploadPublishRetryLimit,U=!1,C={timetoken:"0"};case 85:return e.prev=85,e.next=88,s({channel:n,message:c,fileId:S,fileName:M,meta:g,storeInHistory:y,ttl:v});case 88:C=e.sent,U=!0,e.next=95;break;case 92:e.prev=92,e.t17=e.catch(85),j-=1;case 95:if(!U&&j>0){e.next=85;break}case 96:if(U){e.next=100;break}throw new o.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:S,name:M});case 100:return e.abrupt("return",{timetoken:C.timetoken,id:S,name:M});case 101:case"end":return e.stop()}}),e,null,[[21,73],[85,92]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=h(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new k(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return M()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var u=_(o,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function d(){}function p(){}var h={};u(h,i,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(S([])));v&&v!==t&&n.call(v,i)&&(h=v);var y=p.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,u){var s=c(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,o,u)}),(function(e){r("throw",e,o,u)})):t.resolve(f).then((function(e){l.value=e,o(l)}),(function(e){return r("throw",e,o,u)}))}u(s.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function _(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(16),a=r(n(3));t.default=function(e,t){var n=t.channel,r=t.id,o=t.name,u=e.config,s=e.networking;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!o)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var c="/v1/files/".concat(u.subscribeKey,"/channels/").concat(a.default.encodeString(n),"/files/").concat(r,"/").concat(o),l={};l.uuid=u.getUUID(),l.pnsdk=(0,i.generatePNSDK)(u),u.getAuthKey()&&(l.auth=u.getAuthKey()),u.secretKey&&(0,i.signRequest)(e,c,l,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var f=Object.keys(l).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(l[e]))})).join("&");return""!==f?"".concat(s.getStandardOrigin()).concat(c,"?").concat(f):"".concat(s.getStandardOrigin()).concat(c)},e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,a=r(n(21)),o=r(n(22)),u=r(n(1)),s=r(n(3)),c={getOperation:function(){return u.default.PNDownloadFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.name?null!=t&&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(s.default.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:(i=(0,o.default)(a.default.mark((function e(t,n,r){var i,o,u,s,c,l,f;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.PubNubFile,s=t.config,c=t.cryptography,l=n.response.body,!u.supportsEncryptFile||!(null!==(i=r.cipherKey)&&void 0!==i?i:s.cipherKey)){e.next=6;break}return e.next=5,c.decrypt(null!==(f=r.cipherKey)&&void 0!==f?f:s.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",u.create({data:l,name:null!==(o=n.response.name)&&void 0!==o?o:r.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.id?null!=t&&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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(9)),a=r(n(1)),o={getOperation:function(){return a.default.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,a,o,u,s,c,l,f,d={};(null!=t&&null!==(n=t.include)&&void 0!==n&&n.customFields&&(d.include="custom"),null!=t&&null!==(r=t.include)&&void 0!==r&&r.totalCount)&&(d.count=null===(s=t.include)||void 0===s?void 0:s.totalCount);null!=t&&null!==(a=t.page)&&void 0!==a&&a.next&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next);null!=t&&null!==(o=t.page)&&void 0!==o&&o.prev&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev);(null!=t&&t.filter&&(d.filter=t.filter),d.limit=null!==(u=null==t?void 0:t.limit)&&void 0!==u?u:100,null!=t&&t.sort)&&(d.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,i.default)(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n})));return d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=o,e.exports=t.default},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){u=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw i}}return a}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(72);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(r.include=a)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing UserId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUsersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNCreateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing SpaceId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpacesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom"),n.userFields&&u.push("user"),n.customUserFields&&u.push("user.custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,r=t.updateMembers,i=t.removeMembers,a=t.users,o={};n&&n.length>0&&(o.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.add.push(t)})));r&&r.length>0&&(o.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));a&&a.length>0&&(o.update=o.update||[],a.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));i&&i.length>0&&(o.remove=[],i.forEach((function(e){o.remove.push({id:e})})));return o}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom"),n.spaceFields&&u.push("space"),n.customSpaceFields&&u.push("space.custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,r=t.updateMemberships,i=t.removeMemberships,a=t.spaces,o={};n&&n.length>0&&(o.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.add.push(t)})));r&&r.length>0&&(o.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));a&&a.length>0&&(o.update=o.update||[],a.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));i&&i.length>0&&(o.remove=[],i.forEach((function(e){o.remove.push({id:e})})));return o}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerAudit},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,a=void 0===i?[]:i,o={};n&&(o.channel=n);r&&(o["channel-group"]=r);a.length>0&&(o.auth=a.join(","));return o},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerGrant},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,a=void 0===i?[]:i,o=t.uuids,u=void 0===o?[]:o,s=t.ttl,c=t.read,l=void 0!==c&&c,f=t.write,d=void 0!==f&&f,p=t.manage,h=void 0!==p&&p,g=t.get,v=void 0!==g&&g,y=t.join,b=void 0!==y&&y,m=t.update,_=void 0!==m&&m,P=t.authKeys,O=void 0===P?[]:P,k=t.delete,S={};S.r=l?"1":"0",S.w=d?"1":"0",S.m=h?"1":"0",S.d=k?"1":"0",S.g=v?"1":"0",S.j=b?"1":"0",S.u=_?"1":"0",r.length>0&&(S.channel=r.join(","));a.length>0&&(S["channel-group"]=a.join(","));O.length>0&&(S.auth=O.join(","));u.length>0&&(S["target-uuid"]=u.join(","));(s||0===s)&&(S.ttl=s);return S},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(null!=t.uuids&&!t.authKeys)return"authKeys are required for grant request on uuids";if(null!=t.uuids&&(null!=t.channels||null!=t.channelGroups))return"Both channel/channelgroup and uuid cannot be used in the same request"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.extractPermissions=a,t.getOperation=function(){return i.default.PNAccessManagerGrantToken},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.handleResponse=function(e,t){return t.data.token},t.isAuthSupported=function(){return!1},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,r=t.resources,i=t.patterns,o=t.meta,u=t.authorized_uuid,s={ttl:0,permissions:{resources:{channels:{},groups:{},uuids:{},users:{},spaces:{}},patterns:{channels:{},groups:{},uuids:{},users:{},spaces:{}},meta:{}}};if(r){var c=r.uuids,l=r.channels,f=r.groups;c&&Object.keys(c).forEach((function(e){s.permissions.resources.uuids[e]=a(c[e])})),l&&Object.keys(l).forEach((function(e){s.permissions.resources.channels[e]=a(l[e])})),f&&Object.keys(f).forEach((function(e){s.permissions.resources.groups[e]=a(f[e])}))}if(i){var d=i.uuids,p=i.channels,h=i.groups;d&&Object.keys(d).forEach((function(e){s.permissions.patterns.uuids[e]=a(d[e])})),p&&Object.keys(p).forEach((function(e){s.permissions.patterns.channels[e]=a(p[e])})),h&&Object.keys(h).forEach((function(e){s.permissions.patterns.groups[e]=a(h[e])}))}(n||0===n)&&(s.ttl=n);o&&(s.permissions.meta=o);u&&(s.permissions.uuid="".concat(u));return s}(0,t)},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.prepareParams=function(){return{}},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(!t.resources&&!t.patterns)return"Missing either Resources or Patterns.";if(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))return"Missing values for either Resources or Patterns."};n(2);var i=r(n(1));function a(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNPublishOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,a=u(e,i);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(a))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){var n=t.message;return u(e,n)},t.postURL=function(e,t){var n=e.config,r=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0")},t.prepareParams=function(e,t){var n=t.meta,r=t.replicate,a=void 0===r||r,o=t.storeInHistory,u=t.ttl,s={};null!=o&&(s.store=o?"1":"0");u&&(s.ttl=u);!1===a&&(s.norep="true");n&&"object"===(0,i.default)(n)&&(s.meta=JSON.stringify(n));return s},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};var i=r(n(7)),a=(n(2),r(n(1))),o=r(n(3));function u(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSignalOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,o=(u=i,JSON.stringify(u));var u;return"/signal/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0/").concat(a.default.encodeString(o))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHistoryOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v2/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};Array.isArray(t[0])&&t[0].forEach((function(t){var r={timetoken:t.timetoken,entry:o(e,t.message)};t.meta&&(r.meta=t.meta),n.messages.push(r)}));return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.reverse,a=t.count,o=void 0===a?100:a,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f={include_token:"true"};f.count=o,n&&(f.start=n);r&&(f.end=r);s&&(f.string_message_token="true");null!=i&&(f.reverse=i.toString());l&&(f.include_meta="true");return f},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3));function o(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v3/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i={};n&&(i.start=n);r&&(i.end=r);return i},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNMessageCounts},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(o.default.encodeString(i))},t.handleResponse=function(e,t){return{channels:t.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,r=t.channelTimetokens,a={};if(r&&1===r.length){var o=(0,i.default)(r,1)[0];a.timetoken=o}else r?a.channelsTimetoken=r.join(","):n&&(a.timetoken=n);return a},t.validateParams=function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,a=e.config;if(!n)return"Missing channel";if(r&&i)return"timetoken and channelTimetokens are incompatible together";if(r&&i&&i.length>1&&n.length!==i.length)return"Length of channelTimetokens and channels do not match";if(!a.subscribeKey)return"Missing Subscribe Key"};var i=r(n(9)),a=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNFetchMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.includeMessageActions,o=void 0!==i&&i,u=e.config,s=o?"history-with-actions":"history",c=r.length>0?r.join(","):",";return"/v3/".concat(s,"/sub-key/").concat(u.subscribeKey,"/channel/").concat(a.default.encodeString(c))},t.handleResponse=function(e,t){var n={channels:{}};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);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,r=t.start,i=t.end,a=t.includeMessageActions,o=t.count,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f=t.includeUuid,d=t.includeUUID,p=void 0===d||d,h=t.includeMessageType,g=void 0===h||h,v={};v.max=o||(n.length>1||!0===a?25:100);r&&(v.start=r);i&&(v.end=i);s&&(v.string_message_token="true");l&&(v.include_meta="true");p&&!1!==f&&(v.include_uuid="true");g&&(v.include_message_type="true");return v},t.validateParams=function(e,t){var n=t.channels,r=t.includeMessageActions,i=void 0!==r&&r,a=e.config;if(!n||0===n.length)return"Missing channels";if(!a.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.")};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSubscribeOperation},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.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(a.default.encodeString(o),"/0")},t.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}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,r=t.state,i=t.channelGroups,a=void 0===i?[]:i,o=t.timetoken,u=t.filterExpression,s=t.region,c={heartbeat:n.getPresenceTimeout()};a.length>0&&(c["channel-group"]=a.join(","));u&&u.length>0&&(c["filter-expr"]=u);Object.keys(r).length&&(c.state=JSON.stringify(r));o&&(c.tt=o);s&&(c.tr=s);return c},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),r(n(10))),s=(n(2),function(){function e(t){var n=this;(0,i.default)(this,e),(0,o.default)(this,"_modules",void 0),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"_currentSubDomain",void 0),(0,o.default)(this,"_standardOrigin",void 0),(0,o.default)(this,"_subscribeOrigin",void 0),(0,o.default)(this,"_requestTimeout",void 0),(0,o.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,a.default)(e,[{key:"init",value: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()}},{key:"nextOrigin",value: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)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"PATCH",value:function(e,t,n,r){return this._modules.patch(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=function(){function e(){(0,i.default)(this,e),(0,o.default)(this,"storage",void 0),this.storage={}}return(0,a.default)(e,[{key:"get",value:function(e){return this.storage[e]}},{key:"set",value:function(e,t){this.storage[e]=t}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(5)),o=r(n(6)),u=r(n(4)),s=function(){function e(t,n){(0,a.default)(this,e),(0,u.default)(this,"_base64ToBinary",void 0),(0,u.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,o.default)(e,[{key:"decodeToken",value: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"===(0,i.default)(r))return r}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.del=function(e,t,n){var r=i(),a=this.getStandardOrigin()+t.url;return o.call(this,r,"DELETE",a,e,{},t,n)},t.get=function(e,t,n){var r=i(),a=this.getStandardOrigin()+t.url;return o.call(this,r,"GET",a,e,{},t,n)},t.patch=function(e,t,n,r){var a=i(),u=this.getStandardOrigin()+n.url;return o.call(this,a,"PATCH",u,e,JSON.parse(t),n,r)},t.post=function(e,t,n,r){var a=i(),u=this.getStandardOrigin()+n.url;return o.call(this,a,"POST",u,e,JSON.parse(t),n,r)};n(2);var r=n(118);function i(){return"mobileweb"===Ti.Platform.osname?new XMLHttpRequest:Ti.Network.createHTTPClient()}function a(e){"mobileweb"!==Ti.Platform.osname&&this._config.keepAlive&&(e.enableKeepAlive=!0)}function o(e,t,n,i,o,u,s){var c=this,l={};l.operation=u.operation,e.open(t,(0,r.buildUrl)(n,i),!0),a.call(this,e),e.onload=function(){l.error=!1,e.status&&(l.statusCode=e.status);var t=JSON.parse(e.responseText);return c._config.logVerbosity&&function(e,t,n){var r=(new Date).getTime(),i=(new Date).toISOString(),a=Ti&&Ti.API&&Ti.API.log?Ti.API:console;a.log("<<<<<"),a.log("[".concat(i,"]"),"\n",e,"\n",t),a.log("-----");var o=(new Date).getTime()-r,u=(new Date).toISOString();a.log(">>>>>>"),a.log("[".concat(u," / ").concat(o,"]"),"\n",e,"\n",t,"\n",n),a.log("-----")}(n,i,e.responseText),s(l,t)},e.onerror=function(e){return l.error=!0,l.errorData=e.error,l.category=c._detectErrorCategory(e.error),s(l,null)},e.timeout="android"===Ti.Platform.osname?2147483647:1/0,e.send(o)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.buildUrl=function(e,t){var n=[];return Object.keys(t).forEach((function(e){a(n,e,t[e])})),"".concat(e,"?").concat(n.join("&"))},t.encodedKeyValuePair=a;var i=r(n(7));function a(e,t,n){null!=n?Array.isArray(n)?n.forEach((function(n){a(e,t,n)})):"object"===(0,i.default)(n)?Object.keys(n).forEach((function(r){a(e,"".concat(t,"[").concat(r,"]"),n[r])})):e.push("".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n))):null===n&&e.push(encodeURIComponent("".concat(encodeURIComponent(t))))}}]),module.exports=exports.PubNub; \ No newline at end of file +/*! 5.0.0 / Consumer */ +exports.PubNub=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=23)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={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"},e.exports=t.default},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";function r(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function i(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var a="The Objects v1 API has been deprecated.\nYou can learn more about Objects v2 API at https://www.pubnub.com/docs/web-javascript/api-reference-objects.\nIf you have questions about the Objects v2 API or require additional help with migrating to the new data model, please contact PubNub Support at support@pubnub.com.";e.exports={signPamFromParams:function(e){return i(e).map((function(t){return"".concat(t,"=").concat(r(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:r,deprecated:function(e){return function(){var t,n;"undefined"!=typeof process&&("test"!==(null===(t=process)||void 0===t||null===(n=t.env)||void 0===n?void 0:"production")&&console.warn(a));return e.apply(void 0,arguments)}}}},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n=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}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"5.0.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,r){return n+e+t._PNSDKSuffix[r]}),"")}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){var r=n(69),i=n(70),a=n(71),o=n(73);e.exports=function(e,t){return r(e)||i(e,t)||a(e,t)||o()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(7).default,i=n(17);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(26)),a={createUUID:function(){return i.default.uuid?i.default.uuid():(0,i.default)()}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.PubNubError=void 0,t.createValidationError=b,t.default=function(e,t){var n=e.networking,r=e.config,i=e.telemetryManager,a=e.tokenManager,o=l.default.createUUID(),u=null,s=null,c={};t.getOperation()===d.default.PNTimeOperation||t.getOperation()===d.default.PNChannelGroupsOperation?u=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],u=arguments.length<=3?void 0:arguments[3]);"undefined"==typeof Promise||u||(s=f.default.createPromise());var h=t.validateParams(e,c);if(h)return u?u(b(h)):s?(s.reject(new y("Validation failed, check status for details",b(h))),s.promise):void 0;var v,k=t.prepareParams(e,c),S=m(t,e,c),M={url:S,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,c):null};k.uuid=r.UUID,k.pnsdk=_(r);var T=i.operationsLatencyForRequest();Object.keys(T).length&&(k=g(g({},k),T));r.useInstanceId&&(k.instanceid=r.instanceId);r.useRequestId&&(k.requestid=o);if(t.isAuthSupported()){var x=a.getToken()||r.getAuthKey();x&&(k.auth=x)}r.secretKey&&O(e,S,k,c,t);var w=function(n,r){var a;if(n.error)return t.handleError&&t.handleError(e,c,n),void(u?u(n):s&&s.reject(new y("PubNub call failed, check status for details",n)));i.stopLatencyMeasure(t.getOperation(),o);var l=t.handleResponse(e,r,c);"function"!=typeof(null===(a=l)||void 0===a?void 0:a.then)&&(l=Promise.resolve(l)),l.then((function(e){u?u(n,e):s&&s.fulfill(e)})).catch((function(e){if(u){var n=e;t.getOperation()===d.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),u(n,null)}else s&&s.reject(new y("PubNub call failed, check status for details",e))}))};if(i.startLatencyMeasure(t.getOperation(),o),"POST"===P(e,t,c)){var N=t.postPayload(e,c);v=n.POST(k,N,M,w)}else if("PATCH"===P(e,t,c)){var j=t.patchPayload(e,c);v=n.PATCH(k,j,M,w)}else v="DELETE"===P(e,t,c)?n.DELETE(k,M,w):"GETFILE"===P(e,t,c)?n.GETFILE(k,M,w):n.GET(k,M,w);if(t.getOperation()===d.default.PNSubscribeOperation)return v;if(s)return s.promise},t.generatePNSDK=_,t.signRequest=O;var i=r(n(4)),a=r(n(5)),o=r(n(12)),u=r(n(14)),s=r(n(11)),c=r(n(36)),l=r(n(15)),f=(n(2),r(n(3))),d=(r(n(8)),r(n(1))),p=r(n(10));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function g(e){for(var t=1;t0&&(t+=n),t}function P(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 O(e,t,n,r,i){var a=e.config,o=e.crypto,u=P(e,i,r);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===i.getOperation()&&i.usePost&&i.usePost(e,r)&&(u="GET"),"GETFILE"===u&&(u="GET");var s="".concat(u,"\n").concat(a.publishKey,"\n").concat(t,"\n").concat(f.default.signPamFromParams(n),"\n");if("POST"===u){var c=i.postPayload(e,r);s+="string"==typeof c?c:JSON.stringify(c)}else if("PATCH"===u){var l=i.patchPayload(e,r);s+="string"==typeof l?l:JSON.stringify(l)}var d="v2.".concat(o.HMACSHA256(s));d=(d=(d=d.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=d}t.PubNubError=y},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),r(n(27)));function s(e){var t,n=[];for(t=0;t>10,n=1023&e,r=32768&e;if(31===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-25)*(1024+n):Math.pow(2,-24)*n;return r?-i:i},readFloat32:function(){var e=this.readUint32(),t=(2147483647&e)>>23,n=8388607&e,r=2147483648&e;if(255===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-23-127)*(8388608+n):Math.pow(2,-149)*n;return r?-i:i},readFloat64:function(){var e=this.readUint32(),t=e>>20&2047,n=4294967296*(1048575&e)+this.readUint32(),r=2147483648&e;if(2047===t)return 0===n?r?-1/0:1/0:NaN;var i=t?Math.pow(2,t-52-1023)*(4503599627370496+n):Math.pow(2,-1074)*n;return r?-i:i},readUint16:function(){return 256*this.readByte()+this.readByte()},readUint32:function(){return 65536*this.readUint16()+this.readUint16()},readUint64:function(){return 4294967296*this.readUint32()+this.readUint32()}},a.prototype={writeByte:r("writeByte"),result:r("result"),writeFloat16:r("writeFloat16"),writeFloat32:r("writeFloat32"),writeFloat64:r("writeFloat64"),writeUint16:function(e){this.writeByte(e>>8&255),this.writeByte(255&e)},writeUint32:function(e){this.writeUint16(e>>16&65535),this.writeUint16(65535&e)},writeUint64:function(e){if(e>=9007199254740992||e<=-9007199254740992)throw new Error("Cannot encode Uint64 of: "+e+" magnitude to big (floating point errors)");this.writeUint32(Math.floor(e/4294967296)),this.writeUint32(e%4294967296)},writeString:r("writeString"),canWriteBinary:function(e){return!1},writeBinary:r("writeChunk")};var s=new Error;function c(e){var t=function(e){var t=e.readByte();return{type:t>>5,value:31&t}}(e);switch(t.type){case 0:return o(t,e);case 1:return-1-o(t,e);case 2:return e.readChunk(o(t,e));case 3:return e.readChunk(o(t,e)).toString("utf-8");case 4:case 5:var r=o(t,e),i=[];if(null!==r){5===t.type&&(r*=2);for(var a=0;a-9007199254740992?e<0?u(1,-1-e,n):u(0,e,n):(function(e,t,n){n.writeByte(e<<5|t)}(7,27,n),n.writeFloat64(e));else if("string"==typeof e)n.writeString(e,(function(e){u(3,e,n)}));else if(n.canWriteBinary(e))n.writeBinary(e,(function(e){u(2,e,n)}));else{if("object"!=typeof e)throw new Error("CBOR encoding not supported: "+e);if(p.config.useToJSON&&"function"==typeof e.toJSON&&(e=e.toJSON()),Array.isArray(e))for(u(4,e.length,n),r=0;r=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0),this.byteLength++},g.prototype.writeFloat32=function(e){var t=Buffer.alloc(4);t.writeFloatBE(e,0),this.writeBuffer(t)},g.prototype.writeFloat64=function(e){var t=Buffer.alloc(8);t.writeDoubleBE(e,0),this.writeBuffer(t)},g.prototype.writeString=function(e,t){var n=Buffer.from(e,"utf-8");t(n.length),this.writeBuffer(n)},g.prototype.canWriteBinary=function(e){return e instanceof Buffer},g.prototype.writeBinary=function(e,t){t(e.length),this.writeBuffer(e)},g.prototype.writeBuffer=function(e){if(!(e instanceof Buffer))throw new TypeError("BufferWriter only accepts Buffers");this.latestBufferOffset?this.latestBuffer.length-this.latestBufferOffset>=e.length?(e.copy(this.latestBuffer,this.latestBufferOffset),this.latestBufferOffset+=e.length,this.latestBufferOffset>=this.latestBuffer.length&&(this.completeBuffers.push(this.latestBuffer),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0)):(this.completeBuffers.push(this.latestBuffer.slice(0,this.latestBufferOffset)),this.completeBuffers.push(e),this.latestBuffer=Buffer.alloc(this.defaultBufferLength),this.latestBufferOffset=0):this.completeBuffers.push(e),this.byteLength+=e.length},g.prototype.result=function(){for(var e=Buffer.alloc(this.byteLength),t=0,n=0;n255)throw new Error("Byte value out of range: "+e);var t=e.toString(16);1==t.length&&(t="0"+t),this.$hex+=t},y.prototype.canWriteBinary=function(t){return t instanceof e||"function"==typeof Buffer&&t instanceof Buffer},y.prototype.writeBinary=function(t,n){if(t instanceof e)n(t.length()),this.$hex+=t.$hex;else{if(!("function"==typeof Buffer&&t instanceof Buffer))throw new TypeError("HexWriter only accepts BinaryHex or Buffers");n(t.length),this.$hex+=t.toString("hex")}},y.prototype.result=function(){return"buffer"===this.finalFormat&&"function"==typeof Buffer?Buffer.from(this.$hex,"hex"):new e(this.$hex).toString(this.finalFormat)},y.prototype.writeString=function(t,n){var r=e.fromUtf8String(t);n(r.length()),this.$hex+=r.$hex},p.addReader((function(t,n){return t instanceof e||t.$hex?new v(t.$hex):"hex"===n?new v(t):void 0})),p.addWriter((function(e){if("hex"===e)return new y})),p}();return e.addSemanticEncode(0,(function(e){if(e instanceof Date)return e.toISOString()})).addSemanticDecode(0,(function(e){return new Date(e)})).addSemanticDecode(1,(function(e){return new Date(e)})),e})?r.apply(t,i):r)||(e.exports=a)},function(e,t,n){"use strict";var r=n(0),i=n(7);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=r(n(5)),o=r(n(6)),u=r(n(4)),s=r(n(8)),c=r(n(18)),l=r(n(28)),f=r(n(31)),d=r(n(32)),p=r(n(19)),h=r(n(35)),g=r(n(16)),v=n(3),y=Ee(n(40)),b=Ee(n(41)),m=Ee(n(42)),_=Ee(n(43)),P=Ee(n(44)),O=Ee(n(45)),k=Ee(n(46)),S=Ee(n(47)),M=Ee(n(48)),T=Ee(n(49)),x=Ee(n(50)),w=Ee(n(51)),N=Ee(n(52)),j=Ee(n(53)),U=Ee(n(54)),C=Ee(n(55)),R=Ee(n(56)),E=Ee(n(57)),A=(n(58),Ee(n(59)),r(n(60))),K=r(n(61)),F=r(n(62)),I=r(n(63)),B=r(n(65)),D=r(n(66)),G=r(n(67)),L=r(n(68)),q=r(n(74)),H=r(n(75)),z=r(n(76)),V=r(n(77)),W=r(n(78)),$=r(n(79)),J=r(n(80)),X=r(n(81)),Y=r(n(82)),Q=r(n(83)),Z=r(n(84)),ee=Ee(n(85)),te=Ee(n(86)),ne=Ee(n(87)),re=Ee(n(88)),ie=Ee(n(89)),ae=Ee(n(90)),oe=Ee(n(91)),ue=Ee(n(92)),se=Ee(n(93)),ce=Ee(n(94)),le=Ee(n(95)),fe=Ee(n(96)),de=Ee(n(97)),pe=Ee(n(98)),he=Ee(n(99)),ge=Ee(n(100)),ve=Ee(n(101)),ye=Ee(n(102)),be=Ee(n(103)),me=Ee(n(104)),_e=Ee(n(105)),Pe=r(n(106)),Oe=Ee(n(107)),ke=Ee(n(108)),Se=Ee(n(109)),Me=Ee(n(110)),Te=Ee(n(111)),xe=Ee(n(112)),we=Ee(n(20)),Ne=Ee(n(113)),je=r(n(1)),Ue=r(n(10)),Ce=(n(2),r(n(15)));function Re(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(Re=function(e){return e?n:t})(e)}function Ee(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==i(e)&&"function"!=typeof e)return{default:e};var n=Re(t);if(n&&n.has(e))return n.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var u=a?Object.getOwnPropertyDescriptor(e,o):null;u&&(u.get||u.set)?Object.defineProperty(r,o,u):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function Ae(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Ke(e){for(var t=1;t1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>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=a.clone.call(this);return e.words=this.words.slice(0),e},random:function(t){for(var n=[],r=0;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>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new o.init(n,t/2)}},c=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new o.init(n,t)}},l=u.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)))}},f=r.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.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,a=this.blockSize,u=i/(4*a);if(t=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*a,i=e.min(4*t,i),t){for(var s=0;sl;){var f;e:{f=c;for(var d=e.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>l&&(a[l]=u(e.pow(c,.5))),o[l]=u(e.pow(c,1/3)),l++),c++}var h=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(a.slice(0))},_doProcessBlock:function(e,t){for(var n=this._hash.words,r=n[0],i=n[1],a=n[2],u=n[3],s=n[4],c=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)h[d]=0|e[t+d];else{var p=h[d-15],g=h[d-2];h[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+h[d-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+h[d-16]}p=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&l)+o[d]+h[d],g=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&a^i&a),f=l,l=c,c=s,s=u+p|0,u=a,a=i,i=r,r=p+g|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+a|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|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),i=(r=s).enc.Utf8,r.algo.HMAC=r.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var a=this._oKey=t.clone(),o=this._iKey=t.clone(),u=a.words,s=o.words,c=0;c>>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,o=0;4>o&&i+.75*o>>6*(3-o)&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,a=0;a>>6-a%4*2;r[i>>>2]|=(u|s)<<24-i%4*8,i++}return o.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,r,i,a,o){return((e=e+(t&n|~t&r)+i+o)<>>32-a)+t}function n(e,t,n,r,i,a,o){return((e=e+(t&r|n&~r)+i+o)<>>32-a)+t}function r(e,t,n,r,i,a,o){return((e=e+(t^n^r)+i+o)<>>32-a)+t}function i(e,t,n,r,i,a,o){return((e=e+(n^(t|~r))+i+o)<>>32-a)+t}for(var a=s,o=(c=a.lib).WordArray,u=c.Hasher,c=a.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new o.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,a){for(var o=0;16>o;o++){var u=e[s=a+o];e[s]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}o=this._hash.words;var s=e[a+0],c=(u=e[a+1],e[a+2]),f=e[a+3],d=e[a+4],p=e[a+5],h=e[a+6],g=e[a+7],v=e[a+8],y=e[a+9],b=e[a+10],m=e[a+11],_=e[a+12],P=e[a+13],O=e[a+14],k=e[a+15],S=t(S=o[0],x=o[1],T=o[2],M=o[3],s,7,l[0]),M=t(M,S,x,T,u,12,l[1]),T=t(T,M,S,x,c,17,l[2]),x=t(x,T,M,S,f,22,l[3]);S=t(S,x,T,M,d,7,l[4]),M=t(M,S,x,T,p,12,l[5]),T=t(T,M,S,x,h,17,l[6]),x=t(x,T,M,S,g,22,l[7]),S=t(S,x,T,M,v,7,l[8]),M=t(M,S,x,T,y,12,l[9]),T=t(T,M,S,x,b,17,l[10]),x=t(x,T,M,S,m,22,l[11]),S=t(S,x,T,M,_,7,l[12]),M=t(M,S,x,T,P,12,l[13]),T=t(T,M,S,x,O,17,l[14]),S=n(S,x=t(x,T,M,S,k,22,l[15]),T,M,u,5,l[16]),M=n(M,S,x,T,h,9,l[17]),T=n(T,M,S,x,m,14,l[18]),x=n(x,T,M,S,s,20,l[19]),S=n(S,x,T,M,p,5,l[20]),M=n(M,S,x,T,b,9,l[21]),T=n(T,M,S,x,k,14,l[22]),x=n(x,T,M,S,d,20,l[23]),S=n(S,x,T,M,y,5,l[24]),M=n(M,S,x,T,O,9,l[25]),T=n(T,M,S,x,f,14,l[26]),x=n(x,T,M,S,v,20,l[27]),S=n(S,x,T,M,P,5,l[28]),M=n(M,S,x,T,c,9,l[29]),T=n(T,M,S,x,g,14,l[30]),S=r(S,x=n(x,T,M,S,_,20,l[31]),T,M,p,4,l[32]),M=r(M,S,x,T,v,11,l[33]),T=r(T,M,S,x,m,16,l[34]),x=r(x,T,M,S,O,23,l[35]),S=r(S,x,T,M,u,4,l[36]),M=r(M,S,x,T,d,11,l[37]),T=r(T,M,S,x,g,16,l[38]),x=r(x,T,M,S,b,23,l[39]),S=r(S,x,T,M,P,4,l[40]),M=r(M,S,x,T,s,11,l[41]),T=r(T,M,S,x,f,16,l[42]),x=r(x,T,M,S,h,23,l[43]),S=r(S,x,T,M,y,4,l[44]),M=r(M,S,x,T,_,11,l[45]),T=r(T,M,S,x,k,16,l[46]),S=i(S,x=r(x,T,M,S,c,23,l[47]),T,M,s,6,l[48]),M=i(M,S,x,T,g,10,l[49]),T=i(T,M,S,x,O,15,l[50]),x=i(x,T,M,S,p,21,l[51]),S=i(S,x,T,M,_,6,l[52]),M=i(M,S,x,T,f,10,l[53]),T=i(T,M,S,x,b,15,l[54]),x=i(x,T,M,S,u,21,l[55]),S=i(S,x,T,M,v,6,l[56]),M=i(M,S,x,T,k,10,l[57]),T=i(T,M,S,x,h,15,l[58]),x=i(x,T,M,S,P,21,l[59]),S=i(S,x,T,M,d,6,l[60]),M=i(M,S,x,T,m,10,l[61]),T=i(T,M,S,x,c,15,l[62]),x=i(x,T,M,S,y,21,l[63]);o[0]=o[0]+S|0,o[1]=o[1]+x|0,o[2]=o[2]+T|0,o[3]=o[3]+M|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 a=e.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(a<<8|a>>>24)|4278255360&(a<<24|a>>>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=u.clone.call(this);return e._hash=this._hash.clone(),e}}),a.MD5=u._createHelper(c),a.HmacMD5=u._createHmacHelper(c)}(Math),function(){var e,t=s,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=(u=this.cfg).hasher.create(),i=r.create(),a=i.words,o=u.keySize,u=u.iterations;a.length>>2]}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:c,padding:f}),reset:function(){u.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 d=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(c=(h.format={}).OpenSSL={stringify:function(e){var t=e.ciphertext;return((e=e.salt)?r.create([1398893684,1701076831]).concat(e).concat(t):t).toString(a)},parse:function(e){var t=(e=a.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 d.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:c}),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,d.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}})),h=(h.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=o.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:i})}},g=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),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=p.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,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=s,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],a=[],o=[],u=[],c=[],l=[],f=[],d=[],p=[],h=[],g=0;256>g;g++)h[g]=128>g?g<<1:g<<1^283;var v=0,y=0;for(g=0;256>g;g++){var b=(b=y^y<<1^y<<2^y<<3^y<<4)>>>8^255&b^99;r[v]=b,i[b]=v;var m=h[v],_=h[m],P=h[_],O=257*h[b]^16843008*b;a[v]=O<<24|O>>>8,o[v]=O<<16|O>>>16,u[v]=O<<8|O>>>24,c[v]=O,O=16843009*P^65537*_^257*m^16843008*v,l[b]=O<<24|O>>>8,f[b]=O<<16|O>>>16,d[b]=O<<8|O>>>24,p[b]=O,v?(v=m^h[h[h[P^m]]],y^=h[h[y]]):v=y=1}var k=[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=[],a=0;a>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[255&o]):(o=r[(o=o<<8|o>>>24)>>>24]<<24|r[o>>>16&255]<<16|r[o>>>8&255]<<8|r[255&o],o^=k[a/t|0]<<24),i[a]=i[a-t]^o}for(e=this._invKeySchedule=[],t=0;tt||4>=a?o:l[r[o>>>24]]^f[r[o>>>16&255]]^d[r[o>>>8&255]]^p[r[255&o]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,a,o,u,c,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,l,f,d,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,a,o,u){for(var s=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],d=e[t+3]^n[3],p=4,h=1;h>>24]^i[l>>>16&255]^a[f>>>8&255]^o[255&d]^n[p++],v=r[l>>>24]^i[f>>>16&255]^a[d>>>8&255]^o[255&c]^n[p++],y=r[f>>>24]^i[d>>>16&255]^a[c>>>8&255]^o[255&l]^n[p++];d=r[d>>>24]^i[c>>>16&255]^a[l>>>8&255]^o[255&f]^n[p++],c=g,l=v,f=y}g=(u[c>>>24]<<24|u[l>>>16&255]<<16|u[f>>>8&255]<<8|u[255&d])^n[p++],v=(u[l>>>24]<<24|u[f>>>16&255]<<16|u[d>>>8&255]<<8|u[255&c])^n[p++],y=(u[f>>>24]<<24|u[d>>>16&255]<<16|u[c>>>8&255]<<8|u[255&l])^n[p++],d=(u[d>>>24]<<24|u[c>>>16&255]<<16|u[l>>>8&255]<<8|u[255&f])^n[p++],e[t]=g,e[t+1]=v,e[t+2]=y,e[t+3]=d},keySize:8});e.AES=t._createHelper(n)}(),s.mode.ECB=((u=s.lib.BlockCipherMode.extend()).Encryptor=u.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),u.Decryptor=u.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),u),e.exports=s},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(5)),o=r(n(6)),u=r(n(4)),s=(r(n(18)),r(n(8)),r(n(19)),r(n(29))),c=r(n(30)),l=r(n(3)),f=(n(2),r(n(10))),d=function(){function e(t){var n=t.subscribeEndpoint,r=t.leaveEndpoint,i=t.heartbeatEndpoint,o=t.setStateEndpoint,l=t.timeEndpoint,f=t.getFileUrl,d=t.config,p=t.crypto,h=t.listenerManager;(0,a.default)(this,e),(0,u.default)(this,"_crypto",void 0),(0,u.default)(this,"_config",void 0),(0,u.default)(this,"_listenerManager",void 0),(0,u.default)(this,"_reconnectionManager",void 0),(0,u.default)(this,"_leaveEndpoint",void 0),(0,u.default)(this,"_heartbeatEndpoint",void 0),(0,u.default)(this,"_setStateEndpoint",void 0),(0,u.default)(this,"_subscribeEndpoint",void 0),(0,u.default)(this,"_getFileUrl",void 0),(0,u.default)(this,"_channels",void 0),(0,u.default)(this,"_presenceChannels",void 0),(0,u.default)(this,"_heartbeatChannels",void 0),(0,u.default)(this,"_heartbeatChannelGroups",void 0),(0,u.default)(this,"_channelGroups",void 0),(0,u.default)(this,"_presenceChannelGroups",void 0),(0,u.default)(this,"_currentTimetoken",void 0),(0,u.default)(this,"_lastTimetoken",void 0),(0,u.default)(this,"_storedTimetoken",void 0),(0,u.default)(this,"_region",void 0),(0,u.default)(this,"_subscribeCall",void 0),(0,u.default)(this,"_heartbeatTimer",void 0),(0,u.default)(this,"_subscriptionStatusAnnounced",void 0),(0,u.default)(this,"_autoNetworkDetection",void 0),(0,u.default)(this,"_isOnline",void 0),(0,u.default)(this,"_pendingChannelSubscriptions",void 0),(0,u.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,u.default)(this,"_dedupingManager",void 0),this._listenerManager=h,this._config=d,this._leaveEndpoint=r,this._heartbeatEndpoint=i,this._setStateEndpoint=o,this._subscribeEndpoint=n,this._getFileUrl=f,this._crypto=p,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 s.default({timeEndpoint:l}),this._dedupingManager=new c.default({config:d})}return(0,o.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,r=e.state,i=e.channels,a=void 0===i?[]:i,o=e.channelGroups,u=void 0===o?[]:o;return a.forEach((function(e){e in n._channels&&(n._channels[e].state=r)})),u.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)})),this._setStateEndpoint({state:r,channels:a,channelGroups:u},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a;n?(i.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),o.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(i.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),o.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:o},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a,u=e.withPresence,s=void 0!==u&&u,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:{}},s&&(t._presenceChannels[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),o.forEach((function(e){t._channelGroups[e]={state:{}},s&&(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")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,a=e.channelGroups,o=void 0===a?[]:a,u=[],s=[];i.forEach((function(e){e in n._channels&&(delete n._channels[e],u.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],u.push(e))})),o.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],s.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],s.push(e))})),0===u.length&&0===s.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:u,channelGroups:s},(function(e){e.affectedChannels=u,e.affectedChannelGroups=s,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())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value: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()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value: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))}}},{key:"_startSubscribeLoop",value: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))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===f.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===f.default.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:f.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===f.default.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=f.default.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 a=t.messages||[],o=this._config,u=o.requestMessageCountThreshold,s=o.dedupeOnSubscribe;if(u&&a.length>=u){var c={};c.category=f.default.PNRequestMessageCountExceededCategory,c.operation=e.operation,this._listenerManager.announceStatus(c)}a.forEach((function(e){var t=e.channel,r=e.subscriptionMatch,a=e.publishMetaData;if(t===r&&(r=null),s){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(l.default.endsWith(e.channel,"-pnpres")){var o={channel:null,subscription:null};o.actualChannel=null!=r?t:null,o.subscribedChannel=null!=r?r:t,t&&(o.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(o.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),o.action=e.payload.action,o.state=e.payload.data,o.timetoken=a.publishTimetoken,o.occupancy=e.payload.occupancy,o.uuid=e.payload.uuid,o.timestamp=e.payload.timestamp,e.payload.join&&(o.join=e.payload.join),e.payload.leave&&(o.leave=e.payload.leave),e.payload.timeout&&(o.timeout=e.payload.timeout),n._listenerManager.announcePresence(o)}else if(1===e.messageType){var u={channel:null,subscription:null};u.channel=t,u.subscription=r,u.timetoken=a.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=e.payload,n._listenerManager.announceSignal(u)}else if(2===e.messageType){var c={channel:null,subscription:null};c.channel=t,c.subscription=r,c.timetoken=a.publishTimetoken,c.publisher=e.issuingClientId,e.userMetadata&&(c.userMetadata=e.userMetadata),c.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(c),"user"===e.payload.type?n._listenerManager.announceUser(c):"space"===e.payload.type?n._listenerManager.announceSpace(c):"membership"===e.payload.type&&n._listenerManager.announceMembership(c)}else if(3===e.messageType){var f={};f.channel=t,f.subscription=r,f.timetoken=a.publishTimetoken,f.publisher=e.issuingClientId,f.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},f.event=e.payload.event,n._listenerManager.announceMessageAction(f)}else if(4===e.messageType){var d={};d.channel=t,d.subscription=r,d.timetoken=a.publishTimetoken,d.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var h=n._crypto.decrypt(e.payload);"object"===(0,i.default)(h)&&null!==h&&(p=h)}e.userMetadata&&(d.userMetadata=e.userMetadata),d.message=p.message,d.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(d)}else{var g={channel:null,subscription:null};g.actualChannel=null!=r?t:null,g.subscribedChannel=null!=r?r:t,g.channel=t,g.subscription=r,g.timetoken=a.publishTimetoken,g.publisher=e.issuingClientId,e.userMetadata&&(g.userMetadata=e.userMetadata),n._config.cipherKey?g.message=n._crypto.decrypt(e.payload):g.message=e.payload,n._listenerManager.announceMessage(g)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(20)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,i.default)(this,e),(0,o.default)(this,"_reconnectionCallback",void 0),(0,o.default)(this,"_timeEndpoint",void 0),(0,o.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,a.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),n(2),function(){function e(t){var n=t.config;(0,i.default)(this,e),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,a.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=r(n(1)),s=function(){function e(t){(0,i.default)(this,e),(0,o.default)(this,"_maximumSamplesCount",100),(0,o.default)(this,"_trackedLatencies",{}),(0,o.default)(this,"_latencies",{}),this._maximumSamplesCount=t.maximumSamplesCount||this._maximumSamplesCount}return(0,a.default)(e,[{key:"operationsLatencyForRequest",value: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}},{key:"startLatencyMeasure",value:function(e,t){e!==u.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==u.default.PNSubscribeOperation&&t){var n=this._endpointName(e),r=this._latencies[n],i=this._trackedLatencies[t];r||(r=this._latencies[n]=[]),r.push(Date.now()-i),r.length>this._maximumSamplesCount&&r.splice(0,r.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case u.default.PNPublishOperation:t="pub";break;case u.default.PNSignalOperation:t="sig";break;case u.default.PNHistoryOperation:case u.default.PNFetchMessagesOperation:case u.default.PNDeleteMessagesOperation:case u.default.PNMessageCounts:t="hist";break;case u.default.PNUnsubscribeOperation:case u.default.PNWhereNowOperation:case u.default.PNHereNowOperation:case u.default.PNHeartbeatOperation:case u.default.PNSetStateOperation:case u.default.PNGetStateOperation:t="pres";break;case u.default.PNAddChannelsToGroupOperation:case u.default.PNRemoveChannelsFromGroupOperation:case u.default.PNChannelGroupsOperation:case u.default.PNRemoveGroupOperation:case u.default.PNChannelsForGroupOperation:t="cg";break;case u.default.PNPushNotificationEnabledChannelsOperation:case u.default.PNRemoveAllPushNotificationsOperation:t="push";break;case u.default.PNCreateUserOperation:case u.default.PNUpdateUserOperation:case u.default.PNDeleteUserOperation:case u.default.PNGetUserOperation:case u.default.PNGetUsersOperation:case u.default.PNCreateSpaceOperation:case u.default.PNUpdateSpaceOperation:case u.default.PNDeleteSpaceOperation:case u.default.PNGetSpaceOperation:case u.default.PNGetSpacesOperation:case u.default.PNGetMembersOperation:case u.default.PNUpdateMembersOperation:case u.default.PNGetMembershipsOperation:case u.default.PNUpdateMembershipsOperation:t="obj";break;case u.default.PNAddMessageActionOperation:case u.default.PNRemoveMessageActionOperation:case u.default.PNGetMessageActionsOperation:t="msga";break;case u.default.PNAccessManagerGrant:case u.default.PNAccessManagerAudit:t="pam";break;case u.default.PNAccessManagerGrantToken:case u.default.PNAccessManagerRevokeToken:t="pamv3";break;default:t="time"}return t}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.MPNSNotificationPayload=t.FCMNotificationPayload=t.APNSNotificationPayload=void 0;var i=r(n(33)),a=r(n(17)),o=r(n(12)),u=r(n(14)),s=r(n(11)),c=r(n(5)),l=r(n(6)),f=r(n(4)),d=(n(2),["notification","data"]);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t2){var r=this._payload,a=(r.notification,r.data,(0,i.default)(r,d));e=h(h({},e),a)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}}]),n}(v);t.FCMNotificationPayload=m;var _=function(){function e(t,n){(0,c.default)(this,e),(0,f.default)(this,"_payload",void 0),(0,f.default)(this,"_debugging",void 0),(0,f.default)(this,"_subtitle",void 0),(0,f.default)(this,"_badge",void 0),(0,f.default)(this,"_sound",void 0),(0,f.default)(this,"_title",void 0),(0,f.default)(this,"_body",void 0),(0,f.default)(this,"apns",void 0),(0,f.default)(this,"mpns",void 0),(0,f.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new y(this._payload.apns,t,n),this.mpns=new b(this._payload.mpns,t,n),this.fcm=new m(this._payload.fcm,t,n)}return(0,l.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}},{key:"buildPayload",value: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}();t.default=_},function(e,t,n){var r=n(34);e.exports=function(e,t){if(null==e)return{};var n,i,a=r(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},a=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),n(2),function(){function e(t,n){(0,i.default)(this,e),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"_cbor",void 0),(0,o.default)(this,"_token",void 0),this._config=t,this._cbor=n}return(0,a.default)(e,[{key:"setToken",value:function(e){e&&e.length>0?this._token=e:this._token=void 0}},{key:"getToken",value:function(){return this._token}},{key:"extractPermissions",value: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}},{key:"parseToken",value: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),a=Object.keys(n.res.grp),o=n.pat.uuid?Object.keys(n.pat.uuid):[],u=Object.keys(n.pat.chan),s=Object.keys(n.pat.grp),c={version:n.v,timestamp:n.t,ttl:n.ttl,authorized_uuid:n.uuid},l=r.length>0,f=i.length>0,d=a.length>0;(l||f||d)&&(c.resources={},l&&(c.resources.uuids={},r.forEach((function(e){c.resources.uuids[e]=t.extractPermissions(n.res.uuid[e])}))),f&&(c.resources.channels={},i.forEach((function(e){c.resources.channels[e]=t.extractPermissions(n.res.chan[e])}))),d&&(c.resources.groups={},a.forEach((function(e){c.resources.groups[e]=t.extractPermissions(n.res.grp[e])}))));var p=o.length>0,h=u.length>0,g=s.length>0;return(p||h||g)&&(c.patterns={},p&&(c.patterns.uuids={},o.forEach((function(e){c.patterns.uuids[e]=t.extractPermissions(n.pat.uuid[e])}))),h&&(c.patterns.channels={},u.forEach((function(e){c.patterns.channels[e]=t.extractPermissions(n.pat.chan[e])}))),g&&(c.patterns.groups={},s.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}());t.default=u,e.exports=t.default},function(e,t,n){var r=n(11),i=n(13),a=n(37),o=n(38);function u(t){var n="function"==typeof Map?new Map:void 0;return e.exports=u=function(e){if(null===e||!a(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return o(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,u(t)}e.exports=u,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13),i=n(39);function a(t,n,o){return i()?(e.exports=a=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=a=function(e,t,n){var i=[null];i.push.apply(i,t);var a=new(Function.bind.apply(e,i));return n&&r(a,n.prototype),a},e.exports.default=e.exports,e.exports.__esModule=!0),a.apply(null,arguments)}e.exports=a,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAddChannelsToGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveChannelsFromGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n),"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelGroupsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.handleResponse=function(e,t){return{groups:t.payload.groups}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelsForGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,a=t.environment,o=void 0===a?"development":a,u=t.topic,s={type:n,add:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:o,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,a=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!a)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,a=t.environment,o=void 0===a?"development":a,u=t.topic,s={type:n,remove:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:o,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,a=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!a)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(e,t){return{channels:t}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,a=t.topic,o={type:n};"apns2"===n&&delete(o=Object.assign({},o,{environment:i,topic:a})).type;return o},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveAllPushNotificationsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n,"/remove");return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n,"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,a=t.topic,o={type:n};"apns2"===n&&delete(o=Object.assign({},o,{environment:i,topic:a})).type;return o},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUnsubscribeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/leave")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNWhereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(i))},t.handleResponse=function(e,t){if(!t.payload)return{channels:[]};return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHeartbeatOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/heartbeat")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,a=void 0===i?{}:i,o=e.config,u={};r.length>0&&(u["channel-group"]=r.join(","));return u.state=JSON.stringify(a),u.heartbeat=o.getPresenceTimeout(),u},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,o=t.channels,u=void 0===o?[]:o,s=u.length>0?u.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(a.default.encodeString(s),"/uuid/").concat(i)},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,a=n.channelGroups,o=void 0===a?[]:a,u={};1===i.length&&0===o.length?u[i[0]]=t.payload:u=t.payload;return{channels:u}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(o),"/uuid/").concat(a.default.encodeString(n.UUID),"/data")},t.handleResponse=function(e,t){return{state:t.payload}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,a={};a.state=JSON.stringify(n),i.length>0&&(a["channel-group"]=i.join(","));return a},t.validateParams=function(e,t){var n=e.config,r=t.state,i=t.channels,a=void 0===i?[]:i,o=t.channelGroups,u=void 0===o?[]:o;if(!r)return"Missing State";if(!n.subscribeKey)return"Missing Subscribe Key";if(0===a.length&&0===u.length)return"Please provide a list of channels and/or channel-groups"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNHereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=t.channelGroups,u=void 0===a?[]:a,s="/v2/presence/sub-key/".concat(n.subscribeKey);if(i.length>0||u.length>0){var c=i.length>0?i.join(","):",";s+="/channel/".concat(o.default.encodeString(c))}return s},t.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.")},t.handleResponse=function(e,t,n){var r,i=n.channels,a=void 0===i?[]:i,o=n.channelGroups,u=void 0===o?[]:o,s=n.includeUUIDs,c=void 0===s||s,l=n.includeState,f=void 0!==l&&l;r=a.length>1||u.length>0||0===u.length&&0===a.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},c&&r.uuids.forEach((function(e){f?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[a[0]]={occupants:n,name:a[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){f?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}();return r},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,a=void 0===i||i,o=t.includeState,u=void 0!==o&&o,c=t.queryParameters,l=void 0===c?{}:c,f={};a||(f.disable_uuids=1);u&&(f.state=1);r.length>0&&(f["channel-group"]=r.join(","));return f=s(s({},f),l)},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};var i=r(n(4)),a=(n(2),r(n(1))),o=r(n(3));function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t15)return"Action.type value exceed maximum length of 15"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveMessageActionOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(r),"/message/").concat(o,"/action/").concat(i)},t.handleResponse=function(e,t){return{data:t.data}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken;if(!t.messageTimetoken)return"Missing message timetoken";if(!i)return"Missing action timetoken";if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMessageActionsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,r=t.start,i=t.end,a={};n&&(a.limit=n);r&&(a.start=r);i&&(a.end=i);return a},t.validateParams=function(e,t){var n=e.config,r=t.channel;if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){},function(e,t,n){},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){if(null==t||!t.channel)return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(1)),o=r(n(3)),u={getOperation:function(){return a.default.PNPublishFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.fileId?null!=t&&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,a=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(o.default.encodeString(t.channel),"/0/").concat(o.default.encodeString(a))},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"===(0,i.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(21)),a=r(n(22)),o=n(16),u=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,r,s,c,l,f,d,p,h=(r=(t=e).generateUploadUrl,s=t.publishFile,c=t.modules,l=c.PubNubFile,f=c.config,d=c.cryptography,p=c.networking,n=(0,a.default)(i.default.mark((function e(t){var n,a,c,h,g,v,y,b,m,_,P,O,k,S,M,T,x,w,N,j,U,C;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,a=t.file,c=t.message,h=t.cipherKey,g=t.meta,v=t.ttl,y=t.storeInHistory,n){e.next=3;break}throw new o.PubNubError("Validation failed, check status for details",(0,o.createValidationError)("channel can't be empty"));case 3:if(a){e.next=5;break}throw new o.PubNubError("Validation failed, check status for details",(0,o.createValidationError)("file can't be empty"));case 5:return b=l.create(a),e.next=8,r({channel:n,name:b.name});case 8:if(m=e.sent,_=m.file_upload_request,P=_.url,O=_.form_fields,k=m.data,S=k.id,M=k.name,!l.supportsEncryptFile||!(null!=h?h:f.cipherKey)){e.next=19;break}return e.next=18,d.encryptFile(null!=h?h:f.cipherKey,b,l);case 18:b=e.sent;case 19:if(T=O,b.mimeType&&(T=O.map((function(e){return"Content-Type"===e.key?{key:e.key,value:b.mimeType}:e}))),e.prev=21,!l.supportsFileUri||!a.uri){e.next=34;break}return e.t0=p,e.t1=P,e.t2=T,e.next=28,b.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:x=e.sent,e.next=71;break;case 34:if(!l.supportsFile){e.next=46;break}return e.t4=p,e.t5=P,e.t6=T,e.next=40,b.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:x=e.sent,e.next=71;break;case 46:if(!l.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=P,e.t10=T,e.next=52,b.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:x=e.sent,e.next=71;break;case 58:if(!l.supportsBlob){e.next=70;break}return e.t12=p,e.t13=P,e.t14=T,e.next=64,b.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:x=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,u(e.t16.response);case 77:throw w=e.sent,N=/(.*)<\/Message>/gi.exec(w),new o.PubNubError(N?"Upload to bucket failed: ".concat(N[1]):"Upload to bucket failed.",e.t16);case 80:if(204===x.status){e.next=82;break}throw new o.PubNubError("Upload to bucket was unsuccessful",x);case 82:j=f.fileUploadPublishRetryLimit,U=!1,C={timetoken:"0"};case 85:return e.prev=85,e.next=88,s({channel:n,message:c,fileId:S,fileName:M,meta:g,storeInHistory:y,ttl:v});case 88:C=e.sent,U=!0,e.next=95;break;case 92:e.prev=92,e.t17=e.catch(85),j-=1;case 95:if(!U&&j>0){e.next=85;break}case 96:if(U){e.next=100;break}throw new o.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:S,name:M});case 100:return e.abrupt("return",{timetoken:C.timetoken,id:S,name:M});case 101:case"end":return e.stop()}}),e,null,[[21,73],[85,92]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=h(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",a=r.asyncIterator||"@@asyncIterator",o=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,a=Object.create(i.prototype),o=new k(r||[]);return a._invoke=function(e,t,n){var r="suspendedStart";return function(i,a){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw a;return M()}for(n.method=i,n.arg=a;;){var o=n.delegate;if(o){var u=_(o,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,o),a}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function d(){}function p(){}var h={};u(h,i,(function(){return this}));var g=Object.getPrototypeOf,v=g&&g(g(S([])));v&&v!==t&&n.call(v,i)&&(h=v);var y=p.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var r;this._invoke=function(i,a){function o(){return new t((function(r,o){!function r(i,a,o,u){var s=c(e[i],e,a);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,o,u)}),(function(e){r("throw",e,o,u)})):t.resolve(f).then((function(e){l.value=e,o(l)}),(function(e){return r("throw",e,o,u)}))}u(s.arg)}(i,a,r,o)}))}return r=r?r.then(o,o):o()}}function _(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function k(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function S(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,a=function t(){for(;++r=0;--i){var a=this.tryEntries[i],o=a.completion;if("root"===a.tryLoc)return r("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:S(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(16),a=r(n(3));t.default=function(e,t){var n=t.channel,r=t.id,o=t.name,u=e.config,s=e.networking;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!o)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var c="/v1/files/".concat(u.subscribeKey,"/channels/").concat(a.default.encodeString(n),"/files/").concat(r,"/").concat(o),l={};l.uuid=u.getUUID(),l.pnsdk=(0,i.generatePNSDK)(u),u.getAuthKey()&&(l.auth=u.getAuthKey()),u.secretKey&&(0,i.signRequest)(e,c,l,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var f=Object.keys(l).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(l[e]))})).join("&");return""!==f?"".concat(s.getStandardOrigin()).concat(c,"?").concat(f):"".concat(s.getStandardOrigin()).concat(c)},e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,a=r(n(21)),o=r(n(22)),u=r(n(1)),s=r(n(3)),c={getOperation:function(){return u.default.PNDownloadFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.name?null!=t&&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(s.default.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:(i=(0,o.default)(a.default.mark((function e(t,n,r){var i,o,u,s,c,l,f;return a.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.PubNubFile,s=t.config,c=t.cryptography,l=n.response.body,!u.supportsEncryptFile||!(null!==(i=r.cipherKey)&&void 0!==i?i:s.cipherKey)){e.next=6;break}return e.next=5,c.decrypt(null!==(f=r.cipherKey)&&void 0!==f?f:s.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",u.create({data:l,name:null!==(o=n.response.name)&&void 0!==o?o:r.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.id?null!=t&&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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(9)),a=r(n(1)),o={getOperation:function(){return a.default.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,a,o,u,s,c,l,f,d={};(null!=t&&null!==(n=t.include)&&void 0!==n&&n.customFields&&(d.include="custom"),null!=t&&null!==(r=t.include)&&void 0!==r&&r.totalCount)&&(d.count=null===(s=t.include)||void 0===s?void 0:s.totalCount);null!=t&&null!==(a=t.page)&&void 0!==a&&a.next&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next);null!=t&&null!==(o=t.page)&&void 0!==o&&o.prev&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev);(null!=t&&t.filter&&(d.filter=t.filter),d.limit=null!==(u=null==t?void 0:t.limit)&&void 0!==u?u:100,null!=t&&t.sort)&&(d.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,i.default)(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n})));return d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=o,e.exports=t.default},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,a=[],o=!0,u=!1;try{for(n=n.call(e);!(o=(r=n.next()).done)&&(a.push(r.value),!t||a.length!==t);o=!0);}catch(e){u=!0,i=e}finally{try{o||null==n.return||n.return()}finally{if(u)throw i}}return a}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(72);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(r.include=a)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing UserId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUsersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNCreateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,a=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(a&&!Object.values(a).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing SpaceId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpacesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var a=i.join(",");a.length>0&&(r.include=a)}return r},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom"),n.userFields&&u.push("user"),n.customUserFields&&u.push("user.custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,r=t.updateMembers,i=t.removeMembers,a=t.users,o={};n&&n.length>0&&(o.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.add.push(t)})));r&&r.length>0&&(o.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));a&&a.length>0&&(o.update=o.update||[],a.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));i&&i.length>0&&(o.remove=[],i.forEach((function(e){o.remove.push({id:e})})));return o}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(a.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a=t.filter,o={};r&&(o.limit=r);if(n){var u=[];n.totalCount&&(o.count=!0),n.customFields&&u.push("custom"),n.spaceFields&&u.push("space"),n.customSpaceFields&&u.push("space.custom");var s=u.join(",");s.length>0&&(o.include=s)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));a&&(o.filter=a);return o},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,r=t.updateMemberships,i=t.removeMemberships,a=t.spaces,o={};n&&n.length>0&&(o.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.add.push(t)})));r&&r.length>0&&(o.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));a&&a.length>0&&(o.update=o.update||[],a.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),o.update.push(t)})));i&&i.length>0&&(o.remove=[],i.forEach((function(e){o.remove.push({id:e})})));return o}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(a.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,a={};r&&(a.limit=r);if(n){var o=[];n.totalCount&&(a.count=!0),n.customFields&&o.push("custom"),n.spaceFields&&o.push("space"),n.customSpaceFields&&o.push("space.custom");var u=o.join(",");u.length>0&&(a.include=u)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));return a},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerAudit},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,a=void 0===i?[]:i,o={};n&&(o.channel=n);r&&(o["channel-group"]=r);a.length>0&&(o.auth=a.join(","));return o},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerGrant},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,a=void 0===i?[]:i,o=t.uuids,u=void 0===o?[]:o,s=t.ttl,c=t.read,l=void 0!==c&&c,f=t.write,d=void 0!==f&&f,p=t.manage,h=void 0!==p&&p,g=t.get,v=void 0!==g&&g,y=t.join,b=void 0!==y&&y,m=t.update,_=void 0!==m&&m,P=t.authKeys,O=void 0===P?[]:P,k=t.delete,S={};S.r=l?"1":"0",S.w=d?"1":"0",S.m=h?"1":"0",S.d=k?"1":"0",S.g=v?"1":"0",S.j=b?"1":"0",S.u=_?"1":"0",r.length>0&&(S.channel=r.join(","));a.length>0&&(S["channel-group"]=a.join(","));O.length>0&&(S.auth=O.join(","));u.length>0&&(S["target-uuid"]=u.join(","));(s||0===s)&&(S.ttl=s);return S},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(null!=t.uuids&&!t.authKeys)return"authKeys are required for grant request on uuids";if(null!=t.uuids&&(null!=t.channels||null!=t.channelGroups))return"Both channel/channelgroup and uuid cannot be used in the same request"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.extractPermissions=a,t.getOperation=function(){return i.default.PNAccessManagerGrantToken},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.handleResponse=function(e,t){return t.data.token},t.isAuthSupported=function(){return!1},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,r=t.resources,i=t.patterns,o=t.meta,u=t.authorized_uuid,s={ttl:0,permissions:{resources:{channels:{},groups:{},uuids:{},users:{},spaces:{}},patterns:{channels:{},groups:{},uuids:{},users:{},spaces:{}},meta:{}}};if(r){var c=r.uuids,l=r.channels,f=r.groups;c&&Object.keys(c).forEach((function(e){s.permissions.resources.uuids[e]=a(c[e])})),l&&Object.keys(l).forEach((function(e){s.permissions.resources.channels[e]=a(l[e])})),f&&Object.keys(f).forEach((function(e){s.permissions.resources.groups[e]=a(f[e])}))}if(i){var d=i.uuids,p=i.channels,h=i.groups;d&&Object.keys(d).forEach((function(e){s.permissions.patterns.uuids[e]=a(d[e])})),p&&Object.keys(p).forEach((function(e){s.permissions.patterns.channels[e]=a(p[e])})),h&&Object.keys(h).forEach((function(e){s.permissions.patterns.groups[e]=a(h[e])}))}(n||0===n)&&(s.ttl=n);o&&(s.permissions.meta=o);u&&(s.permissions.uuid="".concat(u));return s}(0,t)},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.prepareParams=function(){return{}},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(!t.resources&&!t.patterns)return"Missing either Resources or Patterns.";if(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))return"Missing values for either Resources or Patterns."};n(2);var i=r(n(1));function a(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),a=r(n(3)),o={getOperation:function(){return i.default.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(a.default.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}}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNPublishOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,a=u(e,i);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(a))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){var n=t.message;return u(e,n)},t.postURL=function(e,t){var n=e.config,r=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0")},t.prepareParams=function(e,t){var n=t.meta,r=t.replicate,a=void 0===r||r,o=t.storeInHistory,u=t.ttl,s={};null!=o&&(s.store=o?"1":"0");u&&(s.ttl=u);!1===a&&(s.norep="true");n&&"object"===(0,i.default)(n)&&(s.meta=JSON.stringify(n));return s},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};var i=r(n(7)),a=(n(2),r(n(1))),o=r(n(3));function u(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSignalOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,o=(u=i,JSON.stringify(u));var u;return"/signal/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0/").concat(a.default.encodeString(o))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHistoryOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v2/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};Array.isArray(t[0])&&t[0].forEach((function(t){var r={timetoken:t.timetoken,entry:o(e,t.message)};t.meta&&(r.meta=t.meta),n.messages.push(r)}));return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.reverse,a=t.count,o=void 0===a?100:a,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f={include_token:"true"};f.count=o,n&&(f.start=n);r&&(f.end=r);s&&(f.string_message_token="true");null!=i&&(f.reverse=i.toString());l&&(f.include_meta="true");return f},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3));function o(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v3/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(a.default.encodeString(n))},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i={};n&&(i.start=n);r&&(i.end=r);return i},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return a.default.PNMessageCounts},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(o.default.encodeString(i))},t.handleResponse=function(e,t){return{channels:t.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,r=t.channelTimetokens,a={};if(r&&1===r.length){var o=(0,i.default)(r,1)[0];a.timetoken=o}else r?a.channelsTimetoken=r.join(","):n&&(a.timetoken=n);return a},t.validateParams=function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,a=e.config;if(!n)return"Missing channel";if(r&&i)return"timetoken and channelTimetokens are incompatible together";if(r&&i&&i.length>1&&n.length!==i.length)return"Length of channelTimetokens and channels do not match";if(!a.subscribeKey)return"Missing Subscribe Key"};var i=r(n(9)),a=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNFetchMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.includeMessageActions,o=void 0!==i&&i,u=e.config,s=o?"history-with-actions":"history",c=r.length>0?r.join(","):",";return"/v3/".concat(s,"/sub-key/").concat(u.subscribeKey,"/channel/").concat(a.default.encodeString(c))},t.handleResponse=function(e,t){var n={channels:{}};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);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,r=t.start,i=t.end,a=t.includeMessageActions,o=t.count,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f=t.includeUuid,d=t.includeUUID,p=void 0===d||d,h=t.includeMessageType,g=void 0===h||h,v={};v.max=o||(n.length>1||!0===a?25:100);r&&(v.start=r);i&&(v.end=i);s&&(v.string_message_token="true");l&&(v.include_meta="true");p&&!1!==f&&(v.include_uuid="true");g&&(v.include_message_type="true");return v},t.validateParams=function(e,t){var n=t.channels,r=t.includeMessageActions,i=void 0!==r&&r,a=e.config;if(!n||0===n.length)return"Missing channels";if(!a.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.")};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSubscribeOperation},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.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(a.default.encodeString(o),"/0")},t.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}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,r=t.state,i=t.channelGroups,a=void 0===i?[]:i,o=t.timetoken,u=t.filterExpression,s=t.region,c={heartbeat:n.getPresenceTimeout()};a.length>0&&(c["channel-group"]=a.join(","));u&&u.length>0&&(c["filter-expr"]=u);Object.keys(r).length&&(c.state=JSON.stringify(r));o&&(c.tt=o);s&&(c.tr=s);return c},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=(r(n(8)),r(n(10))),s=(n(2),function(){function e(t){var n=this;(0,i.default)(this,e),(0,o.default)(this,"_modules",void 0),(0,o.default)(this,"_config",void 0),(0,o.default)(this,"_currentSubDomain",void 0),(0,o.default)(this,"_standardOrigin",void 0),(0,o.default)(this,"_subscribeOrigin",void 0),(0,o.default)(this,"_requestTimeout",void 0),(0,o.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,a.default)(e,[{key:"init",value: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()}},{key:"nextOrigin",value: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)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"PATCH",value:function(e,t,n,r){return this._modules.patch(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),a=r(n(6)),o=r(n(4)),u=function(){function e(){(0,i.default)(this,e),(0,o.default)(this,"storage",void 0),this.storage={}}return(0,a.default)(e,[{key:"get",value:function(e){return this.storage[e]}},{key:"set",value:function(e,t){this.storage[e]=t}}]),e}();t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),a=r(n(5)),o=r(n(6)),u=r(n(4)),s=function(){function e(t,n){(0,a.default)(this,e),(0,u.default)(this,"_base64ToBinary",void 0),(0,u.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,o.default)(e,[{key:"decodeToken",value: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"===(0,i.default)(r))return r}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.del=function(e,t,n){var r=i(),a=this.getStandardOrigin()+t.url;return o.call(this,r,"DELETE",a,e,{},t,n)},t.get=function(e,t,n){var r=i(),a=this.getStandardOrigin()+t.url;return o.call(this,r,"GET",a,e,{},t,n)},t.patch=function(e,t,n,r){var a=i(),u=this.getStandardOrigin()+n.url;return o.call(this,a,"PATCH",u,e,JSON.parse(t),n,r)},t.post=function(e,t,n,r){var a=i(),u=this.getStandardOrigin()+n.url;return o.call(this,a,"POST",u,e,JSON.parse(t),n,r)};n(2);var r=n(118);function i(){return"mobileweb"===Ti.Platform.osname?new XMLHttpRequest:Ti.Network.createHTTPClient()}function a(e){"mobileweb"!==Ti.Platform.osname&&this._config.keepAlive&&(e.enableKeepAlive=!0)}function o(e,t,n,i,o,u,s){var c=this,l={};l.operation=u.operation,e.open(t,(0,r.buildUrl)(n,i),!0),a.call(this,e),e.onload=function(){l.error=!1,e.status&&(l.statusCode=e.status);var t=JSON.parse(e.responseText);return c._config.logVerbosity&&function(e,t,n){var r=(new Date).getTime(),i=(new Date).toISOString(),a=Ti&&Ti.API&&Ti.API.log?Ti.API:console;a.log("<<<<<"),a.log("[".concat(i,"]"),"\n",e,"\n",t),a.log("-----");var o=(new Date).getTime()-r,u=(new Date).toISOString();a.log(">>>>>>"),a.log("[".concat(u," / ").concat(o,"]"),"\n",e,"\n",t,"\n",n),a.log("-----")}(n,i,e.responseText),s(l,t)},e.onerror=function(e){return l.error=!0,l.errorData=e.error,l.category=c._detectErrorCategory(e.error),s(l,null)},e.timeout="android"===Ti.Platform.osname?2147483647:1/0,e.send(o)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.buildUrl=function(e,t){var n=[];return Object.keys(t).forEach((function(e){a(n,e,t[e])})),"".concat(e,"?").concat(n.join("&"))},t.encodedKeyValuePair=a;var i=r(n(7));function a(e,t,n){null!=n?Array.isArray(n)?n.forEach((function(n){a(e,t,n)})):"object"===(0,i.default)(n)?Object.keys(n).forEach((function(r){a(e,"".concat(t,"[").concat(r,"]"),n[r])})):e.push("".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n))):null===n&&e.push(encodeURIComponent("".concat(encodeURIComponent(t))))}}]),module.exports=exports.PubNub; \ No newline at end of file diff --git a/dist/web/pubnub.js b/dist/web/pubnub.js index 3422d741a..deb18aa21 100644 --- a/dist/web/pubnub.js +++ b/dist/web/pubnub.js @@ -1,4 +1,4 @@ -/*! 4.37.0 / Consumer */ +/*! 5.0.0 / Consumer */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); @@ -389,10 +389,8 @@ var _default = function () { function _default(_ref) { var _setup$fileUploadPubl, _setup$useRandomIVs; - var setup = _ref.setup, - db = _ref.db; + var setup = _ref.setup; (0, _classCallCheck2["default"])(this, _default); - (0, _defineProperty2["default"])(this, "_db", void 0); (0, _defineProperty2["default"])(this, "subscribeKey", void 0); (0, _defineProperty2["default"])(this, "publishKey", void 0); (0, _defineProperty2["default"])(this, "secretKey", void 0); @@ -431,7 +429,6 @@ var _default = function () { (0, _defineProperty2["default"])(this, "fileUploadPublishRetryLimit", void 0); (0, _defineProperty2["default"])(this, "useRandomIVs", void 0); this._PNSDKSuffix = {}; - this._db = db; this.instanceId = "pn-".concat(_uuid["default"].createUUID()); this.secretKey = setup.secretKey || setup.secret_key; this.subscribeKey = setup.subscribeKey || setup.subscribe_key; @@ -486,7 +483,7 @@ var _default = function () { this.setHeartbeatInterval(setup.heartbeatInterval); } - this.setUUID(this._decideUUID(setup.uuid)); + this.setUUID(setup.uuid); } (0, _createClass2["default"])(_default, [{ @@ -514,7 +511,10 @@ var _default = function () { }, { key: "setUUID", value: function setUUID(val) { - if (this._db && this._db.set) this._db.set("".concat(this.subscribeKey, "uuid"), val); + if (!val || typeof val !== 'string' || val.trim().length === 0) { + throw new Error('Missing uuid parameter. Provide a valid string uuid'); + } + this.UUID = val; return this; } @@ -599,7 +599,7 @@ var _default = function () { }, { key: "getVersion", value: function getVersion() { - return '4.37.0'; + return '5.0.0'; } }, { key: "_addPnsdkSuffix", @@ -615,19 +615,6 @@ var _default = function () { return result + separator + _this._PNSDKSuffix[key]; }, ''); } - }, { - key: "_decideUUID", - value: function _decideUUID(providedUUID) { - if (providedUUID) { - return providedUUID; - } - - if (this._db && this._db.get && this._db.get("".concat(this.subscribeKey, "uuid"))) { - return this._db.get("".concat(this.subscribeKey, "uuid")); - } - - return "pn-".concat(_uuid["default"].createUUID()); - } }]); return _default; }(); @@ -5848,12 +5835,10 @@ var _default = function () { (0, _defineProperty2["default"])(this, "setProxy", void 0); (0, _defineProperty2["default"])(this, "encrypt", void 0); (0, _defineProperty2["default"])(this, "decrypt", void 0); - var db = setup.db, - networking = setup.networking, + var networking = setup.networking, cbor = setup.cbor; var config = this._config = new _config["default"]({ - setup: setup, - db: db + setup: setup }); var crypto = new _index["default"]({ config: config diff --git a/dist/web/pubnub.min.js b/dist/web/pubnub.min.js index 3fb05cfb2..ce8495804 100644 --- a/dist/web/pubnub.min.js +++ b/dist/web/pubnub.min.js @@ -1,11 +1,11 @@ -/*! 4.37.0 / Consumer */ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.PubNub=t():e.PubNub=t()}(window,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=31)}([function(e,t){e.exports=function(e){return e&&e.__esModule?e:{default:e}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={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"},e.exports=t.default},function(e,t,n){"use strict";e.exports={}},function(e,t,n){"use strict";(function(t){function n(e){return encodeURIComponent(e).replace(/[!~*'()]/g,(function(e){return"%".concat(e.charCodeAt(0).toString(16).toUpperCase())}))}function r(e){return function(e){var t=[];return Object.keys(e).forEach((function(e){return t.push(e)})),t}(e).sort()}var i="The Objects v1 API has been deprecated.\nYou can learn more about Objects v2 API at https://www.pubnub.com/docs/web-javascript/api-reference-objects.\nIf you have questions about the Objects v2 API or require additional help with migrating to the new data model, please contact PubNub Support at support@pubnub.com.";e.exports={signPamFromParams:function(e){return r(e).map((function(t){return"".concat(t,"=").concat(n(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:n,deprecated:function(e){return function(){var n,r;void 0!==t&&("test"!==(null===(n=t)||void 0===n||null===(r=n.env)||void 0===r?void 0:"production")&&console.warn(i));return e.apply(void 0,arguments)}}}}).call(this,n(42))},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(e,t){for(var n=0;n=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}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"4.37.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,r){return n+e+t._PNSDKSuffix[r]}),"")}},{key:"_decideUUID",value:function(e){return e||(this._db&&this._db.get&&this._db.get("".concat(this.subscribeKey,"uuid"))?this._db.get("".concat(this.subscribeKey,"uuid")):"pn-".concat(u.default.createUUID()))}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){var r=n(80),i=n(81),o=n(82),a=n(84);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t,n){e.exports=n(75)},function(e,t){function n(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function u(e){n(a,i,o,u,s,"next",e)}function s(e){n(a,i,o,u,s,"throw",e)}u(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(15);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(7).default,i=n(22);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(34)),o={createUUID:function(){return i.default.uuid?i.default.uuid():(0,i.default)()}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.PubNubError=void 0,t.createValidationError=b,t.default=function(e,t){var n=e.networking,r=e.config,i=e.telemetryManager,o=e.tokenManager,a=l.default.createUUID(),u=null,s=null,c={};t.getOperation()===d.default.PNTimeOperation||t.getOperation()===d.default.PNChannelGroupsOperation?u=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],u=arguments.length<=3?void 0:arguments[3]);"undefined"==typeof Promise||u||(s=f.default.createPromise());var h=t.validateParams(e,c);if(h)return u?u(b(h)):s?(s.reject(new v("Validation failed, check status for details",b(h))),s.promise):void 0;var g,S=t.prepareParams(e,c),w=m(t,e,c),k={url:w,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,c):null};S.uuid=r.UUID,S.pnsdk=_(r);var T=i.operationsLatencyForRequest();Object.keys(T).length&&(S=y(y({},S),T));r.useInstanceId&&(S.instanceid=r.instanceId);r.useRequestId&&(S.requestid=a);if(t.isAuthSupported()){var x=o.getToken()||r.getAuthKey();x&&(S.auth=x)}r.secretKey&&O(e,w,S,c,t);var A=function(n,r){var o;if(n.error)return t.handleError&&t.handleError(e,c,n),void(u?u(n):s&&s.reject(new v("PubNub call failed, check status for details",n)));i.stopLatencyMeasure(t.getOperation(),a);var l=t.handleResponse(e,r,c);"function"!=typeof(null===(o=l)||void 0===o?void 0:o.then)&&(l=Promise.resolve(l)),l.then((function(e){u?u(n,e):s&&s.fulfill(e)})).catch((function(e){if(u){var n=e;t.getOperation()===d.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),u(n,null)}else s&&s.reject(new v("PubNub call failed, check status for details",e))}))};if(i.startLatencyMeasure(t.getOperation(),a),"POST"===P(e,t,c)){var M=t.postPayload(e,c);g=n.POST(S,M,k,A)}else if("PATCH"===P(e,t,c)){var E=t.patchPayload(e,c);g=n.PATCH(S,E,k,A)}else g="DELETE"===P(e,t,c)?n.DELETE(S,k,A):"GETFILE"===P(e,t,c)?n.GETFILE(S,k,A):n.GET(S,k,A);if(t.getOperation()===d.default.PNSubscribeOperation)return g;if(s)return s.promise},t.generatePNSDK=_,t.signRequest=O;var i=r(n(4)),o=r(n(5)),a=r(n(14)),u=r(n(16)),s=r(n(13)),c=r(n(48)),l=r(n(17)),f=(n(2),r(n(3))),d=(r(n(8)),r(n(1))),p=r(n(10));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t0&&(t+=n),t}function P(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 O(e,t,n,r,i){var o=e.config,a=e.crypto,u=P(e,i,r);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===i.getOperation()&&i.usePost&&i.usePost(e,r)&&(u="GET"),"GETFILE"===u&&(u="GET");var s="".concat(u,"\n").concat(o.publishKey,"\n").concat(t,"\n").concat(f.default.signPamFromParams(n),"\n");if("POST"===u){var c=i.postPayload(e,r);s+="string"==typeof c?c:JSON.stringify(c)}else if("PATCH"===u){var l=i.patchPayload(e,r);s+="string"==typeof l?l:JSON.stringify(l)}var d="v2.".concat(a.HMACSHA256(s));d=(d=(d=d.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=d}t.PubNubError=v},function(e,t,n){"use strict";var r=SyntaxError,i=Function,o=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var s=function(){throw new o},c=u?function(){try{return s}catch(e){try{return u(arguments,"callee").get}catch(e){return s}}}():s,l=n(135)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},p="undefined"==typeof Uint8Array?void 0:f(Uint8Array),h={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?f([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?f(f([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?f((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?f((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?f(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":r,"%ThrowTypeError%":c,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},y={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=n(20),v=n(138),b=g.call(Function.call,Array.prototype.concat),m=g.call(Function.apply,Array.prototype.splice),_=g.call(Function.call,String.prototype.replace),P=g.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,w=function(e){var t=P(e,0,1),n=P(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return _(e,O,(function(e,t,n,r){i[i.length]=n?_(r,S,"$1"):t||e})),i},k=function(e,t){var n,i=e;if(v(y,i)&&(i="%"+(n=y[i])[0]+"%"),v(h,i)){var u=h[i];if(u===d&&(u=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(n=f(i.prototype))}return h[t]=n,n}(i)),void 0===u&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:u}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');var n=w(e),i=n.length>0?n[0]:"",a=k("%"+i+"%",t),s=a.name,c=a.value,l=!1,f=a.alias;f&&(i=f[0],m(n,b([0,1],f)));for(var d=1,p=!0;d=n.length){var O=u(c,y);c=(p=!!O)&&"get"in O&&!("originalValue"in O.get)?O.get:c[y]}else p=v(c,y),c=c[y];p&&!l&&(h[s]=c)}}return c}},function(e,t,n){"use strict";var r=n(137);e.exports=Function.prototype.bind||r},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g,o="RFC1738",a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:a}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(r){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(n(5)),a=i(n(6)),u=i(n(4)),s=(i(n(8)),i(n(25)));function c(e){var t,n=[];for(t=0;t=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}},{key:"setProxy",value:function(e){this.proxy=e}},{key:"getHeartbeatInterval",value:function(){return this._heartbeatInterval}},{key:"setHeartbeatInterval",value:function(e){return this._heartbeatInterval=e,this}},{key:"getSubscribeTimeout",value:function(){return this._subscribeRequestTimeout}},{key:"setSubscribeTimeout",value:function(e){return this._subscribeRequestTimeout=e,this}},{key:"getTransactionTimeout",value:function(){return this._transactionalRequestTimeout}},{key:"setTransactionTimeout",value:function(e){return this._transactionalRequestTimeout=e,this}},{key:"isSendBeaconEnabled",value:function(){return this._useSendBeacon}},{key:"setSendBeaconConfig",value:function(e){return this._useSendBeacon=e,this}},{key:"getVersion",value:function(){return"5.0.0"}},{key:"_addPnsdkSuffix",value:function(e,t){this._PNSDKSuffix[e]=t}},{key:"_getPnsdkSuffix",value:function(e){var t=this;return Object.keys(this._PNSDKSuffix).reduce((function(n,r){return n+e+t._PNSDKSuffix[r]}),"")}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){var r=n(80),i=n(81),o=n(82),a=n(84);e.exports=function(e,t){return r(e)||i(e,t)||o(e,t)||a()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;t.default={PNNetworkUpCategory:"PNNetworkUpCategory",PNNetworkDownCategory:"PNNetworkDownCategory",PNNetworkIssuesCategory:"PNNetworkIssuesCategory",PNTimeoutCategory:"PNTimeoutCategory",PNBadRequestCategory:"PNBadRequestCategory",PNAccessDeniedCategory:"PNAccessDeniedCategory",PNUnknownCategory:"PNUnknownCategory",PNReconnectedCategory:"PNReconnectedCategory",PNConnectedCategory:"PNConnectedCategory",PNRequestMessageCountExceededCategory:"PNRequestMessageCountExceededCategory"},e.exports=t.default},function(e,t,n){e.exports=n(75)},function(e,t){function n(e,t,n,r,i,o,a){try{var u=e[o](a),s=u.value}catch(e){return void n(e)}u.done?t(s):Promise.resolve(s).then(r,i)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(i,o){var a=e.apply(t,r);function u(e){n(a,i,o,u,s,"next",e)}function s(e){n(a,i,o,u,s,"throw",e)}u(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return e.exports=n=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.default=e.exports,e.exports.__esModule=!0,n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(15);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&r(e,t)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t,r){return e.exports=n=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},e.exports.default=e.exports,e.exports.__esModule=!0,n(t,r)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(7).default,i=n(22);e.exports=function(e,t){if(t&&("object"===r(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return i(e)},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(34)),o={createUUID:function(){return i.default.uuid?i.default.uuid():(0,i.default)()}};t.default=o,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.PubNubError=void 0,t.createValidationError=b,t.default=function(e,t){var n=e.networking,r=e.config,i=e.telemetryManager,o=e.tokenManager,a=l.default.createUUID(),u=null,s=null,c={};t.getOperation()===d.default.PNTimeOperation||t.getOperation()===d.default.PNChannelGroupsOperation?u=arguments.length<=2?void 0:arguments[2]:(c=arguments.length<=2?void 0:arguments[2],u=arguments.length<=3?void 0:arguments[3]);"undefined"==typeof Promise||u||(s=f.default.createPromise());var h=t.validateParams(e,c);if(h)return u?u(b(h)):s?(s.reject(new v("Validation failed, check status for details",b(h))),s.promise):void 0;var g,S=t.prepareParams(e,c),w=m(t,e,c),k={url:w,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,c):null};S.uuid=r.UUID,S.pnsdk=_(r);var T=i.operationsLatencyForRequest();Object.keys(T).length&&(S=y(y({},S),T));r.useInstanceId&&(S.instanceid=r.instanceId);r.useRequestId&&(S.requestid=a);if(t.isAuthSupported()){var x=o.getToken()||r.getAuthKey();x&&(S.auth=x)}r.secretKey&&O(e,w,S,c,t);var A=function(n,r){var o;if(n.error)return t.handleError&&t.handleError(e,c,n),void(u?u(n):s&&s.reject(new v("PubNub call failed, check status for details",n)));i.stopLatencyMeasure(t.getOperation(),a);var l=t.handleResponse(e,r,c);"function"!=typeof(null===(o=l)||void 0===o?void 0:o.then)&&(l=Promise.resolve(l)),l.then((function(e){u?u(n,e):s&&s.fulfill(e)})).catch((function(e){if(u){var n=e;t.getOperation()===d.default.PNSubscribeOperation&&(n={statusCode:400,error:!0,operation:t.getOperation(),errorData:e,category:p.default.PNUnknownCategory}),u(n,null)}else s&&s.reject(new v("PubNub call failed, check status for details",e))}))};if(i.startLatencyMeasure(t.getOperation(),a),"POST"===P(e,t,c)){var M=t.postPayload(e,c);g=n.POST(S,M,k,A)}else if("PATCH"===P(e,t,c)){var E=t.patchPayload(e,c);g=n.PATCH(S,E,k,A)}else g="DELETE"===P(e,t,c)?n.DELETE(S,k,A):"GETFILE"===P(e,t,c)?n.GETFILE(S,k,A):n.GET(S,k,A);if(t.getOperation()===d.default.PNSubscribeOperation)return g;if(s)return s.promise},t.generatePNSDK=_,t.signRequest=O;var i=r(n(4)),o=r(n(5)),a=r(n(14)),u=r(n(16)),s=r(n(13)),c=r(n(48)),l=r(n(17)),f=(n(2),r(n(3))),d=(r(n(8)),r(n(1))),p=r(n(10));function h(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function y(e){for(var t=1;t0&&(t+=n),t}function P(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 O(e,t,n,r,i){var o=e.config,a=e.crypto,u=P(e,i,r);n.timestamp=Math.floor((new Date).getTime()/1e3),"PNPublishOperation"===i.getOperation()&&i.usePost&&i.usePost(e,r)&&(u="GET"),"GETFILE"===u&&(u="GET");var s="".concat(u,"\n").concat(o.publishKey,"\n").concat(t,"\n").concat(f.default.signPamFromParams(n),"\n");if("POST"===u){var c=i.postPayload(e,r);s+="string"==typeof c?c:JSON.stringify(c)}else if("PATCH"===u){var l=i.patchPayload(e,r);s+="string"==typeof l?l:JSON.stringify(l)}var d="v2.".concat(a.HMACSHA256(s));d=(d=(d=d.replace(/\+/g,"-")).replace(/\//g,"_")).replace(/=+$/,""),n.signature=d}t.PubNubError=v},function(e,t,n){"use strict";var r=SyntaxError,i=Function,o=TypeError,a=function(e){try{return i('"use strict"; return ('+e+").constructor;")()}catch(e){}},u=Object.getOwnPropertyDescriptor;if(u)try{u({},"")}catch(e){u=null}var s=function(){throw new o},c=u?function(){try{return s}catch(e){try{return u(arguments,"callee").get}catch(e){return s}}}():s,l=n(135)(),f=Object.getPrototypeOf||function(e){return e.__proto__},d={},p="undefined"==typeof Uint8Array?void 0:f(Uint8Array),h={"%AggregateError%":"undefined"==typeof AggregateError?void 0:AggregateError,"%Array%":Array,"%ArrayBuffer%":"undefined"==typeof ArrayBuffer?void 0:ArrayBuffer,"%ArrayIteratorPrototype%":l?f([][Symbol.iterator]()):void 0,"%AsyncFromSyncIteratorPrototype%":void 0,"%AsyncFunction%":d,"%AsyncGenerator%":d,"%AsyncGeneratorFunction%":d,"%AsyncIteratorPrototype%":d,"%Atomics%":"undefined"==typeof Atomics?void 0:Atomics,"%BigInt%":"undefined"==typeof BigInt?void 0:BigInt,"%Boolean%":Boolean,"%DataView%":"undefined"==typeof DataView?void 0:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":"undefined"==typeof Float32Array?void 0:Float32Array,"%Float64Array%":"undefined"==typeof Float64Array?void 0:Float64Array,"%FinalizationRegistry%":"undefined"==typeof FinalizationRegistry?void 0:FinalizationRegistry,"%Function%":i,"%GeneratorFunction%":d,"%Int8Array%":"undefined"==typeof Int8Array?void 0:Int8Array,"%Int16Array%":"undefined"==typeof Int16Array?void 0:Int16Array,"%Int32Array%":"undefined"==typeof Int32Array?void 0:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":l?f(f([][Symbol.iterator]())):void 0,"%JSON%":"object"==typeof JSON?JSON:void 0,"%Map%":"undefined"==typeof Map?void 0:Map,"%MapIteratorPrototype%":"undefined"!=typeof Map&&l?f((new Map)[Symbol.iterator]()):void 0,"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":"undefined"==typeof Promise?void 0:Promise,"%Proxy%":"undefined"==typeof Proxy?void 0:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":"undefined"==typeof Reflect?void 0:Reflect,"%RegExp%":RegExp,"%Set%":"undefined"==typeof Set?void 0:Set,"%SetIteratorPrototype%":"undefined"!=typeof Set&&l?f((new Set)[Symbol.iterator]()):void 0,"%SharedArrayBuffer%":"undefined"==typeof SharedArrayBuffer?void 0:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":l?f(""[Symbol.iterator]()):void 0,"%Symbol%":l?Symbol:void 0,"%SyntaxError%":r,"%ThrowTypeError%":c,"%TypedArray%":p,"%TypeError%":o,"%Uint8Array%":"undefined"==typeof Uint8Array?void 0:Uint8Array,"%Uint8ClampedArray%":"undefined"==typeof Uint8ClampedArray?void 0:Uint8ClampedArray,"%Uint16Array%":"undefined"==typeof Uint16Array?void 0:Uint16Array,"%Uint32Array%":"undefined"==typeof Uint32Array?void 0:Uint32Array,"%URIError%":URIError,"%WeakMap%":"undefined"==typeof WeakMap?void 0:WeakMap,"%WeakRef%":"undefined"==typeof WeakRef?void 0:WeakRef,"%WeakSet%":"undefined"==typeof WeakSet?void 0:WeakSet},y={"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},g=n(20),v=n(138),b=g.call(Function.call,Array.prototype.concat),m=g.call(Function.apply,Array.prototype.splice),_=g.call(Function.call,String.prototype.replace),P=g.call(Function.call,String.prototype.slice),O=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,S=/\\(\\)?/g,w=function(e){var t=P(e,0,1),n=P(e,-1);if("%"===t&&"%"!==n)throw new r("invalid intrinsic syntax, expected closing `%`");if("%"===n&&"%"!==t)throw new r("invalid intrinsic syntax, expected opening `%`");var i=[];return _(e,O,(function(e,t,n,r){i[i.length]=n?_(r,S,"$1"):t||e})),i},k=function(e,t){var n,i=e;if(v(y,i)&&(i="%"+(n=y[i])[0]+"%"),v(h,i)){var u=h[i];if(u===d&&(u=function e(t){var n;if("%AsyncFunction%"===t)n=a("async function () {}");else if("%GeneratorFunction%"===t)n=a("function* () {}");else if("%AsyncGeneratorFunction%"===t)n=a("async function* () {}");else if("%AsyncGenerator%"===t){var r=e("%AsyncGeneratorFunction%");r&&(n=r.prototype)}else if("%AsyncIteratorPrototype%"===t){var i=e("%AsyncGenerator%");i&&(n=f(i.prototype))}return h[t]=n,n}(i)),void 0===u&&!t)throw new o("intrinsic "+e+" exists, but is not available. Please file an issue!");return{alias:n,name:i,value:u}}throw new r("intrinsic "+e+" does not exist!")};e.exports=function(e,t){if("string"!=typeof e||0===e.length)throw new o("intrinsic name must be a non-empty string");if(arguments.length>1&&"boolean"!=typeof t)throw new o('"allowMissing" argument must be a boolean');var n=w(e),i=n.length>0?n[0]:"",a=k("%"+i+"%",t),s=a.name,c=a.value,l=!1,f=a.alias;f&&(i=f[0],m(n,b([0,1],f)));for(var d=1,p=!0;d=n.length){var O=u(c,y);c=(p=!!O)&&"get"in O&&!("originalValue"in O.get)?O.get:c[y]}else p=v(c,y),c=c[y];p&&!l&&(h[s]=c)}}return c}},function(e,t,n){"use strict";var r=n(137);e.exports=Function.prototype.bind||r},function(e,t,n){"use strict";var r=String.prototype.replace,i=/%20/g,o="RFC1738",a="RFC3986";e.exports={default:a,formatters:{RFC1738:function(e){return r.call(e,i,"+")},RFC3986:function(e){return String(e)}},RFC1738:o,RFC3986:a}},function(e,t){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";(function(r){var i=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=i(n(5)),a=i(n(6)),u=i(n(4)),s=(i(n(8)),i(n(25)));function c(e){var t,n=[];for(t=0;t * @license MIT */ -var r=n(36),i=n(37),o=n(38);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){var o,a=1,u=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,u/=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;ou&&(n=u-s),o=n;o>=0;o--){for(var f=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(s=(31&c)<<6|63&o)>127&&(l=s);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(s=(15&c)<<12|(63&o)<<6|63&a)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:o=e[i+1],a=e[i+2],u=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(s=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(l=s)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),u=Math.min(o,a),c=this.slice(r,i),l=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return P(this,e,t,n);case"latin1":case"binary":return O(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function C(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function U(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(e,t,n,r,o){return o||U(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function D(e,t,n,r,o){return o||U(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):C(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=0,a=1,u=0;for(this[t]=255&e;++o>0)-u&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=n-1,a=1,u=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===u&&0!==this[t+o+1]&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):C(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return I(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return I(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return D(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return D(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function B(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(F,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(35))},function(e,t,n){"use strict";var r,i,o,a,u,s=s||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)}},a=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||s).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>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>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>>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>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=u.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)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new a.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,u=i/(4*o);if(t=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*o,i=e.min(4*t,i),t){for(var s=0;sl;){var f;e:{f=c;for(var d=e.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>l&&(o[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var h=[];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],u=n[3],s=n[4],c=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)h[d]=0|e[t+d];else{var p=h[d-15],y=h[d-2];h[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+h[d-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+h[d-16]}p=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&l)+a[d]+h[d],y=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=l,l=c,c=s,s=u+p|0,u=o,o=i,i=r,r=p+y|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|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),i=(r=s).enc.Utf8,r.algo.HMAC=r.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),u=o.words,s=a.words,c=0;c>>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,a=0;4>a&&i+.75*a>>6*(3-a)&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>>6-o%4*2;r[i>>>2]|=(u|s)<<24-i%4*8,i++}return a.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,r,i,o,a){return((e=e+(t&n|~t&r)+i+a)<>>32-o)+t}function n(e,t,n,r,i,o,a){return((e=e+(t&r|n&~r)+i+a)<>>32-o)+t}function r(e,t,n,r,i,o,a){return((e=e+(t^n^r)+i+a)<>>32-o)+t}function i(e,t,n,r,i,o,a){return((e=e+(n^(t|~r))+i+a)<>>32-o)+t}for(var o=s,a=(c=o.lib).WordArray,u=c.Hasher,c=o.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var a=0;16>a;a++){var u=e[s=o+a];e[s]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}a=this._hash.words;var s=e[o+0],c=(u=e[o+1],e[o+2]),f=e[o+3],d=e[o+4],p=e[o+5],h=e[o+6],y=e[o+7],g=e[o+8],v=e[o+9],b=e[o+10],m=e[o+11],_=e[o+12],P=e[o+13],O=e[o+14],S=e[o+15],w=t(w=a[0],x=a[1],T=a[2],k=a[3],s,7,l[0]),k=t(k,w,x,T,u,12,l[1]),T=t(T,k,w,x,c,17,l[2]),x=t(x,T,k,w,f,22,l[3]);w=t(w,x,T,k,d,7,l[4]),k=t(k,w,x,T,p,12,l[5]),T=t(T,k,w,x,h,17,l[6]),x=t(x,T,k,w,y,22,l[7]),w=t(w,x,T,k,g,7,l[8]),k=t(k,w,x,T,v,12,l[9]),T=t(T,k,w,x,b,17,l[10]),x=t(x,T,k,w,m,22,l[11]),w=t(w,x,T,k,_,7,l[12]),k=t(k,w,x,T,P,12,l[13]),T=t(T,k,w,x,O,17,l[14]),w=n(w,x=t(x,T,k,w,S,22,l[15]),T,k,u,5,l[16]),k=n(k,w,x,T,h,9,l[17]),T=n(T,k,w,x,m,14,l[18]),x=n(x,T,k,w,s,20,l[19]),w=n(w,x,T,k,p,5,l[20]),k=n(k,w,x,T,b,9,l[21]),T=n(T,k,w,x,S,14,l[22]),x=n(x,T,k,w,d,20,l[23]),w=n(w,x,T,k,v,5,l[24]),k=n(k,w,x,T,O,9,l[25]),T=n(T,k,w,x,f,14,l[26]),x=n(x,T,k,w,g,20,l[27]),w=n(w,x,T,k,P,5,l[28]),k=n(k,w,x,T,c,9,l[29]),T=n(T,k,w,x,y,14,l[30]),w=r(w,x=n(x,T,k,w,_,20,l[31]),T,k,p,4,l[32]),k=r(k,w,x,T,g,11,l[33]),T=r(T,k,w,x,m,16,l[34]),x=r(x,T,k,w,O,23,l[35]),w=r(w,x,T,k,u,4,l[36]),k=r(k,w,x,T,d,11,l[37]),T=r(T,k,w,x,y,16,l[38]),x=r(x,T,k,w,b,23,l[39]),w=r(w,x,T,k,P,4,l[40]),k=r(k,w,x,T,s,11,l[41]),T=r(T,k,w,x,f,16,l[42]),x=r(x,T,k,w,h,23,l[43]),w=r(w,x,T,k,v,4,l[44]),k=r(k,w,x,T,_,11,l[45]),T=r(T,k,w,x,S,16,l[46]),w=i(w,x=r(x,T,k,w,c,23,l[47]),T,k,s,6,l[48]),k=i(k,w,x,T,y,10,l[49]),T=i(T,k,w,x,O,15,l[50]),x=i(x,T,k,w,p,21,l[51]),w=i(w,x,T,k,_,6,l[52]),k=i(k,w,x,T,f,10,l[53]),T=i(T,k,w,x,b,15,l[54]),x=i(x,T,k,w,u,21,l[55]),w=i(w,x,T,k,g,6,l[56]),k=i(k,w,x,T,S,10,l[57]),T=i(T,k,w,x,h,15,l[58]),x=i(x,T,k,w,P,21,l[59]),w=i(w,x,T,k,d,6,l[60]),k=i(k,w,x,T,m,10,l[61]),T=i(T,k,w,x,c,15,l[62]),x=i(x,T,k,w,v,21,l[63]);a[0]=a[0]+w|0,a[1]=a[1]+x|0,a[2]=a[2]+T|0,a[3]=a[3]+k|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=u.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=u._createHelper(c),o.HmacMD5=u._createHmacHelper(c)}(Math),function(){var e,t=s,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=(u=this.cfg).hasher.create(),i=r.create(),o=i.words,a=u.keySize,u=u.iterations;o.length>>2]}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:c,padding:f}),reset:function(){u.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 d=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(c=(h.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 d.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:c}),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,d.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}})),h=(h.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=a.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:i})}},y=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),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=p.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,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=s,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],a=[],u=[],c=[],l=[],f=[],d=[],p=[],h=[],y=0;256>y;y++)h[y]=128>y?y<<1:y<<1^283;var g=0,v=0;for(y=0;256>y;y++){var b=(b=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&b^99;r[g]=b,i[b]=g;var m=h[g],_=h[m],P=h[_],O=257*h[b]^16843008*b;o[g]=O<<24|O>>>8,a[g]=O<<16|O>>>16,u[g]=O<<8|O>>>24,c[g]=O,O=16843009*P^65537*_^257*m^16843008*g,l[b]=O<<24|O>>>8,f[b]=O<<16|O>>>16,d[b]=O<<8|O>>>24,p[b]=O,g?(g=m^h[h[h[P^m]]],v^=h[h[v]]):g=v=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>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=S[o/t|0]<<24),i[o]=i[o-t]^a}for(e=this._invKeySchedule=[],t=0;tt||4>=o?a:l[r[a>>>24]]^f[r[a>>>16&255]]^d[r[a>>>8&255]]^p[r[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,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,l,f,d,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,a,u){for(var s=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],d=e[t+3]^n[3],p=4,h=1;h>>24]^i[l>>>16&255]^o[f>>>8&255]^a[255&d]^n[p++],g=r[l>>>24]^i[f>>>16&255]^o[d>>>8&255]^a[255&c]^n[p++],v=r[f>>>24]^i[d>>>16&255]^o[c>>>8&255]^a[255&l]^n[p++];d=r[d>>>24]^i[c>>>16&255]^o[l>>>8&255]^a[255&f]^n[p++],c=y,l=g,f=v}y=(u[c>>>24]<<24|u[l>>>16&255]<<16|u[f>>>8&255]<<8|u[255&d])^n[p++],g=(u[l>>>24]<<24|u[f>>>16&255]<<16|u[d>>>8&255]<<8|u[255&c])^n[p++],v=(u[f>>>24]<<24|u[d>>>16&255]<<16|u[c>>>8&255]<<8|u[255&l])^n[p++],d=(u[d>>>24]<<24|u[c>>>16&255]<<16|u[l>>>8&255]<<8|u[255&f])^n[p++],e[t]=y,e[t+1]=g,e[t+2]=v,e[t+3]=d},keySize:8});e.AES=t._createHelper(n)}(),s.mode.ECB=((u=s.lib.BlockCipherMode.extend()).Encryptor=u.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),u.Decryptor=u.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),u),e.exports=s},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(n(2),r(n(10))),s=function(){function e(){(0,i.default)(this,e),(0,a.default)(this,"_listeners",void 0),this._listeners=[]}return(0,o.default)(e,[{key:"addListener",value:function(e){this._listeners.push(e)}},{key:"removeListener",value:function(e){var t=[];this._listeners.forEach((function(n){n!==e&&t.push(n)})),this._listeners=t}},{key:"removeAllListeners",value:function(){this._listeners=[]}},{key:"announcePresence",value:function(e){this._listeners.forEach((function(t){t.presence&&t.presence(e)}))}},{key:"announceStatus",value:function(e){this._listeners.forEach((function(t){t.status&&t.status(e)}))}},{key:"announceMessage",value:function(e){this._listeners.forEach((function(t){t.message&&t.message(e)}))}},{key:"announceSignal",value:function(e){this._listeners.forEach((function(t){t.signal&&t.signal(e)}))}},{key:"announceMessageAction",value:function(e){this._listeners.forEach((function(t){t.messageAction&&t.messageAction(e)}))}},{key:"announceFile",value:function(e){this._listeners.forEach((function(t){t.file&&t.file(e)}))}},{key:"announceObjects",value:function(e){this._listeners.forEach((function(t){t.objects&&t.objects(e)}))}},{key:"announceUser",value:function(e){this._listeners.forEach((function(t){t.user&&t.user(e)}))}},{key:"announceSpace",value:function(e){this._listeners.forEach((function(t){t.space&&t.space(e)}))}},{key:"announceMembership",value:function(e){this._listeners.forEach((function(t){t.membership&&t.membership(e)}))}},{key:"announceNetworkUp",value:function(){var e={};e.category=u.default.PNNetworkUpCategory,this.announceStatus(e)}},{key:"announceNetworkDown",value:function(){var e={};e.category=u.default.PNNetworkDownCategory,this.announceStatus(e)}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNTimeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(){return"/time/0"},t.handleResponse=function(e,t){return{timetoken:t[0]}},t.isAuthSupported=function(){return!1},t.prepareParams=function(){return{}},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){},function(e,t,n){"use strict";var r=n(21),i=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),u=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r1;){var t=e.pop(),n=t.obj[t.prop];if(o(n)){for(var r=[],i=0;i=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||o===r.RFC1738&&(40===l||41===l)?s+=u.charAt(c):l<128?s+=a[l]:l<2048?s+=a[192|l>>6]+a[128|63&l]:l<55296||l>=57344?s+=a[224|l>>12]+a[128|l>>6&63]+a[128|63&l]:(c+=1,l=65536+((1023&l)<<10|1023&u.charCodeAt(c)),s+=a[240|l>>18]+a[128|l>>12&63]+a[128|l>>6&63]+a[128|63&l])}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(o(e)){for(var n=[],r=0;r>24,r[o+1]=(16711680&u)>>16,r[o+2]=(65280&u)>>8,r[o+3]=255&u}for(var s=o+3;s>=o;s-=1)0===r[s]&&(i+=1);return i>0?r.buffer.slice(0,r.byteLength-i):r.buffer}function P(e){var t=function(e){return e&&"object"===(0,s.default)(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,a=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(a)?P(a):a})),n}var O=function(e){(0,o.default)(n,e);var t=b(n);function n(e){var r;(0,i.default)(this,n);var o=e.listenToBrowserNetworkEvents,a=void 0===o||o;return e.db=p.default,e.sdkFamily="Web",e.networking=new f.default({del:y.del,get:y.get,post:y.post,patch:y.patch,sendBeacon:m,getfile:y.getfile,postfile:y.postfile}),e.cbor=new h.default((function(e){return P(c.default.decode(e))}),_),e.PubNubFile=v.default,e.cryptography=new g.default,r=t.call(this,e),a&&(window.addEventListener("offline",(function(){r.networkDownDetected()})),window.addEventListener("online",(function(){r.networkUpDetected()}))),r}return n}(l.default);t.default=O,e.exports=t.default},function(e,t,n){var r,i;!function(o,a){"use strict";var u=Math.pow(2,-24),s=Math.pow(2,32),c=Math.pow(2,53);void 0===(i="function"==typeof(r={encode:function(e){var t,n=new ArrayBuffer(256),r=new DataView(n),i=0;function o(e){for(var o=n.byteLength,a=i+e;o>2,c=0;c>6),r.push(128|63&s)):s<55296?(r.push(224|s>>12),r.push(128|s>>6&63),r.push(128|63&s)):(s=(1023&s)<<10,s|=1023&t.charCodeAt(++n),s+=65536,r.push(240|s>>18),r.push(128|s>>12&63),r.push(128|s>>6&63),r.push(128|63&s))}return f(3,r.length),l(r);default:var d;if(Array.isArray(t))for(f(4,d=t.length),n=0;n>5!==e)throw"Invalid indefinite length element";return n}function y(e,t){for(var n=0;n>10),e.push(56320|1023&r))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof n&&(n=function(){});var g=function e(){var s,f,g=c(),v=g>>5,b=31&g;if(7===v)switch(b){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),n=l(),r=32768&n,i=31744&n,o=1023&n;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==o)return o*u;return t.setUint32(0,r<<16|i<<13|o<<13),t.getFloat32(0)}();case 26:return o(r.getFloat32(i),4);case 27:return o(r.getFloat64(i),8)}if((f=p(b))<0&&(v<2||6=0;)_+=f,m.push(a(f));var P=new Uint8Array(_),O=0;for(s=0;s=0;)y(S,f);else y(S,f);return String.fromCharCode.apply(null,S);case 4:var w;if(f<0)for(w=[];!d();)w.push(e());else for(w=new Array(f),s=0;s1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0?a-4:a;for(n=0;n>16&255,s[l++]=t>>8&255,s[l++]=255&t;2===u&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,s[l++]=255&t);1===u&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,s[l++]=t>>8&255,s[l++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,u=n-i;au?u:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,a=[],u=t;u>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){ +var r=n(36),i=n(37),o=n(38);function a(){return s.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function u(e,t){if(a()=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|e}function h(e,t){if(s.isBuffer(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return K(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return B(e).length;default:if(r)return K(e).length;t=(""+t).toLowerCase(),r=!0}}function y(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return M(this,t,n);case"utf8":case"utf-8":return T(this,t,n);case"ascii":return x(this,t,n);case"latin1":case"binary":return A(this,t,n);case"base64":return k(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function g(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function v(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=s.from(t,r)),s.isBuffer(t))return 0===t.length?-1:b(e,t,n,r,i);if("number"==typeof t)return t&=255,s.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):b(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function b(e,t,n,r,i){var o,a=1,u=e.length,s=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,u/=2,s/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;ou&&(n=u-s),o=n;o>=0;o--){for(var f=!0,d=0;di&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function k(e,t,n){return 0===t&&n===e.length?r.fromByteArray(e):r.fromByteArray(e.slice(t,n))}function T(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i239?4:c>223?3:c>191?2:1;if(i+f<=n)switch(f){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(s=(31&c)<<6|63&o)>127&&(l=s);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(s=(15&c)<<12|(63&o)<<6|63&a)>2047&&(s<55296||s>57343)&&(l=s);break;case 4:o=e[i+1],a=e[i+2],u=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&u)&&(s=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&u)>65535&&s<1114112&&(l=s)}null===l?(l=65533,f=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=f}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r0&&(e=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(e+=" ... ")),""},s.prototype.compare=function(e,t,n,r,i){if(!s.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),u=Math.min(o,a),c=this.slice(r,i),l=e.slice(t,n),f=0;fi)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return m(this,e,t,n);case"utf8":case"utf-8":return _(this,e,t,n);case"ascii":return P(this,e,t,n);case"latin1":case"binary":return O(this,e,t,n);case"base64":return S(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},s.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function x(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;ir)&&(n=r);for(var i="",o=t;on)throw new RangeError("Trying to access beyond buffer length")}function R(e,t,n,r,i,o){if(!s.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}function N(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i>>8*(r?i:1-i)}function C(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i>>8*(r?i:3-i)&255}function U(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function I(e,t,n,r,o){return o||U(e,0,n,4),i.write(e,t,n,r,23,4),n+4}function F(e,t,n,r,o){return o||U(e,0,n,8),i.write(e,t,n,r,52,8),n+8}s.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUInt8=function(e,t){return t||j(e,1,this.length),this[e]},s.prototype.readUInt16LE=function(e,t){return t||j(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUInt16BE=function(e,t){return t||j(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUInt32LE=function(e,t){return t||j(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},s.prototype.readUInt32BE=function(e,t){return t||j(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=this[e],i=1,o=0;++o=(i*=128)&&(r-=Math.pow(2,8*t)),r},s.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||j(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},s.prototype.readInt8=function(e,t){return t||j(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},s.prototype.readInt16LE=function(e,t){t||j(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt16BE=function(e,t){t||j(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},s.prototype.readInt32LE=function(e,t){return t||j(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return t||j(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return t||j(e,4,this.length),i.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return t||j(e,8,this.length),i.read(this,e,!1,52,8)},s.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||R(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o=0&&(o*=256);)this[t+i]=e/o&255;return t+n},s.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,255,0),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,65535,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):C(this,e,t,!0),t+4},s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,4294967295,0),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=0,a=1,u=0;for(this[t]=255&e;++o>0)-u&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);R(this,e,t,n,i-1,-i)}var o=n-1,a=1,u=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===u&&0!==this[t+o+1]&&(u=1),this[t+o]=(e/a>>0)-u&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,1,127,-128),s.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):N(this,e,t,!0),t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,2,32767,-32768),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):N(this,e,t,!1),t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),s.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):C(this,e,t,!0),t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||R(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),s.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):C(this,e,t,!1),t+4},s.prototype.writeFloatLE=function(e,t,n){return I(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return I(this,e,t,!1,n)},s.prototype.writeDoubleLE=function(e,t,n){return F(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return F(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t=0;--i)e[i+t]=this[i+n];else if(o<1e3||!s.TYPED_ARRAY_SUPPORT)for(i=0;i>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function B(e){return r.toByteArray(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function G(e,t,n,r){for(var i=0;i=t.length||i>=e.length);++i)t[i+n]=e[i];return i}}).call(this,n(35))},function(e,t,n){"use strict";var r,i,o,a,u,s=s||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)}},a=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||s).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>>2]|=(n[i>>>2]>>>24-i%4*8&255)<<24-(r+i)%4*8;else if(65535>>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>>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>>3]|=parseInt(e.substr(r,2),16)<<24-r%8*4;return new a.init(n,t/2)}},c=u.Latin1={stringify:function(e){var t=e.words;e=e.sigBytes;for(var n=[],r=0;r>>2]>>>24-r%4*8&255));return n.join("")},parse:function(e){for(var t=e.length,n=[],r=0;r>>2]|=(255&e.charCodeAt(r))<<24-r%4*8;return new a.init(n,t)}},l=u.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)))}},f=r.BufferedBlockAlgorithm=o.extend({reset:function(){this._data=new a.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,u=i/(4*o);if(t=(u=t?e.ceil(u):e.max((0|u)-this._minBufferSize,0))*o,i=e.min(4*t,i),t){for(var s=0;sl;){var f;e:{f=c;for(var d=e.sqrt(f),p=2;p<=d;p++)if(!(f%p)){f=!1;break e}f=!0}f&&(8>l&&(o[l]=u(e.pow(c,.5))),a[l]=u(e.pow(c,1/3)),l++),c++}var h=[];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],u=n[3],s=n[4],c=n[5],l=n[6],f=n[7],d=0;64>d;d++){if(16>d)h[d]=0|e[t+d];else{var p=h[d-15],y=h[d-2];h[d]=((p<<25|p>>>7)^(p<<14|p>>>18)^p>>>3)+h[d-7]+((y<<15|y>>>17)^(y<<13|y>>>19)^y>>>10)+h[d-16]}p=f+((s<<26|s>>>6)^(s<<21|s>>>11)^(s<<7|s>>>25))+(s&c^~s&l)+a[d]+h[d],y=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&o^i&o),f=l,l=c,c=s,s=u+p|0,u=o,o=i,i=r,r=p+y|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+o|0,n[3]=n[3]+u|0,n[4]=n[4]+s|0,n[5]=n[5]+c|0,n[6]=n[6]+l|0,n[7]=n[7]+f|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),i=(r=s).enc.Utf8,r.algo.HMAC=r.lib.Base.extend({init:function(e,t){e=this._hasher=new e.init,"string"==typeof t&&(t=i.parse(t));var n=e.blockSize,r=4*n;t.sigBytes>r&&(t=e.finalize(t)),t.clamp();for(var o=this._oKey=t.clone(),a=this._iKey=t.clone(),u=o.words,s=a.words,c=0;c>>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,a=0;4>a&&i+.75*a>>6*(3-a)&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>>6-o%4*2;r[i>>>2]|=(u|s)<<24-i%4*8,i++}return a.create(r,i)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="},function(e){function t(e,t,n,r,i,o,a){return((e=e+(t&n|~t&r)+i+a)<>>32-o)+t}function n(e,t,n,r,i,o,a){return((e=e+(t&r|n&~r)+i+a)<>>32-o)+t}function r(e,t,n,r,i,o,a){return((e=e+(t^n^r)+i+a)<>>32-o)+t}function i(e,t,n,r,i,o,a){return((e=e+(n^(t|~r))+i+a)<>>32-o)+t}for(var o=s,a=(c=o.lib).WordArray,u=c.Hasher,c=o.algo,l=[],f=0;64>f;f++)l[f]=4294967296*e.abs(e.sin(f+1))|0;c=c.MD5=u.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(e,o){for(var a=0;16>a;a++){var u=e[s=o+a];e[s]=16711935&(u<<8|u>>>24)|4278255360&(u<<24|u>>>8)}a=this._hash.words;var s=e[o+0],c=(u=e[o+1],e[o+2]),f=e[o+3],d=e[o+4],p=e[o+5],h=e[o+6],y=e[o+7],g=e[o+8],v=e[o+9],b=e[o+10],m=e[o+11],_=e[o+12],P=e[o+13],O=e[o+14],S=e[o+15],w=t(w=a[0],x=a[1],T=a[2],k=a[3],s,7,l[0]),k=t(k,w,x,T,u,12,l[1]),T=t(T,k,w,x,c,17,l[2]),x=t(x,T,k,w,f,22,l[3]);w=t(w,x,T,k,d,7,l[4]),k=t(k,w,x,T,p,12,l[5]),T=t(T,k,w,x,h,17,l[6]),x=t(x,T,k,w,y,22,l[7]),w=t(w,x,T,k,g,7,l[8]),k=t(k,w,x,T,v,12,l[9]),T=t(T,k,w,x,b,17,l[10]),x=t(x,T,k,w,m,22,l[11]),w=t(w,x,T,k,_,7,l[12]),k=t(k,w,x,T,P,12,l[13]),T=t(T,k,w,x,O,17,l[14]),w=n(w,x=t(x,T,k,w,S,22,l[15]),T,k,u,5,l[16]),k=n(k,w,x,T,h,9,l[17]),T=n(T,k,w,x,m,14,l[18]),x=n(x,T,k,w,s,20,l[19]),w=n(w,x,T,k,p,5,l[20]),k=n(k,w,x,T,b,9,l[21]),T=n(T,k,w,x,S,14,l[22]),x=n(x,T,k,w,d,20,l[23]),w=n(w,x,T,k,v,5,l[24]),k=n(k,w,x,T,O,9,l[25]),T=n(T,k,w,x,f,14,l[26]),x=n(x,T,k,w,g,20,l[27]),w=n(w,x,T,k,P,5,l[28]),k=n(k,w,x,T,c,9,l[29]),T=n(T,k,w,x,y,14,l[30]),w=r(w,x=n(x,T,k,w,_,20,l[31]),T,k,p,4,l[32]),k=r(k,w,x,T,g,11,l[33]),T=r(T,k,w,x,m,16,l[34]),x=r(x,T,k,w,O,23,l[35]),w=r(w,x,T,k,u,4,l[36]),k=r(k,w,x,T,d,11,l[37]),T=r(T,k,w,x,y,16,l[38]),x=r(x,T,k,w,b,23,l[39]),w=r(w,x,T,k,P,4,l[40]),k=r(k,w,x,T,s,11,l[41]),T=r(T,k,w,x,f,16,l[42]),x=r(x,T,k,w,h,23,l[43]),w=r(w,x,T,k,v,4,l[44]),k=r(k,w,x,T,_,11,l[45]),T=r(T,k,w,x,S,16,l[46]),w=i(w,x=r(x,T,k,w,c,23,l[47]),T,k,s,6,l[48]),k=i(k,w,x,T,y,10,l[49]),T=i(T,k,w,x,O,15,l[50]),x=i(x,T,k,w,p,21,l[51]),w=i(w,x,T,k,_,6,l[52]),k=i(k,w,x,T,f,10,l[53]),T=i(T,k,w,x,b,15,l[54]),x=i(x,T,k,w,u,21,l[55]),w=i(w,x,T,k,g,6,l[56]),k=i(k,w,x,T,S,10,l[57]),T=i(T,k,w,x,h,15,l[58]),x=i(x,T,k,w,P,21,l[59]),w=i(w,x,T,k,d,6,l[60]),k=i(k,w,x,T,m,10,l[61]),T=i(T,k,w,x,c,15,l[62]),x=i(x,T,k,w,v,21,l[63]);a[0]=a[0]+w|0,a[1]=a[1]+x|0,a[2]=a[2]+T|0,a[3]=a[3]+k|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=u.clone.call(this);return e._hash=this._hash.clone(),e}}),o.MD5=u._createHelper(c),o.HmacMD5=u._createHmacHelper(c)}(Math),function(){var e,t=s,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=(u=this.cfg).hasher.create(),i=r.create(),o=i.words,a=u.keySize,u=u.iterations;o.length>>2]}},t.BlockCipher=u.extend({cfg:u.cfg.extend({mode:c,padding:f}),reset:function(){u.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 d=t.CipherParams=n.extend({init:function(e){this.mixIn(e)},toString:function(e){return(e||this.formatter).stringify(this)}}),p=(c=(h.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 d.create({ciphertext:e,salt:n})}},t.SerializableCipher=n.extend({cfg:n.extend({format:c}),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,d.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}})),h=(h.kdf={}).OpenSSL={execute:function(e,t,n,i){return i||(i=r.random(8)),e=a.create({keySize:t+n}).compute(e,i),n=r.create(e.words.slice(t),4*n),e.sigBytes=4*t,d.create({key:e,iv:n,salt:i})}},y=t.PasswordBasedCipher=p.extend({cfg:p.cfg.extend({kdf:h}),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=p.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,p.decrypt.call(this,e,t,n.key,r)}})}(),function(){for(var e=s,t=e.lib.BlockCipher,n=e.algo,r=[],i=[],o=[],a=[],u=[],c=[],l=[],f=[],d=[],p=[],h=[],y=0;256>y;y++)h[y]=128>y?y<<1:y<<1^283;var g=0,v=0;for(y=0;256>y;y++){var b=(b=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&b^99;r[g]=b,i[b]=g;var m=h[g],_=h[m],P=h[_],O=257*h[b]^16843008*b;o[g]=O<<24|O>>>8,a[g]=O<<16|O>>>16,u[g]=O<<8|O>>>24,c[g]=O,O=16843009*P^65537*_^257*m^16843008*g,l[b]=O<<24|O>>>8,f[b]=O<<16|O>>>16,d[b]=O<<8|O>>>24,p[b]=O,g?(g=m^h[h[h[P^m]]],v^=h[h[v]]):g=v=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>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=S[o/t|0]<<24),i[o]=i[o-t]^a}for(e=this._invKeySchedule=[],t=0;tt||4>=o?a:l[r[a>>>24]]^f[r[a>>>16&255]]^d[r[a>>>8&255]]^p[r[255&a]]},encryptBlock:function(e,t){this._doCryptBlock(e,t,this._keySchedule,o,a,u,c,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,l,f,d,p,i),n=e[t+1],e[t+1]=e[t+3],e[t+3]=n},_doCryptBlock:function(e,t,n,r,i,o,a,u){for(var s=this._nRounds,c=e[t]^n[0],l=e[t+1]^n[1],f=e[t+2]^n[2],d=e[t+3]^n[3],p=4,h=1;h>>24]^i[l>>>16&255]^o[f>>>8&255]^a[255&d]^n[p++],g=r[l>>>24]^i[f>>>16&255]^o[d>>>8&255]^a[255&c]^n[p++],v=r[f>>>24]^i[d>>>16&255]^o[c>>>8&255]^a[255&l]^n[p++];d=r[d>>>24]^i[c>>>16&255]^o[l>>>8&255]^a[255&f]^n[p++],c=y,l=g,f=v}y=(u[c>>>24]<<24|u[l>>>16&255]<<16|u[f>>>8&255]<<8|u[255&d])^n[p++],g=(u[l>>>24]<<24|u[f>>>16&255]<<16|u[d>>>8&255]<<8|u[255&c])^n[p++],v=(u[f>>>24]<<24|u[d>>>16&255]<<16|u[c>>>8&255]<<8|u[255&l])^n[p++],d=(u[d>>>24]<<24|u[c>>>16&255]<<16|u[l>>>8&255]<<8|u[255&f])^n[p++],e[t]=y,e[t+1]=g,e[t+2]=v,e[t+3]=d},keySize:8});e.AES=t._createHelper(n)}(),s.mode.ECB=((u=s.lib.BlockCipherMode.extend()).Encryptor=u.extend({processBlock:function(e,t){this._cipher.encryptBlock(e,t)}}),u.Decryptor=u.extend({processBlock:function(e,t){this._cipher.decryptBlock(e,t)}}),u),e.exports=s},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(n(2),r(n(10))),s=function(){function e(){(0,i.default)(this,e),(0,a.default)(this,"_listeners",void 0),this._listeners=[]}return(0,o.default)(e,[{key:"addListener",value:function(e){this._listeners.push(e)}},{key:"removeListener",value:function(e){var t=[];this._listeners.forEach((function(n){n!==e&&t.push(n)})),this._listeners=t}},{key:"removeAllListeners",value:function(){this._listeners=[]}},{key:"announcePresence",value:function(e){this._listeners.forEach((function(t){t.presence&&t.presence(e)}))}},{key:"announceStatus",value:function(e){this._listeners.forEach((function(t){t.status&&t.status(e)}))}},{key:"announceMessage",value:function(e){this._listeners.forEach((function(t){t.message&&t.message(e)}))}},{key:"announceSignal",value:function(e){this._listeners.forEach((function(t){t.signal&&t.signal(e)}))}},{key:"announceMessageAction",value:function(e){this._listeners.forEach((function(t){t.messageAction&&t.messageAction(e)}))}},{key:"announceFile",value:function(e){this._listeners.forEach((function(t){t.file&&t.file(e)}))}},{key:"announceObjects",value:function(e){this._listeners.forEach((function(t){t.objects&&t.objects(e)}))}},{key:"announceUser",value:function(e){this._listeners.forEach((function(t){t.user&&t.user(e)}))}},{key:"announceSpace",value:function(e){this._listeners.forEach((function(t){t.space&&t.space(e)}))}},{key:"announceMembership",value:function(e){this._listeners.forEach((function(t){t.membership&&t.membership(e)}))}},{key:"announceNetworkUp",value:function(){var e={};e.category=u.default.PNNetworkUpCategory,this.announceStatus(e)}},{key:"announceNetworkDown",value:function(){var e={};e.category=u.default.PNNetworkDownCategory,this.announceStatus(e)}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNTimeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(){return"/time/0"},t.handleResponse=function(e,t){return{timetoken:t[0]}},t.isAuthSupported=function(){return!1},t.prepareParams=function(){return{}},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){},function(e,t,n){"use strict";var r=n(21),i=Object.prototype.hasOwnProperty,o=Array.isArray,a=function(){for(var e=[],t=0;t<256;++t)e.push("%"+((t<16?"0":"")+t.toString(16)).toUpperCase());return e}(),u=function(e,t){for(var n=t&&t.plainObjects?Object.create(null):{},r=0;r1;){var t=e.pop(),n=t.obj[t.prop];if(o(n)){for(var r=[],i=0;i=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122||o===r.RFC1738&&(40===l||41===l)?s+=u.charAt(c):l<128?s+=a[l]:l<2048?s+=a[192|l>>6]+a[128|63&l]:l<55296||l>=57344?s+=a[224|l>>12]+a[128|l>>6&63]+a[128|63&l]:(c+=1,l=65536+((1023&l)<<10|1023&u.charCodeAt(c)),s+=a[240|l>>18]+a[128|l>>12&63]+a[128|l>>6&63]+a[128|63&l])}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(o(e)){for(var n=[],r=0;r>24,r[o+1]=(16711680&u)>>16,r[o+2]=(65280&u)>>8,r[o+3]=255&u}for(var s=o+3;s>=o;s-=1)0===r[s]&&(i+=1);return i>0?r.buffer.slice(0,r.byteLength-i):r.buffer}function P(e){var t=function(e){return e&&"object"===(0,s.default)(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,a=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(a)?P(a):a})),n}var O=function(e){(0,o.default)(n,e);var t=b(n);function n(e){var r;(0,i.default)(this,n);var o=e.listenToBrowserNetworkEvents,a=void 0===o||o;return e.db=p.default,e.sdkFamily="Web",e.networking=new f.default({del:y.del,get:y.get,post:y.post,patch:y.patch,sendBeacon:m,getfile:y.getfile,postfile:y.postfile}),e.cbor=new h.default((function(e){return P(c.default.decode(e))}),_),e.PubNubFile=v.default,e.cryptography=new g.default,r=t.call(this,e),a&&(window.addEventListener("offline",(function(){r.networkDownDetected()})),window.addEventListener("online",(function(){r.networkUpDetected()}))),r}return n}(l.default);t.default=O,e.exports=t.default},function(e,t,n){var r,i;!function(o,a){"use strict";var u=Math.pow(2,-24),s=Math.pow(2,32),c=Math.pow(2,53);void 0===(i="function"==typeof(r={encode:function(e){var t,n=new ArrayBuffer(256),r=new DataView(n),i=0;function o(e){for(var o=n.byteLength,a=i+e;o>2,c=0;c>6),r.push(128|63&s)):s<55296?(r.push(224|s>>12),r.push(128|s>>6&63),r.push(128|63&s)):(s=(1023&s)<<10,s|=1023&t.charCodeAt(++n),s+=65536,r.push(240|s>>18),r.push(128|s>>12&63),r.push(128|s>>6&63),r.push(128|63&s))}return f(3,r.length),l(r);default:var d;if(Array.isArray(t))for(f(4,d=t.length),n=0;n>5!==e)throw"Invalid indefinite length element";return n}function y(e,t){for(var n=0;n>10),e.push(56320|1023&r))}}"function"!=typeof t&&(t=function(e){return e}),"function"!=typeof n&&(n=function(){});var g=function e(){var s,f,g=c(),v=g>>5,b=31&g;if(7===v)switch(b){case 25:return function(){var e=new ArrayBuffer(4),t=new DataView(e),n=l(),r=32768&n,i=31744&n,o=1023&n;if(31744===i)i=261120;else if(0!==i)i+=114688;else if(0!==o)return o*u;return t.setUint32(0,r<<16|i<<13|o<<13),t.getFloat32(0)}();case 26:return o(r.getFloat32(i),4);case 27:return o(r.getFloat64(i),8)}if((f=p(b))<0&&(v<2||6=0;)_+=f,m.push(a(f));var P=new Uint8Array(_),O=0;for(s=0;s=0;)y(S,f);else y(S,f);return String.fromCharCode.apply(null,S);case 4:var w;if(f<0)for(w=[];!d();)w.push(e());else for(w=new Array(f),s=0;s1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i1?t-1:0),i=1;i0?a-4:a;for(n=0;n>16&255,s[l++]=t>>8&255,s[l++]=255&t;2===u&&(t=i[e.charCodeAt(n)]<<2|i[e.charCodeAt(n+1)]>>4,s[l++]=255&t);1===u&&(t=i[e.charCodeAt(n)]<<10|i[e.charCodeAt(n+1)]<<4|i[e.charCodeAt(n+2)]>>2,s[l++]=t>>8&255,s[l++]=255&t);return s},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,o=[],a=0,u=n-i;au?u:a+16383));1===i?(t=e[n-1],o.push(r[t>>2]+r[t<<4&63]+"==")):2===i&&(t=(e[n-2]<<8)+e[n-1],o.push(r[t>>10]+r[t>>4&63]+r[t<<2&63]+"="));return o.join("")};for(var r=[],i=[],o="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",u=0,s=a.length;u0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function l(e,t,n){for(var i,o,a=[],u=t;u>18&63]+r[o>>12&63]+r[o>>6&63]+r[63&o]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},function(e,t){ /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */ -t.read=function(e,t,n,r,i){var o,a,u=8*i-r-1,s=(1<>1,l=-7,f=n?i-1:0,d=n?-1:1,p=e[t+f];for(f+=d,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+e[t+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,u,s,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,h=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=l?(u=0,a=l):a+f>=1?(u=(t*s-1)*Math.pow(2,i),a+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&u,p+=h,u/=256,i-=8);for(a=a<0;e[n+p]=255&a,p+=h,a/=256,c-=8);e[n+p-h]|=128*y}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(5)),a=r(n(6)),u=r(n(4)),s=(r(n(23)),r(n(8)),r(n(26)),r(n(40))),c=r(n(41)),l=r(n(3)),f=(n(2),r(n(10))),d=function(){function e(t){var n=t.subscribeEndpoint,r=t.leaveEndpoint,i=t.heartbeatEndpoint,a=t.setStateEndpoint,l=t.timeEndpoint,f=t.getFileUrl,d=t.config,p=t.crypto,h=t.listenerManager;(0,o.default)(this,e),(0,u.default)(this,"_crypto",void 0),(0,u.default)(this,"_config",void 0),(0,u.default)(this,"_listenerManager",void 0),(0,u.default)(this,"_reconnectionManager",void 0),(0,u.default)(this,"_leaveEndpoint",void 0),(0,u.default)(this,"_heartbeatEndpoint",void 0),(0,u.default)(this,"_setStateEndpoint",void 0),(0,u.default)(this,"_subscribeEndpoint",void 0),(0,u.default)(this,"_getFileUrl",void 0),(0,u.default)(this,"_channels",void 0),(0,u.default)(this,"_presenceChannels",void 0),(0,u.default)(this,"_heartbeatChannels",void 0),(0,u.default)(this,"_heartbeatChannelGroups",void 0),(0,u.default)(this,"_channelGroups",void 0),(0,u.default)(this,"_presenceChannelGroups",void 0),(0,u.default)(this,"_currentTimetoken",void 0),(0,u.default)(this,"_lastTimetoken",void 0),(0,u.default)(this,"_storedTimetoken",void 0),(0,u.default)(this,"_region",void 0),(0,u.default)(this,"_subscribeCall",void 0),(0,u.default)(this,"_heartbeatTimer",void 0),(0,u.default)(this,"_subscriptionStatusAnnounced",void 0),(0,u.default)(this,"_autoNetworkDetection",void 0),(0,u.default)(this,"_isOnline",void 0),(0,u.default)(this,"_pendingChannelSubscriptions",void 0),(0,u.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,u.default)(this,"_dedupingManager",void 0),this._listenerManager=h,this._config=d,this._leaveEndpoint=r,this._heartbeatEndpoint=i,this._setStateEndpoint=a,this._subscribeEndpoint=n,this._getFileUrl=f,this._crypto=p,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 s.default({timeEndpoint:l}),this._dedupingManager=new c.default({config:d})}return(0,a.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,r=e.state,i=e.channels,o=void 0===i?[]:i,a=e.channelGroups,u=void 0===a?[]:a;return o.forEach((function(e){e in n._channels&&(n._channels[e].state=r)})),u.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)})),this._setStateEndpoint({state:r,channels:o,channelGroups:u},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o;n?(i.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),a.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(i.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),a.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:a},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o,u=e.withPresence,s=void 0!==u&&u,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:{}},s&&(t._presenceChannels[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),a.forEach((function(e){t._channelGroups[e]={state:{}},s&&(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")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o,u=[],s=[];i.forEach((function(e){e in n._channels&&(delete n._channels[e],u.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],u.push(e))})),a.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],s.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],s.push(e))})),0===u.length&&0===s.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:u,channelGroups:s},(function(e){e.affectedChannels=u,e.affectedChannelGroups=s,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())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value: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()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value: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))}}},{key:"_startSubscribeLoop",value: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))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===f.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===f.default.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:f.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===f.default.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=f.default.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 o=t.messages||[],a=this._config,u=a.requestMessageCountThreshold,s=a.dedupeOnSubscribe;if(u&&o.length>=u){var c={};c.category=f.default.PNRequestMessageCountExceededCategory,c.operation=e.operation,this._listenerManager.announceStatus(c)}o.forEach((function(e){var t=e.channel,r=e.subscriptionMatch,o=e.publishMetaData;if(t===r&&(r=null),s){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(l.default.endsWith(e.channel,"-pnpres")){var a={channel:null,subscription:null};a.actualChannel=null!=r?t:null,a.subscribedChannel=null!=r?r:t,t&&(a.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(a.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),a.action=e.payload.action,a.state=e.payload.data,a.timetoken=o.publishTimetoken,a.occupancy=e.payload.occupancy,a.uuid=e.payload.uuid,a.timestamp=e.payload.timestamp,e.payload.join&&(a.join=e.payload.join),e.payload.leave&&(a.leave=e.payload.leave),e.payload.timeout&&(a.timeout=e.payload.timeout),n._listenerManager.announcePresence(a)}else if(1===e.messageType){var u={channel:null,subscription:null};u.channel=t,u.subscription=r,u.timetoken=o.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=e.payload,n._listenerManager.announceSignal(u)}else if(2===e.messageType){var c={channel:null,subscription:null};c.channel=t,c.subscription=r,c.timetoken=o.publishTimetoken,c.publisher=e.issuingClientId,e.userMetadata&&(c.userMetadata=e.userMetadata),c.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(c),"user"===e.payload.type?n._listenerManager.announceUser(c):"space"===e.payload.type?n._listenerManager.announceSpace(c):"membership"===e.payload.type&&n._listenerManager.announceMembership(c)}else if(3===e.messageType){var f={};f.channel=t,f.subscription=r,f.timetoken=o.publishTimetoken,f.publisher=e.issuingClientId,f.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},f.event=e.payload.event,n._listenerManager.announceMessageAction(f)}else if(4===e.messageType){var d={};d.channel=t,d.subscription=r,d.timetoken=o.publishTimetoken,d.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var h=n._crypto.decrypt(e.payload);"object"===(0,i.default)(h)&&null!==h&&(p=h)}e.userMetadata&&(d.userMetadata=e.userMetadata),d.message=p.message,d.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(d)}else{var y={channel:null,subscription:null};y.actualChannel=null!=r?t:null,y.subscribedChannel=null!=r?r:t,y.channel=t,y.subscription=r,y.timetoken=o.publishTimetoken,y.publisher=e.issuingClientId,e.userMetadata&&(y.userMetadata=e.userMetadata),n._config.cipherKey?y.message=n._crypto.decrypt(e.payload):y.message=e.payload,n._listenerManager.announceMessage(y)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(27)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,i.default)(this,e),(0,a.default)(this,"_reconnectionCallback",void 0),(0,a.default)(this,"_timeEndpoint",void 0),(0,a.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,o.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),n(2),function(){function e(t){var n=t.config;(0,i.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,o.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=u,e.exports=t.default},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,c=[],l=!1,f=-1;function d(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=u(d);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;n0&&(t["l_".concat(n)]=i)})),t}},{key:"startLatencyMeasure",value:function(e,t){e!==u.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==u.default.PNSubscribeOperation&&t){var n=this._endpointName(e),r=this._latencies[n],i=this._trackedLatencies[t];r||(r=this._latencies[n]=[]),r.push(Date.now()-i),r.length>this._maximumSamplesCount&&r.splice(0,r.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case u.default.PNPublishOperation:t="pub";break;case u.default.PNSignalOperation:t="sig";break;case u.default.PNHistoryOperation:case u.default.PNFetchMessagesOperation:case u.default.PNDeleteMessagesOperation:case u.default.PNMessageCounts:t="hist";break;case u.default.PNUnsubscribeOperation:case u.default.PNWhereNowOperation:case u.default.PNHereNowOperation:case u.default.PNHeartbeatOperation:case u.default.PNSetStateOperation:case u.default.PNGetStateOperation:t="pres";break;case u.default.PNAddChannelsToGroupOperation:case u.default.PNRemoveChannelsFromGroupOperation:case u.default.PNChannelGroupsOperation:case u.default.PNRemoveGroupOperation:case u.default.PNChannelsForGroupOperation:t="cg";break;case u.default.PNPushNotificationEnabledChannelsOperation:case u.default.PNRemoveAllPushNotificationsOperation:t="push";break;case u.default.PNCreateUserOperation:case u.default.PNUpdateUserOperation:case u.default.PNDeleteUserOperation:case u.default.PNGetUserOperation:case u.default.PNGetUsersOperation:case u.default.PNCreateSpaceOperation:case u.default.PNUpdateSpaceOperation:case u.default.PNDeleteSpaceOperation:case u.default.PNGetSpaceOperation:case u.default.PNGetSpacesOperation:case u.default.PNGetMembersOperation:case u.default.PNUpdateMembersOperation:case u.default.PNGetMembershipsOperation:case u.default.PNUpdateMembershipsOperation:t="obj";break;case u.default.PNAddMessageActionOperation:case u.default.PNRemoveMessageActionOperation:case u.default.PNGetMessageActionsOperation:t="msga";break;case u.default.PNAccessManagerGrant:case u.default.PNAccessManagerAudit:t="pam";break;case u.default.PNAccessManagerGrantToken:case u.default.PNAccessManagerRevokeToken:t="pamv3";break;default:t="time"}return t}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.MPNSNotificationPayload=t.FCMNotificationPayload=t.APNSNotificationPayload=void 0;var i=r(n(45)),o=r(n(22)),a=r(n(14)),u=r(n(16)),s=r(n(13)),c=r(n(5)),l=r(n(6)),f=r(n(4)),d=(n(2),["notification","data"]);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t2){var r=this._payload,o=(r.notification,r.data,(0,i.default)(r,d));e=h(h({},e),o)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}}]),n}(g);t.FCMNotificationPayload=m;var _=function(){function e(t,n){(0,c.default)(this,e),(0,f.default)(this,"_payload",void 0),(0,f.default)(this,"_debugging",void 0),(0,f.default)(this,"_subtitle",void 0),(0,f.default)(this,"_badge",void 0),(0,f.default)(this,"_sound",void 0),(0,f.default)(this,"_title",void 0),(0,f.default)(this,"_body",void 0),(0,f.default)(this,"apns",void 0),(0,f.default)(this,"mpns",void 0),(0,f.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new v(this._payload.apns,t,n),this.mpns=new b(this._payload.mpns,t,n),this.fcm=new m(this._payload.fcm,t,n)}return(0,l.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}},{key:"buildPayload",value: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}();t.default=_},function(e,t,n){var r=n(46);e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),n(2),function(){function e(t,n){(0,i.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_cbor",void 0),(0,a.default)(this,"_token",void 0),this._config=t,this._cbor=n}return(0,o.default)(e,[{key:"setToken",value:function(e){e&&e.length>0?this._token=e:this._token=void 0}},{key:"getToken",value:function(){return this._token}},{key:"extractPermissions",value: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}},{key:"parseToken",value: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),a=n.pat.uuid?Object.keys(n.pat.uuid):[],u=Object.keys(n.pat.chan),s=Object.keys(n.pat.grp),c={version:n.v,timestamp:n.t,ttl:n.ttl,authorized_uuid:n.uuid},l=r.length>0,f=i.length>0,d=o.length>0;(l||f||d)&&(c.resources={},l&&(c.resources.uuids={},r.forEach((function(e){c.resources.uuids[e]=t.extractPermissions(n.res.uuid[e])}))),f&&(c.resources.channels={},i.forEach((function(e){c.resources.channels[e]=t.extractPermissions(n.res.chan[e])}))),d&&(c.resources.groups={},o.forEach((function(e){c.resources.groups[e]=t.extractPermissions(n.res.grp[e])}))));var p=a.length>0,h=u.length>0,y=s.length>0;return(p||h||y)&&(c.patterns={},p&&(c.patterns.uuids={},a.forEach((function(e){c.patterns.uuids[e]=t.extractPermissions(n.pat.uuid[e])}))),h&&(c.patterns.channels={},u.forEach((function(e){c.patterns.channels[e]=t.extractPermissions(n.pat.chan[e])}))),y&&(c.patterns.groups={},s.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}());t.default=u,e.exports=t.default},function(e,t,n){var r=n(13),i=n(15),o=n(49),a=n(50);function u(t){var n="function"==typeof Map?new Map:void 0;return e.exports=u=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return a(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,u(t)}e.exports=u,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(15),i=n(51);function o(t,n,a){return i()?(e.exports=o=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=o=function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o},e.exports.default=e.exports,e.exports.__esModule=!0),o.apply(null,arguments)}e.exports=o,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAddChannelsToGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveChannelsFromGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n),"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelGroupsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.handleResponse=function(e,t){return{groups:t.payload.groups}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelsForGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,o=t.environment,a=void 0===o?"development":o,u=t.topic,s={type:n,add:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:a,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!o)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,o=t.environment,a=void 0===o?"development":o,u=t.topic,s={type:n,remove:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:a,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!o)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(e,t){return{channels:t}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,o=t.topic,a={type:n};"apns2"===n&&delete(a=Object.assign({},a,{environment:i,topic:o})).type;return a},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveAllPushNotificationsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n,"/remove");return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n,"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,o=t.topic,a={type:n};"apns2"===n&&delete(a=Object.assign({},a,{environment:i,topic:o})).type;return a},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUnsubscribeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/leave")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNWhereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(o.default.encodeString(i))},t.handleResponse=function(e,t){if(!t.payload)return{channels:[]};return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHeartbeatOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/heartbeat")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,o=void 0===i?{}:i,a=e.config,u={};r.length>0&&(u["channel-group"]=r.join(","));return u.state=JSON.stringify(o),u.heartbeat=a.getPresenceTimeout(),u},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,a=t.channels,u=void 0===a?[]:a,s=u.length>0?u.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/uuid/").concat(i)},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,a=void 0===o?[]:o,u={};1===i.length&&0===a.length?u[i[0]]=t.payload:u=t.payload;return{channels:u}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/uuid/").concat(o.default.encodeString(n.UUID),"/data")},t.handleResponse=function(e,t){return{state:t.payload}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,o={};o.state=JSON.stringify(n),i.length>0&&(o["channel-group"]=i.join(","));return o},t.validateParams=function(e,t){var n=e.config,r=t.state,i=t.channels,o=void 0===i?[]:i,a=t.channelGroups,u=void 0===a?[]:a;if(!r)return"Missing State";if(!n.subscribeKey)return"Missing Subscribe Key";if(0===o.length&&0===u.length)return"Please provide a list of channels and/or channel-groups"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=t.channelGroups,u=void 0===o?[]:o,s="/v2/presence/sub-key/".concat(n.subscribeKey);if(i.length>0||u.length>0){var c=i.length>0?i.join(","):",";s+="/channel/".concat(a.default.encodeString(c))}return s},t.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.")},t.handleResponse=function(e,t,n){var r,i=n.channels,o=void 0===i?[]:i,a=n.channelGroups,u=void 0===a?[]:a,s=n.includeUUIDs,c=void 0===s||s,l=n.includeState,f=void 0!==l&&l;r=o.length>1||u.length>0||0===u.length&&0===o.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},c&&r.uuids.forEach((function(e){f?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[o[0]]={occupants:n,name:o[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){f?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}();return r},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,o=void 0===i||i,a=t.includeState,u=void 0!==a&&a,c=t.queryParameters,l=void 0===c?{}:c,f={};o||(f.disable_uuids=1);u&&(f.state=1);r.length>0&&(f["channel-group"]=r.join(","));return f=s(s({},f),l)},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};var i=r(n(4)),o=(n(2),r(n(1))),a=r(n(3));function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t15)return"Action.type value exceed maximum length of 15"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveMessageActionOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken,a=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(r),"/message/").concat(a,"/action/").concat(i)},t.handleResponse=function(e,t){return{data:t.data}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken;if(!t.messageTimetoken)return"Missing message timetoken";if(!i)return"Missing action timetoken";if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMessageActionsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,r=t.start,i=t.end,o={};n&&(o.limit=n);r&&(o.start=r);i&&(o.end=i);return o},t.validateParams=function(e,t){var n=e.config,r=t.channel;if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){if(null==t||!t.channel)return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(1)),a=r(n(3)),u={getOperation:function(){return o.default.PNPublishFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.fileId?null!=t&&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(a.default.encodeString(t.channel),"/0/").concat(a.default.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"===(0,i.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(11)),o=r(n(12)),a=n(18),u=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,r,s,c,l,f,d,p,h=(r=(t=e).generateUploadUrl,s=t.publishFile,c=t.modules,l=c.PubNubFile,f=c.config,d=c.cryptography,p=c.networking,n=(0,o.default)(i.default.mark((function e(t){var n,o,c,h,y,g,v,b,m,_,P,O,S,w,k,T,x,A,M,E,j,R;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,o=t.file,c=t.message,h=t.cipherKey,y=t.meta,g=t.ttl,v=t.storeInHistory,n){e.next=3;break}throw new a.PubNubError("Validation failed, check status for details",(0,a.createValidationError)("channel can't be empty"));case 3:if(o){e.next=5;break}throw new a.PubNubError("Validation failed, check status for details",(0,a.createValidationError)("file can't be empty"));case 5:return b=l.create(o),e.next=8,r({channel:n,name:b.name});case 8:if(m=e.sent,_=m.file_upload_request,P=_.url,O=_.form_fields,S=m.data,w=S.id,k=S.name,!l.supportsEncryptFile||!(null!=h?h:f.cipherKey)){e.next=19;break}return e.next=18,d.encryptFile(null!=h?h:f.cipherKey,b,l);case 18:b=e.sent;case 19:if(T=O,b.mimeType&&(T=O.map((function(e){return"Content-Type"===e.key?{key:e.key,value:b.mimeType}:e}))),e.prev=21,!l.supportsFileUri||!o.uri){e.next=34;break}return e.t0=p,e.t1=P,e.t2=T,e.next=28,b.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:x=e.sent,e.next=71;break;case 34:if(!l.supportsFile){e.next=46;break}return e.t4=p,e.t5=P,e.t6=T,e.next=40,b.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:x=e.sent,e.next=71;break;case 46:if(!l.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=P,e.t10=T,e.next=52,b.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:x=e.sent,e.next=71;break;case 58:if(!l.supportsBlob){e.next=70;break}return e.t12=p,e.t13=P,e.t14=T,e.next=64,b.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:x=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,u(e.t16.response);case 77:throw A=e.sent,M=/(.*)<\/Message>/gi.exec(A),new a.PubNubError(M?"Upload to bucket failed: ".concat(M[1]):"Upload to bucket failed.",e.t16);case 80:if(204===x.status){e.next=82;break}throw new a.PubNubError("Upload to bucket was unsuccessful",x);case 82:E=f.fileUploadPublishRetryLimit,j=!1,R={timetoken:"0"};case 85:return e.prev=85,e.next=88,s({channel:n,message:c,fileId:w,fileName:k,meta:y,storeInHistory:v,ttl:g});case 88:R=e.sent,j=!0,e.next=95;break;case 92:e.prev=92,e.t17=e.catch(85),E-=1;case 95:if(!j&&E>0){e.next=85;break}case 96:if(j){e.next=100;break}throw new a.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:w,name:k});case 100:return e.abrupt("return",{timetoken:R.timetoken,id:w,name:k});case 101:case"end":return e.stop()}}),e,null,[[21,73],[85,92]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=h(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return k()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=_(a,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function d(){}function p(){}var h={};u(h,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(w([])));g&&g!==t&&n.call(g,i)&&(h=g);var v=p.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var r;this._invoke=function(i,o){function a(){return new t((function(r,a){!function r(i,o,a,u){var s=c(e[i],e,o);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function _(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function w(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(18),o=r(n(3));t.default=function(e,t){var n=t.channel,r=t.id,a=t.name,u=e.config,s=e.networking;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!a)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var c="/v1/files/".concat(u.subscribeKey,"/channels/").concat(o.default.encodeString(n),"/files/").concat(r,"/").concat(a),l={};l.uuid=u.getUUID(),l.pnsdk=(0,i.generatePNSDK)(u),u.getAuthKey()&&(l.auth=u.getAuthKey()),u.secretKey&&(0,i.signRequest)(e,c,l,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var f=Object.keys(l).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(l[e]))})).join("&");return""!==f?"".concat(s.getStandardOrigin()).concat(c,"?").concat(f):"".concat(s.getStandardOrigin()).concat(c)},e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,o=r(n(11)),a=r(n(12)),u=r(n(1)),s=r(n(3)),c={getOperation:function(){return u.default.PNDownloadFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.name?null!=t&&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(s.default.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:(i=(0,a.default)(o.default.mark((function e(t,n,r){var i,a,u,s,c,l,f;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.PubNubFile,s=t.config,c=t.cryptography,l=n.response.body,!u.supportsEncryptFile||!(null!==(i=r.cipherKey)&&void 0!==i?i:s.cipherKey)){e.next=6;break}return e.next=5,c.decrypt(null!==(f=r.cipherKey)&&void 0!==f?f:s.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",u.create({data:l,name:null!==(a=n.response.name)&&void 0!==a?a:r.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.id?null!=t&&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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(9)),o=r(n(1)),a={getOperation:function(){return o.default.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,o,a,u,s,c,l,f,d={};(null!=t&&null!==(n=t.include)&&void 0!==n&&n.customFields&&(d.include="custom"),null!=t&&null!==(r=t.include)&&void 0!==r&&r.totalCount)&&(d.count=null===(s=t.include)||void 0===s?void 0:s.totalCount);null!=t&&null!==(o=t.page)&&void 0!==o&&o.next&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next);null!=t&&null!==(a=t.page)&&void 0!==a&&a.prev&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev);(null!=t&&t.filter&&(d.filter=t.filter),d.limit=null!==(u=null==t?void 0:t.limit)&&void 0!==u?u:100,null!=t&&t.sort)&&(d.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,i.default)(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n})));return d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=a,e.exports=t.default},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(83);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(r.include=o)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing UserId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUsersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNCreateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing SpaceId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpacesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom"),n.userFields&&u.push("user"),n.customUserFields&&u.push("user.custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,r=t.updateMembers,i=t.removeMembers,o=t.users,a={};n&&n.length>0&&(a.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.add.push(t)})));r&&r.length>0&&(a.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));o&&o.length>0&&(a.update=a.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));i&&i.length>0&&(a.remove=[],i.forEach((function(e){a.remove.push({id:e})})));return a}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom"),n.spaceFields&&u.push("space"),n.customSpaceFields&&u.push("space.custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,r=t.updateMemberships,i=t.removeMemberships,o=t.spaces,a={};n&&n.length>0&&(a.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.add.push(t)})));r&&r.length>0&&(a.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));o&&o.length>0&&(a.update=a.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));i&&i.length>0&&(a.remove=[],i.forEach((function(e){a.remove.push({id:e})})));return a}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerAudit},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,o=void 0===i?[]:i,a={};n&&(a.channel=n);r&&(a["channel-group"]=r);o.length>0&&(a.auth=o.join(","));return a},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerGrant},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,o=void 0===i?[]:i,a=t.uuids,u=void 0===a?[]:a,s=t.ttl,c=t.read,l=void 0!==c&&c,f=t.write,d=void 0!==f&&f,p=t.manage,h=void 0!==p&&p,y=t.get,g=void 0!==y&&y,v=t.join,b=void 0!==v&&v,m=t.update,_=void 0!==m&&m,P=t.authKeys,O=void 0===P?[]:P,S=t.delete,w={};w.r=l?"1":"0",w.w=d?"1":"0",w.m=h?"1":"0",w.d=S?"1":"0",w.g=g?"1":"0",w.j=b?"1":"0",w.u=_?"1":"0",r.length>0&&(w.channel=r.join(","));o.length>0&&(w["channel-group"]=o.join(","));O.length>0&&(w.auth=O.join(","));u.length>0&&(w["target-uuid"]=u.join(","));(s||0===s)&&(w.ttl=s);return w},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(null!=t.uuids&&!t.authKeys)return"authKeys are required for grant request on uuids";if(null!=t.uuids&&(null!=t.channels||null!=t.channelGroups))return"Both channel/channelgroup and uuid cannot be used in the same request"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.extractPermissions=o,t.getOperation=function(){return i.default.PNAccessManagerGrantToken},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.handleResponse=function(e,t){return t.data.token},t.isAuthSupported=function(){return!1},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,r=t.resources,i=t.patterns,a=t.meta,u=t.authorized_uuid,s={ttl:0,permissions:{resources:{channels:{},groups:{},uuids:{},users:{},spaces:{}},patterns:{channels:{},groups:{},uuids:{},users:{},spaces:{}},meta:{}}};if(r){var c=r.uuids,l=r.channels,f=r.groups;c&&Object.keys(c).forEach((function(e){s.permissions.resources.uuids[e]=o(c[e])})),l&&Object.keys(l).forEach((function(e){s.permissions.resources.channels[e]=o(l[e])})),f&&Object.keys(f).forEach((function(e){s.permissions.resources.groups[e]=o(f[e])}))}if(i){var d=i.uuids,p=i.channels,h=i.groups;d&&Object.keys(d).forEach((function(e){s.permissions.patterns.uuids[e]=o(d[e])})),p&&Object.keys(p).forEach((function(e){s.permissions.patterns.channels[e]=o(p[e])})),h&&Object.keys(h).forEach((function(e){s.permissions.patterns.groups[e]=o(h[e])}))}(n||0===n)&&(s.ttl=n);a&&(s.permissions.meta=a);u&&(s.permissions.uuid="".concat(u));return s}(0,t)},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.prepareParams=function(){return{}},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(!t.resources&&!t.patterns)return"Missing either Resources or Patterns.";if(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))return"Missing values for either Resources or Patterns."};n(2);var i=r(n(1));function o(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNPublishOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,o=u(e,i);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0/").concat(a.default.encodeString(o))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){var n=t.message;return u(e,n)},t.postURL=function(e,t){var n=e.config,r=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0")},t.prepareParams=function(e,t){var n=t.meta,r=t.replicate,o=void 0===r||r,a=t.storeInHistory,u=t.ttl,s={};null!=a&&(s.store=a?"1":"0");u&&(s.ttl=u);!1===o&&(s.norep="true");n&&"object"===(0,i.default)(n)&&(s.meta=JSON.stringify(n));return s},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};var i=r(n(7)),o=(n(2),r(n(1))),a=r(n(3));function u(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSignalOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,a=(u=i,JSON.stringify(u));var u;return"/signal/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(a))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHistoryOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v2/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};Array.isArray(t[0])&&t[0].forEach((function(t){var r={timetoken:t.timetoken,entry:a(e,t.message)};t.meta&&(r.meta=t.meta),n.messages.push(r)}));return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.reverse,o=t.count,a=void 0===o?100:o,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f={include_token:"true"};f.count=a,n&&(f.start=n);r&&(f.end=r);s&&(f.string_message_token="true");null!=i&&(f.reverse=i.toString());l&&(f.include_meta="true");return f},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3));function a(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v3/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i={};n&&(i.start=n);r&&(i.end=r);return i},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNMessageCounts},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(i))},t.handleResponse=function(e,t){return{channels:t.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,r=t.channelTimetokens,o={};if(r&&1===r.length){var a=(0,i.default)(r,1)[0];o.timetoken=a}else r?o.channelsTimetoken=r.join(","):n&&(o.timetoken=n);return o},t.validateParams=function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,o=e.config;if(!n)return"Missing channel";if(r&&i)return"timetoken and channelTimetokens are incompatible together";if(r&&i&&i.length>1&&n.length!==i.length)return"Length of channelTimetokens and channels do not match";if(!o.subscribeKey)return"Missing Subscribe Key"};var i=r(n(9)),o=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNFetchMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.includeMessageActions,a=void 0!==i&&i,u=e.config,s=a?"history-with-actions":"history",c=r.length>0?r.join(","):",";return"/v3/".concat(s,"/sub-key/").concat(u.subscribeKey,"/channel/").concat(o.default.encodeString(c))},t.handleResponse=function(e,t){var n={channels:{}};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);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,r=t.start,i=t.end,o=t.includeMessageActions,a=t.count,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f=t.includeUuid,d=t.includeUUID,p=void 0===d||d,h=t.includeMessageType,y=void 0===h||h,g={};g.max=a||(n.length>1||!0===o?25:100);r&&(g.start=r);i&&(g.end=i);s&&(g.string_message_token="true");l&&(g.include_meta="true");p&&!1!==f&&(g.include_uuid="true");y&&(g.include_message_type="true");return g},t.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.")};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSubscribeOperation},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(o.default.encodeString(a),"/0")},t.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}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,r=t.state,i=t.channelGroups,o=void 0===i?[]:i,a=t.timetoken,u=t.filterExpression,s=t.region,c={heartbeat:n.getPresenceTimeout()};o.length>0&&(c["channel-group"]=o.join(","));u&&u.length>0&&(c["filter-expr"]=u);Object.keys(r).length&&(c.state=JSON.stringify(r));a&&(c.tt=a);s&&(c.tr=s);return c},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),r(n(10))),s=(n(2),function(){function e(t){var n=this;(0,i.default)(this,e),(0,a.default)(this,"_modules",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_currentSubDomain",void 0),(0,a.default)(this,"_standardOrigin",void 0),(0,a.default)(this,"_subscribeOrigin",void 0),(0,a.default)(this,"_requestTimeout",void 0),(0,a.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,o.default)(e,[{key:"init",value: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()}},{key:"nextOrigin",value: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)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"PATCH",value:function(e,t,n,r){return this._modules.patch(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}};t.default=r,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(5)),a=r(n(6)),u=r(n(4)),s=function(){function e(t,n){(0,o.default)(this,e),(0,u.default)(this,"_base64ToBinary",void 0),(0,u.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,a.default)(e,[{key:"decodeToken",value: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"===(0,i.default)(r))return r}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.del=function(e,t,n){var r=a.default.delete(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.get=function(e,t,n){var r=a.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.getfile=function(e,t,n){var r=a.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.patch=function(e,t,n,r){var i=a.default.patch(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return s.call(this,i,n,r)},t.post=function(e,t,n,r){var i=a.default.post(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return s.call(this,i,n,r)},t.postfile=function(e,t,n){return c.apply(this,arguments)};var i=r(n(11)),o=r(n(12)),a=r(n(129));n(2);function u(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 s(e,t,n){var r=this;this._config.logVerbosity&&(e=e.use(u)),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;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)).end((function(e,i){var o,a={};if(a.error=null!==e,a.operation=t.operation,i&&i.status&&(a.statusCode=i.status),e){if(e.response&&e.response.text&&!r._config.logVerbosity)try{a.errorData=JSON.parse(e.response.text)}catch(t){a.errorData=e}else a.errorData=e;return a.category=r._detectErrorCategory(e),n(a,null)}if(t.ignoreBody)o={headers:i.headers,redirects:i.redirects,response:i};else try{o=JSON.parse(i.text)}catch(e){return a.errorData=i,a.error=!0,n(a,null)}return o.error&&1===o.error&&o.status&&o.message&&o.service?(a.errorData=o,a.statusCode=o.status,a.error=!0,a.category=r._detectErrorCategory(a),n(a,null)):(o.error&&o.error.message&&(a.errorData=o.error),n(a,o))})),i}function c(){return(c=(0,o.default)(i.default.mark((function e(t,n,r){var o,u;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=a.default.post(t),n.forEach((function(e){var t=e.key,n=e.value;o=o.field(t,n)})),o.attach("file",r,{contentType:"application/octet-stream"}),e.next=5,o;case 5:return u=e.sent,e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},function(e,t,n){"use strict";function r(e){return(r="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})(e)}var i;"undefined"!=typeof window?i=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),i=void 0):i=self;var o=n(130),a=n(131),u=n(132),s=n(144),c=n(30),l=n(145),f=n(147);function d(){}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 p=t=e.exports;t.Request=_,p.getXHR=function(){if(i.XMLHttpRequest&&(!i.location||"file:"!==i.location.protocol||!i.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 h="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function y(e){if(!c(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(c(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 v(e){for(var t,n,r={},i=e.split("&"),o=0,a=i.length;o0||e instanceof Object)?t(e):null)},m.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},p.Response=m,o(_.prototype),s(_.prototype),_.prototype.type=function(e){return this.set("Content-Type",p.types[e]||e),this},_.prototype.accept=function(e){return this.set("Accept",p.types[e]||e),this},_.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"===r(t)&&null!==t&&(n=t,t=""),n||(n={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,n,i)},_.prototype.query=function(e){return"string"!=typeof e&&(e=y(e)),e&&this._query.push(e),this},_.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},_.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},_.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)},_.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)},_.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},_.prototype.ca=_.prototype.agent,_.prototype.buffer=_.prototype.ca,_.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},_.prototype.pipe=_.prototype.write,_.prototype._isHost=function(e){return e&&"object"===r(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},_.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||d,this._finalizeQueryString(),this._end()},_.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},_.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=p.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||p.serialize[i?i.split(";")[0]:""];!o&&b(i)&&(o=p.serialize["application/json"]),o&&(n=o(n))}for(var a in this.header)null!==this.header[a]&&Object.prototype.hasOwnProperty.call(this.header,a)&&t.setRequestHeader(a,this.header[a]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},p.agent=function(){return new f},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){f.prototype[e.toLowerCase()]=function(t,n){var r=new p.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),f.prototype.del=f.prototype.delete,p.get=function(e,t,n){var r=p("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},p.head=function(e,t,n){var r=p("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},p.options=function(e,t,n){var r=p("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.del=P,p.delete=P,p.patch=function(e,t,n){var r=p("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.post=function(e,t,n){var r=p("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.put=function(e,t,n){var r=p("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.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;is.depthLimit)return void a("[...]",t,n,o);if(void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void a("[...]",t,n,o);if(i.push(t),Array.isArray(t))for(c=0;ct?1:0}function s(e,t,o,s){void 0===s&&(s=i());var l,f=function e(t,r,i,o,s,c,l){var f;if(c+=1,"object"==typeof t&&null!==t){for(f=0;fl.depthLimit)return void a("[...]",t,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a("[...]",t,r,s);if(o.push(t),Array.isArray(t))for(f=0;f0)for(var i=0;i0?w.join(",")||null:void 0}];else if(s(d))N=d;else{var U=Object.keys(w);N=p?U.sort(p):U}for(var I=0;I0?_+m:""}},function(e,t,n){"use strict";var r=n(19),i=n(139),o=n(141),a=r("%TypeError%"),u=r("%WeakMap%",!0),s=r("%Map%",!0),c=i("WeakMap.prototype.get",!0),l=i("WeakMap.prototype.set",!0),f=i("WeakMap.prototype.has",!0),d=i("Map.prototype.get",!0),p=i("Map.prototype.set",!0),h=i("Map.prototype.has",!0),y=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new a("Side channel does not contain "+o(e))},get:function(r){if(u&&r&&("object"==typeof r||"function"==typeof r)){if(e)return c(e,r)}else if(s){if(t)return d(t,r)}else if(n)return function(e,t){var n=y(e,t);return n&&n.value}(n,r)},has:function(r){if(u&&r&&("object"==typeof r||"function"==typeof r)){if(e)return f(e,r)}else if(s){if(t)return h(t,r)}else if(n)return function(e,t){return!!y(e,t)}(n,r);return!1},set:function(r,i){u&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new u),l(e,r,i)):s?(t||(t=new s),p(t,r,i)):(n||(n={key:{},next:null}),function(e,t,n){var r=y(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,i))}};return r}},function(e,t,n){"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(136);e.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(e,t,n){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(e,t,n){"use strict";var r="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==o.call(t))throw new TypeError(r+t);for(var n,a=i.call(arguments,1),u=function(){if(this instanceof n){var r=t.apply(this,a.concat(i.call(arguments)));return Object(r)===r?r:this}return t.apply(e,a.concat(i.call(arguments)))},s=Math.max(0,t.length-a.length),c=[],l=0;l-1?i(n):n}},function(e,t,n){"use strict";var r=n(20),i=n(19),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||r.call(a,o),s=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=u(r,a,arguments);if(s&&c){var n=s(t,"length");n.configurable&&c(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var f=function(){return u(r,o,arguments)};c?c(e.exports,"apply",{value:f}):e.exports.apply=f},function(e,t,n){var r="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=r&&i&&"function"==typeof i.get?i.get:null,a=r&&Map.prototype.forEach,u="function"==typeof Set&&Set.prototype,s=Object.getOwnPropertyDescriptor&&u?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=u&&s&&"function"==typeof s.get?s.get:null,l=u&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,b="function"==typeof BigInt?BigInt.prototype.valueOf:null,m=Object.getOwnPropertySymbols,_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,S=Object.prototype.propertyIsEnumerable,w=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),k=n(142).custom,T=k&&E(k)?k:null;function x(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function A(e){return String(e).replace(/"/g,""")}function M(e){return!("[object Array]"!==N(e)||O&&"object"==typeof e&&O in e)}function E(e){if(P)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!_)return!1;try{return _.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,r,i){var u=n||{};if(R(u,"quoteStyle")&&"single"!==u.quoteStyle&&"double"!==u.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(R(u,"maxStringLength")&&("number"==typeof u.maxStringLength?u.maxStringLength<0&&u.maxStringLength!==1/0:null!==u.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!R(u,"customInspect")||u.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(R(u,"indent")&&null!==u.indent&&"\t"!==u.indent&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return function e(t,n){if(t.length>n.maxStringLength){var r=t.length-n.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return e(t.slice(0,n.maxStringLength),n)+i}return x(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,U),"single",n)}(t,u);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var y=void 0===u.depth?5:u.depth;if(void 0===r&&(r=0),r>=y&&y>0&&"object"==typeof t)return M(t)?"[Array]":"[Object]";var m=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=Array(e.indent+1).join(" ")}return{base:n,prev:Array(t+1).join(n)}}(u,r);if(void 0===i)i=[];else if(C(i,t)>=0)return"[Circular]";function S(t,n,o){if(n&&(i=i.slice()).push(n),o){var a={depth:u.depth};return R(u,"quoteStyle")&&(a.quoteStyle=u.quoteStyle),e(t,a,r+1,i)}return e(t,u,r+1,i)}if("function"==typeof t){var k=function(e){if(e.name)return e.name;var t=v.call(g.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),j=K(t,S);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(j.length>0?" { "+j.join(", ")+" }":"")}if(E(t)){var B=P?String(t).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):_.call(t);return"object"!=typeof t||P?B:I(B)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var G="<"+String(t.nodeName).toLowerCase(),q=t.attributes||[],H=0;H"}if(M(t)){if(0===t.length)return"[]";var z=K(t,S);return m&&!function(e){for(var t=0;t=0)return!1;return!0}(z)?"["+L(z,m)+"]":"[ "+z.join(", ")+" ]"}if(function(e){return!("[object Error]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)){var W=K(t,S);return 0===W.length?"["+String(t)+"]":"{ ["+String(t)+"] "+W.join(", ")+" }"}if("object"==typeof t&&s){if(T&&"function"==typeof t[T])return t[T]();if("symbol"!==s&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var V=[];return a.call(t,(function(e,n){V.push(S(n,t,!0)+" => "+S(e,t))})),F("Map",o.call(t),V,m)}if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var Y=[];return l.call(t,(function(e){Y.push(S(e,t))})),F("Set",c.call(t),Y,m)}if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return D("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return D("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return D("WeakRef");if(function(e){return!("[object Number]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(S(Number(t)));if(function(e){if(!e||"object"!=typeof e||!b)return!1;try{return b.call(e),!0}catch(e){}return!1}(t))return I(S(b.call(t)));if(function(e){return!("[object Boolean]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(h.call(t));if(function(e){return!("[object String]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(S(String(t)));if(!function(e){return!("[object Date]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)&&!function(e){return!("[object RegExp]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)){var J=K(t,S),$=w?w(t)===Object.prototype:t instanceof Object||t.constructor===Object,X=t instanceof Object?"":"null prototype",Q=!$&&O&&Object(t)===t&&O in t?N(t).slice(8,-1):X?"Object":"",Z=($||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(Q||X?"["+[].concat(Q||[],X||[]).join(": ")+"] ":"");return 0===J.length?Z+"{}":m?Z+"{"+L(J,m)+"}":Z+"{ "+J.join(", ")+" }"}return String(t)};var j=Object.prototype.hasOwnProperty||function(e){return e in this};function R(e,t){return j.call(e,t)}function N(e){return y.call(e)}function C(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n-1?e.split(","):e},c=function(e,t,n,r){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,u=n.depth>0&&/(\[[^[\]]*])/.exec(o),c=u?o.slice(0,u.index):o,l=[];if(c){if(!n.plainObjects&&i.call(Object.prototype,c)&&!n.allowPrototypes)return;l.push(c)}for(var f=0;n.depth>0&&null!==(u=a.exec(o))&&f=0;--o){var a,u=e[o];if("[]"===u&&n.parseArrays)a=[].concat(i);else{a=n.plainObjects?Object.create(null):{};var c="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,l=parseInt(c,10);n.parseArrays||""!==c?!isNaN(l)&&u!==c&&String(l)===c&&l>=0&&n.parseArrays&&l<=n.arrayLimit?(a=[])[l]=i:a[c]=i:a={0:i}}i=a}return i}(l,t,n,r)}};e.exports=function(e,t){var n=function(e){if(!e)return a;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?a.charset:e.charset;return{allowDots:void 0===e.allowDots?a.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var n,c={},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,f=t.parameterLimit===1/0?void 0:t.parameterLimit,d=l.split(t.delimiter,f),p=-1,h=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(g=o(g)?[g]:g),i.call(c,y)?c[y]=r.combine(c[y],g):c[y]=g}return c}(e,n):e,f=n.plainObjects?Object.create(null):{},d=Object.keys(l),p=0;p=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&&u.has(t.status))return!0;if(e){if(e.code&&a.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},o.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()},o.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)},o.prototype.catch=function(e){return this.then(void 0,e)},o.prototype.use=function(e){return e(this),this},o.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},o.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},o.prototype.get=function(e){return this._header[e.toLowerCase()]},o.prototype.getHeader=o.prototype.get,o.prototype.set=function(e,t){if(i(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},o.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},o.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(i(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},o.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},o.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},o.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},o.prototype.redirects=function(e){return this._maxRedirects=e,this},o.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},o.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},o.prototype.send=function(e){var t=i(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&&i(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},o.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},o.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("&")}}},o.prototype._appendQueryString=function(){console.warn("Unsupported")},o.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)}},o.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))}},function(e,t,n){"use strict";var r=n(146);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.get=function(e){return this.header[e.toLowerCase()]},i.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=r.type(t);var n=r.params(t);for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(this[i]=n[i]);this.links={};try{e.link&&(this.links=r.parseLinks(e.link))}catch(e){}},i.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}},function(e,t,n){"use strict";function r(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 i(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 i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 a,u=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n>1,l=-7,f=n?i-1:0,d=n?-1:1,p=e[t+f];for(f+=d,o=p&(1<<-l)-1,p>>=-l,l+=u;l>0;o=256*o+e[t+f],f+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+f],f+=d,l-=8);if(0===o)o=1-c;else{if(o===s)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,r),o-=c}return(p?-1:1)*a*Math.pow(2,o-r)},t.write=function(e,t,n,r,i,o){var a,u,s,c=8*o-i-1,l=(1<>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=r?0:o-1,h=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(s=Math.pow(2,-a))<1&&(a--,s*=2),(t+=a+f>=1?d/s:d*Math.pow(2,1-f))*s>=2&&(a++,s/=2),a+f>=l?(u=0,a=l):a+f>=1?(u=(t*s-1)*Math.pow(2,i),a+=f):(u=t*Math.pow(2,f-1)*Math.pow(2,i),a=0));i>=8;e[n+p]=255&u,p+=h,u/=256,i-=8);for(a=a<0;e[n+p]=255&a,p+=h,a/=256,c-=8);e[n+p-h]|=128*y}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(5)),a=r(n(6)),u=r(n(4)),s=(r(n(23)),r(n(8)),r(n(26)),r(n(40))),c=r(n(41)),l=r(n(3)),f=(n(2),r(n(10))),d=function(){function e(t){var n=t.subscribeEndpoint,r=t.leaveEndpoint,i=t.heartbeatEndpoint,a=t.setStateEndpoint,l=t.timeEndpoint,f=t.getFileUrl,d=t.config,p=t.crypto,h=t.listenerManager;(0,o.default)(this,e),(0,u.default)(this,"_crypto",void 0),(0,u.default)(this,"_config",void 0),(0,u.default)(this,"_listenerManager",void 0),(0,u.default)(this,"_reconnectionManager",void 0),(0,u.default)(this,"_leaveEndpoint",void 0),(0,u.default)(this,"_heartbeatEndpoint",void 0),(0,u.default)(this,"_setStateEndpoint",void 0),(0,u.default)(this,"_subscribeEndpoint",void 0),(0,u.default)(this,"_getFileUrl",void 0),(0,u.default)(this,"_channels",void 0),(0,u.default)(this,"_presenceChannels",void 0),(0,u.default)(this,"_heartbeatChannels",void 0),(0,u.default)(this,"_heartbeatChannelGroups",void 0),(0,u.default)(this,"_channelGroups",void 0),(0,u.default)(this,"_presenceChannelGroups",void 0),(0,u.default)(this,"_currentTimetoken",void 0),(0,u.default)(this,"_lastTimetoken",void 0),(0,u.default)(this,"_storedTimetoken",void 0),(0,u.default)(this,"_region",void 0),(0,u.default)(this,"_subscribeCall",void 0),(0,u.default)(this,"_heartbeatTimer",void 0),(0,u.default)(this,"_subscriptionStatusAnnounced",void 0),(0,u.default)(this,"_autoNetworkDetection",void 0),(0,u.default)(this,"_isOnline",void 0),(0,u.default)(this,"_pendingChannelSubscriptions",void 0),(0,u.default)(this,"_pendingChannelGroupSubscriptions",void 0),(0,u.default)(this,"_dedupingManager",void 0),this._listenerManager=h,this._config=d,this._leaveEndpoint=r,this._heartbeatEndpoint=i,this._setStateEndpoint=a,this._subscribeEndpoint=n,this._getFileUrl=f,this._crypto=p,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 s.default({timeEndpoint:l}),this._dedupingManager=new c.default({config:d})}return(0,a.default)(e,[{key:"adaptStateChange",value:function(e,t){var n=this,r=e.state,i=e.channels,o=void 0===i?[]:i,a=e.channelGroups,u=void 0===a?[]:a;return o.forEach((function(e){e in n._channels&&(n._channels[e].state=r)})),u.forEach((function(e){e in n._channelGroups&&(n._channelGroups[e].state=r)})),this._setStateEndpoint({state:r,channels:o,channelGroups:u},t)}},{key:"adaptPresenceChange",value:function(e){var t=this,n=e.connected,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o;n?(i.forEach((function(e){t._heartbeatChannels[e]={state:{}}})),a.forEach((function(e){t._heartbeatChannelGroups[e]={state:{}}}))):(i.forEach((function(e){e in t._heartbeatChannels&&delete t._heartbeatChannels[e]})),a.forEach((function(e){e in t._heartbeatChannelGroups&&delete t._heartbeatChannelGroups[e]})),!1===this._config.suppressLeaveEvents&&this._leaveEndpoint({channels:i,channelGroups:a},(function(e){t._listenerManager.announceStatus(e)}))),this.reconnect()}},{key:"adaptSubscribeChange",value:function(e){var t=this,n=e.timetoken,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o,u=e.withPresence,s=void 0!==u&&u,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:{}},s&&(t._presenceChannels[e]={}),(l||t._config.getHeartbeatInterval())&&(t._heartbeatChannels[e]={}),t._pendingChannelSubscriptions.push(e)})),a.forEach((function(e){t._channelGroups[e]={state:{}},s&&(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")}},{key:"adaptUnsubscribeChange",value:function(e,t){var n=this,r=e.channels,i=void 0===r?[]:r,o=e.channelGroups,a=void 0===o?[]:o,u=[],s=[];i.forEach((function(e){e in n._channels&&(delete n._channels[e],u.push(e),e in n._heartbeatChannels&&delete n._heartbeatChannels[e]),e in n._presenceChannels&&(delete n._presenceChannels[e],u.push(e))})),a.forEach((function(e){e in n._channelGroups&&(delete n._channelGroups[e],s.push(e),e in n._heartbeatChannelGroups&&delete n._heartbeatChannelGroups[e]),e in n._presenceChannelGroups&&(delete n._channelGroups[e],s.push(e))})),0===u.length&&0===s.length||(!1!==this._config.suppressLeaveEvents||t||this._leaveEndpoint({channels:u,channelGroups:s},(function(e){e.affectedChannels=u,e.affectedChannelGroups=s,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())}},{key:"unsubscribeAll",value:function(e){this.adaptUnsubscribeChange({channels:this.getSubscribedChannels(),channelGroups:this.getSubscribedChannelGroups()},e)}},{key:"getHeartbeatChannels",value:function(){return Object.keys(this._heartbeatChannels)}},{key:"getHeartbeatChannelGroups",value:function(){return Object.keys(this._heartbeatChannelGroups)}},{key:"getSubscribedChannels",value:function(){return Object.keys(this._channels)}},{key:"getSubscribedChannelGroups",value:function(){return Object.keys(this._channelGroups)}},{key:"reconnect",value:function(){this._startSubscribeLoop(),this._registerHeartbeatTimer()}},{key:"disconnect",value:function(){this._stopSubscribeLoop(),this._stopHeartbeatTimer(),this._reconnectionManager.stopPolling()}},{key:"_registerHeartbeatTimer",value: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()))}},{key:"_stopHeartbeatTimer",value:function(){this._heartbeatTimer&&(clearInterval(this._heartbeatTimer),this._heartbeatTimer=null)}},{key:"_performHeartbeatLoop",value: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))}}},{key:"_startSubscribeLoop",value: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))}}},{key:"_processSubscribeResponse",value:function(e,t){var n=this;if(e.error)e.category===f.default.PNTimeoutCategory?this._startSubscribeLoop():e.category===f.default.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:f.default.PNReconnectedCategory,operation:e.operation,lastTimetoken:n._lastTimetoken,currentTimetoken:n._currentTimetoken};n._listenerManager.announceStatus(t)})),this._reconnectionManager.startPolling(),this._listenerManager.announceStatus(e)):e.category===f.default.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=f.default.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 o=t.messages||[],a=this._config,u=a.requestMessageCountThreshold,s=a.dedupeOnSubscribe;if(u&&o.length>=u){var c={};c.category=f.default.PNRequestMessageCountExceededCategory,c.operation=e.operation,this._listenerManager.announceStatus(c)}o.forEach((function(e){var t=e.channel,r=e.subscriptionMatch,o=e.publishMetaData;if(t===r&&(r=null),s){if(n._dedupingManager.isDuplicate(e))return;n._dedupingManager.addEntry(e)}if(l.default.endsWith(e.channel,"-pnpres")){var a={channel:null,subscription:null};a.actualChannel=null!=r?t:null,a.subscribedChannel=null!=r?r:t,t&&(a.channel=t.substring(0,t.lastIndexOf("-pnpres"))),r&&(a.subscription=r.substring(0,r.lastIndexOf("-pnpres"))),a.action=e.payload.action,a.state=e.payload.data,a.timetoken=o.publishTimetoken,a.occupancy=e.payload.occupancy,a.uuid=e.payload.uuid,a.timestamp=e.payload.timestamp,e.payload.join&&(a.join=e.payload.join),e.payload.leave&&(a.leave=e.payload.leave),e.payload.timeout&&(a.timeout=e.payload.timeout),n._listenerManager.announcePresence(a)}else if(1===e.messageType){var u={channel:null,subscription:null};u.channel=t,u.subscription=r,u.timetoken=o.publishTimetoken,u.publisher=e.issuingClientId,e.userMetadata&&(u.userMetadata=e.userMetadata),u.message=e.payload,n._listenerManager.announceSignal(u)}else if(2===e.messageType){var c={channel:null,subscription:null};c.channel=t,c.subscription=r,c.timetoken=o.publishTimetoken,c.publisher=e.issuingClientId,e.userMetadata&&(c.userMetadata=e.userMetadata),c.message={event:e.payload.event,type:e.payload.type,data:e.payload.data},n._listenerManager.announceObjects(c),"user"===e.payload.type?n._listenerManager.announceUser(c):"space"===e.payload.type?n._listenerManager.announceSpace(c):"membership"===e.payload.type&&n._listenerManager.announceMembership(c)}else if(3===e.messageType){var f={};f.channel=t,f.subscription=r,f.timetoken=o.publishTimetoken,f.publisher=e.issuingClientId,f.data={messageTimetoken:e.payload.data.messageTimetoken,actionTimetoken:e.payload.data.actionTimetoken,type:e.payload.data.type,uuid:e.issuingClientId,value:e.payload.data.value},f.event=e.payload.event,n._listenerManager.announceMessageAction(f)}else if(4===e.messageType){var d={};d.channel=t,d.subscription=r,d.timetoken=o.publishTimetoken,d.publisher=e.issuingClientId;var p=e.payload;if(n._config.cipherKey){var h=n._crypto.decrypt(e.payload);"object"===(0,i.default)(h)&&null!==h&&(p=h)}e.userMetadata&&(d.userMetadata=e.userMetadata),d.message=p.message,d.file={id:p.file.id,name:p.file.name,url:n._getFileUrl({id:p.file.id,name:p.file.name,channel:t})},n._listenerManager.announceFile(d)}else{var y={channel:null,subscription:null};y.actualChannel=null!=r?t:null,y.subscribedChannel=null!=r?r:t,y.channel=t,y.subscription=r,y.timetoken=o.publishTimetoken,y.publisher=e.issuingClientId,e.userMetadata&&(y.userMetadata=e.userMetadata),n._config.cipherKey?y.message=n._crypto.decrypt(e.payload):y.message=e.payload,n._listenerManager.announceMessage(y)}})),this._region=t.metadata.region,this._startSubscribeLoop()}}},{key:"_stopSubscribeLoop",value:function(){this._subscribeCall&&("function"==typeof this._subscribeCall.abort&&this._subscribeCall.abort(),this._subscribeCall=null)}}]),e}();t.default=d,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(27)),n(2),function(){function e(t){var n=t.timeEndpoint;(0,i.default)(this,e),(0,a.default)(this,"_reconnectionCallback",void 0),(0,a.default)(this,"_timeEndpoint",void 0),(0,a.default)(this,"_timeTimer",void 0),this._timeEndpoint=n}return(0,o.default)(e,[{key:"onReconnection",value:function(e){this._reconnectionCallback=e}},{key:"startPolling",value:function(){this._timeTimer=setInterval(this._performTimeLoop.bind(this),3e3)}},{key:"stopPolling",value:function(){clearInterval(this._timeTimer)}},{key:"_performTimeLoop",value:function(){var e=this;this._timeEndpoint((function(t){t.error||(clearInterval(e._timeTimer),e._reconnectionCallback())}))}}]),e}());t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),n(2),function(){function e(t){var n=t.config;(0,i.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"hashHistory",void 0),this.hashHistory=[],this._config=n}return(0,o.default)(e,[{key:"getKey",value:function(e){var t=function(e){var t=0;if(0===e.length)return t;for(var n=0;n=this._config.maximumCacheSize&&this.hashHistory.shift(),this.hashHistory.push(this.getKey(e))}},{key:"clearHistory",value:function(){this.hashHistory=[]}}]),e}());t.default=u,e.exports=t.default},function(e,t){var n,r,i=e.exports={};function o(){throw new Error("setTimeout has not been defined")}function a(){throw new Error("clearTimeout has not been defined")}function u(e){if(n===setTimeout)return setTimeout(e,0);if((n===o||!n)&&setTimeout)return n=setTimeout,setTimeout(e,0);try{return n(e,0)}catch(t){try{return n.call(null,e,0)}catch(t){return n.call(this,e,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:o}catch(e){n=o}try{r="function"==typeof clearTimeout?clearTimeout:a}catch(e){r=a}}();var s,c=[],l=!1,f=-1;function d(){l&&s&&(l=!1,s.length?c=s.concat(c):f=-1,c.length&&p())}function p(){if(!l){var e=u(d);l=!0;for(var t=c.length;t;){for(s=c,c=[];++f1)for(var n=1;n0&&(t["l_".concat(n)]=i)})),t}},{key:"startLatencyMeasure",value:function(e,t){e!==u.default.PNSubscribeOperation&&t&&(this._trackedLatencies[t]=Date.now())}},{key:"stopLatencyMeasure",value:function(e,t){if(e!==u.default.PNSubscribeOperation&&t){var n=this._endpointName(e),r=this._latencies[n],i=this._trackedLatencies[t];r||(r=this._latencies[n]=[]),r.push(Date.now()-i),r.length>this._maximumSamplesCount&&r.splice(0,r.length-this._maximumSamplesCount),delete this._trackedLatencies[t]}}},{key:"_averageLatency",value:function(e){return Math.floor(e.reduce((function(e,t){return e+t}),0)/e.length)}},{key:"_endpointName",value:function(e){var t=null;switch(e){case u.default.PNPublishOperation:t="pub";break;case u.default.PNSignalOperation:t="sig";break;case u.default.PNHistoryOperation:case u.default.PNFetchMessagesOperation:case u.default.PNDeleteMessagesOperation:case u.default.PNMessageCounts:t="hist";break;case u.default.PNUnsubscribeOperation:case u.default.PNWhereNowOperation:case u.default.PNHereNowOperation:case u.default.PNHeartbeatOperation:case u.default.PNSetStateOperation:case u.default.PNGetStateOperation:t="pres";break;case u.default.PNAddChannelsToGroupOperation:case u.default.PNRemoveChannelsFromGroupOperation:case u.default.PNChannelGroupsOperation:case u.default.PNRemoveGroupOperation:case u.default.PNChannelsForGroupOperation:t="cg";break;case u.default.PNPushNotificationEnabledChannelsOperation:case u.default.PNRemoveAllPushNotificationsOperation:t="push";break;case u.default.PNCreateUserOperation:case u.default.PNUpdateUserOperation:case u.default.PNDeleteUserOperation:case u.default.PNGetUserOperation:case u.default.PNGetUsersOperation:case u.default.PNCreateSpaceOperation:case u.default.PNUpdateSpaceOperation:case u.default.PNDeleteSpaceOperation:case u.default.PNGetSpaceOperation:case u.default.PNGetSpacesOperation:case u.default.PNGetMembersOperation:case u.default.PNUpdateMembersOperation:case u.default.PNGetMembershipsOperation:case u.default.PNUpdateMembershipsOperation:t="obj";break;case u.default.PNAddMessageActionOperation:case u.default.PNRemoveMessageActionOperation:case u.default.PNGetMessageActionsOperation:t="msga";break;case u.default.PNAccessManagerGrant:case u.default.PNAccessManagerAudit:t="pam";break;case u.default.PNAccessManagerGrantToken:case u.default.PNAccessManagerRevokeToken:t="pamv3";break;default:t="time"}return t}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.MPNSNotificationPayload=t.FCMNotificationPayload=t.APNSNotificationPayload=void 0;var i=r(n(45)),o=r(n(22)),a=r(n(14)),u=r(n(16)),s=r(n(13)),c=r(n(5)),l=r(n(6)),f=r(n(4)),d=(n(2),["notification","data"]);function p(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function h(e){for(var t=1;t2){var r=this._payload,o=(r.notification,r.data,(0,i.default)(r,d));e=h(h({},e),o)}return this._isSilent?e.notification=this._payload.notification:t=this._payload.notification,Object.keys(e).length&&(n.data=e),t&&Object.keys(t).length&&(n.notification=t),Object.keys(n).length?n:null}}]),n}(g);t.FCMNotificationPayload=m;var _=function(){function e(t,n){(0,c.default)(this,e),(0,f.default)(this,"_payload",void 0),(0,f.default)(this,"_debugging",void 0),(0,f.default)(this,"_subtitle",void 0),(0,f.default)(this,"_badge",void 0),(0,f.default)(this,"_sound",void 0),(0,f.default)(this,"_title",void 0),(0,f.default)(this,"_body",void 0),(0,f.default)(this,"apns",void 0),(0,f.default)(this,"mpns",void 0),(0,f.default)(this,"fcm",void 0),this._payload={apns:{},mpns:{},fcm:{}},this._title=t,this._body=n,this.apns=new v(this._payload.apns,t,n),this.mpns=new b(this._payload.mpns,t,n),this.fcm=new m(this._payload.fcm,t,n)}return(0,l.default)(e,[{key:"debugging",set:function(e){this._debugging=e}},{key:"title",get:function(){return this._title}},{key:"body",get:function(){return this._body}},{key:"subtitle",get:function(){return this._subtitle},set:function(e){this._subtitle=e,this.apns.subtitle=e,this.mpns.subtitle=e,this.fcm.subtitle=e}},{key:"badge",get:function(){return this._badge},set:function(e){this._badge=e,this.apns.badge=e,this.mpns.badge=e,this.fcm.badge=e}},{key:"sound",get:function(){return this._sound},set:function(e){this._sound=e,this.apns.sound=e,this.mpns.sound=e,this.fcm.sound=e}},{key:"buildPayload",value: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}();t.default=_},function(e,t,n){var r=n(46);e.exports=function(e,t){if(null==e)return{};var n,i,o=r(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,i={},o=Object.keys(e);for(r=0;r=0||(i[n]=e[n]);return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),n(2),function(){function e(t,n){(0,i.default)(this,e),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_cbor",void 0),(0,a.default)(this,"_token",void 0),this._config=t,this._cbor=n}return(0,o.default)(e,[{key:"setToken",value:function(e){e&&e.length>0?this._token=e:this._token=void 0}},{key:"getToken",value:function(){return this._token}},{key:"extractPermissions",value: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}},{key:"parseToken",value: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),a=n.pat.uuid?Object.keys(n.pat.uuid):[],u=Object.keys(n.pat.chan),s=Object.keys(n.pat.grp),c={version:n.v,timestamp:n.t,ttl:n.ttl,authorized_uuid:n.uuid},l=r.length>0,f=i.length>0,d=o.length>0;(l||f||d)&&(c.resources={},l&&(c.resources.uuids={},r.forEach((function(e){c.resources.uuids[e]=t.extractPermissions(n.res.uuid[e])}))),f&&(c.resources.channels={},i.forEach((function(e){c.resources.channels[e]=t.extractPermissions(n.res.chan[e])}))),d&&(c.resources.groups={},o.forEach((function(e){c.resources.groups[e]=t.extractPermissions(n.res.grp[e])}))));var p=a.length>0,h=u.length>0,y=s.length>0;return(p||h||y)&&(c.patterns={},p&&(c.patterns.uuids={},a.forEach((function(e){c.patterns.uuids[e]=t.extractPermissions(n.pat.uuid[e])}))),h&&(c.patterns.channels={},u.forEach((function(e){c.patterns.channels[e]=t.extractPermissions(n.pat.chan[e])}))),y&&(c.patterns.groups={},s.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}());t.default=u,e.exports=t.default},function(e,t,n){var r=n(13),i=n(15),o=n(49),a=n(50);function u(t){var n="function"==typeof Map?new Map:void 0;return e.exports=u=function(e){if(null===e||!o(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==n){if(n.has(e))return n.get(e);n.set(e,t)}function t(){return a(e,arguments,r(this).constructor)}return t.prototype=Object.create(e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),i(t,e)},e.exports.default=e.exports,e.exports.__esModule=!0,u(t)}e.exports=u,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){return-1!==Function.toString.call(e).indexOf("[native code]")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(15),i=n(51);function o(t,n,a){return i()?(e.exports=o=Reflect.construct,e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=o=function(e,t,n){var i=[null];i.push.apply(i,t);var o=new(Function.bind.apply(e,i));return n&&r(o,n.prototype),o},e.exports.default=e.exports,e.exports.__esModule=!0),o.apply(null,arguments)}e.exports=o,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAddChannelsToGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{add:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveChannelsFromGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels;return{remove:(void 0===n?[]:n).join(",")}},t.validateParams=function(e,t){var n=t.channels,r=t.channelGroup,i=e.config;if(!r)return"Missing Channel Group";if(!n||0===n.length)return"Missing Channels";if(!i.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n),"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelGroupsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/channel-registration/sub-key/".concat(t.subscribeKey,"/channel-group")},t.handleResponse=function(e,t){return{groups:t.payload.groups}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNChannelsForGroupOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channelGroup,r=e.config;return"/v1/channel-registration/sub-key/".concat(r.subscribeKey,"/channel-group/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=t.channelGroup,r=e.config;if(!n)return"Missing Channel Group";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,o=t.environment,a=void 0===o?"development":o,u=t.topic,s={type:n,add:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:a,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!o)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.channels,i=void 0===r?[]:r,o=t.environment,a=void 0===o?"development":o,u=t.topic,s={type:n,remove:i.join(",")};"apns2"===n&&delete(s=Object.assign({},s,{environment:a,topic:u})).type;return s},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.channels,o=t.topic,a=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!o)return"Missing APNS2 topic";if(!i||0===i.length)return"Missing Channels";if(!a.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNPushNotificationEnabledChannelsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n);return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n)},t.handleResponse=function(e,t){return{channels:t}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,o=t.topic,a={type:n};"apns2"===n&&delete(a=Object.assign({},a,{environment:i,topic:o})).type;return a},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveAllPushNotificationsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.device,r=t.pushGateway,i=e.config;if("apns2"===r)return"/v2/push/sub-key/".concat(i.subscribeKey,"/devices-apns2/").concat(n,"/remove");return"/v1/push/sub-key/".concat(i.subscribeKey,"/devices/").concat(n,"/remove")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.pushGateway,r=t.environment,i=void 0===r?"development":r,o=t.topic,a={type:n};"apns2"===n&&delete(a=Object.assign({},a,{environment:i,topic:o})).type;return a},t.validateParams=function(e,t){var n=t.device,r=t.pushGateway,i=t.topic,o=e.config;if(!n)return"Missing Device ID (device)";if(!r)return"Missing GW Type (pushGateway: gcm, apns or apns2)";if("apns2"===r&&!i)return"Missing APNS2 topic";if(!o.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUnsubscribeOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/leave")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNWhereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(o.default.encodeString(i))},t.handleResponse=function(e,t){if(!t.payload)return{channels:[]};return{channels:t.payload.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHeartbeatOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/heartbeat")},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.state,o=void 0===i?{}:i,a=e.config,u={};r.length>0&&(u["channel-group"]=r.join(","));return u.state=JSON.stringify(o),u.heartbeat=a.getPresenceTimeout(),u},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.uuid,i=void 0===r?n.UUID:r,a=t.channels,u=void 0===a?[]:a,s=u.length>0?u.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(s),"/uuid/").concat(i)},t.handleResponse=function(e,t,n){var r=n.channels,i=void 0===r?[]:r,o=n.channelGroups,a=void 0===o?[]:o,u={};1===i.length&&0===a.length?u[i[0]]=t.payload:u=t.payload;return{channels:u}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i={};r.length>0&&(i["channel-group"]=r.join(","));return i},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSetStateOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/presence/sub-key/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(a),"/uuid/").concat(o.default.encodeString(n.UUID),"/data")},t.handleResponse=function(e,t){return{state:t.payload}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.state,r=t.channelGroups,i=void 0===r?[]:r,o={};o.state=JSON.stringify(n),i.length>0&&(o["channel-group"]=i.join(","));return o},t.validateParams=function(e,t){var n=e.config,r=t.state,i=t.channels,o=void 0===i?[]:i,a=t.channelGroups,u=void 0===a?[]:a;if(!r)return"Missing State";if(!n.subscribeKey)return"Missing Subscribe Key";if(0===o.length&&0===u.length)return"Please provide a list of channels and/or channel-groups"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNHereNowOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,o=t.channelGroups,u=void 0===o?[]:o,s="/v2/presence/sub-key/".concat(n.subscribeKey);if(i.length>0||u.length>0){var c=i.length>0?i.join(","):",";s+="/channel/".concat(a.default.encodeString(c))}return s},t.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.")},t.handleResponse=function(e,t,n){var r,i=n.channels,o=void 0===i?[]:i,a=n.channelGroups,u=void 0===a?[]:a,s=n.includeUUIDs,c=void 0===s||s,l=n.includeState,f=void 0!==l&&l;r=o.length>1||u.length>0||0===u.length&&0===o.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},c&&r.uuids.forEach((function(e){f?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[o[0]]={occupants:n,name:o[0],occupancy:t.occupancy},c&&t.uuids&&t.uuids.forEach((function(e){f?n.push({state:e.state,uuid:e.uuid}):n.push({state:null,uuid:e})})),e}();return r},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channelGroups,r=void 0===n?[]:n,i=t.includeUUIDs,o=void 0===i||i,a=t.includeState,u=void 0!==a&&a,c=t.queryParameters,l=void 0===c?{}:c,f={};o||(f.disable_uuids=1);u&&(f.state=1);r.length>0&&(f["channel-group"]=r.join(","));return f=s(s({},f),l)},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};var i=r(n(4)),o=(n(2),r(n(1))),a=r(n(3));function u(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t15)return"Action.type value exceed maximum length of 15"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNRemoveMessageActionOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken,a=t.messageTimetoken;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(r),"/message/").concat(a,"/action/").concat(i)},t.handleResponse=function(e,t){return{data:t.data}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.channel,i=t.actionTimetoken;if(!t.messageTimetoken)return"Missing message timetoken";if(!i)return"Missing action timetoken";if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMessageActionsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel;return"/v1/message-actions/".concat(n.subscribeKey,"/channel/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){var n={data:t.data,start:null,end:null};n.data.length&&(n.end=n.data[n.data.length-1].actionTimetoken,n.start=n.data[0].actionTimetoken);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.limit,r=t.start,i=t.end,o={};n&&(o.limit=n);r&&(o.start=r);i&&(o.end=i);return o},t.validateParams=function(e,t){var n=e.config,r=t.channel;if(!n.subscribeKey)return"Missing Subscribe Key";if(!r)return"Missing message channel"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){if(null==t||!t.channel)return"channel can't be empty"},getURL:function(e,t){var n=e.config;return"/v1/files/".concat(n.subscribeKey,"/channels/").concat(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNGenerateUploadUrlOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(1)),a=r(n(3)),u={getOperation:function(){return o.default.PNPublishFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.fileId?null!=t&&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(a.default.encodeString(t.channel),"/0/").concat(a.default.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"===(0,i.default)(t.meta)&&(n.meta=JSON.stringify(t.meta)),n},handleResponse:function(e,t){return{timetoken:t[2]}}};t.default=u,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(11)),o=r(n(12)),a=n(18),u=function(e){return new Promise((function(t){var n="";e.on("data",(function(e){n+=e.toString("utf8")})),e.on("end",(function(){t(n)}))}))};t.default=function(e){var t,n,r,s,c,l,f,d,p,h=(r=(t=e).generateUploadUrl,s=t.publishFile,c=t.modules,l=c.PubNubFile,f=c.config,d=c.cryptography,p=c.networking,n=(0,o.default)(i.default.mark((function e(t){var n,o,c,h,y,g,v,b,m,_,P,O,S,w,k,T,x,A,M,E,j,R;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.channel,o=t.file,c=t.message,h=t.cipherKey,y=t.meta,g=t.ttl,v=t.storeInHistory,n){e.next=3;break}throw new a.PubNubError("Validation failed, check status for details",(0,a.createValidationError)("channel can't be empty"));case 3:if(o){e.next=5;break}throw new a.PubNubError("Validation failed, check status for details",(0,a.createValidationError)("file can't be empty"));case 5:return b=l.create(o),e.next=8,r({channel:n,name:b.name});case 8:if(m=e.sent,_=m.file_upload_request,P=_.url,O=_.form_fields,S=m.data,w=S.id,k=S.name,!l.supportsEncryptFile||!(null!=h?h:f.cipherKey)){e.next=19;break}return e.next=18,d.encryptFile(null!=h?h:f.cipherKey,b,l);case 18:b=e.sent;case 19:if(T=O,b.mimeType&&(T=O.map((function(e){return"Content-Type"===e.key?{key:e.key,value:b.mimeType}:e}))),e.prev=21,!l.supportsFileUri||!o.uri){e.next=34;break}return e.t0=p,e.t1=P,e.t2=T,e.next=28,b.toFileUri();case 28:return e.t3=e.sent,e.next=31,e.t0.POSTFILE.call(e.t0,e.t1,e.t2,e.t3);case 31:x=e.sent,e.next=71;break;case 34:if(!l.supportsFile){e.next=46;break}return e.t4=p,e.t5=P,e.t6=T,e.next=40,b.toFile();case 40:return e.t7=e.sent,e.next=43,e.t4.POSTFILE.call(e.t4,e.t5,e.t6,e.t7);case 43:x=e.sent,e.next=71;break;case 46:if(!l.supportsBuffer){e.next=58;break}return e.t8=p,e.t9=P,e.t10=T,e.next=52,b.toBuffer();case 52:return e.t11=e.sent,e.next=55,e.t8.POSTFILE.call(e.t8,e.t9,e.t10,e.t11);case 55:x=e.sent,e.next=71;break;case 58:if(!l.supportsBlob){e.next=70;break}return e.t12=p,e.t13=P,e.t14=T,e.next=64,b.toBlob();case 64:return e.t15=e.sent,e.next=67,e.t12.POSTFILE.call(e.t12,e.t13,e.t14,e.t15);case 67:x=e.sent,e.next=71;break;case 70:throw new Error("Unsupported environment");case 71:e.next=80;break;case 73:return e.prev=73,e.t16=e.catch(21),e.next=77,u(e.t16.response);case 77:throw A=e.sent,M=/(.*)<\/Message>/gi.exec(A),new a.PubNubError(M?"Upload to bucket failed: ".concat(M[1]):"Upload to bucket failed.",e.t16);case 80:if(204===x.status){e.next=82;break}throw new a.PubNubError("Upload to bucket was unsuccessful",x);case 82:E=f.fileUploadPublishRetryLimit,j=!1,R={timetoken:"0"};case 85:return e.prev=85,e.next=88,s({channel:n,message:c,fileId:w,fileName:k,meta:y,storeInHistory:v,ttl:g});case 88:R=e.sent,j=!0,e.next=95;break;case 92:e.prev=92,e.t17=e.catch(85),E-=1;case 95:if(!j&&E>0){e.next=85;break}case 96:if(j){e.next=100;break}throw new a.PubNubError("Publish failed. You may want to execute that operation manually using pubnub.publishFile",{channel:n,id:w,name:k});case 100:return e.abrupt("return",{timetoken:R.timetoken,id:w,name:k});case 101:case"end":return e.stop()}}),e,null,[[21,73],[85,92]])}))),function(e){return n.apply(this,arguments)});return function(e,t){var n=h(e);return"function"==typeof t?(n.then((function(e){return t(null,e)})).catch((function(e){return t(e,null)})),n):n}},e.exports=t.default},function(e,t,n){var r=function(e){"use strict";var t=Object.prototype,n=t.hasOwnProperty,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",o=r.asyncIterator||"@@asyncIterator",a=r.toStringTag||"@@toStringTag";function u(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,n){return e[t]=n}}function s(e,t,n,r){var i=t&&t.prototype instanceof f?t:f,o=Object.create(i.prototype),a=new S(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return k()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var u=_(a,n);if(u){if(u===l)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var s=c(e,t,n);if("normal"===s.type){if(r=n.done?"completed":"suspendedYield",s.arg===l)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(r="completed",n.method="throw",n.arg=s.arg)}}}(e,n,a),o}function c(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}e.wrap=s;var l={};function f(){}function d(){}function p(){}var h={};u(h,i,(function(){return this}));var y=Object.getPrototypeOf,g=y&&y(y(w([])));g&&g!==t&&n.call(g,i)&&(h=g);var v=p.prototype=f.prototype=Object.create(h);function b(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var r;this._invoke=function(i,o){function a(){return new t((function(r,a){!function r(i,o,a,u){var s=c(e[i],e,o);if("throw"!==s.type){var l=s.arg,f=l.value;return f&&"object"==typeof f&&n.call(f,"__await")?t.resolve(f.__await).then((function(e){r("next",e,a,u)}),(function(e){r("throw",e,a,u)})):t.resolve(f).then((function(e){l.value=e,a(l)}),(function(e){return r("throw",e,a,u)}))}u(s.arg)}(i,o,r,a)}))}return r=r?r.then(a,a):a()}}function _(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,_(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var r=c(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,l;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function O(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function S(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function w(e){if(e){var t=e[i];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,o=function t(){for(;++r=0;--i){var o=this.tryEntries[i],a=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=n.call(o,"catchLoc"),s=n.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&n.call(i,"finallyLoc")&&this.prev=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),O(n),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;O(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:w(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=r}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(18),o=r(n(3));t.default=function(e,t){var n=t.channel,r=t.id,a=t.name,u=e.config,s=e.networking;if(!n)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("channel can't be empty"));if(!r)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file id can't be empty"));if(!a)throw new i.PubNubError("Validation failed, check status for details",(0,i.createValidationError)("file name can't be empty"));var c="/v1/files/".concat(u.subscribeKey,"/channels/").concat(o.default.encodeString(n),"/files/").concat(r,"/").concat(a),l={};l.uuid=u.getUUID(),l.pnsdk=(0,i.generatePNSDK)(u),u.getAuthKey()&&(l.auth=u.getAuthKey()),u.secretKey&&(0,i.signRequest)(e,c,l,{},{getOperation:function(){return"PubNubGetFileUrlOperation"}});var f=Object.keys(l).map((function(e){return"".concat(encodeURIComponent(e),"=").concat(encodeURIComponent(l[e]))})).join("&");return""!==f?"".concat(s.getStandardOrigin()).concat(c,"?").concat(f):"".concat(s.getStandardOrigin()).concat(c)},e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,o=r(n(11)),a=r(n(12)),u=r(n(1)),s=r(n(3)),c={getOperation:function(){return u.default.PNDownloadFileOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.name?null!=t&&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(s.default.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:(i=(0,a.default)(o.default.mark((function e(t,n,r){var i,a,u,s,c,l,f;return o.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(u=t.PubNubFile,s=t.config,c=t.cryptography,l=n.response.body,!u.supportsEncryptFile||!(null!==(i=r.cipherKey)&&void 0!==i?i:s.cipherKey)){e.next=6;break}return e.next=5,c.decrypt(null!==(f=r.cipherKey)&&void 0!==f?f:s.cipherKey,l);case 5:l=e.sent;case 6:return e.abrupt("return",u.create({data:l,name:null!==(a=n.response.name)&&void 0!==a?a:r.name,mimeType:n.response.type}));case 7:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})};t.default=c,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.PNListFilesOperation},validateParams:function(e,t){return null!=t&&t.channel?null!=t&&t.id?null!=t&&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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(9)),o=r(n(1)),a={getOperation:function(){return o.default.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,o,a,u,s,c,l,f,d={};(null!=t&&null!==(n=t.include)&&void 0!==n&&n.customFields&&(d.include="custom"),null!=t&&null!==(r=t.include)&&void 0!==r&&r.totalCount)&&(d.count=null===(s=t.include)||void 0===s?void 0:s.totalCount);null!=t&&null!==(o=t.page)&&void 0!==o&&o.next&&(d.start=null===(c=t.page)||void 0===c?void 0:c.next);null!=t&&null!==(a=t.page)&&void 0!==a&&a.prev&&(d.end=null===(l=t.page)||void 0===l?void 0:l.prev);(null!=t&&t.filter&&(d.filter=t.filter),d.limit=null!==(u=null==t?void 0:t.limit)&&void 0!==u?u:100,null!=t&&t.sort)&&(d.sort=Object.entries(null!==(f=t.sort)&&void 0!==f?f:{}).map((function(e){var t=(0,i.default)(e,2),n=t[0],r=t[1];return"asc"===r||"desc"===r?"".concat(n,":").concat(r):n})));return d},handleResponse:function(e,t){return{status:t.status,data:t.data,totalCount:t.totalCount,next:t.next,prev:t.prev}}};t.default=a,e.exports=t.default},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o=[],a=!0,u=!1;try{for(n=n.call(e);!(a=(r=n.next()).done)&&(o.push(r.value),!t||o.length!==t);a=!0);}catch(e){u=!0,i=e}finally{try{a||null==n.return||n.return()}finally{if(u)throw i}}return o}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(83);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n0&&(r.include=o)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing User.id";if(!i)return"Missing User.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing UserId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUserOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetUsersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNCreateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){return function(e,t){return t}(0,t)},t.postURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(r))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){return t}(0,t)},t.patchURL=function(e,t){var n=e.config,r=t.id;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(r))},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=e.config,r=t.id,i=t.name,o=t.custom;if(!r)return"Missing Space.id";if(!i)return"Missing Space.name";if(!n.subscribeKey)return"Missing Subscribe Key";if(o&&!Object.values(o).every((function(e){return"string"==typeof e||"number"==typeof e||"boolean"==typeof e})))return"Invalid custom type, only string, number and boolean values are allowed."};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!t)return"Missing SpaceId";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpacesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v1/objects/".concat(t.subscribeKey,"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(){};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetSpaceOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId))},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r={};n?void 0===n.customFields&&(n.customFields=!0):n={customFields:!0};if(n){var i=[];n.customFields&&i.push("custom");var o=i.join(",");o.length>0&&(r.include=o)}return r},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom"),n.userFields&&u.push("user"),n.customUserFields&&u.push("user.custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(e,t){if(!t.spaceId)return"Missing spaceId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMembers,r=t.updateMembers,i=t.removeMembers,o=t.users,a={};n&&n.length>0&&(a.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.add.push(t)})));r&&r.length>0&&(a.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));o&&o.length>0&&(a.update=a.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));i&&i.length>0&&(a.remove=[],i.forEach((function(e){a.remove.push({id:e})})));return a}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembersOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.users,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/spaces/").concat(o.default.encodeString(t.spaceId),"/users")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.spaceId,r=t.users;if(!n)return"Missing spaceId";if(!r)return"Missing users"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNGetMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o=t.filter,a={};r&&(a.limit=r);if(n){var u=[];n.totalCount&&(a.count=!0),n.customFields&&u.push("custom"),n.spaceFields&&u.push("space"),n.customSpaceFields&&u.push("space.custom");var s=u.join(",");s.length>0&&(a.include=s)}i&&(i.next&&(a.start=i.next),i.prev&&(a.end=i.prev));o&&(a.filter=o);return a},t.validateParams=function(e,t){if(!t.userId)return"Missing userId"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.addMemberships,r=t.updateMemberships,i=t.removeMemberships,o=t.spaces,a={};n&&n.length>0&&(a.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.add.push(t)})));r&&r.length>0&&(a.update=[],r.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));o&&o.length>0&&(a.update=a.update||[],o.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),a.update.push(t)})));i&&i.length>0&&(a.remove=[],i.forEach((function(e){a.remove.push({id:e})})));return a}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.add=[],n.forEach((function(e){var t={id:e.id};e.custom&&(t.custom=e.custom),r.add.push(t)})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNUpdateMembershipsOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.handleResponse=function(e,t){return t},t.isAuthSupported=function(){return!0},t.patchPayload=function(e,t){return function(e,t){var n=t.spaces,r={};n&&n.length>0&&(r.remove=[],n.forEach((function(e){r.remove.push({id:e})})));return r}(0,t)},t.patchURL=function(e,t){var n=e.config;return"/v1/objects/".concat(n.subscribeKey,"/users/").concat(o.default.encodeString(t.userId),"/spaces")},t.prepareParams=function(e,t){var n=t.include,r=t.limit,i=t.page,o={};r&&(o.limit=r);if(n){var a=[];n.totalCount&&(o.count=!0),n.customFields&&a.push("custom"),n.spaceFields&&a.push("space"),n.customSpaceFields&&a.push("space.custom");var u=a.join(",");u.length>0&&(o.include=u)}i&&(i.next&&(o.start=i.next),i.prev&&(o.end=i.prev));return o},t.usePatch=function(){return!0},t.validateParams=function(e,t){var n=t.userId,r=t.spaces;if(!n)return"Missing userId";if(!r)return"Missing spaces"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerAudit},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/audit/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channel,r=t.channelGroup,i=t.authKeys,o=void 0===i?[]:i,a={};n&&(a.channel=n);r&&(a["channel-group"]=r);o.length>0&&(a.auth=o.join(","));return a},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNAccessManagerGrant},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e){var t=e.config;return"/v2/auth/grant/sub-key/".concat(t.subscribeKey)},t.handleResponse=function(){return{}},t.isAuthSupported=function(){return!1},t.prepareParams=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.channelGroups,o=void 0===i?[]:i,a=t.uuids,u=void 0===a?[]:a,s=t.ttl,c=t.read,l=void 0!==c&&c,f=t.write,d=void 0!==f&&f,p=t.manage,h=void 0!==p&&p,y=t.get,g=void 0!==y&&y,v=t.join,b=void 0!==v&&v,m=t.update,_=void 0!==m&&m,P=t.authKeys,O=void 0===P?[]:P,S=t.delete,w={};w.r=l?"1":"0",w.w=d?"1":"0",w.m=h?"1":"0",w.d=S?"1":"0",w.g=g?"1":"0",w.j=b?"1":"0",w.u=_?"1":"0",r.length>0&&(w.channel=r.join(","));o.length>0&&(w["channel-group"]=o.join(","));O.length>0&&(w.auth=O.join(","));u.length>0&&(w["target-uuid"]=u.join(","));(s||0===s)&&(w.ttl=s);return w},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(null!=t.uuids&&!t.authKeys)return"authKeys are required for grant request on uuids";if(null!=t.uuids&&(null!=t.channels||null!=t.channelGroups))return"Both channel/channelgroup and uuid cannot be used in the same request"};n(2);var i=r(n(1))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.extractPermissions=o,t.getOperation=function(){return i.default.PNAccessManagerGrantToken},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.handleResponse=function(e,t){return t.data.token},t.isAuthSupported=function(){return!1},t.postPayload=function(e,t){return function(e,t){var n=t.ttl,r=t.resources,i=t.patterns,a=t.meta,u=t.authorized_uuid,s={ttl:0,permissions:{resources:{channels:{},groups:{},uuids:{},users:{},spaces:{}},patterns:{channels:{},groups:{},uuids:{},users:{},spaces:{}},meta:{}}};if(r){var c=r.uuids,l=r.channels,f=r.groups;c&&Object.keys(c).forEach((function(e){s.permissions.resources.uuids[e]=o(c[e])})),l&&Object.keys(l).forEach((function(e){s.permissions.resources.channels[e]=o(l[e])})),f&&Object.keys(f).forEach((function(e){s.permissions.resources.groups[e]=o(f[e])}))}if(i){var d=i.uuids,p=i.channels,h=i.groups;d&&Object.keys(d).forEach((function(e){s.permissions.patterns.uuids[e]=o(d[e])})),p&&Object.keys(p).forEach((function(e){s.permissions.patterns.channels[e]=o(p[e])})),h&&Object.keys(h).forEach((function(e){s.permissions.patterns.groups[e]=o(h[e])}))}(n||0===n)&&(s.ttl=n);a&&(s.permissions.meta=a);u&&(s.permissions.uuid="".concat(u));return s}(0,t)},t.postURL=function(e){var t=e.config;return"/v3/pam/".concat(t.subscribeKey,"/grant")},t.prepareParams=function(){return{}},t.usePost=function(){return!0},t.validateParams=function(e,t){var n=e.config;if(!n.subscribeKey)return"Missing Subscribe Key";if(!n.publishKey)return"Missing Publish Key";if(!n.secretKey)return"Missing Secret Key";if(!t.resources&&!t.patterns)return"Missing either Resources or Patterns.";if(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))return"Missing values for either Resources or Patterns."};n(2);var i=r(n(1));function o(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(1)),o=r(n(3)),a={getOperation:function(){return i.default.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(o.default.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}}};t.default=a,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNPublishOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,o=u(e,i);return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0/").concat(a.default.encodeString(o))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.postPayload=function(e,t){var n=t.message;return u(e,n)},t.postURL=function(e,t){var n=e.config,r=t.channel;return"/publish/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(a.default.encodeString(r),"/0")},t.prepareParams=function(e,t){var n=t.meta,r=t.replicate,o=void 0===r||r,a=t.storeInHistory,u=t.ttl,s={};null!=a&&(s.store=a?"1":"0");u&&(s.ttl=u);!1===o&&(s.norep="true");n&&"object"===(0,i.default)(n)&&(s.meta=JSON.stringify(n));return s},t.usePost=function(e,t){var n=t.sendByPost;return void 0!==n&&n},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};var i=r(n(7)),o=(n(2),r(n(1))),a=r(n(3));function u(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}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSignalOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channel,i=t.message,a=(u=i,JSON.stringify(u));var u;return"/signal/".concat(n.publishKey,"/").concat(n.subscribeKey,"/0/").concat(o.default.encodeString(r),"/0/").concat(o.default.encodeString(a))},t.handleResponse=function(e,t){return{timetoken:t[2]}},t.isAuthSupported=function(){return!0},t.prepareParams=function(){return{}},t.validateParams=function(e,t){var n=e.config,r=t.message;if(!t.channel)return"Missing Channel";if(!r)return"Missing Message";if(!n.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNHistoryOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v2/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){var n={messages:[],startTimeToken:t[1],endTimeToken:t[2]};Array.isArray(t[0])&&t[0].forEach((function(t){var r={timetoken:t.timetoken,entry:a(e,t.message)};t.meta&&(r.meta=t.meta),n.messages.push(r)}));return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i=t.reverse,o=t.count,a=void 0===o?100:o,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f={include_token:"true"};f.count=a,n&&(f.start=n);r&&(f.end=r);s&&(f.string_message_token="true");null!=i&&(f.reverse=i.toString());l&&(f.include_meta="true");return f},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3));function a(e,t){var n=e.config,r=e.crypto;if(!n.cipherKey)return t;try{return r.decrypt(t)}catch(e){return t}}},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNDeleteMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channel,r=e.config;return"/v3/history/sub-key/".concat(r.subscribeKey,"/channel/").concat(o.default.encodeString(n))},t.handleResponse=function(e,t){return t.payload},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.start,r=t.end,i={};n&&(i.start=n);r&&(i.end=r);return i},t.useDelete=function(){return!0},t.validateParams=function(e,t){var n=t.channel,r=e.config;if(!n)return"Missing channel";if(!r.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return o.default.PNMessageCounts},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.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(a.default.encodeString(i))},t.handleResponse=function(e,t){return{channels:t.channels}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.timetoken,r=t.channelTimetokens,o={};if(r&&1===r.length){var a=(0,i.default)(r,1)[0];o.timetoken=a}else r?o.channelsTimetoken=r.join(","):n&&(o.timetoken=n);return o},t.validateParams=function(e,t){var n=t.channels,r=t.timetoken,i=t.channelTimetokens,o=e.config;if(!n)return"Missing channel";if(r&&i)return"timetoken and channelTimetokens are incompatible together";if(r&&i&&i.length>1&&n.length!==i.length)return"Length of channelTimetokens and channels do not match";if(!o.subscribeKey)return"Missing Subscribe Key"};var i=r(n(9)),o=r(n(1)),a=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNFetchMessagesOperation},t.getRequestTimeout=function(e){return e.config.getTransactionTimeout()},t.getURL=function(e,t){var n=t.channels,r=void 0===n?[]:n,i=t.includeMessageActions,a=void 0!==i&&i,u=e.config,s=a?"history-with-actions":"history",c=r.length>0?r.join(","):",";return"/v3/".concat(s,"/sub-key/").concat(u.subscribeKey,"/channel/").concat(o.default.encodeString(c))},t.handleResponse=function(e,t){var n={channels:{}};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);return n},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=t.channels,r=t.start,i=t.end,o=t.includeMessageActions,a=t.count,u=t.stringifiedTimeToken,s=void 0!==u&&u,c=t.includeMeta,l=void 0!==c&&c,f=t.includeUuid,d=t.includeUUID,p=void 0===d||d,h=t.includeMessageType,y=void 0===h||h,g={};g.max=a||(n.length>1||!0===o?25:100);r&&(g.start=r);i&&(g.end=i);s&&(g.string_message_token="true");l&&(g.include_meta="true");p&&!1!==f&&(g.include_uuid="true");y&&(g.include_message_type="true");return g},t.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.")};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.getOperation=function(){return i.default.PNSubscribeOperation},t.getRequestTimeout=function(e){return e.config.getSubscribeTimeout()},t.getURL=function(e,t){var n=e.config,r=t.channels,i=void 0===r?[]:r,a=i.length>0?i.join(","):",";return"/v2/subscribe/".concat(n.subscribeKey,"/").concat(o.default.encodeString(a),"/0")},t.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}},t.isAuthSupported=function(){return!0},t.prepareParams=function(e,t){var n=e.config,r=t.state,i=t.channelGroups,o=void 0===i?[]:i,a=t.timetoken,u=t.filterExpression,s=t.region,c={heartbeat:n.getPresenceTimeout()};o.length>0&&(c["channel-group"]=o.join(","));u&&u.length>0&&(c["filter-expr"]=u);Object.keys(r).length&&(c.state=JSON.stringify(r));a&&(c.tt=a);s&&(c.tr=s);return c},t.validateParams=function(e){if(!e.config.subscribeKey)return"Missing Subscribe Key"};n(2);var i=r(n(1)),o=r(n(3))},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(5)),o=r(n(6)),a=r(n(4)),u=(r(n(8)),r(n(10))),s=(n(2),function(){function e(t){var n=this;(0,i.default)(this,e),(0,a.default)(this,"_modules",void 0),(0,a.default)(this,"_config",void 0),(0,a.default)(this,"_currentSubDomain",void 0),(0,a.default)(this,"_standardOrigin",void 0),(0,a.default)(this,"_subscribeOrigin",void 0),(0,a.default)(this,"_requestTimeout",void 0),(0,a.default)(this,"_coreParams",void 0),this._modules={},Object.keys(t).forEach((function(e){n._modules[e]=t[e].bind(n)}))}return(0,o.default)(e,[{key:"init",value: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()}},{key:"nextOrigin",value: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)}},{key:"hasModule",value:function(e){return e in this._modules}},{key:"shiftStandardOrigin",value:function(){return this._standardOrigin=this.nextOrigin(),this._standardOrigin}},{key:"getStandardOrigin",value:function(){return this._standardOrigin}},{key:"POSTFILE",value:function(e,t,n){return this._modules.postfile(e,t,n)}},{key:"GETFILE",value:function(e,t,n){return this._modules.getfile(e,t,n)}},{key:"POST",value:function(e,t,n,r){return this._modules.post(e,t,n,r)}},{key:"PATCH",value:function(e,t,n,r){return this._modules.patch(e,t,n,r)}},{key:"GET",value:function(e,t,n){return this._modules.get(e,t,n)}},{key:"DELETE",value:function(e,t,n){return this._modules.del(e,t,n)}},{key:"_detectErrorCategory",value:function(e){if("ENOTFOUND"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNREFUSED"===e.code)return u.default.PNNetworkIssuesCategory;if("ECONNRESET"===e.code)return u.default.PNNetworkIssuesCategory;if("EAI_AGAIN"===e.code)return u.default.PNNetworkIssuesCategory;if(0===e.status||e.hasOwnProperty("status")&&void 0===e.status)return u.default.PNNetworkIssuesCategory;if(e.timeout)return u.default.PNTimeoutCategory;if("ETIMEDOUT"===e.code)return u.default.PNNetworkIssuesCategory;if(e.response){if(e.response.badRequest)return u.default.PNBadRequestCategory;if(e.response.forbidden)return u.default.PNAccessDeniedCategory}return u.default.PNUnknownCategory}}]),e}());t.default=s,e.exports=t.default},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r={get:function(e){try{return localStorage.getItem(e)}catch(e){return null}},set:function(e,t){try{return localStorage.setItem(e,t)}catch(e){return null}}};t.default=r,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(7)),o=r(n(5)),a=r(n(6)),u=r(n(4)),s=function(){function e(t,n){(0,o.default)(this,e),(0,u.default)(this,"_base64ToBinary",void 0),(0,u.default)(this,"_cborReader",void 0),this._base64ToBinary=n,this._decode=t}return(0,a.default)(e,[{key:"decodeToken",value: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"===(0,i.default)(r))return r}}]),e}();t.default=s,e.exports=t.default},function(e,t,n){"use strict";var r=n(0);Object.defineProperty(t,"__esModule",{value:!0}),t.del=function(e,t,n){var r=a.default.delete(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.get=function(e,t,n){var r=a.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.getfile=function(e,t,n){var r=a.default.get(this.getStandardOrigin()+t.url).set(t.headers).query(e);return s.call(this,r,t,n)},t.patch=function(e,t,n,r){var i=a.default.patch(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return s.call(this,i,n,r)},t.post=function(e,t,n,r){var i=a.default.post(this.getStandardOrigin()+n.url).query(e).set(n.headers).send(t);return s.call(this,i,n,r)},t.postfile=function(e,t,n){return c.apply(this,arguments)};var i=r(n(11)),o=r(n(12)),a=r(n(129));n(2);function u(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 s(e,t,n){var r=this;this._config.logVerbosity&&(e=e.use(u)),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;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)).end((function(e,i){var o,a={};if(a.error=null!==e,a.operation=t.operation,i&&i.status&&(a.statusCode=i.status),e){if(e.response&&e.response.text&&!r._config.logVerbosity)try{a.errorData=JSON.parse(e.response.text)}catch(t){a.errorData=e}else a.errorData=e;return a.category=r._detectErrorCategory(e),n(a,null)}if(t.ignoreBody)o={headers:i.headers,redirects:i.redirects,response:i};else try{o=JSON.parse(i.text)}catch(e){return a.errorData=i,a.error=!0,n(a,null)}return o.error&&1===o.error&&o.status&&o.message&&o.service?(a.errorData=o,a.statusCode=o.status,a.error=!0,a.category=r._detectErrorCategory(a),n(a,null)):(o.error&&o.error.message&&(a.errorData=o.error),n(a,o))})),i}function c(){return(c=(0,o.default)(i.default.mark((function e(t,n,r){var o,u;return i.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=a.default.post(t),n.forEach((function(e){var t=e.key,n=e.value;o=o.field(t,n)})),o.attach("file",r,{contentType:"application/octet-stream"}),e.next=5,o;case 5:return u=e.sent,e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))).apply(this,arguments)}},function(e,t,n){"use strict";function r(e){return(r="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})(e)}var i;"undefined"!=typeof window?i=window:"undefined"==typeof self?(console.warn("Using browser-only version of superagent in non-browser environment"),i=void 0):i=self;var o=n(130),a=n(131),u=n(132),s=n(144),c=n(30),l=n(145),f=n(147);function d(){}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 p=t=e.exports;t.Request=_,p.getXHR=function(){if(i.XMLHttpRequest&&(!i.location||"file:"!==i.location.protocol||!i.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 h="".trim?function(e){return e.trim()}:function(e){return e.replace(/(^\s*|\s*$)/g,"")};function y(e){if(!c(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(c(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 v(e){for(var t,n,r={},i=e.split("&"),o=0,a=i.length;o0||e instanceof Object)?t(e):null)},m.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},p.Response=m,o(_.prototype),s(_.prototype),_.prototype.type=function(e){return this.set("Content-Type",p.types[e]||e),this},_.prototype.accept=function(e){return this.set("Accept",p.types[e]||e),this},_.prototype.auth=function(e,t,n){1===arguments.length&&(t=""),"object"===r(t)&&null!==t&&(n=t,t=""),n||(n={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,n,i)},_.prototype.query=function(e){return"string"!=typeof e&&(e=y(e)),e&&this._query.push(e),this},_.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},_.prototype._getFormData=function(){return this._formData||(this._formData=new i.FormData),this._formData},_.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)},_.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)},_.prototype.agent=function(){return console.warn("This is not supported in browser version of superagent"),this},_.prototype.ca=_.prototype.agent,_.prototype.buffer=_.prototype.ca,_.prototype.write=function(){throw new Error("Streaming is not supported in browser version of superagent")},_.prototype.pipe=_.prototype.write,_.prototype._isHost=function(e){return e&&"object"===r(e)&&!Array.isArray(e)&&"[object Object]"!==Object.prototype.toString.call(e)},_.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||d,this._finalizeQueryString(),this._end()},_.prototype._setUploadTimeout=function(){var e=this;this._uploadTimeout&&!this._uploadTimeoutTimer&&(this._uploadTimeoutTimer=setTimeout((function(){e._timeoutError("Upload timeout of ",e._uploadTimeout,"ETIMEDOUT")}),this._uploadTimeout))},_.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=p.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||p.serialize[i?i.split(";")[0]:""];!o&&b(i)&&(o=p.serialize["application/json"]),o&&(n=o(n))}for(var a in this.header)null!==this.header[a]&&Object.prototype.hasOwnProperty.call(this.header,a)&&t.setRequestHeader(a,this.header[a]);this._responseType&&(t.responseType=this._responseType),this.emit("request",this),t.send(void 0===n?null:n)},p.agent=function(){return new f},["GET","POST","OPTIONS","PATCH","PUT","DELETE"].forEach((function(e){f.prototype[e.toLowerCase()]=function(t,n){var r=new p.Request(e,t);return this._setDefaults(r),n&&r.end(n),r}})),f.prototype.del=f.prototype.delete,p.get=function(e,t,n){var r=p("GET",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},p.head=function(e,t,n){var r=p("HEAD",e);return"function"==typeof t&&(n=t,t=null),t&&r.query(t),n&&r.end(n),r},p.options=function(e,t,n){var r=p("OPTIONS",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.del=P,p.delete=P,p.patch=function(e,t,n){var r=p("PATCH",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.post=function(e,t,n){var r=p("POST",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r},p.put=function(e,t,n){var r=p("PUT",e);return"function"==typeof t&&(n=t,t=null),t&&r.send(t),n&&r.end(n),r}},function(e,t,n){function r(e){if(e)return function(e){for(var t in r.prototype)e[t]=r.prototype[t];return e}(e)}e.exports=r,r.prototype.on=r.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this},r.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},r.prototype.off=r.prototype.removeListener=r.prototype.removeAllListeners=r.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;is.depthLimit)return void a("[...]",t,n,o);if(void 0!==s.edgesLimit&&r+1>s.edgesLimit)return void a("[...]",t,n,o);if(i.push(t),Array.isArray(t))for(c=0;ct?1:0}function s(e,t,o,s){void 0===s&&(s=i());var l,f=function e(t,r,i,o,s,c,l){var f;if(c+=1,"object"==typeof t&&null!==t){for(f=0;fl.depthLimit)return void a("[...]",t,r,s);if(void 0!==l.edgesLimit&&i+1>l.edgesLimit)return void a("[...]",t,r,s);if(o.push(t),Array.isArray(t))for(f=0;f0)for(var i=0;i0?w.join(",")||null:void 0}];else if(s(d))N=d;else{var U=Object.keys(w);N=p?U.sort(p):U}for(var I=0;I0?_+m:""}},function(e,t,n){"use strict";var r=n(19),i=n(139),o=n(141),a=r("%TypeError%"),u=r("%WeakMap%",!0),s=r("%Map%",!0),c=i("WeakMap.prototype.get",!0),l=i("WeakMap.prototype.set",!0),f=i("WeakMap.prototype.has",!0),d=i("Map.prototype.get",!0),p=i("Map.prototype.set",!0),h=i("Map.prototype.has",!0),y=function(e,t){for(var n,r=e;null!==(n=r.next);r=n)if(n.key===t)return r.next=n.next,n.next=e.next,e.next=n,n};e.exports=function(){var e,t,n,r={assert:function(e){if(!r.has(e))throw new a("Side channel does not contain "+o(e))},get:function(r){if(u&&r&&("object"==typeof r||"function"==typeof r)){if(e)return c(e,r)}else if(s){if(t)return d(t,r)}else if(n)return function(e,t){var n=y(e,t);return n&&n.value}(n,r)},has:function(r){if(u&&r&&("object"==typeof r||"function"==typeof r)){if(e)return f(e,r)}else if(s){if(t)return h(t,r)}else if(n)return function(e,t){return!!y(e,t)}(n,r);return!1},set:function(r,i){u&&r&&("object"==typeof r||"function"==typeof r)?(e||(e=new u),l(e,r,i)):s?(t||(t=new s),p(t,r,i)):(n||(n={key:{},next:null}),function(e,t,n){var r=y(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}}(n,r,i))}};return r}},function(e,t,n){"use strict";var r="undefined"!=typeof Symbol&&Symbol,i=n(136);e.exports=function(){return"function"==typeof r&&("function"==typeof Symbol&&("symbol"==typeof r("foo")&&("symbol"==typeof Symbol("bar")&&i())))}},function(e,t,n){"use strict";e.exports=function(){if("function"!=typeof Symbol||"function"!=typeof Object.getOwnPropertySymbols)return!1;if("symbol"==typeof Symbol.iterator)return!0;var e={},t=Symbol("test"),n=Object(t);if("string"==typeof t)return!1;if("[object Symbol]"!==Object.prototype.toString.call(t))return!1;if("[object Symbol]"!==Object.prototype.toString.call(n))return!1;for(t in e[t]=42,e)return!1;if("function"==typeof Object.keys&&0!==Object.keys(e).length)return!1;if("function"==typeof Object.getOwnPropertyNames&&0!==Object.getOwnPropertyNames(e).length)return!1;var r=Object.getOwnPropertySymbols(e);if(1!==r.length||r[0]!==t)return!1;if(!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if("function"==typeof Object.getOwnPropertyDescriptor){var i=Object.getOwnPropertyDescriptor(e,t);if(42!==i.value||!0!==i.enumerable)return!1}return!0}},function(e,t,n){"use strict";var r="Function.prototype.bind called on incompatible ",i=Array.prototype.slice,o=Object.prototype.toString;e.exports=function(e){var t=this;if("function"!=typeof t||"[object Function]"!==o.call(t))throw new TypeError(r+t);for(var n,a=i.call(arguments,1),u=function(){if(this instanceof n){var r=t.apply(this,a.concat(i.call(arguments)));return Object(r)===r?r:this}return t.apply(e,a.concat(i.call(arguments)))},s=Math.max(0,t.length-a.length),c=[],l=0;l-1?i(n):n}},function(e,t,n){"use strict";var r=n(20),i=n(19),o=i("%Function.prototype.apply%"),a=i("%Function.prototype.call%"),u=i("%Reflect.apply%",!0)||r.call(a,o),s=i("%Object.getOwnPropertyDescriptor%",!0),c=i("%Object.defineProperty%",!0),l=i("%Math.max%");if(c)try{c({},"a",{value:1})}catch(e){c=null}e.exports=function(e){var t=u(r,a,arguments);if(s&&c){var n=s(t,"length");n.configurable&&c(t,"length",{value:1+l(0,e.length-(arguments.length-1))})}return t};var f=function(){return u(r,o,arguments)};c?c(e.exports,"apply",{value:f}):e.exports.apply=f},function(e,t,n){var r="function"==typeof Map&&Map.prototype,i=Object.getOwnPropertyDescriptor&&r?Object.getOwnPropertyDescriptor(Map.prototype,"size"):null,o=r&&i&&"function"==typeof i.get?i.get:null,a=r&&Map.prototype.forEach,u="function"==typeof Set&&Set.prototype,s=Object.getOwnPropertyDescriptor&&u?Object.getOwnPropertyDescriptor(Set.prototype,"size"):null,c=u&&s&&"function"==typeof s.get?s.get:null,l=u&&Set.prototype.forEach,f="function"==typeof WeakMap&&WeakMap.prototype?WeakMap.prototype.has:null,d="function"==typeof WeakSet&&WeakSet.prototype?WeakSet.prototype.has:null,p="function"==typeof WeakRef&&WeakRef.prototype?WeakRef.prototype.deref:null,h=Boolean.prototype.valueOf,y=Object.prototype.toString,g=Function.prototype.toString,v=String.prototype.match,b="function"==typeof BigInt?BigInt.prototype.valueOf:null,m=Object.getOwnPropertySymbols,_="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?Symbol.prototype.toString:null,P="function"==typeof Symbol&&"object"==typeof Symbol.iterator,O="function"==typeof Symbol&&Symbol.toStringTag&&(typeof Symbol.toStringTag===P||"symbol")?Symbol.toStringTag:null,S=Object.prototype.propertyIsEnumerable,w=("function"==typeof Reflect?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null),k=n(142).custom,T=k&&E(k)?k:null;function x(e,t,n){var r="double"===(n.quoteStyle||t)?'"':"'";return r+e+r}function A(e){return String(e).replace(/"/g,""")}function M(e){return!("[object Array]"!==N(e)||O&&"object"==typeof e&&O in e)}function E(e){if(P)return e&&"object"==typeof e&&e instanceof Symbol;if("symbol"==typeof e)return!0;if(!e||"object"!=typeof e||!_)return!1;try{return _.call(e),!0}catch(e){}return!1}e.exports=function e(t,n,r,i){var u=n||{};if(R(u,"quoteStyle")&&"single"!==u.quoteStyle&&"double"!==u.quoteStyle)throw new TypeError('option "quoteStyle" must be "single" or "double"');if(R(u,"maxStringLength")&&("number"==typeof u.maxStringLength?u.maxStringLength<0&&u.maxStringLength!==1/0:null!==u.maxStringLength))throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var s=!R(u,"customInspect")||u.customInspect;if("boolean"!=typeof s&&"symbol"!==s)throw new TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(R(u,"indent")&&null!==u.indent&&"\t"!==u.indent&&!(parseInt(u.indent,10)===u.indent&&u.indent>0))throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');if(void 0===t)return"undefined";if(null===t)return"null";if("boolean"==typeof t)return t?"true":"false";if("string"==typeof t)return function e(t,n){if(t.length>n.maxStringLength){var r=t.length-n.maxStringLength,i="... "+r+" more character"+(r>1?"s":"");return e(t.slice(0,n.maxStringLength),n)+i}return x(t.replace(/(['\\])/g,"\\$1").replace(/[\x00-\x1f]/g,U),"single",n)}(t,u);if("number"==typeof t)return 0===t?1/0/t>0?"0":"-0":String(t);if("bigint"==typeof t)return String(t)+"n";var y=void 0===u.depth?5:u.depth;if(void 0===r&&(r=0),r>=y&&y>0&&"object"==typeof t)return M(t)?"[Array]":"[Object]";var m=function(e,t){var n;if("\t"===e.indent)n="\t";else{if(!("number"==typeof e.indent&&e.indent>0))return null;n=Array(e.indent+1).join(" ")}return{base:n,prev:Array(t+1).join(n)}}(u,r);if(void 0===i)i=[];else if(C(i,t)>=0)return"[Circular]";function S(t,n,o){if(n&&(i=i.slice()).push(n),o){var a={depth:u.depth};return R(u,"quoteStyle")&&(a.quoteStyle=u.quoteStyle),e(t,a,r+1,i)}return e(t,u,r+1,i)}if("function"==typeof t){var k=function(e){if(e.name)return e.name;var t=v.call(g.call(e),/^function\s*([\w$]+)/);if(t)return t[1];return null}(t),j=K(t,S);return"[Function"+(k?": "+k:" (anonymous)")+"]"+(j.length>0?" { "+j.join(", ")+" }":"")}if(E(t)){var B=P?String(t).replace(/^(Symbol\(.*\))_[^)]*$/,"$1"):_.call(t);return"object"!=typeof t||P?B:I(B)}if(function(e){if(!e||"object"!=typeof e)return!1;if("undefined"!=typeof HTMLElement&&e instanceof HTMLElement)return!0;return"string"==typeof e.nodeName&&"function"==typeof e.getAttribute}(t)){for(var G="<"+String(t.nodeName).toLowerCase(),q=t.attributes||[],H=0;H"}if(M(t)){if(0===t.length)return"[]";var z=K(t,S);return m&&!function(e){for(var t=0;t=0)return!1;return!0}(z)?"["+L(z,m)+"]":"[ "+z.join(", ")+" ]"}if(function(e){return!("[object Error]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)){var W=K(t,S);return 0===W.length?"["+String(t)+"]":"{ ["+String(t)+"] "+W.join(", ")+" }"}if("object"==typeof t&&s){if(T&&"function"==typeof t[T])return t[T]();if("symbol"!==s&&"function"==typeof t.inspect)return t.inspect()}if(function(e){if(!o||!e||"object"!=typeof e)return!1;try{o.call(e);try{c.call(e)}catch(e){return!0}return e instanceof Map}catch(e){}return!1}(t)){var V=[];return a.call(t,(function(e,n){V.push(S(n,t,!0)+" => "+S(e,t))})),D("Map",o.call(t),V,m)}if(function(e){if(!c||!e||"object"!=typeof e)return!1;try{c.call(e);try{o.call(e)}catch(e){return!0}return e instanceof Set}catch(e){}return!1}(t)){var Y=[];return l.call(t,(function(e){Y.push(S(e,t))})),D("Set",c.call(t),Y,m)}if(function(e){if(!f||!e||"object"!=typeof e)return!1;try{f.call(e,f);try{d.call(e,d)}catch(e){return!0}return e instanceof WeakMap}catch(e){}return!1}(t))return F("WeakMap");if(function(e){if(!d||!e||"object"!=typeof e)return!1;try{d.call(e,d);try{f.call(e,f)}catch(e){return!0}return e instanceof WeakSet}catch(e){}return!1}(t))return F("WeakSet");if(function(e){if(!p||!e||"object"!=typeof e)return!1;try{return p.call(e),!0}catch(e){}return!1}(t))return F("WeakRef");if(function(e){return!("[object Number]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(S(Number(t)));if(function(e){if(!e||"object"!=typeof e||!b)return!1;try{return b.call(e),!0}catch(e){}return!1}(t))return I(S(b.call(t)));if(function(e){return!("[object Boolean]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(h.call(t));if(function(e){return!("[object String]"!==N(e)||O&&"object"==typeof e&&O in e)}(t))return I(S(String(t)));if(!function(e){return!("[object Date]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)&&!function(e){return!("[object RegExp]"!==N(e)||O&&"object"==typeof e&&O in e)}(t)){var J=K(t,S),$=w?w(t)===Object.prototype:t instanceof Object||t.constructor===Object,X=t instanceof Object?"":"null prototype",Q=!$&&O&&Object(t)===t&&O in t?N(t).slice(8,-1):X?"Object":"",Z=($||"function"!=typeof t.constructor?"":t.constructor.name?t.constructor.name+" ":"")+(Q||X?"["+[].concat(Q||[],X||[]).join(": ")+"] ":"");return 0===J.length?Z+"{}":m?Z+"{"+L(J,m)+"}":Z+"{ "+J.join(", ")+" }"}return String(t)};var j=Object.prototype.hasOwnProperty||function(e){return e in this};function R(e,t){return j.call(e,t)}function N(e){return y.call(e)}function C(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n-1?e.split(","):e},c=function(e,t,n,r){if(e){var o=n.allowDots?e.replace(/\.([^.[]+)/g,"[$1]"):e,a=/(\[[^[\]]*])/g,u=n.depth>0&&/(\[[^[\]]*])/.exec(o),c=u?o.slice(0,u.index):o,l=[];if(c){if(!n.plainObjects&&i.call(Object.prototype,c)&&!n.allowPrototypes)return;l.push(c)}for(var f=0;n.depth>0&&null!==(u=a.exec(o))&&f=0;--o){var a,u=e[o];if("[]"===u&&n.parseArrays)a=[].concat(i);else{a=n.plainObjects?Object.create(null):{};var c="["===u.charAt(0)&&"]"===u.charAt(u.length-1)?u.slice(1,-1):u,l=parseInt(c,10);n.parseArrays||""!==c?!isNaN(l)&&u!==c&&String(l)===c&&l>=0&&n.parseArrays&&l<=n.arrayLimit?(a=[])[l]=i:a[c]=i:a={0:i}}i=a}return i}(l,t,n,r)}};e.exports=function(e,t){var n=function(e){if(!e)return a;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?a.charset:e.charset;return{allowDots:void 0===e.allowDots?a.allowDots:!!e.allowDots,allowPrototypes:"boolean"==typeof e.allowPrototypes?e.allowPrototypes:a.allowPrototypes,allowSparse:"boolean"==typeof e.allowSparse?e.allowSparse:a.allowSparse,arrayLimit:"number"==typeof e.arrayLimit?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:"boolean"==typeof e.charsetSentinel?e.charsetSentinel:a.charsetSentinel,comma:"boolean"==typeof e.comma?e.comma:a.comma,decoder:"function"==typeof e.decoder?e.decoder:a.decoder,delimiter:"string"==typeof e.delimiter||r.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:"number"==typeof e.depth||!1===e.depth?+e.depth:a.depth,ignoreQueryPrefix:!0===e.ignoreQueryPrefix,interpretNumericEntities:"boolean"==typeof e.interpretNumericEntities?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:"number"==typeof e.parameterLimit?e.parameterLimit:a.parameterLimit,parseArrays:!1!==e.parseArrays,plainObjects:"boolean"==typeof e.plainObjects?e.plainObjects:a.plainObjects,strictNullHandling:"boolean"==typeof e.strictNullHandling?e.strictNullHandling:a.strictNullHandling}}(t);if(""===e||null==e)return n.plainObjects?Object.create(null):{};for(var l="string"==typeof e?function(e,t){var n,c={},l=t.ignoreQueryPrefix?e.replace(/^\?/,""):e,f=t.parameterLimit===1/0?void 0:t.parameterLimit,d=l.split(t.delimiter,f),p=-1,h=t.charset;if(t.charsetSentinel)for(n=0;n-1&&(g=o(g)?[g]:g),i.call(c,y)?c[y]=r.combine(c[y],g):c[y]=g}return c}(e,n):e,f=n.plainObjects?Object.create(null):{},d=Object.keys(l),p=0;p=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&&u.has(t.status))return!0;if(e){if(e.code&&a.has(e.code))return!0;if(e.timeout&&"ECONNABORTED"===e.code)return!0;if(e.crossDomain)return!0}return!1},o.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()},o.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)},o.prototype.catch=function(e){return this.then(void 0,e)},o.prototype.use=function(e){return e(this),this},o.prototype.ok=function(e){if("function"!=typeof e)throw new Error("Callback required");return this._okCallback=e,this},o.prototype._isResponseOK=function(e){return!!e&&(this._okCallback?this._okCallback(e):e.status>=200&&e.status<300)},o.prototype.get=function(e){return this._header[e.toLowerCase()]},o.prototype.getHeader=o.prototype.get,o.prototype.set=function(e,t){if(i(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},o.prototype.unset=function(e){return delete this._header[e.toLowerCase()],delete this.header[e],this},o.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(i(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},o.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},o.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},o.prototype.withCredentials=function(e){return void 0===e&&(e=!0),this._withCredentials=e,this},o.prototype.redirects=function(e){return this._maxRedirects=e,this},o.prototype.maxResponseSize=function(e){if("number"!=typeof e)throw new TypeError("Invalid argument");return this._maxResponseSize=e,this},o.prototype.toJSON=function(){return{method:this.method,url:this.url,data:this._data,headers:this._header}},o.prototype.send=function(e){var t=i(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&&i(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},o.prototype.sortQuery=function(e){return this._sort=void 0===e||e,this},o.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("&")}}},o.prototype._appendQueryString=function(){console.warn("Unsupported")},o.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)}},o.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))}},function(e,t,n){"use strict";var r=n(146);function i(e){if(e)return function(e){for(var t in i.prototype)Object.prototype.hasOwnProperty.call(i.prototype,t)&&(e[t]=i.prototype[t]);return e}(e)}e.exports=i,i.prototype.get=function(e){return this.header[e.toLowerCase()]},i.prototype._setHeaderProperties=function(e){var t=e["content-type"]||"";this.type=r.type(t);var n=r.params(t);for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(this[i]=n[i]);this.links={};try{e.link&&(this.links=r.parseLinks(e.link))}catch(e){}},i.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}},function(e,t,n){"use strict";function r(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 i(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 i(e,t)}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}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 a,u=!0,s=!1;return{s:function(){n=e[Symbol.iterator]()},n:function(){var e=n.next();return u=e.done,e},e:function(e){s=!0,a=e},f:function(){try{u||null==n.return||n.return()}finally{if(s)throw a}}}}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n Array.from({ length: 20 }, (_, i) => `ps${i + 1}.pndsn.com`);\n\ntype ConfigConstructArgs = {\n setup: InternalSetupStruct,\n db: DatabaseInterface,\n};\n\nexport default class {\n _db: DatabaseInterface;\n\n subscribeKey: string;\n publishKey: string;\n secretKey: string;\n cipherKey: string;\n authKey: string;\n UUID: string;\n\n proxy: ProxyStruct;\n\n /*\n if _useInstanceId is true, this instanceId will be added to all requests\n */\n instanceId: string;\n\n /*\n If the SDK is running as part of another SDK built atop of it, allow a custom pnsdk with name and version.\n */\n sdkName: string;\n\n /*\n keep track of the SDK family for identifier generator\n */\n sdkFamily: string;\n\n /*\n If the SDK is operated by a partner, allow a custom pnsdk item for them.\n */\n partnerId: string;\n\n /*\n filter expression to pass along when subscribing.\n */\n filterExpression: string;\n /*\n configuration to supress leave events; when a presence leave is performed\n this configuration will disallow the leave event from happening\n */\n suppressLeaveEvents: boolean;\n\n /*\n use SSL for http requests?\n */\n secure: boolean;\n\n // Custom optional origin.\n origin: string | string[];\n\n // log verbosity: true to output lots of info\n logVerbosity: boolean;\n\n // if instanceId config is true, the SDK will pass the unique instance identifier to the server as instanceId=\n useInstanceId: boolean;\n\n // if requestId config is true, the SDK will pass a unique request identifier with each request as request_id=\n useRequestId: boolean;\n\n // use connection keep-alive for http requests\n keepAlive: ?boolean;\n\n keepAliveSettings: ?KeepAliveStruct;\n\n // if autoNetworkDetection config is true, the SDK will emit NetworkUp and NetworkDown when there changes in the networking\n autoNetworkDetection: ?boolean;\n\n // alert when a heartbeat works out.\n announceSuccessfulHeartbeats: boolean;\n announceFailedHeartbeats: boolean;\n\n /*\n how long the server will wait before declaring that the client is gone.\n */\n _presenceTimeout: number;\n\n /*\n how often (in seconds) the client should announce its presence to server\n */\n _heartbeatInterval: number;\n\n /*\n how long to wait for the server when running the subscribe loop\n */\n _subscribeRequestTimeout: number;\n /*\n how long to wait for the server when making transactional requests\n */\n _transactionalRequestTimeout: number;\n /*\n use send beacon API when unsubscribing.\n https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n _useSendBeacon: boolean;\n\n /*\n allow frameworks to append to the PNSDK parameter\n the key should be an identifier for the specific framework to prevent duplicates\n */\n _PNSDKSuffix: { [key: string]: string };\n\n /*\n if set, the SDK will alert if more messages arrive in one subscribe than the theshold\n */\n requestMessageCountThreshold: number;\n\n /*\n Restore subscription list on disconnection.\n */\n restore: boolean;\n\n /*\n support for client deduping\n */\n dedupeOnSubscribe: boolean;\n\n maximumCacheSize: number;\n\n /*\n support customp encryption and decryption functions.\n */\n customEncrypt: Function; // function to support custome encryption of messages\n\n customDecrypt: Function; // function used to decrypt old version messages\n\n // File Upload\n\n // How many times the publish-file should be retried before giving up\n fileUploadPublishRetryLimit: number;\n useRandomIVs: boolean;\n\n constructor({ setup, db }: ConfigConstructArgs) {\n this._PNSDKSuffix = {};\n this._db = db;\n\n this.instanceId = `pn-${uuidGenerator.createUUID()}`;\n this.secretKey = setup.secretKey || setup.secret_key;\n this.subscribeKey = setup.subscribeKey || setup.subscribe_key;\n this.publishKey = setup.publishKey || setup.publish_key;\n this.sdkName = setup.sdkName;\n this.sdkFamily = setup.sdkFamily;\n this.partnerId = setup.partnerId;\n this.setAuthKey(setup.authKey);\n this.setCipherKey(setup.cipherKey);\n\n this.setFilterExpression(setup.filterExpression);\n\n if (typeof setup.origin !== 'string' && !Array.isArray(setup.origin) && setup.origin !== undefined) {\n throw new Error('Origin must be either undefined, a string or a list of strings.');\n }\n\n this.origin = setup.origin || makeDefaultOrigins();\n this.secure = setup.ssl || false;\n this.restore = setup.restore || false;\n this.proxy = setup.proxy;\n this.keepAlive = setup.keepAlive;\n this.keepAliveSettings = setup.keepAliveSettings;\n this.autoNetworkDetection = setup.autoNetworkDetection || false;\n\n this.dedupeOnSubscribe = setup.dedupeOnSubscribe || false;\n this.maximumCacheSize = setup.maximumCacheSize || 100;\n\n this.customEncrypt = setup.customEncrypt;\n this.customDecrypt = setup.customDecrypt;\n\n this.fileUploadPublishRetryLimit = setup.fileUploadPublishRetryLimit ?? 5;\n this.useRandomIVs = setup.useRandomIVs ?? true;\n\n // if location config exist and we are in https, force secure to true.\n if (typeof location !== 'undefined' && location.protocol === 'https:') {\n this.secure = true;\n }\n\n this.logVerbosity = setup.logVerbosity || false;\n this.suppressLeaveEvents = setup.suppressLeaveEvents || false;\n\n this.announceFailedHeartbeats = setup.announceFailedHeartbeats || true;\n this.announceSuccessfulHeartbeats = setup.announceSuccessfulHeartbeats || false;\n\n this.useInstanceId = setup.useInstanceId || false;\n this.useRequestId = setup.useRequestId || false;\n\n this.requestMessageCountThreshold = setup.requestMessageCountThreshold;\n\n // set timeout to how long a transaction request will wait for the server (default 15 seconds)\n this.setTransactionTimeout(setup.transactionalRequestTimeout || 15 * 1000);\n // set timeout to how long a subscribe event loop will run (default 310 seconds)\n this.setSubscribeTimeout(setup.subscribeRequestTimeout || 310 * 1000);\n // set config on beacon (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) usage\n this.setSendBeaconConfig(setup.useSendBeacon || true);\n // how long the SDK will report the client to be alive before issuing a timeout\n if (setup.presenceTimeout) {\n this.setPresenceTimeout(setup.presenceTimeout);\n } else {\n this._presenceTimeout = PRESENCE_TIMEOUT_DEFAULT;\n }\n\n if (setup.heartbeatInterval != null) {\n this.setHeartbeatInterval(setup.heartbeatInterval);\n }\n\n this.setUUID(this._decideUUID(setup.uuid)); // UUID decision depends on subKey.\n }\n\n // exposed setters\n getAuthKey(): string {\n return this.authKey;\n }\n\n setAuthKey(val: string): this {\n this.authKey = val;\n return this;\n }\n\n setCipherKey(val: string): this {\n this.cipherKey = val;\n return this;\n }\n\n getUUID(): string {\n return this.UUID;\n }\n\n setUUID(val: string): this {\n if (this._db && this._db.set) this._db.set(`${this.subscribeKey}uuid`, val);\n this.UUID = val;\n return this;\n }\n\n getFilterExpression(): string {\n return this.filterExpression;\n }\n\n setFilterExpression(val: string): this {\n this.filterExpression = val;\n return this;\n }\n\n getPresenceTimeout(): number {\n return this._presenceTimeout;\n }\n\n setPresenceTimeout(val: number): this {\n if (val >= PRESENCE_TIMEOUT_MINIMUM) {\n this._presenceTimeout = val;\n } else {\n this._presenceTimeout = PRESENCE_TIMEOUT_MINIMUM;\n\n // eslint-disable-next-line no-console\n console.log('WARNING: Presence timeout is less than the minimum. Using minimum value: ', this._presenceTimeout);\n }\n\n this.setHeartbeatInterval(this._presenceTimeout / 2 - 1);\n\n return this;\n }\n\n setProxy(proxy: ProxyStruct) {\n this.proxy = proxy;\n }\n\n getHeartbeatInterval(): number {\n return this._heartbeatInterval;\n }\n\n setHeartbeatInterval(val: number): this {\n this._heartbeatInterval = val;\n return this;\n }\n\n // deprecated setters.\n getSubscribeTimeout(): number {\n return this._subscribeRequestTimeout;\n }\n\n setSubscribeTimeout(val: number): this {\n this._subscribeRequestTimeout = val;\n return this;\n }\n\n getTransactionTimeout(): number {\n return this._transactionalRequestTimeout;\n }\n\n setTransactionTimeout(val: number): this {\n this._transactionalRequestTimeout = val;\n return this;\n }\n\n isSendBeaconEnabled(): boolean {\n return this._useSendBeacon;\n }\n\n setSendBeaconConfig(val: boolean): this {\n this._useSendBeacon = val;\n return this;\n }\n\n getVersion(): string {\n return '4.37.0';\n }\n\n _addPnsdkSuffix(name: string, suffix: string) {\n this._PNSDKSuffix[name] = suffix;\n }\n\n _getPnsdkSuffix(separator: string): string {\n return Object.keys(this._PNSDKSuffix).reduce((result, key) => result + separator + this._PNSDKSuffix[key], '');\n }\n\n _decideUUID(providedUUID: string): string {\n // if the uuid was provided by setup, use this UUID.\n if (providedUUID) {\n return providedUUID;\n }\n\n // if the database module is enabled and we have something saved, use this.\n if (this._db && this._db.get && this._db.get(`${this.subscribeKey}uuid`)) {\n return this._db.get(`${this.subscribeKey}uuid`);\n }\n\n // randomize the UUID and push to storage\n return `pn-${uuidGenerator.createUUID()}`;\n }\n}\n"],"file":"config.js"} \ No newline at end of file +{"version":3,"sources":["core/components/config.js"],"names":["PRESENCE_TIMEOUT_MINIMUM","PRESENCE_TIMEOUT_DEFAULT","makeDefaultOrigins","Array","from","length","_","i","setup","_PNSDKSuffix","instanceId","uuidGenerator","createUUID","secretKey","secret_key","subscribeKey","subscribe_key","publishKey","publish_key","sdkName","sdkFamily","partnerId","setAuthKey","authKey","setCipherKey","cipherKey","setFilterExpression","filterExpression","origin","isArray","undefined","Error","secure","ssl","restore","proxy","keepAlive","keepAliveSettings","autoNetworkDetection","dedupeOnSubscribe","maximumCacheSize","customEncrypt","customDecrypt","fileUploadPublishRetryLimit","useRandomIVs","location","protocol","logVerbosity","suppressLeaveEvents","announceFailedHeartbeats","announceSuccessfulHeartbeats","useInstanceId","useRequestId","requestMessageCountThreshold","setTransactionTimeout","transactionalRequestTimeout","setSubscribeTimeout","subscribeRequestTimeout","setSendBeaconConfig","useSendBeacon","presenceTimeout","setPresenceTimeout","_presenceTimeout","heartbeatInterval","setHeartbeatInterval","setUUID","uuid","val","UUID","trim","console","log","_heartbeatInterval","_subscribeRequestTimeout","_transactionalRequestTimeout","_useSendBeacon","name","suffix","separator","Object","keys","reduce","result","key"],"mappings":";;;;;;;;;;;;;;;AAGA;;AACA;;AAEA,IAAMA,wBAAgC,GAAG,EAAzC;AACA,IAAMC,wBAAgC,GAAG,GAAzC;;AAEA,IAAMC,kBAAkB,GAAG,SAArBA,kBAAqB;AAAA,SAAMC,KAAK,CAACC,IAAN,CAAW;AAAEC,IAAAA,MAAM,EAAE;AAAV,GAAX,EAA2B,UAACC,CAAD,EAAIC,CAAJ;AAAA,uBAAeA,CAAC,GAAG,CAAnB;AAAA,GAA3B,CAAN;AAAA,CAA3B;;;AAuIE,0BAA4C;AAAA;;AAAA,QAA9BC,KAA8B,QAA9BA,KAA8B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAC1C,SAAKC,YAAL,GAAoB,EAApB;AAEA,SAAKC,UAAL,gBAAwBC,iBAAcC,UAAd,EAAxB;AACA,SAAKC,SAAL,GAAiBL,KAAK,CAACK,SAAN,IAAmBL,KAAK,CAACM,UAA1C;AACA,SAAKC,YAAL,GAAoBP,KAAK,CAACO,YAAN,IAAsBP,KAAK,CAACQ,aAAhD;AACA,SAAKC,UAAL,GAAkBT,KAAK,CAACS,UAAN,IAAoBT,KAAK,CAACU,WAA5C;AACA,SAAKC,OAAL,GAAeX,KAAK,CAACW,OAArB;AACA,SAAKC,SAAL,GAAiBZ,KAAK,CAACY,SAAvB;AACA,SAAKC,SAAL,GAAiBb,KAAK,CAACa,SAAvB;AACA,SAAKC,UAAL,CAAgBd,KAAK,CAACe,OAAtB;AACA,SAAKC,YAAL,CAAkBhB,KAAK,CAACiB,SAAxB;AAEA,SAAKC,mBAAL,CAAyBlB,KAAK,CAACmB,gBAA/B;;AAEA,QAAI,OAAOnB,KAAK,CAACoB,MAAb,KAAwB,QAAxB,IAAoC,CAACzB,KAAK,CAAC0B,OAAN,CAAcrB,KAAK,CAACoB,MAApB,CAArC,IAAoEpB,KAAK,CAACoB,MAAN,KAAiBE,SAAzF,EAAoG;AAClG,YAAM,IAAIC,KAAJ,CAAU,iEAAV,CAAN;AACD;;AAED,SAAKH,MAAL,GAAcpB,KAAK,CAACoB,MAAN,IAAgB1B,kBAAkB,EAAhD;AACA,SAAK8B,MAAL,GAAcxB,KAAK,CAACyB,GAAN,IAAa,KAA3B;AACA,SAAKC,OAAL,GAAe1B,KAAK,CAAC0B,OAAN,IAAiB,KAAhC;AACA,SAAKC,KAAL,GAAa3B,KAAK,CAAC2B,KAAnB;AACA,SAAKC,SAAL,GAAiB5B,KAAK,CAAC4B,SAAvB;AACA,SAAKC,iBAAL,GAAyB7B,KAAK,CAAC6B,iBAA/B;AACA,SAAKC,oBAAL,GAA4B9B,KAAK,CAAC8B,oBAAN,IAA8B,KAA1D;AAEA,SAAKC,iBAAL,GAAyB/B,KAAK,CAAC+B,iBAAN,IAA2B,KAApD;AACA,SAAKC,gBAAL,GAAwBhC,KAAK,CAACgC,gBAAN,IAA0B,GAAlD;AAEA,SAAKC,aAAL,GAAqBjC,KAAK,CAACiC,aAA3B;AACA,SAAKC,aAAL,GAAqBlC,KAAK,CAACkC,aAA3B;AAEA,SAAKC,2BAAL,4BAAmCnC,KAAK,CAACmC,2BAAzC,yEAAwE,CAAxE;AACA,SAAKC,YAAL,0BAAoBpC,KAAK,CAACoC,YAA1B,qEAA0C,IAA1C;;AAGA,QAAI,OAAOC,QAAP,KAAoB,WAApB,IAAmCA,QAAQ,CAACC,QAAT,KAAsB,QAA7D,EAAuE;AACrE,WAAKd,MAAL,GAAc,IAAd;AACD;;AAED,SAAKe,YAAL,GAAoBvC,KAAK,CAACuC,YAAN,IAAsB,KAA1C;AACA,SAAKC,mBAAL,GAA2BxC,KAAK,CAACwC,mBAAN,IAA6B,KAAxD;AAEA,SAAKC,wBAAL,GAAgCzC,KAAK,CAACyC,wBAAN,IAAkC,IAAlE;AACA,SAAKC,4BAAL,GAAoC1C,KAAK,CAAC0C,4BAAN,IAAsC,KAA1E;AAEA,SAAKC,aAAL,GAAqB3C,KAAK,CAAC2C,aAAN,IAAuB,KAA5C;AACA,SAAKC,YAAL,GAAoB5C,KAAK,CAAC4C,YAAN,IAAsB,KAA1C;AAEA,SAAKC,4BAAL,GAAoC7C,KAAK,CAAC6C,4BAA1C;AAGA,SAAKC,qBAAL,CAA2B9C,KAAK,CAAC+C,2BAAN,IAAqC,KAAK,IAArE;AAEA,SAAKC,mBAAL,CAAyBhD,KAAK,CAACiD,uBAAN,IAAiC,MAAM,IAAhE;AAEA,SAAKC,mBAAL,CAAyBlD,KAAK,CAACmD,aAAN,IAAuB,IAAhD;;AAEA,QAAInD,KAAK,CAACoD,eAAV,EAA2B;AACzB,WAAKC,kBAAL,CAAwBrD,KAAK,CAACoD,eAA9B;AACD,KAFD,MAEO;AACL,WAAKE,gBAAL,GAAwB7D,wBAAxB;AACD;;AAED,QAAIO,KAAK,CAACuD,iBAAN,IAA2B,IAA/B,EAAqC;AACnC,WAAKC,oBAAL,CAA0BxD,KAAK,CAACuD,iBAAhC;AACD;;AAED,SAAKE,OAAL,CAAazD,KAAK,CAAC0D,IAAnB;AACD;;;;WAGD,sBAAqB;AACnB,aAAO,KAAK3C,OAAZ;AACD;;;WAED,oBAAW4C,GAAX,EAA8B;AAC5B,WAAK5C,OAAL,GAAe4C,GAAf;AACA,aAAO,IAAP;AACD;;;WAED,sBAAaA,GAAb,EAAgC;AAC9B,WAAK1C,SAAL,GAAiB0C,GAAjB;AACA,aAAO,IAAP;AACD;;;WAED,mBAAkB;AAChB,aAAO,KAAKC,IAAZ;AACD;;;WAED,iBAAQD,GAAR,EAA2B;AACzB,UAAI,CAACA,GAAD,IAAQ,OAAOA,GAAP,KAAe,QAAvB,IAAmCA,GAAG,CAACE,IAAJ,GAAWhE,MAAX,KAAsB,CAA7D,EAAgE;AAC9D,cAAM,IAAI0B,KAAJ,CAAU,qDAAV,CAAN;AACD;;AACD,WAAKqC,IAAL,GAAYD,GAAZ;AACA,aAAO,IAAP;AACD;;;WAED,+BAA8B;AAC5B,aAAO,KAAKxC,gBAAZ;AACD;;;WAED,6BAAoBwC,GAApB,EAAuC;AACrC,WAAKxC,gBAAL,GAAwBwC,GAAxB;AACA,aAAO,IAAP;AACD;;;WAED,8BAA6B;AAC3B,aAAO,KAAKL,gBAAZ;AACD;;;WAED,4BAAmBK,GAAnB,EAAsC;AACpC,UAAIA,GAAG,IAAInE,wBAAX,EAAqC;AACnC,aAAK8D,gBAAL,GAAwBK,GAAxB;AACD,OAFD,MAEO;AACL,aAAKL,gBAAL,GAAwB9D,wBAAxB;AAGAsE,QAAAA,OAAO,CAACC,GAAR,CAAY,2EAAZ,EAAyF,KAAKT,gBAA9F;AACD;;AAED,WAAKE,oBAAL,CAA0B,KAAKF,gBAAL,GAAwB,CAAxB,GAA4B,CAAtD;AAEA,aAAO,IAAP;AACD;;;WAED,kBAAS3B,KAAT,EAA6B;AAC3B,WAAKA,KAAL,GAAaA,KAAb;AACD;;;WAED,gCAA+B;AAC7B,aAAO,KAAKqC,kBAAZ;AACD;;;WAED,8BAAqBL,GAArB,EAAwC;AACtC,WAAKK,kBAAL,GAA0BL,GAA1B;AACA,aAAO,IAAP;AACD;;;WAGD,+BAA8B;AAC5B,aAAO,KAAKM,wBAAZ;AACD;;;WAED,6BAAoBN,GAApB,EAAuC;AACrC,WAAKM,wBAAL,GAAgCN,GAAhC;AACA,aAAO,IAAP;AACD;;;WAED,iCAAgC;AAC9B,aAAO,KAAKO,4BAAZ;AACD;;;WAED,+BAAsBP,GAAtB,EAAyC;AACvC,WAAKO,4BAAL,GAAoCP,GAApC;AACA,aAAO,IAAP;AACD;;;WAED,+BAA+B;AAC7B,aAAO,KAAKQ,cAAZ;AACD;;;WAED,6BAAoBR,GAApB,EAAwC;AACtC,WAAKQ,cAAL,GAAsBR,GAAtB;AACA,aAAO,IAAP;AACD;;;WAED,sBAAqB;AACnB,aAAO,OAAP;AACD;;;WAED,yBAAgBS,IAAhB,EAA8BC,MAA9B,EAA8C;AAC5C,WAAKpE,YAAL,CAAkBmE,IAAlB,IAA0BC,MAA1B;AACD;;;WAED,yBAAgBC,SAAhB,EAA2C;AAAA;;AACzC,aAAOC,MAAM,CAACC,IAAP,CAAY,KAAKvE,YAAjB,EAA+BwE,MAA/B,CAAsC,UAACC,MAAD,EAASC,GAAT;AAAA,eAAiBD,MAAM,GAAGJ,SAAT,GAAqB,KAAI,CAACrE,YAAL,CAAkB0E,GAAlB,CAAtC;AAAA,OAAtC,EAAoG,EAApG,CAAP;AACD","sourcesContent":["/* @flow */\n/* global location */\n\nimport uuidGenerator from './uuid';\nimport { InternalSetupStruct, KeepAliveStruct, ProxyStruct } from '../flow_interfaces';\n\nconst PRESENCE_TIMEOUT_MINIMUM: number = 20;\nconst PRESENCE_TIMEOUT_DEFAULT: number = 300;\n\nconst makeDefaultOrigins = () => Array.from({ length: 20 }, (_, i) => `ps${i + 1}.pndsn.com`);\n\ntype ConfigConstructArgs = {\n setup: InternalSetupStruct\n};\n\nexport default class {\n subscribeKey: string;\n publishKey: string;\n secretKey: string;\n cipherKey: string;\n authKey: string;\n UUID: string;\n\n proxy: ProxyStruct;\n\n /*\n if _useInstanceId is true, this instanceId will be added to all requests\n */\n instanceId: string;\n\n /*\n If the SDK is running as part of another SDK built atop of it, allow a custom pnsdk with name and version.\n */\n sdkName: string;\n\n /*\n keep track of the SDK family for identifier generator\n */\n sdkFamily: string;\n\n /*\n If the SDK is operated by a partner, allow a custom pnsdk item for them.\n */\n partnerId: string;\n\n /*\n filter expression to pass along when subscribing.\n */\n filterExpression: string;\n /*\n configuration to supress leave events; when a presence leave is performed\n this configuration will disallow the leave event from happening\n */\n suppressLeaveEvents: boolean;\n\n /*\n use SSL for http requests?\n */\n secure: boolean;\n\n // Custom optional origin.\n origin: string | string[];\n\n // log verbosity: true to output lots of info\n logVerbosity: boolean;\n\n // if instanceId config is true, the SDK will pass the unique instance identifier to the server as instanceId=\n useInstanceId: boolean;\n\n // if requestId config is true, the SDK will pass a unique request identifier with each request as request_id=\n useRequestId: boolean;\n\n // use connection keep-alive for http requests\n keepAlive: ?boolean;\n\n keepAliveSettings: ?KeepAliveStruct;\n\n // if autoNetworkDetection config is true, the SDK will emit NetworkUp and NetworkDown when there changes in the networking\n autoNetworkDetection: ?boolean;\n\n // alert when a heartbeat works out.\n announceSuccessfulHeartbeats: boolean;\n announceFailedHeartbeats: boolean;\n\n /*\n how long the server will wait before declaring that the client is gone.\n */\n _presenceTimeout: number;\n\n /*\n how often (in seconds) the client should announce its presence to server\n */\n _heartbeatInterval: number;\n\n /*\n how long to wait for the server when running the subscribe loop\n */\n _subscribeRequestTimeout: number;\n /*\n how long to wait for the server when making transactional requests\n */\n _transactionalRequestTimeout: number;\n /*\n use send beacon API when unsubscribing.\n https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon\n */\n _useSendBeacon: boolean;\n\n /*\n allow frameworks to append to the PNSDK parameter\n the key should be an identifier for the specific framework to prevent duplicates\n */\n _PNSDKSuffix: { [key: string]: string };\n\n /*\n if set, the SDK will alert if more messages arrive in one subscribe than the theshold\n */\n requestMessageCountThreshold: number;\n\n /*\n Restore subscription list on disconnection.\n */\n restore: boolean;\n\n /*\n support for client deduping\n */\n dedupeOnSubscribe: boolean;\n\n maximumCacheSize: number;\n\n /*\n support customp encryption and decryption functions.\n */\n customEncrypt: Function; // function to support custome encryption of messages\n\n customDecrypt: Function; // function used to decrypt old version messages\n\n // File Upload\n\n // How many times the publish-file should be retried before giving up\n fileUploadPublishRetryLimit: number;\n useRandomIVs: boolean;\n\n constructor({ setup }: ConfigConstructArgs) {\n this._PNSDKSuffix = {};\n\n this.instanceId = `pn-${uuidGenerator.createUUID()}`;\n this.secretKey = setup.secretKey || setup.secret_key;\n this.subscribeKey = setup.subscribeKey || setup.subscribe_key;\n this.publishKey = setup.publishKey || setup.publish_key;\n this.sdkName = setup.sdkName;\n this.sdkFamily = setup.sdkFamily;\n this.partnerId = setup.partnerId;\n this.setAuthKey(setup.authKey);\n this.setCipherKey(setup.cipherKey);\n\n this.setFilterExpression(setup.filterExpression);\n\n if (typeof setup.origin !== 'string' && !Array.isArray(setup.origin) && setup.origin !== undefined) {\n throw new Error('Origin must be either undefined, a string or a list of strings.');\n }\n\n this.origin = setup.origin || makeDefaultOrigins();\n this.secure = setup.ssl || false;\n this.restore = setup.restore || false;\n this.proxy = setup.proxy;\n this.keepAlive = setup.keepAlive;\n this.keepAliveSettings = setup.keepAliveSettings;\n this.autoNetworkDetection = setup.autoNetworkDetection || false;\n\n this.dedupeOnSubscribe = setup.dedupeOnSubscribe || false;\n this.maximumCacheSize = setup.maximumCacheSize || 100;\n\n this.customEncrypt = setup.customEncrypt;\n this.customDecrypt = setup.customDecrypt;\n\n this.fileUploadPublishRetryLimit = setup.fileUploadPublishRetryLimit ?? 5;\n this.useRandomIVs = setup.useRandomIVs ?? true;\n\n // if location config exist and we are in https, force secure to true.\n if (typeof location !== 'undefined' && location.protocol === 'https:') {\n this.secure = true;\n }\n\n this.logVerbosity = setup.logVerbosity || false;\n this.suppressLeaveEvents = setup.suppressLeaveEvents || false;\n\n this.announceFailedHeartbeats = setup.announceFailedHeartbeats || true;\n this.announceSuccessfulHeartbeats = setup.announceSuccessfulHeartbeats || false;\n\n this.useInstanceId = setup.useInstanceId || false;\n this.useRequestId = setup.useRequestId || false;\n\n this.requestMessageCountThreshold = setup.requestMessageCountThreshold;\n\n // set timeout to how long a transaction request will wait for the server (default 15 seconds)\n this.setTransactionTimeout(setup.transactionalRequestTimeout || 15 * 1000);\n // set timeout to how long a subscribe event loop will run (default 310 seconds)\n this.setSubscribeTimeout(setup.subscribeRequestTimeout || 310 * 1000);\n // set config on beacon (https://developer.mozilla.org/en-US/docs/Web/API/Navigator/sendBeacon) usage\n this.setSendBeaconConfig(setup.useSendBeacon || true);\n // how long the SDK will report the client to be alive before issuing a timeout\n if (setup.presenceTimeout) {\n this.setPresenceTimeout(setup.presenceTimeout);\n } else {\n this._presenceTimeout = PRESENCE_TIMEOUT_DEFAULT;\n }\n\n if (setup.heartbeatInterval != null) {\n this.setHeartbeatInterval(setup.heartbeatInterval);\n }\n\n this.setUUID(setup.uuid);\n }\n\n // exposed setters\n getAuthKey(): string {\n return this.authKey;\n }\n\n setAuthKey(val: string): this {\n this.authKey = val;\n return this;\n }\n\n setCipherKey(val: string): this {\n this.cipherKey = val;\n return this;\n }\n\n getUUID(): string {\n return this.UUID;\n }\n\n setUUID(val: string): this {\n if (!val || typeof val !== 'string' || val.trim().length === 0) {\n throw new Error('Missing uuid parameter. Provide a valid string uuid');\n }\n this.UUID = val;\n return this;\n }\n\n getFilterExpression(): string {\n return this.filterExpression;\n }\n\n setFilterExpression(val: string): this {\n this.filterExpression = val;\n return this;\n }\n\n getPresenceTimeout(): number {\n return this._presenceTimeout;\n }\n\n setPresenceTimeout(val: number): this {\n if (val >= PRESENCE_TIMEOUT_MINIMUM) {\n this._presenceTimeout = val;\n } else {\n this._presenceTimeout = PRESENCE_TIMEOUT_MINIMUM;\n\n // eslint-disable-next-line no-console\n console.log('WARNING: Presence timeout is less than the minimum. Using minimum value: ', this._presenceTimeout);\n }\n\n this.setHeartbeatInterval(this._presenceTimeout / 2 - 1);\n\n return this;\n }\n\n setProxy(proxy: ProxyStruct) {\n this.proxy = proxy;\n }\n\n getHeartbeatInterval(): number {\n return this._heartbeatInterval;\n }\n\n setHeartbeatInterval(val: number): this {\n this._heartbeatInterval = val;\n return this;\n }\n\n // deprecated setters.\n getSubscribeTimeout(): number {\n return this._subscribeRequestTimeout;\n }\n\n setSubscribeTimeout(val: number): this {\n this._subscribeRequestTimeout = val;\n return this;\n }\n\n getTransactionTimeout(): number {\n return this._transactionalRequestTimeout;\n }\n\n setTransactionTimeout(val: number): this {\n this._transactionalRequestTimeout = val;\n return this;\n }\n\n isSendBeaconEnabled(): boolean {\n return this._useSendBeacon;\n }\n\n setSendBeaconConfig(val: boolean): this {\n this._useSendBeacon = val;\n return this;\n }\n\n getVersion(): string {\n return '5.0.0';\n }\n\n _addPnsdkSuffix(name: string, suffix: string) {\n this._PNSDKSuffix[name] = suffix;\n }\n\n _getPnsdkSuffix(separator: string): string {\n return Object.keys(this._PNSDKSuffix).reduce((result, key) => result + separator + this._PNSDKSuffix[key], '');\n }\n}\n"],"file":"config.js"} \ No newline at end of file diff --git a/lib/core/flow_interfaces.js.map b/lib/core/flow_interfaces.js.map index 69fab79b0..f8b754149 100644 --- a/lib/core/flow_interfaces.js.map +++ b/lib/core/flow_interfaces.js.map @@ -1 +1 @@ -{"version":3,"sources":["core/flow_interfaces.js"],"names":["module","exports"],"mappings":";;AA0xBAA,MAAM,CAACC,OAAP,GAAiB,EAAjB","sourcesContent":["/* eslint no-unused-vars: 0 */\ndeclare module 'uuid' {\n declare function v4(): string;\n}\n\ndeclare module 'superagent' {\n declare function type(): superagent;\n}\n\nexport type CallbackStruct = {\n status: Function,\n presence: Function,\n message: Function,\n signal: Function,\n messageAction: Function,\n user: Function,\n space: Function,\n membership: Function\n}\n\nexport type ProxyStruct = {\n port: number,\n hostname: string,\n headers: Object\n}\n\nexport type KeepAliveStruct = {\n keepAlive: number,\n keepAliveMsecs: number,\n freeSocketKeepAliveTimeout: number,\n timeout: number,\n maxSockets: number,\n maxFreeSockets: number\n}\n\nexport type NetworkingModules = {\n keepAlive: ?Function,\n sendBeacon: ?Function,\n get: Function,\n post: Function,\n patch: Function\n}\n\nexport type InternalSetupStruct = {\n useSendBeacon: ?boolean, // configuration on beacon usage\n publishKey: ?string, // API key required for publishing\n subscribeKey: string, // API key required to subscribe\n cipherKey: string, // decryption keys\n origin: ?string, // an optional FQDN which will recieve calls from the SDK.\n ssl: boolean, // is SSL enabled?\n shutdown: Function, // function to call when pubnub is shutting down.\n\n sendBeacon: ?Function, // executes a call against the Beacon API\n useSendBeacon: ?boolean, // enable, disable usage of send beacons\n\n subscribeRequestTimeout: ?number, // how long to wait for subscribe requst\n transactionalRequestTimeout: ?number, // how long to wait for transactional requests\n\n proxy: ?ProxyStruct, // configuration to support proxy settings.\n\n keepAlive: ?boolean, // is keep-alive enabled?\n\n keepAliveSettings: ?KeepAliveStruct, // configuration on keep-alive usage\n\n suppressLev: ?boolean,\n\n db: Function, // get / set implementation to store data\n networking: Function // component of networking to use\n}\n\ntype DatabaseInterface = {\n get: Function,\n set: Function\n}\n\ntype EndpointKeyDefinition = {\n required: boolean\n}\n\ntype SupportedParams = {\n subscribeKey: EndpointKeyDefinition,\n uuid: EndpointKeyDefinition,\n}\n\nexport type EndpointDefinition = {\n params: SupportedParams,\n headers?: Object,\n timeout: number,\n url: string\n}\n\nexport type StateChangeAnnouncement = {\n state: Object,\n channels: Array,\n channelGroups: Array\n}\n\n// ****************** SUBSCRIPTIONS ********************************************\n\ntype SubscribeMetadata = {\n timetoken: number,\n region: number\n}\n\ntype PublishMetaData = {\n publishTimetoken: number,\n region: number\n}\n\ntype SubscribeMessage = {\n shard: string,\n subscriptionMatch: string,\n channel: string,\n messageType: number,\n payload: Object,\n flags: string,\n issuingClientId: string,\n subscribeKey: string,\n originationTimetoken: string,\n publishMetaData: PublishMetaData\n\n}\n\n// subscribe responses\ntype SubscribeEnvelope = {\n messages: Array,\n metadata: SubscribeMetadata;\n}\n\n// *****************************************************************************\n\n\n// ****************** Announcements ********************************************\n\ntype PresenceAnnouncement = {\n event: string,\n\n uuid: string,\n timestamp: number,\n occupancy: number,\n state: Object,\n\n subscribedChannel: string, // deprecated\n actualChannel: string, // deprecated\n\n channel: string,\n subscription: string,\n\n timetoken: number,\n userMetadata: Object\n}\n\ntype MessageAnnouncement = {\n\n message: Object,\n\n subscribedChannel: string, // deprecated\n actualChannel: string, // deprecated\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ntype SignalAnnouncement = {\n\n message: Object,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ntype ObjectMessage = {\n event: string,\n type: string,\n data: Object\n}\n\ntype ObjectAnnouncement = {\n\n message: ObjectMessage,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\nexport type StatusAnnouncement = {\n error: boolean,\n statusCode: number,\n category: string,\n errorData: Object,\n lastTimetoken: number,\n currentTimetoken: number,\n\n // send back channel, channel groups that were affected by this operation\n affectedChannels: Array,\n affectedChannelGroups: Array,\n}\n\n// *****************************************************************************\n\n// Time endpoints\n\ntype TimeResponse = {\n timetoken: number\n};\n\n// history\ntype FetchHistoryArguments = {\n channel: string, // fetch history from a channel\n start: number | string, // start timetoken for history fetching\n end: number | string, // end timetoken for history fetching\n includeTimetoken: boolean, // include time token for each history call\n includeMeta: boolean, // include message meta for each history entry\n reverse: boolean,\n count: number\n}\n\n// history\nexport type MessageCounterArguments = {\n channels: Array, // fetch history from a channel\n timetoken: number | null,\n channelTimetokens: Array | null\n}\n\ntype FetchMessagesArguments = {\n channels: string, // fetch history from a channel\n start: number | string, // start timetoken for history fetching\n end: number | string, // end timetoken for history fetching\n includeMeta: boolean, // include message meta for each history entry\n includeMessageActions: boolean, // include message actions for each history entry\n count: number\n}\n\ntype HistoryItem = {\n timetoken: number | string | null,\n meta: Object | null,\n entry: any,\n}\n\ntype HistoryResponse = {\n messages: Array,\n startTimeToken: number | string,\n endTimeToken: number | string,\n}\n\n\nexport type MessageCountersResponse = {\n channels: Object\n}\n\ntype HistoryV3Response = {\n channels: Object\n}\n\n// CG endpoints\n\ntype AddChannelParams = {\n channels: Array,\n channelGroup: string,\n}\n\ntype RemoveChannelParams = {\n channels: Array,\n channelGroup: string,\n}\n\ntype DeleteGroupParams = {\n channelGroup: string,\n}\n\ntype ListAllGroupsResponse = {\n groups: Array\n}\n\ntype ListChannelsParams = {\n channelGroup: string,\n}\n\ntype ListChannelsResponse = {\n channels: Array\n}\n\n//\n\n// push\n\nexport type APNS2Target = {\n topic: string,\n environment?: 'development' | 'production',\n excludedDevices?: Array\n}\n\nexport type APNS2Configuration = {\n collapseId?: string,\n expirationDate?: Date,\n targets: Array\n}\n\ntype ProvisionDeviceArgs = {\n operation: 'add' | 'remove',\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n channels: Array\n};\n\ntype ModifyDeviceArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n channels: Array\n};\n\ntype ListChannelsArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n};\n\ntype RemoveDeviceArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n};\n\ntype ListPushChannelsResponse = {\n channels: Array\n}\n\n//\n\n// presence\n\ntype LeaveArguments = {\n channels: Array,\n channelGroups: Array,\n}\n\ntype HereNowArguments = {\n channels: Array,\n channelGroups: Array,\n includeUUIDs: boolean,\n includeState: boolean,\n queryParameters?: Object\n}\n\ntype WhereNowArguments = {\n uuid: string,\n}\n\ntype WhereNowResponse = {\n channels: Array,\n}\n\n//\n\ntype GetStateArguments = {\n uuid: string,\n channels: Array,\n channelGroups: Array\n}\n\ntype GetStateResponse = {\n channels: Object\n}\n\n//\n\ntype SetStateArguments = {\n channels: Array,\n channelGroups: Array,\n state: Object\n}\n\ntype SetStateResponse = {\n state: Object\n}\n\n\ntype HeartbeatArguments = {\n channels: Array,\n channelGroups: Array,\n state: Object\n}\n\n//\n\n// subscribe\n\ntype SubscribeArguments = {\n channels: Array,\n channelGroups: Array,\n timetoken: number,\n filterExpression: ?string,\n region: ?string,\n state: Object\n}\n\n//\n\n// access manager\n\ntype AuditArguments = {\n channel: string,\n channelGroup: string,\n authKeys: Array,\n}\n\ntype GrantArguments = {\n channels: Array,\n channelGroups: Array,\n uuids: Array,\n ttl: number,\n read: boolean,\n write: boolean,\n manage: boolean,\n get: boolean,\n join: boolean,\n update: boolean,\n delete: Boolean,\n authKeys: Array\n}\n\n// Base permissions object\ninterface GrantTokenObject {\n read: boolean,\n write: boolean,\n manage: boolean,\n delete: boolean,\n get: boolean,\n update: boolean,\n join: boolean\n}\n\ninterface GrantTokenInput {\n ttl: number,\n authorizedUuid: String,\n resources?: {\n channels?: {\n [key: String]: GrantTokenObject,\n },\n groups?: {\n [key: String]: GrantTokenObject,\n },\n uuids?: {\n [key: String]: GrantTokenObject,\n }\n },\n patterns?: {\n channels?: {\n [key: String]: GrantTokenObject,\n },\n groups?: {\n [key: String]: GrantTokenObject,\n },\n uuids?: {\n [key: String]: GrantTokenObject,\n }\n },\n meta?: Object\n}\n\ninterface GrantTokenOutput extends GrantTokenInput {\n version: number,\n timestamp: number,\n signature: Buffer\n}\n\n// publish\n\ntype PublishResponse = {\n timetoken: number\n};\n\ntype PublishArguments = {\n message: Object | string | number | boolean, // the contents of the dispatch\n channel: string, // the destination of our dispatch\n sendByPost: boolean | null, // use POST when dispatching the message\n storeInHistory: boolean | null, // store the published message in remote history\n meta: Object, // psv2 supports filtering by metadata\n replicate: boolean | null // indicates to server on replication status to other data centers.\n}\n\n// signal\ntype SignalResponse = {\n timetoken: number\n};\n\ntype SignalArguments = {\n message: Object | string | number | boolean,\n channel: string\n}\n\n// Actions\n\ninterface MessageAction {\n type: string,\n value: string,\n}\n\ninterface PublishedMessageAction extends MessageAction {\n messageTimetoken: string,\n actionTimetoken: string,\n uuid: string,\n}\n\ntype MessageActionAnnouncement = {\n data: PublishedMessageAction,\n event: string,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ninterface AddMessageActionInput {\n messageTimetoken: string,\n channel: string,\n action: MessageAction,\n}\n\ninterface AddMessageActionResponse {\n data: PublishedMessageAction,\n}\n\ninterface RemoveMessageActionInput {\n messageTimetoken: string,\n actionTimetoken: string,\n channel: string,\n}\n\ninterface RemoveMessageActionResponse {\n data: {},\n}\n\ninterface GetMessageActionsInput {\n channel: string,\n start?: number | string,\n end?: number | string,\n limit?: number,\n}\n\ninterface GetMessageActionsResponse {\n data: Array,\n start?: string,\n end?: string,\n}\n\n// Users Object\n\ntype UserListInput = {\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n },\n filter?: string,\n}\n\ntype SingleUserInput = {\n userId: string,\n include?: {\n customFields?: boolean,\n }\n}\n\ntype UsersObjectInput = {\n id: string,\n name: string,\n externalId?: string,\n profileUrl?: string,\n email?: string,\n custom?: Object,\n};\n\ntype UserResponse = {\n status: number,\n data: {\n ...UsersObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype UsersListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\n// Spaces Object\n\ntype SpaceListInput = {\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n },\n filter?: string,\n}\n\ntype SingleSpaceInput = {\n spaceId: string,\n include?: {\n customFields?: boolean,\n }\n}\n\ntype SpacesObjectInput = {\n id: string,\n name: string,\n description?: String,\n custom?: Object,\n include?: {\n customFields?: boolean,\n }\n};\n\ntype SpacesResponse = {\n status: number,\n data: {\n ...SpacesObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype SpaceResponse = {\n status: number,\n data: {\n ...SpacesObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype SpacesListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\n// Memberships Object\n\ntype MembershipsInput = {\n userId: string,\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n spaceFields?: boolean,\n customSpaceFields?: boolean,\n },\n filter?: string,\n}\n\ntype MembershipsObjectInput = {\n id: string,\n custom?: Object,\n space?: SpacesResponse,\n};\n\ntype MembershipsResponse = {\n status: number,\n data: {\n ...MembershipsObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype MembershipsListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\ninterface AddMemberships extends MembershipsInput {\n addMemberships: Array,\n}\n\ninterface UpdateMemberships extends MembershipsInput {\n updateMemberships: Array,\n}\n\ninterface RemoveMemberships extends MembershipsInput {\n removeMemberships: Array,\n}\n\ninterface AddUpdateRemoveMemberships extends AddMemberships, UpdateMemberships, RemoveMemberships {}\n\n// Members Object\n\ntype MembersInput = {\n spaceId: string,\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n userFields?: boolean,\n customUserFields?: boolean,\n },\n filter?: string,\n}\n\ntype MembersObjectInput = {\n id: string,\n custom?: Object,\n user?: UserResponse,\n};\n\ntype MembersResponse = {\n status: number,\n data: {\n ...MembersObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype MembersListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\ninterface AddMembers extends MembersInput {\n addMembers: Array,\n}\n\ninterface UpdateMembers extends MembersInput {\n updateMembers: Array,\n}\n\ninterface RemoveMembers extends MembersInput {\n removeMembers: Array,\n}\n\ninterface AddUpdateRemoveMembers extends AddMembers, UpdateMembers, RemoveMembers {}\n\n//\n\ntype ModulesInject = {\n config: Object;\n}\n\nmodule.exports = {};\n"],"file":"flow_interfaces.js"} \ No newline at end of file +{"version":3,"sources":["core/flow_interfaces.js"],"names":["module","exports"],"mappings":";;AAoxBAA,MAAM,CAACC,OAAP,GAAiB,EAAjB","sourcesContent":["/* eslint no-unused-vars: 0 */\ndeclare module 'uuid' {\n declare function v4(): string;\n}\n\ndeclare module 'superagent' {\n declare function type(): superagent;\n}\n\nexport type CallbackStruct = {\n status: Function,\n presence: Function,\n message: Function,\n signal: Function,\n messageAction: Function,\n user: Function,\n space: Function,\n membership: Function\n}\n\nexport type ProxyStruct = {\n port: number,\n hostname: string,\n headers: Object\n}\n\nexport type KeepAliveStruct = {\n keepAlive: number,\n keepAliveMsecs: number,\n freeSocketKeepAliveTimeout: number,\n timeout: number,\n maxSockets: number,\n maxFreeSockets: number\n}\n\nexport type NetworkingModules = {\n keepAlive: ?Function,\n sendBeacon: ?Function,\n get: Function,\n post: Function,\n patch: Function\n}\n\nexport type InternalSetupStruct = {\n useSendBeacon: ?boolean, // configuration on beacon usage\n publishKey: ?string, // API key required for publishing\n subscribeKey: string, // API key required to subscribe\n cipherKey: string, // decryption keys\n origin: ?string, // an optional FQDN which will recieve calls from the SDK.\n ssl: boolean, // is SSL enabled?\n shutdown: Function, // function to call when pubnub is shutting down.\n\n sendBeacon: ?Function, // executes a call against the Beacon API\n useSendBeacon: ?boolean, // enable, disable usage of send beacons\n\n subscribeRequestTimeout: ?number, // how long to wait for subscribe requst\n transactionalRequestTimeout: ?number, // how long to wait for transactional requests\n\n proxy: ?ProxyStruct, // configuration to support proxy settings.\n\n keepAlive: ?boolean, // is keep-alive enabled?\n\n keepAliveSettings: ?KeepAliveStruct, // configuration on keep-alive usage\n\n suppressLev: ?boolean,\n\n networking: Function // component of networking to use\n}\n\ntype EndpointKeyDefinition = {\n required: boolean\n}\n\ntype SupportedParams = {\n subscribeKey: EndpointKeyDefinition,\n uuid: EndpointKeyDefinition,\n}\n\nexport type EndpointDefinition = {\n params: SupportedParams,\n headers?: Object,\n timeout: number,\n url: string\n}\n\nexport type StateChangeAnnouncement = {\n state: Object,\n channels: Array,\n channelGroups: Array\n}\n\n// ****************** SUBSCRIPTIONS ********************************************\n\ntype SubscribeMetadata = {\n timetoken: number,\n region: number\n}\n\ntype PublishMetaData = {\n publishTimetoken: number,\n region: number\n}\n\ntype SubscribeMessage = {\n shard: string,\n subscriptionMatch: string,\n channel: string,\n messageType: number,\n payload: Object,\n flags: string,\n issuingClientId: string,\n subscribeKey: string,\n originationTimetoken: string,\n publishMetaData: PublishMetaData\n\n}\n\n// subscribe responses\ntype SubscribeEnvelope = {\n messages: Array,\n metadata: SubscribeMetadata;\n}\n\n// *****************************************************************************\n\n\n// ****************** Announcements ********************************************\n\ntype PresenceAnnouncement = {\n event: string,\n\n uuid: string,\n timestamp: number,\n occupancy: number,\n state: Object,\n\n subscribedChannel: string, // deprecated\n actualChannel: string, // deprecated\n\n channel: string,\n subscription: string,\n\n timetoken: number,\n userMetadata: Object\n}\n\ntype MessageAnnouncement = {\n\n message: Object,\n\n subscribedChannel: string, // deprecated\n actualChannel: string, // deprecated\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ntype SignalAnnouncement = {\n\n message: Object,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ntype ObjectMessage = {\n event: string,\n type: string,\n data: Object\n}\n\ntype ObjectAnnouncement = {\n\n message: ObjectMessage,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\nexport type StatusAnnouncement = {\n error: boolean,\n statusCode: number,\n category: string,\n errorData: Object,\n lastTimetoken: number,\n currentTimetoken: number,\n\n // send back channel, channel groups that were affected by this operation\n affectedChannels: Array,\n affectedChannelGroups: Array,\n}\n\n// *****************************************************************************\n\n// Time endpoints\n\ntype TimeResponse = {\n timetoken: number\n};\n\n// history\ntype FetchHistoryArguments = {\n channel: string, // fetch history from a channel\n start: number | string, // start timetoken for history fetching\n end: number | string, // end timetoken for history fetching\n includeTimetoken: boolean, // include time token for each history call\n includeMeta: boolean, // include message meta for each history entry\n reverse: boolean,\n count: number\n}\n\n// history\nexport type MessageCounterArguments = {\n channels: Array, // fetch history from a channel\n timetoken: number | null,\n channelTimetokens: Array | null\n}\n\ntype FetchMessagesArguments = {\n channels: string, // fetch history from a channel\n start: number | string, // start timetoken for history fetching\n end: number | string, // end timetoken for history fetching\n includeMeta: boolean, // include message meta for each history entry\n includeMessageActions: boolean, // include message actions for each history entry\n count: number\n}\n\ntype HistoryItem = {\n timetoken: number | string | null,\n meta: Object | null,\n entry: any,\n}\n\ntype HistoryResponse = {\n messages: Array,\n startTimeToken: number | string,\n endTimeToken: number | string,\n}\n\n\nexport type MessageCountersResponse = {\n channels: Object\n}\n\ntype HistoryV3Response = {\n channels: Object\n}\n\n// CG endpoints\n\ntype AddChannelParams = {\n channels: Array,\n channelGroup: string,\n}\n\ntype RemoveChannelParams = {\n channels: Array,\n channelGroup: string,\n}\n\ntype DeleteGroupParams = {\n channelGroup: string,\n}\n\ntype ListAllGroupsResponse = {\n groups: Array\n}\n\ntype ListChannelsParams = {\n channelGroup: string,\n}\n\ntype ListChannelsResponse = {\n channels: Array\n}\n\n//\n\n// push\n\nexport type APNS2Target = {\n topic: string,\n environment?: 'development' | 'production',\n excludedDevices?: Array\n}\n\nexport type APNS2Configuration = {\n collapseId?: string,\n expirationDate?: Date,\n targets: Array\n}\n\ntype ProvisionDeviceArgs = {\n operation: 'add' | 'remove',\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n channels: Array\n};\n\ntype ModifyDeviceArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n channels: Array\n};\n\ntype ListChannelsArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n};\n\ntype RemoveDeviceArgs = {\n pushGateway: 'gcm' | 'apns' | 'apns2' | 'mpns',\n environment?: 'development' | 'production',\n topic?: string,\n device: string,\n};\n\ntype ListPushChannelsResponse = {\n channels: Array\n}\n\n//\n\n// presence\n\ntype LeaveArguments = {\n channels: Array,\n channelGroups: Array,\n}\n\ntype HereNowArguments = {\n channels: Array,\n channelGroups: Array,\n includeUUIDs: boolean,\n includeState: boolean,\n queryParameters?: Object\n}\n\ntype WhereNowArguments = {\n uuid: string,\n}\n\ntype WhereNowResponse = {\n channels: Array,\n}\n\n//\n\ntype GetStateArguments = {\n uuid: string,\n channels: Array,\n channelGroups: Array\n}\n\ntype GetStateResponse = {\n channels: Object\n}\n\n//\n\ntype SetStateArguments = {\n channels: Array,\n channelGroups: Array,\n state: Object\n}\n\ntype SetStateResponse = {\n state: Object\n}\n\n\ntype HeartbeatArguments = {\n channels: Array,\n channelGroups: Array,\n state: Object\n}\n\n//\n\n// subscribe\n\ntype SubscribeArguments = {\n channels: Array,\n channelGroups: Array,\n timetoken: number,\n filterExpression: ?string,\n region: ?string,\n state: Object\n}\n\n//\n\n// access manager\n\ntype AuditArguments = {\n channel: string,\n channelGroup: string,\n authKeys: Array,\n}\n\ntype GrantArguments = {\n channels: Array,\n channelGroups: Array,\n uuids: Array,\n ttl: number,\n read: boolean,\n write: boolean,\n manage: boolean,\n get: boolean,\n join: boolean,\n update: boolean,\n delete: Boolean,\n authKeys: Array\n}\n\n// Base permissions object\ninterface GrantTokenObject {\n read: boolean,\n write: boolean,\n manage: boolean,\n delete: boolean,\n get: boolean,\n update: boolean,\n join: boolean\n}\n\ninterface GrantTokenInput {\n ttl: number,\n authorizedUuid: String,\n resources?: {\n channels?: {\n [key: String]: GrantTokenObject,\n },\n groups?: {\n [key: String]: GrantTokenObject,\n },\n uuids?: {\n [key: String]: GrantTokenObject,\n }\n },\n patterns?: {\n channels?: {\n [key: String]: GrantTokenObject,\n },\n groups?: {\n [key: String]: GrantTokenObject,\n },\n uuids?: {\n [key: String]: GrantTokenObject,\n }\n },\n meta?: Object\n}\n\ninterface GrantTokenOutput extends GrantTokenInput {\n version: number,\n timestamp: number,\n signature: Buffer\n}\n\n// publish\n\ntype PublishResponse = {\n timetoken: number\n};\n\ntype PublishArguments = {\n message: Object | string | number | boolean, // the contents of the dispatch\n channel: string, // the destination of our dispatch\n sendByPost: boolean | null, // use POST when dispatching the message\n storeInHistory: boolean | null, // store the published message in remote history\n meta: Object, // psv2 supports filtering by metadata\n replicate: boolean | null // indicates to server on replication status to other data centers.\n}\n\n// signal\ntype SignalResponse = {\n timetoken: number\n};\n\ntype SignalArguments = {\n message: Object | string | number | boolean,\n channel: string\n}\n\n// Actions\n\ninterface MessageAction {\n type: string,\n value: string,\n}\n\ninterface PublishedMessageAction extends MessageAction {\n messageTimetoken: string,\n actionTimetoken: string,\n uuid: string,\n}\n\ntype MessageActionAnnouncement = {\n data: PublishedMessageAction,\n event: string,\n\n channel: string,\n subscription: string,\n\n timetoken: number | string,\n userMetadata: Object,\n publisher: string\n}\n\ninterface AddMessageActionInput {\n messageTimetoken: string,\n channel: string,\n action: MessageAction,\n}\n\ninterface AddMessageActionResponse {\n data: PublishedMessageAction,\n}\n\ninterface RemoveMessageActionInput {\n messageTimetoken: string,\n actionTimetoken: string,\n channel: string,\n}\n\ninterface RemoveMessageActionResponse {\n data: {},\n}\n\ninterface GetMessageActionsInput {\n channel: string,\n start?: number | string,\n end?: number | string,\n limit?: number,\n}\n\ninterface GetMessageActionsResponse {\n data: Array,\n start?: string,\n end?: string,\n}\n\n// Users Object\n\ntype UserListInput = {\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n },\n filter?: string,\n}\n\ntype SingleUserInput = {\n userId: string,\n include?: {\n customFields?: boolean,\n }\n}\n\ntype UsersObjectInput = {\n id: string,\n name: string,\n externalId?: string,\n profileUrl?: string,\n email?: string,\n custom?: Object,\n};\n\ntype UserResponse = {\n status: number,\n data: {\n ...UsersObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype UsersListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\n// Spaces Object\n\ntype SpaceListInput = {\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n },\n filter?: string,\n}\n\ntype SingleSpaceInput = {\n spaceId: string,\n include?: {\n customFields?: boolean,\n }\n}\n\ntype SpacesObjectInput = {\n id: string,\n name: string,\n description?: String,\n custom?: Object,\n include?: {\n customFields?: boolean,\n }\n};\n\ntype SpacesResponse = {\n status: number,\n data: {\n ...SpacesObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype SpaceResponse = {\n status: number,\n data: {\n ...SpacesObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype SpacesListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\n// Memberships Object\n\ntype MembershipsInput = {\n userId: string,\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n spaceFields?: boolean,\n customSpaceFields?: boolean,\n },\n filter?: string,\n}\n\ntype MembershipsObjectInput = {\n id: string,\n custom?: Object,\n space?: SpacesResponse,\n};\n\ntype MembershipsResponse = {\n status: number,\n data: {\n ...MembershipsObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype MembershipsListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\ninterface AddMemberships extends MembershipsInput {\n addMemberships: Array,\n}\n\ninterface UpdateMemberships extends MembershipsInput {\n updateMemberships: Array,\n}\n\ninterface RemoveMemberships extends MembershipsInput {\n removeMemberships: Array,\n}\n\ninterface AddUpdateRemoveMemberships extends AddMemberships, UpdateMemberships, RemoveMemberships {}\n\n// Members Object\n\ntype MembersInput = {\n spaceId: string,\n limit?: number,\n page?: {\n next?: string,\n prev?: string,\n },\n include?: {\n totalCount?: boolean,\n customFields?: boolean,\n userFields?: boolean,\n customUserFields?: boolean,\n },\n filter?: string,\n}\n\ntype MembersObjectInput = {\n id: string,\n custom?: Object,\n user?: UserResponse,\n};\n\ntype MembersResponse = {\n status: number,\n data: {\n ...MembersObjectInput,\n created: string,\n updated: string,\n eTag: string,\n },\n};\n\ntype MembersListResponse = {\n status: number,\n totalCount: number,\n next: String,\n prev: String,\n data: Array,\n};\n\ninterface AddMembers extends MembersInput {\n addMembers: Array,\n}\n\ninterface UpdateMembers extends MembersInput {\n updateMembers: Array,\n}\n\ninterface RemoveMembers extends MembersInput {\n removeMembers: Array,\n}\n\ninterface AddUpdateRemoveMembers extends AddMembers, UpdateMembers, RemoveMembers {}\n\n//\n\ntype ModulesInject = {\n config: Object;\n}\n\nmodule.exports = {};\n"],"file":"flow_interfaces.js"} \ No newline at end of file diff --git a/lib/core/pubnub-common.js b/lib/core/pubnub-common.js index 09b07a41d..4ca183989 100644 --- a/lib/core/pubnub-common.js +++ b/lib/core/pubnub-common.js @@ -272,12 +272,10 @@ var _default = function () { (0, _defineProperty2["default"])(this, "setProxy", void 0); (0, _defineProperty2["default"])(this, "encrypt", void 0); (0, _defineProperty2["default"])(this, "decrypt", void 0); - var db = setup.db, - networking = setup.networking, + var networking = setup.networking, cbor = setup.cbor; var config = this._config = new _config["default"]({ - setup: setup, - db: db + setup: setup }); var crypto = new _index["default"]({ config: config diff --git a/lib/core/pubnub-common.js.map b/lib/core/pubnub-common.js.map index 95f4b439f..b7824cf9a 100644 --- a/lib/core/pubnub-common.js.map +++ b/lib/core/pubnub-common.js.map @@ -1 +1 @@ -{"version":3,"sources":["core/pubnub-common.js"],"names":["setup","db","networking","cbor","config","_config","Config","crypto","Crypto","cryptography","init","tokenManager","_tokenManager","TokenManager","telemetryManager","_telemetryManager","TelemetryManager","maximumSamplesCount","modules","PubNubFile","File","encryptFile","key","file","decryptFile","timeEndpoint","endpointCreator","bind","timeEndpointConfig","leaveEndpoint","presenceLeaveEndpointConfig","heartbeatEndpoint","presenceHeartbeatEndpointConfig","setStateEndpoint","presenceSetStateConfig","subscribeEndpoint","subscribeEndpointConfig","listenerManager","_listenerManager","ListenerManager","subscriptionManager","SubscriptionManager","getFileUrl","params","addListener","removeListener","removeAllListeners","parseToken","setToken","getToken","channelGroups","listGroups","listChannelGroupsConfig","listChannels","listChannelsInChannelGroupConfig","addChannels","addChannelsChannelGroupConfig","removeChannels","removeChannelsChannelGroupConfig","deleteGroup","deleteChannelGroupConfig","push","addPushChannelsConfig","removePushChannelsConfig","deleteDevice","removeDevicePushConfig","listPushChannelsConfig","hereNow","presenceHereNowConfig","whereNow","presenceWhereNowEndpointConfig","getState","presenceGetStateConfig","setState","adaptStateChange","grant","grantEndpointConfig","grantToken","grantTokenEndpointConfig","audit","auditEndpointConfig","revokeToken","revokeTokenEndpointConfig","publish","publishEndpointConfig","fire","args","callback","replicate","storeInHistory","signal","signalEndpointConfig","history","historyEndpointConfig","deleteMessages","deleteMessagesEndpointConfig","messageCounts","messageCountsEndpointConfig","fetchMessages","fetchMessagesEndpointConfig","addMessageAction","addMessageActionEndpointConfig","removeMessageAction","removeMessageActionEndpointConfig","getMessageActions","getMessageActionEndpointConfig","listFiles","listFilesEndpointConfig","generateUploadUrl","generateUploadUrlEndpointConfig","publishFile","publishFileEndpointConfig","sendFile","downloadFile","downloadFileEndpointConfig","deleteFile","deleteFileEndpointConfig","objects","getAllUUIDMetadata","getAllUUIDMetadataEndpointConfig","getUUIDMetadata","getUUIDMetadataEndpointConfig","setUUIDMetadata","setUUIDMetadataEndpointConfig","removeUUIDMetadata","removeUUIDMetadataEndpointConfig","getAllChannelMetadata","getAllChannelMetadataEndpointConfig","getChannelMetadata","getChannelMetadataEndpointConfig","setChannelMetadata","setChannelMetadataEndpointConfig","removeChannelMetadata","removeChannelMetadataEndpointConfig","getChannelMembers","getMembersV2EndpointConfig","setChannelMembers","parameters","rest","call","setMembersV2EndpointConfig","type","removeChannelMembers","getMemberships","getMembershipsV2EndpointConfig","setMemberships","setMembershipsV2EndpointConfig","removeMemberships","createUser","createUserEndpointConfig","updateUser","updateUserEndpointConfig","deleteUser","deleteUserEndpointConfig","getUser","getUserEndpointConfig","getUsers","getUsersEndpointConfig","createSpace","createSpaceEndpointConfig","updateSpace","updateSpaceEndpointConfig","deleteSpace","deleteSpaceEndpointConfig","getSpaces","getSpacesEndpointConfig","getSpace","getSpaceEndpointConfig","addMembers","addMembersEndpointConfig","updateMembers","updateMembersEndpointConfig","removeMembers","removeMembersEndpointConfig","getMembers","getMembersEndpointConfig","getMembershipsEndpointConfig","joinSpaces","joinSpacesEndpointConfig","updateMemberships","updateMembershipsEndpointConfig","leaveSpaces","leaveSpacesEndpointConfig","time","subscribe","adaptSubscribeChange","presence","adaptPresenceChange","unsubscribe","adaptUnsubscribeChange","disconnect","reconnect","destroy","isOffline","unsubscribeAll","stop","getSubscribedChannels","getSubscribedChannelGroups","encrypt","decrypt","getAuthKey","setAuthKey","setCipherKey","getUUID","setUUID","getFilterExpression","setFilterExpression","setHeartbeatInterval","hasModule","setProxy","proxy","getVersion","name","suffix","_addPnsdkSuffix","announceNetworkDown","restore","announceNetworkUp","title","body","NotificationsPayload","uuidGenerator","createUUID","OPERATIONS","CATEGORIES"],"mappings":";;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAIA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAMA;;AAKA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;;AA0ME,oBAAYA,KAAZ,EAAwC;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACtC,QAAMC,EAAN,GAA+BD,KAA/B,CAAMC,EAAN;AAAA,QAAUC,UAAV,GAA+BF,KAA/B,CAAUE,UAAV;AAAA,QAAsBC,IAAtB,GAA+BH,KAA/B,CAAsBG,IAAtB;AAEA,QAAMC,MAAM,GAAI,KAAKC,OAAL,GAAe,IAAIC,kBAAJ,CAAW;AAAEN,MAAAA,KAAK,EAALA,KAAF;AAASC,MAAAA,EAAE,EAAFA;AAAT,KAAX,CAA/B;AACA,QAAMM,MAAM,GAAG,IAAIC,iBAAJ,CAAW;AAAEJ,MAAAA,MAAM,EAANA;AAAF,KAAX,CAAf;AAEA,QAAMK,YAAY,GAAGT,KAAK,CAACS,YAA3B;AAEAP,IAAAA,UAAU,CAACQ,IAAX,CAAgBN,MAAhB;AAEA,QAAMO,YAAY,GAAI,KAAKC,aAAL,GAAqB,IAAIC,yBAAJ,CAAiBT,MAAjB,EAAyBD,IAAzB,CAA3C;AACA,QAAMW,gBAAgB,GAAI,KAAKC,iBAAL,GAAyB,IAAIC,6BAAJ,CAAqB;AACtEC,MAAAA,mBAAmB,EAAE;AADiD,KAArB,CAAnD;AAIA,QAAIC,OAAO,GAAG;AACZd,MAAAA,MAAM,EAANA,MADY;AAEZF,MAAAA,UAAU,EAAVA,UAFY;AAGZK,MAAAA,MAAM,EAANA,MAHY;AAIZE,MAAAA,YAAY,EAAZA,YAJY;AAKZE,MAAAA,YAAY,EAAZA,YALY;AAMZG,MAAAA,gBAAgB,EAAhBA,gBANY;AAOZK,MAAAA,UAAU,EAAEnB,KAAK,CAACmB;AAPN,KAAd;AAUA,SAAKC,IAAL,GAAYpB,KAAK,CAACmB,UAAlB;;AAEA,SAAKE,WAAL,GAAmB,UAACC,GAAD,EAAMC,IAAN;AAAA,aAAed,YAAY,CAACY,WAAb,CAAyBC,GAAzB,EAA8BC,IAA9B,EAAoC,KAAI,CAACH,IAAzC,CAAf;AAAA,KAAnB;;AACA,SAAKI,WAAL,GAAmB,UAACF,GAAD,EAAMC,IAAN;AAAA,aAAed,YAAY,CAACe,WAAb,CAAyBF,GAAzB,EAA8BC,IAA9B,EAAoC,KAAI,CAACH,IAAzC,CAAf;AAAA,KAAnB;;AAEA,QAAMK,YAAY,GAAGC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCU,kBAApC,CAArB;;AACA,QAAMC,aAAa,GAAGH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCY,2BAApC,CAAtB;;AACA,QAAMC,iBAAiB,GAAGL,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCc,+BAApC,CAA1B;;AACA,QAAMC,gBAAgB,GAAGP,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgB,sBAApC,CAAzB;;AACA,QAAMC,iBAAiB,GAAGT,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkB,uBAApC,CAA1B;;AAGA,QAAMC,eAAe,GAAI,KAAKC,gBAAL,GAAwB,IAAIC,4BAAJ,EAAjD;AAEA,QAAMC,mBAAmB,GAAG,IAAIC,gCAAJ,CAAwB;AAClDhB,MAAAA,YAAY,EAAZA,YADkD;AAElDI,MAAAA,aAAa,EAAbA,aAFkD;AAGlDE,MAAAA,iBAAiB,EAAjBA,iBAHkD;AAIlDE,MAAAA,gBAAgB,EAAhBA,gBAJkD;AAKlDE,MAAAA,iBAAiB,EAAjBA,iBALkD;AAMlD5B,MAAAA,MAAM,EAAEW,OAAO,CAACX,MANkC;AAOlDH,MAAAA,MAAM,EAAEc,OAAO,CAACd,MAPkC;AAQlDiC,MAAAA,eAAe,EAAfA,eARkD;AASlDK,MAAAA,UAAU,EAAE,oBAACC,MAAD;AAAA,eAAY,8BAAmBzB,OAAnB,EAA4ByB,MAA5B,CAAZ;AAAA;AATsC,KAAxB,CAA5B;AAYA,SAAKC,WAAL,GAAmBP,eAAe,CAACO,WAAhB,CAA4BjB,IAA5B,CAAiCU,eAAjC,CAAnB;AACA,SAAKQ,cAAL,GAAsBR,eAAe,CAACQ,cAAhB,CAA+BlB,IAA/B,CAAoCU,eAApC,CAAtB;AACA,SAAKS,kBAAL,GAA0BT,eAAe,CAACS,kBAAhB,CAAmCnB,IAAnC,CAAwCU,eAAxC,CAA1B;AAEA,SAAKU,UAAL,GAAkBpC,YAAY,CAACoC,UAAb,CAAwBpB,IAAxB,CAA6BhB,YAA7B,CAAlB;AACA,SAAKqC,QAAL,GAAgBrC,YAAY,CAACqC,QAAb,CAAsBrB,IAAtB,CAA2BhB,YAA3B,CAAhB;AACA,SAAKsC,QAAL,GAAgBtC,YAAY,CAACsC,QAAb,CAAsBtB,IAAtB,CAA2BhB,YAA3B,CAAhB;AAGA,SAAKuC,aAAL,GAAqB;AACnBC,MAAAA,UAAU,EAAEzB,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkC,uBAApC,CADO;AAEnBC,MAAAA,YAAY,EAAE3B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoC,gCAApC,CAFK;AAGnBC,MAAAA,WAAW,EAAE7B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCsC,6BAApC,CAHM;AAInBC,MAAAA,cAAc,EAAE/B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCwC,gCAApC,CAJG;AAKnBC,MAAAA,WAAW,EAAEjC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC0C,wBAApC;AALM,KAArB;AAQA,SAAKC,IAAL,GAAY;AACVN,MAAAA,WAAW,EAAE7B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC4C,qBAApC,CADH;AAEVL,MAAAA,cAAc,EAAE/B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6C,wBAApC,CAFN;AAGVC,MAAAA,YAAY,EAAEtC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+C,sBAApC,CAHJ;AAIVZ,MAAAA,YAAY,EAAE3B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgD,sBAApC;AAJJ,KAAZ;AAOA,SAAKC,OAAL,GAAezC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkD,qBAApC,CAAf;AACA,SAAKC,QAAL,GAAgB3C,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoD,8BAApC,CAAhB;AACA,SAAKC,QAAL,GAAgB7C,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCsD,sBAApC,CAAhB;AACA,SAAKC,QAAL,GAAgBjC,mBAAmB,CAACkC,gBAApB,CAAqC/C,IAArC,CAA0Ca,mBAA1C,CAAhB;AAEA,SAAKmC,KAAL,GAAajD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC0D,mBAApC,CAAb;AACA,SAAKC,UAAL,GAAkBnD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC4D,wBAApC,CAAlB;AACA,SAAKC,KAAL,GAAarD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8D,mBAApC,CAAb;AACA,SAAKC,WAAL,GAAmBvD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgE,wBAApC,CAAnB;AAEA,SAAKC,OAAL,GAAezD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkE,qBAApC,CAAf;;AAEA,SAAKC,IAAL,GAAY,UAACC,IAAD,EAAOC,QAAP,EAAoB;AAC9BD,MAAAA,IAAI,CAACE,SAAL,GAAiB,KAAjB;AACAF,MAAAA,IAAI,CAACG,cAAL,GAAsB,KAAtB;AACA,aAAO,KAAI,CAACN,OAAL,CAAaG,IAAb,EAAmBC,QAAnB,CAAP;AACD,KAJD;;AAMA,SAAKG,MAAL,GAAchE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyE,oBAApC,CAAd;AAEA,SAAKC,OAAL,GAAelE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2E,qBAApC,CAAf;AACA,SAAKC,cAAL,GAAsBpE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6E,4BAApC,CAAtB;AACA,SAAKC,aAAL,GAAqBtE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+E,2BAApC,CAArB;AACA,SAAKC,aAAL,GAAqBxE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiF,2BAApC,CAArB;AAIA,SAAKC,gBAAL,GAAwB1E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmF,8BAApC,CAAxB;AAEA,SAAKC,mBAAL,GAA2B5E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqF,iCAApC,CAA3B;AAEA,SAAKC,iBAAL,GAAyB9E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuF,8BAApC,CAAzB;AAIA,SAAKC,SAAL,GAAiBhF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyF,sBAApC,CAAjB;;AAEA,QAAMC,iBAAiB,GAAGlF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2F,+BAApC,CAA1B;;AACA,SAAKC,WAAL,GAAmBpF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6F,wBAApC,CAAnB;AAEA,SAAKC,QAAL,GAAgB,2BAAiB;AAC/BJ,MAAAA,iBAAiB,EAAjBA,iBAD+B;AAE/BE,MAAAA,WAAW,EAAE,KAAKA,WAFa;AAG/B5F,MAAAA,OAAO,EAAPA;AAH+B,KAAjB,CAAhB;;AAMA,SAAKwB,UAAL,GAAkB,UAACC,MAAD;AAAA,aAAY,8BAAmBzB,OAAnB,EAA4ByB,MAA5B,CAAZ;AAAA,KAAlB;;AAEA,SAAKsE,YAAL,GAAoBvF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgG,yBAApC,CAApB;AAEA,SAAKC,UAAL,GAAkBzF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkG,uBAApC,CAAlB;AAIA,SAAKC,OAAL,GAAe;AACbC,MAAAA,kBAAkB,EAAE5F,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqG,mBAApC,CADP;AAEbC,MAAAA,eAAe,EAAE9F,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuG,eAApC,CAFJ;AAGbC,MAAAA,eAAe,EAAEhG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyG,eAApC,CAHJ;AAIbC,MAAAA,kBAAkB,EAAElG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2G,kBAApC,CAJP;AAMbC,MAAAA,qBAAqB,EAAEpG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6G,oBAApC,CANV;AAObC,MAAAA,kBAAkB,EAAEtG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+G,gBAApC,CAPP;AAQbC,MAAAA,kBAAkB,EAAExG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiH,gBAApC,CARP;AASbC,MAAAA,qBAAqB,EAAE1G,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmH,mBAApC,CATV;AAWbC,MAAAA,iBAAiB,EAAE5G,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqH,gBAApC,CAXN;AAYbC,MAAAA,iBAAiB,EAAE,2BAACC,UAAD;AAAA,0CAAgEC,IAAhE;AAAgEA,UAAAA,IAAhE;AAAA;;AAAA,eACjBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGE0H,gBAHF;AAKIC,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADiB;AAAA,OAZN;AAuBbI,MAAAA,oBAAoB,EAAE,8BAACL,UAAD;AAAA,2CAAgEC,IAAhE;AAAgEA,UAAAA,IAAhE;AAAA;;AAAA,eACpBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGE0H,gBAHF;AAKIC,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADoB;AAAA,OAvBT;AAmCbK,MAAAA,cAAc,EAAErH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8H,gBAApC,CAnCH;AAoCbC,MAAAA,cAAc,EAAE,wBAACR,UAAD;AAAA,2CAAoEC,IAApE;AAAoEA,UAAAA,IAApE;AAAA;;AAAA,eACdhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGEgI,gBAHF;AAKIL,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADc;AAAA,OApCH;AA+CbS,MAAAA,iBAAiB,EAAE,2BAACV,UAAD;AAAA,2CAAoEC,IAApE;AAAoEA,UAAAA,IAApE;AAAA;;AAAA,eACjBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGEgI,gBAHF;AAKIL,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADiB;AAAA;AA/CN,KAAf;AA8DA,SAAKU,UAAL,GAAkB,uBAAW1H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,UAAL,GAAkB,uBAAW5H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,UAAL,GAAkB,uBAAW9H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,OAAL,GAAe,uBAAWhI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyI,qBAApC,CAAX,CAAf;AAEA,SAAKC,QAAL,GAAgB,uBAAWlI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2I,sBAApC,CAAX,CAAhB;AAEA,SAAKC,WAAL,GAAmB,uBAAWpI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6I,yBAApC,CAAX,CAAnB;AAEA,SAAKC,WAAL,GAAmB,uBAAWtI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+I,yBAApC,CAAX,CAAnB;AAEA,SAAKC,WAAL,GAAmB,uBAAWxI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiJ,yBAApC,CAAX,CAAnB;AAEA,SAAKC,SAAL,GAAiB,uBAAW1I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmJ,uBAApC,CAAX,CAAjB;AAEA,SAAKC,QAAL,GAAgB,uBAAW5I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqJ,sBAApC,CAAX,CAAhB;AAEA,SAAKC,UAAL,GAAkB,uBAAW9I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuJ,wBAApC,CAAX,CAAlB;AAEA,SAAKC,aAAL,GAAqB,uBAAWhJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyJ,2BAApC,CAAX,CAArB;AAEA,SAAKC,aAAL,GAAqB,uBAAWlJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2J,2BAApC,CAAX,CAArB;AAEA,SAAKC,UAAL,GAAkB,uBAAWpJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6J,wBAApC,CAAX,CAAlB;AAEA,SAAKhC,cAAL,GAAsB,uBAAWrH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8J,4BAApC,CAAX,CAAtB;AAEA,SAAKC,UAAL,GAAkB,uBAAWvJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgK,wBAApC,CAAX,CAAlB;AAEA,SAAKC,iBAAL,GAAyB,uBAAWzJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkK,+BAApC,CAAX,CAAzB;AAEA,SAAKC,WAAL,GAAmB,uBAAW3J,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoK,yBAApC,CAAX,CAAnB;AAEA,SAAKC,IAAL,GAAY9J,YAAZ;AAGA,SAAK+J,SAAL,GAAiBhJ,mBAAmB,CAACiJ,oBAApB,CAAyC9J,IAAzC,CAA8Ca,mBAA9C,CAAjB;AACA,SAAKkJ,QAAL,GAAgBlJ,mBAAmB,CAACmJ,mBAApB,CAAwChK,IAAxC,CAA6Ca,mBAA7C,CAAhB;AACA,SAAKoJ,WAAL,GAAmBpJ,mBAAmB,CAACqJ,sBAApB,CAA2ClK,IAA3C,CAAgDa,mBAAhD,CAAnB;AACA,SAAKsJ,UAAL,GAAkBtJ,mBAAmB,CAACsJ,UAApB,CAA+BnK,IAA/B,CAAoCa,mBAApC,CAAlB;AACA,SAAKuJ,SAAL,GAAiBvJ,mBAAmB,CAACuJ,SAApB,CAA8BpK,IAA9B,CAAmCa,mBAAnC,CAAjB;;AAEA,SAAKwJ,OAAL,GAAe,UAACC,SAAD,EAAwB;AACrCzJ,MAAAA,mBAAmB,CAAC0J,cAApB,CAAmCD,SAAnC;AACAzJ,MAAAA,mBAAmB,CAACsJ,UAApB;AACD,KAHD;;AAMA,SAAKK,IAAL,GAAY,KAAKH,OAAjB;AAGA,SAAKE,cAAL,GAAsB1J,mBAAmB,CAAC0J,cAApB,CAAmCvK,IAAnC,CAAwCa,mBAAxC,CAAtB;AAEA,SAAK4J,qBAAL,GAA6B5J,mBAAmB,CAAC4J,qBAApB,CAA0CzK,IAA1C,CAA+Ca,mBAA/C,CAA7B;AACA,SAAK6J,0BAAL,GAAkC7J,mBAAmB,CAAC6J,0BAApB,CAA+C1K,IAA/C,CAAoDa,mBAApD,CAAlC;AAGA,SAAK8J,OAAL,GAAe/L,MAAM,CAAC+L,OAAP,CAAe3K,IAAf,CAAoBpB,MAApB,CAAf;AACA,SAAKgM,OAAL,GAAehM,MAAM,CAACgM,OAAP,CAAe5K,IAAf,CAAoBpB,MAApB,CAAf;AAGA,SAAKiM,UAAL,GAAkBtL,OAAO,CAACd,MAAR,CAAeoM,UAAf,CAA0B7K,IAA1B,CAA+BT,OAAO,CAACd,MAAvC,CAAlB;AACA,SAAKqM,UAAL,GAAkBvL,OAAO,CAACd,MAAR,CAAeqM,UAAf,CAA0B9K,IAA1B,CAA+BT,OAAO,CAACd,MAAvC,CAAlB;AACA,SAAKsM,YAAL,GAAoBxL,OAAO,CAACd,MAAR,CAAesM,YAAf,CAA4B/K,IAA5B,CAAiCT,OAAO,CAACd,MAAzC,CAApB;AACA,SAAKuM,OAAL,GAAezL,OAAO,CAACd,MAAR,CAAeuM,OAAf,CAAuBhL,IAAvB,CAA4BT,OAAO,CAACd,MAApC,CAAf;AACA,SAAKwM,OAAL,GAAe1L,OAAO,CAACd,MAAR,CAAewM,OAAf,CAAuBjL,IAAvB,CAA4BT,OAAO,CAACd,MAApC,CAAf;AACA,SAAKyM,mBAAL,GAA2B3L,OAAO,CAACd,MAAR,CAAeyM,mBAAf,CAAmClL,IAAnC,CAAwCT,OAAO,CAACd,MAAhD,CAA3B;AACA,SAAK0M,mBAAL,GAA2B5L,OAAO,CAACd,MAAR,CAAe0M,mBAAf,CAAmCnL,IAAnC,CAAwCT,OAAO,CAACd,MAAhD,CAA3B;AAEA,SAAK2M,oBAAL,GAA4B7L,OAAO,CAACd,MAAR,CAAe2M,oBAAf,CAAoCpL,IAApC,CAAyCT,OAAO,CAACd,MAAjD,CAA5B;;AAEA,QAAIF,UAAU,CAAC8M,SAAX,CAAqB,OAArB,CAAJ,EAAmC;AACjC,WAAKC,QAAL,GAAgB,UAACC,KAAD,EAAW;AACzBhM,QAAAA,OAAO,CAACd,MAAR,CAAe6M,QAAf,CAAwBC,KAAxB;;AACA,QAAA,KAAI,CAACnB,SAAL;AACD,OAHD;AAID;AACF;;;;WAED,sBAAqB;AACnB,aAAO,KAAK1L,OAAL,CAAa8M,UAAb,EAAP;AACD;;;WAED,yBAAgBC,IAAhB,EAA8BC,MAA9B,EAA8C;AAC5C,WAAKhN,OAAL,CAAaiN,eAAb,CAA6BF,IAA7B,EAAmCC,MAAnC;AACD;;;WAGD,+BAAsB;AACpB,WAAK/K,gBAAL,CAAsBiL,mBAAtB;;AAEA,UAAI,KAAKlN,OAAL,CAAamN,OAAjB,EAA0B;AACxB,aAAK1B,UAAL;AACD,OAFD,MAEO;AACL,aAAKE,OAAL,CAAa,IAAb;AACD;AACF;;;WAED,6BAAoB;AAClB,WAAK1J,gBAAL,CAAsBmL,iBAAtB;;AACA,WAAK1B,SAAL;AACD;;;WAED,6BAA2B2B,KAA3B,EAA2CC,IAA3C,EAAgF;AAC9E,aAAO,IAAIC,wBAAJ,CAAyBF,KAAzB,EAAgCC,IAAhC,CAAP;AACD;;;WAED,wBAA8B;AAC5B,aAAOE,iBAAcC,UAAd,EAAP;AACD;;;;;;yDAEmBC,sB;yDACAC,sB","sourcesContent":["/** @flow */\n\nimport Config from './components/config';\nimport Crypto from './components/cryptography/index';\nimport SubscriptionManager from './components/subscription_manager';\nimport TelemetryManager from './components/telemetry_manager';\nimport NotificationsPayload from './components/push_payload';\nimport ListenerManager from './components/listener_manager';\nimport TokenManager from './components/token_manager';\n\nimport endpointCreator from './components/endpoint';\n\nimport { deprecated } from './utils';\n\nimport * as addChannelsChannelGroupConfig from './endpoints/channel_groups/add_channels';\nimport * as removeChannelsChannelGroupConfig from './endpoints/channel_groups/remove_channels';\nimport * as deleteChannelGroupConfig from './endpoints/channel_groups/delete_group';\nimport * as listChannelGroupsConfig from './endpoints/channel_groups/list_groups';\nimport * as listChannelsInChannelGroupConfig from './endpoints/channel_groups/list_channels';\n\nimport * as addPushChannelsConfig from './endpoints/push/add_push_channels';\nimport * as removePushChannelsConfig from './endpoints/push/remove_push_channels';\nimport * as listPushChannelsConfig from './endpoints/push/list_push_channels';\nimport * as removeDevicePushConfig from './endpoints/push/remove_device';\n\nimport * as presenceLeaveEndpointConfig from './endpoints/presence/leave';\nimport * as presenceWhereNowEndpointConfig from './endpoints/presence/where_now';\nimport * as presenceHeartbeatEndpointConfig from './endpoints/presence/heartbeat';\nimport * as presenceGetStateConfig from './endpoints/presence/get_state';\nimport * as presenceSetStateConfig from './endpoints/presence/set_state';\nimport * as presenceHereNowConfig from './endpoints/presence/here_now';\n\n// Actions API\n\nimport * as addMessageActionEndpointConfig from './endpoints/actions/add_message_action';\nimport * as removeMessageActionEndpointConfig from './endpoints/actions/remove_message_action';\nimport * as getMessageActionEndpointConfig from './endpoints/actions/get_message_actions';\n\n// File Upload API v1\n\nimport { IFile, FileClass } from '../file';\n\nimport * as fileUploadTypes from './endpoints/file_upload/types';\n\nimport listFilesEndpointConfig from './endpoints/file_upload/list_files';\nimport generateUploadUrlEndpointConfig from './endpoints/file_upload/generate_upload_url';\nimport publishFileEndpointConfig from './endpoints/file_upload/publish_file';\nimport sendFileFunction from './endpoints/file_upload/send_file';\nimport getFileUrlFunction from './endpoints/file_upload/get_file_url';\nimport downloadFileEndpointConfig from './endpoints/file_upload/download_file';\nimport deleteFileEndpointConfig from './endpoints/file_upload/delete_file';\n\n// Object API v2\nimport getAllUUIDMetadataEndpointConfig, {\n type GetAllUUIDMetadataParams,\n type GetAllUUIDMetadataResult,\n} from './endpoints/objects/uuid/get_all';\n\nimport getUUIDMetadataEndpointConfig, {\n type GetUUIDMetadataParams,\n type GetUUIDMetadataResult,\n} from './endpoints/objects/uuid/get';\n\nimport setUUIDMetadataEndpointConfig, {\n type SetUUIDMetadataParams,\n type SetUUIDMetadataResult,\n} from './endpoints/objects/uuid/set';\n\nimport removeUUIDMetadataEndpointConfig, {\n type RemoveUUIDMetadataParams,\n type RemoveUUIDMetadataResult,\n} from './endpoints/objects/uuid/remove';\n\nimport getAllChannelMetadataEndpointConfig, {\n type GetAllChannelMetadataParams,\n type GetAllChannelMetadataResult,\n} from './endpoints/objects/channel/get_all';\n\nimport getChannelMetadataEndpointConfig, {\n type GetChannelMetadataParams,\n type GetChannelMetadataResult,\n} from './endpoints/objects/channel/get';\n\nimport setChannelMetadataEndpointConfig, {\n type SetChannelMetadataParams,\n type SetChannelMetadataResult,\n} from './endpoints/objects/channel/set';\n\nimport removeChannelMetadataEndpointConfig, {\n type RemoveChannelMetadataParams,\n type RemoveChannelMetadataResult,\n} from './endpoints/objects/channel/remove';\n\nimport getMembersV2EndpointConfig, {\n type GetMembersParams,\n type GetMembersResult,\n} from './endpoints/objects/member/get';\n\nimport setMembersV2EndpointConfig, {\n type UpsertMembersParams,\n type RemoveMembersParams,\n type SetMembersResult,\n} from './endpoints/objects/member/set';\n\nimport getMembershipsV2EndpointConfig, {\n type GetMembershipsParams,\n type GetMembershipsResult,\n} from './endpoints/objects/membership/get';\n\nimport setMembershipsV2EndpointConfig, {\n type UpsertMembershipsParams,\n type RemoveMembershipsParams,\n type SetMembershipsResult,\n} from './endpoints/objects/membership/set';\n\n// Objects API\n\nimport * as createUserEndpointConfig from './endpoints/users/create_user';\nimport * as updateUserEndpointConfig from './endpoints/users/update_user';\nimport * as deleteUserEndpointConfig from './endpoints/users/delete_user';\nimport * as getUserEndpointConfig from './endpoints/users/get_user';\nimport * as getUsersEndpointConfig from './endpoints/users/get_users';\nimport * as createSpaceEndpointConfig from './endpoints/spaces/create_space';\nimport * as updateSpaceEndpointConfig from './endpoints/spaces/update_space';\nimport * as deleteSpaceEndpointConfig from './endpoints/spaces/delete_space';\nimport * as getSpacesEndpointConfig from './endpoints/spaces/get_spaces';\nimport * as getSpaceEndpointConfig from './endpoints/spaces/get_space';\nimport * as getMembersEndpointConfig from './endpoints/memberships/get_members';\nimport * as addMembersEndpointConfig from './endpoints/memberships/add_members';\nimport * as updateMembersEndpointConfig from './endpoints/memberships/update_members';\nimport * as removeMembersEndpointConfig from './endpoints/memberships/remove_members';\nimport * as getMembershipsEndpointConfig from './endpoints/memberships/get_memberships';\nimport * as updateMembershipsEndpointConfig from './endpoints/memberships/update_memberships';\nimport * as joinSpacesEndpointConfig from './endpoints/memberships/join_spaces';\nimport * as leaveSpacesEndpointConfig from './endpoints/memberships/leave_spaces';\n\nimport * as auditEndpointConfig from './endpoints/access_manager/audit';\nimport * as grantEndpointConfig from './endpoints/access_manager/grant';\nimport * as grantTokenEndpointConfig from './endpoints/access_manager/grant_token';\nimport revokeTokenEndpointConfig, {\n type RevokeTokenParams,\n type RevokeTokenResult,\n} from './endpoints/access_manager/revoke_token';\n\nimport * as publishEndpointConfig from './endpoints/publish';\nimport * as signalEndpointConfig from './endpoints/signal';\nimport * as historyEndpointConfig from './endpoints/history/get_history';\nimport * as deleteMessagesEndpointConfig from './endpoints/history/delete_messages';\nimport * as messageCountsEndpointConfig from './endpoints/history/message_counts';\nimport * as fetchMessagesEndpointConfig from './endpoints/fetch_messages';\nimport * as timeEndpointConfig from './endpoints/time';\nimport * as subscribeEndpointConfig from './endpoints/subscribe';\n\nimport OPERATIONS from './constants/operations';\nimport CATEGORIES from './constants/categories';\n\nimport { InternalSetupStruct } from './flow_interfaces';\nimport uuidGenerator from './components/uuid';\n\ntype CallbackStatus = {|\n error: boolean,\n operation: string,\n statusCode: number,\n|};\n\nexport default class {\n _config: Config;\n _telemetryManager: TelemetryManager;\n _listenerManager: ListenerManager;\n _tokenManager: TokenManager;\n\n // tell flow about the mounted endpoint\n time: Function;\n publish: Function;\n fire: Function;\n\n history: Function;\n deleteMessages: Function;\n messageCounts: Function;\n fetchMessages: Function;\n\n //\n channelGroups: Object;\n //\n push: Object;\n //\n hereNow: Function;\n whereNow: Function;\n getState: Function;\n setState: Function;\n //\n grant: Function;\n grantToken: Function;\n audit: Function;\n revokeToken: (\n parameters: RevokeTokenParams,\n callback?: (status: CallbackStatus, result: RevokeTokenResult) => void\n ) => Promise;\n //\n subscribe: Function;\n signal: Function;\n presence: Function;\n unsubscribe: Function;\n unsubscribeAll: Function;\n\n // Actions API\n addMessageAction: Function;\n removeMessageAction: Function;\n getMessageActions: Function;\n\n // File Upload API v1\n\n File: FileClass;\n encryptFile: (key: string, file: IFile) => Promise;\n decryptFile: (key: string, file: IFile) => Promise;\n\n listFiles: (\n parameters: fileUploadTypes.ListFilesParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.ListFilesResult) => void\n ) => Promise;\n sendFile: (\n parameters: fileUploadTypes.SendFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.SendFileResult) => void\n ) => Promise;\n downloadFile: (\n parameters: fileUploadTypes.DownloadFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.DownloadFileResult) => void\n ) => Promise;\n getFileUrl: (parameters: fileUploadTypes.GetFileUrlParams) => fileUploadTypes.GetFileUrlResult;\n deleteFile: (\n parameters: fileUploadTypes.DeleteFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.DeleteFileResult) => void\n ) => Promise;\n publishFile: (\n parameters: fileUploadTypes.PublishFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.PublishFileResult) => void\n ) => Promise;\n\n // Objects API v2\n\n objects: {\n getAllUUIDMetadata: (\n parameters?: GetAllUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: GetAllUUIDMetadataResult) => void\n ) => Promise,\n getUUIDMetadata: (\n parameters?: GetUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: GetUUIDMetadataResult) => void\n ) => Promise,\n setUUIDMetadata: (\n parameters: SetUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: SetUUIDMetadataResult) => void\n ) => Promise,\n removeUUIDMetadata: (\n parameters?: RemoveUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: RemoveUUIDMetadataResult) => void\n ) => Promise,\n\n getAllChannelMetadata: (\n parameters?: GetAllChannelMetadataParams,\n cb?: (status: CallbackStatus, result: GetAllChannelMetadataResult) => void\n ) => Promise,\n getChannelMetadata: (\n parameters: GetChannelMetadataParams,\n cb?: (status: CallbackStatus, result: GetChannelMetadataResult) => void\n ) => Promise,\n setChannelMetadata: (\n parameters: SetChannelMetadataParams,\n cb?: (status: CallbackStatus, result: SetChannelMetadataResult) => void\n ) => Promise,\n removeChannelMetadata: (\n parameters: RemoveChannelMetadataParams,\n cb?: (status: CallbackStatus, result: RemoveChannelMetadataResult) => void\n ) => Promise,\n\n getMemberships: (\n parameters: GetMembershipsParams,\n cb?: (status: CallbackStatus, result: GetMembershipsResult) => void\n ) => Promise,\n setMemberships: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembershipsResult) => void\n ) => Promise,\n removeMemberships: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembershipsResult) => void\n ) => Promise,\n\n getChannelMembers: (\n parameters: GetMembersParams,\n cb?: (status: CallbackStatus, result: GetMembersResult) => void\n ) => Promise,\n setChannelMembers: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembersResult) => void\n ) => Promise,\n removeChannelMembers: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembersResult) => void\n ) => Promise,\n };\n\n // Objects API\n\n createUser: Function;\n updateUser: Function;\n deleteUser: Function;\n getUser: Function;\n getUsers: Function;\n createSpace: Function;\n updateSpace: Function;\n deleteSpace: Function;\n getSpaces: Function;\n getSpace: Function;\n getMembers: Function;\n addMembers: Function;\n updateMembers: Function;\n removeMembers: Function;\n getMemberships: Function;\n joinSpaces: Function;\n updateMemberships: Function;\n leaveSpaces: Function;\n\n disconnect: Function;\n reconnect: Function;\n\n destroy: Function;\n stop: Function;\n\n getSubscribedChannels: Function;\n getSubscribedChannelGroups: Function;\n\n addListener: Function;\n removeListener: Function;\n removeAllListeners: Function;\n\n parseToken: Function;\n setToken: Function;\n getToken: Function;\n\n getAuthKey: Function;\n setAuthKey: Function;\n\n setCipherKey: Function;\n setUUID: Function;\n getUUID: Function;\n\n getFilterExpression: Function;\n setFilterExpression: Function;\n\n setHeartbeatInterval: Function;\n\n setProxy: Function;\n\n encrypt: Function;\n decrypt: Function;\n\n //\n\n constructor(setup: InternalSetupStruct) {\n let { db, networking, cbor } = setup;\n\n const config = (this._config = new Config({ setup, db }));\n const crypto = new Crypto({ config }); // LEGACY\n\n const cryptography = setup.cryptography;\n\n networking.init(config);\n\n const tokenManager = (this._tokenManager = new TokenManager(config, cbor));\n const telemetryManager = (this._telemetryManager = new TelemetryManager({\n maximumSamplesCount: 60000,\n }));\n\n let modules = {\n config,\n networking,\n crypto,\n cryptography,\n tokenManager,\n telemetryManager,\n PubNubFile: setup.PubNubFile,\n };\n\n this.File = setup.PubNubFile;\n\n this.encryptFile = (key, file) => cryptography.encryptFile(key, file, this.File);\n this.decryptFile = (key, file) => cryptography.decryptFile(key, file, this.File);\n\n const timeEndpoint = endpointCreator.bind(this, modules, timeEndpointConfig);\n const leaveEndpoint = endpointCreator.bind(this, modules, presenceLeaveEndpointConfig);\n const heartbeatEndpoint = endpointCreator.bind(this, modules, presenceHeartbeatEndpointConfig);\n const setStateEndpoint = endpointCreator.bind(this, modules, presenceSetStateConfig);\n const subscribeEndpoint = endpointCreator.bind(this, modules, subscribeEndpointConfig);\n\n // managers\n const listenerManager = (this._listenerManager = new ListenerManager());\n\n const subscriptionManager = new SubscriptionManager({\n timeEndpoint,\n leaveEndpoint,\n heartbeatEndpoint,\n setStateEndpoint,\n subscribeEndpoint,\n crypto: modules.crypto,\n config: modules.config,\n listenerManager,\n getFileUrl: (params) => getFileUrlFunction(modules, params),\n });\n\n this.addListener = listenerManager.addListener.bind(listenerManager);\n this.removeListener = listenerManager.removeListener.bind(listenerManager);\n this.removeAllListeners = listenerManager.removeAllListeners.bind(listenerManager);\n\n this.parseToken = tokenManager.parseToken.bind(tokenManager);\n this.setToken = tokenManager.setToken.bind(tokenManager);\n this.getToken = tokenManager.getToken.bind(tokenManager);\n\n /* channel groups */\n this.channelGroups = {\n listGroups: endpointCreator.bind(this, modules, listChannelGroupsConfig),\n listChannels: endpointCreator.bind(this, modules, listChannelsInChannelGroupConfig),\n addChannels: endpointCreator.bind(this, modules, addChannelsChannelGroupConfig),\n removeChannels: endpointCreator.bind(this, modules, removeChannelsChannelGroupConfig),\n deleteGroup: endpointCreator.bind(this, modules, deleteChannelGroupConfig),\n };\n /* push */\n this.push = {\n addChannels: endpointCreator.bind(this, modules, addPushChannelsConfig),\n removeChannels: endpointCreator.bind(this, modules, removePushChannelsConfig),\n deleteDevice: endpointCreator.bind(this, modules, removeDevicePushConfig),\n listChannels: endpointCreator.bind(this, modules, listPushChannelsConfig),\n };\n /* presence */\n this.hereNow = endpointCreator.bind(this, modules, presenceHereNowConfig);\n this.whereNow = endpointCreator.bind(this, modules, presenceWhereNowEndpointConfig);\n this.getState = endpointCreator.bind(this, modules, presenceGetStateConfig);\n this.setState = subscriptionManager.adaptStateChange.bind(subscriptionManager);\n /* PAM */\n this.grant = endpointCreator.bind(this, modules, grantEndpointConfig);\n this.grantToken = endpointCreator.bind(this, modules, grantTokenEndpointConfig);\n this.audit = endpointCreator.bind(this, modules, auditEndpointConfig);\n this.revokeToken = endpointCreator.bind(this, modules, revokeTokenEndpointConfig);\n //\n this.publish = endpointCreator.bind(this, modules, publishEndpointConfig);\n\n this.fire = (args, callback) => {\n args.replicate = false;\n args.storeInHistory = false;\n return this.publish(args, callback);\n };\n\n this.signal = endpointCreator.bind(this, modules, signalEndpointConfig);\n\n this.history = endpointCreator.bind(this, modules, historyEndpointConfig);\n this.deleteMessages = endpointCreator.bind(this, modules, deleteMessagesEndpointConfig);\n this.messageCounts = endpointCreator.bind(this, modules, messageCountsEndpointConfig);\n this.fetchMessages = endpointCreator.bind(this, modules, fetchMessagesEndpointConfig);\n\n // Actions API\n\n this.addMessageAction = endpointCreator.bind(this, modules, addMessageActionEndpointConfig);\n\n this.removeMessageAction = endpointCreator.bind(this, modules, removeMessageActionEndpointConfig);\n\n this.getMessageActions = endpointCreator.bind(this, modules, getMessageActionEndpointConfig);\n\n // File Upload API v1\n\n this.listFiles = endpointCreator.bind(this, modules, listFilesEndpointConfig);\n\n const generateUploadUrl = endpointCreator.bind(this, modules, generateUploadUrlEndpointConfig);\n this.publishFile = endpointCreator.bind(this, modules, publishFileEndpointConfig);\n\n this.sendFile = sendFileFunction({\n generateUploadUrl,\n publishFile: this.publishFile,\n modules,\n });\n\n this.getFileUrl = (params) => getFileUrlFunction(modules, params);\n\n this.downloadFile = endpointCreator.bind(this, modules, downloadFileEndpointConfig);\n\n this.deleteFile = endpointCreator.bind(this, modules, deleteFileEndpointConfig);\n\n // Objects API v2\n\n this.objects = {\n getAllUUIDMetadata: endpointCreator.bind(this, modules, getAllUUIDMetadataEndpointConfig),\n getUUIDMetadata: endpointCreator.bind(this, modules, getUUIDMetadataEndpointConfig),\n setUUIDMetadata: endpointCreator.bind(this, modules, setUUIDMetadataEndpointConfig),\n removeUUIDMetadata: endpointCreator.bind(this, modules, removeUUIDMetadataEndpointConfig),\n\n getAllChannelMetadata: endpointCreator.bind(this, modules, getAllChannelMetadataEndpointConfig),\n getChannelMetadata: endpointCreator.bind(this, modules, getChannelMetadataEndpointConfig),\n setChannelMetadata: endpointCreator.bind(this, modules, setChannelMetadataEndpointConfig),\n removeChannelMetadata: endpointCreator.bind(this, modules, removeChannelMetadataEndpointConfig),\n\n getChannelMembers: endpointCreator.bind(this, modules, getMembersV2EndpointConfig),\n setChannelMembers: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembersV2EndpointConfig,\n {\n type: 'set',\n ...parameters,\n },\n ...rest\n ),\n removeChannelMembers: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembersV2EndpointConfig,\n {\n type: 'delete',\n ...parameters,\n },\n ...rest\n ),\n\n getMemberships: endpointCreator.bind(this, modules, getMembershipsV2EndpointConfig),\n setMemberships: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembershipsV2EndpointConfig,\n {\n type: 'set',\n ...parameters,\n },\n ...rest\n ),\n removeMemberships: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembershipsV2EndpointConfig,\n {\n type: 'delete',\n ...parameters,\n },\n ...rest\n ),\n };\n\n // Objects API\n\n this.createUser = deprecated(endpointCreator.bind(this, modules, createUserEndpointConfig));\n\n this.updateUser = deprecated(endpointCreator.bind(this, modules, updateUserEndpointConfig));\n\n this.deleteUser = deprecated(endpointCreator.bind(this, modules, deleteUserEndpointConfig));\n\n this.getUser = deprecated(endpointCreator.bind(this, modules, getUserEndpointConfig));\n\n this.getUsers = deprecated(endpointCreator.bind(this, modules, getUsersEndpointConfig));\n\n this.createSpace = deprecated(endpointCreator.bind(this, modules, createSpaceEndpointConfig));\n\n this.updateSpace = deprecated(endpointCreator.bind(this, modules, updateSpaceEndpointConfig));\n\n this.deleteSpace = deprecated(endpointCreator.bind(this, modules, deleteSpaceEndpointConfig));\n\n this.getSpaces = deprecated(endpointCreator.bind(this, modules, getSpacesEndpointConfig));\n\n this.getSpace = deprecated(endpointCreator.bind(this, modules, getSpaceEndpointConfig));\n\n this.addMembers = deprecated(endpointCreator.bind(this, modules, addMembersEndpointConfig));\n\n this.updateMembers = deprecated(endpointCreator.bind(this, modules, updateMembersEndpointConfig));\n\n this.removeMembers = deprecated(endpointCreator.bind(this, modules, removeMembersEndpointConfig));\n\n this.getMembers = deprecated(endpointCreator.bind(this, modules, getMembersEndpointConfig));\n\n this.getMemberships = deprecated(endpointCreator.bind(this, modules, getMembershipsEndpointConfig));\n\n this.joinSpaces = deprecated(endpointCreator.bind(this, modules, joinSpacesEndpointConfig));\n\n this.updateMemberships = deprecated(endpointCreator.bind(this, modules, updateMembershipsEndpointConfig));\n\n this.leaveSpaces = deprecated(endpointCreator.bind(this, modules, leaveSpacesEndpointConfig));\n\n this.time = timeEndpoint;\n\n // subscription related methods\n this.subscribe = subscriptionManager.adaptSubscribeChange.bind(subscriptionManager);\n this.presence = subscriptionManager.adaptPresenceChange.bind(subscriptionManager);\n this.unsubscribe = subscriptionManager.adaptUnsubscribeChange.bind(subscriptionManager);\n this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);\n this.reconnect = subscriptionManager.reconnect.bind(subscriptionManager);\n\n this.destroy = (isOffline: boolean) => {\n subscriptionManager.unsubscribeAll(isOffline);\n subscriptionManager.disconnect();\n };\n\n // --- deprecated ------------------\n this.stop = this.destroy; // --------\n // --- deprecated ------------------\n\n this.unsubscribeAll = subscriptionManager.unsubscribeAll.bind(subscriptionManager);\n\n this.getSubscribedChannels = subscriptionManager.getSubscribedChannels.bind(subscriptionManager);\n this.getSubscribedChannelGroups = subscriptionManager.getSubscribedChannelGroups.bind(subscriptionManager);\n\n // mount crypto\n this.encrypt = crypto.encrypt.bind(crypto);\n this.decrypt = crypto.decrypt.bind(crypto);\n\n /* config */\n this.getAuthKey = modules.config.getAuthKey.bind(modules.config);\n this.setAuthKey = modules.config.setAuthKey.bind(modules.config);\n this.setCipherKey = modules.config.setCipherKey.bind(modules.config);\n this.getUUID = modules.config.getUUID.bind(modules.config);\n this.setUUID = modules.config.setUUID.bind(modules.config);\n this.getFilterExpression = modules.config.getFilterExpression.bind(modules.config);\n this.setFilterExpression = modules.config.setFilterExpression.bind(modules.config);\n\n this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);\n\n if (networking.hasModule('proxy')) {\n this.setProxy = (proxy) => {\n modules.config.setProxy(proxy);\n this.reconnect();\n };\n }\n }\n\n getVersion(): string {\n return this._config.getVersion();\n }\n\n _addPnsdkSuffix(name: string, suffix: string) {\n this._config._addPnsdkSuffix(name, suffix);\n }\n\n // network hooks to indicate network changes\n networkDownDetected() {\n this._listenerManager.announceNetworkDown();\n\n if (this._config.restore) {\n this.disconnect();\n } else {\n this.destroy(true);\n }\n }\n\n networkUpDetected() {\n this._listenerManager.announceNetworkUp();\n this.reconnect();\n }\n\n static notificationPayload(title: ?string, body: ?string): NotificationsPayload {\n return new NotificationsPayload(title, body);\n }\n\n static generateUUID(): string {\n return uuidGenerator.createUUID();\n }\n\n static OPERATIONS = OPERATIONS;\n static CATEGORIES = CATEGORIES;\n}\n"],"file":"pubnub-common.js"} \ No newline at end of file +{"version":3,"sources":["core/pubnub-common.js"],"names":["setup","networking","cbor","config","_config","Config","crypto","Crypto","cryptography","init","tokenManager","_tokenManager","TokenManager","telemetryManager","_telemetryManager","TelemetryManager","maximumSamplesCount","modules","PubNubFile","File","encryptFile","key","file","decryptFile","timeEndpoint","endpointCreator","bind","timeEndpointConfig","leaveEndpoint","presenceLeaveEndpointConfig","heartbeatEndpoint","presenceHeartbeatEndpointConfig","setStateEndpoint","presenceSetStateConfig","subscribeEndpoint","subscribeEndpointConfig","listenerManager","_listenerManager","ListenerManager","subscriptionManager","SubscriptionManager","getFileUrl","params","addListener","removeListener","removeAllListeners","parseToken","setToken","getToken","channelGroups","listGroups","listChannelGroupsConfig","listChannels","listChannelsInChannelGroupConfig","addChannels","addChannelsChannelGroupConfig","removeChannels","removeChannelsChannelGroupConfig","deleteGroup","deleteChannelGroupConfig","push","addPushChannelsConfig","removePushChannelsConfig","deleteDevice","removeDevicePushConfig","listPushChannelsConfig","hereNow","presenceHereNowConfig","whereNow","presenceWhereNowEndpointConfig","getState","presenceGetStateConfig","setState","adaptStateChange","grant","grantEndpointConfig","grantToken","grantTokenEndpointConfig","audit","auditEndpointConfig","revokeToken","revokeTokenEndpointConfig","publish","publishEndpointConfig","fire","args","callback","replicate","storeInHistory","signal","signalEndpointConfig","history","historyEndpointConfig","deleteMessages","deleteMessagesEndpointConfig","messageCounts","messageCountsEndpointConfig","fetchMessages","fetchMessagesEndpointConfig","addMessageAction","addMessageActionEndpointConfig","removeMessageAction","removeMessageActionEndpointConfig","getMessageActions","getMessageActionEndpointConfig","listFiles","listFilesEndpointConfig","generateUploadUrl","generateUploadUrlEndpointConfig","publishFile","publishFileEndpointConfig","sendFile","downloadFile","downloadFileEndpointConfig","deleteFile","deleteFileEndpointConfig","objects","getAllUUIDMetadata","getAllUUIDMetadataEndpointConfig","getUUIDMetadata","getUUIDMetadataEndpointConfig","setUUIDMetadata","setUUIDMetadataEndpointConfig","removeUUIDMetadata","removeUUIDMetadataEndpointConfig","getAllChannelMetadata","getAllChannelMetadataEndpointConfig","getChannelMetadata","getChannelMetadataEndpointConfig","setChannelMetadata","setChannelMetadataEndpointConfig","removeChannelMetadata","removeChannelMetadataEndpointConfig","getChannelMembers","getMembersV2EndpointConfig","setChannelMembers","parameters","rest","call","setMembersV2EndpointConfig","type","removeChannelMembers","getMemberships","getMembershipsV2EndpointConfig","setMemberships","setMembershipsV2EndpointConfig","removeMemberships","createUser","createUserEndpointConfig","updateUser","updateUserEndpointConfig","deleteUser","deleteUserEndpointConfig","getUser","getUserEndpointConfig","getUsers","getUsersEndpointConfig","createSpace","createSpaceEndpointConfig","updateSpace","updateSpaceEndpointConfig","deleteSpace","deleteSpaceEndpointConfig","getSpaces","getSpacesEndpointConfig","getSpace","getSpaceEndpointConfig","addMembers","addMembersEndpointConfig","updateMembers","updateMembersEndpointConfig","removeMembers","removeMembersEndpointConfig","getMembers","getMembersEndpointConfig","getMembershipsEndpointConfig","joinSpaces","joinSpacesEndpointConfig","updateMemberships","updateMembershipsEndpointConfig","leaveSpaces","leaveSpacesEndpointConfig","time","subscribe","adaptSubscribeChange","presence","adaptPresenceChange","unsubscribe","adaptUnsubscribeChange","disconnect","reconnect","destroy","isOffline","unsubscribeAll","stop","getSubscribedChannels","getSubscribedChannelGroups","encrypt","decrypt","getAuthKey","setAuthKey","setCipherKey","getUUID","setUUID","getFilterExpression","setFilterExpression","setHeartbeatInterval","hasModule","setProxy","proxy","getVersion","name","suffix","_addPnsdkSuffix","announceNetworkDown","restore","announceNetworkUp","title","body","NotificationsPayload","uuidGenerator","createUUID","OPERATIONS","CATEGORIES"],"mappings":";;;;;;;;;;;;;;;;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAIA;;AACA;;AACA;;AAIA;;AAEA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAGA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAKA;;AAMA;;AAKA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AAKA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;;;;;;AA0ME,oBAAYA,KAAZ,EAAwC;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACtC,QAAMC,UAAN,GAA2BD,KAA3B,CAAMC,UAAN;AAAA,QAAkBC,IAAlB,GAA2BF,KAA3B,CAAkBE,IAAlB;AAEA,QAAMC,MAAM,GAAI,KAAKC,OAAL,GAAe,IAAIC,kBAAJ,CAAW;AAAEL,MAAAA,KAAK,EAALA;AAAF,KAAX,CAA/B;AACA,QAAMM,MAAM,GAAG,IAAIC,iBAAJ,CAAW;AAAEJ,MAAAA,MAAM,EAANA;AAAF,KAAX,CAAf;AAEA,QAAMK,YAAY,GAAGR,KAAK,CAACQ,YAA3B;AAEAP,IAAAA,UAAU,CAACQ,IAAX,CAAgBN,MAAhB;AAEA,QAAMO,YAAY,GAAI,KAAKC,aAAL,GAAqB,IAAIC,yBAAJ,CAAiBT,MAAjB,EAAyBD,IAAzB,CAA3C;AACA,QAAMW,gBAAgB,GAAI,KAAKC,iBAAL,GAAyB,IAAIC,6BAAJ,CAAqB;AACtEC,MAAAA,mBAAmB,EAAE;AADiD,KAArB,CAAnD;AAIA,QAAIC,OAAO,GAAG;AACZd,MAAAA,MAAM,EAANA,MADY;AAEZF,MAAAA,UAAU,EAAVA,UAFY;AAGZK,MAAAA,MAAM,EAANA,MAHY;AAIZE,MAAAA,YAAY,EAAZA,YAJY;AAKZE,MAAAA,YAAY,EAAZA,YALY;AAMZG,MAAAA,gBAAgB,EAAhBA,gBANY;AAOZK,MAAAA,UAAU,EAAElB,KAAK,CAACkB;AAPN,KAAd;AAUA,SAAKC,IAAL,GAAYnB,KAAK,CAACkB,UAAlB;;AAEA,SAAKE,WAAL,GAAmB,UAACC,GAAD,EAAMC,IAAN;AAAA,aAAed,YAAY,CAACY,WAAb,CAAyBC,GAAzB,EAA8BC,IAA9B,EAAoC,KAAI,CAACH,IAAzC,CAAf;AAAA,KAAnB;;AACA,SAAKI,WAAL,GAAmB,UAACF,GAAD,EAAMC,IAAN;AAAA,aAAed,YAAY,CAACe,WAAb,CAAyBF,GAAzB,EAA8BC,IAA9B,EAAoC,KAAI,CAACH,IAAzC,CAAf;AAAA,KAAnB;;AAEA,QAAMK,YAAY,GAAGC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCU,kBAApC,CAArB;;AACA,QAAMC,aAAa,GAAGH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCY,2BAApC,CAAtB;;AACA,QAAMC,iBAAiB,GAAGL,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCc,+BAApC,CAA1B;;AACA,QAAMC,gBAAgB,GAAGP,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgB,sBAApC,CAAzB;;AACA,QAAMC,iBAAiB,GAAGT,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkB,uBAApC,CAA1B;;AAGA,QAAMC,eAAe,GAAI,KAAKC,gBAAL,GAAwB,IAAIC,4BAAJ,EAAjD;AAEA,QAAMC,mBAAmB,GAAG,IAAIC,gCAAJ,CAAwB;AAClDhB,MAAAA,YAAY,EAAZA,YADkD;AAElDI,MAAAA,aAAa,EAAbA,aAFkD;AAGlDE,MAAAA,iBAAiB,EAAjBA,iBAHkD;AAIlDE,MAAAA,gBAAgB,EAAhBA,gBAJkD;AAKlDE,MAAAA,iBAAiB,EAAjBA,iBALkD;AAMlD5B,MAAAA,MAAM,EAAEW,OAAO,CAACX,MANkC;AAOlDH,MAAAA,MAAM,EAAEc,OAAO,CAACd,MAPkC;AAQlDiC,MAAAA,eAAe,EAAfA,eARkD;AASlDK,MAAAA,UAAU,EAAE,oBAACC,MAAD;AAAA,eAAY,8BAAmBzB,OAAnB,EAA4ByB,MAA5B,CAAZ;AAAA;AATsC,KAAxB,CAA5B;AAYA,SAAKC,WAAL,GAAmBP,eAAe,CAACO,WAAhB,CAA4BjB,IAA5B,CAAiCU,eAAjC,CAAnB;AACA,SAAKQ,cAAL,GAAsBR,eAAe,CAACQ,cAAhB,CAA+BlB,IAA/B,CAAoCU,eAApC,CAAtB;AACA,SAAKS,kBAAL,GAA0BT,eAAe,CAACS,kBAAhB,CAAmCnB,IAAnC,CAAwCU,eAAxC,CAA1B;AAEA,SAAKU,UAAL,GAAkBpC,YAAY,CAACoC,UAAb,CAAwBpB,IAAxB,CAA6BhB,YAA7B,CAAlB;AACA,SAAKqC,QAAL,GAAgBrC,YAAY,CAACqC,QAAb,CAAsBrB,IAAtB,CAA2BhB,YAA3B,CAAhB;AACA,SAAKsC,QAAL,GAAgBtC,YAAY,CAACsC,QAAb,CAAsBtB,IAAtB,CAA2BhB,YAA3B,CAAhB;AAGA,SAAKuC,aAAL,GAAqB;AACnBC,MAAAA,UAAU,EAAEzB,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkC,uBAApC,CADO;AAEnBC,MAAAA,YAAY,EAAE3B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoC,gCAApC,CAFK;AAGnBC,MAAAA,WAAW,EAAE7B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCsC,6BAApC,CAHM;AAInBC,MAAAA,cAAc,EAAE/B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCwC,gCAApC,CAJG;AAKnBC,MAAAA,WAAW,EAAEjC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC0C,wBAApC;AALM,KAArB;AAQA,SAAKC,IAAL,GAAY;AACVN,MAAAA,WAAW,EAAE7B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC4C,qBAApC,CADH;AAEVL,MAAAA,cAAc,EAAE/B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6C,wBAApC,CAFN;AAGVC,MAAAA,YAAY,EAAEtC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+C,sBAApC,CAHJ;AAIVZ,MAAAA,YAAY,EAAE3B,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgD,sBAApC;AAJJ,KAAZ;AAOA,SAAKC,OAAL,GAAezC,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkD,qBAApC,CAAf;AACA,SAAKC,QAAL,GAAgB3C,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoD,8BAApC,CAAhB;AACA,SAAKC,QAAL,GAAgB7C,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCsD,sBAApC,CAAhB;AACA,SAAKC,QAAL,GAAgBjC,mBAAmB,CAACkC,gBAApB,CAAqC/C,IAArC,CAA0Ca,mBAA1C,CAAhB;AAEA,SAAKmC,KAAL,GAAajD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC0D,mBAApC,CAAb;AACA,SAAKC,UAAL,GAAkBnD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC4D,wBAApC,CAAlB;AACA,SAAKC,KAAL,GAAarD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8D,mBAApC,CAAb;AACA,SAAKC,WAAL,GAAmBvD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgE,wBAApC,CAAnB;AAEA,SAAKC,OAAL,GAAezD,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkE,qBAApC,CAAf;;AAEA,SAAKC,IAAL,GAAY,UAACC,IAAD,EAAOC,QAAP,EAAoB;AAC9BD,MAAAA,IAAI,CAACE,SAAL,GAAiB,KAAjB;AACAF,MAAAA,IAAI,CAACG,cAAL,GAAsB,KAAtB;AACA,aAAO,KAAI,CAACN,OAAL,CAAaG,IAAb,EAAmBC,QAAnB,CAAP;AACD,KAJD;;AAMA,SAAKG,MAAL,GAAchE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyE,oBAApC,CAAd;AAEA,SAAKC,OAAL,GAAelE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2E,qBAApC,CAAf;AACA,SAAKC,cAAL,GAAsBpE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6E,4BAApC,CAAtB;AACA,SAAKC,aAAL,GAAqBtE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+E,2BAApC,CAArB;AACA,SAAKC,aAAL,GAAqBxE,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiF,2BAApC,CAArB;AAIA,SAAKC,gBAAL,GAAwB1E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmF,8BAApC,CAAxB;AAEA,SAAKC,mBAAL,GAA2B5E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqF,iCAApC,CAA3B;AAEA,SAAKC,iBAAL,GAAyB9E,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuF,8BAApC,CAAzB;AAIA,SAAKC,SAAL,GAAiBhF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyF,sBAApC,CAAjB;;AAEA,QAAMC,iBAAiB,GAAGlF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2F,+BAApC,CAA1B;;AACA,SAAKC,WAAL,GAAmBpF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6F,wBAApC,CAAnB;AAEA,SAAKC,QAAL,GAAgB,2BAAiB;AAC/BJ,MAAAA,iBAAiB,EAAjBA,iBAD+B;AAE/BE,MAAAA,WAAW,EAAE,KAAKA,WAFa;AAG/B5F,MAAAA,OAAO,EAAPA;AAH+B,KAAjB,CAAhB;;AAMA,SAAKwB,UAAL,GAAkB,UAACC,MAAD;AAAA,aAAY,8BAAmBzB,OAAnB,EAA4ByB,MAA5B,CAAZ;AAAA,KAAlB;;AAEA,SAAKsE,YAAL,GAAoBvF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgG,yBAApC,CAApB;AAEA,SAAKC,UAAL,GAAkBzF,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkG,uBAApC,CAAlB;AAIA,SAAKC,OAAL,GAAe;AACbC,MAAAA,kBAAkB,EAAE5F,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqG,mBAApC,CADP;AAEbC,MAAAA,eAAe,EAAE9F,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuG,eAApC,CAFJ;AAGbC,MAAAA,eAAe,EAAEhG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyG,eAApC,CAHJ;AAIbC,MAAAA,kBAAkB,EAAElG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2G,kBAApC,CAJP;AAMbC,MAAAA,qBAAqB,EAAEpG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6G,oBAApC,CANV;AAObC,MAAAA,kBAAkB,EAAEtG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+G,gBAApC,CAPP;AAQbC,MAAAA,kBAAkB,EAAExG,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiH,gBAApC,CARP;AASbC,MAAAA,qBAAqB,EAAE1G,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmH,mBAApC,CATV;AAWbC,MAAAA,iBAAiB,EAAE5G,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqH,gBAApC,CAXN;AAYbC,MAAAA,iBAAiB,EAAE,2BAACC,UAAD;AAAA,0CAAgEC,IAAhE;AAAgEA,UAAAA,IAAhE;AAAA;;AAAA,eACjBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGE0H,gBAHF;AAKIC,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADiB;AAAA,OAZN;AAuBbI,MAAAA,oBAAoB,EAAE,8BAACL,UAAD;AAAA,2CAAgEC,IAAhE;AAAgEA,UAAAA,IAAhE;AAAA;;AAAA,eACpBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGE0H,gBAHF;AAKIC,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADoB;AAAA,OAvBT;AAmCbK,MAAAA,cAAc,EAAErH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8H,gBAApC,CAnCH;AAoCbC,MAAAA,cAAc,EAAE,wBAACR,UAAD;AAAA,2CAAoEC,IAApE;AAAoEA,UAAAA,IAApE;AAAA;;AAAA,eACdhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGEgI,gBAHF;AAKIL,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADc;AAAA,OApCH;AA+CbS,MAAAA,iBAAiB,EAAE,2BAACV,UAAD;AAAA,2CAAoEC,IAApE;AAAoEA,UAAAA,IAApE;AAAA;;AAAA,eACjBhH,qBAAgBiH,IAAhB,8BACE,KADF,EAEEzH,OAFF,EAGEgI,gBAHF;AAKIL,UAAAA,IAAI,EAAE;AALV,WAMOJ,UANP,UAQKC,IARL,EADiB;AAAA;AA/CN,KAAf;AA8DA,SAAKU,UAAL,GAAkB,uBAAW1H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,UAAL,GAAkB,uBAAW5H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,UAAL,GAAkB,uBAAW9H,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuI,wBAApC,CAAX,CAAlB;AAEA,SAAKC,OAAL,GAAe,uBAAWhI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyI,qBAApC,CAAX,CAAf;AAEA,SAAKC,QAAL,GAAgB,uBAAWlI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2I,sBAApC,CAAX,CAAhB;AAEA,SAAKC,WAAL,GAAmB,uBAAWpI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6I,yBAApC,CAAX,CAAnB;AAEA,SAAKC,WAAL,GAAmB,uBAAWtI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC+I,yBAApC,CAAX,CAAnB;AAEA,SAAKC,WAAL,GAAmB,uBAAWxI,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCiJ,yBAApC,CAAX,CAAnB;AAEA,SAAKC,SAAL,GAAiB,uBAAW1I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCmJ,uBAApC,CAAX,CAAjB;AAEA,SAAKC,QAAL,GAAgB,uBAAW5I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCqJ,sBAApC,CAAX,CAAhB;AAEA,SAAKC,UAAL,GAAkB,uBAAW9I,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCuJ,wBAApC,CAAX,CAAlB;AAEA,SAAKC,aAAL,GAAqB,uBAAWhJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCyJ,2BAApC,CAAX,CAArB;AAEA,SAAKC,aAAL,GAAqB,uBAAWlJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC2J,2BAApC,CAAX,CAArB;AAEA,SAAKC,UAAL,GAAkB,uBAAWpJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC6J,wBAApC,CAAX,CAAlB;AAEA,SAAKhC,cAAL,GAAsB,uBAAWrH,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoC8J,4BAApC,CAAX,CAAtB;AAEA,SAAKC,UAAL,GAAkB,uBAAWvJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCgK,wBAApC,CAAX,CAAlB;AAEA,SAAKC,iBAAL,GAAyB,uBAAWzJ,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCkK,+BAApC,CAAX,CAAzB;AAEA,SAAKC,WAAL,GAAmB,uBAAW3J,qBAAgBC,IAAhB,CAAqB,IAArB,EAA2BT,OAA3B,EAAoCoK,yBAApC,CAAX,CAAnB;AAEA,SAAKC,IAAL,GAAY9J,YAAZ;AAGA,SAAK+J,SAAL,GAAiBhJ,mBAAmB,CAACiJ,oBAApB,CAAyC9J,IAAzC,CAA8Ca,mBAA9C,CAAjB;AACA,SAAKkJ,QAAL,GAAgBlJ,mBAAmB,CAACmJ,mBAApB,CAAwChK,IAAxC,CAA6Ca,mBAA7C,CAAhB;AACA,SAAKoJ,WAAL,GAAmBpJ,mBAAmB,CAACqJ,sBAApB,CAA2ClK,IAA3C,CAAgDa,mBAAhD,CAAnB;AACA,SAAKsJ,UAAL,GAAkBtJ,mBAAmB,CAACsJ,UAApB,CAA+BnK,IAA/B,CAAoCa,mBAApC,CAAlB;AACA,SAAKuJ,SAAL,GAAiBvJ,mBAAmB,CAACuJ,SAApB,CAA8BpK,IAA9B,CAAmCa,mBAAnC,CAAjB;;AAEA,SAAKwJ,OAAL,GAAe,UAACC,SAAD,EAAwB;AACrCzJ,MAAAA,mBAAmB,CAAC0J,cAApB,CAAmCD,SAAnC;AACAzJ,MAAAA,mBAAmB,CAACsJ,UAApB;AACD,KAHD;;AAMA,SAAKK,IAAL,GAAY,KAAKH,OAAjB;AAGA,SAAKE,cAAL,GAAsB1J,mBAAmB,CAAC0J,cAApB,CAAmCvK,IAAnC,CAAwCa,mBAAxC,CAAtB;AAEA,SAAK4J,qBAAL,GAA6B5J,mBAAmB,CAAC4J,qBAApB,CAA0CzK,IAA1C,CAA+Ca,mBAA/C,CAA7B;AACA,SAAK6J,0BAAL,GAAkC7J,mBAAmB,CAAC6J,0BAApB,CAA+C1K,IAA/C,CAAoDa,mBAApD,CAAlC;AAGA,SAAK8J,OAAL,GAAe/L,MAAM,CAAC+L,OAAP,CAAe3K,IAAf,CAAoBpB,MAApB,CAAf;AACA,SAAKgM,OAAL,GAAehM,MAAM,CAACgM,OAAP,CAAe5K,IAAf,CAAoBpB,MAApB,CAAf;AAGA,SAAKiM,UAAL,GAAkBtL,OAAO,CAACd,MAAR,CAAeoM,UAAf,CAA0B7K,IAA1B,CAA+BT,OAAO,CAACd,MAAvC,CAAlB;AACA,SAAKqM,UAAL,GAAkBvL,OAAO,CAACd,MAAR,CAAeqM,UAAf,CAA0B9K,IAA1B,CAA+BT,OAAO,CAACd,MAAvC,CAAlB;AACA,SAAKsM,YAAL,GAAoBxL,OAAO,CAACd,MAAR,CAAesM,YAAf,CAA4B/K,IAA5B,CAAiCT,OAAO,CAACd,MAAzC,CAApB;AACA,SAAKuM,OAAL,GAAezL,OAAO,CAACd,MAAR,CAAeuM,OAAf,CAAuBhL,IAAvB,CAA4BT,OAAO,CAACd,MAApC,CAAf;AACA,SAAKwM,OAAL,GAAe1L,OAAO,CAACd,MAAR,CAAewM,OAAf,CAAuBjL,IAAvB,CAA4BT,OAAO,CAACd,MAApC,CAAf;AACA,SAAKyM,mBAAL,GAA2B3L,OAAO,CAACd,MAAR,CAAeyM,mBAAf,CAAmClL,IAAnC,CAAwCT,OAAO,CAACd,MAAhD,CAA3B;AACA,SAAK0M,mBAAL,GAA2B5L,OAAO,CAACd,MAAR,CAAe0M,mBAAf,CAAmCnL,IAAnC,CAAwCT,OAAO,CAACd,MAAhD,CAA3B;AAEA,SAAK2M,oBAAL,GAA4B7L,OAAO,CAACd,MAAR,CAAe2M,oBAAf,CAAoCpL,IAApC,CAAyCT,OAAO,CAACd,MAAjD,CAA5B;;AAEA,QAAIF,UAAU,CAAC8M,SAAX,CAAqB,OAArB,CAAJ,EAAmC;AACjC,WAAKC,QAAL,GAAgB,UAACC,KAAD,EAAW;AACzBhM,QAAAA,OAAO,CAACd,MAAR,CAAe6M,QAAf,CAAwBC,KAAxB;;AACA,QAAA,KAAI,CAACnB,SAAL;AACD,OAHD;AAID;AACF;;;;WAED,sBAAqB;AACnB,aAAO,KAAK1L,OAAL,CAAa8M,UAAb,EAAP;AACD;;;WAED,yBAAgBC,IAAhB,EAA8BC,MAA9B,EAA8C;AAC5C,WAAKhN,OAAL,CAAaiN,eAAb,CAA6BF,IAA7B,EAAmCC,MAAnC;AACD;;;WAGD,+BAAsB;AACpB,WAAK/K,gBAAL,CAAsBiL,mBAAtB;;AAEA,UAAI,KAAKlN,OAAL,CAAamN,OAAjB,EAA0B;AACxB,aAAK1B,UAAL;AACD,OAFD,MAEO;AACL,aAAKE,OAAL,CAAa,IAAb;AACD;AACF;;;WAED,6BAAoB;AAClB,WAAK1J,gBAAL,CAAsBmL,iBAAtB;;AACA,WAAK1B,SAAL;AACD;;;WAED,6BAA2B2B,KAA3B,EAA2CC,IAA3C,EAAgF;AAC9E,aAAO,IAAIC,wBAAJ,CAAyBF,KAAzB,EAAgCC,IAAhC,CAAP;AACD;;;WAED,wBAA8B;AAC5B,aAAOE,iBAAcC,UAAd,EAAP;AACD;;;;;;yDAEmBC,sB;yDACAC,sB","sourcesContent":["/** @flow */\n\nimport Config from './components/config';\nimport Crypto from './components/cryptography/index';\nimport SubscriptionManager from './components/subscription_manager';\nimport TelemetryManager from './components/telemetry_manager';\nimport NotificationsPayload from './components/push_payload';\nimport ListenerManager from './components/listener_manager';\nimport TokenManager from './components/token_manager';\n\nimport endpointCreator from './components/endpoint';\n\nimport { deprecated } from './utils';\n\nimport * as addChannelsChannelGroupConfig from './endpoints/channel_groups/add_channels';\nimport * as removeChannelsChannelGroupConfig from './endpoints/channel_groups/remove_channels';\nimport * as deleteChannelGroupConfig from './endpoints/channel_groups/delete_group';\nimport * as listChannelGroupsConfig from './endpoints/channel_groups/list_groups';\nimport * as listChannelsInChannelGroupConfig from './endpoints/channel_groups/list_channels';\n\nimport * as addPushChannelsConfig from './endpoints/push/add_push_channels';\nimport * as removePushChannelsConfig from './endpoints/push/remove_push_channels';\nimport * as listPushChannelsConfig from './endpoints/push/list_push_channels';\nimport * as removeDevicePushConfig from './endpoints/push/remove_device';\n\nimport * as presenceLeaveEndpointConfig from './endpoints/presence/leave';\nimport * as presenceWhereNowEndpointConfig from './endpoints/presence/where_now';\nimport * as presenceHeartbeatEndpointConfig from './endpoints/presence/heartbeat';\nimport * as presenceGetStateConfig from './endpoints/presence/get_state';\nimport * as presenceSetStateConfig from './endpoints/presence/set_state';\nimport * as presenceHereNowConfig from './endpoints/presence/here_now';\n\n// Actions API\n\nimport * as addMessageActionEndpointConfig from './endpoints/actions/add_message_action';\nimport * as removeMessageActionEndpointConfig from './endpoints/actions/remove_message_action';\nimport * as getMessageActionEndpointConfig from './endpoints/actions/get_message_actions';\n\n// File Upload API v1\n\nimport { IFile, FileClass } from '../file';\n\nimport * as fileUploadTypes from './endpoints/file_upload/types';\n\nimport listFilesEndpointConfig from './endpoints/file_upload/list_files';\nimport generateUploadUrlEndpointConfig from './endpoints/file_upload/generate_upload_url';\nimport publishFileEndpointConfig from './endpoints/file_upload/publish_file';\nimport sendFileFunction from './endpoints/file_upload/send_file';\nimport getFileUrlFunction from './endpoints/file_upload/get_file_url';\nimport downloadFileEndpointConfig from './endpoints/file_upload/download_file';\nimport deleteFileEndpointConfig from './endpoints/file_upload/delete_file';\n\n// Object API v2\nimport getAllUUIDMetadataEndpointConfig, {\n type GetAllUUIDMetadataParams,\n type GetAllUUIDMetadataResult,\n} from './endpoints/objects/uuid/get_all';\n\nimport getUUIDMetadataEndpointConfig, {\n type GetUUIDMetadataParams,\n type GetUUIDMetadataResult,\n} from './endpoints/objects/uuid/get';\n\nimport setUUIDMetadataEndpointConfig, {\n type SetUUIDMetadataParams,\n type SetUUIDMetadataResult,\n} from './endpoints/objects/uuid/set';\n\nimport removeUUIDMetadataEndpointConfig, {\n type RemoveUUIDMetadataParams,\n type RemoveUUIDMetadataResult,\n} from './endpoints/objects/uuid/remove';\n\nimport getAllChannelMetadataEndpointConfig, {\n type GetAllChannelMetadataParams,\n type GetAllChannelMetadataResult,\n} from './endpoints/objects/channel/get_all';\n\nimport getChannelMetadataEndpointConfig, {\n type GetChannelMetadataParams,\n type GetChannelMetadataResult,\n} from './endpoints/objects/channel/get';\n\nimport setChannelMetadataEndpointConfig, {\n type SetChannelMetadataParams,\n type SetChannelMetadataResult,\n} from './endpoints/objects/channel/set';\n\nimport removeChannelMetadataEndpointConfig, {\n type RemoveChannelMetadataParams,\n type RemoveChannelMetadataResult,\n} from './endpoints/objects/channel/remove';\n\nimport getMembersV2EndpointConfig, {\n type GetMembersParams,\n type GetMembersResult,\n} from './endpoints/objects/member/get';\n\nimport setMembersV2EndpointConfig, {\n type UpsertMembersParams,\n type RemoveMembersParams,\n type SetMembersResult,\n} from './endpoints/objects/member/set';\n\nimport getMembershipsV2EndpointConfig, {\n type GetMembershipsParams,\n type GetMembershipsResult,\n} from './endpoints/objects/membership/get';\n\nimport setMembershipsV2EndpointConfig, {\n type UpsertMembershipsParams,\n type RemoveMembershipsParams,\n type SetMembershipsResult,\n} from './endpoints/objects/membership/set';\n\n// Objects API\n\nimport * as createUserEndpointConfig from './endpoints/users/create_user';\nimport * as updateUserEndpointConfig from './endpoints/users/update_user';\nimport * as deleteUserEndpointConfig from './endpoints/users/delete_user';\nimport * as getUserEndpointConfig from './endpoints/users/get_user';\nimport * as getUsersEndpointConfig from './endpoints/users/get_users';\nimport * as createSpaceEndpointConfig from './endpoints/spaces/create_space';\nimport * as updateSpaceEndpointConfig from './endpoints/spaces/update_space';\nimport * as deleteSpaceEndpointConfig from './endpoints/spaces/delete_space';\nimport * as getSpacesEndpointConfig from './endpoints/spaces/get_spaces';\nimport * as getSpaceEndpointConfig from './endpoints/spaces/get_space';\nimport * as getMembersEndpointConfig from './endpoints/memberships/get_members';\nimport * as addMembersEndpointConfig from './endpoints/memberships/add_members';\nimport * as updateMembersEndpointConfig from './endpoints/memberships/update_members';\nimport * as removeMembersEndpointConfig from './endpoints/memberships/remove_members';\nimport * as getMembershipsEndpointConfig from './endpoints/memberships/get_memberships';\nimport * as updateMembershipsEndpointConfig from './endpoints/memberships/update_memberships';\nimport * as joinSpacesEndpointConfig from './endpoints/memberships/join_spaces';\nimport * as leaveSpacesEndpointConfig from './endpoints/memberships/leave_spaces';\n\nimport * as auditEndpointConfig from './endpoints/access_manager/audit';\nimport * as grantEndpointConfig from './endpoints/access_manager/grant';\nimport * as grantTokenEndpointConfig from './endpoints/access_manager/grant_token';\nimport revokeTokenEndpointConfig, {\n type RevokeTokenParams,\n type RevokeTokenResult,\n} from './endpoints/access_manager/revoke_token';\n\nimport * as publishEndpointConfig from './endpoints/publish';\nimport * as signalEndpointConfig from './endpoints/signal';\nimport * as historyEndpointConfig from './endpoints/history/get_history';\nimport * as deleteMessagesEndpointConfig from './endpoints/history/delete_messages';\nimport * as messageCountsEndpointConfig from './endpoints/history/message_counts';\nimport * as fetchMessagesEndpointConfig from './endpoints/fetch_messages';\nimport * as timeEndpointConfig from './endpoints/time';\nimport * as subscribeEndpointConfig from './endpoints/subscribe';\n\nimport OPERATIONS from './constants/operations';\nimport CATEGORIES from './constants/categories';\n\nimport { InternalSetupStruct } from './flow_interfaces';\nimport uuidGenerator from './components/uuid';\n\ntype CallbackStatus = {|\n error: boolean,\n operation: string,\n statusCode: number,\n|};\n\nexport default class {\n _config: Config;\n _telemetryManager: TelemetryManager;\n _listenerManager: ListenerManager;\n _tokenManager: TokenManager;\n\n // tell flow about the mounted endpoint\n time: Function;\n publish: Function;\n fire: Function;\n\n history: Function;\n deleteMessages: Function;\n messageCounts: Function;\n fetchMessages: Function;\n\n //\n channelGroups: Object;\n //\n push: Object;\n //\n hereNow: Function;\n whereNow: Function;\n getState: Function;\n setState: Function;\n //\n grant: Function;\n grantToken: Function;\n audit: Function;\n revokeToken: (\n parameters: RevokeTokenParams,\n callback?: (status: CallbackStatus, result: RevokeTokenResult) => void\n ) => Promise;\n //\n subscribe: Function;\n signal: Function;\n presence: Function;\n unsubscribe: Function;\n unsubscribeAll: Function;\n\n // Actions API\n addMessageAction: Function;\n removeMessageAction: Function;\n getMessageActions: Function;\n\n // File Upload API v1\n\n File: FileClass;\n encryptFile: (key: string, file: IFile) => Promise;\n decryptFile: (key: string, file: IFile) => Promise;\n\n listFiles: (\n parameters: fileUploadTypes.ListFilesParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.ListFilesResult) => void\n ) => Promise;\n sendFile: (\n parameters: fileUploadTypes.SendFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.SendFileResult) => void\n ) => Promise;\n downloadFile: (\n parameters: fileUploadTypes.DownloadFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.DownloadFileResult) => void\n ) => Promise;\n getFileUrl: (parameters: fileUploadTypes.GetFileUrlParams) => fileUploadTypes.GetFileUrlResult;\n deleteFile: (\n parameters: fileUploadTypes.DeleteFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.DeleteFileResult) => void\n ) => Promise;\n publishFile: (\n parameters: fileUploadTypes.PublishFileParams,\n callback?: (status: CallbackStatus, result: fileUploadTypes.PublishFileResult) => void\n ) => Promise;\n\n // Objects API v2\n\n objects: {\n getAllUUIDMetadata: (\n parameters?: GetAllUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: GetAllUUIDMetadataResult) => void\n ) => Promise,\n getUUIDMetadata: (\n parameters?: GetUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: GetUUIDMetadataResult) => void\n ) => Promise,\n setUUIDMetadata: (\n parameters: SetUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: SetUUIDMetadataResult) => void\n ) => Promise,\n removeUUIDMetadata: (\n parameters?: RemoveUUIDMetadataParams,\n cb?: (status: CallbackStatus, result: RemoveUUIDMetadataResult) => void\n ) => Promise,\n\n getAllChannelMetadata: (\n parameters?: GetAllChannelMetadataParams,\n cb?: (status: CallbackStatus, result: GetAllChannelMetadataResult) => void\n ) => Promise,\n getChannelMetadata: (\n parameters: GetChannelMetadataParams,\n cb?: (status: CallbackStatus, result: GetChannelMetadataResult) => void\n ) => Promise,\n setChannelMetadata: (\n parameters: SetChannelMetadataParams,\n cb?: (status: CallbackStatus, result: SetChannelMetadataResult) => void\n ) => Promise,\n removeChannelMetadata: (\n parameters: RemoveChannelMetadataParams,\n cb?: (status: CallbackStatus, result: RemoveChannelMetadataResult) => void\n ) => Promise,\n\n getMemberships: (\n parameters: GetMembershipsParams,\n cb?: (status: CallbackStatus, result: GetMembershipsResult) => void\n ) => Promise,\n setMemberships: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembershipsResult) => void\n ) => Promise,\n removeMemberships: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembershipsResult) => void\n ) => Promise,\n\n getChannelMembers: (\n parameters: GetMembersParams,\n cb?: (status: CallbackStatus, result: GetMembersResult) => void\n ) => Promise,\n setChannelMembers: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembersResult) => void\n ) => Promise,\n removeChannelMembers: (\n parameters: $Diff,\n cb?: (status: CallbackStatus, result: SetMembersResult) => void\n ) => Promise,\n };\n\n // Objects API\n\n createUser: Function;\n updateUser: Function;\n deleteUser: Function;\n getUser: Function;\n getUsers: Function;\n createSpace: Function;\n updateSpace: Function;\n deleteSpace: Function;\n getSpaces: Function;\n getSpace: Function;\n getMembers: Function;\n addMembers: Function;\n updateMembers: Function;\n removeMembers: Function;\n getMemberships: Function;\n joinSpaces: Function;\n updateMemberships: Function;\n leaveSpaces: Function;\n\n disconnect: Function;\n reconnect: Function;\n\n destroy: Function;\n stop: Function;\n\n getSubscribedChannels: Function;\n getSubscribedChannelGroups: Function;\n\n addListener: Function;\n removeListener: Function;\n removeAllListeners: Function;\n\n parseToken: Function;\n setToken: Function;\n getToken: Function;\n\n getAuthKey: Function;\n setAuthKey: Function;\n\n setCipherKey: Function;\n setUUID: Function;\n getUUID: Function;\n\n getFilterExpression: Function;\n setFilterExpression: Function;\n\n setHeartbeatInterval: Function;\n\n setProxy: Function;\n\n encrypt: Function;\n decrypt: Function;\n\n //\n\n constructor(setup: InternalSetupStruct) {\n let { networking, cbor } = setup;\n\n const config = (this._config = new Config({ setup }));\n const crypto = new Crypto({ config }); // LEGACY\n\n const cryptography = setup.cryptography;\n\n networking.init(config);\n\n const tokenManager = (this._tokenManager = new TokenManager(config, cbor));\n const telemetryManager = (this._telemetryManager = new TelemetryManager({\n maximumSamplesCount: 60000,\n }));\n\n let modules = {\n config,\n networking,\n crypto,\n cryptography,\n tokenManager,\n telemetryManager,\n PubNubFile: setup.PubNubFile,\n };\n\n this.File = setup.PubNubFile;\n\n this.encryptFile = (key, file) => cryptography.encryptFile(key, file, this.File);\n this.decryptFile = (key, file) => cryptography.decryptFile(key, file, this.File);\n\n const timeEndpoint = endpointCreator.bind(this, modules, timeEndpointConfig);\n const leaveEndpoint = endpointCreator.bind(this, modules, presenceLeaveEndpointConfig);\n const heartbeatEndpoint = endpointCreator.bind(this, modules, presenceHeartbeatEndpointConfig);\n const setStateEndpoint = endpointCreator.bind(this, modules, presenceSetStateConfig);\n const subscribeEndpoint = endpointCreator.bind(this, modules, subscribeEndpointConfig);\n\n // managers\n const listenerManager = (this._listenerManager = new ListenerManager());\n\n const subscriptionManager = new SubscriptionManager({\n timeEndpoint,\n leaveEndpoint,\n heartbeatEndpoint,\n setStateEndpoint,\n subscribeEndpoint,\n crypto: modules.crypto,\n config: modules.config,\n listenerManager,\n getFileUrl: (params) => getFileUrlFunction(modules, params),\n });\n\n this.addListener = listenerManager.addListener.bind(listenerManager);\n this.removeListener = listenerManager.removeListener.bind(listenerManager);\n this.removeAllListeners = listenerManager.removeAllListeners.bind(listenerManager);\n\n this.parseToken = tokenManager.parseToken.bind(tokenManager);\n this.setToken = tokenManager.setToken.bind(tokenManager);\n this.getToken = tokenManager.getToken.bind(tokenManager);\n\n /* channel groups */\n this.channelGroups = {\n listGroups: endpointCreator.bind(this, modules, listChannelGroupsConfig),\n listChannels: endpointCreator.bind(this, modules, listChannelsInChannelGroupConfig),\n addChannels: endpointCreator.bind(this, modules, addChannelsChannelGroupConfig),\n removeChannels: endpointCreator.bind(this, modules, removeChannelsChannelGroupConfig),\n deleteGroup: endpointCreator.bind(this, modules, deleteChannelGroupConfig),\n };\n /* push */\n this.push = {\n addChannels: endpointCreator.bind(this, modules, addPushChannelsConfig),\n removeChannels: endpointCreator.bind(this, modules, removePushChannelsConfig),\n deleteDevice: endpointCreator.bind(this, modules, removeDevicePushConfig),\n listChannels: endpointCreator.bind(this, modules, listPushChannelsConfig),\n };\n /* presence */\n this.hereNow = endpointCreator.bind(this, modules, presenceHereNowConfig);\n this.whereNow = endpointCreator.bind(this, modules, presenceWhereNowEndpointConfig);\n this.getState = endpointCreator.bind(this, modules, presenceGetStateConfig);\n this.setState = subscriptionManager.adaptStateChange.bind(subscriptionManager);\n /* PAM */\n this.grant = endpointCreator.bind(this, modules, grantEndpointConfig);\n this.grantToken = endpointCreator.bind(this, modules, grantTokenEndpointConfig);\n this.audit = endpointCreator.bind(this, modules, auditEndpointConfig);\n this.revokeToken = endpointCreator.bind(this, modules, revokeTokenEndpointConfig);\n //\n this.publish = endpointCreator.bind(this, modules, publishEndpointConfig);\n\n this.fire = (args, callback) => {\n args.replicate = false;\n args.storeInHistory = false;\n return this.publish(args, callback);\n };\n\n this.signal = endpointCreator.bind(this, modules, signalEndpointConfig);\n\n this.history = endpointCreator.bind(this, modules, historyEndpointConfig);\n this.deleteMessages = endpointCreator.bind(this, modules, deleteMessagesEndpointConfig);\n this.messageCounts = endpointCreator.bind(this, modules, messageCountsEndpointConfig);\n this.fetchMessages = endpointCreator.bind(this, modules, fetchMessagesEndpointConfig);\n\n // Actions API\n\n this.addMessageAction = endpointCreator.bind(this, modules, addMessageActionEndpointConfig);\n\n this.removeMessageAction = endpointCreator.bind(this, modules, removeMessageActionEndpointConfig);\n\n this.getMessageActions = endpointCreator.bind(this, modules, getMessageActionEndpointConfig);\n\n // File Upload API v1\n\n this.listFiles = endpointCreator.bind(this, modules, listFilesEndpointConfig);\n\n const generateUploadUrl = endpointCreator.bind(this, modules, generateUploadUrlEndpointConfig);\n this.publishFile = endpointCreator.bind(this, modules, publishFileEndpointConfig);\n\n this.sendFile = sendFileFunction({\n generateUploadUrl,\n publishFile: this.publishFile,\n modules,\n });\n\n this.getFileUrl = (params) => getFileUrlFunction(modules, params);\n\n this.downloadFile = endpointCreator.bind(this, modules, downloadFileEndpointConfig);\n\n this.deleteFile = endpointCreator.bind(this, modules, deleteFileEndpointConfig);\n\n // Objects API v2\n\n this.objects = {\n getAllUUIDMetadata: endpointCreator.bind(this, modules, getAllUUIDMetadataEndpointConfig),\n getUUIDMetadata: endpointCreator.bind(this, modules, getUUIDMetadataEndpointConfig),\n setUUIDMetadata: endpointCreator.bind(this, modules, setUUIDMetadataEndpointConfig),\n removeUUIDMetadata: endpointCreator.bind(this, modules, removeUUIDMetadataEndpointConfig),\n\n getAllChannelMetadata: endpointCreator.bind(this, modules, getAllChannelMetadataEndpointConfig),\n getChannelMetadata: endpointCreator.bind(this, modules, getChannelMetadataEndpointConfig),\n setChannelMetadata: endpointCreator.bind(this, modules, setChannelMetadataEndpointConfig),\n removeChannelMetadata: endpointCreator.bind(this, modules, removeChannelMetadataEndpointConfig),\n\n getChannelMembers: endpointCreator.bind(this, modules, getMembersV2EndpointConfig),\n setChannelMembers: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembersV2EndpointConfig,\n {\n type: 'set',\n ...parameters,\n },\n ...rest\n ),\n removeChannelMembers: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembersV2EndpointConfig,\n {\n type: 'delete',\n ...parameters,\n },\n ...rest\n ),\n\n getMemberships: endpointCreator.bind(this, modules, getMembershipsV2EndpointConfig),\n setMemberships: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembershipsV2EndpointConfig,\n {\n type: 'set',\n ...parameters,\n },\n ...rest\n ),\n removeMemberships: (parameters: $Diff, ...rest) =>\n endpointCreator.call(\n this,\n modules,\n setMembershipsV2EndpointConfig,\n {\n type: 'delete',\n ...parameters,\n },\n ...rest\n ),\n };\n\n // Objects API\n\n this.createUser = deprecated(endpointCreator.bind(this, modules, createUserEndpointConfig));\n\n this.updateUser = deprecated(endpointCreator.bind(this, modules, updateUserEndpointConfig));\n\n this.deleteUser = deprecated(endpointCreator.bind(this, modules, deleteUserEndpointConfig));\n\n this.getUser = deprecated(endpointCreator.bind(this, modules, getUserEndpointConfig));\n\n this.getUsers = deprecated(endpointCreator.bind(this, modules, getUsersEndpointConfig));\n\n this.createSpace = deprecated(endpointCreator.bind(this, modules, createSpaceEndpointConfig));\n\n this.updateSpace = deprecated(endpointCreator.bind(this, modules, updateSpaceEndpointConfig));\n\n this.deleteSpace = deprecated(endpointCreator.bind(this, modules, deleteSpaceEndpointConfig));\n\n this.getSpaces = deprecated(endpointCreator.bind(this, modules, getSpacesEndpointConfig));\n\n this.getSpace = deprecated(endpointCreator.bind(this, modules, getSpaceEndpointConfig));\n\n this.addMembers = deprecated(endpointCreator.bind(this, modules, addMembersEndpointConfig));\n\n this.updateMembers = deprecated(endpointCreator.bind(this, modules, updateMembersEndpointConfig));\n\n this.removeMembers = deprecated(endpointCreator.bind(this, modules, removeMembersEndpointConfig));\n\n this.getMembers = deprecated(endpointCreator.bind(this, modules, getMembersEndpointConfig));\n\n this.getMemberships = deprecated(endpointCreator.bind(this, modules, getMembershipsEndpointConfig));\n\n this.joinSpaces = deprecated(endpointCreator.bind(this, modules, joinSpacesEndpointConfig));\n\n this.updateMemberships = deprecated(endpointCreator.bind(this, modules, updateMembershipsEndpointConfig));\n\n this.leaveSpaces = deprecated(endpointCreator.bind(this, modules, leaveSpacesEndpointConfig));\n\n this.time = timeEndpoint;\n\n // subscription related methods\n this.subscribe = subscriptionManager.adaptSubscribeChange.bind(subscriptionManager);\n this.presence = subscriptionManager.adaptPresenceChange.bind(subscriptionManager);\n this.unsubscribe = subscriptionManager.adaptUnsubscribeChange.bind(subscriptionManager);\n this.disconnect = subscriptionManager.disconnect.bind(subscriptionManager);\n this.reconnect = subscriptionManager.reconnect.bind(subscriptionManager);\n\n this.destroy = (isOffline: boolean) => {\n subscriptionManager.unsubscribeAll(isOffline);\n subscriptionManager.disconnect();\n };\n\n // --- deprecated ------------------\n this.stop = this.destroy; // --------\n // --- deprecated ------------------\n\n this.unsubscribeAll = subscriptionManager.unsubscribeAll.bind(subscriptionManager);\n\n this.getSubscribedChannels = subscriptionManager.getSubscribedChannels.bind(subscriptionManager);\n this.getSubscribedChannelGroups = subscriptionManager.getSubscribedChannelGroups.bind(subscriptionManager);\n\n // mount crypto\n this.encrypt = crypto.encrypt.bind(crypto);\n this.decrypt = crypto.decrypt.bind(crypto);\n\n /* config */\n this.getAuthKey = modules.config.getAuthKey.bind(modules.config);\n this.setAuthKey = modules.config.setAuthKey.bind(modules.config);\n this.setCipherKey = modules.config.setCipherKey.bind(modules.config);\n this.getUUID = modules.config.getUUID.bind(modules.config);\n this.setUUID = modules.config.setUUID.bind(modules.config);\n this.getFilterExpression = modules.config.getFilterExpression.bind(modules.config);\n this.setFilterExpression = modules.config.setFilterExpression.bind(modules.config);\n\n this.setHeartbeatInterval = modules.config.setHeartbeatInterval.bind(modules.config);\n\n if (networking.hasModule('proxy')) {\n this.setProxy = (proxy) => {\n modules.config.setProxy(proxy);\n this.reconnect();\n };\n }\n }\n\n getVersion(): string {\n return this._config.getVersion();\n }\n\n _addPnsdkSuffix(name: string, suffix: string) {\n this._config._addPnsdkSuffix(name, suffix);\n }\n\n // network hooks to indicate network changes\n networkDownDetected() {\n this._listenerManager.announceNetworkDown();\n\n if (this._config.restore) {\n this.disconnect();\n } else {\n this.destroy(true);\n }\n }\n\n networkUpDetected() {\n this._listenerManager.announceNetworkUp();\n this.reconnect();\n }\n\n static notificationPayload(title: ?string, body: ?string): NotificationsPayload {\n return new NotificationsPayload(title, body);\n }\n\n static generateUUID(): string {\n return uuidGenerator.createUUID();\n }\n\n static OPERATIONS = OPERATIONS;\n static CATEGORIES = CATEGORIES;\n}\n"],"file":"pubnub-common.js"} \ No newline at end of file diff --git a/package.json b/package.json index b5c55d416..0a350aab7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pubnub", - "version": "4.37.0", + "version": "5.0.0", "author": "PubNub ", "description": "Publish & Subscribe Real-time Messaging with PubNub", "bin": {}, diff --git a/src/core/components/config.js b/src/core/components/config.js index 95ea62017..cd9bbadf4 100644 --- a/src/core/components/config.js +++ b/src/core/components/config.js @@ -2,7 +2,7 @@ /* global location */ import uuidGenerator from './uuid'; -import { InternalSetupStruct, DatabaseInterface, KeepAliveStruct, ProxyStruct } from '../flow_interfaces'; +import { InternalSetupStruct, KeepAliveStruct, ProxyStruct } from '../flow_interfaces'; const PRESENCE_TIMEOUT_MINIMUM: number = 20; const PRESENCE_TIMEOUT_DEFAULT: number = 300; @@ -10,13 +10,10 @@ const PRESENCE_TIMEOUT_DEFAULT: number = 300; const makeDefaultOrigins = () => Array.from({ length: 20 }, (_, i) => `ps${i + 1}.pndsn.com`); type ConfigConstructArgs = { - setup: InternalSetupStruct, - db: DatabaseInterface, + setup: InternalSetupStruct }; export default class { - _db: DatabaseInterface; - subscribeKey: string; publishKey: string; secretKey: string; @@ -145,9 +142,8 @@ export default class { fileUploadPublishRetryLimit: number; useRandomIVs: boolean; - constructor({ setup, db }: ConfigConstructArgs) { + constructor({ setup }: ConfigConstructArgs) { this._PNSDKSuffix = {}; - this._db = db; this.instanceId = `pn-${uuidGenerator.createUUID()}`; this.secretKey = setup.secretKey || setup.secret_key; @@ -215,7 +211,7 @@ export default class { this.setHeartbeatInterval(setup.heartbeatInterval); } - this.setUUID(this._decideUUID(setup.uuid)); // UUID decision depends on subKey. + this.setUUID(setup.uuid); } // exposed setters @@ -238,7 +234,9 @@ export default class { } setUUID(val: string): this { - if (this._db && this._db.set) this._db.set(`${this.subscribeKey}uuid`, val); + if (!val || typeof val !== 'string' || val.trim().length === 0) { + throw new Error('Missing uuid parameter. Provide a valid string uuid'); + } this.UUID = val; return this; } @@ -313,7 +311,7 @@ export default class { } getVersion(): string { - return '4.37.0'; + return '5.0.0'; } _addPnsdkSuffix(name: string, suffix: string) { @@ -323,19 +321,4 @@ export default class { _getPnsdkSuffix(separator: string): string { return Object.keys(this._PNSDKSuffix).reduce((result, key) => result + separator + this._PNSDKSuffix[key], ''); } - - _decideUUID(providedUUID: string): string { - // if the uuid was provided by setup, use this UUID. - if (providedUUID) { - return providedUUID; - } - - // if the database module is enabled and we have something saved, use this. - if (this._db && this._db.get && this._db.get(`${this.subscribeKey}uuid`)) { - return this._db.get(`${this.subscribeKey}uuid`); - } - - // randomize the UUID and push to storage - return `pn-${uuidGenerator.createUUID()}`; - } } diff --git a/src/core/flow_interfaces.js b/src/core/flow_interfaces.js index 718aa96a9..d5547fc4a 100644 --- a/src/core/flow_interfaces.js +++ b/src/core/flow_interfaces.js @@ -64,15 +64,9 @@ export type InternalSetupStruct = { suppressLev: ?boolean, - db: Function, // get / set implementation to store data networking: Function // component of networking to use } -type DatabaseInterface = { - get: Function, - set: Function -} - type EndpointKeyDefinition = { required: boolean } diff --git a/src/core/pubnub-common.js b/src/core/pubnub-common.js index 8c64c2f14..ef5e5922b 100644 --- a/src/core/pubnub-common.js +++ b/src/core/pubnub-common.js @@ -358,9 +358,9 @@ export default class { // constructor(setup: InternalSetupStruct) { - let { db, networking, cbor } = setup; + let { networking, cbor } = setup; - const config = (this._config = new Config({ setup, db })); + const config = (this._config = new Config({ setup })); const crypto = new Crypto({ config }); // LEGACY const cryptography = setup.cryptography; diff --git a/test/contract/world.ts b/test/contract/world.ts index 65c94a2cb..3ffa6c2e5 100644 --- a/test/contract/world.ts +++ b/test/contract/world.ts @@ -34,7 +34,8 @@ class PubnubWorld extends World{ origin: 'localhost:8090', ssl: false, suppressLeaveEvents: true, - logVerbosity: false + logVerbosity: false, + uuid: 'myUUID' }, demoKeyset: { publishKey : 'demo', diff --git a/test/dist/react-native.test.js b/test/dist/react-native.test.js index 3bda4cf0f..949168e22 100644 --- a/test/dist/react-native.test.js +++ b/test/dist/react-native.test.js @@ -19,7 +19,7 @@ describe('#distribution test (rkt-native)', function () { }); beforeEach(() => { - pubnub = new PubNub({ subscribeKey: 'demo', publishKey: 'demo' }); + pubnub = new PubNub({ subscribeKey: 'demo', publishKey: 'demo', uuid: 'myUUID' }); }); afterEach(() => { diff --git a/test/dist/web-titanium.test.js b/test/dist/web-titanium.test.js index a68527049..00d1a8e59 100644 --- a/test/dist/web-titanium.test.js +++ b/test/dist/web-titanium.test.js @@ -15,7 +15,7 @@ var myChanneGroup1 = 'myChannelGroup1' + channelSuffix; describe('#distribution test (titanium)', function () { before(function () { - pubnub = new PubNub({ subscribeKey: 'demo', publishKey: 'demo' }); + pubnub = new PubNub({ subscribeKey: 'demo', publishKey: 'demo', uuid: 'myUUID' }); }); after(function () { diff --git a/test/integration/components/config.test.js b/test/integration/components/config.test.js index 9648dc78a..1331cb6a9 100644 --- a/test/integration/components/config.test.js +++ b/test/integration/components/config.test.js @@ -2,69 +2,66 @@ /* eslint no-console: 0, object-shorthand: 0 */ import assert from 'assert'; -import sinon from 'sinon'; -import lilUUID from 'lil-uuid'; -import PubNub from '../../../src/core/pubnub-common'; -import Networking from '../../../src/networking'; -import { get, post } from '../../../src/networking/modules/web-node'; -import { keepAlive, proxy } from '../../../src/networking/modules/node'; +import PubNub from '../../../src/node/index'; describe('components/config', () => { - describe('AuthKey Storage', () => { - let networking = new Networking({ keepAlive, get, post, proxy }); - let storageParams = { authKey: 'authKey1', networking: networking }; - const pubnub = new PubNub(storageParams); + describe('AuthKey parameter', () => { + it('get/set', () => { + let pubnub = new PubNub({ + subscribeKey: 'mySubKey', + publishKey: 'myPublishKey', + authKey: 'authKey1', + uuid: 'myUUID' + }); assert.equal(pubnub.getAuthKey(), 'authKey1'); pubnub.setAuthKey('authKey2'); assert.equal(pubnub.getAuthKey(), 'authKey2'); + }); }); - describe('UUID storage', () => { - let database = () => { - let db = {}; - return { - get: (key) => db[key], - set: (key, value) => { db[key] = value; } + describe('uuid Parameter', () => { + it('throws when not provided value', () => { + let config = { + subscribeKey: 'mySubKey', + publishKey: 'myPublishKey', + authKey: 'authKey1' }; - }; - - it('uses the UUID if it is provided in setup', () => { - let networking = new Networking({ keepAlive, get, post, proxy }); - let storageParams = { uuid: 'customUUID', networking: networking }; - const pubnub = new PubNub(storageParams); - assert.equal(pubnub.getUUID(), 'customUUID'); + assert.throws(() => { + new PubNub(config); + }); }); - it('generates the UUID if it is not provided', () => { - let networking = new Networking({ keepAlive, get, post, proxy }); - let storageParams = { networking: networking }; - const pubnub = new PubNub(storageParams); - assert.equal(lilUUID.isUUID(pubnub.getUUID().replace('pn-', '')), true); + it('get/set', () => { + let pubnub = new PubNub({ + subscribeKey: 'mySubKey', + publishKey: 'myPublishKey', + uuid: 'uuid1' + }); + assert.equal(pubnub.getUUID(), 'uuid1'); + pubnub.setUUID('uuid2'); + assert.equal(pubnub.getUUID(), 'uuid2'); }); - it('checks UUID from database if db object is provided', () => { - let dbInstance = database(); - let networking = new Networking({ keepAlive, get, post, proxy }); - sinon.spy(dbInstance, 'get'); - sinon.spy(dbInstance, 'set'); - let storageParams = { subscribeKey: 'mySubKey', db: dbInstance, networking: networking }; - const pubnub = new PubNub(storageParams); - assert.equal(dbInstance.get.callCount, 1); - assert.equal(dbInstance.get.getCall(0).args[0], 'mySubKeyuuid'); - assert.equal(lilUUID.isUUID(pubnub.getUUID().replace('pn-', '')), true); + it('throws when invalid value provided', () => { + let config = { + subscribeKey: 'mySubKey', + publishKey: 'myPublishKey', + uuid: ' ' + }; + assert.throws(() => { + new PubNub(config); + }); }); - it('uses UUID from database if db object is provided', () => { - let dbInstance = database(); - let networking = new Networking({ keepAlive, get, post, proxy }); - dbInstance.set('mySubKeyuuid', 'dbUUID'); - sinon.spy(dbInstance, 'get'); - sinon.spy(dbInstance, 'set'); - let storageParams = { subscribeKey: 'mySubKey', db: dbInstance, networking: networking }; - const pubnub = new PubNub(storageParams); - assert.equal(dbInstance.get.callCount, 2); - assert.equal(dbInstance.get.getCall(0).args[0], 'mySubKeyuuid'); - assert.equal(pubnub.getUUID(), 'dbUUID'); + it('setUUID throws while trying to set invalid uuid', () => { + let pubnub = new PubNub({ + subscribeKey: 'mySubKey', + publishKey: 'myPublishKey', + uuid: 'myUUID' + }); + assert.throws(() => { + pubnub.setUUID(' '); + }); }); }); }); diff --git a/test/integration/components/crypto.test.js b/test/integration/components/crypto.test.js index d0748900d..3e07707ba 100644 --- a/test/integration/components/crypto.test.js +++ b/test/integration/components/crypto.test.js @@ -8,6 +8,7 @@ describe('components/crypto useRandomIVs', () => { publishKey: 'demo-36', useRandomIVs: true, cipherKey: 'abcdef', + uuid: 'myUUID' }); it('should be able to encrypt and decrypt a message', () => { diff --git a/test/integration/components/token_manager.test.js b/test/integration/components/token_manager.test.js index b72daab09..3dd26f60c 100644 --- a/test/integration/components/token_manager.test.js +++ b/test/integration/components/token_manager.test.js @@ -10,7 +10,8 @@ describe('#components/token_manager', () => { beforeEach(() => { pubnub = new PubNub({ subscribeKey: 'mySubKey', - publishKey: 'myPublishKey' + publishKey: 'myPublishKey', + uuid: 'myUUID' }); }); diff --git a/test/release/release.test.js b/test/release/release.test.js index 98f92fddb..c7620dbc8 100755 --- a/test/release/release.test.js +++ b/test/release/release.test.js @@ -24,7 +24,7 @@ describe('release should be consistent', () => { }); it('with correct version in code', () => { - assert.equal(packageJSON.version, new PubNub({}).getVersion()); + assert.equal(packageJSON.version, new PubNub({uuid: 'myUUID'}).getVersion()); }); it('with updated readme', () => { diff --git a/test/unit/common.test.js b/test/unit/common.test.js index 83c67c68e..f8dcb0eb3 100644 --- a/test/unit/common.test.js +++ b/test/unit/common.test.js @@ -7,12 +7,12 @@ import CryptoJS from '../../src/core/components/cryptography/hmac-sha256'; describe('#core / mounting point', () => { it('should have default heartbeat interval undefined', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); assert(pn._config.getHeartbeatInterval() === undefined); }); it('should have correct heartbeat interval set when reducing presence timeout', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); let presenceTimeout = 200; let expectedHeartBeat = presenceTimeout / 2 - 1; pn._config.setPresenceTimeout(presenceTimeout); @@ -20,7 +20,7 @@ describe('#core / mounting point', () => { }); it('should support multiple pnsdk suffix', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); let suffix1 = 'suffix1/0.1'; let suffix2 = 'suffix2/0.2'; @@ -31,7 +31,7 @@ describe('#core / mounting point', () => { }); it('should replace duplicate pnsdk suffix by name', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); let suffix1 = 'suffix1/0.1'; let suffix2 = 'suffix2/0.2'; let suffix3 = 'suffix3/0.3'; @@ -44,7 +44,7 @@ describe('#core / mounting point', () => { }); it('should default to empty pnsdk suffix', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); assert(pn._config._getPnsdkSuffix(' ') === ''); }); @@ -53,7 +53,7 @@ describe('#core / mounting point', () => { }); it('supports encryption with static IV', () => { - let pn = new PubNub({ cipherKey: 'customKey', useRandomIVs: false }); + let pn = new PubNub({ cipherKey: 'customKey', useRandomIVs: false, uuid: 'myUUID' }); assert.equal( pn.encrypt(JSON.stringify({ hi: 'there' })), 'TejX6F2JNqH/gIiGHWN4Cw==' @@ -61,7 +61,7 @@ describe('#core / mounting point', () => { }); it('supports encryption with random IV', () => { - let pn = new PubNub({ cipherKey: 'customKey' }); + let pn = new PubNub({ cipherKey: 'customKey', uuid: 'myUUID' }); const data1 = pn.encrypt(JSON.stringify({ hi: 'there' })); const data2 = pn.encrypt(JSON.stringify({ hi: 'there' })); @@ -73,7 +73,7 @@ describe('#core / mounting point', () => { }); it('supports encryption with custom key and static IV', () => { - let pn = new PubNub({ useRandomIVs: false }); + let pn = new PubNub({ useRandomIVs: false, uuid: 'myUUID' }); assert.equal( pn.encrypt(JSON.stringify({ hi: 'there' }), 'customKey'), 'TejX6F2JNqH/gIiGHWN4Cw==' @@ -81,7 +81,7 @@ describe('#core / mounting point', () => { }); it('supports encryption with custom key and random IV', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); const data1 = pn.encrypt(JSON.stringify({ hi: 'there' }), 'customKey'); const data2 = pn.encrypt(JSON.stringify({ hi: 'there' }), 'customKey'); @@ -93,12 +93,12 @@ describe('#core / mounting point', () => { }); it('supports decryption with static IV', () => { - let pn = new PubNub({ cipherKey: 'customKey', useRandomIVs: false }); + let pn = new PubNub({ cipherKey: 'customKey', useRandomIVs: false, uuid: 'myUUID' }); assert.deepEqual(pn.decrypt('TejX6F2JNqH/gIiGHWN4Cw=='), { hi: 'there' }); }); it('supports decryption with random IV', () => { - let pn = new PubNub({ cipherKey: 'customKey' }); + let pn = new PubNub({ cipherKey: 'customKey', uuid: 'myUUID' }); const data = pn.encrypt(JSON.stringify({ hi: 'there2' })); assert.notDeepEqual(pn.decrypt('TejX6F2JNqH/gIiGHWN4Cw=='), { hi: 'there' }); @@ -106,14 +106,14 @@ describe('#core / mounting point', () => { }); it('supports decryption with custom key and static IV', () => { - let pn = new PubNub({ useRandomIVs: false }); + let pn = new PubNub({ useRandomIVs: false, uuid: 'myUUID' }); assert.deepEqual(pn.decrypt('TejX6F2JNqH/gIiGHWN4Cw==', 'customKey'), { hi: 'there', }); }); it('supports decryption with custom key and random IV', () => { - let pn = new PubNub({}); + let pn = new PubNub({ uuid: 'myUUID' }); const data = pn.encrypt(JSON.stringify({ hi: 'there2' }), 'customKey'); assert.notDeepEqual(pn.decrypt('TejX6F2JNqH/gIiGHWN4Cw==', 'customKey'), { @@ -133,7 +133,7 @@ describe('#core / mounting point', () => { return JSON.parse(bytes.toString(CryptoJS.enc.Utf8)); }; - let pn = new PubNub({ customEncrypt, customDecrypt }); + let pn = new PubNub({ customEncrypt, customDecrypt, uuid: 'myUUID' }); let ciphertext = pn.encrypt({ hi: 'there' }); diff --git a/test/unit/networking.test.js b/test/unit/networking.test.js index b56261211..1ab2654f6 100644 --- a/test/unit/networking.test.js +++ b/test/unit/networking.test.js @@ -16,7 +16,7 @@ describe('multiple origins', () => { it('should use a random origin from a supplied array of origins', () => { const origins = ['test1.example.com', 'test2.example.com']; - const config = new Config({ setup: { ssl: true, origin: origins } }) + const config = new Config({ setup: { ssl: true, origin: origins, uuid: 'myUUID' } }) const networking = new Networking({}); networking.init(config); @@ -26,7 +26,7 @@ describe('multiple origins', () => { }); it('should use string origin if a string is supplied', () => { - const config = new Config({ setup: { ssl: true, origin: 'example.com' } }) + const config = new Config({ setup: { ssl: true, origin: 'example.com', uuid: 'myUUID' } }) const networking = new Networking({}); networking.init(config); @@ -38,7 +38,7 @@ describe('multiple origins', () => { describe('shiftStandardOrigin', () => { it('should use all origins if array is supplied', () => { const origins = ['test1.example.com', 'test2.example.com']; - const config = new Config({ setup: { ssl: true, origin: origins } }) + const config = new Config({ setup: { ssl: true, origin: origins, uuid: 'myUUID' } }) const networking = new Networking({}); networking.init(config); @@ -51,7 +51,7 @@ describe('multiple origins', () => { }); it('should do nothing if string is supplied', () => { - const config = new Config({ setup: { ssl: true, origin: 'example.com' } }) + const config = new Config({ setup: { ssl: true, origin: 'example.com', uuid: 'myUUID' } }) const networking = new Networking({}); networking.init(config); @@ -71,7 +71,7 @@ describe('keep-alive agent', () => { after(() => nock.enableNetConnect()); const setupNetwork = (shouldSecure, enableKeepAlive) => { - const config = new Config({ setup: { origin: 'ps.pndsn.com', ssl: shouldSecure, keepAlive: enableKeepAlive, logVerbosity: false } }); + const config = new Config({ setup: { origin: 'ps.pndsn.com', ssl: shouldSecure, keepAlive: enableKeepAlive, logVerbosity: false, uuid: 'myUUID' } }); const networking = new Networking({ keepAlive, del, get, post, proxy }); networking.init(config);