UNPKG

@cometchat-pro/react-native-chat

Version:
1 lines 308 kB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e(require("@react-native-async-storage/async-storage"),require("react"),require("react-native"));else if("function"==typeof define&&define.amd)define(["@react-native-async-storage/async-storage","react","react-native"],e);else{var n="object"==typeof exports?e(require("@react-native-async-storage/async-storage"),require("react"),require("react-native")):e(t["@react-native-async-storage/async-storage"],t.react,t["react-native"]);for(var s in n)("object"==typeof exports?exports:t)[s]=n[s]}}(window,function(n,s,o){return function(n){var s={};function o(t){if(s[t])return s[t].exports;var e=s[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,o),e.l=!0,e.exports}return o.m=n,o.c=s,o.d=function(t,e,n){o.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},o.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},o.t=function(e,t){if(1&t&&(e=o(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)o.d(n,s,function(t){return e[t]}.bind(null,s));return n},o.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return o.d(e,"a",e),e},o.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},o.p="",o(o.s=39)}([function(t,W,r){"use strict";(function(K){W.__esModule=!0,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 s=r(14),B=r(1),t=r(6),F=r(2),i=r(17),a=r(18),E=r(20),x=r(5),e=r(13),b=r(31),V=r(41),J=r(15);function H(t){return null!=t&&("string"==typeof t&&(t=t.trim()),"object"==typeof t&&0===Object.keys(t).length&&(t=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(t)}function c(t){for(var s=[],e=1;e<arguments.length;e++)s[e-1]=arguments[e];return t.split("%s").reduce(function(t,e,n){return t+e+(s[n]||"")},"")}W.getChatHost=function(t){return t[B.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?t[B.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:t[B.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?t[B.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:t[B.APP_SETTINGS.KEYS.CHAT_HOST]},W.getJidHost=function(t){return t[B.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?t[B.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:t[B.APP_SETTINGS.KEYS.CHAT_HOST]},W.isObject=function(t){return t instanceof Object&&t.constructor===Object},W.isTruthy=function(t){return[!0,1,"1","true","TRUE"].includes(t)},W.isFalsy=H,W.getOrdinalSuffix=function(t){var e=t%10,n=t%100;return 1==e&&11!=n?t+"st":2==e&&12!=n?t+"nd":3==e&&13!=n?t+"rd":t+"th"},W.format=c,W.createUidFromJid=function(t){return t.substring(t.lastIndexOf("]")+1,t.lastIndexOf("@"))};var n=function(){function t(){}return t.log=function(t,e){},t.error=function(t,e){},t.info=function(t,e){},t}();function k(){return new Promise(function(e,n){s.LocalStorage.getInstance().get(B.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){H(t)?o().then(function(t){e(t)},function(t){n(t)}):e(t)},function(t){n(t)})})}function o(){return new Promise(function(e,n){t.makeApiCall("appSettings").then(function(t){s.LocalStorage.getInstance().set(B.LOCAL_STORE.KEY_APP_SETTINGS,t.data),t.data.MODE&&x.CometChat.setMode(t.data.MODE),e(t.data)},function(t){n(new F.CometChatException(t.error))})})}W.Logger=n,W.getCurrentTime=function(){return(new Date).getTime()},W.getAppSettings=k,W.getUpdatedSettings=o,W.isImage=function(t){var e;return t.type&&t.type.toLowerCase().includes("image")&&(e=!0),e},W.isVideo=function(t){var e;return t.type&&t.type.toLowerCase().includes("video")&&(e=!0),e},W.isAudio=function(t){var e;return t.type&&t.type.toLowerCase().includes("audio")&&(e=!0),e},W.validateScope=function(t){return typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):H(t)?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):t!=x.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&t!=x.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&t!=x.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new F.CometChatException(B.GroupErrors.INVALID_SCOPE):void 0},W.validateUpdateGroup=function(t){return t.hasOwnProperty(B.GroupConstants.KEYS.GUID)?typeof t[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):H(t[B.GroupConstants.KEYS.GUID])?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):t.hasOwnProperty(B.GroupConstants.KEYS.NAME)&&""===t[B.GroupConstants.KEYS.NAME]?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},W.validateJoinGroup=function(t,e,n){if(typeof t==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!t.hasOwnProperty(B.GroupConstants.KEYS.GUID))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(H(t[B.GroupConstants.KEYS.GUID]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(B.GroupConstants.KEYS.TYPE))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[B.GroupConstants.KEYS.TYPE]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(H(t[B.GroupConstants.KEYS.TYPE]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PUBLIC&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PASSWORD&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PROTECTED&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(t[B.GroupConstants.KEYS.TYPE].toLowerCase()==x.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(B.GroupConstants.KEYS.PASSWORD))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[B.GroupConstants.KEYS.PASSWORD]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(H(t[B.GroupConstants.KEYS.PASSWORD]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==t){if(typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(H(t))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==e){if(typeof e!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(H(e))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e.toLowerCase()!=x.CometChat.GROUP_TYPE.PUBLIC&&e.toLowerCase()!=x.CometChat.GROUP_TYPE.PASSWORD&&e.toLowerCase()!=x.CometChat.GROUP_TYPE.PROTECTED&&e.toLowerCase()!=x.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(e.toLowerCase()==x.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(H(n))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},W.validateCreateGroup=function(t){if(!t.hasOwnProperty(B.GroupConstants.KEYS.GUID))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[B.GroupConstants.KEYS.GUID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(H(t[B.GroupConstants.KEYS.GUID]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(B.GroupConstants.KEYS.NAME))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof t[B.GroupConstants.KEYS.NAME]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(H(t[B.GroupConstants.KEYS.NAME]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!t.hasOwnProperty(B.GroupConstants.KEYS.TYPE))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[B.GroupConstants.KEYS.TYPE]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(H(t[B.GroupConstants.KEYS.TYPE]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PUBLIC&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PASSWORD&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PROTECTED&&t[B.GroupConstants.KEYS.TYPE].toLowerCase()!=x.CometChat.GROUP_TYPE.PRIVATE)return new F.CometChatException(B.GroupErrors.INVALID_GROUP_TYPE);if(t[B.GroupConstants.KEYS.TYPE].toLowerCase()==x.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(B.GroupConstants.KEYS.PASSWORD))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[B.GroupConstants.KEYS.PASSWORD]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(H(t[B.GroupConstants.KEYS.PASSWORD]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(t.hasOwnProperty(B.GroupConstants.KEYS.TAGS)){if(!Array.isArray(t[B.GroupConstants.KEYS.TAGS]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===t[B.GroupConstants.KEYS.TAGS].length)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},W.validateId=function(t,e){if("user"===e){if(typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(H(t))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===e){if(typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(H(t))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}},W.validateHideMessagesFromBlockedUsers=function(t){if(typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},W.validateArray=function(t,e){var n="List should be an array.";return n="blockUsers"===e?"blockUsers() method accepts an array of users.":"unblockUsers"===e?"unblockUsers() method accepts an array of users.":"groupMembers"===e?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof t!=B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(t)?void 0:new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},W.validateMsgId=function(t){return isNaN(t)?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):H(t)?new F.CometChatException(e.ERRORS.PARAMETER_MISSING):void 0},W.validateChatType=function(t){return typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):H(t)?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):t!=B.MessageConstatnts.RECEIVER_TYPE.GROUP&&t!=B.MessageConstatnts.RECEIVER_TYPE.USER?new F.CometChatException(B.MessageErrors.INVALID_RECEIVER_TYPE):void 0},W.validateMessage=function(t){var e=t;if(typeof e.getReceiverId()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(H(e.getReceiverId()))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof e.getReceiverType()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(H(e.getReceiverType()))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(e.getReceiverType()!=B.MessageConstatnts.RECEIVER_TYPE.GROUP&&e.getReceiverType()!=B.MessageConstatnts.RECEIVER_TYPE.USER)return new F.CometChatException(B.MessageErrors.INVALID_RECEIVER_TYPE);if(t instanceof i.TextMessage){var n=t;if(typeof n.getText()!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(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(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(t instanceof a.MediaMessage){var s=t;if(s.getData()&&s.getData().hasOwnProperty("attachments"))for(var o=s.getAttachments(),r=0;r<o.length;r++){if(!o[r].getExtension())return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!o[r].getMimeType())return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!o[r].getName())return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!o[r].getUrl())return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(s.hasOwnProperty("files"))for(r=0;r<s.files.length;r++){if(typeof s.files[r]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_OBJECT),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")));if(H(s.files[r])&&!(s.files[r]instanceof Blob))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"MEDIA_OBJECT","MEDIA_OBJECT","Media object","Media object")))}}if(t instanceof E.CustomMessage&&H(t.getCustomData()))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")))},W.validateCreateUser=function(t){if(!t.hasOwnProperty(B.UserConstants.UID))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof t[B.UserConstants.UID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(H(t[B.UserConstants.UID]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!t.hasOwnProperty(B.UserConstants.NAME))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof t[B.UserConstants.NAME]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(H(t[B.UserConstants.NAME]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(t.hasOwnProperty(B.UserConstants.AVATAR)&&""===t[B.UserConstants.AVATAR])return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(t.hasOwnProperty(B.UserConstants.META_DATA)&&""===t[B.UserConstants.META_DATA])return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(t.hasOwnProperty(B.UserConstants.LINK)&&""===t[B.UserConstants.LINK])return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(t.hasOwnProperty(B.UserConstants.STATUS_MESSAGE)&&""===t[B.UserConstants.STATUS_MESSAGE])return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(t.hasOwnProperty(B.UserConstants.ROLE)&&""===t[B.UserConstants.ROLE])return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(t.hasOwnProperty(B.UserConstants.TAGS)){if(!Array.isArray(t[B.UserConstants.TAGS]))return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===t[B.UserConstants.TAGS].length)return new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},W.validateUpdateUser=function(t){return t.hasOwnProperty(B.UserConstants.UID)?typeof t[B.UserConstants.UID]!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):H(t[B.UserConstants.UID])?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):t.hasOwnProperty(B.UserConstants.NAME)&&""===t[B.UserConstants.NAME]?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},W.validateConversationType=function(t){return typeof t!==B.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):H(t)?new F.CometChatException(JSON.parse(c(JSON.stringify(B.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(t=t.toLowerCase())!=x.CometChat.RECEIVER_TYPE.USER&&t!=x.CometChat.RECEIVER_TYPE.GROUP?new F.CometChatException(B.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},W.getKeyprefix=function(t,e){switch(t){case B.LOCAL_STORE.COMMON_STORE:return c(B.LOCAL_STORE.KEY_STRING,c(B.LOCAL_STORE.STORE_STRING,x.CometChat.getAppId(),B.LOCAL_STORE.COMMON_STORE),e);case B.LOCAL_STORE.KEYS_STORE:return c(B.LOCAL_STORE.KEY_STRING,c(B.LOCAL_STORE.STORE_STRING,x.CometChat.getAppId(),B.LOCAL_STORE.KEYS_STORE),e);case B.LOCAL_STORE.MESSAGES_STORE:return c(B.LOCAL_STORE.KEY_STRING,c(B.LOCAL_STORE.STORE_STRING,x.CometChat.getAppId(),B.LOCAL_STORE.MESSAGES_STORE),e);case B.LOCAL_STORE.MESSAGE_LISTENERS_LIST:return c(B.LOCAL_STORE.KEY_STRING,c(B.LOCAL_STORE.STORE_STRING,x.CometChat.getAppId(),B.LOCAL_STORE.MESSAGE_LISTENERS_LIST),e);case B.LOCAL_STORE.USERS_STORE:return c(B.LOCAL_STORE.KEY_STRING,c(B.LOCAL_STORE.STORE_STRING,x.CometChat.getAppId(),B.LOCAL_STORE.USERS_STORE),e)}},W.isCallingComponentInstalled=function(){return!!(K.hasOwnProperty("CometChatCalling")&&K.CometChatCalling&&K.CometChatCalling.hasOwnProperty("isCallingComponentInstalled")&&K.CometChatCalling.isCallingComponentInstalled)},W.getCallSettings=function(w){return new Promise(function(s,t){var o,r,i,a,E,c,u,S,C,p,l,T={};i=x.CometChat.getActiveCall(),E=x.CometChat.user;var d,_,g,R,A,h,I,O,N,f,m,y,L,M,P,v,U,D,Y,G=!0;k().then(function(t){if(u=t[B.APP_SETTINGS.KEYS.WEBRTC_HOST],T[B.APP_SETTINGS.KEYS.ANALYTICS_HOST]=t[B.APP_SETTINGS.KEYS.ANALYTICS_HOST],T[B.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=t[B.APP_SETTINGS.KEYS.ANALYTICS_VERSION],T[B.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=t[B.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],T[B.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=t[B.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],o=t[B.APP_SETTINGS.KEYS.REGION],w.getCallEventListener()&&J.CallController.getInstance().setCallListner(w.getCallEventListener()),W.isCallingComponentInstalled())if(S=K.CometChatCalling.CometChatCalls,C=K.CometChatCalling.CallEventListener,p=K.CometChatCalling.CallScreen,l=K.CometChatCalling.CometChatRTC,H(x.CometChat.appSettings))J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_INITIALIZED));else{if(!o)return G=!1,void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.NOT_INITIALIZED)));if(x.CometChat.getAppId()){if(r=x.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 e=i.getType();d=e===B.CallConstants.CALL_TYPE.AUDIO,_=i.getSessionId()}else{if(d=w.isAudioOnlyCall(),H(w.getSessionId()))return void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.SESSION_ID_REQUIRED)));_=("v1."+o+"."+x.CometChat.getAppId()+"."+w.getSessionId()).toLowerCase()}if(!_)return G=!1,void(J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.SESSION_ID_REQUIRED)));if(g=w.isDefaultLayoutEnabled(),R=w.isAudioModeButtonEnabled(),A=w.isPauseVideoButtonEnabled(),h=w.isMuteAudioButtonEnabled(),I=w.isSwitchCameraButtonEnabled(),O=w.isEndCallButtonEnabled(),N=w.getMode(),f=w.getStartWithAudioMuted(),m=w.getStartWithVideoMuted(),y=w.getDefaultAudioMode(),L=!!d&&w.isAudioToVideoButtonEnabled(),M=w.getAvatarMode(),P=w.isRecordingButtonEnabled(),v=w.shouldStartRecordingOnCallStart(),U=w.getMainVideoContainerSetting(),D=w.isVideoTileClickEnabled(),Y=w.isVideoTileDragEnabled(),G){var n={uid:E.getUid(),sessionId:_};x.CometChat.getInstance().getJWT(n).then(function(t){t.hasOwnProperty("token")?((c=new V.RTCUser(E.getUid())).setName(E.getName()),c.setAvatar(E.getAvatar()),c.setResource(x.CometChat.getSessionId()),c.setJWT(t.token),a=(new b.CallSettingsBuilder).setSessionID(_).enableDefaultLayout(g).setIsAudioOnlyCall(d).setUser(c).setRegion(o).setAppId(r).setDomain(u).showAudioModeButton(R).showEndCallButton(O).showMuteAudioButton(h).showPauseVideoButton(A).showSwitchCameraButton(I).setMode(N).setAnalyticsSettings(T).startWithAudioMuted(f).startWithVideoMuted(m).setDefaultAudioMode(y).showSwitchToVideoCallButton(L).setAvatarMode(M).showRecordingButton(P).startRecordingOnCallStart(v).setMainVideoContainerSetting(U).enableVideoTileClick(D).enableVideoTileDrag(Y).build(),J.CallController.getInstance().callStarted(),s({callSettingsNew:a,call:i,CometChatCalls:S,CallEventListener:C,CallScreen:p,CometChatRTC:l})):J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(B.CALL_ERROR.JWT_NOT_FOUND))},function(t){J.CallController.getInstance().getCallListner()&&J.CallController.getInstance().getCallListner()._eventListener.onError(new F.CometChatException(t))})}}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))})})}}).call(this,r(40))},function(t,e,n){"use strict";e.__esModule=!0,e.ONLINE_MEMBER_COUNT_API=e.JWT_API=e.ProsodyApiErrors=e.PROSODY_API=e.API_ERROR_CODES=e.CONNECTION_STATUS=e.COMMON_UTILITY_CONSTANTS=e.APP_SETTINGS=e.PresenceConstatnts=e.FeatureRestrictionErrors=e.MessageErrors=e.ExtensionErrors=e.ConversationErrors=e.GroupErrors=e.UserErrors=e.ReceiptErrors=e.GENERAL_ERROR=e.PARAMETER_ERROR=e.CALL_ERROR=e.Errors=e.UserConstants=e.GroupMemersConstans=e.GroupConstants=e.CallConstants=e.BlockedUsersConstants=e.ActionConstatnts=e.TYPING_NOTIFICATION=e.MessageCategory=e.ATTACHMENTS_CONSTANTS=e.MessageConstatnts=e.READ_RECEIPTS=e.DELIVERY_RECEIPTS=e.ResponseConstants=e.LOCAL_STORE=e.ANALYTICS=e.WS=e.SDKHeader=e.APPINFO=e.GROUP_MEMBER_SCOPE=e.GroupMemberScope=e.GROUP_TYPE=e.GroupType=e.DEFAULT_VALUES=e.constants=void 0;var s,o,r,i=n(2);e.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},e.DEFAULT_VALUES={ZERO:0,MSGS_LIMIT:30,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"},(s=e.GroupType||(e.GroupType={})).Public="public",s.Private="private",s.Protected="protected",s.Password="password",e.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(o=e.GroupMemberScope||(e.GroupMemberScope={})).Admin="admin",o.Moderator="moderator",o.Member="member",e.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},e.APPINFO={platform:"REACT_NATIVE",sdkVersion:"v3.0.12",apiVersion:"v3.0",sdkVersionWithUnderScore:"3_0_12",userAgent:"cc_react_native_sdk"},e.SDKHeader={platform:"react-native",sdkVersion:"3.0.12",sdk:"%s@%s"},e.WS={CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},e.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},e.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_MESSAGE_LISTENER_LIST:"all"},e.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",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_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"}}},e.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"},e.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"},e.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"},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"},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"}}},e.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(r=e.MessageCategory||(e.MessageCategory={})).ACTION="action",r.MESSAGE="message",r.CALL="call",r.CUSTOM="custom",e.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},e.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"}},e.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},e.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"}}},e.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"}},e.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},e.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"}},e.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"},e.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:{}}},e.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},e.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:{}}},e.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:{}}},e.UserErrors={INVALID_STATUS:new i.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new i.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 i.CometChatException({code:"USER_NOT_LOGGED_IN",name:"USER_NOT_LOGGED_IN",message:"Please log in to CometChat before calling this method.",details:""})},e.GroupErrors={NOT_A_GROUP:new i.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new i.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new i.CometChatException({code:"INVALID_GROUP_TYPE",name:"INVALID_GROUP_TYPE",message:"Group type can be `public`, `private`, `protected` or `password`.",details:""})},e.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."}},e.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:{}}},e.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."}},e.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:{}}},e.PresenceConstatnts={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},e.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"}},e.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},e.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"},e.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},e.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},e.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:""}},e.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},e.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:""}}}},function(t,e,n){"use strict";e.__esModule=!0,e.CometChatException=void 0;var s=function(t){null!==t.code&&void 0!==t.code&&""!==t.code&&(this.code=t.code),null!==t.name&&void 0!==t.name&&""!==t.name&&(this.name=t.name),null!==t.message&&void 0!==t.message&&""!==t.message&&(this.message=t.message),null!==t.details&&void 0!==t.details&&""!==t.details&&(this.details=t.details)};e.CometChatException=s},function(t,e,n){"use strict";var s,o=this&&this.__extends||(s=function(t,e){return(s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)},function(t,e){function n(){this.constructor=t}s(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)});e.__esModule=!0,e.Me=e.User=void 0;var r=n(2),i=n(13),a=n(1),E=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this.hasBlockedMe=!1,this.blockedByMe=!1,this.deactivatedAt=0,1===t.length)typeof t[0]===a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?this.uid=t[0]:(this.uid=t[0].uid,this.name=t[0].name,t[0].authToken&&(this.authToken=t[0].authToken),t[0].avatar&&(this.avatar=t[0].avatar),t[0].lastActiveAt&&(this.lastActiveAt=t[0].lastActiveAt),t[0].link&&(this.link=t[0].link),t[0].metadata&&(this.metadata=t[0].metadata),t[0].role&&(this.role=t[0].role),t[0].statusMessage&&(this.statusMessage=t[0].statusMessage),t[0].status&&"offline"!==t[0].status?this.status="online":this.status="offline",t[0].tags&&(this.tags=t[0].tags),t[0].deactivatedAt&&(this.deactivatedAt=t[0].deactivatedAt));else{if(2!==t.length)throw new r.CometChatException(i.ERRORS.PARAMETER_MISSING);this.uid=t[0],this.name=t[1]}}return t.prototype.getUid=function(){return this.uid.toString()},t.prototype.setUid=function(t){this.uid=t},t.prototype.getName=function(){return this.name.toString()},t.prototype.setName=function(t){t&&(this.name=t)},t.prototype.getAuthToken=function(){return this.authToken},t.prototype.setAuthToken=function(t){this.authToken=t},t.prototype.getAvatar=function(){return this.avatar},t.prototype.setAvatar=function(t){this.avatar=t},t.prototype.getLastActiveAt=function(){return this.lastActiveAt},t.prototype.setLastActiveAt=function(t){this.lastActiveAt=t},t.prototype.getLink=function(){return this.link},t.prototype.setLink=function(t){return this.link=t},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(t){this.metadata=t},t.prototype.getRole=function(){return this.role},t.prototype.setRole=function(t){this.role=t},t.prototype.getStatus=function(){return this.status},t.prototype.setStatus=function(t){this.status=t},t.prototype.getStatusMessage=function(){return this.statu