UNPKG

@cometchat-pro/chat

Version:
1 lines 344 kB
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var n=e();for(var o in n)("object"==typeof exports?exports:t)[o]=n[o]}}(window,function(){return function(n){var o={};function s(t){if(o[t])return o[t].exports;var e=o[t]={i:t,l:!1,exports:{}};return n[t].call(e.exports,e,e.exports,s),e.l=!0,e.exports}return s.m=n,s.c=o,s.d=function(t,e,n){s.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},s.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},s.t=function(e,t){if(1&t&&(e=s(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)s.d(n,o,function(t){return e[t]}.bind(null,o));return n},s.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return s.d(e,"a",e),e},s.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s.p="",s(s.s=38)}([function(t,e,n){"use strict";e.__esModule=!0,e.validateConversationType=e.validateUpdateUser=e.validateCreateUser=e.validateMessage=e.validateChatType=e.validateMsgId=e.validateArray=e.validateHideMessagesFromBlockedUsers=e.validateId=e.validateCreateGroup=e.validateJoinGroup=e.validateUpdateGroup=e.validateScope=e.isAudio=e.isVideo=e.isImage=e.getUpdatedSettings=e.getAppSettings=e.getCurrentTime=e.Logger=e.createUidFromJid=e.format=e.getOrdinalSuffix=e.isFalsy=e.isTruthy=e.isObject=e.getJidHost=e.getChatHost=void 0;var o=n(14),i=n(1),s=n(6),a=n(2),E=n(16),c=n(17),u=n(19),r=n(3),S=n(13);function l(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 p(t){for(var o=[],e=1;e<arguments.length;e++)o[e-1]=arguments[e];return t.split("%s").reduce(function(t,e,n){return t+e+(o[n]||"")},"")}e.getChatHost=function(t){return t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?t[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},e.getJidHost=function(t){return t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?t[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:t[i.APP_SETTINGS.KEYS.CHAT_HOST]},e.isObject=function(t){return t instanceof Object&&t.constructor===Object},e.isTruthy=function(t){return[!0,1,"1","true","TRUE"].includes(t)},e.isFalsy=l,e.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"},e.format=p,e.createUidFromJid=function(t){return t.substring(t.lastIndexOf("]")+1,t.lastIndexOf("@"))};var C=function(){function t(){}return t.log=function(t,e){},t.error=function(t,e){},t.info=function(t,e){},t}();function T(){return new Promise(function(e,n){s.makeApiCall("appSettings").then(function(t){o.LocalStorage.getInstance().set(i.LOCAL_STORE.KEY_APP_SETTINGS,t.data),t.data.MODE&&r.CometChat.setMode(t.data.MODE),e(t.data)},function(t){n(new a.CometChatException(t.error))})})}e.Logger=C,e.getCurrentTime=function(){return(new Date).getTime()},e.getAppSettings=function(){return new Promise(function(e,n){o.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){l(t)?T().then(function(t){e(t)},function(t){n(t)}):e(t)},function(t){n(t)})})},e.getUpdatedSettings=T,e.isImage=function(t){var e;return t.type&&t.type.toLowerCase().includes("image")&&(e=!0),e},e.isVideo=function(t){var e;return t.type&&t.type.toLowerCase().includes("video")&&(e=!0),e},e.isAudio=function(t){var e;return t.type&&t.type.toLowerCase().includes("audio")&&(e=!0),e},e.validateScope=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):t!=r.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&t!=r.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&t!=r.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},e.validateUpdateGroup=function(t){return t.hasOwnProperty(i.GroupConstants.KEYS.GUID)?typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):l(t[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):t.hasOwnProperty(i.GroupConstants.KEYS.NAME)&&""===t[i.GroupConstants.KEYS.NAME]?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},e.validateJoinGroup=function(t,e,n){if(typeof t==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(e))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e.toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e.toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e.toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(n))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},e.validateCreateGroup=function(t){if(!t.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof t[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.NAME))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof t[i.GroupConstants.KEYS.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(l(t[i.GroupConstants.KEYS.NAME]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!t.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof t[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!t.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof t[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(t[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(t.hasOwnProperty(i.GroupConstants.KEYS.TAGS)){if(!Array.isArray(t[i.GroupConstants.KEYS.TAGS]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===t[i.GroupConstants.KEYS.TAGS].length)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},e.validateId=function(t,e){if("user"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===e){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(t))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}},e.validateHideMessagesFromBlockedUsers=function(t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},e.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!=i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(t)?void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},e.validateMsgId=function(t){return isNaN(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):l(t)?new a.CometChatException(S.ERRORS.PARAMETER_MISSING):void 0},e.validateChatType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):t!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&t!=i.MessageConstatnts.RECEIVER_TYPE.USER?new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE):void 0},e.validateMessage=function(t){var e=t;if(typeof e.getReceiverId()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(l(e.getReceiverId()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof e.getReceiverType()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(l(e.getReceiverType()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&e.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.USER)return new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE);if(t instanceof E.TextMessage){var n=t;if(typeof n.getText()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")));if(""===n.getText().trim())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(t instanceof c.MediaMessage){var o=t;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var s=o.getAttachments(),r=0;r<s.length;r++){if(!s[r].getExtension())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!s[r].getMimeType())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!s[r].getName())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!s[r].getUrl())return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(o.hasOwnProperty("files"))for(r=0;r<o.files.length;r++)if(!(o.files[r]instanceof Blob))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}if(t instanceof u.CustomMessage&&l(t.getCustomData()))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")))},e.validateCreateUser=function(t){if(!t.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(t[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!t.hasOwnProperty(i.UserConstants.NAME))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof t[i.UserConstants.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(l(t[i.UserConstants.NAME]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(t.hasOwnProperty(i.UserConstants.AVATAR)&&""===t[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(t.hasOwnProperty(i.UserConstants.META_DATA)&&""===t[i.UserConstants.META_DATA])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(t.hasOwnProperty(i.UserConstants.LINK)&&""===t[i.UserConstants.LINK])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(t.hasOwnProperty(i.UserConstants.STATUS_MESSAGE)&&""===t[i.UserConstants.STATUS_MESSAGE])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(t.hasOwnProperty(i.UserConstants.ROLE)&&""===t[i.UserConstants.ROLE])return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(t.hasOwnProperty(i.UserConstants.TAGS)){if(!Array.isArray(t[i.UserConstants.TAGS]))return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===t[i.UserConstants.TAGS].length)return new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},e.validateUpdateUser=function(t){return t.hasOwnProperty(i.UserConstants.UID)?typeof t[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):l(t[i.UserConstants.UID])?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):t.hasOwnProperty(i.UserConstants.NAME)&&""===t[i.UserConstants.NAME]?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},e.validateConversationType=function(t){return typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):l(t)?new a.CometChatException(JSON.parse(p(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(t=t.toLowerCase())!=r.CometChat.RECEIVER_TYPE.USER&&t!=r.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0}},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.SESSION_STORE=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.CALLING_COMPONENT_VERSION=e.DEFAULT_VALUES=e.constants=void 0;var o,s,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"},e.CALLING_COMPONENT_VERSION=5,(o=e.GroupType||(e.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",e.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(s=e.GroupMemberScope||(e.GroupMemberScope={})).Admin="admin",s.Moderator="moderator",s.Member="member",e.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},e.APPINFO={platform:"WEB",sdkVersion:"v3.0.12",apiVersion:"v3.0",sdkVersionWithUnderScore:"3_0_12"},e.SDKHeader={platform:"javascript",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",TILE:"TILE",GRID:"GRID"},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"},AUDIO_INPUT_DEVICES:"audioInputDevices",AUDIO_OUTPUT_DEVICES:"audioOutputDevices",VIDEO_INPUT_DEVICES:"videoInputDevices",POST_MESSAGES:{TYPES:{ACTION_MESSAGE:"cometchat_action_message",HANGUP:"hangup",COMETCHAT_RTC_SETTINGS:"cometchat_rtc_settings"},ACTIONS:{USER_JOINED:"onUserJoined",USER_LEFT:"onUserLeft",USER_LIST_CHANGED:"onUserListChanged",INITIAL_DEVICE_LIST:"initialDeviceList",DEVICE_CHANGE:"onDeviceChange",LOAD:"LOAD",CHANGE_AUDIO_INPUT:"changeAudioInput",CHANGE_AUDIO_OUTPUT:"changeAudioOutput",CHANGE_VIDEO_INPUT:"changeVideoInput",MUTE_AUDIO:"muteAudio",UNMUTE_AUDIO:"unMuteAudio",PAUSE_VIDEO:"pauseVideo",UNPAUSE_VIDEO:"unPauseVideo",SWITCH_MODE:"switchMode",START_SCREENSHARE:"startScreenShare",STOP_SCREENSHARE:"stopScreenShare",END_CALL:"endCall",START_RECORDING:"startRecording",STOP_RECORDING:"stopRecording",RECORDING_TOGGLED:"onRecordingToggled",USER_MUTED:"onUserMuted",SCREEN_SHARE_STARTED:"SCREEN_SHARE_STARTED",SCREEN_SHARE_STOPPED:"SCREEN_SHARE_ENDED",SWITCH_TO_VIDEO_CALL:"switchedToVideo",SWITCHED_TO_VIDEO_CALL:"onCallSwitchedToVideo",OPEN_VIRTUAL_BACKGROUND:"openVirtualBackgroundMenu",SET_BACKGROUND_BLUR:"setBackgroundBlur",SET_BACKGROUND_IMAGE:"setBackgroundImage"}},MEDIA_DEVICE:{ID:"id",NAME:"name",ACTIVE:"active"},ZOOM_BUTTON_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},NAME_LABEL_DEFAULT_PARAMS:{position:"bottom-left",visible:!0,color:"rgba(27, 27, 27, 0.4)"},NETWORK_LABEL_DEFAULT_PARAMS:{position:"bottom-right",visible:!0},MAIN_VIDEO_CONTAINER_SETTINGS:{KEYS:{POSITION:"position",VISIBILITY:"visible",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:"CALL_IN_PROGRESS",name:"CALL_IN_PROGRESS",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:{}},CALL_SETTINGS_REQUIRED:{code:"CALL_SETTINGS_REQUIRED",name:"CALL_SETTINGS_REQUIRED",message:"Please make sure you are passing the call settings object.",details:{}},JWT_NOT_FOUND:{code:"JWT_NOT_FOUND",name:"JWT_NOT_FOUND",message:"There was some issue while fetching JWT from API.",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",WEBRTC_WEB_FRONTEND_HOST:"WEBRTC_WEB_FRONTEND_HOST",WEBRTC_WEB_FRONTEND_VERSION:"WEBRTC_WEB_FRONTEND_VERSION"}},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.SESSION_STORE={SESSION_ID:"sessionId"},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 o=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=o},function(t,e,n){"use strict";var p=this&&this.__assign||function(){return(p=Object.assign||function(t){for(var e,n=1,o=arguments.length;n<o;n++)for(var s in e=arguments[n])Object.prototype.hasOwnProperty.call(e,s)&&(t[s]=e[s]);return t}).apply(this,arguments)},E=this&&this.__awaiter||function(t,i,a,E){return new(a||(a=Promise))(function(n,e){function o(t){try{r(E.next(t))}catch(t){e(t)}}function s(t){try{r(E.throw(t))}catch(t){e(t)}}function r(t){var e;t.done?n(t.value):(e=t.value,e instanceof a?e:new a(function(t){t(e)})).then(o,s)}r((E=E.apply(t,i||[])).next())})},c=this&&this.__generator||function(n,o){var s,r,i,t,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return t={next:e(0),throw:e(1),return:e(2)},"function"==typeof Symbol&&(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&e[0]?r.return:e[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,e[1])).done)return i;switch(r=0,i&&(e=[2&e[0],i.value]),e[0]){case 0:case 1:i=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,r=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){a.label=e[1];break}if(6===e[0]&&a.label<i[1]){a.label=i[1],i=e;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(e);break}i[2]&&a.ops.pop(),a.trys.pop();continue}e=o.call(n,a)}catch(t){e=[6,t],r=0}finally{s=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}};e.__esModule=!0,e.CometChat=void 0;var u=n(28),w=n(0),K=n(2),T=n(6),C=n(4),d=n(14),S=n(17),l=n(7),_=n(16),g=n(10),h=n(11),b=n(1),a=n(8),A=n(15),r=n(30),o=n(23),s=n(21),B=n(31),R=n(13),i=n(20),I=n(40),f=n(41),O=n(42),N=n(43),y=n(45),m=n(46),L=n(25),M=n(26),v=n(36),P=n(19),D=n(34),U=n(48),Y=n(49),F=n(50),V=n(35),x=n(24),k=n(18),J=n(51),H=n(52),W=n(53),G=n(37),j=n(5),X=n(62),q=n(29),Q=n(32),z=n(27),Z=n(63),$=W.WSConnectionHelper.getInstance(),tt=G.ListenerHandlers.getInstance(),et=function(){function G(t){try{G.appId=t,G.localStorage=d.LocalStorage.getInstance(),G.keyStore=r.KeyStore.getInstance()}catch(t){w.Logger.error("CometChat: constructor",t)}}return G.setAuthToken=function(t){try{G.authToken=t}catch(t){w.Logger.error("CometChat: setAuthToken",t)}},G.prototype.getAuthToken=function(){try{return G.authToken}catch(t){w.Logger.error("CometChat: getAuthToken",t)}},G.getAppId=function(){try{return G.appId}catch(t){w.Logger.error("CometChat: getAppId",t)}},G.prototype.getApiKey=function(){try{return G.apiKey}catch(t){w.Logger.error("CometChat: getApiKey",t)}},G.getMode=function(){try{return G.mode}catch(t){w.Logger.error("CometChat: getMode",t)}},G.setMode=function(t){try{G.mode=t}catch(t){w.Logger.error("CometChat: getMode",t)}},G.getSessionId=function(){try{return G.sessionId}catch(t){w.Logger.error("CometChat: getSessionId",t)}},G.onStorageEvent=function(t){if(document&&!document.hasFocus()){var e=G.appId+":common_store/user";t.key===e&&null===t.newValue&&(G.authToken=void 0,G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),$.WSLogout(),G.pushToLoginListener("","Logout_Success")),t.key===e&&null===t.oldValue&&d.LocalStorage.getInstance().get("user").then(function(t){t&&(G.user=new C.Me(t),G.setAuthToken(G.user.getAuthToken()),t.jwt&&(G.jwt=t.jwt),d.LocalStorage.getInstance().get("app_settings").then(function(t){if(t){if(t.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var e=parseInt(b.APPINFO.sdkVersion.charAt(1));t[b.APP_SETTINGS.KEYS.APP_VERSION]<e&&(G.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken()))}else G.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken());if(t[b.APP_SETTINGS.KEYS.MODE]&&(G.mode=t[b.APP_SETTINGS.KEYS.MODE]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=t[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!t[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.getConnectionStatus()!==b.CONNECTION_STATUS.CONNECTED){var n=new C.User(G.user);G.pushToLoginListener(n,"Login_Success"),G.appSettings.shouldAutoEstablishSocketConnection()&&G.WSLogin(G.user)}}}))})}},G.beforeUnload=function(t){var e=G.getDataFromSessionStorage(b.SESSION_STORE.SESSION_ID);G.removeDataFromSessionStorage(b.SESSION_STORE.SESSION_ID),d.LocalStorage.getInstance().set(b.SESSION_STORE.SESSION_ID,e)},G.didAnalyticsPingStart=function(){try{return G.isAnalyticsPingStarted}catch(t){w.Logger.error("CometChat: didAnalyticsPingStart",t)}},G.getDataFromSessionStorage=function(t){if(window.sessionStorage)return window.sessionStorage.getItem(t)},G.addDataToSessionStorage=function(t,e){window.sessionStorage&&window.sessionStorage.setItem(t,e)},G.removeDataFromSessionStorage=function(t){window.sessionStorage&&window.sessionStorage.removeItem(t)},G.init=function(s,t){var o=this;return void 0===s&&(s=""),new Promise(function(n,e){try{"object"==typeof s&&(s.hasOwnProperty("appId")&&(s=s.appId),s.hasOwnProperty("appSettings")&&(t=s.appSettings)),w.isFalsy(t)?t=(new Y.AppSettingsBuilder).setRegion(Y.AppSettings.REGION_EU).build():t.getRegion()==Y.AppSettings.REGION_PRIVATE&&(t.region=s),o.appSettings=t,w.isFalsy(s)?e(new K.CometChatException(R.INIT_ERROR.NO_APP_ID)):(window.addEventListener&&(window.addEventListener("storage",G.onStorageEvent,!1),window.addEventListener("beforeunload",G.beforeUnload,!1)),o.initialzed=!0,G.appId=s,G.getInstance(s),d.LocalStorage.getInstance().get(b.SESSION_STORE.SESSION_ID).then(function(t){null==t||null==t?(G.sessionId=b.APPINFO.platform+"-"+b.APPINFO.sdkVersionWithUnderScore+"-"+Z()+"-"+(new Date).getTime(),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId()),d.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID)):(G.sessionId=t.toLocaleString(),d.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId())),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_ID).then(function(t){if(null==t||null==t)G.appId=s,G.getInstance(s),d.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,s),n(!0);else{var e=t.toLocaleString();e===s?(G.appId=e,G.getInstance(e),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_USER).then(function(t){t?(G.isLoggedOut=!1,G.user=new C.Me(t),G.setAuthToken(G.user.getAuthToken()),t.jwt&&(G.jwt=t.jwt),n(!0),d.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){if(t){if(t.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var e=parseInt(b.APPINFO.sdkVersion.charAt(1));t[b.APP_SETTINGS.KEYS.APP_VERSION]<e&&(o.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToW