-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathCometChat.js
1 lines (1 loc) · 417 KB
/
CometChat.js
1
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@react-native-async-storage/async-storage"),require("react-native"),require("react"));else if("function"==typeof define&&define.amd)define(["@react-native-async-storage/async-storage","react-native","react"],t);else{var n="object"==typeof exports?t(require("@react-native-async-storage/async-storage"),require("react-native"),require("react")):t(e["@react-native-async-storage/async-storage"],e["react-native"],e.react);for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(n,o,s){return function(n){var o={};function s(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,s),t.l=!0,t.exports}return s.m=n,s.c=o,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)s.d(n,o,function(e){return t[e]}.bind(null,o));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=52)}([function(e,W,r){"use strict";(function(K){W.__esModule=!0,W.validateQuestion=W.updatePropertiesWithDynamicValue=W.getCallSettings=W.isCallingComponentInstalled=W.getKeyprefix=W.validateConversationType=W.validateUpdateUser=W.validateCreateUser=W.validateMessage=W.validateChatType=W.validateMsgId=W.validateArray=W.validateHideMessagesFromBlockedUsers=W.validateId=W.validateCreateGroup=W.validateJoinGroup=W.validateUpdateGroup=W.validateScope=W.isAudio=W.isVideo=W.isImage=W.getUpdatedSettings=W.getAppSettings=W.getCurrentTime=W.Logger=W.createUidFromJid=W.format=W.getOrdinalSuffix=W.isFalsy=W.isTruthy=W.isObject=W.getJidHost=W.getChatHost=void 0;var o=r(15),B=r(1),e=r(5),F=r(2),i=r(20),a=r(22),E=r(24),b=r(6),t=r(10),x=r(39),V=r(53),J=r(16),c=r(26);function k(e){return null!=e&&("string"==typeof e&&(e=e.trim()),"object"==typeof e&&0===Object.keys(e).length&&(e=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(e)}function u(e){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return e.split("%s").reduce(function(e,t,n){return e+t+(o[n]||"")},"")}W.getChatHost=function(e){return e[B.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?e[B.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:e[B.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?e[B.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:e[B.APP_SETTINGS.KEYS.CHAT_HOST]},W.getJidHost=function(e){return e[B.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?e[B.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:e[B.APP_SETTINGS.KEYS.CHAT_HOST]},W.isObject=function(e){return e instanceof Object&&e.constructor===Object},W.isTruthy=function(e){return[!0,1,"1","true","TRUE"].includes(e)},W.isFalsy=k,W.getOrdinalSuffix=function(e){var t=e%10,n=e%100;return 1==t&&11!=n?e+"st":2==t&&12!=n?e+"nd":3==t&&13!=n?e+"rd":e+"th"},W.format=u,W.createUidFromJid=function(e){return e.substring(e.lastIndexOf("]")+1,e.lastIndexOf("@"))};var n=function(){function e(){}return e.log=function(e,t){},e.error=function(e,t){},e.info=function(e,t){},e}();function H(){return new Promise(function(t,n){o.LocalStorage.getInstance().get(B.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){k(e)?s().then(function(e){t(e)},function(e){n(e)}):t(e)},function(e){n(e)})})}function s(){return new Promise(function(t,n){e.makeApiCall("appSettings").then(function(e){o.LocalStorage.getInstance().set(B.LOCAL_STORE.KEY_APP_SETTINGS,e.data),e.data.MODE&&b.CometChat.setMode(e.data.MODE),t(e.data)},function(e){n(new F.CometChatException(e.error))})})}W.Logger=n,W.getCurrentTime=function(){return(new Date).getTime()},W.getAppSettings=H,W.getUpdatedSettings=s,W.isImage=function(e){var t;return e.type&&e.type.toLowerCase().includes("image")&&(t=!0),t},W.isVideo=function(e){var t;return e.type&&e.type.toLowerCase().includes("video")&&(t=!0),t},W.isAudio=function(e){var t;return e.type&&e.type.toLowerCase().includes("audio")&&(t=!0),t},W.validateScope=function(e){return typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):k(e)?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):e!=b.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&e!=b.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&e!=b.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new F.CometChatException(B.GroupErrors.INVALID_SCOPE):void 0},W.validateUpdateGroup=function(e){return e.hasOwnProperty(B.GroupConstants.KEYS.GUID)?typeof e[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):k(e[B.GroupConstants.KEYS.GUID])?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):e.hasOwnProperty(B.GroupConstants.KEYS.NAME)&&""===e[B.GroupConstants.KEYS.NAME]?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},W.validateJoinGroup=function(e,t,n){if(typeof e==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!e.hasOwnProperty(B.GroupConstants.KEYS.GUID))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(k(e[B.GroupConstants.KEYS.GUID]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(B.GroupConstants.KEYS.TYPE))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[B.GroupConstants.KEYS.TYPE]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(k(e[B.GroupConstants.KEYS.TYPE]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PUBLIC&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PASSWORD&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PROTECTED&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(e[B.GroupConstants.KEYS.TYPE].toLowerCase()==b.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(B.GroupConstants.KEYS.PASSWORD))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[B.GroupConstants.KEYS.PASSWORD]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(k(e[B.GroupConstants.KEYS.PASSWORD]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==e){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(k(e))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==t){if(typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(k(t))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t.toLowerCase()!=b.CometChat.GROUP_TYPE.PUBLIC&&t.toLowerCase()!=b.CometChat.GROUP_TYPE.PASSWORD&&t.toLowerCase()!=b.CometChat.GROUP_TYPE.PROTECTED&&t.toLowerCase()!=b.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(t.toLowerCase()==b.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(k(n))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},W.validateCreateGroup=function(e){if(!e.hasOwnProperty(B.GroupConstants.KEYS.GUID))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(k(e[B.GroupConstants.KEYS.GUID]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(B.GroupConstants.KEYS.NAME))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof e[B.GroupConstants.KEYS.NAME]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(k(e[B.GroupConstants.KEYS.NAME]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!e.hasOwnProperty(B.GroupConstants.KEYS.TYPE))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[B.GroupConstants.KEYS.TYPE]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(k(e[B.GroupConstants.KEYS.TYPE]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PUBLIC&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PASSWORD&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PROTECTED&&e[B.GroupConstants.KEYS.TYPE].toLowerCase()!=b.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(e[B.GroupConstants.KEYS.TYPE].toLowerCase()==b.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(B.GroupConstants.KEYS.PASSWORD))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[B.GroupConstants.KEYS.PASSWORD]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(k(e[B.GroupConstants.KEYS.PASSWORD]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(e.hasOwnProperty(B.GroupConstants.KEYS.TAGS)){if(!Array.isArray(e[B.GroupConstants.KEYS.TAGS]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===e[B.GroupConstants.KEYS.TAGS].length)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},W.validateId=function(e,t){if("user"===t){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(k(e))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===t){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(k(e))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}if("bot"===t){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"BOT_ID","BOT_ID","BOT_ID")));if(k(e))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"BOT_ID","BOT_ID","BOT_ID","BOT_ID")))}},W.validateHideMessagesFromBlockedUsers=function(e){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},W.validateArray=function(e,t){var n="List should be an array.";return n="blockUsers"===t?"blockUsers() method accepts an array of users.":"unblockUsers"===t?"unblockUsers() method accepts an array of users.":"groupMembers"===t?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof e!=B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(e)?void 0:new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},W.validateMsgId=function(e){return isNaN(e)?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):k(e)?new F.CometChatException(t.ERRORS.PARAMETER_MISSING):void 0},W.validateChatType=function(e){return typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):k(e)?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):e!=B.MessageConstatnts.RECEIVER_TYPE.GROUP&&e!=B.MessageConstatnts.RECEIVER_TYPE.USER?new F.CometChatException(B.MessageErrors.INVALID_RECEIVER_TYPE):void 0},W.validateMessage=function(e){var t=e;if(typeof t.getReceiverId()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(k(t.getReceiverId()))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof t.getReceiverType()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(k(t.getReceiverType()))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(t.getReceiverType()!=B.MessageConstatnts.RECEIVER_TYPE.GROUP&&t.getReceiverType()!=B.MessageConstatnts.RECEIVER_TYPE.USER)return new F.CometChatException(B.MessageErrors.INVALID_RECEIVER_TYPE);if(e instanceof i.TextMessage){var n=e;if(typeof n.getText()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")));if(""===n.getText().trim())return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(e instanceof a.MediaMessage){var o=e;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var s=o.getAttachments(),r=0;r<s.length;r++){if(!s[r].getExtension())return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!s[r].getMimeType())return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!s[r].getName())return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!s[r].getUrl())return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(o.hasOwnProperty("files"))for(r=0;r<o.files.length;r++){if(typeof o.files[r]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_OBJECT),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")));if(k(o.files[r])&&!(o.files[r]instanceof Blob))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"MEDIA_OBJECT","MEDIA_OBJECT","Media object","Media object")))}}if(e instanceof E.CustomMessage&&k(e.getCustomData()))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")));if(e instanceof c.InteractiveMessage&&k(e.getInteractiveData()))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"INTERACTIVE_DATA","INTERACTIVE_DATA","interactive data","interactive data")))},W.validateCreateUser=function(e){if(!e.hasOwnProperty(B.UserConstants.UID))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof e[B.UserConstants.UID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(k(e[B.UserConstants.UID]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!e.hasOwnProperty(B.UserConstants.NAME))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof e[B.UserConstants.NAME]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(k(e[B.UserConstants.NAME]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(e.hasOwnProperty(B.UserConstants.AVATAR)&&""===e[B.UserConstants.AVATAR])return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(e.hasOwnProperty(B.UserConstants.META_DATA)&&""===e[B.UserConstants.META_DATA])return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(e.hasOwnProperty(B.UserConstants.LINK)&&""===e[B.UserConstants.LINK])return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(e.hasOwnProperty(B.UserConstants.STATUS_MESSAGE)&&""===e[B.UserConstants.STATUS_MESSAGE])return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(e.hasOwnProperty(B.UserConstants.ROLE)&&""===e[B.UserConstants.ROLE])return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(e.hasOwnProperty(B.UserConstants.TAGS)){if(!Array.isArray(e[B.UserConstants.TAGS]))return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===e[B.UserConstants.TAGS].length)return new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},W.validateUpdateUser=function(e){return e.hasOwnProperty(B.UserConstants.UID)?typeof e[B.UserConstants.UID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):k(e[B.UserConstants.UID])?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):e.hasOwnProperty(B.UserConstants.NAME)&&""===e[B.UserConstants.NAME]?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},W.validateConversationType=function(e){return typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):k(e)?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(e=e.toLowerCase())!=b.CometChat.RECEIVER_TYPE.USER&&e!=b.CometChat.RECEIVER_TYPE.GROUP?new F.CometChatException(B.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},W.getKeyprefix=function(e,t){switch(e){case B.LOCAL_STORE.COMMON_STORE:return u(B.LOCAL_STORE.KEY_STRING,u(B.LOCAL_STORE.STORE_STRING,b.CometChat.getAppId(),B.LOCAL_STORE.COMMON_STORE),t);case B.LOCAL_STORE.KEYS_STORE:return u(B.LOCAL_STORE.KEY_STRING,u(B.LOCAL_STORE.STORE_STRING,b.CometChat.getAppId(),B.LOCAL_STORE.KEYS_STORE),t);case B.LOCAL_STORE.MESSAGES_STORE:return u(B.LOCAL_STORE.KEY_STRING,u(B.LOCAL_STORE.STORE_STRING,b.CometChat.getAppId(),B.LOCAL_STORE.MESSAGES_STORE),t);case B.LOCAL_STORE.MESSAGE_LISTENERS_LIST:return u(B.LOCAL_STORE.KEY_STRING,u(B.LOCAL_STORE.STORE_STRING,b.CometChat.getAppId(),B.LOCAL_STORE.MESSAGE_LISTENERS_LIST),t);case B.LOCAL_STORE.USERS_STORE:return u(B.LOCAL_STORE.KEY_STRING,u(B.LOCAL_STORE.STORE_STRING,b.CometChat.getAppId(),B.LOCAL_STORE.USERS_STORE),t)}},W.isCallingComponentInstalled=function(){return!!(K.hasOwnProperty("CometChatCalling")&&K.CometChatCalling&&K.CometChatCalling.hasOwnProperty("isCallingComponentInstalled")&&K.CometChatCalling.isCallingComponentInstalled)},W.getCallSettings=function(w){return new Promise(function(o,e){var s,r,i,a,E,c,u,p,C,S,l,_={};i=b.CometChat.getActiveCall(),E=b.CometChat.user;var T,d,h,R,g,A,I,f,O,N,m,P,y,M,v,L,U,D,Y,G=!0;H().then(function(e){if(u=e[B.APP_SETTINGS.KEYS.WEBRTC_HOST],_[B.APP_SETTINGS.KEYS.ANALYTICS_HOST]=e[B.APP_SETTINGS.KEYS.ANALYTICS_HOST],_[B.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=e[B.APP_SETTINGS.KEYS.ANALYTICS_VERSION],_[B.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=e[B.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],_[B.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=e[B.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],s=e[B.APP_SETTINGS.KEYS.REGION],w.getCallEventListener()&&J.CallController.getInstance().setCallListner(w.getCallEventListener()),W.isCallingComponentInstalled())if(p=K.CometChatCalling.CometChatCalls,C=K.CometChatCalling.CallEventListener,S=K.CometChatCalling.CallScreen,l=K.CometChatCalling.CometChatRTC,k(b.CometChat.appSettings))J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_INITIALIZED));else{if(!s)return G=!1,void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_INITIALIZED)));if(b.CometChat.getAppId()){if(r=b.CometChat.getAppId(),!E)return G=!1,void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_LOGGED_IN)));if(i){var t=i.getType();T=t===B.CallConstants.CALL_TYPE.AUDIO,d=i.getSessionId()}else{if(T=w.isAudioOnlyCall(),k(w.getSessionId()))return void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.SESSION_ID_REQUIRED)));d=("v1."+s+"."+b.CometChat.getAppId()+"."+w.getSessionId()).toLowerCase()}if(!d)return G=!1,void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.SESSION_ID_REQUIRED)));if(h=w.isDefaultLayoutEnabled(),R=w.isAudioModeButtonEnabled(),g=w.isPauseVideoButtonEnabled(),A=w.isMuteAudioButtonEnabled(),I=w.isSwitchCameraButtonEnabled(),f=w.isEndCallButtonEnabled(),O=w.getMode(),N=w.getStartWithAudioMuted(),m=w.getStartWithVideoMuted(),P=w.getDefaultAudioMode(),y=!!T&&w.isAudioToVideoButtonEnabled(),M=w.getAvatarMode(),v=w.isRecordingButtonEnabled(),L=w.shouldStartRecordingOnCallStart(),U=w.getMainVideoContainerSetting(),D=w.isVideoTileClickEnabled(),Y=w.isVideoTileDragEnabled(),G){var n={uid:E.getUid(),sessionId:d};b.CometChat.getInstance().getJWT(n).then(function(e){e.hasOwnProperty("token")?((c=new V.RTCUser(E.getUid())).setName(E.getName()),c.setAvatar(E.getAvatar()),c.setResource(b.CometChat.getSessionId()),c.setJWT(e.token),a=(new x.CallSettingsBuilder).setSessionID(d).enableDefaultLayout(h).setIsAudioOnlyCall(T).setUser(c).setRegion(s).setAppId(r).setDomain(u).showAudioModeButton(R).showEndCallButton(f).showMuteAudioButton(A).showPauseVideoButton(g).showSwitchCameraButton(I).setMode(O).setAnalyticsSettings(_).startWithAudioMuted(N).startWithVideoMuted(m).setDefaultAudioMode(P).showSwitchToVideoCallButton(y).setAvatarMode(M).showRecordingButton(v).startRecordingOnCallStart(L).setMainVideoContainerSetting(U).enableVideoTileClick(D).enableVideoTileDrag(Y).build(),J.CallController.getInstance().callStarted(),o({callSettingsNew:a,call:i,CometChatCalls:p,CallEventListener:C,CallScreen:S,CometChatRTC:l})):J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.JWT_NOT_FOUND))},function(e){J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(e))})}}else J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_INITIALIZED))}else J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.MODULE_NOT_INSTALLED))})})},W.updatePropertiesWithDynamicValue=function(e,o,s){return function e(t){for(var n in t)t.hasOwnProperty(n)&&("object"==typeof t[n]?e(t[n]):"string"==typeof t[n]&&t[n].includes(o)&&!t[n].includes(B.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY)&&(t[n]+=s))}(e),e},W.validateQuestion=function(e){return typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"QUESTION","QUESTION","Question"))):k(e)?new F.CometChatException(JSON.parse(u(JSON.stringify(B.GENERAL_ERROR.INVALID),"QUESTION","QUESTION","question","question"))):void 0}}).call(this,r(19))},function(e,t,n){"use strict";t.__esModule=!0,t.AI_SLUG_ENABLED=t.AI_SLUG_ACCESSIBLE=t.AI_FEATURE_ENABLED=t.AI_FEATURE_ACCESSIBLE=t.ADDITIONAL_CONSTANTS=t.ONLINE_MEMBER_COUNT_API=t.JWT_API=t.ProsodyApiErrors=t.PROSODY_API=t.API_ERROR_CODES=t.REACTION_ACTION=t.CONNECTION_STATUS=t.COMMON_UTILITY_CONSTANTS=t.APP_SETTINGS=t.PresenceConstatnts=t.FeatureRestrictionErrors=t.MessageErrors=t.AIFeatureError=t.ExtensionErrors=t.AIErrors=t.ConversationErrors=t.GroupErrors=t.UserErrors=t.ReceiptErrors=t.GENERAL_ERROR=t.PARAMETER_ERROR=t.CALL_ERROR=t.Errors=t.UserConstants=t.GroupMemersConstans=t.GroupConstants=t.CallConstants=t.BlockedUsersConstants=t.ActionConstatnts=t.TYPING_NOTIFICATION=t.GoalType=t.MessageCategory=t.ATTACHMENTS_CONSTANTS=t.MessageConstatnts=t.READ_RECEIPTS=t.DELIVERY_RECEIPTS=t.ResponseConstants=t.LOCAL_STORE=t.ANALYTICS=t.WS=t.SDKHeader=t.APPINFO=t.GROUP_MEMBER_SCOPE=t.GroupMemberScope=t.GROUP_TYPE=t.GroupType=t.DEFAULT_VALUES=t.constants=void 0;var o,s,r,i,a,E=n(2);t.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},t.DEFAULT_VALUES={ZERO:0,MSGS_LIMIT:30,REACTIONS_LIMIT:10,MSGS_MAX_LIMIT:100,USERS_LIMIT:30,USERS_MAX_LIMIT:100,GROUPS_LIMIT:30,GROUPS_MAX_LIMIT:100,CONVERSATION_MAX_LIMIT:50,CALL_TIMEOUT:45,DEFAULT_MSG_ID:0,DEFAULT_MAX_TYPING_INDICATOR_LIMIT:5,REGION_DEFAULT:"eu",REGION_DEFAULT_EU:"eu",REGION_DEFAULT_US:"us",REGION_DEFAULT_IN:"in",REGION_DEFAULT_PRIVATE:"private",REACTIONS_MAX_LIMIT:20},(o=t.GroupType||(t.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",t.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(s=t.GroupMemberScope||(t.GroupMemberScope={})).Admin="admin",s.Moderator="moderator",s.Member="member",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"REACT_NATIVE",sdkVersion:"v4.0.12",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_0_12",userAgent:"cc_react_native_sdk"},t.SDKHeader={platform:"react-native",sdkVersion:"4.0.12",sdk:"%s@%s"},t.WS={CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},t.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},t.LOCAL_STORE={COMMON_STORE:"common_store",MESSAGE_LISTENERS_LIST:"message_listeners_list",USERS_STORE:"users_store",MESSAGES_STORE:"messages_store",KEYS_STORE:"keys_store",STORE_STRING:"%s:%s",KEY_STRING:"%s/%s",KEY_USER:"user",KEY_APP_SETTINGS:"app_settings",KEY_APP_ID:"appId",KEY_DEVICE_ID:"deviceId",KEY_SESSION_ID:"sessionId",KEY_MESSAGE_LISTENER_LIST:"all"},t.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",KEY_NEXT:"next",KEY_PREVIOUS:"previous",KEY_ACTION:"action",KEY_MESSAGE:"message",KEY_ERROR:"error",KEY_ERROR_DETAILS:"details",KEY_ERROR_CODE:"code",KEY_ERROR_MESSAGE:"message",KEY_AUTH_TOKEN:"authToken",KEY_WS_CHANNEL:"wsChannel",KEY_IDENTITY:"identity",KEY_SERVICE:"identity",KEY_ENTITIES:"entities",KEY_REACTIONS:"reactions",KEY_ENTITITY:"entity",KEY_ENTITYTYPE:"entityType",KEY_ATTACHMENTS:"attachments",CODE_REQUEST_OK:200,CODE_BAD_REQUEST:401,UNREAD_UNDELIVERED_KEYS:{ENTITY:"entity",ENTITY_TYPE:"entityType",ENTITY_Id:"entityId",COUNT:"count"},GROUP_MEMBERS_RESPONSE:{SUCCESS:"success",ERROR:"error",MESSAGE:"message"},KEY_ENTITY_TYPE:{USER:"user",GROUP:"group"},KEY_CONVERSATION_STARTER:"conversation-starter",KEY_SMART_REPLIES:"smart-replies",KEY_CONVERSATION_SUMMARY:"conversation-summary",KEY_BOT_REPLY:"bot-reply"}},t.DELIVERY_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",RECEIVED:"delivered",DELIVERED_AT:"deliveredAt",ID:"id",TIME:"time",DELIVERED_TO_ME_AT:"deliveredToMeAt"},t.READ_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",READ:"read",READ_AT:"readAt",ID:"id",TIME:"time",READ_BY_ME_AT:"readByMeAt"},t.MessageConstatnts={TYPE:{TEXT:"text",MEDIA:"media",IMAGE:"image",VIDEO:"video",AUDIO:"audio",FILE:"file",CUSTOM:"custom"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom",INTERACTIVE:"interactive"},RECEIVER_TYPE:{USER:"user",GROUP:"group"},KEYS:{ATTATCHMENT:"attatchment",ATTATCHMENTS:"attachments",ACTION:"action",TYPE:"type",DATA:"data",ID:"id",MUID:"muid",SENDER:"sender",RECEIVER:"receiver",RECEIVER_ID:"receiverId",CATEGORY:"category",RECEIVER_TYPE:"receiverType",SENT_AT:"sentAt",STATUS:"status",TEXT:"text",URL:"url",METADATA:"metadata",RECEIPTS:"receipts",MY_RECEIPTS:"myReceipt",CUSTOM_DATA:"customData",CUSTOM_SUB_TYPE:"subType",RESOURCE:"resource",MENTIONS:"mentions",INTERACTIVE_DATA:"interactiveData",INTERACTION_GOAL:"interactionGoal",INTERACTIONS:"interactions",ALLOW_SENDER_INTERACTION:"allowSenderInteraction",ELEMENT_ID:"elementId",INTERACTED_AT:"interactedAt",ELEMENT_IDS:"elementIds"},KNOWN_MEDIA_TYPE:{IMAGE:[],VIDEO:[],AUDIO:[],FILE:[]},PAGINATION:{AFFIX:{APPEND:"append",PREPEND:"prepend"},CURSOR_FILEDS:{ID:"id",SENT_AT:"sentAt"},CURSOR_AFFIX_DEFAULT:"prepend",CURSOR_FIELD_DEFAULT:"sentAt",KEYS:{PER_PAGE:"per_page",CURSOR_AFFIX:"cursorAffix",AFFIX:"affix",CURSOR_FIELD:"cursorField",CURSOR_VALUE:"cursorValue",UID:"uid",SENT_AT:"sentAt",ID:"id",CURRENT_PAGE:"page",UNREAD:"unread",HIDE_MESSAGES_FROM_BLOCKED_USER:"hideMessagesFromBlockedUsers",SEARCH_KEY:"searchKey",ONLY_UPDATES:"onlyUpdates",UPDATED_AT:"updatedAt",CATEGORY:"category",CATEGORIES:"categories",TYPE:"type",TYPES:"types",HIDE_REPLIES:"hideReplies",HIDE_DELETED_MESSAGES:"hideDeleted",WITH_TAGS:"withTags",TAGS:"tags",MENTIONS_WITH_TAG_INFO:"mentionsWithTagInfo",MENTIONS_WITH_BLOCKED_INFO:"mentionsWithBlockedInfo",ONLY_INTERACTION_GOAL_COMPLETED:"onlyInteractionGoalCompleted"}}},t.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(r=t.MessageCategory||(t.MessageCategory={})).ACTION="action",r.MESSAGE="message",r.CALL="call",r.CUSTOM="custom",r.INTERACTIVE="interactive",(i=t.GoalType||(t.GoalType={})).ANY_ACTION="anyAction",i.ANY_OF="anyOf",i.ALL_OF="allOf",i.NONE="none",t.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},t.ActionConstatnts={ACTION_SUBJECTS:{ACTION_ON:"on",ACTION_BY:"by",ACTION_FOR:"for"},ACTION_ENTITY_TYPE:{GROUP_USER:"groupuser",USER:"user",GROUP:"group",MESSAGE:"message"},ACTION_KEYS:{ACTION_CREATED:"created",ACTION_UPDATED:"updated",ACTION_DELETED:"deleted",ENTITIES:"entities",ENTITY:"entity",ENTITY_TYPE:"entityType",TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_ADDED:"added",ACTION_SCOPE_CHANGED:"scopeChanged",ACTION_TYPE_USER:"user",ACTION_TYPE_GROUP:"group",ACTION_TYPE_GROUP_MEMBER:"groupMember",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",ACTION_TYPE_CALL:"call",EXTRAS:"extras",SCOPE:"scope",NEW:"new",OLD:"old"},ActionMessages:{ACTION_GROUP_JOINED_MESSAGE:"%s joined",ACTION_GROUP_LEFT_MESSAGE:"%s left",ACTION_MEMBER_KICKED_MESSAGE:"%s kicked %s",ACTION_MEMBER_BANNED_MESSAGE:"%s banned %s",ACTION_MEMBER_UNBANNED_MESSAGE:"%s unbanned %s",ACTION_MEMBER_INVITED_MESSAGE:"%s banned %s",ACTION_MESSAGE_EDITED_MESSAGE:" Message Edited",ACTION_MESSAGE_DELETED_MESSAGE:"Message Deleted",ACTION_MEMBER_SCOPE_CHANGED:"%s made %s %s",ACTION_MEMBER_ADDED_TO_GROUP:"%s added %s"},ACTION_TYPE:{TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_SCOPE_CHANGED:"scopeChanged",TYPE_MESSAGE:"message",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",TYPE_MEMBER_ADDED:"added"},ACTIONS:{MEMBER_ADDED:"added",MEMBER_JOINED:"joined",MEMBER_LEFT:"left",MEMBER_KICKED:"kicked",MEMBER_BANNED:"banned",MEMBER_UNBANNED:"unbanned",MEMBER_INVITED:"invited",MEMBER_SCOPE_CHANGED:"scopeChanged",MESSAGE_EDITED:"edited",MESSSAGE_DELETED:"deleted",TYPE_USER:"user",TYPE_GROUP:"group",TYPE_GROUP_MEMBER:"groupMember"}},t.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},t.CallConstants={CALL_MODE:{DEFAULT:"DEFAULT",SPOTLIGHT:"SPOTLIGHT",SINGLE:"SINGLE"},AUDIO_MODE:{SPEAKER:"SPEAKER",EARPIECE:"EARPIECE",BLUETOOTH:"BLUETOOTH",HEADPHONES:"HEADPHONES"},CALL_TYPE:{AUDIO:"audio",VIDEO:"video"},RECEIVER_TYPE_GROUP:"group",RECEIVER_TYPE_USER:"user",CALL_KEYS:{CALL_DATA:"data",CALL_ID:"id",CALL_SESSION_ID:"sessionid",CALL_RECEIVER:"receiver",CALL_SENDER:"sender",CALL_RECEIVER_TYPE:"receiverType",CALL_STATUS:"status",CALL_TYPE:"type",CALL_INITIATED_AT:"initiatedAt",CALL_JOINED_AT:"joinedAt",CALL_LEFT_AT:"leftAt",CALL_METADATA:"metadata",CALL_ENTITIES:"entities",CALL_ENTITY_TYPE:"entityType",CALL_ENTITY:"entity",CALL_ENTITY_USER:"user",CALL_ENTITY_GROUP:"group"},CALL_STATUS:{INITIATED:"initiated",ONGOING:"ongoing",UNANSWERED:"unanswered",REJECTED:"rejected",BUSY:"busy",CANCELLED:"cancelled",ENDED:"ended"},ZOOM_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},FULL_SCREEN_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},USER_LIST_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},NAME_LABEL_DEFAULT_PARAMS:{position:"bottom-left",visible:!0,color:"#333333"},MAIN_VIDEO_CONTAINER_SETTINGS:{KEYS:{POSITION:"position",VISIBILITY:"visibility",COLOR:"color"}}},t.GroupConstants={KEYS:{NAME:"name",GUID:"guid",TYPE:"type",PASSWORD:"password",ICON:"icon",DESCRIPTION:"description",OWNER:"owner",METADATA:"metadata",CREATED_AT:"createdAt",UPDATED_AT:"updatedAt",HAS_JOINED:"hasJoined",WS_CHANNEL:"wsChannel",TAGS:"tags"}},t.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},t.UserConstants={UID:"uid",NAME:"name",AUTH_TOKEN:"authToken",AVATAR:"avatar",LAST_ACTIVE_AT:"lastActiveAt",LINK:"link",META_DATA:"metadata",ROLE:"role",STATUS:"status",STATUS_MESSAGE:"statusMessage",USER_NAME:"user_name",TAGS:"tags",SORT_BY:{NAME:"name",STATUS:"status"},SORT_ORDER:{ASCENDING:"asc",DESCENDING:"desc"}},t.Errors={ERROR_IO_EXCEPTION:"ERROR_IO_EXCEPTION",ERROR_JSON_EXCEPTION:"ERROR_JSON_EXCEPTION",ERROR_PASSWORD_MISSING:"ERROR_PASSWORD_MISSING",ERROR_LIMIT_EXCEEDED:"ERROR_LIMIT_EXCEEDED",ERROR_USER_NOT_LOGGED_IN:"ERROR_USER_NOT_LOGGED_IN",ERROR_INVALID_GUID:"ERROR_INVALID_GUID",ERROR_PASSWORD_MISSING_MESSAGE:"Password is mandatory for a password group",ERROR_LIMIT_EXCEEDED_MESSAGE:"Limit Exceeded Max limit of %s",ERROR_USER_NOT_LOGGED_IN_MESSAGE:"Please log in to CometChat before calling this method",ERROR_INVALID_GUID_MESSAGE:"Please provide a valid GUID",ERROR_DEFAULT_MESSAGE:"Something went wrong",ERR_SETTINGS_HASH_OUTDATED:"ERR_SETTINGS_HASH_OUTDATED",ERR_NO_AUTH:"ERR_NO_AUTH"},t.CALL_ERROR={CALL_ALREADY_INITIATED:{code:"CALL_ALREADY_INITIATED",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},ERROR_IN_CALLING:{code:"CALL_IN_PROGRESS",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},CANNOT_ACCEPT_CALL:{code:"OTHER_CALL_ONGOING",name:"OTHER_CALL_ONGOING",message:"There is already a call in progress",details:{}},NOT_INITIALIZED:{code:"NOT_INITIALIZED",name:"NOT_INITIALIZED",message:"Please call the CometChat.init() method before calling any other methods related to CometChat.",details:{}},NOT_LOGGED_IN:{code:"NOT_LOGGED_IN",name:"NOT_LOGGED_IN",message:"Please login before starting a call.",details:{}},SESSION_ID_REQUIRED:{code:"SESSION_ID_REQUIRED",name:"SESSION_ID_REQUIRED",message:"Please make sure you are passing correct session id.",details:{}},JWT_NOT_FOUND:{code:"JWT_NOT_FOUND",name:"JWT_NOT_FOUND",message:"There was some issue while fetching JWT from API.",details:{}},MODULE_NOT_INSTALLED:{code:"ERROR_CALL_MODULE_NOT_FOUND",name:"ERROR_CALL_MODULE_NOT_FOUND",message:"CometChat Calling module not found. Please add the CometChat Calling dependency and try again.",details:{}}},t.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},t.GENERAL_ERROR={MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a string.",details:{}},MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a number.",details:{}},MUST_BE_A_OBJECT:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a object.",details:{}},MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be an array.",details:{}},MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a boolean.",details:{}},MUST_BE_A_BLOB:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a blob.",details:{}},INVALID:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s. Please provide a valid %s.",details:{}},METHOD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s is required.",details:{}},LIMIT_EXCEEDED:{code:"ERROR_%s_EXCEEDED",name:"ERROR_%s_EXCEEDED",message:"Limit exceeded max limit of %s.",details:{}},MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a postive integer greater than 0.",details:{}},INVALID_MEDIA_FILE:{code:"INVALID_%s",name:"INVALID_%s",message:"The message type does not match the file's mime type.",details:{}},EMPTY_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s cannot be empty.",details:{}},MISSING_KEY:{code:"MISSING_KEY",name:"MISSING_KEY",message:"The key %s is missing from the %s object.",details:{}},EMPTY_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"The parameter %s should be an array and it cannot be empty.",details:{}},INVALID_SEARCH_KEYWORD:{code:"INVALID_SEARCH_KEYWORD",name:"INVALID_SEARCH_KEYWORD",message:"Invalid search keyword. Please provide a valid search keyword.",details:{}},INVALID_GROUP_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for the group. Please provide a valid %s.",details:{}},INVALID_USER_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for a user. Please provide a valid %s.",details:{}},PARAMETER_MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a number.",details:{}},PARAMETER_MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as an array.",details:{}},PARAMETER_MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a boolean.",details:{}},PARAMETER_MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter to be a positive number greater than 0.",details:{}},PARAMETER_MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a string.",details:{}},PARAMETER_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s cannot be blank. Please provide a valid %s.",details:{}},PASSWORD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"Password is mandatory for a password group.",details:{}},INVALID_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}}},t.ReceiptErrors={MISSING_PARAMETERS:{code:"MISSING_PARAMETERS",name:"MISSING_PARAMETERS",message:"Expected 4 parameters received 3",details:{}},INVALID_PARAMETER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}},NO_WEBSOCKET_CONNECTION:{code:"NO_WEBSOCKET_CONNECTION",name:"NO_WEBSOCKET_CONNECTION",message:"Connection to our Websockets server is broken. Please retry after some time.",details:{}},RECEIPTS_TEMPORARILY_BLOCKED:{code:"RECEIPTS_TEMPORARILY_BLOCKED",name:"RECEIPTS_TEMPORARILY_BLOCKED",message:"Due to high load. Receipts have been blocked for your app.",details:{}},UNKNOWN_ERROR_OCCURRED:{code:"UNKNOWN_ERROR_OCCURRED",name:"UNKNOWN_ERROR_OCCURRED",message:"Unknown error occurred while marking a message as read.",details:{}}},t.UserErrors={INVALID_STATUS:new E.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new E.CometChatException({code:"INVALID_DIRECTION_VALUE",name:"INVALID_DIRECTION_VALUE",message:"The `direction` parameter accepts only `both`, `blockeyByMe` or `hasBlockedMe`.",details:""}),USER_NOT_LOGGED_IN:new E.CometChatException({code:"USER_NOT_LOGGED_IN",name:"USER_NOT_LOGGED_IN",message:"Please log in to CometChat before calling this method.",details:""})},t.GroupErrors={NOT_A_GROUP:new E.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new E.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new E.CometChatException({code:"INVALID_GROUP_TYPE",name:"INVALID_GROUP_TYPE",message:"Group type can be `public`, `private`, `protected` or `password`.",details:""})},t.ConversationErrors={INVALID_CONVERSATION_TYPE:{code:"INVALID_CONVERSATION_TYPE",name:"INVALID_CONVERSATION_TYPE",message:"Conversation type can be `user` or `group`.",details:"Please check the value of conversationType."},CONVERSATION_NOT_FOUND:{code:"CONVERSATION_NOT_FOUND",name:"CONVERSATION_NOT_FOUND",message:"Conversation for %s %s not found.",details:"Please check the value of conversationWith and conversationType."}},t.AIErrors={NO_CONVERSATION_STARTER:{code:"NO_CONVERSATION_STARTER",name:"NO_CONVERSATION_STARTER",message:"Unable to get conversation starter for this conversation.",details:""},NO_SMART_REPLY:{code:"NO_SMART_REPLY",name:"NO_SMART_REPLY",message:"Unable to get smart reply for this conversation.",details:""},NO_CONVERSATION_SUMMARY:{code:"NO_CONVERSATION_SUMMARY",name:"NO_CONVERSATION_SUMMARY",message:"Unable to get summary of the conversation.",details:""},NO_ASSISTANCE:{code:"EMPTY_RESPONSE",name:"EMPTY_RESPONSE",message:"Unable to get a suggestion.",details:""}},t.ExtensionErrors={INVALID_EXTENSION:{code:"ERROR_INVALID_EXTENSION",name:"ERROR_INVALID_EXTENSION",message:"The provided extension cannot be null or empty. Please provide a valid extension.",details:{}},EXTENSION_NOT_FOUND:{code:"ERROR_EXTENSION_NOT_FOUND",name:"ERROR_EXTENSION_NOT_FOUND",message:"The provided extension could not be found.",details:{}}},t.AIFeatureError={INVALID_AI_FEATURE:{code:"ERROR_INVALID_AI_FEATURE",name:"ERROR_INVALID_AI_FEATURE",message:"The provided AI Feature cannot be null or empty. Please provide a valid AI Feature.",details:{}}},t.MessageErrors={INVALID_RECEIVER_TYPE:{code:"INVALID_RECEIVER_TYPE",name:"INVALID_RECEIVER_TYPE",message:"Receiver type can be `user` or `group`.",details:"Please check the value of receiverType."}},t.FeatureRestrictionErrors={INVALID_FEATURE:{code:"ERROR_INVALID_FEATURE",name:"ERROR_INVALID_FEATURE",message:"The provided feature cannot be null or empty. Please provide a valid feature.",details:{}},FEATURE_NOT_FOUND:{code:"ERROR_FEATURE_NOT_FOUND",name:"ERROR_FEATURE_NOT_FOUND",message:"The provided feature could not be found.",details:{}}},t.PresenceConstatnts={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},t.APP_SETTINGS={APP_SETTINGS:"app_settings",KEYS:{CHAT_HOST:"CHAT_HOST",CHAT_USE_SSL:"CHAT_USE_SSL",GROUP_SERVICE:"GROUP_SERVICE",CALL_SERVICE:"CALL_SERVICE",CHAT_WS_PORT:"CHAT_WS_PORT",CHAT_WSS_PORT:"CHAT_WSS_PORT",CHAT_HTTP_BIND_PORT:"CHAT_HTTP_BIND_PORT",CHAT_HTTPS_BIND_PORT:"CHAT_HTTPS_BIND_PORT",ADMIN_API_HOST:"ADMIN_API_HOST",CLIENT_API_HOST:"CLIENT_API_HOST",WEBRTC_HOST:"WEBRTC_HOST",WEBRTC_USE_SSL:"WEBRTC_USE_SSL",WEBRTC_WS_PORT:"WEBRTC_WS_PORT",WEBRTC_WSS_PORT:"WEBRTC_WSS_PORT",WEBRTC_HTTP_BIND_PORT:"WEBRTC_HTTP_BIND_PORT",WEBRTC_HTTPS_BIND_PORT:"WEBRTC_HTTPS_BIND_PORT",EXTENSION_LIST:"extensions",EXTENSION_KEYS:{ID:"id",NAME:"name"},JID_HOST_OVERRIDE:"JID_HOST_OVERRIDE",CHAT_HOST_OVERRIDE:"CHAT_HOST_OVERRIDE",CHAT_HOST_APP_SPECIFIC:"CHAT_HOST_APP_SPECIFIC",MODE:"MODE",CONNECTION_TYPE:"connection_type",DEFAULT_MODE:"DEFAULT",LIMITED_TRANSIENT:"LIMITED_TRANSIENT",NO_TRANSIENT:"NO_TRANSIENT",POLLING_ENABLED:"POLLING_ENABLED",POLLING_INTERVAL:"POLLING_INTERVAL",ANALYTICS_PING_DISABLED:"ANALYTICS_PING_DISABLED",ANALYTICS_HOST:"ANALYTICS_HOST",ANALYTICS_VERSION:"ANALYTICS_VERSION",ANALYTICS_USE_SSL:"ANALYTICS_USE_SSL",SETTINGS_HASH:"settingsHash",SETTINGS_HASH_RECEIVED_AT:"settingsHashReceivedAt",DENY_FALLBACK_TO_POLLING:"DENY_FALLBACK_TO_POLLING",APP_VERSION:"APP_VERSION",MAIN_DOMAIN:"MAIN_DOMAIN",CHAT_API_VERSION:"CHAT_API_VERSION",WS_API_VERSION:"WS_API_VERSION",REGION:"REGION",EXTENSION_DOMAIN:"EXTENSION_DOMAIN",WEBRTC_API_SUBDOMAIN:"WEBRTC_API_SUBDOMAIN",SECURED_MEDIA_HOST:"SECURED_MEDIA_HOST",PARAMETERS:"parameters",CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES:"core.conversations.updateOnCallActivity",CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS:"core.conversations.updateOnGroupActions",CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES:"core.conversations.updateOnCustomMessage",CORE_CONVERSATIONS_UPDATE_ON_REPLIES:"core.conversations.updateOnReplies"}},t.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},t.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"},(a=t.REACTION_ACTION||(t.REACTION_ACTION={})).REACTION_ADDED="message_reaction_added",a.REACTION_REMOVED="message_reaction_removed",t.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},t.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},t.ProsodyApiErrors={INVALID_SESSIONID:{code:"ERROR_INVALID_SESSIONID",name:"ERROR_INVALID_SESSIONID",message:"The provided sessionId cannot be null or empty. Please provide a valid sessionId.",details:""},INVALID_TYPE:{code:"ERROR_INVALID_TYPE",name:"ERROR_INVALID_TYPE",message:"The provided type cannot be null or empty. Please provide a valid type.",details:""}},t.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},t.ONLINE_MEMBER_COUNT_API={ENDPOINTS:{GET_ONLINE_MEMBER_COUNT:"api/%s/online-members"},RESPONSE:{ONLINE_USERS_COUNT:"onlineUsersCount",GROUPS:"groups"},ERRORS:{INVALID_GROUPLIST:{code:"ERROR_INVALID_GROUPLIST",name:"ERROR_INVALID_GROUPLIST",message:"Grouplist cannot be null or empty.",details:""}}},t.ADDITIONAL_CONSTANTS={SECURE_URL_PROPERTY:"fat"},t.AI_FEATURE_ACCESSIBLE="features.ai.accessible",t.AI_FEATURE_ENABLED="features.ai.enabled",t.AI_SLUG_ACCESSIBLE="features.ai.%s.accessible",t.AI_SLUG_ENABLED="features.ai.%s.enabled"},function(e,t,n){"use strict";t.__esModule=!0,t.CometChatException=void 0;var o=function(e){null!==e.code&&void 0!==e.code&&""!==e.code&&(this.code=e.code),null!==e.name&&void 0!==e.name&&""!==e.name&&(this.name=e.name),null!==e.message&&void 0!==e.message&&""!==e.message&&(this.message=e.message),null!==e.details&&void 0!==e.details&&""!==e.details&&(this.details=e.details)};t.CometChatException=o},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.Me=t.User=void 0;var r=n(2),i=n(10),a=n(1),E=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.hasBlockedMe=!1,this.blockedByMe=!1,this.deactivatedAt=0,1===e.length)typeof e[0]===a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?this.uid=e[0]:(this.uid=e[0].uid,this.name=e[0].name,e[0].authToken&&(this.authToken=e[0].authToken),e[0].avatar&&(this.avatar=e[0].avatar),e[0].lastActiveAt&&(this.lastActiveAt=e[0].lastActiveAt),e[0].link&&(this.link=e[0].link),e[0].metadata&&(this.metadata=e[0].metadata),e[0].role&&(this.role=e[0].role),e[0].statusMessage&&(this.statusMessage=e[0].statusMessage),e[0].status&&"offline"!==e[0].status?this.status="online":this.status="offline",e[0].tags&&(this.tags=e[0].tags),e[0].deactivatedAt&&(this.deactivatedAt=e[0].deactivatedAt));else{if(2!==e.length)throw new r.CometChatException(i.ERRORS.PARAMETER_MISSING);this.uid=e[0],this.name=e[1]}}return e.prototype.getUid=function(){return this.uid.toString()},e.prototype.setUid=function(e){this.uid=e},e.prototype.getName=function(){return this.name.toString()},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getAuthToken=function(){return this.authToken},e.prototype.setAuthToken=function(e){this.authToken=e},e.prototype.getAvatar=function(){return this.avatar},e.prototype.setAvatar=function(e){this.avatar=e},e.prototype.getLastActiveAt=function(){return this.lastActiveAt},e.prototype.setLastActiveAt=function(e){this.lastActiveAt=e},e.prototype.getLink=function(){return this.link},e.prototype.setLink=function(e){return this.link=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getRole=function(){return this.role},e.prototype.setRole=function(e){this.role=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getStatusMessage=function(){return this.statusMessage},e.prototype.setStatusMessage=function(e){this.statusMessage=e},e.prototype.setBlockedByMe=function(e){this.blockedByMe=e},e.prototype.getBlockedByMe=function(){return this.blockedByMe},e.prototype.setHasBlockedMe=function(e){this.hasBlockedMe=e},e.prototype.getHasBlockedMe=function(){return this.hasBlockedMe},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.setDeactivatedAt=function(e){this.deactivatedAt=e},e.prototype.getDeactivatedAt=function(){return this.deactivatedAt},e}(),c=function(n){function e(e){var t=n.call(this,e)||this;return t.wsChannel=e.wsChannel,e.jwt&&(t.jwt=e.jwt),e.fat&&(t.fat=e.fat),t}return s(e,n),e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.getJWT=function(){return this.jwt},e.prototype.getFat=function(){return this.fat},e}(t.User=E);t.Me=c},function(e,t,n){"use strict";t.__esModule=!0,t.KEYS=t.AUTH=t.MESSAGE=t.PRESENCE=t.INTERACTION_RECEIPT=t.RECEIPTS=t.TRANSIENT_MESSAGE=t.MESSAGE_REACTION=t.TYPING_INDICATOR=t.LOGOUT_REASON=t.LOGOUT_CODE=t.READY_STATE=t.WS=void 0,t.WS={protocol:"wss://"},t.READY_STATE={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,INVALID_JWT:4},t.LOGOUT_CODE=1e3,t.LOGOUT_REASON="User logged out",t.TYPING_INDICATOR={TYPE:"typing_indicator",ACTION:{STARTED:"started",ENDED:"ended"}},t.MESSAGE_REACTION={TYPE:"reaction",ACTION:{ADDED:"message_reaction_added",REMOVED:"message_reaction_removed"}},t.TRANSIENT_MESSAGE={TYPE:"transient_message"},t.RECEIPTS={TYPE:"receipts",ACTION:{READ:"read",DELIVERED:"delivered",READ_BY_ALL:"readByAll",DELIVERED_TO_ALL:"deliveredToAll"},RECEIPT_TYPE:{READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERY_TO_ALL_RECEIPT:"deliveredToAll"}},t.INTERACTION_RECEIPT={TYPE:"interaction_completed"},t.PRESENCE={TYPE:"presence",ACTION:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline"}},t.MESSAGE={TYPE:"message"},t.AUTH={TYPE:"auth"},t.KEYS={TYPE:"type",ACTION:"action",APP_ID:"appId",RECEIVER:"receiver",RECEIVER_TYPE:"receiverType",DEVICE_ID:"deviceId",BODY:"body",USER:"user",METADATA:"metadata",MESSAGE_ID:"messageId",TIMESTAMP:"timestamp",STATUS:"status",CODE:"code",SENDER:"sender",MESSAGE_SENDER:"messageSender",PRESENCE_SUBSCRIPTION:"presenceSubscription",AUTH:"auth",PING:"ping",DATA:"data",PARAMS:"params",ACK:"ack",PONG:"pong",INTERACTIONS:"interactions",REACTION:"reaction",REACTED_AT:"reactedAt",REACTED_BY:"reactedBy",ID:"id",UID:"uid",CONVERSATION_ID:"conversationId",PARENT_ID:"parentId"}},function(e,t,n){"use strict";var u=this&&this.__assign||function(){return(u=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.postData=t.makeAdminApiCall=t.makeApiCall=void 0;var p=n(38),C=n(6),S=n(0),l=n(2),_=n(10),T=n(1);function d(n,e,o,t,s){var r;return void 0===n&&(n=""),void 0===e&&(e="GET"),void 0===o&&(o={}),void 0===t&&(t={}),o=S.isFalsy(o)?void 0:("GET"==e&&(n+="?",Object.keys(o).map(function(e,t){n=t===Object.keys(o).length-1?n+e+"="+o[e]:n+e+"="+o[e]+"&"}),o=void 0),s&&(r=new FormData,Object.keys(o).map(function(t){if("data"!=t){if("tags"==t)o[t].forEach(function(e){r.append(t+"[]",e)});else if("metadata"!=t)if("files"===t)for(var e=0;e<o[t].length;e++)r.append(t+"[]",o[t][e]);else"object"==typeof o[t]?r.append(t,JSON.stringify(o[t])):r.append(t,o[t])}else r.append(t,JSON.stringify(o[t]))})),JSON.stringify(o)),fetch(n,{method:e,mode:"cors",cache:"no-cache",headers:t,redirect:"follow",referrer:"no-referrer",body:s?r:o})}t.makeApiCall=function(s,r,i,a,E){void 0===s&&(s=""),void 0===r&&(r={}),void 0===i&&(i={});var c=C.CometChat.getInstance(C.CometChat.getAppId());return new Promise(function(n,o){try{p.getEndPoint(s,r).then(function(e){var t=u({resource:C.CometChat.getSessionId(),appId:C.CometChat.getAppId(),Accept:"application/json",sdk:S.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion)},E);a||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAIApi")&&e.isAIApi&&(t.onbehalfofuser=r.onbehalfofuser),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?c.getApiKey()?t.apiKey=c.getApiKey():o({error:{code:"API_KEY_NOT_SET",message:"An apiKey is needed to use the "+s+" api.",name:"API_KEY_NOT_SET"}}):c.getAuthToken()?t.authToken=c.getAuthToken():o({error:{code:"USER_NOT_LOGED_IN",message:"An authToken is need to use the "+s+" end-point. PS- We are aware of the spelling mistake, but in order to maintain backward compatibility we cannot change it :(",name:"User not logged-in"}}),d(e.endpoint,e.method,i,t,a).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty("data"))e.data.hasOwnProperty("authToken")&&C.CometChat.setAuthToken(e.data.authToken),n(e);else{if(e.hasOwnProperty("error")){var t=e.error;t.hasOwnProperty("code")&&t.code===T.API_ERROR_CODES.AUTH_ERR_AUTH_TOKEN_NOT_FOUND&&C.CometChat.getInstance().internalLogout().then(function(){S.Logger.log("CometChat: makeApiCall","User logged out")})}o(e)}}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(t)})}).catch(function(e){return o})}catch(e){o(new l.CometChatException(e))}})},t.makeAdminApiCall=function(s,e,r,i){void 0===s&&(s=""),void 0===e&&(e={}),void 0===r&&(r={});var a=C.CometChat.getInstance(C.CometChat.getAppId());return new Promise(function(n,o){p.getEndPoint(s,e).then(function(e){var t={appId:C.CometChat.getAppId(),Accept:"application/json",sdk:S.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion)};i||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?a.getApiKey()?t.apiKey=a.getApiKey():o({error:"An apiKey is need to use the "+s+" api."}):a.getAuthToken()?t.authToken=a.getAuthToken():o({error:"An authToken is need to use the "+s+" api."}),d(e.endpoint,e.method,r,t,i).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("data")?(e.data.hasOwnProperty("authToken")&&C.CometChat.setAuthToken(e.data.authToken),n(e)):o(e)}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(t)})}).catch(function(e){return o})})},t.postData=d},function(e,t,n){"use strict";var S=this&&this.__assign||function(){return(S=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},E=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},c=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};t.__esModule=!0,t.CometChat=void 0;var u=n(37),T=n(0),d=n(2),h=n(5),l=n(3),R=n(15),p=n(22),C=n(7),g=n(20),A=n(11),I=n(12),f=n(1),a=n(9),O=n(18),r=n(31),o=n(25),s=n(29),N=n(16),m=n(10),i=n(28),P=n(56),y=n(57),M=n(58),v=n(59),L=n(61),U=n(62),D=n(33),Y=n(34),G=n(45),w=n(24),K=n(43),B=n(64),F=n(65),b=n(66),x=n(44),V=n(32),J=n(23),k=n(39),H=n(40),_=n(67),W=n(47),j=n(4),X=n(77),q=n(38),Q=n(36),Z=n(17),z=n(49),$=n(50),ee=n(26),te=n(41),ne=n(27),oe=n(46),se=n(81),re=n(82),ie=n(21),ae=n(48),Ee=n(35),ce=n(83),ue=n(84),pe=_.WSConnectionHelper.getInstance(),Ce=W.ListenerHandlers.getInstance(),Se=function(){function _(e){var n=this;try{_.appId=e,_.localStorage=R.LocalStorage.getInstance(),_.keyStore=r.KeyStore.getInstance(),Z.AppState.addEventListener("change",function(e){var t;_.appSettings&&(_.appSettings.shouldAutoEstablishSocketConnection()?"active"===e?(_.isAppInactive=!1,_.connect(),_.callWaitTimer&&n.clearCallWaitTimer()):(_.isAppInactive=!0,(null===(t=null==_?void 0:_.getActiveCall())||void 0===t?void 0:t.getStatus())===f.CallConstants.CALL_STATUS.INITIATED?n.startCallWaitTimer():_.disconnectInternally()):"active"===e?(_.isAppInactive=!1,!z.checkConnection(pe.connection)&&_.disconnectedByUser||_.startAnalyticsPingTimer()):(_.isAppInactive=!0,_.clearAnalyticsPingTimer()))})}catch(e){T.Logger.error("CometChat: constructor",e)}}return _.ping=function(e){var t=e||{},n=t.onError,o=t.onSuccess;this.currentConnectionStatus===f.CONNECTION_STATUS.CONNECTED?_.user?pe.pingWS({onError:n,onSuccess:o}):n&&n(new d.CometChatException({code:f.Errors.ERROR_USER_NOT_LOGGED_IN,message:f.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE})):n&&n(new d.CometChatException(f.ReceiptErrors.NO_WEBSOCKET_CONNECTION))},_.prototype.startCallWaitTimer=function(){var e=this;_.callWaitTimer=setInterval(function(){try{1<_.callWaitTime?_.callWaitTime=_.callWaitTime-1:1===_.callWaitTime&&(_.disconnectInternally(),e.clearCallWaitTimer())}catch(e){T.Logger.error("CometChat: startCallWaitTimer",e)}},1e3)},_.prototype.clearCallWaitTimer=function(){try{clearInterval(_.callWaitTimer),_.callWaitTime=30}catch(e){T.Logger.error("CometChat: clearCallWaitTimer",e)}},_.setAuthToken=function(e){try{_.authToken=e}catch(e){T.Logger.error("CometChat: setAuthToken",e)}},_.prototype.getAuthToken=function(){try{return _.authToken}catch(e){T.Logger.error("CometChat: getAuthToken",e)}},_.getAppId=function(){try{return _.appId}catch(e){T.Logger.error("CometChat: getAppId",e)}},_.prototype.getApiKey=function(){try{return _.apiKey}catch(e){T.Logger.error("CometChat: getApiKey",e)}},_.getMode=function(){try{return _.mode}catch(e){T.Logger.error("CometChat: getMode",e)}},_.setMode=function(e){try{_.mode=e}catch(e){T.Logger.error("CometChat: getMode",e)}},_.getSessionId=function(){try{return _.sessionId}catch(e){T.Logger.error("CometChat: getSessionId",e)}},_.didAnalyticsPingStart=function(){try{return _.isAnalyticsPingStarted}catch(e){T.Logger.error("CometChat: didAnalyticsPingStart",e)}},_.init=function(s,e){var o=this;return void 0===s&&(s=""),new Promise(function(n,t){try{"object"==typeof s&&(s.hasOwnProperty("appId")&&(s=s.appId),s.hasOwnProperty("appSettings")&&(e=s.appSettings)),T.isFalsy(e)?e=(new F.AppSettingsBuilder).setRegion(F.AppSettings.REGION_EU).build():e.getRegion()==F.AppSettings.REGION_PRIVATE&&(e.region=s),o.appSettings=e,T.isFalsy(s)?t(new d.CometChatException(m.INIT_ERROR.NO_APP_ID)):(o.initialzed=!0,_.appId=s,_.getInstance(s),_.sessionId=f.APPINFO.platform+"-"+f.APPINFO.sdkVersionWithUnderScore+"-"+ue()+"-"+(new Date).getTime(),R.LocalStorage.getInstance().get(f.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e)_.appId=s,_.getInstance(s),R.LocalStorage.getInstance().set(f.LOCAL_STORE.KEY_APP_ID,s),n(!0);else{var t=e.toLocaleString();t===s?(_.appId=t,_.getInstance(t),R.LocalStorage.getInstance().get(f.LOCAL_STORE.KEY_USER).then(function(e){e?(_.isLoggedOut=!1,_.user=new l.Me(e),_.setAuthToken(_.user.getAuthToken()),e.jwt&&(_.jwt=e.jwt),new se.PostDetails,n(!0),R.LocalStorage.getInstance().get(f.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(e){if(e.hasOwnProperty(f.APP_SETTINGS.KEYS.APP_VERSION)){var t=parseInt(f.APPINFO.sdkVersion.charAt(1));e[f.APP_SETTINGS.KEYS.APP_VERSION]<t&&3!==e[f.APP_SETTINGS.KEYS.APP_VERSION]&&(o.appSettings.shouldAutoEstablishSocketConnection()||(_.shouldConnectToWS=!1),_.getInstance().internalRestart(_.user.getAuthToken()))}else o.appSettings.shouldAutoEstablishSocketConnection()||(_.shouldConnectToWS=!1),_.getInstance().internalRestart(_.user.getAuthToken());e[f.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(_.SECURED_MEDIA_HOST=e[f.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]),e[f.APP_SETTINGS.KEYS.MODE]&&(_.mode=e[f.APP_SETTINGS.KEYS.MODE]),e[f.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(_.settingsHash=e[f.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[f.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(_.settingsHashReceivedAt=e[f.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),_.isAnalyticsDisabled=!!e[f.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],_.didAnalyticsPingStart()||_.isAnalyticsDisabled||!o.appSettings.shouldAutoEstablishSocketConnection()||(_.pingAnalytics(),_.startAnalyticsPingTimer()),pe&&!pe.connection&&o.appSettings.shouldAutoEstablishSocketConnection()&&(_.isConnectingFromInit=!0,_.WSLogin(_.user))}})):n(!0)})):o.clearCache().then(function(){_.apiKey=void 0,_.user=void 0,_.authToken=void 0,_.cometChat=void 0,_.mode=void 0,pe.WSLogout(),_.appId=s,R.LocalStorage.getInstance().set(f.LOCAL_STORE.KEY_APP_ID,s),_.getInstance(s),n(!0)})}r.KeyStore.getInstance().get(f.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var t=ue(),n=(new Date).getTime(),o=s+"_"+t+"_"+n;r.KeyStore.getInstance().set(f.LOCAL_STORE.KEY_DEVICE_ID,o)}})}))}catch(e){t(new d.CometChatException(e))}})},_.isInitialized=function(){try{return this.initialzed}catch(e){T.Logger.error("CometChat: isInitialized",e)}},_.getInstance=function(e){try{return this.cometChat||(this.cometChat=new _(e)),this.cometChat}catch(e){T.Logger.error("CometChat: getInstance",e)}},_.registerTokenForPushNotification=function(C,S){var l=this;return new Promise(function(u,p){try{_.keyStore.get(f.LOCAL_STORE.KEY_DEVICE_ID).then(function(c){T.getAppSettings().then(function(e){var t="",n=c,o=f.APPINFO.platform,s=f.APPINFO.sdkVersion,r=e[f.APP_SETTINGS.KEYS.CHAT_API_VERSION];if(navigator&&(t=navigator.userAgent),null==n){var i=ue(),a=(new Date).getTime();n=l.appId+"_"+i+"_"+a,_.keyStore.set(f.LOCAL_STORE.KEY_DEVICE_ID,n)}var E={platform:o,deviceId:n,appInfo:{version:s,apiVersion:r,userAgent:t,pushNotification:{fcmDeviceToken:C,settings:S}}};h.makeApiCall("updateMyDetails",{},E,!1).then(function(e){u("Token Registration successful")},function(e){p(new d.CometChatException(e.error))}).catch(function(e){p(new d.CometChatException(e))})},function(e){return p(new d.CometChatException(e))})})}catch(e){p(new d.CometChatException(e))}})},_.pushToLoginListener=function(t,n){Ce.loginHandlers.map(function(e){try{if(e._eventListener)switch(n){case"Login_Success":T.isFalsy(e._eventListener.loginSuccess)||e._eventListener.loginSuccess(t);break;case"Login_Failure":T.isFalsy(e._eventListener.loginFailure)||e._eventListener.loginFailure(t);break;case"Logout_Success":T.isFalsy(e._eventListener.logoutSuccess)||e._eventListener.logoutSuccess()}}catch(e){T.Logger.error("ConnectionHandlers: onConnected Status",e)}})},_.login=function(){for(var E=this,c=[],e=0;e<arguments.length;e++)c[e]=arguments[e];return new Promise(function(i,a){try{if(_.loginInProgress){_.isLoggedOut=!0;var t=new d.CometChatException(m.LOGIN_ERROR.REQUEST_IN_PROGRESS);return a(t)}_.loginInProgress=!0,_.isConnectingFromInit=!1,_.localStorage.get(f.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e){var t=new d.CometChatException(m.LOGIN_ERROR.NOT_INITIALIZED);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}var n=e.toLocaleString();if(E.getInstance(n),_.appId=n,R.LocalStorage.getInstance().set(f.LOCAL_STORE.KEY_APP_ID,n),"object"==typeof c[0]){var o=c[0];c[0].hasOwnProperty("authToken")?c[0]=o.authToken:c[0].hasOwnProperty("username")&&c[0].hasOwnProperty("apiKey")&&(c[0]=o.username,c[1]=o.apiKey)}if(2==c.length){if(T.isFalsy(c[0])||T.isFalsy(c[1])){t=new d.CometChatException(m.ERRORS.PARAMETER_MISSING);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}}else{if(1!=c.length){t=new d.CometChatException(m.ERRORS.PARAMETER_MISSING);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}if(T.isFalsy(c[0])){var t=new d.CometChatException(m.ERRORS.PARAMETER_MISSING);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}}if(T.isFalsy(E.getAppId())){t=new d.CometChatException(m.LOGIN_ERROR.NOT_INITIALIZED);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}return _.localStorage.get(f.LOCAL_STORE.KEY_USER).then(function(r){if(2==c.length){_.apiKey=c[1];var e=c[0];if(null!=r&&r.uid!==c[0])_.localStorage.clearStore().then(function(){pe.WSLogout(),_.generateAuthToken(e).then(function(e){_.user=new l.Me(e),_.setAuthToken(_.user.getAuthToken()),_.getLoggedInUser().then(function(e){(_.user=new l.Me(e)).setAuthToken(_.authToken),_.setAuthToken(_.user.getAuthToken());var t=_.user;t.setStatus(f.PresenceConstatnts.STATUS.ONLINE),_.localStorage.set("user",t);var n=new l.User(t);i(n),_.isConnectingFromInit||_.internalRestart||(_.pushToLoginListener(n,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.didAnalyticsPingStart()||_.isAnalyticsDisabled||!_.appSettings.shouldAutoEstablishSocketConnection()||(_.pingAnalytics(),_.startAnalyticsPingTimer()),_.isLoggedOut=!1,(_.appSettings.shouldAutoEstablishSocketConnection()||_.internalRestart)&&_.shouldConnectToWS&&_.WSLogin(_.user)},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})});else{if(!T.isFalsy(_.authToken)){var t=new l.User(E.user);return _.internalRestart||(_.pushToLoginListener(t,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.isLoggedOut=!1,i(t)}if(!T.isFalsy(e)){if(T.isFalsy(_.apiKey)){var n=new d.CometChatException(m.LOGIN_ERROR.UNAUTHORISED);return _.internalRestart||_.pushToLoginListener(n,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(n)}E.generateAuthToken(e).then(function(e){E.user=new l.Me(e),E.setAuthToken(_.user.getAuthToken()),E.getLoggedInUser().then(function(e){E.user=new l.Me(e),E.user.setAuthToken(_.authToken),E.setAuthToken(E.user.getAuthToken()),pe.WSLogout();var t=E.user;t.setStatus(f.PresenceConstatnts.STATUS.ONLINE),E.localStorage.set("user",t);var n=new l.User(t);i(n),_.isConnectingFromInit||_.internalRestart||(_.pushToLoginListener(n,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.didAnalyticsPingStart()||_.isAnalyticsDisabled||!_.appSettings.shouldAutoEstablishSocketConnection()||(_.pingAnalytics(),_.startAnalyticsPingTimer()),_.isLoggedOut=!1,(_.appSettings.shouldAutoEstablishSocketConnection()||_.internalRestart)&&_.shouldConnectToWS&&E.WSLogin(E.user)},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})}}}else _.authToken=c[0],E.getLoggedInUser().then(function(e){if(e.authToken!=c[0]){var o=E;o.localStorage.clearStore().then(function(){pe.WSLogout(),o.getLoggedInUser().then(function(e){(_.user=new l.Me(e)).setAuthToken(_.authToken),_.setAuthToken(_.user.getAuthToken());var t=_.user;t.setStatus(f.PresenceConstatnts.STATUS.ONLINE),o.localStorage.set("user",t);var n=new l.User(t);i(n),_.isConnectingFromInit||_.internalRestart||(_.pushToLoginListener(n,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.didAnalyticsPingStart()||_.isAnalyticsDisabled||!_.appSettings.shouldAutoEstablishSocketConnection()||(_.pingAnalytics(),_.startAnalyticsPingTimer()),_.isLoggedOut=!1,(_.appSettings.shouldAutoEstablishSocketConnection()||_.internalRestart)&&_.shouldConnectToWS&&_.WSLogin(new l.Me(e))},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})})}else{if(r){var t=new l.User(e);return _.internalRestart||(_.pushToLoginListener(t,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.isLoggedOut=!1,i(t)}(_.user=new l.Me(e)).setAuthToken(_.authToken),_.setAuthToken(_.user.getAuthToken());var n=_.user;n.setStatus(f.PresenceConstatnts.STATUS.ONLINE),_.localStorage.set("user",n);var s=new l.User(n);i(s),_.isConnectingFromInit||_.internalRestart||(_.pushToLoginListener(s,"Login_Success"),new se.PostDetails),_.loginInProgress=!1,_.didAnalyticsPingStart()||_.isAnalyticsDisabled||!_.appSettings.shouldAutoEstablishSocketConnection()||(_.pingAnalytics(),_.startAnalyticsPingTimer()),_.isLoggedOut=!1,(_.appSettings.shouldAutoEstablishSocketConnection()||_.internalRestart)&&_.shouldConnectToWS&&_.WSLogin(new l.Me(e))}},function(e){return _.internalRestart||_.pushToLoginListener(e,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(e)})})})}catch(e){t=new d.CometChatException(e);return _.internalRestart||_.pushToLoginListener(t,"Login_Failure"),_.loginInProgress=!1,_.isLoggedOut=!0,a(t)}})},_.sendMessage=function(a){var e=this;return new Promise(function(r,i){return E(e,void 0,void 0,function(){var t,n,o,s=this;return c(this,function(e){try{return a instanceof g.TextMessage||a instanceof p.MediaMessage||a instanceof w.CustomMessage||a instanceof ee.InteractiveMessage||(a=a[f.MessageConstatnts.KEYS.ATTATCHMENT]?(t=f.MessageConstatnts.TYPE.FILE,T.isImage(a[f.MessageConstatnts.KEYS.ATTATCHMENT])?t=f.MessageConstatnts.TYPE.IMAGE:T.isAudio(a[f.MessageConstatnts.KEYS.ATTATCHMENT])?t=f.MessageConstatnts.TYPE.AUDIO:T.isVideo(a[f.MessageConstatnts.KEYS.ATTATCHMENT])&&(t=f.MessageConstatnts.TYPE.VIDEO),new p.MediaMessage(a[f.MessageConstatnts.KEYS.RECEIVER_ID],a[f.MessageConstatnts.KEYS.ATTATCHMENT],t,a[f.MessageConstatnts.KEYS.RECEIVER_TYPE])):new g.TextMessage(a[f.MessageConstatnts.KEYS.RECEIVER_ID],a[f.MessageConstatnts.KEYS.TEXT],a[f.MessageConstatnts.KEYS.RECEIVER_TYPE])),(n=T.validateMessage(a))instanceof d.CometChatException?(i(n),[2]):(a.receiver=a.receiverId,delete a.receiverId,o=a.parentMessageId,[2,h.makeApiCall(o?"sendMessageInThread":"sendMessage",o?{parentId:o}:{},a,a instanceof p.MediaMessage).then(function(n){return E(s,void 0,void 0,function(){var t;return c(this,function(e){return t=A.MessageController.trasformJSONMessge(n.data),r(t),[2]})})},function(e){i(new d.CometChatException(e.error))})])}catch(e){i(new d.CometChatException(e))}return[2]})})})},_.sendDirectMessage=function(e){try{return Object.assign(e,{receiverType:f.MessageConstatnts.RECEIVER_TYPE.USER}),this.sendMessage(e)}catch(e){T.Logger.error("CometChat: sendDirectMessage",e)}},_.sendGroupMessage=function(e){try{return Object.assign(e,{receiverType:f.MessageConstatnts.RECEIVER_TYPE.GROUP}),this.sendMessage(e)}catch(e){T.Logger.error("CometChat: sendGroupMessage",e)}},_.sendMediaMessage=function(e){try{return this.sendMessage(e)}catch(e){T.Logger.error("CometChat: sendMediaMessage",e)}},_.sendCustomMessage=function(e){try{return this.sendMessage(e)}catch(e){T.Logger.error("CometChat: sendCustomMessage",e)}},_.sendInteractiveMessage=function(e){try{return this.sendMessage(e)}catch(e){T.Logger.error("CometChat: sendInteractiveMessage",e)}},_.getLastDeliveredMessageId=function(){return E(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,D.MessageListnerMaping.getInstance().get(f.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST)];case 1:return[2,e.sent()];case 2:return t=e.sent(),T.Logger.error("CometChat: getLastDeliveredMessageId",t),[3,3];case 3:return[2]}})})},_.startTyping=function(e){try{if(T.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,o={};if(e instanceof Y.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(f.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[f.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(f.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[f.TYPING_NOTIFICATION.RECEIVER_TYPE]),e.hasOwnProperty(f.TYPING_NOTIFICATION.META)&&(o=e[f.TYPING_NOTIFICATION.META])}if(T.isFalsy(t))return;if(null==G.TypingNotificationController.getTypingStartedMap(t)){var s=_.getMode();return T.isFalsy(s)||s&&s!==f.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==f.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(pe.startTypingIndicator(t,n,o),G.TypingNotificationController.addTypingStarted(t),void G.TypingNotificationController.removeTypingEnded(t)):void 0}}catch(e){T.Logger.error("CometChat: startTyping",e)}},_.endTyping=function(e){try{if(T.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,o={};if(e instanceof Y.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(f.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[f.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(f.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[f.TYPING_NOTIFICATION.RECEIVER_TYPE]),n=n==this.RECEIVER_TYPE.USER?f.WS.CONVERSATION.TYPE.CHAT:f.WS.CONVERSATION.TYPE.GROUP_CHAT,e.hasOwnProperty(f.TYPING_NOTIFICATION.META)&&(o=e[f.TYPING_NOTIFICATION.META])}if(T.isFalsy(t))return;if(null==G.TypingNotificationController.getTypingEndedMap(t)){var s=_.getMode();return T.isFalsy(s)||s&&s!==f.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==f.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(pe.pauseTypingIndicator(t,n,o),G.TypingNotificationController.addTypingEnded(t),void G.TypingNotificationController.removeTypingStarted(t)):void 0}}catch(e){T.Logger.error("CometChat: endTyping",e)}},_.markAsRead=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(t,n){try{var e=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return n(new d.CometChatException(f.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(T.isFalsy(E[0])||"string"!=typeof E[0])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(e=E[0],T.isFalsy(E[1])||"string"!=typeof E[1])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],T.isFalsy(E[2])||"string"!=typeof E[2])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],T.isFalsy(E[3])||"string"!=typeof E[3])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsRead() expects either 1 or 4 arguments."))));if(T.isFalsy(E[0])||!(E[0]instanceof C.BaseMessage))return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];e=i.getId().toString(),o=(s=i.getReceiverType())===f.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===_.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=_.getMode();if(!(T.isFalsy(a)||a&&a!==f.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==f.APP_SETTINGS.KEYS.LIMITED_TRANSIENT))return n(new d.CometChatException(f.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED));if(_.getConnectionStatus()===f.CONNECTION_STATUS.CONNECTED)return pe.markAsRead(o,s,e,r),t();h.makeApiCall(s===f.MessageConstatnts.RECEIVER_TYPE.USER?"markAsReadForUser":"markAsReadForGroup",s===f.MessageConstatnts.RECEIVER_TYPE.USER?{uid:o}:{guid:o},{messageId:e}).then(function(e){return t(e)},function(e){return n(new d.CometChatException(e.error))})}catch(e){return T.Logger.error("CometChat: markAsRead",e),n(new d.CometChatException(f.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},_.markAsDelivered=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(t,n){try{var e=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return n(new d.CometChatException(f.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(T.isFalsy(E[0])||"string"!=typeof E[0])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(e=E[0],T.isFalsy(E[1])||"string"!=typeof E[1])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],T.isFalsy(E[2])||"string"!=typeof E[2])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],T.isFalsy(E[3])||"string"!=typeof E[3])return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsDelivered() expects either 1 or 4 arguments."))));if(T.isFalsy(E[0])||!(E[0]instanceof C.BaseMessage))return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];e=i.getId().toString(),o=(s=i.getReceiverType())===f.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===_.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=_.getMode();if(!(T.isFalsy(a)||a&&a!==f.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==f.APP_SETTINGS.KEYS.LIMITED_TRANSIENT))return n(new d.CometChatException(f.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED));if(_.getConnectionStatus()===f.CONNECTION_STATUS.CONNECTED)return pe.markAsDelivered(o,s,e,r),t();h.makeApiCall(s===f.MessageConstatnts.RECEIVER_TYPE.USER?"markAsDeliveredForUser":"markAsDeliveredForGroup",s===f.MessageConstatnts.RECEIVER_TYPE.USER?{uid:o}:{guid:o},{messageId:e}).then(function(e){return t(e)},function(e){return n(new d.CometChatException(e.error))})}catch(e){return T.Logger.error("CometChat: markAsDelivered",e),n(new d.CometChatException(f.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},_.markAsUnread=function(r){var i=this;return new Promise(function(t,n){try{var e=void 0;if(T.isFalsy(r)||!(r instanceof C.BaseMessage))return n(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));e=r.getId().toString();var o={},s="";r.getReceiverType()===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="markGroupMessagesAsUnread",o.guid=r.getReceiverId()):(s="markUserMessagesAsUnread",i.user&&r.getSender().getUid()===i.user.getUid()?o.uid=r.getReceiverId():o.uid=r.getSender().getUid()),h.makeApiCall(s,o,{messageId:e}).then(function(e){return t("Messages marked as unread successfully.")},function(e){return n(new d.CometChatException(e.error))})}catch(e){return T.Logger.error("CometChat: markAsUnread",e),n(new d.CometChatException(e))}})},_.sendTransientMessage=function(e){try{if(T.isFalsy(e))return;var t=void 0,n=void 0,o={};if(!(e instanceof Q.TransientMessage))return;if(t=e.getReceiverId(),n=e.getReceiverType(),o=e.getData(),T.isFalsy(t)||T.isFalsy(n))return;var s=_.getMode();return T.isFalsy(s)||s&&s!==f.APP_SETTINGS.KEYS.NO_TRANSIENT?void pe.sendTransientMessage(t,n,o):void 0}catch(e){T.Logger.error("CometChat: startTyping",e)}},_.getMessageDetails=function(e){return new Promise(function(t,n){try{T.isFalsy(e)?n(new d.CometChatException(m.ERRORS.PARAMETER_MISSING)):h.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data))},function(e){T.Logger.error("CometChat:GetMessageDetails:",e),n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.getMessageReceipts=function(o){return new Promise(function(t,n){try{var e=T.validateMsgId(o);if(e instanceof d.CometChatException)return void n(e);T.isFalsy(o)?n(new d.CometChatException(m.ERRORS.PARAMETER_MISSING)):h.makeApiCall("getMessageDetails",{messageId:o}).then(function(e){A.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new d.CometChatException(e))})},function(e){T.Logger.error("CometChat:GetMessageDetails:",e),n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var s=0;return new Promise(function(o,t){try{var e=T.validateHideMessagesFromBlockedUsers(n);if(e instanceof d.CometChatException)return void t(e);n&&(s=1),h.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:s}).then(function(e){var t={},n={};e.data.map(function(e){e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==f.MessageConstatnts.RECEIVER_TYPE.GROUP?n[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),o({users:t,groups:n})},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getUnreadMessageCountForAllUsers=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,t){try{var e=T.validateHideMessagesFromBlockedUsers(o);if(e instanceof d.CometChatException)return void t(e);o&&(s=1),h.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:f.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(S({},t))},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getUnreadMessageCountForAllGroups=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,t){try{var e=T.validateHideMessagesFromBlockedUsers(o);if(e instanceof d.CometChatException)return void t(e);o&&(s=1),h.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:f.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==f.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(S({},t))},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getUnreadMessageCountForUser=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=T.validateId(s,"user");if(e instanceof d.CometChatException)return void t(e);var o=T.validateHideMessagesFromBlockedUsers(r);if(o instanceof d.CometChatException)return void t(o);r&&(i=1),h.makeApiCall("getUserMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:s}).then(function(e){var t={};e.data.map(function(e){t[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(S({},t))},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getUnreadMessageCountForGroup=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=T.validateId(s,"group");if(e instanceof d.CometChatException)return void t(e);var o=T.validateHideMessagesFromBlockedUsers(r);if(o instanceof d.CometChatException)return void t(o);r&&(i=1),h.makeApiCall("getGroupMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:s}).then(function(e){var t={};e.data.map(function(e){e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==f.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[f.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(S({},t))},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.addReaction=function(o,s){return new Promise(function(n,t){try{var e=T.validateMsgId(o);if(e instanceof d.CometChatException)return void t(e);T.isFalsy(o)||T.isFalsy(s)?t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING)):h.makeApiCall("addReaction",{messageId:o,reaction:encodeURIComponent(s)}).then(function(e){var t=A.MessageController.trasformJSONMessge(e.data);n(t)},function(e){T.Logger.error("CometChat:addReaction:",e),t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.removeReaction=function(o,s){return new Promise(function(n,t){try{var e=T.validateMsgId(o);if(e instanceof d.CometChatException)return void t(e);T.isFalsy(o)||T.isFalsy(s)?t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING)):h.makeApiCall("removeReaction",{messageId:o,reaction:encodeURIComponent(s)}).then(function(e){var t=A.MessageController.trasformJSONMessge(e.data);n(t)},function(e){T.Logger.error("CometChat:removeReaction:",e),t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.editMessage=function(o){return new Promise(function(t,n){try{var e=T.validateMsgId(o.getId());if(e instanceof d.CometChatException)return void n(e);h.makeApiCall("updateMessage",{messageId:o.getId()},o).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.deleteMessage=function(o){return new Promise(function(t,n){try{var e=T.validateMsgId(o);if(e instanceof d.CometChatException)return void n(e);h.makeApiCall("deleteMessage",{messageId:o},{id:o}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.getOnlineUserCount=function(){return new Promise(function(o,s){try{T.getAppSettings().then(function(e){var t=T.format((new u.EndpointFactory).wsApi,T.getChatHost(e),T.format(f.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[f.APP_SETTINGS.KEYS.WS_API_VERSION])),n={appId:_.appId,Authorization:_.jwt,Accept:"application/json","Content-Type":"application/json"};h.postData(t,"POST",{},n,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ONLINE_MEMBER_COUNT_API.RESPONSE.ONLINE_USERS_COUNT]):s(new d.CometChatException(e.error))}).catch(function(){var e={error:m.FETCH_ERROR.ERROR_IN_API_CALL};return s(e)})},function(e){return s(new d.CometChatException(e))})}catch(e){return s(new d.CometChatException(e))}})},_.getOnlineGroupMemberCount=function(i){return new Promise(function(s,r){try{if(!i||0==i.length)return r(new d.CometChatException(f.ONLINE_MEMBER_COUNT_API.ERRORS.INVALID_GROUPLIST));T.getAppSettings().then(function(e){var t=T.format((new u.EndpointFactory).wsApi,T.getChatHost(e),T.format(f.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[f.APP_SETTINGS.KEYS.WS_API_VERSION])),n={groups:i},o={appId:_.appId,Authorization:_.jwt,Accept:"application/json","Content-Type":"application/json"};h.postData(t,"POST",n,o,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?s(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ONLINE_MEMBER_COUNT_API.RESPONSE.GROUPS]):r(new d.CometChatException(e.error))}).catch(function(){var e={error:m.FETCH_ERROR.ERROR_IN_API_CALL};return r(e)})},function(e){return r(new d.CometChatException(e))})}catch(e){return r(new d.CometChatException(e))}})},_.createUser=function(s,r){return new Promise(function(n,t){try{if(T.isFalsy(r))return void t(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));_.apiKey=r;var e=T.validateCreateUser(s);if(e instanceof d.CometChatException)return void t(e);if(!(s instanceof l.User)){var o=void 0;if(!s.hasOwnProperty(f.UserConstants.UID))return void t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(f.UserConstants.NAME))return void t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));o=new l.User(s[f.UserConstants.UID],s[f.UserConstants.NAME]),s.hasOwnProperty(f.UserConstants.AVATAR)&&o.setAvatar(s[f.UserConstants.AVATAR]),s.hasOwnProperty(f.UserConstants.ROLE)&&o.setRole(s[f.UserConstants.ROLE]),s.hasOwnProperty(f.UserConstants.META_DATA)&&o.setMetadata(s[f.UserConstants.META_DATA]),s.hasOwnProperty(f.UserConstants.LINK)&&o.setLink(s[f.UserConstants.LINK]),s.hasOwnProperty(f.UserConstants.STATUS_MESSAGE)&&o.setStatusMessage(s[f.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(f.UserConstants.TAGS)&&o.setTags(s[f.UserConstants.TAGS]),s=o}h.makeApiCall("createUser",{},s).then(function(e){var t=I.UsersController.trasformJSONUser(e.data);n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.updateUser=function(o,i){var a=this;return new Promise(function(s,t){try{if(T.isFalsy(i))return void t(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));_.apiKey=i;var e=T.validateUpdateUser(o);if(e instanceof d.CometChatException)return void t(e);if(!(o instanceof l.User)){var n=void 0;if(!o.hasOwnProperty(f.UserConstants.UID))return void t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));n=new l.User(o[f.UserConstants.UID]),o.hasOwnProperty(f.UserConstants.NAME)&&n.setName(o[f.UserConstants.NAME]),o.hasOwnProperty(f.UserConstants.AVATAR)&&n.setAvatar(o[f.UserConstants.AVATAR]),o.hasOwnProperty(f.UserConstants.ROLE)&&n.setRole(o[f.UserConstants.ROLE]),o.hasOwnProperty(f.UserConstants.META_DATA)&&n.setMetadata(o[f.UserConstants.META_DATA]),o.hasOwnProperty(f.UserConstants.LINK)&&n.setLink(o[f.UserConstants.LINK]),o.hasOwnProperty(f.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(o[f.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(f.UserConstants.TAGS)&&n.setTags(o[f.UserConstants.TAGS]),o=n}var r=o.uid;h.makeApiCall("updateUser",{uid:r},o).then(function(o){if(a.user&&r.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())R.LocalStorage.getInstance().get("user").then(function(e){if(e){var t=I.UsersController.trasformJSONUser(o.data),n=o.data;n.wsChannel=e.wsChannel,n.authToken=_.authToken,n.status=f.PresenceConstatnts.STATUS.ONLINE,e.jwt&&(n.jwt=e.jwt),_.user=new l.Me(n),a.localStorage.set("user",_.user),s(t)}});else{var e=I.UsersController.trasformJSONUser(o.data);s(e)}},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.updateCurrentUserDetails=function(s){var r=this;return new Promise(function(o,t){try{s.uid=r.user.uid;var e=T.validateUpdateUser(s);if(e instanceof d.CometChatException)return void t(e);if(!(s instanceof l.User)){var n=void 0;s.hasOwnProperty(f.UserConstants.UID)&&(n=new l.User(s[f.UserConstants.UID])),s.hasOwnProperty(f.UserConstants.NAME)&&n.setName(s[f.UserConstants.NAME]),s.hasOwnProperty(f.UserConstants.AVATAR)&&n.setAvatar(s[f.UserConstants.AVATAR]),s.hasOwnProperty(f.UserConstants.ROLE)&&n.setRole(s[f.UserConstants.ROLE]),s.hasOwnProperty(f.UserConstants.META_DATA)&&n.setMetadata(s[f.UserConstants.META_DATA]),s.hasOwnProperty(f.UserConstants.LINK)&&n.setLink(s[f.UserConstants.LINK]),s.hasOwnProperty(f.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(s[f.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(f.UserConstants.TAGS)&&n.setTags(s[f.UserConstants.TAGS]),s=n}h.makeApiCall("updateMyDetails",{},s).then(function(e){var t=I.UsersController.trasformJSONUser(e.data),n=_.user=new l.Me(e.data);n.setStatus(f.PresenceConstatnts.STATUS.ONLINE),_.localStorage.set("user",n),o(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getUser=function(o){return new Promise(function(n,t){try{"object"==typeof o&&o.hasOwnProperty("uid")&&(o=o.uid);var e=T.validateId(o,"user");if(e instanceof d.CometChatException)return void t(e);h.makeApiCall("user",{uid:o}).then(function(e){var t=I.UsersController.trasformJSONUser(e.data);n(t)}).catch(function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getLoggedInUser=function(){var C=this;return new Promise(function(u,p){try{_.localStorage.get(f.LOCAL_STORE.KEY_USER).then(function(e){if(e)_.user=new l.Me(e),u(_.user);else{var r="",i="",a=f.APPINFO.platform,E=f.APPINFO.sdkVersion,c=f.APPINFO.apiVersion;_.keyStore.get(f.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(i=e,navigator&&(r=navigator.userAgent),null==i){var t=ue(),n=(new Date).getTime();i=C.appId+"_"+t+"_"+n,_.keyStore.set(f.LOCAL_STORE.KEY_DEVICE_ID,i)}var o={version:E,apiVersion:c,userAgent:r};T.isFalsy(C.platform)||(o.platform=C.platform),T.isFalsy(C.language)||(o.language=C.language),T.isFalsy(C.resource)||(o.resource=C.resource);var s={platform:a,deviceId:i,appInfo:o};h.makeApiCall("updateMyDetails",{},s,!1).then(function(e){e.data.jwt&&(_.jwt=e.data.jwt);var t=e.data.settings;t&&(R.LocalStorage.getInstance().set("app_settings",t),t[f.APP_SETTINGS.KEYS.MODE]&&_.setMode(t[f.APP_SETTINGS.KEYS.MODE]),t[f.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(_.settingsHash=t[f.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[f.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(_.settingsHashReceivedAt=t[f.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),_.isAnalyticsDisabled=!!t[f.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],t[f.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(_.SECURED_MEDIA_HOST=t[f.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST])),u(new l.Me(e.data))},function(e){p(new d.CometChatException(e.error))}).catch(function(e){p(new d.CometChatException(e))})})}})}catch(e){p(new d.CometChatException(e))}})},_.getLoggedinUser=function(){return new Promise(function(t,n){try{_.localStorage.get(f.LOCAL_STORE.KEY_USER).then(function(e){t(e?new l.User(e):null)},function(e){t(null)})}catch(e){n(new d.CometChatException(e))}})},_.blockUsers=function(o){return new Promise(function(t,n){try{var e=T.validateArray(o,"blockUsers");if(e instanceof d.CometChatException)return void n(e);T.isFalsy(o)?n(new d.CometChatException(m.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):h.makeApiCall("blockUsers",{},{blockedUids:o}).then(function(e){t(e.data)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.unblockUsers=function(o){return new Promise(function(t,n){try{var e=T.validateArray(o,"unblockUsers");if(e instanceof d.CometChatException)return void n(e);T.isFalsy(o)?n(new d.CometChatException(m.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):h.makeApiCall("unblockUsers",{},{blockedUids:o}).then(function(e){t(e.data)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.getConversation=function(i,a){return new Promise(function(n,o){try{var e=T.validateConversationType(a);if(e instanceof d.CometChatException)return void o(e);var t=T.validateId(i,a);if(t instanceof d.CometChatException)return void o(t);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversation",s.guid=i):(r="getUserConversation",s.uid=i),h.makeApiCall(r,s).then(function(e){if(e.data){var t=e.data;n(V.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else o(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){o(new d.CometChatException(e.error))})}catch(e){o(new d.CometChatException(e))}})},_.tagConversation=function(i,a,E){return void 0===E&&(E=[]),new Promise(function(n,o){try{var e=T.validateConversationType(a);if(e instanceof d.CometChatException)return void o(e);var t=T.validateId(i,a);if(t instanceof d.CometChatException)return void o(t);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="updateGroupConversation",s.guid=i):(r="updateUserConversation",s.uid=i),h.makeApiCall(r,s,{tags:E}).then(function(e){if(e.data){var t=e.data;n(V.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else o(new d.CometChatException(JSON.parse(T.format(JSON.stringify(f.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){o(new d.CometChatException(e.error))})}catch(e){o(new d.CometChatException(e))}})},_.deleteConversation=function(i,a){return new Promise(function(t,n){try{var e=T.validateConversationType(a);if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(i,a);if(o instanceof d.CometChatException)return void n(o);var s={},r="";a=a.toLowerCase(),i=i.toLowerCase(),a===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="deleteGroupConversation",s.guid=i):(r="deleteUserConversation",s.uid=i),h.makeApiCall(r,s).then(function(e){t("Conversation deleted successfully.")},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.createGroup=function(s){return new Promise(function(t,n){try{var e=T.validateCreateGroup(s);if(e instanceof d.CometChatException)return void n(e);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(f.GroupConstants.KEYS.GUID))return void n(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(f.GroupConstants.KEYS.NAME))return void n(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));if(o=new a.Group(s[f.GroupConstants.KEYS.GUID],s[f.GroupConstants.KEYS.NAME],""),s.hasOwnProperty(f.GroupConstants.KEYS.TYPE))if(s[f.GroupConstants.KEYS.TYPE].toLocaleLowerCase()==f.GroupType.Password){if(!s.hasOwnProperty(f.GroupConstants.KEYS.PASSWORD))return void n(new d.CometChatException(m.GROUP_CREATION_ERRORS.EMPTY_PASSWORD));o.setType(f.GROUP_TYPE.PASSWORD),o.setPassword(s[f.GroupConstants.KEYS.PASSWORD])}else o.setType(s[f.GroupConstants.KEYS.TYPE]);else o.setType(f.GROUP_TYPE.PUBLIC);s.hasOwnProperty(f.GroupConstants.KEYS.ICON)&&o.setIcon(s[f.GroupConstants.KEYS.ICON]),s.hasOwnProperty(f.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[f.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(f.GroupConstants.KEYS.TAGS)&&o.setTags(s[f.GroupConstants.KEYS.TAGS]),s=o}h.makeApiCall("createGroup",{},s).then(function(e){O.GroupsController.trasformJSONGroup(e.data).setHasJoined(!0),t(O.GroupsController.trasformJSONGroup(e.data))},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.getGroup=function(o){return new Promise(function(t,n){try{"object"==typeof o&&o.hasOwnProperty("guid")&&(o=o.guid);var e=T.validateId(o,"group");if(e instanceof d.CometChatException)return void n(e);h.makeApiCall("getGroup",{guid:o}).then(function(e){t(O.GroupsController.trasformJSONGroup(e.data))},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.joinGroup=function(s,r,i){return void 0===r&&(r=f.GroupType.Public),void 0===i&&(i=""),new Promise(function(n,t){try{var e=T.validateJoinGroup(s,r,i);if(e instanceof d.CometChatException)return void t(e);var o=void 0;"object"==typeof s&&(s.hasOwnProperty(f.GroupConstants.KEYS.GUID)?(s.hasOwnProperty(f.GroupConstants.KEYS.TYPE)&&(r=s[f.GroupConstants.KEYS.TYPE],s[f.GroupConstants.KEYS.TYPE].toLocaleLowerCase()===f.GroupType.Password&&s.hasOwnProperty(f.GroupConstants.KEYS.PASSWORD)&&(i=s[f.GroupConstants.KEYS.PASSWORD])),s=s[f.GroupConstants.KEYS.GUID]):t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING))),o=T.isFalsy(i)?new a.Group(s,"name",r):new a.Group(s,"name",r,i),h.makeApiCall("joinGroup",o,o).then(function(e){var t=O.GroupsController.trasformJSONGroup(e.data[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ActionConstatnts.ACTION_KEYS.ENTITIES][f.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][f.ActionConstatnts.ACTION_KEYS.ENTITY]);t.setHasJoined(!0),n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.updateGroup=function(s){return new Promise(function(t,n){try{var e=T.validateUpdateGroup(s);if(e instanceof d.CometChatException)return void n(e);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(f.GroupConstants.KEYS.GUID))return void n(new d.CometChatException(m.ERRORS.PARAMETER_MISSING));o=new a.Group(f.GroupConstants.KEYS.GUID,"",""),s.hasOwnProperty(f.GroupConstants.KEYS.TYPE)?o.setType(s[f.GroupConstants.KEYS.TYPE]):(s[f.GroupConstants.KEYS.TYPE]=f.GROUP_TYPE.PUBLIC,o.setType[f.GROUP_TYPE.PUBLIC]),s.hasOwnProperty(f.GroupConstants.KEYS.NAME)&&o.setName(s[f.GroupConstants.KEYS.NAME]),s.hasOwnProperty(f.GroupConstants.KEYS.ICON)&&o.setIcon(s[f.GroupConstants.KEYS.ICON]),s.hasOwnProperty(f.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[f.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(f.GroupConstants.KEYS.TAGS)&&o.setTags(s[f.GroupConstants.KEYS.TAGS]),s=o}h.makeApiCall("updateGroup",s,s).then(function(e){t(O.GroupsController.trasformJSONGroup(e.data))},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.deleteGroup=function(o){return new Promise(function(t,n){try{var e=T.validateId(o,"group");if(e instanceof d.CometChatException)return void n(e);h.makeApiCall("deleteGroup",{guid:o}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.leaveGroup=function(o){return new Promise(function(t,n){try{var e=T.validateId(o,"group");if(e instanceof d.CometChatException)return void n(e);h.makeApiCall("leaveGroup",{guid:o}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.kickGroupMember=function(s,r){return new Promise(function(t,n){try{var e=T.validateId(s,"group");if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(r,"user");if(o instanceof d.CometChatException)return void n(o);h.makeApiCall("kickGroupMembers",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.updateGroupMemberScope=function(r,i,a){return new Promise(function(t,n){try{var e=T.validateId(r,"group");if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(i,"user");if(o instanceof d.CometChatException)return void n(o);var s=T.validateScope(a);if(s instanceof d.CometChatException)return void n(s);h.makeApiCall("changeScopeOfMember",{guid:r,uid:i},{scope:a}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.banGroupMember=function(s,r){return new Promise(function(t,n){try{var e=T.validateId(s,"group");if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(r,"user");if(o instanceof d.CometChatException)return void n(o);h.makeApiCall("banGroupMember",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.unbanGroupMember=function(s,r){return new Promise(function(t,n){try{var e=T.validateId(s,"group");if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(r,"user");if(o instanceof d.CometChatException)return void n(o);h.makeApiCall("unbanGroupMember",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.addMembersToGroup=function(i,a,E){var c=[],u=[],p=[],C=[];return new Promise(function(e,t){try{var n=T.validateId(i,"group");if(n instanceof d.CometChatException)return void t(n);var o=T.validateArray(a,"groupMembers");if(o instanceof d.CometChatException)return void t(o);if(E){var s=T.validateArray(E,"bannedMembers");if(s instanceof d.CometChatException)return void t(s)}T.isFalsy(a)&&T.isFalsy(E)?t(new d.CometChatException({})):T.isFalsy(a)||T.isFalsy(E)?T.isFalsy(a)?E.map(function(e){C.push(e)}):(a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){p.push(e.getUid())})):(a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==f.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){p.push(e.getUid())}),E.map(function(e){C.push(e)}));var r={};T.isFalsy(c)||(r=S(S({},r),{admins:c})),T.isFalsy(p)||(r=S(S({},r),{participants:p})),T.isFalsy(u)||(r=S(S({},r),{moderators:u})),T.isFalsy(C)||(r=S(S({},r),{usersToBan:C})),h.makeApiCall("addMemebersToGroup",{guid:i},r).then(function(t){var n={};Object.keys(t.data.admins).map(function(e){t.data.admins[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.admins[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.participants).map(function(e){t.data.participants[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.participants[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.moderators).map(function(e){t.data.moderators[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.moderators[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.usersToBan).map(function(e){t.data.usersToBan[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.usersToBan[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),e(n)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.transferGroupOwnership=function(s,r){return new Promise(function(n,t){try{var e=T.validateId(s,"group");if(e instanceof d.CometChatException)return void t(e);var o=T.validateId(r,"user");if(o instanceof d.CometChatException)return void t(o);h.makeApiCall("transferOwnership",{guid:s},{owner:r}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Ownership transferred to user "+r+" for the group with guid "+s+".",n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.createGroupWithMembers=function(i,a,E){var c=[],u=[],p=[],C=[];return new Promise(function(r,t){try{var e=T.validateCreateGroup(i);if(e instanceof d.CometChatException)return void t(e);if(a&&0<a.length){var n=T.validateArray(a,"groupMembers");if(n instanceof d.CometChatException)return void t(n);a.map(function(e){e.getScope()===f.GROUP_MEMBER_SCOPE.ADMIN&&c.push(e.getUid()),e.getScope()===f.GROUP_MEMBER_SCOPE.MODERATOR&&u.push(e.getUid()),e.getScope()===f.GROUP_MEMBER_SCOPE.PARTICIPANT&&p.push(e.getUid())})}if(E&&0<E.length){var o=T.validateArray(E,"bannedMembers");if(o instanceof d.CometChatException)return void t(o);E.map(function(e){C.push(e)})}var s={};s=S({},i),T.isFalsy(c)||(s.members=S(S({},s.members),{admins:c})),T.isFalsy(p)||(s.members=S(S({},s.members),{participants:p})),T.isFalsy(u)||(s.members=S(S({},s.members),{moderators:u})),T.isFalsy(C)||(s.members=S(S({},s.members),{usersToBan:C})),h.makeApiCall("createGroup",{},s).then(function(e){var t={members:{}},n=e.data.members.data?e.data.members.data:{admins:{},moderators:{},participants:{},usersToBan:{}};Object.keys(n.admins).map(function(e){n.admins[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.admins[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.participants).map(function(e){n.participants[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.participants[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.moderators).map(function(e){n.moderators[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.moderators[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.usersToBan).map(function(e){n.usersToBan[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.usersToBan[e][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][f.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),delete e.data.members;var o=e.data,s=O.GroupsController.trasformJSONGroup(o);s.setHasJoined(!0),t=S(S({},t),{group:s}),r(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.initiateCall=function(t){var e=this;return new Promise(function(n,o){if(T.isCallingComponentInstalled())if(null===e.getActiveCall())try{T.isFalsy(JSON.parse(JSON.stringify(t)).sender)?T.isFalsy(e.getActiveCall())?(t.setStatus(f.CallConstants.CALL_STATUS.INITIATED),t.receiver=t.receiverId.toString(),delete t.receiverId,h.makeApiCall("createCallSession",{},t).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);N.CallController.getInstance().initiateCall(t).then(function(e){n(t)}).catch(function(e){o(new d.CometChatException(e))})},function(e){o(new d.CometChatException(e.error))})):o(new d.CometChatException(f.CALL_ERROR.ERROR_IN_CALLING)):N.CallController.getInstance().initiateCall(t).then(function(e){n(Object.assign(t))}).catch(function(e){o(new d.CometChatException(e))})}catch(e){o(new d.CometChatException(e))}else o(new d.CometChatException(f.CALL_ERROR.CALL_ALREADY_INITIATED));else o(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))})},_.acceptCall=function(o){var s=this;return new Promise(function(n,t){if(T.isCallingComponentInstalled())if(null===s.getActiveCall())try{var e={};e[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.ONGOING,h.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);N.CallController.getInstance().onCallStarted(t),n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}else t(new d.CometChatException(f.CALL_ERROR.CANNOT_ACCEPT_CALL));else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))})},_.rejectCall=function(e,t){try{switch(t){case f.CallConstants.CALL_STATUS.REJECTED:return this.rejectIncomingCall(e);case f.CallConstants.CALL_STATUS.CANCELLED:return this.cancelCall(e);case f.CallConstants.CALL_STATUS.BUSY:return this.sendBusyResponse(e);default:return this.endCall(e,!0)}}catch(e){T.Logger.error("CometChat: rejectCall",e)}},_.clearActiveCall=function(){N.CallController.getInstance().clearActiveCall()},_.endCall=function(s,r){var i=this;return new Promise(function(n,t){if(T.isCallingComponentInstalled()){T.isFalsy(r)&&(r=!1);var o=i.getActiveCall();if(null!==o){if(o.getSessionId()===s)try{var e={};e[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.ENDED,o.getJoinedAt()&&(e[f.CallConstants.CALL_KEYS.CALL_JOINED_AT]=o.getJoinedAt()),h.makeApiCall("updateCallSession",{sessionid:s},e).then(function(e){r||N.CallController.getInstance().endSession();var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t),N.CallController.getInstance().getCallListner()&&N.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t),N.CallController.getInstance().endCall()},function(e){T.Logger.log("calling Log",{error:e}),r||N.CallController.getInstance().endSession(),o.setStatus(f.CallConstants.CALL_STATUS.ENDED),n(o),N.CallController.getInstance().getCallListner()&&N.CallController.getInstance().getCallListner()._eventListener.onCallEnded(o),N.CallController.getInstance().endCall()})}catch(e){t(new d.CometChatException(e))}}else r||N.CallController.getInstance().endSession(),N.CallController.getInstance().getCallListner()&&N.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),n(null)}else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))})},_.getActiveCall=function(){try{return N.CallController.getInstance().getActiveCall()}catch(e){T.Logger.error("CometChat: getActiveCall",e)}},_.getCallParticipantCount=function(E,c){return new Promise(function(i,a){try{T.getAppSettings().then(function(e){if(T.isFalsy(E))return a(new d.CometChatException(f.ProsodyApiErrors.INVALID_SESSIONID));if(T.isFalsy(c))return a(new d.CometChatException(f.ProsodyApiErrors.INVALID_TYPE));var t=e[f.APP_SETTINGS.KEYS.REGION],n={},o=e[f.APP_SETTINGS.KEYS.WEBRTC_HOST],s=e[f.APP_SETTINGS.KEYS.WEBRTC_API_SUBDOMAIN],r=T.format((new u.EndpointFactory).prosodyApi,s,o,f.PROSODY_API.PATH.ROOM_SIZE);"direct"===c.toLowerCase()&&(E=("v1."+t+"."+_.getAppId()+"."+E).toLowerCase()),n[f.PROSODY_API.QUERY_PARAMETERS.DOMAIN]=o,n[f.PROSODY_API.QUERY_PARAMETERS.ROOM]=E,h.postData(r,"GET",n,{},!1).then(function(e){return e.text()}).then(function(e){var t=e?JSON.parse(e):{};return t.hasOwnProperty(f.PROSODY_API.RESPONSE.PARTICIPANTS)?i(t[f.PROSODY_API.RESPONSE.PARTICIPANTS]):i(0)}).catch(function(){var e={error:m.FETCH_ERROR.ERROR_IN_API_CALL};return a(e)})},function(e){return a(new d.CometChatException(e))})}catch(e){return a(new d.CometChatException(e))}})},_.rejectIncomingCall=function(o){return new Promise(function(n,t){try{if(T.isCallingComponentInstalled()){var e={};e[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.REJECTED,h.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new d.CometChatException(e.error))})}else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new d.CometChatException(e))}})},_.cancelCall=function(s){var r=this;return new Promise(function(n,t){if(T.isCallingComponentInstalled()){var e=r.getActiveCall();if(null!==e&&e.getSessionId()===s&&e.getCallInitiator().getUid().toLocaleLowerCase()===_.user.getUid().toLocaleLowerCase())try{var o={};o[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.CANCELLED,h.makeApiCall("updateCallSession",{sessionid:s},o).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);N.CallController.getInstance().endCallSession(),n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}}else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))})},_.sendBusyResponse=function(o){return new Promise(function(n,t){try{if(T.isCallingComponentInstalled()){var e={};e[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.BUSY,h.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new d.CometChatException(e.error))})}else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new d.CometChatException(e))}})},_.sendUnansweredResponse=function(o){return new Promise(function(n,t){try{if(T.isCallingComponentInstalled()){var e={};e[f.CallConstants.CALL_KEYS.CALL_STATUS]=f.CallConstants.CALL_STATUS.UNANSWERED,h.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);pe.publishCallMessage(t),n(t)},function(e){t(new d.CometChatException(e.error))})}else t(new d.CometChatException(f.CALL_ERROR.MODULE_NOT_INSTALLED))}catch(e){t(new d.CometChatException(e))}})},_.addConnectionListener=function(e,t){try{Ce.addConnectionEventListener(e,t)}catch(e){T.Logger.error("CometChat: addConnectionListener",e)}},_.removeConnectionListener=function(e){try{Ce.removeConnectionEventListener(e)}catch(e){T.Logger.error("CometChat: removeConnectionListener",e)}},_.addMessageListener=function(e,t){try{Ce.addMessageEventListener(e,t)}catch(e){T.Logger.error("CometChat: addMessageListener",e)}},_.removeMessageListener=function(e){try{Ce.removeMessageEventListener(e)}catch(e){T.Logger.error("CometChat: removeMessageListener",e)}},_.addCallListener=function(e,t){try{Ce.addCallEventListener(e,t)}catch(e){T.Logger.error("CometChat: addCallListener",e)}},_.removeCallListener=function(e){try{Ce.removeCallEventListener(e)}catch(e){T.Logger.error("CometChat: removeCallListener",e)}},_.addUserListener=function(e,t){try{Ce.addUserEventListener(e,t)}catch(e){T.Logger.error("CometChat: addUserListener",e)}},_.removeUserListener=function(e){try{Ce.removeUserEventListener(e)}catch(e){T.Logger.error("CometChat: removeUserListener",e)}},_.addGroupListener=function(e,t){try{Ce.addGroupEventListener(e,t)}catch(e){T.Logger.error("CometChat: addGroupListener",e)}},_.removeGroupListener=function(e){try{Ce.removeGroupEventListener(e)}catch(e){T.Logger.error("CometChat: removeGroupListener",e)}},_.addLoginListener=function(e,t){try{Ce.addLoginEventListener(e,t)}catch(e){T.Logger.error("CometChat: addLoginListener",e)}},_.removeLoginListener=function(e){try{Ce.removeLoginEventListener(e)}catch(e){T.Logger.error("CometChat: removeLoginListener",e)}},_.generateAuthToken=function(p){var C=this;return new Promise(function(o,s){try{var r={},i="",a="",E=f.APPINFO.platform,c=f.APPINFO.sdkVersion,u=f.APPINFO.apiVersion;navigator&&(a=navigator.userAgent),_.keyStore.get(f.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==(i=e)){var t=ue(),n=(new Date).getTime();i=C.appId+"_"+t+"_"+n,_.keyStore.set(f.LOCAL_STORE.KEY_DEVICE_ID,i)}r={platform:E,deviceId:i,appInfo:{version:c,apiVersion:u,userAgent:a}},h.makeApiCall("authToken",{uid:p},r).then(function(e){o(e.data)}).catch(function(e){s(new d.CometChatException(e.error))})},function(e){T.Logger.error("Got error while fetching data from key store",e)})}catch(e){s(new d.CometChatException(e))}})},_.tryReconnectingToWS=function(){_.WSReconnectionInProgress||_.startWSReconnectionTimer()},_.prototype.makeWSConnection=function(){_.WSLogin(_.user)},_.prototype.accidentallyDisconnected=function(){_.currentConnectionStatus=f.CONNECTION_STATUS.CONNECTING,Ce.connectionHandlers.map(function(e){try{e._eventListener&&(T.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){T.Logger.error("ConnectionHandlers: inConnecting Status",e)}}),_.tryReconnectingToWS()},_.WSLogin=function(e){var o=this;pe.connection||pe.WSLogin(e.getJWT(),function(e,t){switch(e){case j.READY_STATE.CONNECTING:(n=_.getConnectionStatus())==f.CONNECTION_STATUS.DISCONNECTED&&(o.currentConnectionStatus=f.CONNECTION_STATUS.CONNECTING,Ce.connectionHandlers.map(function(e){try{e._eventListener&&(T.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){T.Logger.error("connectionHandlers: Connecting Status",e)}}));break;case j.READY_STATE.OPEN:(n=_.getConnectionStatus())==f.CONNECTION_STATUS.CONNECTING&&(o.currentConnectionStatus=f.CONNECTION_STATUS.CONNECTED,Ce.connectionHandlers.map(function(e){try{e._eventListener&&(T.isFalsy(e._eventListener.onConnected)||e._eventListener.onConnected()),o.onConnectionSuccess&&(o.onConnectionSuccess(),o.onConnectionSuccess=null)}catch(e){T.Logger.error("connectionHandlers: Connected Status",e)}})),_.WSReconnectionInProgress&&_.clearWSReconnectionTimer();break;case j.READY_STATE.CLOSING:break;case j.READY_STATE.CLOSED:var n=_.getConnectionStatus();1e3!==t.code&&(o.onConnectionError&&(o.onConnectionError(new d.CometChatException(f.ReceiptErrors.NO_WEBSOCKET_CONNECTION)),o.onConnectionError=null),Ce.connectionHandlers.map(function(e){try{e._eventListener&&(T.isFalsy(e._eventListener.onConnectionError)||e._eventListener.onConnectionError())}catch(e){T.Logger.error("connectionHandlers: ConnectionError Status",e)}})),n!==f.CONNECTION_STATUS.DISCONNECTED&&n!==f.CONNECTION_STATUS.CONNECTING&&(o.currentConnectionStatus=f.CONNECTION_STATUS.DISCONNECTED,Ce.connectionHandlers.map(function(e){try{e._eventListener&&(T.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected()),_.onDisconnectSuccess&&(_.onDisconnectSuccess(),_.onDisconnectSuccess=null)}catch(e){T.Logger.error("connectionHandlers: Disconnected Status",e)}})),pe.connection&&(pe.connection=null),_.isLoggedOut||_.disconnectedByUser||_.isAppInactive||o.tryReconnectingToWS()}})},_.pingAnalytics=function(){var c=this;try{_.keyStore.get("deviceId").then(function(E){T.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",o=E,s={version:f.SDKHeader.sdkVersion,apiVersion:e[f.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};T.isFalsy(c.resource)||(s.resource=c.resource),T.isFalsy(c.platform)||(s.platform=c.platform),T.isFalsy(c.language)||(s.language=c.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,uid:_.user.getUid(),userAgent:n,deviceId:o,platform:f.SDKHeader.platform};T.isFalsy(_.getSessionId())||(r.wsId=_.getSessionId());var i="https://"+e[f.APP_SETTINGS.KEYS.ANALYTICS_HOST]+"/"+e[f.APP_SETTINGS.KEYS.ANALYTICS_VERSION]+"/ping",a={appId:_.appId,sdk:T.format(f.SDKHeader.sdk,f.SDKHeader.platform,f.SDKHeader.sdkVersion),"Content-Type":"application/json"};_.settingsHash&&(a.settingsHash=_.settingsHash),_.settingsHashReceivedAt&&(a.settingsHashReceivedAt=_.settingsHashReceivedAt),_.jwt&&(a.Authorization="Bearer "+_.jwt),_.authToken&&(a.authToken=_.authToken),h.postData(i,"POST",r,a,!1).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_DATA))T.Logger.log("Analytics Ping Request Data",e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);else if(e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_ERROR)){var t=e[f.ResponseConstants.RESPONSE_KEYS.KEY_ERROR];T.Logger.log("Analytics Ping Request Error",new d.CometChatException(t));var n=t.code;if(n===f.Errors.ERR_SETTINGS_HASH_OUTDATED){var o=_.authToken;_.getInstance().internalRestart(o)}n===f.Errors.ERR_NO_AUTH&&c.updateJWT()}}).catch(function(e){T.Logger.error("CometChat: pingAnalytics Fetch Error",e)})},function(e){T.Logger.error("CometChat: pingAnalytics getSettings Error",e)})},function(e){T.Logger.error("CometChat: pingAnalytics getDeviceId Error",e)})}catch(e){T.Logger.error("CometChat: pingAnalytics",e)}},_.updateJWT=function(){h.makeApiCall("getMyDetails",{},{},!1).then(function(e){var t=e.data,n=t.settings,o=new l.Me(t);if(_.user=o,t.hasOwnProperty("jwt")&&t.jwt&&(_.jwt=t.jwt),R.LocalStorage.getInstance().set("user",o),n&&n[f.APP_SETTINGS.KEYS.SETTINGS_HASH]&&_.settingsHash!==n[f.APP_SETTINGS.KEYS.SETTINGS_HASH]){var s=_.getInstance().getAuthToken();_.getInstance().internalRestart(s)}T.Logger.log("CometChat: updateJWT response",e)},function(e){T.Logger.error("CometChat: updateJWT Fetch Error",e)}).catch(function(e){T.Logger.error("CometChat: updateJWT",e)})},_.startAnalyticsPingTimer=function(){var e=this;_.isAnalyticsPingStarted=!0,_.analyticsPingTimer=setInterval(function(){try{e.pingAnalytics()}catch(e){T.Logger.error("CometChat: startAnalyticsPingTimer",e)}},_.settingsInterval)},_.clearAnalyticsPingTimer=function(){try{_.isAnalyticsPingStarted=!1,clearInterval(_.analyticsPingTimer)}catch(e){T.Logger.error("CometChat: clearAnalyticsPingTimer",e)}},_.startWSReconnectionTimer=function(){_.WSReconnectionInProgress=!0,_.WSReconnectionTimer=setInterval(function(){try{_.WSLogin(_.user)}catch(e){T.Logger.error("CometChat: startWSReconnectionTimer",e)}},_.WSReconnectionTimerInterval)},_.clearWSReconnectionTimer=function(){_.WSReconnectionInProgress=!1,clearInterval(_.WSReconnectionTimer)},_.prototype.getJWT=function(r){return new Promise(function(o,s){try{q.getEndPoint("getJWT").then(function(e){var t={appId:_.appId,Accept:"application/json",authToken:_.authToken,resource:_.getSessionId(),sdk:T.format(f.SDKHeader.sdk,f.SDKHeader.platform,f.SDKHeader.sdkVersion),"Content-Type":"application/json"},n={};n[f.JWT_API.KEYS.PASSTHROUGH]=r,h.postData(e.endpoint,e.method,n,t,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new d.CometChatException(e.error))}).catch(function(e){var t={error:m.FETCH_ERROR.ERROR_IN_API_CALL};s(new d.CometChatException(t))})},function(e){s(new d.CometChatException(e))})}catch(e){s(new d.CometChatException(e))}})},_.getConnectionStatus=function(){return this.currentConnectionStatus},_.prototype.setConnectionStatus=function(e){_.currentConnectionStatus=e},_.isExtensionEnabled=function(r){return new Promise(function(o,s){try{if(T.isFalsy(r))return s(new d.CometChatException(f.ExtensionErrors.INVALID_EXTENSION));T.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.some(function(e){return e.id===r});return o(n)}return o(!1)}return s(new d.CometChatException(f.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return s(new d.CometChatException(e))})}catch(e){return s(new d.CometChatException(e))}})},_.isAIFeatureEnabled=function(e){return new Promise(function(n,t){try{if(T.isFalsy(e))return t(new d.CometChatException(f.AIFeatureError.INVALID_AI_FEATURE));var o=f.AI_FEATURE_ACCESSIBLE,s=f.AI_FEATURE_ENABLED,r=T.format(f.AI_SLUG_ACCESSIBLE,e),i=T.format(f.AI_SLUG_ENABLED,e);T.getAppSettings().then(function(e){if(null==e?void 0:e.parameters){var t=null==e?void 0:e.parameters;return t[o]&&t[s]&&t[r]&&t[i]?n(!0):n(!1)}return n(!1)},function(e){return t(new d.CometChatException(e))})}catch(e){return t(new d.CometChatException(e))}})},_.getExtensionDetails=function(i){return new Promise(function(s,r){try{if(T.isFalsy(i))return r(new d.CometChatException(f.ExtensionErrors.INVALID_EXTENSION));T.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.filter(function(e){return e.id===i});if(0<n.length){var o=new X.CCExtension(n[0]);return s(o)}return r(new d.CometChatException(f.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new d.CometChatException(f.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new d.CometChatException(f.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return r(new d.CometChatException(e))})}catch(e){return r(new d.CometChatException(e))}})},_.getAppSettings=function(){return new Promise(function(t,n){try{h.makeApiCall("appSettings").then(function(e){R.LocalStorage.getInstance().set(f.LOCAL_STORE.KEY_APP_SETTINGS,e.data),t(e.data)},function(e){n(new d.CometChatException(e.error))})}catch(e){n(new d.CometChatException(e))}})},_.isFeatureEnabled=function(s){return new Promise(function(n,o){try{if(T.isFalsy(s))return o(new d.CometChatException(f.FeatureRestrictionErrors.INVALID_FEATURE));T.getAppSettings().then(function(e){if(e.parameters){var t=e.parameters;return t.hasOwnProperty(s)?n(t[s]):n(!1)}return o(new d.CometChatException(f.FeatureRestrictionErrors.FEATURE_NOT_FOUND))},function(e){return o(new d.CometChatException(e))})}catch(e){return o(new d.CometChatException(e))}})},_.logout=function(){var o=this;return new Promise(function(t,n){try{_.didAnalyticsPingStart()&&_.clearAnalyticsPingTimer(),_.WSReconnectionInProgress&&_.clearWSReconnectionTimer(),_.isLoggedOut=!0,_.WSReconnectionInProgress=!1,_.isAnalyticsDisabled=!1,h.makeApiCall("userLogout").then(function(e){o.clearCache().then(function(){_.apiKey=void 0,_.user=void 0,_.authToken=void 0,_.cometChat=void 0,_.mode=void 0,pe.WSLogout(),_.pushToLoginListener("","Logout_Success"),t(e.data)})},function(e){o.clearCache().then(function(){_.apiKey=void 0,_.user=void 0,_.authToken=void 0,_.cometChat=void 0,_.mode=void 0,pe.WSLogout(),_.pushToLoginListener("","Logout_Success"),new d.CometChatException(e.error).code==m.SERVER_ERRORS.AUTH_ERR.code?t({}):n(new d.CometChatException(e.error))})})}catch(e){n(new d.CometChatException(e))}})},_.callExtension=function(r,i,a,E){return void 0===E&&(E={}),new Promise(function(o,s){try{T.getAppSettings().then(function(e){var t=T.format((new u.EndpointFactory).extensionApi,r,e[f.APP_SETTINGS.KEYS.REGION],e[f.APP_SETTINGS.KEYS.EXTENSION_DOMAIN],a),n={appId:_.appId,Accept:"application/json",authToken:_.authToken,resource:_.getSessionId(),sdk:T.format(f.SDKHeader.sdk,f.SDKHeader.platform,f.SDKHeader.sdkVersion),chatApiVersion:e[f.APP_SETTINGS.KEYS.CHAT_API_VERSION],"Content-Type":"application/json"};_.jwt&&(n.Authorization="Bearer "+_.jwt),h.postData(t,i,E,n,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(f.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new d.CometChatException(e.error))}).catch(function(e){var t={error:m.FETCH_ERROR.ERROR_IN_API_CALL};s(t)})},function(e){return s(new d.CometChatException(e))})}catch(e){return s(new d.CometChatException(e))}})},_.getConversationStarter=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=T.validateChatType(E);if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(a,E);if(o instanceof d.CometChatException)return void n(o);var s={},r="";E===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversationStarter",s.guid=a):(r="getUserConversationStarter",s.uid=a);var i={uid:_.user.uid,name:_.user.name};s.onbehalfofuser=new $.Buffer(JSON.stringify(i)).toString("base64"),h.makeApiCall(r,s,c||{}).then(function(e){return e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]?t(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]):n(new d.CometChatException(f.AIErrors.NO_CONVERSATION_STARTER))},function(e){return n(new d.CometChatException(e.error))})}catch(e){return n(new d.CometChatException(e))}})},_.getSmartReplies=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=T.validateChatType(E);if(e instanceof d.CometChatException)return void n(e);var o=T.validateId(a,E);if(o instanceof d.CometChatException)return void n(o);var s={},r="";E===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupSmartReply",s.guid=a):(r="getUserSmartReply",s.uid=a);var i={uid:_.user.uid,name:_.user.name};s.onbehalfofuser=new $.Buffer(JSON.stringify(i)).toString("base64"),h.makeApiCall(r,s,c||{}).then(function(e){return e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]?t(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]):n(new d.CometChatException(f.AIErrors.NO_SMART_REPLY))},function(e){return n(new d.CometChatException(e.error))})}catch(e){return n(new d.CometChatException(e))}})},_.setDemoMetaInfo=function(e){_.demoMetaInfo=e},_.askBot=function(c,u,p,C,S){return new Promise(function(n,o){try{var e={},t="";c=c.toLowerCase(),u=u.toLowerCase();var s=T.validateChatType(u);if(s instanceof d.CometChatException)return void o(s);var r=T.validateId(c,u);if(r instanceof d.CometChatException)return void o(r);var i=T.validateId(p,"bot");if(i instanceof d.CometChatException)return void o(i);e.botId=p,T.isFalsy(S)&&(S={});var a=T.validateQuestion(C);if(a instanceof d.CometChatException)return void o(a);S.question=C,u===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(t="getBotAssistanceInGroupConversation",e.guid=c):(t="getBotAssistanceInUserConversation",e.uid=c);var E={uid:_.user.uid,name:_.user.name};e.onbehalfofuser=new $.Buffer(JSON.stringify(E)).toString("base64"),h.makeApiCall(t,e,S).then(function(e){if(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY]){var t=e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY];return n(t.toString())}return o(new d.CometChatException(f.AIErrors.NO_ASSISTANCE))},function(e){return o(new d.CometChatException(e.error))})}catch(e){return o(new d.CometChatException(e))}})},_.getConversationSummary=function(a,E,c){return new Promise(function(n,o){try{a=a.toLowerCase(),E=E.toLowerCase();var e=T.validateChatType(E);if(e instanceof d.CometChatException)return void o(e);var t=T.validateId(a,E);if(t instanceof d.CometChatException)return void o(t);var s={},r="";E===f.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversationSummary",s.guid=a):(r="getUserConversationSummary",s.uid=a);var i={uid:_.user.uid,name:_.user.name};s.onbehalfofuser=new $.Buffer(JSON.stringify(i)).toString("base64"),h.makeApiCall(r,s,c||{}).then(function(e){if(e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY]){var t=e[f.ResponseConstants.RESPONSE_KEYS.KEY_DATA][f.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY];return n(t.toString())}return o(new d.CometChatException(f.AIErrors.NO_CONVERSATION_SUMMARY))},function(e){return o(new d.CometChatException(e.error))})}catch(e){return o(new d.CometChatException(e))}})},_.setSource=function(e,t,n){T.isFalsy(e)||(this.resource=e),T.isFalsy(t)||(this.platform=t),T.isFalsy(n)||(this.language=n)},_.clearCache=function(){return new Promise(function(e,t){try{R.LocalStorage.getInstance().clearStore().then(function(){T.Logger.info("CometChat: clearCache => All store cleared successfully","true"),e(!0)})}catch(e){T.Logger.error("CometChat: clearCache",e),t(e)}})},_.connect=function(e){var t=e||{},n=t.onSuccess,o=t.onError;_.user?(pe.connection||(_.onConnectionSuccess=n,_.disconnectedByUser=!1,_.WSLogin(_.user)),_.didAnalyticsPingStart()||_.isAnalyticsDisabled||(_.pingAnalytics(),_.startAnalyticsPingTimer())):o&&o(new d.CometChatException({code:f.Errors.ERROR_USER_NOT_LOGGED_IN,message:f.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},_.disconnect=function(e){var t=e||{},n=t.onSuccess,o=t.onError;_.user?(_.disconnectedByUser=!0,_.disconnectInternally({onError:o}),pe.clearWSResponseTimer(),_.onDisconnectSuccess=n):o&&o(new d.CometChatException({code:f.Errors.ERROR_USER_NOT_LOGGED_IN,message:f.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},_.disconnectInternally=function(e){var t=(e||{}).onError;_.user?(pe.connection&&pe.WSLogout(),_.didAnalyticsPingStart()&&_.clearAnalyticsPingTimer(),_.clearWSReconnectionTimer()):t&&t(new d.CometChatException({code:f.Errors.ERROR_USER_NOT_LOGGED_IN,message:f.Errors.ERROR_USER_NOT_LOGGED_IN_MESSAGE}))},_.prototype.internalRestart=function(e){_.internalRestart||_.getInstance().internalLogout(!1).then(function(){_.internalRestart=!0,_.login(e).then(function(e){_.shouldConnectToWS=!0,_.internalRestart=!1},function(e){T.Logger.error("CometChat: internalRestart :: login",e),_.internalRestart=!1})},function(e){T.Logger.error("CometChat: internalRestart :: internalLogout",e)})},_.prototype.internalLogout=function(n){return void 0===n&&(n=!0),new Promise(function(e,t){try{_.didAnalyticsPingStart()&&_.clearAnalyticsPingTimer(),_.WSReconnectionInProgress&&_.clearWSReconnectionTimer(),_.isLoggedOut=!0,_.WSReconnectionInProgress=!1,_.isAnalyticsDisabled=!1,_.clearCache().then(function(){_.apiKey=void 0,_.user=void 0,_.authToken=void 0,_.cometChat=void 0,_.mode=void 0,pe.WSLogout(),n&&_.pushToLoginListener("","Logout_Success"),e(!0)})}catch(e){T.Logger.error("CometChat: internalLogout",e),t(e)}})},_.markAsInteracted=function(e,o,t){return new Promise(function(n,t){try{T.isFalsy(e)?t(new d.CometChatException(m.ERRORS.PARAMETER_MISSING)):h.makeApiCall("markInteracted",{messageId:e},{interactions:[o]}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Marked interacted",n(t)},function(e){t(new d.CometChatException(e.error))})}catch(e){t(new d.CometChatException(e))}})},_.getConversationUpdateSettings=function(){return E(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,T.getAppSettings()];case 1:return t=e.sent(),[2,ce.ConversationUpdateSettings.fromJSON(t)];case 2:return e.sent(),[2,new ce.ConversationUpdateSettings];case 3:return[2]}})})},_.initialzed=!1,_.CometChatException=d.CometChatException,_.TextMessage=g.TextMessage,_.MediaMessage=p.MediaMessage,_.CustomMessage=w.CustomMessage,_.Action=i.Action,_.Call=s.Call,_.TypingIndicator=Y.TypingIndicator,_.TransientMessage=Q.TransientMessage,_.InteractiveMessage=ee.InteractiveMessage,_.InteractionGoal=te.InteractionGoal,_.Interaction=ne.Interaction,_.InteractionReceipt=oe.InteractionReceipt,_.Group=a.Group,_.User=l.User,_.GroupMember=K.GroupMember,_.Conversation=x.Conversation,_.ReactionCount=ie.ReactionCount,_.ReactionEvent=ae.ReactionEvent,_.Reaction=Ee.Reaction,_.USER_STATUS={ONLINE:f.PresenceConstatnts.STATUS.ONLINE,OFFLINE:f.PresenceConstatnts.STATUS.OFFLINE},_.MessagesRequest=U.MessagesRequest,_.MessagesRequestBuilder=U.MessagesRequestBuilder,_.ReactionsRequest=re.ReactionsRequest,_.ReactionsRequestBuilder=re.ReactionsRequestBuilder,_.UsersRequest=v.UsersRequest,_.UsersRequestBuilder=v.UsersRequestBuilder,_.ConversationsRequest=L.ConversationsRequest,_.ConversationsRequestBuilder=L.ConversationsRequestBuilder,_.BlockedUsersRequest=B.BlockedUsersRequest,_.BlockedUsersRequestBuilder=B.BlockedUsersRequestBuilder,_.GroupsRequest=P.GroupsRequest,_.GroupsRequestBuilder=P.GroupsRequestBuilder,_.GroupMembersRequest=y.GroupMembersRequest,_.GroupMembersRequestBuilder=y.GroupMembersRequestBuilder,_.BannedMembersRequest=M.BannedMembersRequest,_.BannedMembersRequestBuilder=M.BannedMembersRequestBuilder,_.CallSettings=k.CallSettings,_.CallSettingsBuilder=k.CallSettingsBuilder,_.MainVideoContainerSetting=k.MainVideoContainerSetting,_.AppSettings=F.AppSettings,_.AppSettingsBuilder=F.AppSettingsBuilder,_.CallingComponent=H.CallingComponent,_.MessageListener=o.MessageListener,_.UserListener=o.UserListener,_.GroupListener=o.GroupListener,_.OngoingCallListener=o.OngoingCallListener,_.CallListener=o.CallListener,_.ConnectionListener=o.ConnectionListener,_.LoginListener=o.LoginListener,_.CallController=N.CallController,_.CometChatHelper=b.CometChatHelper,_.Attachment=J.Attachment,_.ConversationUpdateSettings=ce.ConversationUpdateSettings,_.GoalType=f.GoalType,_.MESSAGE_TYPE=f.MessageConstatnts.TYPE,_.CATEGORY_MESSAGE=f.MessageConstatnts.CATEGORY.MESSAGE,_.CATEGORY_ACTION=f.MessageConstatnts.CATEGORY.ACTION,_.CATEGORY_CALL=f.MessageConstatnts.CATEGORY.CALL,_.CATEGORY_CUSTOM=f.MessageConstatnts.CATEGORY.CUSTOM,_.ACTION_TYPE=f.ActionConstatnts.ACTIONS,_.CALL_TYPE=f.CallConstants.CALL_TYPE,_.CATEGORY_INTERACTIVE=f.MessageConstatnts.CATEGORY.INTERACTIVE,_.REACTION_ACTION=f.REACTION_ACTION,_.RECEIVER_TYPE=f.MessageConstatnts.RECEIVER_TYPE,_.CALL_STATUS=f.CallConstants.CALL_STATUS,_.GROUP_MEMBER_SCOPE=f.GROUP_MEMBER_SCOPE,_.GROUP_TYPE=f.GROUP_TYPE,_.MESSAGE_REQUEST=f.MessageConstatnts.PAGINATION.CURSOR_FILEDS,_.CONNECTION_STATUS=f.CONNECTION_STATUS,_.CALL_MODE=f.CallConstants.CALL_MODE,_.AUDIO_MODE=f.CallConstants.AUDIO_MODE,_.SORT_BY=f.UserConstants.SORT_BY,_.SORT_ORDER=f.UserConstants.SORT_ORDER,_.WSReconnectionInProgress=!1,_.WSReconnectionTimerInterval=5e3,_.currentConnectionStatus=f.CONNECTION_STATUS.DISCONNECTED,_.isConnectingFromInit=!1,_.loginInProgress=!1,_.internalRestart=!1,_.settingsInterval=6e4,_.isAnalyticsPingStarted=!1,_.isLoggedOut=!0,_.isAnalyticsDisabled=!1,_.disconnectedByUser=!1,_.shouldConnectToWS=!0,_.isAppInactive=!1,_.onConnectionSuccess=null,_.onDisconnectSuccess=null,_.onConnectionError=null,_.callWaitTimer=null,_.callWaitTime=30,_}();t.CometChat=Se},function(e,t,n){"use strict";t.__esModule=!0,t.BaseMessage=void 0;var o=n(1),s=n(21),r=n(0),i=function(){function e(e,t,n,o){this.reactions=[],this.mentionedUsers=[],this.mentionedMe=!1,this.receiverId=e,this.type=t,this.receiverType=n,this.category=o}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getUnreadRepliesCount=function(){return this.unreadRepliesCount},e.prototype.setUnreadRepliesCount=function(e){this.unreadRepliesCount=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e.prototype.getMuid=function(){return this.muid},e.prototype.setMuid=function(e){this.muid=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSentAt=function(){return this.sentAt},e.prototype.setSentAt=function(e){this.sentAt=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredToMeAt=function(){return this.deliveredToMeAt},e.prototype.setDeliveredToMeAt=function(e){this.deliveredToMeAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadByMeAt=function(){return this.readByMeAt},e.prototype.setReadByMeAt=function(e){this.readByMeAt=e},e.prototype.getCategory=function(){return this.category},e.prototype.setCategory=function(e){this.category=e},e.prototype.getEditedAt=function(){return this.editedAt},e.prototype.setEditedAt=function(e){this.editedAt=e},e.prototype.getEditedBy=function(){return this.editedBy},e.prototype.setEditedBy=function(e){this.editedBy=e},e.prototype.getDeletedAt=function(){return this.deletedAt},e.prototype.setDeletedAt=function(e){this.deletedAt=e},e.prototype.getDeletedBy=function(){return this.deletedBy},e.prototype.setDeletedBy=function(e){this.deletedBy=e},e.prototype.getReplyCount=function(){return this.replyCount},e.prototype.setReplyCount=function(e){this.replyCount=e},e.prototype.getRawMessage=function(){return this.rawMessage},e.prototype.setRawMessage=function(e){this.rawMessage=e},e.prototype.setMentionedUsers=function(e){this.mentionedUsers=e},e.prototype.getMentionedUsers=function(){return this.mentionedUsers},e.prototype.setHasMentionedMe=function(e){this.mentionedMe=e},e.prototype.hasMentionedMe=function(){return this.mentionedMe},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.setReactions=function(e){try{this.setReactionsToData(e)}catch(e){return this.reactions}},e.prototype.getReactions=function(){try{return this.getReactionsFromData()}catch(e){return this.reactions}},e.prototype.setReactionsToData=function(e){var t=this.getData();if(t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]){var n=e.map(function(e){return new s.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe)});t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=n,this.setData(t),this.reactions=n}else t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=e,this.setData(t),this.reactions=e},e.prototype.getReactionsFromData=function(){try{var e=this.getData(),n=[];if(e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS])e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS].forEach(function(e){var t=new s.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe);n.push(t)});return n}catch(e){throw r.Logger.error("BaseMessageModel: getReactionsFromData",e),e}},e}();t.BaseMessage=i},function(e,t,n){"use strict";t.__esModule=!0,t.CometChatEvent=void 0;var i=n(0),o=n(4),s=function(){function e(e,t,n,o,s,r){i.isFalsy(e)||(this.appId=e),i.isFalsy(t)||(this.receiver=t),i.isFalsy(n)||(this.receiverType=n),i.isFalsy(s)||(this.deviceId=s),i.isFalsy(o)||(this.sender=o),i.isFalsy(r)||(this.messageSender=r)}return e.prototype.getAppId=function(){return this.appId},e.prototype.setAppId=function(e){this.appId=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getDeviceId=function(){return this.deviceId},e.prototype.setDeviceId=function(e){this.deviceId=e},e.prototype.getMessageSender=function(){return this.messageSender},e.prototype.setMessageSender=function(e){this.messageSender=e},e.prototype.getCometChatEventJSON=function(){var e={};return e[o.KEYS.APP_ID]=this.getAppId(),e[o.KEYS.RECEIVER]=this.getReceiver(),e[o.KEYS.RECEIVER_TYPE]=this.getReceiverType(),e[o.KEYS.DEVICE_ID]=this.getDeviceId(),e[o.KEYS.TYPE]=this.getType(),e[o.KEYS.SENDER]=this.getSender(),i.isFalsy(this.getMessageSender())||(e[o.KEYS.MESSAGE_SENDER]=this.getMessageSender()),e},e}();t.CometChatEvent=s},function(e,t,n){"use strict";t.__esModule=!0,t.Group=void 0;var o=n(1),s=function(){function e(e,t,n,o,s,r,i){this.hasJoined=!1,this.membersCount=0,this.isBanned=!1,this.guid=e,t&&(this.name=t),n&&(this.type=n),!o&&""!==o||"password"!=n||(this.password=o),(s||""===s)&&(this.icon=s),(r||""===r)&&(this.description=r),i&&(this.hasJoined=i)}return e.prototype.getGuid=function(){return this.guid},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getPassword=function(){return this.password},e.prototype.setPassword=function(e){this.password=e},e.prototype.getIcon=function(){return this.icon},e.prototype.setIcon=function(e){this.icon=e},e.prototype.getDescription=function(){return this.description},e.prototype.setDescription=function(e){this.description=e},e.prototype.getOwner=function(){return this.owner},e.prototype.setOwner=function(e){this.owner=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getCreatedAt=function(){return this.createdAt},e.prototype.setCreatedAt=function(e){this.createdAt=e},e.prototype.getUpdatedAt=function(){return this.updatedAt},e.prototype.setUpdatedAt=function(e){this.updatedAt=e},e.prototype.getHasJoined=function(){return this.hasJoined},e.prototype.setHasJoined=function(e){this.hasJoined=e},e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.setWsChannel=function(e){this.wsChannel=e},e.prototype.setScope=function(e){this.scope=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getMembersCount=function(){return this.membersCount},e.prototype.setMembersCount=function(e){this.membersCount=e},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.isBannedFromGroup=function(){return this.isBanned},e.TYPE=o.GroupType,e.Type=e.TYPE,e}();t.Group=s},function(e,t,n){"use strict";t.__esModule=!0,t.FETCH_ERROR=t.TYPINGNOTIFICATION_CONSTANTS=t.LOGIN_ERROR=t.MESSAGE_ERRORS=t.MESSAGES_REQUEST_ERRORS=t.USERS_REQUEST_ERRORS=t.GROUP_CREATION_ERRORS=t.INIT_ERROR=t.ERRORS=t.SERVER_ERRORS=void 0,t.SERVER_ERRORS={AUTH_ERR:{code:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND",message:"The auth token %s% does not exist. Please make sure you are logged in and have a valid auth token or try login again."}},t.ERRORS={PARAMETER_MISSING:{code:"MISSING_PARAMETERS",name:"Invalid or no parameter passed to the method."}},t.INIT_ERROR={NO_APP_ID:{code:t.ERRORS.PARAMETER_MISSING.code,name:t.ERRORS.PARAMETER_MISSING.name,message:"AppID cannot be empty. Please specify a valid appID.",details:{}}},t.GROUP_CREATION_ERRORS={EMPTY_PASSWORD:{code:"ERR_EMPTY_GROUP_PASS",details:void 0,message:"Password is mandatory to join a group.",name:void 0}},t.USERS_REQUEST_ERRORS={EMPTY_USERS_LIST:{code:"EMPTY_USERS_LIST",name:"EMPTY_USERS_LIST",message:"The users list needs to have atleast one UID.",details:{}}},t.MESSAGES_REQUEST_ERRORS={REQUEST_IN_PROGRESS_ERROR:{code:"REQUEST_IN_PROGRESS",name:"REQUEST_IN_PROGRESS",message:"Request in progress.",details:{}},NOT_ENOUGH_PARAMS:{code:"NOT_ENOUGH_PARAMETERS",name:"NOT_ENOUGH_PARAMETERS",message:"`Timestamp`, `MessageId` or `updatedAfter` is required to use the 'fetchNext()' method.",details:{}}},t.MESSAGE_ERRORS={INVALID_CUSTOM_DATA:{code:"-1",name:"%s_CUSTOM_DATA",message:"",details:{}}},t.LOGIN_ERROR={NOT_INITIALIZED:{code:"-1",name:"COMETCHAT_INITIALIZATION_NOT_DONE",message:"please initialize the cometchat before using login method.",details:{}},UNAUTHORISED:{code:401,name:"USER_NOT_AUTHORISED",message:"The `authToken` of the user is not authorised. Please verify again.",details:{}},WS_CONNECTION_FAIL:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. %s",details:{}},WS_CONNECTION_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. Trying to connect with port: %s",details:{}},WS_CONNECTION_FALLBACK_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FALLBACK_FAIL",message:"WS Connection fallback failed. Trying to connect with port: %s",details:{}},WS_AUTH_FAIL:{code:-1,name:"WS_AUTH_FAIL",message:"WS username/password not correct.",details:{}},NO_INTERNET:{code:-1,name:"NO_INTERNET_CONNECTION",message:"You do not have internet connection.",details:{}},REQUEST_IN_PROGRESS:{code:-1,name:"LOGIN_IN_PROGRESS",message:"Please wait until the previous login request ends.",details:{}}},t.TYPINGNOTIFICATION_CONSTANTS={TOO_MANY_REQUEST:{code:"TOO_MANY_REQUEST",name:"TOO MANY REQUEST",message:"too many request, wait for `%s` seconds before sending next request.",details:{}}},t.FETCH_ERROR={ERROR_IN_API_CALL:{code:"FAILED_TO_FETCH",name:"FAILED_TO_FETCH",message:"There is an unknown issue with the API request. Please check your internet connection and verify the api call.",details:{}}}},function(e,t,n){"use strict";t.__esModule=!0,t.MessageController=void 0;var _=n(7),T=n(20),d=n(22),h=n(0),R=n(1),g=n(28),A=n(29),I=n(30),r=n(2),f=n(23),O=n(24),N=n(6),i=n(12),a=n(3),m=n(26),o=function(){function l(){}return l.trasformJSONMessge=function(n){var e,t,o,s,r;try{var i=null,a=void 0;switch(n[R.MessageConstatnts.KEYS.CATEGORY]){case R.MessageConstatnts.CATEGORY.ACTION:a=g.Action.actionFromJSON(n);break;case R.MessageConstatnts.CATEGORY.CALL:a=A.Call.callFromJSON(n);break;case R.MessageConstatnts.CATEGORY.MESSAGE:switch(n[R.MessageConstatnts.KEYS.TYPE]){case R.MessageConstatnts.TYPE.TEXT:a=new T.TextMessage(n[R.MessageConstatnts.KEYS.RECEIVER],n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.TEXT],n[R.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case R.MessageConstatnts.TYPE.CUSTOM:a=new O.CustomMessage(n[R.MessageConstatnts.KEYS.RECEIVER],n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.CUSTOM_DATA],n[R.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;default:if(a=new d.MediaMessage(n[R.MessageConstatnts.KEYS.RECEIVER],n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.URL],n[R.MessageConstatnts.KEYS.TYPE],n[R.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.hasOwnProperty(R.MessageConstatnts.KEYS.DATA)){var E=n[R.MessageConstatnts.KEYS.DATA];if(E.hasOwnProperty(R.MessageConstatnts.KEYS.ATTATCHMENTS)){var c,u=E[R.MessageConstatnts.KEYS.ATTATCHMENTS];new Array;u.map(function(e){c=new f.Attachment(e)}),a.setAttachment(c)}E.hasOwnProperty(R.MessageConstatnts.KEYS.TEXT)&&a.setCaption(E[R.MessageConstatnts.KEYS.TEXT])}a.hasOwnProperty("file")&&delete a.file}break;case R.MessageConstatnts.CATEGORY.CUSTOM:a=new O.CustomMessage(n[R.MessageConstatnts.KEYS.RECEIVER],n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.CUSTOM_DATA],n[R.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type);break;case R.MessageConstatnts.CATEGORY.INTERACTIVE:a=new m.InteractiveMessage(n[R.MessageConstatnts.KEYS.RECEIVER],n[R.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type,n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.INTERACTIVE_DATA],n[R.MessageConstatnts.KEYS.DATA][R.MessageConstatnts.KEYS.INTERACTION_GOAL])}if((n[R.MessageConstatnts.KEYS.CATEGORY]===R.MessageConstatnts.CATEGORY.MESSAGE||n[R.MessageConstatnts.KEYS.CATEGORY]===R.MessageConstatnts.CATEGORY.CUSTOM)&&n[R.MessageConstatnts.KEYS.TYPE]!==R.MessageConstatnts.TYPE.TEXT&&(null==n?void 0:n[R.MessageConstatnts.KEYS.DATA])&&(null===(e=null==n?void 0:n[R.MessageConstatnts.KEYS.DATA])||void 0===e?void 0:e[R.MessageConstatnts.KEYS.ATTATCHMENTS])&&0!==(null===(o=null===(t=null==n?void 0:n[R.MessageConstatnts.KEYS.DATA])||void 0===t?void 0:t[R.MessageConstatnts.KEYS.ATTATCHMENTS])||void 0===o?void 0:o.length)&&(null===(s=N.CometChat.user)||void 0===s?void 0:s.getFat())&&N.CometChat.SECURED_MEDIA_HOST){var p=N.CometChat.SECURED_MEDIA_HOST,C=null===(r=N.CometChat.user)||void 0===r?void 0:r.getFat(),S=h.updatePropertiesWithDynamicValue(n,p,"?"+R.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY+"="+C);S&&(n=S)}n[R.MessageConstatnts.KEYS.MY_RECEIPTS]&&(n[R.MessageConstatnts.KEYS.MY_RECEIPTS]=n[R.MessageConstatnts.KEYS.MY_RECEIPTS],Object.keys(n[R.MessageConstatnts.KEYS.MY_RECEIPTS]).map(function(e){var t=new I.MessageReceipt;e==R.DELIVERY_RECEIPTS.DELIVERED_AT&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.DELIVERY_RECEIPTS.DELIVERED_AT]),h.isFalsy(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.DELIVERY_RECEIPTS.RECIPIENT])?n[R.DELIVERY_RECEIPTS.DELIVERED_TO_ME_AT]=n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.DELIVERY_RECEIPTS.DELIVERED_AT]:t.setSender(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.DELIVERY_RECEIPTS.RECIPIENT]),t.setReceiverType(n[R.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[R.MessageConstatnts.KEYS.RECEIVER])),n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.READ_RECEIPTS.READ_AT]),h.isFalsy(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.READ_RECEIPTS.RECIPIENT])?n[R.READ_RECEIPTS.READ_BY_ME_AT]=n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.READ_RECEIPTS.READ_AT]:t.setSender(n[R.MessageConstatnts.KEYS.MY_RECEIPTS][R.READ_RECEIPTS.RECIPIENT]),t.setReceiverType(n[R.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[R.MessageConstatnts.KEYS.RECEIVER]))}));try{if(Object.assign(a,n),(n=a).parentId&&(n.parentMessageId=n.parentId,delete n.parentId),n instanceof _.BaseMessage&&(h.isFalsy(i)||n.setRawMessage(i)),n instanceof T.TextMessage)l.extractDetailsFromMentions(n),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.getData()[R.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[R.MessageConstatnts.KEYS.METADATA]);else if(n instanceof d.MediaMessage)l.extractDetailsFromMentions(n),n.getData()[R.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[R.MessageConstatnts.KEYS.METADATA]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver());else if(n instanceof g.Action)n.setSender(n.getSender()),n.setReceiver(n.getActionFor()),n.setActionBy(n.getActionBy()),n.setActionOn(n.getActionOn()),n.setActionFor(n.getActionFor()),n.setMessage(n.getMessage());else if(n instanceof A.Call){try{n.setSender(n.getSender())}catch(e){h.Logger.error("MessageController: trasformJSONMessge: setSender",e)}try{n.setCallInitiator(n.getCallInitiator())}catch(e){h.Logger.error("MessageController: trasformJSONMessge: setCallInitiator",e)}try{n.setReceiver(n.getCallReceiver()),n.setCallReceiver(n.getCallReceiver())}catch(e){h.Logger.error("MessageController: trasformJSONMessge: setCallreceiver",e)}}else n instanceof O.CustomMessage?(n.getData()[R.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[R.MessageConstatnts.KEYS.METADATA]),n.setCustomData(n.getData()[R.MessageConstatnts.KEYS.CUSTOM_DATA]),n.setSubType(n.getData()[R.MessageConstatnts.KEYS.CUSTOM_SUB_TYPE]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver())):n instanceof m.InteractiveMessage&&(n.setMetadata(n.getData()[R.MessageConstatnts.KEYS.METADATA]),n.setInteractiveData(n.getData()[R.MessageConstatnts.KEYS.INTERACTIVE_DATA]),n.setInteractionGoal(n.getInteractionGoal()),n.setInteractions(n.getInteractions()),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.setIsSenderInteractionAllowed(n.getData()[R.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION]));n.hasOwnProperty("rawMessage")||(i=JSON.parse(JSON.stringify(n))),n instanceof _.BaseMessage&&(h.isFalsy(i)||n.setRawMessage(i))}catch(e){h.Logger.error("MessageController: trasformJSONMessge: Main",e),n=null}return n}catch(e){h.Logger.error("MessageController: trasformJSONMessge",e)}},l.extractDetailsFromMentions=function(e){if(e.getData()[R.MessageConstatnts.KEYS.MENTIONS]){var t=[],n=!1,o=N.CometChat.user,s=e.getData()[R.MessageConstatnts.KEYS.MENTIONS];for(var r in s)r.toString()==(null==o?void 0:o.getUid())&&(n=!0),t.push(new a.User(s[r]));e.setMentionedUsers(t),e.setHasMentionedMe(n)}},l.getReceiptsFromJSON=function(s){return new Promise(function(e,t){try{var o=[];N.CometChat.getLoggedInUser().then(function(n){h.isFalsy(s.receipts)?e([]):(s.receipts.data.map(function(e){var t=new I.MessageReceipt;e[R.DELIVERY_RECEIPTS.DELIVERED_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(e[R.DELIVERY_RECEIPTS.DELIVERED_AT]),t.setTimestamp(e[R.DELIVERY_RECEIPTS.DELIVERED_AT]),h.isFalsy(e[R.DELIVERY_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[R.DELIVERY_RECEIPTS.RECIPIENT])),t.setReceiverType(s[R.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(s[R.MessageConstatnts.KEYS.RECEIVER])),e[R.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(e[R.READ_RECEIPTS.READ_AT]),t.setTimestamp(e[e[R.READ_RECEIPTS.READ_AT]]),h.isFalsy(e[R.READ_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[R.READ_RECEIPTS.RECIPIENT])),t.setReceiverType(s[R.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(s[R.MessageConstatnts.KEYS.RECEIVER])),o.push(t)}),e(o))})}catch(e){t(new r.CometChatException(e))}})},l}();t.MessageController=o},function(e,t,n){"use strict";t.__esModule=!0,t.UsersController=void 0;var o=n(3),s=n(0),r=function(){function e(){}return e.trasformJSONUser=function(e){var t;try{e.uid=e.uid.toString(),e.name=e.name.toString(),e.status&&"offline"!==e.status?e.status="online":e.status="offline",t=new o.User(e),Object.assign(t,e),e=t}catch(e){s.Logger.error("UsersController:transformJSONUser",e)}return e},e}();t.UsersController=r},function(e,t,n){"use strict";var o,s,r,i,a,E,c,u;t.__esModule=!0,t.DEFAULT_PROVIDER_ID=t.APIResponseConstants=t.APIConstants=t.PushPlatforms=t.MutedConversationType=t.DayOfWeek=t.DNDOptions=t.MemberActionsOptions=t.ReactionsOptions=t.RepliesOptions=t.MessagesOptions=void 0,(o=t.MessagesOptions||(t.MessagesOptions={}))[o.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",o[o.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",o[o.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(s=t.RepliesOptions||(t.RepliesOptions={}))[s.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",s[s.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",s[s.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(r=t.ReactionsOptions||(t.ReactionsOptions={}))[r.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",r[r.SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES=2]="SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES",r[r.SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES=3]="SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES",(i=t.MemberActionsOptions||(t.MemberActionsOptions={}))[i.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",i[i.SUBSCRIBE=2]="SUBSCRIBE",(a=t.DNDOptions||(t.DNDOptions={}))[a.DISABLED=1]="DISABLED",a[a.ENABLED=2]="ENABLED",(E=t.DayOfWeek||(t.DayOfWeek={})).MONDAY="monday",E.TUESDAY="tuesday",E.WEDNESDAY="wednesday",E.THURSDAY="thursday",E.FRIDAY="friday",E.SATURDAY="saturday",E.SUNDAY="sunday",(c=t.MutedConversationType||(t.MutedConversationType={})).ONE_ON_ONE="oneOnOne",c.GROUP="group",(u=t.PushPlatforms||(t.PushPlatforms={})).FCM_REACT_NATIVE_ANDROID="fcm_react_native_android",u.FCM_REACT_NATIVE_IOS="fcm_react_native_ios",u.APNS_REACT_NATIVE_DEVICE="apns_react_native_device",u.APNS_REACT_NATIVE_VOIP="apns_react_native_voip",t.APIConstants={KEY_GROUP_PREFERENCES:"groupPreferences",KEY_GROUP_MESSAGES:"groupMessages",KEY_GROUP_REACTIONS:"groupReactions",KEY_GROUP_REPLIES:"groupReplies",KEY_GROUP_MEMBER_ADDED:"groupMemberAdded",KEY_GROUP_MEMBER_LEFT:"groupMemberLeft",KEY_GROUP_MEMBER_JOINED:"groupMemberJoined",KEY_GROUP_MEMBER_KICKED:"groupMemberKicked",KEY_GROUP_MEMBER_BANNED:"groupMemberBanned",KEY_GROUP_MEMBER_UNBANNED:"groupMemberUnbanned",KEY_GROUP_MEMBER_SCOPE_CHANGED:"groupMemberScopeChanged",KEY_MUTE_PREFERENCES:"mutePreferences",KEY_MUTE_DND:"dnd",KEY_MUTE_SCHEDULE:"schedule",KEY_ONE_ON_ONE_PREFERENCES:"oneOnOnePreferences",KEY_ONE_ON_ONE_MESSAGES:"oneOnOneMessages",KEY_ONE_ON_ONE_REACTIONS:"oneOnOneReactions",KEY_ONE_ON_ONE_REPLIES:"oneOnOneReplies",KEY_USE_PRIVACY_TEMPLATE:"usePrivacyTemplate",KEY_PROVIDER_ID:"providerId",KEY_TIMEZONE:"timezone",KEY_PLATFORM:"platform",KEY_FCM_TOKEN:"fcmToken",KEY_DEVICE_TOKEN:"deviceToken",KEY_VOIP_TOKEN:"voipToken",KEY_CONVERSATIONS:"conversations",KEY_GET_PREFERENCES:"getPushPreferences",KEY_UPDATE_PREFERENCES:"updatePushPreferences",KEY_RESET_PREFERENCES:"resetPushPreferences",KEY_REGISTER_TOKEN:"registerToken",KEY_UNREGISTER_TOKEN:"unregisterToken",KEY_MUTE_CONVERSATIONS:"muteConversations",KEY_UNMUTE_CONVERSATIONS:"unmuteConversations",KEY_GET_MUTED_CONVERSATIONS:"getMutedConversations",KEY_MUTED_CONVERSATIONS:"mutedConversations",KEY_FROM:"from",KEY_TO:"to",KEY_GET_TIMEZONE:"getTimezone",KEY_UPDATE_TIMEZONE:"updateTimezone"},t.APIResponseConstants={TOKEN_REGISTER_SUCCESS:"Push token registered successfully.",TOKEN_REGISTER_ERROR:"Failed to register push token.",TOKEN_UNREGISTER_SUCCESS:"Push token unregistered successfully.",TOKEN_UNREGISTER_ERROR:"Failed to unregister push token.",MUTE_CONVERSATION_SUCCESS:"Conversations muted successfully.",MUTE_CONVERSATION_ERROR:"Failed to mute conversations.",UNMUTE_CONVERSATION_SUCCESS:"Conversations unmuted successfully.",UNMUTE_CONVERSATION_ERROR:"Failed to unmute conversations.",TIMEZONE_UPDATE_SUCCESS:"Timezone updated successfully.",TIMEZONE_UPDATE_ERROR:"Failed to update Timezone.",TIMEZONE_FETCH_ERROR:"Failed to fetch Timezone."},t.DEFAULT_PROVIDER_ID="default"},function(e,t){e.exports=n},function(e,t,n){"use strict";t.__esModule=!0,t.LocalStorage=void 0;var r=n(0),i=n(1),a=n(2),o=n(14),s=function(){function e(e){this.store=i.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e);try{this.localStore=o.default}catch(e){r.Logger.error("store: constructor",{e:e})}}return e.getInstance=function(){return null==e.localStorage&&(e.localStorage=new e),e.localStorage},e.prototype.set=function(e,t){var n=r.getKeyprefix(i.LOCAL_STORE.COMMON_STORE,e);return this.localStore.setItem(n,JSON.stringify(t))},e.prototype.get=function(e){var o=this,s=r.getKeyprefix(i.LOCAL_STORE.COMMON_STORE,e);return new Promise(function(n,t){try{o.localStore.getItem(s).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clearStore=function(){var s=this;return new Promise(function(n,t){try{var o=[r.getKeyprefix(i.LOCAL_STORE.COMMON_STORE,i.LOCAL_STORE.KEY_USER),r.getKeyprefix(i.LOCAL_STORE.COMMON_STORE,i.LOCAL_STORE.KEY_APP_SETTINGS)];s.localStore.getAllKeys().then(function(e){if(0<e.length)for(var t=0;t<e.length;t++)-1!==o.indexOf(e[t])&&s.localStore.removeItem(e[t]),t===e.length-1&&n(!0);else n(!0)},function(e){t(e)})}catch(e){t(e)}})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.localStorage=null,e}();t.LocalStorage=s},function(e,t,n){"use strict";t.__esModule=!0,t.CallController=void 0;var s=n(1),r=n(0),o=n(6),i=n(2),a=n(25),E=n(40),c=function(){function e(){this.TAG="calling Log",this.callListner=void 0,this.CALL_NO_ANSWER_INTERVAL=45e3}return e.prototype.getCallListner=function(){return this.callListner},e.prototype.setCallListner=function(e){this.callListner=new a.UserCallListener(e)},e.getInstance=function(){try{return null!=this.callController&&null!=this.callController||(this.callController=new e),this.callController}catch(e){r.Logger.error("CallController: getInstance",e)}},e.prototype.getActiveCall=function(){try{return r.isFalsy(this.call)?null:this.call}catch(e){r.Logger.error("CallController: getActiveCall",e)}},e.prototype.initiateCall=function(n){var o=this;return new Promise(function(e,t){try{r.isFalsy(o.call)?null!=n&&null!=n?(o.call=n,o.startCallTimer(),e(n)):t(new i.CometChatException(s.CALL_ERROR.ERROR_IN_CALLING)):t(new i.CometChatException(s.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new i.CometChatException(e))}})},e.prototype.clearTimer=function(){this.timer&&this.stopCallTimer()},e.prototype.endCall=function(e){try{this.endCallSession()}catch(e){r.Logger.error("CallController: endCall",e)}},e.prototype.onCallStarted=function(n){var o=this;return new Promise(function(e,t){try{r.isFalsy(o.call)?null!=n&&null!=n?e(o.call=n):t(new i.CometChatException(s.CALL_ERROR.ERROR_IN_CALLING)):t(new i.CometChatException(s.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new i.CometChatException(e))}})},e.prototype.clearActiveCall=function(){this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer()},e.prototype.endCallSession=function(){try{this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer()}catch(e){r.Logger.error("CallController:EndCallSession",{e:e})}},e.prototype.startCallTimer=function(){var t=this;try{this.timer=setTimeout(function(){t.call?o.CometChat.sendUnansweredResponse(t.call.getSessionId()).then(function(e){t.endCallSession()},function(e){t.endCallSession()}):t.endCallSession()},this.CALL_NO_ANSWER_INTERVAL)}catch(e){r.Logger.error("CallController: startCallTimer",e)}},e.prototype.stopCallTimer=function(){try{clearTimeout(this.timer)}catch(e){r.Logger.error("CallController: stopCallTimer",e)}},e.prototype.callStarted=function(){this.timer&&this.stopCallTimer()},e.prototype.muteAudio=function(e){E.CallingComponent.muteAudio(e)},e.prototype.pauseVideo=function(e){E.CallingComponent.pauseVideo(e)},e.prototype.endSession=function(e,t){void 0===e&&(e=!1),E.CallingComponent.endCall(e,t)},e.prototype.setAudioMode=function(e){E.CallingComponent.setAudioMode(e)},e.prototype.switchCamera=function(){E.CallingComponent.switchCamera()},e.prototype.getAudioOutputModes=function(){return new Promise(function(t,n){E.CallingComponent.getAudioOutputModes().then(function(e){t(e)},function(e){n(e)})})},e.prototype.switchToVideoCall=function(){E.CallingComponent.switchToVideoCall()},e.prototype.startRecording=function(){E.CallingComponent.startCallRecording()},e.prototype.stopRecording=function(){E.CallingComponent.stopCallRecording()},e.callController=void 0,e}();t.CallController=c},function(e,t){e.exports=o},function(e,t,n){"use strict";t.__esModule=!0,t.GroupsController=void 0;var o=n(9),s=n(1),r=n(0),i=function(){function e(){}return e.trasformJSONGroup=function(e){var t;try{t=new o.Group(e[s.GroupConstants.KEYS.GUID],e[s.GroupConstants.KEYS.NAME],e[s.GroupConstants.KEYS.TYPE]),e.wsChannel&&delete e.wsChannel,Object.assign(t,e),e=t}catch(e){r.Logger.error("GroupsController:transformJSONGroup",e)}return e},e}();t.GroupsController=i},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.TextMessage=void 0;var s=n(7),a=n(1),E=n(3),c=n(9),u=n(0),p=function(s){function e(e,t,n){var o=s.call(this,e,"text",n,a.MessageCategory.MESSAGE)||this;return o.type="text",o.data={text:t},o.text=t,o}return r(e,s),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getText=function(){return this.text},e.prototype.setText=function(e){this.text=e,this.data.text=e},e.prototype.setProcessedText=function(e){this.processedText=e},e.prototype.getProcessedText=function(){return this.processedText},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("TextMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new c.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("TextMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE.TEXT,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY.MESSAGE,e}(s.BaseMessage);t.TextMessage=p},function(e,t,n){"use strict";t.__esModule=!0,t.ReactionCount=void 0;var o=n(0),s=function(){function e(e,t,n){this.reactedByMe=!1,o.isFalsy(e)||(this.reaction=e),o.isFalsy(t)||(this.count=t),null===n&&void 0===n||(this.reactedByMe=n)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getCount=function(){return this.count},e.prototype.setCount=function(e){this.count=e},e.prototype.getReactedByMe=function(){return!!this.reactedByMe&&this.reactedByMe},e.prototype.setReactedByMe=function(e){this.reactedByMe=e},e}();t.ReactionCount=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.MediaMessage=void 0;var r=n(7),a=n(1),E=n(3),c=n(23),u=n(9),p=n(0),C=function(r){function e(e,t,n,o){var s=r.call(this,e,n,o,a.MessageCategory.MESSAGE)||this;return s.data={},"object"!=typeof t?s.data={url:t}:p.isFalsy(t)||(0<t.length?s.files=t:s.files=[t]),s}return s(e,r),e.prototype.setCaption=function(e){this.caption=e,this.data[a.MessageConstatnts.KEYS.TEXT]=e},e.prototype.getCaption=function(){return this.data[a.MessageConstatnts.KEYS.TEXT]},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getAttachment=function(){return new c.Attachment(this.data.attachments[0])},e.prototype.setAttachment=function(e){this.data.attachments=[c.Attachment.toJSON(e)]},e.prototype.getAttachments=function(){var e=[];if(this.data.attachments&&0<this.data.attachments.length)for(var t=0;t<this.data.attachments.length;t++)e.push(new c.Attachment(this.data.attachments[t]));return e},e.prototype.setAttachments=function(e){var t=[];if(e&&0<e.length)for(var n=0;n<e.length;n++)t.push(c.Attachment.toJSON(e[n]));this.data.attachments=t},e.prototype.getURL=function(){try{var e=this.getData();if(e[a.MessageConstatnts.KEYS.URL])return e[a.MessageConstatnts.KEYS.URL]}catch(e){p.Logger.error("MediaMessageModel: getURL",e)}},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw p.Logger.error("MediaMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new u.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw p.Logger.error("MediaMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY,e}(r.BaseMessage);t.MediaMessage=C},function(e,t,n){"use strict";t.__esModule=!0,t.Attachment=void 0;var o=n(1),s=function(){function t(e){e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION)&&(this.extension=e[o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE)&&(this.mimeType=e[o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.NAME)&&(this.name=e[o.ATTACHMENTS_CONSTANTS.KEYS.NAME]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.SIZE)&&(this.size=e[o.ATTACHMENTS_CONSTANTS.KEYS.SIZE]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.URL)&&(this.url=e[o.ATTACHMENTS_CONSTANTS.KEYS.URL])}return t.prototype.createFileFromJSON=function(e){return new t(e)},t.toJSON=function(e){return{extension:e.getExtension(),mimeType:e.getMimeType(),name:e.getName(),url:e.getUrl(),size:e.getSize()}},t.prototype.getExtension=function(){return this.extension},t.prototype.setExtension=function(e){this.extension=e},t.prototype.getMimeType=function(){return this.mimeType},t.prototype.setMimeType=function(e){this.mimeType=e},t.prototype.getName=function(){return this.name},t.prototype.setName=function(e){this.name=e},t.prototype.getSize=function(){return this.size},t.prototype.setSize=function(e){this.size=e},t.prototype.getUrl=function(){return this.url},t.prototype.setUrl=function(e){this.url=e},t}();t.Attachment=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.CustomMessage=void 0;var i=n(7),E=n(1),c=n(3),u=n(0),p=n(9),a=function(a){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(3==e.length){var o=e[0],s=e[1],r=e[2];n=a.call(this,o,E.MessageConstatnts.TYPE.CUSTOM,s,E.MessageCategory.MESSAGE)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}if(4==e.length){o=e[0],s=e[1];var i=e[2];r=e[3];n=a.call(this,o,i,s,E.MessageCategory.CUSTOM)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}return n}return s(e,a),e.prototype.getConversationText=function(){var e;return null!==(e=this.data.text)&&void 0!==e?e:""},e.prototype.setConversationText=function(e){this.data.text=e},e.prototype.willUpdateConversation=function(){var e;return null!==(e=this.data.updateConversation)&&void 0!==e&&e},e.prototype.shouldUpdateConversation=function(e){this.data.updateConversation=e},e.prototype.willSendNotification=function(){var e;return null!==(e=this.data.sendNotification)&&void 0!==e&&e},e.prototype.shouldSendNotification=function(e){this.data.sendNotification=e},e.prototype.getCustomData=function(){return this.customData},e.prototype.setCustomData=function(e){this.customData=e,this.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=e},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getSubType=function(){return this.subType},e.prototype.setSubType=function(e){this.subType=e,this.data=r(r({},this.data),{subType:e})},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new c.User(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new c.User(t);var n=new p.Group(t[E.GroupConstants.KEYS.GUID],t[E.GroupConstants.KEYS.NAME],t[E.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("CustomMessageModel: getReceiverFromData",e),e}},e}(i.BaseMessage);t.CustomMessage=a},function(e,t,n){"use strict";var o,i=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.WSConnectionListener=t.UserLoginListener=t.CallsListener=t.UserCallListener=t.GroupsListener=t.UsersListener=t.MessagesListener=t.Listener=t.ConnectionListener=t.LoginListener=t.OngoingCallListener=t.GroupListener=t.UserListener=t.CallListener=t.MessageListener=void 0;var s=n(0),r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onTextMessageReceived=void 0,this.onMediaMessageReceived=void 0,this.onCustomMessageReceived=void 0,this.onTypingStarted=void 0,this.onTypingEnded=void 0,this.onMessagesDelivered=void 0,this.onMessagesRead=void 0,this.onMessageEdited=void 0,this.onMessageDeleted=void 0,this.onTransientMessageReceived=void 0,this.onInteractiveMessageReceived=void 0,this.onInteractionGoalCompleted=void 0,this.onMessageReactionAdded=void 0,this.onMessageReactionRemoved=void 0,this.onMessagesDeliveredToAll=void 0,this.onMessagesReadByAll=void 0,s.isFalsy(e[0].onTextMessageReceived)||(this.onTextMessageReceived=e[0].onTextMessageReceived),s.isFalsy(e[0].onMediaMessageReceived)||(this.onMediaMessageReceived=e[0].onMediaMessageReceived),s.isFalsy(e[0].onTypingStarted)||(this.onTypingStarted=e[0].onTypingStarted),s.isFalsy(e[0].onTypingEnded)||(this.onTypingEnded=e[0].onTypingEnded),s.isFalsy(e[0].onMessagesDelivered)||(this.onMessagesDelivered=e[0].onMessagesDelivered),s.isFalsy(e[0].onMessagesRead)||(this.onMessagesRead=e[0].onMessagesRead),s.isFalsy(e[0].onCustomMessageReceived)||(this.onCustomMessageReceived=e[0].onCustomMessageReceived),s.isFalsy(e[0].onMessageEdited)||(this.onMessageEdited=e[0].onMessageEdited),s.isFalsy(e[0].onMessageDeleted)||(this.onMessageDeleted=e[0].onMessageDeleted),s.isFalsy(e[0].onTransientMessageReceived)||(this.onTransientMessageReceived=e[0].onTransientMessageReceived),s.isFalsy(e[0].onInteractiveMessageReceived)||(this.onInteractiveMessageReceived=e[0].onInteractiveMessageReceived),s.isFalsy(e[0].onInteractionGoalCompleted)||(this.onInteractionGoalCompleted=e[0].onInteractionGoalCompleted),s.isFalsy(e[0].onMessageReactionAdded)||(this.onMessageReactionAdded=e[0].onMessageReactionAdded),s.isFalsy(e[0].onMessageReactionRemoved)||(this.onMessageReactionRemoved=e[0].onMessageReactionRemoved),s.isFalsy(e[0].onMessagesDeliveredToAll)||(this.onMessagesDeliveredToAll=e[0].onMessagesDeliveredToAll),s.isFalsy(e[0].onMessagesReadByAll)||(this.onMessagesReadByAll=e[0].onMessagesReadByAll)};t.MessageListener=r;var a=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onIncomingCallReceived=void 0,this.onOutgoingCallAccepted=void 0,this.onOutgoingCallRejected=void 0,this.onIncomingCallCancelled=void 0,this.onCallEndedMessageReceived=void 0,s.isFalsy(e[0].onIncomingCallReceived)||(this.onIncomingCallReceived=e[0].onIncomingCallReceived),s.isFalsy(e[0].onOutgoingCallAccepted)||(this.onOutgoingCallAccepted=e[0].onOutgoingCallAccepted),s.isFalsy(e[0].onOutgoingCallRejected)||(this.onOutgoingCallRejected=e[0].onOutgoingCallRejected),s.isFalsy(e[0].onIncomingCallCancelled)||(this.onIncomingCallCancelled=e[0].onIncomingCallCancelled),s.isFalsy(e[0].onCallEndedMessageReceived)||(this.onCallEndedMessageReceived=e[0].onCallEndedMessageReceived)};t.CallListener=a;var E=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onUserOnline)||(this.onUserOnline=e[0].onUserOnline),s.isFalsy(e[0].onUserOffline)||(this.onUserOffline=e[0].onUserOffline)};t.UserListener=E;var c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onGroupMemberJoined)||(this.onGroupMemberJoined=e[0].onGroupMemberJoined),s.isFalsy(e[0].onGroupMemberLeft)||(this.onGroupMemberLeft=e[0].onGroupMemberLeft),s.isFalsy(e[0].onGroupMemberKicked)||(this.onGroupMemberKicked=e[0].onGroupMemberKicked),s.isFalsy(e[0].onGroupMemberBanned)||(this.onGroupMemberBanned=e[0].onGroupMemberBanned),s.isFalsy(e[0].onGroupMemberUnbanned)||(this.onGroupMemberUnbanned=e[0].onGroupMemberUnbanned),s.isFalsy(e[0].onGroupMemberScopeChanged)||(this.onGroupMemberScopeChanged=e[0].onGroupMemberScopeChanged),s.isFalsy(e[0].onMemberAddedToGroup)||(this.onGroupMemberAddedToGroup=e[0].onMemberAddedToGroup)};t.GroupListener=c;var u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onYouLeft)||(this.onYouLeft=e[0].onYouLeft),s.isFalsy(e[0].onYouJoined)||(this.onYouJoined=e[0].onYouJoined),s.isFalsy(e[0].onUserJoined)||(this.onUserJoined=e[0].onUserJoined),s.isFalsy(e[0].onUserLeft)||(this.onUserLeft=e[0].onUserLeft),s.isFalsy(e[0].onUserListUpdated)||(this.onUserListUpdated=e[0].onUserListUpdated),s.isFalsy(e[0].onAudioModesUpdated)||(this.onAudioModesUpdated=e[0].onAudioModesUpdated),s.isFalsy(e[0].onCallEnded)||(this.onCallEnded=e[0].onCallEnded),s.isFalsy(e[0].onError)||(this.onError=e[0].onError),s.isFalsy(e[0].onRecordingStarted)||(this.onRecordingStarted=e[0].onRecordingStarted),s.isFalsy(e[0].onRecordingStopped)||(this.onRecordingStopped=e[0].onRecordingStopped),s.isFalsy(e[0].onUserMuted)||(this.onUserMuted=e[0].onUserMuted),s.isFalsy(e[0].onCallSwitchedToVideo)||(this.onCallSwitchedToVideo=e[0].onCallSwitchedToVideo)};t.OngoingCallListener=u;var p=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].loginSuccess)||(this.loginSuccess=e[0].loginSuccess),s.isFalsy(e[0].loginFailure)||(this.loginFailure=e[0].loginFailure),s.isFalsy(e[0].logoutSuccess)||(this.logoutSuccess=e[0].logoutSuccess),s.isFalsy(e[0].logoutFailure)||(this.logoutFailure=e[0].logoutFailure)};t.LoginListener=p;var C=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onConnected=void 0,this.inConnecting=void 0,this.onDisconnected=void 0,this.onConnectionError=void 0,this.onFeatureThrottled=void 0,s.isFalsy(e[0].onConnected)||(this.onConnected=e[0].onConnected),s.isFalsy(e[0].inConnecting)||(this.inConnecting=e[0].inConnecting),s.isFalsy(e[0].onDisconnected)||(this.onDisconnected=e[0].onDisconnected),s.isFalsy(e[0].onConnectionError)||(this.onConnectionError=e[0].onConnectionError),s.isFalsy(e[0].onFeatureThrottled)||(this.onFeatureThrottled=e[0].onFeatureThrottled)};t.ConnectionListener=C;var S=function(e,t){this._name=e,this._callback=t},l=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(t.Listener=S);t.MessagesListener=l;var _=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(S);t.UsersListener=_;var T=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(S);t.GroupsListener=T;var d=function(s){function e(e,t,n){var o=s.call(this,"callListner",n)||this;return o._eventListener=e,o}return i(e,s),e}(S);t.UserCallListener=d;var h=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,s}return i(e,r),e}(S);t.CallsListener=h;var R=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(S);t.UserLoginListener=R;var g=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(S);t.WSConnectionListener=g},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.InteractiveMessage=void 0;var i=n(7),c=n(1),a=n(3),u=n(0),p=n(9),C=n(41),S=n(27),E=function(E){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(4==e.length){var o=e[0],s=e[1],r=e[2],i=e[3];(n=E.call(this,o,r,s,c.MessageCategory.INTERACTIVE)||this).interactionGoal=new C.InteractionGoal(c.GoalType.NONE,[]),("object"!=typeof i||Array.isArray(i))&&(i={}),n.interactiveData=i,n.interactions=[],u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=new C.InteractionGoal(c.GoalType.NONE,[])}else if(5==e.length){o=e[0],s=e[1],r=e[2],i=e[3];var a=e[4];n=E.call(this,o,r,s,c.MessageCategory.INTERACTIVE)||this,("object"!=typeof i||Array.isArray(i))&&(i={}),("object"!=typeof a||Array.isArray(a))&&(a={}),n.interactiveData=i,n.interactionGoal=a,u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=a,n.interactions=[]}return n}return s(e,E),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getInteractiveData=function(){return this.interactiveData},e.prototype.setInteractiveData=function(e){this.interactiveData=e,this.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=e},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getInteractionGoal=function(){try{return this.getInteractionGoalFromdata()}catch(e){return this.interactionGoal}},e.prototype.setInteractionGoal=function(e){this.interactionGoal=e,this.data=r(r({},this.data),{interactionGoal:e})},e.prototype.getInteractions=function(){try{return this.getInteractionsFromData()}catch(e){return this.interactions}},e.prototype.setInteractions=function(e){this.interactions=e;var t=c.MessageConstatnts.KEYS.INTERACTIONS;this.data[t]=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.setIsSenderInteractionAllowed=function(e){this.allowSenderInteraction=this.allowSenderInteraction},e.prototype.getIsSenderInteractionAllowed=function(){return this.allowSenderInteraction},e.prototype.getInteractionGoalFromdata=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL])return new C.InteractionGoal(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.TYPE],e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.ELEMENT_IDS])}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getInteractionsFromData=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTIONS])return(e[c.MessageConstatnts.KEYS.INTERACTIONS]||[]).map(function(e){return new S.Interaction(e[c.MessageConstatnts.KEYS.ELEMENT_ID],e[c.MessageConstatnts.KEYS.INTERACTED_AT])})}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new a.User(t);var n=new p.Group(t[c.GroupConstants.KEYS.GUID],t[c.GroupConstants.KEYS.NAME],t[c.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("InteractiveMessageModel: getReceiverFromData",e),e}},e}(i.BaseMessage);t.InteractiveMessage=E},function(e,t,n){"use strict";t.__esModule=!0,t.Interaction=void 0;var o=n(1),s=function(){function n(e,t){this.elementId=e,this.interactedAt=t}return n.prototype.getElementId=function(){return this.elementId},n.prototype.getInteractedAt=function(){return this.interactedAt},n.prototype.setElementId=function(e){this.elementId=e},n.prototype.setInteractedAt=function(e){this.interactedAt=this.interactedAt},n.getInteractionFromJSON=function(e){var t=e[o.MessageConstatnts.KEYS.INTERACTED_AT];return new n(e[o.MessageConstatnts.KEYS.ELEMENT_ID],t)},n}();t.Interaction=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.Action=void 0;var i=n(7),c=n(9),u=n(3),p=n(1),a=n(0),C=n(11),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.actionFromJSON=function(e){var t=new this(e[p.MessageConstatnts.KEYS.RECEIVER],e[p.MessageConstatnts.KEYS.TYPE],e[p.MessageConstatnts.KEYS.RECEIVER_TYPE],p.MessageCategory.ACTION),n=e[p.MessageConstatnts.KEYS.DATA];if(t.data=n,t.setAction(n[p.MessageConstatnts.KEYS.ACTION]),n[p.ActionConstatnts.ACTION_KEYS.EXTRAS]){var o=n[p.ActionConstatnts.ACTION_KEYS.EXTRAS];if(o[p.ActionConstatnts.ACTION_KEYS.SCOPE]){var s=o[p.ActionConstatnts.ACTION_KEYS.SCOPE];s[p.ActionConstatnts.ACTION_KEYS.NEW]&&s[p.ActionConstatnts.ACTION_KEYS.OLD]&&(t.setOldScope(s[p.ActionConstatnts.ACTION_KEYS.OLD]),t.setNewScope(s[p.ActionConstatnts.ACTION_KEYS.NEW]))}}n[p.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[p.MessageConstatnts.KEYS.METADATA]);var r=n[p.ActionConstatnts.ACTION_KEYS.ENTITIES];if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var i=new u.User(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=i,t.setSender(i)}else{var a=new c.Group("","","");Object.assign(a,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=a}if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR])if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=i}else{a=new c.Group("","","");Object.assign(a,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=a}if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON])if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=i}else if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.GROUP){a=new c.Group("","","");Object.assign(a,r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=a}else if(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.MESSAGE){var E=C.MessageController.trasformJSONMessge(r[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][p.ActionConstatnts.ACTION_KEYS.ENTITY]);t.actionOn=E}return t.setMessage(t.getActionMessage(t)),t},t.prototype.getOldScope=function(){return this.oldScope},t.prototype.setOldScope=function(e){this.oldScope=e},t.prototype.getNewScope=function(){return this.newScope},t.prototype.setNewScope=function(e){this.newScope=e},t.prototype.getRawData=function(){return this.rawData},t.prototype.setRawData=function(e){this.rawData=e},t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getActionBy=function(){return this.actionBy},t.prototype.setActionBy=function(e){this.actionBy=e},t.prototype.getActionOn=function(){return this.actionOn},t.prototype.setActionOn=function(e){this.actionOn=e},t.prototype.getActionFor=function(){return this.actionFor},t.prototype.setActionFor=function(e){this.actionFor=e},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},t.prototype.getActionMessage=function(e){var t="";switch(e.getType()){case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_USER:case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP:switch(e.getAction()){case p.ActionConstatnts.ACTION_KEYS.ACTION_CREATED:case p.ActionConstatnts.ACTION_KEYS.ACTION_UPDATED:case p.ActionConstatnts.ACTION_KEYS.ACTION_DELETED:}break;case p.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP_MEMBER:switch(e.getAction()){case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_JOINED:var n=e.getActionBy();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_GROUP_JOINED_MESSAGE,n.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_LEFT:n=e.getActionBy();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_GROUP_LEFT_MESSAGE,n.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_KICKED:n=e.getActionBy();var o=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_KICKED_MESSAGE,n.getName(),o.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_BANNED:n=e.getActionBy(),o=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_BANNED_MESSAGE,n.getName(),o.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_UNBANNED:n=e.getActionBy(),o=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_UNBANNED_MESSAGE,n.getName(),o.getName());break;case p.ActionConstatnts.ACTION_KEYS.ACTION_SCOPE_CHANGED:n=e.getActionBy(),o=e.getActionOn();var s=e.getNewScope();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_SCOPE_CHANGED,n.getName(),o.getName(),s);break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_ADDED:n=e.getActionBy(),o=e.getActionOn();t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MEMBER_ADDED_TO_GROUP,n.getName(),o.getName());break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_EDITED:t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MESSAGE_EDITED_MESSAGE,"");break;case p.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_DELETED:t=a.format(p.ActionConstatnts.ActionMessages.ACTION_MESSAGE_DELETED_MESSAGE,"")}}return t},t.prototype.getSenderFromData=function(){var e=this.data[p.ActionConstatnts.ACTION_KEYS.ENTITIES];if(e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY]&&e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==p.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var t=new u.User(e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]);return Object.assign(t,e[p.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][p.ActionConstatnts.ACTION_KEYS.ENTITY]),t}},t.TYPE=p.MessageConstatnts.TYPE,t.RECEIVER_TYPE=p.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=p.MessageConstatnts.CATEGORY,t.ACTION_TYPE=p.ActionConstatnts.ACTION_TYPE,t}(i.BaseMessage);t.Action=E},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.Call=void 0;var s=n(7),a=n(9),E=n(1),c=n(0),u=n(3),p=function(s){function e(e,t,n,o){return c.isFalsy(o)?s.call(this,e,t,n,E.MessageCategory.CALL)||this:s.call(this,e,t,n,o)||this}return r(e,s),e.prototype.getCallInitiator=function(){try{return this.getCallInitiatedByFromData()}catch(e){return this.callInitiator}},e.prototype.setCallInitiator=function(e){this.callInitiator=e},e.prototype.getCallReceiver=function(){try{return this.getCallReceivedByFromData()}catch(e){return this.callReceiver}},e.prototype.setCallReceiver=function(e){this.callReceiver=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSessionId=function(){return this.sessionId},e.prototype.setSessionId=function(e){this.sessionId=e},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getAction=function(){return this.action},e.prototype.setAction=function(e){this.action=e},e.prototype.getInitiatedAt=function(){return this.initiatedAt},e.prototype.setInitiatedAt=function(e){this.initiatedAt=e},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getRawData=function(){return this.rawData},e.prototype.setRawData=function(e){this.rawData=e},e.callFromJSON=function(e){try{var t=new this(e[E.MessageConstatnts.KEYS.RECEIVER],e[E.MessageConstatnts.KEYS.TYPE],e[E.MessageConstatnts.KEYS.RECEIVER_TYPE],E.MessageCategory.CALL),n=e[E.MessageConstatnts.KEYS.DATA];t.setAction(n[E.MessageConstatnts.KEYS.ACTION]),n[E.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[E.MessageConstatnts.KEYS.METADATA]);var o=n[E.ActionConstatnts.ACTION_KEYS.ENTITIES];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON]){var s=o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON];if(s[E.CallConstants.CALL_KEYS.CALL_ENTITY]){var r=s[E.CallConstants.CALL_KEYS.CALL_ENTITY];if(r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]&&(t.sessionId=r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]),r[E.CallConstants.CALL_KEYS.CALL_STATUS]&&(t.status=r[E.CallConstants.CALL_KEYS.CALL_STATUS]),r[E.CallConstants.CALL_KEYS.CALL_DATA]){var i=r[E.CallConstants.CALL_KEYS.CALL_DATA];if(i[E.CallConstants.CALL_KEYS.CALL_METADATA]&&(t.metadata=i[E.CallConstants.CALL_KEYS.CALL_METADATA]),i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES])i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES]}r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]&&(t.initiatedAt=r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]),r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]&&(t.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]),r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT]&&(t.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT])}}return t}catch(e){c.Logger.error("CallModel: callFromJSON",e)}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getSenderFromData",e),e}},e.prototype.getCallInitiatedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getCallInitiatedByFromData",e),e}},e.prototype.getCallReceivedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]){if(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY_TYPE]==E.CallConstants.CALL_KEYS.CALL_ENTITY_USER)return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]);var t=new a.Group(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.GUID],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.NAME],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.TYPE]);return Object.assign(t,e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY])}}catch(e){throw c.Logger.error("CallModel:getCallReceivedByFromData",e),e}},e.TYPE=E.MessageConstatnts.TYPE,e.RECEIVER_TYPE=E.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=E.MessageConstatnts.CATEGORY,e.ACTION_TYPE=E.ActionConstatnts.ACTION_TYPE,e}(s.BaseMessage);t.Call=p},function(e,t,n){"use strict";t.__esModule=!0,t.MessageReceipt=void 0;var o=function(){function e(){this.RECEIPT_TYPE={READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERED_TO_ALL_RECEIPT:"deliveredToAll"},this.receiptType=this.RECEIPT_TYPE.DELIVERY_RECEIPT}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.setTimestamp=function(e){this.timestamp=e},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReceiptType=function(){return this.receiptType},e.prototype.setReceiptType=function(e){void 0===e&&(e=this.RECEIPT_TYPE.DELIVERY_RECEIPT),this.receiptType=e},e}();t.MessageReceipt=o},function(e,t,n){"use strict";t.__esModule=!0,t.KeyStore=void 0;var r=n(0),i=n(1),a=n(2),o=n(14),s=function(){function e(e){this.store=i.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e);try{this.keyStore=o.default}catch(e){r.Logger.error("KeyStore: constructor",{e:e})}}return e.getInstance=function(){return null==e.KeyStore&&(e.KeyStore=new e),e.KeyStore},e.prototype.set=function(e,t){var n=r.getKeyprefix(i.LOCAL_STORE.KEYS_STORE,e);return this.keyStore.setItem(n,JSON.stringify(t))},e.prototype.get=function(e){var o=this,s=r.getKeyprefix(i.LOCAL_STORE.KEYS_STORE,e);return new Promise(function(n,t){try{o.keyStore.getItem(s).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e}();t.KeyStore=s},function(e,t,n){"use strict";t.__esModule=!0,t.ConversationController=void 0;var c=n(44),u=n(0),o=function(){function e(){}return e.trasformJSONConversation=function(e,t,n,o,s,r,i,a){var E;try{E=new c.Conversation(e,t,n,o,s,r,i,a)}catch(e){u.Logger.error("ConversationController:transformJSONConversation",e)}return E},e}();t.ConversationController=o},function(e,t,n){"use strict";t.__esModule=!0,t.MessageListnerMaping=void 0;var r=n(0),i=n(1),a=n(2),o=n(14),s=function(){function e(e){this.store=i.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e);try{this.settingsStore=o.default}catch(e){r.Logger.error("MessageListnerEventMaping: constructor",{e:e})}}return e.getInstance=function(){return null==e.settingsStore&&(e.settingsStore=new e),e.settingsStore},e.prototype.set=function(e,t){var n=r.getKeyprefix(i.LOCAL_STORE.MESSAGE_LISTENERS_LIST,e);return this.settingsStore.setItem(n,JSON.stringify(t))},e.prototype.get=function(e){var o=this,s=r.getKeyprefix(i.LOCAL_STORE.MESSAGE_LISTENERS_LIST,e);return new Promise(function(n,t){try{o.settingsStore.getItem(s).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.selectStore=function(e){this.store=e},e.settingsStore=null,e}();t.MessageListnerMaping=s},function(e,t,n){"use strict";t.__esModule=!0,t.TypingIndicator=void 0;var o=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.metadata=n}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TypingIndicator=o},function(e,t,n){"use strict";t.__esModule=!0,t.Reaction=void 0;var o=n(3),i=n(0),s=function(){function e(e,t,n,o,s,r){i.isFalsy(e)||(this.id=e),i.isFalsy(t)||(this.messageId=t),i.isFalsy(n)||(this.reaction=n),i.isFalsy(o)||(this.uid=o),i.isFalsy(s)||(this.reactedAt=s),i.isFalsy(r)||(this.reactedBy=r)}return e.prototype.getReactionId=function(){return this.id},e.prototype.setReactionId=function(e){this.id=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getUid=function(){return this.uid},e.prototype.setUid=function(e){this.uid=e},e.prototype.getReactedAt=function(){return this.reactedAt},e.prototype.setReactedAt=function(e){this.reactedAt=e},e.prototype.getReactedBy=function(){return new o.User(this.reactedBy)},e.prototype.setReactedBy=function(e){this.reactedBy=e},e}();t.Reaction=s},function(e,t,n){"use strict";t.__esModule=!0,t.TransientMessage=void 0;var o=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.data=n||{}}return e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TransientMessage=o},function(e,t,n){"use strict";t.__esModule=!0,t.EndpointFactory=void 0;var E=n(0),c=n(1),u=n(15),p=n(6),C=n(2),o=function(){function a(){this.baseUrl="https://%s.apiclient-%s.cometchat.io/",this.apiVersion=c.APPINFO.apiVersion,this.adminApiUrl="https://%s.api-%s.cometchat.io/",this.adminApiVersion=c.APPINFO.apiVersion,this.extensionApi="https://%s-%s.%s/%s",this.prosodyApi="https://%s.%s/%s",this.wsApi="https://%s/%s",this.uriEndpoints={authToken:{endpoint:"users/{{uid}}/auth_tokens",method:"POST",data:{uid:"string|max:100"},isAdminApi:!0},appSettings:{endpoint:"settings",method:"GET"},login:{endpoint:"admin/users/auth",method:"POST",data:{uid:"string|max:100"}},logout:{endpoint:"admin/users/auth/{{authToken}}",method:"DELETE"},getMyDetails:{endpoint:"me",method:"GET"},updateMyDetails:{endpoint:"me",method:"PUT"},getJWT:{endpoint:"me/jwt",method:"POST"},userSessions:{endpoint:"user_sessions",method:"POST"},users:{endpoint:"users",method:"GET"},user:{endpoint:"users/{{uid}}",method:"GET"},blockUsers:{endpoint:"blockedusers",method:"POST"},blockedUsersList:{endpoint:"blockedusers",method:"GET"},unblockUsers:{endpoint:"blockedusers",method:"DELETE"},userLogout:{endpoint:"me",method:"DELETE"},createUser:{endpoint:"users",method:"POST",isAdminApi:!0},updateUser:{endpoint:"users/{{uid}}",method:"PUT",isAdminApi:!0},sendFriendRequests:{endpoint:"user/friends",method:"POST",data:{uids:"array<string|max:100>"}},getFriends:{endpoint:"user/friends",method:"GET"},unfriend:{endpoint:"user/friends/{{uid}}/{{gid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},acceptFriendRequest:{endpoint:"user/friends/{{uid}}/accept",method:"PUT",data:{uids:"array<string|max:100>"}},rejectFriendRequest:{endpoint:"user/friends/{{uid}}/reject",method:"DELETE",data:{uids:"array<string|max:100>"}},createGroup:{endpoint:"groups",method:"POST",data:{guid:"required|string|max:100",name:"required|string|max:100",type:"enum|public,protected,password",password:"filled|string|max:100"}},getGroups:{endpoint:"groups",method:"GET"},getGroup:{endpoint:"groups/{{guid}}",method:"GET"},updateGroup:{endpoint:"groups/{{guid}}",method:"PUT"},deleteGroup:{endpoint:"groups/{{guid}}",method:"DELETE"},addGroupMembers:{endpoint:"groups/{{guid}}/members",method:"POST",data:{uids:"array<string|max:100>"}},getGroupMembers:{endpoint:"groups/{{guid}}/members",method:"GET"},joinGroup:{endpoint:"groups/{{guid}}/members",method:"POST"},leaveGroup:{endpoint:"groups/{{guid}}/members",method:"DELETE"},kickGroupMembers:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},changeScopeOfMember:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"PUT",data:{uids:"array<string|max:100>"}},banGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"POST",data:{uids:"array<string|max:100>"}},unbanGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},addMemebersToGroup:{endpoint:"groups/{{guid}}/members",method:"PUT"},getBannedGroupMembers:{endpoint:"groups/{{guid}}/bannedusers",method:"GET"},promotemoteGroupMember:{endpoint:"groups/{{guid}}/promote",method:"PUT",data:{uids:"array<string|max:100>"}},demoteGroupMember:{endpoint:"groups/{{guid}}/demote",method:"DELETE",data:{uids:"array<string|max:100>"}},transferOwnership:{endpoint:"groups/{{guid}}/owner",method:"PATCH"},sendMessage:{endpoint:"messages",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},sendMessageInThread:{endpoint:"messages/{{parentId}}/thread",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},getMessages:{endpoint:"messages",method:"GET"},getMessageDetails:{endpoint:"messages/{{messageId}}",method:"GET"},addReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"POST"},removeReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"DELETE"},getFilteredReactionsList:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"GET",data:{}},getReactionsList:{endpoint:"messages/{{messageId}}/reactions",method:"GET",data:{}},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},markAsReadForUser:{endpoint:"users/{{uid}}/conversation/read",method:"POST"},markAsReadForGroup:{endpoint:"groups/{{guid}}/conversation/read",method:"POST"},markAsDeliveredForUser:{endpoint:"users/{{uid}}/conversation/delivered",method:"POST"},markAsDeliveredForGroup:{endpoint:"groups/{{guid}}/conversation/delivered",method:"POST"},markUserMessagesAsUnread:{endpoint:"users/{{uid}}/conversation/read",method:"DELETE"},markGroupMessagesAsUnread:{endpoint:"groups/{{guid}}/conversation/read",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"},getUserConversation:{endpoint:"users/{{uid}}/conversation",method:"GET"},getGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"GET"},deleteUserConversation:{endpoint:"users/{{uid}}/conversation",method:"DELETE"},deleteGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"DELETE"},updateUserConversation:{endpoint:"users/{{uid}}/conversation",method:"PUT"},updateGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"PUT"},updateCallType:{endpoint:"calls/{{sessionid}}/type",method:"PATCH"},getUserConversationStarter:{endpoint:"ai/conversation-starter/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationStarter:{endpoint:"ai/conversation-starter/groups/{{guid}}",method:"GET",isAIApi:!0},getUserSmartReply:{endpoint:"ai/smart-replies/users/{{uid}}",method:"GET",isAIApi:!0},getGroupSmartReply:{endpoint:"ai/smart-replies/groups/{{guid}}",method:"GET",isAIApi:!0},markInteracted:{endpoint:"messages/{{messageId}}/interacted",method:"PATCH"},getUserConversationSummary:{endpoint:"ai/conversation-summary/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationSummary:{endpoint:"ai/conversation-summary/groups/{{guid}}",method:"GET",isAIApi:!0},getBotAssistanceInUserConversation:{endpoint:"ai/bots/{{botId}}/assistance/users/{{uid}}",method:"GET",isAIApi:!0},getBotAssistanceInGroupConversation:{endpoint:"ai/bots/{{botId}}/assistance/groups/{{guid}}",method:"GET",isAIApi:!0},getPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"GET"},updatePushPreferences:{endpoint:"notifications/push/v1/preferences",method:"PATCH"},resetPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"DELETE"},registerToken:{endpoint:"notifications/push/v1/tokens",method:"POST"},unregisterToken:{endpoint:"notifications/push/v1/tokens",method:"DELETE"},muteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"PUT"},unmuteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"DELETE"},getMutedConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"GET"},updateTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"PATCH"},getTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"GET"}}}return a.prototype.getEndpointData=function(i){return new Promise(function(o,t){try{var s=p.CometChat.appSettings.getAdminHost(),r=p.CometChat.appSettings.getClientHost();u.LocalStorage.getInstance().get(c.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(E.isFalsy(e)){var t={};if((new a).uriEndpoints.hasOwnProperty(i))if((t=(new a).uriEndpoints[i]).hasOwnProperty("isAdminApi"))if(E.isFalsy(s)){var n=E.format((new a).adminApiUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).adminApiVersion+"/"+t.endpoint;t.endpoint=n,o(t)}else{n="https://"+s+"/"+t.endpoint;t.endpoint=n,o(t)}else if(E.isFalsy(r)){n=E.format((new a).baseUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).apiVersion+"/"+t.endpoint;t.endpoint=n,o(t)}else{n="https://"+r+"/"+t.endpoint;t.endpoint=n,o(t)}}else{t={};if((new a).uriEndpoints.hasOwnProperty(i))if((t=(new a).uriEndpoints[i]).hasOwnProperty("isAdminApi")){n="https://"+e[c.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+e[c.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=n,o(t)}else{n="https://"+e[c.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+e[c.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=n,o(t)}}},function(e){var t;if((new a).uriEndpoints.hasOwnProperty(i))if((t=(new a).uriEndpoints[i]).hasOwnProperty(["isAdminApi"]))if(E.isFalsy(s)){var n=E.format((new a).adminApiUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).adminApiVersion+"/"+t.endpoint;t.endpoint=n,o(t)}else t.endpoint="https://"+s+"/"+t.endpoint,o(t);else if(E.isFalsy(r)){n=E.format((new a).baseUrl,p.CometChat.getAppId(),p.CometChat.appSettings.getRegion())+(new a).apiVersion+"/"+t.endpoint;t.endpoint=n,o(t)}else t.endpoint="https://"+r+"/"+t.endpoint,o(t)})}catch(e){t(new C.CometChatException(e))}})},a}();t.EndpointFactory=o},function(e,t,n){"use strict";t.__esModule=!0,t.getEndPoint=void 0;var o=n(37),i=n(2);t.getEndPoint=function(e,r){void 0===e&&(e=""),void 0===r&&(r={});var t=new o.EndpointFactory;return new Promise(function(o,s){try{t.getEndpointData(e).then(function(e){var t=e;if(t){for(var n in r)t.endpoint=t.endpoint.replace("{{"+n+"}}",r[n]);o(t)}else s({error:"Unknown endPoint name."})})}catch(e){s(new i.CometChatException(e))}})}},function(e,t,n){"use strict";t.__esModule=!0,t.MainVideoContainerSetting=t.CallSettingsBuilder=t.CallSettings=void 0;var o=n(1),s=n(0),r=function(){function e(e){this.sessionID=e.sessionID,this.defaultLayout=e.defaultLayout,this.isAudioOnly=e.isAudioOnly,this.region=e.region,this.domain=e.domain,this.user=e.user,this.listener=e.listener,this.mode=e.mode,this.ShowEndCallButton=e.ShowEndCallButton,this.ShowSwitchCameraButton=e.ShowSwitchCameraButton,this.ShowMuteAudioButton=e.ShowMuteAudioButton,this.ShowPauseVideoButton=e.ShowPauseVideoButton,this.ShowAudioModeButton=e.ShowAudioModeButton,this.StartAudioMuted=e.StartAudioMuted,this.StartVideoMuted=e.StartVideoMuted,this.analyticsSettings=e.analyticsSettings,this.appId=e.appId,this.defaultAudioMode=e.defaultAudioMode,this.ShowSwitchToVideoCallButton=e.ShowSwitchToVideoCallButton,this.AvatarMode=e.AvatarMode,this.ShowRecordingButton=e.ShowRecordingButton,this.StartRecordingOnCallStart=e.StartRecordingOnCallStart,this.MainVideoContainerSetting=e.MainVideoContainerSetting,this.EnableVideoTileClick=e.EnableVideoTileClick,this.enableDraggableVideoTile=e.enableDraggableVideoTile}return e.prototype.getSessionId=function(){return this.sessionID},e.prototype.isAudioOnlyCall=function(){return this.isAudioOnly},e.prototype.getUser=function(){return this.user},e.prototype.getRegion=function(){return this.region},e.prototype.getAppId=function(){return this.appId},e.prototype.getDomain=function(){return this.domain},e.prototype.isDefaultLayoutEnabled=function(){return this.defaultLayout},e.prototype.getCallEventListener=function(){return this.listener},e.prototype.getMode=function(){return this.mode},e.prototype.isEndCallButtonEnabled=function(){return this.ShowEndCallButton},e.prototype.isSwitchCameraButtonEnabled=function(){return this.ShowSwitchCameraButton},e.prototype.isMuteAudioButtonEnabled=function(){return this.ShowMuteAudioButton},e.prototype.isPauseVideoButtonEnabled=function(){return this.ShowPauseVideoButton},e.prototype.isAudioModeButtonEnabled=function(){return this.ShowAudioModeButton},e.prototype.getStartWithAudioMuted=function(){return this.StartAudioMuted},e.prototype.getStartWithVideoMuted=function(){return this.StartVideoMuted},e.prototype.getAnalyticsSettings=function(){return this.analyticsSettings},e.prototype.getDefaultAudioMode=function(){return this.defaultAudioMode},e.prototype.isAudioToVideoButtonEnabled=function(){return this.ShowSwitchToVideoCallButton},e.prototype.getAvatarMode=function(){return this.AvatarMode},e.prototype.isRecordingButtonEnabled=function(){return this.ShowRecordingButton},e.prototype.shouldStartRecordingOnCallStart=function(){return this.StartRecordingOnCallStart},e.prototype.getMainVideoContainerSetting=function(){return this.MainVideoContainerSetting},e.prototype.isVideoTileClickEnabled=function(){return this.EnableVideoTileClick},e.prototype.isVideoTileDragEnabled=function(){return this.enableDraggableVideoTile},e.POSITION_TOP_LEFT="top-left",e.POSITION_TOP_RIGHT="top-right",e.POSITION_BOTTOM_LEFT="bottom-left",e.POSITION_BOTTOM_RIGHT="bottom-right",e.ASPECT_RATIO_DEFAULT="default",e.ASPECT_RATIO_CONTAIN="contain",e.ASPECT_RATIO_COVER="cover",e}();t.CallSettings=r;var i=function(){function e(){this.defaultLayout=!0,this.isAudioOnly=!1,this.mode=o.CallConstants.CALL_MODE.DEFAULT,this.ShowEndCallButton=!0,this.ShowSwitchCameraButton=!0,this.ShowMuteAudioButton=!0,this.ShowPauseVideoButton=!0,this.ShowAudioModeButton=!0,this.StartAudioMuted=!1,this.StartVideoMuted=!1,this.analyticsSettings={},this.ShowSwitchToVideoCallButton=!0,this.AvatarMode="circle",this.ShowRecordingButton=!1,this.StartRecordingOnCallStart=!1,this.MainVideoContainerSetting=new a,this.EnableVideoTileClick=!0,this.enableDraggableVideoTile=!0}return e.prototype.setSessionID=function(e){return this.sessionID=e,this},e.prototype.enableDefaultLayout=function(e){return this.defaultLayout=e,this},e.prototype.setIsAudioOnlyCall=function(e){return this.isAudioOnly=e,this},e.prototype.setRegion=function(e){return this.region=e,this},e.prototype.setDomain=function(e){return this.domain=e,this},e.prototype.setUser=function(e){return this.user=e,this},e.prototype.setCallEventListener=function(e){return this.listener=e,this},e.prototype.setMode=function(e){return this.mode=e,this},e.prototype.showEndCallButton=function(e){return this.ShowEndCallButton=e,this},e.prototype.showSwitchCameraButton=function(e){return this.ShowSwitchCameraButton=e,this},e.prototype.showMuteAudioButton=function(e){return this.ShowMuteAudioButton=e,this},e.prototype.showPauseVideoButton=function(e){return this.ShowPauseVideoButton=e,this},e.prototype.showAudioModeButton=function(e){return this.ShowAudioModeButton=e,this},e.prototype.startWithAudioMuted=function(e){return this.StartAudioMuted=e,this},e.prototype.startWithVideoMuted=function(e){return this.StartVideoMuted=e,this},e.prototype.setAnalyticsSettings=function(e){return this.analyticsSettings=e,this},e.prototype.setAppId=function(e){return this.appId=e,this},e.prototype.setDefaultAudioMode=function(e){return this.defaultAudioMode=e,this},e.prototype.showSwitchToVideoCallButton=function(e){return this.ShowSwitchToVideoCallButton=e,this},e.prototype.setAvatarMode=function(e){return this.AvatarMode=e,this},e.prototype.showRecordingButton=function(e){return this.ShowRecordingButton=e,this},e.prototype.startRecordingOnCallStart=function(e){return this.StartRecordingOnCallStart=e,this},e.prototype.setMainVideoContainerSetting=function(e){return this.MainVideoContainerSetting=e,this},e.prototype.enableVideoTileClick=function(e){return this.EnableVideoTileClick=e,this},e.prototype.enableVideoTileDrag=function(e){return this.enableDraggableVideoTile=e,this},e.prototype.build=function(){return new r(this)},e}();t.CallSettingsBuilder=i;var a=function(){function e(){this.videoFit=r.ASPECT_RATIO_CONTAIN,this.zoomButton=o.CallConstants.ZOOM_BUTTON_DEFAULT_PARAMS,this.fullScreenButton=o.CallConstants.FULL_SCREEN_BUTTON_DEFAULT_PARAMS,this.userListButton=o.CallConstants.USER_LIST_BUTTON_DEFAULT_PARAMS,this.nameLabel=o.CallConstants.NAME_LABEL_DEFAULT_PARAMS}return e.prototype.setMainVideoAspectRatio=function(e){this.videoFit=e},e.prototype.setFullScreenButtonParams=function(e,t){s.isFalsy(e)||(this.fullScreenButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.fullScreenButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e.prototype.setNameLabelParams=function(e,t,n){s.isFalsy(e)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t),s.isFalsy(n)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.COLOR]=n)},e.prototype.setZoomButtonParams=function(e,t){s.isFalsy(e)||(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e.prototype.setUserListButtonParams=function(e,t){s.isFalsy(e)||(this.userListButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.userListButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e}();t.MainVideoContainerSetting=a},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CallingComponent=void 0;var i,a,E,c,u,p=n(54),C=n(17),S=n(6),l=n(3),_=n(1),T=n(16),d=n(55),h=n(0),R=n(5),r=function(t){function r(e){var r=t.call(this,e)||this;return r.state={shouldLoad:!1},a=e.callsettings,h.getCallSettings(a).then(function(e){var t=e.callSettingsNew,n=e.call,o=e.CallScreen,s=e.CometChatRTC;E=t,i=n,c=o,u=s,r.setState({shouldLoad:!0})}),r}return s(r,t),r.prototype.render=function(){return this.state.shouldLoad?p.createElement(C.View,{style:{flex:1,backgroundColor:"#000"}},p.createElement(c,{ref:function(e){return r.ref=e},style:{flex:1,backgroundColor:"#000"},callsettings:E,onCallEnded:function(){h.Logger.log("CallingComponent","oncallEnded")},onCallEndButtonPressed:function(){var e,t,n,o;i?(h.isFalsy(u)?(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.endCall)&&(null===(t=null==r?void 0:r.ref)||void 0===t||t.endCall()):u.endCall(),setTimeout(function(){S.CometChat.endCall(a.getSessionId(),!0)},1e3)):(h.isFalsy(u)?(null===(n=null==r?void 0:r.ref)||void 0===n?void 0:n.endCall)&&(null===(o=null==r?void 0:r.ref)||void 0===o||o.endCall()):u.endCall(),T.CallController.getInstance().getCallListner()&&T.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null))},onUserJoined:function(e){if(e){var t=void 0;h.isFalsy(e.uid)||h.isFalsy(e.name)||((t=new l.User(e)).setStatus("online"),S.CometChat.user.getUid().toLowerCase()!=t.getUid().toLowerCase()&&T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onUserJoined)||T.CallController.getInstance().getCallListner()._eventListener.onUserJoined(t)))}},onUserLeft:function(e){if(e){var t=void 0;h.isFalsy(e.uid)||h.isFalsy(e.name)||((t=new l.User(e)).setStatus("online"),S.CometChat.user.getUid().toLowerCase()!=t.getUid().toLowerCase()&&T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onUserLeft)||T.CallController.getInstance().getCallListner()._eventListener.onUserLeft(t)))}},onUserListChanged:function(e){var n=[];e&&0<e.length&&(e.map(function(e){if(!h.isFalsy(e.uid)&&!h.isFalsy(e.name)){var t=new l.User(e);t.setStatus("online"),n.push(t)}}),T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onUserListUpdated)||T.CallController.getInstance().getCallListner()._eventListener.onUserListUpdated(n)))},onAudioModeChanged:function(e){var o=[];e&&0<e.length&&(e.map(function(e){var t="",n=!1;e.hasOwnProperty("mode")&&(t=e.mode),e.hasOwnProperty("isSelected")&&(n=e.isSelected),e.hasOwnProperty("type")&&(t=e.type),e.hasOwnProperty("selected")&&(n=e.selected),o.push(new d.AudioMode(t,n))}),T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onAudioModesUpdated)||T.CallController.getInstance().getCallListner()._eventListener.onAudioModesUpdated(o)))},onCallSwitchedToVideo:function(e){if(h.Logger.info("onCallSwitchedToVideo received in SDK = ",e),e.hasOwnProperty("initiator")&&e.hasOwnProperty("sessionId")&&!h.isFalsy(e.initiator.uid)&&!h.isFalsy(e.sessionId)&&e.hasOwnProperty("accepted")&&!h.isFalsy(e.accepted.uid)){var t=e.sessionId,n=new l.User(e.initiator);n.setStatus("online");var o=new l.User(e.accepted);if(o.setStatus("online"),T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo)||T.CallController.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo(t,n,o)),e.initiator.uid.toLowerCase()===S.CometChat.user.getUid().toLowerCase()&&!e.sessionId.includes("v1."))try{R.makeApiCall("updateCallType",{sessionid:t},{type:"video"}).then(function(e){h.Logger.log("API :: response",e)},function(e){h.Logger.error("CallController :: onSwitchedToVideo",e)})}catch(e){h.Logger.error("CallController :: onSwitchedToVideo",e)}}},onRecordingToggled:function(e){if(h.Logger.info("onRecordingToggled received in SDK = ",e),e&&e.hasOwnProperty("user")&&e.hasOwnProperty("recordingStarted")&&!h.isFalsy(e.user.uid)&&!h.isFalsy(e.user.name)){var t=new l.User(e.user);t.setStatus("online");var n=e.recordingStarted;T.CallController.getInstance().getCallListner()&&(n?h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onRecordingStarted)||T.CallController.getInstance().getCallListner()._eventListener.onRecordingStarted(t):h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onRecordingStopped)||T.CallController.getInstance().getCallListner()._eventListener.onRecordingStopped(t))}},onUserMuted:function(e){if(h.Logger.info("onUserMuted received in SDK = ",e),e&&e.hasOwnProperty("muted")&&e.hasOwnProperty("mutedBy")&&!h.isFalsy(e.muted.uid)&&!h.isFalsy(e.muted.name)&&!h.isFalsy(e.mutedBy.uid)&&!h.isFalsy(e.mutedBy.name)){var t=new l.User(e.muted);t.setStatus("online");var n=new l.User(e.mutedBy);n.setStatus("online"),T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onUserMuted)||T.CallController.getInstance().getCallListner()._eventListener.onUserMuted(t,n))}}})):null},r.switchCamera=function(){var e,t;h.isFalsy(u)?(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.switchCamera)?null===(t=null==r?void 0:r.ref)||void 0===t||t.switchCamera():h.Logger.error("CallingComponent :: switchCamera","Calling Component is not installed"):u.switchCamera()},r.endCall=function(e,t){var n,o;void 0===e&&(e=!1),h.isFalsy(u)?(null===(n=null==r?void 0:r.ref)||void 0===n?void 0:n.endCall)?(null===(o=null==r?void 0:r.ref)||void 0===o||o.endCall(),e&&!h.isFalsy(t)&&T.CallController.getInstance().getCallListner()&&(h.isFalsy(T.CallController.getInstance().getCallListner()._eventListener.onCallEnded)||T.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t))):h.Logger.error("CallingComponent :: endCall","Calling Component is not installed"):u.endCall()},r.muteAudio=function(e){var t,n,o,s;e?h.isFalsy(u)?(null===(t=null==r?void 0:r.ref)||void 0===t?void 0:t.muteAudio)?null===(n=null==r?void 0:r.ref)||void 0===n||n.muteAudio():h.Logger.error("CallingComponent :: muteAudio","Calling Component is not installed"):u.muteAudio():h.isFalsy(u)?(null===(o=null==r?void 0:r.ref)||void 0===o?void 0:o.unMuteAudio)?null===(s=null==r?void 0:r.ref)||void 0===s||s.unMuteAudio():h.Logger.error("CallingComponent :: muteAudio","Calling Component is not installed"):u.unMuteAudio()},r.pauseVideo=function(e){var t,n,o,s;e?h.isFalsy(u)?(null===(t=null==r?void 0:r.ref)||void 0===t?void 0:t.pauseVideo)?null===(n=null==r?void 0:r.ref)||void 0===n||n.pauseVideo():h.Logger.error("CallingComponent :: pauseVideo","Calling Component is not installed"):u.pauseVideo():h.isFalsy(u)?(null===(o=null==r?void 0:r.ref)||void 0===o?void 0:o.unPauseVideo)?null===(s=null==r?void 0:r.ref)||void 0===s||s.unPauseVideo():h.Logger.error("CallingComponent :: muteAudio","Calling Component is not installed"):u.unPauseVideo()},r.setAudioMode=function(e){var t,n;h.isFalsy(u)?(null===(t=null==r?void 0:r.ref)||void 0===t?void 0:t.setAudioMode)?(e=e.toUpperCase(),-1<Object.keys(_.CallConstants.AUDIO_MODE).indexOf(e)&&(null===(n=null==r?void 0:r.ref)||void 0===n||n.setAudioMode(e))):h.Logger.error("CallingComponent :: setAudioMode","Calling Component is not installed"):(e=e.toUpperCase(),-1<Object.keys(_.CallConstants.AUDIO_MODE).indexOf(e)&&u.setAudioMode(e))},r.getAudioOutputModes=function(){return new Promise(function(t,n){var e,o;if(h.isFalsy(u))(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.getAudioModes)?null===(o=null==r?void 0:r.ref)||void 0===o||o.getAudioModes().then(function(e){var o=[];e.hasOwnProperty("modes")&&e.modes.map(function(e){var t="",n=!1;e.hasOwnProperty("mode")&&(t=e.mode),e.hasOwnProperty("isSelected")&&(n=e.isSelected),e.hasOwnProperty("type")&&(t=e.type),e.hasOwnProperty("selected")&&(n=e.selected),o.push(new d.AudioMode(t,n))}),t(o)},function(e){n(e)}):h.Logger.error("CallingComponent :: getAudioOutputModes","Calling Component is not installed");else{var s=[];u.getAudioModes().then(function(e){e.hasOwnProperty("modes")&&e.modes.map(function(e){var t="",n=!1;e.hasOwnProperty("mode")&&(t=e.mode),e.hasOwnProperty("isSelected")&&(n=e.isSelected),e.hasOwnProperty("type")&&(t=e.type),e.hasOwnProperty("selected")&&(n=e.selected),s.push(new d.AudioMode(t,n))}),t(s)},function(e){n(e)})}})},r.switchToVideoCall=function(){var e,t;h.isFalsy(u)?(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.switchToVideoCall)?null===(t=null==r?void 0:r.ref)||void 0===t||t.switchToVideoCall():h.Logger.error("CallingComponent: switchToVideoCall","Calling Component is not installed"):u.switchToVideoCall()},r.startCallRecording=function(){var e,t;h.isFalsy(u)?(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.startRecording)?null===(t=null==r?void 0:r.ref)||void 0===t||t.startRecording():h.Logger.error("CallingComponent: startCallRecording","Calling Component is not installed"):u.startRecording()},r.stopCallRecording=function(){var e,t;h.isFalsy(u)?(null===(e=null==r?void 0:r.ref)||void 0===e?void 0:e.stopRecording)?null===(t=null==r?void 0:r.ref)||void 0===t||t.stopRecording():h.Logger.error("CallingComponent: stopCallRecording","Calling Component is not installed"):u.stopRecording()},r.ref=null,r}(p.Component);t.CallingComponent=r},function(e,t,n){"use strict";t.__esModule=!0,t.InteractionGoal=void 0;var o=function(){function e(e,t){this.elementIds=[],this.type=e,this.elementIds=t}return e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getElementIds=function(){return this.elementIds},e.prototype.setElementIds=function(e){this.elementIds=e},e}();t.InteractionGoal=o},function(e,t,n){"use strict";t.__esModule=!0,t.GroupMembersController=void 0;var o=n(43),s=n(1),r=n(0),i=function(){function e(){}return e.trasformJSONGroupMember=function(t){var e;try{return t.status&&"offline"!==t.status?t.status="online":t.status="offline",e=new o.GroupMember(t[s.GroupMemersConstans.KEYS.UID]),Object.assign(e,t),e}catch(e){return r.Logger.error("GroupMembersController:trasformJSONGroupMember",{e:e,groupMember:t}),t}},e}();t.GroupMembersController=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.GroupMember=void 0;var r=n(3),i=n(1),a=function(o){function e(e,t){var n=o.call(this,e)||this;return n.joinedAt=0,t&&(n.scope=t),n}return s(e,o),e.prototype.setScope=function(e){this.scope=e},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.getGuid=function(){return this.guid},e.GroupMemberScope=i.GroupMemberScope,e}(r.User);t.GroupMember=a},function(e,t,n){"use strict";t.__esModule=!0,t.Conversation=void 0;var E=n(11),c=n(1),u=n(12),p=n(18),o=function(){function e(e,t,n,o,s,r,i,a){this.conversationId=e,this.conversationType=t,this.unreadMentionsCount=i,this.lastReadMessageId=a,r&&0<r.length&&(this.tags=r),void 0!==n&&void 0!==(this.lastMessage=n).id&&(this.lastMessage=E.MessageController.trasformJSONMessge(n)),this.conversationType==c.MessageConstatnts.RECEIVER_TYPE.USER?this.conversationWith=u.UsersController.trasformJSONUser(o):this.conversationWith=p.GroupsController.trasformJSONGroup(o),this.unreadMessageCount=void 0!==s?s:0}return e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.setConversationType=function(e){this.conversationType=e},e.prototype.getUnreadMentionsCount=function(){return this.unreadMentionsCount},e.prototype.setUnreadMentionsCount=function(e){this.unreadMentionsCount=e},e.prototype.getLastReadMessageId=function(){return this.lastReadMessageId},e.prototype.setLastReadMessageId=function(e){this.lastReadMessageId=e},e.prototype.setLastMessage=function(e){this.lastMessage=e},e.prototype.setConversationWith=function(e){this.conversationWith=e},e.prototype.setUnreadMessageCount=function(e){this.unreadMessageCount=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.getLastMessage=function(){return this.lastMessage},e.prototype.getConversationWith=function(){return this.conversationWith},e.prototype.getUnreadMessageCount=function(){return this.unreadMessageCount},e.prototype.getTags=function(){return this.tags},e}();t.Conversation=o},function(e,t,n){"use strict";t.__esModule=!0,t.TypingNotificationController=void 0;var o=n(0),s=function(){function e(){}return e.addTypingStarted=function(e){this.TYPING_STARTED_MAP[e]=o.getCurrentTime()},e.removeTypingStarted=function(e){delete this.TYPING_STARTED_MAP[e]},e.getTypingStartedMap=function(e){if(e)return this.TYPING_STARTED_MAP[e]},e.addTypingEnded=function(e){this.TYPING_ENDED_MAP[e]=o.getCurrentTime()},e.removeTypingEnded=function(e){delete this.TYPING_ENDED_MAP[e]},e.getTypingEndedMap=function(e){if(e)return this.TYPING_ENDED_MAP[e]},e.addIncomingTypingStarted=function(e){this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]={typingNotification:e,timestamp:o.getCurrentTime()}},e.removeIncomingTypingStarted=function(e){delete this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]},e.TYPING_STARTED_MAP={},e.TYPING_ENDED_MAP={},e.INCOMING_TYPING_STARTED_MAP={},e}();t.TypingNotificationController=s},function(e,t,n){"use strict";t.__esModule=!0,t.InteractionReceipt=void 0;var o=function(){function e(){}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiveId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getInteractions=function(){return this.interactions},e.prototype.setInteractions=function(e){this.interactions=e},e}();t.InteractionReceipt=o},function(e,t,n){"use strict";var o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};t.__esModule=!0,t.ListenerHandlers=void 0;var s=n(0),r=n(25),i=function(){function e(){this.connectionHandlers=[],this.loginHandlers=[],this.messageHandlers=[],this.userHandlers=[],this.groupHandlers=[],this.callHandlers=[]}return e.getInstance=function(){return null!=this.listenerHandlers&&null!=this.listenerHandlers||(this.listenerHandlers=new e),this.listenerHandlers},e.prototype.addConnectionEventListener=function(t,e){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!=t}),this.connectionHandlers=o(this.connectionHandlers,[new r.WSConnectionListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addWSConnectionEventListener",e)}},e.prototype.removeConnectionEventListener=function(t){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeWSConnectionEventListener",e)}},e.prototype.addLoginEventListener=function(t,e){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!=t}),this.loginHandlers=o(this.loginHandlers,[new r.UserLoginListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addLoginEventListener",e)}},e.prototype.removeLoginEventListener=function(t){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeLoginEventListener",e)}},e.prototype.addMessageEventListener=function(t,e){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!=t}),this.messageHandlers=o(this.messageHandlers,[new r.MessagesListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addMessageEventListener",e)}},e.prototype.removeMessageEventListener=function(t){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeMessageEventListener",e)}},e.prototype.addUserEventListener=function(t,e){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!=t}),this.userHandlers=o(this.userHandlers,[new r.UsersListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addUserEventListener",e)}},e.prototype.removeUserEventListener=function(t){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeUserEventListener",e)}},e.prototype.addGroupEventListener=function(t,e){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!=t}),this.groupHandlers=o(this.groupHandlers,[new r.GroupsListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addGroupEventListener",e)}},e.prototype.removeGroupEventListener=function(t){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeGroupEventListener",e)}},e.prototype.addCallEventListener=function(t,e){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!=t}),this.callHandlers=o(this.callHandlers,[new r.CallsListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addCallEventListener",e)}},e.prototype.removeCallEventListener=function(t){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeCallEventListener",e)}},e.listenerHandlers=new e,e}();t.ListenerHandlers=i},function(e,t,n){"use strict";t.__esModule=!0,t.ReactionEvent=void 0;var r=n(0),o=function(){function e(e,t,n,o,s){this.parentMessageId=null,r.isFalsy(e)||(this.reaction=e),r.isFalsy(t)||(this.receiverId=t),r.isFalsy(n)||(this.receiverType=n),r.isFalsy(o)||(this.conversationId=o),r.isFalsy(s)||(this.parentMessageId=s)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e}();t.ReactionEvent=o},function(e,t,n){"use strict";t.__esModule=!0,t.getWSURL=t.stringifyMessage=t.checkConnection=void 0;var o=n(1),s=n(0),r=n(4);t.checkConnection=function(e){return e&&e.readyState===r.READY_STATE.OPEN},t.stringifyMessage=function(e){return JSON.stringify(e)},t.getWSURL=function(){return new Promise(function(n,e){s.getAppSettings().then(function(e){var t=r.WS.protocol+s.getChatHost(e)+":"+e[o.APP_SETTINGS.KEYS.CHAT_WSS_PORT];n(t)},function(e){s.Logger.error("WSHelper :: getWSURL",e)})})}},function(e,B,t){"use strict";(function(e){var o=t(78),r=t(79),i=t(80);function n(){return p.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function a(e,t){if(n()<t)throw new RangeError("Invalid typed array length");return p.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=p.prototype:(null===e&&(e=new p(t)),e.length=t),e}function p(e,t,n){if(!(p.TYPED_ARRAY_SUPPORT||this instanceof p))return new p(e,t,n);if("number"!=typeof e)return s(this,e,t,n);if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return c(this,e)}function s(e,t,n,o){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,o){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(o||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===o?new Uint8Array(t):void 0===o?new Uint8Array(t,n):new Uint8Array(t,n,o);p.TYPED_ARRAY_SUPPORT?(e=t).__proto__=p.prototype:e=u(e,t);return e}(e,t,n,o):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!p.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var o=0|S(t,n),s=(e=a(e,o)).write(t,n);s!==o&&(e=e.slice(0,s));return e}(e,t,n):function(e,t){if(p.isBuffer(t)){var n=0|C(t.length);return 0===(e=a(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(o=t.length)!=o?a(e,0):u(e,t);if("Buffer"===t.type&&i(t.data))return u(e,t.data)}var o;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function E(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function c(e,t){if(E(t),e=a(e,t<0?0:0|C(t)),!p.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function u(e,t){var n=t.length<0?0:0|C(t.length);e=a(e,n);for(var o=0;o<n;o+=1)e[o]=255&t[o];return e}function C(e){if(e>=n())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n().toString(16)+" bytes");return 0|e}function S(e,t){if(p.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 o=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return G(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return w(e).length;default:if(o)return G(e).length;t=(""+t).toLowerCase(),o=!0}}function l(e,t,n){var o=e[t];e[t]=e[n],e[n]=o}function _(e,t,n,o,s){if(0===e.length)return-1;if("string"==typeof n?(o=n,n=0):2147483647<n?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=s?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(s)return-1;n=e.length-1}else if(n<0){if(!s)return-1;n=0}if("string"==typeof t&&(t=p.from(t,o)),p.isBuffer(t))return 0===t.length?-1:T(e,t,n,o,s);if("number"==typeof t)return t&=255,p.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?s?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):T(e,[t],n,o,s);throw new TypeError("val must be string, number or Buffer")}function T(e,t,n,o,s){var r,i=1,a=e.length,E=t.length;if(void 0!==o&&("ucs2"===(o=String(o).toLowerCase())||"ucs-2"===o||"utf16le"===o||"utf-16le"===o)){if(e.length<2||t.length<2)return-1;a/=i=2,E/=2,n/=2}function c(e,t){return 1===i?e[t]:e.readUInt16BE(t*i)}if(s){var u=-1;for(r=n;r<a;r++)if(c(e,r)===c(t,-1===u?0:r-u)){if(-1===u&&(u=r),r-u+1===E)return u*i}else-1!==u&&(r-=r-u),u=-1}else for(a<n+E&&(n=a-E),r=n;0<=r;r--){for(var p=!0,C=0;C<E;C++)if(c(e,r+C)!==c(t,C)){p=!1;break}if(p)return r}return-1}function d(e,t,n,o){n=Number(n)||0;var s=e.length-n;o?s<(o=Number(o))&&(o=s):o=s;var r=t.length;if(r%2!=0)throw new TypeError("Invalid hex string");r/2<o&&(o=r/2);for(var i=0;i<o;++i){var a=parseInt(t.substr(2*i,2),16);if(isNaN(a))return i;e[n+i]=a}return i}function h(e,t,n,o){return K(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,o)}function R(e,t,n){return 0===t&&n===e.length?o.fromByteArray(e):o.fromByteArray(e.slice(t,n))}function g(e,t,n){n=Math.min(e.length,n);for(var o=[],s=t;s<n;){var r,i,a,E,c=e[s],u=null,p=239<c?4:223<c?3:191<c?2:1;if(s+p<=n)switch(p){case 1:c<128&&(u=c);break;case 2:128==(192&(r=e[s+1]))&&127<(E=(31&c)<<6|63&r)&&(u=E);break;case 3:r=e[s+1],i=e[s+2],128==(192&r)&&128==(192&i)&&2047<(E=(15&c)<<12|(63&r)<<6|63&i)&&(E<55296||57343<E)&&(u=E);break;case 4:r=e[s+1],i=e[s+2],a=e[s+3],128==(192&r)&&128==(192&i)&&128==(192&a)&&65535<(E=(15&c)<<18|(63&r)<<12|(63&i)<<6|63&a)&&E<1114112&&(u=E)}null===u?(u=65533,p=1):65535<u&&(u-=65536,o.push(u>>>10&1023|55296),u=56320|1023&u),o.push(u),s+=p}return function(e){var t=e.length;if(t<=A)return String.fromCharCode.apply(String,e);var n="",o=0;for(;o<t;)n+=String.fromCharCode.apply(String,e.slice(o,o+=A));return n}(o)}B.Buffer=p,B.SlowBuffer=function(e){+e!=e&&(e=0);return p.alloc(+e)},B.INSPECT_MAX_BYTES=50,p.TYPED_ARRAY_SUPPORT=void 0!==e.TYPED_ARRAY_SUPPORT?e.TYPED_ARRAY_SUPPORT:function(){try{var e=new Uint8Array(1);return e.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===e.foo()&&"function"==typeof e.subarray&&0===e.subarray(1,1).byteLength}catch(e){return!1}}(),B.kMaxLength=n(),p.poolSize=8192,p._augment=function(e){return e.__proto__=p.prototype,e},p.from=function(e,t,n){return s(null,e,t,n)},p.TYPED_ARRAY_SUPPORT&&(p.prototype.__proto__=Uint8Array.prototype,p.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&p[Symbol.species]===p&&Object.defineProperty(p,Symbol.species,{value:null,configurable:!0})),p.alloc=function(e,t,n){return o=null,r=t,i=n,E(s=e),s<=0?a(o,s):void 0!==r?"string"==typeof i?a(o,s).fill(r,i):a(o,s).fill(r):a(o,s);var o,s,r,i},p.allocUnsafe=function(e){return c(null,e)},p.allocUnsafeSlow=function(e){return c(null,e)},p.isBuffer=function(e){return!(null==e||!e._isBuffer)},p.compare=function(e,t){if(!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,o=t.length,s=0,r=Math.min(n,o);s<r;++s)if(e[s]!==t[s]){n=e[s],o=t[s];break}return n<o?-1:o<n?1:0},p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.concat=function(e,t){if(!i(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return p.alloc(0);var n;if(void 0===t)for(n=t=0;n<e.length;++n)t+=e[n].length;var o=p.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){var r=e[n];if(!p.isBuffer(r))throw new TypeError('"list" argument must be an Array of Buffers');r.copy(o,s),s+=r.length}return o},p.byteLength=S,p.prototype._isBuffer=!0,p.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)l(this,t,t+1);return this},p.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)l(this,t,t+3),l(this,t+1,t+2);return this},p.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)l(this,t,t+7),l(this,t+1,t+6),l(this,t+2,t+5),l(this,t+3,t+4);return this},p.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?g(this,0,e):function(e,t,n){var o=!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 O(this,t,n);case"utf8":case"utf-8":return g(this,t,n);case"ascii":return I(this,t,n);case"latin1":case"binary":return f(this,t,n);case"base64":return R(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,t,n);default:if(o)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),o=!0}}.apply(this,arguments)},p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===p.compare(this,e)},p.prototype.inspect=function(){var e="",t=B.INSPECT_MAX_BYTES;return 0<this.length&&(e=this.toString("hex",0,t).match(/.{2}/g).join(" "),this.length>t&&(e+=" ... ")),"<Buffer "+e+">"},p.prototype.compare=function(e,t,n,o,s){if(!p.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===o&&(o=0),void 0===s&&(s=this.length),t<0||n>e.length||o<0||s>this.length)throw new RangeError("out of range index");if(s<=o&&n<=t)return 0;if(s<=o)return-1;if(n<=t)return 1;if(this===e)return 0;for(var r=(s>>>=0)-(o>>>=0),i=(n>>>=0)-(t>>>=0),a=Math.min(r,i),E=this.slice(o,s),c=e.slice(t,n),u=0;u<a;++u)if(E[u]!==c[u]){r=E[u],i=c[u];break}return r<i?-1:i<r?1:0},p.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},p.prototype.indexOf=function(e,t,n){return _(this,e,t,n,!0)},p.prototype.lastIndexOf=function(e,t,n){return _(this,e,t,n,!1)},p.prototype.write=function(e,t,n,o){if(void 0===t)o="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)o=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===o&&(o="utf8")):(o=n,n=void 0)}var s=this.length-t;if((void 0===n||s<n)&&(n=s),0<e.length&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");o||(o="utf8");for(var r,i,a,E,c,u,p,C,S,l=!1;;)switch(o){case"hex":return d(this,e,t,n);case"utf8":case"utf-8":return C=t,S=n,K(G(e,(p=this).length-C),p,C,S);case"ascii":return h(this,e,t,n);case"latin1":case"binary":return h(this,e,t,n);case"base64":return E=this,c=t,u=n,K(w(e),E,c,u);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return i=t,a=n,K(function(e,t){for(var n,o,s,r=[],i=0;i<e.length&&!((t-=2)<0);++i)n=e.charCodeAt(i),o=n>>8,s=n%256,r.push(s),r.push(o);return r}(e,(r=this).length-i),r,i,a);default:if(l)throw new TypeError("Unknown encoding: "+o);o=(""+o).toLowerCase(),l=!0}},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var A=4096;function I(e,t,n){var o="";n=Math.min(e.length,n);for(var s=t;s<n;++s)o+=String.fromCharCode(127&e[s]);return o}function f(e,t,n){var o="";n=Math.min(e.length,n);for(var s=t;s<n;++s)o+=String.fromCharCode(e[s]);return o}function O(e,t,n){var o=e.length;(!t||t<0)&&(t=0),(!n||n<0||o<n)&&(n=o);for(var s="",r=t;r<n;++r)s+=Y(e[r]);return s}function N(e,t,n){for(var o=e.slice(t,n),s="",r=0;r<o.length;r+=2)s+=String.fromCharCode(o[r]+256*o[r+1]);return s}function m(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(n<e+t)throw new RangeError("Trying to access beyond buffer length")}function P(e,t,n,o,s,r){if(!p.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(s<t||t<r)throw new RangeError('"value" argument is out of bounds');if(n+o>e.length)throw new RangeError("Index out of range")}function y(e,t,n,o){t<0&&(t=65535+t+1);for(var s=0,r=Math.min(e.length-n,2);s<r;++s)e[n+s]=(t&255<<8*(o?s:1-s))>>>8*(o?s:1-s)}function M(e,t,n,o){t<0&&(t=4294967295+t+1);for(var s=0,r=Math.min(e.length-n,4);s<r;++s)e[n+s]=t>>>8*(o?s:3-s)&255}function v(e,t,n,o,s,r){if(n+o>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function L(e,t,n,o,s){return s||v(e,0,n,4),r.write(e,t,n,o,23,4),n+4}function U(e,t,n,o,s){return s||v(e,0,n,8),r.write(e,t,n,o,52,8),n+8}p.prototype.slice=function(e,t){var n,o=this.length;if((e=~~e)<0?(e+=o)<0&&(e=0):o<e&&(e=o),(t=void 0===t?o:~~t)<0?(t+=o)<0&&(t=0):o<t&&(t=o),t<e&&(t=e),p.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=p.prototype;else{var s=t-e;n=new p(s,void 0);for(var r=0;r<s;++r)n[r]=this[r+e]}return n},p.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var o=this[e],s=1,r=0;++r<t&&(s*=256);)o+=this[e+r]*s;return o},p.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var o=this[e+--t],s=1;0<t&&(s*=256);)o+=this[e+--t]*s;return o},p.prototype.readUInt8=function(e,t){return t||m(e,1,this.length),this[e]},p.prototype.readUInt16LE=function(e,t){return t||m(e,2,this.length),this[e]|this[e+1]<<8},p.prototype.readUInt16BE=function(e,t){return t||m(e,2,this.length),this[e]<<8|this[e+1]},p.prototype.readUInt32LE=function(e,t){return t||m(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},p.prototype.readUInt32BE=function(e,t){return t||m(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},p.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var o=this[e],s=1,r=0;++r<t&&(s*=256);)o+=this[e+r]*s;return(s*=128)<=o&&(o-=Math.pow(2,8*t)),o},p.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||m(e,t,this.length);for(var o=t,s=1,r=this[e+--o];0<o&&(s*=256);)r+=this[e+--o]*s;return(s*=128)<=r&&(r-=Math.pow(2,8*t)),r},p.prototype.readInt8=function(e,t){return t||m(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,t){t||m(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt16BE=function(e,t){t||m(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},p.prototype.readInt32LE=function(e,t){return t||m(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},p.prototype.readInt32BE=function(e,t){return t||m(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},p.prototype.readFloatLE=function(e,t){return t||m(e,4,this.length),r.read(this,e,!0,23,4)},p.prototype.readFloatBE=function(e,t){return t||m(e,4,this.length),r.read(this,e,!1,23,4)},p.prototype.readDoubleLE=function(e,t){return t||m(e,8,this.length),r.read(this,e,!0,52,8)},p.prototype.readDoubleBE=function(e,t){return t||m(e,8,this.length),r.read(this,e,!1,52,8)},p.prototype.writeUIntLE=function(e,t,n,o){(e=+e,t|=0,n|=0,o)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var s=1,r=0;for(this[t]=255&e;++r<n&&(s*=256);)this[t+r]=e/s&255;return t+n},p.prototype.writeUIntBE=function(e,t,n,o){(e=+e,t|=0,n|=0,o)||P(this,e,t,n,Math.pow(2,8*n)-1,0);var s=n-1,r=1;for(this[t+s]=255&e;0<=--s&&(r*=256);)this[t+s]=e/r&255;return t+n},p.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,255,0),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},p.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):y(this,e,t,!0),t+2},p.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,65535,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):y(this,e,t,!1),t+2},p.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):M(this,e,t,!0),t+4},p.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,4294967295,0),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},p.prototype.writeIntLE=function(e,t,n,o){if(e=+e,t|=0,!o){var s=Math.pow(2,8*n-1);P(this,e,t,n,s-1,-s)}var r=0,i=1,a=0;for(this[t]=255&e;++r<n&&(i*=256);)e<0&&0===a&&0!==this[t+r-1]&&(a=1),this[t+r]=(e/i>>0)-a&255;return t+n},p.prototype.writeIntBE=function(e,t,n,o){if(e=+e,t|=0,!o){var s=Math.pow(2,8*n-1);P(this,e,t,n,s-1,-s)}var r=n-1,i=1,a=0;for(this[t+r]=255&e;0<=--r&&(i*=256);)e<0&&0===a&&0!==this[t+r+1]&&(a=1),this[t+r]=(e/i>>0)-a&255;return t+n},p.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,1,127,-128),p.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},p.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):y(this,e,t,!0),t+2},p.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,2,32767,-32768),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):y(this,e,t,!1),t+2},p.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),p.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):M(this,e,t,!0),t+4},p.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||P(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),p.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):M(this,e,t,!1),t+4},p.prototype.writeFloatLE=function(e,t,n){return L(this,e,t,!0,n)},p.prototype.writeFloatBE=function(e,t,n){return L(this,e,t,!1,n)},p.prototype.writeDoubleLE=function(e,t,n){return U(this,e,t,!0,n)},p.prototype.writeDoubleBE=function(e,t,n){return U(this,e,t,!1,n)},p.prototype.copy=function(e,t,n,o){if(n||(n=0),o||0===o||(o=this.length),t>=e.length&&(t=e.length),t||(t=0),0<o&&o<n&&(o=n),o===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(o<0)throw new RangeError("sourceEnd out of bounds");o>this.length&&(o=this.length),e.length-t<o-n&&(o=e.length-t+n);var s,r=o-n;if(this===e&&n<t&&t<o)for(s=r-1;0<=s;--s)e[s+t]=this[s+n];else if(r<1e3||!p.TYPED_ARRAY_SUPPORT)for(s=0;s<r;++s)e[s+t]=this[s+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+r),t);return r},p.prototype.fill=function(e,t,n,o){if("string"==typeof e){if("string"==typeof t?(o=t,t=0,n=this.length):"string"==typeof n&&(o=n,n=this.length),1===e.length){var s=e.charCodeAt(0);s<256&&(e=s)}if(void 0!==o&&"string"!=typeof o)throw new TypeError("encoding must be a string");if("string"==typeof o&&!p.isEncoding(o))throw new TypeError("Unknown encoding: "+o)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var r;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(r=t;r<n;++r)this[r]=e;else{var i=p.isBuffer(e)?e:G(new p(e,o).toString()),a=i.length;for(r=0;r<n-t;++r)this[r+t]=i[r%a]}return this};var D=/[^+\/0-9A-Za-z-_]/g;function Y(e){return e<16?"0"+e.toString(16):e.toString(16)}function G(e,t){var n;t=t||1/0;for(var o=e.length,s=null,r=[],i=0;i<o;++i){if(55295<(n=e.charCodeAt(i))&&n<57344){if(!s){if(56319<n){-1<(t-=3)&&r.push(239,191,189);continue}if(i+1===o){-1<(t-=3)&&r.push(239,191,189);continue}s=n;continue}if(n<56320){-1<(t-=3)&&r.push(239,191,189),s=n;continue}n=65536+(s-55296<<10|n-56320)}else s&&-1<(t-=3)&&r.push(239,191,189);if(s=null,n<128){if((t-=1)<0)break;r.push(n)}else if(n<2048){if((t-=2)<0)break;r.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;r.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;r.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return r}function w(e){return o.toByteArray(function(e){var t;if((e=(t=e,t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")).replace(D,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function K(e,t,n,o){for(var s=0;s<o&&!(s+n>=t.length||s>=e.length);++s)t[s+n]=e[s];return s}}).call(this,t(19))},function(e,t,n){"use strict";t.__esModule=!0,t.DaySchedule=void 0;var o=function(){function e(e,t,n){this.from=e,this.to=t,this.dnd=n}return e.prototype.getFrom=function(){return this.from},e.prototype.setFrom=function(e){this.from=e},e.prototype.getTo=function(){return this.to},e.prototype.setTo=function(e){this.to=e},e.prototype.getDND=function(){return this.dnd},e.prototype.setDND=function(e){this.dnd=e},e}();t.DaySchedule=o},function(e,t,n){"use strict";t.__esModule=!0,t.CometChatNotifications=t.CometChat=t.init=void 0;var o=n(6),s=n(87);t.init=function(e){return o.CometChat.getInstance(e)},t.CometChat=o.CometChat,t.CometChatNotifications=s.CometChatNotifications},function(e,t,n){"use strict";t.__esModule=!0,t.RTCUser=void 0;var o=n(0),s=function(){function e(e){this.avatar="",o.isFalsy(e)||(this.uid=e.toString())}return e.prototype.setUID=function(e){this.uid=e?e.toString():""},e.prototype.getUID=function(){return this.uid.toString()},e.prototype.setName=function(e){this.name=e?e.toString():""},e.prototype.getName=function(){return this.name.toString()},e.prototype.setAvatar=function(e){this.avatar=e?e.toString():""},e.prototype.getAvatar=function(){return this.avatar.toString()},e.prototype.setJWT=function(e){this.jwt=e?e.toString():""},e.prototype.getJWT=function(){return this.jwt.toString()},e.prototype.setResource=function(e){this.resource=e?e.toString():""},e.prototype.getResource=function(){return this.resource.toString()},e}();t.RTCUser=s},function(e,t){e.exports=s},function(e,t,n){"use strict";t.__esModule=!0,t.AudioMode=void 0;var o=n(0),s=function(){function e(e,t){this.isSelected=!1,this.mode="",o.isFalsy(e)||(this.mode=e.toString()),this.isSelected=t||!1}return e.prototype.setMode=function(e){this.mode=e?e.toString():""},e.prototype.getMode=function(){return this.mode.toString()},e.prototype.setIsSelected=function(e){this.isSelected=e||!1},e.prototype.getIsSelected=function(){return this.isSelected},e}();t.AudioMode=s},function(e,t,n){"use strict";t.__esModule=!0,t.GroupsRequestBuilder=t.GroupsRequest=void 0;var s=n(5),o=n(0),r=n(2),i=n(18),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.hasJoined=0,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(o.isFalsy(e.limit)||(this.limit=e.limit),o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.hasJoined)||(this.hasJoined=1),o.isFalsy(e.tags)||(this.tags=e.tags),o.isFalsy(e.showTags)||(this.withTags=e.showTags))}return e.prototype.validateGroupBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.withTags){if(typeof this.withTags!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}return void 0===this.tags||Array.isArray(this.tags)?void 0:new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(t,n){try{var e=o.validateGroupBuilder();if(e instanceof r.CometChatException)return void n(e);s.makeApiCall("getGroups",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var n=[];e.data.map(function(e,t){n.push(i.GroupsController.trasformJSONGroup(e))}),t(n)}t([])},function(e){n(new r.CometChatException(e.error))})}catch(e){n(new r.CometChatException(e))}})},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.isJoinedOnly=function(){return this.hasJoined},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.hasJoined)||(e.hasJoined=1),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.withTags)||(e.withTags=1),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=100,e.DEFAULT_LIMIT=30,e}();t.GroupsRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.joinedOnly=function(e){return this.hasJoined=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.build=function(){return new E(this)},e}();t.GroupsRequestBuilder=c},function(e,t,n){"use strict";t.__esModule=!0,t.GroupMembersRequestBuilder=t.GroupMembersRequest=void 0;var s=n(5),o=n(0),r=n(15),i=n(2),a=n(42),E=n(1),c=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},this.store=r.LocalStorage.getInstance(),o.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateGroupMembersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{var e=o.validateGroupMembersBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("getGroupMembers",{guid:o.guid},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=o.guid,t.push(a.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new i.CometChatException(e.error))})}catch(e){t(new i.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.GroupMembersRequest=c;var u=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new c(this)},e}();t.GroupMembersRequestBuilder=u},function(e,t,n){"use strict";t.__esModule=!0,t.BannedMembersRequestBuilder=t.BannedMembersRequest=void 0;var s=n(5),o=n(0),r=n(2),i=n(42),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateBannedMembersBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{var e=o.validateBannedMembersBuilder();if(e instanceof r.CometChatException)return void t(e);s.makeApiCall("getBannedGroupMembers",{guid:o.guid},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=o.guid,t.push(i.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new r.CometChatException(e.error))})}catch(e){t(new r.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.BannedMembersRequest=E;var c=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new E(this)},e}();t.BannedMembersRequestBuilder=c},function(e,t,n){"use strict";t.__esModule=!0,t.UsersRequestBuilder=t.UsersRequest=void 0;var s=n(5),o=n(0),r=n(12),i=n(2),a=n(60),E=n(1),c=function(){function t(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.hideBlockedUsers=!1,this.friendsOnly=!1,this.fetchingInProgress=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},t.userStore=a.UserStore.getInstance(),o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.status)||(e.status==t.USER_STATUS.ONLINE?this.status=E.PresenceConstatnts.STATUS.AVAILABLE:this.status=e.status),o.isFalsy(e.shouldHideBlockedUsers)||(this.hideBlockedUsers=e.shouldHideBlockedUsers),o.isFalsy(e.showFriendsOnly)||(this.friendsOnly=e.showFriendsOnly),o.isFalsy(e.showTags)||(this.withTags=e.showTags),o.isFalsy(e.role)||(this.role=e.role),o.isFalsy(e.roles)||(this.roles=e.roles),o.isFalsy(e.tags)||(this.tags=e.tags),o.isFalsy(e.UIDs)||(this.UIDs=e.UIDs),o.isFalsy(e.SortBy)||(this.sortBy=e.SortBy),o.isFalsy(e.SearchIn)||(this.searchIn=e.SearchIn),o.isFalsy(e.SortOrder)||(this.sortOrder=e.SortOrder))}return t.prototype.validateUserBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(this.status){if(typeof this.status!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_STATUS","SET_STATUS","setStatus()")));if("available"!=this.status.toLowerCase()&&"offline"!=this.status.toLowerCase())return new i.CometChatException(E.UserErrors.INVALID_STATUS)}if(void 0!==this.hideBlockedUsers){if(typeof this.hideBlockedUsers!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_BLOCKED_USERS","HIDE_BLOCKED_USERS","hideBlockedUsers()")));1==this.hideBlockedUsers?this.hideBlockedUsers=!0:this.hideBlockedUsers=!1}if(void 0!==this.friendsOnly){if(typeof this.friendsOnly!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"FRIENDS_ONLY","FRIENDS_ONLY","friendsOnly()")));1==this.friendsOnly?this.friendsOnly=!0:this.friendsOnly=!1}if(void 0!==this.withTags){if(typeof this.withTags!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}if(void 0!==this.roles&&!Array.isArray(this.roles))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"ROLES","ROLES","setRoles()")));if(void 0!==this.tags&&!Array.isArray(this.tags))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")));if(void 0!==this.UIDs&&!Array.isArray(this.UIDs))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"UIDs","UIDs","setUIDs()")));if(this.sortBy){if(typeof this.sortBy!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY","SORT_BY","sortBy()")));if(o.isFalsy(this.sortBy.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY","SORT_BY","sort by","sort by")));this.sortBy=this.sortBy.trim().toLowerCase()}if(this.sortOrder){if(typeof this.sortOrder!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY_ORDER","SORT_BY_ORDER","sortByOrder()")));if(o.isFalsy(this.sortOrder.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY_ORDER","SORT_BY_ORDER","sort order","sort order")));this.sortOrder=this.sortOrder.trim().toLowerCase()}return this.searchIn&&!Array.isArray(this.searchIn)?new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SEARCH_IN","SEARCH_IN","searchIn()"))):void 0},t.prototype.getLimit=function(){return this.limit},t.prototype.getSearchKeyword=function(){return this.searchKeyword},t.prototype.isHideBlockedUsers=function(){return this.hideBlockedUsers},t.prototype.getStatus=function(){return this.status},t.prototype.getRole=function(){return this.role},t.prototype.isFriendsOnly=function(){return this.friendsOnly},t.prototype.getRoles=function(){return this.roles},t.prototype.getTags=function(){return this.tags},t.prototype.isWithTags=function(){return this.withTags},t.prototype.getUIDs=function(){return this.UIDs},t.prototype.getSearchIn=function(){return this.searchIn},t.prototype.getSortBy=function(){return this.sortBy},t.prototype.getSortOrder=function(){return this.sortOrder},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateUserBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("users",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(r.UsersController.trasformJSONUser(e))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new i.CometChatException(e))}})},t.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.status)||(e.status=this.status),o.isFalsy(this.hideBlockedUsers)||(e.hideBlockedUsers=1),o.isFalsy(this.role)||(e.roles=this.role),o.isFalsy(this.roles)||(e.roles=this.roles),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.friendsOnly)||(e.friendsOnly=1),o.isFalsy(this.withTags)||(e.withTags=1),o.isFalsy(this.UIDs)||(e.uids=this.UIDs),o.isFalsy(this.sortBy)||(e.sortBy=this.sortBy),o.isFalsy(this.sortOrder)||(e.sortOrder=this.sortOrder),o.isFalsy(this.searchIn)||(e.searchIn=this.searchIn),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},t.USER_STATUS={ONLINE:E.PresenceConstatnts.STATUS.ONLINE,OFFLINE:E.PresenceConstatnts.STATUS.OFFLINE},t}();t.UsersRequest=c;var u=function(){function e(){this.shouldHideBlockedUsers=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setStatus=function(e){return this.status=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.hideBlockedUsers=function(e){return this.shouldHideBlockedUsers=e,this},e.prototype.setRole=function(e){return this.role=e,this},e.prototype.setRoles=function(e){return this.roles=e,this},e.prototype.friendsOnly=function(e){return this.showFriendsOnly=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.setUIDs=function(e){return this.UIDs=e,this},e.prototype.sortBy=function(e){return this.SortBy=e,this},e.prototype.sortByOrder=function(e){return this.SortOrder=e,this},e.prototype.searchIn=function(e){return this.SearchIn=e,this},e.prototype.build=function(){return this.role&&this.roles&&this.roles.push(this.role),new c(this)},e}();t.UsersRequestBuilder=u},function(e,t,n){"use strict";t.__esModule=!0,t.UserStore=void 0;var r=n(0),i=n(1),a=n(2),o=n(14),s=function(){function e(e){this.store=i.constants.DEFAULT_STORE,r.isFalsy(e)||(this.store=e);try{this.userStore=o.default}catch(e){r.Logger.error("UserStore: constructor",{e:e})}}return e.getInstance=function(){return null==e.UserStore&&(e.UserStore=new e),e.UserStore},e.prototype.set=function(e,t){var n=r.getKeyprefix(i.LOCAL_STORE.USERS_STORE,e);return this.userStore.setItem(n,JSON.stringify(t))},e.prototype.get=function(e){var o=this,s=r.getKeyprefix(i.LOCAL_STORE.USERS_STORE,e);return new Promise(function(n,t){try{o.userStore.getItem(s).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeUsers=function(e){var t=this;return e.map(function(e){t.set(e.getUid(),e)}),!0},e.prototype.storeUser=function(e){return this.set(e.getUid(),e),!0},e}();t.UserStore=s},function(e,t,n){"use strict";t.__esModule=!0,t.ConversationsRequestBuilder=t.ConversationsRequest=void 0;var s=n(5),o=n(0),r=n(2),i=n(32),a=n(1),E=function(){function e(e){this.limit=100,this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.getUserAndGroupTags=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.conversationType)||(this.conversationType=e.conversationType)),o.isFalsy(e.getUserAndGroupTags)||(this.getUserAndGroupTags=e.getUserAndGroupTags),e.tags&&(this.tags=e.tags),o.isFalsy(e.WithTags)||(this.withTags=e.WithTags),e.groupTags&&(this.groupTags=e.groupTags),e.userTags&&(this.userTags=e.userTags),e.IncludeBlockedUsers&&(this.includeBlockedUsers=e.IncludeBlockedUsers),e.WithBlockedInfo&&(this.withBlockedInfo=e.WithBlockedInfo)}return e.prototype.validateConversationBuilder=function(){return void 0===this.limit?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))):isNaN(this.limit)?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):this.limit>a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limit<a.DEFAULT_VALUES.ZERO?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):void 0},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateConversationBuilder();if(e instanceof r.CometChatException)return void t(e);s.makeApiCall("getConversations",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(i.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[],e.unreadMentionsCount,e.lastReadMessageId))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new r.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new r.CometChatException(e))}})},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.conversationType)||(e.conversationType=this.conversationType),o.isFalsy(this.getUserAndGroupTags)||(e.withUserAndGroupTags=this.getUserAndGroupTags),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.withTags)||(e.withTags=this.withTags),o.isFalsy(this.userTags)||(e.userTags=this.userTags),o.isFalsy(this.groupTags)||(e.groupTags=this.groupTags),o.isFalsy(this.includeBlockedUsers)||(e.includeBlockedUsers=this.includeBlockedUsers),o.isFalsy(this.withBlockedInfo)||(e.withBlockedInfo=this.withBlockedInfo),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.isIncludeBlockedUsers=function(){return this.includeBlockedUsers},e.prototype.isWithBlockedInfo=function(){return this.withBlockedInfo},e.prototype.getLimit=function(){return this.limit},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.isWithUserAndGroupTags=function(){return this.getUserAndGroupTags},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getGroupTags=function(){return this.groupTags},e.prototype.getUserTags=function(){return this.userTags},e}();t.ConversationsRequest=E;var c=function(){function e(){this.WithTags=!1,this.IncludeBlockedUsers=!1,this.WithBlockedInfo=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.withUserAndGroupTags=function(e){return"boolean"==typeof e&&(this.getUserAndGroupTags=e),this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.setGroupTags=function(e){return this.groupTags=e,this},e.prototype.setUserTags=function(e){return this.userTags=e,this},e.prototype.setIncludeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.includeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.setWithBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.withBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.build=function(){return new E(this)},e}();t.ConversationsRequestBuilder=c},function(e,t,n){"use strict";var I=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},f=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};t.__esModule=!0,t.MessagesRequestBuilder=t.MessagesRequest=void 0;var O=n(2),N=n(5),m=n(11),P=n(0),r=n(63),y=n(1),i=n(10),M=n(33),o=function(){function e(e){this.limit=y.DEFAULT_VALUES.MSGS_LIMIT,this.timestamp=0,this.id=y.DEFAULT_VALUES.DEFAULT_MSG_ID,this.messageStore=r.MessagesStore.getInstance(),this.endpointName="getUserMessages",this.listId="",this.totalPages=0,this.unread=!1,this.inProgress=!1,this.hideMessagesFromBlockedUsers=!1,this.updatedAt=0,this.onlyUpdates=0,this.paginationMeta={},this.WithTags=!1,this.hideDeletedMessages=!1,this.mentionsWithTagInfoFlag=!1,this.mentionsWithBlockedInfoFlag=!1,this.interactionGoalCompletedOnly=!1,this.limit=e.limit,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,this.uid=e.uid,this.guid=e.guid,this.parentMessageId=e.parentMessageId,this.timestamp=e.timestamp,this.timestamp&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.id=e.id,this.id!=y.DEFAULT_VALUES.DEFAULT_MSG_ID&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.hideMessagesFromBlockedUsers=e.HideMessagesFromBlockedUsers,this.hideMessagesFromBlockedUsers&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=this.hideMessagesFromBlockedUsers),this.unread=e.unread,this.unread&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.UNREAD]=this.unread),e.searchKey&&(this.searchKey=e.searchKey,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=this.searchKey),e.onlyUpdate&&(this.onlyUpdates=e.onlyUpdate,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ONLY_UPDATES]=this.onlyUpdates),e.updatedAt&&(this.updatedAt=e.updatedAt,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),e.category&&(this.category=e.category),e.categories&&(this.categories=e.categories),e.type&&(this.type=e.type),e.types&&(this.types=e.types),e.WithTags&&(this.WithTags=e.WithTags),e.tags&&(this.tags=e.tags),e.HideReplies&&(this.hideReplies=e.HideReplies,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES]=this.hideReplies),this.hideDeletedMessages=e.HideDeletedMessages,this.hideDeletedMessages&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=this.hideDeletedMessages),this.mentionsWithTagInfoFlag=e.mentionsWithTagInfoFlag,this.mentionsWithBlockedInfoFlag=e.mentionsWithBlockedInfoFlag,this.interactionGoalCompletedOnly=e.interactionGoalCompletedOnly,this.interactionGoalCompletedOnly&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=this.interactionGoalCompletedOnly)}return e.prototype.getLimit=function(){return this.limit},e.prototype.getUID=function(){return this.uid},e.prototype.getGUID=function(){return this.guid},e.prototype.getMessageId=function(){return this.id},e.prototype.isUnread=function(){return this.unread},e.prototype.isHideMessagesFromBlockedUsers=function(){return this.hideMessagesFromBlockedUsers},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getSearchKeyword=function(){return this.searchKey},e.prototype.getUpdatedAfter=function(){return this.updatedAt},e.prototype.isUpdatesOnly=function(){return this.onlyUpdates},e.prototype.getCategories=function(){return this.categories},e.prototype.getCategory=function(){return this.category},e.prototype.getTypes=function(){return this.types},e.prototype.getType=function(){return this.type},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.isHideReplies=function(){return this.hideReplies},e.prototype.isHideDeletedMessages=function(){return this.hideDeletedMessages},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.WithTags},e.prototype.isMentionsWithTagInfo=function(){return this.mentionsWithTagInfoFlag},e.prototype.isMentionsWithBlockedInfo=function(){return this.mentionsWithBlockedInfoFlag},e.prototype.isInteractionGoalCompletedOnly=function(){return this.interactionGoalCompletedOnly},e.prototype.fetchNext=function(){var e=this;return new Promise(function(s,r){return I(e,void 0,void 0,function(){var t,n,o;return f(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,this.onlyUpdates){if(0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2]}else if(0==this.timestamp&&0==this.id&&0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=y.MessageConstatnts.PAGINATION.AFFIX.APPEND,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=y.MessageConstatnts.PAGINATION.AFFIX.APPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),s(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,r(new O.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,r(new O.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(s,r){return I(e,void 0,void 0,function(){var t,n,o;return f(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,this.onlyUpdates&&0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=y.MessageConstatnts.PAGINATION.AFFIX.PREPEND,this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=y.MessageConstatnts.PAGINATION.AFFIX.PREPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),s(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,r(new O.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,r(new O.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(){var A=this;return new Promise(function(s,t){try{var e=A.mentionsWithTagInfoFlag;if(void 0!==e){if(typeof e!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_TAG_INFO","MENTIONS_WITH_TAG_INFO","mentionsWithTagInfo()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_TAG_INFO]=1==e?1:0}var n=A.mentionsWithBlockedInfoFlag;if(void 0!==n){if(typeof n!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_BLOCKED_INFO","MENTIONS_WITH_BLOCKED_INFO","mentionsWithBlockedInfo()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_BLOCKED_INFO]=1==n?1:0}var o=A.uid;if(void 0!==o){if(typeof o!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"UID","UID","setUID()"))));if(P.isFalsy(o.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.INVALID),"UID","UID","UID","UID"))));A.uid=o.trim()}var r=A.guid;if(void 0!==r){if(typeof r!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","setGUID()"))));if(P.isFalsy(r.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID"))));A.guid=r.trim()}var i=A.parentMessageId;if(void 0!==i){if(isNaN(i))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))));if(i<y.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))))}var a=A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE];if(void 0===a)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(a))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(a>y.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",y.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(a<y.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));var E=A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY];if(void 0!==E){if(typeof E!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))));if(P.isFalsy(E.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=E.trim()}var c=A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ID];if(void 0!==c){if(isNaN(c))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))));if(c<y.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))))}var u=A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SENT_AT];if(void 0!==u){if(isNaN(u))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))));if(u<y.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))))}var p=A.hideMessagesFromBlockedUsers;if(void 0!==p){if(typeof p!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=1==p?1:0}var C=A.unread;if(void 0!==C){if(typeof C!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"UNREAD","UNREAD","setUnread()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.UNREAD]=1==C?1:0}var S=A.category;if(void 0!==S){if(typeof S!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_CATEGORY","SET_CATEGORY","setCategory()"))));if(P.isFalsy(S.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.INVALID),"SET_CATEGORY","SET_CATEGORY","category","category"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=S.trim()}var l=A.categories;if(void 0!==l){if(!Array.isArray(l))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_CATEGORIES","SET_CATEGORIES","setCategories()"))));0<l.length&&(A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=l)}var _=A.type;if(void 0!==_){if(typeof _!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_TYPE","SET_TYPE","setType()"))));if(P.isFalsy(_.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.INVALID),"SET_TYPE","SET_TYPE","type","type"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.TYPES]=_.trim()}var T=A.types;if(void 0!==T){if(!Array.isArray(T))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<T.length&&(A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.TYPES]=T)}var d=A.tags;if(void 0!==d){if(!Array.isArray(d))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TAGS","SET_TAGS","setTags()"))));0<d.length&&(A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.TAGS]=d)}var h=A.WithTags;if(void 0!==h){if(typeof h!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.WITH_TAGS]=1==h?1:0}var R=A.hideDeletedMessages;if(void 0!==R){if(typeof R!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_DELETED_MESSAGES","HIDE_DELETED_MESSAGES","hideDeletedMessages()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=1==R?1:0}var g=A.interactionGoalCompletedOnly;if(void 0!==g){if(typeof g!==y.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(y.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"ONLY_INTERACTION_GOAL_COMPLETED","ONLY_INTERACTION_GOAL_COMPLETED","interactionGoalCompletedOnly()"))));A.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=1==g?1:0}if(A.createEndpoint(),A.totalPages)if(1!=A.totalPages);else if(A.lastAffix==A.affix)return void s([]);N.makeApiCall(A.endpointName,{listId:A.listId},A.paginationMeta).then(function(t){return I(A,void 0,void 0,function(){var n,o=this;return f(this,function(e){return n=[],t[y.ResponseConstants.RESPONSE_KEYS.KEY_META][y.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(y.MessageConstatnts.PAGINATION.KEYS.ID)&&0==this.id&&(this.id=parseInt(t.meta.cursor[y.MessageConstatnts.PAGINATION.KEYS.ID])),t[y.ResponseConstants.RESPONSE_KEYS.KEY_META][y.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(y.MessageConstatnts.PAGINATION.KEYS.SENT_AT)&&0==this.timestamp&&(this.timestamp=t.meta.cursor[y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]),t.meta.pagination.hasOwnProperty("total_pages")&&(this.totalPages=t.meta.pagination.total_pages),t.meta.cursor.hasOwnProperty("affix")&&(this.lastAffix=t.meta.cursor.affix),t.data[0]?(0<this.id&&(this.id=parseInt(t.data[0].id)),0<this.timestamp&&(this.timestamp=t.data[0].sentAt),t.data.map(function(t){return I(o,void 0,void 0,function(){return f(this,function(e){return M.MessageListnerMaping.getInstance().get(y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST).then(function(e){parseInt(t.id)>e&&M.MessageListnerMaping.getInstance().set(y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))},function(e){M.MessageListnerMaping.getInstance().set(y.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))}),this.affix==y.MessageConstatnts.PAGINATION.AFFIX.APPEND?(this.id<parseInt(t.id)&&0<this.id&&(this.id=parseInt(t.id)),this.timestamp<t.sentAt&&0<this.timestamp&&(this.timestamp=t.sentAt),this.updatedAt<t.updatedAt&&0<this.updatedAt&&(this.updatedAt=t.updatedAt)):(this.id>parseInt(t.id)&&(this.id=parseInt(t.id)),this.timestamp>t.sentAt&&(this.timestamp=t.sentAt),this.updatedAt>t.updatedAt&&(this.updatedAt=t.updatedAt)),this.id&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.timestamp&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.updatedAt&&(this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),n.push(m.MessageController.trasformJSONMessge(t)),[2]})})})):n=[],s(n),[2]})})},function(e){t(new O.CometChatException(e.error))})}catch(e){t(new O.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[y.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(P.isFalsy(this.guid)||P.isFalsy(this.uid))&&P.isFalsy(this.guid)?(P.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},e.prototype.makeData=function(){var e={};e[y.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[y.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(P.isFalsy(this.guid)||P.isFalsy(this.uid))&&P.isFalsy(this.guid)&&P.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(t){return I(this,void 0,void 0,function(){var n,o=this;return f(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).filter(function(e){return t[e].sender.uid==o.uid}).map(function(e){n=s(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e.prototype.getFilteredNextDataByReceiverId=function(t){return I(this,void 0,void 0,function(){var n,o=this;return f(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).filter(function(e){return t[e].sender.uid==o.uid}).map(function(e){n=s(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e}();t.MessagesRequest=o;var a=function(){function e(){this.maxLimit=y.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=y.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0,this.HideDeletedMessages=!1,this.WithTags=!1,this.mentionsWithTagInfoFlag=!1,this.mentionsWithBlockedInfoFlag=!1,this.interactionGoalCompletedOnly=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setGUID=function(e){return this.guid=e,this},e.prototype.setUID=function(e){return this.uid=e,this},e.prototype.setParentMessageId=function(e){return this.parentMessageId=e,this},e.prototype.setTimestamp=function(e){return void 0===e&&(e=P.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=y.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=e,this},e.prototype.setUnread=function(e){return void 0===e&&(e=!1),this.unread=e,this},e.prototype.hideMessagesFromBlockedUsers=function(e){return void 0===e&&(e=!1),this.HideMessagesFromBlockedUsers=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKey=e,this},e.prototype.setUpdatedAfter=function(e){return this.updatedAt=e,this},e.prototype.updatesOnly=function(e){return e&&(this.onlyUpdate=1),this},e.prototype.setCategory=function(e){return this.category=e,this},e.prototype.setCategories=function(e){return this.categories=e,this},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setTypes=function(e){return this.types=e,this},e.prototype.hideReplies=function(e){return this.HideReplies=e,this},e.prototype.hideDeletedMessages=function(e){return this.HideDeletedMessages=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.mentionsWithTagInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithTagInfoFlag=e,this},e.prototype.mentionsWithBlockedInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithBlockedInfoFlag=e,this},e.prototype.setInteractionGoalCompletedOnly=function(e){return void 0===e&&(e=!1),this.interactionGoalCompletedOnly=e,this},e.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new o(this)},e}();t.MessagesRequestBuilder=a},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};t.__esModule=!0,t.MessagesStore=void 0;var o=n(6),E=n(0),c=n(1),r=n(2),s=n(14),i=function(){function e(e){this.store=c.constants.DEFAULT_STORE,E.isFalsy(e)||(this.store=e);try{this.messagesStore=s.default}catch(e){E.Logger.error("MessageStore: constructor",{e:e})}}return e.getInstance=function(){return null==e.MessagesStore&&(e.MessagesStore=new e),e.MessagesStore},e.prototype.set=function(e,t){var n=E.getKeyprefix(c.LOCAL_STORE.MESSAGES_STORE,e);return this.messagesStore.setItem(n,JSON.stringify(t))},e.prototype.get=function(e){var o=this,s=E.getKeyprefix(c.LOCAL_STORE.MESSAGES_STORE,e);return new Promise(function(n,t){try{o.messagesStore.getItem(s).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new r.CometChatException(e))}})},e.prototype.getAllMessages=function(){var n=this,o={};return new Promise(function(e,t){n.messagesStore.iterate(function(e,t,n){t!=c.constants.MSG_VER_POST&&t!=c.constants.MSG_VER_POST&&(o=a(a({},o),e))}).then(function(){e(o)})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeMessages=function(e){var n=this;if(o.CometChat.user.getUid()){var s=o.CometChat.user.getUid(),r={},i=0;return this.get(c.constants.MSG_VER_POST).then(function(o){e.map(function(e){var t;if(!E.isFalsy(e)){0==i&&(i=parseInt(e.getId().toString())),i>e.getId()&&(i=parseInt(e.getId().toString())),o<e.getId()&&(o=parseInt(e.getId().toString()));var n=void 0;n=e.getSender()instanceof Object?e.getSender().getUid():e.getSender(),e.getReceiverType()==c.MessageConstatnts.RECEIVER_TYPE.GROUP&&(n=e.getReceiver()),e.getSender()instanceof Object?e.getSender().getUid()==s&&(n=e.getReceiver()):e.getSender()==s&&(n=e.getReceiver()),r[n]||(r[n]={}),r[n]=a(a({},r[n]),((t={})[e.getId()]=e,t))}}),n.get(c.constants.MSG_VER_PRE).then(function(e){(0<i&&i<e||null==e)&&n.set(c.constants.MSG_VER_PRE,i)})&&0<o&&n.set(c.constants.MSG_VER_POST,o),Object.keys(r).map(function(t){n.get(t).then(function(e){null==e&&(e={}),n.set(t,a(a({},r[t]),e))})})}),!0}},e}();t.MessagesStore=i},function(e,t,n){"use strict";t.__esModule=!0,t.BlockedUsersRequestBuilder=t.BlockedUsersRequest=void 0;var s=n(5),o=n(0),r=n(12),i=n(2),a=n(1),E=function(){function e(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.direction)||(this.direction=e.direction))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.direction){if(typeof this.direction!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_DIRECTION","SET_DIRECTION","setDirection()")));if(this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BOTH&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME)return new i.CometChatException(a.UserErrors.INVALID_DIRECTION)}},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateBlockedUsersBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("blockedUsersList",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(r.UsersController.trasformJSONUser(e))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new i.CometChatException(e))}})},e.prototype.getDirection=function(){return this.direction},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.direction)||(e.direction=this.direction),o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e.directions=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS,e}();t.BlockedUsersRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setDirection=function(e){return this.direction=e,this},e.prototype.blockedByMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME,this},e.prototype.hasBlockedMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME,this},e.prototype.build=function(){return new E(this)},e}();t.BlockedUsersRequestBuilder=c},function(e,t,n){"use strict";t.__esModule=!0,t.AppSettingsBuilder=t.AppSettings=void 0;var o=n(1),s=function(){function t(e){this.subscriptionType=t.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null,this.subscriptionType=e.subscriptionType,this.roles=e.roles,this.region=e.region,this.autoJoinGroup=e.autoJoinGroup,this.establishSocketConnection=e.establishSocketConnection,this.adminHost=e.adminHost,this.clientHost=e.clientHost}return t.prototype.getSubscriptionType=function(){return this.subscriptionType},t.prototype.getRoles=function(){return this.roles},t.prototype.getRegion=function(){return this.region},t.prototype.getIsAutoJoinEnabled=function(){return this.autoJoinGroup},t.prototype.shouldAutoEstablishSocketConnection=function(){return this.establishSocketConnection},t.prototype.getAdminHost=function(){return this.adminHost},t.prototype.getClientHost=function(){return this.clientHost},t.SUBSCRIPTION_TYPE_NONE="NONE",t.SUBSCRIPTION_TYPE_ALL_USERS="ALL_USERS",t.SUBSCRIPTION_TYPE_ROLES="ROLES",t.SUBSCRIPTION_TYPE_FRIENDS="FRIENDS",t.REGION_EU=o.DEFAULT_VALUES.REGION_DEFAULT_EU,t.REGION_US=o.DEFAULT_VALUES.REGION_DEFAULT_US,t.REGION_IN=o.DEFAULT_VALUES.REGION_DEFAULT_IN,t.REGION_PRIVATE=o.DEFAULT_VALUES.REGION_DEFAULT_PRIVATE,t}();t.AppSettings=s;var r=function(){function e(){this.subscriptionType=s.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null}return e.prototype.subscribePresenceForAllUsers=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ALL_USERS,this},e.prototype.subscribePresenceForRoles=function(e){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ROLES,this.roles=e,this},e.prototype.subscribePresenceForFriends=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_FRIENDS,this},e.prototype.setRegion=function(e){return void 0===e&&(e=o.DEFAULT_VALUES.REGION_DEFAULT),this.region=e.toLowerCase(),this},e.prototype.enableAutoJoinForGroups=function(e){return void 0===e&&(e=!0),this.autoJoinGroup=e,this},e.prototype.autoEstablishSocketConnection=function(e){return void 0===e&&(e=!0),this.establishSocketConnection=e,this},e.prototype.overrideAdminHost=function(e){return this.adminHost=e,this},e.prototype.overrideClientHost=function(e){return this.clientHost=e,this},e.prototype.build=function(){return new s(this)},e}();t.AppSettingsBuilder=r},function(e,t,n){"use strict";var p=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};t.__esModule=!0,t.CometChatHelper=void 0;var C=n(11),S=n(1),l=n(12),_=n(18),T=n(32),d=n(6),h=n(2),o=n(0),R=n(7),g=n(4),A=n(21),I=n(10),s=function(){function e(){}return e.processMessage=function(e){try{return C.MessageController.trasformJSONMessge(e)}catch(e){o.Logger.error("CometChatHelper: processMessage",e)}},e.getConversationFromMessage=function(u){return new Promise(function(E,c){try{d.CometChat.getLoggedinUser().then(function(e){if(null!==e){var t=C.MessageController.trasformJSONMessge(u),n=t.receiverType,o=t.conversationId,s=void 0,r=C.MessageController.trasformJSONMessge(u);if(n==S.MessageConstatnts.RECEIVER_TYPE.USER){var i=l.UsersController.trasformJSONUser(t[S.MessageConstatnts.KEYS.SENDER]);s=i.getUid()==e.getUid()?l.UsersController.trasformJSONUser(t[S.MessageConstatnts.KEYS.RECEIVER]):i}else s=_.GroupsController.trasformJSONGroup(t[S.MessageConstatnts.KEYS.RECEIVER]);var a=T.ConversationController.trasformJSONConversation(o,n,r,s,0,[],null,null);E(a)}else c(S.UserErrors.USER_NOT_LOGGED_IN)},function(e){c(new h.CometChatException(e.error))})}catch(e){c(new h.CometChatException(e))}})},e.updateMessageWithReactionInfo=function(e,t,n){var o,s,r,i;try{if(!e||!t||!n)return new h.CometChatException(I.ERRORS.PARAMETER_MISSING);if(!(e instanceof R.BaseMessage))return new h.CometChatException(I.ERRORS.PARAMETER_MISSING);if(n===g.MESSAGE_REACTION.ACTION.ADDED){if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<(null===(o=e.getReactions())||void 0===o?void 0:o.length)){var a=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==a){(c=e.getReactions())[a].setCount(c[a].getCount()+1),(null===(s=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===s?void 0:s.uid)===t.getUid()&&c[a].setReactedByMe(!0),e.setReactions(c)}else{var E=void 0;E=(null===(r=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===r?void 0:r.uid)===t.getUid()?new A.ReactionCount(t.getReaction(),1,!0):new A.ReactionCount(t.getReaction(),1,!1),e.setReactions(p(e.getReactions(),[E]))}}else(null===(i=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===i?void 0:i.uid)===t.getUid()?e.setReactions([new A.ReactionCount(t.getReaction(),1,!0)]):e.setReactions([new A.ReactionCount(t.getReaction(),1,!1)]);return e}}else{if(n!==g.MESSAGE_REACTION.ACTION.REMOVED)return new h.CometChatException(I.ERRORS.PARAMETER_MISSING);if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<e.getReactions().length){var c,u=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==u)if(1<(E=e.getReactions()[u]).getCount())(c=e.getReactions())[u].setCount(c[u].getCount()-1),d.CometChat.user.getUid()===t.getUid()&&c[u].setReactedByMe(!1),e.setReactions(c);else c=(c=e.getReactions()).filter(function(e,t){return t!==u}),e.setReactions(c)}return e}}}catch(e){return new h.CometChatException(e)}},e}();t.CometChatHelper=s},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},a=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};t.__esModule=!0,t.WSConnectionHelper=void 0;var C=n(6),s=n(68),S=n(1),r=n(16),E=n(45),l=n(0),i=n(47),_=n(31),c=n(33),u=n(28),p=n(29),T=n(69),d=n(70),h=n(71),R=n(72),g=n(73),A=n(74),I=n(75),f=n(76),O=n(30),N=n(36),m=n(34),P=n(4),y=n(49),M=n(17),v=i.ListenerHandlers.getInstance(),L=function(){function i(){var n=this;this.startWSResponseTimer=function(){i.wsResponseTimer=setInterval(function(){try{1<i.wsResponseTime?i.wsResponseTime=i.wsResponseTime-1:1===i.wsResponseTime&&(C.CometChat.disconnectInternally(),n.clearPingTimer(),n.clearWSResponseTimer(),i.appInactiveTimer&&i.clearAppInactiveTimer())}catch(e){l.Logger.error("CometChat: startWSResponseTimer",e)}},1e3)},this.clearWSResponseTimer=function(){try{i.wsResponseTime=30,clearInterval(i.wsResponseTimer)}catch(e){l.Logger.error("WSConnectionHelper: clearWSResponseTimer",e)}},M.AppState.addEventListener("change",function(e){var t;(null===(t=C.CometChat.appSettings)||void 0===t?void 0:t.shouldAutoEstablishSocketConnection())||("active"===e?(i.isAppInactive=!1,i.pingTimer&&i.clearAppInactiveTimer(),!i.pingTimer&&y.checkConnection(n.connection)&&(n.pingWS(),n.startPingingWS())):i.isAppInactive=!0)})}return i.getInstance=function(){try{return null!=this.wsConnectionHelper&&null!=this.wsConnectionHelper||(this.wsConnectionHelper=new i),this.wsConnectionHelper}catch(e){l.Logger.error("WSConnectionHelper: getInstance",e)}},i.prototype.WSLogin=function(t,n){var o=this;try{y.getWSURL().then(function(e){o.connection=new WebSocket(e),n&&o.connection&&o.connection.readyState==P.READY_STATE.CONNECTING&&n(o.connection.readyState),o.connection.onopen=function(e){o.onOpen(e,n),o.authenticateUser(t)},o.connection.onclose=function(e){o.onClose(e,n)},o.connection.onmessage=function(e){o.onMessage(e)}},function(e){l.Logger.error("WSConnectionHelper :: WSLogin",e)})}catch(e){l.Logger.error("WSConnectionHelper: WSLogin",e)}},i.prototype.onOpen=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){l.Logger.error("WSConnectionHelper: onOpen",e)}},i.prototype.onClose=function(e,t){try{t&&this.connection&&t(this.connection.readyState,e)}catch(e){l.Logger.error("WSConnectionHelper: onClose",e)}},i.prototype.onMessage=function(e){if(e.data&&"string"==typeof e.data)try{var t=JSON.parse(e.data);if(t&&t.action&&t.action===P.KEYS.PONG)return;var n=this.getCometChatEventFromMessage(t);if(n.getDeviceId()===C.CometChat.getSessionId()&&n.getType()!==P.AUTH.TYPE)return;switch(n.getType()){case P.MESSAGE_REACTION.TYPE:this.publishMessageReaction(n);break;case P.TYPING_INDICATOR.TYPE:this.publishTypingIndicator(n);break;case P.RECEIPTS.TYPE:this.publishReceipts(n);break;case P.PRESENCE.TYPE:this.publishPresence(n);break;case P.AUTH.TYPE:this.authResponseReceived(n);break;case P.MESSAGE.TYPE:this.publishMessages(n);break;case P.TRANSIENT_MESSAGE.TYPE:this.publishTransientMessage(n);break;case P.INTERACTION_RECEIPT.TYPE:this.publishInteractionReceipt(n);break;default:l.Logger.log("WSHelper: onMessage :: unknown type",e.data)}}catch(e){l.Logger.error("WSHelper: onMessage",e)}else l.Logger.log("WSHelper: onMessage :: object data",e.data)},i.prototype.authenticateUser=function(u){var p=this;try{C.CometChat.getLoggedinUser().then(function(c){c?_.KeyStore.getInstance().get("deviceId").then(function(E){l.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",o=E,s={version:S.SDKHeader.sdkVersion,apiVersion:e[S.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};l.isFalsy(C.CometChat.resource)||(s.resource=C.CometChat.resource),l.isFalsy(C.CometChat.platform)||(s.platform=C.CometChat.platform),l.isFalsy(C.CometChat.language)||(s.language=C.CometChat.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,userAgent:n,deviceId:o,platform:S.SDKHeader.platform},i=new T.CometChatAuthEvent(C.CometChat.getAppId(),"","",c.getUid(),C.CometChat.getSessionId());if(i.setAuth(u),i.setPresenceSubscription(C.CometChat.appSettings.getSubscriptionType()),i.setDeviceId(C.CometChat.getSessionId()),i.setExtraParmaeters(r),y.checkConnection(p.connection)){var a=i.getAsString();p.connection.send(a)}})}):l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},i.prototype.authResponseReceived=function(e){try{"200"===e.getCode()&&"OK"===e.getStatus()&&this.startPingingWS()}catch(e){l.Logger.error("WSConnectionHelper: authResponseReceived",e)}},i.prototype.WSLogout=function(){try{this.clearPingTimer(),y.checkConnection(this.connection)&&this.connection.close(P.LOGOUT_CODE,P.LOGOUT_REASON)}catch(e){l.Logger.error("WSConnectionHelper: WSLogout",e)}},i.clearAppInactiveTimer=function(){try{i.appInactiveTime=30,clearInterval(i.appInactiveTimer)}catch(e){l.Logger.error("WSConnectionHelper: clearAppInactiveTime",e)}},i.startAppInactiveTimer=function(){i.appInactiveTimer=setInterval(function(){try{1<i.appInactiveTime?i.appInactiveTime=i.appInactiveTime-1:1===i.appInactiveTime&&(C.CometChat.disconnectInternally(),clearInterval(i.appInactiveTimer),i.appInactiveTime=30)}catch(e){l.Logger.error("CometChat: startAppInactiveTimer",e)}},1e3)},i.prototype.pingWS=function(r){return o(this,void 0,void 0,function(){var t,n,o,s;return a(this,function(e){switch(e.label){case 0:return(t=r||{}).onError,n=t.onSuccess,y.checkConnection(this.connection)?(o=new h.CometChatPingEvent("","","","",""),s=o.getAsString(),this.connection.send(s),i.isAppInactive&&this.startWSResponseTimer(),[4,this.listenForPong()]):[3,2];case 1:e.sent()?(l.Logger.log("WSConnectionHelper :: startPingingWS","pong success"),i.isAppInactive?(this.clearWSResponseTimer(),i.pingTimer&&this.clearPingTimer(),i.appInactiveTimer&&i.clearAppInactiveTimer(),i.startAppInactiveTimer()):i.appInactiveTimer&&i.clearAppInactiveTimer(),C.CometChat.getConnectionStatus()!=S.CONNECTION_STATUS.CONNECTED&&(this.WSLogout(),this.connection=null,C.CometChat.getInstance().makeWSConnection()),n&&n({status:C.CometChat.getConnectionStatus()})):(i.isAppInactive?(i.appInactiveTimer&&i.clearAppInactiveTimer(),i.startAppInactiveTimer()):i.appInactiveTimer&&i.clearAppInactiveTimer(),l.Logger.log("WSConnectionHelper :: startPingingWS","pong failure"),this.WSLogout(),this.connection=null,C.CometChat.getInstance().setConnectionStatus(S.CONNECTION_STATUS.DISCONNECTED),v.connectionHandlers.map(function(e){try{e._eventListener&&(l.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){l.Logger.error("WSConnectionHandlers: Disconnected Status",e)}}),C.CometChat.getInstance().accidentallyDisconnected()),e.label=2;case 2:return[2]}})})},i.prototype.startPingingWS=function(){var e=this;try{i.pingTimer||(i.pingTimer=setInterval(function(){return o(e,void 0,void 0,function(){return a(this,function(e){return this.pingWS(),[2]})})},15e3))}catch(e){l.Logger.error("WSConnectionHelper: startPingingWS",e)}},i.prototype.listenForPong=function(){var o=this;return new Promise(function(t,e){var n=setTimeout(function(){t(!1)},3e3);o.connection.addEventListener("message",function(e){e&&e.data&&"string"==typeof e.data&&(JSON.parse(e.data).action===P.KEYS.PONG&&(clearTimeout(n),t(!0)))})})},i.prototype.clearPingTimer=function(){i.pingTimer&&(clearInterval(i.pingTimer),i.pingTimer=void 0)},i.prototype.sendOnlineEvent=function(){var o=this;try{y.checkConnection(this.connection)&&C.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:C.CometChat.getAppId(),deviceId:C.CometChat.getSessionId(),type:P.PRESENCE.TYPE,body:{action:P.PRESENCE.ACTION.ONLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(y.checkConnection(o.connection)){var n=y.stringifyMessage(t);o.connection.send(n)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendOnlineEvent",e)}},i.prototype.sendOfflineEvent=function(){var o=this;try{y.checkConnection(this.connection)&&C.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:C.CometChat.getAppId(),deviceId:C.CometChat.getSessionId(),type:P.PRESENCE.TYPE,body:{action:P.PRESENCE.ACTION.OFFLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(y.checkConnection(o.connection)){var n=y.stringifyMessage(t);o.connection.send(n)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendOfflineEvent",e)}},i.prototype.startTypingIndicator=function(s,r,i){var a=this;try{C.CometChat.getLoggedinUser().then(function(e){if(e){var t=new m.TypingIndicator(s,r);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new f.CometChatTypingEvent(C.CometChat.getAppId(),s,r,e.getUid(),C.CometChat.getSessionId());if(n.setAction(P.TYPING_INDICATOR.ACTION.STARTED),n.setTypingIndicator(t),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},i.prototype.pauseTypingIndicator=function(s,r,i){var a=this;try{C.CometChat.getLoggedinUser().then(function(e){if(e){var t=new m.TypingIndicator(s,r);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new f.CometChatTypingEvent(C.CometChat.getAppId(),s,r,e.getUid(),C.CometChat.getSessionId());if(n.setAction(P.TYPING_INDICATOR.ACTION.ENDED),n.setTypingIndicator(t),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: pauseTypingIndicator",e)}},i.prototype.markAsRead=function(s,r,i,a){var E=this;try{C.CometChat.getLoggedinUser().then(function(e){if(e){var t=new A.CometChatReceiptEvent(C.CometChat.getAppId(),s,r,e.getUid(),C.CometChat.getSessionId(),a);t.setAction(P.RECEIPTS.ACTION.READ);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(P.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),y.checkConnection(E.connection)){var o=t.getAsString();E.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: markAsRead",e)}},i.prototype.markAsDelivered=function(s,r,i,a){var E=this;try{C.CometChat.getLoggedinUser().then(function(e){if(e){var t=new A.CometChatReceiptEvent(C.CometChat.getAppId(),s,r,e.getUid(),C.CometChat.getSessionId(),a);t.setAction(P.RECEIPTS.ACTION.DELIVERED);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(P.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),y.checkConnection(E.connection)){var o=t.getAsString();E.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: markAsDelivered",e)}},i.prototype.sendTransientMessage=function(s,r,i){var a=this;try{C.CometChat.getLoggedinUser().then(function(e){if(e){var t=new N.TransientMessage(s,r,i);e.authToken&&delete e.authToken,t.setSender(e);var n=new I.CometChatTransientEvent(C.CometChat.getAppId(),s,r,e.getUid(),C.CometChat.getSessionId());if(n.setTransientMessage(t),y.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendTransientMessage",e)}},i.prototype.publishMessageReaction=function(e){var t=e.getMessageReactionEvent();switch(e.getAction()){case P.MESSAGE_REACTION.ACTION.ADDED:v.messageHandlers.map(function(e){e._eventListener.onMessageReactionAdded&&e._eventListener.onMessageReactionAdded(t)});break;case P.MESSAGE_REACTION.ACTION.REMOVED:v.messageHandlers.map(function(e){e._eventListener.onMessageReactionRemoved&&e._eventListener.onMessageReactionRemoved(t)})}},i.prototype.publishTypingIndicator=function(e){try{var t=e.getTypingIndicator();switch(e.getAction()){case P.TYPING_INDICATOR.ACTION.STARTED:v.messageHandlers.map(function(e){e._eventListener.onTypingStarted&&e._eventListener.onTypingStarted(t)}),E.TypingNotificationController.addIncomingTypingStarted(t);break;case P.TYPING_INDICATOR.ACTION.ENDED:v.messageHandlers.map(function(e){e._eventListener.onTypingEnded&&e._eventListener.onTypingEnded(t)}),E.TypingNotificationController.removeIncomingTypingStarted(t)}}catch(e){l.Logger.error("WSHelper: publishTypingIndicator",e)}},i.prototype.publishReceipts=function(e){try{var t=e.getMessageReceipt();switch(e.getAction()){case P.RECEIPTS.ACTION.DELIVERED:v.messageHandlers.map(function(e){e._eventListener.onMessagesDelivered&&e._eventListener.onMessagesDelivered(t)});break;case P.RECEIPTS.ACTION.READ:v.messageHandlers.map(function(e){e._eventListener.onMessagesRead&&e._eventListener.onMessagesRead(t)});break;case P.RECEIPTS.ACTION.DELIVERED_TO_ALL:v.messageHandlers.map(function(e){e._eventListener.onMessagesDeliveredToAll&&e._eventListener.onMessagesDeliveredToAll(t)});break;case P.RECEIPTS.ACTION.READ_BY_ALL:v.messageHandlers.map(function(e){e._eventListener.onMessagesReadByAll&&e._eventListener.onMessagesReadByAll(t)})}}catch(e){l.Logger.error("WSHelper: publishReceipts",e)}},i.prototype.publishPresence=function(e){try{var t=e.getUser();switch(t.setLastActiveAt(e.getTimestamp()),e.getAction()){case P.PRESENCE.ACTION.ONLINE:case P.PRESENCE.ACTION.AVAILABLE:t.setStatus(S.PresenceConstatnts.STATUS.ONLINE),v.userHandlers.map(function(e){l.isFalsy(e._eventListener.onUserOnline)||e._eventListener.onUserOnline(t)});break;case P.PRESENCE.ACTION.OFFLINE:t.setStatus(S.PresenceConstatnts.STATUS.OFFLINE),v.userHandlers.map(function(e){l.isFalsy(e._eventListener.onUserOffline)||e._eventListener.onUserOffline(t)})}}catch(e){l.Logger.error("WSHelper: publishPresence",e)}},i.prototype.publishMessages=function(e){try{var t=e.getMessage();t&&t.getId()&&c.MessageListnerMaping.getInstance().set("all",t.getId()),t instanceof p.Call?this.publishCallMessage(t):t instanceof u.Action?this.publishActionMessage(t):this.publishMessage(t)}catch(e){l.Logger.error("WSHelper: publishMessages",e)}},i.prototype.publishMessage=function(n){try{v.messageHandlers.map(function(e){if(e._eventListener){var t=n;switch(t.getType()){case S.MessageConstatnts.TYPE.TEXT:l.isFalsy(e._eventListener.onTextMessageReceived)||e._eventListener.onTextMessageReceived(n);break;case S.MessageConstatnts.TYPE.CUSTOM:l.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n);break;default:t.getCategory()==S.MessageCategory.CUSTOM?l.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n):t.getCategory()==S.MessageCategory.INTERACTIVE?l.isFalsy(e._eventListener.onInteractiveMessageReceived)||e._eventListener.onInteractiveMessageReceived(n):l.isFalsy(e._eventListener.onMediaMessageReceived)||e._eventListener.onMediaMessageReceived(n)}}})}catch(e){l.Logger.error("WSHelper: publishMessage",e)}},i.prototype.publishCallMessage=function(t){try{var n=r.CallController.getInstance().getActiveCall();switch(t.getStatus()){case S.CallConstants.CALL_STATUS.INITIATED:t.getReceiverType()==S.CallConstants.RECEIVER_TYPE_GROUP?v.callHandlers.map(function(e){t.getCallInitiator().getUid().toLocaleLowerCase()!=C.CometChat.user.getUid().toLocaleLowerCase()&&(l.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t))}):v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t)});break;case S.CallConstants.CALL_STATUS.ONGOING:t.getReceiverType()==S.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==C.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}):(r.CallController.getInstance().clearTimer(),v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}));break;case S.CallConstants.CALL_STATUS.UNANSWERED:if(t.getCallInitiator().getUid().toLocaleLowerCase()==C.CometChat.user.getUid().toLocaleLowerCase())v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)})}break;case S.CallConstants.CALL_STATUS.REJECTED:if(t.getReceiverType()==S.CallConstants.RECEIVER_TYPE_GROUP)t.getCallInitiator().getUid().toLocaleLowerCase()==C.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)})}break;case S.CallConstants.CALL_STATUS.BUSY:t.getReceiverType()==S.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==C.CometChat.user.getUid().toLocaleLowerCase()&&v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)}):v.callHandlers.map(function(e){if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});break;case S.CallConstants.CALL_STATUS.CANCELLED:if(v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)}),null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}break;case S.CallConstants.CALL_STATUS.ENDED:if(v.callHandlers.map(function(e){l.isFalsy(e._eventListener.onCallEndedMessageReceived)||e._eventListener.onCallEndedMessageReceived(t)}),null!==n&&n.getSessionId()===t.getSessionId())try{l.isCallingComponentInstalled()&&(r.CallController.getInstance().endSession(!0,t),r.CallController.getInstance().endCall())}catch(e){l.Logger.error("CallError",e)}break;default:l.Logger.log("WSHelper: publishCallMessage :: unknown status",t)}}catch(e){l.Logger.error("WSHelper: publishCallMessage",e)}},i.prototype.publishActionMessage=function(t){try{switch(t.getAction()){case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_JOINED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_INVITED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_LEFT:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberLeft)||e._eventListener.onGroupMemberLeft(t,t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_BANNED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberBanned)||e._eventListener.onGroupMemberBanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_KICKED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberKicked)||e._eventListener.onGroupMemberKicked(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_UNBANNED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberUnbanned)||e._eventListener.onGroupMemberUnbanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_SCOPE_CHANGED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberScopeChanged)||e._eventListener.onGroupMemberScopeChanged(t,t.getActionOn(),t.getNewScope(),t.getOldScope(),t.getActionFor())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_EDITED:v.messageHandlers.map(function(e){l.isFalsy(e._eventListener.onMessageEdited)||e._eventListener.onMessageEdited(t.getActionOn())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_DELETED:v.messageHandlers.map(function(e){l.isFalsy(e._eventListener.onMessageDeleted)||e._eventListener.onMessageDeleted(t.getActionOn())});break;case S.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_ADDED:v.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberAddedToGroup)||e._eventListener.onGroupMemberAddedToGroup(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;default:l.Logger.log("WSHelper: publishActionMessage :: unknown action",t)}}catch(e){l.Logger.error("WSHelper: publishActionMessage",e)}},i.prototype.publishTransientMessage=function(e){try{var t=e.getTransientMessage();v.messageHandlers.map(function(e){e._eventListener.onTransientMessageReceived&&e._eventListener.onTransientMessageReceived(t)})}catch(e){l.Logger.error("WSHelper: publishTransientMessage",e)}},i.prototype.publishInteractionReceipt=function(e){try{var t=e.getInteractionReceipt();v.messageHandlers.map(function(e){e._eventListener.onInteractionGoalCompleted&&e._eventListener.onInteractionGoalCompleted(t)})}catch(e){l.Logger.error("WSHelper: publishInteractionReceipt",e)}},i.prototype.getCometChatEventFromMessage=function(e){try{if(e.hasOwnProperty(P.KEYS.TYPE))switch(e.type){case P.TYPING_INDICATOR.TYPE:return f.CometChatTypingEvent.getTypingEventFromJSON(e);case P.RECEIPTS.TYPE:return A.CometChatReceiptEvent.getReceiptEventFromJSON(e);case P.PRESENCE.TYPE:return R.CometChatPresenceEvent.getPresenceEventFromJSON(e);case P.MESSAGE.TYPE:return d.CometChatMessageEvent.getMessageEventFromJSON(e);case P.AUTH.TYPE:return T.CometChatAuthEvent.getAuthEventFromJSON(e);case P.TRANSIENT_MESSAGE.TYPE:return I.CometChatTransientEvent.getTransientEventFromJSON(e);case P.INTERACTION_RECEIPT.TYPE:return s.CometChatInteractionReceiptEvent.getReceiptEventFromJSON(e);case P.MESSAGE_REACTION.TYPE:return g.CometChatReactionEvent.getReactionEventFromJSON(e)}}catch(e){l.Logger.error("WSConnectionHelper: getCometChatEventFromMessage",e)}},i.wsConnectionHelper=new i,i.appInactiveTime=30,i.isAppInactive=!1,i.wsResponseTime=30,i}();t.WSConnectionHelper=L},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatInteractionReceiptEvent=void 0;var l=n(4),r=n(8),_=n(27),T=n(46),d=n(3),i=function(a){function S(e,t,n,o,s,r){var i=a.call(this,e,t,n,o,s,r)||this;return i.setType(l.INTERACTION_RECEIPT.TYPE),i}return s(S,a),S.prototype.getInteractionReceipt=function(){return this.interactionReceipt},S.prototype.setInteractionReceipt=function(e){this.interactionReceipt=e},S.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},S.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[l.KEYS.MESSAGE_ID]=this.interactionReceipt.getMessageId(),t[l.KEYS.USER]=this.interactionReceipt.getSender(),t[l.KEYS.INTERACTIONS]=this.interactionReceipt.getInteractions(),e[l.KEYS.BODY]=t,e},S.getReceiptEventFromJSON=function(e){var t=e[l.KEYS.APP_ID],n=e[l.KEYS.RECEIVER],o=e[l.KEYS.RECEIVER_TYPE],s=e[l.KEYS.DEVICE_ID],r=e[l.KEYS.SENDER],i=e[l.KEYS.MESSAGE_SENDER],a=e[l.KEYS.BODY],E=a[l.KEYS.USER],c=a[l.KEYS.MESSAGE_ID],u=a[l.KEYS.INTERACTIONS],p=new S(t,n,o,r,s,i),C=new T.InteractionReceipt;return C.setSender(new d.User(E)),C.setReceiverType(o),C.setMessageId(c),C.setReceiverId(n),C.setInteractions(u.map(function(e){return _.Interaction.getInteractionFromJSON(e)})),p.setInteractionReceipt(C),p},S}(r.CometChatEvent);t.CometChatInteractionReceiptEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatAuthEvent=void 0;var p=n(4),r=function(i){function u(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(p.AUTH.TYPE),r}return s(u,i),u.prototype.getStatus=function(){return this.status},u.prototype.setStatus=function(e){this.status=e},u.prototype.getCode=function(){return this.code},u.prototype.setCode=function(e){this.code=e},u.prototype.setAuth=function(e){this.auth=e},u.prototype.getAuth=function(){return this.auth},u.prototype.setPresenceSubscription=function(e){this.presenceSubscription=e},u.prototype.getPresenceSubscription=function(){return this.presenceSubscription},u.prototype.setDeviceId=function(e){this.deviceId=e},u.prototype.getdeviceId=function(){return this.deviceId},u.prototype.setExtraParmaeters=function(e){this.params=e},u.prototype.getExtraParameters=function(){return this.params},u.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},u.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[p.KEYS.AUTH]=this.auth,t[p.KEYS.DEVICE_ID]=this.deviceId,t[p.KEYS.PRESENCE_SUBSCRIPTION]=this.presenceSubscription,t[p.KEYS.PARAMS]=this.params,e[p.KEYS.BODY]=t,e},u.getAuthEventFromJSON=function(e){var t=e[p.KEYS.APP_ID],n=e[p.KEYS.RECEIVER],o=e[p.KEYS.RECEIVER_TYPE],s=e[p.KEYS.DEVICE_ID],r=e[p.KEYS.SENDER],i=e[p.KEYS.BODY],a=i[p.KEYS.STATUS],E=i[p.KEYS.CODE],c=new u(t,n,o,r,s);return c.setStatus(a),c.setCode(E),c},u}(n(8).CometChatEvent);t.CometChatAuthEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatMessageEvent=void 0;var u=n(11),p=n(4),r=function(i){function c(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(p.MESSAGE.TYPE),r}return s(c,i),c.prototype.getMessage=function(){return this.message},c.prototype.setMessage=function(e){this.message=e},c.getMessageEventFromJSON=function(e){var t=e[p.KEYS.APP_ID],n=e[p.KEYS.RECEIVER],o=e[p.KEYS.RECEIVER_TYPE],s=e[p.KEYS.DEVICE_ID],r=e[p.KEYS.SENDER],i=e[p.KEYS.BODY],a=new c(t,n,o,r,s),E=u.MessageController.trasformJSONMessge(i);return a.setMessage(E),a},c}(n(8).CometChatEvent);t.CometChatMessageEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatPingEvent=void 0;var i=n(4),r=function(r){function e(e,t,n,o,s){return r.call(this,e,t,n,o,s)||this}return s(e,r),e.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},e.prototype.getAsJSONObject=function(){var e={};return e[i.KEYS.ACTION]=i.KEYS.PING,e[i.KEYS.ACK]="true",e},e}(n(8).CometChatEvent);t.CometChatPingEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatPresenceEvent=void 0;var u=n(4),r=n(8),p=n(3),i=function(i){function c(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(u.PRESENCE.TYPE),r}return s(c,i),c.prototype.getAction=function(){return this.action},c.prototype.setAction=function(e){this.action=e},c.prototype.getUser=function(){return this.user},c.prototype.setUser=function(e){this.user=e},c.prototype.getTimestamp=function(){return this.timestamp},c.prototype.setTimestamp=function(e){this.timestamp=e},c.getPresenceEventFromJSON=function(e){var t=e[u.KEYS.APP_ID],n=e[u.KEYS.DEVICE_ID],o=e[u.KEYS.SENDER],s=e[u.KEYS.BODY],r=s[u.KEYS.ACTION],i=s[u.KEYS.USER],a=s[u.KEYS.TIMESTAMP],E=new c(t,"","",o,n);return E.setAction(r),E.setUser(new p.User(i)),E.setTimestamp(a),E},c}(r.CometChatEvent);t.CometChatPresenceEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatReactionEvent=void 0;var g=n(4),r=n(8),A=n(35),I=n(48),i=function(i){function R(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(g.MESSAGE_REACTION.TYPE),r}return s(R,i),R.prototype.getAction=function(){return this.action},R.prototype.setAction=function(e){this.action=e},R.prototype.getMessageReactionEvent=function(){return this.reaction},R.prototype.setMessageReactionEvent=function(e){this.reaction=e},R.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},R.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[g.KEYS.ACTION]=this.action,t[g.KEYS.REACTION]=this.reaction,e[g.KEYS.BODY]=t,e},R.getReactionEventFromJSON=function(e){var t=e[g.KEYS.APP_ID],n=e[g.KEYS.DEVICE_ID],o=e[g.KEYS.SENDER],s=e[g.KEYS.RECEIVER],r=e[g.KEYS.RECEIVER_TYPE],i=e[g.KEYS.BODY],a=i[g.KEYS.ACTION],E=i[g.KEYS.ID],c=i[g.KEYS.MESSAGE_ID],u=i[g.KEYS.UID],p=i[g.KEYS.REACTION],C=i[g.KEYS.REACTED_BY],S=i[g.KEYS.REACTED_AT],l=i[g.KEYS.CONVERSATION_ID],_=i[g.KEYS.PARENT_ID],T=new A.Reaction(E,c,p,u,S,C),d=new I.ReactionEvent(T,s,r,l,_),h=new R(t,s,r,o,n);return h.setAction(a),h.setMessageReactionEvent(d),h},R}(r.CometChatEvent);t.CometChatReactionEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatReceiptEvent=void 0;var l=n(4),r=n(8),_=n(30),T=n(3),i=function(a){function S(e,t,n,o,s,r){var i=a.call(this,e,t,n,o,s,r)||this;return i.setType(l.RECEIPTS.TYPE),i}return s(S,a),S.prototype.getAction=function(){return this.action},S.prototype.setAction=function(e){this.action=e},S.prototype.getMessageReceipt=function(){return this.receipt},S.prototype.setMessageReceipt=function(e){this.receipt=e},S.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},S.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[l.KEYS.ACTION]=this.action,t[l.KEYS.MESSAGE_ID]=this.receipt.getMessageId(),t[l.KEYS.USER]=this.receipt.getSender(),e[l.KEYS.BODY]=t,e},S.getReceiptEventFromJSON=function(e){var t=e[l.KEYS.APP_ID],n=e[l.KEYS.RECEIVER],o=e[l.KEYS.RECEIVER_TYPE],s=e[l.KEYS.DEVICE_ID],r=e[l.KEYS.SENDER],i=e[l.KEYS.BODY],a=i[l.KEYS.ACTION],E=i[l.KEYS.USER],c=i[l.KEYS.MESSAGE_ID],u=i[l.KEYS.TIMESTAMP],p=new S(t,n,o,r,s);p.setAction(a);var C=new _.MessageReceipt;return C.setSender(new T.User(E)),C.setReceiverType(o),C.setReceiver(n),a===l.RECEIPTS.ACTION.DELIVERED&&(C.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),C.setDeliveredAt(u)),a===l.RECEIPTS.ACTION.READ&&(C.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),C.setReadAt(u)),a===l.RECEIPTS.ACTION.READ_BY_ALL&&(C.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.READ_BY_ALL_RECEIPT),C.setReadAt(u)),a===l.RECEIPTS.ACTION.DELIVERED_TO_ALL&&(C.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.DELIVERY_TO_ALL_RECEIPT),C.setDeliveredAt(u)),C.setMessageId(c.toString()),C.setTimestamp(u),p.setMessageReceipt(C),p},S}(r.CometChatEvent);t.CometChatReceiptEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatTransientEvent=void 0;var C=n(4),r=n(8),S=n(36),l=n(3),i=function(i){function p(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(C.TRANSIENT_MESSAGE.TYPE),r}return s(p,i),p.prototype.getTransientMessage=function(){return this.transientMessage},p.prototype.setTransientMessage=function(e){this.transientMessage=e},p.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},p.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[C.KEYS.USER]=this.transientMessage.getSender(),this.transientMessage.getData()&&(t[C.KEYS.DATA]=this.transientMessage.getData()),e[C.KEYS.BODY]=t,e},p.getTransientEventFromJSON=function(e){var t=e[C.KEYS.APP_ID],n=e[C.KEYS.RECEIVER],o=e[C.KEYS.RECEIVER_TYPE],s=e[C.KEYS.DEVICE_ID],r=e[C.KEYS.SENDER],i=e[C.KEYS.BODY],a=i[C.KEYS.USER],E=i[C.KEYS.DATA],c=new p(t,n,o,r,s),u=new S.TransientMessage(n,o,E);return u.setSender(new l.User(a)),i.hasOwnProperty(C.KEYS.DATA)&&i[C.KEYS.DATA]&&u.setData(E),c.setTransientMessage(u),c},p}(r.CometChatEvent);t.CometChatTransientEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});t.__esModule=!0,t.CometChatTypingEvent=void 0;var S=n(4),r=n(8),l=n(34),_=n(3),i=function(i){function C(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(S.TYPING_INDICATOR.TYPE),r}return s(C,i),C.prototype.getAction=function(){return this.action},C.prototype.setAction=function(e){this.action=e},C.prototype.getTypingIndicator=function(){return this.typingIndicator},C.prototype.setTypingIndicator=function(e){this.typingIndicator=e},C.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},C.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[S.KEYS.ACTION]=this.action,t[S.KEYS.USER]=this.typingIndicator.getSender(),this.typingIndicator.getMetadata()&&(t[S.KEYS.METADATA]=this.typingIndicator.getMetadata()),e[S.KEYS.BODY]=t,e},C.getTypingEventFromJSON=function(e){var t=e[S.KEYS.APP_ID],n=e[S.KEYS.RECEIVER],o=e[S.KEYS.RECEIVER_TYPE],s=e[S.KEYS.DEVICE_ID],r=e[S.KEYS.SENDER],i=e[S.KEYS.BODY],a=i[S.KEYS.ACTION],E=i[S.KEYS.USER],c=i[S.KEYS.METADATA],u=new C(t,n,o,r,s);u.setAction(a);var p=new l.TypingIndicator(n,o);return p.setSender(new _.User(E)),i.hasOwnProperty(S.KEYS.METADATA)&&i[S.KEYS.METADATA]&&p.setMetadata(c),u.setTypingIndicator(p),u},C}(r.CometChatEvent);t.CometChatTypingEvent=i},function(e,t,n){"use strict";t.__esModule=!0,t.CCExtension=void 0;var o=n(0),s=function(){function e(e){this.id="",this.name="",e&&(o.isFalsy(e.id)||(this.id=e.id),o.isFalsy(e.name)||(this.name=e.name))}return e.prototype.getId=function(){return this.id},e.prototype.getName=function(){return this.name},e}();t.CCExtension=s},function(e,t,n){"use strict";t.byteLength=function(e){var t=S(e),n=t[0],o=t[1];return 3*(n+o)/4-o},t.toByteArray=function(e){for(var t,n=S(e),o=n[0],s=n[1],r=new C((c=o,u=s,3*(c+u)/4-u)),i=0,a=0<s?o-4:o,E=0;E<a;E+=4)t=p[e.charCodeAt(E)]<<18|p[e.charCodeAt(E+1)]<<12|p[e.charCodeAt(E+2)]<<6|p[e.charCodeAt(E+3)],r[i++]=t>>16&255,r[i++]=t>>8&255,r[i++]=255&t;var c,u;2===s&&(t=p[e.charCodeAt(E)]<<2|p[e.charCodeAt(E+1)]>>4,r[i++]=255&t);1===s&&(t=p[e.charCodeAt(E)]<<10|p[e.charCodeAt(E+1)]<<4|p[e.charCodeAt(E+2)]>>2,r[i++]=t>>8&255,r[i++]=255&t);return r},t.fromByteArray=function(e){for(var t,n=e.length,o=n%3,s=[],r=0,i=n-o;r<i;r+=16383)s.push(E(e,r,i<r+16383?i:r+16383));1===o?(t=e[n-1],s.push(a[t>>2]+a[t<<4&63]+"==")):2===o&&(t=(e[n-2]<<8)+e[n-1],s.push(a[t>>10]+a[t>>4&63]+a[t<<2&63]+"="));return s.join("")};for(var a=[],p=[],C="undefined"!=typeof Uint8Array?Uint8Array:Array,o="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,r=o.length;s<r;++s)a[s]=o[s],p[o.charCodeAt(s)]=s;function S(e){var t=e.length;if(0<t%4)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function E(e,t,n){for(var o,s,r=[],i=t;i<n;i+=3)o=(e[i]<<16&16711680)+(e[i+1]<<8&65280)+(255&e[i+2]),r.push(a[(s=o)>>18&63]+a[s>>12&63]+a[s>>6&63]+a[63&s]);return r.join("")}p["-".charCodeAt(0)]=62,p["_".charCodeAt(0)]=63},function(e,t){t.read=function(e,t,n,o,s){var r,i,a=8*s-o-1,E=(1<<a)-1,c=E>>1,u=-7,p=n?s-1:0,C=n?-1:1,S=e[t+p];for(p+=C,r=S&(1<<-u)-1,S>>=-u,u+=a;0<u;r=256*r+e[t+p],p+=C,u-=8);for(i=r&(1<<-u)-1,r>>=-u,u+=o;0<u;i=256*i+e[t+p],p+=C,u-=8);if(0===r)r=1-c;else{if(r===E)return i?NaN:1/0*(S?-1:1);i+=Math.pow(2,o),r-=c}return(S?-1:1)*i*Math.pow(2,r-o)},t.write=function(e,t,n,o,s,r){var i,a,E,c=8*r-s-1,u=(1<<c)-1,p=u>>1,C=23===s?Math.pow(2,-24)-Math.pow(2,-77):0,S=o?0:r-1,l=o?1:-1,_=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,i=u):(i=Math.floor(Math.log(t)/Math.LN2),t*(E=Math.pow(2,-i))<1&&(i--,E*=2),2<=(t+=1<=i+p?C/E:C*Math.pow(2,1-p))*E&&(i++,E/=2),u<=i+p?(a=0,i=u):1<=i+p?(a=(t*E-1)*Math.pow(2,s),i+=p):(a=t*Math.pow(2,p-1)*Math.pow(2,s),i=0));8<=s;e[n+S]=255&a,S+=l,a/=256,s-=8);for(i=i<<s|a,c+=s;0<c;e[n+S]=255&i,S+=l,i/=256,c-=8);e[n+S-l]|=128*_}},function(e,t){var n={}.toString;e.exports=Array.isArray||function(e){return"[object Array]"==n.call(e)}},function(e,l,_){"use strict";(function(t,n){var s=this&&this.__assign||function(){return(s=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},a=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};l.__esModule=!0,l.PostDetails=void 0;var E=_(6),c=_(1),r=_(31),u=_(5),p=_(17),e=p.Dimensions.get("screen"),C=e.width,S=e.height,o=function(){function e(){var t=this;this.platform="react-native",this.uiKitSDK={version:""},this.callSDK={version:""},this.getSDKVersion(),r.KeyStore.getInstance().get(c.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){e&&(t.deviceId=e)}),setTimeout(function(){t.postDetails()},5e3)}return e.prototype.getSDKVersion=function(){t.CometChatUiKit&&(this.uiKitSDK=t.CometChatUiKit),t.CometChatCallSDK&&(this.callSDK=t.CometChatCallSDK)},e.prototype.toBase64=function(t){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,n.from(t).toString("base64")]})})},e.prototype.customEncode=function(t){return i(this,void 0,void 0,function(){return a(this,function(e){return[2,t.split("").map(function(e){return String.fromCharCode(e.charCodeAt(0)+1)}).join("")]})})},e.prototype.getSessionIdHash=function(){var s,r;return i(this,void 0,void 0,function(){var t,n,o;return a(this,function(e){switch(e.label){case 0:return t=""+c.SDKHeader.sdkVersion+(null!==(s=this.callSDK.version)&&void 0!==s?s:null)+(null!==(r=this.uiKitSDK.version)&&void 0!==r?r:null)+(null!==__DEV__&&void 0!==__DEV__&&__DEV__)+p.Platform.Version+(E.CometChat.demoMetaInfo?E.CometChat.demoMetaInfo.version:null),[4,this.toBase64(t)];case 1:return n=e.sent(),o=this.customEncode(n),[2,o.then(function(e){return e.replace(/[^a-zA-Z0-9]/g,"")})]}})})},e.prototype.getStoredSessionIdHash=function(){return i(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,r.KeyStore.getInstance().get(c.LOCAL_STORE.KEY_SESSION_ID)];case 1:return[2,e.sent()]}})})},e.prototype.getLocale=function(){var e,t,n,o,s,r,i,a,E,c,u;return"ios"===p.Platform.OS?(null===(t=null===(e=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.SettingsManager)||void 0===e?void 0:e.settings)||void 0===t?void 0:t.AppleLocale)||(null===(o=null===(n=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.SettingsManager)||void 0===n?void 0:n.settings)||void 0===o?void 0:o.AppleLanguages)&&(null===(r=null===(s=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.SettingsManager)||void 0===s?void 0:s.settings)||void 0===r?void 0:r.AppleLanguages[0])||(null===(a=null===(i=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.SettingsManager)||void 0===i?void 0:i.settings)||void 0===a?void 0:a.NSLanguages)&&(null===(c=null===(E=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.SettingsManager)||void 0===E?void 0:E.settings)||void 0===c?void 0:c.NSLanguages[0]):null===(u=null===p.NativeModules||void 0===p.NativeModules?void 0:p.NativeModules.I18nManager)||void 0===u?void 0:u.localeIdentifier},e.prototype.getTimeZone=function(){var e=(new Date).getTimezoneOffset(),t=Math.floor(Math.abs(e)/60),n=Math.abs(e)%60;return(0<e?"-":"+")+(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)},e.prototype.postDetails=function(){return i(this,void 0,void 0,function(){var t,n,o=this;return a(this,function(e){switch(e.label){case 0:return[4,this.getSessionIdHash()];case 1:return t=e.sent(),[4,this.getStoredSessionIdHash()];case 2:return e.sent()===t||(n={sessionId:t,data:s(s({cometchat:s(s(s({},this.uiKitSDK.version?{uikit:{platform:this.platform,version:this.uiKitSDK.version}}:{}),{chatsdk:{platform:this.platform,version:c.SDKHeader.sdkVersion}}),this.callSDK.version?{callssdk:{platform:this.platform,version:this.callSDK.version}}:{})},E.CometChat.demoMetaInfo?{demo:{name:E.CometChat.demoMetaInfo.name,type:E.CometChat.demoMetaInfo.type,version:E.CometChat.demoMetaInfo.version,platform:E.CometChat.demoMetaInfo.platform}}:{}),{app:{debug:null!==__DEV__&&void 0!==__DEV__&&__DEV__},device:{id:this.deviceId,platform:this.platform,language:this.getLocale(),resolution:C+" × "+S,userAgent:window.navigator.userAgent,timezone:this.getTimeZone(),os:{version:""+p.Platform.Version,name:p.Platform.OS}}}),generatedAt:Math.ceil((new Date).valueOf()/1e3)},u.makeApiCall("userSessions",{},n).then(function(n){return i(o,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return(null===(t=null==n?void 0:n.data)||void 0===t?void 0:t.sessionId)?[4,r.KeyStore.getInstance().set(c.LOCAL_STORE.KEY_SESSION_ID,n.data.sessionId)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})})),[2]}})})},e}();l.PostDetails=o}).call(this,_(19),_(50).Buffer)},function(e,t,n){"use strict";var c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},r=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},u=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};t.__esModule=!0,t.ReactionsRequestBuilder=t.ReactionsRequest=void 0;var p=n(2),i=n(5),C=n(0),S=n(1),l=n(10),a=n(35),E=n(3),o=function(){function e(e){this.limit=S.DEFAULT_VALUES.REACTIONS_LIMIT,this.msgId=S.DEFAULT_VALUES.DEFAULT_MSG_ID,this.params={},this.inProgress=!1,this.paginationMeta={},this.endpointName="getReactionsList",e.reaction&&(this.reaction=e.reaction),e.limit&&(this.limit=e.limit),this.msgId=e.msgId}return e.prototype.getLimit=function(){return this.limit},e.prototype.getMessageId=function(){return this.msgId},e.prototype.getReaction=function(){return this.reaction},e.prototype.fetchNext=function(){var e=this;return new Promise(function(a,E){return r(e,void 0,void 0,function(){var t,n,o,s,r,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,E(new p.CometChatException(l.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((r={limit:this.limit})[S.MessageConstatnts.PAGINATION.KEYS.AFFIX]=S.MessageConstatnts.PAGINATION.AFFIX.APPEND,r),null!==(i=this.nextPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return o=e.sent(),this.inProgress=!1,E(new p.CometChatException(o)),[3,4];case 4:return[3,6];case 5:return s=e.sent(),this.inProgress=!1,E(new p.CometChatException(s)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(a,E){return r(e,void 0,void 0,function(){var t,n,o,s,r,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return E(new p.CometChatException(l.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((r={limit:this.limit})[S.MessageConstatnts.PAGINATION.KEYS.AFFIX]=S.MessageConstatnts.PAGINATION.AFFIX.PREPEND,r),null!==(i=this.previousPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return o=e.sent(),this.inProgress=!1,E(new p.CometChatException(o)),[3,4];case 4:return[3,6];case 5:return s=e.sent(),this.inProgress=!1,E(new p.CometChatException(s)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(n){var s=this;return new Promise(function(o,t){try{var e=s.limit;if(void 0===e)return void t(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(e))return void t(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(e>S.DEFAULT_VALUES.REACTIONS_MAX_LIMIT)return void t(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",S.DEFAULT_VALUES.REACTIONS_MAX_LIMIT))));if(e<S.DEFAULT_VALUES.ZERO)return void t(new p.CometChatException(JSON.parse(C.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));s.createEndpoint(),i.makeApiCall(s.endpointName,s.params,n).then(function(n){return r(s,void 0,void 0,function(){var t;return u(this,function(e){return this.paginationMeta=n.meta,n.meta&&n.meta.next&&(this.nextPage=n.meta.next),n.meta&&n.meta.previous&&(this.previousPage=n.meta.previous),t=[],0<n.data.length&&n.data.map(function(e){t.push(new a.Reaction(e.id,e.messageId,e.reaction,e.uid,e.reactedAt,new E.User(e.reactedBy)))}),o(t),[2]})})},function(e){t(new p.CometChatException(e.error))})}catch(e){t(new p.CometChatException(e))}})},e.prototype.createEndpoint=function(){C.isFalsy(this.reaction)?(this.endpointName="getReactionsList",this.params={messageId:this.msgId}):(this.endpointName="getFilteredReactionsList",this.params={messageId:this.msgId,reaction:this.reaction})},e}();t.ReactionsRequest=o;var s=function(){function e(){this.msgId=S.DEFAULT_VALUES.DEFAULT_MSG_ID}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=S.DEFAULT_VALUES.DEFAULT_MSG_ID),this.msgId=e,this},e.prototype.setReaction=function(e){return this.reaction=e,this},e.prototype.build=function(){return new o(this)},e}();t.ReactionsRequestBuilder=s},function(e,t,n){"use strict";t.__esModule=!0,t.ConversationUpdateSettings=void 0;var r=n(1),o=function(){function s(){this.callActivities=!0,this.groupActions=!0,this.customMessages=!0,this.messageReplies=!0}return s.prototype.shouldUpdateOnCallActivities=function(){return this.callActivities},s.prototype.setCallActivities=function(e){this.callActivities=e},s.prototype.shouldUpdateOnGroupActions=function(){return this.groupActions},s.prototype.setGroupActions=function(e){this.groupActions=e},s.prototype.shouldUpdateOnCustomMessages=function(){return this.customMessages},s.prototype.setCustomMessages=function(e){this.customMessages=e},s.prototype.shouldUpdateOnMessageReplies=function(){return this.messageReplies},s.prototype.setMessageReplies=function(e){this.messageReplies=e},s.fromJSON=function(e){var t,n=new s,o=null!==(t=e[r.APP_SETTINGS.KEYS.PARAMETERS])&&void 0!==t?t:{};return n.setCallActivities(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES]),n.setGroupActions(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS]),n.setCustomMessages(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES]),n.setMessageReplies(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES]),n},s}();t.ConversationUpdateSettings=o},function(e,t,n){var i=n(85),a=n(86);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var r=0;r<16;++r)t[o+r]=s[r];return t||a(s)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var s=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}},function(e,t){for(var s=[],n=0;n<256;++n)s[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,o=s;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},function(e,t,n){"use strict";t.__esModule=!0,t.CometChatNotifications=void 0;var u=n(1),p=n(0),C=n(2),S=n(5),l=n(13),o=n(51),_=n(88),s=n(89),T=n(90),d=n(91),h=n(92),R=n(93),r=n(94),i=function(){function E(){}return E.fetchPushPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_GET_PREFERENCES,{},null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=R.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new R.PushPreferences)},function(e){return t(new C.CometChatException(e.error))})},function(e){return t(new C.CometChatException(e))})}catch(e){return t(new C.CometChatException(e))}})},E.fetchPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_GET_PREFERENCES,{},null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new d.NotificationPreferences)},function(e){return t(new C.CometChatException(e.error))})},function(e){return t(new C.CometChatException(e))})}catch(e){return t(new C.CometChatException(e))}})},E.updatePushPreferences=function(c){return new Promise(function(a,E){try{p.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_GROUP_PREFERENCES]={},t[l.APIConstants.KEY_MUTE_PREFERENCES]={},t[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),o=c.getGroupPreferences(),s=c.getMutePreferences(),r=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();o&&(o.getMessagesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MESSAGES]=o.getMessagesPreference()),o.getReactionsPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REACTIONS]=o.getReactionsPreference()),o.getRepliesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REPLIES]=o.getRepliesPreference()),o.getMemberAddedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_ADDED]=o.getMemberAddedPreference()),o.getMemberBannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_BANNED]=o.getMemberBannedPreference()),o.getMemberJoinedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_JOINED]=o.getMemberJoinedPreference()),o.getMemberKickedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_KICKED]=o.getMemberKickedPreference()),o.getMemberLeftPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_LEFT]=o.getMemberLeftPreference()),o.getMemberScopeChangedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=o.getMemberScopeChangedPreference()),o.getMemberUnbannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=o.getMemberUnbannedPreference())),s&&(s.getDNDPreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_DND]=s.getDNDPreference()),s.getSchedulePreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_SCHEDULE]=s.getSchedulePreference())),r&&(r.getMessagesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REPLIES]=r.getRepliesPreference())),null!=i&&(n[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[l.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[l.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],S.makeApiCall(l.APIConstants.KEY_UPDATE_PREFERENCES,{},n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=R.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return a(r)}return a(new R.PushPreferences)},function(e){return E(new C.CometChatException(e.error))})},function(e){return E(new C.CometChatException(e))})}catch(e){return E(new C.CometChatException(e))}})},E.updatePreferences=function(c){return new Promise(function(a,E){try{p.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_GROUP_PREFERENCES]={},t[l.APIConstants.KEY_MUTE_PREFERENCES]={},t[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),o=c.getGroupPreferences(),s=c.getMutePreferences(),r=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();o&&(o.getMessagesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MESSAGES]=o.getMessagesPreference()),o.getReactionsPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REACTIONS]=o.getReactionsPreference()),o.getRepliesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REPLIES]=o.getRepliesPreference()),o.getMemberAddedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_ADDED]=o.getMemberAddedPreference()),o.getMemberBannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_BANNED]=o.getMemberBannedPreference()),o.getMemberJoinedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_JOINED]=o.getMemberJoinedPreference()),o.getMemberKickedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_KICKED]=o.getMemberKickedPreference()),o.getMemberLeftPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_LEFT]=o.getMemberLeftPreference()),o.getMemberScopeChangedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=o.getMemberScopeChangedPreference()),o.getMemberUnbannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=o.getMemberUnbannedPreference())),s&&(s.getDNDPreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_DND]=s.getDNDPreference()),s.getSchedulePreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_SCHEDULE]=s.getSchedulePreference())),r&&(r.getMessagesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REPLIES]=r.getRepliesPreference())),null!=i&&(n[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[l.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[l.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],S.makeApiCall(l.APIConstants.KEY_UPDATE_PREFERENCES,{},n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return a(r)}return a(new d.NotificationPreferences)},function(e){return E(new C.CometChatException(e.error))})},function(e){return E(new C.CometChatException(e))})}catch(e){return E(new C.CometChatException(e))}})},E.resetPushPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_RESET_PREFERENCES,{},null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=R.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new R.PushPreferences)},function(e){return t(new C.CometChatException(e.error))})},function(e){return t(new C.CometChatException(e))})}catch(e){return t(new C.CometChatException(e))}})},E.resetPreferences=function(){return new Promise(function(i,t){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_RESET_PREFERENCES,{},null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?h.OneOnOnePreferences.fromJSON(e.data):new h.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new d.NotificationPreferences)},function(e){return t(new C.CometChatException(e.error))})},function(e){return t(new C.CometChatException(e))})}catch(e){return t(new C.CometChatException(e))}})},E.getTokensForRequest=function(e,t,n,o){var s={};return s[l.APIConstants.KEY_PROVIDER_ID]=null!=o?o:l.DEFAULT_PROVIDER_ID,s[l.APIConstants.KEY_TIMEZONE]=e,n===l.PushPlatforms.FCM_REACT_NATIVE_ANDROID&&(s[l.APIConstants.KEY_FCM_TOKEN]=t),n===l.PushPlatforms.FCM_REACT_NATIVE_IOS&&(s[l.APIConstants.KEY_FCM_TOKEN]=t),n===l.PushPlatforms.APNS_REACT_NATIVE_DEVICE&&(s[l.APIConstants.KEY_DEVICE_TOKEN]=t),n===l.PushPlatforms.APNS_REACT_NATIVE_VOIP&&(s[l.APIConstants.KEY_VOIP_TOKEN]=t),s[l.APIConstants.KEY_PLATFORM]=n,s},E.registerPushToken=function(r,i,a){return new Promise(function(o,s){try{p.getAppSettings().then(function(e){var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=E.getTokensForRequest(t,r,i,a);S.makeApiCall(l.APIConstants.KEY_REGISTER_TOKEN,{},n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.TOKEN_REGISTER_SUCCESS):o(l.APIResponseConstants.TOKEN_REGISTER_ERROR)},function(e){return s(new C.CometChatException(e.error))})},function(e){return s(new C.CometChatException(e))})}catch(e){return s(new C.CometChatException(e))}})},E.unregisterPushToken=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_UNREGISTER_TOKEN,{},null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(l.APIResponseConstants.TOKEN_UNREGISTER_SUCCESS):t(l.APIResponseConstants.TOKEN_UNREGISTER_ERROR)},function(e){return n(new C.CometChatException(e.error))})},function(e){return n(new C.CometChatException(e))})}catch(e){return n(new C.CometChatException(e))}})},E.muteConversations=function(r){return new Promise(function(o,s){try{p.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_CONVERSATIONS]=r,t);S.makeApiCall(l.APIConstants.KEY_MUTE_CONVERSATIONS,{},n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.MUTE_CONVERSATION_SUCCESS):o(l.APIResponseConstants.MUTE_CONVERSATION_ERROR)},function(e){return s(new C.CometChatException(e.error))})},function(e){return s(new C.CometChatException(e))})}catch(e){return s(new C.CometChatException(e))}})},E.unmuteConversations=function(r){return new Promise(function(o,s){try{p.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_CONVERSATIONS]=r,t);S.makeApiCall(l.APIConstants.KEY_UNMUTE_CONVERSATIONS,{},n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.UNMUTE_CONVERSATION_SUCCESS):o(l.APIResponseConstants.UNMUTE_CONVERSATION_ERROR)},function(e){return s(new C.CometChatException(e.error))})},function(e){return s(new C.CometChatException(e))})}catch(e){return s(new C.CometChatException(e))}})},E.getMutedConversations=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_GET_MUTED_CONVERSATIONS,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){var n=[];return e.hasOwnProperty("data")&&e.data.hasOwnProperty(l.APIConstants.KEY_MUTED_CONVERSATIONS)&&e.data[l.APIConstants.KEY_MUTED_CONVERSATIONS].forEach(function(e){var t=new s.MutedConversation;t.setId(e.id),t.setType(e.type),t.setUntil(e.until),n.push(t)}),t(n)},function(e){return n(new C.CometChatException(e.error))})},function(e){return n(new C.CometChatException(e))})}catch(e){return n(new C.CometChatException(e))}})},E.updateTimezone=function(o){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_UPDATE_TIMEZONE,null,{timezone:o},!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(l.APIResponseConstants.TIMEZONE_UPDATE_SUCCESS):t(l.APIResponseConstants.TIMEZONE_UPDATE_ERROR)},function(e){return n(new C.CometChatException(e.error))})},function(e){return n(new C.CometChatException(e))})}catch(e){return n(new C.CometChatException(e))}})},E.getTimezone=function(){return new Promise(function(t,n){try{p.getAppSettings().then(function(e){S.makeApiCall(l.APIConstants.KEY_GET_TIMEZONE,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(e.data):t(l.APIResponseConstants.TIMEZONE_FETCH_ERROR)},function(e){return n(new C.CometChatException(e.error))})},function(e){return n(new C.CometChatException(e))})}catch(e){return n(new C.CometChatException(e))}})},E.MessagesOptions=l.MessagesOptions,E.RepliesOptions=l.RepliesOptions,E.ReactionsOptions=l.ReactionsOptions,E.MemberActionsOptions=l.MemberActionsOptions,E.DayOfWeek=l.DayOfWeek,E.DNDOptions=l.DNDOptions,E.MutedConversationType=l.MutedConversationType,E.PushPlatforms=l.PushPlatforms,E.DaySchedule=o.DaySchedule,E.PushPreferences=R.PushPreferences,E.GroupPreferences=_.GroupPreferences,E.OneOnOnePreferences=h.OneOnOnePreferences,E.MutePreferences=T.MutePreferences,E.MutedConversation=s.MutedConversation,E.UnmutedConversation=r.UnmutedConversation,E.NotificationPreferences=d.NotificationPreferences,E}();t.CometChatNotifications=i},function(e,t,n){"use strict";t.__esModule=!0,t.GroupPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getMessagesPreference=function(){return this.groupMessages},n.prototype.getRepliesPreference=function(){return this.groupReplies},n.prototype.getReactionsPreference=function(){return this.groupReactions},n.prototype.getMemberLeftPreference=function(){return this.groupMemberLeft},n.prototype.getMemberAddedPreference=function(){return this.groupMemberAdded},n.prototype.getMemberJoinedPreference=function(){return this.groupMemberJoined},n.prototype.getMemberKickedPreference=function(){return this.groupMemberKicked},n.prototype.getMemberBannedPreference=function(){return this.groupMemberBanned},n.prototype.getMemberUnbannedPreference=function(){return this.groupMemberUnbanned},n.prototype.getMemberScopeChangedPreference=function(){return this.groupMemberScopeChanged},n.prototype.setMessagesPreference=function(e){this.groupMessages=e},n.prototype.setRepliesPreference=function(e){this.groupReplies=e},n.prototype.setReactionsPreference=function(e){this.groupReactions=e},n.prototype.setMemberLeftPreference=function(e){this.groupMemberLeft=e},n.prototype.setMemberAddedPreference=function(e){this.groupMemberAdded=e},n.prototype.setMemberJoinedPreference=function(e){this.groupMemberJoined=e},n.prototype.setMemberKickedPreference=function(e){this.groupMemberKicked=e},n.prototype.setMemberBannedPreference=function(e){this.groupMemberBanned=e},n.prototype.setMemberUnbannedPreference=function(e){this.groupMemberUnbanned=e},n.prototype.setMemberScopeChangedPreference=function(e){this.groupMemberScopeChanged=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(o.MessagesOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MESSAGES]]),t.setRepliesPreference(o.RepliesOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REPLIES]]),t.setReactionsPreference(o.ReactionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REACTIONS]]),t.setMemberAddedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_ADDED]]),t.setMemberJoinedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_JOINED]]),t.setMemberBannedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_BANNED]]),t.setMemberKickedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_KICKED]]),t.setMemberLeftPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_LEFT]]),t.setMemberScopeChangedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]]),t.setMemberUnbannedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_UNBANNED]]),t},n}();t.GroupPreferences=s},function(e,t,n){"use strict";t.__esModule=!0,t.MutedConversation=void 0;var o=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getUntil=function(){return this.until},e.prototype.setUntil=function(e){this.until=e},e}();t.MutedConversation=o},function(e,t,n){"use strict";t.__esModule=!0,t.MutePreferences=void 0;var p=n(13),C=n(51),o=function(){function u(){}return u.prototype.getDNDPreference=function(){return this.dnd},u.prototype.setDNDPreference=function(e){this.dnd=e},u.prototype.getSchedulePreference=function(){return this.schedule},u.prototype.setSchedulePreference=function(e){this.schedule=e},u.prototype.getScheduleFor=function(e){return this.schedule.get(e)},u.prototype.setScheduleFor=function(e,t){this.schedule.set(e,t)},u.fromJSON=function(e){var t=new u;t.setDNDPreference(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_DND]);var n=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.MONDAY][p.APIConstants.KEY_MUTE_DND]),o=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.TUESDAY][p.APIConstants.KEY_MUTE_DND]),s=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.WEDNESDAY][p.APIConstants.KEY_MUTE_DND]),r=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.THURSDAY][p.APIConstants.KEY_MUTE_DND]),i=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.FRIDAY][p.APIConstants.KEY_MUTE_DND]),a=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SATURDAY][p.APIConstants.KEY_MUTE_DND]),E=new C.DaySchedule(e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_FROM],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_TO],e[p.APIConstants.KEY_MUTE_PREFERENCES][p.APIConstants.KEY_MUTE_SCHEDULE][p.DayOfWeek.SUNDAY][p.APIConstants.KEY_MUTE_DND]),c=new Map([[p.DayOfWeek.MONDAY,n],[p.DayOfWeek.TUESDAY,o],[p.DayOfWeek.WEDNESDAY,s],[p.DayOfWeek.THURSDAY,r],[p.DayOfWeek.FRIDAY,i],[p.DayOfWeek.SATURDAY,a],[p.DayOfWeek.SUNDAY,E]]);return t.setSchedulePreference(c),t},u}();t.MutePreferences=o},function(e,t,n){"use strict";t.__esModule=!0,t.NotificationPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[o.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[o.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.NotificationPreferences=s},function(e,t,n){"use strict";t.__esModule=!0,t.OneOnOnePreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getReactionsPreference=function(){return this.oneOnOneMessageReactions},n.prototype.setReactionsPreference=function(e){this.oneOnOneMessageReactions=e},n.prototype.getRepliesPreference=function(){return this.oneOnOneReplies},n.prototype.setRepliesPreference=function(e){this.oneOnOneReplies=e},n.prototype.getMessagesPreference=function(){return this.oneOnOneMessages},n.prototype.setMessagesPreference=function(e){this.oneOnOneMessages=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(o.MessagesOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_MESSAGES]]),t.setRepliesPreference(o.RepliesOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REPLIES]]),t.setReactionsPreference(o.ReactionsOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REACTIONS]]),t},n}();t.OneOnOnePreferences=s},function(e,t,n){"use strict";t.__esModule=!0,t.PushPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[o.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[o.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.PushPreferences=s},function(e,t,n){"use strict";t.__esModule=!0,t.UnmutedConversation=void 0;var o=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e}();t.UnmutedConversation=o}])}),function(){try{require("@cometchat/calls-sdk-react-native")&&(this.CometChatCallSDK=require("@cometchat/calls-sdk-react-native/package.json"),this.CometChatCalling={},this.CometChatCalling.isCallingComponentInstalled=!0,this.CometChatCalling.CallScreen=require("@cometchat/calls-sdk-react-native").default,this.CometChatCalling.CometChatRTC=require("@cometchat/calls-sdk-react-native").CometChatRTC,this.CometChatCalling.CometChatCalls=require("@cometchat/calls-sdk-react-native").CometChatCalls,this.CometChatCalling.CallEventListener=require("@cometchat/calls-sdk-react-native").CallEventListener)}catch(e){}try{require("@cometchat/chat-uikit-react-native")&&(this.CometChatUiKit=require("@cometchat/chat-uikit-react-native/package.json"))}catch(e){}}();