-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathCometChat.js
1 lines (1 loc) · 430 KB
/
CometChat.js
1
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(window,function(){return function(n){var o={};function s(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,s),t.l=!0,t.exports}return s.m=n,s.c=o,s.d=function(e,t,n){s.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},s.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.t=function(t,e){if(1&e&&(t=s(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(s.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)s.d(n,o,function(e){return t[e]}.bind(null,o));return n},s.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return s.d(t,"a",t),t},s.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s.p="",s(s.s=34)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.validateQuestion=t.updatePropertiesWithDynamicValue=t.validateConversationType=t.validateUpdateUser=t.validateCreateUser=t.validateMessage=t.validateChatType=t.validateMsgId=t.validateArray=t.validateHideMessagesFromBlockedUsers=t.validateId=t.validateCreateGroup=t.validateJoinGroup=t.validateUpdateGroup=t.validateScope=t.isAudio=t.isVideo=t.isImage=t.getUpdatedSettings=t.getAppSettings=t.getCurrentTime=t.Logger=t.createUidFromJid=t.format=t.getOrdinalSuffix=t.isFalsy=t.isTruthy=t.isObject=t.getJidHost=t.getChatHost=void 0;var o=n(15),i=n(1),s=n(6),a=n(2),E=n(17),c=n(19),u=n(21),r=n(5),S=n(10),p=n(22);function C(e){return null!=e&&("string"==typeof e&&(e=e.trim()),"object"==typeof e&&0===Object.keys(e).length&&(e=void 0)),["",0,"0",!1,null,"null",void 0,"undefined"].includes(e)}function l(e){for(var o=[],t=1;t<arguments.length;t++)o[t-1]=arguments[t];return e.split("%s").reduce(function(e,t,n){return e+t+(o[n]||"")},"")}t.getChatHost=function(e){return e[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?e[i.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:e[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?e[i.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:e[i.APP_SETTINGS.KEYS.CHAT_HOST]},t.getJidHost=function(e){return e[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?e[i.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:e[i.APP_SETTINGS.KEYS.CHAT_HOST]},t.isObject=function(e){return e instanceof Object&&e.constructor===Object},t.isTruthy=function(e){return[!0,1,"1","true","TRUE"].includes(e)},t.isFalsy=C,t.getOrdinalSuffix=function(e){var t=e%10,n=e%100;return 1==t&&11!=n?e+"st":2==t&&12!=n?e+"nd":3==t&&13!=n?e+"rd":e+"th"},t.format=l,t.createUidFromJid=function(e){return e.substring(e.lastIndexOf("]")+1,e.lastIndexOf("@"))};var _=function(){function e(){}return e.log=function(e,t){},e.error=function(e,t){},e.info=function(e,t){},e}();function T(){return new Promise(function(t,n){s.makeApiCall("appSettings").then(function(e){o.LocalStorage.getInstance().set(i.LOCAL_STORE.KEY_APP_SETTINGS,e.data),e.data.MODE&&r.CometChat.setMode(e.data.MODE),t(e.data)},function(e){n(new a.CometChatException(e.error))})})}t.Logger=_,t.getCurrentTime=function(){return(new Date).getTime()},t.getAppSettings=function(){return new Promise(function(t,n){o.LocalStorage.getInstance().get(i.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){C(e)?T().then(function(e){t(e)},function(e){n(e)}):t(e)},function(e){n(e)})})},t.getUpdatedSettings=T,t.isImage=function(e){var t;return e.type&&e.type.toLowerCase().includes("image")&&(t=!0),t},t.isVideo=function(e){var t;return e.type&&e.type.toLowerCase().includes("video")&&(t=!0),t},t.isAudio=function(e){var t;return e.type&&e.type.toLowerCase().includes("audio")&&(t=!0),t},t.validateScope=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):e!=r.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&e!=r.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&e!=r.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new a.CometChatException(i.GroupErrors.INVALID_SCOPE):void 0},t.validateUpdateGroup=function(e){return e.hasOwnProperty(i.GroupConstants.KEYS.GUID)?typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):C(e[i.GroupConstants.KEYS.GUID])?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):e.hasOwnProperty(i.GroupConstants.KEYS.NAME)&&""===e[i.GroupConstants.KEYS.NAME]?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},t.validateJoinGroup=function(e,t,n){if(typeof e==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!e.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(e[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(e[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==t){if(typeof t!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(t))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t.toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&t.toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(t.toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(n))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},t.validateCreateGroup=function(e){if(!e.hasOwnProperty(i.GroupConstants.KEYS.GUID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[i.GroupConstants.KEYS.GUID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e[i.GroupConstants.KEYS.GUID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.NAME))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof e[i.GroupConstants.KEYS.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(C(e[i.GroupConstants.KEYS.NAME]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!e.hasOwnProperty(i.GroupConstants.KEYS.TYPE))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[i.GroupConstants.KEYS.TYPE]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(C(e[i.GroupConstants.KEYS.TYPE]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PUBLIC&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PASSWORD&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PROTECTED&&e[i.GroupConstants.KEYS.TYPE].toLowerCase()!=r.CometChat.GROUP_TYPE.PRIVATE)return new a.CometChatException(i.GroupErrors.INVALID_GROUP_TYPE);if(e[i.GroupConstants.KEYS.TYPE].toLowerCase()==r.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(i.GroupConstants.KEYS.PASSWORD))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[i.GroupConstants.KEYS.PASSWORD]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(C(e[i.GroupConstants.KEYS.PASSWORD]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(e.hasOwnProperty(i.GroupConstants.KEYS.TAGS)){if(!Array.isArray(e[i.GroupConstants.KEYS.TAGS]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===e[i.GroupConstants.KEYS.TAGS].length)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},t.validateId=function(e,t){if("user"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}if("bot"===t){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"BOT_ID","BOT_ID","BOT_ID")));if(C(e))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"BOT_ID","BOT_ID","BOT_ID","BOT_ID")))}},t.validateHideMessagesFromBlockedUsers=function(e){if(typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers")))},t.validateArray=function(e,t){var n="List should be an array.";return n="blockUsers"===t?"blockUsers() method accepts an array of users.":"unblockUsers"===t?"unblockUsers() method accepts an array of users.":"groupMembers"===t?"addMembersToGroup() method accepts members list as an array of users.":"addMembersToGroup() method accepts bannedMembers list as an array of users.",typeof e!=i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(e)?void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},t.validateMsgId=function(e){return isNaN(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):C(e)?new a.CometChatException(S.ERRORS.PARAMETER_MISSING):void 0},t.validateChatType=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):e!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&e!=i.MessageConstatnts.RECEIVER_TYPE.USER?new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE):void 0},t.validateMessage=function(e){var t=e;if(typeof t.getReceiverId()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(C(t.getReceiverId()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof t.getReceiverType()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(C(t.getReceiverType()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(t.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.GROUP&&t.getReceiverType()!=i.MessageConstatnts.RECEIVER_TYPE.USER)return new a.CometChatException(i.MessageErrors.INVALID_RECEIVER_TYPE);if(e instanceof E.TextMessage){var n=e;if(typeof n.getText()!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(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(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(e instanceof c.MediaMessage){var o=e;if(o.getData()&&o.getData().hasOwnProperty("attachments"))for(var s=o.getAttachments(),r=0;r<s.length;r++){if(!s[r].getExtension())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!s[r].getMimeType())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!s[r].getName())return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!s[r].getUrl())return new a.CometChatException(JSON.parse(l(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(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}if(e instanceof u.CustomMessage&&C(e.getCustomData()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data")));if(e instanceof p.InteractiveMessage&&C(e.getInteractiveData()))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"INTERACTIVE_DATA","INTERACTIVE_DATA","interactive data","interactive data")))},t.validateCreateUser=function(e){if(!e.hasOwnProperty(i.UserConstants.UID))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof e[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(C(e[i.UserConstants.UID]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!e.hasOwnProperty(i.UserConstants.NAME))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof e[i.UserConstants.NAME]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(C(e[i.UserConstants.NAME]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(e.hasOwnProperty(i.UserConstants.AVATAR)&&""===e[i.UserConstants.AVATAR])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(e.hasOwnProperty(i.UserConstants.META_DATA)&&""===e[i.UserConstants.META_DATA])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(e.hasOwnProperty(i.UserConstants.LINK)&&""===e[i.UserConstants.LINK])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(e.hasOwnProperty(i.UserConstants.STATUS_MESSAGE)&&""===e[i.UserConstants.STATUS_MESSAGE])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(e.hasOwnProperty(i.UserConstants.ROLE)&&""===e[i.UserConstants.ROLE])return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(e.hasOwnProperty(i.UserConstants.TAGS)){if(!Array.isArray(e[i.UserConstants.TAGS]))return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===e[i.UserConstants.TAGS].length)return new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},t.validateUpdateUser=function(e){return e.hasOwnProperty(i.UserConstants.UID)?typeof e[i.UserConstants.UID]!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):C(e[i.UserConstants.UID])?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):e.hasOwnProperty(i.UserConstants.NAME)&&""===e[i.UserConstants.NAME]?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},t.validateConversationType=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(e=e.toLowerCase())!=r.CometChat.RECEIVER_TYPE.USER&&e!=r.CometChat.RECEIVER_TYPE.GROUP?new a.CometChatException(i.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},t.updatePropertiesWithDynamicValue=function(e,o,s){return function e(t){for(var n in t)t.hasOwnProperty(n)&&("object"==typeof t[n]?e(t[n]):"string"==typeof t[n]&&t[n].includes(o)&&!t[n].includes(i.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY)&&(t[n]+=s))}(e),e},t.validateQuestion=function(e){return typeof e!==i.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.MUST_BE_A_STRING),"QUESTION","QUESTION","Question"))):C(e)?new a.CometChatException(JSON.parse(l(JSON.stringify(i.GENERAL_ERROR.INVALID),"QUESTION","QUESTION","question","question"))):void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AI_SLUG_ENABLED=t.AI_SLUG_ACCESSIBLE=t.AI_FEATURE_ENABLED=t.AI_FEATURE_ACCESSIBLE=t.ADDITIONAL_CONSTANTS=t.ONLINE_MEMBER_COUNT_API=t.JWT_API=t.ProsodyApiErrors=t.PROSODY_API=t.API_ERROR_CODES=t.REACTION_ACTION=t.SESSION_STORE=t.CONNECTION_STATUS=t.COMMON_UTILITY_CONSTANTS=t.APP_SETTINGS=t.PresenceConstatnts=t.FeatureRestrictionErrors=t.MessageErrors=t.AIFeatureError=t.ExtensionErrors=t.AIErrors=t.ConversationErrors=t.GroupErrors=t.UserErrors=t.ReceiptErrors=t.GENERAL_ERROR=t.PARAMETER_ERROR=t.CALL_ERROR=t.Errors=t.UserConstants=t.GroupMemersConstans=t.GroupConstants=t.CallConstants=t.BlockedUsersConstants=t.ActionConstatnts=t.TYPING_NOTIFICATION=t.GoalType=t.MessageCategory=t.ATTACHMENTS_CONSTANTS=t.MessageConstatnts=t.READ_RECEIPTS=t.DELIVERY_RECEIPTS=t.ResponseConstants=t.LOCAL_STORE=t.ANALYTICS=t.WS=t.SDKHeader=t.APPINFO=t.GROUP_MEMBER_SCOPE=t.GroupMemberScope=t.GROUP_TYPE=t.GroupType=t.CALLING_COMPONENT_VERSION=t.DEFAULT_VALUES=t.constants=void 0;var o,s,r,i,a,E=n(2);t.constants={DEFAULT_STORE:"cometchat",MSG_VER_PRE:"store-ver-pre",MSG_VER_POST:"store-ver-post"},t.DEFAULT_VALUES={ZERO:0,MSGS_LIMIT:30,REACTIONS_LIMIT:10,MSGS_MAX_LIMIT:100,USERS_LIMIT:30,USERS_MAX_LIMIT:100,GROUPS_LIMIT:30,GROUPS_MAX_LIMIT:100,CONVERSATION_MAX_LIMIT:50,CALL_TIMEOUT:45,DEFAULT_MSG_ID:0,DEFAULT_MAX_TYPING_INDICATOR_LIMIT:5,REGION_DEFAULT:"eu",REGION_DEFAULT_EU:"eu",REGION_DEFAULT_US:"us",REGION_DEFAULT_IN:"in",REGION_DEFAULT_PRIVATE:"private",REACTIONS_MAX_LIMIT:20},t.CALLING_COMPONENT_VERSION=5,(o=t.GroupType||(t.GroupType={})).Public="public",o.Private="private",o.Protected="protected",o.Password="password",t.GROUP_TYPE={PUBLIC:"public",PRIVATE:"private",PROTECTED:"password",PASSWORD:"password"},(s=t.GroupMemberScope||(t.GroupMemberScope={})).Admin="admin",s.Moderator="moderator",s.Member="member",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"WEB",sdkVersion:"v4.0.10",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_0_10"},t.SDKHeader={platform:"javascript",sdkVersion:"4.0.10",sdk:"%s@%s"},t.WS={CONVERSATION:{TYPE:{CHAT:"chat",GROUP_CHAT:"groupchat"}}},t.ANALYTICS={analyticsHost:"metrics-%s.cometchat.io",analyticsVersion:"v1"},t.LOCAL_STORE={COMMON_STORE:"common_store",MESSAGE_LISTENERS_LIST:"message_listeners_list",USERS_STORE:"users_store",MESSAGES_STORE:"messages_store",KEYS_STORE:"keys_store",STORE_STRING:"%s:%s",KEY_STRING:"%s/%s",KEY_USER:"user",KEY_APP_SETTINGS:"app_settings",KEY_APP_ID:"appId",KEY_DEVICE_ID:"deviceId",KEY_SESSION_ID:"sessionId",KEY_MESSAGE_LISTENER_LIST:"all"},t.ResponseConstants={RESPONSE_KEYS:{KEY_DATA:"data",KEY_META:"meta",KEY_CURSOR:"cursor",KEY_NEXT:"next",KEY_PREVIOUS:"previous",KEY_ACTION:"action",KEY_MESSAGE:"message",KEY_ERROR:"error",KEY_ERROR_DETAILS:"details",KEY_ERROR_CODE:"code",KEY_ERROR_MESSAGE:"message",KEY_AUTH_TOKEN:"authToken",KEY_WS_CHANNEL:"wsChannel",KEY_IDENTITY:"identity",KEY_SERVICE:"identity",KEY_ENTITIES:"entities",KEY_REACTIONS:"reactions",KEY_ENTITITY:"entity",KEY_ENTITYTYPE:"entityType",KEY_ATTACHMENTS:"attachments",CODE_REQUEST_OK:200,CODE_BAD_REQUEST:401,UNREAD_UNDELIVERED_KEYS:{ENTITY:"entity",ENTITY_TYPE:"entityType",ENTITY_Id:"entityId",COUNT:"count"},GROUP_MEMBERS_RESPONSE:{SUCCESS:"success",ERROR:"error",MESSAGE:"message"},KEY_ENTITY_TYPE:{USER:"user",GROUP:"group"},KEY_CONVERSATION_STARTER:"conversation-starter",KEY_SMART_REPLIES:"smart-replies",KEY_CONVERSATION_SUMMARY:"conversation-summary",KEY_BOT_REPLY:"bot-reply"}},t.DELIVERY_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",RECEIVED:"delivered",DELIVERED_AT:"deliveredAt",ID:"id",TIME:"time",DELIVERED_TO_ME_AT:"deliveredToMeAt"},t.READ_RECEIPTS={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"type",RECIPIENT:"recipient",MESSAGE_ID:"messageId",READ:"read",READ_AT:"readAt",ID:"id",TIME:"time",READ_BY_ME_AT:"readByMeAt"},t.MessageConstatnts={TYPE:{TEXT:"text",MEDIA:"media",IMAGE:"image",VIDEO:"video",AUDIO:"audio",FILE:"file",CUSTOM:"custom"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom",INTERACTIVE:"interactive"},RECEIVER_TYPE:{USER:"user",GROUP:"group"},KEYS:{ATTATCHMENT:"attatchment",ATTATCHMENTS:"attachments",ACTION:"action",TYPE:"type",DATA:"data",ID:"id",MUID:"muid",SENDER:"sender",RECEIVER:"receiver",RECEIVER_ID:"receiverId",CATEGORY:"category",RECEIVER_TYPE:"receiverType",SENT_AT:"sentAt",STATUS:"status",TEXT:"text",URL:"url",METADATA:"metadata",RECEIPTS:"receipts",MY_RECEIPTS:"myReceipt",CUSTOM_DATA:"customData",CUSTOM_SUB_TYPE:"subType",RESOURCE:"resource",MENTIONS:"mentions",INTERACTIVE_DATA:"interactiveData",INTERACTION_GOAL:"interactionGoal",INTERACTIONS:"interactions",ALLOW_SENDER_INTERACTION:"allowSenderInteraction",ELEMENT_ID:"elementId",INTERACTED_AT:"interactedAt",ELEMENT_IDS:"elementIds"},KNOWN_MEDIA_TYPE:{IMAGE:[],VIDEO:[],AUDIO:[],FILE:[]},PAGINATION:{AFFIX:{APPEND:"append",PREPEND:"prepend"},CURSOR_FILEDS:{ID:"id",SENT_AT:"sentAt"},CURSOR_AFFIX_DEFAULT:"prepend",CURSOR_FIELD_DEFAULT:"sentAt",KEYS:{PER_PAGE:"per_page",CURSOR_AFFIX:"cursorAffix",AFFIX:"affix",CURSOR_FIELD:"cursorField",CURSOR_VALUE:"cursorValue",UID:"uid",SENT_AT:"sentAt",ID:"id",CURRENT_PAGE:"page",UNREAD:"unread",HIDE_MESSAGES_FROM_BLOCKED_USER:"hideMessagesFromBlockedUsers",SEARCH_KEY:"searchKey",ONLY_UPDATES:"onlyUpdates",UPDATED_AT:"updatedAt",CATEGORY:"category",CATEGORIES:"categories",TYPE:"type",TYPES:"types",HIDE_REPLIES:"hideReplies",HIDE_DELETED_MESSAGES:"hideDeleted",WITH_TAGS:"withTags",TAGS:"tags",MENTIONS_WITH_TAG_INFO:"mentionsWithTagInfo",MENTIONS_WITH_BLOCKED_INFO:"mentionsWithBlockedInfo",ONLY_INTERACTION_GOAL_COMPLETED:"onlyInteractionGoalCompleted"}}},t.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",SIZE:"size",URL:"url"}},(r=t.MessageCategory||(t.MessageCategory={})).ACTION="action",r.MESSAGE="message",r.CALL="call",r.CUSTOM="custom",r.INTERACTIVE="interactive",(i=t.GoalType||(t.GoalType={})).ANY_ACTION="anyAction",i.ANY_OF="anyOf",i.ALL_OF="allOf",i.NONE="none",t.TYPING_NOTIFICATION={RECEIVER_ID:"receiverId",RECEIVER_TYPE:"receiverType",META:"metadata",KEYS:{TYPING_NOTIFICATION:"typingNotification",TIMESTAMP:"timestamp"},ACTIONS:{STARTED:"started",ENDED:"ended"}},t.ActionConstatnts={ACTION_SUBJECTS:{ACTION_ON:"on",ACTION_BY:"by",ACTION_FOR:"for"},ACTION_ENTITY_TYPE:{GROUP_USER:"groupuser",USER:"user",GROUP:"group",MESSAGE:"message"},ACTION_KEYS:{ACTION_CREATED:"created",ACTION_UPDATED:"updated",ACTION_DELETED:"deleted",ENTITIES:"entities",ENTITY:"entity",ENTITY_TYPE:"entityType",TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_ADDED:"added",ACTION_SCOPE_CHANGED:"scopeChanged",ACTION_TYPE_USER:"user",ACTION_TYPE_GROUP:"group",ACTION_TYPE_GROUP_MEMBER:"groupMember",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",ACTION_TYPE_CALL:"call",EXTRAS:"extras",SCOPE:"scope",NEW:"new",OLD:"old"},ActionMessages:{ACTION_GROUP_JOINED_MESSAGE:"%s joined",ACTION_GROUP_LEFT_MESSAGE:"%s left",ACTION_MEMBER_KICKED_MESSAGE:"%s kicked %s",ACTION_MEMBER_BANNED_MESSAGE:"%s banned %s",ACTION_MEMBER_UNBANNED_MESSAGE:"%s unbanned %s",ACTION_MEMBER_INVITED_MESSAGE:"%s banned %s",ACTION_MESSAGE_EDITED_MESSAGE:" Message Edited",ACTION_MESSAGE_DELETED_MESSAGE:"Message Deleted",ACTION_MEMBER_SCOPE_CHANGED:"%s made %s %s",ACTION_MEMBER_ADDED_TO_GROUP:"%s added %s"},ACTION_TYPE:{TYPE_MEMBER_JOINED:"joined",TYPE_MEMBER_LEFT:"left",TYPE_MEMBER_KICKED:"kicked",TYPE_MEMBER_BANNED:"banned",TYPE_MEMBER_UNBANNED:"unbanned",TYPE_MEMBER_INVITED:"invited",TYPE_MEMBER_SCOPE_CHANGED:"scopeChanged",TYPE_MESSAGE:"message",TYPE_MESSAGE_EDITED:"edited",TYPE_MESSAGE_DELETED:"deleted",TYPE_MEMBER_ADDED:"added"},ACTIONS:{MEMBER_ADDED:"added",MEMBER_JOINED:"joined",MEMBER_LEFT:"left",MEMBER_KICKED:"kicked",MEMBER_BANNED:"banned",MEMBER_UNBANNED:"unbanned",MEMBER_INVITED:"invited",MEMBER_SCOPE_CHANGED:"scopeChanged",MESSAGE_EDITED:"edited",MESSSAGE_DELETED:"deleted",TYPE_USER:"user",TYPE_GROUP:"group",TYPE_GROUP_MEMBER:"groupMember"}},t.BlockedUsersConstants={REQUEST_KEYS:{DIRECTIONS:{BOTH:"both",HAS_BLOCKED_ME:"hasBlockedMe",BLOCKED_BY_ME:"blockedByMe"}}},t.CallConstants={CALL_MODE:{DEFAULT:"DEFAULT",SPOTLIGHT:"SPOTLIGHT",SINGLE:"SINGLE",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"}}},t.GroupConstants={KEYS:{NAME:"name",GUID:"guid",TYPE:"type",PASSWORD:"password",ICON:"icon",DESCRIPTION:"description",OWNER:"owner",METADATA:"metadata",CREATED_AT:"createdAt",UPDATED_AT:"updatedAt",HAS_JOINED:"hasJoined",WS_CHANNEL:"wsChannel",TAGS:"tags"}},t.GroupMemersConstans={KEYS:{SCOPE:"scope",UID:"uid",GUID:"guid",USER:"user",NAME:"name"}},t.UserConstants={UID:"uid",NAME:"name",AUTH_TOKEN:"authToken",AVATAR:"avatar",LAST_ACTIVE_AT:"lastActiveAt",LINK:"link",META_DATA:"metadata",ROLE:"role",STATUS:"status",STATUS_MESSAGE:"statusMessage",USER_NAME:"user_name",TAGS:"tags",SORT_BY:{NAME:"name",STATUS:"status"},SORT_ORDER:{ASCENDING:"asc",DESCENDING:"desc"}},t.Errors={ERROR_IO_EXCEPTION:"ERROR_IO_EXCEPTION",ERROR_JSON_EXCEPTION:"ERROR_JSON_EXCEPTION",ERROR_PASSWORD_MISSING:"ERROR_PASSWORD_MISSING",ERROR_LIMIT_EXCEEDED:"ERROR_LIMIT_EXCEEDED",ERROR_USER_NOT_LOGGED_IN:"ERROR_USER_NOT_LOGGED_IN",ERROR_INVALID_GUID:"ERROR_INVALID_GUID",ERROR_PASSWORD_MISSING_MESSAGE:"Password is mandatory for a password group",ERROR_LIMIT_EXCEEDED_MESSAGE:"Limit Exceeded Max limit of %s",ERROR_USER_NOT_LOGGED_IN_MESSAGE:"Please log in to CometChat before calling this method",ERROR_INVALID_GUID_MESSAGE:"Please provide a valid GUID",ERROR_DEFAULT_MESSAGE:"Something went wrong",ERR_SETTINGS_HASH_OUTDATED:"ERR_SETTINGS_HASH_OUTDATED",ERR_NO_AUTH:"ERR_NO_AUTH"},t.CALL_ERROR={CALL_ALREADY_INITIATED:{code:"CALL_ALREADY_INITIATED",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},ERROR_IN_CALLING:{code:"CALL_IN_PROGRESS",name:"CALL_ALREADY_INITIATED",message:"There is already call in progress",details:{}},CANNOT_ACCEPT_CALL:{code:"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:{}}},t.PARAMETER_ERROR={PARAMETER_REQUIRED:{code:"%s_NOT_PROVIDED",name:"%s_NOT_PROVIDED",message:"please provide the %s.",details:{}}},t.GENERAL_ERROR={MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a string.",details:{}},MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a number.",details:{}},MUST_BE_A_OBJECT:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a object.",details:{}},MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be an array.",details:{}},MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a boolean.",details:{}},MUST_BE_A_BLOB:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a blob.",details:{}},INVALID:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s. Please provide a valid %s.",details:{}},METHOD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s is required.",details:{}},LIMIT_EXCEEDED:{code:"ERROR_%s_EXCEEDED",name:"ERROR_%s_EXCEEDED",message:"Limit exceeded max limit of %s.",details:{}},MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s should be a postive integer greater than 0.",details:{}},INVALID_MEDIA_FILE:{code:"INVALID_%s",name:"INVALID_%s",message:"The message type does not match the file's mime type.",details:{}},EMPTY_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s cannot be empty.",details:{}},MISSING_KEY:{code:"MISSING_KEY",name:"MISSING_KEY",message:"The key %s is missing from the %s object.",details:{}},EMPTY_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"The parameter %s should be an array and it cannot be empty.",details:{}},INVALID_SEARCH_KEYWORD:{code:"INVALID_SEARCH_KEYWORD",name:"INVALID_SEARCH_KEYWORD",message:"Invalid search keyword. Please provide a valid search keyword.",details:{}},INVALID_GROUP_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for the group. Please provide a valid %s.",details:{}},INVALID_USER_PROPERTY:{code:"INVALID_%s",name:"INVALID_%s",message:"Invalid %s provided for a user. Please provide a valid %s.",details:{}},PARAMETER_MUST_BE_A_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a number.",details:{}},PARAMETER_MUST_BE_AN_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as an array.",details:{}},PARAMETER_MUST_BE_A_BOOLEAN:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a boolean.",details:{}},PARAMETER_MUST_BE_A_POSITIVE_NUMBER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter to be a positive number greater than 0.",details:{}},PARAMETER_MUST_BE_A_STRING:{code:"INVALID_%s",name:"INVALID_%s",message:"%s method accepts parameter as a string.",details:{}},PARAMETER_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"%s cannot be blank. Please provide a valid %s.",details:{}},PASSWORD_COMPULSORY:{code:"%s_IS_COMPULSORY",name:"%s_IS_COMPULSORY",message:"Password is mandatory for a password group.",details:{}},INVALID_ARRAY:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}}},t.ReceiptErrors={MISSING_PARAMETERS:{code:"MISSING_PARAMETERS",name:"MISSING_PARAMETERS",message:"Expected 4 parameters received 3",details:{}},INVALID_PARAMETER:{code:"INVALID_%s",name:"INVALID_%s",message:"%s",details:{}},NO_WEBSOCKET_CONNECTION:{code:"NO_WEBSOCKET_CONNECTION",name:"NO_WEBSOCKET_CONNECTION",message:"Connection to our Websockets server is broken. Please retry after some time.",details:{}},RECEIPTS_TEMPORARILY_BLOCKED:{code:"RECEIPTS_TEMPORARILY_BLOCKED",name:"RECEIPTS_TEMPORARILY_BLOCKED",message:"Due to high load. Receipts have been blocked for your app.",details:{}},UNKNOWN_ERROR_OCCURRED:{code:"UNKNOWN_ERROR_OCCURRED",name:"UNKNOWN_ERROR_OCCURRED",message:"Unknown error occurred while marking a message as read.",details:{}}},t.UserErrors={INVALID_STATUS:new E.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new E.CometChatException({code:"INVALID_DIRECTION_VALUE",name:"INVALID_DIRECTION_VALUE",message:"The `direction` parameter accepts only `both`, `blockeyByMe` or `hasBlockedMe`.",details:""}),USER_NOT_LOGGED_IN:new E.CometChatException({code:"USER_NOT_LOGGED_IN",name:"USER_NOT_LOGGED_IN",message:"Please log in to CometChat before calling this method.",details:""})},t.GroupErrors={NOT_A_GROUP:new E.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new E.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new E.CometChatException({code:"INVALID_GROUP_TYPE",name:"INVALID_GROUP_TYPE",message:"Group type can be `public`, `private`, `protected` or `password`.",details:""})},t.ConversationErrors={INVALID_CONVERSATION_TYPE:{code:"INVALID_CONVERSATION_TYPE",name:"INVALID_CONVERSATION_TYPE",message:"Conversation type can be `user` or `group`.",details:"Please check the value of conversationType."},CONVERSATION_NOT_FOUND:{code:"CONVERSATION_NOT_FOUND",name:"CONVERSATION_NOT_FOUND",message:"Conversation for %s %s not found.",details:"Please check the value of conversationWith and conversationType."}},t.AIErrors={NO_CONVERSATION_STARTER:{code:"NO_CONVERSATION_STARTER",name:"NO_CONVERSATION_STARTER",message:"Unable to get conversation starter for this conversation.",details:""},NO_SMART_REPLY:{code:"NO_SMART_REPLY",name:"NO_SMART_REPLY",message:"Unable to get smart reply for this conversation.",details:""},NO_CONVERSATION_SUMMARY:{code:"NO_CONVERSATION_SUMMARY",name:"NO_CONVERSATION_SUMMARY",message:"Unable to get summary of the conversation.",details:""},NO_ASSISTANCE:{code:"EMPTY_RESPONSE",name:"EMPTY_RESPONSE",message:"Unable to get a suggestion.",details:""}},t.ExtensionErrors={INVALID_EXTENSION:{code:"ERROR_INVALID_EXTENSION",name:"ERROR_INVALID_EXTENSION",message:"The provided extension cannot be null or empty. Please provide a valid extension.",details:{}},EXTENSION_NOT_FOUND:{code:"ERROR_EXTENSION_NOT_FOUND",name:"ERROR_EXTENSION_NOT_FOUND",message:"The provided extension could not be found.",details:{}}},t.AIFeatureError={INVALID_AI_FEATURE:{code:"ERROR_INVALID_AI_FEATURE",name:"ERROR_INVALID_AI_FEATURE",message:"The provided AI Feature cannot be null or empty. Please provide a valid AI Feature.",details:{}}},t.MessageErrors={INVALID_RECEIVER_TYPE:{code:"INVALID_RECEIVER_TYPE",name:"INVALID_RECEIVER_TYPE",message:"Receiver type can be `user` or `group`.",details:"Please check the value of receiverType."}},t.FeatureRestrictionErrors={INVALID_FEATURE:{code:"ERROR_INVALID_FEATURE",name:"ERROR_INVALID_FEATURE",message:"The provided feature cannot be null or empty. Please provide a valid feature.",details:{}},FEATURE_NOT_FOUND:{code:"ERROR_FEATURE_NOT_FOUND",name:"ERROR_FEATURE_NOT_FOUND",message:"The provided feature could not be found.",details:{}}},t.PresenceConstatnts={STATUS:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline",JOINED:"JOINED",LEFT:"LEFT"}},t.APP_SETTINGS={APP_SETTINGS:"app_settings",KEYS:{CHAT_HOST:"CHAT_HOST",CHAT_USE_SSL:"CHAT_USE_SSL",GROUP_SERVICE:"GROUP_SERVICE",CALL_SERVICE:"CALL_SERVICE",CHAT_WS_PORT:"CHAT_WS_PORT",CHAT_WSS_PORT:"CHAT_WSS_PORT",CHAT_HTTP_BIND_PORT:"CHAT_HTTP_BIND_PORT",CHAT_HTTPS_BIND_PORT:"CHAT_HTTPS_BIND_PORT",ADMIN_API_HOST:"ADMIN_API_HOST",CLIENT_API_HOST:"CLIENT_API_HOST",WEBRTC_HOST:"WEBRTC_HOST",WEBRTC_USE_SSL:"WEBRTC_USE_SSL",WEBRTC_WS_PORT:"WEBRTC_WS_PORT",WEBRTC_WSS_PORT:"WEBRTC_WSS_PORT",WEBRTC_HTTP_BIND_PORT:"WEBRTC_HTTP_BIND_PORT",WEBRTC_HTTPS_BIND_PORT:"WEBRTC_HTTPS_BIND_PORT",EXTENSION_LIST:"extensions",EXTENSION_KEYS:{ID:"id",NAME:"name"},JID_HOST_OVERRIDE:"JID_HOST_OVERRIDE",CHAT_HOST_OVERRIDE:"CHAT_HOST_OVERRIDE",CHAT_HOST_APP_SPECIFIC:"CHAT_HOST_APP_SPECIFIC",MODE:"MODE",CONNECTION_TYPE:"connection_type",DEFAULT_MODE:"DEFAULT",LIMITED_TRANSIENT:"LIMITED_TRANSIENT",NO_TRANSIENT:"NO_TRANSIENT",POLLING_ENABLED:"POLLING_ENABLED",POLLING_INTERVAL:"POLLING_INTERVAL",ANALYTICS_PING_DISABLED:"ANALYTICS_PING_DISABLED",ANALYTICS_HOST:"ANALYTICS_HOST",ANALYTICS_VERSION:"ANALYTICS_VERSION",ANALYTICS_USE_SSL:"ANALYTICS_USE_SSL",SETTINGS_HASH:"settingsHash",SETTINGS_HASH_RECEIVED_AT:"settingsHashReceivedAt",DENY_FALLBACK_TO_POLLING:"DENY_FALLBACK_TO_POLLING",APP_VERSION:"APP_VERSION",MAIN_DOMAIN:"MAIN_DOMAIN",CHAT_API_VERSION:"CHAT_API_VERSION",WS_API_VERSION:"WS_API_VERSION",REGION:"REGION",EXTENSION_DOMAIN:"EXTENSION_DOMAIN",WEBRTC_API_SUBDOMAIN:"WEBRTC_API_SUBDOMAIN",WEBRTC_WEB_FRONTEND_HOST:"WEBRTC_WEB_FRONTEND_HOST",WEBRTC_WEB_FRONTEND_VERSION:"WEBRTC_WEB_FRONTEND_VERSION",SECURED_MEDIA_HOST:"SECURED_MEDIA_HOST",PARAMETERS:"parameters",CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES:"core.conversations.updateOnCallActivity",CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS:"core.conversations.updateOnGroupActions",CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES:"core.conversations.updateOnCustomMessage",CORE_CONVERSATIONS_UPDATE_ON_REPLIES:"core.conversations.updateOnReplies"}},t.COMMON_UTILITY_CONSTANTS={TYPE_CONSTANTS:{BOOLEAN:"boolean",STRING:"string",OBJECT:"object",NUMBER:"number"}},t.CONNECTION_STATUS={CONNECTED:"connected",CONNECTING:"connecting",DISCONNECTED:"disconnected",FEATURE_THROTTLED:"featureThrottled"},t.SESSION_STORE={SESSION_ID:"sessionId"},(a=t.REACTION_ACTION||(t.REACTION_ACTION={})).REACTION_ADDED="message_reaction_added",a.REACTION_REMOVED="message_reaction_removed",t.API_ERROR_CODES={AUTH_ERR_AUTH_TOKEN_NOT_FOUND:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND"},t.PROSODY_API={DOMAIN_PREFIX:"xmpp",PATH:{ROOM:"room",ROOM_SIZE:"room-size",SESSIONS:"sessions"},RESPONSE:{PARTICIPANTS:"participants"},QUERY_PARAMETERS:{DOMAIN:"domain",ROOM:"room"}},t.ProsodyApiErrors={INVALID_SESSIONID:{code:"ERROR_INVALID_SESSIONID",name:"ERROR_INVALID_SESSIONID",message:"The provided sessionId cannot be null or empty. Please provide a valid sessionId.",details:""},INVALID_TYPE:{code:"ERROR_INVALID_TYPE",name:"ERROR_INVALID_TYPE",message:"The provided type cannot be null or empty. Please provide a valid type.",details:""}},t.JWT_API={KEYS:{PASSTHROUGH:"passthrough",EXPAND:"expand"}},t.ONLINE_MEMBER_COUNT_API={ENDPOINTS:{GET_ONLINE_MEMBER_COUNT:"api/%s/online-members"},RESPONSE:{ONLINE_USERS_COUNT:"onlineUsersCount",GROUPS:"groups"},ERRORS:{INVALID_GROUPLIST:{code:"ERROR_INVALID_GROUPLIST",name:"ERROR_INVALID_GROUPLIST",message:"Grouplist cannot be null or empty.",details:""}}},t.ADDITIONAL_CONSTANTS={SECURE_URL_PROPERTY:"fat"},t.AI_FEATURE_ACCESSIBLE="features.ai.accessible",t.AI_FEATURE_ENABLED="features.ai.enabled",t.AI_SLUG_ACCESSIBLE="features.ai.%s.accessible",t.AI_SLUG_ENABLED="features.ai.%s.enabled"},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatException=void 0;var o=function(e){null!==e.code&&void 0!==e.code&&""!==e.code&&(this.code=e.code),null!==e.name&&void 0!==e.name&&""!==e.name&&(this.name=e.name),null!==e.message&&void 0!==e.message&&""!==e.message&&(this.message=e.message),null!==e.details&&void 0!==e.details&&""!==e.details&&(this.details=e.details)};t.CometChatException=o},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.Me=t.User=void 0;var r=n(2),i=n(10),a=n(1),E=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];if(this.hasBlockedMe=!1,this.blockedByMe=!1,this.deactivatedAt=0,1===e.length)typeof e[0]===a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?this.uid=e[0]:(this.uid=e[0].uid,this.name=e[0].name,e[0].authToken&&(this.authToken=e[0].authToken),e[0].avatar&&(this.avatar=e[0].avatar),e[0].lastActiveAt&&(this.lastActiveAt=e[0].lastActiveAt),e[0].link&&(this.link=e[0].link),e[0].metadata&&(this.metadata=e[0].metadata),e[0].role&&(this.role=e[0].role),e[0].statusMessage&&(this.statusMessage=e[0].statusMessage),e[0].status&&"offline"!==e[0].status?this.status="online":this.status="offline",e[0].tags&&(this.tags=e[0].tags),e[0].deactivatedAt&&(this.deactivatedAt=e[0].deactivatedAt));else{if(2!==e.length)throw new r.CometChatException(i.ERRORS.PARAMETER_MISSING);this.uid=e[0],this.name=e[1]}}return e.prototype.getUid=function(){return this.uid.toString()},e.prototype.setUid=function(e){this.uid=e},e.prototype.getName=function(){return this.name.toString()},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getAuthToken=function(){return this.authToken},e.prototype.setAuthToken=function(e){this.authToken=e},e.prototype.getAvatar=function(){return this.avatar},e.prototype.setAvatar=function(e){this.avatar=e},e.prototype.getLastActiveAt=function(){return this.lastActiveAt},e.prototype.setLastActiveAt=function(e){this.lastActiveAt=e},e.prototype.getLink=function(){return this.link},e.prototype.setLink=function(e){return this.link=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getRole=function(){return this.role},e.prototype.setRole=function(e){this.role=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getStatusMessage=function(){return this.statusMessage},e.prototype.setStatusMessage=function(e){this.statusMessage=e},e.prototype.setBlockedByMe=function(e){this.blockedByMe=e},e.prototype.getBlockedByMe=function(){return this.blockedByMe},e.prototype.setHasBlockedMe=function(e){this.hasBlockedMe=e},e.prototype.getHasBlockedMe=function(){return this.hasBlockedMe},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.setDeactivatedAt=function(e){this.deactivatedAt=e},e.prototype.getDeactivatedAt=function(){return this.deactivatedAt},e}(),c=function(n){function e(e){var t=n.call(this,e)||this;return t.wsChannel=e.wsChannel,e.jwt&&(t.jwt=e.jwt),e.fat&&(t.fat=e.fat),t}return s(e,n),e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.getJWT=function(){return this.jwt},e.prototype.getFat=function(){return this.fat},e}(t.User=E);t.Me=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KEYS=t.AUTH=t.MESSAGE=t.PRESENCE=t.INTERACTION_RECEIPT=t.RECEIPTS=t.TRANSIENT_MESSAGE=t.MESSAGE_REACTION=t.TYPING_INDICATOR=t.LOGOUT_REASON=t.LOGOUT_CODE=t.READY_STATE=t.WS=void 0,t.WS={protocol:"wss://"},t.READY_STATE={CONNECTING:0,OPEN:1,CLOSING:2,CLOSED:3,INVALID_JWT:4},t.LOGOUT_CODE=1e3,t.LOGOUT_REASON="User logged out",t.TYPING_INDICATOR={TYPE:"typing_indicator",ACTION:{STARTED:"started",ENDED:"ended"}},t.MESSAGE_REACTION={TYPE:"reaction",ACTION:{ADDED:"message_reaction_added",REMOVED:"message_reaction_removed"}},t.TRANSIENT_MESSAGE={TYPE:"transient_message"},t.RECEIPTS={TYPE:"receipts",ACTION:{READ:"read",DELIVERED:"delivered",READ_BY_ALL:"readByAll",DELIVERED_TO_ALL:"deliveredToAll"},RECEIPT_TYPE:{READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERY_TO_ALL_RECEIPT:"deliveredToAll"}},t.INTERACTION_RECEIPT={TYPE:"interaction_completed"},t.PRESENCE={TYPE:"presence",ACTION:{ONLINE:"online",AVAILABLE:"available",OFFLINE:"offline"}},t.MESSAGE={TYPE:"message"},t.AUTH={TYPE:"auth"},t.KEYS={TYPE:"type",ACTION:"action",APP_ID:"appId",RECEIVER:"receiver",RECEIVER_TYPE:"receiverType",DEVICE_ID:"deviceId",BODY:"body",USER:"user",METADATA:"metadata",MESSAGE_ID:"messageId",TIMESTAMP:"timestamp",STATUS:"status",CODE:"code",SENDER:"sender",MESSAGE_SENDER:"messageSender",PRESENCE_SUBSCRIPTION:"presenceSubscription",AUTH:"auth",PING:"ping",DATA:"data",PARAMS:"params",ACK:"ack",PONG:"pong",INTERACTIONS:"interactions",REACTION:"reaction",REACTED_AT:"reactedAt",REACTED_BY:"reactedBy",ID:"id",UID:"uid",CONVERSATION_ID:"conversationId",PARENT_ID:"parentId"}},function(e,t,n){"use strict";var C=this&&this.__assign||function(){return(C=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},E=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},c=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CometChat=void 0;var u=n(35),w=n(0),K=n(2),_=n(6),l=n(3),T=n(15),S=n(19),p=n(7),d=n(17),A=n(11),h=n(12),b=n(1),a=n(9),g=n(16),r=n(27),o=n(28),s=n(25),B=n(38),R=n(10),i=n(24),I=n(49),f=n(50),O=n(51),N=n(52),y=n(54),P=n(55),m=n(30),M=n(31),v=n(43),L=n(21),D=n(41),U=n(57),Y=n(58),F=n(59),V=n(42),x=n(29),k=n(20),J=n(60),H=n(61),W=n(62),G=n(44),j=n(4),X=n(73),q=n(36),z=n(39),Q=n(33),Z=n(22),$=n(37),ee=n(23),te=n(45),ne=n(74),oe=n(75),se=n(18),re=n(46),ie=n(32),ae=n(76),Ee=n(77),ce=W.WSConnectionHelper.getInstance(),ue=G.ListenerHandlers.getInstance(),Se=function(){function G(e){try{G.appId=e,G.localStorage=T.LocalStorage.getInstance(),G.keyStore=r.KeyStore.getInstance()}catch(e){w.Logger.error("CometChat: constructor",e)}}return G.setAuthToken=function(e){try{G.authToken=e}catch(e){w.Logger.error("CometChat: setAuthToken",e)}},G.prototype.getAuthToken=function(){try{return G.authToken}catch(e){w.Logger.error("CometChat: getAuthToken",e)}},G.getAppId=function(){try{return G.appId}catch(e){w.Logger.error("CometChat: getAppId",e)}},G.prototype.getApiKey=function(){try{return G.apiKey}catch(e){w.Logger.error("CometChat: getApiKey",e)}},G.getMode=function(){try{return G.mode}catch(e){w.Logger.error("CometChat: getMode",e)}},G.setMode=function(e){try{G.mode=e}catch(e){w.Logger.error("CometChat: getMode",e)}},G.getSessionId=function(){try{return G.sessionId}catch(e){w.Logger.error("CometChat: getSessionId",e)}},G.onStorageEvent=function(e){if(document&&!document.hasFocus()){var t=G.appId+":common_store/user";e.key===t&&null===e.newValue&&(G.authToken=void 0,G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),ce.WSLogout(),G.pushToLoginListener("","Logout_Success")),e.key===t&&null===e.oldValue&&T.LocalStorage.getInstance().get("user").then(function(e){e&&(G.user=new l.Me(e),G.setAuthToken(G.user.getAuthToken()),e.jwt&&(G.jwt=e.jwt),T.LocalStorage.getInstance().get("app_settings").then(function(e){if(e){if(e.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var t=parseInt(b.APPINFO.sdkVersion.charAt(1));e[b.APP_SETTINGS.KEYS.APP_VERSION]<t&&(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(e[b.APP_SETTINGS.KEYS.MODE]&&(G.mode=e[b.APP_SETTINGS.KEYS.MODE]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!e[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 l.User(G.user);G.pushToLoginListener(n,"Login_Success"),G.appSettings.shouldAutoEstablishSocketConnection()&&G.WSLogin(G.user)}}}))})}},G.beforeUnload=function(e){var t=G.getDataFromSessionStorage(b.SESSION_STORE.SESSION_ID);G.removeDataFromSessionStorage(b.SESSION_STORE.SESSION_ID),T.LocalStorage.getInstance().set(b.SESSION_STORE.SESSION_ID,t)},G.didAnalyticsPingStart=function(){try{return G.isAnalyticsPingStarted}catch(e){w.Logger.error("CometChat: didAnalyticsPingStart",e)}},G.getDataFromSessionStorage=function(e){if(window.sessionStorage)return window.sessionStorage.getItem(e)},G.addDataToSessionStorage=function(e,t){window.sessionStorage&&window.sessionStorage.setItem(e,t)},G.removeDataFromSessionStorage=function(e){window.sessionStorage&&window.sessionStorage.removeItem(e)},G.init=function(s,e){var o=this;return void 0===s&&(s=""),new Promise(function(n,t){try{"object"==typeof s&&(s.hasOwnProperty("appId")&&(s=s.appId),s.hasOwnProperty("appSettings")&&(e=s.appSettings)),w.isFalsy(e)?e=(new Y.AppSettingsBuilder).setRegion(Y.AppSettings.REGION_EU).build():e.getRegion()==Y.AppSettings.REGION_PRIVATE&&(e.region=s),o.appSettings=e,w.isFalsy(s)?t(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),T.LocalStorage.getInstance().get(b.SESSION_STORE.SESSION_ID).then(function(e){null==e||null==e?(G.sessionId=b.APPINFO.platform+"-"+b.APPINFO.sdkVersionWithUnderScore+"-"+Ee()+"-"+(new Date).getTime(),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId()),T.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID)):(G.sessionId=e.toLocaleString(),T.LocalStorage.getInstance().remove(b.SESSION_STORE.SESSION_ID),G.addDataToSessionStorage(b.SESSION_STORE.SESSION_ID,G.getSessionId())),T.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e)G.appId=s,G.getInstance(s),T.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,s),n(!0);else{var t=e.toLocaleString();t===s?(G.appId=t,G.getInstance(t),T.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_USER).then(function(e){e?(G.isLoggedOut=!1,G.user=new l.Me(e),new ne.PostDetails,G.setAuthToken(G.user.getAuthToken()),e.jwt&&(G.jwt=e.jwt),n(!0),T.LocalStorage.getInstance().get(b.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(e){if(e.hasOwnProperty(b.APP_SETTINGS.KEYS.APP_VERSION)){var t=parseInt(b.APPINFO.sdkVersion.charAt(1));e[b.APP_SETTINGS.KEYS.APP_VERSION]<t&&3!==e[b.APP_SETTINGS.KEYS.APP_VERSION]&&(o.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken()))}else o.appSettings.shouldAutoEstablishSocketConnection()||(G.shouldConnectToWS=!1),G.getInstance().internalRestart(G.user.getAuthToken());e[b.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(G.SECURED_MEDIA_HOST=e[b.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]),e[b.APP_SETTINGS.KEYS.MODE]&&(G.mode=e[b.APP_SETTINGS.KEYS.MODE]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(G.settingsHash=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH]),e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(G.settingsHashReceivedAt=e[b.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),G.isAnalyticsDisabled=!!e[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!o.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),ce&&!ce.connection&&o.appSettings.shouldAutoEstablishSocketConnection()&&(G.isConnectingFromInit=!0,G.WSLogin(G.user))}})):n(!0)})):o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,ce.WSLogout(),G.appId=s,T.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,s),G.getInstance(s),n(!0)})}r.KeyStore.getInstance().get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var t=Ee(),n=(new Date).getTime(),o=s+"_"+t+"_"+n;r.KeyStore.getInstance().set(b.LOCAL_STORE.KEY_DEVICE_ID,o)}})})}))}catch(e){t(new K.CometChatException(e))}})},G.isInitialized=function(){try{return this.initialzed}catch(e){w.Logger.error("CometChat: isInitialized",e)}},G.getInstance=function(e){try{return this.cometChat||(this.cometChat=new G(e)),this.cometChat}catch(e){w.Logger.error("CometChat: getInstance",e)}},G.registerTokenForPushNotification=function(p,C){var l=this;return new Promise(function(u,S){try{G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(c){w.getAppSettings().then(function(e){var t="",n=c,o=b.APPINFO.platform,s=b.APPINFO.sdkVersion,r=e[b.APP_SETTINGS.KEYS.CHAT_API_VERSION];if(navigator&&(t=navigator.userAgent),null==n){var i=Ee(),a=(new Date).getTime();n=l.appId+"_"+i+"_"+a,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,n)}var E={platform:o,deviceId:n,appInfo:{version:s,apiVersion:r,userAgent:t,pushNotification:{fcmDeviceToken:p,settings:C}}};_.makeApiCall("updateMyDetails",{},E,!1).then(function(e){u("Token Registration successful")},function(e){S(new K.CometChatException(e.error))}).catch(function(e){S(new K.CometChatException(e))})},function(e){S(new K.CometChatException(e))})})}catch(e){S(new K.CometChatException(e))}})},G.pushToLoginListener=function(t,n){ue.loginHandlers.map(function(e){try{if(e._eventListener)switch(n){case"Login_Success":w.isFalsy(e._eventListener.loginSuccess)||e._eventListener.loginSuccess(t);break;case"Login_Failure":w.isFalsy(e._eventListener.loginFailure)||e._eventListener.loginFailure(t);break;case"Logout_Success":w.isFalsy(e._eventListener.logoutSuccess)||e._eventListener.logoutSuccess()}}catch(e){w.Logger.error("ConnectionHandlers: onConnected Status",e)}})},G.login=function(){for(var E=this,c=[],e=0;e<arguments.length;e++)c[e]=arguments[e];return new Promise(function(i,a){try{if(G.loginInProgress){G.isLoggedOut=!0;var t=new K.CometChatException(R.LOGIN_ERROR.REQUEST_IN_PROGRESS);return a(t)}G.loginInProgress=!0,G.isConnectingFromInit=!1,G.localStorage.get(b.LOCAL_STORE.KEY_APP_ID).then(function(e){if(null==e||null==e){var t=new K.CometChatException(R.LOGIN_ERROR.NOT_INITIALIZED);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}var n=e.toLocaleString();if(E.getInstance(n),G.appId=n,T.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_ID,n),"object"==typeof c[0]){var o=c[0];c[0].hasOwnProperty("authToken")?c[0]=o.authToken:c[0].hasOwnProperty("username")&&c[0].hasOwnProperty("apiKey")&&(c[0]=o.username,c[1]=o.apiKey)}if(2==c.length){if(w.isFalsy(c[0])||w.isFalsy(c[1])){t=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}}else{if(1!=c.length){t=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}if(w.isFalsy(c[0])){var t=new K.CometChatException(R.ERRORS.PARAMETER_MISSING);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}}if(w.isFalsy(E.getAppId())){t=new K.CometChatException(R.LOGIN_ERROR.NOT_INITIALIZED);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}return G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(r){if(2==c.length){G.apiKey=c[1];var e=c[0];if(null!=r&&r.uid!==c[0])G.localStorage.clearStore().then(function(){ce.WSLogout(),G.generateAuthToken(e).then(function(e){G.user=new l.Me(e),G.setAuthToken(G.user.getAuthToken()),G.getLoggedInUser().then(function(e){(G.user=new l.Me(e)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var t=G.user;t.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",t);var n=new l.User(t);i(n),G.isConnectingFromInit||G.internalRestart||(G.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(G.user)},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})});else{if(!w.isFalsy(G.authToken)){var t=new l.User(E.user);return G.internalRestart||(G.pushToLoginListener(t,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.isLoggedOut=!1,i(t)}if(!w.isFalsy(e)){if(w.isFalsy(G.apiKey)){var n=new K.CometChatException(R.LOGIN_ERROR.UNAUTHORISED);return G.internalRestart||G.pushToLoginListener(n,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(n)}E.generateAuthToken(e).then(function(e){E.user=new l.Me(e),E.setAuthToken(G.user.getAuthToken()),E.getLoggedInUser().then(function(e){E.user=new l.Me(e),E.user.setAuthToken(G.authToken),E.setAuthToken(E.user.getAuthToken()),ce.WSLogout();var t=E.user;t.setStatus(b.PresenceConstatnts.STATUS.ONLINE),E.localStorage.set("user",t);var n=new l.User(t);i(n),G.isConnectingFromInit||G.internalRestart||(G.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&E.WSLogin(E.user)},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})}}}else G.authToken=c[0],E.getLoggedInUser().then(function(e){if(e.authToken!=c[0]){var o=E;o.localStorage.clearStore().then(function(){ce.WSLogout(),o.getLoggedInUser().then(function(e){(G.user=new l.Me(e)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var t=G.user;t.setStatus(b.PresenceConstatnts.STATUS.ONLINE),o.localStorage.set("user",t);var n=new l.User(t);i(n),G.isConnectingFromInit||G.internalRestart||(G.pushToLoginListener(n,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(new l.Me(e))},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})})}else{if(r){var t=new l.User(e);return G.internalRestart||(G.pushToLoginListener(t,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.isLoggedOut=!1,i(t)}(G.user=new l.Me(e)).setAuthToken(G.authToken),G.setAuthToken(G.user.getAuthToken());var n=G.user;n.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",n);var s=new l.User(n);i(s),G.isConnectingFromInit||G.internalRestart||(G.pushToLoginListener(s,"Login_Success"),new ne.PostDetails),G.loginInProgress=!1,G.didAnalyticsPingStart()||G.isAnalyticsDisabled||!G.appSettings.shouldAutoEstablishSocketConnection()||(G.pingAnalytics(),G.startAnalyticsPingTimer()),G.isLoggedOut=!1,(G.appSettings.shouldAutoEstablishSocketConnection()||G.internalRestart)&&G.shouldConnectToWS&&G.WSLogin(new l.Me(e))}},function(e){return G.internalRestart||G.pushToLoginListener(e,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(e)})})})}catch(e){t=new K.CometChatException(e);return G.internalRestart||G.pushToLoginListener(t,"Login_Failure"),G.loginInProgress=!1,G.isLoggedOut=!0,a(t)}})},G.sendMessage=function(a){var e=this;return new Promise(function(r,i){return E(e,void 0,void 0,function(){var t,n,o,s=this;return c(this,function(e){try{return a instanceof d.TextMessage||a instanceof S.MediaMessage||a instanceof L.CustomMessage||a instanceof Z.InteractiveMessage||(a=a[b.MessageConstatnts.KEYS.ATTATCHMENT]?(t=b.MessageConstatnts.TYPE.FILE,w.isImage(a[b.MessageConstatnts.KEYS.ATTATCHMENT])?t=b.MessageConstatnts.TYPE.IMAGE:w.isAudio(a[b.MessageConstatnts.KEYS.ATTATCHMENT])?t=b.MessageConstatnts.TYPE.AUDIO:w.isVideo(a[b.MessageConstatnts.KEYS.ATTATCHMENT])&&(t=b.MessageConstatnts.TYPE.VIDEO),new S.MediaMessage(a[b.MessageConstatnts.KEYS.RECEIVER_ID],a[b.MessageConstatnts.KEYS.ATTATCHMENT],t,a[b.MessageConstatnts.KEYS.RECEIVER_TYPE])):new d.TextMessage(a[b.MessageConstatnts.KEYS.RECEIVER_ID],a[b.MessageConstatnts.KEYS.TEXT],a[b.MessageConstatnts.KEYS.RECEIVER_TYPE])),(n=w.validateMessage(a))instanceof K.CometChatException?(i(n),[2]):(a.receiver=a.receiverId,delete a.receiverId,o=a.parentMessageId,[2,_.makeApiCall(o?"sendMessageInThread":"sendMessage",o?{parentId:o}:{},a,a instanceof S.MediaMessage).then(function(n){return E(s,void 0,void 0,function(){var t;return c(this,function(e){return t=A.MessageController.trasformJSONMessge(n.data),m.MessageListnerMaping.getInstance().set("all",parseInt(t.id)),r(t),[2]})})},function(e){i(new K.CometChatException(e.error))})])}catch(e){i(new K.CometChatException(e))}return[2]})})})},G.sendDirectMessage=function(e){try{return Object.assign(e,{receiverType:b.MessageConstatnts.RECEIVER_TYPE.USER}),this.sendMessage(e)}catch(e){w.Logger.error("CometChat: sendDirectMessage",e)}},G.sendGroupMessage=function(e){try{return Object.assign(e,{receiverType:b.MessageConstatnts.RECEIVER_TYPE.GROUP}),this.sendMessage(e)}catch(e){w.Logger.error("CometChat: sendGroupMessage",e)}},G.sendMediaMessage=function(e){try{return this.sendMessage(e)}catch(e){w.Logger.error("CometChat: sendMediaMessage",e)}},G.sendCustomMessage=function(e){try{return this.sendMessage(e)}catch(e){w.Logger.error("CometChat: sendCustomMessage",e)}},G.sendInteractiveMessage=function(e){try{return this.sendMessage(e)}catch(e){w.Logger.error("CometChat: sendInteractiveMessage",e)}},G.getLastDeliveredMessageId=function(){return E(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,m.MessageListnerMaping.getInstance().get(b.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST)];case 1:return[2,e.sent()];case 2:return t=e.sent(),w.Logger.error("CometChat: getLastDeliveredMessageId",t),[3,3];case 3:return[2]}})})},G.startTyping=function(e){try{if(w.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,o={};if(e instanceof M.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[b.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[b.TYPING_NOTIFICATION.RECEIVER_TYPE]),e.hasOwnProperty(b.TYPING_NOTIFICATION.META)&&(o=e[b.TYPING_NOTIFICATION.META])}if(w.isFalsy(t))return;if(null==v.TypingNotificationController.getTypingStartedMap(t)){var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(ce.startTypingIndicator(t,n,o),v.TypingNotificationController.addTypingStarted(t),void v.TypingNotificationController.removeTypingEnded(t)):void 0}}catch(e){w.Logger.error("CometChat: startTyping",e)}},G.endTyping=function(e){try{if(w.isFalsy(e))return;var t=void 0,n=this.RECEIVER_TYPE.USER,o={};if(e instanceof M.TypingIndicator)t=e.getReceiverId(),n=e.getReceiverType(),o=e.getMetadata();else{if(!e.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_ID))return;t=e[b.TYPING_NOTIFICATION.RECEIVER_ID],e.hasOwnProperty(b.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(n=e[b.TYPING_NOTIFICATION.RECEIVER_TYPE]),n=n==this.RECEIVER_TYPE.USER?b.WS.CONVERSATION.TYPE.CHAT:b.WS.CONVERSATION.TYPE.GROUP_CHAT,e.hasOwnProperty(b.TYPING_NOTIFICATION.META)&&(o=e[b.TYPING_NOTIFICATION.META])}if(w.isFalsy(t))return;if(null==v.TypingNotificationController.getTypingEndedMap(t)){var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&s!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(ce.pauseTypingIndicator(t,n,o),v.TypingNotificationController.addTypingEnded(t),void v.TypingNotificationController.removeTypingStarted(t)):void 0}}catch(e){w.Logger.error("CometChat: endTyping",e)}},G.markAsRead=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(e,t){try{var n=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return t(new K.CometChatException(b.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(w.isFalsy(E[0])||"string"!=typeof E[0])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(n=E[0],w.isFalsy(E[1])||"string"!=typeof E[1])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],w.isFalsy(E[2])||"string"!=typeof E[2])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],w.isFalsy(E[3])||"string"!=typeof E[3])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsRead() expects either 1 or 4 arguments."))));if(w.isFalsy(E[0])||!(E[0]instanceof p.BaseMessage))return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];n=i.getId().toString(),o=(s=i.getReceiverType())===b.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===G.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=G.getMode();return w.isFalsy(a)||a&&a!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?G.getConnectionStatus()===b.CONNECTION_STATUS.CONNECTED?(ce.markAsRead(o,s,n,r),e()):t(new K.CometChatException(b.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):t(new K.CometChatException(b.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(e){return w.Logger.error("CometChat: markAsRead",e),t(new K.CometChatException(b.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},G.markAsDelivered=function(){for(var E=[],e=0;e<arguments.length;e++)E[e]=arguments[e];return new Promise(function(e,t){try{var n=void 0,o=void 0,s=void 0,r=void 0;if(3===E.length)return t(new K.CometChatException(b.ReceiptErrors.MISSING_PARAMETERS));if(4===E.length){if(w.isFalsy(E[0])||"string"!=typeof E[0])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(n=E[0],w.isFalsy(E[1])||"string"!=typeof E[1])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(o=E[1],w.isFalsy(E[2])||"string"!=typeof E[2])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(s=E[2],w.isFalsy(E[3])||"string"!=typeof E[3])return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));r=E[3]}else{if(1!==E.length)return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsDelivered() expects either 1 or 4 arguments."))));if(w.isFalsy(E[0])||!(E[0]instanceof p.BaseMessage))return t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var i=E[0];n=i.getId().toString(),o=(s=i.getReceiverType())===b.MessageConstatnts.RECEIVER_TYPE.USER?i.getSender().getUid()===G.user.getUid()?i.getReceiverId():i.getSender().getUid():i.getReceiverId(),r=i.getSender().getUid()}var a=G.getMode();return w.isFalsy(a)||a&&a!==b.APP_SETTINGS.KEYS.NO_TRANSIENT&&a!==b.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?G.getConnectionStatus()===b.CONNECTION_STATUS.CONNECTED?(ce.markAsDelivered(o,s,n,r),e()):t(new K.CometChatException(b.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):t(new K.CometChatException(b.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(e){return w.Logger.error("CometChat: markAsDelivered",e),t(new K.CometChatException(b.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},G.markAsUnread=function(r){var i=this;return new Promise(function(t,n){try{var e=void 0;if(w.isFalsy(r)||!(r instanceof p.BaseMessage))return n(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));e=r.getId().toString();var o={},s="";r.getReceiverType()===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(s="markGroupMessagesAsUnread",o.guid=r.getReceiverId()):(s="markUserMessagesAsUnread",i.user&&r.getSender().getUid()===i.user.getUid()?o.uid=r.getReceiverId():o.uid=r.getSender().getUid()),_.makeApiCall(s,o,{messageId:e}).then(function(e){return t("Messages marked as unread successfully.")},function(e){return n(new K.CometChatException(e.error))})}catch(e){return w.Logger.error("CometChat: markAsUnread",e),n(new K.CometChatException(e))}})},G.sendTransientMessage=function(e){try{if(w.isFalsy(e))return;var t=void 0,n=void 0,o={};if(!(e instanceof Q.TransientMessage))return;if(t=e.getReceiverId(),n=e.getReceiverType(),o=e.getData(),w.isFalsy(t)||w.isFalsy(n))return;var s=G.getMode();return w.isFalsy(s)||s&&s!==b.APP_SETTINGS.KEYS.NO_TRANSIENT?void ce.sendTransientMessage(t,n,o):void 0}catch(e){w.Logger.error("CometChat: sendTransientMessage",e)}},G.sendTestMessage=function(o){return E(this,void 0,void 0,function(){var t,n;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(t=o)instanceof p.BaseMessage?[3,2]:[4,F.CometChatHelper.processMessage(o)];case 1:t=e.sent(),e.label=2;case 2:return t instanceof d.TextMessage&&W.WSConnectionHelper.getInstance().publishMessage(t),[3,4];case 3:return n=e.sent(),w.Logger.error("CometChat: sendTestMessage",n),[3,4];case 4:return[2]}})})},G.getMessageDetails=function(e){return new Promise(function(t,n){try{w.isFalsy(e)?n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):_.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data))},function(e){w.Logger.error("CometChat:GetMessageDetails:",e),n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.getMessageReceipts=function(o){return new Promise(function(t,n){try{var e=w.validateMsgId(o);if(e instanceof K.CometChatException)return void n(e);w.isFalsy(o)?n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):_.makeApiCall("getMessageDetails",{messageId:o}).then(function(e){A.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new K.CometChatException(e))})},function(e){w.Logger.error("CometChat:GetMessageDetails:",e),n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.getUnreadMessageCount=function(n){void 0===n&&(n=!1);var s=0;return new Promise(function(o,t){try{var e=w.validateHideMessagesFromBlockedUsers(n);if(e instanceof K.CometChatException)return void t(e);n&&(s=1),_.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:s}).then(function(e){var t={},n={};e.data.map(function(e){e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP?n[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),o({users:t,groups:n})},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getUnreadMessageCountForAllUsers=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,t){try{var e=w.validateHideMessagesFromBlockedUsers(o);if(e instanceof K.CometChatException)return void t(e);o&&(s=1),_.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:b.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(C({},t))},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getUnreadMessageCountForAllGroups=function(o){void 0===o&&(o=!1);var s=0;return new Promise(function(n,t){try{var e=w.validateHideMessagesFromBlockedUsers(o);if(e instanceof K.CometChatException)return void t(e);o&&(s=1),_.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:s,receiverType:b.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(C({},t))},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getUnreadMessageCountForUser=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=w.validateId(s,"user");if(e instanceof K.CometChatException)return void t(e);var o=w.validateHideMessagesFromBlockedUsers(r);if(o instanceof K.CometChatException)return void t(o);r&&(i=1),_.makeApiCall("getUserMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,uid:s}).then(function(e){var t={};e.data.map(function(e){t[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(C({},t))},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getUnreadMessageCountForGroup=function(s,r){void 0===r&&(r=!1);var i=0;return new Promise(function(n,t){try{var e=w.validateId(s,"group");if(e instanceof K.CometChatException)return void t(e);var o=w.validateHideMessagesFromBlockedUsers(r);if(o instanceof K.CometChatException)return void t(o);r&&(i=1),_.makeApiCall("getGroupMessages",{listId:s},{hideMessagesFromBlockedUsers:i,unread:1,count:1,guid:s}).then(function(e){var t={};e.data.map(function(e){e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==b.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[b.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(C({},t))},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.addReaction=function(o,s){return new Promise(function(n,t){try{var e=w.validateMsgId(o);if(e instanceof K.CometChatException)return void t(e);w.isFalsy(o)||w.isFalsy(s)?t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):_.makeApiCall("addReaction",{messageId:o,reaction:encodeURIComponent(s)}).then(function(e){var t=A.MessageController.trasformJSONMessge(e.data);n(t)},function(e){w.Logger.error("CometChat:addReaction:",e),t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.removeReaction=function(o,s){return new Promise(function(n,t){try{var e=w.validateMsgId(o);if(e instanceof K.CometChatException)return void t(e);w.isFalsy(o)||w.isFalsy(s)?t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):_.makeApiCall("removeReaction",{messageId:o,reaction:encodeURIComponent(s)}).then(function(e){var t=A.MessageController.trasformJSONMessge(e.data);n(t)},function(e){w.Logger.error("CometChat:removeReaction:",e),t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.editMessage=function(o){return new Promise(function(t,n){try{var e=w.validateMsgId(o.getId());if(e instanceof K.CometChatException)return void n(e);_.makeApiCall("updateMessage",{messageId:o.getId()},o).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.deleteMessage=function(o){return new Promise(function(t,n){try{var e=w.validateMsgId(o);if(e instanceof K.CometChatException)return void n(e);_.makeApiCall("deleteMessage",{messageId:o},{id:o}).then(function(e){t(A.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.getOnlineUserCount=function(){return new Promise(function(o,s){try{w.getAppSettings().then(function(e){var t=w.format((new u.EndpointFactory).wsApi,w.getChatHost(e),w.format(b.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[b.APP_SETTINGS.KEYS.WS_API_VERSION])),n={appId:G.appId,Authorization:G.jwt,Accept:"application/json","Content-Type":"application/json"};_.postData(t,"POST",{},n,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ONLINE_MEMBER_COUNT_API.RESPONSE.ONLINE_USERS_COUNT]):s(new K.CometChatException(e.error))}).catch(function(){var e={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return s(e)})},function(e){return s(new K.CometChatException(e))})}catch(e){return s(new K.CometChatException(e))}})},G.getOnlineGroupMemberCount=function(i){return new Promise(function(s,r){try{if(!i||0==i.length)return r(new K.CometChatException(b.ONLINE_MEMBER_COUNT_API.ERRORS.INVALID_GROUPLIST));w.getAppSettings().then(function(e){var t=w.format((new u.EndpointFactory).wsApi,w.getChatHost(e),w.format(b.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,e[b.APP_SETTINGS.KEYS.WS_API_VERSION])),n={groups:i},o={appId:G.appId,Authorization:G.jwt,Accept:"application/json","Content-Type":"application/json"};_.postData(t,"POST",n,o,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?s(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ONLINE_MEMBER_COUNT_API.RESPONSE.GROUPS]):r(new K.CometChatException(e.error))}).catch(function(){var e={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return r(e)})},function(e){return r(new K.CometChatException(e))})}catch(e){return r(new K.CometChatException(e))}})},G.createUser=function(s,r){return new Promise(function(n,t){try{if(w.isFalsy(r))return void t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));G.apiKey=r;var e=w.validateCreateUser(s);if(e instanceof K.CometChatException)return void t(e);if(!(s instanceof l.User)){var o=void 0;if(!s.hasOwnProperty(b.UserConstants.UID))return void t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(b.UserConstants.NAME))return void t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));o=new l.User(s[b.UserConstants.UID],s[b.UserConstants.NAME]),s.hasOwnProperty(b.UserConstants.AVATAR)&&o.setAvatar(s[b.UserConstants.AVATAR]),s.hasOwnProperty(b.UserConstants.ROLE)&&o.setRole(s[b.UserConstants.ROLE]),s.hasOwnProperty(b.UserConstants.META_DATA)&&o.setMetadata(s[b.UserConstants.META_DATA]),s.hasOwnProperty(b.UserConstants.LINK)&&o.setLink(s[b.UserConstants.LINK]),s.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&o.setStatusMessage(s[b.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(b.UserConstants.TAGS)&&o.setTags(s[b.UserConstants.TAGS]),s=o}_.makeApiCall("createUser",{},s).then(function(e){var t=h.UsersController.trasformJSONUser(e.data);n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.updateUser=function(o,i){var a=this;return new Promise(function(s,t){try{if(w.isFalsy(i))return void t(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));G.apiKey=i;var e=w.validateUpdateUser(o);if(e instanceof K.CometChatException)return void t(e);if(!(o instanceof l.User)){var n=void 0;if(!o.hasOwnProperty(b.UserConstants.UID))return void t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));n=new l.User(o[b.UserConstants.UID]),o.hasOwnProperty(b.UserConstants.NAME)&&n.setName(o[b.UserConstants.NAME]),o.hasOwnProperty(b.UserConstants.AVATAR)&&n.setAvatar(o[b.UserConstants.AVATAR]),o.hasOwnProperty(b.UserConstants.ROLE)&&n.setRole(o[b.UserConstants.ROLE]),o.hasOwnProperty(b.UserConstants.META_DATA)&&n.setMetadata(o[b.UserConstants.META_DATA]),o.hasOwnProperty(b.UserConstants.LINK)&&n.setLink(o[b.UserConstants.LINK]),o.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(o[b.UserConstants.STATUS_MESSAGE]),o.hasOwnProperty(b.UserConstants.TAGS)&&n.setTags(o[b.UserConstants.TAGS]),o=n}var r=o.uid;_.makeApiCall("updateUser",{uid:r},o).then(function(o){if(a.user&&r.toLocaleLowerCase()===a.user.getUid().toLocaleLowerCase())T.LocalStorage.getInstance().get("user").then(function(e){if(e){var t=h.UsersController.trasformJSONUser(o.data),n=o.data;n.wsChannel=e.wsChannel,n.authToken=G.authToken,n.status=b.PresenceConstatnts.STATUS.ONLINE,e.jwt&&(n.jwt=e.jwt),G.user=new l.Me(n),a.localStorage.set("user",G.user),s(t)}});else{var e=h.UsersController.trasformJSONUser(o.data);s(e)}},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.updateCurrentUserDetails=function(s){var r=this;return new Promise(function(o,t){try{s.uid=r.user.uid;var e=w.validateUpdateUser(s);if(e instanceof K.CometChatException)return void t(e);if(!(s instanceof l.User)){var n=void 0;s.hasOwnProperty(b.UserConstants.UID)&&(n=new l.User(s[b.UserConstants.UID])),s.hasOwnProperty(b.UserConstants.NAME)&&n.setName(s[b.UserConstants.NAME]),s.hasOwnProperty(b.UserConstants.AVATAR)&&n.setAvatar(s[b.UserConstants.AVATAR]),s.hasOwnProperty(b.UserConstants.ROLE)&&n.setRole(s[b.UserConstants.ROLE]),s.hasOwnProperty(b.UserConstants.META_DATA)&&n.setMetadata(s[b.UserConstants.META_DATA]),s.hasOwnProperty(b.UserConstants.LINK)&&n.setLink(s[b.UserConstants.LINK]),s.hasOwnProperty(b.UserConstants.STATUS_MESSAGE)&&n.setStatusMessage(s[b.UserConstants.STATUS_MESSAGE]),s.hasOwnProperty(b.UserConstants.TAGS)&&n.setTags(s[b.UserConstants.TAGS]),s=n}_.makeApiCall("updateMyDetails",{},s).then(function(e){var t=h.UsersController.trasformJSONUser(e.data),n=G.user=new l.Me(e.data);n.setStatus(b.PresenceConstatnts.STATUS.ONLINE),G.localStorage.set("user",n),o(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getUser=function(o){return new Promise(function(n,t){try{"object"==typeof o&&o.hasOwnProperty("uid")&&(o=o.uid);var e=w.validateId(o,"user");if(e instanceof K.CometChatException)return void t(e);_.makeApiCall("user",{uid:o}).then(function(e){var t=h.UsersController.trasformJSONUser(e.data);n(t)}).catch(function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getLoggedInUser=function(){var p=this;return new Promise(function(u,S){try{G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(e){if(e)G.user=new l.Me(e),u(G.user);else{var r="",i="",a=b.APPINFO.platform,E=b.APPINFO.sdkVersion,c=b.APPINFO.apiVersion;G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(i=e,navigator&&(r=navigator.userAgent),null==i){var t=Ee(),n=(new Date).getTime();i=p.appId+"_"+t+"_"+n,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,i)}var o={version:E,apiVersion:c,userAgent:r};w.isFalsy(p.platform)||(o.platform=p.platform),w.isFalsy(p.language)||(o.language=p.language),w.isFalsy(p.resource)||(o.resource=p.resource);var s={platform:a,deviceId:i,appInfo:o};_.makeApiCall("updateMyDetails",{},s,!1).then(function(e){e.data.jwt&&(G.jwt=e.data.jwt);var t=e.data.settings;t&&(T.LocalStorage.getInstance().set("app_settings",t),t[b.APP_SETTINGS.KEYS.MODE]&&G.setMode(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],t[b.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(G.SECURED_MEDIA_HOST=t[b.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST])),u(new l.Me(e.data))},function(e){S(new K.CometChatException(e.error))}).catch(function(e){S(new K.CometChatException(e))})})}})}catch(e){S(new K.CometChatException(e))}})},G.getLoggedinUser=function(){return new Promise(function(t,n){try{G.localStorage.get(b.LOCAL_STORE.KEY_USER).then(function(e){t(e?new l.User(e):null)},function(e){t(null)})}catch(e){n(new K.CometChatException(e))}})},G.blockUsers=function(o){return new Promise(function(t,n){try{var e=w.validateArray(o,"blockUsers");if(e instanceof K.CometChatException)return void n(e);w.isFalsy(o)?n(new K.CometChatException(R.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):_.makeApiCall("blockUsers",{},{blockedUids:o}).then(function(e){t(e.data)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.unblockUsers=function(o){return new Promise(function(t,n){try{var e=w.validateArray(o,"unblockUsers");if(e instanceof K.CometChatException)return void n(e);w.isFalsy(o)?n(new K.CometChatException(R.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):_.makeApiCall("unblockUsers",{},{blockedUids:o}).then(function(e){t(e.data)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.getConversation=function(i,a){return new Promise(function(n,o){try{var e=w.validateConversationType(a);if(e instanceof K.CometChatException)return void o(e);var t=w.validateId(i,a);if(t instanceof K.CometChatException)return void o(t);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversation",s.guid=i):(r="getUserConversation",s.uid=i),_.makeApiCall(r,s).then(function(e){if(e.data){var t=e.data;n(x.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else o(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){o(new K.CometChatException(e.error))})}catch(e){o(new K.CometChatException(e))}})},G.tagConversation=function(i,a,E){return void 0===E&&(E=[]),new Promise(function(n,o){try{var e=w.validateConversationType(a);if(e instanceof K.CometChatException)return void o(e);var t=w.validateId(i,a);if(t instanceof K.CometChatException)return void o(t);a=a.toLowerCase(),i=i.toLowerCase();var s={},r="";a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="updateGroupConversation",s.guid=i):(r="updateUserConversation",s.uid=i),_.makeApiCall(r,s,{tags:E}).then(function(e){if(e.data){var t=e.data;n(x.ConversationController.trasformJSONConversation(t.conversationId,t.conversationType,t.lastMessage,t.conversationWith,parseInt(t.unreadMessageCount),t.tags?t.tags:[],t.unreadMentionsCount,t.lastReadMessageId))}else o(new K.CometChatException(JSON.parse(w.format(JSON.stringify(b.ConversationErrors.CONVERSATION_NOT_FOUND),a,i))))},function(e){o(new K.CometChatException(e.error))})}catch(e){o(new K.CometChatException(e))}})},G.deleteConversation=function(i,a){return new Promise(function(t,n){try{var e=w.validateConversationType(a);if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(i,a);if(o instanceof K.CometChatException)return void n(o);var s={},r="";a=a.toLowerCase(),i=i.toLowerCase(),a===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="deleteGroupConversation",s.guid=i):(r="deleteUserConversation",s.uid=i),_.makeApiCall(r,s).then(function(e){t("Conversation deleted successfully.")},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.createGroup=function(s){return new Promise(function(t,n){try{var e=w.validateCreateGroup(s);if(e instanceof K.CometChatException)return void n(e);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(b.GroupConstants.KEYS.GUID))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(!s.hasOwnProperty(b.GroupConstants.KEYS.NAME))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));if(o=new a.Group(s[b.GroupConstants.KEYS.GUID],s[b.GroupConstants.KEYS.NAME],""),s.hasOwnProperty(b.GroupConstants.KEYS.TYPE))if(s[b.GroupConstants.KEYS.TYPE].toLocaleLowerCase()==b.GroupType.Password){if(!s.hasOwnProperty(b.GroupConstants.KEYS.PASSWORD))return void n(new K.CometChatException(R.GROUP_CREATION_ERRORS.EMPTY_PASSWORD));o.setType(b.GROUP_TYPE.PASSWORD),o.setPassword(s[b.GroupConstants.KEYS.PASSWORD])}else o.setType(s[b.GroupConstants.KEYS.TYPE]);else o.setType(b.GROUP_TYPE.PUBLIC);s.hasOwnProperty(b.GroupConstants.KEYS.ICON)&&o.setIcon(s[b.GroupConstants.KEYS.ICON]),s.hasOwnProperty(b.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[b.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(b.GroupConstants.KEYS.TAGS)&&o.setTags(s[b.GroupConstants.KEYS.TAGS]),s=o}_.makeApiCall("createGroup",{},s).then(function(e){g.GroupsController.trasformJSONGroup(e.data).setHasJoined(!0),t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.getGroup=function(o){return new Promise(function(t,n){try{"object"==typeof o&&o.hasOwnProperty("guid")&&(o=o.guid);var e=w.validateId(o,"group");if(e instanceof K.CometChatException)return void n(e);_.makeApiCall("getGroup",{guid:o}).then(function(e){t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.joinGroup=function(s,r,i){return void 0===r&&(r=b.GroupType.Public),void 0===i&&(i=""),new Promise(function(n,t){try{var e=w.validateJoinGroup(s,r,i);if(e instanceof K.CometChatException)return void t(e);var o=void 0;"object"==typeof s&&(s.hasOwnProperty(b.GroupConstants.KEYS.GUID)?(s.hasOwnProperty(b.GroupConstants.KEYS.TYPE)&&(r=s[b.GroupConstants.KEYS.TYPE],s[b.GroupConstants.KEYS.TYPE].toLocaleLowerCase()===b.GroupType.Password&&s.hasOwnProperty(b.GroupConstants.KEYS.PASSWORD)&&(i=s[b.GroupConstants.KEYS.PASSWORD])),s=s[b.GroupConstants.KEYS.GUID]):t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING))),o=w.isFalsy(i)?new a.Group(s,"name",r):new a.Group(s,"name",r,i),_.makeApiCall("joinGroup",o,o).then(function(e){var t=g.GroupsController.trasformJSONGroup(e.data[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ActionConstatnts.ACTION_KEYS.ENTITIES][b.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][b.ActionConstatnts.ACTION_KEYS.ENTITY]);t.setHasJoined(!0),n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.updateGroup=function(s){return new Promise(function(t,n){try{var e=w.validateUpdateGroup(s);if(e instanceof K.CometChatException)return void n(e);if(!(s instanceof a.Group)){var o=void 0;if(!s.hasOwnProperty(b.GroupConstants.KEYS.GUID))return void n(new K.CometChatException(R.ERRORS.PARAMETER_MISSING));o=new a.Group(b.GroupConstants.KEYS.GUID,"",""),s.hasOwnProperty(b.GroupConstants.KEYS.TYPE)?o.setType(s[b.GroupConstants.KEYS.TYPE]):(s[b.GroupConstants.KEYS.TYPE]=b.GROUP_TYPE.PUBLIC,o.setType[b.GROUP_TYPE.PUBLIC]),s.hasOwnProperty(b.GroupConstants.KEYS.NAME)&&o.setName(s[b.GroupConstants.KEYS.NAME]),s.hasOwnProperty(b.GroupConstants.KEYS.ICON)&&o.setIcon(s[b.GroupConstants.KEYS.ICON]),s.hasOwnProperty(b.GroupConstants.KEYS.DESCRIPTION)&&o.setDescription(s[b.GroupConstants.KEYS.DESCRIPTION]),s.hasOwnProperty(b.GroupConstants.KEYS.TAGS)&&o.setTags(s[b.GroupConstants.KEYS.TAGS]),s=o}_.makeApiCall("updateGroup",s,s).then(function(e){t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.deleteGroup=function(o){return new Promise(function(t,n){try{var e=w.validateId(o,"group");if(e instanceof K.CometChatException)return void n(e);_.makeApiCall("deleteGroup",{guid:o}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.leaveGroup=function(o){return new Promise(function(t,n){try{var e=w.validateId(o,"group");if(e instanceof K.CometChatException)return void n(e);_.makeApiCall("leaveGroup",{guid:o}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.kickGroupMember=function(s,r){return new Promise(function(t,n){try{var e=w.validateId(s,"group");if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);_.makeApiCall("kickGroupMembers",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.updateGroupMemberScope=function(r,i,a){return new Promise(function(t,n){try{var e=w.validateId(r,"group");if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(i,"user");if(o instanceof K.CometChatException)return void n(o);var s=w.validateScope(a);if(s instanceof K.CometChatException)return void n(s);_.makeApiCall("changeScopeOfMember",{guid:r,uid:i},{scope:a}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.banGroupMember=function(s,r){return new Promise(function(t,n){try{var e=w.validateId(s,"group");if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);_.makeApiCall("banGroupMember",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.unbanGroupMember=function(s,r){return new Promise(function(t,n){try{var e=w.validateId(s,"group");if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void n(o);_.makeApiCall("unbanGroupMember",{guid:s,uid:r}).then(function(e){t(!0)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.addMembersToGroup=function(i,a,E){var c=[],u=[],S=[],p=[];return new Promise(function(e,t){try{var n=w.validateId(i,"group");if(n instanceof K.CometChatException)return void t(n);var o=w.validateArray(a,"groupMembers");if(o instanceof K.CometChatException)return void t(o);if(E){var s=w.validateArray(E,"bannedMembers");if(s instanceof K.CometChatException)return void t(s)}w.isFalsy(a)&&w.isFalsy(E)?t(new K.CometChatException({})):w.isFalsy(a)||w.isFalsy(E)?w.isFalsy(a)?E.map(function(e){p.push(e)}):(a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){S.push(e.getUid())})):(a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){c.push(e.getUid())}),a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){u.push(e.getUid())}),a.filter(function(e){if(e.getScope()==b.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){S.push(e.getUid())}),E.map(function(e){p.push(e)}));var r={};w.isFalsy(c)||(r=C(C({},r),{admins:c})),w.isFalsy(S)||(r=C(C({},r),{participants:S})),w.isFalsy(u)||(r=C(C({},r),{moderators:u})),w.isFalsy(p)||(r=C(C({},r),{usersToBan:p})),_.makeApiCall("addMemebersToGroup",{guid:i},r).then(function(t){var n={};Object.keys(t.data.admins).map(function(e){t.data.admins[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.admins[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.participants).map(function(e){t.data.participants[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.participants[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.moderators).map(function(e){t.data.moderators[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.moderators[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(t.data.usersToBan).map(function(e){t.data.usersToBan[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?n[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:n[e]=t.data.usersToBan[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),e(n)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.transferGroupOwnership=function(s,r){return new Promise(function(n,t){try{var e=w.validateId(s,"group");if(e instanceof K.CometChatException)return void t(e);var o=w.validateId(r,"user");if(o instanceof K.CometChatException)return void t(o);_.makeApiCall("transferOwnership",{guid:s},{owner:r}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Ownership transferred to user "+r+" for the group with guid "+s+".",n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.createGroupWithMembers=function(i,a,E){var c=[],u=[],S=[],p=[];return new Promise(function(r,t){try{var e=w.validateCreateGroup(i);if(e instanceof K.CometChatException)return void t(e);if(a&&0<a.length){var n=w.validateArray(a,"groupMembers");if(n instanceof K.CometChatException)return void t(n);a.map(function(e){e.getScope()===b.GROUP_MEMBER_SCOPE.ADMIN&&c.push(e.getUid()),e.getScope()===b.GROUP_MEMBER_SCOPE.MODERATOR&&u.push(e.getUid()),e.getScope()===b.GROUP_MEMBER_SCOPE.PARTICIPANT&&S.push(e.getUid())})}if(E&&0<E.length){var o=w.validateArray(E,"bannedMembers");if(o instanceof K.CometChatException)return void t(o);E.map(function(e){p.push(e)})}var s={};s=C({},i),w.isFalsy(c)||(s.members=C(C({},s.members),{admins:c})),w.isFalsy(S)||(s.members=C(C({},s.members),{participants:S})),w.isFalsy(u)||(s.members=C(C({},s.members),{moderators:u})),w.isFalsy(p)||(s.members=C(C({},s.members),{usersToBan:p})),_.makeApiCall("createGroup",{},s).then(function(e){var t={members:{}},n=e.data.members.data?e.data.members.data:{admins:{},moderators:{},participants:{},usersToBan:{}};Object.keys(n.admins).map(function(e){n.admins[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.admins[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.participants).map(function(e){n.participants[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.participants[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.moderators).map(function(e){n.moderators[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.moderators[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.usersToBan).map(function(e){n.usersToBan[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.usersToBan[e][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][b.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),delete e.data.members;var o=e.data,s=g.GroupsController.trasformJSONGroup(o);s.setHasJoined(!0),t=C(C({},t),{group:s}),r(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.initiateCall=function(t){var s=this;return new Promise(function(n,o){var e=s.getActiveCall();if(null===e)try{w.isFalsy(JSON.parse(JSON.stringify(t)).sender)?w.isFalsy(e)?(t.setStatus(b.CallConstants.CALL_STATUS.INITIATED),t.receiver=t.receiverId.toString(),delete t.receiverId,_.makeApiCall("createCallSession",{},t).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);B.CallController.getInstance().initiateCall(t).then(function(e){n(t)}).catch(function(e){o(new K.CometChatException(e))})},function(e){o(new K.CometChatException(e.error))})):o(new K.CometChatException(b.CALL_ERROR.ERROR_IN_CALLING)):B.CallController.getInstance().initiateCall(t).then(function(e){n(Object.assign(t))}).catch(function(e){o(new K.CometChatException(e))})}catch(e){o(new K.CometChatException(e))}else o(new K.CometChatException(b.CALL_ERROR.CALL_ALREADY_INITIATED))})},G.acceptCall=function(o){var s=this;return new Promise(function(n,t){if(null===s.getActiveCall())try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.ONGOING,_.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);B.CallController.getInstance().onCallStarted(t),n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}else t(new K.CometChatException(b.CALL_ERROR.CANNOT_ACCEPT_CALL))})},G.rejectCall=function(e,t){try{switch(t){case b.CallConstants.CALL_STATUS.REJECTED:return this.rejectIncomingCall(e);case b.CallConstants.CALL_STATUS.CANCELLED:return this.cancelCall(e);case b.CallConstants.CALL_STATUS.BUSY:return this.sendBusyResponse(e);default:return this.endCall(e,!0)}}catch(e){w.Logger.error("CometChat: rejectCall",e)}},G.endCall=function(s,r){var i=this;return new Promise(function(n,t){w.isFalsy(r)&&(r=!1);var o=i.getActiveCall();if(null!==o){if(o.getSessionId()===s)try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.ENDED,o.getJoinedAt()&&(e[b.CallConstants.CALL_KEYS.CALL_JOINED_AT]=o.getJoinedAt()),_.makeApiCall("updateCallSession",{sessionid:s},e).then(function(e){r||B.CallController.getInstance().endSession();var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t),B.CallController.getInstance().endCall()},function(e){w.Logger.log("calling Log",{error:e}),r||B.CallController.getInstance().endSession(),o.setStatus(b.CallConstants.CALL_STATUS.ENDED),n(o),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(o),B.CallController.getInstance().endCall()})}catch(e){t(new K.CometChatException(e))}}else r||B.CallController.getInstance().endSession(),n(null),B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),B.CallController.getInstance().endCall()})},G.getActiveCall=function(){try{return B.CallController.getInstance().getActiveCall()}catch(e){w.Logger.error("CometChat: getActiveCall",e)}},G.clearActiveCall=function(){B.CallController.getInstance().clearActiveCall()},G.startCall=function(o,s,r){var i=this;try{var a,E,c,u,S,p,C,l,_,T,d=this.getActiveCall(),A=!1,h=!0,g=!0,R=!0,I=!0,f=!0,O=!0,N=!1,y=!1,P=b.CallConstants.CALL_MODE.DEFAULT,m=!1,M=!1,v=!1,L=!0,D=!0,U={},Y=this.user;u=(new J.VirtualBackgroundBuilder).build(),S=new J.MainVideoContainerSetting,w.getAppSettings().then(function(e){if(l=e[b.APP_SETTINGS.KEYS.WEBRTC_HOST],U[b.APP_SETTINGS.KEYS.ANALYTICS_HOST]=e[b.APP_SETTINGS.KEYS.ANALYTICS_HOST],U[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=e[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION],U[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=e[b.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],U[b.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=e[b.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],p=e[b.APP_SETTINGS.KEYS.REGION],w.isFalsy(r)||B.CallController.getInstance().setCallListner(r),w.isFalsy(i.appSettings))B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED));else if(p)if(Y)if((T=new H.RTCUser(Y.getUid())).setName(Y.getName()),T.setAvatar(Y.getAvatar()),T.setResource(G.getSessionId()),G.appId)if(C=G.appId,"string"==typeof o){if(d){var t=d.getType();A=t===b.CallConstants.CALL_TYPE.AUDIO,E=d.getSessionId()}else{if(w.isFalsy(o))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));E=("v1."+p+"."+G.getAppId()+"."+o).toLowerCase()}if(!E)return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));L=!!A;var n={uid:Y.getUid(),sessionId:E};G.getJWT(n).then(function(e){e.hasOwnProperty("token")?(T.setJWT(e.token),a=(new J.CallSettingsBuilder).setSessionID(E).enableDefaultLayout(h).setIsAudioOnlyCall(A).setUser(T).setRegion(p).setAppId(C).setDomain(l).showEndCallButton(I).showMuteAudioButton(R).showPauseVideoButton(g).showScreenShareButton(f).showModeButton(O).setMode(P).setAnalyticsSettings(U).startWithAudioMuted(N).startWithVideoMuted(y).showRecordingButton(m).startRecordingOnCallStart(M).forceLegacyUI(v).showSwitchToVideoCallButton(L).setVirtualBackground(u).showVirtualBackgroundSetting(D).setMainVideoContainerSetting(S).build(),B.CallController.getInstance().startCall(a,s)):B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.JWT_NOT_FOUND))},function(e){B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(e))})}else{if(w.isFalsy(o))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.CALL_SETTINGS_REQUIRED)));if(d){t=d.getType();A=t===b.CallConstants.CALL_TYPE.AUDIO,E=d.getSessionId()}else{if(A=o.isAudioOnlyCall(),w.isFalsy(o.getSessionId()))return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));E=("v1."+p+"."+G.getAppId()+"."+o.getSessionId()).toLowerCase()}if(!E)return void(B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.SESSION_ID_REQUIRED)));h=o.isDefaultLayoutEnabled(),g=o.isPauseVideoButtonEnabled(),R=o.isMuteAudioButtonEnabled(),I=o.isEndCallButtonEnabled(),f=o.isScreenShareButtonEnabled(),P=o.getMode(),_=o.getLocalizedStringObject(),c=o.getCustomCSS(),O=o.isModeButtonEnabled(),N=o.getStartWithAudioMuted(),y=o.getStartWithVideoMuted(),m=o.isRecordingButtonEnabled(),M=o.shouldStartRecordingOnCallStart(),v=o.shouldUseLegacyUI(),L=!!A&&o.isAudioToVideoButtonEnabled(),u=o.getVirtualBackground(),D=o.isVirtualBackgroundSettingEnabled(),S=o.getMainVideoContainerSetting();n={uid:Y.getUid(),sessionId:E};G.getJWT(n).then(function(e){e.hasOwnProperty("token")?(T.setJWT(e.token),a=(new J.CallSettingsBuilder).setSessionID(E).enableDefaultLayout(h).setIsAudioOnlyCall(A).setUser(T).setRegion(p).setAppId(C).setDomain(l).showEndCallButton(I).showMuteAudioButton(R).showPauseVideoButton(g).showScreenShareButton(f).showModeButton(O).setMode(P).setLocalizedStringObject(_).setCustomCSS(c).setAnalyticsSettings(U).startWithAudioMuted(N).startWithVideoMuted(y).showRecordingButton(m).startRecordingOnCallStart(M).forceLegacyUI(v).showSwitchToVideoCallButton(L).setVirtualBackground(u).showVirtualBackgroundSetting(D).setMainVideoContainerSetting(S).build(),B.CallController.getInstance().startCall(a,s)):B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.JWT_NOT_FOUND))},function(e){B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(e))})}else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED));else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_LOGGED_IN));else B.CallController.getInstance().getCallListner()&&B.CallController.getInstance().getCallListner()._eventListener.onError(new K.CometChatException(b.CALL_ERROR.NOT_INITIALIZED))},function(e){w.Logger.error("CometChat: startCall",e)})}catch(e){w.Logger.error("CometChat: startCall",e)}},G.getCallParticipantCount=function(E,c){return new Promise(function(i,a){try{w.getAppSettings().then(function(e){if(w.isFalsy(E))return a(new K.CometChatException(b.ProsodyApiErrors.INVALID_SESSIONID));if(w.isFalsy(c))return a(new K.CometChatException(b.ProsodyApiErrors.INVALID_TYPE));var t=e[b.APP_SETTINGS.KEYS.REGION],n={},o=e[b.APP_SETTINGS.KEYS.WEBRTC_HOST],s=e[b.APP_SETTINGS.KEYS.WEBRTC_API_SUBDOMAIN],r=w.format((new u.EndpointFactory).prosodyApi,s,o,b.PROSODY_API.PATH.ROOM_SIZE);"direct"===c.toLowerCase()&&(E=("v1."+t+"."+G.getAppId()+"."+E).toLowerCase()),n[b.PROSODY_API.QUERY_PARAMETERS.DOMAIN]=o,n[b.PROSODY_API.QUERY_PARAMETERS.ROOM]=E,_.postData(r,"GET",n,{},!1).then(function(e){return e.text()}).then(function(e){var t=e?JSON.parse(e):{};return t.hasOwnProperty(b.PROSODY_API.RESPONSE.PARTICIPANTS)?i(t[b.PROSODY_API.RESPONSE.PARTICIPANTS]):i(0)}).catch(function(){var e={error:R.FETCH_ERROR.ERROR_IN_API_CALL};return a(e)})},function(e){return a(new K.CometChatException(e))})}catch(e){return a(new K.CometChatException(e))}})},G.rejectIncomingCall=function(o){return new Promise(function(n,t){try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.REJECTED,_.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.cancelCall=function(o){var s=this;return new Promise(function(n,t){try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.CANCELLED,_.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);s.getActiveCall().getSessionId()===o&&B.CallController.getInstance().endCallSession(),n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.sendBusyResponse=function(o){return new Promise(function(n,t){try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.BUSY,_.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.sendUnansweredResponse=function(o){return new Promise(function(n,t){try{var e={};e[b.CallConstants.CALL_KEYS.CALL_STATUS]=b.CallConstants.CALL_STATUS.UNANSWERED,_.makeApiCall("updateCallSession",{sessionid:o},e).then(function(e){var t=A.MessageController.trasformJSONMessge(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);ce.publishCallMessage(t),n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.addConnectionListener=function(e,t){try{ue.addConnectionEventListener(e,t)}catch(e){w.Logger.error("CometChat: addConnectionListener",e)}},G.removeConnectionListener=function(e){try{ue.removeConnectionEventListener(e)}catch(e){w.Logger.error("CometChat: removeConnectionListener",e)}},G.addMessageListener=function(e,t){try{ue.addMessageEventListener(e,t)}catch(e){w.Logger.error("CometChat: addMessageListener",e)}},G.removeMessageListener=function(e){try{ue.removeMessageEventListener(e)}catch(e){w.Logger.error("CometChat: removeMessageListener",e)}},G.addCallListener=function(e,t){try{ue.addCallEventListener(e,t)}catch(e){w.Logger.error("CometChat: addCallListener",e)}},G.removeCallListener=function(e){try{ue.removeCallEventListener(e)}catch(e){w.Logger.error("CometChat: removeCallListener",e)}},G.addUserListener=function(e,t){try{ue.addUserEventListener(e,t)}catch(e){w.Logger.error("CometChat: addUserListener",e)}},G.removeUserListener=function(e){try{ue.removeUserEventListener(e)}catch(e){w.Logger.error("CometChat: removeUserListener",e)}},G.addGroupListener=function(e,t){try{ue.addGroupEventListener(e,t)}catch(e){w.Logger.error("CometChat: addGroupListener",e)}},G.removeGroupListener=function(e){try{ue.removeGroupEventListener(e)}catch(e){w.Logger.error("CometChat: removeGroupListener",e)}},G.addLoginListener=function(e,t){try{ue.addLoginEventListener(e,t)}catch(e){w.Logger.error("CometChat: addLoginListener",e)}},G.removeLoginListener=function(e){try{ue.removeLoginEventListener(e)}catch(e){w.Logger.error("CometChat: removeLoginListener",e)}},G.generateAuthToken=function(S){var p=this;return new Promise(function(o,s){try{var r={},i="",a="",E=b.APPINFO.platform,c=b.APPINFO.sdkVersion,u=b.APPINFO.apiVersion;navigator&&(a=navigator.userAgent),G.keyStore.get(b.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==(i=e)){var t=Ee(),n=(new Date).getTime();i=p.appId+"_"+t+"_"+n,G.keyStore.set(b.LOCAL_STORE.KEY_DEVICE_ID,i)}r={platform:E,deviceId:i,appInfo:{version:c,apiVersion:u,userAgent:a}},_.makeApiCall("authToken",{uid:S},r).then(function(e){o(e.data)}).catch(function(e){s(new K.CometChatException(e.error))})},function(e){w.Logger.error("Got error while fetching data from key store",e)})}catch(e){s(new K.CometChatException(e))}})},G.tryReconnectingToWS=function(){G.WSReconnectionInProgress||G.startWSReconnectionTimer()},G.prototype.makeWSConnection=function(){G.WSLogin(G.user)},G.prototype.accidentallyDisconnected=function(){G.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTING,ue.connectionHandlers.map(function(e){try{e._eventListener&&(w.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){w.Logger.error("ConnectionHandlers: inConnecting Status",e)}}),G.tryReconnectingToWS()},G.WSLogin=function(e){var n=this;ce.connection?w.Logger.error("CometChat :: WSLogin",ce.connection):ce.WSLogin(e.getJWT(),function(e){switch(e){case j.READY_STATE.CONNECTING:(t=G.getConnectionStatus())==b.CONNECTION_STATUS.DISCONNECTED&&(n.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTING,ue.connectionHandlers.map(function(e){try{e._eventListener&&(w.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){w.Logger.error("connectionHandlers: Connecting Status",e)}}));break;case j.READY_STATE.OPEN:(t=G.getConnectionStatus())==b.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=b.CONNECTION_STATUS.CONNECTED,ue.connectionHandlers.map(function(e){try{e._eventListener&&(w.isFalsy(e._eventListener.onConnected)||e._eventListener.onConnected())}catch(e){w.Logger.error("connectionHandlers: Connected Status",e)}})),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer();break;case j.READY_STATE.CLOSING:break;case j.READY_STATE.CLOSED:var t;(t=G.getConnectionStatus())!==b.CONNECTION_STATUS.DISCONNECTED&&t!==b.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=b.CONNECTION_STATUS.DISCONNECTED,ue.connectionHandlers.map(function(e){try{e._eventListener&&(w.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){w.Logger.error("connectionHandlers: Disconnected Status",e)}})),ce.connection&&(ce.connection=null),G.isLoggedOut||G.disconnectedByUser||n.tryReconnectingToWS()}})},G.pingAnalytics=function(){var c=this;try{G.keyStore.get("deviceId").then(function(E){w.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",o=E,s={version:b.SDKHeader.sdkVersion,apiVersion:e[b.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};w.isFalsy(c.resource)||(s.resource=c.resource),w.isFalsy(c.platform)||(s.platform=c.platform),w.isFalsy(c.language)||(s.language=c.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,uid:G.user.getUid(),userAgent:n,deviceId:o,platform:b.SDKHeader.platform};w.isFalsy(G.getSessionId())||(r.wsId=G.getSessionId());var i="https://"+e[b.APP_SETTINGS.KEYS.ANALYTICS_HOST]+"/"+e[b.APP_SETTINGS.KEYS.ANALYTICS_VERSION]+"/ping",a={appId:G.appId,sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),"Content-Type":"application/json"};G.settingsHash&&(a.settingsHash=G.settingsHash),G.settingsHashReceivedAt&&(a.settingsHashReceivedAt=G.settingsHashReceivedAt),G.jwt&&(a.Authorization="Bearer "+G.jwt),G.authToken&&(a.authToken=G.authToken),_.postData(i,"POST",r,a,!1).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA))w.Logger.log("Analytics Ping Request Data",e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);else if(e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_ERROR)){var t=e[b.ResponseConstants.RESPONSE_KEYS.KEY_ERROR];w.Logger.log("Analytics Ping Request Error",new K.CometChatException(t));var n=t.code;if(n===b.Errors.ERR_SETTINGS_HASH_OUTDATED){var o=G.authToken;G.getInstance().internalRestart(o)}n===b.Errors.ERR_NO_AUTH&&c.updateJWT()}}).catch(function(e){w.Logger.error("CometChat: pingAnalytics Fetch Error",e)})},function(e){w.Logger.error("CometChat: pingAnalytics getSettings Error",e)})},function(e){w.Logger.error("CometChat: pingAnalytics getDeviceId Error",e)})}catch(e){w.Logger.error("CometChat: pingAnalytics",e)}},G.updateJWT=function(){_.makeApiCall("getMyDetails",{},{},!1).then(function(e){var t=e.data,n=t.settings,o=new l.Me(t);if(G.user=o,t.hasOwnProperty("jwt")&&t.jwt&&(G.jwt=t.jwt),T.LocalStorage.getInstance().set("user",o),n&&n[b.APP_SETTINGS.KEYS.SETTINGS_HASH]&&G.settingsHash!==n[b.APP_SETTINGS.KEYS.SETTINGS_HASH]){var s=G.getInstance().getAuthToken();G.getInstance().internalRestart(s)}w.Logger.log("CometChat: updateJWT response",e)},function(e){w.Logger.error("CometChat: updateJWT Fetch Error",e)}).catch(function(e){w.Logger.error("CometChat: updateJWT",e)})},G.startAnalyticsPingTimer=function(){var e=this;G.isAnalyticsPingStarted=!0,G.analyticsPingTimer=setInterval(function(){try{e.pingAnalytics()}catch(e){w.Logger.error("CometChat: startAnalyticsPingTimer",e)}},G.settingsInterval)},G.clearAnalyticsPingTimer=function(){try{G.isAnalyticsPingStarted=!1,clearInterval(G.analyticsPingTimer)}catch(e){w.Logger.error("CometChat: clearAnalyticsPingTimer",e)}},G.startWSReconnectionTimer=function(){G.WSReconnectionInProgress=!0,G.WSReconnectionTimer=setInterval(function(){try{G.WSLogin(G.user)}catch(e){w.Logger.error("CometChat: startWSReconnectionTimer",e)}},G.WSReconnectionTimerInterval)},G.clearWSReconnectionTimer=function(){G.WSReconnectionInProgress=!1,clearInterval(G.WSReconnectionTimer)},G.getJWT=function(r){return new Promise(function(o,s){try{q.getEndPoint("getJWT").then(function(e){var t={appId:G.appId,Accept:"application/json",authToken:G.authToken,resource:G.getSessionId(),sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),"Content-Type":"application/json"},n={};n[b.JWT_API.KEYS.PASSTHROUGH]=r,_.postData(e.endpoint,e.method,n,t,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new K.CometChatException(e.error))}).catch(function(e){var t={error:R.FETCH_ERROR.ERROR_IN_API_CALL};s(new K.CometChatException(t))})},function(e){s(new K.CometChatException(e))})}catch(e){s(new K.CometChatException(e))}})},G.getConnectionStatus=function(){return this.currentConnectionStatus},G.prototype.setConnectionStatus=function(e){G.currentConnectionStatus=e},G.isExtensionEnabled=function(r){return new Promise(function(o,s){try{if(w.isFalsy(r))return s(new K.CometChatException(b.ExtensionErrors.INVALID_EXTENSION));w.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.some(function(e){return e.id===r});return o(n)}return o(!1)}return s(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return s(new K.CometChatException(e))})}catch(e){return s(new K.CometChatException(e))}})},G.isAIFeatureEnabled=function(e){return new Promise(function(n,t){try{if(w.isFalsy(e))return t(new K.CometChatException(b.AIFeatureError.INVALID_AI_FEATURE));var o=b.AI_FEATURE_ACCESSIBLE,s=b.AI_FEATURE_ENABLED,r=w.format(b.AI_SLUG_ACCESSIBLE,e),i=w.format(b.AI_SLUG_ENABLED,e);w.getAppSettings().then(function(e){if(null==e?void 0:e.parameters){var t=null==e?void 0:e.parameters;return t[o]&&t[s]&&t[r]&&t[i]?n(!0):n(!1)}return n(!1)},function(e){return t(new K.CometChatException(e))})}catch(e){return t(new K.CometChatException(e))}})},G.getExtensionDetails=function(i){return new Promise(function(s,r){try{if(w.isFalsy(i))return r(new K.CometChatException(b.ExtensionErrors.INVALID_EXTENSION));w.getAppSettings().then(function(e){if(e.extensions){var t=e.extensions;if(0<t.length){var n=t.filter(function(e){return e.id===i});if(0<n.length){var o=new X.CCExtension(n[0]);return s(o)}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))}return r(new K.CometChatException(b.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return r(new K.CometChatException(e))})}catch(e){return r(new K.CometChatException(e))}})},G.getAppSettings=function(){return new Promise(function(t,n){try{_.makeApiCall("appSettings").then(function(e){T.LocalStorage.getInstance().set(b.LOCAL_STORE.KEY_APP_SETTINGS,e.data),t(e.data)},function(e){n(new K.CometChatException(e.error))})}catch(e){n(new K.CometChatException(e))}})},G.isFeatureEnabled=function(s){return new Promise(function(n,o){try{if(w.isFalsy(s))return o(new K.CometChatException(b.FeatureRestrictionErrors.INVALID_FEATURE));w.getAppSettings().then(function(e){if(e.parameters){var t=e.parameters;return t.hasOwnProperty(s)?n(t[s]):n(!1)}return o(new K.CometChatException(b.FeatureRestrictionErrors.FEATURE_NOT_FOUND))},function(e){return o(new K.CometChatException(e))})}catch(e){return o(new K.CometChatException(e))}})},G.logout=function(){var o=this;return new Promise(function(t,n){try{G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer(),G.isLoggedOut=!0,G.WSReconnectionInProgress=!1,G.isAnalyticsDisabled=!1,_.makeApiCall("userLogout").then(function(e){o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,ce.WSLogout(),G.pushToLoginListener("","Logout_Success"),t(e.data)})},function(e){o.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,ce.WSLogout(),G.pushToLoginListener("","Logout_Success"),new K.CometChatException(e.error).code==R.SERVER_ERRORS.AUTH_ERR.code?t({}):n(new K.CometChatException(e.error))})})}catch(e){n(new K.CometChatException(e))}})},G.callExtension=function(r,i,a,E){return void 0===E&&(E={}),new Promise(function(o,s){try{w.getAppSettings().then(function(e){var t=w.format((new u.EndpointFactory).extensionApi,r,e[b.APP_SETTINGS.KEYS.REGION],e[b.APP_SETTINGS.KEYS.EXTENSION_DOMAIN],a),n={appId:G.appId,Accept:"application/json",authToken:G.authToken,resource:G.getSessionId(),sdk:w.format(b.SDKHeader.sdk,b.SDKHeader.platform,b.SDKHeader.sdkVersion),chatApiVersion:e[b.APP_SETTINGS.KEYS.CHAT_API_VERSION],"Content-Type":"application/json"};G.jwt&&(n.Authorization="Bearer "+G.jwt),_.postData(t,i,E,n,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(b.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?o(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):s(new K.CometChatException(e.error))}).catch(function(e){var t={error:R.FETCH_ERROR.ERROR_IN_API_CALL};s(t)})},function(e){return s(new K.CometChatException(e))})}catch(e){return s(new K.CometChatException(e))}})},G.getConversationStarter=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=w.validateChatType(E);if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(a,E);if(o instanceof K.CometChatException)return void n(o);var s={},r="";E===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversationStarter",s.guid=a):(r="getUserConversationStarter",s.uid=a);var i={uid:G.user.uid,name:G.user.name};s.onbehalfofuser=btoa(JSON.stringify(i)),_.makeApiCall(r,s,c||{}).then(function(e){return e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]?t(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]):n(new K.CometChatException(b.AIErrors.NO_CONVERSATION_STARTER))},function(e){return n(new K.CometChatException(e.error))})}catch(e){return n(new K.CometChatException(e))}})},G.getSmartReplies=function(a,E,c){return new Promise(function(t,n){try{a=a.toLowerCase(),E=E.toLowerCase();var e=w.validateChatType(E);if(e instanceof K.CometChatException)return void n(e);var o=w.validateId(a,E);if(o instanceof K.CometChatException)return void n(o);var s={},r="";E===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupSmartReply",s.guid=a):(r="getUserSmartReply",s.uid=a);var i={uid:G.user.uid,name:G.user.name};s.onbehalfofuser=btoa(JSON.stringify(i)),_.makeApiCall(r,s,c||{}).then(function(e){return e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]?t(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]):n(new K.CometChatException(b.AIErrors.NO_SMART_REPLY))},function(e){return n(new K.CometChatException(e.error))})}catch(e){return n(new K.CometChatException(e))}})},G.askBot=function(c,u,S,p,C){return new Promise(function(n,o){try{var e={},t="";c=c.toLowerCase(),u=u.toLowerCase();var s=w.validateChatType(u);if(s instanceof K.CometChatException)return void o(s);var r=w.validateId(c,u);if(r instanceof K.CometChatException)return void o(r);var i=w.validateId(S,"bot");if(i instanceof K.CometChatException)return void o(i);e.botId=S,w.isFalsy(C)&&(C={});var a=w.validateQuestion(p);if(a instanceof K.CometChatException)return void o(a);C.question=p,u===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(t="getBotAssistanceInGroupConversation",e.guid=c):(t="getBotAssistanceInUserConversation",e.uid=c);var E={uid:G.user.uid,name:G.user.name};e.onbehalfofuser=btoa(JSON.stringify(E)),_.makeApiCall(t,e,C).then(function(e){if(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY]){var t=e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY];return n(t.toString())}return o(new K.CometChatException(b.AIErrors.NO_ASSISTANCE))},function(e){return o(new K.CometChatException(e.error))})}catch(e){return o(new K.CometChatException(e))}})},G.getConversationSummary=function(a,E,c){return new Promise(function(n,o){try{a=a.toLowerCase(),E=E.toLowerCase();var e=w.validateChatType(E);if(e instanceof K.CometChatException)return void o(e);var t=w.validateId(a,E);if(t instanceof K.CometChatException)return void o(t);var s={},r="";E===b.MessageConstatnts.RECEIVER_TYPE.GROUP?(r="getGroupConversationSummary",s.guid=a):(r="getUserConversationSummary",s.uid=a);var i={uid:G.user.uid,name:G.user.name};s.onbehalfofuser=btoa(JSON.stringify(i)),_.makeApiCall(r,s,c||{}).then(function(e){if(e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY]){var t=e[b.ResponseConstants.RESPONSE_KEYS.KEY_DATA][b.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY];return n(t.toString())}return o(new K.CometChatException(b.AIErrors.NO_CONVERSATION_SUMMARY))},function(e){return o(new K.CometChatException(e.error))})}catch(e){return o(new K.CometChatException(e))}})},G.setSource=function(e,t,n){w.isFalsy(e)||(this.resource=e),w.isFalsy(t)||(this.platform=t),w.isFalsy(n)||(this.language=n)},G.setDemoMetaInfo=function(e){G.demoMetaInfo=e},G.clearCache=function(){return new Promise(function(e,t){try{T.LocalStorage.getInstance().clearStore().then(function(){G.removeDataFromSessionStorage(b.SESSION_STORE.SESSION_ID),w.Logger.info("CometChat: clearCache => All store cleared successfully","true"),e(!0)})}catch(e){w.Logger.error("CometChat: clearCache",e),t(e)}})},G.connect=function(){G.user&&(ce.connection||(G.disconnectedByUser=!1,G.WSLogin(G.user)),G.didAnalyticsPingStart()||G.isAnalyticsDisabled||(G.pingAnalytics(),G.startAnalyticsPingTimer()))},G.disconnect=function(){G.user&&(G.disconnectedByUser=!0,ce.connection&&ce.WSLogout(),G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer())},G.prototype.internalRestart=function(e){G.internalRestart||G.getInstance().internalLogout(!1).then(function(){G.internalRestart=!0,G.login(e).then(function(e){G.shouldConnectToWS=!0,G.internalRestart=!1},function(e){w.Logger.error("CometChat: internalRestart :: login",e),G.internalRestart=!1})},function(e){w.Logger.error("CometChat: internalRestart :: internalLogout",e)})},G.prototype.internalLogout=function(n){return void 0===n&&(n=!0),new Promise(function(e,t){try{G.didAnalyticsPingStart()&&G.clearAnalyticsPingTimer(),G.WSReconnectionInProgress&&G.clearWSReconnectionTimer(),G.isLoggedOut=!0,G.WSReconnectionInProgress=!1,G.isAnalyticsDisabled=!1,G.clearCache().then(function(){G.apiKey=void 0,G.user=void 0,G.authToken=void 0,G.cometChat=void 0,G.mode=void 0,ce.WSLogout(),n&&G.pushToLoginListener("","Logout_Success"),e(!0)})}catch(e){w.Logger.error("CometChat: internalLogout",e),t(e)}})},G.markAsInteracted=function(e,o){return new Promise(function(n,t){try{w.isFalsy(e)?t(new K.CometChatException(R.ERRORS.PARAMETER_MISSING)):_.makeApiCall("markInteracted",{messageId:e},{interactions:[o]}).then(function(e){var t;t=e&&e.data&&e.data.message?e.data.message:"Marked interacted",n(t)},function(e){t(new K.CometChatException(e.error))})}catch(e){t(new K.CometChatException(e))}})},G.getConversationUpdateSettings=function(){return E(this,void 0,void 0,function(){var t;return c(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,w.getAppSettings()];case 1:return t=e.sent(),[2,ae.ConversationUpdateSettings.fromJSON(t)];case 2:return e.sent(),[2,new ae.ConversationUpdateSettings];case 3:return[2]}})})},G.GroupType=b.GroupType,G.GroupMemberScope=b.GroupMemberScope,G.ResponseConstants=b.ResponseConstants,G.CallConstants=b.CallConstants,G.ActionConstatnts=b.ActionConstatnts,G.CALL_ERROR=b.CALL_ERROR,G.MessageConstatnts=b.MessageConstatnts,G.APP_SETTINGS=b.APP_SETTINGS,G.GroupConstants=b.GroupConstants,G.TYPING_NOTIFICATION=b.TYPING_NOTIFICATION,G.PresenceConstatnts=b.PresenceConstatnts,G.APPINFO=b.APPINFO,G.UserConstants=b.UserConstants,G.GENERAL_ERROR=b.GENERAL_ERROR,G.ConversationErrors=b.ConversationErrors,G.LOCAL_STORE=b.LOCAL_STORE,G.SDKHeader=b.SDKHeader,G.Errors=b.Errors,G.SESSION_STORE=b.SESSION_STORE,G.REACTION_ACTION=b.REACTION_ACTION,G.ExtensionErrors=b.ExtensionErrors,G.FeatureRestrictionErrors=b.FeatureRestrictionErrors,G.WS=b.WS,G.JWT_API=b.JWT_API,G.PROSODY_API=b.PROSODY_API,G.ProsodyApiErrors=b.ProsodyApiErrors,G.ONLINE_MEMBER_COUNT_API=b.ONLINE_MEMBER_COUNT_API,G.ReceiptErrors=b.ReceiptErrors,G.ANALYTICS=b.ANALYTICS,G.API_ERROR_CODES=b.API_ERROR_CODES,G.ATTACHMENTS_CONSTANTS=b.ATTACHMENTS_CONSTANTS,G.BlockedUsersConstants=b.BlockedUsersConstants,G.CALLING_COMPONENT_VERSION=b.CALLING_COMPONENT_VERSION,G.COMMON_UTILITY_CONSTANTS=b.COMMON_UTILITY_CONSTANTS,G.DEFAULT_VALUES=b.DEFAULT_VALUES,G.DELIVERY_RECEIPTS=b.DELIVERY_RECEIPTS,G.GroupErrors=b.GroupErrors,G.GroupMemersConstans=b.GroupMemersConstans,G.MessageCategory=b.MessageCategory,G.MessageErrors=b.MessageErrors,G.PARAMETER_ERROR=b.PARAMETER_ERROR,G.READ_RECEIPTS=b.READ_RECEIPTS,G.UserErrors=b.UserErrors,G.constants=b.constants,G.GoalType=b.GoalType,G.initialzed=!1,G.CometChatException=K.CometChatException,G.TextMessage=d.TextMessage,G.MediaMessage=S.MediaMessage,G.CustomMessage=L.CustomMessage,G.BaseMessage=p.BaseMessage,G.Action=i.Action,G.Call=s.Call,G.TypingIndicator=M.TypingIndicator,G.TransientMessage=Q.TransientMessage,G.InteractiveMessage=Z.InteractiveMessage,G.InteractionGoal=$.InteractionGoal,G.Interaction=ee.Interaction,G.InteractionReceipt=te.InteractionReceipt,G.Group=a.Group,G.User=l.User,G.GroupMember=D.GroupMember,G.Conversation=V.Conversation,G.ReactionCount=se.ReactionCount,G.ReactionEvent=re.ReactionEvent,G.Reaction=ie.Reaction,G.USER_STATUS={ONLINE:b.PresenceConstatnts.STATUS.ONLINE,OFFLINE:b.PresenceConstatnts.STATUS.OFFLINE},G.MessagesRequest=P.MessagesRequest,G.MessagesRequestBuilder=P.MessagesRequestBuilder,G.ReactionsRequest=oe.ReactionsRequest,G.ReactionsRequestBuilder=oe.ReactionsRequestBuilder,G.UsersRequest=N.UsersRequest,G.UsersRequestBuilder=N.UsersRequestBuilder,G.ConversationsRequest=y.ConversationsRequest,G.ConversationsRequestBuilder=y.ConversationsRequestBuilder,G.BlockedUsersRequest=U.BlockedUsersRequest,G.BlockedUsersRequestBuilder=U.BlockedUsersRequestBuilder,G.GroupsRequest=I.GroupsRequest,G.GroupsRequestBuilder=I.GroupsRequestBuilder,G.GroupMembersRequest=f.GroupMembersRequest,G.GroupMembersRequestBuilder=f.GroupMembersRequestBuilder,G.BannedMembersRequest=O.BannedMembersRequest,G.BannedMembersRequestBuilder=O.BannedMembersRequestBuilder,G.CallSettings=J.CallSettings,G.CallSettingsBuilder=J.CallSettingsBuilder,G.MainVideoContainerSetting=J.MainVideoContainerSetting,G.VirtualBackground=J.VirtualBackground,G.VirtualBackgroundBuilder=J.VirtualBackgroundBuilder,G.AppSettings=Y.AppSettings,G.AppSettingsBuilder=Y.AppSettingsBuilder,G.MessageListener=o.MessageListener,G.UserListener=o.UserListener,G.GroupListener=o.GroupListener,G.OngoingCallListener=o.OngoingCallListener,G.CallListener=o.CallListener,G.ConnectionListener=o.ConnectionListener,G.LoginListener=o.LoginListener,G.CallController=B.CallController,G.CometChatHelper=F.CometChatHelper,G.Attachment=k.Attachment,G.MediaDevice=z.MediaDevice,G.MESSAGE_TYPE=b.MessageConstatnts.TYPE,G.CATEGORY_MESSAGE=b.MessageConstatnts.CATEGORY.MESSAGE,G.CATEGORY_ACTION=b.MessageConstatnts.CATEGORY.ACTION,G.CATEGORY_CALL=b.MessageConstatnts.CATEGORY.CALL,G.CATEGORY_CUSTOM=b.MessageConstatnts.CATEGORY.CUSTOM,G.CATEGORY_INTERACTIVE=b.MessageConstatnts.CATEGORY.INTERACTIVE,G.ACTION_TYPE=b.ActionConstatnts.ACTIONS,G.CALL_TYPE=b.CallConstants.CALL_TYPE,G.SORT_BY=b.UserConstants.SORT_BY,G.SORT_ORDER=b.UserConstants.SORT_ORDER,G.CALL_MODE=b.CallConstants.CALL_MODE,G.RECEIVER_TYPE=b.MessageConstatnts.RECEIVER_TYPE,G.CONNECTION_STATUS=b.CONNECTION_STATUS,G.CALL_STATUS=b.CallConstants.CALL_STATUS,G.GROUP_MEMBER_SCOPE=b.GROUP_MEMBER_SCOPE,G.GROUP_TYPE=b.GROUP_TYPE,G.MESSAGE_REQUEST=b.MessageConstatnts.PAGINATION.CURSOR_FILEDS,G.WSReconnectionInProgress=!1,G.WSReconnectionTimerInterval=5e3,G.currentConnectionStatus=b.CONNECTION_STATUS.DISCONNECTED,G.isConnectingFromInit=!1,G.loginInProgress=!1,G.internalRestart=!1,G.settingsInterval=6e4,G.isAnalyticsPingStarted=!1,G.isLoggedOut=!0,G.isAnalyticsDisabled=!1,G.disconnectedByUser=!1,G.shouldConnectToWS=!0,G}();t.CometChat=Se},function(e,t,n){"use strict";var u=this&&this.__assign||function(){return(u=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.postData=t.makeAdminApiCall=t.makeApiCall=void 0;var S=n(36),p=n(5),C=n(0),l=n(2),_=n(10),T=n(1);function d(n,e,o,t,s){var r;return void 0===n&&(n=""),void 0===e&&(e="GET"),void 0===o&&(o={}),void 0===t&&(t={}),o=C.isFalsy(o)?void 0:("GET"==e&&(n+="?",Object.keys(o).map(function(e,t){n=t===Object.keys(o).length-1?n+e+"="+o[e]:n+e+"="+o[e]+"&"}),o=void 0),s&&(r=new FormData,Object.keys(o).map(function(e){if("data"!=e){if("tags"==e)for(var t=0;t<o[e].length;t++)r.append(e+"[]",o[e][t]);else if("metadata"!=e)if("files"===e)for(t=0;t<o[e].length;t++)r.append(e+"[]",o[e][t]);else r.append(e,o[e])}else r.append(e,JSON.stringify(o[e]))})),JSON.stringify(o)),fetch(n,{method:e,mode:"cors",cache:"no-cache",headers:t,redirect:"follow",referrer:"no-referrer",body:s?r:o})}t.makeApiCall=function(s,r,i,a,E){void 0===s&&(s=""),void 0===r&&(r={}),void 0===i&&(i={});var c=p.CometChat.getInstance(p.CometChat.getAppId());return new Promise(function(n,o){try{S.getEndPoint(s,r).then(function(e){var t=u({resource:p.CometChat.getSessionId(),appId:p.CometChat.getAppId(),Accept:"application/json",sdk:C.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion)},E);a||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAIApi")&&e.isAIApi&&(t.onbehalfofuser=r.onbehalfofuser),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?c.getApiKey()?t.apiKey=c.getApiKey():o({error:{code:"API_KEY_NOT_SET",message:"An apiKey is needed to use the "+s+" api.",name:"API_KEY_NOT_SET"}}):c.getAuthToken()?t.authToken=c.getAuthToken():o({error:{code:"USER_NOT_LOGED_IN",message:"An authToken is need to use the "+s+" end-point. PS- We are aware of the spelling mistake, but in order to maintain backward compatibility we cannot change it :(",name:"User not logged-in"}}),d(e.endpoint,e.method,i,t,a).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty("data"))e.data.hasOwnProperty("authToken")&&p.CometChat.setAuthToken(e.data.authToken),n(e);else{if(e.hasOwnProperty("error")){var t=e.error;t.hasOwnProperty("code")&&t.code===T.API_ERROR_CODES.AUTH_ERR_AUTH_TOKEN_NOT_FOUND&&p.CometChat.getInstance().internalLogout().then(function(){C.Logger.log("CometChat: makeApiCall","User logged out")})}o(e)}}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(t)})}).catch(function(e){return o})}catch(e){o(new l.CometChatException(e))}})},t.makeAdminApiCall=function(s,e,r,i){void 0===s&&(s=""),void 0===e&&(e={}),void 0===r&&(r={});var a=p.CometChat.getInstance(p.CometChat.getAppId());return new Promise(function(n,o){S.getEndPoint(s,e).then(function(e){var t={appId:p.CometChat.getAppId(),Accept:"application/json",sdk:C.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion)};i||(t["Content-Type"]="application/json"),e.hasOwnProperty("isAdminApi")&&e.isAdminApi?a.getApiKey()?t.apiKey=a.getApiKey():o({error:"An apiKey is need to use the "+s+" api."}):a.getAuthToken()?t.authToken=a.getAuthToken():o({error:"An authToken is need to use the "+s+" api."}),d(e.endpoint,e.method,r,t,i).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("data")?(e.data.hasOwnProperty("authToken")&&p.CometChat.setAuthToken(e.data.authToken),n(e)):o(e)}).catch(function(e){var t={error:_.FETCH_ERROR.ERROR_IN_API_CALL};o(t)})}).catch(function(e){return o})})},t.postData=d},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BaseMessage=void 0;var o=n(1),s=n(18),r=n(0),i=function(){function e(e,t,n,o){this.reactions=[],this.mentionedUsers=[],this.mentionedMe=!1,this.receiverId=e,this.type=t,this.receiverType=n,this.category=o}return e.prototype.getUnreadRepliesCount=function(){return this.unreadRepliesCount},e.prototype.setUnreadRepliesCount=function(e){this.unreadRepliesCount=e},e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e.prototype.getMuid=function(){return this.muid},e.prototype.setMuid=function(e){this.muid=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSentAt=function(){return this.sentAt},e.prototype.setSentAt=function(e){this.sentAt=e},e.prototype.getStatus=function(){return this.status},e.prototype.setStatus=function(e){this.status=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredToMeAt=function(){return this.deliveredToMeAt},e.prototype.setDeliveredToMeAt=function(e){this.deliveredToMeAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadByMeAt=function(){return this.readByMeAt},e.prototype.setReadByMeAt=function(e){this.readByMeAt=e},e.prototype.getCategory=function(){return this.category},e.prototype.setCategory=function(e){this.category=e},e.prototype.getEditedAt=function(){return this.editedAt},e.prototype.setEditedAt=function(e){this.editedAt=e},e.prototype.getEditedBy=function(){return this.editedBy},e.prototype.setEditedBy=function(e){this.editedBy=e},e.prototype.getDeletedAt=function(){return this.deletedAt},e.prototype.setDeletedAt=function(e){this.deletedAt=e},e.prototype.getDeletedBy=function(){return this.deletedBy},e.prototype.setDeletedBy=function(e){this.deletedBy=e},e.prototype.getReplyCount=function(){return this.replyCount},e.prototype.setReplyCount=function(e){this.replyCount=e},e.prototype.getRawMessage=function(){return this.rawMessage},e.prototype.setRawMessage=function(e){this.rawMessage=e},e.prototype.setMentionedUsers=function(e){this.mentionedUsers=e},e.prototype.getMentionedUsers=function(){return this.mentionedUsers},e.prototype.setHasMentionedMe=function(e){this.mentionedMe=e},e.prototype.hasMentionedMe=function(){return this.mentionedMe},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.setReactions=function(e){try{this.setReactionsToData(e)}catch(e){return this.reactions}},e.prototype.getReactions=function(){try{return this.getReactionsFromData()}catch(e){return this.reactions}},e.prototype.setReactionsToData=function(e){var t=this.getData();if(t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]){var n=e.map(function(e){return new s.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe)});t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=n,this.setData(t),this.reactions=n}else t[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]=e,this.setData(t),this.reactions=e},e.prototype.getReactionsFromData=function(){try{var e=this.getData(),n=[];if(e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS])e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS].forEach(function(e){var t=new s.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe);n.push(t)});return n}catch(e){throw r.Logger.error("BaseMessageModel: getReactionsFromData",e),e}},e}();t.BaseMessage=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatEvent=void 0;var i=n(0),o=n(4),s=function(){function e(e,t,n,o,s,r){i.isFalsy(e)||(this.appId=e),i.isFalsy(t)||(this.receiver=t),i.isFalsy(n)||(this.receiverType=n),i.isFalsy(s)||(this.deviceId=s),i.isFalsy(o)||(this.sender=o),i.isFalsy(r)||(this.messageSender=r)}return e.prototype.getAppId=function(){return this.appId},e.prototype.setAppId=function(e){this.appId=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getDeviceId=function(){return this.deviceId},e.prototype.setDeviceId=function(e){this.deviceId=e},e.prototype.getMessageSender=function(){return this.messageSender},e.prototype.setMessageSender=function(e){this.messageSender=e},e.prototype.getCometChatEventJSON=function(){var e={};return e[o.KEYS.APP_ID]=this.getAppId(),e[o.KEYS.RECEIVER]=this.getReceiver(),e[o.KEYS.RECEIVER_TYPE]=this.getReceiverType(),e[o.KEYS.DEVICE_ID]=this.getDeviceId(),e[o.KEYS.TYPE]=this.getType(),e[o.KEYS.SENDER]=this.getSender(),i.isFalsy(this.getMessageSender())||(e[o.KEYS.MESSAGE_SENDER]=this.getMessageSender()),e},e}();t.CometChatEvent=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;var o=n(1),s=function(){function e(e,t,n,o,s,r,i){this.hasJoined=!1,this.membersCount=0,this.isBanned=!1,this.guid=e,t&&(this.name=t),n&&(this.type=n),!o&&""!==o||"password"!=n||(this.password=o),(s||""===s)&&(this.icon=s),(r||""===r)&&(this.description=r),i&&(this.hasJoined=i)}return e.prototype.getGuid=function(){return this.guid},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){e&&(this.name=e)},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getPassword=function(){return this.password},e.prototype.setPassword=function(e){this.password=e},e.prototype.getIcon=function(){return this.icon},e.prototype.setIcon=function(e){this.icon=e},e.prototype.getDescription=function(){return this.description},e.prototype.setDescription=function(e){this.description=e},e.prototype.getOwner=function(){return this.owner},e.prototype.setOwner=function(e){this.owner=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getCreatedAt=function(){return this.createdAt},e.prototype.setCreatedAt=function(e){this.createdAt=e},e.prototype.getUpdatedAt=function(){return this.updatedAt},e.prototype.setUpdatedAt=function(e){this.updatedAt=e},e.prototype.getHasJoined=function(){return this.hasJoined},e.prototype.setHasJoined=function(e){this.hasJoined=e},e.prototype.getWsChannel=function(){return this.wsChannel},e.prototype.setWsChannel=function(e){this.wsChannel=e},e.prototype.setScope=function(e){this.scope=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getMembersCount=function(){return this.membersCount},e.prototype.setMembersCount=function(e){this.membersCount=e},e.prototype.setTags=function(e){this.tags=e},e.prototype.getTags=function(){return this.tags},e.prototype.isBannedFromGroup=function(){return this.isBanned},e.TYPE=o.GroupType,e.Type=e.TYPE,e}();t.Group=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.FETCH_ERROR=t.TYPINGNOTIFICATION_CONSTANTS=t.LOGIN_ERROR=t.MESSAGE_ERRORS=t.MESSAGES_REQUEST_ERRORS=t.USERS_REQUEST_ERRORS=t.GROUP_CREATION_ERRORS=t.INIT_ERROR=t.ERRORS=t.SERVER_ERRORS=void 0,t.SERVER_ERRORS={AUTH_ERR:{code:"AUTH_ERR_AUTH_TOKEN_NOT_FOUND",message:"The auth token %s% does not exist. Please make sure you are logged in and have a valid auth token or try login again."}},t.ERRORS={PARAMETER_MISSING:{code:"MISSING_PARAMETERS",name:"Invalid or no parameter passed to the method."}},t.INIT_ERROR={NO_APP_ID:{code:t.ERRORS.PARAMETER_MISSING.code,name:t.ERRORS.PARAMETER_MISSING.name,message:"AppID cannot be empty. Please specify a valid appID.",details:{}}},t.GROUP_CREATION_ERRORS={EMPTY_PASSWORD:{code:"ERR_EMPTY_GROUP_PASS",details:void 0,message:"Password is mandatory to join a group.",name:void 0}},t.USERS_REQUEST_ERRORS={EMPTY_USERS_LIST:{code:"EMPTY_USERS_LIST",name:"EMPTY_USERS_LIST",message:"The users list needs to have atleast one UID.",details:{}}},t.MESSAGES_REQUEST_ERRORS={REQUEST_IN_PROGRESS_ERROR:{code:"REQUEST_IN_PROGRESS",name:"REQUEST_IN_PROGRESS",message:"Request in progress.",details:{}},NOT_ENOUGH_PARAMS:{code:"NOT_ENOUGH_PARAMETERS",name:"NOT_ENOUGH_PARAMETERS",message:"`Timestamp`, `MessageId` or `updatedAfter` is required to use the 'fetchNext()' method.",details:{}}},t.MESSAGE_ERRORS={INVALID_CUSTOM_DATA:{code:"-1",name:"%s_CUSTOM_DATA",message:"",details:{}}},t.LOGIN_ERROR={NOT_INITIALIZED:{code:"-1",name:"COMETCHAT_INITIALIZATION_NOT_DONE",message:"please initialize the cometchat before using login method.",details:{}},UNAUTHORISED:{code:401,name:"USER_NOT_AUTHORISED",message:"The `authToken` of the user is not authorised. Please verify again.",details:{}},WS_CONNECTION_FAIL:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. %s",details:{}},WS_CONNECTION_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FAIL",message:"WS Connection failed. Trying to connect with port: %s",details:{}},WS_CONNECTION_FALLBACK_FAIL_PORT_ERROR:{code:-1,name:"WS_CONNECTION_FALLBACK_FAIL",message:"WS Connection fallback failed. Trying to connect with port: %s",details:{}},WS_AUTH_FAIL:{code:-1,name:"WS_AUTH_FAIL",message:"WS username/password not correct.",details:{}},NO_INTERNET:{code:-1,name:"NO_INTERNET_CONNECTION",message:"You do not have internet connection.",details:{}},REQUEST_IN_PROGRESS:{code:-1,name:"LOGIN_IN_PROGRESS",message:"Please wait until the previous login request ends.",details:{}}},t.TYPINGNOTIFICATION_CONSTANTS={TOO_MANY_REQUEST:{code:"TOO_MANY_REQUEST",name:"TOO MANY REQUEST",message:"too many request, wait for `%s` seconds before sending next request.",details:{}}},t.FETCH_ERROR={ERROR_IN_API_CALL:{code:"FAILED_TO_FETCH",name:"FAILED_TO_FETCH",message:"There is an unknown issue with the API request. Please check your internet connection and verify the api call.",details:{}}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageController=void 0;var _=n(7),T=n(17),d=n(19),A=n(0),h=n(1),g=n(24),R=n(25),I=n(26),r=n(2),f=n(20),O=n(21),N=n(5),i=n(12),y=n(22),a=n(3),o=function(){function l(){}return l.trasformJSONMessge=function(n){var e,t,o,s,r;try{var i=null,a=void 0;switch(n[h.MessageConstatnts.KEYS.CATEGORY]){case h.MessageConstatnts.CATEGORY.ACTION:a=g.Action.actionFromJSON(n);break;case h.MessageConstatnts.CATEGORY.CALL:a=R.Call.callFromJSON(n);break;case h.MessageConstatnts.CATEGORY.MESSAGE:switch(n[h.MessageConstatnts.KEYS.TYPE]){case h.MessageConstatnts.TYPE.TEXT:a=new T.TextMessage(n[h.MessageConstatnts.KEYS.RECEIVER],n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.TEXT],n[h.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case h.MessageConstatnts.TYPE.CUSTOM:a=new O.CustomMessage(n[h.MessageConstatnts.KEYS.RECEIVER],n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.CUSTOM_DATA],n[h.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;default:if(a=new d.MediaMessage(n[h.MessageConstatnts.KEYS.RECEIVER],n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.URL],n[h.MessageConstatnts.KEYS.TYPE],n[h.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.hasOwnProperty(h.MessageConstatnts.KEYS.DATA)){var E=n[h.MessageConstatnts.KEYS.DATA];if(E.hasOwnProperty(h.MessageConstatnts.KEYS.ATTATCHMENTS)){var c,u=E[h.MessageConstatnts.KEYS.ATTATCHMENTS];new Array;u.map(function(e){c=new f.Attachment(e)}),a.setAttachment(c)}E.hasOwnProperty(h.MessageConstatnts.KEYS.TEXT)&&a.setCaption(E[h.MessageConstatnts.KEYS.TEXT])}a.hasOwnProperty("file")&&delete a.file}break;case h.MessageConstatnts.CATEGORY.CUSTOM:a=new O.CustomMessage(n[h.MessageConstatnts.KEYS.RECEIVER],n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.CUSTOM_DATA],n[h.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type);break;case h.MessageConstatnts.CATEGORY.INTERACTIVE:a=new y.InteractiveMessage(n[h.MessageConstatnts.KEYS.RECEIVER],n[h.MessageConstatnts.KEYS.RECEIVER_TYPE],n.type,n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.INTERACTIVE_DATA],n[h.MessageConstatnts.KEYS.DATA][h.MessageConstatnts.KEYS.INTERACTION_GOAL])}if((n[h.MessageConstatnts.KEYS.CATEGORY]===h.MessageConstatnts.CATEGORY.MESSAGE||n[h.MessageConstatnts.KEYS.CATEGORY]===h.MessageConstatnts.CATEGORY.CUSTOM)&&n[h.MessageConstatnts.KEYS.TYPE]!==h.MessageConstatnts.TYPE.TEXT&&(null==n?void 0:n[h.MessageConstatnts.KEYS.DATA])&&(null===(e=null==n?void 0:n[h.MessageConstatnts.KEYS.DATA])||void 0===e?void 0:e[h.MessageConstatnts.KEYS.ATTATCHMENTS])&&0!==(null===(o=null===(t=null==n?void 0:n[h.MessageConstatnts.KEYS.DATA])||void 0===t?void 0:t[h.MessageConstatnts.KEYS.ATTATCHMENTS])||void 0===o?void 0:o.length)&&(null===(s=N.CometChat.user)||void 0===s?void 0:s.getFat())&&N.CometChat.SECURED_MEDIA_HOST){var S=N.CometChat.SECURED_MEDIA_HOST,p=null===(r=N.CometChat.user)||void 0===r?void 0:r.getFat(),C=A.updatePropertiesWithDynamicValue(n,S,"?"+h.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY+"="+p);C&&(n=C)}n[h.MessageConstatnts.KEYS.MY_RECEIPTS]&&(n[h.MessageConstatnts.KEYS.MY_RECEIPTS]=n[h.MessageConstatnts.KEYS.MY_RECEIPTS],Object.keys(n[h.MessageConstatnts.KEYS.MY_RECEIPTS]).map(function(e){var t=new I.MessageReceipt;e==h.DELIVERY_RECEIPTS.DELIVERED_AT&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.DELIVERY_RECEIPTS.DELIVERED_AT]),A.isFalsy(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.DELIVERY_RECEIPTS.RECIPIENT])?n[h.DELIVERY_RECEIPTS.DELIVERED_TO_ME_AT]=n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.DELIVERY_RECEIPTS.DELIVERED_AT]:t.setSender(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.DELIVERY_RECEIPTS.RECIPIENT]),t.setReceiverType(n[h.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[h.MessageConstatnts.KEYS.RECEIVER])),n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.READ_RECEIPTS.READ_AT]),A.isFalsy(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.READ_RECEIPTS.RECIPIENT])?n[h.READ_RECEIPTS.READ_BY_ME_AT]=n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.READ_RECEIPTS.READ_AT]:t.setSender(n[h.MessageConstatnts.KEYS.MY_RECEIPTS][h.READ_RECEIPTS.RECIPIENT]),t.setReceiverType(n[h.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(n[h.MessageConstatnts.KEYS.RECEIVER]))}));try{if(Object.assign(a,n),(n=a).parentId&&(n.parentMessageId=n.parentId,delete n.parentId),n instanceof _.BaseMessage&&(A.isFalsy(i)||n.setRawMessage(i)),n instanceof T.TextMessage)l.extractDetailsFromMentions(n),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.getData()[h.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[h.MessageConstatnts.KEYS.METADATA]);else if(n instanceof d.MediaMessage)l.extractDetailsFromMentions(n),n.getData()[h.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[h.MessageConstatnts.KEYS.METADATA]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver());else if(n instanceof g.Action)n.setSender(n.getSender()),n.setReceiver(n.getActionFor()),n.setActionBy(n.getActionBy()),n.setActionOn(n.getActionOn()),n.setActionFor(n.getActionFor()),n.setMessage(n.getMessage());else if(n instanceof R.Call){try{n.setSender(n.getSender())}catch(e){A.Logger.error("MessageController: trasformJSONMessge: setSender",e)}try{n.setCallInitiator(n.getCallInitiator())}catch(e){A.Logger.error("MessageController: trasformJSONMessge: setCallInitiator",e)}try{n.setReceiver(n.getCallReceiver()),n.setCallReceiver(n.getCallReceiver())}catch(e){A.Logger.error("MessageController: trasformJSONMessge: setCallreceiver",e)}}else n instanceof O.CustomMessage?(n.getData()[h.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[h.MessageConstatnts.KEYS.METADATA]),n.setCustomData(n.getData()[h.MessageConstatnts.KEYS.CUSTOM_DATA]),n.setSubType(n.getData()[h.MessageConstatnts.KEYS.CUSTOM_SUB_TYPE]),n.setSender(n.getSender()),n.setReceiver(n.getReceiver())):n instanceof y.InteractiveMessage&&(n.getData()[h.MessageConstatnts.KEYS.METADATA]&&n.setMetadata(n.getData()[h.MessageConstatnts.KEYS.METADATA]),n.setInteractiveData(n.getData()[h.MessageConstatnts.KEYS.INTERACTIVE_DATA]),n.setInteractionGoal(n.getInteractionGoal()),n.setInteractions(n.getInteractions()),n.setSender(n.getSender()),n.setReceiver(n.getReceiver()),n.setIsSenderInteractionAllowed(n.getData()[h.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION]));n.hasOwnProperty("rawMessage")||(i=JSON.parse(JSON.stringify(n))),n instanceof _.BaseMessage&&(A.isFalsy(i)||n.setRawMessage(i))}catch(e){A.Logger.error("MessageController: trasformJSONMessge: Main",e),n=null}return n}catch(e){A.Logger.error("MessageController: trasformJSONMessge",e)}},l.extractDetailsFromMentions=function(e){if(e.getData()[h.MessageConstatnts.KEYS.MENTIONS]){var t=[],n=!1,o=N.CometChat.user,s=e.getData()[h.MessageConstatnts.KEYS.MENTIONS];for(var r in s)r.toString()==(null==o?void 0:o.getUid())&&(n=!0),t.push(new a.User(s[r]));e.setMentionedUsers(t),e.setHasMentionedMe(n)}},l.getReceiptsFromJSON=function(s){return new Promise(function(e,t){try{var o=[];N.CometChat.getLoggedInUser().then(function(n){A.isFalsy(s.receipts)?e([]):(s.receipts.data.map(function(e){var t=new I.MessageReceipt;e[h.DELIVERY_RECEIPTS.DELIVERED_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.DELIVERY_RECEIPT),t.setDeliveredAt(e[h.DELIVERY_RECEIPTS.DELIVERED_AT]),t.setTimestamp(e[h.DELIVERY_RECEIPTS.DELIVERED_AT]),A.isFalsy(e[h.DELIVERY_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[h.DELIVERY_RECEIPTS.RECIPIENT])),t.setReceiverType(s[h.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(s[h.MessageConstatnts.KEYS.RECEIVER])),e[h.READ_RECEIPTS.READ_AT]&&(t.setReceiptType(t.RECEIPT_TYPE.READ_RECEIPT),t.setReadAt(e[h.READ_RECEIPTS.READ_AT]),t.setTimestamp(e[e[h.READ_RECEIPTS.READ_AT]]),A.isFalsy(e[h.READ_RECEIPTS.RECIPIENT])?t.setSender(n):t.setSender(i.UsersController.trasformJSONUser(e[h.READ_RECEIPTS.RECIPIENT])),t.setReceiverType(s[h.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.setReceiver(s[h.MessageConstatnts.KEYS.RECEIVER])),o.push(t)}),e(o))})}catch(e){t(new r.CometChatException(e))}})},l}();t.MessageController=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersController=void 0;var o=n(3),s=n(0),r=function(){function e(){}return e.trasformJSONUser=function(e){var t;try{e.uid=e.uid.toString(),e.name=e.name.toString(),e.status&&"offline"!==e.status?e.status="online":e.status="offline",t=new o.User(e),Object.assign(t,e),e=t}catch(e){s.Logger.error("UsersController:transformJSONUser",e)}return e},e}();t.UsersController=r},function(e,t,n){"use strict";var o,s,r,i,a,E,c;Object.defineProperty(t,"__esModule",{value:!0}),t.DEFAULT_PROVIDER_ID=t.APIResponseConstants=t.APIConstants=t.PushPlatforms=t.MutedConversationType=t.DayOfWeek=t.DNDOptions=t.MemberActionsOptions=t.ReactionsOptions=t.RepliesOptions=t.MessagesOptions=void 0,(o=t.MessagesOptions||(t.MessagesOptions={}))[o.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",o[o.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",o[o.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(s=t.RepliesOptions||(t.RepliesOptions={}))[s.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",s[s.SUBSCRIBE_TO_ALL=2]="SUBSCRIBE_TO_ALL",s[s.SUBSCRIBE_TO_MENTIONS=3]="SUBSCRIBE_TO_MENTIONS",(r=t.ReactionsOptions||(t.ReactionsOptions={}))[r.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",r[r.SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES=2]="SUBSCRIBE_TO_REACTIONS_ON_OWN_MESSAGES",r[r.SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES=3]="SUBSCRIBE_TO_REACTIONS_ON_ALL_MESSAGES",(i=t.MemberActionsOptions||(t.MemberActionsOptions={}))[i.DONT_SUBSCRIBE=1]="DONT_SUBSCRIBE",i[i.SUBSCRIBE=2]="SUBSCRIBE",(a=t.DNDOptions||(t.DNDOptions={}))[a.DISABLED=1]="DISABLED",a[a.ENABLED=2]="ENABLED",(E=t.DayOfWeek||(t.DayOfWeek={})).MONDAY="monday",E.TUESDAY="tuesday",E.WEDNESDAY="wednesday",E.THURSDAY="thursday",E.FRIDAY="friday",E.SATURDAY="saturday",E.SUNDAY="sunday",(c=t.MutedConversationType||(t.MutedConversationType={})).ONE_ON_ONE="oneOnOne",c.GROUP="group",(t.PushPlatforms||(t.PushPlatforms={})).FCM_WEB="fcm_web",t.APIConstants={KEY_GROUP_PREFERENCES:"groupPreferences",KEY_GROUP_MESSAGES:"groupMessages",KEY_GROUP_REACTIONS:"groupReactions",KEY_GROUP_REPLIES:"groupReplies",KEY_GROUP_MEMBER_ADDED:"groupMemberAdded",KEY_GROUP_MEMBER_LEFT:"groupMemberLeft",KEY_GROUP_MEMBER_JOINED:"groupMemberJoined",KEY_GROUP_MEMBER_KICKED:"groupMemberKicked",KEY_GROUP_MEMBER_BANNED:"groupMemberBanned",KEY_GROUP_MEMBER_UNBANNED:"groupMemberUnbanned",KEY_GROUP_MEMBER_SCOPE_CHANGED:"groupMemberScopeChanged",KEY_MUTE_PREFERENCES:"mutePreferences",KEY_MUTE_DND:"dnd",KEY_MUTE_SCHEDULE:"schedule",KEY_ONE_ON_ONE_PREFERENCES:"oneOnOnePreferences",KEY_ONE_ON_ONE_MESSAGES:"oneOnOneMessages",KEY_ONE_ON_ONE_REACTIONS:"oneOnOneReactions",KEY_ONE_ON_ONE_REPLIES:"oneOnOneReplies",KEY_USE_PRIVACY_TEMPLATE:"usePrivacyTemplate",KEY_PROVIDER_ID:"providerId",KEY_TIMEZONE:"timezone",KEY_PLATFORM:"platform",KEY_FCM_TOKEN:"fcmToken",KEY_CONVERSATIONS:"conversations",KEY_GET_PREFERENCES:"getPushPreferences",KEY_UPDATE_PREFERENCES:"updatePushPreferences",KEY_RESET_PREFERENCES:"resetPushPreferences",KEY_REGISTER_TOKEN:"registerToken",KEY_UNREGISTER_TOKEN:"unregisterToken",KEY_MUTE_CONVERSATIONS:"muteConversations",KEY_UNMUTE_CONVERSATIONS:"unmuteConversations",KEY_GET_MUTED_CONVERSATIONS:"getMutedConversations",KEY_MUTED_CONVERSATIONS:"mutedConversations",KEY_FROM:"from",KEY_TO:"to",KEY_GET_TIMEZONE:"getTimezone",KEY_UPDATE_TIMEZONE:"updateTimezone"},t.APIResponseConstants={TOKEN_REGISTER_SUCCESS:"Push token registered successfully.",TOKEN_REGISTER_ERROR:"Failed to register push token.",TOKEN_UNREGISTER_SUCCESS:"Push token unregistered successfully.",TOKEN_UNREGISTER_ERROR:"Failed to unregister push token.",MUTE_CONVERSATION_SUCCESS:"Conversations muted successfully.",MUTE_CONVERSATION_ERROR:"Failed to mute conversations.",UNMUTE_CONVERSATION_SUCCESS:"Conversations unmuted successfully.",UNMUTE_CONVERSATION_ERROR:"Failed to unmute conversations.",TIMEZONE_UPDATE_SUCCESS:"Timezone updated successfully.",TIMEZONE_UPDATE_ERROR:"Failed to update Timezone.",TIMEZONE_FETCH_ERROR:"Failed to fetch Timezone."},t.DEFAULT_PROVIDER_ID="default"},function(e,t,n){(function(o){e.exports=function s(r,i,a){function E(n,e){if(!i[n]){if(!r[n]){if(c)return c(n,!0);var t=new Error("Cannot find module '"+n+"'");throw t.code="MODULE_NOT_FOUND",t}var o=i[n]={exports:{}};r[n][0].call(o.exports,function(e){var t=r[n][1][e];return E(t||e)},o,o.exports,s,r,i,a)}return i[n].exports}for(var c=!1,e=0;e<a.length;e++)E(a[e]);return E}({1:[function(e,u,t){(function(t){"use strict";var n,o,e=t.MutationObserver||t.WebKitMutationObserver;if(e){var s=0,r=new e(c),i=t.document.createTextNode("");r.observe(i,{characterData:!0}),n=function(){i.data=s=++s%2}}else if(t.setImmediate||void 0===t.MessageChannel)n="document"in t&&"onreadystatechange"in t.document.createElement("script")?function(){var e=t.document.createElement("script");e.onreadystatechange=function(){c(),e.onreadystatechange=null,e.parentNode.removeChild(e),e=null},t.document.documentElement.appendChild(e)}:function(){setTimeout(c,0)};else{var a=new t.MessageChannel;a.port1.onmessage=c,n=function(){a.port2.postMessage(0)}}var E=[];function c(){var e,t;o=!0;for(var n=E.length;n;){for(t=E,E=[],e=-1;++e<n;)t[e]();n=E.length}o=!1}u.exports=function(e){1!==E.push(e)||o||n()}}).call(this,void 0!==o?o:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var s=e(1);function c(){}var u={},r=["REJECTED"],i=["FULFILLED"],a=["PENDING"];function o(e){if("function"!=typeof e)throw new TypeError("resolver must be a function");this.state=a,this.queue=[],this.outcome=void 0,e!==c&&C(this,e)}function E(e,t,n){this.promise=e,"function"==typeof t&&(this.onFulfilled=t,this.callFulfilled=this.otherCallFulfilled),"function"==typeof n&&(this.onRejected=n,this.callRejected=this.otherCallRejected)}function S(t,n,o){s(function(){var e;try{e=n(o)}catch(e){return u.reject(t,e)}e===t?u.reject(t,new TypeError("Cannot resolve promise with itself")):u.resolve(t,e)})}function p(e){var t=e&&e.then;if(e&&("object"==typeof e||"function"==typeof e)&&"function"==typeof t)return function(){t.apply(e,arguments)}}function C(t,e){var n=!1;function o(e){n||(n=!0,u.reject(t,e))}function s(e){n||(n=!0,u.resolve(t,e))}var r=l(function(){e(s,o)});"error"===r.status&&o(r.value)}function l(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=o).prototype.catch=function(e){return this.then(null,e)},o.prototype.then=function(e,t){if("function"!=typeof e&&this.state===i||"function"!=typeof t&&this.state===r)return this;var n=new this.constructor(c);if(this.state!==a){var o=this.state===i?e:t;S(n,o,this.outcome)}else this.queue.push(new E(n,e,t));return n},E.prototype.callFulfilled=function(e){u.resolve(this.promise,e)},E.prototype.otherCallFulfilled=function(e){S(this.promise,this.onFulfilled,e)},E.prototype.callRejected=function(e){u.reject(this.promise,e)},E.prototype.otherCallRejected=function(e){S(this.promise,this.onRejected,e)},u.resolve=function(e,t){var n=l(p,t);if("error"===n.status)return u.reject(e,n.value);var o=n.value;if(o)C(e,o);else{e.state=i,e.outcome=t;for(var s=-1,r=e.queue.length;++s<r;)e.queue[s].callFulfilled(t)}return e},u.reject=function(e,t){e.state=r,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callRejected(t);return e},o.resolve=function(e){return e instanceof this?e:u.resolve(new this(c),e)},o.reject=function(e){var t=new this(c);return u.reject(t,e)},o.all=function(e){var n=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var o=e.length,s=!1;if(!o)return this.resolve([]);for(var r=new Array(o),i=0,t=-1,a=new this(c);++t<o;)E(e[t],t);return a;function E(e,t){n.resolve(e).then(function(e){r[t]=e,++i!==o||s||(s=!0,u.resolve(a,r))},function(e){s||(s=!0,u.reject(a,e))})}},o.race=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(new TypeError("must be an array"));var n=e.length,o=!1;if(!n)return this.resolve([]);for(var s,r=-1,i=new this(c);++r<n;)s=e[r],t.resolve(s).then(function(e){o||(o=!0,u.resolve(i,e))},function(e){o||(o=!0,u.reject(i,e))});return i}},{1:1}],3:[function(t,e,n){(function(e){"use strict";"function"!=typeof e.Promise&&(e.Promise=t(2))}).call(this,void 0!==o?o:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{2:2}],4:[function(e,t,n){"use strict";var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=function(){try{if("undefined"!=typeof indexedDB)return indexedDB;if("undefined"!=typeof webkitIndexedDB)return webkitIndexedDB;if("undefined"!=typeof mozIndexedDB)return mozIndexedDB;if("undefined"!=typeof OIndexedDB)return OIndexedDB;if("undefined"!=typeof msIndexedDB)return msIndexedDB}catch(e){return}}();function i(t,n){t=t||[],n=n||{};try{return new Blob(t,n)}catch(e){if("TypeError"!==e.name)throw e;for(var o="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,s=new o,r=0;r<t.length;r+=1)s.append(t[r]);return s.getBlob(n.type)}}"undefined"==typeof Promise&&e(3);var S=Promise;function p(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function c(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function u(e){return"string"!=typeof e&&(e=String(e)),e}function r(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var a="local-forage-detect-blob-support",s=void 0,C={},l=Object.prototype.toString,_="readonly",T="readwrite";function d(e){return"boolean"==typeof s?S.resolve(s):(o=e,new S(function(n){var e=o.transaction(a,T),t=i([""]);e.objectStore(a).put(t,"key"),e.onabort=function(e){e.preventDefault(),e.stopPropagation(),n(!1)},e.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/),t=navigator.userAgent.match(/Edge\//);n(t||!e||43<=parseInt(e[1],10))}}).catch(function(){return!1})).then(function(e){return s=e});var o}function A(e){var t=C[e.name],n={};n.promise=new S(function(e,t){n.resolve=e,n.reject=t}),t.deferredOperations.push(n),t.dbReady?t.dbReady=t.dbReady.then(function(){return n.promise}):t.dbReady=n.promise}function h(e){var t=C[e.name],n=t.deferredOperations.pop();if(n)return n.resolve(),n.promise}function g(e,t){var n=C[e.name],o=n.deferredOperations.pop();if(o)return o.reject(t),o.promise}function R(s,r){return new S(function(t,n){if(C[s.name]=C[s.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},s.db){if(!r)return t(s.db);A(s),s.db.close()}var e=[s.name];r&&e.push(s.version);var o=E.open.apply(E,e);r&&(o.onupgradeneeded=function(e){var t=o.result;try{t.createObjectStore(s.storeName),e.oldVersion<=1&&t.createObjectStore(a)}catch(e){if("ConstraintError"!==e.name)throw e}}),o.onerror=function(e){e.preventDefault(),n(o.error)},o.onsuccess=function(){var e=o.result;e.onversionchange=function(e){e.target.close()},t(e),h(s)}})}function I(e){return R(e,!1)}function f(e){return R(e,!0)}function O(e,t){if(!e.db)return!0;var n=!e.db.objectStoreNames.contains(e.storeName),o=e.version<e.db.version,s=e.version>e.db.version;if(o&&(e.version,e.version=e.db.version),s||n){if(n){var r=e.db.version+1;r>e.version&&(e.version=r)}return!0}return!1}function N(e){var t=function(e){for(var t=e.length,n=new ArrayBuffer(t),o=new Uint8Array(n),s=0;s<t;s++)o[s]=e.charCodeAt(s);return n}(atob(e.data));return i([t],{type:e.type})}function y(e){return e&&e.__local_forage_encoded_blob}function P(e){var t=this,n=t._initReady().then(function(){var e=C[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return c(n,e,e),n}function m(t,n,o,s){void 0===s&&(s=1);try{var e=t.db.transaction(t.storeName,n);o(null,e)}catch(e){if(0<s&&(!t.db||"InvalidStateError"===e.name||"NotFoundError"===e.name))return S.resolve().then(function(){if(!t.db||"NotFoundError"===e.name&&!t.db.objectStoreNames.contains(t.storeName)&&t.version<=t.db.version)return t.db&&(t.version=t.db.version+1),f(t)}).then(function(){return function(n){A(n);for(var o=C[n.name],s=o.forages,e=0;e<s.length;e++){var t=s[e];t._dbInfo.db&&(t._dbInfo.db.close(),t._dbInfo.db=null)}return n.db=null,I(n).then(function(e){return n.db=e,O(n)?f(n):e}).then(function(e){n.db=o.db=e;for(var t=0;t<s.length;t++)s[t]._dbInfo.db=e}).catch(function(e){throw g(n,e),e})}(t).then(function(){m(t,n,o,s-1)})}).catch(o);o(e)}}var M={_driver:"asyncStorage",_initStorage:function(e){var o=this,s={db:null};if(e)for(var t in e)s[t]=e[t];var r=C[s.name];r||(r={forages:[],db:null,dbReady:null,deferredOperations:[]},C[s.name]=r),r.forages.push(o),o._initReady||(o._initReady=o.ready,o.ready=P);var n=[];function i(){return S.resolve()}for(var a=0;a<r.forages.length;a++){var E=r.forages[a];E!==o&&n.push(E._initReady().catch(i))}var c=r.forages.slice(0);return S.all(n).then(function(){return s.db=r.db,I(s)}).then(function(e){return s.db=e,O(s,o._defaultConfig.version)?f(s):e}).then(function(e){s.db=r.db=e,o._dbInfo=s;for(var t=0;t<c.length;t++){var n=c[t];n!==o&&(n._dbInfo.db=s.db,n._dbInfo.version=s.version)}})},_support:function(){try{if(!E||!E.open)return!1;var e="undefined"!=typeof openDatabase&&/(Safari|iPhone|iPad|iPod)/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)&&!/BlackBerry/.test(navigator.platform),t="function"==typeof fetch&&-1!==fetch.toString().indexOf("[native code");return(!e||t)&&"undefined"!=typeof indexedDB&&"undefined"!=typeof IDBKeyRange}catch(e){return!1}}(),iterate:function(a,e){var E=this,t=new S(function(r,i){E.ready().then(function(){m(E._dbInfo,_,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName),o=n.openCursor(),s=1;o.onsuccess=function(){var e=o.result;if(e){var t=e.value;y(t)&&(t=N(t));var n=a(t,e.key,s++);void 0!==n?r(n):e.continue()}else r()},o.onerror=function(){i(o.error)}}catch(e){i(e)}})}).catch(i)});return p(t,e),t},getItem:function(i,e){var a=this;i=u(i);var t=new S(function(s,r){a.ready().then(function(){m(a._dbInfo,_,function(e,t){if(e)return r(e);try{var n=t.objectStore(a._dbInfo.storeName),o=n.get(i);o.onsuccess=function(){var e=o.result;void 0===e&&(e=null),y(e)&&(e=N(e)),s(e)},o.onerror=function(){r(o.error)}}catch(e){r(e)}})}).catch(r)});return p(t,e),t},setItem:function(a,t,e){var E=this;a=u(a);var n=new S(function(r,i){var e;E.ready().then(function(){return e=E._dbInfo,"[object Blob]"===l.call(t)?d(e.db).then(function(e){return e?t:(o=t,new S(function(n,e){var t=new FileReader;t.onerror=e,t.onloadend=function(e){var t=btoa(e.target.result||"");n({__local_forage_encoded_blob:!0,data:t,type:o.type})},t.readAsBinaryString(o)}));var o}):t}).then(function(s){m(E._dbInfo,T,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName);null===s&&(s=void 0);var o=n.put(s,a);t.oncomplete=function(){void 0===s&&(s=null),r(s)},t.onabort=t.onerror=function(){var e=o.error?o.error:o.transaction.error;i(e)}}catch(e){i(e)}})}).catch(i)});return p(n,e),n},removeItem:function(i,e){var a=this;i=u(i);var t=new S(function(s,r){a.ready().then(function(){m(a._dbInfo,T,function(e,t){if(e)return r(e);try{var n=t.objectStore(a._dbInfo.storeName),o=n.delete(i);t.oncomplete=function(){s()},t.onerror=function(){r(o.error)},t.onabort=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}})}).catch(r)});return p(t,e),t},clear:function(e){var i=this,t=new S(function(s,r){i.ready().then(function(){m(i._dbInfo,T,function(e,t){if(e)return r(e);try{var n=t.objectStore(i._dbInfo.storeName),o=n.clear();t.oncomplete=function(){s()},t.onabort=t.onerror=function(){var e=o.error?o.error:o.transaction.error;r(e)}}catch(e){r(e)}})}).catch(r)});return p(t,e),t},length:function(e){var i=this,t=new S(function(s,r){i.ready().then(function(){m(i._dbInfo,_,function(e,t){if(e)return r(e);try{var n=t.objectStore(i._dbInfo.storeName),o=n.count();o.onsuccess=function(){s(o.result)},o.onerror=function(){r(o.error)}}catch(e){r(e)}})}).catch(r)});return p(t,e),t},key:function(a,e){var E=this,t=new S(function(r,i){a<0?r(null):E.ready().then(function(){m(E._dbInfo,_,function(e,t){if(e)return i(e);try{var n=t.objectStore(E._dbInfo.storeName),o=!1,s=n.openKeyCursor();s.onsuccess=function(){var e=s.result;e?0===a?r(e.key):o?r(e.key):(o=!0,e.advance(a)):r(null)},s.onerror=function(){i(s.error)}}catch(e){i(e)}})}).catch(i)});return p(t,e),t},keys:function(e){var a=this,t=new S(function(r,i){a.ready().then(function(){m(a._dbInfo,_,function(e,t){if(e)return i(e);try{var n=t.objectStore(a._dbInfo.storeName),o=n.openKeyCursor(),s=[];o.onsuccess=function(){var e=o.result;e?(s.push(e.key),e.continue()):r(s)},o.onerror=function(){i(o.error)}}catch(e){i(e)}})}).catch(i)});return p(t,e),t},dropInstance:function(a,e){e=r.apply(this,arguments);var t,n=this.config();if((a="function"!=typeof a&&a||{}).name||(a.name=a.name||n.name,a.storeName=a.storeName||n.storeName),a.name){var o=a.name===n.name&&this._dbInfo.db,s=o?S.resolve(this._dbInfo.db):I(a).then(function(e){var t=C[a.name],n=t.forages;t.db=e;for(var o=0;o<n.length;o++)n[o]._dbInfo.db=e;return e});t=a.storeName?s.then(function(e){if(e.objectStoreNames.contains(a.storeName)){var s=e.version+1;A(a);var o=C[a.name],r=o.forages;e.close();for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=null,n._dbInfo.version=s}var i=new S(function(t,n){var o=E.open(a.name,s);o.onerror=function(e){var t=o.result;t.close(),n(e)},o.onupgradeneeded=function(){var e=o.result;e.deleteObjectStore(a.storeName)},o.onsuccess=function(){var e=o.result;e.close(),t(e)}});return i.then(function(e){o.db=e;for(var t=0;t<r.length;t++){var n=r[t];n._dbInfo.db=e,h(n._dbInfo)}}).catch(function(e){throw(g(a,e)||S.resolve()).catch(function(){}),e})}}):s.then(function(e){A(a);var o=C[a.name],s=o.forages;e.close();for(var t=0;t<s.length;t++){var n=s[t];n._dbInfo.db=null}var r=new S(function(t,n){var o=E.deleteDatabase(a.name);o.onerror=function(){var e=o.result;e&&e.close(),n(o.error)},o.onblocked=function(){},o.onsuccess=function(){var e=o.result;e&&e.close(),t(e)}});return r.then(function(e){o.db=e;for(var t=0;t<s.length;t++){var n=s[t];h(n._dbInfo)}}).catch(function(e){throw(g(a,e)||S.resolve()).catch(function(){}),e})})}else t=S.reject("Invalid arguments");return p(t,e),t}},v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",L=/^~~local_forage_type~([^~]+)~/,D="__lfsc__:",U=D.length,Y="arbf",G="blob",w=U+Y.length,K=Object.prototype.toString;function b(e){var t,n,o,s,r,i=.75*e.length,a=e.length,E=0;"="===e[e.length-1]&&(i--,"="===e[e.length-2]&&i--);var c=new ArrayBuffer(i),u=new Uint8Array(c);for(t=0;t<a;t+=4)n=v.indexOf(e[t]),o=v.indexOf(e[t+1]),s=v.indexOf(e[t+2]),r=v.indexOf(e[t+3]),u[E++]=n<<2|o>>4,u[E++]=(15&o)<<4|s>>2,u[E++]=(3&s)<<6|63&r;return c}function B(e){var t,n=new Uint8Array(e),o="";for(t=0;t<n.length;t+=3)o+=v[n[t]>>2],o+=v[(3&n[t])<<4|n[t+1]>>4],o+=v[(15&n[t+1])<<2|n[t+2]>>6],o+=v[63&n[t+2]];return n.length%3==2?o=o.substring(0,o.length-1)+"=":n.length%3==1&&(o=o.substring(0,o.length-2)+"=="),o}var F={serialize:function(t,n){var e="";if(t&&(e=K.call(t)),t&&("[object ArrayBuffer]"===e||t.buffer&&"[object ArrayBuffer]"===K.call(t.buffer))){var o,s=D;t instanceof ArrayBuffer?(o=t,s+=Y):(o=t.buffer,"[object Int8Array]"===e?s+="si08":"[object Uint8Array]"===e?s+="ui08":"[object Uint8ClampedArray]"===e?s+="uic8":"[object Int16Array]"===e?s+="si16":"[object Uint16Array]"===e?s+="ur16":"[object Int32Array]"===e?s+="si32":"[object Uint32Array]"===e?s+="ui32":"[object Float32Array]"===e?s+="fl32":"[object Float64Array]"===e?s+="fl64":n(new Error("Failed to get type for BinaryArray"))),n(s+B(o))}else if("[object Blob]"===e){var r=new FileReader;r.onload=function(){var e="~~local_forage_type~"+t.type+"~"+B(this.result);n(D+G+e)},r.readAsArrayBuffer(t)}else try{n(JSON.stringify(t))}catch(e){n(null,e)}},deserialize:function(e){if(e.substring(0,U)!==D)return JSON.parse(e);var t,n=e.substring(w),o=e.substring(U,w);if(o===G&&L.test(n)){var s=n.match(L);t=s[1],n=n.substring(s[0].length)}var r=b(n);switch(o){case Y:return r;case G:return i([r],{type:t});case"si08":return new Int8Array(r);case"ui08":return new Uint8Array(r);case"uic8":return new Uint8ClampedArray(r);case"si16":return new Int16Array(r);case"ur16":return new Uint16Array(r);case"si32":return new Int32Array(r);case"ui32":return new Uint32Array(r);case"fl32":return new Float32Array(r);case"fl64":return new Float64Array(r);default:throw new Error("Unkown type: "+o)}},stringToBuffer:b,bufferToString:B};function V(e,t,n,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,o)}function x(e,o,s,r,i,a){e.executeSql(s,r,i,function(e,n){n.code===n.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[o.storeName],function(e,t){t.rows.length?a(e,n):V(e,o,function(){e.executeSql(s,r,i,a)},a)},a):a(e,n)},a)}function k(i,e,a,E){var c=this;i=u(i);var t=new S(function(s,r){c.ready().then(function(){void 0===e&&(e=null);var n=e,o=c._dbInfo;o.serializer.serialize(e,function(t,e){e?r(e):o.db.transaction(function(e){x(e,o,"INSERT OR REPLACE INTO "+o.storeName+" (key, value) VALUES (?, ?)",[i,t],function(){s(n)},function(e,t){r(t)})},function(e){if(e.code===e.QUOTA_ERR){if(0<E)return void s(k.apply(c,[i,n,a,E-1]));r(e)}})})}).catch(r)});return p(t,a),t}var J={_driver:"webSQLStorage",_initStorage:function(e){var o=this,s={db:null};if(e)for(var t in e)s[t]="string"!=typeof e[t]?e[t].toString():e[t];var n=new S(function(t,n){try{s.db=openDatabase(s.name,String(s.version),s.description,s.size)}catch(e){return n(e)}s.db.transaction(function(e){V(e,s,function(){o._dbInfo=s,t()},function(e,t){n(t)})},n)});return s.serializer=F,n},_support:"function"==typeof openDatabase,iterate:function(c,e){var t=this,n=new S(function(E,n){t.ready().then(function(){var a=t._dbInfo;a.db.transaction(function(e){x(e,a,"SELECT * FROM "+a.storeName,[],function(e,t){for(var n=t.rows,o=n.length,s=0;s<o;s++){var r=n.item(s),i=r.value;if(i&&(i=a.serializer.deserialize(i)),void 0!==(i=c(i,r.key,s+1)))return void E(i)}E()},function(e,t){n(t)})})}).catch(n)});return p(n,e),n},getItem:function(t,e){var r=this;t=u(t);var n=new S(function(s,n){r.ready().then(function(){var o=r._dbInfo;o.db.transaction(function(e){x(e,o,"SELECT * FROM "+o.storeName+" WHERE key = ? LIMIT 1",[t],function(e,t){var n=t.rows.length?t.rows.item(0).value:null;n&&(n=o.serializer.deserialize(n)),s(n)},function(e,t){n(t)})})}).catch(n)});return p(n,e),n},setItem:function(e,t,n){return k.apply(this,[e,t,n,1])},removeItem:function(s,e){var r=this;s=u(s);var t=new S(function(n,o){r.ready().then(function(){var t=r._dbInfo;t.db.transaction(function(e){x(e,t,"DELETE FROM "+t.storeName+" WHERE key = ?",[s],function(){n()},function(e,t){o(t)})})}).catch(o)});return p(t,e),t},clear:function(e){var s=this,t=new S(function(n,o){s.ready().then(function(){var t=s._dbInfo;t.db.transaction(function(e){x(e,t,"DELETE FROM "+t.storeName,[],function(){n()},function(e,t){o(t)})})}).catch(o)});return p(t,e),t},length:function(e){var s=this,t=new S(function(o,n){s.ready().then(function(){var t=s._dbInfo;t.db.transaction(function(e){x(e,t,"SELECT COUNT(key) as c FROM "+t.storeName,[],function(e,t){var n=t.rows.item(0).c;o(n)},function(e,t){n(t)})})}).catch(n)});return p(t,e),t},key:function(s,e){var r=this,t=new S(function(o,n){r.ready().then(function(){var t=r._dbInfo;t.db.transaction(function(e){x(e,t,"SELECT key FROM "+t.storeName+" WHERE id = ? LIMIT 1",[s+1],function(e,t){var n=t.rows.length?t.rows.item(0).key:null;o(n)},function(e,t){n(t)})})}).catch(n)});return p(t,e),t},keys:function(e){var o=this,t=new S(function(s,n){o.ready().then(function(){var t=o._dbInfo;t.db.transaction(function(e){x(e,t,"SELECT key FROM "+t.storeName,[],function(e,t){for(var n=[],o=0;o<t.rows.length;o++)n.push(t.rows.item(o).key);s(n)},function(e,t){n(t)})})}).catch(n)});return p(t,e),t},dropInstance:function(n,e){e=r.apply(this,arguments);var o=this.config();(n="function"!=typeof n&&n||{}).name||(n.name=n.name||o.name,n.storeName=n.storeName||o.storeName);var t,s=this;return p(t=n.name?new S(function(e){var t,r;t=n.name===o.name?s._dbInfo.db:openDatabase(n.name,"","",0),n.storeName?e({db:t,storeNames:[n.storeName]}):e((r=t,new S(function(s,n){r.transaction(function(e){e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(e,t){for(var n=[],o=0;o<t.rows.length;o++)n.push(t.rows.item(o).name);s({db:r,storeNames:n})},function(e,t){n(t)})},function(e){n(e)})})))}).then(function(a){return new S(function(r,i){a.db.transaction(function(o){function e(t){return new S(function(e,n){o.executeSql("DROP TABLE IF EXISTS "+t,[],function(){e()},function(e,t){n(t)})})}for(var t=[],n=0,s=a.storeNames.length;n<s;n++)t.push(e(a.storeNames[n]));S.all(t).then(function(){r()}).catch(function(e){i(e)})},function(e){i(e)})})}):S.reject("Invalid arguments"),e),t}};function H(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}function W(){return!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||0<localStorage.length}var j={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=H(e,this._defaultConfig),W()?((this._dbInfo=t).serializer=F,S.resolve()):S.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(E,e){var c=this,t=c.ready().then(function(){for(var e=c._dbInfo,t=e.keyPrefix,n=t.length,o=localStorage.length,s=1,r=0;r<o;r++){var i=localStorage.key(r);if(0===i.indexOf(t)){var a=localStorage.getItem(i);if(a&&(a=e.serializer.deserialize(a)),void 0!==(a=E(a,i.substring(n),s++)))return a}}});return p(t,e),t},getItem:function(n,e){var o=this;n=u(n);var t=o.ready().then(function(){var e=o._dbInfo,t=localStorage.getItem(e.keyPrefix+n);return t&&(t=e.serializer.deserialize(t)),t});return p(t,e),t},setItem:function(i,e,t){var a=this;i=u(i);var n=a.ready().then(function(){void 0===e&&(e=null);var r=e;return new S(function(n,o){var s=a._dbInfo;s.serializer.serialize(e,function(e,t){if(t)o(t);else try{localStorage.setItem(s.keyPrefix+i,e),n(r)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||o(e),o(e)}})})});return p(n,t),n},removeItem:function(t,e){var n=this;t=u(t);var o=n.ready().then(function(){var e=n._dbInfo;localStorage.removeItem(e.keyPrefix+t)});return p(o,e),o},clear:function(e){var o=this,t=o.ready().then(function(){for(var e=o._dbInfo.keyPrefix,t=localStorage.length-1;0<=t;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}});return p(t,e),t},length:function(e){var t=this.keys().then(function(e){return e.length});return p(t,e),t},key:function(n,e){var o=this,t=o.ready().then(function(){var t,e=o._dbInfo;try{t=localStorage.key(n)}catch(e){t=null}return t&&(t=t.substring(e.keyPrefix.length)),t});return p(t,e),t},keys:function(e){var r=this,t=r.ready().then(function(){for(var e=r._dbInfo,t=localStorage.length,n=[],o=0;o<t;o++){var s=localStorage.key(o);0===s.indexOf(e.keyPrefix)&&n.push(s.substring(e.keyPrefix.length))}return n});return p(t,e),t},dropInstance:function(t,e){if(e=r.apply(this,arguments),!(t="function"!=typeof t&&t||{}).name){var n=this.config();t.name=t.name||n.name,t.storeName=t.storeName||n.storeName}var o,s=this;return p(o=t.name?new S(function(e){t.storeName?e(H(t,s._defaultConfig)):e(t.name+"/")}).then(function(e){for(var t=localStorage.length-1;0<=t;t--){var n=localStorage.key(t);0===n.indexOf(e)&&localStorage.removeItem(n)}}):S.reject("Invalid arguments"),e),o}},X=function(e,t){for(var n=e.length,o=0;o<n;){if((s=e[o])===(r=t)||"number"==typeof s&&"number"==typeof r&&isNaN(s)&&isNaN(r))return!0;o++}var s,r;return!1},q=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},z={},Q={},Z={INDEXEDDB:M,WEBSQL:J,LOCALSTORAGE:j},$=[Z.INDEXEDDB._driver,Z.WEBSQL._driver,Z.LOCALSTORAGE._driver],ee=["dropInstance"],te=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(ee),ne={description:"",driver:$.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function oe(t,n){t[n]=function(){var e=arguments;return t.ready().then(function(){return t[n].apply(t,e)})}}function se(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(q(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}var re=function(){function s(e){for(var t in function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,s),Z)if(Z.hasOwnProperty(t)){var n=Z[t],o=n._driver;this[t]=o,z[o]||this.defineDriver(n)}this._defaultConfig=se({},ne),this._config=se({},this._defaultConfig,e),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return s.prototype.config=function(e){if("object"!==(void 0===e?"undefined":o(e)))return"string"==typeof e?this._config[e]:this._config;if(this._ready)return new Error("Can't call config() after localforage has been used.");for(var t in e){if("storeName"===t&&(e[t]=e[t].replace(/\W/g,"_")),"version"===t&&"number"!=typeof e[t])return new Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)},s.prototype.defineDriver=function(u,e,t){var n=new S(function(t,n){try{var o=u._driver,e=new Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!u._driver)return void n(e);for(var s=te.concat("_initStorage"),r=0,i=s.length;r<i;r++){var a=s[r],E=!X(ee,a);if((E||u[a])&&"function"!=typeof u[a])return void n(e)}!function(){for(var e=function(n){return function(){var e=new Error("Method "+n+" is not implemented by the current driver"),t=S.reject(e);return p(t,arguments[arguments.length-1]),t}},t=0,n=ee.length;t<n;t++){var o=ee[t];u[o]||(u[o]=e(o))}}();var c=function(e){z[o],z[o]=u,Q[o]=e,t()};"_support"in u?u._support&&"function"==typeof u._support?u._support().then(c,n):c(!!u._support):c(!0)}catch(e){n(e)}});return c(n,e,t),n},s.prototype.driver=function(){return this._driver||null},s.prototype.getDriver=function(e,t,n){var o=z[e]?S.resolve(z[e]):S.reject(new Error("Driver not found."));return c(o,t,n),o},s.prototype.getSerializer=function(e){var t=S.resolve(F);return c(t,e),t},s.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return c(n,e,e),n},s.prototype.setDriver=function(e,t,n){var r=this;q(e)||(e=[e]);var o=this._getSupportedDrivers(e);function i(){r._config.driver=r.driver()}function a(e){return r._extend(e),i(),r._ready=r._initStorage(r._config),r._ready}var s=null!==this._driverSet?this._driverSet.catch(function(){return S.resolve()}):S.resolve();return this._driverSet=s.then(function(){var e=o[0];return r._dbInfo=null,r._ready=null,r.getDriver(e).then(function(e){var s;r._driver=e._driver,i(),r._wrapLibraryMethodsWithReady(),r._initDriver=(s=o,function(){var n=0;function o(){for(;n<s.length;){var e=s[n];return n++,r._dbInfo=null,r._ready=null,r.getDriver(e).then(a).catch(o)}i();var t=new Error("No available storage method found.");return r._driverSet=S.reject(t),r._driverSet}return o()})})}).catch(function(){i();var e=new Error("No available storage method found.");return r._driverSet=S.reject(e),r._driverSet}),c(this._driverSet,t,n),this._driverSet},s.prototype.supports=function(e){return!!Q[e]},s.prototype._extend=function(e){se(this,e)},s.prototype._getSupportedDrivers=function(e){for(var t=[],n=0,o=e.length;n<o;n++){var s=e[n];this.supports(s)&&t.push(s)}return t},s.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=te.length;e<t;e++)oe(this,te[e])},s.prototype.createInstance=function(e){return new s(e)},s}(),ie=new re;t.exports=ie},{3:3}]},{},[4])(4)}).call(this,n(48))},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorage=void 0;var o=n(0),s=n(1),r=n(14),i=n(5),a=n(2),E=function(){function e(e){this.store=s.constants.DEFAULT_STORE,o.isFalsy(e)||(this.store=e),this.localStore=r.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),s.LOCAL_STORE.COMMON_STORE)}),this.localStore.setDriver([r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL])}return e.getInstance=function(){return null==e.localStorage&&(e.localStorage=new e),e.localStorage},e.prototype.set=function(e,t){return this.localStore.setItem(e,JSON.stringify(t))},e.prototype.remove=function(e){this.localStore.removeItem(e)},e.prototype.update=function(e,t){this.remove(e),this.set(e,t)},e.prototype.get=function(e){var o=this;return new Promise(function(n,t){try{o.localStore.getItem(e).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clearStore=function(){var o=this;return new Promise(function(n,t){try{o.localStore.keys().then(function(e){if(0<e.length)for(var t=0;t<e.length;t++)"appId"!==e[t]&&o.localStore.removeItem(e[t]),t===e.length-1&&n(!0)})}catch(e){t(e)}})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.localStorage=null,e}();t.LocalStorage=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsController=void 0;var o=n(9),s=n(1),r=n(0),i=function(){function e(){}return e.trasformJSONGroup=function(e){var t;try{t=new o.Group(e[s.GroupConstants.KEYS.GUID],e[s.GroupConstants.KEYS.NAME],e[s.GroupConstants.KEYS.TYPE]),e.wsChannel&&delete e.wsChannel,Object.assign(t,e),e=t}catch(e){r.Logger.error("GroupsController:transformJSONGroup",e)}return e},e}();t.GroupsController=i},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.TextMessage=void 0;var s=n(7),a=n(1),E=n(3),c=n(9),u=n(0),S=function(s){function e(e,t,n){var o=s.call(this,e,"text",n,a.MessageCategory.MESSAGE)||this;return o.type="text",o.data={text:t},o.text=t,o}return r(e,s),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getText=function(){return this.text},e.prototype.setText=function(e){this.text=e,this.data.text=e},e.prototype.setProcessedText=function(e){this.processedText=e},e.prototype.getProcessedText=function(){return this.processedText},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("TextMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new c.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("TextMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE.TEXT,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY.MESSAGE,e}(s.BaseMessage);t.TextMessage=S},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionCount=void 0;var o=n(0),s=function(){function e(e,t,n){this.reactedByMe=!1,o.isFalsy(e)||(this.reaction=e),o.isFalsy(t)||(this.count=t),null===n&&void 0===n||(this.reactedByMe=n)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getCount=function(){return this.count},e.prototype.setCount=function(e){this.count=e},e.prototype.getReactedByMe=function(){return!!this.reactedByMe&&this.reactedByMe},e.prototype.setReactedByMe=function(e){this.reactedByMe=e},e}();t.ReactionCount=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.MediaMessage=void 0;var r=n(7),a=n(1),E=n(3),c=n(20),u=n(9),S=n(0),p=function(r){function e(e,t,n,o){var s=r.call(this,e,n,o,a.MessageCategory.MESSAGE)||this;return s.data={},"object"!=typeof t?s.data={url:t}:t&&(0<t.length?s.files=t:s.files=[t]),s}return s(e,r),e.prototype.setCaption=function(e){this.caption=e,this.data[a.MessageConstatnts.KEYS.TEXT]=e},e.prototype.getCaption=function(){return this.data[a.MessageConstatnts.KEYS.TEXT]},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getAttachment=function(){return new c.Attachment(this.data.attachments[0])},e.prototype.setAttachment=function(e){this.data.attachments=[c.Attachment.toJSON(e)]},e.prototype.getAttachments=function(){var e=[];if(this.data.attachments&&0<this.data.attachments.length)for(var t=0;t<this.data.attachments.length;t++)e.push(new c.Attachment(this.data.attachments[t]));return e},e.prototype.setAttachments=function(e){var t=[];if(e&&0<e.length)for(var n=0;n<e.length;n++)t.push(c.Attachment.toJSON(e[n]));this.data.attachments=t},e.prototype.getURL=function(){try{var e=this.getData();if(e[a.MessageConstatnts.KEYS.URL])return e[a.MessageConstatnts.KEYS.URL]}catch(e){S.Logger.error("MediaMessageModel: getURL",e)}},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new E.User(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.SENDER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw S.Logger.error("MediaMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][a.MessageConstatnts.KEYS.RECEIVER][a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[a.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new E.User(t);var n=new u.Group(t[a.GroupConstants.KEYS.GUID],t[a.GroupConstants.KEYS.NAME],t[a.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw S.Logger.error("MediaMessageModel: getReceiverFromData",e),e}},e.TYPE=a.MessageConstatnts.TYPE,e.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=a.MessageConstatnts.CATEGORY,e}(r.BaseMessage);t.MediaMessage=p},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Attachment=void 0;var o=n(1),s=function(){function t(e){e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION)&&(this.extension=e[o.ATTACHMENTS_CONSTANTS.KEYS.EXTENSION]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE)&&(this.mimeType=e[o.ATTACHMENTS_CONSTANTS.KEYS.MIME_TYPE]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.NAME)&&(this.name=e[o.ATTACHMENTS_CONSTANTS.KEYS.NAME]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.SIZE)&&(this.size=e[o.ATTACHMENTS_CONSTANTS.KEYS.SIZE]),e.hasOwnProperty(o.ATTACHMENTS_CONSTANTS.KEYS.URL)&&(this.url=e[o.ATTACHMENTS_CONSTANTS.KEYS.URL])}return t.prototype.createFileFromJSON=function(e){return new t(e)},t.toJSON=function(e){return{extension:e.getExtension(),mimeType:e.getMimeType(),name:e.getName(),url:e.getUrl(),size:e.getSize()}},t.prototype.getExtension=function(){return this.extension},t.prototype.setExtension=function(e){this.extension=e},t.prototype.getMimeType=function(){return this.mimeType},t.prototype.setMimeType=function(e){this.mimeType=e},t.prototype.getName=function(){return this.name},t.prototype.setName=function(e){this.name=e},t.prototype.getSize=function(){return this.size},t.prototype.setSize=function(e){this.size=e},t.prototype.getUrl=function(){return this.url},t.prototype.setUrl=function(e){this.url=e},t}();t.Attachment=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.CustomMessage=void 0;var i=n(7),E=n(1),c=n(3),u=n(0),S=n(9),a=function(a){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(3==e.length){var o=e[0],s=e[1],r=e[2];n=a.call(this,o,E.MessageConstatnts.TYPE.CUSTOM,s,E.MessageCategory.MESSAGE)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}if(4==e.length){o=e[0],s=e[1];var i=e[2];r=e[3];n=a.call(this,o,i,s,E.MessageCategory.CUSTOM)||this,("object"!=typeof r||Array.isArray(r))&&(r={}),n.customData=r,u.isFalsy(n.data)&&(n.data={}),n.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=r}return n}return s(e,a),e.prototype.getConversationText=function(){var e;return null!==(e=this.data.text)&&void 0!==e?e:""},e.prototype.setConversationText=function(e){this.data.text=e},e.prototype.willUpdateConversation=function(){var e;return null!==(e=this.data.updateConversation)&&void 0!==e&&e},e.prototype.shouldUpdateConversation=function(e){this.data.updateConversation=e},e.prototype.willSendNotification=function(){var e;return null!==(e=this.data.sendNotification)&&void 0!==e&&e},e.prototype.shouldSendNotification=function(e){this.data.sendNotification=e},e.prototype.getCustomData=function(){return this.customData},e.prototype.setCustomData=function(e){this.customData=e,this.data[E.MessageConstatnts.KEYS.CUSTOM_DATA]=e},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getSubType=function(){return this.subType},e.prototype.setSubType=function(e){this.subType=e,this.data=r(r({},this.data),{subType:e})},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new c.User(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.SENDER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][E.MessageConstatnts.KEYS.RECEIVER][E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new c.User(t);var n=new S.Group(t[E.GroupConstants.KEYS.GUID],t[E.GroupConstants.KEYS.NAME],t[E.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("CustomMessageModel: getReceiverFromData",e),e}},e}(i.BaseMessage);t.CustomMessage=a},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.InteractiveMessage=void 0;var i=n(7),c=n(1),a=n(3),u=n(0),S=n(9),p=n(37),C=n(23),E=function(E){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var n=this;if(4==e.length){var o=e[0],s=e[1],r=e[2],i=e[3];(n=E.call(this,o,r,s,c.MessageCategory.INTERACTIVE)||this).interactionGoal=new p.InteractionGoal(c.GoalType.NONE,[]),("object"!=typeof i||Array.isArray(i))&&(i={}),n.interactiveData=i,n.interactions=[],u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=new p.InteractionGoal(c.GoalType.NONE,[])}else if(5==e.length){o=e[0],s=e[1],r=e[2],i=e[3];var a=e[4];n=E.call(this,o,r,s,c.MessageCategory.INTERACTIVE)||this,("object"!=typeof i||Array.isArray(i))&&(i={}),("object"!=typeof a||Array.isArray(a))&&(a={}),n.interactiveData=i,n.interactionGoal=a,u.isFalsy(n.data)&&(n.data={}),n.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=i,n.data[c.MessageConstatnts.KEYS.INTERACTION_GOAL]=a,n.interactions=[]}return n}return s(e,E),e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getInteractiveData=function(){return this.interactiveData},e.prototype.setInteractiveData=function(e){this.interactiveData=e,this.data[c.MessageConstatnts.KEYS.INTERACTIVE_DATA]=e},e.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},e.prototype.getInteractionGoal=function(){try{return this.getInteractionGoalFromdata()}catch(e){return this.interactionGoal}},e.prototype.setInteractionGoal=function(e){this.interactionGoal=e,this.data=r(r({},this.data),{interactionGoal:e})},e.prototype.getInteractions=function(){try{return this.getInteractionsFromData()}catch(e){return this.interactions}},e.prototype.setInteractions=function(e){this.interactions=e;var t=c.MessageConstatnts.KEYS.INTERACTIONS;this.data[t]=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},e.prototype.getData=function(){return this.data},e.prototype.getTags=function(){return this.tags},e.prototype.setTags=function(e){this.tags=e},e.prototype.setIsSenderInteractionAllowed=function(e){this.allowSenderInteraction=e;var t=c.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION;this.data[t]=e},e.prototype.getIsSenderInteractionAllowed=function(e){return this.allowSenderInteraction},e.prototype.getInteractionGoalFromdata=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL])return new p.InteractionGoal(e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.TYPE],e[c.MessageConstatnts.KEYS.INTERACTION_GOAL][c.MessageConstatnts.KEYS.ELEMENT_IDS])}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getInteractionsFromData=function(){try{var e=this.getData();if(e[c.MessageConstatnts.KEYS.INTERACTIONS])return(e[c.MessageConstatnts.KEYS.INTERACTIONS]||[]).map(function(e){return new C.Interaction(e[c.MessageConstatnts.KEYS.ELEMENT_ID],e[c.MessageConstatnts.KEYS.INTERACTED_AT])})}catch(e){throw u.Logger.error("InteractiveMessageModel: getFromData",e),e}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.SENDER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw u.Logger.error("CustomMessageModel: getSenderFromData",e),e}},e.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][c.MessageConstatnts.KEYS.RECEIVER][c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==[c.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER])return new a.User(t);var n=new S.Group(t[c.GroupConstants.KEYS.GUID],t[c.GroupConstants.KEYS.NAME],t[c.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw u.Logger.error("InteractiveMessageModel: getReceiverFromData",e),e}},e.TYPE=c.MessageConstatnts.TYPE,e.RECEIVER_TYPE=c.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=c.MessageConstatnts.CATEGORY,e}(i.BaseMessage);t.InteractiveMessage=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Interaction=void 0;var o=n(1),s=function(){function n(e,t){this.elementId=e,this.interactedAt=t}return n.prototype.getElementId=function(){return this.elementId},n.prototype.getInteractedAt=function(){return this.interactedAt},n.prototype.setElementId=function(e){this.elementId=e},n.prototype.setInteractedAt=function(e){this.interactedAt=this.interactedAt},n.getInteractionFromJSON=function(e){var t=e[o.MessageConstatnts.KEYS.INTERACTED_AT];return new n(e[o.MessageConstatnts.KEYS.ELEMENT_ID],t)},n}();t.Interaction=s},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Action=void 0;var i=n(7),c=n(9),u=n(3),S=n(1),a=n(0),p=n(11),E=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return s(t,e),t.actionFromJSON=function(e){var t=new this(e[S.MessageConstatnts.KEYS.RECEIVER],e[S.MessageConstatnts.KEYS.TYPE],e[S.MessageConstatnts.KEYS.RECEIVER_TYPE],S.MessageCategory.ACTION),n=e[S.MessageConstatnts.KEYS.DATA];if(t.data=n,t.setAction(n[S.MessageConstatnts.KEYS.ACTION]),n[S.ActionConstatnts.ACTION_KEYS.EXTRAS]){var o=n[S.ActionConstatnts.ACTION_KEYS.EXTRAS];if(o[S.ActionConstatnts.ACTION_KEYS.SCOPE]){var s=o[S.ActionConstatnts.ACTION_KEYS.SCOPE];s[S.ActionConstatnts.ACTION_KEYS.NEW]&&s[S.ActionConstatnts.ACTION_KEYS.OLD]&&(t.setOldScope(s[S.ActionConstatnts.ACTION_KEYS.OLD]),t.setNewScope(s[S.ActionConstatnts.ACTION_KEYS.NEW]))}}n[S.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[S.MessageConstatnts.KEYS.METADATA]);var r=n[S.ActionConstatnts.ACTION_KEYS.ENTITIES];if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=i,t.setSender(i)}else{var a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=a}if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=i}else{a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=a}if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON])if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){i=new u.User(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=i}else if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.GROUP){a=new c.Group("","","");Object.assign(a,r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=a}else if(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.MESSAGE){var E=p.MessageController.trasformJSONMessge(r[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][S.ActionConstatnts.ACTION_KEYS.ENTITY]);t.actionOn=E}return t.setMessage(t.getActionMessage(t)),t},t.prototype.getOldScope=function(){return this.oldScope},t.prototype.setOldScope=function(e){this.oldScope=e},t.prototype.getNewScope=function(){return this.newScope},t.prototype.setNewScope=function(e){this.newScope=e},t.prototype.getRawData=function(){return this.rawData},t.prototype.setRawData=function(e){this.rawData=e},t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getActionBy=function(){return this.actionBy},t.prototype.setActionBy=function(e){this.actionBy=e},t.prototype.getActionOn=function(){return this.actionOn},t.prototype.setActionOn=function(e){this.actionOn=e},t.prototype.getActionFor=function(){return this.actionFor},t.prototype.setActionFor=function(e){this.actionFor=e},t.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},t.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},t.prototype.getActionMessage=function(e){var t="";switch(e.getType()){case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_USER:case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP:switch(e.getAction()){case S.ActionConstatnts.ACTION_KEYS.ACTION_CREATED:case S.ActionConstatnts.ACTION_KEYS.ACTION_UPDATED:case S.ActionConstatnts.ACTION_KEYS.ACTION_DELETED:}break;case S.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP_MEMBER:switch(e.getAction()){case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_JOINED:var n=e.getActionBy();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_GROUP_JOINED_MESSAGE,n.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_LEFT:n=e.getActionBy();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_GROUP_LEFT_MESSAGE,n.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_KICKED:n=e.getActionBy();var o=e.getActionOn();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_KICKED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_BANNED:n=e.getActionBy(),o=e.getActionOn();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_BANNED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_UNBANNED:n=e.getActionBy(),o=e.getActionOn();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_UNBANNED_MESSAGE,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.ACTION_SCOPE_CHANGED:n=e.getActionBy(),o=e.getActionOn();var s=e.getNewScope();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_SCOPE_CHANGED,n.getName(),o.getName(),s);break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_ADDED:n=e.getActionBy(),o=e.getActionOn();t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MEMBER_ADDED_TO_GROUP,n.getName(),o.getName());break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_EDITED:t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MESSAGE_EDITED_MESSAGE,"");break;case S.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_DELETED:t=a.format(S.ActionConstatnts.ActionMessages.ACTION_MESSAGE_DELETED_MESSAGE,"")}}return t},t.prototype.getSenderFromData=function(){var e=this.data[S.ActionConstatnts.ACTION_KEYS.ENTITIES];if(e[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY]&&e[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==S.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var t=new u.User(e[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]);return Object.assign(t,e[S.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][S.ActionConstatnts.ACTION_KEYS.ENTITY]),t}},t.TYPE=S.MessageConstatnts.TYPE,t.RECEIVER_TYPE=S.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=S.MessageConstatnts.CATEGORY,t.ACTION_TYPE=S.ActionConstatnts.ACTION_TYPE,t}(i.BaseMessage);t.Action=E},function(e,t,n){"use strict";var o,r=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}),i=this&&this.__assign||function(){return(i=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.Call=void 0;var s=n(7),a=n(9),E=n(1),c=n(0),u=n(3),S=function(s){function e(e,t,n,o){return c.isFalsy(o)?s.call(this,e,t,n,E.MessageCategory.CALL)||this:s.call(this,e,t,n,o)||this}return r(e,s),e.prototype.getCallInitiator=function(){try{return this.getCallInitiatedByFromData()}catch(e){return this.callInitiator}},e.prototype.setCallInitiator=function(e){this.callInitiator=e},e.prototype.getCallReceiver=function(){try{return this.getCallReceivedByFromData()}catch(e){return this.callReceiver}},e.prototype.setCallReceiver=function(e){this.callReceiver=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSessionId=function(){return this.sessionId},e.prototype.setSessionId=function(e){this.sessionId=e},e.prototype.getMetadata=function(){return this.data.metadata&&(this.metadata=this.data.metadata),this.metadata},e.prototype.setMetadata=function(e){this.metadata=e,this.data=i(i({},this.data),{metadata:e})},e.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},e.prototype.getAction=function(){return this.action},e.prototype.setAction=function(e){this.action=e},e.prototype.getInitiatedAt=function(){return this.initiatedAt},e.prototype.setInitiatedAt=function(e){this.initiatedAt=e},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.getRawData=function(){return this.rawData},e.prototype.setRawData=function(e){this.rawData=e},e.callFromJSON=function(e){try{var t=new this(e[E.MessageConstatnts.KEYS.RECEIVER],e[E.MessageConstatnts.KEYS.TYPE],e[E.MessageConstatnts.KEYS.RECEIVER_TYPE],E.MessageCategory.CALL),n=e[E.MessageConstatnts.KEYS.DATA];t.setAction(n[E.MessageConstatnts.KEYS.ACTION]),n[E.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[E.MessageConstatnts.KEYS.METADATA]);var o=n[E.ActionConstatnts.ACTION_KEYS.ENTITIES];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY];if(o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON]){var s=o[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON];if(s[E.CallConstants.CALL_KEYS.CALL_ENTITY]){var r=s[E.CallConstants.CALL_KEYS.CALL_ENTITY];if(r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]&&(t.sessionId=r[E.CallConstants.CALL_KEYS.CALL_SESSION_ID]),r[E.CallConstants.CALL_KEYS.CALL_STATUS]&&(t.status=r[E.CallConstants.CALL_KEYS.CALL_STATUS]),r[E.CallConstants.CALL_KEYS.CALL_DATA]){var i=r[E.CallConstants.CALL_KEYS.CALL_DATA];if(i[E.CallConstants.CALL_KEYS.CALL_METADATA]&&(t.metadata=i[E.CallConstants.CALL_KEYS.CALL_METADATA]),i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES])i[E.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES]}r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]&&(t.initiatedAt=r[E.CallConstants.CALL_KEYS.CALL_INITIATED_AT]),r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]&&(t.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_JOINED_AT]),r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT]&&(t.joinedAt=r[E.CallConstants.CALL_KEYS.CALL_LEFT_AT])}}return t}catch(e){c.Logger.error("CallModel: callFromJSON",e)}},e.prototype.getSenderFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getSenderFromData",e),e}},e.prototype.getCallInitiatedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER])return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.CallConstants.CALL_KEYS.CALL_DATA][E.ActionConstatnts.ACTION_KEYS.ENTITIES][E.CallConstants.CALL_KEYS.CALL_SENDER][E.CallConstants.CALL_KEYS.CALL_ENTITY])}catch(e){throw c.Logger.error("CallModel:getCallInitiatedByFromData",e),e}},e.prototype.getCallReceivedByFromData=function(){try{var e=this.getData();if((e=e[E.ActionConstatnts.ACTION_KEYS.ENTITIES])[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]){if(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY_TYPE]==E.CallConstants.CALL_KEYS.CALL_ENTITY_USER)return new u.User(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY]);var t=new a.Group(e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.GUID],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.NAME],e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY][E.GroupConstants.KEYS.TYPE]);return Object.assign(t,e[E.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][E.CallConstants.CALL_KEYS.CALL_ENTITY])}}catch(e){throw c.Logger.error("CallModel:getCallReceivedByFromData",e),e}},e.TYPE=E.MessageConstatnts.TYPE,e.RECEIVER_TYPE=E.MessageConstatnts.RECEIVER_TYPE,e.CATEGORY=E.MessageConstatnts.CATEGORY,e.ACTION_TYPE=E.ActionConstatnts.ACTION_TYPE,e}(s.BaseMessage);t.Call=S},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceipt=void 0;var o=function(){function e(){this.RECEIPT_TYPE={READ_RECEIPT:"read",DELIVERY_RECEIPT:"delivery",READ_BY_ALL_RECEIPT:"readByAll",DELIVERED_TO_ALL_RECEIPT:"deliveredToAll"},this.receiptType=this.RECEIPT_TYPE.DELIVERY_RECEIPT}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiver=function(){return this.receiver},e.prototype.setReceiver=function(e){this.receiver=e},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.setTimestamp=function(e){this.timestamp=e},e.prototype.setReadAt=function(e){this.readAt=e},e.prototype.getReadAt=function(){return this.readAt},e.prototype.setDeliveredAt=function(e){this.deliveredAt=e},e.prototype.getDeliveredAt=function(){return this.deliveredAt},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReceiptType=function(){return this.receiptType},e.prototype.setReceiptType=function(e){void 0===e&&(e=this.RECEIPT_TYPE.DELIVERY_RECEIPT),this.receiptType=e},e}();t.MessageReceipt=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.KeyStore=void 0;var o=n(5),s=n(0),r=n(1),i=n(14),a=n(2),E=function(){function e(e){this.store=r.constants.DEFAULT_STORE,s.isFalsy(e)||(this.store=e),this.keyStore=i.createInstance({name:s.format(r.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),r.LOCAL_STORE.KEYS_STORE)}),this.keyStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return e.getInstance=function(){return null==e.KeyStore&&(e.KeyStore=new e),e.KeyStore},e.prototype.set=function(e,t){return this.keyStore.setItem(e,t)},e.prototype.remove=function(e){this.keyStore.removeItem(e)},e.prototype.get=function(e){var o=this;return new Promise(function(n,t){try{o.keyStore.getItem(e).then(function(t){try{n(JSON.parse(t))}catch(e){n(t)}},function(e){t(e)})}catch(e){t(new a.CometChatException(e))}})},e.prototype.clearStore=function(){return this.keyStore.clear()},e}();t.KeyStore=E},function(e,t,n){"use strict";var o,i=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.WSConnectionListener=t.UserLoginListener=t.CallsListener=t.UserCallListener=t.GroupsListener=t.UsersListener=t.MessagesListener=t.Listener=t.ConnectionListener=t.LoginListener=t.OngoingCallListener=t.GroupListener=t.UserListener=t.CallListener=t.MessageListener=void 0;var s=n(0),r=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onTextMessageReceived=void 0,this.onMediaMessageReceived=void 0,this.onCustomMessageReceived=void 0,this.onTypingStarted=void 0,this.onTypingEnded=void 0,this.onMessagesDelivered=void 0,this.onMessagesRead=void 0,this.onMessageEdited=void 0,this.onMessageDeleted=void 0,this.onTransientMessageReceived=void 0,this.onInteractiveMessageReceived=void 0,this.onInteractionGoalCompleted=void 0,this.onMessageReactionAdded=void 0,this.onMessageReactionRemoved=void 0,this.onMessagesDeliveredToAll=void 0,this.onMessagesReadByAll=void 0,s.isFalsy(e[0].onTextMessageReceived)||(this.onTextMessageReceived=e[0].onTextMessageReceived),s.isFalsy(e[0].onMediaMessageReceived)||(this.onMediaMessageReceived=e[0].onMediaMessageReceived),s.isFalsy(e[0].onTypingStarted)||(this.onTypingStarted=e[0].onTypingStarted),s.isFalsy(e[0].onTypingEnded)||(this.onTypingEnded=e[0].onTypingEnded),s.isFalsy(e[0].onMessagesDelivered)||(this.onMessagesDelivered=e[0].onMessagesDelivered),s.isFalsy(e[0].onMessagesRead)||(this.onMessagesRead=e[0].onMessagesRead),s.isFalsy(e[0].onCustomMessageReceived)||(this.onCustomMessageReceived=e[0].onCustomMessageReceived),s.isFalsy(e[0].onMessageEdited)||(this.onMessageEdited=e[0].onMessageEdited),s.isFalsy(e[0].onMessageDeleted)||(this.onMessageDeleted=e[0].onMessageDeleted),s.isFalsy(e[0].onTransientMessageReceived)||(this.onTransientMessageReceived=e[0].onTransientMessageReceived),s.isFalsy(e[0].onInteractiveMessageReceived)||(this.onInteractiveMessageReceived=e[0].onInteractiveMessageReceived),s.isFalsy(e[0].onInteractionGoalCompleted)||(this.onInteractionGoalCompleted=e[0].onInteractionGoalCompleted),s.isFalsy(e[0].onMessageReactionAdded)||(this.onMessageReactionAdded=e[0].onMessageReactionAdded),s.isFalsy(e[0].onMessageReactionRemoved)||(this.onMessageReactionRemoved=e[0].onMessageReactionRemoved),s.isFalsy(e[0].onMessagesDeliveredToAll)||(this.onMessagesDeliveredToAll=e[0].onMessagesDeliveredToAll),s.isFalsy(e[0].onMessagesReadByAll)||(this.onMessagesReadByAll=e[0].onMessagesReadByAll)};t.MessageListener=r;var a=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onIncomingCallReceived=void 0,this.onOutgoingCallAccepted=void 0,this.onOutgoingCallRejected=void 0,this.onIncomingCallCancelled=void 0,this.onCallEndedMessageReceived=void 0,s.isFalsy(e[0].onIncomingCallReceived)||(this.onIncomingCallReceived=e[0].onIncomingCallReceived),s.isFalsy(e[0].onOutgoingCallAccepted)||(this.onOutgoingCallAccepted=e[0].onOutgoingCallAccepted),s.isFalsy(e[0].onOutgoingCallRejected)||(this.onOutgoingCallRejected=e[0].onOutgoingCallRejected),s.isFalsy(e[0].onIncomingCallCancelled)||(this.onIncomingCallCancelled=e[0].onIncomingCallCancelled),s.isFalsy(e[0].onCallEndedMessageReceived)||(this.onCallEndedMessageReceived=e[0].onCallEndedMessageReceived)};t.CallListener=a;var E=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onUserOnline)||(this.onUserOnline=e[0].onUserOnline),s.isFalsy(e[0].onUserOffline)||(this.onUserOffline=e[0].onUserOffline)};t.UserListener=E;var c=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onGroupMemberJoined)||(this.onGroupMemberJoined=e[0].onGroupMemberJoined),s.isFalsy(e[0].onGroupMemberLeft)||(this.onGroupMemberLeft=e[0].onGroupMemberLeft),s.isFalsy(e[0].onGroupMemberKicked)||(this.onGroupMemberKicked=e[0].onGroupMemberKicked),s.isFalsy(e[0].onGroupMemberBanned)||(this.onGroupMemberBanned=e[0].onGroupMemberBanned),s.isFalsy(e[0].onGroupMemberUnbanned)||(this.onGroupMemberUnbanned=e[0].onGroupMemberUnbanned),s.isFalsy(e[0].onGroupMemberScopeChanged)||(this.onGroupMemberScopeChanged=e[0].onGroupMemberScopeChanged),s.isFalsy(e[0].onMemberAddedToGroup)||(this.onGroupMemberAddedToGroup=e[0].onMemberAddedToGroup)};t.GroupListener=c;var u=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].onYouLeft)||(this.onYouLeft=e[0].onYouLeft),s.isFalsy(e[0].onYouJoined)||(this.onYouJoined=e[0].onYouJoined),s.isFalsy(e[0].onUserJoined)||(this.onUserJoined=e[0].onUserJoined),s.isFalsy(e[0].onUserLeft)||(this.onUserLeft=e[0].onUserLeft),s.isFalsy(e[0].onUserListUpdated)||(this.onUserListUpdated=e[0].onUserListUpdated),s.isFalsy(e[0].onMediaDeviceListUpdated)||(this.onMediaDeviceListUpdated=e[0].onMediaDeviceListUpdated),s.isFalsy(e[0].onRecordingStarted)||(this.onRecordingStarted=e[0].onRecordingStarted),s.isFalsy(e[0].onRecordingStopped)||(this.onRecordingStopped=e[0].onRecordingStopped),s.isFalsy(e[0].onScreenShareStarted)||(this.onScreenShareStarted=e[0].onScreenShareStarted),s.isFalsy(e[0].onScreenShareStopped)||(this.onScreenShareStopped=e[0].onScreenShareStopped),s.isFalsy(e[0].onUserMuted)||(this.onUserMuted=e[0].onUserMuted),s.isFalsy(e[0].onCallSwitchedToVideo)||(this.onCallSwitchedToVideo=e[0].onCallSwitchedToVideo),s.isFalsy(e[0].onCallEnded)||(this.onCallEnded=e[0].onCallEnded),s.isFalsy(e[0].onError)||(this.onError=e[0].onError)};t.OngoingCallListener=u;var S=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];s.isFalsy(e[0].loginSuccess)||(this.loginSuccess=e[0].loginSuccess),s.isFalsy(e[0].loginFailure)||(this.loginFailure=e[0].loginFailure),s.isFalsy(e[0].logoutSuccess)||(this.logoutSuccess=e[0].logoutSuccess),s.isFalsy(e[0].logoutFailure)||(this.logoutFailure=e[0].logoutFailure)};t.LoginListener=S;var p=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.onConnected=void 0,this.inConnecting=void 0,this.onDisconnected=void 0,this.onFeatureThrottled=void 0,s.isFalsy(e[0].onConnected)||(this.onConnected=e[0].onConnected),s.isFalsy(e[0].inConnecting)||(this.inConnecting=e[0].inConnecting),s.isFalsy(e[0].onDisconnected)||(this.onDisconnected=e[0].onDisconnected),s.isFalsy(e[0].onFeatureThrottled)||(this.onFeatureThrottled=e[0].onFeatureThrottled)};t.ConnectionListener=p;var C=function(e,t){this._name=e,this._callback=t},l=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(t.Listener=C);t.MessagesListener=l;var _=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(C);t.UsersListener=_;var T=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(C);t.GroupsListener=T;var d=function(s){function e(e,t,n){var o=s.call(this,"callListner",n)||this;return o._eventListener=e,o}return i(e,s),e}(C);t.UserCallListener=d;var A=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,s}return i(e,r),e}(C);t.CallsListener=A;var h=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(C);t.UserLoginListener=h;var g=function(r){function e(e,t,n,o){var s=r.call(this,e,o)||this;return s._eventListener=t,n&&(s._cursor=n),s}return i(e,r),e}(C);t.WSConnectionListener=g},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationController=void 0;var c=n(42),u=n(0),o=function(){function e(){}return e.trasformJSONConversation=function(e,t,n,o,s,r,i,a){var E;try{E=new c.Conversation(e,t,n,o,s,r,i,a)}catch(e){u.Logger.error("ConversationController:transformJSONConversation",e)}return E},e}();t.ConversationController=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageListnerMaping=void 0;var o=n(0),s=n(1),r=n(14),i=n(5),a=function(){function e(e){this.store=s.constants.DEFAULT_STORE,o.isFalsy(e)||(this.store=e),this.settingsStore=r.createInstance({name:o.format(s.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),s.LOCAL_STORE.MESSAGE_LISTENERS_LIST)}),this.settingsStore.setDriver([r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL])}return e.getInstance=function(){return null==e.settingsStore&&(e.settingsStore=new e),e.settingsStore},e.prototype.set=function(e,t){return this.settingsStore.setItem(e,t)},e.prototype.remove=function(e){this.settingsStore.removeItem(e)},e.prototype.get=function(e){return this.settingsStore.getItem(e)},e.prototype.clearStore=function(){return this.settingsStore.clear()},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.settingsStore=null,e}();t.MessageListnerMaping=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypingIndicator=void 0;var o=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.metadata=n}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMetadata=function(){return this.metadata},e.prototype.setMetadata=function(e){this.metadata=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TypingIndicator=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Reaction=void 0;var o=n(3),i=n(0),s=function(){function e(e,t,n,o,s,r){i.isFalsy(e)||(this.id=e),i.isFalsy(t)||(this.messageId=t),i.isFalsy(n)||(this.reaction=n),i.isFalsy(o)||(this.uid=o),i.isFalsy(s)||(this.reactedAt=s),i.isFalsy(r)||(this.reactedBy=r)}return e.prototype.getReactionId=function(){return this.id},e.prototype.setReactionId=function(e){this.id=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getUid=function(){return this.uid},e.prototype.setUid=function(e){this.uid=e},e.prototype.getReactedAt=function(){return this.reactedAt},e.prototype.setReactedAt=function(e){this.reactedAt=e},e.prototype.getReactedBy=function(){return new o.User(this.reactedBy)},e.prototype.setReactedBy=function(e){this.reactedBy=e},e}();t.Reaction=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TransientMessage=void 0;var o=function(){function e(e,t,n){this.receiverId=e,this.receiverType=t,this.data=n||{}}return e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e}();t.TransientMessage=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatNotifications=t.CometChat=t.init=void 0;var o=n(5),s=n(80);t.init=function(e){return o.CometChat.getInstance(e)},t.CometChat=o.CometChat,t.CometChatNotifications=s.CometChatNotifications},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.EndpointFactory=void 0;var c=n(0),u=n(1),o=n(15),S=n(5),p=n(2),s=function(){function E(){this.baseUrl="https://%s.apiclient-%s.cometchat.io/",this.apiVersion=u.APPINFO.apiVersion,this.adminApiUrl="https://%s.api-%s.cometchat.io/",this.adminApiVersion=u.APPINFO.apiVersion,this.extensionApi="https://%s-%s.%s/%s",this.prosodyApi="https://%s.%s/%s",this.wsApi="https://%s/%s",this.uriEndpoints={authToken:{endpoint:"users/{{uid}}/auth_tokens",method:"POST",data:{uid:"string|max:100"},isAdminApi:!0},appSettings:{endpoint:"settings",method:"GET"},login:{endpoint:"admin/users/auth",method:"POST",data:{uid:"string|max:100"}},logout:{endpoint:"admin/users/auth/{{authToken}}",method:"DELETE"},getMyDetails:{endpoint:"me",method:"GET"},updateMyDetails:{endpoint:"me",method:"PUT"},getJWT:{endpoint:"me/jwt",method:"POST"},userSessions:{endpoint:"user_sessions",method:"POST"},users:{endpoint:"users",method:"GET"},user:{endpoint:"users/{{uid}}",method:"GET"},blockUsers:{endpoint:"blockedusers",method:"POST"},blockedUsersList:{endpoint:"blockedusers",method:"GET"},unblockUsers:{endpoint:"blockedusers",method:"DELETE"},userLogout:{endpoint:"me",method:"DELETE"},createUser:{endpoint:"users",method:"POST",isAdminApi:!0},updateUser:{endpoint:"users/{{uid}}",method:"PUT",isAdminApi:!0},sendFriendRequests:{endpoint:"user/friends",method:"POST",data:{uids:"array<string|max:100>"}},getFriends:{endpoint:"user/friends",method:"GET"},unfriend:{endpoint:"user/friends/{{uid}}/{{gid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},acceptFriendRequest:{endpoint:"user/friends/{{uid}}/accept",method:"PUT",data:{uids:"array<string|max:100>"}},rejectFriendRequest:{endpoint:"user/friends/{{uid}}/reject",method:"DELETE",data:{uids:"array<string|max:100>"}},createGroup:{endpoint:"groups",method:"POST",data:{guid:"required|string|max:100",name:"required|string|max:100",type:"enum|public,protected,password",password:"filled|string|max:100"}},getGroups:{endpoint:"groups",method:"GET"},getGroup:{endpoint:"groups/{{guid}}",method:"GET"},updateGroup:{endpoint:"groups/{{guid}}",method:"PUT"},deleteGroup:{endpoint:"groups/{{guid}}",method:"DELETE"},addGroupMembers:{endpoint:"groups/{{guid}}/members",method:"POST",data:{uids:"array<string|max:100>"}},getGroupMembers:{endpoint:"groups/{{guid}}/members",method:"GET"},joinGroup:{endpoint:"groups/{{guid}}/members",method:"POST"},leaveGroup:{endpoint:"groups/{{guid}}/members",method:"DELETE"},kickGroupMembers:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},changeScopeOfMember:{endpoint:"groups/{{guid}}/members/{{uid}}",method:"PUT",data:{uids:"array<string|max:100>"}},banGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"POST",data:{uids:"array<string|max:100>"}},unbanGroupMember:{endpoint:"groups/{{guid}}/bannedusers/{{uid}}",method:"DELETE",data:{uids:"array<string|max:100>"}},addMemebersToGroup:{endpoint:"groups/{{guid}}/members",method:"PUT"},getBannedGroupMembers:{endpoint:"groups/{{guid}}/bannedusers",method:"GET"},promotemoteGroupMember:{endpoint:"groups/{{guid}}/promote",method:"PUT",data:{uids:"array<string|max:100>"}},demoteGroupMember:{endpoint:"groups/{{guid}}/demote",method:"DELETE",data:{uids:"array<string|max:100>"}},transferOwnership:{endpoint:"groups/{{guid}}/owner",method:"PATCH"},sendMessage:{endpoint:"messages",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},sendMessageInThread:{endpoint:"messages/{{parentId}}/thread",method:"POST",data:{sender:"array:string:max:100>",isGroupMember:"filled|boolean|bail",data:"required|json"}},getMessages:{endpoint:"messages",method:"GET"},getMessageDetails:{endpoint:"messages/{{messageId}}",method:"GET"},addReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"POST"},removeReaction:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"DELETE"},getFilteredReactionsList:{endpoint:"messages/{{messageId}}/reactions/{{reaction}}",method:"GET",data:{}},getReactionsList:{endpoint:"messages/{{messageId}}/reactions",method:"GET",data:{}},getUserMessages:{endpoint:"users/{{listId}}/messages",method:"GET"},getGroupMessages:{endpoint:"groups/{{listId}}/messages",method:"GET"},getThreadMessages:{endpoint:"messages/{{listId}}/thread",method:"GET"},getMessage:{endpoint:"user/messages/{{muid}}",method:"GET"},updateMessage:{endpoint:"messages/{{messageId}}",method:"PUT"},deleteMessage:{endpoint:"messages/{{messageId}}",method:"DELETE"},markUserMessagesAsUnread:{endpoint:"users/{{uid}}/conversation/read",method:"DELETE"},markGroupMessagesAsUnread:{endpoint:"groups/{{guid}}/conversation/read",method:"DELETE"},createCallSession:{endpoint:"calls",method:"POST",data:{}},updateCallSession:{endpoint:"calls/{{sessionid}}",method:"put",data:{}},getConversations:{endpoint:"conversations",method:"GET"},getUserConversation:{endpoint:"users/{{uid}}/conversation",method:"GET"},getGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"GET"},deleteUserConversation:{endpoint:"users/{{uid}}/conversation",method:"DELETE"},deleteGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"DELETE"},updateUserConversation:{endpoint:"users/{{uid}}/conversation",method:"PUT"},updateGroupConversation:{endpoint:"groups/{{guid}}/conversation",method:"PUT"},updateCallType:{endpoint:"calls/{{sessionid}}/type",method:"PATCH"},getUserConversationStarter:{endpoint:"ai/conversation-starter/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationStarter:{endpoint:"ai/conversation-starter/groups/{{guid}}",method:"GET",isAIApi:!0},getUserSmartReply:{endpoint:"ai/smart-replies/users/{{uid}}",method:"GET",isAIApi:!0},getGroupSmartReply:{endpoint:"ai/smart-replies/groups/{{guid}}",method:"GET",isAIApi:!0},markInteracted:{endpoint:"messages/{{messageId}}/interacted",method:"PATCH"},getUserConversationSummary:{endpoint:"ai/conversation-summary/users/{{uid}}",method:"GET",isAIApi:!0},getGroupConversationSummary:{endpoint:"ai/conversation-summary/groups/{{guid}}",method:"GET",isAIApi:!0},getBotAssistanceInUserConversation:{endpoint:"ai/bots/{{botId}}/assistance/users/{{uid}}",method:"GET",isAIApi:!0},getBotAssistanceInGroupConversation:{endpoint:"ai/bots/{{botId}}/assistance/groups/{{guid}}",method:"GET",isAIApi:!0},getPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"GET"},updatePushPreferences:{endpoint:"notifications/push/v1/preferences",method:"PATCH"},resetPushPreferences:{endpoint:"notifications/push/v1/preferences",method:"DELETE"},registerToken:{endpoint:"notifications/push/v1/tokens",method:"POST"},unregisterToken:{endpoint:"notifications/push/v1/tokens",method:"DELETE"},muteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"PUT"},unmuteConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"DELETE"},getMutedConversations:{endpoint:"notifications/push/v1/preferences/mute",method:"GET"},updateTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"PATCH"},getTimezone:{endpoint:"notifications/v1/preferences/timezone",method:"GET"}}}return E.prototype.getEndpointData=function(a){return new Promise(function(s,t){try{var r=S.CometChat.appSettings.getAdminHost(),i=S.CometChat.appSettings.getClientHost();o.LocalStorage.getInstance().get(u.LOCAL_STORE.KEY_APP_SETTINGS).then(function(e){if(c.isFalsy(e)){var t={};if((new E).uriEndpoints.hasOwnProperty(a))if((t=(new E).uriEndpoints[a]).hasOwnProperty("isAdminApi"))if(c.isFalsy(r)){var n=c.format((new E).adminApiUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).adminApiVersion+"/"+t.endpoint;t.endpoint=n,s(t)}else{n="https://"+r+"/"+t.endpoint;t.endpoint=n,s(t)}else if(c.isFalsy(i)){n=c.format((new E).baseUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).apiVersion+"/"+t.endpoint;t.endpoint=n,s(t)}else{n="https://"+i+"/"+t.endpoint;t.endpoint=n,s(t)}}else{t={};if((new E).uriEndpoints.hasOwnProperty(a))if((t=(new E).uriEndpoints[a]).hasOwnProperty("isAdminApi")){var o="https://"+e[u.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=o,s(t)}else{o="https://"+e[u.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+t.endpoint;t.endpoint=o,s(t)}}},function(e){var t;if((new E).uriEndpoints.hasOwnProperty(a))if((t=(new E).uriEndpoints[a]).hasOwnProperty(["isAdminApi"]))if(c.isFalsy(r)){var n=c.format((new E).adminApiUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).adminApiVersion+"/"+t.endpoint;t.endpoint=n,s(t)}else t.endpoint="https://"+r+"/"+t.endpoint,s(t);else if(c.isFalsy(i)){n=c.format((new E).baseUrl,S.CometChat.getAppId(),S.CometChat.appSettings.getRegion())+(new E).apiVersion+"/"+t.endpoint;t.endpoint=n,s(t)}else t.endpoint="https://"+i+"/"+t.endpoint,s(t)})}catch(e){t(new p.CometChatException(e))}})},E}();t.EndpointFactory=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEndPoint=void 0;var o=n(35),i=n(2);t.getEndPoint=function(e,r){void 0===e&&(e=""),void 0===r&&(r={});var t=new o.EndpointFactory;return new Promise(function(o,s){try{t.getEndpointData(e).then(function(e){var t=e;if(t){for(var n in r)t.endpoint=t.endpoint.replace("{{"+n+"}}",r[n]);o(t)}else s({error:"Unknown endPoint name."})})}catch(e){s(new i.CometChatException(e))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionGoal=void 0;var o=function(){function e(e,t){this.elementIds=[],this.type=e,this.elementIds=t}return e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getElementIds=function(){return this.elementIds},e.prototype.setElementIds=function(e){this.elementIds=e},e}();t.InteractionGoal=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallController=void 0;var h=n(1),g=n(0),R=n(5),s=n(2),o=n(28),r=n(39),I=n(3),f=n(6),i=function(){function A(){this.TAG="calling Log",this.CALL_NO_ANSWER_INTERVAL=45e3,this.view=void 0,this.isDev=!1}return A.prototype.getCallListner=function(){return A.callListner},A.prototype.setCallListner=function(e){A.callListner=new o.UserCallListener(e)},A.getInstance=function(){try{return null!=this.callController&&null!=this.callController||(this.callController=new A),this.callController}catch(e){g.Logger.error("CallController: getInstance",e)}},A.prototype.getActiveCall=function(){try{return g.isFalsy(this.call)?null:this.call}catch(e){g.Logger.error("CallController: getActiveCall",e)}},A.prototype.initiateCall=function(n){var o=this;return new Promise(function(e,t){try{g.isFalsy(o.call)?null!=n&&null!=n?(o.call=n,o.startCallTimer(),e(n)):t(new s.CometChatException(h.CALL_ERROR.ERROR_IN_CALLING)):t(new s.CometChatException(h.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new s.CometChatException(e))}})},A.prototype.clearTimer=function(){this.timer&&this.stopCallTimer()},A.prototype.endCall=function(e){var t=this;try{document.getElementsByName("frame").forEach(function(e){t.view&&(t.view.removeChild(e),t.view=void 0)}),this.endCallSession()}catch(e){g.Logger.error("CallController: endCall",e)}},A.prototype.onCallStarted=function(n){var o=this;return new Promise(function(e,t){try{g.isFalsy(o.call)?null!=n&&null!=n?e(o.call=n):t(new s.CometChatException(h.CALL_ERROR.ERROR_IN_CALLING)):t(new s.CometChatException(h.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){t(new s.CometChatException(e))}})},A.prototype.clearActiveCall=function(){this.call=void 0,A.callController=void 0,this.timer&&this.stopCallTimer(),this.view=void 0,this.removeListener(),A.callScreen=null,A.callSettings=null},A.prototype.endCallSession=function(){try{this.call=void 0,A.callController=void 0,this.timer&&this.stopCallTimer(),this.view=void 0,this.removeListener(),A.callScreen=null,A.callSettings=null}catch(e){g.Logger.error("CallController:EndCallSession",{e:e})}},A.prototype.startCallTimer=function(){var t=this;try{this.timer=setTimeout(function(){t.call?R.CometChat.sendUnansweredResponse(t.call.getSessionId()).then(function(e){t.endCallSession()},function(e){t.endCallSession()}):t.endCallSession()},this.CALL_NO_ANSWER_INTERVAL)}catch(e){g.Logger.error("CallController: startCallTimer",e)}},A.prototype.stopCallTimer=function(){try{clearTimeout(this.timer)}catch(e){g.Logger.error("CallController: stopCallTimer",e)}},A.prototype.startCall=function(t,n){var o=this;try{this.timer&&this.stopCallTimer();var s=document.createElement("iframe");this.getCallUrl().then(function(e){s.src=e+"",s.name="frame",s.setAttribute("allow","camera; microphone; display-capture;"),s.setAttribute("width","100%"),s.setAttribute("height","100%"),A.callScreen=s,A.callSettings=t,n&&(o.view=n),n.appendChild(s),o.addListener()})}catch(e){g.Logger.error("CallController: startCall",e)}},A.prototype.addListener=function(){window.addEventListener("message",this.handler,!0)},A.prototype.removeListener=function(){window.removeEventListener("message",this.handler,!0)},A.prototype.handler=function(e){var t,n=this,o=A.callSettings,s=A.callScreen,r=A.getInstance().getActiveCall();try{if(void 0!==(t=JSON.parse(e.data))&&t.type==h.CallConstants.POST_MESSAGES.TYPES.HANGUP)A.deviceList=null,r?(g.Logger.info(this.TAG,A.callListner),window.setTimeout(function(){R.CometChat.endCall(r.getSessionId(),!0).then(function(e){g.Logger.info(n.TAG,{call:e})}).catch(function(e){g.Logger.info(n.TAG,"The Call Was Already Ended")})},1e3)):R.CometChat.endCall(o.getSessionId(),!0).then(function(e){g.Logger.info(n.TAG,{call:e})}).catch(function(e){g.Logger.info(n.TAG,"The Call Was Already Ended")});else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_JOINED){if(t.value){var i=void 0,a=t.value;g.isFalsy(a.uid)||g.isFalsy(a.name)||((i=new I.User(a)).setStatus("online"),R.CometChat.user.getUid().toLowerCase()!=i.getUid().toLowerCase()&&A.callListner&&(g.isFalsy(A.callListner._eventListener.onUserJoined)||A.callListner._eventListener.onUserJoined(i)))}}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_LEFT){if(t.value){i=void 0,a=t.value;g.isFalsy(a.uid)||g.isFalsy(a.name)||((i=new I.User(a)).setStatus("online"),R.CometChat.user.getUid().toLowerCase()!=i.getUid().toLowerCase()&&A.callListner&&(g.isFalsy(A.callListner._eventListener.onUserLeft)||A.callListner._eventListener.onUserLeft(i)))}}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_LIST_CHANGED){var E=[];if(t.value&&0<t.value.length)t.value.map(function(e){if(!g.isFalsy(e.uid)&&!g.isFalsy(e.name)){var t=new I.User(e);t.setStatus("online"),E.push(t)}}),A.callListner&&(g.isFalsy(A.callListner._eventListener.onUserListUpdated)||A.callListner._eventListener.onUserListUpdated(E))}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.INITIAL_DEVICE_LIST)g.Logger.info("initialDeviceList received in SDK = ",t),t.value&&(A.deviceList=t.value);else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.DEVICE_CHANGE){if(g.Logger.info("onDeviceChange received in SDK = ",t),t.value){A.deviceList=t.value;var c=A.getAvailableDeviceObject(A.deviceList);A.callListner&&(g.isFalsy(A.callListner._eventListener.onMediaDeviceListUpdated)||A.callListner._eventListener.onMediaDeviceListUpdated(c))}}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.RECORDING_TOGGLED){if(g.Logger.info("onRecordingToggled received in SDK = ",t),t.value)if((l=t.value).hasOwnProperty("user")&&l.hasOwnProperty("recordingStarted")&&!g.isFalsy(l.user.uid)&&!g.isFalsy(l.user.name)){var u=new I.User(l.user);u.setStatus("online");var S=l.recordingStarted;A.callListner&&(S?g.isFalsy(A.callListner._eventListener.onRecordingStarted)||A.callListner._eventListener.onRecordingStarted(u):g.isFalsy(A.callListner._eventListener.onRecordingStopped)||A.callListner._eventListener.onRecordingStopped(u))}}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.USER_MUTED){if(g.Logger.info("onUserMuted received in SDK = ",t),t.value)if((l=t.value).hasOwnProperty("muted")&&l.hasOwnProperty("mutedBy")&&!g.isFalsy(l.muted.uid)&&!g.isFalsy(l.muted.name)&&!g.isFalsy(l.mutedBy.uid)&&!g.isFalsy(l.mutedBy.name)){var p=new I.User(l.muted);p.setStatus("online");var C=new I.User(l.mutedBy);C.setStatus("online"),A.callListner&&(g.isFalsy(A.callListner._eventListener.onUserMuted)||A.callListner._eventListener.onUserMuted(p,C))}}else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STARTED)A.callListner&&(g.isFalsy(A.callListner._eventListener.onScreenShareStarted)||A.callListner._eventListener.onScreenShareStarted(null));else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STOPPED)A.callListner&&(g.isFalsy(A.callListner._eventListener.onScreenShareStopped)||A.callListner._eventListener.onScreenShareStopped(null));else if(void 0!==t&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.SWITCHED_TO_VIDEO_CALL){if(t.value){var l=t.value;if(g.Logger.info("onCallSwitchedToVideo received in SDK = ",l),l.hasOwnProperty("initiator")&&l.hasOwnProperty("sessionId")&&!g.isFalsy(l.initiator.uid)&&!g.isFalsy(l.sessionId)&&l.hasOwnProperty("accepted")&&!g.isFalsy(l.accepted.uid)){var _=l.sessionId,T=new I.User(l.initiator);T.setStatus("online");var d=new I.User(l.accepted);if(d.setStatus("online"),A.getInstance().getCallListner()&&(g.isFalsy(A.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo)||A.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo(_,T,d)),l.initiator.uid.toLowerCase()===R.CometChat.user.getUid().toLowerCase()&&!l.sessionId.includes("v1."))try{f.makeApiCall("updateCallType",{sessionid:_},{type:"video"}).then(function(e){g.Logger.log("response",e)},function(e){g.Logger.error("CallController :: onSwitchedToVideo",e)})}catch(e){g.Logger.error("CallController :: onSwitchedToVideo",e)}}}}else void 0!==t&&t.type&&t.action&&t.type==h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&t.action==h.CallConstants.POST_MESSAGES.ACTIONS.LOAD&&null!=s.contentWindow&&s.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.COMETCHAT_RTC_SETTINGS,callsettings:JSON.stringify(o)},"*")}catch(e){t=void 0,g.Logger.error("CallController: startCall",e)}},A.prototype.getCallUrl=function(){var e=this,o=void 0;return new Promise(function(t,n){try{e.isDev?(o="https://rtc-test.cometchat.io/?v="+h.CALLING_COMPONENT_VERSION,t(o)):g.getAppSettings().then(function(e){o="https://"+e[h.APP_SETTINGS.KEYS.WEBRTC_WEB_FRONTEND_HOST]+"/?v="+h.CALLING_COMPONENT_VERSION,t(o)})}catch(e){n(new s.CometChatException(e))}})},A.getAvailableDeviceArray=function(e){var t=[];try{return e&&0<e.length&&e.map(function(e){t.push(new r.MediaDevice(e.deviceId,e.label,e.active))}),t}catch(e){return g.Logger.error("CallController: getAvailableDeviceArray",e),t}},A.getAvailableDeviceObject=function(e){var t=[],n=[],o=[];try{return g.isFalsy(e)||g.isFalsy(e[h.CallConstants.AUDIO_INPUT_DEVICES])||(t=A.getAvailableDeviceArray(e[h.CallConstants.AUDIO_INPUT_DEVICES])),g.isFalsy(e)||g.isFalsy(e[h.CallConstants.AUDIO_OUTPUT_DEVICES])||(n=A.getAvailableDeviceArray(e[h.CallConstants.AUDIO_OUTPUT_DEVICES])),g.isFalsy(e)||g.isFalsy(e[h.CallConstants.VIDEO_INPUT_DEVICES])||(o=A.getAvailableDeviceArray(e[h.CallConstants.VIDEO_INPUT_DEVICES])),{audioInputDevices:t,audioOutputDevices:n,videoInputDevices:o}}catch(e){return g.Logger.error("CallController: getAvailableDeviceObject",e),{audioInputDevices:t,audioOutputDevices:n,videoInputDevices:o}}},A.prototype.getAudioInputDevices=function(){var t=[];try{return g.isFalsy(A.deviceList)||g.isFalsy(A.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES])||(t=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES])),t}catch(e){return g.Logger.error("CallController: getAudioInputDevices",e),t}},A.prototype.getAudioOutputDevices=function(){var t=[];try{return g.isFalsy(A.deviceList)||g.isFalsy(A.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES])||(t=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES])),t}catch(e){return g.Logger.error("CallController: getAudioOutputDevices",e),t}},A.prototype.getVideoInputDevices=function(){var t=[];try{return g.isFalsy(A.deviceList)||g.isFalsy(A.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES])||(t=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES])),t}catch(e){return g.Logger.error("CallController: getVideoInputDevices",e),t}},A.prototype.setAudioInputDevice=function(t){try{if(A.callScreen&&!g.isFalsy(t)){var e=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.AUDIO_INPUT_DEVICES]).filter(function(e){return e[h.CallConstants.MEDIA_DEVICE.ID]===t&&!e[h.CallConstants.MEDIA_DEVICE.ACTIVE]});e&&0<e.length&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_INPUT,value:t},"*")}}catch(e){g.Logger.error("CallController: setAudioInputDevice",e)}},A.prototype.setAudioOutputDevice=function(t){try{if(A.callScreen&&!g.isFalsy(t)){var e=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.AUDIO_OUTPUT_DEVICES]).filter(function(e){return e[h.CallConstants.MEDIA_DEVICE.ID]===t&&!e[h.CallConstants.MEDIA_DEVICE.ACTIVE]});e&&0<e.length&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_OUTPUT,value:t},"*")}}catch(e){g.Logger.error("CallController: setAudioOutputDevice",e)}},A.prototype.setVideoInputDevice=function(t){try{if(A.callScreen&&!g.isFalsy(t)){var e=A.getAvailableDeviceArray(A.deviceList[h.CallConstants.VIDEO_INPUT_DEVICES]).filter(function(e){return e[h.CallConstants.MEDIA_DEVICE.ID]===t&&!e[h.CallConstants.MEDIA_DEVICE.ACTIVE]});e&&0<e.length&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_VIDEO_INPUT,value:t},"*")}}catch(e){g.Logger.error("CallController: setVideoInputDevice",e)}},A.prototype.muteAudio=function(e){try{A.callScreen&&(e?A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.MUTE_AUDIO},"*"):A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.UNMUTE_AUDIO},"*"))}catch(e){g.Logger.error("CallController: muteAudio",e)}},A.prototype.pauseVideo=function(e){try{A.callScreen&&(e?A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.PAUSE_VIDEO},"*"):A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.UNPAUSE_VIDEO},"*"))}catch(e){g.Logger.error("CallController: pauseVideo",e)}},A.prototype.setMode=function(e){try{A.callScreen&&!g.isFalsy(e)&&(e=e.toUpperCase(),-1<Object.values(h.CallConstants.CALL_MODE).indexOf(e)&&e!=h.CallConstants.CALL_MODE.SINGLE&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_MODE,value:e},"*"))}catch(e){g.Logger.error("CallController: setMode",e)}},A.prototype.startScreenShare=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.START_SCREENSHARE},"*")}catch(e){g.Logger.error("CallController: startScreenShare",e)}},A.prototype.stopScreenShare=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.STOP_SCREENSHARE},"*")}catch(e){g.Logger.error("CallController: stopScreenShare",e)}},A.prototype.startRecording=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.START_RECORDING},"*")}catch(e){g.Logger.error("CallController: startRecording",e)}},A.prototype.stopRecording=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.STOP_RECORDING},"*")}catch(e){g.Logger.error("CallController: stopRecording",e)}},A.prototype.switchToVideoCall=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_TO_VIDEO_CALL},"*")}catch(e){g.Logger.error("CallController: switchToVideoCall",e)}},A.prototype.openVirtualBackground=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.OPEN_VIRTUAL_BACKGROUND},"*")}catch(e){g.Logger.error("CallController: openVirtualBackground",e)}},A.prototype.setBackgroundBlur=function(e){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_BLUR,value:e},"*")}catch(e){g.Logger.error("CallController: openVirtualBackground",e)}},A.prototype.setBackgroundImage=function(e){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_IMAGE,value:e},"*")}catch(e){g.Logger.error("CallController: openVirtualBackground",e)}},A.prototype.endSession=function(){try{A.callScreen&&A.callScreen.contentWindow.postMessage({type:h.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:h.CallConstants.POST_MESSAGES.ACTIONS.END_CALL},"*")}catch(e){g.Logger.error("CallController: endSession",e)}},A.callController=void 0,A.callListner=void 0,A}();t.CallController=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaDevice=void 0;var o=n(0),s=function(){function e(e,t,n){this.id="",this.name="",this.active=!1,o.isFalsy(e)||(this.id=e),o.isFalsy(t)||(this.name=t),this.active=!!n}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e||""},e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){this.name=e||""},e.prototype.getIsActive=function(){return this.active},e.prototype.setIsActive=function(e){this.active=!!e},e}();t.MediaDevice=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersController=void 0;var o=n(41),s=n(1),r=n(0),i=function(){function e(){}return e.trasformJSONGroupMember=function(t){var e;try{return t.status&&"offline"!==t.status?t.status="online":t.status="offline",e=new o.GroupMember(t[s.GroupMemersConstans.KEYS.UID]),Object.assign(e,t),e}catch(e){return r.Logger.error("GroupMembersController:trasformJSONGroupMember",{e:e,groupMember:t}),t}},e}();t.GroupMembersController=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMember=void 0;var r=n(3),i=n(1),a=function(o){function e(e,t){var n=o.call(this,e)||this;return n.joinedAt=0,t&&(n.scope=t),n}return s(e,o),e.prototype.setScope=function(e){this.scope=e},e.prototype.setJoinedAt=function(e){this.joinedAt=e},e.prototype.setGuid=function(e){this.guid=e},e.prototype.getScope=function(){return this.scope},e.prototype.getJoinedAt=function(){return this.joinedAt},e.prototype.getGuid=function(){return this.guid},e.GroupMemberScope=i.GroupMemberScope,e}(r.User);t.GroupMember=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversation=void 0;var E=n(11),c=n(1),u=n(12),S=n(16),o=function(){function e(e,t,n,o,s,r,i,a){this.conversationId=e,this.conversationType=t,this.unreadMentionsCount=i,this.lastReadMessageId=a,r&&0<r.length&&(this.tags=r),void 0!==n&&void 0!==(this.lastMessage=n).id&&(this.lastMessage=E.MessageController.trasformJSONMessge(n)),this.conversationType==c.MessageConstatnts.RECEIVER_TYPE.USER?this.conversationWith=u.UsersController.trasformJSONUser(o):this.conversationWith=S.GroupsController.trasformJSONGroup(o),this.unreadMessageCount=void 0!==s?s:0}return e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getUnreadMentionsCount=function(){return this.unreadMentionsCount},e.prototype.setUnreadMentionsCount=function(e){this.unreadMentionsCount=e},e.prototype.getLastReadMessageId=function(){return this.lastReadMessageId},e.prototype.setLastReadMessageId=function(e){this.lastReadMessageId=e},e.prototype.setConversationType=function(e){this.conversationType=e},e.prototype.setLastMessage=function(e){this.lastMessage=e},e.prototype.setConversationWith=function(e){this.conversationWith=e},e.prototype.setUnreadMessageCount=function(e){this.unreadMessageCount=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.getLastMessage=function(){return this.lastMessage},e.prototype.getConversationWith=function(){return this.conversationWith},e.prototype.getUnreadMessageCount=function(){return this.unreadMessageCount},e.prototype.getTags=function(){return this.tags},e}();t.Conversation=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.TypingNotificationController=void 0;var o=n(0),s=function(){function e(){}return e.addTypingStarted=function(e){this.TYPING_STARTED_MAP[e]=o.getCurrentTime()},e.removeTypingStarted=function(e){delete this.TYPING_STARTED_MAP[e]},e.getTypingStartedMap=function(e){if(e)return this.TYPING_STARTED_MAP[e]},e.addTypingEnded=function(e){this.TYPING_ENDED_MAP[e]=o.getCurrentTime()},e.removeTypingEnded=function(e){delete this.TYPING_ENDED_MAP[e]},e.getTypingEndedMap=function(e){if(e)return this.TYPING_ENDED_MAP[e]},e.addIncomingTypingStarted=function(e){this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]={typingNotification:e,timestamp:o.getCurrentTime()}},e.removeIncomingTypingStarted=function(e){delete this.INCOMING_TYPING_STARTED_MAP[e.getReceiverId()]},e.TYPING_STARTED_MAP={},e.TYPING_ENDED_MAP={},e.INCOMING_TYPING_STARTED_MAP={},e}();t.TypingNotificationController=s},function(e,t,n){"use strict";var o=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};Object.defineProperty(t,"__esModule",{value:!0}),t.ListenerHandlers=void 0;var s=n(0),r=n(28),i=function(){function e(){this.connectionHandlers=[],this.loginHandlers=[],this.messageHandlers=[],this.userHandlers=[],this.groupHandlers=[],this.callHandlers=[]}return e.getInstance=function(){return null!=this.listenerHandlers&&null!=this.listenerHandlers||(this.listenerHandlers=new e),this.listenerHandlers},e.prototype.addConnectionEventListener=function(t,e){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!=t}),this.connectionHandlers=o(this.connectionHandlers,[new r.WSConnectionListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addWSConnectionEventListener",e)}},e.prototype.removeConnectionEventListener=function(t){try{this.connectionHandlers=this.connectionHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeWSConnectionEventListener",e)}},e.prototype.addLoginEventListener=function(t,e){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!=t}),this.loginHandlers=o(this.loginHandlers,[new r.UserLoginListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addLoginEventListener",e)}},e.prototype.removeLoginEventListener=function(t){try{this.loginHandlers=this.loginHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeLoginEventListener",e)}},e.prototype.addMessageEventListener=function(t,e){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!=t}),this.messageHandlers=o(this.messageHandlers,[new r.MessagesListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addMessageEventListener",e)}},e.prototype.removeMessageEventListener=function(t){try{this.messageHandlers=this.messageHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeMessageEventListener",e)}},e.prototype.addUserEventListener=function(t,e){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!=t}),this.userHandlers=o(this.userHandlers,[new r.UsersListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addUserEventListener",e)}},e.prototype.removeUserEventListener=function(t){try{this.userHandlers=this.userHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeUserEventListener",e)}},e.prototype.addGroupEventListener=function(t,e){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!=t}),this.groupHandlers=o(this.groupHandlers,[new r.GroupsListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addGroupEventListener",e)}},e.prototype.removeGroupEventListener=function(t){try{this.groupHandlers=this.groupHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeGroupEventListener",e)}},e.prototype.addCallEventListener=function(t,e){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!=t}),this.callHandlers=o(this.callHandlers,[new r.CallsListener(t,e)])}catch(e){s.Logger.error("ListenerHandlers: addCallEventListener",e)}},e.prototype.removeCallEventListener=function(t){try{this.callHandlers=this.callHandlers.filter(function(e){return e._name!==t})}catch(e){s.Logger.error("ListenerHandlers: removeCallEventListener",e)}},e.listenerHandlers=new e,e}();t.ListenerHandlers=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionReceipt=void 0;var o=function(){function e(){}return e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getSender=function(){return this.sender},e.prototype.setSender=function(e){this.sender=e},e.prototype.getReceiveId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getInteractions=function(){return this.interactions},e.prototype.setInteractions=function(e){this.interactions=e},e}();t.InteractionReceipt=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionEvent=void 0;var r=n(0),o=function(){function e(e,t,n,o,s){this.parentMessageId=null,r.isFalsy(e)||(this.reaction=e),r.isFalsy(t)||(this.receiverId=t),r.isFalsy(n)||(this.receiverType=n),r.isFalsy(o)||(this.conversationId=o),r.isFalsy(s)||(this.parentMessageId=s)}return e.prototype.getReaction=function(){return this.reaction},e.prototype.setReaction=function(e){this.reaction=e},e.prototype.getReceiverId=function(){return this.receiverId},e.prototype.setReceiverId=function(e){this.receiverId=e},e.prototype.getReceiverType=function(){return this.receiverType},e.prototype.setReceiverType=function(e){this.receiverType=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e}();t.ReactionEvent=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DaySchedule=void 0;var o=function(){function e(e,t,n){this.from=e,this.to=t,this.dnd=n}return e.prototype.getFrom=function(){return this.from},e.prototype.setFrom=function(e){this.from=e},e.prototype.getTo=function(){return this.to},e.prototype.setTo=function(e){this.to=e},e.prototype.getDND=function(){return this.dnd},e.prototype.setDND=function(e){this.dnd=e},e}();t.DaySchedule=o},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsRequestBuilder=t.GroupsRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(16),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.hasJoined=0,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(o.isFalsy(e.limit)||(this.limit=e.limit),o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.hasJoined)||(this.hasJoined=1),o.isFalsy(e.tags)||(this.tags=e.tags),o.isFalsy(e.showTags)||(this.withTags=e.showTags))}return e.prototype.validateGroupBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.GROUPS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.withTags){if(typeof this.withTags!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}return void 0===this.tags||Array.isArray(this.tags)?void 0:new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(t,n){try{var e=o.validateGroupBuilder();if(e instanceof r.CometChatException)return void n(e);s.makeApiCall("getGroups",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var n=[];e.data.map(function(e,t){n.push(i.GroupsController.trasformJSONGroup(e))}),t(n)}t([])},function(e){n(new r.CometChatException(e.error))})}catch(e){n(new r.CometChatException(e))}})},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.isJoinedOnly=function(){return this.hasJoined},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.hasJoined)||(e.hasJoined=1),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.withTags)||(e.withTags=1),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=100,e.DEFAULT_LIMIT=30,e}();t.GroupsRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.joinedOnly=function(e){return this.hasJoined=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.build=function(){return new E(this)},e}();t.GroupsRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersRequestBuilder=t.GroupMembersRequest=void 0;var s=n(6),o=n(0),r=n(15),i=n(2),a=n(40),E=n(1),c=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},this.store=r.LocalStorage.getInstance(),o.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateGroupMembersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{var e=o.validateGroupMembersBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("getGroupMembers",{guid:o.guid},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=o.guid,t.push(a.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new i.CometChatException(e.error))})}catch(e){t(new i.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.GroupMembersRequest=c;var u=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new c(this)},e}();t.GroupMembersRequestBuilder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BannedMembersRequestBuilder=t.BannedMembersRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(40),a=n(1),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=1,this.total_pages=-1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.scopes)||(this.scopes=e.scopes))}return e.prototype.validateBannedMembersBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.guid){if(typeof this.guid!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(o.isFalsy(this.guid))return new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}return void 0===this.scopes||Array.isArray(this.scopes)?void 0:new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{var e=o.validateBannedMembersBuilder();if(e instanceof r.CometChatException)return void t(e);s.makeApiCall("getBannedGroupMembers",{guid:o.guid},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){e.guid=o.guid,t.push(i.GroupMembersController.trasformJSONGroupMember(e))}),n(t)}else n([])},function(e){t(new r.CometChatException(e.error))})}catch(e){t(new r.CometChatException(e))}})},e.prototype.getGuid=function(){return this.guid},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getScopes=function(){return this.scopes},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.scopes)||(e.scopes=this.scopes),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.BannedMembersRequest=E;var c=function(){function e(e){this.guid=e}return e.prototype.setGuid=function(e){return this.guid=e,this},e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setScopes=function(e){return this.scopes=e,this},e.prototype.build=function(){return new E(this)},e}();t.BannedMembersRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersRequestBuilder=t.UsersRequest=void 0;var s=n(6),o=n(0),r=n(12),i=n(2),a=n(53),E=n(1),c=function(){function t(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.hideBlockedUsers=!1,this.friendsOnly=!1,this.fetchingInProgress=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},t.userStore=a.UserStore.getInstance(),o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.status)||(e.status==t.USER_STATUS.ONLINE?this.status=E.PresenceConstatnts.STATUS.AVAILABLE:this.status=e.status),o.isFalsy(e.shouldHideBlockedUsers)||(this.hideBlockedUsers=e.shouldHideBlockedUsers),o.isFalsy(e.showFriendsOnly)||(this.friendsOnly=e.showFriendsOnly),o.isFalsy(e.showTags)||(this.withTags=e.showTags),o.isFalsy(e.role)||(this.role=e.role),o.isFalsy(e.roles)||(this.roles=e.roles),o.isFalsy(e.tags)||(this.tags=e.tags),o.isFalsy(e.UIDs)||(this.UIDs=e.UIDs),o.isFalsy(e.SortBy)||(this.sortBy=e.SortBy),o.isFalsy(e.SearchIn)||(this.searchIn=e.SearchIn),o.isFalsy(e.SortOrder)||(this.sortOrder=e.SortOrder))}return t.prototype.validateUserBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>E.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",E.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<E.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(this.status){if(typeof this.status!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_STATUS","SET_STATUS","setStatus()")));if("available"!=this.status.toLowerCase()&&"offline"!=this.status.toLowerCase())return new i.CometChatException(E.UserErrors.INVALID_STATUS)}if(void 0!==this.hideBlockedUsers){if(typeof this.hideBlockedUsers!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_BLOCKED_USERS","HIDE_BLOCKED_USERS","hideBlockedUsers()")));1==this.hideBlockedUsers?this.hideBlockedUsers=!0:this.hideBlockedUsers=!1}if(void 0!==this.friendsOnly){if(typeof this.friendsOnly!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"FRIENDS_ONLY","FRIENDS_ONLY","friendsOnly()")));1==this.friendsOnly?this.friendsOnly=!0:this.friendsOnly=!1}if(void 0!==this.withTags){if(typeof this.withTags!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()")));1==this.withTags?this.withTags=!0:this.withTags=!1}if(void 0!==this.roles&&!Array.isArray(this.roles))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"ROLES","ROLES","setRoles()")));if(void 0!==this.tags&&!Array.isArray(this.tags))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")));if(void 0!==this.UIDs&&!Array.isArray(this.UIDs))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"UIDs","UIDs","setUIDs()")));if(this.sortBy){if(typeof this.sortBy!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY","SORT_BY","sortBy()")));if(o.isFalsy(this.sortBy.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY","SORT_BY","sort by","sort by")));this.sortBy=this.sortBy.trim().toLowerCase()}if(this.sortOrder){if(typeof this.sortOrder!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY_ORDER","SORT_BY_ORDER","sortByOrder()")));if(o.isFalsy(this.sortOrder.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"SORT_BY_ORDER","SORT_BY_ORDER","sort order","sort order")));this.sortOrder=this.sortOrder.trim().toLowerCase()}return this.searchIn&&!Array.isArray(this.searchIn)?new i.CometChatException(JSON.parse(o.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SEARCH_IN","SEARCH_IN","searchIn()"))):void 0},t.prototype.getLimit=function(){return this.limit},t.prototype.getSearchKeyword=function(){return this.searchKeyword},t.prototype.isHideBlockedUsers=function(){return this.hideBlockedUsers},t.prototype.getStatus=function(){return this.status},t.prototype.getRole=function(){return this.role},t.prototype.isFriendsOnly=function(){return this.friendsOnly},t.prototype.getRoles=function(){return this.roles},t.prototype.getTags=function(){return this.tags},t.prototype.isWithTags=function(){return this.withTags},t.prototype.getUIDs=function(){return this.UIDs},t.prototype.getSearchIn=function(){return this.searchIn},t.prototype.getSortBy=function(){return this.sortBy},t.prototype.getSortOrder=function(){return this.sortOrder},t.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateUserBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("users",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(r.UsersController.trasformJSONUser(e))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new i.CometChatException(e))}})},t.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),o.isFalsy(this.status)||(e.status=this.status),o.isFalsy(this.hideBlockedUsers)||(e.hideBlockedUsers=1),o.isFalsy(this.role)||(e.roles=this.role),o.isFalsy(this.roles)||(e.roles=this.roles),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.friendsOnly)||(e.friendsOnly=1),o.isFalsy(this.withTags)||(e.withTags=1),o.isFalsy(this.UIDs)||(e.uids=this.UIDs),o.isFalsy(this.sortBy)||(e.sortBy=this.sortBy),o.isFalsy(this.sortOrder)||(e.sortOrder=this.sortOrder),o.isFalsy(this.searchIn)||(e.searchIn=this.searchIn),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},t.USER_STATUS={ONLINE:E.PresenceConstatnts.STATUS.ONLINE,OFFLINE:E.PresenceConstatnts.STATUS.OFFLINE},t}();t.UsersRequest=c;var u=function(){function e(){this.shouldHideBlockedUsers=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setStatus=function(e){return this.status=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.hideBlockedUsers=function(e){return this.shouldHideBlockedUsers=e,this},e.prototype.setRole=function(e){return this.role=e,this},e.prototype.setRoles=function(e){return this.roles=e,this},e.prototype.friendsOnly=function(e){return this.showFriendsOnly=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.showTags=e,this},e.prototype.setUIDs=function(e){return this.UIDs=e,this},e.prototype.sortBy=function(e){return this.SortBy=e,this},e.prototype.sortByOrder=function(e){return this.SortOrder=e,this},e.prototype.searchIn=function(e){return this.SearchIn=e,this},e.prototype.build=function(){return this.role&&this.roles&&this.roles.push(this.role),new c(this)},e}();t.UsersRequestBuilder=u},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UserStore=void 0;var o=n(5),s=n(0),r=n(1),i=n(14),a=function(){function e(e){this.store=r.constants.DEFAULT_STORE,s.isFalsy(e)||(this.store=e),this.userStore=i.createInstance({name:s.format(r.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),r.LOCAL_STORE.USERS_STORE)}),this.userStore.setDriver([i.LOCALSTORAGE,i.INDEXEDDB,i.WEBSQL])}return e.getInstance=function(){return null==e.UserStore&&(e.UserStore=new e),e.UserStore},e.prototype.set=function(e,t){return this.userStore.setItem(e,t)},e.prototype.remove=function(e){this.userStore.removeItem(e)},e.prototype.get=function(e){return this.userStore.getItem(e)},e.prototype.clearStore=function(){var n=this;return new Promise(function(e,t){n.userStore.clear().then(function(){e(!0)}).catch(function(e){t(e)})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeUsers=function(e){var t=this;return e.map(function(e){t.set(e.getUid(),e)}),!0},e.prototype.storeUser=function(e){return this.set(e.getUid(),e),!0},e}();t.UserStore=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationsRequestBuilder=t.ConversationsRequest=void 0;var s=n(6),o=n(0),r=n(2),i=n(29),a=n(1),E=function(){function e(e){this.limit=30,this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.getUserAndGroupTags=!1,this.withTags=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.conversationType)||(this.conversationType=e.conversationType),o.isFalsy(e.getUserAndGroupTags)||(this.getUserAndGroupTags=e.getUserAndGroupTags),e.tags&&(this.tags=e.tags),o.isFalsy(e.WithTags)||(this.withTags=e.WithTags),e.groupTags&&(this.groupTags=e.groupTags),e.userTags&&(this.userTags=e.userTags),e.IncludeBlockedUsers&&(this.includeBlockedUsers=e.IncludeBlockedUsers),e.WithBlockedInfo&&(this.withBlockedInfo=e.WithBlockedInfo))}return e.prototype.validateConversationBuilder=function(){return void 0===this.limit?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))):isNaN(this.limit)?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):this.limit>a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limit<a.DEFAULT_VALUES.ZERO?new r.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):void 0},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateConversationBuilder();if(e instanceof r.CometChatException)return void t(e);s.makeApiCall("getConversations",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(i.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[],e.unreadMentionsCount,e.lastReadMessageId))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new r.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new r.CometChatException(e))}})},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.conversationType)||(e.conversationType=this.conversationType),o.isFalsy(this.getUserAndGroupTags)||(e.withUserAndGroupTags=this.getUserAndGroupTags),o.isFalsy(this.tags)||(e.tags=this.tags),o.isFalsy(this.withTags)||(e.withTags=this.withTags),o.isFalsy(this.userTags)||(e.userTags=this.userTags),o.isFalsy(this.groupTags)||(e.groupTags=this.groupTags),o.isFalsy(this.includeBlockedUsers)||(e.includeBlockedUsers=this.includeBlockedUsers),o.isFalsy(this.withBlockedInfo)||(e.withBlockedInfo=this.withBlockedInfo),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.prototype.isIncludeBlockedUsers=function(){return this.includeBlockedUsers},e.prototype.isWithBlockedInfo=function(){return this.withBlockedInfo},e.prototype.getLimit=function(){return this.limit},e.prototype.getConversationType=function(){return this.conversationType},e.prototype.isWithUserAndGroupTags=function(){return this.getUserAndGroupTags},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getGroupTags=function(){return this.groupTags},e.prototype.getUserTags=function(){return this.userTags},e}();t.ConversationsRequest=E;var c=function(){function e(){this.WithTags=!1,this.IncludeBlockedUsers=!1,this.WithBlockedInfo=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.withUserAndGroupTags=function(e){return"boolean"==typeof e&&(this.getUserAndGroupTags=e),this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.setGroupTags=function(e){return this.groupTags=e,this},e.prototype.setUserTags=function(e){return this.userTags=e,this},e.prototype.setIncludeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.includeBlockedUsers=function(e){return this.IncludeBlockedUsers=e,this},e.prototype.setWithBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.withBlockedInfo=function(e){return this.WithBlockedInfo=e,this},e.prototype.build=function(){return new E(this)},e}();t.ConversationsRequestBuilder=c},function(e,t,n){"use strict";var I=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},f=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}},s=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesRequestBuilder=t.MessagesRequest=void 0;var O=n(2),N=n(6),y=n(11),P=n(0),r=n(56),m=n(1),i=n(10),M=n(30),o=function(){function e(e){this.limit=m.DEFAULT_VALUES.MSGS_LIMIT,this.timestamp=0,this.id=m.DEFAULT_VALUES.DEFAULT_MSG_ID,this.messageStore=r.MessagesStore.getInstance(),this.endpointName="getUserMessages",this.listId="",this.totalPages=0,this.unread=!1,this.inProgress=!1,this.hideMessagesFromBlockedUsers=!1,this.updatedAt=0,this.onlyUpdates=0,this.paginationMeta={},this.WithTags=!1,this.hideDeletedMessages=!1,this.mentionsWithUserTags=!1,this.mentionsWithBlockedRelation=!1,this.interactionGoalCompletedOnly=!1,this.limit=e.limit,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,this.uid=e.uid,this.guid=e.guid,this.parentMessageId=e.parentMessageId,this.timestamp=e.timestamp,this.timestamp&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.id=e.id,this.id!=m.DEFAULT_VALUES.DEFAULT_MSG_ID&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.hideMessagesFromBlockedUsers=e.HideMessagesFromBlockedUsers,this.hideMessagesFromBlockedUsers&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=this.hideMessagesFromBlockedUsers),this.unread=e.unread,this.unread&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.UNREAD]=this.unread),e.searchKey&&(this.searchKey=e.searchKey,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=this.searchKey),e.onlyUpdate&&(this.onlyUpdates=e.onlyUpdate,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ONLY_UPDATES]=this.onlyUpdates),e.updatedAt&&(this.updatedAt=e.updatedAt,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),e.category&&(this.category=e.category),e.categories&&(this.categories=e.categories),e.type&&(this.type=e.type),e.types&&(this.types=e.types),e.WithTags&&(this.WithTags=e.WithTags),e.tags&&(this.tags=e.tags),e.HideReplies&&(this.hideReplies=e.HideReplies,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES]=this.hideReplies),this.hideDeletedMessages=e.HideDeletedMessages,this.hideDeletedMessages&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=this.hideDeletedMessages),this.mentionsWithUserTags=e.mentionsWithUserTags,this.mentionsWithBlockedRelation=e.mentionsWithBlockedRelation,this.interactionGoalCompletedOnly=e.interactionGoalCompletedOnly,this.interactionGoalCompletedOnly&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=this.interactionGoalCompletedOnly)}return e.prototype.getLimit=function(){return this.limit},e.prototype.getUID=function(){return this.uid},e.prototype.getGUID=function(){return this.guid},e.prototype.getMessageId=function(){return this.id},e.prototype.isUnread=function(){return this.unread},e.prototype.isHideMessagesFromBlockedUsers=function(){return this.hideMessagesFromBlockedUsers},e.prototype.getTimestamp=function(){return this.timestamp},e.prototype.getSearchKeyword=function(){return this.searchKey},e.prototype.getUpdatedAfter=function(){return this.updatedAt},e.prototype.isUpdatesOnly=function(){return this.onlyUpdates},e.prototype.getCategories=function(){return this.categories},e.prototype.getCategory=function(){return this.category},e.prototype.getTypes=function(){return this.types},e.prototype.getType=function(){return this.type},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.isHideReplies=function(){return this.hideReplies},e.prototype.isHideDeletedMessages=function(){return this.hideDeletedMessages},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.WithTags},e.prototype.isMentionsWithTagInfo=function(){return this.mentionsWithUserTags},e.prototype.isMentionsWithBlockedInfo=function(){return this.mentionsWithBlockedRelation},e.prototype.isInteractionGoalCompletedOnly=function(){return this.interactionGoalCompletedOnly},e.prototype.fetchNext=function(){var e=this;return new Promise(function(s,r){return I(e,void 0,void 0,function(){var t,n,o;return f(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,this.onlyUpdates){if(0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2]}else if(0==this.timestamp&&0==this.id&&0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=m.MessageConstatnts.PAGINATION.AFFIX.APPEND,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=m.MessageConstatnts.PAGINATION.AFFIX.APPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),s(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,r(new O.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,r(new O.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(s,r){return I(e,void 0,void 0,function(){var t,n,o;return f(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,this.onlyUpdates&&0==this.updatedAt)return this.inProgress=!1,r(new O.CometChatException(i.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=m.MessageConstatnts.PAGINATION.AFFIX.PREPEND,this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=m.MessageConstatnts.PAGINATION.AFFIX.PREPEND,e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t=e.sent(),s(t),this.inProgress=!1,[3,4];case 3:return n=e.sent(),this.inProgress=!1,r(new O.CometChatException(n)),[3,4];case 4:return[3,6];case 5:return o=e.sent(),this.inProgress=!1,r(new O.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(){var R=this;return new Promise(function(s,t){try{var e=R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.PER_PAGE];if(void 0===e)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(e))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(e>m.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",m.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(e<m.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));var n=R.uid;if(void 0!==n){if(typeof n!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"UID","UID","setUID()"))));if(P.isFalsy(n.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.INVALID),"UID","UID","UID","UID"))));R.uid=n.trim()}var o=R.guid;if(void 0!==o){if(typeof o!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","setGUID()"))));if(P.isFalsy(o.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID"))));R.guid=o.trim()}var r=R.mentionsWithUserTags;if(void 0!==r){if(typeof r!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_TAG_INFO","MENTIONS_WITH_TAG_INFO","mentionsWithTagInfo()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_TAG_INFO]=1==r?1:0}var i=R.mentionsWithBlockedRelation;if(void 0!==i){if(typeof i!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_BLOCKED_INFO","MENTIONS_WITH_BLOCKED_INFO","mentionsWithBlockedInfo()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_BLOCKED_INFO]=1==i?1:0}var a=R.parentMessageId;if(void 0!==a){if(isNaN(a))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))));if(a<m.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))))}var E=R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY];if(void 0!==E){if(typeof E!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))));if(P.isFalsy(E.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=E.trim()}var c=R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ID];if(void 0!==c){if(isNaN(c))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))));if(c<m.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))))}var u=R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SENT_AT];if(void 0!==u){if(isNaN(u))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))));if(u<m.DEFAULT_VALUES.ZERO)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))))}var S=R.hideMessagesFromBlockedUsers;if(void 0!==S){if(typeof S!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=1==S?1:0}var p=R.unread;if(void 0!==p){if(typeof p!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"UNREAD","UNREAD","setUnread()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.UNREAD]=1==p?1:0}var C=R.category;if(void 0!==C){if(typeof C!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_CATEGORY","SET_CATEGORY","setCategory()"))));if(P.isFalsy(C.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.INVALID),"SET_CATEGORY","SET_CATEGORY","category","category"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=C.trim()}var l=R.categories;if(void 0!==l){if(!Array.isArray(l))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_CATEGORIES","SET_CATEGORIES","setCategories()"))));0<l.length&&(R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=l)}var _=R.type;if(void 0!==_){if(typeof _!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_TYPE","SET_TYPE","setType()"))));if(P.isFalsy(_.trim()))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.INVALID),"SET_TYPE","SET_TYPE","type","type"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.TYPES]=_.trim()}var T=R.types;if(void 0!==T){if(!Array.isArray(T))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<T.length&&(R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.TYPES]=T)}var d=R.tags;if(void 0!==d){if(!Array.isArray(d))return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TAGS","SET_TAGS","setTags()"))));0<d.length&&(R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.TAGS]=d)}var A=R.WithTags;if(void 0!==A){if(typeof A!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.WITH_TAGS]=1==A?1:0}var h=R.hideDeletedMessages;if(void 0!==h){if(typeof h!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_DELETED_MESSAGES","HIDE_DELETED_MESSAGES","hideDeletedMessages()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=1==h?1:0}var g=R.interactionGoalCompletedOnly;if(void 0!==g){if(typeof g!==m.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void t(new O.CometChatException(JSON.parse(P.format(JSON.stringify(m.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"ONLY_INTERACTION_GOAL_COMPLETED","ONLY_INTERACTION_GOAL_COMPLETED","interactionGoalCompletedOnly()"))));R.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=1==g?1:0}if(R.createEndpoint(),R.totalPages)if(1!=R.totalPages);else if(R.lastAffix==R.affix)return void s([]);N.makeApiCall(R.endpointName,{listId:R.listId},R.paginationMeta).then(function(t){return I(R,void 0,void 0,function(){var n,o=this;return f(this,function(e){return n=[],t[m.ResponseConstants.RESPONSE_KEYS.KEY_META][m.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(m.MessageConstatnts.PAGINATION.KEYS.ID)&&0==this.id&&(this.id=parseInt(t.meta.cursor[m.MessageConstatnts.PAGINATION.KEYS.ID])),t[m.ResponseConstants.RESPONSE_KEYS.KEY_META][m.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(m.MessageConstatnts.PAGINATION.KEYS.SENT_AT)&&0==this.timestamp&&(this.timestamp=t.meta.cursor[m.MessageConstatnts.PAGINATION.KEYS.SENT_AT]),t.meta.pagination.hasOwnProperty("total_pages")&&(this.totalPages=t.meta.pagination.total_pages),t.meta.cursor.hasOwnProperty("affix")&&(this.lastAffix=t.meta.cursor.affix),t.data[0]?(0<this.id&&(this.id=parseInt(t.data[0].id)),0<this.timestamp&&(this.timestamp=t.data[0].sentAt),t.data.map(function(t){return I(o,void 0,void 0,function(){return f(this,function(e){return M.MessageListnerMaping.getInstance().get(m.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST).then(function(e){parseInt(t.id)>e&&M.MessageListnerMaping.getInstance().set(m.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))},function(e){M.MessageListnerMaping.getInstance().set(m.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))}),this.affix==m.MessageConstatnts.PAGINATION.AFFIX.APPEND?(this.id<parseInt(t.id)&&0<this.id&&(this.id=parseInt(t.id)),this.timestamp<t.sentAt&&0<this.timestamp&&(this.timestamp=t.sentAt),this.updatedAt<t.updatedAt&&0<this.updatedAt&&(this.updatedAt=t.updatedAt)):(this.id>parseInt(t.id)&&(this.id=parseInt(t.id)),this.timestamp>t.sentAt&&(this.timestamp=t.sentAt),this.updatedAt>t.updatedAt&&(this.updatedAt=t.updatedAt)),this.id&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.timestamp&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.updatedAt&&(this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),n.push(y.MessageController.trasformJSONMessge(t)),[2]})})})):n=[],s(n),[2]})})},function(e){t(new O.CometChatException(e.error))})}catch(e){t(new O.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[m.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(P.isFalsy(this.guid)||P.isFalsy(this.uid))&&P.isFalsy(this.guid)?(P.isFalsy(this.uid)?this.endpointName="getMessages":this.endpointName="getUserMessages",this.listId=this.uid):(this.endpointName="getGroupMessages",this.listId=this.guid)},e.prototype.makeData=function(){var e={};e[m.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[m.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(P.isFalsy(this.guid)||P.isFalsy(this.uid))&&P.isFalsy(this.guid)&&P.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(t){return I(this,void 0,void 0,function(){var n,o=this;return f(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).filter(function(e){return t[e].sender.uid==o.uid}).map(function(e){n=s(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e.prototype.getFilteredNextDataByReceiverId=function(t){return I(this,void 0,void 0,function(){var n,o=this;return f(this,function(e){switch(e.label){case 0:switch(n=[],t){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,r.MessagesStore.getInstance().get(this.uid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 2:return e.sent(),[3,9];case 3:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 4:e.sent(),e.label=5;case 5:return[4,r.MessagesStore.getInstance().get(this.guid).then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).filter(function(e){return t[e].sender.uid==o.uid}).map(function(e){n=s(n,[t[e]])})})];case 6:return e.sent(),[3,9];case 7:return[4,r.MessagesStore.getInstance().getAllMessages().then(function(t){Object.keys(t).filter(function(e){return parseInt(e)>o.id}).map(function(e){n=s(n,[t[e]])})})];case 8:return e.sent(),[3,9];case 9:return[2,n]}})})},e}();t.MessagesRequest=o;var a=function(){function e(){this.maxLimit=m.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=m.DEFAULT_VALUES.DEFAULT_MSG_ID,this.unread=!1,this.HideMessagesFromBlockedUsers=!1,this.onlyUpdate=0,this.HideDeletedMessages=!1,this.WithTags=!1,this.interactionGoalCompletedOnly=!1,this.mentionsWithUserTags=!1,this.mentionsWithBlockedRelation=!1}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setGUID=function(e){return this.guid=e,this},e.prototype.setUID=function(e){return this.uid=e,this},e.prototype.setParentMessageId=function(e){return this.parentMessageId=e,this},e.prototype.setTimestamp=function(e){return void 0===e&&(e=P.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=m.DEFAULT_VALUES.DEFAULT_MSG_ID),this.id=e,this},e.prototype.setUnread=function(e){return void 0===e&&(e=!1),this.unread=e,this},e.prototype.hideMessagesFromBlockedUsers=function(e){return void 0===e&&(e=!1),this.HideMessagesFromBlockedUsers=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKey=e,this},e.prototype.setUpdatedAfter=function(e){return this.updatedAt=e,this},e.prototype.updatesOnly=function(e){return e&&(this.onlyUpdate=1),this},e.prototype.setCategory=function(e){return this.category=e,this},e.prototype.setCategories=function(e){return this.categories=e,this},e.prototype.setType=function(e){return this.type=e,this},e.prototype.setTypes=function(e){return this.types=e,this},e.prototype.hideReplies=function(e){return this.HideReplies=e,this},e.prototype.hideDeletedMessages=function(e){return this.HideDeletedMessages=e,this},e.prototype.setTags=function(e){return this.tags=e,this},e.prototype.withTags=function(e){return this.WithTags=e,this},e.prototype.mentionsWithTagInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithUserTags=e,this},e.prototype.mentionsWithBlockedInfo=function(e){return void 0===e&&(e=!1),this.mentionsWithBlockedRelation=e,this},e.prototype.setInteractionGoalCompletedOnly=function(e){return void 0===e&&(e=!1),this.interactionGoalCompletedOnly=e,this},e.prototype.build=function(){return this.category&&this.categories&&this.categories.push(this.category),this.type&&this.types&&this.types.push(this.type),new o(this)},e}();t.MessagesRequestBuilder=a},function(e,t,n){"use strict";var a=this&&this.__assign||function(){return(a=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesStore=void 0;var o=n(5),E=n(0),c=n(1),s=n(14),r=function(){function e(e){this.store=c.constants.DEFAULT_STORE,E.isFalsy(e)||(this.store=e),this.messagesStore=s.createInstance({name:E.format(c.LOCAL_STORE.STORE_STRING,o.CometChat.getAppId(),c.LOCAL_STORE.MESSAGES_STORE)}),this.messagesStore.setDriver([s.LOCALSTORAGE,s.INDEXEDDB,s.WEBSQL])}return e.getInstance=function(){return null==e.MessagesStore&&(e.MessagesStore=new e),e.MessagesStore},e.prototype.set=function(e,t){return this.messagesStore.setItem(e,t)},e.prototype.remove=function(e){this.messagesStore.removeItem(e)},e.prototype.get=function(e){return this.messagesStore.getItem(e)},e.prototype.clearStore=function(){var n=this;return new Promise(function(e,t){n.messagesStore.clear().then(function(){e(!0)}).catch(function(e){t(e)})})},e.prototype.getAllMessages=function(){var n=this,o={};return new Promise(function(e,t){n.messagesStore.iterate(function(e,t,n){t!=c.constants.MSG_VER_POST&&t!=c.constants.MSG_VER_POST&&(o=a(a({},o),e))}).then(function(){e(o)})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeMessages=function(e){var n=this;if(o.CometChat.user.getUid()){var s=o.CometChat.user.getUid(),r={},i=0;return this.get(c.constants.MSG_VER_POST).then(function(o){e.map(function(e){var t;if(!E.isFalsy(e)){0==i&&(i=parseInt(e.getId().toString())),i>e.getId()&&(i=parseInt(e.getId().toString())),o<e.getId()&&(o=parseInt(e.getId().toString()));var n=void 0;n=e.getSender()instanceof Object?e.getSender().getUid():e.getSender(),e.getReceiverType()==c.MessageConstatnts.RECEIVER_TYPE.GROUP&&(n=e.getReceiver()),e.getSender()instanceof Object?e.getSender().getUid()==s&&(n=e.getReceiver()):e.getSender()==s&&(n=e.getReceiver()),r[n]||(r[n]={}),r[n]=a(a({},r[n]),((t={})[e.getId()]=e,t))}}),n.get(c.constants.MSG_VER_PRE).then(function(e){(0<i&&i<e||null==e)&&n.set(c.constants.MSG_VER_PRE,i)})&&0<o&&n.set(c.constants.MSG_VER_POST,o),Object.keys(r).map(function(t){n.get(t).then(function(e){null==e&&(e={}),n.set(t,a(a({},r[t]),e))})})}),!0}},e}();t.MessagesStore=r},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BlockedUsersRequestBuilder=t.BlockedUsersRequest=void 0;var s=n(6),o=n(0),r=n(12),i=n(2),a=n(1),E=function(){function e(e){this.next_page=1,this.current_page=1,this.total_pages=-1,this.fetchingInProgress=!1,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},o.isFalsy(e)||(this.limit=e.limit,o.isFalsy(e.searchKeyword)||(this.searchKeyword=e.searchKeyword),o.isFalsy(e.direction)||(this.direction=e.direction))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(this.limit>a.DEFAULT_VALUES.USERS_MAX_LIMIT)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.USERS_MAX_LIMIT)));if(this.limit<a.DEFAULT_VALUES.ZERO)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()")));if(void 0!==this.searchKeyword){if(typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));if(o.isFalsy(this.searchKeyword.trim()))return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.INVALID),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","search keyword","search keyword")));this.searchKeyword=this.searchKeyword.trim()}if(void 0!==this.direction){if(typeof this.direction!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(o.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_DIRECTION","SET_DIRECTION","setDirection()")));if(this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BOTH&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME&&this.direction!=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME)return new i.CometChatException(a.UserErrors.INVALID_DIRECTION)}},e.prototype.fetchNext=function(){var o=this;return new Promise(function(n,t){try{if(o.fetchingInProgress)o.fetchingInProgress=!1,n([]);else{o.fetchingInProgress=!0;var e=o.validateBlockedUsersBuilder();if(e instanceof i.CometChatException)return void t(e);s.makeApiCall("blockedUsersList",{},o.getNextData()).then(function(e){if(e.meta&&(o.total_pages=e.meta.pagination.total_pages),0<e.data.length){o.pagination=e.meta.pagination;var t=[];e.data.map(function(e){t.push(r.UsersController.trasformJSONUser(e))}),n(t)}else n([]);o.fetchingInProgress=!1},function(e){o.fetchingInProgress=!1,t(new i.CometChatException(e.error))})}}catch(e){o.fetchingInProgress=!1,t(new i.CometChatException(e))}})},e.prototype.getDirection=function(){return this.direction},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getNextData=function(){var e={};if(e.per_page=this.limit,o.isFalsy(this.direction)||(e.direction=this.direction),o.isFalsy(this.searchKeyword)||(e.searchKey=this.searchKeyword),1==this.current_page)e.page=this.next_page,this.next_page++,this.current_page++;else{if(this.next_page>this.total_pages)return e.page=this.next_page,e;e.page=this.next_page++}return e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e.directions=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS,e}();t.BlockedUsersRequest=E;var c=function(){function e(){}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=e,this},e.prototype.setDirection=function(e){return this.direction=e,this},e.prototype.blockedByMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.BLOCKED_BY_ME,this},e.prototype.hasBlockedMe=function(){return this.direction=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS.HAS_BLOCKED_ME,this},e.prototype.build=function(){return new E(this)},e}();t.BlockedUsersRequestBuilder=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppSettingsBuilder=t.AppSettings=void 0;var o=n(1),s=function(){function t(e){this.subscriptionType=t.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null,this.subscriptionType=e.subscriptionType,this.roles=e.roles,this.region=e.region,this.autoJoinGroup=e.autoJoinGroup,this.establishSocketConnection=e.establishSocketConnection,this.adminHost=e.adminHost,this.clientHost=e.clientHost}return t.prototype.getSubscriptionType=function(){return this.subscriptionType},t.prototype.getRoles=function(){return this.roles},t.prototype.getRegion=function(){return this.region},t.prototype.getIsAutoJoinEnabled=function(){return this.autoJoinGroup},t.prototype.shouldAutoEstablishSocketConnection=function(){return this.establishSocketConnection},t.prototype.getAdminHost=function(){return this.adminHost},t.prototype.getClientHost=function(){return this.clientHost},t.SUBSCRIPTION_TYPE_NONE="NONE",t.SUBSCRIPTION_TYPE_ALL_USERS="ALL_USERS",t.SUBSCRIPTION_TYPE_ROLES="ROLES",t.SUBSCRIPTION_TYPE_FRIENDS="FRIENDS",t.REGION_EU=o.DEFAULT_VALUES.REGION_DEFAULT_EU,t.REGION_US=o.DEFAULT_VALUES.REGION_DEFAULT_US,t.REGION_IN=o.DEFAULT_VALUES.REGION_DEFAULT_IN,t.REGION_PRIVATE=o.DEFAULT_VALUES.REGION_DEFAULT_PRIVATE,t}();t.AppSettings=s;var r=function(){function e(){this.subscriptionType=s.SUBSCRIPTION_TYPE_NONE,this.roles=null,this.region=o.DEFAULT_VALUES.REGION_DEFAULT,this.autoJoinGroup=!0,this.establishSocketConnection=!0,this.adminHost=null,this.clientHost=null}return e.prototype.subscribePresenceForAllUsers=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ALL_USERS,this},e.prototype.subscribePresenceForRoles=function(e){return this.subscriptionType=s.SUBSCRIPTION_TYPE_ROLES,this.roles=e,this},e.prototype.subscribePresenceForFriends=function(){return this.subscriptionType=s.SUBSCRIPTION_TYPE_FRIENDS,this},e.prototype.setRegion=function(e){return void 0===e&&(e=o.DEFAULT_VALUES.REGION_DEFAULT),this.region=e.toLowerCase(),this},e.prototype.enableAutoJoinForGroups=function(e){return void 0===e&&(e=!0),this.autoJoinGroup=e,this},e.prototype.autoEstablishSocketConnection=function(e){return void 0===e&&(e=!0),this.establishSocketConnection=e,this},e.prototype.overrideAdminHost=function(e){return this.adminHost=e,this},e.prototype.overrideClientHost=function(e){return this.clientHost=e,this},e.prototype.build=function(){return new s(this)},e}();t.AppSettingsBuilder=r},function(e,t,n){"use strict";var S=this&&this.__spreadArrays||function(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var o=Array(e),s=0;for(t=0;t<n;t++)for(var r=arguments[t],i=0,a=r.length;i<a;i++,s++)o[s]=r[i];return o};Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatHelper=void 0;var p=n(11),C=n(1),l=n(12),_=n(16),T=n(29),d=n(5),A=n(2),o=n(0),h=n(7),g=n(4),R=n(18),I=n(10),s=function(){function e(){}return e.processMessage=function(e){try{return p.MessageController.trasformJSONMessge(e)}catch(e){o.Logger.error("CometChatHelper: processMessage",e)}},e.getConversationFromMessage=function(u){return new Promise(function(E,c){try{d.CometChat.getLoggedinUser().then(function(e){if(null!==e){var t=p.MessageController.trasformJSONMessge(u),n=t.receiverType,o=t.conversationId,s=void 0,r=p.MessageController.trasformJSONMessge(u);if(n==C.MessageConstatnts.RECEIVER_TYPE.USER){var i=l.UsersController.trasformJSONUser(t[C.MessageConstatnts.KEYS.SENDER]);s=i.getUid()==e.getUid()?l.UsersController.trasformJSONUser(t[C.MessageConstatnts.KEYS.RECEIVER]):i}else s=_.GroupsController.trasformJSONGroup(t[C.MessageConstatnts.KEYS.RECEIVER]);var a=T.ConversationController.trasformJSONConversation(o,n,r,s,0,[],null,null);E(a)}else c(C.UserErrors.USER_NOT_LOGGED_IN)},function(e){c(new A.CometChatException(e.error))})}catch(e){c(new A.CometChatException(e))}})},e.updateMessageWithReactionInfo=function(e,t,n){var o,s,r,i;try{if(!e||!t||!n)return new A.CometChatException(I.ERRORS.PARAMETER_MISSING);if(!(e instanceof h.BaseMessage))return new A.CometChatException(I.ERRORS.PARAMETER_MISSING);if(n===g.MESSAGE_REACTION.ACTION.ADDED){if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<(null===(o=e.getReactions())||void 0===o?void 0:o.length)){var a=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==a){(c=e.getReactions())[a].setCount(c[a].getCount()+1),(null===(s=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===s?void 0:s.uid)===t.getUid()&&c[a].setReactedByMe(!0),e.setReactions(c)}else{var E=void 0;E=(null===(r=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===r?void 0:r.uid)===t.getUid()?new R.ReactionCount(t.getReaction(),1,!0):new R.ReactionCount(t.getReaction(),1,!1),e.setReactions(S(e.getReactions(),[E]))}}else(null===(i=null===d.CometChat||void 0===d.CometChat?void 0:d.CometChat.user)||void 0===i?void 0:i.uid)===t.getUid()?e.setReactions([new R.ReactionCount(t.getReaction(),1,!0)]):e.setReactions([new R.ReactionCount(t.getReaction(),1,!1)]);return e}}else{if(n!==g.MESSAGE_REACTION.ACTION.REMOVED)return new A.CometChatException(I.ERRORS.PARAMETER_MISSING);if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<e.getReactions().length){var c,u=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==u)if(1<(E=e.getReactions()[u]).getCount())(c=e.getReactions())[u].setCount(c[u].getCount()-1),d.CometChat.user.getUid()===t.getUid()&&c[u].setReactedByMe(!1),e.setReactions(c);else c=(c=e.getReactions()).filter(function(e,t){return t!==u}),e.setReactions(c)}return e}}}catch(e){return new A.CometChatException(e)}},e}();t.CometChatHelper=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MainVideoContainerSetting=t.VirtualBackgroundBuilder=t.VirtualBackground=t.CallSettingsBuilder=t.CallSettings=void 0;var o=n(1),s=n(0),r=function(){function e(e){this.sessionID=e.sessionID,this.defaultLayout=e.defaultLayout,this.isAudioOnly=e.isAudioOnly,this.region=e.region,this.user=e.user,this.mode=e.mode,this.domain=e.domain,this.ShowEndCallButton=e.ShowEndCallButton,this.ShowMuteAudioButton=e.ShowMuteAudioButton,this.ShowPauseVideoButton=e.ShowPauseVideoButton,this.ShowScreenShareButton=e.ShowScreenShareButton,this.ShowSwitchModeButton=e.ShowSwitchModeButton,this.StartAudioMuted=e.StartAudioMuted,this.StartVideoMuted=e.StartVideoMuted,this.localizedObject=e.localizedObject,this.analyticsSettings=e.analyticsSettings,this.appId=e.appId,this.customCSS=e.customCSS,this.ShowRecordingButton=e.ShowRecordingButton,this.StartRecordingOnCallStart=e.StartRecordingOnCallStart,this.useLegacyUI=e.useLegacyUI,this.ShowSwitchToVideoCallButton=e.ShowSwitchToVideoCallButton,this.VirtualBackground=e.virtualBackground,this.ShowVirtualBackgroundSetting=e.ShowVirtualBackgroundSetting,this.MainVideoContainerSetting=e.MainVideoContainerSetting}return e.prototype.shouldUseLegacyUI=function(){return this.useLegacyUI},e.prototype.isRecordingButtonEnabled=function(){return this.ShowRecordingButton},e.prototype.shouldStartRecordingOnCallStart=function(){return this.StartRecordingOnCallStart},e.prototype.getCustomCSS=function(){return this.customCSS},e.prototype.getSessionId=function(){return this.sessionID},e.prototype.isAudioOnlyCall=function(){return this.isAudioOnly},e.prototype.getUser=function(){return this.user},e.prototype.getRegion=function(){return this.region},e.prototype.getAppId=function(){return this.appId},e.prototype.getDomain=function(){return this.domain},e.prototype.isDefaultLayoutEnabled=function(){return this.defaultLayout},e.prototype.getMode=function(){return this.mode},e.prototype.getStartWithAudioMuted=function(){return this.StartAudioMuted},e.prototype.getStartWithVideoMuted=function(){return this.StartVideoMuted},e.prototype.isEndCallButtonEnabled=function(){return this.ShowEndCallButton},e.prototype.isMuteAudioButtonEnabled=function(){return this.ShowMuteAudioButton},e.prototype.isPauseVideoButtonEnabled=function(){return this.ShowPauseVideoButton},e.prototype.isScreenShareButtonEnabled=function(){return this.ShowScreenShareButton},e.prototype.isModeButtonEnabled=function(){return this.ShowSwitchModeButton},e.prototype.getLocalizedStringObject=function(){return this.localizedObject},e.prototype.getAnalyticsSettings=function(){return this.analyticsSettings},e.prototype.isAudioToVideoButtonEnabled=function(){return this.ShowSwitchToVideoCallButton},e.prototype.getVirtualBackground=function(){return this.VirtualBackground},e.prototype.isVirtualBackgroundSettingEnabled=function(){return this.ShowVirtualBackgroundSetting},e.prototype.getMainVideoContainerSetting=function(){return this.MainVideoContainerSetting},e.POSITION_TOP_LEFT="top-left",e.POSITION_TOP_RIGHT="top-right",e.POSITION_BOTTOM_LEFT="bottom-left",e.POSITION_BOTTOM_RIGHT="bottom-right",e.ASPECT_RATIO_DEFAULT="default",e.ASPECT_RATIO_CONTAIN="contain",e.ASPECT_RATIO_COVER="cover",e}();t.CallSettings=r;var i=function(){function e(){this.defaultLayout=!0,this.isAudioOnly=!1,this.mode=o.CallConstants.CALL_MODE.DEFAULT,this.ShowEndCallButton=!0,this.ShowMuteAudioButton=!0,this.ShowPauseVideoButton=!0,this.ShowScreenShareButton=!0,this.ShowSwitchModeButton=!0,this.StartAudioMuted=!1,this.StartVideoMuted=!1,this.localizedObject={},this.analyticsSettings={},this.ShowRecordingButton=!1,this.StartRecordingOnCallStart=!1,this.useLegacyUI=!1,this.ShowSwitchToVideoCallButton=!0,this.virtualBackground=(new E).build(),this.ShowVirtualBackgroundSetting=!0,this.MainVideoContainerSetting=new c}return e.prototype.setSessionID=function(e){return this.sessionID=e,this},e.prototype.enableDefaultLayout=function(e){return this.defaultLayout=e,this},e.prototype.setIsAudioOnlyCall=function(e){return this.isAudioOnly=e,this},e.prototype.setRegion=function(e){return this.region=e,this},e.prototype.setDomain=function(e){return this.domain=e,this},e.prototype.setUser=function(e){return this.user=e,this},e.prototype.setMode=function(e){return this.mode=e,this},e.prototype.showEndCallButton=function(e){return this.ShowEndCallButton=e,this},e.prototype.showMuteAudioButton=function(e){return this.ShowMuteAudioButton=e,this},e.prototype.showPauseVideoButton=function(e){return this.ShowPauseVideoButton=e,this},e.prototype.showScreenShareButton=function(e){return this.ShowScreenShareButton=e,this},e.prototype.showModeButton=function(e){return this.ShowSwitchModeButton=e,this},e.prototype.setLocalizedStringObject=function(e){return this.localizedObject=e,this},e.prototype.setAnalyticsSettings=function(e){return this.analyticsSettings=e,this},e.prototype.setAppId=function(e){return this.appId=e,this},e.prototype.startWithAudioMuted=function(e){return this.StartAudioMuted=e,this},e.prototype.startWithVideoMuted=function(e){return this.StartVideoMuted=e,this},e.prototype.setCustomCSS=function(e){return this.customCSS=e,this},e.prototype.showRecordingButton=function(e){return this.ShowRecordingButton=e,this},e.prototype.startRecordingOnCallStart=function(e){return this.StartRecordingOnCallStart=e,this},e.prototype.forceLegacyUI=function(e){return this.useLegacyUI=e,this},e.prototype.showSwitchToVideoCallButton=function(e){return this.ShowSwitchToVideoCallButton=e,this},e.prototype.setVirtualBackground=function(e){return this.virtualBackground=e,this},e.prototype.showVirtualBackgroundSetting=function(e){return this.ShowVirtualBackgroundSetting=e,this},e.prototype.setMainVideoContainerSetting=function(e){return this.MainVideoContainerSetting=e,this},e.prototype.build=function(){return new r(this)},e}();t.CallSettingsBuilder=i;var a=function(){function e(e){this.AllowBackgroundBlur=e.AllowBackgroundBlur,this.AllowUserImages=e.AllowUserImages,this.ShowDefaultImages=e.ShowDefaultImages,this.SetImages=e.SetImages,this.EnforceBackgroundBlur=e.EnforceBackgroundBlur,this.EnforceBackgroundImage=e.EnforceBackgroundImage}return e.prototype.shouldAllowBackgroundBlur=function(){return this.AllowBackgroundBlur},e.prototype.shouldAllowUserImages=function(){return this.AllowUserImages},e.prototype.shouldShowDefaultImages=function(){return this.ShowDefaultImages},e.prototype.getImages=function(){return this.SetImages},e.prototype.isBackgroundBlurEnforced=function(){return this.EnforceBackgroundBlur},e.prototype.getEnforcedBackgroundImage=function(){return this.EnforceBackgroundImage},e}();t.VirtualBackground=a;var E=function(){function e(){this.AllowBackgroundBlur=!0,this.AllowUserImages=!0,this.ShowDefaultImages=!0,this.SetImages=[],this.EnforceBackgroundBlur=0,this.EnforceBackgroundImage=""}return e.prototype.allowBackgroundBlur=function(e){return this.AllowBackgroundBlur=e,this},e.prototype.allowUserImages=function(e){return this.AllowUserImages=e,this},e.prototype.showDefaultImages=function(e){return this.ShowDefaultImages=e,this},e.prototype.setImages=function(e){return this.SetImages=e,this},e.prototype.enforceBackgroundBlur=function(e){return this.EnforceBackgroundBlur=e,this},e.prototype.enforceBackgroundImage=function(e){return this.EnforceBackgroundImage=e,this},e.prototype.build=function(){return new a(this)},e}();t.VirtualBackgroundBuilder=E;var c=function(){function e(){this.videoFit=r.ASPECT_RATIO_CONTAIN,this.zoomButton=o.CallConstants.ZOOM_BUTTON_DEFAULT_PARAMS,this.nameLabel=o.CallConstants.NAME_LABEL_DEFAULT_PARAMS,this.network=o.CallConstants.NETWORK_LABEL_DEFAULT_PARAMS}return e.prototype.setMainVideoAspectRatio=function(e){this.videoFit=e},e.prototype.setFullScreenButtonParams=function(e,t){s.isFalsy(e)||(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.zoomButton[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e.prototype.setNameLabelParams=function(e,t,n){s.isFalsy(e)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t),s.isFalsy(n)||(this.nameLabel[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.COLOR]=n)},e.prototype.setNetworkLabelParams=function(e,t){s.isFalsy(e)||(this.network[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.POSITION]=e),null!=t&&null!=t&&(this.network[o.CallConstants.MAIN_VIDEO_CONTAINER_SETTINGS.KEYS.VISIBILITY]=t)},e}();t.MainVideoContainerSetting=c},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RTCUser=void 0;var o=n(0),s=function(){function e(e){this.avatar="",o.isFalsy(e)||(this.uid=e.toString())}return e.prototype.setUID=function(e){this.uid=e?e.toString():""},e.prototype.getUID=function(){return this.uid.toString()},e.prototype.setName=function(e){this.name=e?e.toString():""},e.prototype.getName=function(){return this.name.toString()},e.prototype.setAvatar=function(e){this.avatar=e?e.toString():""},e.prototype.getAvatar=function(){return this.avatar.toString()},e.prototype.setJWT=function(e){this.jwt=e?e.toString():""},e.prototype.getJWT=function(){return this.jwt.toString()},e.prototype.setResource=function(e){this.resource=e?e.toString():""},e.prototype.getResource=function(){return this.resource.toString()},e}();t.RTCUser=s},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},s=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WSConnectionHelper=void 0;var p=n(5),C=n(1),r=n(38),i=n(43),l=n(0),a=n(44),E=n(27),c=n(30),u=n(24),S=n(25),_=n(63),T=n(64),d=n(65),A=n(66),h=n(67),g=n(68),R=n(69),I=n(70),f=n(71),O=n(26),N=n(33),y=n(31),P=n(4),m=n(72),M=a.ListenerHandlers.getInstance(),v=function(){function t(){}return t.getInstance=function(){try{return null!=this.wsConnectionHelper&&null!=this.wsConnectionHelper||(this.wsConnectionHelper=new t),this.wsConnectionHelper}catch(e){l.Logger.error("WSConnectionHelper: getInstance",e)}},t.prototype.WSLogin=function(t,n){var o=this;try{m.getWSURL().then(function(e){o.connection=new WebSocket(e),n&&o.connection&&o.connection.readyState==P.READY_STATE.CONNECTING&&n(o.connection.readyState),o.connection.onopen=function(e){o.onOpen(e,n),o.authenticateUser(t)},o.connection.onclose=function(e){o.onClose(e,n)},o.connection.onmessage=function(e){o.onMessage(e)}},function(e){l.Logger.error("WSConnectionHelper :: WSLogin",e)})}catch(e){l.Logger.error("WSConnectionHelper: WSLogin",e)}},t.prototype.onOpen=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){l.Logger.error("WSConnectionHelper: onOpen",e)}},t.prototype.onClose=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){l.Logger.error("WSConnectionHelper: onClose",e)}},t.prototype.publishMessageReaction=function(e){var t=e.getMessageReactionEvent();switch(e.getAction()){case P.MESSAGE_REACTION.ACTION.ADDED:M.messageHandlers.map(function(e){e._eventListener.onMessageReactionAdded&&e._eventListener.onMessageReactionAdded(t)});break;case P.MESSAGE_REACTION.ACTION.REMOVED:M.messageHandlers.map(function(e){e._eventListener.onMessageReactionRemoved&&e._eventListener.onMessageReactionRemoved(t)})}},t.prototype.onMessage=function(e){if(e.data&&"string"==typeof e.data)try{var t=JSON.parse(e.data);if(t&&t.action&&t.action===P.KEYS.PONG)return;var n=this.getCometChatEventFromMessage(t);if(n.getDeviceId()===p.CometChat.getSessionId()&&n.getType()!==P.AUTH.TYPE)return;switch(n.getType()){case P.MESSAGE_REACTION.TYPE:this.publishMessageReaction(n);break;case P.TYPING_INDICATOR.TYPE:this.publishTypingIndicator(n);break;case P.RECEIPTS.TYPE:this.publishReceipts(n);break;case P.PRESENCE.TYPE:this.publishPresence(n);break;case P.AUTH.TYPE:this.authResponseReceived(n);break;case P.MESSAGE.TYPE:this.publishMessages(n);break;case P.TRANSIENT_MESSAGE.TYPE:this.publishTransientMessage(n);break;case P.INTERACTION_RECEIPT.TYPE:this.publishInteractionReceipt(n);break;default:l.Logger.log("WSHelper: onMessage :: unknown type",e.data)}}catch(e){l.Logger.error("WSHelper: onMessage",e)}else l.Logger.log("WSHelper: onMessage :: object data",e.data)},t.prototype.authenticateUser=function(u){var S=this;try{p.CometChat.getLoggedinUser().then(function(c){c?E.KeyStore.getInstance().get("deviceId").then(function(E){l.getAppSettings().then(function(e){var t=null;window&&window.location&&window.location.origin&&(t=window.location.origin);var n="",o=E,s={version:C.SDKHeader.sdkVersion,apiVersion:e[C.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:t,uts:(new Date).getTime()};l.isFalsy(p.CometChat.resource)||(s.resource=p.CometChat.resource),l.isFalsy(p.CometChat.platform)||(s.platform=p.CometChat.platform),l.isFalsy(p.CometChat.language)||(s.language=p.CometChat.language),navigator&&(n=navigator.userAgent);var r={appInfo:s,userAgent:n,deviceId:o,platform:C.SDKHeader.platform},i=new _.CometChatAuthEvent(p.CometChat.getAppId(),"","",c.getUid(),p.CometChat.getSessionId());if(i.setAuth(u),i.setPresenceSubscription(p.CometChat.appSettings.getSubscriptionType()),i.setDeviceId(p.CometChat.getSessionId()),i.setExtraParmaeters(r),m.checkConnection(S.connection)){var a=i.getAsString();S.connection.send(a)}})}):l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},t.prototype.authResponseReceived=function(e){try{"200"===e.getCode()&&"OK"===e.getStatus()&&this.startPingingWS()}catch(e){l.Logger.error("WSConnectionHelper: authResponseReceived",e)}},t.prototype.WSLogout=function(){try{this.clearPingTimer(),m.checkConnection(this.connection)&&this.connection.close(P.LOGOUT_CODE,P.LOGOUT_REASON)}catch(e){l.Logger.error("WSConnectionHelper: WSLogout",e)}},t.prototype.startPingingWS=function(){var e=this;try{t.pingTimer||(t.pingTimer=setInterval(function(){return o(e,void 0,void 0,function(){var t,n;return s(this,function(e){switch(e.label){case 0:return m.checkConnection(this.connection)?(t=new A.CometChatPingEvent("","","","",""),n=t.getAsString(),this.connection.send(n),[4,this.listenForPong()]):[3,2];case 1:e.sent()?(l.Logger.log("WSConnectionHelper :: startPingingWS","pong success"),p.CometChat.getConnectionStatus()!=C.CONNECTION_STATUS.CONNECTED&&(this.WSLogout(),this.connection=null,p.CometChat.getInstance().makeWSConnection())):(l.Logger.log("WSConnectionHelper :: startPingingWS","pong failure"),this.WSLogout(),this.connection=null,p.CometChat.getInstance().setConnectionStatus(C.CONNECTION_STATUS.DISCONNECTED),M.connectionHandlers.map(function(e){try{e._eventListener&&(l.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){l.Logger.error("WSConnectionHandlers: Disconnected Status",e)}}),p.CometChat.getInstance().accidentallyDisconnected()),e.label=2;case 2:return[2]}})})},15e3))}catch(e){l.Logger.error("WSConnectionHelper: startPingingWS",e)}},t.prototype.listenForPong=function(){var o=this;return new Promise(function(t,e){var n=setTimeout(function(){t(!1)},3e3);o.connection.addEventListener("message",function(e){e&&e.data&&"string"==typeof e.data&&(JSON.parse(e.data).action===P.KEYS.PONG&&(clearTimeout(n),t(!0)))})})},t.prototype.clearPingTimer=function(){t.pingTimer&&(clearInterval(t.pingTimer),t.pingTimer=void 0)},t.prototype.sendOnlineEvent=function(){var o=this;try{m.checkConnection(this.connection)&&p.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:p.CometChat.getAppId(),deviceId:p.CometChat.getSessionId(),type:P.PRESENCE.TYPE,body:{action:P.PRESENCE.ACTION.ONLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(m.checkConnection(o.connection)){var n=m.stringifyMessage(t);o.connection.send(n)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendOnlineEvent",e)}},t.prototype.sendOfflineEvent=function(){var o=this;try{m.checkConnection(this.connection)&&p.CometChat.getLoggedinUser().then(function(e){if(e){e.authToken&&delete e.authToken;var t={appId:p.CometChat.getAppId(),deviceId:p.CometChat.getSessionId(),type:P.PRESENCE.TYPE,body:{action:P.PRESENCE.ACTION.OFFLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:e}};if(m.checkConnection(o.connection)){var n=m.stringifyMessage(t);o.connection.send(n)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendOfflineEvent",e)}},t.prototype.startTypingIndicator=function(s,r,i){var a=this;try{p.CometChat.getLoggedinUser().then(function(e){if(e){var t=new y.TypingIndicator(s,r);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new f.CometChatTypingEvent(p.CometChat.getAppId(),s,r,e.getUid(),p.CometChat.getSessionId());if(n.setAction(P.TYPING_INDICATOR.ACTION.STARTED),n.setTypingIndicator(t),m.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},t.prototype.pauseTypingIndicator=function(s,r,i){var a=this;try{p.CometChat.getLoggedinUser().then(function(e){if(e){var t=new y.TypingIndicator(s,r);e.authToken&&delete e.authToken,t.setSender(e),i&&t.setMetadata(i);var n=new f.CometChatTypingEvent(p.CometChat.getAppId(),s,r,e.getUid(),p.CometChat.getSessionId());if(n.setAction(P.TYPING_INDICATOR.ACTION.ENDED),n.setTypingIndicator(t),m.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: pauseTypingIndicator",e)}},t.prototype.markAsRead=function(s,r,i,a){var E=this;try{p.CometChat.getMode();p.CometChat.getLoggedinUser().then(function(e){if(e){var t=new R.CometChatReceiptEvent(p.CometChat.getAppId(),s,r,e.getUid(),p.CometChat.getSessionId(),a);t.setAction(P.RECEIPTS.ACTION.READ);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(P.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),m.checkConnection(E.connection)){var o=t.getAsString();E.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: markAsRead",e)}},t.prototype.markAsDelivered=function(s,r,i,a){var E=this;try{p.CometChat.getMode();p.CometChat.getLoggedinUser().then(function(e){if(e){var t=new R.CometChatReceiptEvent(p.CometChat.getAppId(),s,r,e.getUid(),p.CometChat.getSessionId(),a);t.setAction(P.RECEIPTS.ACTION.DELIVERED);var n=new O.MessageReceipt;if(e.authToken&&delete e.authToken,n.setSender(e),n.setReceiverType(r),n.setReceiver(s),n.setReceiptType(P.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),n.setMessageId(i),n.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),t.setMessageReceipt(n),m.checkConnection(E.connection)){var o=t.getAsString();E.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: markAsDelivered",e)}},t.prototype.sendTransientMessage=function(s,r,i){var a=this;try{p.CometChat.getLoggedinUser().then(function(e){if(e){var t=new N.TransientMessage(s,r,i);e.authToken&&delete e.authToken,t.setSender(e);var n=new I.CometChatTransientEvent(p.CometChat.getAppId(),s,r,e.getUid(),p.CometChat.getSessionId());if(n.setTransientMessage(t),m.checkConnection(a.connection)){var o=n.getAsString();a.connection.send(o)}}else l.Logger.log("no logged-in user","null")},function(e){l.Logger.log("error in fetching logged-in user",e)})}catch(e){l.Logger.error("WSConnectionHelper: sendTransientMessage",e)}},t.prototype.publishTypingIndicator=function(e){try{var t=e.getTypingIndicator();switch(e.getAction()){case P.TYPING_INDICATOR.ACTION.STARTED:M.messageHandlers.map(function(e){e._eventListener.onTypingStarted&&e._eventListener.onTypingStarted(t)}),i.TypingNotificationController.addIncomingTypingStarted(t);break;case P.TYPING_INDICATOR.ACTION.ENDED:M.messageHandlers.map(function(e){e._eventListener.onTypingEnded&&e._eventListener.onTypingEnded(t)}),i.TypingNotificationController.removeIncomingTypingStarted(t)}}catch(e){l.Logger.error("WSHelper: publishTypingIndicator",e)}},t.prototype.publishReceipts=function(e){try{var t=e.getMessageReceipt();switch(e.getAction()){case P.RECEIPTS.ACTION.DELIVERED:M.messageHandlers.map(function(e){e._eventListener.onMessagesDelivered&&e._eventListener.onMessagesDelivered(t)});break;case P.RECEIPTS.ACTION.READ:M.messageHandlers.map(function(e){e._eventListener.onMessagesRead&&e._eventListener.onMessagesRead(t)});break;case P.RECEIPTS.ACTION.DELIVERED_TO_ALL:M.messageHandlers.map(function(e){e._eventListener.onMessagesDeliveredToAll&&e._eventListener.onMessagesDeliveredToAll(t)});break;case P.RECEIPTS.ACTION.READ_BY_ALL:M.messageHandlers.map(function(e){e._eventListener.onMessagesReadByAll&&e._eventListener.onMessagesReadByAll(t)})}}catch(e){l.Logger.error("WSHelper: publishReceipts",e)}},t.prototype.publishPresence=function(e){try{var t=e.getUser();switch(t.setLastActiveAt(e.getTimestamp()),e.getAction()){case P.PRESENCE.ACTION.ONLINE:case P.PRESENCE.ACTION.AVAILABLE:t.setStatus(C.PresenceConstatnts.STATUS.ONLINE),M.userHandlers.map(function(e){l.isFalsy(e._eventListener.onUserOnline)||e._eventListener.onUserOnline(t)});break;case P.PRESENCE.ACTION.OFFLINE:t.setStatus(C.PresenceConstatnts.STATUS.OFFLINE),M.userHandlers.map(function(e){l.isFalsy(e._eventListener.onUserOffline)||e._eventListener.onUserOffline(t)})}}catch(e){l.Logger.error("WSHelper: publishPresence",e)}},t.prototype.publishMessages=function(e){try{var t=e.getMessage();t&&t.getId()&&c.MessageListnerMaping.getInstance().set("all",t.getId()),t instanceof S.Call?this.publishCallMessage(t):t instanceof u.Action?this.publishActionMessage(t):this.publishMessage(t)}catch(e){l.Logger.error("WSHelper: publishMessages",e)}},t.prototype.publishMessage=function(n){try{M.messageHandlers.map(function(e){if(e._eventListener){var t=n;switch(t.getType()){case C.MessageConstatnts.TYPE.TEXT:l.isFalsy(e._eventListener.onTextMessageReceived)||e._eventListener.onTextMessageReceived(n);break;case C.MessageConstatnts.TYPE.CUSTOM:l.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n);break;default:t.getCategory()==C.MessageCategory.CUSTOM?l.isFalsy(e._eventListener.onCustomMessageReceived)||e._eventListener.onCustomMessageReceived(n):t.getCategory()==C.MessageCategory.INTERACTIVE?l.isFalsy(e._eventListener.onInteractiveMessageReceived)||e._eventListener.onInteractiveMessageReceived(n):l.isFalsy(e._eventListener.onMediaMessageReceived)||e._eventListener.onMediaMessageReceived(n)}}})}catch(e){l.Logger.error("WSHelper: publishMessage",e)}},t.prototype.publishCallMessage=function(t){try{var n=r.CallController.getInstance().getActiveCall();switch(t.getStatus()){case C.CallConstants.CALL_STATUS.INITIATED:t.getReceiverType()==C.CallConstants.RECEIVER_TYPE_GROUP?M.callHandlers.map(function(e){t.getCallInitiator().getUid().toLocaleLowerCase()!=p.CometChat.user.getUid().toLocaleLowerCase()&&(l.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t))}):M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallReceived)||e._eventListener.onIncomingCallReceived(t)});break;case C.CallConstants.CALL_STATUS.ONGOING:t.getReceiverType()==C.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==p.CometChat.user.getUid().toLocaleLowerCase()&&M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}):(r.CallController.getInstance().clearTimer(),M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallAccepted)||e._eventListener.onOutgoingCallAccepted(t)}));break;case C.CallConstants.CALL_STATUS.UNANSWERED:if(t.getCallInitiator().getUid().toLocaleLowerCase()==p.CometChat.user.getUid().toLocaleLowerCase())M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)})}break;case C.CallConstants.CALL_STATUS.REJECTED:if(t.getReceiverType()==C.CallConstants.RECEIVER_TYPE_GROUP)t.getCallInitiator().getUid().toLocaleLowerCase()==p.CometChat.user.getUid().toLocaleLowerCase()&&M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});else{if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)})}break;case C.CallConstants.CALL_STATUS.BUSY:t.getReceiverType()==C.CallConstants.RECEIVER_TYPE_GROUP?t.getCallInitiator().getUid().toLocaleLowerCase()==p.CometChat.user.getUid().toLocaleLowerCase()&&M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)}):M.callHandlers.map(function(e){if(null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}l.isFalsy(e._eventListener.onOutgoingCallRejected)||e._eventListener.onOutgoingCallRejected(t)});break;case C.CallConstants.CALL_STATUS.CANCELLED:if(M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onIncomingCallCancelled)||e._eventListener.onIncomingCallCancelled(t)}),null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}break;case C.CallConstants.CALL_STATUS.ENDED:if(M.callHandlers.map(function(e){l.isFalsy(e._eventListener.onCallEndedMessageReceived)||e._eventListener.onCallEndedMessageReceived(t)}),r.CallController.getInstance().getCallListner()&&r.CallController.getInstance().getCallListner()._eventListener.onCallEnded(t),null!==n&&n.getSessionId()===t.getSessionId())try{r.CallController.getInstance().endCall()}catch(e){l.Logger.error("CallError",e)}break;default:l.Logger.log("WSHelper: publishCallMessage :: unknown status",t)}}catch(e){l.Logger.error("WSHelper: publishCallMessage",e)}},t.prototype.publishActionMessage=function(t){try{switch(t.getAction()){case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_JOINED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_INVITED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberJoined)||e._eventListener.onGroupMemberJoined(t,t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_LEFT:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberLeft)||e._eventListener.onGroupMemberLeft(t,t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_BANNED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberBanned)||e._eventListener.onGroupMemberBanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_KICKED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberKicked)||e._eventListener.onGroupMemberKicked(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_UNBANNED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberUnbanned)||e._eventListener.onGroupMemberUnbanned(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_SCOPE_CHANGED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberScopeChanged)||e._eventListener.onGroupMemberScopeChanged(t,t.getActionOn(),t.getNewScope(),t.getOldScope(),t.getActionFor())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_EDITED:M.messageHandlers.map(function(e){l.isFalsy(e._eventListener.onMessageEdited)||e._eventListener.onMessageEdited(t.getActionOn())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_DELETED:M.messageHandlers.map(function(e){l.isFalsy(e._eventListener.onMessageDeleted)||e._eventListener.onMessageDeleted(t.getActionOn())});break;case C.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_ADDED:M.groupHandlers.map(function(e){l.isFalsy(e._eventListener.onGroupMemberAddedToGroup)||e._eventListener.onGroupMemberAddedToGroup(t,t.getActionOn(),t.getActionBy(),t.getActionFor())});break;default:l.Logger.log("WSHelper: publishActionMessage :: unknown action",t)}}catch(e){l.Logger.error("WSHelper: publishActionMessage",e)}},t.prototype.publishTransientMessage=function(e){try{var t=e.getTransientMessage();M.messageHandlers.map(function(e){e._eventListener.onTransientMessageReceived&&e._eventListener.onTransientMessageReceived(t)})}catch(e){l.Logger.error("WSHelper: publishTransientMessage",e)}},t.prototype.publishInteractionReceipt=function(e){try{var t=e.getInteractionReceipt();M.messageHandlers.map(function(e){e._eventListener.onInteractionGoalCompleted&&e._eventListener.onInteractionGoalCompleted(t)})}catch(e){l.Logger.error("WSHelper: publishInteractionReceipt",e)}},t.prototype.getCometChatEventFromMessage=function(e){try{if(e.hasOwnProperty(P.KEYS.TYPE))switch(e.type){case P.TYPING_INDICATOR.TYPE:return f.CometChatTypingEvent.getTypingEventFromJSON(e);case P.RECEIPTS.TYPE:return R.CometChatReceiptEvent.getReceiptEventFromJSON(e);case P.PRESENCE.TYPE:return h.CometChatPresenceEvent.getPresenceEventFromJSON(e);case P.MESSAGE.TYPE:return d.CometChatMessageEvent.getMessageEventFromJSON(e);case P.AUTH.TYPE:return _.CometChatAuthEvent.getAuthEventFromJSON(e);case P.TRANSIENT_MESSAGE.TYPE:return I.CometChatTransientEvent.getTransientEventFromJSON(e);case P.INTERACTION_RECEIPT.TYPE:return T.CometChatInteractionReceiptEvent.getReceiptEventFromJSON(e);case P.MESSAGE_REACTION.TYPE:return g.CometChatReactionEvent.getReactionEventFromJSON(e)}}catch(e){l.Logger.error("WSConnectionHelper: getCometChatEventFromMessage",e)}},t.wsConnectionHelper=new t,t}();t.WSConnectionHelper=v},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatAuthEvent=void 0;var S=n(4),r=function(i){function u(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(S.AUTH.TYPE),r}return s(u,i),u.prototype.getStatus=function(){return this.status},u.prototype.setStatus=function(e){this.status=e},u.prototype.getCode=function(){return this.code},u.prototype.setCode=function(e){this.code=e},u.prototype.setAuth=function(e){this.auth=e},u.prototype.getAuth=function(){return this.auth},u.prototype.setPresenceSubscription=function(e){this.presenceSubscription=e},u.prototype.getPresenceSubscription=function(){return this.presenceSubscription},u.prototype.setDeviceId=function(e){this.deviceId=e},u.prototype.getdeviceId=function(){return this.deviceId},u.prototype.setExtraParmaeters=function(e){this.params=e},u.prototype.getExtraParameters=function(){return this.params},u.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},u.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[S.KEYS.AUTH]=this.auth,t[S.KEYS.DEVICE_ID]=this.deviceId,t[S.KEYS.PRESENCE_SUBSCRIPTION]=this.presenceSubscription,t[S.KEYS.PARAMS]=this.params,e[S.KEYS.BODY]=t,e},u.getAuthEventFromJSON=function(e){var t=e[S.KEYS.APP_ID],n=e[S.KEYS.RECEIVER],o=e[S.KEYS.RECEIVER_TYPE],s=e[S.KEYS.DEVICE_ID],r=e[S.KEYS.SENDER],i=e[S.KEYS.BODY],a=i[S.KEYS.STATUS],E=i[S.KEYS.CODE],c=new u(t,n,o,r,s);return c.setStatus(a),c.setCode(E),c},u}(n(8).CometChatEvent);t.CometChatAuthEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatInteractionReceiptEvent=void 0;var l=n(4),r=n(8),_=n(23),T=n(45),d=n(3),i=function(a){function C(e,t,n,o,s,r){var i=a.call(this,e,t,n,o,s,r)||this;return i.setType(l.INTERACTION_RECEIPT.TYPE),i}return s(C,a),C.prototype.getInteractionReceipt=function(){return this.interactionReceipt},C.prototype.setInteractionReceipt=function(e){this.interactionReceipt=e},C.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},C.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[l.KEYS.MESSAGE_ID]=this.interactionReceipt.getMessageId(),t[l.KEYS.USER]=this.interactionReceipt.getSender(),t[l.KEYS.INTERACTIONS]=this.interactionReceipt.getInteractions(),e[l.KEYS.BODY]=t,e},C.getReceiptEventFromJSON=function(e){var t=e[l.KEYS.APP_ID],n=e[l.KEYS.RECEIVER],o=e[l.KEYS.RECEIVER_TYPE],s=e[l.KEYS.DEVICE_ID],r=e[l.KEYS.SENDER],i=e[l.KEYS.MESSAGE_SENDER],a=e[l.KEYS.BODY],E=a[l.KEYS.USER],c=a[l.KEYS.MESSAGE_ID],u=a[l.KEYS.INTERACTIONS],S=new C(t,n,o,r,s,i),p=new T.InteractionReceipt;return p.setSender(new d.User(E)),p.setReceiverType(o),p.setMessageId(c),p.setReceiverId(n),p.setInteractions(u.map(function(e){return _.Interaction.getInteractionFromJSON(e)})),S.setInteractionReceipt(p),S},C}(r.CometChatEvent);t.CometChatInteractionReceiptEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatMessageEvent=void 0;var u=n(11),S=n(4),r=function(i){function c(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(S.MESSAGE.TYPE),r}return s(c,i),c.prototype.getMessage=function(){return this.message},c.prototype.setMessage=function(e){this.message=e},c.getMessageEventFromJSON=function(e){var t=e[S.KEYS.APP_ID],n=e[S.KEYS.RECEIVER],o=e[S.KEYS.RECEIVER_TYPE],s=e[S.KEYS.DEVICE_ID],r=e[S.KEYS.SENDER],i=e[S.KEYS.BODY],a=new c(t,n,o,r,s),E=u.MessageController.trasformJSONMessge(i);return a.setMessage(E),a},c}(n(8).CometChatEvent);t.CometChatMessageEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatPingEvent=void 0;var i=n(4),r=function(r){function e(e,t,n,o,s){return r.call(this,e,t,n,o,s)||this}return s(e,r),e.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},e.prototype.getAsJSONObject=function(){var e={};return e[i.KEYS.ACTION]=i.KEYS.PING,e[i.KEYS.ACK]="true",e},e}(n(8).CometChatEvent);t.CometChatPingEvent=r},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatPresenceEvent=void 0;var u=n(4),r=n(8),S=n(3),i=function(i){function c(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(u.PRESENCE.TYPE),r}return s(c,i),c.prototype.getAction=function(){return this.action},c.prototype.setAction=function(e){this.action=e},c.prototype.getUser=function(){return this.user},c.prototype.setUser=function(e){this.user=e},c.prototype.getTimestamp=function(){return this.timestamp},c.prototype.setTimestamp=function(e){this.timestamp=e},c.getPresenceEventFromJSON=function(e){var t=e[u.KEYS.APP_ID],n=e[u.KEYS.DEVICE_ID],o=e[u.KEYS.SENDER],s=e[u.KEYS.BODY],r=s[u.KEYS.ACTION],i=s[u.KEYS.USER],a=s[u.KEYS.TIMESTAMP],E=new c(t,"","",o,n);return E.setAction(r),E.setUser(new S.User(i)),E.setTimestamp(a),E},c}(r.CometChatEvent);t.CometChatPresenceEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatReactionEvent=void 0;var g=n(4),r=n(8),R=n(32),I=n(46),i=function(i){function h(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(g.MESSAGE_REACTION.TYPE),r}return s(h,i),h.prototype.getAction=function(){return this.action},h.prototype.setAction=function(e){this.action=e},h.prototype.getMessageReactionEvent=function(){return this.reaction},h.prototype.setMessageReactionEvent=function(e){this.reaction=e},h.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},h.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[g.KEYS.ACTION]=this.action,t[g.KEYS.REACTION]=this.reaction,e[g.KEYS.BODY]=t,e},h.getReactionEventFromJSON=function(e){var t=e[g.KEYS.APP_ID],n=e[g.KEYS.DEVICE_ID],o=e[g.KEYS.SENDER],s=e[g.KEYS.RECEIVER],r=e[g.KEYS.RECEIVER_TYPE],i=e[g.KEYS.BODY],a=i[g.KEYS.ACTION],E=i[g.KEYS.ID],c=i[g.KEYS.MESSAGE_ID],u=i[g.KEYS.UID],S=i[g.KEYS.REACTION],p=i[g.KEYS.REACTED_BY],C=i[g.KEYS.REACTED_AT],l=i[g.KEYS.CONVERSATION_ID],_=i[g.KEYS.PARENT_ID],T=new R.Reaction(E,c,S,u,C,p),d=new I.ReactionEvent(T,s,r,l,_),A=new h(t,s,r,o,n);return A.setAction(a),A.setMessageReactionEvent(d),A},h}(r.CometChatEvent);t.CometChatReactionEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatReceiptEvent=void 0;var l=n(4),r=n(8),_=n(26),T=n(3),i=function(a){function C(e,t,n,o,s,r){var i=a.call(this,e,t,n,o,s,r)||this;return i.setType(l.RECEIPTS.TYPE),i}return s(C,a),C.prototype.getAction=function(){return this.action},C.prototype.setAction=function(e){this.action=e},C.prototype.getMessageReceipt=function(){return this.receipt},C.prototype.setMessageReceipt=function(e){this.receipt=e},C.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},C.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[l.KEYS.ACTION]=this.action,t[l.KEYS.MESSAGE_ID]=this.receipt.getMessageId(),t[l.KEYS.USER]=this.receipt.getSender(),e[l.KEYS.BODY]=t,e},C.getReceiptEventFromJSON=function(e){var t=e[l.KEYS.APP_ID],n=e[l.KEYS.RECEIVER],o=e[l.KEYS.RECEIVER_TYPE],s=e[l.KEYS.DEVICE_ID],r=e[l.KEYS.SENDER],i=e[l.KEYS.BODY],a=i[l.KEYS.ACTION],E=i[l.KEYS.USER],c=i[l.KEYS.MESSAGE_ID],u=i[l.KEYS.TIMESTAMP],S=new C(t,n,o,r,s);S.setAction(a);var p=new _.MessageReceipt;return p.setSender(new T.User(E)),p.setReceiverType(o),p.setReceiver(n),a===l.RECEIPTS.ACTION.DELIVERED&&(p.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),p.setDeliveredAt(u)),a===l.RECEIPTS.ACTION.READ&&(p.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),p.setReadAt(u)),a===l.RECEIPTS.ACTION.READ_BY_ALL&&(p.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.READ_BY_ALL_RECEIPT),p.setReadAt(u)),a===l.RECEIPTS.ACTION.DELIVERED_TO_ALL&&(p.setReceiptType(l.RECEIPTS.RECEIPT_TYPE.DELIVERY_TO_ALL_RECEIPT),p.setDeliveredAt(u)),p.setMessageId(c.toString()),p.setTimestamp(u),S.setMessageReceipt(p),S},C}(r.CometChatEvent);t.CometChatReceiptEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatTransientEvent=void 0;var p=n(4),r=n(8),C=n(33),l=n(3),i=function(i){function S(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(p.TRANSIENT_MESSAGE.TYPE),r}return s(S,i),S.prototype.getTransientMessage=function(){return this.transientMessage},S.prototype.setTransientMessage=function(e){this.transientMessage=e},S.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},S.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[p.KEYS.USER]=this.transientMessage.getSender(),this.transientMessage.getData()&&(t[p.KEYS.DATA]=this.transientMessage.getData()),e[p.KEYS.BODY]=t,e},S.getTransientEventFromJSON=function(e){var t=e[p.KEYS.APP_ID],n=e[p.KEYS.RECEIVER],o=e[p.KEYS.RECEIVER_TYPE],s=e[p.KEYS.DEVICE_ID],r=e[p.KEYS.SENDER],i=e[p.KEYS.BODY],a=i[p.KEYS.USER],E=i[p.KEYS.DATA],c=new S(t,n,o,r,s),u=new C.TransientMessage(n,o,E);return u.setSender(new l.User(a)),i.hasOwnProperty(p.KEYS.DATA)&&i[p.KEYS.DATA]&&u.setData(E),c.setTransientMessage(u),c},S}(r.CometChatEvent);t.CometChatTransientEvent=i},function(e,t,n){"use strict";var o,s=this&&this.__extends||(o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)},function(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)});Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatTypingEvent=void 0;var C=n(4),r=n(8),l=n(31),_=n(3),i=function(i){function p(e,t,n,o,s){var r=i.call(this,e,t,n,o,s)||this;return r.setType(C.TYPING_INDICATOR.TYPE),r}return s(p,i),p.prototype.getAction=function(){return this.action},p.prototype.setAction=function(e){this.action=e},p.prototype.getTypingIndicator=function(){return this.typingIndicator},p.prototype.setTypingIndicator=function(e){this.typingIndicator=e},p.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},p.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[C.KEYS.ACTION]=this.action,t[C.KEYS.USER]=this.typingIndicator.getSender(),this.typingIndicator.getMetadata()&&(t[C.KEYS.METADATA]=this.typingIndicator.getMetadata()),e[C.KEYS.BODY]=t,e},p.getTypingEventFromJSON=function(e){var t=e[C.KEYS.APP_ID],n=e[C.KEYS.RECEIVER],o=e[C.KEYS.RECEIVER_TYPE],s=e[C.KEYS.DEVICE_ID],r=e[C.KEYS.SENDER],i=e[C.KEYS.BODY],a=i[C.KEYS.ACTION],E=i[C.KEYS.USER],c=i[C.KEYS.METADATA],u=new p(t,n,o,r,s);u.setAction(a);var S=new l.TypingIndicator(n,o);return S.setSender(new _.User(E)),i.hasOwnProperty(C.KEYS.METADATA)&&i[C.KEYS.METADATA]&&S.setMetadata(c),u.setTypingIndicator(S),u},p}(r.CometChatEvent);t.CometChatTypingEvent=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getWSURL=t.stringifyMessage=t.checkConnection=void 0;var o=n(1),s=n(0),r=n(4);t.checkConnection=function(e){return e&&e.readyState===r.READY_STATE.OPEN},t.stringifyMessage=function(e){return JSON.stringify(e)},t.getWSURL=function(){return new Promise(function(n,e){s.getAppSettings().then(function(e){var t=r.WS.protocol+s.getChatHost(e)+":"+e[o.APP_SETTINGS.KEYS.CHAT_WSS_PORT];n(t)},function(e){s.Logger.error("WSHelper :: getWSURL",e)})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CCExtension=void 0;var o=n(0),s=function(){function e(e){this.id="",this.name="",e&&(o.isFalsy(e.id)||(this.id=e.id),o.isFalsy(e.name)||(this.name=e.name))}return e.prototype.getId=function(){return this.id},e.prototype.getName=function(){return this.name},e}();t.CCExtension=s},function(e,t,n){"use strict";var r=this&&this.__assign||function(){return(r=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},i=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},a=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostDetails=void 0;var E=n(1),c=n(27),u=n(6),S=n(34),o=function(){function e(){var t=this;this.uiKitSDK={version:""},this.callSDK={version:""},this.deviceId="",this.platform="unknown",this.sessionId="",this.origin="",this.debugMode=!1,this.getOperatingSystem=function(){var e=window.navigator.userAgent;return/Windows/.test(e)?"Windows":/Mac/.test(e)?"Mac OS":/Linux/.test(e)?"Linux":/Android/.test(e)?"Android":/iOS/.test(e)?"iOS":"Unknown"},this.isIP=function(e){return/^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$/.test(e)},c.KeyStore.getInstance().get(E.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){e&&(t.deviceId=e)}),this.getSDKVersion(),this.getPlatform(),this.getOrgin(),setTimeout(function(){t.getCallSDKVersion(),t.postDetails()},5e3)}return e.prototype.getOrientation=function(){return window.matchMedia("(orientation: portrait)").matches?"Portrait":window.matchMedia("(orientation: landscape)").matches?"Landscape":"Unknown"},e.prototype.getPlatform=function(){document.querySelector("#root, #app")&&(this.platform="react"),document.querySelector("app-root")&&(this.platform="angular"),document.querySelector("[__vue__]")&&(this.platform="vue"),"Ember"in window&&(this.platform="ember"),"Backbone"in window&&(this.platform="backbone"),"Meteor"in window&&(this.platform="meteor"),"ko"in window&&(this.platform="ko")},e.prototype.getSDKVersion=function(){window.CometChatUiKit&&(this.uiKitSDK=window.CometChatUiKit)},e.prototype.getCallSDKVersion=function(){if("function"==typeof window.getCometChatCallSDKInfo){var e=window.getCometChatCallSDKInfo();e&&(this.callSDK=e)}},e.prototype.getUIKitPlatform=function(e){return e?e.includes("react")?"react":e.includes("angular")?"angular":e.includes("vue")?"vue":void 0:""},e.prototype.getBrowser=function(){var e=navigator.userAgent;return/Chrome/.test(e)&&!/Edge/.test(e)?"Google Chrome":/Firefox/.test(e)?"Mozilla Firefox":/Safari/.test(e)&&!/Chrome/.test(e)?"Safari":/Edge/.test(e)?"Microsoft Edge":/Trident\/7\./.test(e)?"Internet Explorer":/Opera\//.test(e)||/OPR\//.test(e)?"Opera":"Unknown Browser"},e.prototype.getOrgin=function(){this.origin=window.location.hostname,(this.origin.includes("localhost")||this.isIP(this.origin))&&(this.debugMode=!0)},e.prototype.encodeSHA256=function(s){return i(this,void 0,void 0,function(){var t,n,o;return a(this,function(e){switch(e.label){case 0:return t=(new TextEncoder).encode(s),[4,crypto.subtle.digest("SHA-256",t)];case 1:return n=e.sent(),o=Array.from(new Uint8Array(n)),[2,o.map(function(e){return e.toString(16).padStart(2,"0")}).join("")]}})})},e.prototype.getSessionIdHash=function(){var n,o;return i(this,void 0,void 0,function(){var t;return a(this,function(e){switch(e.label){case 0:return t=""+E.SDKHeader.sdkVersion+(null!==(n=this.callSDK.version)&&void 0!==n?n:null)+(null!==(o=this.uiKitSDK.version)&&void 0!==o?o:null)+this.debugMode+(S.CometChat.demoMetaInfo?S.CometChat.demoMetaInfo.version:null),[4,this.encodeSHA256(t)];case 1:return[2,e.sent()]}})})},e.prototype.getStoredSessionIdHash=function(){return i(this,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return[4,c.KeyStore.getInstance().get(E.LOCAL_STORE.KEY_SESSION_ID)];case 1:return[2,e.sent()]}})})},e.prototype.isMobile=function(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)},e.prototype.getTimeZone=function(){var e=(new Date).getTimezoneOffset(),t=Math.floor(Math.abs(e)/60),n=Math.abs(e)%60;return(0<e?"-":"+")+(t=t<10?"0"+t:t)+":"+(n=n<10?"0"+n:n)},e.prototype.postDetails=function(){var s;return i(this,void 0,void 0,function(){var t,n,o=this;return a(this,function(e){switch(e.label){case 0:return[4,this.getSessionIdHash()];case 1:return t=e.sent(),[4,this.getStoredSessionIdHash()];case 2:return e.sent()===t||(n={sessionId:t,data:r(r({cometchat:r(r(r({},this.uiKitSDK.version?{uikit:{platform:this.getUIKitPlatform(this.uiKitSDK.name),version:this.uiKitSDK.version}}:{}),{chatsdk:{platform:"javascript",version:E.SDKHeader.sdkVersion}}),this.callSDK.version?{callssdk:{platform:"javascript",version:this.callSDK.version}}:{})},S.CometChat.demoMetaInfo?{demo:{name:S.CometChat.demoMetaInfo.name,type:S.CometChat.demoMetaInfo.type,version:S.CometChat.demoMetaInfo.version,platform:S.CometChat.demoMetaInfo.platform}}:{}),{app:{url:this.origin,debug:this.debugMode,browser:this.getBrowser(),isMobileBrowser:this.isMobile()},device:{id:this.deviceId,platform:this.platform,language:navigator.language,resolution:window.screen.width+" × "+window.screen.height,userAgent:navigator.userAgent,timezone:this.getTimeZone(),os:{name:this.getOperatingSystem()}},meta:{network:null===(s=navigator.connection)||void 0===s?void 0:s.effectiveType,deviceOrientation:this.getOrientation()}}),generatedAt:Math.ceil((new Date).valueOf()/1e3)},u.makeApiCall("userSessions",{},n).then(function(t){return i(o,void 0,void 0,function(){return a(this,function(e){switch(e.label){case 0:return t.data.sessionId?[4,c.KeyStore.getInstance().set(E.LOCAL_STORE.KEY_SESSION_ID,t.data.sessionId)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})})),[2]}})})},e}();t.PostDetails=o},function(e,t,n){"use strict";var c=this&&this.__assign||function(){return(c=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var s in t=arguments[n])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e}).apply(this,arguments)},r=this&&this.__awaiter||function(e,i,a,E){return new(a||(a=Promise))(function(n,t){function o(e){try{r(E.next(e))}catch(e){t(e)}}function s(e){try{r(E.throw(e))}catch(e){t(e)}}function r(e){var t;e.done?n(e.value):(t=e.value,t instanceof a?t:new a(function(e){e(t)})).then(o,s)}r((E=E.apply(e,i||[])).next())})},u=this&&this.__generator||function(n,o){var s,r,i,e,a={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(s)throw new TypeError("Generator is already executing.");for(;a;)try{if(s=1,r&&(i=2&t[0]?r.return:t[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,t[1])).done)return i;switch(r=0,i&&(t=[2&t[0],i.value]),t[0]){case 0:case 1:i=t;break;case 4:return a.label++,{value:t[1],done:!1};case 5:a.label++,r=t[1],t=[0];continue;case 7:t=a.ops.pop(),a.trys.pop();continue;default:if(!(i=0<(i=a.trys).length&&i[i.length-1])&&(6===t[0]||2===t[0])){a=0;continue}if(3===t[0]&&(!i||t[1]>i[0]&&t[1]<i[3])){a.label=t[1];break}if(6===t[0]&&a.label<i[1]){a.label=i[1],i=t;break}if(i&&a.label<i[2]){a.label=i[2],a.ops.push(t);break}i[2]&&a.ops.pop(),a.trys.pop();continue}t=o.call(n,a)}catch(e){t=[6,e],r=0}finally{s=i=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionsRequestBuilder=t.ReactionsRequest=void 0;var S=n(2),i=n(6),p=n(0),C=n(1),l=n(10),a=n(32),E=n(3),o=function(){function e(e){this.limit=C.DEFAULT_VALUES.REACTIONS_LIMIT,this.msgId=C.DEFAULT_VALUES.DEFAULT_MSG_ID,this.params={},this.inProgress=!1,this.paginationMeta={},this.endpointName="getReactionsList",e.reaction&&(this.reaction=e.reaction),e.limit&&(this.limit=e.limit),this.msgId=e.msgId}return e.prototype.getLimit=function(){return this.limit},e.prototype.getMessageId=function(){return this.msgId},e.prototype.getReaction=function(){return this.reaction},e.prototype.fetchNext=function(){var e=this;return new Promise(function(a,E){return r(e,void 0,void 0,function(){var t,n,o,s,r,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,E(new S.CometChatException(l.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((r={limit:this.limit})[C.MessageConstatnts.PAGINATION.KEYS.AFFIX]=C.MessageConstatnts.PAGINATION.AFFIX.APPEND,r),null!==(i=this.nextPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return o=e.sent(),this.inProgress=!1,E(new S.CometChatException(o)),[3,4];case 4:return[3,6];case 5:return s=e.sent(),this.inProgress=!1,E(new S.CometChatException(s)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(a,E){return r(e,void 0,void 0,function(){var t,n,o,s,r,i;return u(this,function(e){switch(e.label){case 0:if(e.trys.push([0,5,,6]),this.inProgress)return E(new S.CometChatException(l.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,E(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];t=c(((r={limit:this.limit})[C.MessageConstatnts.PAGINATION.KEYS.AFFIX]=C.MessageConstatnts.PAGINATION.AFFIX.PREPEND,r),null!==(i=this.previousPage)&&void 0!==i?i:{}),e.label=1;case 1:return e.trys.push([1,3,,4]),[4,this.makeAPICall(t)];case 2:return n=e.sent(),a(n),this.inProgress=!1,[3,4];case 3:return o=e.sent(),this.inProgress=!1,E(new S.CometChatException(o)),[3,4];case 4:return[3,6];case 5:return s=e.sent(),this.inProgress=!1,E(new S.CometChatException(s)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(n){var s=this;return new Promise(function(o,t){try{var e=s.limit;if(void 0===e)return void t(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(e))return void t(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(e>C.DEFAULT_VALUES.REACTIONS_MAX_LIMIT)return void t(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",C.DEFAULT_VALUES.REACTIONS_MAX_LIMIT))));if(e<C.DEFAULT_VALUES.ZERO)return void t(new S.CometChatException(JSON.parse(p.format(JSON.stringify(C.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));s.createEndpoint(),i.makeApiCall(s.endpointName,s.params,n).then(function(n){return r(s,void 0,void 0,function(){var t;return u(this,function(e){return this.paginationMeta=n.meta,n.meta&&n.meta.next&&(this.nextPage=n.meta.next),n.meta&&n.meta.previous&&(this.previousPage=n.meta.previous),t=[],0<n.data.length&&n.data.map(function(e){t.push(new a.Reaction(e.id,e.messageId,e.reaction,e.uid,e.reactedAt,new E.User(e.reactedBy)))}),o(t),[2]})})},function(e){t(new S.CometChatException(e.error))})}catch(e){t(new S.CometChatException(e))}})},e.prototype.createEndpoint=function(){p.isFalsy(this.reaction)?(this.endpointName="getReactionsList",this.params={messageId:this.msgId}):(this.endpointName="getFilteredReactionsList",this.params={messageId:this.msgId,reaction:this.reaction})},e}();t.ReactionsRequest=o;var s=function(){function e(){this.msgId=C.DEFAULT_VALUES.DEFAULT_MSG_ID}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=C.DEFAULT_VALUES.DEFAULT_MSG_ID),this.msgId=e,this},e.prototype.setReaction=function(e){return this.reaction=e,this},e.prototype.build=function(){return new o(this)},e}();t.ReactionsRequestBuilder=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationUpdateSettings=void 0;var r=n(1),o=function(){function s(){this.callActivities=!0,this.groupActions=!0,this.customMessages=!0,this.messageReplies=!0}return s.prototype.shouldUpdateOnCallActivities=function(){return this.callActivities},s.prototype.setCallActivities=function(e){this.callActivities=e},s.prototype.shouldUpdateOnGroupActions=function(){return this.groupActions},s.prototype.setGroupActions=function(e){this.groupActions=e},s.prototype.shouldUpdateOnCustomMessages=function(){return this.customMessages},s.prototype.setCustomMessages=function(e){this.customMessages=e},s.prototype.shouldUpdateOnMessageReplies=function(){return this.messageReplies},s.prototype.setMessageReplies=function(e){this.messageReplies=e},s.fromJSON=function(e){var t,n=new s,o=null!==(t=e[r.APP_SETTINGS.KEYS.PARAMETERS])&&void 0!==t?t:{};return n.setCallActivities(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES]),n.setGroupActions(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS]),n.setCustomMessages(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES]),n.setMessageReplies(!!o.hasOwnProperty(r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES)&&o[r.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES]),n},s}();t.ConversationUpdateSettings=o},function(e,t,n){var i=n(78),a=n(79);e.exports=function(e,t,n){var o=t&&n||0;"string"==typeof e&&(t="binary"===e?new Array(16):null,e=null);var s=(e=e||{}).random||(e.rng||i)();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t)for(var r=0;r<16;++r)t[o+r]=s[r];return t||a(s)}},function(e,t){var n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof window.msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto);if(n){var o=new Uint8Array(16);e.exports=function(){return n(o),o}}else{var s=new Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=4294967296*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}},function(e,t){for(var s=[],n=0;n<256;++n)s[n]=(n+256).toString(16).substr(1);e.exports=function(e,t){var n=t||0,o=s;return[o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],"-",o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]],o[e[n++]]].join("")}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatNotifications=void 0;var u=n(1),S=n(0),p=n(2),C=n(6),l=n(13),o=n(47),_=n(81),s=n(82),T=n(83),d=n(84),A=n(85),h=n(86),r=n(87),i=function(){function E(){}return E.fetchPushPreferences=function(){return new Promise(function(i,t){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=h.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new h.PushPreferences)},function(e){return t(new p.CometChatException(e.error))})},function(e){return t(new p.CometChatException(e))})}catch(e){return t(new p.CometChatException(e))}})},E.fetchPreferences=function(){return new Promise(function(i,t){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new d.NotificationPreferences)},function(e){return t(new p.CometChatException(e.error))})},function(e){return t(new p.CometChatException(e))})}catch(e){return t(new p.CometChatException(e))}})},E.updatePushPreferences=function(c){return new Promise(function(a,E){try{S.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_GROUP_PREFERENCES]={},t[l.APIConstants.KEY_MUTE_PREFERENCES]={},t[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),o=c.getGroupPreferences(),s=c.getMutePreferences(),r=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();o&&(o.getMessagesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MESSAGES]=o.getMessagesPreference()),o.getReactionsPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REACTIONS]=o.getReactionsPreference()),o.getRepliesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REPLIES]=o.getRepliesPreference()),o.getMemberAddedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_ADDED]=o.getMemberAddedPreference()),o.getMemberBannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_BANNED]=o.getMemberBannedPreference()),o.getMemberJoinedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_JOINED]=o.getMemberJoinedPreference()),o.getMemberKickedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_KICKED]=o.getMemberKickedPreference()),o.getMemberLeftPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_LEFT]=o.getMemberLeftPreference()),o.getMemberScopeChangedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=o.getMemberScopeChangedPreference()),o.getMemberUnbannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=o.getMemberUnbannedPreference())),s&&(s.getDNDPreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_DND]=s.getDNDPreference()),s.getSchedulePreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_SCHEDULE]=s.getSchedulePreference())),r&&(r.getMessagesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REPLIES]=r.getRepliesPreference())),null!=i&&(n[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[l.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[l.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],C.makeApiCall(l.APIConstants.KEY_UPDATE_PREFERENCES,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=h.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return a(r)}return a(new h.PushPreferences)},function(e){return E(new p.CometChatException(e.error))})},function(e){return E(new p.CometChatException(e))})}catch(e){return E(new p.CometChatException(e))}})},E.updatePreferences=function(c){return new Promise(function(a,E){try{S.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_GROUP_PREFERENCES]={},t[l.APIConstants.KEY_MUTE_PREFERENCES]={},t[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},t),o=c.getGroupPreferences(),s=c.getMutePreferences(),r=c.getOneOnOnePreferences(),i=c.getUsePrivacyTemplate();o&&(o.getMessagesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MESSAGES]=o.getMessagesPreference()),o.getReactionsPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REACTIONS]=o.getReactionsPreference()),o.getRepliesPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_REPLIES]=o.getRepliesPreference()),o.getMemberAddedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_ADDED]=o.getMemberAddedPreference()),o.getMemberBannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_BANNED]=o.getMemberBannedPreference()),o.getMemberJoinedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_JOINED]=o.getMemberJoinedPreference()),o.getMemberKickedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_KICKED]=o.getMemberKickedPreference()),o.getMemberLeftPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_LEFT]=o.getMemberLeftPreference()),o.getMemberScopeChangedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=o.getMemberScopeChangedPreference()),o.getMemberUnbannedPreference()&&(n[l.APIConstants.KEY_GROUP_PREFERENCES][l.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=o.getMemberUnbannedPreference())),s&&(s.getDNDPreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_DND]=s.getDNDPreference()),s.getSchedulePreference()&&(n[l.APIConstants.KEY_MUTE_PREFERENCES][l.APIConstants.KEY_MUTE_SCHEDULE]=s.getSchedulePreference())),r&&(r.getMessagesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=r.getMessagesPreference()),r.getReactionsPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=r.getReactionsPreference()),r.getRepliesPreference()&&(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][l.APIConstants.KEY_ONE_ON_ONE_REPLIES]=r.getRepliesPreference())),null!=i&&(n[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=i),0===Object.keys(n[l.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete n[l.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete n[l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],C.makeApiCall(l.APIConstants.KEY_UPDATE_PREFERENCES,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return a(r)}return a(new d.NotificationPreferences)},function(e){return E(new p.CometChatException(e.error))})},function(e){return E(new p.CometChatException(e))})}catch(e){return E(new p.CometChatException(e))}})},E.resetPushPreferences=function(){return new Promise(function(i,t){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=h.PushPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new h.PushPreferences)},function(e){return t(new p.CometChatException(e.error))})},function(e){return t(new p.CometChatException(e))})}catch(e){return t(new p.CometChatException(e))}})},E.resetPreferences=function(){return new Promise(function(i,t){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var t=void 0,n=void 0,o=void 0,s=void 0;t=e.data.hasOwnProperty(l.APIConstants.KEY_GROUP_PREFERENCES)?_.GroupPreferences.fromJSON(e.data):new _.GroupPreferences,n=e.data.hasOwnProperty(l.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?A.OneOnOnePreferences.fromJSON(e.data):new A.OneOnOnePreferences,o=e.data.hasOwnProperty(l.APIConstants.KEY_MUTE_PREFERENCES)?T.MutePreferences.fromJSON(e.data):new T.MutePreferences,s=!!e.data.hasOwnProperty(l.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[l.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var r=d.NotificationPreferences.fromJSON({groupPreferences:t,oneOnOnePreferences:n,mutePreferences:o,usePrivacyTemplate:s});return i(r)}return i(new d.NotificationPreferences)},function(e){return t(new p.CometChatException(e.error))})},function(e){return t(new p.CometChatException(e))})}catch(e){return t(new p.CometChatException(e))}})},E.getTokensForRequest=function(e,t,n,o){var s={};return s[l.APIConstants.KEY_PROVIDER_ID]=null!=o?o:l.DEFAULT_PROVIDER_ID,s[l.APIConstants.KEY_TIMEZONE]=e,n===l.PushPlatforms.FCM_WEB&&(s[l.APIConstants.KEY_FCM_TOKEN]=t),s[l.APIConstants.KEY_PLATFORM]=n,s},E.registerPushToken=function(r,i,a){return new Promise(function(o,s){try{S.getAppSettings().then(function(e){var t=Intl.DateTimeFormat().resolvedOptions().timeZone,n=E.getTokensForRequest(t,r,i,a);C.makeApiCall(l.APIConstants.KEY_REGISTER_TOKEN,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.TOKEN_REGISTER_SUCCESS):o(l.APIResponseConstants.TOKEN_REGISTER_ERROR)},function(e){return s(new p.CometChatException(e.error))})},function(e){return s(new p.CometChatException(e))})}catch(e){return s(new p.CometChatException(e))}})},E.unregisterPushToken=function(){return new Promise(function(t,n){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_UNREGISTER_TOKEN,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(l.APIResponseConstants.TOKEN_UNREGISTER_SUCCESS):t(l.APIResponseConstants.TOKEN_UNREGISTER_ERROR)},function(e){return n(new p.CometChatException(e.error))})},function(e){return n(new p.CometChatException(e))})}catch(e){return n(new p.CometChatException(e))}})},E.muteConversations=function(r){return new Promise(function(o,s){try{S.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_CONVERSATIONS]=r,t);C.makeApiCall(l.APIConstants.KEY_MUTE_CONVERSATIONS,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.MUTE_CONVERSATION_SUCCESS):o(l.APIResponseConstants.MUTE_CONVERSATION_ERROR)},function(e){return s(new p.CometChatException(e.error))})},function(e){return s(new p.CometChatException(e))})}catch(e){return s(new p.CometChatException(e))}})},E.unmuteConversations=function(r){return new Promise(function(o,s){try{S.getAppSettings().then(function(e){var t,n=((t={})[l.APIConstants.KEY_CONVERSATIONS]=r,t);C.makeApiCall(l.APIConstants.KEY_UNMUTE_CONVERSATIONS,null,n,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?o(l.APIResponseConstants.UNMUTE_CONVERSATION_SUCCESS):o(l.APIResponseConstants.UNMUTE_CONVERSATION_ERROR)},function(e){return s(new p.CometChatException(e.error))})},function(e){return s(new p.CometChatException(e))})}catch(e){return s(new p.CometChatException(e))}})},E.getMutedConversations=function(){return new Promise(function(t,n){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_GET_MUTED_CONVERSATIONS,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){var n=[];return e.hasOwnProperty("data")&&e.data.hasOwnProperty(l.APIConstants.KEY_MUTED_CONVERSATIONS)&&e.data[l.APIConstants.KEY_MUTED_CONVERSATIONS].forEach(function(e){var t=new s.MutedConversation;t.setId(e.id),t.setType(e.type),t.setUntil(e.until),n.push(t)}),t(n)},function(e){return n(new p.CometChatException(e.error))})},function(e){return n(new p.CometChatException(e))})}catch(e){return n(new p.CometChatException(e))}})},E.updateTimezone=function(o){return new Promise(function(t,n){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_UPDATE_TIMEZONE,null,{timezone:o},!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(l.APIResponseConstants.TIMEZONE_UPDATE_SUCCESS):t(l.APIResponseConstants.TIMEZONE_UPDATE_ERROR)},function(e){return n(new p.CometChatException(e.error))})},function(e){return n(new p.CometChatException(e))})}catch(e){return n(new p.CometChatException(e))}})},E.getTimezone=function(){return new Promise(function(t,n){try{S.getAppSettings().then(function(e){C.makeApiCall(l.APIConstants.KEY_GET_TIMEZONE,null,null,!1,{chatApiVersion:e[u.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(e.data):t(l.APIResponseConstants.TIMEZONE_FETCH_ERROR)},function(e){return n(new p.CometChatException(e.error))})},function(e){return n(new p.CometChatException(e))})}catch(e){return n(new p.CometChatException(e))}})},E.MessagesOptions=l.MessagesOptions,E.RepliesOptions=l.RepliesOptions,E.ReactionsOptions=l.ReactionsOptions,E.MemberActionsOptions=l.MemberActionsOptions,E.DayOfWeek=l.DayOfWeek,E.DNDOptions=l.DNDOptions,E.MutedConversationType=l.MutedConversationType,E.PushPlatforms=l.PushPlatforms,E.DaySchedule=o.DaySchedule,E.PushPreferences=h.PushPreferences,E.GroupPreferences=_.GroupPreferences,E.OneOnOnePreferences=A.OneOnOnePreferences,E.MutePreferences=T.MutePreferences,E.MutedConversation=s.MutedConversation,E.UnmutedConversation=r.UnmutedConversation,E.NotificationPreferences=d.NotificationPreferences,E}();t.CometChatNotifications=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getMessagesPreference=function(){return this.groupMessages},n.prototype.getRepliesPreference=function(){return this.groupReplies},n.prototype.getReactionsPreference=function(){return this.groupReactions},n.prototype.getMemberLeftPreference=function(){return this.groupMemberLeft},n.prototype.getMemberAddedPreference=function(){return this.groupMemberAdded},n.prototype.getMemberJoinedPreference=function(){return this.groupMemberJoined},n.prototype.getMemberKickedPreference=function(){return this.groupMemberKicked},n.prototype.getMemberBannedPreference=function(){return this.groupMemberBanned},n.prototype.getMemberUnbannedPreference=function(){return this.groupMemberUnbanned},n.prototype.getMemberScopeChangedPreference=function(){return this.groupMemberScopeChanged},n.prototype.setMessagesPreference=function(e){this.groupMessages=e},n.prototype.setRepliesPreference=function(e){this.groupReplies=e},n.prototype.setReactionsPreference=function(e){this.groupReactions=e},n.prototype.setMemberLeftPreference=function(e){this.groupMemberLeft=e},n.prototype.setMemberAddedPreference=function(e){this.groupMemberAdded=e},n.prototype.setMemberJoinedPreference=function(e){this.groupMemberJoined=e},n.prototype.setMemberKickedPreference=function(e){this.groupMemberKicked=e},n.prototype.setMemberBannedPreference=function(e){this.groupMemberBanned=e},n.prototype.setMemberUnbannedPreference=function(e){this.groupMemberUnbanned=e},n.prototype.setMemberScopeChangedPreference=function(e){this.groupMemberScopeChanged=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(o.MessagesOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MESSAGES]]),t.setRepliesPreference(o.RepliesOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REPLIES]]),t.setReactionsPreference(o.ReactionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REACTIONS]]),t.setMemberAddedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_ADDED]]),t.setMemberJoinedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_JOINED]]),t.setMemberBannedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_BANNED]]),t.setMemberKickedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_KICKED]]),t.setMemberLeftPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_LEFT]]),t.setMemberScopeChangedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]]),t.setMemberUnbannedPreference(o.MemberActionsOptions[e[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_UNBANNED]]),t},n}();t.GroupPreferences=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutedConversation=void 0;var o=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getUntil=function(){return this.until},e.prototype.setUntil=function(e){this.until=e},e}();t.MutedConversation=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutePreferences=void 0;var S=n(13),p=n(47),o=function(){function u(){}return u.prototype.getDNDPreference=function(){return this.dnd},u.prototype.setDNDPreference=function(e){this.dnd=e},u.prototype.getSchedulePreference=function(){return this.schedule},u.prototype.setSchedulePreference=function(e){this.schedule=e},u.prototype.getScheduleFor=function(e){return this.schedule.get(e)},u.prototype.setScheduleFor=function(e,t){this.schedule.set(e,t)},u.fromJSON=function(e){var t=new u;t.setDNDPreference(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_DND]);var n=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.MONDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.MONDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.MONDAY][S.APIConstants.KEY_MUTE_DND]),o=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.TUESDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.TUESDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.TUESDAY][S.APIConstants.KEY_MUTE_DND]),s=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.WEDNESDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.WEDNESDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.WEDNESDAY][S.APIConstants.KEY_MUTE_DND]),r=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.THURSDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.THURSDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.THURSDAY][S.APIConstants.KEY_MUTE_DND]),i=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.FRIDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.FRIDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.FRIDAY][S.APIConstants.KEY_MUTE_DND]),a=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SATURDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SATURDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SATURDAY][S.APIConstants.KEY_MUTE_DND]),E=new p.DaySchedule(e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SUNDAY][S.APIConstants.KEY_FROM],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SUNDAY][S.APIConstants.KEY_TO],e[S.APIConstants.KEY_MUTE_PREFERENCES][S.APIConstants.KEY_MUTE_SCHEDULE][S.DayOfWeek.SUNDAY][S.APIConstants.KEY_MUTE_DND]),c=new Map([[S.DayOfWeek.MONDAY,n],[S.DayOfWeek.TUESDAY,o],[S.DayOfWeek.WEDNESDAY,s],[S.DayOfWeek.THURSDAY,r],[S.DayOfWeek.FRIDAY,i],[S.DayOfWeek.SATURDAY,a],[S.DayOfWeek.SUNDAY,E]]);return t.setSchedulePreference(c),t},u}();t.MutePreferences=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[o.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[o.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.NotificationPreferences=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneOnOnePreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getReactionsPreference=function(){return this.oneOnOneMessageReactions},n.prototype.setReactionsPreference=function(e){this.oneOnOneMessageReactions=e},n.prototype.getRepliesPreference=function(){return this.oneOnOneReplies},n.prototype.setRepliesPreference=function(e){this.oneOnOneReplies=e},n.prototype.getMessagesPreference=function(){return this.oneOnOneMessages},n.prototype.setMessagesPreference=function(e){this.oneOnOneMessages=e},n.fromJSON=function(e){var t=new n;return t.setMessagesPreference(o.MessagesOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_MESSAGES]]),t.setRepliesPreference(o.RepliesOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REPLIES]]),t.setReactionsPreference(o.ReactionsOptions[e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REACTIONS]]),t},n}();t.OneOnOnePreferences=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PushPreferences=void 0;var o=n(13),s=function(){function n(){}return n.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},n.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},n.prototype.getMutePreferences=function(){return this.mutePreferences},n.prototype.setMutePreferences=function(e){this.mutePreferences=e},n.prototype.getGroupPreferences=function(){return this.groupPreferences},n.prototype.setGroupPreferences=function(e){this.groupPreferences=e},n.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},n.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},n.fromJSON=function(e){var t=new n;return e.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&t.setMutePreferences(e[o.APIConstants.KEY_MUTE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&t.setGroupPreferences(e[o.APIConstants.KEY_GROUP_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&t.setOneOnOnePreferences(e[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),e.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.setUsePrivacyTemplate(e[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),t},n}();t.PushPreferences=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnmutedConversation=void 0;var o=function(){function e(){}return e.prototype.getId=function(){return this.id},e.prototype.setId=function(e){this.id=e},e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e}();t.UnmutedConversation=o}])});