1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1127],{91097:e=>{window,e.exports=function(){var e=[function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AI_ASSISTANT_EVENTS=t.ModerationStatus=t.AttachmentType=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.PresenceConstants=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.StorageMode=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,c,u,S=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",(r=t.StorageMode||(t.StorageMode={})).LOCAL="local",r.SESSION="session",t.GROUP_MEMBER_SCOPE={ADMIN:"admin",MODERATOR:"moderator",PARTICIPANT:"participant"},t.APPINFO={platform:"WEB",sdkVersion:"v4.1.5",apiVersion:"v3.0",sdkVersionWithUnderScore:"4_1_5"},t.SDKHeader={platform:"javascript",sdkVersion:"4.1.5",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",ASSISTANT:"assistant",TOOL_RESULT:"tool-result",TOOL_ARGUMENTS:"tool-arguments"},CATEGORY:{MESSAGE:"message",ACTION:"action",CALL:"call",CUSTOM:"custom",INTERACTIVE:"interactive",AGENTIC:"agentic"},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",RUN_ID:"runId",THREAD_ID:"threadId",TOOL_CALLS:"toolCalls",FUNCTION:"function",NAME:"name",ARGUMENTS:"arguments",TOOL_CALL_ID:"toolCallId",DISPLAY_NAME:"displayName",EXECUTION_TEXT:"executionText"},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",HAS_ATTACHMENTS:"hasAttachments",HAS_LINKS:"hasLinks",HAS_MENTIONS:"hasMentions",HAS_REACTIONS:"hasReactions",MENTIONED_UIDS:"mentionedUids",ATTACHMENT_TYPES:"attachmentTypes",WITH_PARENT:"withParent",HIDE_QUOTED_MESSAGES:"hideQuotedMessages"}}},t.ATTACHMENTS_CONSTANTS={KEYS:{EXTENSION:"extension",MIME_TYPE:"mimeType",NAME:"name",
1SIZE:"size",URL:"url"}},(i=t.MessageCategory||(t.MessageCategory={})).ACTION="action",i.MESSAGE="message",i.CALL="call",i.CUSTOM="custom",i.INTERACTIVE="interactive",i.AGENTIC="agentic",(a=t.GoalType||(t.GoalType={})).ANY_ACTION="anyAction",a.ANY_OF="anyOf",a.ALL_OF="allOf",a.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:"openVirtualBackgroun
1dMenu",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:{}}
1,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 S.CometChatException({code:"INVALID_STATUS_VALUE",name:"INVALID_STATUS_VALUE",message:"The `status` parameter accepts only `online` or `offline`.",details:""}),INVALID_DIRECTION:new S.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 S.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 S.CometChatException({code:"NOT_A_GROUP",message:"Please use group class to construct a new group."}),INVALID_SCOPE:new S.CometChatException({code:"INVALID_SCOPE_VALUE",name:"INVALID_SCOPE_VALUE",message:"Scope can be `admin`, `moderator` or `participant`.",details:""}),INVALID_GROUP_TYPE:new S.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.PresenceConstants={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",FLAG_REASONS:"flagReasons"}},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"},(E=t.REACTION_ACTION||(t.REACTION_ACTION={})).REACTION_ADDED="message_reaction_added",E.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"}
1,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",(c=t.AttachmentType||(t.AttachmentType={})).IMAGE="image",c.VIDEO="video",c.AUDIO="audio",c.FILE="file",(u=t.ModerationStatus||(t.ModerationStatus={})).PENDING="pending",u.APPROVED="approved",u.DISAPPROVED="disapproved",u.UNMODERATED="unmoderated",t.AI_ASSISTANT_EVENTS={RUN_STARTED:"run_started",RUN_FINISHED:"run_finished",TEXT_MESSAGE_START:"text_message_start",TEXT_MESSAGE_END:"text_message_end",TEXT_MESSAGE_CONTENT:"text_message_content",TOOL_CALL_STARTED:"tool_call_start",TOOL_CALL_ENDED:"tool_call_end",TOOL_CALL_RESULT:"tool_call_result",TOOL_CALL_ARGUMENT:"tool_call_args"}},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(17),s=n(0),r=n(6),i=n(2),a=n(20),E=n(22),c=n(24),u=n(5),S=n(12),p=n(25);function l(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 C(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return e.split("%s").reduce(function(e,n,o){return e+n+(t[o]||"")},"")}function d(){return new Promise(function(e,t){r.makeApiCall("appSettings").then(function(t){o.LocalStorage.getInstance().set(s.LOCAL_STORE.KEY_APP_SETTINGS,t.data),t.data.MODE&&u.CometChat.setMode(t.data.MODE),e(t.data)},function(e){t(new i.CometChatException(e.error))})})}t.getChatHost=function(e){return e[s.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]?e[s.APP_SETTINGS.KEYS.CHAT_HOST_OVERRIDE]:e[s.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]?e[s.APP_SETTINGS.KEYS.CHAT_HOST_APP_SPECIFIC]:e[s.APP_SETTINGS.KEYS.CHAT_HOST]},t.getJidHost=function(e){return e[s.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]?e[s.APP_SETTINGS.KEYS.JID_HOST_OVERRIDE]:e[s.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=l,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=C,t.createUidFromJid=function(e){return e.substring(e.lastIndexOf("]")+1,e.lastIndexOf("@"))},t.Logger=function(){function e(){}return e.log=function(e,t){},e.error=function(e,t){},e.info=function(e,t){},e}(),t.getCurrentTime=function(){return(new Date).getTime()},t.getAppSettings=function(){return new Promise(function(e,t){o.LocalStorage.getInstance().get(s.LOCAL_STORE.KEY_APP_SETTINGS).then(function(n){l(n)?d().then(function(t){e(t)},function(e){t(e)}):e(n)},function(e){t(e)})})},t.getUpdatedSettings=d,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!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"SCOPE","SCOPE","Scope"))):l(e)?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"SCOPE","SCOPE","scope","scope"))):e!=u.CometChat.GROUP_MEMBER_SCOPE.ADMIN&&e!=u.CometChat.GROUP_MEMBER_SCOPE.MODERATOR&&e!=u.CometChat.GROUP_MEMBER_SCOPE.PARTICIPANT?new i.CometChatException(s.GroupErrors.INVALID_SCOPE):void 0},t.validateUpdateGroup=function(e){return e.hasOwnProperty(s.GroupConstants.KEYS.GUID)?typeof e[s.GroupConstants.KEYS.GUID]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ER
1ROR.MUST_BE_A_STRING),"GUID","GUID","GUID"))):l(e[s.GroupConstants.KEYS.GUID])?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID"))):e.hasOwnProperty(s.GroupConstants.KEYS.NAME)&&""===e[s.GroupConstants.KEYS.NAME]?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"GROUP_NAME","GROUP_NAME","Group name"))):void 0:new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")))},t.validateJoinGroup=function(e,t,n){if(typeof e==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT){if(!e.hasOwnProperty(s.GroupConstants.KEYS.GUID))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[s.GroupConstants.KEYS.GUID]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(e[s.GroupConstants.KEYS.GUID]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(s.GroupConstants.KEYS.TYPE))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[s.GroupConstants.KEYS.TYPE]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(e[s.GroupConstants.KEYS.TYPE]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PUBLIC&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PASSWORD&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PROTECTED&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PRIVATE)return new i.CometChatException(s.GroupErrors.INVALID_GROUP_TYPE);if(e[s.GroupConstants.KEYS.TYPE].toLowerCase()==u.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(s.GroupConstants.KEYS.PASSWORD))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[s.GroupConstants.KEYS.PASSWORD]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(e[s.GroupConstants.KEYS.PASSWORD]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}else{if(void 0!==e){if(typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(e))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")))}if(void 0!==t){if(typeof t!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(t))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(t.toLowerCase()!=u.CometChat.GROUP_TYPE.PUBLIC&&t.toLowerCase()!=u.CometChat.GROUP_TYPE.PASSWORD&&t.toLowerCase()!=u.CometChat.GROUP_TYPE.PROTECTED&&t.toLowerCase()!=u.CometChat.GROUP_TYPE.PRIVATE)return new i.CometChatException(s.GroupErrors.INVALID_GROUP_TYPE);if(t.toLowerCase()==u.CometChat.GROUP_TYPE.PASSWORD){if(typeof n!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(n))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ER
1ROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}}}},t.validateCreateGroup=function(e){if(!e.hasOwnProperty(s.GroupConstants.KEYS.GUID))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GUID","GUID","GUID","GUID")));if(typeof e[s.GroupConstants.KEYS.GUID]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(e[s.GroupConstants.KEYS.GUID]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GUID","GUID","GUID","GUID")));if(!e.hasOwnProperty(s.GroupConstants.KEYS.NAME))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_NAME","GROUP_NAME","Group name","Group name")));if(typeof e[s.GroupConstants.KEYS.NAME]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_NAME","GROUP_NAME","Group name")));if(l(e[s.GroupConstants.KEYS.NAME]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_NAME","GROUP_NAME","name","name")));if(!e.hasOwnProperty(s.GroupConstants.KEYS.TYPE))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"GROUP_TYPE","GROUP_TYPE","Group type","Group type")));if(typeof e[s.GroupConstants.KEYS.TYPE]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GROUP_TYPE","GROUP_TYPE","Group type")));if(l(e[s.GroupConstants.KEYS.TYPE]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"GROUP_TYPE","GROUP_TYPE","type","type")));if(e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PUBLIC&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PASSWORD&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PROTECTED&&e[s.GroupConstants.KEYS.TYPE].toLowerCase()!=u.CometChat.GROUP_TYPE.PRIVATE)return new i.CometChatException(s.GroupErrors.INVALID_GROUP_TYPE);if(e[s.GroupConstants.KEYS.TYPE].toLowerCase()==u.CometChat.GROUP_TYPE.PASSWORD){if(!e.hasOwnProperty(s.GroupConstants.KEYS.PASSWORD))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PASSWORD_COMPULSORY),"PASSWORD","PASSWORD")));if(typeof e[s.GroupConstants.KEYS.PASSWORD]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"PASSWORD","PASSWORD","Password")));if(l(e[s.GroupConstants.KEYS.PASSWORD]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_GROUP_PROPERTY),"PASSWORD","PASSWORD","password","password")))}if(e.hasOwnProperty(s.GroupConstants.KEYS.TAGS)){if(!Array.isArray(e[s.GroupConstants.KEYS.TAGS]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_AN_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")));if(0===e[s.GroupConstants.KEYS.TAGS].length)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_ARRAY),"GROUP_TAGS","GROUP_TAGS","Group tags")))}},t.validateId=function(e,t){if("user"===t){if(typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(e))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"UID","UID","UID","UID")))}if("group"===t){if(typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"GUID","GUID","GUID")));if(l(e))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}if("bot"===t){if(typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ER
1ROR.MUST_BE_A_STRING),"BOT_ID","BOT_ID","BOT_ID")));if(l(e))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"BOT_ID","BOT_ID","BOT_ID","BOT_ID")))}},t.validateHideMessagesFromBlockedUsers=function(e){if(typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.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!=s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.OBJECT?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n))):Array.isArray(e)?void 0:new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_ARRAY),"USER_LIST","USER_LIST",n)))},t.validateMsgId=function(e){return isNaN(e)?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","Message Id"))):l(e)?new i.CometChatException(S.ERRORS.PARAMETER_MISSING):void 0},t.validateChatType=function(e){return typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type"))):l(e)?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type"))):e!=s.MessageConstatnts.RECEIVER_TYPE.GROUP&&e!=s.MessageConstatnts.RECEIVER_TYPE.USER?new i.CometChatException(s.MessageErrors.INVALID_RECEIVER_TYPE):void 0},t.validateMessage=function(e){if(typeof e.getReceiverId()!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_ID","RECEIVER_ID","Receiver Id")));if(l(e.getReceiverId()))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"RECEIVER_ID","RECEIVER_ID","receiver id","receiver id")));if(typeof e.getReceiverType()!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver Type")));if(l(e.getReceiverType()))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"RECEIVER_TYPE","RECEIVER_TYPE","receiver type","receiver type")));if(e.getReceiverType()!=s.MessageConstatnts.RECEIVER_TYPE.GROUP&&e.getReceiverType()!=s.MessageConstatnts.RECEIVER_TYPE.USER)return new i.CometChatException(s.MessageErrors.INVALID_RECEIVER_TYPE);if(e instanceof a.TextMessage){if(typeof e.getText()!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")));if(""===e.getText().trim())return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"MESSAGE_TEXT","MESSAGE_TEXT","Message text")))}if(e instanceof E.MediaMessage){if(e.getData()&&e.getData().hasOwnProperty("attachments"))for(var t=e.getAttachments(),n=0;n<t.length;n++){if(!t[n].getExtension())return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MISSING_KEY),"extension","Attachment")));if(!t[n].getMimeType())return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MISSING_KEY),"mimeType","Attachment")));if(!t[n].getName())return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MISSING_KEY),"name","Attachment")));if(!t[n].getUrl())return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MISSING_KEY),"url","Attachment")))}if(e.hasOwnProperty("files")){for(n=0;n<e.files.length;n++)if(!(e.files[n]instanceof Blob))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ER
1ROR.MUST_BE_A_BLOB),"MEDIA_OBJECT","MEDIA_OBJECT","Media object")))}}return e instanceof c.CustomMessage&&l(e.getCustomData())?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"CUSTOM_DATA","CUSTOM_DATA","custom data","custom data"))):e instanceof p.InteractiveMessage&&l(e.getInteractiveData())?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"INTERACTIVE_DATA","INTERACTIVE_DATA","interactive data","interactive data"))):void 0},t.validateCreateUser=function(e){if(!e.hasOwnProperty(s.UserConstants.UID))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")));if(typeof e[s.UserConstants.UID]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID")));if(l(e[s.UserConstants.UID]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID")));if(!e.hasOwnProperty(s.UserConstants.NAME))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"USER_NAME","USER_NAME","User name","User name")));if(typeof e[s.UserConstants.NAME]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"USER_NAME","USER_NAME","User name")));if(l(e[s.UserConstants.NAME]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_USER_PROPERTY),"USER_NAME","USER_NAME","name","name")));if(e.hasOwnProperty(s.UserConstants.AVATAR)&&""===e[s.UserConstants.AVATAR])return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_AVATAR","USER_AVATAR","User avatar")));if(e.hasOwnProperty(s.UserConstants.META_DATA)&&""===e[s.UserConstants.META_DATA])return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_METADATA","USER_METADATA","User metadata")));if(e.hasOwnProperty(s.UserConstants.LINK)&&""===e[s.UserConstants.LINK])return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_LINK","USER_LINK","User link")));if(e.hasOwnProperty(s.UserConstants.STATUS_MESSAGE)&&""===e[s.UserConstants.STATUS_MESSAGE])return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_STATUS_MESSAGE","USER_STATUS_MESSAGE","User status message")));if(e.hasOwnProperty(s.UserConstants.ROLE)&&""===e[s.UserConstants.ROLE])return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_ROLE","USER_ROLE","User role")));if(e.hasOwnProperty(s.UserConstants.TAGS)){if(!Array.isArray(e[s.UserConstants.TAGS]))return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_AN_ARRAY),"USER_TAGS","USER_TAGS","User tags")));if(0===e[s.UserConstants.TAGS].length)return new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_ARRAY),"USER_TAGS","USER_TAGS","User tags")))}},t.validateUpdateUser=function(e){return e.hasOwnProperty(s.UserConstants.UID)?typeof e[s.UserConstants.UID]!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"UID","UID","UID"))):l(e[s.UserConstants.UID])?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID_USER_PROPERTY),"UID","UID","UID","UID"))):e.hasOwnProperty(s.UserConstants.NAME)&&""===e[s.UserConstants.NAME]?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.EMPTY_STRING),"USER_NAME","USER_NAME","User name"))):void 0:new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.PARAMETER_COMPULSORY),"UID","UID","UID","UID")))},t.validateConversationType=function(e){return typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"CONVERSATION_TYPE","CONVERSATION_TYPE","Conversation type"))):l(e)?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ER
1ROR.INVALID),"CONVERSATION_TYPE","CONVERSATION_TYPE","conversation type","conversation type"))):(e=e.toLowerCase())!=u.CometChat.RECEIVER_TYPE.USER&&e!=u.CometChat.RECEIVER_TYPE.GROUP?new i.CometChatException(s.ConversationErrors.INVALID_CONVERSATION_TYPE):void 0},t.updatePropertiesWithDynamicValue=function(e,t,n){return function e(o){for(var r in o)o.hasOwnProperty(r)&&("object"==typeof o[r]?e(o[r]):"string"==typeof o[r]&&o[r].includes(t)&&!o[r].includes(s.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY)&&(o[r]+=n))}(e),e},t.validateQuestion=function(e){return typeof e!==s.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.MUST_BE_A_STRING),"QUESTION","QUESTION","Question"))):l(e)?new i.CometChatException(JSON.parse(C(JSON.stringify(s.GENERAL_ERROR.INVALID),"QUESTION","QUESTION","question","question"))):void 0}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatException=void 0,t.CometChatException=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)}},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(12),a=n(0),E=function(e){function t(t){var n=e.call(this,t)||this;return n.wsChannel=t.wsChannel,t.jwt&&(n.jwt=t.jwt),t.fat&&(n.fat=t.fat),n}return s(t,e),t.prototype.getWsChannel=function(){return this.wsChannel},t.prototype.getJWT=function(){return this.jwt},t.prototype.getFat=function(){return this.fat},t}(t.User=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}());t.Me=E},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.STREAM_MESSAGE=t.MODERATION_STATUS_CHANGED=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",ROLES:"roles"},t.MODERATION_STATUS_CHANGED={TYPE:"on_moderation_status_changed"},t.STREAM_MESSAGE={TYPE:"streamed_message"}},function(e,t,n){"use strict";var o=this&&this.__assign||function(){return(o=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)},s=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.CometChat=void 0;var i=n(38),a=n(1),E=n(2),c=n(6),u=n(3),S=n(17),p=n(22),l=n(7),C=n(20),d=n(13),_=n(15),T=n(0),h=n(8),g=n(19),A=n(29),f=n(30),I=n(28),R=n(45),O=n(12),N=n(27),y=n(57),m=n(58),P=n(59),M=n(60),v=n(62),L=n(63),D=n(32),U=n(33),Y=n(50),G=n(24),w=n(48),K=n(65),b=n(34),B=n(66),F=n(49),V=n(31),x=n(23),k=n(67),J=n(68),H=n(69),W=n(51),j=n(4),z=n(91),X=n(40),q=n(46),Q=n(36),Z=n(25),$=n(41),ee=n(26),et=n(52),en=n(92),eo=n(93),es=n(21),er=n(53),ei=n(35),ea=n(94),eE=n(18),ec=n(54),eu=n(42),eS=n(43),ep=n(44),el=n(11),eC=n(39),ed=n(14),e_=n(95),eT=H.WSConnectionHelper.getInstance(),eh=W.ListenerHandlers.getInstance();t.CometChat=function(){function e(t){try{e.appId=t,e.localStorage=S.LocalStorage.getInstance(),e.keyStore=A.KeyStore.getInstance()}catch(e){a.Logger.error("CometChat: constructor",e)}}return e.setAuthToken=function(t){try{e.authToken=t}catch(e){a.Logger.error("CometChat: setAuthToken",e)}},e.prototype.getAuthToken=function(){try{return e.authToken}catch(e){a.Logger.error("CometChat: getAuthToken",e)}},e.getAppId=function(){try{return e.appId}catch(e){a.Logger.error("CometChat: getAppId",e)}},e.prototype.getApiKey=function(){try{return e.apiKey}catch(e){a.Logger.error("CometChat: getApiKey",e)}},e.getMode=function(){try{return e.mode}catch(e){a.Logger.error("CometChat: getMode",e)}},e.setMode=function(t){try{e.mode=t}catch(e){a.Logger.error("CometChat: getMode",e)}},e.getSessionId=function(){try{return e.sessionId}catch(e){a.Logger.error("CometChat: getSessionId",e)}},e.initializeStorage=function(){var t;return s(this,void 0,void 0,function(){var n,o;return r(this,function(s){switch(s.label){case 0:if(e.keyStore)return[2];s.label=1;case 1:return s.trys.push([1,3,,5]),n=(null==(t=e.appSettings)?void 0:t.getStorageMode())||T.StorageMode.LOCAL,[4,(o=ed.StorageManager.getInstance()).initialize(n)];case 2:return s.sent(),e.keyStore=o.getStorage(e.getAppId(),T.LOCAL_STORE.KEYS_STORE),[3,5];case 3:return s.sent(),[4,(e.keyStore=el.createInstance({name:a.format(T.LOCAL_STORE.STORE_STRING,e.getAppId(),T.LOCAL_STORE.KEYS_STORE)})).setDriver([el.LOCALSTORAGE,el.INDEXEDDB,el.WEBSQL])];case 4:return s.sent(),[3,5];case 5:return[2]}})})},e.onStorageEvent=function(t){if(document&&!document.hasFocus()){var n=e.appId+":common_store/user";t.key===n&&null===t.newValue&&(e.authToken=void 0,e.didAnalyticsPingStart()&&e.clearAnalyticsPingTimer(),eT.WSLogout(),e.pushToLoginListener("","Logout_Success")),t.key===n&&null===t.oldValue&&S.LocalStorage.getInstance().get("user").then(function(t){t&&(e.user=new u.Me(t),e.setAuthToken(e.user.getAuthToken()),t.jwt&&(e.jwt=t.jwt),S.LocalStorage.getInstance().get("app_settings").then(function(t){if(t){if(t.hasOwnProperty(T.APP_SETTINGS.KEYS.APP_VERSION)){var n=parseInt(T.APPINFO.sdkVersion.charAt(1));t[T.APP_SETTINGS.KEYS.APP_VERSION]<n&&(e.appSettings.shouldAutoEstablishSocketConnection()||(e.shouldConnectToWS=!1),e.getInstance().internalRestart(e.user.getAuthToken()))}
1else e.appSettings.shouldAutoEstablishSocketConnection()||(e.shouldConnectToWS=!1),e.getInstance().internalRestart(e.user.getAuthToken());if(t[T.APP_SETTINGS.KEYS.MODE]&&(e.mode=t[T.APP_SETTINGS.KEYS.MODE]),t[T.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(e.settingsHash=t[T.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(e.settingsHashReceivedAt=t[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),e.isAnalyticsDisabled=!!t[T.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!e.appSettings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),e.getConnectionStatus()!==T.CONNECTION_STATUS.CONNECTED){var o=new u.User(e.user);e.pushToLoginListener(o,"Login_Success"),e.appSettings.shouldAutoEstablishSocketConnection()&&e.WSLogin(e.user)}}}))})}},e.beforeUnload=function(t){var n=e.getDataFromSessionStorage(T.SESSION_STORE.SESSION_ID);e.removeDataFromSessionStorage(T.SESSION_STORE.SESSION_ID),S.LocalStorage.getInstance().set(T.SESSION_STORE.SESSION_ID,n)},e.didAnalyticsPingStart=function(){try{return e.isAnalyticsPingStarted}catch(e){a.Logger.error("CometChat: didAnalyticsPingStart",e)}},e.getDataFromSessionStorage=function(e){if(window.sessionStorage)return window.sessionStorage.getItem(e)},e.addDataToSessionStorage=function(e,t){window.sessionStorage&&window.sessionStorage.setItem(e,t)},e.removeDataFromSessionStorage=function(e){window.sessionStorage&&window.sessionStorage.removeItem(e)},e.init=function(t,n){var o=this;return void 0===t&&(t=""),new Promise(function(i,c){return s(o,void 0,void 0,function(){var o,s,p=this;return r(this,function(r){switch(r.label){case 0:if(r.trys.push([0,8,,9]),"object"==typeof t&&(t.hasOwnProperty("appId")&&(t=t.appId),t.hasOwnProperty("appSettings")&&(n=t.appSettings)),a.isFalsy(n)?n=(new b.AppSettingsBuilder).setRegion(b.AppSettings.REGION_EU).build():n.getRegion()==b.AppSettings.REGION_PRIVATE&&(n.region=t),(this.appSettings=n).getStorageMode()!==T.StorageMode.SESSION)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,eC.registerSessionStorageDriver()];case 2:return r.sent(),[3,4];case 3:return o=r.sent(),c(new E.CometChatException(o)),[3,4];case 4:return a.isFalsy(t)?(c(new E.CometChatException(O.INIT_ERROR.NO_APP_ID)),[3,7]):[3,5];case 5:return window.addEventListener&&(window.addEventListener("storage",e.onStorageEvent,!1),window.addEventListener("beforeunload",e.beforeUnload,!1)),this.initialzed=!0,e.appId=t,e.getInstance(t),[4,e.initializeStorage()];case 6:r.sent(),S.LocalStorage.getInstance().get(T.SESSION_STORE.SESSION_ID).then(function(n){null==n||null==n?(e.sessionId=T.APPINFO.platform+"-"+T.APPINFO.sdkVersionWithUnderScore+"-"+e_()+"-"+(new Date).getTime(),e.addDataToSessionStorage(T.SESSION_STORE.SESSION_ID,e.getSessionId()),S.LocalStorage.getInstance().remove(T.SESSION_STORE.SESSION_ID)):(e.sessionId=n.toLocaleString(),S.LocalStorage.getInstance().remove(T.SESSION_STORE.SESSION_ID),e.addDataToSessionStorage(T.SESSION_STORE.SESSION_ID,e.getSessionId())),S.LocalStorage.getInstance().get(T.LOCAL_STORE.KEY_APP_ID).then(function(n){if(null==n||null==n)e.appId=t,e.getInstance(t),S.LocalStorage.getInstance().set(T.LOCAL_STORE.KEY_APP_ID,t),i(!0);else{var o=n.toLocaleString();o===t?(e.appId=o,e.getInstance(o),S.LocalStorage.getInstance().get(T.LOCAL_STORE.KEY_USER).then(function(t){t?(e.isLoggedOut=!1,e.user=new u.Me(t),new en.PostDetails,e.setAuthToken(e.user.getAuthToken()),t.jwt&&(e.jwt=t.jwt),i(!0),S.LocalStorage.getInstance().get(T.LOCAL_STORE.KEY_APP_SETTINGS).then(function(t){if(t){if(t.hasOwnProperty(T.APP_SETTINGS.KEYS.APP_VERSION)){var n=parseInt(T.APPINFO.sdkVersion.charAt(1));t[T.APP_SETTINGS.KEYS.APP_VERSION]<n&&3!==t[T.APP_SETTINGS.KEYS.APP_VERSION]&&(p.appSettings.shouldAutoEstablishSocketConnection()||(e.shouldConnectToWS=!1),e.getInstance().internalRestart(e.user.getAuthToken()))}else p.appSettings.shouldAutoEstablishSocketConnection()||(e.shouldConnectToWS=!1),e.getInstance().internalRestart(e.user.getAuthToken());t[T.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(e.SECURED_MEDIA_HOST=t[T.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]),t[T.APP_SETTINGS.KEYS.MODE]&&(e.mode=t[T.APP_SETTINGS.KEYS.MODE]),t[T.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(e.settingsHash=t[T.APP_SETTINGS.KEYS.SETTINGS_HASH]),t[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(e.settingsHashReceivedAt=t[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),e.isAnalyticsDisabled=!!t[T.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!p.appSett
1ings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),eT&&!eT.connection&&p.appSettings.shouldAutoEstablishSocketConnection()&&(e.isConnectingFromInit=!0,e.WSLogin(e.user))}})):i(!0)})):p.clearCache().then(function(){e.apiKey=void 0,e.user=void 0,e.authToken=void 0,e.cometChat=void 0,e.mode=void 0,eT.WSLogout(),e.appId=t,S.LocalStorage.getInstance().set(T.LOCAL_STORE.KEY_APP_ID,t),e.getInstance(t),i(!0)})}A.KeyStore.getInstance().get(T.LOCAL_STORE.KEY_DEVICE_ID).then(function(e){if(null==e){var n=e_(),o=(new Date).getTime(),s=t+"_"+n+"_"+o;A.KeyStore.getInstance().set(T.LOCAL_STORE.KEY_DEVICE_ID,s)}})})}),r.label=7;case 7:return[3,9];case 8:return s=r.sent(),c(new E.CometChatException(s)),[3,9];case 9:return[2]}})})})},e.isInitialized=function(){try{return this.initialzed}catch(e){a.Logger.error("CometChat: isInitialized",e)}},e.getInstance=function(t){try{return this.cometChat||(this.cometChat=new e(t)),this.cometChat}catch(e){a.Logger.error("CometChat: getInstance",e)}},e.registerTokenForPushNotification=function(t,n){var o=this;return new Promise(function(s,r){try{e.keyStore.get(T.LOCAL_STORE.KEY_DEVICE_ID).then(function(i){a.getAppSettings().then(function(a){var u="",S=i,p=T.APPINFO.platform,l=T.APPINFO.sdkVersion,C=a[T.APP_SETTINGS.KEYS.CHAT_API_VERSION];if(navigator&&(u=navigator.userAgent),null==S){var d=e_(),_=(new Date).getTime();S=o.appId+"_"+d+"_"+_,e.keyStore.set(T.LOCAL_STORE.KEY_DEVICE_ID,S)}var h={platform:p,deviceId:S,appInfo:{version:l,apiVersion:C,userAgent:u,pushNotification:{fcmDeviceToken:t,settings:n}}};c.makeApiCall("updateMyDetails",{},h,!1).then(function(e){s("Token Registration successful")},function(e){r(new E.CometChatException(e.error))}).catch(function(e){r(new E.CometChatException(e))})},function(e){r(new E.CometChatException(e))})})}catch(e){r(new E.CometChatException(e))}})},e.pushToLoginListener=function(e,t){eh.loginHandlers.map(function(n){try{if(n._eventListener)switch(t){case"Login_Success":a.isFalsy(n._eventListener.loginSuccess)||n._eventListener.loginSuccess(e);break;case"Login_Failure":a.isFalsy(n._eventListener.loginFailure)||n._eventListener.loginFailure(e);break;case"Logout_Success":a.isFalsy(n._eventListener.logoutSuccess)||n._eventListener.logoutSuccess()}}catch(e){a.Logger.error("ConnectionHandlers: onConnected Status",e)}})},e.login=function(){for(var t=this,n=[],o=0;o<arguments.length;o++)n[o]=arguments[o];return new Promise(function(o,i){return s(t,void 0,void 0,function(){var t,s,c=this;return r(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,e.initializeStorage()];case 1:return r.sent(),e.loginInProgress?(e.isLoggedOut=!0,[2,i(s=new E.CometChatException(O.LOGIN_ERROR.REQUEST_IN_PROGRESS))]):(e.loginInProgress=!0,e.isConnectingFromInit=!1,e.localStorage.get(T.LOCAL_STORE.KEY_APP_ID).then(function(t){if(null==t||null==t){var s=new E.CometChatException(O.LOGIN_ERROR.NOT_INITIALIZED);return e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(s)}var r=t.toLocaleString();if(c.getInstance(r),e.appId=r,S.LocalStorage.getInstance().set(T.LOCAL_STORE.KEY_APP_ID,r),"object"==typeof n[0]){var p=n[0];n[0].hasOwnProperty("authToken")?n[0]=p.authToken:n[0].hasOwnProperty("username")&&n[0].hasOwnProperty("apiKey")&&(n[0]=p.username,n[1]=p.apiKey)}if(2==n.length){if(a.isFalsy(n[0])||a.isFalsy(n[1]))return s=new E.CometChatException(O.ERRORS.PARAMETER_MISSING),e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(s)}else{if(1!=n.length)return s=new E.CometChatException(O.ERRORS.PARAMETER_MISSING),e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(s);if(a.isFalsy(n[0])){var s=new E.CometChatException(O.ERRORS.PARAMETER_MISSING);return e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(s)}}return a.isFalsy(c.getAppId())?(s=new E.CometChatException(O.LOGIN_ERROR.NOT_INITIALIZED),e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(s)):e.localStorage.get(T.LOCAL_STORE.KEY_USER).then(function(t){if(2==n.length){e.apiKey=n[1];var s=n[0];if(null!=t&&t.uid!==n[0])e.localStorage.clearStore().then(function(){eT.WSLogout(),e.generateAuthToken(s).then(function(t){e.user=new u.Me(t),e.setAuthToken(e.user.getAuthToken()),e.getLoggedInUser().then(function(t){(e.user=new u.Me(t)).setAuthToken(e.authToken),e.setAuthToken(e.user.getAuthToken());var n=e.user;n.setStatus(T.PresenceConstatnts.STATUS.ONLINE),e.localStorage.set("user",n);var s=new u.User(n);o(s),e.isConnectingFromInit||e.internalRestart||(e.pushToLoginListener(s,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!e.appSettings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),e.isLoggedOut=!1,(e.appSettings.shouldAutoEstablishSocketConnection()||e.internalRestart)&&e.shouldConnectToWS&&e.WSLogin(e.user)},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})});else{if(!a.isFalsy(e.authToken)){var r=new u.User(c.user);return e.internalRestart||(e.pushToLoginListener(r,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.isLoggedOut=!1,o(r)}
1if(!a.isFalsy(s)){if(a.isFalsy(e.apiKey)){var S=new E.CometChatException(O.LOGIN_ERROR.UNAUTHORISED);return e.internalRestart||e.pushToLoginListener(S,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(S)}c.generateAuthToken(s).then(function(t){c.user=new u.Me(t),c.setAuthToken(e.user.getAuthToken()),c.getLoggedInUser().then(function(t){c.user=new u.Me(t),c.user.setAuthToken(e.authToken),c.setAuthToken(c.user.getAuthToken()),eT.WSLogout();var n=c.user;n.setStatus(T.PresenceConstatnts.STATUS.ONLINE),c.localStorage.set("user",n);var s=new u.User(n);o(s),e.isConnectingFromInit||e.internalRestart||(e.pushToLoginListener(s,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!e.appSettings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),e.isLoggedOut=!1,(e.appSettings.shouldAutoEstablishSocketConnection()||e.internalRestart)&&e.shouldConnectToWS&&c.WSLogin(c.user)},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})}}}else e.authToken=n[0],c.getLoggedInUser().then(function(s){if(s.authToken!=n[0])c.localStorage.clearStore().then(function(){eT.WSLogout(),c.getLoggedInUser().then(function(t){(e.user=new u.Me(t)).setAuthToken(e.authToken),e.setAuthToken(e.user.getAuthToken());var n=e.user;n.setStatus(T.PresenceConstatnts.STATUS.ONLINE),c.localStorage.set("user",n);var s=new u.User(n);o(s),e.isConnectingFromInit||e.internalRestart||(e.pushToLoginListener(s,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!e.appSettings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),e.isLoggedOut=!1,(e.appSettings.shouldAutoEstablishSocketConnection()||e.internalRestart)&&e.shouldConnectToWS&&e.WSLogin(new u.Me(t))},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})});else{if(t){var r=new u.User(s);return e.internalRestart||(e.pushToLoginListener(r,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.isLoggedOut=!1,o(r)}(e.user=new u.Me(s)).setAuthToken(e.authToken),e.setAuthToken(e.user.getAuthToken());var a=e.user;a.setStatus(T.PresenceConstatnts.STATUS.ONLINE),e.localStorage.set("user",a);var E=new u.User(a);o(E),e.isConnectingFromInit||e.internalRestart||(e.pushToLoginListener(E,"Login_Success"),new en.PostDetails),e.loginInProgress=!1,e.didAnalyticsPingStart()||e.isAnalyticsDisabled||!e.appSettings.shouldAutoEstablishSocketConnection()||(e.pingAnalytics(),e.startAnalyticsPingTimer()),e.isLoggedOut=!1,(e.appSettings.shouldAutoEstablishSocketConnection()||e.internalRestart)&&e.shouldConnectToWS&&e.WSLogin(new u.Me(s))}},function(t){return e.internalRestart||e.pushToLoginListener(t,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,i(t)})})}),[3,3]);case 2:return t=r.sent(),s=new E.CometChatException(t),e.internalRestart||e.pushToLoginListener(s,"Login_Failure"),e.loginInProgress=!1,e.isLoggedOut=!0,[2,i(s)];case 3:return[2]}})})})},e.sendMessage=function(e){var t=this;return new Promise(function(n,o){return s(t,void 0,void 0,function(){var t,i,u,S=this;return r(this,function(l){try{return e instanceof C.TextMessage||e instanceof p.MediaMessage||e instanceof G.CustomMessage||e instanceof Z.InteractiveMessage||(e=e[T.MessageConstatnts.KEYS.ATTATCHMENT]?(t=T.MessageConstatnts.TYPE.FILE,a.isImage(e[T.MessageConstatnts.KEYS.ATTATCHMENT])?t=T.MessageConstatnts.TYPE.IMAGE:a.isAudio(e[T.MessageConstatnts.KEYS.ATTATCHMENT])?t=T.MessageConstatnts.TYPE.AUDIO:a.isVideo(e[T.MessageConstatnts.KEYS.ATTATCHMENT])&&(t=T.MessageConstatnts.TYPE.VIDEO),new p.MediaMessage(e[T.MessageConstatnts.KEYS.RECEIVER_ID],e[T.MessageConstatnts.KEYS.ATTATCHMENT],t,e[T.MessageConstatnts.KEYS.RECEIVER_TYPE])):new C.TextMessage(e[T.MessageConstatnts.KEYS.RECEIVER_ID],e[T.MessageConstatnts.KEYS.TEXT],e[T.MessageConstatnts.KEYS.RECEIVER_TYPE])),(i=a.validateMessage(e))instanceof E.CometChatException?(o(i),[2]):(e.receiver=e.receiverId,delete e.receiverId,u=e.parentMessageId,[2,c.makeApiCall(u?"sendMessageInThread":"sendMessage",u?{parentId:u}:{},e,e instanceof p.MediaMessage).then(function(e){return s(S,void 0,void 0,function(){var t;return r(this,function(o){return t=d.MessageController.trasformJSONMessge(e.data),D.MessageListnerMaping.getInstance().set("all",parseInt(t.id)),n(t),[2]})})},function(e){o(new E.CometChatException(e.error))})])}catch(e){o(new E.CometChatException(e))}return[2]})})})},e.sendDirectMessage=function(e){try{return Object.assign(e,{receiverType:T.MessageConstatnts.RECEIVER_TYPE.USER}),this.sendMessage(e)}catch(e){a.Logger.error("CometChat: sendDirectMessage",e)}},e.sendGroupMessage=function(e){try{return Object.assign(e,{receiverType:T.MessageConstatnts.RECEIVER_TYPE.GROUP}),this.sendMessage(e)}catch(e){a.Logger.error("CometChat: sendGroupMessage",e)}},e.sendMediaMessage=function(e){try{return this.sendMessage(e)}catch(e){a.Logger.error("CometChat: sendMediaMessage",e)}},e.sendCustomMessage=function(e){try{return this.sendMessage(e)}catch(e){a.Logger.error("CometChat: sendCustomMessage",e)}},e.sendInteractiveMessage=function(e){try{return this.sendMessage(e)}catch(e){a.Logger.error("CometChat: sendInteractiveMessage",e)}},e.getLastDeliveredMessageId=function(){return s(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,D.MessageListnerMaping.getInstance().get(T.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST)];case 1:return[2,t.sent()];case 2:return e=t.sent(),a.Logger.error("CometChat: getLastDeliveredMessageId",e),[3,3];case 3:return[2]}})})},e.startTyping=function(t){try{if(a.isFalsy(t))return;var n=void 0,o=this.RECEIVER_TYPE.USER,s={};if(t instanceof U.TypingIndicator)n=t.getReceiverId(),o=t.getReceiverType(),s=t.getMetadata();else{if(!t.hasOwnProperty(T.TYPING_NOTIFICATION.RECEIVER_ID))return;n=t[T.TYPING_NOTIFICATION.RECEIVER_ID],t.hasOwnProperty(T.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(o=t[T.TYPING_NOTIFICATION.RECEIVER_TYPE]),t.hasOwnProperty(T.TYPING_NOTIFICATION.META)&&(s=t[T.TYPING_NOTIFICATION.META])}if(a.isFalsy(n))return;if(null==Y.TypingNotificationController.getTypingStartedMap(n)){var r=e.getMode();return a.isFalsy(r)||r&&r!==T.APP_SETTINGS.KEYS.NO_TRANSIENT&&r!==T.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(eT.startTypingIndicator(n,o,s),Y.TypingNotificationController.addTypingStarted(n),void Y.TypingNotificationController.removeTypingEnded(n)):void 0}}catch(e){a.Logger.error("CometChat: startTyping",e)}},e.endTyping=function(t){try{if(a.isFalsy(t))return;var n=void 0,o=this.RECEIVER_TYPE.USER,s={};if(t instanceof U.TypingIndicator)n=t.getReceiverId(),o=t.getReceiverType(),s=t.getMetadata();else{if(!t.hasOwnProperty(T.TYPING_NOTIFICATION.RECEIVER_ID))return;n=t[T.TYPING_NOTIFICATION.RECEIVER_ID],t.hasOwnProperty(T.TYPING_NOTIFICATION.RECEIVER_TYPE)&&(o=t[T.TYPING_NOTIFICATION.RECEIVER_TYPE]),o=o==this.RECEIVER_TYPE.USER?T.WS.CONVERSATION.TYPE.CHAT:T.WS.CONVERSATION.TYPE.GROUP_CHAT,t.hasOwnProperty(T.TYPING_NOTIFICATION.META)&&(s=t[T.TYPING_NOTIFICATION.META])}if(a.isFalsy(n))return;if(null==Y.TypingNotificationController.getTypingEndedMap(n)){var r=e.getMode();return a.isFalsy(r)||r&&r!==T.APP_SETTINGS.KEYS.NO_TRANSIENT&&r!==T.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?(eT.pauseTypingIndicator(n,o,s),Y.TypingNotificationController.addTypingEnded(n),void Y.TypingNotificationController.removeTypingStarted(n)):void 0}}catch(e){a.Logger.error("CometChat: endTyping",e)}},e.markAsRead=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new Promise(function(n,o){try{var s=void 0,r=void 0,i=void 0,c=void 0;if(3===t.length)return o(new E.CometChatException(T.ReceiptErrors.MISSING_PARAMETERS));if(4===t.length){if(a.isFalsy(t[0])||"string"!=typeof t[0])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(s=t[0],a.isFalsy(t[1])||"string"!=typeof t[1])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(r=t[1],a.isFalsy(t[2])||"string"!=typeof t[2])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(i=t[2],a.isFalsy(t[3])||"string"!=typeof t[3])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));c=t[3]}else{if(1!==t.length)return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsRead() expects either 1 or 4 arguments."))));if(a.isFalsy(t[0])||!(t[0]instanceof l.BaseMessage))return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var u=t[0];s=u.getId().toString(),r=(i=u.getReceiverType())===T.MessageConstatnts.RECEIVER_TYPE.USER?u.getSender().getUid()===e.user.getUid()?u.getReceiverId():u.getSender().getUid():u.getReceiverId(),c=u.getSender().getUid()}var S=e.getMode();return a.isFalsy(S)||S&&S!==T.APP_SETTINGS.KEYS.NO_TRANSIENT&&S!==T.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?e.getConnectionStatus()===T.CONNECTION_STATUS.CONNECTED?(eT.markAsRead(r,i,s,c),n()):o(new E.CometChatException(T.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):o(new E.CometChatException(T.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(e){return a.Logger.error("CometChat: markAsRead",e),o(new E.CometChatException(T.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},e.markAsDelivered=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return new Promise(function(n,o){try{var s=void 0,r=void 0,i=void 0,c=void 0;if(3===t.length)return o(new E.CometChatException(T.ReceiptErrors.MISSING_PARAMETERS));if(4===t.length){if(a.isFalsy(t[0])||"string"!=typeof t[0])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE_ID","MESSAGE_ID","Message ID should be a string."))));if(s=t[0],a.isFalsy(t[1])||"string"!=typeof t[1])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_ID","RECEIVER_ID","Receiver ID should be a string."))));if(r=t[1],a.isFalsy(t[2])||"string"!=typeof t[2])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"RECEIVER_TYPE","RECEIVER_TYPE","Receiver type should be a string."))));if(i=t[2],a.isFalsy(t[3])||"string"!=typeof t[3])return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"SENDER_ID","SENDER_ID","Sender ID should be a string."))));c=t[3]}else{if(1!==t.length)return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"ARGUMENTS","ARGUMENTS","markAsDelivered() expects either 1 or 4 arguments."))));if(a.isFalsy(t[0])||!(t[0]instanceof l.BaseMessage))return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));var u=t[0];s=u.getId().toString(),r=(i=u.getReceiverType())===T.MessageConstatnts.RECEIVER_TYPE.USER?u.getSender().getUid()===e.user.getUid()?u.getReceiverId():u.getSender().getUid():u.getReceiverId(),c=u.getSender().getUid()}var S=e.getMode();return a.isFalsy(S)||S&&S!==T.APP_SETTINGS.KEYS.NO_TRANSIENT&&S!==T.APP_SETTINGS.KEYS.LIMITED_TRANSIENT?e.getConnectionStatus()===T.CONNECTION_STATUS.CONNECTED?(eT.markAsDelivered(r,i,s,c),n()):o(new E.CometChatException(T.ReceiptErrors.NO_WEBSOCKET_CONNECTION)):o(new E.CometChatException(T.ReceiptErrors.RECEIPTS_TEMPORARILY_BLOCKED))}catch(e){return a.Logger.error("CometChat: markAsDelivered",e),o(new E.CometChatException(T.ReceiptErrors.UNKNOWN_ERROR_OCCURRED))}})},e.markConversationAsRead=function(e,t){return new Promise(function(n,o){try{var s=a.validateConversationType(t);if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(e,t);if(r instanceof E.CometChatException)return void o(r);var i={},u="";t=t.toLowerCase(),e=e.toLowerCase(),t===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(u="markGroupConversationAsRead",i.guid=e):(u="markUserConversationAsRead",i.uid=e),c.makeApiCall(u,i,{}).then(function(e){n("Conversation marked as read successfully.")},function(e){return o(new E.CometChatException(e.error))})}catch(e){return a.Logger.error("CometChat: markConversationAsRead",e),o(new E.CometChatException(e))}})},e.markConversationAsDelivered=function(e,t){return new Promise(function(n,o){try{var s=a.validateConversationType(t);if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(e,t);if(r instanceof E.CometChatException)return void o(r);var i={},u="";t=t.toLowerCase(),e=e.toLowerCase(),t===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(u="markGroupConversationAsDelivered",i.guid=e):(u="markUserConversationAsDelivered",i.uid=e),c.makeApiCall(u,i,{}).then(function(e){n("Conversation marked as delivered successfully.")},function(e){return o(new E.CometChatException(e.error))})}catch(e){return a.Logger.error("CometChat: markConversationAsDelivered",e),o(new E.CometChatException(e))}})},e.markAsUnread=function(e){var t=this;return new Promise(function(n,o){try{var s=void 0;if(a.isFalsy(e)||!(e instanceof l.BaseMessage))return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));s=e.getId().toString();var r={},i="";e.getReceiverType()===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(i="markGroupMessagesAsUnread",r.guid=e.getReceiverId()):(i="markUserMessagesAsUnread",t.user&&e.getSender().getUid()===t.user.getUid()?r.uid=e.getReceiverId():r.uid=e.getSender().getUid()),c.makeApiCall(i,r,{messageId:s}).then(function(e){return n("Messages marked as unread successfully.")},function(e){return o(new E.CometChatException(e.error))})}catch(e){return a.Logger.error("CometChat: markAsUnread",e),o(new E.CometChatException(e))}})},e.markMessageAsUnread=function(e){var t=this;return F.Conversation,new Promise(function(n,o){try{var s=void 0;if(a.isFalsy(e)||!(e instanceof l.BaseMessage))return o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ReceiptErrors.INVALID_PARAMETER),"MESSAGE","MESSAGE","Invalid message object received."))));s=e.getId().toString();var r={},i="";e.getReceiverType()===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(i="markGroupMessagesAsUnread",r.guid=e.getReceiverId()):(i="markUserMessagesAsUnread",t.user&&e.getSender().getUid()===t.user.getUid()?r.uid=e.getReceiverId():r.uid=e.getSender().getUid()),c.makeApiCall(i,r,{messageId:s}).then(function(e){var t,o=null==(t=null==e?void 0:e.data)?void 0:t.conversation;
1return n(V.ConversationController.trasformJSONConversation(o.conversationId,o.conversationType,o.lastMessage,o.conversationWith,parseInt(o.unreadMessageCount),o.tags?o.tags:[],o.unreadMentionsCount,o.lastReadMessageId,o.latestMessageId))},function(e){return o(new E.CometChatException(e.error))})}catch(e){return a.Logger.error("CometChat: markMessageAsUnread",e),o(new E.CometChatException(e))}})},e.sendTransientMessage=function(t){try{if(a.isFalsy(t))return;var n=void 0,o=void 0,s={};if(!(t instanceof Q.TransientMessage)||(n=t.getReceiverId(),o=t.getReceiverType(),s=t.getData(),a.isFalsy(n)||a.isFalsy(o)))return;var r=e.getMode();return a.isFalsy(r)||r&&r!==T.APP_SETTINGS.KEYS.NO_TRANSIENT?void eT.sendTransientMessage(n,o,s):void 0}catch(e){a.Logger.error("CometChat: sendTransientMessage",e)}},e.sendTestMessage=function(e){return s(this,void 0,void 0,function(){var t,n;return r(this,function(o){switch(o.label){case 0:return o.trys.push([0,3,,4]),(t=e)instanceof l.BaseMessage?[3,2]:[4,B.CometChatHelper.processMessage(e)];case 1:t=o.sent(),o.label=2;case 2:return t instanceof C.TextMessage&&H.WSConnectionHelper.getInstance().publishMessage(t),[3,4];case 3:return n=o.sent(),a.Logger.error("CometChat: sendTestMessage",n),[3,4];case 4:return[2]}})})},e.getMessageDetails=function(e){return new Promise(function(t,n){try{a.isFalsy(e)?n(new E.CometChatException(O.ERRORS.PARAMETER_MISSING)):c.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){t(d.MessageController.trasformJSONMessge(e.data))},function(e){a.Logger.error("CometChat:GetMessageDetails:",e),n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getMessageReceipts=function(e){return new Promise(function(t,n){try{var o=a.validateMsgId(e);if(o instanceof E.CometChatException)return void n(o);a.isFalsy(e)?n(new E.CometChatException(O.ERRORS.PARAMETER_MISSING)):c.makeApiCall("getMessageDetails",{messageId:e}).then(function(e){d.MessageController.getReceiptsFromJSON(e.data).then(function(e){t(e)},function(e){n(new E.CometChatException(e))})},function(e){a.Logger.error("CometChat:GetMessageDetails:",e),n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getUnreadMessageCount=function(e){void 0===e&&(e=!1);var t=0;return new Promise(function(n,o){try{var s=a.validateHideMessagesFromBlockedUsers(e);if(s instanceof E.CometChatException)return void o(s);e&&(t=1),c.makeApiCall("getMessages",{},{unread:1,count:1,hideMessagesFromBlockedUsers:t}).then(function(e){var t={},o={};e.data.map(function(e){e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==T.MessageConstatnts.RECEIVER_TYPE.GROUP?o[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]:t[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n({users:t,groups:o})},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.getUnreadMessageCountForAllUsers=function(e){void 0===e&&(e=!1);var t=0;return new Promise(function(n,s){try{var r=a.validateHideMessagesFromBlockedUsers(e);if(r instanceof E.CometChatException)return void s(r);e&&(t=1),c.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:t,receiverType:T.MessageConstatnts.RECEIVER_TYPE.USER,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){t[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),n(o({},t))},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.getUnreadMessageCountForAllGroups=function(e){void 0===e&&(e=!1);var t=0;return new Promise(function(n,s){try{var r=a.validateHideMessagesFromBlockedUsers(e);if(r instanceof E.CometChatException)return void s(r);e&&(t=1),c.makeApiCall("getMessages",{},{hideMessagesFromBlockedUsers:t,receiverType:T.MessageConstatnts.RECEIVER_TYPE.GROUP,unread:1,count:1}).then(function(e){var t={};e.data.map(function(e){e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==T.Me
1ssageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),n(o({},t))},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.getUnreadMessageCountForUser=function(e,t){void 0===t&&(t=!1);var n=0;return new Promise(function(s,r){try{var i=a.validateId(e,"user");if(i instanceof E.CometChatException)return void r(i);var u=a.validateHideMessagesFromBlockedUsers(t);if(u instanceof E.CometChatException)return void r(u);t&&(n=1),c.makeApiCall("getUserMessages",{listId:e},{hideMessagesFromBlockedUsers:n,unread:1,count:1,uid:e}).then(function(e){var t={};e.data.map(function(e){t[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT]}),s(o({},t))},function(e){r(new E.CometChatException(e.error))})}catch(e){r(new E.CometChatException(e))}})},e.getUnreadMessageCountForGroup=function(e,t){void 0===t&&(t=!1);var n=0;return new Promise(function(s,r){try{var i=a.validateId(e,"group");if(i instanceof E.CometChatException)return void r(i);var u=a.validateHideMessagesFromBlockedUsers(t);if(u instanceof E.CometChatException)return void r(u);t&&(n=1),c.makeApiCall("getGroupMessages",{listId:e},{hideMessagesFromBlockedUsers:n,unread:1,count:1,guid:e}).then(function(e){var t={};e.data.map(function(e){e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_TYPE]==T.MessageConstatnts.RECEIVER_TYPE.GROUP&&(t[e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.ENTITY_Id]]=e[T.ResponseConstants.RESPONSE_KEYS.UNREAD_UNDELIVERED_KEYS.COUNT])}),s(o({},t))},function(e){r(new E.CometChatException(e.error))})}catch(e){r(new E.CometChatException(e))}})},e.addReaction=function(e,t){return new Promise(function(n,o){try{var s=a.validateMsgId(e);if(s instanceof E.CometChatException)return void o(s);a.isFalsy(e)||a.isFalsy(t)?o(new E.CometChatException(O.ERRORS.PARAMETER_MISSING)):c.makeApiCall("addReaction",{messageId:e,reaction:encodeURIComponent(t)}).then(function(e){var t=d.MessageController.trasformJSONMessge(e.data);n(t)},function(e){a.Logger.error("CometChat:addReaction:",e),o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.removeReaction=function(e,t){return new Promise(function(n,o){try{var s=a.validateMsgId(e);if(s instanceof E.CometChatException)return void o(s);a.isFalsy(e)||a.isFalsy(t)?o(new E.CometChatException(O.ERRORS.PARAMETER_MISSING)):c.makeApiCall("removeReaction",{messageId:e,reaction:encodeURIComponent(t)}).then(function(e){var t=d.MessageController.trasformJSONMessge(e.data);n(t)},function(e){a.Logger.error("CometChat:removeReaction:",e),o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.editMessage=function(e){return new Promise(function(t,n){try{var o=a.validateMsgId(e.getId());if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("updateMessage",{messageId:e.getId()},e).then(function(e){t(d.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.deleteMessage=function(e){return new Promise(function(t,n){try{var o=a.validateMsgId(e);if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("deleteMessage",{messageId:e},{id:e}).then(function(e){t(d.MessageController.trasformJSONMessge(e.data).getActionOn())},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getOnlineUserCount=function(){return new Promise(function(t,n){try{a.getAppSettings().then(function(o){var s=a.format((new i.EndpointFactory).wsApi,a.getChatHost(o),a.format(T.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,o[T.APP_SETTINGS.KEYS.WS_API_VERSION])),r={appId:e.appId,Authorization:e.jwt,Accept:"application/json","Content-Type":"application/json"};c.postData(s,"POST",{},r,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?t(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ONLINE_MEMBER_COUNT_API.RESPONSE.ONLINE_USERS_COUNT]):n(new E.CometChatException(e.error))}).catch(function(){var e={error:O.FETCH_ERROR.ERROR_IN_API_CALL};return n(e)})},function(e){return n(new E.CometChatException(e))})}catch(e){return n(new E.CometChatException(e))}})},e.getOnlineGroupMemberCount=function(t){return new Promise(function(n,o){try{if(!t||0==t.length)return o(new E.CometChatException(T.ONLINE_MEMBER_COUNT_API.ERRORS.INVALID_GROUPLIST));a.getAppSettings().then(function(s){var r=a.format((new i.EndpointFactory).wsApi,a.getChatHost(s),a.format(T.ONLINE_MEMBER_COUNT_API.ENDPOINTS.GET_ONLINE_MEMBER_COUNT,s[T.APP_SETTINGS.KEYS.WS_API_VERSION])),u={appId:e.appId,Authorization:e.jwt,Accept:"application/json","Content-Type":"application/json"};c.postData(r,"POST",{groups:t},u,!1).then(function(e){return e.json()}).then(function(e){return e.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?n(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ONLINE_MEMBER_COUNT_API.RESPONSE.GROUPS]):o(new E.CometChatException(e.error))}).catch(function(){var e={error:O.FETCH_ERROR.ERROR_IN_API_CALL};return o(e)})},function(e){return o(new E.CometChatException(e))})}catch(e){return o(new E.CometChatException(e))}})},e.createUser=function(t,n){return new Promise(function(o,s){try{if(a.isFalsy(n))return void s(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.GENERAL_ER
1ROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));e.apiKey=n;var r=a.validateCreateUser(t);if(r instanceof E.CometChatException)return void s(r);if(!(t instanceof u.User)){var i=void 0;if(!t.hasOwnProperty(T.UserConstants.UID)||!t.hasOwnProperty(T.UserConstants.NAME))return void s(new E.CometChatException(O.ERRORS.PARAMETER_MISSING));i=new u.User(t[T.UserConstants.UID],t[T.UserConstants.NAME]),t.hasOwnProperty(T.UserConstants.AVATAR)&&i.setAvatar(t[T.UserConstants.AVATAR]),t.hasOwnProperty(T.UserConstants.ROLE)&&i.setRole(t[T.UserConstants.ROLE]),t.hasOwnProperty(T.UserConstants.META_DATA)&&i.setMetadata(t[T.UserConstants.META_DATA]),t.hasOwnProperty(T.UserConstants.LINK)&&i.setLink(t[T.UserConstants.LINK]),t.hasOwnProperty(T.UserConstants.STATUS_MESSAGE)&&i.setStatusMessage(t[T.UserConstants.STATUS_MESSAGE]),t.hasOwnProperty(T.UserConstants.TAGS)&&i.setTags(t[T.UserConstants.TAGS]),t=i}c.makeApiCall("createUser",{},t).then(function(e){var t=_.UsersController.trasformJSONUser(e.data);o(t)},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.updateUser=function(t,n){var o=this;return new Promise(function(s,r){try{if(a.isFalsy(n))return void r(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.GENERAL_ERROR.INVALID),"AUTH_KEY","AUTH_KEY","AUTH_KEY","AUTH_KEY"))));e.apiKey=n;var i=a.validateUpdateUser(t);if(i instanceof E.CometChatException)return void r(i);if(!(t instanceof u.User)){var p=void 0;if(!t.hasOwnProperty(T.UserConstants.UID))return void r(new E.CometChatException(O.ERRORS.PARAMETER_MISSING));p=new u.User(t[T.UserConstants.UID]),t.hasOwnProperty(T.UserConstants.NAME)&&p.setName(t[T.UserConstants.NAME]),t.hasOwnProperty(T.UserConstants.AVATAR)&&p.setAvatar(t[T.UserConstants.AVATAR]),t.hasOwnProperty(T.UserConstants.ROLE)&&p.setRole(t[T.UserConstants.ROLE]),t.hasOwnProperty(T.UserConstants.META_DATA)&&p.setMetadata(t[T.UserConstants.META_DATA]),t.hasOwnProperty(T.UserConstants.LINK)&&p.setLink(t[T.UserConstants.LINK]),t.hasOwnProperty(T.UserConstants.STATUS_MESSAGE)&&p.setStatusMessage(t[T.UserConstants.STATUS_MESSAGE]),t.hasOwnProperty(T.UserConstants.TAGS)&&p.setTags(t[T.UserConstants.TAGS]),t=p}var l=t.uid;c.makeApiCall("updateUser",{uid:l},t).then(function(t){if(o.user&&l.toLocaleLowerCase()===o.user.getUid().toLocaleLowerCase())S.LocalStorage.getInstance().get("user").then(function(n){if(n){var r=_.UsersController.trasformJSONUser(t.data),i=t.data;i.wsChannel=n.wsChannel,i.authToken=e.authToken,i.status=T.PresenceConstatnts.STATUS.ONLINE,n.jwt&&(i.jwt=n.jwt),e.user=new u.Me(i),o.localStorage.set("user",e.user),s(r)}});else{var n=_.UsersController.trasformJSONUser(t.data);s(n)}},function(e){r(new E.CometChatException(e.error))})}catch(e){r(new E.CometChatException(e))}})},e.updateCurrentUserDetails=function(t){var n=this;return new Promise(function(o,s){try{t.uid=n.user.uid;var r=a.validateUpdateUser(t);if(r instanceof E.CometChatException)return void s(r);if(!(t instanceof u.User)){var i=void 0;t.hasOwnProperty(T.UserConstants.UID)&&(i=new u.User(t[T.UserConstants.UID])),t.hasOwnProperty(T.UserConstants.NAME)&&i.setName(t[T.UserConstants.NAME]),t.hasOwnProperty(T.UserConstants.AVATAR)&&i.setAvatar(t[T.UserConstants.AVATAR]),t.hasOwnProperty(T.UserConstants.ROLE)&&i.setRole(t[T.UserConstants.ROLE]),t.hasOwnProperty(T.UserConstants.META_DATA)&&i.setMetadata(t[T.UserConstants.META_DATA]),t.hasOwnProperty(T.UserConstants.LINK)&&i.setLink(t[T.UserConstants.LINK]),t.hasOwnProperty(T.UserConstants.STATUS_MESSAGE)&&i.setStatusMessage(t[T.UserConstants.STATUS_MESSAGE]),t.hasOwnProperty(T.UserConstants.TAGS)&&i.setTags(t[T.UserConstants.TAGS]),t=i}c.makeApiCall("updateMyDetails",{},t).then(function(t){var n=_.UsersController.trasformJSONUser(t.data),s=e.user=new u.Me(t.data);s.setStatus(T.PresenceConstatnts.STATUS.ONLINE),e.localStorage.set("user",s),o(n)},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.getUser=function(e){return new Promise(function(t,n){try{"object"==typeof e&&e.hasOwnProperty("uid")&&(e=e.uid);var o=a.validateId(e,"user");if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("user",{uid:e}).then(function(e){var n=_.UsersController.trasformJSONUser(e.data);t(n)}).catch(function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getLoggedInUser=function(){var t=this;return new Promise(function(n,o){try{e.localStorage.get(T.LOCAL_STORE.KEY_USER).then(function(s){if(s)e.user=new u.Me(s),n(e.user);else{var r="",i="",p=T.APPINFO.platform,l=T.APPINFO.sdkVersion,C=T.APPINFO.apiVersion;e.keyStore.get(T.LOCAL_STORE.KEY_DEVICE_ID).then(function(s){if(i=s,navigator&&(r=navigator.userAgent),null==i){var d=e_(),_=(new Date).getTime();i=t.appId+"_"+d+"_"+_,e.keyStore.set(T.LOCAL_STORE.KEY_DEVICE_ID,i)}var h={version:l,apiVersion:C,userAgent:r};a.isFalsy(t.platform)||(h.platform=t.platform),a.isFalsy(t.language)||(h.language=t.language),a.isFalsy(t.resource)||(h.resource=t.resource);var g={platform:p,deviceId:i,appInfo:h};c.makeApiCall("updateMyDetails",{},g,!1).then(function(t){t.data.jwt&&(e.jwt=t.data.jwt);var o=t.data.settings;o&&(S.LocalStorage.getInstance().set("app_settings",o),o[T.APP_SETTINGS.KEYS.MODE]&&e.setMode(o[T.APP_SETTINGS.KEYS.MODE]),o[T.APP_SETTINGS.KEYS.SETTINGS_HASH]&&(e.settingsHash=o[T.APP_SETTINGS.KEYS.SETTINGS_HASH]),o[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]&&(e.settingsHashReceivedAt=o[T.APP_SETTINGS.KEYS.SETTINGS_HASH_RECEIVED_AT]),e.isAnalyticsDisabled=!!o[T.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],o[T.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST]&&(e.SECURED_MEDIA_HOST=o[T.APP_SETTINGS.KEYS.SECURED_MEDIA_HOST])),n(new u.Me(t.data))},function(e){o(new E.CometChatException(e.error))}).catch(function(e){o(new E.CometChatException(e))})})}})}catch(e){o(new E.CometChatException(e))}})},e.getLoggedinUser=function(){return new Promise(function(t,n){try{e.localStorage.get(T.LOCAL_STORE.KEY_USER).then(function(e){t(e?new u.User(e):null)},function(e){t(null)})}catch(e){n(new E.CometChatException(e))}})},e.blockUsers=function(e){return new Promise(function(t,n){try{var o=a.validateArray(e,"blockUsers");if(o instanceof E.CometChatException)return void n(o);a.isFalsy(e)?n(new E.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):c.makeApiCall("blockUsers",{},{blockedUids:e}).then(function(e){t(e.data)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.unblockUsers=function(e){return new Promise(function(t,n){try{var o=a.validateArray(e,"unblockUsers");if(o instanceof E.CometChatException)return void n(o);a.isFalsy(e)?n(new E.CometChatException(O.USERS_REQUEST_ERRORS.EMPTY_USERS_LIST)):c.makeApiCall("unblockUsers",{},{blockedUids:e}).then(function(e){t(e.data)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getConversation=function(e,t){return new Promise(function(n,o){try{var s=a.validateConversationType(t);if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(e,t);if(r instanceof E.CometChatException)return void o(r);t=t.toLowerCase(),e=e.toLowerCase();var i={},u="";t===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(u="getGroupConversation",i.guid=e):(u="getUserConversation",i.uid=e),c.makeApiCall(u,i).then(function(s){if(s.data){var r=s.data;n(V.ConversationController.trasformJSONConversation(r.conversationId,r.conversationType,r.lastMessage,r.conversationWith,parseInt(r.unreadMessageCount),r.tags?r.tags:[],r.unreadMentionsCount,r.lastReadMessageId,r.latestMessageId))}else o(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ConversationErrors.CONVERSATION_NOT_FOUND),t,e))))},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.tagConversation=function(e,t,n){return void 0===n&&(n=[]),new Promise(function(o,s){try{var r=a.validateConversationType(t);if(r instanceof E.CometChatException)return void s(r);var i=a.validateId(e,t);if(i instanceof E.CometChatException)return void s(i);t=t.toLowerCase(),e=e.toLowerCase();var u={},S="";t===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(S="updateGroupConversation",u.guid=e):(S="updateUserConversation",u.uid=e),c.makeApiCall(S,u,{tags:n}).then(function(n){if(n.data){var r=n.data;o(V.ConversationController.trasformJSONConversation(r.conversationId,r.conversationType,r.lastMessage,r.conversationWith,parseInt(r.unreadMessageCount),r.tags?r.tags:[],r.unreadMentionsCount,r.lastReadMessageId,r.latestMessageId))}else s(new E.CometChatException(JSON.parse(a.format(JSON.stringify(T.ConversationErrors.CONVERSATION_NOT_FOUND),t,e))))},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.deleteConversation=function(e,t){return new Promise(function(n,o){try{var s=a.validateConversationType(t);if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(e,t);if(r instanceof E.CometChatException)return void o(r);var i={},u="";t=t.toLowerCase(),e=e.toLowerCase(),t===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(u="deleteGroupConversation",i.guid=e):(u="deleteUserConversation",i.uid=e),c.makeApiCall(u,i).then(function(e){n("Conversation deleted successfully.")},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.createGroup=function(e){return new Promise(function(t,n){try{var o=a.validateCreateGroup(e);if(o instanceof E.CometChatException)return void n(o);if(!(e instanceof h.Group)){var s=void 0;if(!e.hasOwnProperty(T.GroupConstants.KEYS.GUID)||!e.hasOwnProperty(T.GroupConstants.KEYS.NAME))return void n(new E.CometChatException(O.ERRORS.PARAMETER_MISSING));if(s=new h.Group(e[T.GroupConstants.KEYS.GUID],e[T.GroupConstants.KEYS.NAME],""),e.hasOwnProperty(T.GroupConstants.KEYS.TYPE))if(e[T.GroupConstants.KEYS.TYPE].toLocaleLowerCase()==T.GroupType.Password){if(!e.hasOwnProperty(T.GroupConstants.KEYS.PASSWORD))return void n(new E.CometChatException(O.GROUP_CREATION_ERRORS.EMPTY_PASSWORD));s.setType(T.GROUP_TYPE.PASSWORD),s.setPassword(e[T.GroupConstants.KEYS.PASSWORD])}else s.setType(e[T.GroupConstants.KEYS.TYPE]);else s.setType(T.GROUP_TYPE.PUBLIC);e.hasOwnProperty(T.GroupConstants.KEYS.ICON)&&s.setIcon(e[T.GroupConstants.KEYS.ICON]),e.hasOwnProperty(T.GroupConstants.KEYS.DESCRIPTION)&&s.setDescription(e[T.GroupConstants.KEYS.DESCRIPTION]),e.hasOwnProperty(T.GroupConstants.KEYS.TAGS)&&s.setTags(e[T.GroupConstants.KEYS.TAGS]),e=s}c.makeApiCall("createGroup",{},e).then(function(e){g.GroupsController.trasformJSONGroup(e.data).setHasJoined(!0),t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.getGroup=function(e){return new Promise(function(t,n){try{"object"==typeof e&&e.hasOwnProperty("guid")&&(e=e.guid);var o=a.validateId(e,"group");if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("getGroup",{guid:e}).then(function(e){t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.joinGroup=function(e,t,n){return void 0===t&&(t=T.GroupType.Public),void 0===n&&(n=""),new Promise(function(o,s){try{var r=a.validateJoinGroup(e,t,n);if(r instanceof E.CometChatException)return void s(r);var i=void 0;"object"==typeof e&&(e.hasOwnProperty(T.GroupConstants.KEYS.GUID)?(e.hasOwnProperty(T.GroupConstants.KEYS.TYPE)&&(t=e[T.GroupConstants.KEYS.TYPE],e[T.GroupConstants.KEYS.TYPE].toLocaleLowerCase()===T.GroupType.Password&&e.hasOwnProperty(T.GroupConstants.KEYS.PASSWORD)&&(n=e[T.GroupConstants.KEYS.PASSWORD])),e=e[T.GroupConstants.KEYS.GUID]):s(new E.CometChatException(O.ERRORS.PARAMETER_MISSING))),i=a.isFalsy(n)?new h.Group(e,"name",t):new h.Group(e,"name",t,n),c.makeApiCall("joinGroup",i,i).then(function(e){var t=g.GroupsController.trasformJSONGroup(e.data[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ActionConstatnts.ACTION_KEY
1S.ENTITIES][T.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][T.ActionConstatnts.ACTION_KEYS.ENTITY]);t.setHasJoined(!0),o(t)},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.updateGroup=function(e){return new Promise(function(t,n){try{var o=a.validateUpdateGroup(e);if(o instanceof E.CometChatException)return void n(o);if(!(e instanceof h.Group)){var s=void 0;if(!e.hasOwnProperty(T.GroupConstants.KEYS.GUID))return void n(new E.CometChatException(O.ERRORS.PARAMETER_MISSING));s=new h.Group(T.GroupConstants.KEYS.GUID,"",""),e.hasOwnProperty(T.GroupConstants.KEYS.TYPE)?s.setType(e[T.GroupConstants.KEYS.TYPE]):(e[T.GroupConstants.KEYS.TYPE]=T.GROUP_TYPE.PUBLIC,s.setType[T.GROUP_TYPE.PUBLIC]),e.hasOwnProperty(T.GroupConstants.KEYS.NAME)&&s.setName(e[T.GroupConstants.KEYS.NAME]),e.hasOwnProperty(T.GroupConstants.KEYS.ICON)&&s.setIcon(e[T.GroupConstants.KEYS.ICON]),e.hasOwnProperty(T.GroupConstants.KEYS.DESCRIPTION)&&s.setDescription(e[T.GroupConstants.KEYS.DESCRIPTION]),e.hasOwnProperty(T.GroupConstants.KEYS.TAGS)&&s.setTags(e[T.GroupConstants.KEYS.TAGS]),e=s}c.makeApiCall("updateGroup",e,e).then(function(e){t(g.GroupsController.trasformJSONGroup(e.data))},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.deleteGroup=function(e){return new Promise(function(t,n){try{var o=a.validateId(e,"group");if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("deleteGroup",{guid:e}).then(function(e){t(!0)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.leaveGroup=function(e){return new Promise(function(t,n){try{var o=a.validateId(e,"group");if(o instanceof E.CometChatException)return void n(o);c.makeApiCall("leaveGroup",{guid:e}).then(function(e){t(!0)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.kickGroupMember=function(e,t){return new Promise(function(n,o){try{var s=a.validateId(e,"group");if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(t,"user");if(r instanceof E.CometChatException)return void o(r);c.makeApiCall("kickGroupMembers",{guid:e,uid:t}).then(function(e){n(!0)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.updateGroupMemberScope=function(e,t,n){return new Promise(function(o,s){try{var r=a.validateId(e,"group");if(r instanceof E.CometChatException)return void s(r);var i=a.validateId(t,"user");if(i instanceof E.CometChatException)return void s(i);var u=a.validateScope(n);if(u instanceof E.CometChatException)return void s(u);c.makeApiCall("changeScopeOfMember",{guid:e,uid:t},{scope:n}).then(function(e){o(!0)},function(e){s(new E.CometChatException(e.error))})}catch(e){s(new E.CometChatException(e))}})},e.banGroupMember=function(e,t){return new Promise(function(n,o){try{var s=a.validateId(e,"group");if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(t,"user");if(r instanceof E.CometChatException)return void o(r);c.makeApiCall("banGroupMember",{guid:e,uid:t}).then(function(e){n(!0)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.unbanGroupMember=function(e,t){return new Promise(function(n,o){try{var s=a.validateId(e,"group");if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(t,"user");if(r instanceof E.CometChatException)return void o(r);c.makeApiCall("unbanGroupMember",{guid:e,uid:t}).then(function(e){n(!0)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.addMembersToGroup=function(e,t,n){var s=[],r=[],i=[],u=[];return new Promise(function(S,p){try{var l=a.validateId(e,"group");if(l instanceof E.CometChatException)return void p(l);var C=a.validateArray(t,"groupMembers");if(C instanceof E.CometChatException)return void p(C);if(n){var d=a.validateArray(n,"bannedMembers");if(d instanceof E.CometChatException)return void p(d)}a.isFalsy(t)&&a.isFalsy(n)?p(new E.CometChatException({})):a.isFalsy(t)||a.isFalsy(n)?a.isFalsy(t)?n.map(function(e){u.push(e)}):(t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){s.push(e.getUid())}),t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){r.push(e.getUid())}),t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){i.push(e.getUid())})):(t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.ADMIN)return!0}).map(function(e){s.push(e.getUid())}),t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.MODERATOR)return!0}).map(function(e){r.push(e.getUid())}),t.filter(function(e){if(e.getScope()==T.GROUP_MEMBER_SCOPE.PARTICIPANT)return!0}).map(function(e){i.push(e.getUid())}),n.map(function(e){u.push(e)}));var _={};a.isFalsy(s)||(_=o(o({},_),{admins:s})),a.isFalsy(i)||(_=o(o({},_),{participants:i})),a.isFalsy(r)||(_=o(o({},_),{moderators:r})),a.isFalsy(u)||(_=o(o({},_),{usersToBan:u})),c.makeApiCall("addMemebersToGroup",{guid:e},_).then(function(e){var t={};Object.keys(e.data.admins).map(function(n){e.data.admins[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t[n]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t[n]=e.data.admins[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.participants).map(function(n){e.data.participants[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t[n]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t[n]=e.data.participants[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.moderators).map(function(n){e.data.moderators[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t[n]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t[n]=e.data.moderators[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(e.data.usersToBan).map(function(n){e.data.usersToBan[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t[n]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t[n]=e.data.usersToBan[n][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),S(t)},function(e){p(new E.CometChatException(e.error))})}catch(e){p(new E.CometChatException(e))}})},e.transferGroupOwnership=function(e,t){return new Promise(function(n,o){try{var s=a.validateId(e,"group");if(s instanceof E.CometChatException)return void o(s);var r=a.validateId(t,"user");if(r instanceof E.CometChatException)return void o(r);c.makeApiCall("transferOwnership",{guid:e},{owner:t}).then(function(o){var s;s=o&&o.data&&o.data.message?o.data.message:"Ownership transferred to user "+t+" for the group with guid "+e+".",n(s)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.createGroupWithMembers=function(e,t,n){var s=[],r=[],i=[],u=[];return new Promise(function(S,p){try{var l=a.validateCreateGroup(e);if(l instanceof E.CometChatException)return void p(l);if(t&&0<t.length){var C=a.validateArray(t,"groupMembers");if(C instanceof E.CometChatException)return void p(C);t.map(function(e){e.getScope()===T.GROUP_MEMBER_SCOPE.ADMIN&&s.push(e.getUid()),e.getScope()===T.GROUP_MEMBER_SCOPE.MODERATOR&&r.push(e.getUid()),e.getScope()===T.GROUP_MEMBER_SCOPE.PARTICIPANT&&i.push(e.getUid())})}if(n&&0<n.length){var d=a.validateArray(n,"bannedMembers");if(d instanceof E.CometChatException)return void p(d);n.map(function(e){u.push(e)})}var _={};_=o({},e),a.isFalsy(s)||(_.members=o(o({},_.members),{admins:s})),a.isFalsy(i)||(_.members=o(o({},_.members),{participants:i})),a.isFalsy(r)||(_.members=o(o({},_.members),{moderators:r})),a.isFalsy(u)||(_.members=o(o({},_.members),{usersToBan:u})),c.makeApiCall("createGroup",{},_).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][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.admins[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.participants).map(function(e){n.participants[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.participants[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.moderators).map(function(e){n.moderators[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.moderators[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),Object.keys(n.usersToBan).map(function(e){n.usersToBan[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS]?t.members[e]=T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.SUCCESS:t.members[e]=n.usersToBan[e][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.ERROR][T.ResponseConstants.RESPONSE_KEYS.GROUP_MEMBERS_RESPONSE.MESSAGE]}),delete e.data.members;var s=e.data,r=g.GroupsController.trasformJSONGroup(s);r.setHasJoined(!0),t=o(o({},t),{group:r}),S(t)},function(e){p(new E.CometChatException(e.error))})}catch(e){p(new E.CometChatException(e))}})},e.initiateCall=function(e){var t=this;return new Promise(function(n,o){var s=t.getActiveCall();if(null===s)try{a.isFalsy(JSON.parse(JSON.stringify(e)).sender)?a.isFalsy(s)?(e.setStatus(T.CallConstants.CALL_STATUS.INITIATED),e.receiver=e.receiverId.toString(),delete e.receiverId,c.makeApiCall("createCallSession",{},e).then(function(e){var t=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);R.CallController.getInstance().initiateCall(t).then(function(e){n(t)}
1).catch(function(e){o(new E.CometChatException(e))})},function(e){o(new E.CometChatException(e.error))})):o(new E.CometChatException(T.CALL_ERROR.ERROR_IN_CALLING)):R.CallController.getInstance().initiateCall(e).then(function(t){n(Object.assign(e))}).catch(function(e){o(new E.CometChatException(e))})}catch(e){o(new E.CometChatException(e))}else o(new E.CometChatException(T.CALL_ERROR.CALL_ALREADY_INITIATED))})},e.acceptCall=function(e){var t=this;return new Promise(function(n,o){if(null===t.getActiveCall())try{var s={};s[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.ONGOING,c.makeApiCall("updateCallSession",{sessionid:e},s).then(function(e){var t=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);R.CallController.getInstance().onCallStarted(t),n(t)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}else o(new E.CometChatException(T.CALL_ERROR.CANNOT_ACCEPT_CALL))})},e.rejectCall=function(e,t){try{switch(t){case T.CallConstants.CALL_STATUS.REJECTED:return this.rejectIncomingCall(e);case T.CallConstants.CALL_STATUS.CANCELLED:return this.cancelCall(e);case T.CallConstants.CALL_STATUS.BUSY:return this.sendBusyResponse(e);default:return this.endCall(e,!0)}}catch(e){a.Logger.error("CometChat: rejectCall",e)}},e.endCall=function(e,t){var n=this;return new Promise(function(o,s){a.isFalsy(t)&&(t=!1);var r=n.getActiveCall();if(null!==r){if(r.getSessionId()===e)try{var i={};i[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.ENDED,r.getJoinedAt()&&(i[T.CallConstants.CALL_KEYS.CALL_JOINED_AT]=r.getJoinedAt()),c.makeApiCall("updateCallSession",{sessionid:e},i).then(function(e){t||R.CallController.getInstance().endSession();var n=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);o(n),R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onCallEnded(n),R.CallController.getInstance().endCall()},function(e){a.Logger.log("calling Log",{error:e}),t||R.CallController.getInstance().endSession(),r.setStatus(T.CallConstants.CALL_STATUS.ENDED),o(r),R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onCallEnded(r),R.CallController.getInstance().endCall()})}catch(e){s(new E.CometChatException(e))}}else t||R.CallController.getInstance().endSession(),o(null),R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onCallEnded(null),R.CallController.getInstance().endCall()})},e.getActiveCall=function(){try{return R.CallController.getInstance().getActiveCall()}catch(e){a.Logger.error("CometChat: getActiveCall",e)}},e.clearActiveCall=function(){R.CallController.getInstance().clearActiveCall()},e.startCall=function(t,n,o){var s=this;try{var r,i,c,u,S,p,l,C,d,_,h=this.getActiveCall(),g=!1,A=!0,f=!0,I=!0,O=!0,N=!0,y=!0,m=!1,P=!1,M=T.CallConstants.CALL_MODE.DEFAULT,v=!1,L=!1,D=!1,U=!0,Y=!0,G={},w=this.user;u=(new k.VirtualBackgroundBuilder).build(),S=new k.MainVideoContainerSetting,a.getAppSettings().then(function(K){if(C=K[T.APP_SETTINGS.KEYS.WEBRTC_HOST],G[T.APP_SETTINGS.KEYS.ANALYTICS_HOST]=K[T.APP_SETTINGS.KEYS.ANALYTICS_HOST],G[T.APP_SETTINGS.KEYS.ANALYTICS_VERSION]=K[T.APP_SETTINGS.KEYS.ANALYTICS_VERSION],G[T.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED]=K[T.APP_SETTINGS.KEYS.ANALYTICS_PING_DISABLED],G[T.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL]=K[T.APP_SETTINGS.KEYS.ANALYTICS_USE_SSL],p=K[T.APP_SETTINGS.KEYS.REGION],a.isFalsy(o)||R.CallController.getInstance().setCallListner(o),a.isFalsy(s.appSettings))R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.NOT_INITIALIZED));else if(p)if(w)if((_=new J.RTCUser(w.getUid())).setName(w.getName()),_.setAvatar(w.getAvatar()),_.setResource(e.getSessionId()),e.appId)if(l=e.appId,"string"==typeof t){if(h){var b=h.getType();g=b===T.CallConstants.CALL_TYPE.AUDIO,i=h.getSessionId()}else{if(a.isFalsy(t))return void(R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.SESSION_ID_REQUIRED)));i=("v1."+p+"."+e.getAppId()+"."+t).toLowerCase()}if(!i)return void(R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.SESSION_ID_REQUIRED)));U=!!g;var B={uid:w.getUid(),sessionId:i};e.getJWT(B).then(function(e){e.hasOwnProperty("token")?(_.setJWT(e.token),r=(new k.CallSettingsBuilder).setSessionID(i).enableDefaultLayout(A).setIsAudioOnlyCall(g).setUser(_).setRegion(p).setAppId(l).setDomain(C).showEndCallButton(O).showMuteAudioButton(I).showPauseVideoButton(f).showScreenShareButton(N).showModeButton(y).setMode(M).setAnalyticsSettings(G).startWithAudioMuted(m).startWithVideoMuted(P).showRecordingButton(v).startRecordingOnCallStart(L).forceLegacyUI(D).showSwitchToVideoCallButton(U).setVirtualBackgroun
1d(u).showVirtualBackgroundSetting(Y).setMainVideoContainerSetting(S).build(),R.CallController.getInstance().startCall(r,n)):R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.JWT_NOT_FOUND))},function(e){R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(e))})}else{if(a.isFalsy(t))return void(R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.CALL_SETTINGS_REQUIRED)));if(h)g=(b=h.getType())===T.CallConstants.CALL_TYPE.AUDIO,i=h.getSessionId();else{if(g=t.isAudioOnlyCall(),a.isFalsy(t.getSessionId()))return void(R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.SESSION_ID_REQUIRED)));i=("v1."+p+"."+e.getAppId()+"."+t.getSessionId()).toLowerCase()}if(!i)return void(R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.SESSION_ID_REQUIRED)));A=t.isDefaultLayoutEnabled(),f=t.isPauseVideoButtonEnabled(),I=t.isMuteAudioButtonEnabled(),O=t.isEndCallButtonEnabled(),N=t.isScreenShareButtonEnabled(),M=t.getMode(),d=t.getLocalizedStringObject(),c=t.getCustomCSS(),y=t.isModeButtonEnabled(),m=t.getStartWithAudioMuted(),P=t.getStartWithVideoMuted(),v=t.isRecordingButtonEnabled(),L=t.shouldStartRecordingOnCallStart(),D=t.shouldUseLegacyUI(),U=!!g&&t.isAudioToVideoButtonEnabled(),u=t.getVirtualBackground(),Y=t.isVirtualBackgroundSettingEnabled(),S=t.getMainVideoContainerSetting(),B={uid:w.getUid(),sessionId:i},e.getJWT(B).then(function(e){e.hasOwnProperty("token")?(_.setJWT(e.token),r=(new k.CallSettingsBuilder).setSessionID(i).enableDefaultLayout(A).setIsAudioOnlyCall(g).setUser(_).setRegion(p).setAppId(l).setDomain(C).showEndCallButton(O).showMuteAudioButton(I).showPauseVideoButton(f).showScreenShareButton(N).showModeButton(y).setMode(M).setLocalizedStringObject(d).setCustomCSS(c).setAnalyticsSettings(G).startWithAudioMuted(m).startWithVideoMuted(P).showRecordingButton(v).startRecordingOnCallStart(L).forceLegacyUI(D).showSwitchToVideoCallButton(U).setVirtualBackground(u).showVirtualBackgroundSetting(Y).setMainVideoContainerSetting(S).build(),R.CallController.getInstance().startCall(r,n)):R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.JWT_NOT_FOUND))},function(e){R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(e))})}else R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.NOT_INITIALIZED));else R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.NOT_LOGGED_IN));else R.CallController.getInstance().getCallListner()&&R.CallController.getInstance().getCallListner()._eventListener.onError(new E.CometChatException(T.CALL_ERROR.NOT_INITIALIZED))},function(e){a.Logger.error("CometChat: startCall",e)})}catch(e){a.Logger.error("CometChat: startCall",e)}},e.getCallParticipantCount=function(t,n){return new Promise(function(o,s){try{a.getAppSettings().then(function(r){if(a.isFalsy(t))return s(new E.CometChatException(T.ProsodyApiErrors.INVALID_SESSIONID));if(a.isFalsy(n))return s(new E.CometChatException(T.ProsodyApiErrors.INVALID_TYPE));var u=r[T.APP_SETTINGS.KEYS.REGION],S={},p=r[T.APP_SETTINGS.KEYS.WEBRTC_HOST],l=r[T.APP_SETTINGS.KEYS.WEBRTC_API_SUBDOMAIN],C=a.format((new i.EndpointFactory).prosodyApi,l,p,T.PROSODY_API.PATH.ROOM_SIZE);"direct"===n.toLowerCase()&&(t=("v1."+u+"."+e.getAppId()+"."+t).toLowerCase()),S[T.PROSODY_API.QUERY_PARAMETERS.DOMAIN]=p,S[T.PROSODY_API.QUERY_PARAMETERS.ROOM]=t,c.postData(C,"GET",S,{},!1).then(function(e){return e.text()}).then(function(e){var t=e?JSON.parse(e):{};return t.hasOwnProperty(T.PROSODY_API.RESPONSE.PARTICIPANTS)?o(t[T.PROSODY_API.RESPONSE.PARTICIPANTS]):o(0)}).catch(function(){var e={error:O.FETCH_ERROR.ERROR_IN_API_CALL};return s(e)})},function(e){return s(new E.CometChatException(e))})}catch(e){return s(new E.CometChatException(e))}})},e.rejectIncomingCall=function(e){return new Promise(function(t,n){try{var o={};o[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.REJECTED,c.makeApiCall("updateCallSession",{sessionid:e},o).then(function(e){var n=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);t(n)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.cancelCall=function(e){var t=this;return new Promise(function(n,o){try{var s={};s[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.CANCELLED,c.makeApiCall("updateCallSession",{sessionid:e},s).then(function(o){var s=d.MessageController.trasformJSONMessge(o[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);t.getActiveCall().getSessionId()===e&&R.CallController.getInstance().endCallSession(),n(s)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.sendBusyResponse=function(e){return new Promise(function(t,n){try{var o={};o[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.BUSY,c.makeApiCall("updateCallSession",{sessionid:e},o).then(function(e){var n=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);t(n)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.sendUnansweredResponse=function(e){return new Promise(function(t,n){try{var o={};o[T.CallConstants.CALL_KEYS.CALL_STATUS]=T.CallConstants.CALL_STATUS.UNANSWERED,c.makeApiCall("updateCallSession",{sessionid:e},o).then(function(e){var n=d.MessageController.trasformJSONMessge(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);eT.publishCallMessage(n),t(n)},function(e){n(new E.CometChatException(e.error))})}catch(e){n(new E.CometChatException(e))}})},e.addConnectionListener=function(e,t){try{eh.addConnectionEventListener(e,t)}catch(e){a.Logger.error("CometChat: addConnectionListener",e)}},e.removeConnectionListener=function(e){try{eh.removeConnectionEventListener(e)}catch(e){a.Logger.error("CometChat: removeConnectionListener",e)}},e.addMessageListener=function(e,t){try{eh.addMessageEventListener(e,t)}catch(e){a.Logger.error("CometChat: addMessageListener",e)}},e.removeMessageListener=function(e){try{eh.removeMessageEventListener(e)}catch(e){a.Logger.error("CometChat: removeMessageListener",e)}},e.addCallListener=function(e,t){try{eh.addCallEventListener(e,t)}catch(e){a.Logger.error("CometChat: addCallListener",e)}},e.removeCallListener=function(e){try{eh.removeCallEventListener(e)}catch(e){a.Logger.error("CometChat: removeCallListener",e)}},e.addAIAssistantListener=function(e,t){try{eh.addAIAssistantListener(e,t)}catch(e){a.Logger.error("CometChat: addAIAssistantListener",e)}},e.removeAIAssistantListener=function(e){try{eh.removeAIAssistantListener(e)}catch(e){a.Logger.error("CometChat: removeAIAssistantListener",e)}},e.addUserListener=function(e,t){try{eh.addUserEventListener(e,t)}catch(e){a.Logger.error("CometChat: addUserListener",e)}},e.removeUserListener=function(e){try{eh.removeUserEventListener(e)}catch(e){a.Logger.error("CometChat: removeUserListener",e)}},e.addGroupListener=function(e,t){try{eh.addGroupEventListener(e,t)}catch(e){a.Logger.error("CometChat: addGroupListener",e)}},e.removeGroupListener=function(e){try{eh.removeGroupEventListener(e)}catch(e){a.Logger.error("CometChat: removeGroupListener",e)}},e.addLoginListener=function(e,t){try{eh.addLoginEventListener(e,t)}catch(e){a.Logger.error("CometChat: addLoginListener",e)}},e.removeLoginListener=function(e){try{eh.removeLoginEventListener(e)}catch(e){a.Logger.error("CometChat: removeLoginListener",e)}},e.generateAuthToken=function(t){var n=this;return new Promise(function(o,s){try{var r={},i="",u="",S=T.APPINFO.platform,p=T.APPINFO.sdkVersion,l=T.APPINFO.apiVersion;navigator&&(u=navigator.userAgent),e.keyStore.get(T.LOCAL_STORE.KEY_DEVICE_ID).then(function(a){if
1(null==(i=a)){var C=e_(),d=(new Date).getTime();i=n.appId+"_"+C+"_"+d,e.keyStore.set(T.LOCAL_STORE.KEY_DEVICE_ID,i)}r={platform:S,deviceId:i,appInfo:{version:p,apiVersion:l,userAgent:u}},c.makeApiCall("authToken",{uid:t},r).then(function(e){o(e.data)}).catch(function(e){s(new E.CometChatException(e.error))})},function(e){a.Logger.error("Got error while fetching data from key store",e)})}catch(e){s(new E.CometChatException(e))}})},e.tryReconnectingToWS=function(){e.WSReconnectionInProgress||e.startWSReconnectionTimer()},e.prototype.makeWSConnection=function(){e.WSLogin(e.user)},e.prototype.accidentallyDisconnected=function(){e.currentConnectionStatus=T.CONNECTION_STATUS.CONNECTING,eh.connectionHandlers.map(function(e){try{e._eventListener&&(a.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){a.Logger.error("ConnectionHandlers: inConnecting Status",e)}}),e.tryReconnectingToWS()},e.WSLogin=function(t){var n=this;eT.connection?a.Logger.error("CometChat :: WSLogin",eT.connection):eT.WSLogin(t.getJWT(),function(t){switch(t){case j.READY_STATE.CONNECTING:(o=e.getConnectionStatus())==T.CONNECTION_STATUS.DISCONNECTED&&(n.currentConnectionStatus=T.CONNECTION_STATUS.CONNECTING,eh.connectionHandlers.map(function(e){try{e._eventListener&&(a.isFalsy(e._eventListener.inConnecting)||e._eventListener.inConnecting())}catch(e){a.Logger.error("connectionHandlers: Connecting Status",e)}}));break;case j.READY_STATE.OPEN:(o=e.getConnectionStatus())==T.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=T.CONNECTION_STATUS.CONNECTED,eh.connectionHandlers.map(function(e){try{e._eventListener&&(a.isFalsy(e._eventListener.onConnected)||e._eventListener.onConnected())}catch(e){a.Logger.error("connectionHandlers: Connected Status",e)}})),e.WSReconnectionInProgress&&e.clearWSReconnectionTimer();break;case j.READY_STATE.CLOSING:break;case j.READY_STATE.CLOSED:var o;(o=e.getConnectionStatus())!==T.CONNECTION_STATUS.DISCONNECTED&&o!==T.CONNECTION_STATUS.CONNECTING&&(n.currentConnectionStatus=T.CONNECTION_STATUS.DISCONNECTED,eh.connectionHandlers.map(function(e){try{e._eventListener&&(a.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){a.Logger.error("connectionHandlers: Disconnected Status",e)}})),eT.connection&&(eT.connection=null),e.isLoggedOut||e.disconnectedByUser||n.tryReconnectingToWS()}})},e.pingAnalytics=function(){var t=this;try{e.keyStore.get("deviceId").then(function(n){a.getAppSettings().then(function(o){var s=null;window&&window.location&&window.location.origin&&(s=window.location.origin);var r="",i={version:T.SDKHeader.sdkVersion,apiVersion:o[T.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:s,uts:(new Date).getTime()};a.isFalsy(t.resource)||(i.resource=t.resource),a.isFalsy(t.platform)||(i.platform=t.platform),a.isFalsy(t.language)||(i.language=t.language),navigator&&(r=navigator.userAgent);var u={appInfo:i,uid:e.user.getUid(),userAgent:r,deviceId:n,platform:T.SDKHeader.platform};a.isFalsy(e.getSessionId())||(u.wsId=e.getSessionId());var S="https://"+o[T.APP_SETTINGS.KEYS.ANALYTICS_HOST]+"/"+o[T.APP_SETTINGS.KEYS.ANALYTICS_VERSION]+"/ping",p={appId:e.appId,sdk:a.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion),"Content-Type":"application/json"};e.settingsHash&&(p.settingsHash=e.settingsHash),e.settingsHashReceivedAt&&(p.settingsHashReceivedAt=e.settingsHashReceivedAt),e.jwt&&(p.Authorization="Bearer "+e.jwt),e.authToken&&(p.authToken=e.authToken),c.postData(S,"POST",u,p,!1).then(function(e){return e.json()}).then(function(n){if(n.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_DATA))a.Logger.log("Analytics Ping Request Data",n[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]);else if(n.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_ERROR)){var o=n[T.ResponseConstants.RESPONSE_KEYS.KEY_ERROR];a.Logger.log("Analytics Ping Request Error",new E.CometChatException(o));var s=o.code;if(s===T.Errors.ERR_SETTINGS_HASH_OUTDATED){var r=e.authToken;e.getInstance().internalRestart(r)}s===T.Errors.ERR_NO_AUTH&&t.updateJWT()}}).catch(function(e){a.Logger.error("CometChat: pingAnalytics Fetch Error",e)})},function(e){a.Logger.error("CometChat: pingAnalytics getSettings Error",e)})},function(e){a.Logger.error("CometChat: pingAnalytics getDeviceId Error",e)})}catch(e){a.Logger.error("CometChat: pingAnalytics",e)}},e.updateJWT=function(){c.makeApiCall("getMyDetails",{},{},!1).then(function(t){var n=t.data,o=n.settings,s=new u.Me(n);if(e.user=s,n.hasOwnProperty("jwt")&&n.jwt&&(e.jwt=n.jwt),S.LocalStorage.getInstance().set("user",s),o&&o[T.APP_SETTINGS.KEYS.SETTINGS_HASH]&&e.settingsHash!==o[T.APP_SETTINGS.KEYS.SETTINGS_HASH]){var r=e.getInstance().getAuthToken();e.getInstance().internalRestart(r)}a.Logger.log("CometChat: updateJWT response",t)},function(e){a.Logger.error("CometChat: updateJWT Fetch Error",e)}).catch(function(e){a.Logger.error("CometChat: updateJWT",e)})},e.startAnalyticsPingTimer=function(){var t=this;e.isAnalyticsPingStarted=!0,e.analyticsPingTimer=setInterval(function(){try{t.pingAnalytics()}catch(e){a.Logger.error("CometChat: startAnalyticsPingTimer",e)}},e.settingsInterval)},e.clearAnalyticsPingTimer=function(){try{e.isAnalyticsPingStarted=!1,clearInterval(e.anal
1yticsPingTimer)}catch(e){a.Logger.error("CometChat: clearAnalyticsPingTimer",e)}},e.startWSReconnectionTimer=function(){e.WSReconnectionInProgress=!0,e.WSReconnectionTimer=setInterval(function(){try{e.WSLogin(e.user)}catch(e){a.Logger.error("CometChat: startWSReconnectionTimer",e)}},e.WSReconnectionTimerInterval)},e.clearWSReconnectionTimer=function(){e.WSReconnectionInProgress=!1,clearInterval(e.WSReconnectionTimer)},e.getJWT=function(t){return new Promise(function(n,o){try{X.getEndPoint("getJWT").then(function(s){var r={appId:e.appId,Accept:"application/json",authToken:e.authToken,resource:e.getSessionId(),sdk:a.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion),"Content-Type":"application/json"},i={};i[T.JWT_API.KEYS.PASSTHROUGH]=t,c.postData(s.endpoint,s.method,i,r,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?n(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):o(new E.CometChatException(e.error))}).catch(function(e){var t={error:O.FETCH_ERROR.ERROR_IN_API_CALL};o(new E.CometChatException(t))})},function(e){o(new E.CometChatException(e))})}catch(e){o(new E.CometChatException(e))}})},e.getConnectionStatus=function(){return this.currentConnectionStatus},e.prototype.setConnectionStatus=function(t){e.currentConnectionStatus=t},e.isExtensionEnabled=function(e){return new Promise(function(t,n){try{if(a.isFalsy(e))return n(new E.CometChatException(T.ExtensionErrors.INVALID_EXTENSION));a.getAppSettings().then(function(o){if(o.extensions){var s=o.extensions;if(0<s.length){var r=s.some(function(t){return t.id===e});return t(r)}return t(!1)}return n(new E.CometChatException(T.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return n(new E.CometChatException(e))})}catch(e){return n(new E.CometChatException(e))}})},e.isAIFeatureEnabled=function(e){return new Promise(function(t,n){try{if(a.isFalsy(e))return n(new E.CometChatException(T.AIFeatureError.INVALID_AI_FEATURE));var o=T.AI_FEATURE_ACCESSIBLE,s=T.AI_FEATURE_ENABLED,r=a.format(T.AI_SLUG_ACCESSIBLE,e),i=a.format(T.AI_SLUG_ENABLED,e);a.getAppSettings().then(function(e){if(null==e?void 0:e.parameters){var n=null==e?void 0:e.parameters;return n[o]&&n[s]&&n[r]&&n[i]?t(!0):t(!1)}return t(!1)},function(e){return n(new E.CometChatException(e))})}catch(e){return n(new E.CometChatException(e))}})},e.getExtensionDetails=function(e){return new Promise(function(t,n){try{if(a.isFalsy(e))return n(new E.CometChatException(T.ExtensionErrors.INVALID_EXTENSION));a.getAppSettings().then(function(o){if(o.extensions){var s=o.extensions;if(0<s.length){var r=s.filter(function(t){return t.id===e});if(0<r.length){var i=new z.CCExtension(r[0]);return t(i)}}}return n(new E.CometChatException(T.ExtensionErrors.EXTENSION_NOT_FOUND))},function(e){return n(new E.CometChatException(e))})}catch(e){return n(new E.CometChatException(e))}})},e.getAppSettings=function(){return new Promise(function(e,t){try{c.makeApiCall("appSettings").then(function(t){S.LocalStorage.getInstance().set(T.LOCAL_STORE.KEY_APP_SETTINGS,t.data),e(t.data)},function(e){t(new E.CometChatException(e.error))})}catch(e){t(new E.CometChatException(e))}})},e.isFeatureEnabled=function(e){return new Promise(function(t,n){try{if(a.isFalsy(e))return n(new E.CometChatException(T.FeatureRestrictionErrors.INVALID_FEATURE));a.getAppSettings().then(function(o){if(o.parameters){var s=o.parameters;return s.hasOwnProperty(e)?t(s[e]):t(!1)}return n(new E.CometChatException(T.FeatureRestrictionErrors.FEATURE_NOT_FOUND))},function(e){return n(new E.CometChatException(e))})}catch(e){return n(new E.CometChatException(e))}})},e.logout=function(){var t=this;return new Promise(function(n,o){try{e.didAnalyticsPingStart()&&e.clearAnalyticsPingTimer(),e.WSReconnectionInProgress&&e.clearWSReconnectionTimer(),e.isLoggedOut=!0,e.WSReconnectionInProgress=!1,e.isAnalyticsDisabled=!1,c.makeApiCall("userLogout").then(function(o){t.clearCache().then(function(){e.apiKey=void 0,e.user=void 0,e.authToken=void 0,e.cometChat=void 0,e.mode=void 0,eT.WSLogout(),e.pushToLoginListener("","Logout_Success"),n(o.data)})},function(s){t.clearCache().then(function(){e.apiKey=void 0,e.user=void 0,e.authToken=void 0,e.cometChat=void 0,e.mode=void 0,eT.WSLogout(),e.pushToLoginListener("","Logout_Success"),new E.CometChatException(s.error).code==O.SERVER_ERRORS.AUTH_ERR.code?n({}):o(new E.CometChatException(s.error))})})}catch(e){o(new E.CometChatException(e))}})},e.callExtension=function(t,n,o,s){return void 0===s&&(s={}),new Promise(function(r,u){try{a.getAppSettings().then(function(S){var p=a.format((new i.EndpointFactory).extensionApi,t,S[T.APP_SETTINGS.KEYS.REGION],S[T.APP_SETTINGS.KEYS.EXTENSION_DOMAIN],o),l={appId:e.appId,Accept:"application/json",authToken:e.authToken,resource:e.getSessionId(),sdk:a.format(T.SDKHeader.sdk,T.SDKHeader.platform,T.SDKHeader.sdkVersion),chatApiVersion:S[T.APP_SETTINGS.KEYS.CHAT_API_VERSION],"Content-Type":"application/json"};e.jwt&&(l.Authorization="Bearer "+e.jwt),c.postData(p,n,s,l,!1).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty(T.ResponseConstants.RESPONSE_KEYS.KEY_DATA)?r(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]):u(new E.CometChatException(e.error))}).catch(function(e){var t={error:O.FETCH_ERROR.ERROR_IN_API_CALL};u(t)})},function(e){return u(new E.CometChatException(e))})}catch(e){return u(new E.CometChatException(e))}})},e.getConversationStarter=function(t,n,o){return new Promise(function(s,r){try{t=t.toLowerCase(),n=n.toLowerCase();var i=a.validateChatType(n);if(i instanceof E.CometChatException)return void r(i);var u=a.validateId(t,n);if(u instanceof E.CometChatException)return void r(u);var S={},p="";n===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(p="getGroupConversationStarter",S.guid=t):(p="getUserConversationStarter",S.uid=t);var l={uid:e.user.uid,name:e.user.name};S.onbehalfofuser=btoa(JSON.stringify(l)),c.makeApiCall(p,S,o||{}).then(function(e){return e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]?s(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_STARTER]):r(new E.CometChatException(T.AIErrors.NO_CONVERSATION_STARTER))},function(e){return r(new E.CometChatException(e.error))})}catch(e){return r(new E.CometChatException(e))}})},e.getSmartReplies=function(t,n,o){return new Promise(function(s,r){try{t=t.toLowerCase(),n=n.toLowerCase();var i=a.validateChatType(n);if(i instanceof E.CometChatException)return void r(i);var u=a.validateId(t,n);if(u instanceof E.CometChatException)return void r(u);var S={},p="";n===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(p="getGroupSmartReply",S.guid=t):(p="getUserSmartReply",S.uid=t);var l={uid:e.user.uid,name:e.user.name};S.onbehalfofuser=btoa(JSON.stringify(l)),c.makeApiCall(p,S,o||{}).then(function(e){return e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]?s(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_SMART_REPLIES]):r(new E.CometChatException(T.AIErrors.NO_SMART_REPLY))},function(e){return r(new E.CometChatException(e.error))})}catch(e){return r(new E.CometChatException(e))}})},e.askBot=function(t,n,o,s,r){return new Promise(function(i,u){try{var S={},p="";t=t.toLowerCase(),n=n.toLowerCase();var l=a.validateChatType(n);if(l instanceof E.CometChatException)return void u(l);var C=a.validateId(t,n);if(C instanceof E.CometChatException)return void u(C);var d=a.validateId(o,"bot");if(d instanceof E.CometChatException)return void u(d);S.botId=o,a.isFalsy(r)&&(r={});var _=a.validateQuestion(s);if(_ instanceof E.CometChatException)return void u(_);r.question=s,n===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(p="getBotAssistanceInGroupConversation",S.guid=t):(p="getBotAssistanceInUserConversation",S.uid=t);var h={uid:e.user.uid,name:e.user.name};S.onbehalfofuser=btoa(JSON.stringify(h)),c.makeApiCall(p,S,r).then(function(e){if(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY]){var t=e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_BOT_REPLY];return i(t.toString())}return u(new E.CometChatException(T.AIErrors.NO_ASSISTANCE))},function(e){return u(new E.CometChatException(e.error))})}catch(e){return u(new E.CometChatException(e))}})},e.getConversationSummary=function(t,n,o){return new Promise(function(s,r){try{t=t.toLowerCase(),n=n.toLowerCase();var i=a.validateChatType(n);if(i instanceof E.CometChatException)return void r(i);var u=a.validateId(t,n);if(u instanceof E.CometChatException)return void r(u);var S={},p="";n===T.MessageConstatnts.RECEIVER_TYPE.GROUP?(p="getGroupConversationSummary",S.guid=t):(p="getUserConversationSummary",S.uid=t);var l={uid:e.user.uid,name:e.user.name};S.onbehalfofuser=btoa(JSON.stringify(l)),c.makeApiCall(p,S,o||{}).then(function(e){if(e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA]&&e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY]){var t=e[T.ResponseConstants.RESPONSE_KEYS.KEY_DATA][T.ResponseConstants.RESPONSE_KEYS.KEY_CONVERSATION_SUMMARY];return s(t.toString())}return r(new E.CometChatException(T.AIErrors.NO_CONVERSATION_SUMMARY))},function(e){return r(new E.CometChatException(e.error))})}catch(e){return r(new E.CometChatException(e))}})},e.setSource=function(e,t,n){a.isFalsy(e)||(this.resource=e),a.isFalsy(t)||(this.platform=t),a.isFalsy(n)||(this.language=n)},e.setDemoMetaInfo=function(t){e.demoMetaInfo=t},e.clearCache=function(){return new Promise(function(t,n){try{S.LocalStorage.getInstance().clearStore().then(function(){e.removeDataFromSessionStorage(T.SESSION_STORE.SESSION_ID),a.Logger.info("CometChat: clearCache => All store cleared successfully","true"),t(!0)})}catch(e){a.Logger.error("CometChat: clearCache",e),n(e)}})},e.connect=function(){e.user&&(eT.connection||(e.disconnectedByUser=!1,e.WSLogin(e.user)),e.didAnalyticsPingStart()||e.isAnalyticsDisabled||(e.pingAnalytics(),e.startAnalyticsPingTimer()))},e.disconnect=function(){e.user&&(e.disconnectedByUser=!0,eT.connection&&eT.WSLogout(),e.didAnalyticsPingStart()&&e.clearAnalyticsPingTimer())},e.prototype.internalRestart=function(t){e.internalRestart||e.getInstance().internalLogout(!1).then(function(){e.internalRestart=!0,e.login(t).then(function(t){e.shouldConnectToWS=!0,e.internalRestart=!1},function(t){a.Logger.error("CometChat: internalRestart :: login",t),e.internalRestart=!1})},function(e){a.Logger.error("CometChat: internalRestart :: internalLogout",e)})},e.prototype.internalLogout=function(t){return void 0===t&&(t=!0),new Promise(function(n,o){try{e.didAnalyticsPingStart()&&e.clearAnalyticsPingTimer(),e.WSReconnectionInProgress&&e.clearWSReconnectionTimer(),e.isLoggedOut=!0,e.WSReconnectionInProgress=!1,e.isAnalyticsDisabled=!1,e.clearCache().then(function(){e.apiKey=void 0,e.user=void 0,e.authToken=void 0,e.cometChat=void 0,e.mode=void 0,eT.WSLogout(),t&&e.pushToLoginListener("","Logout_Success"),n(!0)})}catch(e){a.Logger.error("CometChat: internalLogout",e),o(e)}})},e.markAsInteracted=function(e,t){return new Promise(function(n,o){try{a.isFalsy(e)?o(new E.CometChatException(O.ERRORS.PARAMETER_MISSING)):c.makeApiCall("markInteracted",{messageId:e},{interactions:[t]}).then(function(e){var t;
1t=e&&e.data&&e.data.message?e.data.message:"Marked interacted",n(t)},function(e){o(new E.CometChatException(e.error))})}catch(e){o(new E.CometChatException(e))}})},e.getConversationUpdateSettings=function(){return s(this,void 0,void 0,function(){var e;return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,a.getAppSettings()];case 1:return e=t.sent(),[2,ea.ConversationUpdateSettings.fromJSON(e)];case 2:return t.sent(),[2,new ea.ConversationUpdateSettings];case 3:return[2]}})})},e.getFlagReasons=function(){return new Promise(function(e,t){try{a.getAppSettings().then(function(t){if(t&&t[T.APP_SETTINGS.KEYS.FLAG_REASONS]&&Array.isArray(t[T.APP_SETTINGS.KEYS.FLAG_REASONS])){var n=t[T.APP_SETTINGS.KEYS.FLAG_REASONS].map(function(e){return{id:e.id,name:e.name,description:e.description,createdAt:parseInt(e.createdAt),updatedAt:parseInt(e.updatedAt),default:!!e.hasOwnProperty("default")&&e.default}});e(n)}else e([])},function(e){t(new E.CometChatException(e))}).catch(function(e){t(new E.CometChatException(e))})}catch(e){t(new E.CometChatException(e))}})},e.flagMessage=function(e,t){var n=this;return new Promise(function(o,s){try{if(a.isFalsy(e))return void s(new E.CometChatException(O.ERRORS.PARAMETER_MISSING));a.isFalsy(t.reasonId)||n.getFlagReasons().then(function(r){r.find(function(e){return e.id===t.reasonId})?n.performFlagMessage(e,t,o,s):s(new E.CometChatException(O.ERRORS.INVALID_REASON_ID))},function(e){s(e)})}catch(e){s(new E.CometChatException(e))}})},e.performFlagMessage=function(e,t,n,o){var s={};t.reasonId&&(s.id=t.reasonId),t.remark&&(s.remark=t.remark),c.makeApiCall("flagMessage",{messageId:e},s,!1).then(function(e){(null==e?void 0:e.data)?n(null==e?void 0:e.data):n(e)},function(e){o(new E.CometChatException(e.error))}).catch(function(e){o(new E.CometChatException(e))})},e.AIAssistantBaseEvent=ec.AIAssistantBaseEvent,e.AIAssistantRunStartedEvent=ec.AIAssistantRunStartedEvent,e.AIAssistantRunFinishedEvent=ec.AIAssistantRunFinishedEvent,e.AIAssistantMessageStartedEvent=ec.AIAssistantMessageStartedEvent,e.AIAssistantMessageEndedEvent=ec.AIAssistantMessageEndedEvent,e.AIAssistantContentReceivedEvent=ec.AIAssistantContentReceivedEvent,e.AIAssistantToolStartedEvent=ec.AIAssistantToolStartedEvent,e.AIAssistantToolEndedEvent=ec.AIAssistantToolEndedEvent,e.AIAssistantToolArgumentEvent=ec.AIAssistantToolArgumentEvent,e.AIAssistantToolResultEvent=ec.AIAssistantToolResultEvent,e.AI_ASSISTANT_EVENTS=T.AI_ASSISTANT_EVENTS,e.GroupType=T.GroupType,e.GroupMemberScope=T.GroupMemberScope,e.ResponseConstants=T.ResponseConstants,e.CallConstants=T.CallConstants,e.ActionConstatnts=T.ActionConstatnts,e.CALL_ERROR=T.CALL_ERROR,e.MessageConstatnts=T.MessageConstatnts,e.APP_SETTINGS=T.APP_SETTINGS,e.GroupConstants=T.GroupConstants,e.TYPING_NOTIFICATION=T.TYPING_NOTIFICATION,e.PresenceConstatnts=T.PresenceConstatnts,e.PresenceConstants=T.PresenceConstants,e.APPINFO=T.APPINFO,e.UserConstants=T.UserConstants,e.GENERAL_ERROR=T.GENERAL_ERROR,e.ConversationErrors=T.ConversationErrors,e.LOCAL_STORE=T.LOCAL_STORE,e.SDKHeader=T.SDKHeader,e.Errors=T.Errors,e.SESSION_STORE=T.SESSION_STORE,e.REACTION_ACTION=T.REACTION_ACTION,e.ExtensionErrors=T.ExtensionErrors,e.FeatureRestrictionErrors=T.FeatureRestrictionErrors,e.WS=T.WS,e.JWT_API=T.JWT_API,e.PROSODY_API=T.PROSODY_API,e.ProsodyApiErrors=T.ProsodyApiErrors,e.ONLINE_MEMBER_COUNT_API=T.ONLINE_MEMBER_COUNT_API,e.ReceiptErrors=T.ReceiptErrors,e.ANALYTICS=T.ANALYTICS,e.API_ERROR_CODES=T.API_ERROR_CODES,e.ATTACHMENTS_CONSTANTS=T.ATTACHMENTS_CONSTANTS,e.BlockedUsersConstants=T.BlockedUsersConstants,e.CALLING_COMPONENT_VERSION=T.CALLING_COMPONENT_VERSION,e.COMMON_UTILITY_CONSTANTS=T.COMMON_UTILITY_CONSTANTS,e.DEFAULT_VALUES=T.DEFAULT_VALUES,e.DELIVERY_RECEIPTS=T.DELIVERY_RECEIPTS,e.GroupErrors=T.GroupErrors,e.GroupMemersConstans=T.GroupMemersConstans,e.MessageCategory=T.MessageCategory,e.MessageErrors=T.MessageErrors,e.PARAMETER_ERROR=T.PARAMETER_ERROR,e.READ_RECEIPTS=T.READ_RECEIPTS,e.UserErrors=T.UserErrors,e.constants=T.constants,e.GoalType=T.GoalType,e.AttachmentType=T.AttachmentType,e.ModerationStatus=T.ModerationStatus,e.initialzed=!1,e.CometChatException=E.CometChatException,e.TextMessage=C.TextMessage,e.MediaMessage=p.MediaMessage,e.CustomMessage=G.CustomMessage,e.BaseMessage=l.BaseMessage,e.Action=N.Action,e.Call=I.Call,e.TypingIndicator=U.TypingIndicator,e.TransientMessage=Q.TransientMessage,e.InteractiveMessage=Z.InteractiveMessage,e.InteractionGoal=$.InteractionGoal,e.Interaction=ee.Interaction,e.InteractionReceipt=et.InteractionReceipt,e.MessageReceipt=eE.MessageReceipt,e.AIAssistantMessage=eu.AIAssistantMessage,e.AIToolCall=ep.AIToolCall,e.AIToolCallFunction=ep.AIToolCallFunction,e.AIAssistantMessageData=eu.AIAssistantMessageData,e.AIToolResultMessage=eS.AIToolResultMessage,e.AIToolResultMessageData=eS.AIToolResultMessageData,e.AIToolArgumentMessage=ep.AIToolArgumentMessage,e.AIToolArgumentMessageData=ep.AIToolArgumentMessageData,e.Group=h.Group,e.User=u.User,e.GroupMember=w.GroupMember,e.Conversation=F.Conversation,e.ReactionCount=es.ReactionCount,e.ReactionEvent=er.ReactionEvent,e.Reaction=ei.Reaction,e.USER_STATUS={ONLINE:T.PresenceConstatnts.STATUS.ONLINE,OFFLINE:T.PresenceConstatnts.STATUS.OFFLINE},e.MessagesRequest=L.MessagesRequest,e.MessagesRequestBuilder=L.MessagesRequestBuilder,e.ReactionsRequest=eo.ReactionsRequest,e.ReactionsRequestBuilder=eo.ReactionsRequestBuilder,e.UsersRequest=M.UsersRequest,e.UsersRequestBuilder=M.UsersRequestBuilder,e.ConversationsRequest=v.ConversationsRequest,e.ConversationsRequestBuilder=v.ConversationsRequestBuilder,e.BlockedUsersRequest=K.BlockedUsersRequest,e.BlockedUsersRequestBuilder=K.BlockedUsersRequestBuilder,e.GroupsRequest=y.GroupsRequest,e.GroupsRequestBuilder=y.GroupsRequestBuilder,e.GroupMembersRequest=m.GroupMembersRequest,e.GroupMembersRequestBuilder=m.GroupMembersRequestBuilder,e.BannedMembersRequest=P.BannedMembersRequest,e.BannedMembersRequestBuilder=P.BannedMembersRequestBuilder,e.CallSettings=k.CallSettings,e.CallSettingsBuilder=k.CallSettingsBuilder,e.MainVideoContainerSetting=k.MainVideoContainerSetting,e.VirtualBackgroun
1d=k.VirtualBackground,e.VirtualBackgroundBuilder=k.VirtualBackgroundBuilder,e.AppSettings=b.AppSettings,e.AppSettingsBuilder=b.AppSettingsBuilder,e.MessageListener=f.MessageListener,e.UserListener=f.UserListener,e.GroupListener=f.GroupListener,e.OngoingCallListener=f.OngoingCallListener,e.CallListener=f.CallListener,e.ConnectionListener=f.ConnectionListener,e.LoginListener=f.LoginListener,e.AIAssistantListener=f.AIAssistantListener,e.CallController=R.CallController,e.CometChatHelper=B.CometChatHelper,e.Attachment=x.Attachment,e.MediaDevice=q.MediaDevice,e.StorageMode=T.StorageMode,e.MESSAGE_TYPE=T.MessageConstatnts.TYPE,e.CATEGORY_MESSAGE=T.MessageConstatnts.CATEGORY.MESSAGE,e.CATEGORY_ACTION=T.MessageConstatnts.CATEGORY.ACTION,e.CATEGORY_CALL=T.MessageConstatnts.CATEGORY.CALL,e.CATEGORY_CUSTOM=T.MessageConstatnts.CATEGORY.CUSTOM,e.CATEGORY_INTERACTIVE=T.MessageConstatnts.CATEGORY.INTERACTIVE,e.ACTION_TYPE=T.ActionConstatnts.ACTIONS,e.CALL_TYPE=T.CallConstants.CALL_TYPE,e.SORT_BY=T.UserConstants.SORT_BY,e.SORT_ORDER=T.UserConstants.SORT_ORDER,e.CALL_MODE=T.CallConstants.CALL_MODE,e.RECEIVER_TYPE=T.MessageConstatnts.RECEIVER_TYPE,e.CONNECTION_STATUS=T.CONNECTION_STATUS,e.CALL_STATUS=T.CallConstants.CALL_STATUS,e.GROUP_MEMBER_SCOPE=T.GROUP_MEMBER_SCOPE,e.GROUP_TYPE=T.GROUP_TYPE,e.MESSAGE_REQUEST=T.MessageConstatnts.PAGINATION.CURSOR_FILEDS,e.WSReconnectionInProgress=!1,e.WSReconnectionTimerInterval=5e3,e.currentConnectionStatus=T.CONNECTION_STATUS.DISCONNECTED,e.isConnectingFromInit=!1,e.loginInProgress=!1,e.internalRestart=!1,e.settingsInterval=6e4,e.isAnalyticsPingStarted=!1,e.isLoggedOut=!0,e.isAnalyticsDisabled=!1,e.disconnectedByUser=!1,e.shouldConnectToWS=!0,e}()},function(e,t,n){"use strict";var o=this&&this.__assign||function(){return(o=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(40),r=n(5),i=n(1),a=n(2),E=n(12),c=n(0);function u(e,t,n,o,s){var r;return void 0===e&&(e=""),void 0===t&&(t="GET"),void 0===n&&(n={}),void 0===o&&(o={}),n=i.isFalsy(n)?void 0:("GET"==t&&(e+="?",Object.keys(n).map(function(t,o){e=o===Object.keys(n).length-1?e+t+"="+n[t]:e+t+"="+n[t]+"&"}),n=void 0),s&&(r=new FormData,Object.keys(n).map(function(e){if("data"!=e){if("tags"==e)for(var t=0;t<n[e].length;t++)r.append(e+"[]",n[e][t]);else if("metadata"!=e)if("files"===e)for(t=0;t<n[e].length;t++)r.append(e+"[]",n[e][t]);else r.append(e,n[e])}else r.append(e,JSON.stringify(n[e]))})),JSON.stringify(n)),fetch(e,{method:t,mode:"cors",cache:"no-cache",headers:o,redirect:"follow",referrer:"no-referrer",body:s?r:n})}t.makeApiCall=function(e,t,n,S,p){void 0===e&&(e=""),void 0===t&&(t={}),void 0===n&&(n={});var l=r.CometChat.getInstance(r.CometChat.getAppId());return new Promise(function(C,d){try{s.getEndPoint(e,t).then(function(s){var a=o({resource:r.CometChat.getSessionId(),appId:r.CometChat.getAppId(),Accept:"application/json",sdk:i.format(c.SDKHeader.sdk,c.SDKHeader.platform,c.SDKHeader.sdkVersion)},p);S||(a["Content-Type"]="application/json"),s.hasOwnProperty("isAIApi")&&s.isAIApi&&(a.onbehalfofuser=t.onbehalfofuser),s.hasOwnProperty("isAdminApi")&&s.isAdminApi?l.getApiKey()?a.apiKey=l.getApiKey():d({error:{code:"API_KEY_NOT_SET",message:"An apiKey is needed to use the "+e+" api.",name:"API_KEY_NOT_SET"}}):l.getAuthToken()?a.authToken=l.getAuthToken():d({error:{code:"USER_NOT_LOGED_IN",message:"An authToken is need to use the "+e+" 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"}}),u(s.endpoint,s.method,n,a,S).then(function(e){return e.json()}).then(function(e){if(e.hasOwnProperty("data"))e.data.hasOwnProperty("authToken")&&r.CometChat.setAuthToken(e.data.authToken),C(e);else{if(e.hasOwnProperty("error")){var t=e.error;t.hasOwnProperty("code")&&t.code===c.API_ERROR_CODES.AUTH_ERR_AUTH_TOKEN_NOT_FOUND&&r.CometChat.getInstance().internalLogout().then(function(){i.Logger.log("CometChat: makeApiCall","User logged out")})}d(e)}}).catch(function(e){var t={error:E.FETCH_ERROR.ERROR_IN_API_CALL};d(t)})}).catch(function(e){return d})}catch(e){d(new a.CometChatException(e))}})},t.makeAdminApiCall=function(e,t,n,o){void 0===e&&(e=""),void 0===t&&(t={}),void 0===n&&(n={});var a=r.CometChat.getInstance(r.CometChat.getAppId());return new Promise(function(S,p){s.getEndPoint(e,t).then(function(t){var s={appId:r.CometChat.getAppId(),Accept:"application/json",sdk:i.format(c.SDKHeader.sdk,c.SDKHeader.platform,c.SDKHeader.sdkVersion)};o||(s["Content-Type"]="application/json"),t.hasOwnProperty("isAdminApi")&&t.isAdminApi?a.getApiKey()?s.apiKey=a.getApiKey():p({error:"An apiKey is need to use the "+e+" api."}):a.getAuthToken()?s.authToken=a.getAuthToken():p({error:"An authToken is need to use the "+e+" api."}),u(t.endpoint,t.method,n,s,o).then(function(e){return e.json()}).then(function(e){e.hasOwnProperty("data")?(e.data.hasOwnProperty("authToken")&&r.CometChat.setAuthToken(e.data.authToken),S(e)):p(e)}).catch(function(e){p({error:E.FETCH_ERROR.ERROR_IN_API_CALL})})}).catch(function(e){return p})})},t.postData=u},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.BaseMessage=void 0;var o=n(0),s=n(21),r=n(1);t.BaseMessage=function(){function e(e,t,n,o){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(){var e;return null!=(e=this.mentionedUsers)?e:[]},e.prototype.setHasMentionedMe=function(e){this.mentionedMe=e},e.prototype.hasMentionedMe=function(){var e;return null!=(e=this.mentionedMe)&&e},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(t){this.reactions=e}},e.prototype.getReactions=function(){var e;try{return this.getReactionsFromData()}catch(t){return null!=(e=this.reactions)?e:[]}},e.prototype.getQuotedMessageId=function(){return this.quotedMessageId},e.prototype.setQuotedMessageId=function(e){this.quotedMessageId=e},e.prototype.getQuotedMessage=function(){return this.quotedMessage},e.prototype.setQuotedMessage=function(e){this.quotedMessage=e},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(),t=[];return e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS]&&e[o.ResponseConstants.RESPONSE_KEYS.KEY_REACTIONS].forEac
1h(function(e){var n=new s.ReactionCount(e.reaction,e.count,!!e.reactedByMe&&e.reactedByMe);t.push(n)}),t}catch(e){throw r.Logger.error("BaseMessageModel: getReactionsFromData",e),e}},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Group=void 0;var o=n(0);t.Group=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatEvent=void 0;var o=n(1),s=n(4);t.CometChatEvent=function(){function e(e,t,n,s,r,i){o.isFalsy(e)||(this.appId=e),o.isFalsy(t)||(this.receiver=t),o.isFalsy(n)||(this.receiverType=n),o.isFalsy(r)||(this.deviceId=r),o.isFalsy(s)||(this.sender=s),o.isFalsy(i)||(this.messageSender=i)}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[s.KEYS.APP_ID]=this.getAppId(),e[s.KEYS.RECEIVER]=this.getReceiver(),e[s.KEYS.RECEIVER_TYPE]=this.getReceiverType(),e[s.KEYS.DEVICE_ID]=this.getDeviceId(),e[s.KEYS.TYPE]=this.getType(),e[s.KEYS.SENDER]=this.getSender(),o.isFalsy(this.getMessageSender())||(e[s.KEYS.MESSAGE_SENDER]=this.getMessageSender()),e},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AIAssistantBaseEvent=void 0,t.AIAssistantBaseEvent=function(){function e(e,t,n,o,s){this.type=e,this.conversationId=t,this.messageId=n,this.parentMessageId=o,this.data=s}return e.prototype.getType=function(){return this.type},e.prototype.setType=function(e){this.type=e},e.prototype.getConversationId=function(){return this.conversationId},e.prototype.setConversationId=function(e){this.conversationId=e},e.prototype.getMessageId=function(){return this.messageId},e.prototype.setMessageId=function(e){this.messageId=e},e.prototype.getPatentMessageId=function(){return this.parentMessageId},e.prototype.getParentMessageId=function(){return this.parentMessageId},e.prototype.setPatentMessageId=function(e){this.parentMessageId=e},e.prototype.setParentMessageId=function(e){this.parentMessageId=e},e.prototype.getData=function(){return this.data},e.prototype.setData=function(e){this.data=e},e.prototype.getTimestamp=function(){return this.data.timestamp},e.prototype.setTimestamp=function(e){this.data.timestamp=e},e.prototype.getRunId=function(){return this.data.runId},e.prototype.setRunId=function(e){this.data.runId=e},e.prototype.getThreadId=function(){return this.data.threadId},e.prototype.setThreadId=function(e){this.data.threadId=e}
1,e.prototype.toJSON=function(){return{type:this.type,conversationId:this.conversationId,messageId:this.messageId,parentMessageId:this.parentMessageId,data:this.data}},e.fromJSON=function(t){return new e(t.type,t.conversationId,t.messageId,t.parentMessageId,t.data)},e}()},function(e,t,n){(function(t){e.exports=(function e(t,n,o){function s(i,a){if(!n[i]){if(!t[i]){if(r)return r(i,!0);var E=Error("Cannot find module '"+i+"'");throw E.code="MODULE_NOT_FOUND",E}var c=n[i]={exports:{}};t[i][0].call(c.exports,function(e){return s(t[i][1][e]||e)},c,c.exports,e,t,n,o)}return n[i].exports}for(var r=!1,i=0;i<o.length;i++)s(o[i]);return s})({1:[function(e,n,o){(function(e){"use strict";var t,o,s=e.MutationObserver||e.WebKitMutationObserver;if(s){var r=0,i=new s(u),a=e.document.createTextNode("");i.observe(a,{characterData:!0}),t=function(){a.data=r=++r%2}}else if(e.setImmediate||void 0===e.MessageChannel)t="document"in e&&"onreadystatechange"in e.document.createElement("script")?function(){var t=e.document.createElement("script");t.onreadystatechange=function(){u(),t.onreadystatechange=null,t.parentNode.removeChild(t),t=null},e.document.documentElement.appendChild(t)}:function(){setTimeout(u,0)};else{var E=new e.MessageChannel;E.port1.onmessage=u,t=function(){E.port2.postMessage(0)}}var c=[];function u(){var e,t;o=!0;for(var n=c.length;n;){for(t=c,c=[],e=-1;++e<n;)t[e]();n=c.length}o=!1}n.exports=function(e){1!==c.push(e)||o||t()}}).call(this,void 0!==t?t:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],2:[function(e,t,n){"use strict";var o=e(1);function s(){}var r={},i=["REJECTED"],a=["FULFILLED"],E=["PENDING"];function c(e){if("function"!=typeof e)throw TypeError("resolver must be a function");this.state=E,this.queue=[],this.outcome=void 0,e!==s&&l(this,e)}function u(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(e,t,n){o(function(){var o;try{o=t(n)}catch(t){return r.reject(e,t)}o===e?r.reject(e,TypeError("Cannot resolve promise with itself")):r.resolve(e,o)})}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 l(e,t){var n=!1;function o(t){n||(n=!0,r.reject(e,t))}function s(t){n||(n=!0,r.resolve(e,t))}var i=C(function(){t(s,o)});"error"===i.status&&o(i.value)}function C(e,t){var n={};try{n.value=e(t),n.status="success"}catch(e){n.status="error",n.value=e}return n}(t.exports=c).prototype.catch=function(e){return this.then(null,e)},c.prototype.then=function(e,t){if("function"!=typeof e&&this.state===a||"function"!=typeof t&&this.state===i)return this;var n=new this.constructor(s);return this.state!==E?S(n,this.state===a?e:t,this.outcome):this.queue.push(new u(n,e,t)),n},u.prototype.callFulfilled=function(e){r.resolve(this.promise,e)},u.prototype.otherCallFulfilled=function(e){S(this.promise,this.onFulfilled,e)},u.prototype.callRejected=function(e){r.reject(this.promise,e)},u.prototype.otherCallRejected=function(e){S(this.promise,this.onRejected,e)},r.resolve=function(e,t){var n=C(p,t);if("error"===n.status)return r.reject(e,n.value);var o=n.value;if(o)l(e,o);else{e.state=a,e.outcome=t;for(var s=-1,i=e.queue.length;++s<i;)e.queue[s].callFulfilled(t)}return e},r.reject=function(e,t){e.state=i,e.outcome=t;for(var n=-1,o=e.queue.length;++n<o;)e.queue[n].callRejected(t);return e},c.resolve=function(e){return e instanceof this?e:r.resolve(new this(s),e)},c.reject=function(e){var t=new this(s);return r.reject(t,e)},c.all=function(e){var t=this;if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var n=e.length,o=!1;if(!n)return this.resolve([]);for(var i=Array(n),a=0,E=-1,c=new this(s);++E<n;)!function(e,s){t.resolve(e).then(function(e){i[s]=e,++a!==n||o||(o=!0,r.resolve(c,i))},function(e){o||(o=!0,r.reject(c,e))})}(e[E],E);return c},c.race=function(e){if("[object Array]"!==Object.prototype.toString.call(e))return this.reject(TypeError("must be an array"));var t=e.length,n=!1;if(!t)return this.resolve([]);for(var o,i=-1,a=new this(s);++i<t;)o=e[i],this.resolve(o).then(function(e){n||(n=!0,r.resolve(a,e))},function(e){n||(n=!0,r.reject(a,e))});return a}},{1:1}],3:[function(e,n,o){(function(t){"use strict";"function"!=typeof t.Promise&&(t.Promise=e(2))}).call(this,void 0!==t?t:"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},s=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 r(e,t){e=e||[],t=t||{};try{return new Blob(e,t)}catch(r){if("TypeError"!==r.name)throw r;for(var n="undefined"!=typeof BlobBuilder?BlobBuilder:"undefined"!=typeof MSBlobBuilder?MSBlobBuilder:"undefined"!=typeof MozBlobBuilder?MozBlobBuilder:WebKitBlobBuilder,o=new n,s=0;s<e.length;s+=1)o.append(e[s]);return o.getBlob(t.type)}}"undefined"==typeof Promise&&e(3);var i=Promise;function a(e,t){t&&e.then(function(e){t(null,e)},function(e){t(e)})}function E(e,t,n){"function"==typeof t&&e.then(t),"function"==typeof n&&e.catch(n)}function c(e){return"string"!=typeof e&&(e=String(e)),e}function u(){if(arguments.length&&"function"==typeof arguments[arguments.length-1])return arguments[arguments.length-1]}var S="local-forage-detect-blob-support",p=void 0,l={},C=Object.prototype.toString,d="readonly",_="readwrite";function T(e){var t=l[e.name],n={};n.promise=new i(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=l[e.name].deferredOperations.pop();if(t)return t.resolve(),t.promise}function g(e,t){var n=l[e.name].deferredOperations.pop();if(n)return n.reject(t),n.promise}function A(e,t){return new i(function(n,o){if(l[e.name]=l[e.name]||{forages:[],db:null,dbReady:null,deferredOperations:[]},e.db){if(!t)return n(e.db);T(e),e.db.close()}var r=[e.name];t&&r.push(e.version);var i=s.open.apply(s,r);t&&(i.onupgradeneeded=function(t){var n=i.result;try{n.createObjectStore(e.storeName),t.oldVersion<=1&&n.createObjectStore(S)}catch(e){if("ConstraintError"!==e.name)throw e}}),i.onerror=function(e){e.preventDefault(),o(i.error)},i.onsuccess=function(){var t=i.result;t.onversionchange=function(e){e.target.close()},n(t),h(e)}})}function f(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 I(e){return r([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))],{type:e.type})}function R(e){return e&&e.__local_forage_encoded_blob}function O(e){var t=this,n=t._initReady().then(function(){var e=l[t._dbInfo.name];if(e&&e.dbReady)return e.dbReady});return E(n,e,e),n}function N(e,t,n,o){void 0===o&&(o=1);try{var s=e.db.transaction(e.storeName,t);n(null,s)}catch(s){if(0<o&&(!e.db||"InvalidStateError"===s.name||"NotFoundError"===s.name))return i.resolve().then(function(){if(!e.db||"NotFoundError"===s.name&&!e.db.objectStoreNames.contains(e.storeName)&&e.version<=e.db.version)return e.db&&(e.version=e.db.version+1),A(e,!0)}).then(function(){return(function(e){T(e);for(var t=l[e.name],n=t.forages,o=0;o<n.length;o++){var s=n[o];s._dbInfo.db&&(s._dbInfo.db.close(),s._dbInfo.db=null)}return e.db=null,A(e,!1).then(function(t){return e.db=t,f(e)?A(e,!0):t}).then(function(o){e.db=t.db=o;for(var s=0;s<n.length;s++)n[s]._dbInfo.db=o}).catch(function(t){throw g(e,t),t})})(e).then(function(){N(e,t,n,o-1)})}).catch(n);n(s)}}var y={_driver:"asyncStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var o in e)n[o]=e[o];var s=l[n.name];s||(s={forages:[],db:null,dbReady:null,deferredOperations:[]},l[n.name]=s),s.forages.push(t),t._initReady||(t._initReady=t.ready,t.ready=O);var r=[];function a(){return i.resolve()}for(var E=0;E<s.forages.length;E++){var c=s.forages[E];c!==t&&r.push(c._initReady().catch(a))}var u=s.forages.slice(0);return i.all(r).then(function(){return n.db=s.db,A(n,!1)}).then(function(e){return n.db=e,f(n,t._defaultConfig.version)?A
1(n,!0):e}).then(function(e){n.db=s.db=e,t._dbInfo=n;for(var o=0;o<u.length;o++){var r=u[o];r!==t&&(r._dbInfo.db=n.db,r._dbInfo.version=n.version)}})},_support:function(){try{if(!s||!s.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(e,t){var n=this,o=new i(function(t,o){n.ready().then(function(){N(n._dbInfo,d,function(s,r){if(s)return o(s);try{var i=r.objectStore(n._dbInfo.storeName).openCursor(),a=1;i.onsuccess=function(){var n=i.result;if(n){var o=n.value;R(o)&&(o=I(o));var s=e(o,n.key,a++);void 0!==s?t(s):n.continue()}else t()},i.onerror=function(){o(i.error)}}catch(e){o(e)}})}).catch(o)});return a(o,t),o},getItem:function(e,t){var n=this;e=c(e);var o=new i(function(t,o){n.ready().then(function(){N(n._dbInfo,d,function(s,r){if(s)return o(s);try{var i=r.objectStore(n._dbInfo.storeName).get(e);i.onsuccess=function(){var e=i.result;void 0===e&&(e=null),R(e)&&(e=I(e)),t(e)},i.onerror=function(){o(i.error)}}catch(e){o(e)}})}).catch(o)});return a(o,t),o},setItem:function(e,t,n){var o=this;e=c(e);var s=new i(function(n,s){var a;o.ready().then(function(){var e;return a=o._dbInfo,"[object Blob]"===C.call(t)?(e=a.db,"boolean"==typeof p?i.resolve(p):new i(function(t){var n=e.transaction(S,_),o=r([""]);n.objectStore(S).put(o,"key"),n.onabort=function(e){e.preventDefault(),e.stopPropagation(),t(!1)},n.oncomplete=function(){var e=navigator.userAgent.match(/Chrome\/(\d+)/);t(navigator.userAgent.match(/Edge\//)||!e||43<=parseInt(e[1],10))}}).catch(function(){return!1}).then(function(e){return p=e})).then(function(e){return e?t:new i(function(e,n){var o=new FileReader;o.onerror=n,o.onloadend=function(n){e({__local_forage_encoded_blob:!0,data:btoa(n.target.result||""),type:t.type})},o.readAsBinaryString(t)})}):t}).then(function(t){N(o._dbInfo,_,function(r,i){if(r)return s(r);try{var a=i.objectStore(o._dbInfo.storeName);null===t&&(t=void 0);var E=a.put(t,e);i.oncomplete=function(){void 0===t&&(t=null),n(t)},i.onabort=i.onerror=function(){var e=E.error?E.error:E.transaction.error;s(e)}}catch(e){s(e)}})}).catch(s)});return a(s,n),s},removeItem:function(e,t){var n=this;e=c(e);var o=new i(function(t,o){n.ready().then(function(){N(n._dbInfo,_,function(s,r){if(s)return o(s);try{var i=r.objectStore(n._dbInfo.storeName).delete(e);r.oncomplete=function(){t()},r.onerror=function(){o(i.error)},r.onabort=function(){var e=i.error?i.error:i.transaction.error;o(e)}}catch(e){o(e)}})}).catch(o)});return a(o,t),o},clear:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){N(t._dbInfo,_,function(o,s){if(o)return n(o);try{var r=s.objectStore(t._dbInfo.storeName).clear();s.oncomplete=function(){e()},s.onabort=s.onerror=function(){var e=r.error?r.error:r.transaction.error;n(e)}}catch(e){n(e)}})}).catch(n)});return a(n,e),n},length:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){N(t._dbInfo,d,function(o,s){if(o)return n(o);try{var r=s.objectStore(t._dbInfo.storeName).count();r.onsuccess=function(){e(r.result)},r.onerror=function(){n(r.error)}}catch(e){n(e)}})}).catch(n)});return a(n,e),n},key:function(e,t){var n=this,o=new i(function(t,o){e<0?t(null):n.ready().then(function(){N(n._dbInfo,d,function(s,r){if(s)return o(s);try{var i=r.objectStore(n._dbInfo.storeName),a=!1,E=i.openKeyCursor();E.onsuccess=function(){var n=E.result;n?0===e||a?t(n.key):(a=!0,n.advance(e)):t(null)},E.onerror=function(){o(E.error)}}catch(e){o(e)}})}).catch(o)});return a(o,t),o},keys:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){N(t._dbInfo,d,function(o,s){if(o)return n(o);try{var r=s.objectStore(t._dbInfo.storeName).openKeyCursor(),i=[];r.onsuccess=function(){var t=r.result;t?(i.push(t.key),t.continue()):e(i)},r.onerror=function(){n(r.error)}}catch(e){n(e)}})}).catch(n)});return a(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n,o=this.config();if((e="function"!=typeof e&&e||{}).name||(e.name=e.name||o.name,e.storeName=e.storeName||o.storeName),e.name){var r=e.name===o.name&&this._dbInfo.db?i.resolve(this._dbInfo.db):A(e,!1).then(function(t){var n=l[e.name],o=n.forages;n.db=t;for(var s=0;s<o.length;s++)o[s]._dbInfo.db=t;return t});n=e.storeName?r.then(function(t){if(t.objectStoreNames.contains(e.storeName)){var n=t.ver
1sion+1;T(e);var o=l[e.name],r=o.forages;t.close();for(var a=0;a<r.length;a++){var E=r[a];E._dbInfo.db=null,E._dbInfo.version=n}return new i(function(t,o){var r=s.open(e.name,n);r.onerror=function(e){r.result.close(),o(e)},r.onupgradeneeded=function(){r.result.deleteObjectStore(e.storeName)},r.onsuccess=function(){var e=r.result;e.close(),t(e)}}).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(t){throw(g(e,t)||i.resolve()).catch(function(){}),t})}}):r.then(function(t){T(e);var n=l[e.name],o=n.forages;t.close();for(var r=0;r<o.length;r++)o[r]._dbInfo.db=null;return new i(function(t,n){var o=s.deleteDatabase(e.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)}}).then(function(e){n.db=e;for(var t=0;t<o.length;t++)h(o[t]._dbInfo)}).catch(function(t){throw(g(e,t)||i.resolve()).catch(function(){}),t})})}else n=i.reject("Invalid arguments");return a(n,t),n}},m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",P=/^~~local_forage_type~([^~]+)~/,M="__lfsc__:",v=M.length,L="arbf",D="blob",U=v+L.length,Y=Object.prototype.toString;function G(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=m.indexOf(e[t]),o=m.indexOf(e[t+1]),s=m.indexOf(e[t+2]),r=m.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 w(e){var t,n=new Uint8Array(e),o="";for(t=0;t<n.length;t+=3)o+=m[n[t]>>2],o+=m[(3&n[t])<<4|n[t+1]>>4],o+=m[(15&n[t+1])<<2|n[t+2]>>6],o+=m[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 K={serialize:function(e,t){var n="";if(e&&(n=Y.call(e)),e&&("[object ArrayBuffer]"===n||e.buffer&&"[object ArrayBuffer]"===Y.call(e.buffer))){var o,s=M;e instanceof ArrayBuffer?(o=e,s+=L):(o=e.buffer,"[object Int8Array]"===n?s+="si08":"[object Uint8Array]"===n?s+="ui08":"[object Uint8ClampedArray]"===n?s+="uic8":"[object Int16Array]"===n?s+="si16":"[object Uint16Array]"===n?s+="ur16":"[object Int32Array]"===n?s+="si32":"[object Uint32Array]"===n?s+="ui32":"[object Float32Array]"===n?s+="fl32":"[object Float64Array]"===n?s+="fl64":t(Error("Failed to get type for BinaryArray"))),t(s+w(o))}else if("[object Blob]"===n){var r=new FileReader;r.onload=function(){t(M+D+("~~local_forage_type~"+e.type+"~")+w(this.result))},r.readAsArrayBuffer(e)}else try{t(JSON.stringify(e))}catch(e){t(null,e)}},deserialize:function(e){if(e.substring(0,v)!==M)return JSON.parse(e);var t,n=e.substring(U),o=e.substring(v,U);if(o===D&&P.test(n)){var s=n.match(P);t=s[1],n=n.substring(s[0].length)}var i=G(n);switch(o){case L:return i;case D:return r([i],{type:t});case"si08":return new Int8Array(i);case"ui08":return new Uint8Array(i);case"uic8":return new Uint8ClampedArray(i);case"si16":return new Int16Array(i);case"ur16":return new Uint16Array(i);case"si32":return new Int32Array(i);case"ui32":return new Uint32Array(i);case"fl32":return new Float32Array(i);case"fl64":return new Float64Array(i);default:throw Error("Unkown type: "+o)}},stringToBuffer:G,bufferToString:w};function b(e,t,n,o){e.executeSql("CREATE TABLE IF NOT EXISTS "+t.storeName+" (id INTEGER PRIMARY KEY, key unique, value)",[],n,o)}function B(e,t,n,o,s,r){e.executeSql(n,o,s,function(e,i){i.code===i.SYNTAX_ERR?e.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name = ?",[t.storeName],function(e,a){a.rows.length?r(e,i):b(e,t,function(){e.executeSql(n,o,s,r)},r)},r):r(e,i)},r)}function F(e,t,n,o){var s=this;e=c(e);var r=new i(function(r,i){s.ready().then(function(){void 0===t&&(t=null);var a=t,E=s._dbInfo;E.serializer.serialize(t,function(t,c){c?i(c):E.db.transaction(function(n){B(n,E,"INSERT OR REPLACE INTO "+E.storeName+" (key, value) VALUES (?, ?)",[e,t],function(){r(a)},function(e,t){i(t)})},function(t){if(t.code===t.QUOTA_ERR){if(0<o)return void r(F.apply(s,[e,a,n,o-1]));i(t)}})})}).catch(i)});return a(r,n),r}var V={_driver:"webSQLStorage",_initStorage:function(e){var t=this,n={db:null};if(e)for(var o in e)n[o]="string"!=typeof e[o]?e[o].toString():e[o];var s=new i(function(e,o){try{n.db=openDatabase(n.name,String(n.version),n.description,n.size)}catch(e){return o(e)}n.db.transaction(function(s){b(s,n,function(){t._dbInfo=n,e()},function(e,t){o(t)})},o)});
1return n.serializer=K,s},_support:"function"==typeof openDatabase,iterate:function(e,t){var n=this,o=new i(function(t,o){n.ready().then(function(){var s=n._dbInfo;s.db.transaction(function(n){B(n,s,"SELECT * FROM "+s.storeName,[],function(n,o){for(var r=o.rows,i=r.length,a=0;a<i;a++){var E=r.item(a),c=E.value;if(c&&(c=s.serializer.deserialize(c)),void 0!==(c=e(c,E.key,a+1)))return void t(c)}t()},function(e,t){o(t)})})}).catch(o)});return a(o,t),o},getItem:function(e,t){var n=this;e=c(e);var o=new i(function(t,o){n.ready().then(function(){var s=n._dbInfo;s.db.transaction(function(n){B(n,s,"SELECT * FROM "+s.storeName+" WHERE key = ? LIMIT 1",[e],function(e,n){var o=n.rows.length?n.rows.item(0).value:null;o&&(o=s.serializer.deserialize(o)),t(o)},function(e,t){o(t)})})}).catch(o)});return a(o,t),o},setItem:function(e,t,n){return F.apply(this,[e,t,n,1])},removeItem:function(e,t){var n=this;e=c(e);var o=new i(function(t,o){n.ready().then(function(){var s=n._dbInfo;s.db.transaction(function(n){B(n,s,"DELETE FROM "+s.storeName+" WHERE key = ?",[e],function(){t()},function(e,t){o(t)})})}).catch(o)});return a(o,t),o},clear:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){B(t,o,"DELETE FROM "+o.storeName,[],function(){e()},function(e,t){n(t)})})}).catch(n)});return a(n,e),n},length:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){B(t,o,"SELECT COUNT(key) as c FROM "+o.storeName,[],function(t,n){e(n.rows.item(0).c)},function(e,t){n(t)})})}).catch(n)});return a(n,e),n},key:function(e,t){var n=this,o=new i(function(t,o){n.ready().then(function(){var s=n._dbInfo;s.db.transaction(function(n){B(n,s,"SELECT key FROM "+s.storeName+" WHERE id = ? LIMIT 1",[e+1],function(e,n){t(n.rows.length?n.rows.item(0).key:null)},function(e,t){o(t)})})}).catch(o)});return a(o,t),o},keys:function(e){var t=this,n=new i(function(e,n){t.ready().then(function(){var o=t._dbInfo;o.db.transaction(function(t){B(t,o,"SELECT key FROM "+o.storeName,[],function(t,n){for(var o=[],s=0;s<n.rows.length;s++)o.push(n.rows.item(s).key);e(o)},function(e,t){n(t)})})}).catch(n)});return a(n,e),n},dropInstance:function(e,t){t=u.apply(this,arguments);var n=this.config();(e="function"!=typeof e&&e||{}).name||(e.name=e.name||n.name,e.storeName=e.storeName||n.storeName);var o,s=this;return a(o=e.name?new i(function(t){var o;o=e.name===n.name?s._dbInfo.db:openDatabase(e.name,"","",0),t(e.storeName?{db:o,storeNames:[e.storeName]}:new i(function(e,t){o.transaction(function(n){n.executeSql("SELECT name FROM sqlite_master WHERE type='table' AND name <> '__WebKitDatabaseInfoTable__'",[],function(t,n){for(var s=[],r=0;r<n.rows.length;r++)s.push(n.rows.item(r).name);e({db:o,storeNames:s})},function(e,n){t(n)})},function(e){t(e)})}))}).then(function(e){return new i(function(t,n){e.db.transaction(function(o){for(var s=[],r=0,a=e.storeNames.length;r<a;r++)s.push(function(e){return new i(function(t,n){o.executeSql("DROP TABLE IF EXISTS "+e,[],function(){t()},function(e,t){n(t)})})}(e.storeNames[r]));i.all(s).then(function(){t()}).catch(function(e){n(e)})},function(e){n(e)})})}):i.reject("Invalid arguments"),t),o}};function x(e,t){var n=e.name+"/";return e.storeName!==t.storeName&&(n+=e.storeName+"/"),n}var k={_driver:"localStorageWrapper",_initStorage:function(e){var t={};if(e)for(var n in e)t[n]=e[n];return t.keyPrefix=x(e,this._defaultConfig),!function(){var e="_localforage_support_test";try{return localStorage.setItem(e,!0),localStorage.removeItem(e),!1}catch(e){return!0}}()||0<localStorage.length?((this._dbInfo=t).serializer=K,i.resolve()):i.reject()},_support:function(){try{return"undefined"!=typeof localStorage&&"setItem"in localStorage&&!!localStorage.setItem}catch(e){return!1}}(),iterate:function(e,t){var n=this,o=n.ready().then(function(){for(var t=n._dbInfo,o=t.keyPrefix,s=o.length,r=localStorage.length,i=1,a=0;a<r;a++){var E=localStorage.key(a);if(0===E.indexOf(o)){var c=localStorage.getItem(E);if(c&&(c=t.serializer.deserialize(c)),void 0!==(c=e(c,E.substring(s),i++)))return c}}});return a(o,t),o},getItem:function(e,t){var n=this;e=c(e);var o=n.ready().then(function(){var t=n._dbInfo,o=localStorage.getItem(t.keyPrefix+e);return o&&(o=t.serializer.deserialize(o)),o});return a(o,t),o},setItem:function(e,t,n){var o=this;e=c(e);var s=o.ready().then(function(){void 0===t&&(t=null);var n=t;return new i(function(s,r){var i=o._dbInfo;i.serializer.serialize(t,function(t,o){if(o)r(o);else try{localStorage.setItem(i.keyPrefix+e,t),s(n)}catch(e){"QuotaExceededError"!==e.name&&"NS_ERROR_DOM_QUOTA_REACHED"!==e.name||r(e),r(e)}})})});return a(s,n),s},removeItem:function(e,t){var n=this;e=c(e);var o=n.ready().then(function(){var t=n._dbInfo;localStorage.removeItem(t.keyPrefix+e)});return a(o,t),o},clear:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo.keyPrefix,n=localStorage.length-1;0<=n;n--){var o=localStorage.key(n);0===o.indexOf(e)&&localStorage.removeItem(o)}});return a(n,e),n},length:function(e){var t=this.keys().then(function(e){return e.length});return a(t,e),t},key:function(e,t){var n=this,o=n.ready().then(function(){var t,o=n._dbInfo;try{t=localStorage.key(e)}catch(e){t=null}return t&&(t=t.substring(o.keyPrefix.length)),t});return a(o,t),o},keys:function(e){var t=this,n=t.ready().then(function(){for(var e=t._dbInfo,n=localStorage.length,o=[],s=0;s<n;s++){var r=localStorage.key(s);0===r.indexOf(e.keyPrefix)&&o.push(r.substring(e.keyPrefix.length))}return o}
1);return a(n,e),n},dropInstance:function(e,t){if(t=u.apply(this,arguments),!(e="function"!=typeof e&&e||{}).name){var n=this.config();e.name=e.name||n.name,e.storeName=e.storeName||n.storeName}var o,s=this;return a(o=e.name?new i(function(t){t(e.storeName?x(e,s._defaultConfig):e.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)}}):i.reject("Invalid arguments"),t),o}},J=function(e,t){for(var n,o=e.length,s=0;s<o;){if((n=e[s])===t||"number"==typeof n&&"number"==typeof t&&isNaN(n)&&isNaN(t))return!0;s++}return!1},H=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},W={},j={},z={INDEXEDDB:y,WEBSQL:V,LOCALSTORAGE:k},X=[z.INDEXEDDB._driver,z.WEBSQL._driver,z.LOCALSTORAGE._driver],q=["dropInstance"],Q=["clear","getItem","iterate","key","keys","length","removeItem","setItem"].concat(q),Z={description:"",driver:X.slice(),name:"localforage",size:4980736,storeName:"keyvaluepairs",version:1};function $(){for(var e=1;e<arguments.length;e++){var t=arguments[e];if(t)for(var n in t)t.hasOwnProperty(n)&&(H(t[n])?arguments[0][n]=t[n].slice():arguments[0][n]=t[n])}return arguments[0]}t.exports=new(function(){function e(t){for(var n in function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")}(this,e),z)if(z.hasOwnProperty(n)){var o=z[n],s=o._driver;this[n]=s,W[s]||this.defineDriver(o)}this._defaultConfig=$({},Z),this._config=$({},this._defaultConfig,t),this._driverSet=null,this._initDriver=null,this._ready=!1,this._dbInfo=null,this._wrapLibraryMethodsWithReady(),this.setDriver(this._config.driver).catch(function(){})}return e.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 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 Error("Database version must be a number.");this._config[t]=e[t]}return!("driver"in e&&e.driver)||this.setDriver(this._config.driver)},e.prototype.defineDriver=function(e,t,n){var o=new i(function(t,n){try{var o=e._driver,s=Error("Custom driver not compliant; see https://mozilla.github.io/localForage/#definedriver");if(!e._driver)return void n(s);for(var r=Q.concat("_initStorage"),E=0,c=r.length;E<c;E++){var u=r[E];if((!J(q,u)||e[u])&&"function"!=typeof e[u])return void n(s)}for(var S=function(e){return function(){var t=Error("Method "+e+" is not implemented by the current driver"),n=i.reject(t);return a(n,arguments[arguments.length-1]),n}},p=0,l=q.length;p<l;p++){var C=q[p];e[C]||(e[C]=S(C))}var d=function(n){W[o],W[o]=e,j[o]=n,t()};"_support"in e?e._support&&"function"==typeof e._support?e._support().then(d,n):d(!!e._support):d(!0)}catch(e){n(e)}});return E(o,t,n),o},e.prototype.driver=function(){return this._driver||null},e.prototype.getDriver=function(e,t,n){var o=W[e]?i.resolve(W[e]):i.reject(Error("Driver not found."));return E(o,t,n),o},e.prototype.getSerializer=function(e){var t=i.resolve(K);return E(t,e),t},e.prototype.ready=function(e){var t=this,n=t._driverSet.then(function(){return null===t._ready&&(t._ready=t._initDriver()),t._ready});return E(n,e,e),n},e.prototype.setDriver=function(e,t,n){var o=this;H(e)||(e=[e]);var s=this._getSupportedDrivers(e);function r(){o._config.driver=o.driver()}function a(e){return o._extend(e),r(),o._ready=o._initStorage(o._config),o._ready}var c=null!==this._driverSet?this._driverSet.catch(function(){return i.resolve()}):i.resolve();return this._driverSet=c.then(function(){var e=s[0];return o._dbInfo=null,o._ready=null,o.getDriver(e).then(function(e){o._driver=e._driver,r(),o._wrapLibraryMethodsWithReady(),o._initDriver=function(){var e=0;return function t(){for(;e<s.length;){var n=s[e];return e++,o._dbInfo=null,o._ready=null,o.getDriver(n).then(a).catch(t)}r();var E=Error("No available storage method found.");return o._driverSet=i.reject(E),o._driverSet}()}})}).catch(function(){r();var e=Error("No available storage method found.");return o._driverSet=i.reject(e),o._driverSet}
1),E(this._driverSet,t,n),this._driverSet},e.prototype.supports=function(e){return!!j[e]},e.prototype._extend=function(e){$(this,e)},e.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},e.prototype._wrapLibraryMethodsWithReady=function(){for(var e=0,t=Q.length;e<t;e++)!function(e,t){e[t]=function(){var n=arguments;return e.ready().then(function(){return e[t].apply(e,n)})}}(this,Q[e])},e.prototype.createInstance=function(t){return new e(t)},e}())},{3:3}]},{},[4])(4)}).call(this,n(56))},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."},INVALID_REASON_ID:{code:"INVALID_REASON_ID",name:"Invalid reasonId provided."}},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 o=n(7),s=n(20),r=n(22),i=n(1),a=n(0),E=n(27),c=n(28),u=n(18),S=n(2),p=n(23),l=n(24),C=n(5),d=n(15),_=n(25),T=n(3),h=n(42),g=n(43),A=n(44);t.MessageController=function(){function e(){}return e.trasformJSONMessge=function(t){var n,S,d,T,f;try{var I=null,R=void 0;switch(t[a.MessageConstatnts.KEYS.CATEGORY]){case a.MessageConstatnts.CATEGORY.ACTION:R=E.Action.actionFromJSON(t);break;case a.MessageConstatnts.CATEGORY.CALL:R=c.Call.callFromJSON(t);break;case a.MessageConstatnts.CATEGORY.MESSAGE:switch(t[a.MessageConstatnts.KEYS.TYPE]){case a.MessageConstatnts.TYPE.TEXT:R=new s.TextMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.TEXT],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case a.MessageConstatnts.TYPE.CUSTOM:R=new l.CustomMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.CUSTOM_DATA],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;
1default:R=new r.MediaMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.URL],t[a.MessageConstatnts.KEYS.TYPE],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]),t.hasOwnProperty(a.MessageConstatnts.KEYS.DATA)&&((Y=t[a.MessageConstatnts.KEYS.DATA]).hasOwnProperty(a.MessageConstatnts.KEYS.ATTATCHMENTS)&&(Y[a.MessageConstatnts.KEYS.ATTATCHMENTS].map(function(e){U=new p.Attachment(e)}),R.setAttachment(U)),Y.hasOwnProperty(a.MessageConstatnts.KEYS.TEXT)&&R.setCaption(Y[a.MessageConstatnts.KEYS.TEXT])),R.hasOwnProperty("file")&&delete R.file}break;case a.MessageConstatnts.CATEGORY.CUSTOM:R=new l.CustomMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.CUSTOM_DATA],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE],t.type);break;case a.MessageConstatnts.CATEGORY.INTERACTIVE:R=new _.InteractiveMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE],t.type,t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.INTERACTIVE_DATA],t[a.MessageConstatnts.KEYS.DATA][a.MessageConstatnts.KEYS.INTERACTION_GOAL]);break;case a.MessageConstatnts.CATEGORY.AGENTIC:switch(t[a.MessageConstatnts.KEYS.TYPE]){case a.MessageConstatnts.TYPE.ASSISTANT:R=new h.AIAssistantMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case a.MessageConstatnts.TYPE.TOOL_ARGUMENTS:R=new A.AIToolArgumentMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]);break;case a.MessageConstatnts.TYPE.TOOL_RESULT:R=new g.AIToolResultMessage(t[a.MessageConstatnts.KEYS.RECEIVER],t[a.MessageConstatnts.KEYS.RECEIVER_TYPE])}}if((t[a.MessageConstatnts.KEYS.CATEGORY]===a.MessageConstatnts.CATEGORY.MESSAGE||t[a.MessageConstatnts.KEYS.CATEGORY]===a.MessageConstatnts.CATEGORY.CUSTOM)&&t[a.MessageConstatnts.KEYS.TYPE]!==a.MessageConstatnts.TYPE.TEXT&&(null==t?void 0:t[a.MessageConstatnts.KEYS.DATA])&&(null==(n=null==t?void 0:t[a.MessageConstatnts.KEYS.DATA])?void 0:n[a.MessageConstatnts.KEYS.ATTATCHMENTS])&&0!==(null==(d=null==(S=null==t?void 0:t[a.MessageConstatnts.KEYS.DATA])?void 0:S[a.MessageConstatnts.KEYS.ATTATCHMENTS])?void 0:d.length)&&(null==(T=C.CometChat.user)?void 0:T.getFat())&&C.CometChat.SECURED_MEDIA_HOST){var O=C.CometChat.SECURED_MEDIA_HOST,N=null==(f=C.CometChat.user)?void 0:f.getFat(),y=i.updatePropertiesWithDynamicValue(t,O,"?"+a.ADDITIONAL_CONSTANTS.SECURE_URL_PROPERTY+"="+N);y&&(t=y)}t[a.MessageConstatnts.KEYS.MY_RECEIPTS]&&(t[a.MessageConstatnts.KEYS.MY_RECEIPTS]=t[a.MessageConstatnts.KEYS.MY_RECEIPTS],Object.keys(t[a.MessageConstatnts.KEYS.MY_RECEIPTS]).map(function(e){var n=new u.MessageReceipt;e==a.DELIVERY_RECEIPTS.DELIVERED_AT&&(n.setReceiptType(n.RECEIPT_TYPE.DELIVERY_RECEIPT),n.setDeliveredAt(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.DELIVERY_RECEIPTS.DELIVERED_AT]),i.isFalsy(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.DELIVERY_RECEIPTS.RECIPIENT])?t[a.DELIVERY_RECEIPTS.DELIVERED_TO_ME_AT]=t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.DELIVERY_RECEIPTS.DELIVERED_AT]:n.setSender(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.DELIVERY_RECEIPTS.RECIPIENT]),n.setReceiverType(t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.setReceiver(t[a.MessageConstatnts.KEYS.RECEIVER])),t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.READ_RECEIPTS.READ_AT]&&(n.setReceiptType(n.RECEIPT_TYPE.READ_RECEIPT),n.setReadAt(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.READ_RECEIPTS.READ_AT]),i.isFalsy(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.READ_RECEIPTS.RECIPIENT])?t[a.READ_RECEIPTS.READ_BY_ME_AT]=t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.READ_RECEIPTS.READ_AT]:n.setSender(t[a.MessageConstatnts.KEYS.MY_RECEIPTS][a.READ_RECEIPTS.RECIPIENT]),n.setReceiverType(t[a.MessageConstatnts.KEYS.RECEIVER_TYPE]),n.setReceiver(t[a.MessageConstatnts.KEYS.RECEIVER]))}));try{if(Object.assign(R,t),(t=R).parentId&&(t.parentMessageId=t.parentId,delete t.parentId),t instanceof o.BaseMessage&&(i.isFalsy(I)||t.setRawMessage(I),t.quotedMessage&&(t.setQuotedMessageId(t.quotedMessage.id),t.setQuotedMessage(e.trasformJSONMessge(t.quotedMessage)))),t instanceof s.TextMessage)e.extractDetailsFromMentions(t),t.setSender(t.getSender()),t.setReceiver(t.getReceiver()),t.getData()[a.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(t.getData()[a.MessageConstatnts.KEYS.METADATA]);else if(t instanceof r.MediaMessage)e.extractDetailsFromMentions(t),t.getData()[a.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(t.getData()[a.MessageConstatnts.KEYS.METADATA]),t.setSender(t.getSender()),t.setReceiver(t.getReceiver());else if(t instanceof E.Action)t.setSender(t.getSender()),t.setReceiver(t.getActionFor()),t.setActionBy(t.getActionBy()),t.setActionOn(t.getActionOn()),t.setActionFor(t.getActionFor()),t.setMessage(t.getMessage());else if(t instanceof c.Call){try{t.setSender(t.getSender())}catch(e){i.Logger.error("MessageController: trasformJSONMessge: setSender",e)}try{t.setCallInitiator(t.getCallInitiator())}catch(e){i.Logger.error("MessageController: trasformJSONMessge: setCallInitiator",e)}try{t.setReceiver(t.getCallReceiver()),t.setCallReceiver(t.getCallReceiver())}catch(e){i.Logger.error("MessageController: trasformJSONMessge: setCallreceiver",e)}}else if(t instanceof l.CustomMessage)t.getData()[a.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(t.getData()[a.MessageConstatnts.KEYS.METADATA]),t.setCustomData(t.getData()[a.MessageConstatnts.KEYS.CUSTOM_DATA]),t.setSubType(t.getData()[a.MessageConstatnts.KEYS.CUSTOM_SUB_TYPE]),t.setSender(t.getSender()),t.setReceiver(t.getReceiver());else if(t instanceof _.InteractiveMessage)t.getData()[a.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(t.getData()[a.MessageConstatnts.KEYS.METADATA]),t.setInteractiveData(t.getData()[a.MessageConstatnts.KEYS.INTERACTIVE_DATA]),t.setInteractionGoal(t.getInteractionGoal()),t.setInteractions(t.getInteractions()),t.setSender(t.getSender()),t.setReceiver(t.getReceiver()),t.setIsSenderInteractionAllowed(t.getData()[a.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION]);else if(t instanceof h.AIAssistantMessage){if(t.setSender(t.getSender()),t.setReceiver(t.getReceiver()),t[a.MessageConstatnts.KEYS.DATA]){var m=(Y=t[a.MessageConstatnts.KEYS.DATA])[a.MessageConstatnts.KEYS.RUN_ID]||"",P=Y[a.MessageConstatnts.KEYS.THREAD_ID]||"",M=Y[a.MessageConstatnts.KEYS.TEXT]||"",v=new h.AIAssistantMessageData(m,P,M);t.setAssistantMessageData(v)}}else if(t instanceof g.AIToolResultMessage){if(t.setSender(t.getSender()),t.setReceiver(t.getReceiver()),t[a.MessageConstatnts.KEYS.DATA]){m=(Y=t[a.MessageConstatnts.KEYS.DATA])[a.MessageConstatnts.KEYS.RUN_ID]||"",P=Y[a.MessageConstatnts.KEYS.THREAD_ID]||"",M=Y[a.MessageConstatnts.KEYS.TEXT]||"";var L=Y[a.MessageConstatnts.KEYS.TOOL_CALL_ID]||"",D=new g.AIToolResultMessageData(m,P,M,L);t.setToolResultMessageData(D)}}else if(t instanceof A.AIToolArgumentMessage&&(t.setSender(t.getSender()),t.setReceiver(t.getReceiver()),t[a.MessageConstatnts.KEYS.DATA])){m=(Y=t[a.MessageConstatnts.KEYS.DATA])[a.MessageConstatnts.KEYS.RUN_ID]||"",P=Y[a.MessageConstatnts.KEYS.THREAD_ID]||"";var U,Y,G=A.AIToolCall.fromArray(Y[a.MessageConstatnts.KEYS.TOOL_CALLS]||[]),w=new A.AIToolArgumentMessageData(m,P,G);t.setToolArgumentMessageData(w)}t.hasOwnProperty("rawMessage")||(I=JSON.parse(JSON.stringify(t))),t instanceof o.BaseMessage&&(i.isFalsy(I)||t.setRawMessage(I))}catch(e){i.Logger.error("MessageController: trasformJSONMessge: Main",e),t=null}return t}catch(e){i.Logger.error("MessageController: trasformJSONMessge",e)}},e.extractDetailsFromMentions=function(e){if(e.getData()[a.MessageConstatnts.KEYS.MENTIONS]){var t=[],n=!1,o=C.CometChat.user,s=e.getData()[a.MessageConstatnts.KEYS.MENTIONS];for(var r in s)r.toString()==(null==o?void 0:o.getUid())&&(n=!0),t.push(new T.User(s[r]));e.setMentionedUsers(t),e.setHasMentionedMe(n)}},e.getReceiptsFromJSON=function(e){return new Promise(function(t,n){try{var o=[];C.CometChat.getLoggedInUser().then(function(n){i.isFalsy(e.receipts)?t([]):(e.receipts.data.map(function(t){var s=new u.MessageReceipt;t[a.DELIVERY_RECEIPTS.DELIVERED_AT]&&(s.setReceiptType(s.RECEIPT_TYPE.DELIVERY_RECEIPT),s.setDeliveredAt(t[a.DELIVERY_RECEIPTS.DELIVERED_AT]),s.setTimestamp(t[a.DELIVERY_RECEIPTS.DELIVERED_AT]),i.isFalsy(t[a.DELIVERY_RECEIPTS.RECIPIENT])?s.setSender(n):s.setSender(d.UsersController.trasformJSONUser(t[a.DELIVERY_RECEIPTS.RECIPIENT])),s.setReceiverType(e[a.MessageConstatnts.KEYS.RECEIVER_TYPE]),s.setReceiver(e[a.MessageConstatnts.KEYS.RECEIVER])),t[a.READ_RECEIPTS.READ_AT]&&(s.setReceiptType(s.RECEIPT_TYPE.READ_RECEIPT),s.setReadAt(t[a.READ_RECEIPTS.READ_AT]),s.setTimestamp(t[t[a.READ_RECEIPTS.READ_AT]]),i.isFalsy(t[a.READ_RECEIPTS.RECIPIENT])?s.setSender(n):s.setSender(d.UsersController.trasformJSONUser(t[a.READ_RECEIPTS.RECIPIENT])),s.setReceiverType(e[a.MessageConstatnts.KEYS.RECEIVER_TYPE]),s.setReceiver(e[a.MessageConstatnts.KEYS.RECEIVER])),o.push(s)}),t(o))})}catch(e){n(new S.CometChatException(e))}})},e}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Prom
1ise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.StorageManager=void 0;var r=n(11),i=n(1),a=n(0),E=n(39);t.StorageManager=function(){function e(){this.isInitialized=!1,this.storageInstances=new Map,this.storageMode=a.StorageMode.LOCAL,this.drivers=[]}return e.getInstance=function(){return e.instance||(e.instance=new e),e.instance},e.prototype.initialize=function(e){return void 0===e&&(e=a.StorageMode.LOCAL),o(this,void 0,void 0,function(){var t;return s(this,function(n){switch(n.label){case 0:if(this.isInitialized)return[2];n.label=1;case 1:return n.trys.push([1,3,,4]),this.storageMode=e,[4,E.getDriverForMode(e)];case 2:return t=n.sent(),this.drivers="session"===e?[t,r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL]:[r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL],this.isInitialized=!0,[3,4];case 3:return n.sent(),this.drivers=[r.LOCALSTORAGE,r.INDEXEDDB,r.WEBSQL],this.isInitialized=!0,[3,4];case 4:return[2]}})})},e.prototype.getStorage=function(e,t){if(!this.isInitialized)throw Error("StorageManager must be initialized before getting storage instances");var n=e+"_"+t;if(!this.storageInstances.has(n)){var o=r.createInstance({name:i.format(a.LOCAL_STORE.STORE_STRING,e,t)});o.setDriver(this.drivers),this.storageInstances.set(n,o)}return this.storageInstances.get(n)},e.prototype.isStorageInitialized=function(){return this.isInitialized},e.prototype.clearStorageInstances=function(){this.storageInstances.clear()},e.prototype.getStorageMode=function(){return this.storageMode},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersController=void 0;var o=n(3),s=n(1);t.UsersController=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}()},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"}
1,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){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.LocalStorage=void 0;var r=n(1),i=n(0),a=n(11),E=n(5),c=n(2),u=n(14);t.LocalStorage=function(){function e(e){this.store=i.constants.DEFAULT_STORE,this.initializationPromise=null,this.isInitialized=!1,r.isFalsy(e)||(this.store=e)}return e.prototype.initializeStorage=function(){return o(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:if(this.initializationPromise)return[2,this.initializationPromise];if(this.isInitialized&&this.localStore)return[2,Promise.resolve()];this.initializationPromise=this.doInitializeStorage(),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.initializationPromise];case 2:return t.sent(),this.isInitialized=!0,[3,4];case 3:throw e=t.sent(),this.initializationPromise=null,this.isInitialized=!1,e;case 4:return[2]}})})},e.prototype.doInitializeStorage=function(){var e;return o(this,void 0,void 0,function(){var t,n;return s(this,function(o){switch(o.label){case 0:if(this.localStore&&this.isInitialized)return[2];o.label=1;case 1:return o.trys.push([1,5,,7]),(t=u.StorageManager.getInstance()).isStorageInitialized()?(this.localStore=t.getStorage(E.CometChat.getAppId(),i.LOCAL_STORE.COMMON_STORE),[3,4]):[3,2];case 2:return n=(null==(e=E.CometChat.appSettings)?void 0:e.getStorageMode())||i.StorageMode.LOCAL,[4,t.initialize(n)];case 3:o.sent(),this.localStore=t.getStorage(E.CometChat.getAppId(),i.LOCAL_STORE.COMMON_STORE),o.label=4;case 4:return[3,7];case 5:return o.sent(),this.localStore=a.createInstance({name:r.format(i.LOCAL_STORE.STORE_STRING,E.CometChat.getAppId(),i.LOCAL_STORE.COMMON_STORE)}),[4,this.localStore.setDriver([a.LOCALSTORAGE,a.INDEXEDDB,a.WEBSQL])];case 6:return o.sent(),[3,7];case 7:return[2]}})})},e.getInstance=function(){return null==e.localStorage&&(e.localStorage=new e),e.localStorage},e.prototype.set=function(e,t){return o(this,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.initializeStorage()];case 1:return n.sent(),[2,this.localStore.setItem(e,JSON.stringify(t))]}})})},e.prototype.remove=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.localStore.removeItem(e)]}})})},e.prototype.update=function(e,t){return o(this,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.remove(e)
1];case 1:return n.sent(),[4,this.set(e,t)];case 2:return n.sent(),[2]}})})},e.prototype.get=function(e){return o(this,void 0,void 0,function(){var t=this;return s(this,function(n){return[2,new Promise(function(n,r){return o(t,void 0,void 0,function(){var t;return s(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return o.sent(),this.localStore.getItem(e).then(function(e){try{n(JSON.parse(e))}catch(t){n(e)}},function(e){r(e)}),[3,3];case 2:return t=o.sent(),r(new c.CometChatException(t)),[3,3];case 3:return[2]}})})})]})})},e.prototype.clearStore=function(){return o(this,void 0,void 0,function(){var e=this;return s(this,function(t){return[2,new Promise(function(t,n){return o(e,void 0,void 0,function(){var e=this;return s(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return o.sent(),this.localStore.keys().then(function(n){if(0<n.length)for(var o=0;o<n.length;o++)"appId"!==n[o]&&e.localStore.removeItem(n[o]);t(!0)}),[3,3];case 2:return n(o.sent()),[3,3];case 3:return[2]}})})})]})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.localStorage=null,e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MessageReceipt=void 0,t.MessageReceipt=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupsController=void 0;var o=n(8),s=n(0),r=n(1);t.GroupsController=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}()},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.TextMessage=void 0;var i=n(7),a=n(0),E=n(3),c=n(8),u=n(1);t.TextMessage=function(e){function t(t,n,o){var s=e.call(this,t,"text",o,a.MessageCategory.MESSAGE)||this;return s.type="text",s.data={text:n},s.text=n,s}return s(t,e),t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},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.getData=function(){return this.data},t.prototype.setData=function(e){this.data=e},t.prototype.getText=function(){return this.text},t.prototype.setText=function(e){this.text=e,this.data.text=e},t.prototype.setProcessedText=function(e){this.processedText=e},t.prototype.getProcessedText=function(){return this.processedText},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.getModerationStatus=function(){var e,t,n=null==(t=null==(e=this.data)?void 0:e.moderation)?void 0:t.status,o=Object.values(a.ModerationStatus);return n&&o.includes(n)?n:a.ModerationStatus.UNMODERATED},t.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}},t.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}},t.TYPE=a.MessageConstatnts.TYPE.TEXT,t.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=
1a.MessageConstatnts.CATEGORY.MESSAGE,t}(i.BaseMessage)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionCount=void 0;var o=n(1);t.ReactionCount=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}()},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.MediaMessage=void 0;var i=n(7),a=n(0),E=n(3),c=n(23),u=n(8),S=n(1);t.MediaMessage=function(e){function t(t,n,o,s){var r=e.call(this,t,o,s,a.MessageCategory.MESSAGE)||this;return r.data={},"object"!=typeof n?r.data={url:n}:n&&(0<n.length?r.files=n:r.files=[n]),r}return s(t,e),t.prototype.setCaption=function(e){this.caption=e,this.data[a.MessageConstatnts.KEYS.TEXT]=e},t.prototype.getCaption=function(){return this.data[a.MessageConstatnts.KEYS.TEXT]},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},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.getData=function(){return this.data},t.prototype.setData=function(e){this.data=e},t.prototype.getAttachment=function(){return new c.Attachment(this.data.attachments[0])},t.prototype.setAttachment=function(e){this.data.attachments=[c.Attachment.toJSON(e)]},t.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},t.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},t.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)}},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.getModerationStatus=function(){var e,t,n=null==(t=null==(e=this.data)?void 0:e.moderation)?void 0:t.status,o=Object.values(a.ModerationStatus);return n&&o.includes(n)?n:a.ModerationStatus.UNMODERATED},t.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}},t.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}},t.TYPE=a.MessageConstatnts.TYPE,t.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=
1a.MessageConstatnts.CATEGORY,t}(i.BaseMessage)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Attachment=void 0;var o=n(0);t.Attachment=function(){function e(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 e.prototype.createFileFromJSON=function(t){return new e(t)},e.toJSON=function(e){return{extension:e.getExtension(),mimeType:e.getMimeType(),name:e.getName(),url:e.getUrl(),size:e.getSize()}},e.prototype.getExtension=function(){return this.extension},e.prototype.setExtension=function(e){this.extension=e},e.prototype.getMimeType=function(){return this.mimeType},e.prototype.setMimeType=function(e){this.mimeType=e},e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){this.name=e},e.prototype.getSize=function(){return this.size},e.prototype.setSize=function(e){this.size=e},e.prototype.getUrl=function(){return this.url},e.prototype.setUrl=function(e){this.url=e},e}()},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),a=n(0),E=n(3),c=n(1),u=n(8);t.CustomMessage=function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=this;if(3==t.length){var s=t[0],r=t[1],i=t[2];o=e.call(this,s,a.MessageConstatnts.TYPE.CUSTOM,r,a.MessageCategory.MESSAGE)||this,("object"!=typeof i||Array.isArray(i))&&(i={}),o.customData=i,c.isFalsy(o.data)&&(o.data={}),o.data[a.MessageConstatnts.KEYS.CUSTOM_DATA]=i}if(4==t.length){s=t[0],r=t[1];var E=t[2];i=t[3],o=e.call(this,s,E,r,a.MessageCategory.CUSTOM)||this,("object"!=typeof i||Array.isArray(i))&&(i={}),o.customData=i,c.isFalsy(o.data)&&(o.data={}),o.data[a.MessageConstatnts.KEYS.CUSTOM_DATA]=i}return o}return s(t,e),t.prototype.getConversationText=function(){var e;return null!=(e=this.data.text)?e:""},t.prototype.setConversationText=function(e){this.data.text=e},t.prototype.willUpdateConversation=function(){var e;return null!=(e=this.data.updateConversation)&&e},t.prototype.shouldUpdateConversation=function(e){this.data.updateConversation=e},t.prototype.willSendNotification=function(){var e;return null!=(e=this.data.sendNotification)&&e},t.prototype.shouldSendNotification=function(e){this.data.sendNotification=e},t.prototype.getCustomData=function(){return this.customData},t.prototype.setCustomData=function(e){this.customData=e,this.data[a.MessageConstatnts.KEYS.CUSTOM_DATA]=e},t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},t.prototype.getSubType=function(){return this.subType},t.prototype.setSubType=function(e){this.subType=e,this.data=r(r({},this.data),{subType:e})},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.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 c.Logger.error("CustomMessageModel: getSenderFromData",e),e}},t.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 c.Logger.error("CustomMessageModel: getReceiverFromData",e),e}},t}(i.BaseMessage)},function(e,t,n){"use strict";
1var 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),a=n(0),E=n(3),c=n(1),u=n(8),S=n(41),p=n(26);t.InteractiveMessage=function(e){function t(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];var o=this;if(4==t.length){var s=t[0],r=t[1],i=t[2],E=t[3];(o=e.call(this,s,i,r,a.MessageCategory.INTERACTIVE)||this).interactionGoal=new S.InteractionGoal(a.GoalType.NONE,[]),("object"!=typeof E||Array.isArray(E))&&(E={}),o.interactiveData=E,o.interactions=[],c.isFalsy(o.data)&&(o.data={}),o.data[a.MessageConstatnts.KEYS.INTERACTIVE_DATA]=E,o.data[a.MessageConstatnts.KEYS.INTERACTION_GOAL]=new S.InteractionGoal(a.GoalType.NONE,[])}else if(5==t.length){s=t[0],r=t[1],i=t[2],E=t[3];var u=t[4];o=e.call(this,s,i,r,a.MessageCategory.INTERACTIVE)||this,("object"!=typeof E||Array.isArray(E))&&(E={}),("object"!=typeof u||Array.isArray(u))&&(u={}),o.interactiveData=E,o.interactionGoal=u,c.isFalsy(o.data)&&(o.data={}),o.data[a.MessageConstatnts.KEYS.INTERACTIVE_DATA]=E,o.data[a.MessageConstatnts.KEYS.INTERACTION_GOAL]=u,o.interactions=[]}return o}return s(t,e),t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getInteractiveData=function(){return this.interactiveData},t.prototype.setInteractiveData=function(e){this.interactiveData=e,this.data[a.MessageConstatnts.KEYS.INTERACTIVE_DATA]=e},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},t.prototype.getInteractionGoal=function(){try{return this.getInteractionGoalFromdata()}catch(e){return this.interactionGoal}},t.prototype.setInteractionGoal=function(e){this.interactionGoal=e,this.data=r(r({},this.data),{interactionGoal:e})},t.prototype.getInteractions=function(){try{return this.getInteractionsFromData()}catch(e){return this.interactions}},t.prototype.setInteractions=function(e){this.interactions=e;var t=a.MessageConstatnts.KEYS.INTERACTIONS;this.data[t]=e},t.prototype.getMetadata=function(){return this.metadata},t.prototype.setMetadata=function(e){this.metadata=e,this.data=r(r({},this.data),{metadata:e})},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.setIsSenderInteractionAllowed=function(e){this.allowSenderInteraction=e;var t=a.MessageConstatnts.KEYS.ALLOW_SENDER_INTERACTION;this.data[t]=e},t.prototype.getIsSenderInteractionAllowed=function(e){return this.allowSenderInteraction},t.prototype.getInteractionGoalFromdata=function(){try{var e=this.getData();if(e[a.MessageConstatnts.KEYS.INTERACTION_GOAL])return new S.InteractionGoal(e[a.MessageConstatnts.KEYS.INTERACTION_GOAL][a.MessageConstatnts.KEYS.TYPE],e[a.MessageConstatnts.KEYS.INTERACTION_GOAL][a.MessageConstatnts.KEYS.ELEMENT_IDS])}catch(e){throw c.Logger.error("InteractiveMessageModel: getFromData",e),e}},t.prototype.getInteractionsFromData=function(){try{var e=this.getData();if(e[a.MessageConstatnts.KEYS.INTERACTIONS])return(e[a.MessageConstatnts.KEYS.INTERACTIONS]||[]).map(function(e){return new p.Interaction(e[a.MessageConstatnts.KEYS.ELEMENT_ID],e[a.MessageConstatnts.KEYS.INTERACTED_AT])})}catch(e){throw c.Logger.error("InteractiveMessageModel: getFromData",e),e}},t.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 c.Logger.error("CustomMessageModel: getSenderFromData",e),e}},t.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 c.Logger.error("InteractiveMessageModel: getReceiverFromData",e),e}},t.TYPE=a.MessageConstatnts.TYPE,t.RECEIVER_TYPE=a.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=
1a.MessageConstatnts.CATEGORY,t}(i.BaseMessage)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Interaction=void 0;var o=n(0);t.Interaction=function(){function e(e,t){this.elementId=e,this.interactedAt=t}return e.prototype.getElementId=function(){return this.elementId},e.prototype.getInteractedAt=function(){return this.interactedAt},e.prototype.setElementId=function(e){this.elementId=e},e.prototype.setInteractedAt=function(e){this.interactedAt=this.interactedAt},e.getInteractionFromJSON=function(t){var n=t[o.MessageConstatnts.KEYS.INTERACTED_AT];return new e(t[o.MessageConstatnts.KEYS.ELEMENT_ID],n)},e}()},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),a=n(8),E=n(3),c=n(0),u=n(1),S=n(13);t.Action=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[c.MessageConstatnts.KEYS.RECEIVER],e[c.MessageConstatnts.KEYS.TYPE],e[c.MessageConstatnts.KEYS.RECEIVER_TYPE],c.MessageCategory.ACTION),n=e[c.MessageConstatnts.KEYS.DATA];if(t.data=n,t.setAction(n[c.MessageConstatnts.KEYS.ACTION]),n[c.ActionConstatnts.ACTION_KEYS.EXTRAS]){var o=n[c.ActionConstatnts.ACTION_KEYS.EXTRAS];if(o[c.ActionConstatnts.ACTION_KEYS.SCOPE]){var s=o[c.ActionConstatnts.ACTION_KEYS.SCOPE];s[c.ActionConstatnts.ACTION_KEYS.NEW]&&s[c.ActionConstatnts.ACTION_KEYS.OLD]&&(t.setOldScope(s[c.ActionConstatnts.ACTION_KEYS.OLD]),t.setNewScope(s[c.ActionConstatnts.ACTION_KEYS.NEW]))}}n[c.MessageConstatnts.KEYS.METADATA]&&t.setMetadata(n[c.MessageConstatnts.KEYS.METADATA]);var r=n[c.ActionConstatnts.ACTION_KEYS.ENTITIES];if(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY])if(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var i=new E.User(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY]);Object.assign(i,r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=i,t.setSender(i)}else{var u=new a.Group("","","");Object.assign(u,r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionBy=u}return r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR]&&(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][c.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.USER?(Object.assign(i=new E.User(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][c.ActionConstatnts.ACTION_KEYS.ENTITY]),r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=i):(Object.assign(u=new a.Group("","",""),r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_FOR][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionFor=u)),r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON]&&(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.USER?(Object.assign(i=new E.User(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY]),r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=i):r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.GROUP?(Object.assign(u=new a.Group("","",""),r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t.actionOn=u):r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEY
1S.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.MESSAGE&&(t.actionOn=S.MessageController.trasformJSONMessge(r[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_ON][c.ActionConstatnts.ACTION_KEYS.ENTITY]))),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 c.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_USER:case c.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP:switch(e.getAction()){case c.ActionConstatnts.ACTION_KEYS.ACTION_CREATED:case c.ActionConstatnts.ACTION_KEYS.ACTION_UPDATED:case c.ActionConstatnts.ACTION_KEYS.ACTION_DELETED:}break;case c.ActionConstatnts.ACTION_KEYS.ACTION_TYPE_GROUP_MEMBER:switch(e.getAction()){case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_JOINED:var n=e.getActionBy();t=u.format(c.ActionConstatnts.ActionMessages.ACTION_GROUP_JOINED_MESSAGE,n.getName());break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_LEFT:n=e.getActionBy(),t=u.format(c.ActionConstatnts.ActionMessages.ACTION_GROUP_LEFT_MESSAGE,n.getName());break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_KICKED:n=e.getActionBy();var o=e.getActionOn();t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MEMBER_KICKED_MESSAGE,n.getName(),o.getName());break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_BANNED:n=e.getActionBy(),o=e.getActionOn(),t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MEMBER_BANNED_MESSAGE,n.getName(),o.getName());break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_UNBANNED:n=e.getActionBy(),o=e.getActionOn(),t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MEMBER_UNBANNED_MESSAGE,n.getName(),o.getName());break;case c.ActionConstatnts.ACTION_KEYS.ACTION_SCOPE_CHANGED:n=e.getActionBy(),o=e.getActionOn();var s=e.getNewScope();t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MEMBER_SCOPE_CHANGED,n.getName(),o.getName(),s);break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MEMBER_ADDED:n=e.getActionBy(),o=e.getActionOn(),t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MEMBER_ADDED_TO_GROUP,n.getName(),o.getName());break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_EDITED:t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MESSAGE_EDITED_MESSAGE,"");break;case c.ActionConstatnts.ACTION_KEYS.TYPE_MESSAGE_DELETED:t=u.format(c.ActionConstatnts.ActionMessages.ACTION_MESSAGE_DELETED_MESSAGE,"")}}return t},t.prototype.getSenderFromData=function(){var e=this.data[c.ActionConstatnts.ACTION_KEYS.ENTITIES];if(e[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY]&&e[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY_TYPE]==c.ActionConstatnts.ACTION_ENTITY_TYPE.USER){var t=new E.User(e[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY]);return Object.assign(t,e[c.ActionConstatnts.ACTION_SUBJECTS.ACTION_BY][c.ActionConstatnts.ACTION_KEYS.ENTITY]),t}},t.TYPE=c.MessageConstatnts.TYPE,t.RECEIVER_TYPE=c.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=c.MessageConstatnts.CATEGORY,t.ACTION_TYPE=c.ActionConstatnts.ACTION_TYPE,t}(i.BaseMessage)},function(e,t,n){"use strict";
1var 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.Call=void 0;var i=n(7),a=n(8),E=n(0),c=n(1),u=n(3);t.Call=function(e){function t(t,n,o,s){return c.isFalsy(s)?e.call(this,t,n,o,E.MessageCategory.CALL)||this:e.call(this,t,n,o,s)||this}return s(t,e),t.prototype.getCallInitiator=function(){try{return this.getCallInitiatedByFromData()}catch(e){return this.callInitiator}},t.prototype.setCallInitiator=function(e){this.callInitiator=e},t.prototype.getCallReceiver=function(){try{return this.getCallReceivedByFromData()}catch(e){return this.callReceiver}},t.prototype.setCallReceiver=function(e){this.callReceiver=e},t.prototype.getData=function(){return this.data},t.prototype.setData=function(e){this.data=e},t.prototype.getSessionId=function(){return this.sessionId},t.prototype.setSessionId=function(e){this.sessionId=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.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getInitiatedAt=function(){return this.initiatedAt},t.prototype.setInitiatedAt=function(e){this.initiatedAt=e},t.prototype.getJoinedAt=function(){return this.joinedAt},t.prototype.setJoinedAt=function(e){this.joinedAt=e},t.prototype.getRawData=function(){return this.rawData},t.prototype.setRawData=function(e){this.rawData=e},t.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],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];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)}},t.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}},t.prototype.getCallInitiatedByFromData=function(){try{var e=this.getData();
1if((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}},t.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}},t.TYPE=E.MessageConstatnts.TYPE,t.RECEIVER_TYPE=E.MessageConstatnts.RECEIVER_TYPE,t.CATEGORY=E.MessageConstatnts.CATEGORY,t.ACTION_TYPE=E.ActionConstatnts.ACTION_TYPE,t}(i.BaseMessage)},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.KeyStore=void 0;var r=n(5),i=n(1),a=n(0),E=n(11),c=n(2),u=n(14);t.KeyStore=function(){function e(e){this.store=a.constants.DEFAULT_STORE,i.isFalsy(e)||(this.store=e)}return e.prototype.initializeStorage=function(){var e;return o(this,void 0,void 0,function(){var t,n;return s(this,function(o){switch(o.label){case 0:if(this.keyStore)return[2];o.label=1;case 1:return o.trys.push([1,5,,6]),(t=u.StorageManager.getInstance()).isStorageInitialized()?(this.keyStore=t.getStorage(r.CometChat.getAppId(),a.LOCAL_STORE.KEYS_STORE),[3,4]):[3,2];case 2:return n=(null==(e=r.CometChat.appSettings)?void 0:e.getStorageMode())||a.StorageMode.LOCAL,[4,t.initialize(n)];case 3:o.sent(),this.keyStore=t.getStorage(r.CometChat.getAppId(),a.LOCAL_STORE.KEYS_STORE),o.label=4;case 4:return[3,6];case 5:return o.sent(),this.keyStore=E.createInstance({name:i.format(a.LOCAL_STORE.STORE_STRING,r.CometChat.getAppId(),a.LOCAL_STORE.KEYS_STORE)}),this.keyStore.setDriver([E.LOCALSTORAGE,E.INDEXEDDB,E.WEBSQL]),[3,6];case 6:return[2]}})})},e.getInstance=function(){return null==e.KeyStore&&(e.KeyStore=new e),e.KeyStore},e.prototype.set=function(e,t){return o(this,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.initializeStorage()];case 1:return n.sent(),[2,this.keyStore.setItem(e,t)]}})})},e.prototype.remove=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.keyStore.removeItem(e)]}})})},e.prototype.get=function(e){var t=this;return new Promise(function(n,r){return o(t,void 0,void 0,function(){var t;return s(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return o.sent(),this.keyStore.getItem(e).then(function(e){try{n(JSON.parse(e))}catch(t){n(e)}},function(e){r(e)}),[3,3];case 2:return t=o.sent(),r(new c.CometChatException(t)),[3,3];case 3:return[2]}})})})},e.prototype.clearStore=function(){return o(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,this.initializeStorage()];case 1:return e.sent(),[2,this.keyStore.clear()]}})})},e}()},function(e,t,n){"use strict";
1var 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.WSConnectionListener=t.AssistantsListener=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.AIAssistantListener=t.CallListener=t.MessageListener=void 0;var r=n(1);t.MessageListener=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,this.onMessageModerated=void 0,this.onAIToolResultReceived=void 0,this.onAIToolArgumentsReceived=void 0,this.onAIAssistantMessageReceived=void 0,r.isFalsy(e[0].onTextMessageReceived)||(this.onTextMessageReceived=e[0].onTextMessageReceived),r.isFalsy(e[0].onMediaMessageReceived)||(this.onMediaMessageReceived=e[0].onMediaMessageReceived),r.isFalsy(e[0].onTypingStarted)||(this.onTypingStarted=e[0].onTypingStarted),r.isFalsy(e[0].onTypingEnded)||(this.onTypingEnded=e[0].onTypingEnded),r.isFalsy(e[0].onMessagesDelivered)||(this.onMessagesDelivered=e[0].onMessagesDelivered),r.isFalsy(e[0].onMessagesRead)||(this.onMessagesRead=e[0].onMessagesRead),r.isFalsy(e[0].onCustomMessageReceived)||(this.onCustomMessageReceived=e[0].onCustomMessageReceived),r.isFalsy(e[0].onMessageEdited)||(this.onMessageEdited=e[0].onMessageEdited),r.isFalsy(e[0].onMessageDeleted)||(this.onMessageDeleted=e[0].onMessageDeleted),r.isFalsy(e[0].onTransientMessageReceived)||(this.onTransientMessageReceived=e[0].onTransientMessageReceived),r.isFalsy(e[0].onInteractiveMessageReceived)||(this.onInteractiveMessageReceived=e[0].onInteractiveMessageReceived),r.isFalsy(e[0].onInteractionGoalCompleted)||(this.onInteractionGoalCompleted=e[0].onInteractionGoalCompleted),r.isFalsy(e[0].onMessageReactionAdded)||(this.onMessageReactionAdded=e[0].onMessageReactionAdded),r.isFalsy(e[0].onMessageReactionRemoved)||(this.onMessageReactionRemoved=e[0].onMessageReactionRemoved),r.isFalsy(e[0].onMessagesDeliveredToAll)||(this.onMessagesDeliveredToAll=e[0].onMessagesDeliveredToAll),r.isFalsy(e[0].onMessagesReadByAll)||(this.onMessagesReadByAll=e[0].onMessagesReadByAll),r.isFalsy(e[0].onMessageModerated)||(this.onMessageModerated=e[0].onMessageModerated),r.isFalsy(e[0].onAIToolResultReceived)||(this.onAIToolResultReceived=e[0].onAIToolResultReceived),r.isFalsy(e[0].onAIToolArgumentsReceived)||(this.onAIToolArgumentsReceived=e[0].onAIToolArgumentsReceived),r.isFalsy(e[0].onAIAssistantMessageReceived)||(this.onAIAssistantMessageReceived=e[0].onAIAssistantMessageReceived)},t.CallListener=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,r.isFalsy(e[0].onIncomingCallReceived)||(this.onIncomingCallReceived=e[0].onIncomingCallReceived),r.isFalsy(e[0].onOutgoingCallAccepted)||(this.onOutgoingCallAccepted=e[0].onOutgoingCallAccepted),r.isFalsy(e[0].onOutgoingCallRejected)||(this.onOutgoingCallRejected=e[0].onOutgoingCallRejected),r.isFalsy(e[0].onIncomingCallCancelled)||(this.onIncomingCallCancelled=e[0].onIncomingCallCancelled),r.isFalsy(e[0].onCallEndedMessageReceived)||(this.onCallEndedMessageReceived=e[0].onCallEndedMessageReceived)},t.AIAssistantListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.isFalsy(e[0].onAIAssistantEventReceived)||(this.onAIAssistantEventReceived=e[0].onAIAssistantEventReceived)},t.UserListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.isFalsy(e[0].onUserOnline)||(this.onUserOnline=e[0].onUserOnline),r.isFalsy(e[0].onUserOffline)||(this.onUserOffline=e[0].onUserOffline)},t.GroupListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.isFalsy(e[0].onGroupMemberJoined)||(this.onGroupMemberJoined=e[0].onGroupMemberJoined),r.isFalsy(e[0].onGroupMemberLeft)||(this.onGroupMemberLeft=e[0].onGroupMemberLeft),r.isFalsy(e[0].onGroupMemberKicked)||(this.onGroupMemberKicked=e[0].onGroupMemberKicked),r.isFalsy(e[0].onGroupMemberBanned)||(this.onGroupMemberBanned=e[0].onGroupMemberBanned),r.isFalsy(e[0].onGroupMemberUnbanned)||(this.onGroupMemberUnbanned=e[0].onGroupMemberUnbanned),r.isFalsy(e[0].onGroupMemberScopeChanged)||(this.onGroupMemberScopeChanged=e[0].onGroupMemberScopeChanged),r.isFalsy(e[0].onMemberAddedToGroup)||(this.onGroupMemberAddedToGroup=e[0].onMemberAddedToGroup)},t.OngoingCallListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.isFalsy(e[0].onYouLeft)||(this.onYouLeft=e[0].onYouLeft),r.isFalsy(e[0].onYouJoined)||(this.onYouJoined=e[0].onYouJoined),r.isFalsy(e[0].onUserJoined)||(this.onUserJoined=e[0].onUserJoined),r.isFalsy(e[0].onUserLeft)||(this.onUserLeft=e[0].onUserLeft),r.isFalsy(e[0].onUserListUpdated)||(this.onUserListUpdated=e[0].onUserListUpdated),r.isFalsy(e[0].onMediaDeviceListUpdated)||(this.onMediaDeviceListUpdated=e[0].onMediaDeviceListUpdated),r.isFalsy(e[0].onRecordingStarted)||(this.onRecordingStarted=e[0].onRecordingStarted),r.isFalsy(e[0].onRecordingStopped)||(this.onRecordingStopped=e[0].onRecordingStopped),r.isFalsy(e[0].onScreenShareStarted)||(this.onScreenShareStarted=e[0].onScreenShareStarted),r.isFalsy(e[0].onScreenShareStopped)||(this.onScreenShareStopped=e[0].onScreenShareStopped),r.isFalsy(e[0].onUserMuted)||(this.onUserMuted=e[0].onUserMuted),r.isFalsy(e[0].onCallSwitchedToVideo)||(this.onCallSwitchedToVideo=e[0].onCallSwitchedToVideo),r.isFalsy(e[0].onCallEnded)||(this.onCallEnded=e[0].onCallEnded),r.isFalsy(e[0].onError)||(this.onError=e[0].onError)},t.LoginListener=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];r.isFalsy(e[0].loginSuccess)||(this.loginSuccess=e[0].loginSuccess),r.isFalsy(e[0].loginFailure)||(this.loginFailure=e[0].loginFailure),r.isFalsy(e[0].logoutSuccess)||(this.logoutSuccess=e[0].logoutSuccess),r.isFalsy(e[0].logoutFailure)||(this.logoutFailure=e[0].logoutFailure)},t.ConnectionListener=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,r.isFalsy(e[0].onConnected)||(this.onConnected=e[0].onConnected),r.isFalsy(e[0].inConnecting)||(this.inConnecting=e[0].inConnecting),r.isFalsy(e[0].onDisconnected)||(this.onDisconnected=e[0].onDisconnected),r.isFalsy(e[0].onFeatureThrottled)||(this.onFeatureThrottled=e[0].onFeatureThrottled)};var i=function(e,t){this._name=e,this._callback=t},a=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(t.Listener=i);t.MessagesListener=a,t.UsersListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(i),t.GroupsListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(i),t.UserCallListener=function(e){function t(t,n,o){var s=e.call(this,"callListner",o)||this;return s._eventListener=t,s}return s(t,e),t}(i),t.CallsListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,r}return s(t,e),t}(i),t.UserLoginListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(i),t.AssistantsListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(i),t.WSConnectionListener=function(e){function t(t,n,o,s){var r=e.call(this,t,s)||this;return r._eventListener=n,o&&(r._cursor=o),r}return s(t,e),t}(i)},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationController=void 0;var o=n(49),s=n(1);t.ConversationController=function(){function e(){}return e.trasformJSONConversation=function(e,t,n,r,i,a,E,c,u){var S;void 0===u&&(u="");try{S=new o.Conversation(e,t,n,r,i,a,E,c,u)}catch(e){s.Logger.error("ConversationController:transformJSONConversation",e)}return S},e}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.MessageListnerMaping=void 0;var r=n(1),i=n(0),a=n(11),E=n(5),c=n(14);t.MessageListnerMaping=function(){function e(e){this.store=i.constants.DEFAULT_STORE,this.initializationPromise=null,this.isInitialized=!1,r.isFalsy(e)||(this.store=e)}return e.prototype.initializeStorage=function(){return o(this,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:if(this.initializationPromise)return[2,this.initializationPromise];if(this.isInitialized&&this.settingsStore)return[2,Promise.resolve()];t.label=1;case 1:return t.trys.push([1,3,,4]),this.initializationPromise=this.doInitializeStorage(),[4,this.initializationPromise];case 2:return t.sent(),this.isInitialized=!0,[3,4];case 3:throw e=t.sent(),this.initializationPromise=null,this.isInitialized=!1,e;case 4:return[2]}})})},e.prototype.doInitializeStorage=function(){var e;return o(this,void 0,void 0,function(){var t,n;return s(this,function(o){switch(o.label){case 0:if(this.settingsStore&&this.isInitialized)return[2];o.label=1;case 1:return o.trys.push([1,5,,7]),(t=c.StorageManager.getInstance()).isStorageInitialized()?(this.settingsStore=t.getStorage(E.CometChat.getAppId(),i.LOCAL_STORE.MESSAGE_LISTENERS_LIST),[3,4]):[3,2];case 2:return n=(null==(e=E.CometChat.appSettings)?void 0:e.getStorageMode())||i.StorageMode.LOCAL,[4,t.initialize(n)];case 3:o.sent(),this.settingsStore=t.getStorage(E.CometChat.getAppId(),i.LOCAL_STORE.MESSAGE_LISTENERS_LIST),o.label=4;case 4:return[3,7];case 5:return o.sent(),this.settingsStore=a.createInstance({name:r.format(i.LOCAL_STORE.STORE_STRING,E.CometChat.getAppId(),i.LOCAL_STORE.MESSAGE_LISTENERS_LIST)}),[4,this.settingsStore.setDriver([a.LOCALSTORAGE,a.INDEXEDDB,a.WEBSQL])];case 6:return o.sent(),[3,7];case 7:return[2]}})})},e.getInstance=function(){return null==e.settingsStore&&(e.settingsStore=new e),e.settingsStore},e.prototype.set=function(e,t){return o(this,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.initializeStorage()];case 1:return n.sent(),[2,this.settingsStore.setItem(e,t)]}})})},e.prototype.remove=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.settingsStore.removeItem(e)]}})})},e.prototype.get=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.settingsStore.getItem(e)]}})})},e.prototype.clearStore=function(){return o(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return[4,this.initializeStorage()];case 1:return e.sent(),[2,this.settingsStore.clear()]}})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.settingsStore=null,e}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TypingIndicator=void 0,t.TypingIndicator=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.AppSettingsBuilder=t.AppSettings=void 0;var o=n(0),s=function(){function e(t){this.subscriptionType=e.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.storageMode=o.StorageMode.LOCAL,this.subscriptionType=t.subscriptionType,this.roles=t.roles,this.region=t.region,this.autoJoinGroup=t.autoJoinGroup,this.establishSocketConnection=t.establishSocketConnection,this.adminHost=t.adminHost,this.clientHost=t.clientHost,this.storageMode=t.storageMode}return e.prototype.getSubscriptionType=function(){return this.subscriptionType},e.prototype.getRoles=function(){return this.roles},e.prototype.getRegion=function(){return this.region},e.prototype.getIsAutoJoinEnabled=function(){return this.autoJoinGroup},e.prototype.shouldAutoEstablishSocketConnection=function(){return this.establishSocketConnection},e.prototype.getAdminHost=function(){return this.adminHost},e.prototype.getClientHost=function(){return this.clientHost},e.prototype.getStorageMode=function(){return this.storageMode},e.SUBSCRIPTION_TYPE_NONE="NONE",e.SUBSCRIPTION_TYPE_ALL_USERS="ALL_USERS",e.SUBSCRIPTION_TYPE_ROLES="ROLES",e.SUBSCRIPTION_TYPE_FRIENDS="FRIENDS",e.REGION_EU=o.DEFAULT_VALUES.REGION_DEFAULT_EU,e.REGION_US=o.DEFAULT_VALUES.REGION_DEFAULT_US,e.REGION_IN=o.DEFAULT_VALUES.REGION_DEFAULT_IN,e.REGION_PRIVATE=o.DEFAULT_VALUES.REGION_DEFAULT_PRIVATE,e.STORAGE_MODE_LOCAL=o.StorageMode.LOCAL,e.STORAGE_MODE_SESSION=o.StorageMode.SESSION,e}();t.AppSettings=s,t.AppSettingsBuilder=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,this.storageMode=o.StorageMode.LOCAL}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.setStorageMode=function(e){return this.storageMode=e,this},e.prototype.build=function(){return new s(this)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Reaction=void 0;var o=n(3),s=n(1);t.Reaction=function(){function e(e,t,n,o,r,i){s.isFalsy(e)||(this.id=e),s.isFalsy(t)||(this.messageId=t),s.isFalsy(n)||(this.reaction=n),s.isFalsy(o)||(this.uid=o),s.isFalsy(r)||(this.reactedAt=r),s.isFalsy(i)||(this.reactedBy=i)}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}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TransientMessage=void 0,t.TransientMessage=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}()},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(98);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 o=n(1),s=n(0),r=n(17),i=n(5),a=n(2);t.EndpointFactory=function(){function e(){this.baseUrl="https://%s.apiclient-%s.cometchat.io/",this.apiVersion=s.APPINFO.apiVersion,this.adminApiUrl="https://%s.api-%s.cometchat.io/",this.adminApiVersion=s.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},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"},flagMessage:{endpoint:"messages/{{messageId}}/flagged",method:"POST"},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"},markGroupConversationAsRead:{endpoint:"groups/{{guid}}/conversation/read",method:"POST"},markUserConversationAsRead:{endpoint:"users/{{uid}}/conversation/read",method:"POST"},markGroupConversationAsDelivered:{endpoint:"groups/{{guid}}/conversation/delivered",method:"POST"},markUserConversationAsDelivered:{endpoint:"users/{{uid}}/conversation/delivered",method:"POST"},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(t){return new Promise(function(n,E){try{var c=i.CometChat.appSettings.getAdminHost(),u=i.CometChat.appSettings.getClientHost();r.LocalStorage.getInstance().get(s.LOCAL_STORE.KEY_APP_SETTINGS).then(function(r){if(o.isFalsy(r)){var a={};if((new e).uriEndpoints.hasOwnProperty(t))if((a=(new e).uriEndpoints[t]).hasOwnProperty("isAdminApi"))if(o.isFalsy(c)){var E=o.format((new e).adminApiUrl,i.CometChat.getAppId(),i.CometChat.appSettings.getRegion())+(new e).adminApiVersion+"/"+a.endpoint;a.endpoint=E,n(a)}else E="https://"+c+"/"+a.endpoint,a.endpoint=E,n(a);else E=o.isFalsy(u)?o.format((new e).baseUrl,i.CometChat.getAppId(),i.CometChat.appSettings.getRegion())+(new e).apiVersion+"/"+a.endpoint:"https://"+u+"/"+a.endpoint,a.endpoint=E,n(a)}else if(a={},(new e).uriEndpoints.hasOwnProperty(t))if((a=(new e).uriEndpoints[t]).hasOwnProperty("isAdminApi")){var S="https://"+r[s.APP_SETTINGS.KEYS.ADMIN_API_HOST]+"/"+r[s.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+a.endpoint;a.endpoint=S,n(a)}else S="https://"+r[s.APP_SETTINGS.KEYS.CLIENT_API_HOST]+"/"+r[s.APP_SETTINGS.KEYS.CHAT_API_VERSION]+"/"+a.endpoint,a.endpoint=S,n(a)},function(s){var r;if((new e).uriEndpoints.hasOwnProperty(t))if((r=(new e).uriEndpoints[t]).hasOwnProperty(["isAdminApi"]))if(o.isFalsy(c)){var a=o.format((new e).adminApiUrl,i.CometChat.getAppId(),i.CometChat.appSettings.getRegion())+(new e).adminApiVersion+"/"+r.endpoint;r.endpoint=a,n(r)}else r.endpoint="https://"+c+"/"+r.endpoint,n(r);else o.isFalsy(u)?(a=o.format((new e).baseUrl,i.CometChat.getAppId(),i.CometChat.appSettings.getRegion())+(new e).apiVersion+"/"+r.endpoint,r.endpoint=a):r.endpoint="https://"+u+"/"+r.endpoint,n(r)})}catch(e){E(new a.CometChatException(e))}})},e}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Prom
1ise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.migrateStorage=t.getDriverForMode=t.isStorageAvailable=t.registerSessionStorageDriver=void 0;var r=n(11),i=n(0),a=!1,E=null,c={_driver:"sessionStorageDriver",_initStorage:function(e){var t=this;return new Promise(function(n,o){try{if("undefined"==typeof sessionStorage)return void o(Error("SessionStorage is not available"));t._dbInfo={name:e.name,storeName:e.storeName},n()}catch(e){o(Error("SessionStorage initialization failed: "+(e instanceof Error?e.message:"Unknown error")))}})},_support:function(){return Promise.resolve("undefined"!=typeof sessionStorage)},_getFullKey:function(e){return this._dbInfo.name+"/"+e},getItem:function(e){var t=this;return new Promise(function(n){try{var o=t._getFullKey(e),s=sessionStorage.getItem(o);n(s?JSON.parse(s):null)}catch(e){n(null)}})},setItem:function(e,t){var n=this;return new Promise(function(o,s){try{var r=n._getFullKey(e);sessionStorage.setItem(r,JSON.stringify(t)),o(t)}catch(t){s(Error('Failed to store value for key "'+e+'": '+(t instanceof Error?t.message:"Unknown error")))}})},removeItem:function(e){var t=this;return new Promise(function(n){try{var o=t._getFullKey(e);sessionStorage.removeItem(o),n()}catch(e){n()}})},clear:function(){var e=this;return new Promise(function(t){try{for(var n=e._dbInfo.name+"/",o=[],s=0;s<sessionStorage.length;s++){var r=sessionStorage.key(s);r&&r.startsWith(n)&&o.push(r)}o.forEach(function(e){return sessionStorage.removeItem(e)}),t()}catch(e){t()}})},length:function(){var e=this;return new Promise(function(t){try{for(var n=e._dbInfo.name+"/",o=0,s=0;s<sessionStorage.length;s++){var r=sessionStorage.key(s);r&&r.startsWith(n)&&o++}t(o)}catch(e){t(0)}})},key:function(e){var t=this;return new Promise(function(n){try{for(var o=t._dbInfo.name+"/",s=[],r=0;r<sessionStorage.length;r++){var i=sessionStorage.key(r);i&&i.startsWith(o)&&s.push(i.substring(o.length))}n(e<s.length?s[e]:null)}catch(e){n(null)}})},keys:function(){var e=this;return new Promise(function(t){try{for(var n=e._dbInfo.name+"/",o=[],s=0;s<sessionStorage.length;s++){var r=sessionStorage.key(s);r&&r.startsWith(n)&&o.push(r.substring(n.length))}t(o)}catch(e){t([])}})},iterate:function(e){return new Promise(function(t){try{for(var n=void 0,o=0;o<sessionStorage.length;o++){var s=sessionStorage.key(o);if(s){var r=sessionStorage.getItem(s);if(null!==r)try{var i=JSON.parse(r);n=e(i,s,o)}catch(e){continue}}}t(n)}catch(e){t(void 0)}})}};function u(){return o(this,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:if(a)return[2,Promise.resolve()];if(!E)return[3,4];e.label=1;case 1:return e.trys.push([1,3,,4]),[4,E];case 2:return e.sent(),[2];case 3:return e.sent(),[3,4];case 4:return e.trys.push([4,6,,7]),[4,r.defineDriver(c)];case 5:return e.sent(),a=!0,[3,7];case 6:throw e.sent();case 7:return[2]}})})}function S(e){try{return e===i.StorageMode.LOCAL?"undefined"!=typeof localStorage:e===i.StorageMode.SESSION&&"undefined"!=typeof sessionStorage}catch(e){return!1}}function p(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return t.trys.push([0,4,,5]),e!==i.StorageMode.SESSION?[3,3]:S(i.StorageMode.SESSION)?[4,u()]:[2,r.LO
1CALSTORAGE];case 1:return t.sent(),[4,new Promise(function(e){return setTimeout(e,10)})];case 2:return t.sent(),S(i.StorageMode.SESSION)?[2,c._driver]:[2,r.LOCALSTORAGE];case 3:return[2,r.LOCALSTORAGE];case 4:return t.sent(),[2,r.LOCALSTORAGE];case 5:return[2]}})})}"undefined"==typeof window||E||(E=o(void 0,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),"undefined"==typeof sessionStorage?[3,2]:[4,r.defineDriver(c)];case 1:e.sent(),a=!0,e.label=2;case 2:return[3,4];case 3:return e.sent(),[2];case 4:return[2]}})})),t.registerSessionStorageDriver=u,t.isStorageAvailable=S,t.getDriverForMode=p,t.migrateStorage=function(e,t){return o(this,void 0,void 0,function(){var n,o,i,a,E,c,u,S,l,C;return s(this,function(s){switch(s.label){case 0:if(e===t)return[2];s.label=1;case 1:return s.trys.push([1,10,,11]),[4,p(e)];case 2:return n=s.sent(),[4,p(t)];case 3:return o=s.sent(),i=r.createInstance({name:"SDKStore_Migration_Source",driver:n}),a=r.createInstance({name:"SDKStore_Migration_Target",driver:o}),[4,i.keys()];case 4:E=s.sent(),c=0,u=E,s.label=5;case 5:return c<u.length?(S=u[c],[4,i.getItem(S)]):[3,9];case 6:return null===(l=s.sent())?[3,8]:[4,a.setItem(S,l)];case 7:s.sent(),s.label=8;case 8:return c++,[3,5];case 9:return[3,11];case 10:throw Error("Migration failed: "+((C=s.sent())instanceof Error?C.message:"Unknown error"));case 11:return[2]}})})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEndPoint=void 0;var o=n(38),s=n(2);t.getEndPoint=function(e,t){void 0===e&&(e=""),void 0===t&&(t={});var n=new o.EndpointFactory;return new Promise(function(o,r){try{n.getEndpointData(e).then(function(e){if(e){for(var n in t)e.endpoint=e.endpoint.replace("{{"+n+"}}",t[n]);o(e)}else r({error:"Unknown endPoint name."})})}catch(e){r(new s.CometChatException(e))}})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionGoal=void 0,t.InteractionGoal=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}()},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.AIAssistantMessage=t.AIAssistantMessageData=void 0;var r=n(7),i=n(0),a=n(3),E=n(1),c=n(8);t.AIAssistantMessageData=function(){function e(e,t,n){this.runId=e,this.threadId=t,this.text=n}return e.prototype.getRunId=function(){return this.runId},e.prototype.setRunId=function(e){this.runId=e},e.prototype.getThreadId=function(){return this.threadId},e.prototype.setThreadId=function(e){this.threadId=e},e.prototype.getText=function(){return this.text},e.prototype.setText=function(e){this.text=e},e}(),t.AIAssistantMessage=function(e){function t(t,n){var o=e.call(this,t,i.MessageConstatnts.TYPE.ASSISTANT,n,i.MessageCategory.AGENTIC)||this;return o.aiAssistantMessageData=void 0,o}return s(t,e),t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},t.prototype.getAssistantMessageData=function(){return this.aiAssistantMessageData},t.prototype.setAssistantMessageData=function(e){this.aiAssistantMessageData=e},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw E.Logger.error("AssistantMessageModel: getSenderFromData",e),e}},t.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new a.User(t);var n=new c.Group(t[i.GroupConstants.KEYS.GUID],t[i.GroupConstants.KEYS.NAME],t[i.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw E.Logger.error("AssistantMessageModel: getReceiverFromData",e),e}},t}(r.BaseMessage)},function(e,t,n){"use strict";
1var 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.AIToolResultMessage=t.AIToolResultMessageData=void 0;var r=n(7),i=n(0),a=n(3),E=n(1),c=n(8);t.AIToolResultMessageData=function(){function e(e,t,n,o){this.runId=e,this.threadId=t,this.text=n,this.toolCallId=o}return e.prototype.getRunId=function(){return this.runId},e.prototype.setRunId=function(e){this.runId=e},e.prototype.getThreadId=function(){return this.threadId},e.prototype.setThreadId=function(e){this.threadId=e},e.prototype.getText=function(){return this.text},e.prototype.setText=function(e){this.text=e},e.prototype.getToolCallId=function(){return this.toolCallId},e.prototype.setToolCallId=function(e){this.toolCallId=e},e}(),t.AIToolResultMessage=function(e){function t(t,n){var o=e.call(this,t,i.MessageConstatnts.TYPE.TOOL_RESULT,n,i.MessageCategory.AGENTIC)||this;return o.toolMessageData=void 0,o}return s(t,e),t.prototype.getSender=function(){try{return this.getSenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},t.prototype.getToolResultMessageData=function(){return this.toolMessageData},t.prototype.setToolResultMessageData=function(e){this.toolMessageData=e},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw E.Logger.error("ToolResultMessageModel: getSenderFromData",e),e}},t.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new a.User(t);var n=new c.Group(t[i.GroupConstants.KEYS.GUID],t[i.GroupConstants.KEYS.NAME],t[i.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw E.Logger.error("ToolResultMessageModel: getReceiverFromData",e),e}},t}(r.BaseMessage)},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.AIToolArgumentMessage=t.AIToolArgumentMessageData=t.AIToolCall=t.AIToolCallFunction=void 0;var r=n(7),i=n(0),a=n(3),E=n(1),c=n(8),u=function(){function e(e,t){this.name=e,this.arguments=t}return e.prototype.getName=function(){return this.name},e.prototype.setName=function(e){this.name=e},e.prototype.getArguments=function(){return this.arguments},e.prototype.setArguments=function(e){this.arguments=e},e}();t.AIToolCallFunction=u,t.AIToolCall=function(){function e(e,t,n,o,s){this.id=e,this.type=t,this.function=n,this.displayName=o,this.executionText=s}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.getFunction=function(){return this.function},e.prototype.setFunction=function(e){this.function=e},e.prototype.getDisplayName=function(){return this.displayName},e.prototype.setDisplayName=function(e){this.displayName=e},e.prototype.getExecutionText=function(){return this.executionText},e.prototype.setExecutionText=function(e){this.executionText=e},e.fromJSON=function(t){var n=t[i.MessageConstatnts.KEYS.ID]||"",o=t[i.MessageConstatnts.KEYS.TYPE]||"",s=t[i.MessageConstatnts.KEYS.FUNCTION][i.MessageConstatnts.KEYS.DISPLAY_NAME]||"",r=t[i.MessageConstatnts.KEYS.FUNCTION][i.MessageConstatnts.KEYS.EXECUTION_TEXT]||"";return new e(n,o,new u(t[i.MessageConstatnts.KEYS.FUNCTION][i.MessageConstatnts.KEYS.NAME]||"",t[i.MessageConstatnts.KEYS.FUNCTION][i.MessageConstatnts.KEYS.ARGUMENTS]||""),s,r)},e.fromArray=function(t){return 0===t.length?[]:t.map(function(t){return e.fromJSON(t)})},e}(),t.AIToolArgumentMessageData=function(){function e(e,t,n){this.runId=e,this.threadId=t,this.toolCalls=n}return e.prototype.getRunId=function(){return this.runId},e.prototype.setRunId=function(e){this.runId=e},e.prototype.getThreadId=function(){return this.threadId},e.prototype.setThreadId=function(e){this.threadId=e},e.prototype.getToolCalls=function(){return this.toolCalls},e.prototype.setToolCalls=function(e){this.toolCalls=e},e}(),t.AIToolArgumentMessage=function(e){function t(t,n){var o=e.call(this,t,i.MessageConstatnts.TYPE.TOOL_ARGUMENTS,n,i.MessageCategory.AGENTIC)||this;return o.aiToolArgumentMessageData=void 0,o}return s(t,e),t.prototype.getSender=function(){try{return this.get
1SenderFromData()}catch(e){return this.sender}},t.prototype.getReceiver=function(){try{return this.getReceiverFromData()}catch(e){return this.receiver}},t.prototype.getToolArgumentMessageData=function(){return this.aiToolArgumentMessageData},t.prototype.setToolArgumentMessageData=function(e){this.aiToolArgumentMessageData=e},t.prototype.getData=function(){return this.data},t.prototype.getTags=function(){return this.tags},t.prototype.setTags=function(e){this.tags=e},t.prototype.getSenderFromData=function(){try{var e=this.getData();if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])return new a.User(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.SENDER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY])}catch(e){throw E.Logger.error("AssistantMessageModel: getSenderFromData",e),e}},t.prototype.getReceiverFromData=function(){try{var e=this.getData(),t=e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITITY];if(e[i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITIES][i.MessageConstatnts.KEYS.RECEIVER][i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITYTYPE]==i.ResponseConstants.RESPONSE_KEYS.KEY_ENTITY_TYPE.USER)return new a.User(t);var n=new c.Group(t[i.GroupConstants.KEYS.GUID],t[i.GroupConstants.KEYS.NAME],t[i.MessageConstatnts.KEYS.TYPE]);return Object.assign(n,t)}catch(e){throw E.Logger.error("AssistantMessageModel: getReceiverFromData",e),e}},t}(r.BaseMessage)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.CallController=void 0;var o=n(0),s=n(1),r=n(5),i=n(2),a=n(30),E=n(46),c=n(3),u=n(6);t.CallController=function(){function e(){this.TAG="calling Log",this.CALL_NO_ANSWER_INTERVAL=45e3,this.view=void 0,this.isDev=!1}return e.prototype.getCallListner=function(){return e.callListner},e.prototype.setCallListner=function(t){e.callListner=new a.UserCallListener(t)},e.getInstance=function(){try{return null!=this.callController&&null!=this.callController||(this.callController=new e),this.callController}catch(e){s.Logger.error("CallController: getInstance",e)}},e.prototype.getActiveCall=function(){try{return s.isFalsy(this.call)?null:this.call}catch(e){s.Logger.error("CallController: getActiveCall",e)}},e.prototype.initiateCall=function(e){var t=this;return new Promise(function(n,r){try{s.isFalsy(t.call)?null!=e&&null!=e?(t.call=e,t.startCallTimer(),n(e)):r(new i.CometChatException(o.CALL_ERROR.ERROR_IN_CALLING)):r(new i.CometChatException(o.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){r(new i.CometChatException(e))}})},e.prototype.clearTimer=function(){this.timer&&this.stopCallTimer()},e.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){s.Logger.error("CallController: endCall",e)}},e.prototype.onCallStarted=function(e){var t=this;return new Promise(function(n,r){try{s.isFalsy(t.call)?null!=e&&null!=e?n(t.call=e):r(new i.CometChatException(o.CALL_ERROR.ERROR_IN_CALLING)):r(new i.CometChatException(o.CALL_ERROR.CALL_ALREADY_INITIATED))}catch(e){r(new i.CometChatException(e))}})},e.prototype.clearActiveCall=function(){this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer(),this.view=void 0,this.removeListener(),e.callScreen=null,e.callSettings=null},e.prototype.endCallSession=function(){try{this.call=void 0,e.callController=void 0,this.timer&&this.stopCallTimer(),this.view=void 0,this.removeListener(),e.callScreen=null,e.callSettings=null}catch(e){s.Logger.error("CallController:EndCallSession",{e:e})}},e.prototype.startCallTimer=function(){var e=this;try{this.timer=setTimeout(function(){e.call?r.CometChat.sendUnansweredResponse(e.call.getSessionId()).then(function(t){e.endCallSession()},function(t){e.endCallSession()}):e.endCallSession()},this.CALL_NO_ANSWER_INTERVAL)}catch(e){s.Logger.error("CallController: startCallTimer",e)}},e.prototype.stopCallTimer=function(){try{clearTimeout(this.timer)}catch(e){s.Logger.error("CallController: stopCallTimer",e)}},e.prototype.startCall=function(t,n){var o=this;try{this.timer&&this.stopCallTimer();var r=document.createElement("iframe");this.getCallUrl().then(function(s){r.src=s+"",r.name="frame",r.setAttribute("allow","camera; microphone; display-capture;"),r.setAttribute("width","100%"),r.setAttribute("height","100%"),e.callScreen=r,e.callSettings=t,n&&(o.view=n),n.appendChild(r),o.addListener()})}catch(e){s.Logger.error("CallController: startCall",e)}
1},e.prototype.addListener=function(){window.addEventListener("message",this.handler,!0)},e.prototype.removeListener=function(){window.removeEventListener("message",this.handler,!0)},e.prototype.handler=function(t){var n,i=this,a=e.callSettings,E=e.callScreen,S=e.getInstance().getActiveCall();try{if(void 0!==(n=JSON.parse(t.data))&&n.type==o.CallConstants.POST_MESSAGES.TYPES.HANGUP)e.deviceList=null,S?(s.Logger.info(this.TAG,e.callListner),window.setTimeout(function(){r.CometChat.endCall(S.getSessionId(),!0).then(function(e){s.Logger.info(i.TAG,{call:e})}).catch(function(e){s.Logger.info(i.TAG,"The Call Was Already Ended")})},1e3)):r.CometChat.endCall(a.getSessionId(),!0).then(function(e){s.Logger.info(i.TAG,{call:e})}).catch(function(e){s.Logger.info(i.TAG,"The Call Was Already Ended")});else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.USER_JOINED){if(n.value){var p=void 0,l=n.value;s.isFalsy(l.uid)||s.isFalsy(l.name)||((p=new c.User(l)).setStatus("online"),r.CometChat.user.getUid().toLowerCase()!=p.getUid().toLowerCase()&&e.callListner&&(s.isFalsy(e.callListner._eventListener.onUserJoined)||e.callListner._eventListener.onUserJoined(p)))}}else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.USER_LEFT)n.value&&(p=void 0,l=n.value,s.isFalsy(l.uid)||s.isFalsy(l.name)||((p=new c.User(l)).setStatus("online"),r.CometChat.user.getUid().toLowerCase()!=p.getUid().toLowerCase()&&e.callListner&&(s.isFalsy(e.callListner._eventListener.onUserLeft)||e.callListner._eventListener.onUserLeft(p))));else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.USER_LIST_CHANGED){var C=[];n.value&&0<n.value.length&&(n.value.map(function(e){if(!s.isFalsy(e.uid)&&!s.isFalsy(e.name)){var t=new c.User(e);t.setStatus("online"),C.push(t)}}),e.callListner&&(s.isFalsy(e.callListner._eventListener.onUserListUpdated)||e.callListner._eventListener.onUserListUpdated(C)))}else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.INITIAL_DEVICE_LIST)s.Logger.info("initialDeviceList received in SDK = ",n),n.value&&(e.deviceList=n.value);else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.DEVICE_CHANGE){if(s.Logger.info("onDeviceChange received in SDK = ",n),n.value){e.deviceList=n.value;var d=e.getAvailableDeviceObject(e.deviceList);e.callListner&&(s.isFalsy(e.callListner._eventListener.onMediaDeviceListUpdated)||e.callListner._eventListener.onMediaDeviceListUpdated(d))}}else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.RECORDING_TOGGLED){if(s.Logger.info("onRecordingToggled received in SDK = ",n),n.value&&(A=n.value).hasOwnProperty("user")&&A.hasOwnProperty("recordingStarted")&&!s.isFalsy(A.user.uid)&&!s.isFalsy(A.user.name)){var _=new c.User(A.user);_.setStatus("online");var T=A.recordingStarted;e.callListner&&(T?s.isFalsy(e.callListner._eventListener.onRecordingStarted)||e.callListner._eventListener.onRecordingStarted(_):s.isFalsy(e.callListner._eventListener.onRecordingStopped)||e.callListner._eventListener.onRecordingStopped(_))}}else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.USER_MUTED){if(s.Logger.info("onUserMuted received in SDK = ",n),n.value&&(A=n.value).hasOwnProperty("muted")&&A.hasOwnProperty("mutedBy")&&!s.isFalsy(A.muted.uid)&&!s.isFalsy(A.muted.name)&&!s.isFalsy(A.mutedBy.uid)&&!s.isFalsy(A.mutedBy.name)){var h=new c.User(A.muted);h.setStatus("online");var g=new c.User(A.mutedBy);g.setStatus("online"),e.callListner&&(s.isFalsy(e.callListner._eventListener.onUserMuted)||e.callListner._eventListener.onUserMuted(h,g))}}else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STARTED)e.callListner&&(s.isFalsy(e.callListner._eventListener.onScreenShareStarted)||e.callListner._eventListener.onScreenShareStarted(null));else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.SCREEN_SHARE_STOPPED)e.callListner&&(s.isFalsy(e.callListner._eventListener.onScreenShareStopped)||e.callListner._eventListener.onScreenShareStopped(null));else if(void 0!==n&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.SWITCHED_TO_VIDEO_CALL){if(n.value){var A=n.value;if(s.Logger.info("onCallSwitchedToVideo received in SDK = ",A),A.hasOwnProperty("initiator")&&A.hasOwnProperty("sessionId")&&!s.isFalsy(A.initiator.uid)&&!s.isFalsy(A.sessionId)&&A.hasOwnProperty("accepted")&&!s.isFalsy(A.accepted.uid)){var f=A.sessionId,I=new c.User(A.initiator);I.setStatus("online");var R=new c.User(A.accepted);if(R.setStatus("online"),e.getInstance().getCallListner()&&(s.isFalsy(e.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo)||e.getInstance().getCallListner()._eventListener.onCallSwitchedToVideo(f,I,R)),A.initiator.uid.toLowerCase()===r.CometChat.user.getUid().toLowerCase()&&!A.sessionId.includes("v1."))try{u.makeApiCall("updateCallType",{sessionid:f},{type:"video"}).then(function(e){s.Logger.log("response",e)},function(e){s.Logger.error("CallController :: onSwitchedToVideo",e)})}catch(e){s.Logger.error("CallController :: onSwitchedToVideo",e)}}}}else void 0!==n&&n.type&&n.action&&n.type==o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE&&n.action==o.CallConstants.POST_MESSAGES.ACTIONS.LOAD&&null!=E.contentWindow&&E.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.COMETCHAT_RTC_SETTINGS,callsettings:JSON.stringify(a)},"*")}catch(e){n=void 0,s.Logger.error("CallController: startCall",e)}
1},e.prototype.getCallUrl=function(){var e=this,t=void 0;return new Promise(function(n,r){try{e.isDev?(t="https://rtc-test.cometchat.io/?v="+o.CALLING_COMPONENT_VERSION,n(t)):s.getAppSettings().then(function(e){t="https://"+e[o.APP_SETTINGS.KEYS.WEBRTC_WEB_FRONTEND_HOST]+"/?v="+o.CALLING_COMPONENT_VERSION,n(t)})}catch(e){r(new i.CometChatException(e))}})},e.getAvailableDeviceArray=function(e){var t=[];try{return e&&0<e.length&&e.map(function(e){t.push(new E.MediaDevice(e.deviceId,e.label,e.active))}),t}catch(e){return s.Logger.error("CallController: getAvailableDeviceArray",e),t}},e.getAvailableDeviceObject=function(t){var n=[],r=[],i=[];try{return s.isFalsy(t)||s.isFalsy(t[o.CallConstants.AUDIO_INPUT_DEVICES])||(n=e.getAvailableDeviceArray(t[o.CallConstants.AUDIO_INPUT_DEVICES])),s.isFalsy(t)||s.isFalsy(t[o.CallConstants.AUDIO_OUTPUT_DEVICES])||(r=e.getAvailableDeviceArray(t[o.CallConstants.AUDIO_OUTPUT_DEVICES])),s.isFalsy(t)||s.isFalsy(t[o.CallConstants.VIDEO_INPUT_DEVICES])||(i=e.getAvailableDeviceArray(t[o.CallConstants.VIDEO_INPUT_DEVICES])),{audioInputDevices:n,audioOutputDevices:r,videoInputDevices:i}}catch(e){return s.Logger.error("CallController: getAvailableDeviceObject",e),{audioInputDevices:n,audioOutputDevices:r,videoInputDevices:i}}},e.prototype.getAudioInputDevices=function(){var t=[];try{return s.isFalsy(e.deviceList)||s.isFalsy(e.deviceList[o.CallConstants.AUDIO_INPUT_DEVICES])||(t=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.AUDIO_INPUT_DEVICES])),t}catch(e){return s.Logger.error("CallController: getAudioInputDevices",e),t}},e.prototype.getAudioOutputDevices=function(){var t=[];try{return s.isFalsy(e.deviceList)||s.isFalsy(e.deviceList[o.CallConstants.AUDIO_OUTPUT_DEVICES])||(t=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.AUDIO_OUTPUT_DEVICES])),t}catch(e){return s.Logger.error("CallController: getAudioOutputDevices",e),t}},e.prototype.getVideoInputDevices=function(){var t=[];try{return s.isFalsy(e.deviceList)||s.isFalsy(e.deviceList[o.CallConstants.VIDEO_INPUT_DEVICES])||(t=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.VIDEO_INPUT_DEVICES])),t}catch(e){return s.Logger.error("CallController: getVideoInputDevices",e),t}},e.prototype.setAudioInputDevice=function(t){try{if(e.callScreen&&!s.isFalsy(t)){var n=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.AUDIO_INPUT_DEVICES]).filter(function(e){return e[o.CallConstants.MEDIA_DEVICE.ID]===t&&!e[o.CallConstants.MEDIA_DEVICE.ACTIVE]});n&&0<n.length&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_INPUT,value:t},"*")}}catch(e){s.Logger.error("CallController: setAudioInputDevice",e)}},e.prototype.setAudioOutputDevice=function(t){try{if(e.callScreen&&!s.isFalsy(t)){var n=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.AUDIO_OUTPUT_DEVICES]).filter(function(e){return e[o.CallConstants.MEDIA_DEVICE.ID]===t&&!e[o.CallConstants.MEDIA_DEVICE.ACTIVE]});n&&0<n.length&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_AUDIO_OUTPUT,value:t},"*")}}catch(e){s.Logger.error("CallController: setAudioOutputDevice",e)}},e.prototype.setVideoInputDevice=function(t){try{if(e.callScreen&&!s.isFalsy(t)){var n=e.getAvailableDeviceArray(e.deviceList[o.CallConstants.VIDEO_INPUT_DEVICES]).filter(function(e){return e[o.CallConstants.MEDIA_DEVICE.ID]===t&&!e[o.CallConstants.MEDIA_DEVICE.ACTIVE]});n&&0<n.length&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.CHANGE_VIDEO_INPUT,value:t},"*")}}catch(e){s.Logger.error("CallController: setVideoInputDevice",e)}},e.prototype.muteAudio=function(t){try{e.callScreen&&(t?e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.MUTE_AUDIO},"*"):e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.UNMUTE_AUDIO},"*"))}catch(e){s.Logger.error("CallController: muteAudio",e)}},e.prototype.pauseVideo=function(t){try{e.callScreen&&(t?e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.PAUSE_VIDEO},"*"):e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.UNPAUSE_VIDEO},"*"))}catch(e){s.Logger.error("CallController: pauseVideo",e)}},e.prototype.setMode=function(t){try{e.callScreen&&!s.isFalsy(t)&&(t=t.toUpperCase(),-1<Object.values(o.CallConstants.CALL_MODE).indexOf(t)&&t!=o.CallConstants.CALL_MODE.SINGLE&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_MODE,value:t},"*"))}catch(e){s.Logger.error("CallController: setMode",e)}},e.prototype.startScreenShare=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.START_SCREENSHARE},"*")}catch(e){s.Logger.error("CallController: startScreenShare",e)}},e.prototype.stopScreenShare=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.STOP_SCREENSHARE},"*")}catch(e){s.Logger.error("CallController: stopScreenShare",e)}},e.prototype.startRecording=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.START_RECORDING},"*")}catch(e){s.Logger.error("CallController: startRecording",e)}},e.prototype.stopRecording=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.STOP_RECORDING},"*")}catch(e){s.Logger.error("CallController: stopRecording",e)}},e.prototype.switchToVideoCall=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.SWITCH_TO_VIDEO_CALL},"*")}catch(e){s.Logger.error("CallController: switchToVideoCall",e)}}
1,e.prototype.openVirtualBackground=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.OPEN_VIRTUAL_BACKGROUND},"*")}catch(e){s.Logger.error("CallController: openVirtualBackground",e)}},e.prototype.setBackgroundBlur=function(t){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_BLUR,value:t},"*")}catch(e){s.Logger.error("CallController: openVirtualBackground",e)}},e.prototype.setBackgroundImage=function(t){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.SET_BACKGROUND_IMAGE,value:t},"*")}catch(e){s.Logger.error("CallController: openVirtualBackground",e)}},e.prototype.endSession=function(){try{e.callScreen&&e.callScreen.contentWindow.postMessage({type:o.CallConstants.POST_MESSAGES.TYPES.ACTION_MESSAGE,action:o.CallConstants.POST_MESSAGES.ACTIONS.END_CALL},"*")}catch(e){s.Logger.error("CallController: endSession",e)}},e.callController=void 0,e.callListner=void 0,e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MediaDevice=void 0;var o=n(1);t.MediaDevice=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersController=void 0;var o=n(48),s=n(0),r=n(1);t.GroupMembersController=function(){function e(){}return e.trasformJSONGroupMember=function(e){var t;try{return e.status&&"offline"!==e.status?e.status="online":e.status="offline",t=new o.GroupMember(e[s.GroupMemersConstans.KEYS.UID]),Object.assign(t,e),t}catch(t){return r.Logger.error("GroupMembersController:trasformJSONGroupMember",{e:t,groupMember:e}),e}},e}()},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(0);t.GroupMember=function(e){function t(t,n){var o=e.call(this,t)||this;return o.joinedAt=0,n&&(o.scope=n),o}return s(t,e),t.prototype.setScope=function(e){this.scope=e},t.prototype.setJoinedAt=function(e){this.joinedAt=e},t.prototype.setGuid=function(e){this.guid=e},t.prototype.getScope=function(){return this.scope},t.prototype.getJoinedAt=function(){return this.joinedAt},t.prototype.getGuid=function(){return this.guid},t.GroupMemberScope=i.GroupMemberScope,t}(r.User)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Conversation=void 0;var o=n(13),s=n(0),r=n(15),i=n(19);t.Conversation=function(){function e(e,t,n,a,E,c,u,S,p){void 0===p&&(p=""),this.conversationId=e,this.conversationType=t,this.unreadMentionsCount=null!=u?u:0,this.lastReadMessageId=null!=S?S:"",this.latestMessageId=p,this.unreadMessageCount=null!=E?E:0,this.lastMessage=null!=n?n:null,c&&0<c.length&&(this.tags=c),n&&n.id&&void 0!==n.id&&null!==n.id&&""!==n.id&&(this.lastMessage=o.MessageController.trasformJSONMessge(n)),this.conversationType==s.MessageConstatnts.RECEIVER_TYPE.USER?this.conversationWith=r.UsersController.trasformJSONUser(a):this.conversationWith=i.GroupsController.trasformJSONGroup(a)}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.getLatestMessageId=function(){return this.latestMessageId},e.prototype.setLatestMessageId=function(e){this.latestMessageId=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}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.TypingNotificationController=void 0;var o=n(1);t.TypingNotificationController=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}()},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(1),r=n(30);t.ListenerHandlers=function(){function e(){this.connectionHandlers=[],this.loginHandlers=[],this.messageHandlers=[],this.userHandlers=[],this.groupHandlers=[],this.callHandlers=[],this.assistantHandlers=[]}return e.getInstance=function(){return null!=this.listenerHandlers&&null!=this.listenerHandlers||(this.listenerHandlers=new e),this.listenerHandlers},e.prototype.addConnectionEventListener=function(e,t){try{this.connectionHandlers=this.connectionHandlers.filter(function(t){return t._name!=e}),this.connectionHandlers=o(this.connectionHandlers,[new r.WSConnectionListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addWSConnectionEventListener",e)}},e.prototype.removeConnectionEventListener=function(e){try{this.connectionHandlers=this.connectionHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeWSConnectionEventListener",e)}},e.prototype.addLoginEventListener=function(e,t){try{this.loginHandlers=this.loginHandlers.filter(function(t){return t._name!=e}),this.loginHandlers=o(this.loginHandlers,[new r.UserLoginListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addLoginEventListener",e)}},e.prototype.removeLoginEventListener=function(e){try{this.loginHandlers=this.loginHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeLoginEventListener",e)}},e.prototype.addMessageEventListener=function(e,t){try{this.messageHandlers=this.messageHandlers.filter(function(t){return t._name!=e}),this.messageHandlers=o(this.messageHandlers,[new r.MessagesListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addMessageEventListener",e)}},e.prototype.removeMessageEventListener=function(e){try{this.messageHandlers=this.messageHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeMessageEventListener",e)}},e.prototype.addAIAssistantListener=function(e,t){try{this.assistantHandlers=this.assistantHandlers.filter(function(t){return t._name!=e}),this.assistantHandlers=o(this.assistantHandlers,[new r.AssistantsListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addAIAssistantListener",e)}},e.prototype.removeAIAssistantListener=function(e){try{this.assistantHandlers=this.assistantHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeAIAssistantListener",e)}},e.prototype.addUserEventListener=function(e,t){try{this.userHandlers=this.userHandlers.filter(function(t){return t._name!=e}),this.userHandlers=o(this.userHandlers,[new r.UsersListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addUserEventListener",e)}},e.prototype.removeUserEventListener=function(e){try{this.userHandlers=this.userHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeUserEventListener",e)}},e.prototype.addGroupEventListener=function(e,t){try{this.groupHandlers=this.groupHandlers.filter(function(t){return t._name!=e}),this.groupHandlers=o(this.groupHandlers,[new r.GroupsListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addGroupEventListener",e)}},e.prototype.removeGroupEventListener=function(e){try{this.groupHandlers=this.groupHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeGroupEventListener",e)}},e.prototype.addCallEventListener=function(e,t){try{this.callHandlers=this.callHandlers.filter(function(t){return t._name!=e}),this.callHandlers=o(this.callHandlers,[new r.CallsListener(e,t)])}catch(e){s.Logger.error("ListenerHandlers: addCallEventListener",e)}},e.prototype.removeCallEventListener=function(e){try{this.callHandlers=this.callHandlers.filter(function(t){return t._name!==e})}catch(e){s.Logger.error("ListenerHandlers: removeCallEventListener",e)}},e.listenerHandlers=new e,e}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.InteractionReceipt=void 0,t.InteractionReceipt=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionEvent=void 0;var o=n(1);t.ReactionEvent=function(){function e(e,t,n,s,r){this.parentMessageId=null,o.isFalsy(e)||(this.reaction=e),o.isFalsy(t)||(this.receiverId=t),o.isFalsy(n)||(this.receiverType=n),o.isFalsy(s)||(this.conversationId=s),o.isFalsy(r)||(this.parentMessageId=r)}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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var o=n(10);Object.defineProperty(t,"AIAssistantBaseEvent",{enumerable:!0,get:function(){return o.AIAssistantBaseEvent}});var s=n(79);Object.defineProperty(t,"AIAssistantRunStartedEvent",{enumerable:!0,get:function(){return s.AIAssistantRunStartedEvent}});var r=n(80);Object.defineProperty(t,"AIAssistantRunFinishedEvent",{enumerable:!0,get:function(){return r.AIAssistantRunFinishedEvent}});var i=n(81);Object.defineProperty(t,"AIAssistantMessageStartedEvent",{enumerable:!0,get:function(){return i.AIAssistantMessageStartedEvent}});var a=n(82);Object.defineProperty(t,"AIAssistantMessageEndedEvent",{enumerable:!0,get:function(){return a.AIAssistantMessageEndedEvent}});var E=n(83);Object.defineProperty(t,"AIAssistantContentReceivedEvent",{enumerable:!0,get:function(){return E.AIAssistantContentReceivedEvent}});var c=n(84);Object.defineProperty(t,"AIAssistantToolStartedEvent",{enumerable:!0,get:function(){return c.AIAssistantToolStartedEvent}});var u=n(85);Object.defineProperty(t,"AIAssistantToolArgumentEvent",{enumerable:!0,get:function(){return u.AIAssistantToolArgumentEvent}});var S=n(86);Object.defineProperty(t,"AIAssistantToolEndedEvent",{enumerable:!0,get:function(){return S.AIAssistantToolEndedEvent}});var p=n(87);Object.defineProperty(t,"AIAssistantToolResultEvent",{enumerable:!0,get:function(){return p.AIAssistantToolResultEvent}})},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.DaySchedule=void 0,t.DaySchedule=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}()},function(e,t){var n;n=function(){return this}();try{n=n||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 o=n(6),s=n(1),r=n(2),i=n(19),a=n(0),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=0,this.total_pages=-1,this.hasJoined=0,this.withTags=!1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(s.isFalsy(e.limit)||(this.limit=e.limit),e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),s.isFalsy(e.hasJoined)||(this.hasJoined=1),s.isFalsy(e.tags)||(this.tags=e.tags),s.isFalsy(e.showTags)||(this.withTags=e.showTags),void 0!==e.page&&(this.page=Math.max(0,e.page)))}return e.prototype.validateGroupBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ER
1ROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(s.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(s.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(s.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&&void 0!==this.searchKeyword)return new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));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(s.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(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"TAGS","TAGS","setTags()")))},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){try{var s=e.validateGroupBuilder();if(s instanceof r.CometChatException)return void n(s);var a=e.getPageToFetch();o.makeApiCall("getGroups",{},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=a,e.pagination=n.meta.pagination;var o=[];n.data.map(function(e,t){o.push(i.GroupsController.trasformJSONGroup(e))}),t(o)}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.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),s.isFalsy(this.hasJoined)||(e.hasJoined=1),s.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e)})),s.isFalsy(this.withTags)||(e.withTags=1),e.page=this.getPageToFetch(),e},e.MAX_LIMIT=100,e.DEFAULT_LIMIT=30,e}();t.GroupsRequest=E,t.GroupsRequestBuilder=function(){function e(){this.page=0}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.setPage=function(e){return this.page=Math.max(0,e),this},e.prototype.build=function(){return new E(this)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.GroupMembersRequestBuilder=t.GroupMembersRequest=void 0;var o=n(6),s=n(1),r=n(17),i=n(2),a=n(47),E=n(0),c=function(){function e(t){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=0,this.total_pages=-1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},this.store=r.LocalStorage.getInstance(),s.isFalsy(t)||(this.limit=t.limit,this.guid=t.guid,t.searchKeyword&&""!==t.searchKeyword.trim()&&(this.searchKeyword=t.searchKeyword),s.isFalsy(t.scopes)||(this.scopes=t.scopes),void 0!==t.page&&(this.page=Math.max(0,t.page)),s.isFalsy(t.status)||(t.status==e.USER_STATUS.ONLINE?this.status=E.PresenceConstants.STATUS.AVAILABLE:this.status=t.status))}return e.prototype.validateGroupMembersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ER
1ROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(s.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(s.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(s.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&&void 0!==this.searchKeyword)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));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(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(s.isFalsy(this.guid))return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID")))}if(void 0!==this.scopes&&!Array.isArray(this.scopes))return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")));if(this.status){if(typeof this.status!==E.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return new i.CometChatException(JSON.parse(s.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)}},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){try{var s=e.validateGroupMembersBuilder();if(s instanceof i.CometChatException)return void n(s);var r=e.getPageToFetch();o.makeApiCall("getGroupMembers",{guid:e.guid},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=r,e.pagination=n.meta.pagination;var o=[];n.data.map(function(t){t.guid=e.guid,o.push(a.GroupMembersController.trasformJSONGroupMember(t))}),t(o)}else t([])},function(e){n(new i.CometChatException(e.error))})}catch(e){n(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.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.getStatus=function(){return this.status},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),s.isFalsy(this.scopes)||(e.scopes=this.scopes),e.page=this.getPageToFetch(),s.isFalsy(this.status)||(e.status=this.status),e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e.USER_STATUS={ONLINE:E.PresenceConstants.STATUS.ONLINE,OFFLINE:E.PresenceConstants.STATUS.OFFLINE},e}();t.GroupMembersRequest=c,t.GroupMembersRequestBuilder=function(){function e(e){this.page=0,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.setPage=function(e){return this.page=Math.max(0,e),this},e.prototype.setStatus=function(e){return this.status=e,this},e.prototype.build=function(){return new c(this)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.BannedMembersRequestBuilder=t.BannedMembersRequest=void 0;var o=n(6),s=n(1),r=n(2),i=n(47),a=n(0),E=function(){function e(e){this.cursor=-1,this.total=-1,this.next_page=1,this.last_page=-1,this.current_page=0,this.total_pages=-1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(this.limit=e.limit,this.guid=e.guid,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),s.isFalsy(e.scopes)||(this.scopes=e.scopes),void 0!==e.page&&(this.page=Math.max(0,e.page)))}return e.prototype.validateBannedMembersBuilder=function(){if(void 0===this.limit)return new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ER
1ROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new r.CometChatException(JSON.parse(s.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(s.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(s.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(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));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(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","GroupMembersRequestBuilder()")));if(s.isFalsy(this.guid))return new r.CometChatException(JSON.parse(s.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(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_SCOPES","SET_SCOPES","setScopes()")))},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){try{var s=e.validateBannedMembersBuilder();if(s instanceof r.CometChatException)return void n(s);var a=e.getPageToFetch();o.makeApiCall("getBannedGroupMembers",{guid:e.guid},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=a,e.pagination=n.meta.pagination;var o=[];n.data.map(function(t){t.guid=e.guid,o.push(i.GroupMembersController.trasformJSONGroupMember(t))}),t(o)}else t([])},function(e){n(new r.CometChatException(e.error))})}catch(e){n(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.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),s.isFalsy(this.scopes)||(e.scopes=this.scopes),e.page=this.getPageToFetch(),e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e}();t.BannedMembersRequest=E,t.BannedMembersRequestBuilder=function(){function e(e){this.page=0,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.setPage=function(e){return this.page=Math.max(0,e),this},e.prototype.build=function(){return new E(this)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UsersRequestBuilder=t.UsersRequest=void 0;var o=n(6),s=n(1),r=n(15),i=n(2),a=n(61),E=n(0),c=function(){function e(t){this.next_page=1,this.current_page=0,this.total_pages=-1,this.hideBlockedUsers=!1,this.friendsOnly=!1,this.fetchingInProgress=!1,this.withTags=!1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},e.userStore=a.UserStore.getInstance(),s.isFalsy(t)||(this.limit=t.limit,t.searchKeyword&&""!==t.searchKeyword.trim()&&(this.searchKeyword=t.searchKeyword),s.isFalsy(t.status)||(t.status==e.USER_STATUS.ONLINE?this.status=E.PresenceConstatnts.STATUS.AVAILABLE:this.status=t.status),s.isFalsy(t.shouldHideBlockedUsers)||(this.hideBlockedUsers=t.shouldHideBlockedUsers),s.isFalsy(t.showFriendsOnly)||(this.friendsOnly=t.showFriendsOnly),s.isFalsy(t.showTags)||(this.withTags=t.showTags),s.isFalsy(t.role)||(this.role=t.role),s.isFalsy(t.roles)||(this.roles=t.roles),s.isFalsy(t.tags)||(this.tags=t.tags),s.isFalsy(t.UIDs)||(this.UIDs=t.UIDs),s.isFalsy(t.S
1ortBy)||(this.sortBy=t.SortBy),s.isFalsy(t.SearchIn)||(this.searchIn=t.SearchIn),s.isFalsy(t.SortOrder)||(this.sortOrder=t.SortOrder),void 0!==t.page&&(this.page=Math.max(0,t.page)))}return e.prototype.validateUserBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(s.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(s.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(s.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&&void 0!==this.searchKeyword)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));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(s.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(s.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(s.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(s.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(s.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(s.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(s.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(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY","SORT_BY","sortBy()")));if(s.isFalsy(this.sortBy.trim()))return new i.CometChatException(JSON.parse(s.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(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SORT_BY_ORDER","SORT_BY_ORDER","sortByOrder()")));if(s.isFalsy(this.sortOrder.trim()))return new i.CometChatException(JSON.parse(s.format(JSON.stringify(E.GENERAL_ER
1ROR.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(s.format(JSON.stringify(E.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SEARCH_IN","SEARCH_IN","searchIn()"))):void 0},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.isHideBlockedUsers=function(){return this.hideBlockedUsers},e.prototype.getStatus=function(){return this.status},e.prototype.getRole=function(){return this.role},e.prototype.isFriendsOnly=function(){return this.friendsOnly},e.prototype.getRoles=function(){return this.roles},e.prototype.getTags=function(){return this.tags},e.prototype.isWithTags=function(){return this.withTags},e.prototype.getUIDs=function(){return this.UIDs},e.prototype.getSearchIn=function(){return this.searchIn},e.prototype.getSortBy=function(){return this.sortBy},e.prototype.getSortOrder=function(){return this.sortOrder},e.prototype.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){try{if(e.fetchingInProgress)e.fetchingInProgress=!1,t([]);else{e.fetchingInProgress=!0;var s=e.validateUserBuilder();if(s instanceof i.CometChatException)return void n(s);var a=e.getPageToFetch();o.makeApiCall("users",{},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=a,e.pagination=n.meta.pagination;var o=[];n.data.map(function(e){o.push(r.UsersController.trasformJSONUser(e))}),t(o)}else t([]);e.fetchingInProgress=!1},function(t){e.fetchingInProgress=!1,n(new i.CometChatException(t.error))})}}catch(t){e.fetchingInProgress=!1,n(new i.CometChatException(t))}})},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),s.isFalsy(this.status)||(e.status=this.status),s.isFalsy(this.hideBlockedUsers)||(e.hideBlockedUsers=1),s.isFalsy(this.role)||(e.roles=this.role),s.isFalsy(this.roles)||(e.roles=this.roles),s.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e)})),s.isFalsy(this.friendsOnly)||(e.friendsOnly=1),s.isFalsy(this.withTags)||(e.withTags=1),s.isFalsy(this.UIDs)||(e.uids=this.UIDs),s.isFalsy(this.sortBy)||(e.sortBy=this.sortBy),s.isFalsy(this.sortOrder)||(e.sortOrder=this.sortOrder),s.isFalsy(this.searchIn)||(e.searchIn=this.searchIn),e.page=this.getPageToFetch(),e},e.USER_STATUS={ONLINE:E.PresenceConstatnts.STATUS.ONLINE,OFFLINE:E.PresenceConstatnts.STATUS.OFFLINE},e}();t.UsersRequest=c,t.UsersRequestBuilder=function(){function e(){this.shouldHideBlockedUsers=!1,this.page=0}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.setPage=function(e){return this.page=Math.max(0,e),this},e.prototype.build=function(){return this.role&&this.roles&&this.roles.push(this.role),new c(this)},e}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};
1Object.defineProperty(t,"__esModule",{value:!0}),t.UserStore=void 0;var r=n(5),i=n(1),a=n(0),E=n(11),c=n(14);t.UserStore=function(){function e(e){this.store=a.constants.DEFAULT_STORE,i.isFalsy(e)||(this.store=e)}return e.prototype.initializeStorage=function(){var e;return o(this,void 0,void 0,function(){var t,n;return s(this,function(o){switch(o.label){case 0:if(this.userStore)return[2];o.label=1;case 1:return o.trys.push([1,5,,6]),(t=c.StorageManager.getInstance()).isStorageInitialized()?(this.userStore=t.getStorage(r.CometChat.getAppId(),a.LOCAL_STORE.USERS_STORE),[3,4]):[3,2];case 2:return n=(null==(e=r.CometChat.appSettings)?void 0:e.getStorageMode())||a.StorageMode.LOCAL,[4,t.initialize(n)];case 3:o.sent(),this.userStore=t.getStorage(r.CometChat.getAppId(),a.LOCAL_STORE.USERS_STORE),o.label=4;case 4:return[3,6];case 5:return o.sent(),this.userStore=E.createInstance({name:i.format(a.LOCAL_STORE.STORE_STRING,r.CometChat.getAppId(),a.LOCAL_STORE.USERS_STORE)}),this.userStore.setDriver([E.LOCALSTORAGE,E.INDEXEDDB,E.WEBSQL]),[3,6];case 6:return[2]}})})},e.getInstance=function(){return null==e.UserStore&&(e.UserStore=new e),e.UserStore},e.prototype.set=function(e,t){return o(this,void 0,void 0,function(){return s(this,function(n){switch(n.label){case 0:return[4,this.initializeStorage()];case 1:return n.sent(),[2,this.userStore.setItem(e,t)]}})})},e.prototype.remove=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.userStore.removeItem(e)]}})})},e.prototype.get=function(e){return o(this,void 0,void 0,function(){return s(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.userStore.getItem(e)]}})})},e.prototype.clearStore=function(){return o(this,void 0,void 0,function(){var e=this;return s(this,function(t){return[2,new Promise(function(t,n){return o(e,void 0,void 0,function(){return s(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return e.sent(),this.userStore.clear().then(function(){t(!0)}).catch(function(e){n(e)}),[3,3];case 2:return n(e.sent()),[3,3];case 3:return[2]}})})})]})})},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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationsRequestBuilder=t.ConversationsRequest=void 0;var o=n(6),s=n(1),r=n(2),i=n(31),a=n(0),E=function(){function e(e){this.limit=30,this.next_page=1,this.current_page=0,this.total_pages=-1,this.fetchingInProgress=!1,this.getUserAndGroupTags=!1,this.withTags=!1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(this.limit=e.limit,s.isFalsy(e.conversationType)||(this.conversationType=e.conversationType),e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),s.isFalsy(e.getUserAndGroupTags)||(this.getUserAndGroupTags=e.getUserAndGroupTags),e.tags&&(this.tags=e.tags),s.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),e.unreadOnly&&(this.unread=e.unreadOnly),void 0!==e.page&&(this.page=Math.max(0,e.page)),void 0!==e.hideAgentic&&(this.hideAgentic=e.hideAgentic),void 0!==e.onlyAgentic&&(this.onlyAgentic=e.onlyAgentic))}return e.prototype.validateConversationBuilder=function(){return void 0===this.limit?new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))):isNaN(this.limit)?new r.CometChatException(JSON.parse(s.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(s.format(JSON.stringify(a.GENERAL_ER
1ROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",a.DEFAULT_VALUES.CONVERSATION_MAX_LIMIT))):this.limit<a.DEFAULT_VALUES.ZERO?new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))):typeof this.searchKeyword!==a.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING&&void 0!==this.searchKeyword?new r.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))):void 0},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){try{if(e.fetchingInProgress)e.fetchingInProgress=!1,t([]);else{e.fetchingInProgress=!0;var s=e.validateConversationBuilder();if(s instanceof r.CometChatException)return void n(s);var a=e.getPageToFetch();o.makeApiCall("getConversations",{},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=a,e.pagination=n.meta.pagination;var o=[];n.data.map(function(e){o.push(i.ConversationController.trasformJSONConversation(e.conversationId,e.conversationType,e.lastMessage,e.conversationWith,parseInt(e.unreadMessageCount),e.tags?e.tags:[],e.unreadMentionsCount,e.lastReadMessageId,e.latestMessageId))}),t(o)}else t([]);e.fetchingInProgress=!1},function(t){e.fetchingInProgress=!1,n(new r.CometChatException(t.error))})}}catch(t){e.fetchingInProgress=!1,n(new r.CometChatException(t))}})},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,s.isFalsy(this.conversationType)||(e.conversationType=this.conversationType),this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword.trim())),s.isFalsy(this.getUserAndGroupTags)||(e.withUserAndGroupTags=this.getUserAndGroupTags),s.isFalsy(this.tags)||(e.tags=this.tags.map(function(e){return encodeURIComponent(e.trim())})),s.isFalsy(this.withTags)||(e.withTags=this.withTags),s.isFalsy(this.userTags)||(e.userTags=this.userTags.map(function(e){return encodeURIComponent(e.trim())})),s.isFalsy(this.groupTags)||(e.groupTags=this.groupTags.map(function(e){return encodeURIComponent(e.trim())})),s.isFalsy(this.includeBlockedUsers)||(e.includeBlockedUsers=this.includeBlockedUsers),s.isFalsy(this.withBlockedInfo)||(e.withBlockedInfo=this.withBlockedInfo),s.isFalsy(this.unread)||(e.unread=this.unread),s.isFalsy(this.hideAgentic)||(e.hideAgentic=this.hideAgentic),s.isFalsy(this.onlyAgentic)||(e.onlyAgentic=this.onlyAgentic),e.page=this.getPageToFetch(),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.getSearchKeyword=function(){return this.searchKeyword},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.prototype.getUnread=function(){return this.unread},e.prototype.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.getHideAgentic=function(){return this.hideAgentic},e.prototype.getOnlyAgentic=function(){return this.onlyAgentic},e}();t.ConversationsRequest=E,t.ConversationsRequestBuilder=function(){function e(){this.WithTags=!1,this.IncludeBlockedUsers=!1,this.WithBlockedInfo=!1,this.unreadOnly=!1,this.page=0}return e.prototype.setLimit=function(e){return this.limit=e,this},e.prototype.setConversationType=function(e){return this.conversationType=e,this},e.prototype.setSearchKeyword=function(e){return this.searchKeyword=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.setUnread=function(e){return this.unreadOnly=e,this},e.prototype.setPage=function(e){return this.page=Math.max(0,e),this},e.prototype.setHideAgentic=function(e){return this.hideAgentic=e,this},e.prototype.setOnlyAgentic=function(e){return this.onlyAgentic=e,this},e.prototype.build=function(){return new E(this)},e}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Prom
1ise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}},r=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 i=n(2),a=n(6),E=n(13),c=n(1),u=n(64),S=n(0),p=n(12),l=n(32),C=function(){function e(e){this.limit=S.DEFAULT_VALUES.MSGS_LIMIT,this.timestamp=0,this.id=S.DEFAULT_VALUES.DEFAULT_MSG_ID,this.messageStore=u.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.hasAttachments=!1,this.hasLinks=!1,this.hasMentions=!1,this.hasReactions=!1,this.WithParent=!1,this.hideQuotedMessages=!1,this.limit=e.limit,this.paginationMeta[S.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[S.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.id=e.id,this.id!=S.DEFAULT_VALUES.DEFAULT_MSG_ID&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.hideMessagesFromBlockedUsers=e.HideMessagesFromBlockedUsers,this.hideMessagesFromBlockedUsers&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=this.hideMessagesFromBlockedUsers),this.unread=e.unread,this.unread&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.UNREAD]=this.unread),e.searchKey&&(this.searchKey=e.searchKey,this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=this.searchKey),e.onlyUpdate&&(this.onlyUpdates=e.onlyUpdate,this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ONLY_UPDATES]=this.onlyUpdates),e.updatedAt&&(this.updatedAt=e.updatedAt,this.paginationMeta[S.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[S.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES]=this.hideReplies),this.hideDeletedMessages=e.HideDeletedMessages,this.hideDeletedMessages&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=this.hideDeletedMessages),this.hideQuotedMessages=e.HideQuotedMessages,this.hideQuotedMessages&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_QUOTED_MESSAGES]=this.hideQuotedMessages),this.hasAttachments=e.HasAttachments,this.hasAttachments&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_ATTACHMENTS]=this.hasAttachments),this.hasLinks=e.HasLinks,this.hasLinks&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_LINKS]=this.hasLinks),this.hasMentions=e.HasMentions,this.hasMentions&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_MENTIONS]=this.hasMentions),this.hasReactions=e.HasReactions,this.hasReactions&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_REACTIONS]=this.hasReactions),e.mentionedUIDs&&(this.mentionedUIDs=e.mentionedUIDs),e.attachmentTypes&&(this.attachmentTypes=e.attachmentTypes),this.mentionsWithUserTags=e.mentionsWithUserTags,this.mentionsWithBlockedRelation=e.mentionsWithBlockedRelation,this.interactionGoalCompletedOnly=e.interactionGoalCompletedOnly,this.interactionGoalCompletedOnly&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=this.interactionGoalCompletedOnly),e.WithParent&&(this.WithParent=e.WithParent)}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}
1,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.getHasAttachments=function(){return this.hasAttachments},e.prototype.getHasLinks=function(){return this.hasLinks},e.prototype.getHasMentions=function(){return this.hasMentions},e.prototype.getHasReactions=function(){return this.hasReactions},e.prototype.getMentionedUIDs=function(){return this.mentionedUIDs},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.getAttachmentTypes=function(){return this.attachmentTypes},e.prototype.isWithParent=function(){return this.WithParent},e.prototype.isHideQuotedMessages=function(){return this.hideQuotedMessages},e.prototype.fetchNext=function(){var e=this;return new Promise(function(t,n){return o(e,void 0,void 0,function(){var e,o;return s(this,function(s){switch(s.label){case 0:if(s.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,n(new i.CometChatException(p.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,this.onlyUpdates){if(0==this.updatedAt)return this.inProgress=!1,n(new i.CometChatException(p.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2]}else if(0==this.timestamp&&0==this.id&&0==this.updatedAt)return this.inProgress=!1,n(new i.CometChatException(p.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=S.MessageConstatnts.PAGINATION.AFFIX.APPEND,this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=S.MessageConstatnts.PAGINATION.AFFIX.APPEND,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t(s.sent()),this.inProgress=!1,[3,4];case 3:return e=s.sent(),this.inProgress=!1,n(new i.CometChatException(e)),[3,4];case 4:return[3,6];case 5:return o=s.sent(),this.inProgress=!1,n(new i.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(t,n){return o(e,void 0,void 0,function(){var e,o;return s(this,function(s){switch(s.label){case 0:if(s.trys.push([0,5,,6]),this.inProgress)return n(new i.CometChatException(p.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,this.onlyUpdates&&0==this.updatedAt)return this.inProgress=!1,n(new i.CometChatException(p.MESSAGES_REQUEST_ERRORS.NOT_ENOUGH_PARAMS)),[2];this.affix=S.MessageConstatnts.PAGINATION.AFFIX.PREPEND,this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,this.currentMethod=S.MessageConstatnts.PAGINATION.AFFIX.PREPEND,s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.makeAPICall()];case 2:return t(s.sent()),this.inProgress=!1,[3,4];case 3:return e=s.sent(),this.inProgress=!1,n(new i.CometChatException(e)),[3,4];case 4:return[3,6];case 5:return o=s.sent(),this.inProgress=!1,n(new i.CometChatException(o)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(){var e=this;return new Promise(function(t,n){try{var r=e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.PER_PAGE];if(void 0===r)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")))
1);if(isNaN(r))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(r>S.DEFAULT_VALUES.MSGS_MAX_LIMIT)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",S.DEFAULT_VALUES.MSGS_MAX_LIMIT))));if(r<S.DEFAULT_VALUES.ZERO)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));var u=e.uid;if(void 0!==u){if(typeof u!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"UID","UID","setUID()"))));if(c.isFalsy(u.trim()))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.INVALID),"UID","UID","UID","UID"))));e.uid=u.trim()}var p=e.guid;if(void 0!==p){if(typeof p!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"GUID","GUID","setGUID()"))));if(c.isFalsy(p.trim()))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.INVALID),"GUID","GUID","GUID","GUID"))));e.guid=p.trim()}var C=e.mentionsWithUserTags;if(void 0!==C){if(typeof C!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_TAG_INFO","MENTIONS_WITH_TAG_INFO","mentionsWithTagInfo()"))));1==C&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_TAG_INFO]=1)}var d=e.mentionsWithBlockedRelation;if(void 0!==d){if(typeof d!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"MENTIONS_WITH_BLOCKED_INFO","MENTIONS_WITH_BLOCKED_INFO","mentionsWithBlockedInfo()"))));1==d&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.MENTIONS_WITH_BLOCKED_INFO]=1)}var _=e.parentMessageId;if(void 0!==_){if(isNaN(_))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))));if(_<S.DEFAULT_VALUES.ZERO)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"PARENT_MESSAGE_ID","PARENT_MESSAGE_ID","setParentMessageId()"))))}var T=e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY];if(void 0!==T){if(typeof T!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()"))));e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.SEARCH_KEY]=encodeURIComponent(T.trim())}var h=e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ID];if(void 0!==h){if(isNaN(h))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))));if(h<S.DEFAULT_VALUES.ZERO)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"MESSAGE_ID","MESSAGE_ID","setMessageId()"))))}var g=e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.SENT_AT];if(void 0!==g){if(isNaN(g))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))));if(g<S.DEFAULT_VALUES.ZERO)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"TIMESTAMP","TIMESTAMP","setTimestamp()"))))}var A=e.hideMessagesFromBlockedUsers;if(void 0!==A){if(typeof A!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ER
1ROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_MESSAGES_FROM_BLOCKED_USERS","HIDE_MESSAGES_FROM_BLOCKED_USERS","hideMessagesFromBlockedUsers()"))));1==A&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_MESSAGES_FROM_BLOCKED_USER]=1)}var f=e.unread;if(void 0!==f){if(typeof f!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"UNREAD","UNREAD","setUnread()"))));1==f&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.UNREAD]=1)}var I=e.category;if(void 0!==I){if(typeof I!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_CATEGORY","SET_CATEGORY","setCategory()"))));if(c.isFalsy(I.trim()))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.INVALID),"SET_CATEGORY","SET_CATEGORY","category","category"))));e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=I.trim()}var R=e.categories;if(void 0!==R){if(!Array.isArray(R))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_CATEGORIES","SET_CATEGORIES","setCategories()"))));0<R.length&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.CATEGORIES]=R)}var O=e.type;if(void 0!==O){if(typeof O!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.STRING)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_TYPE","SET_TYPE","setType()"))));if(c.isFalsy(O.trim()))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.INVALID),"SET_TYPE","SET_TYPE","type","type"))));e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.TYPES]=encodeURIComponent(O.trim())}var N=e.types;if(void 0!==N){if(!Array.isArray(N))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<N.length&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.TYPES]=N.map(function(e){return encodeURIComponent(e)}))}var y=e.tags;if(void 0!==y){if(!Array.isArray(y))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TAGS","SET_TAGS","setTags()"))));0<y.length&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.TAGS]=y.map(function(e){return encodeURIComponent(e)}))}var m=e.WithTags;if(void 0!==m){if(typeof m!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_TAGS","WITH_TAGS","withTags()"))));1==m&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.WITH_TAGS]=1)}var P=e.hideDeletedMessages;if(void 0!==P){if(typeof P!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_DELETED_MESSAGES","HIDE_DELETED_MESSAGES","hideDeletedMessages()"))));1==P&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_DELETED_MESSAGES]=1)}var M=e.interactionGoalCompletedOnly;if(void 0!==M){if(typeof M!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"ONLY_INTERACTION_GOAL_COMPLETED","ONLY_INTERACTION_GOAL_COMPLETED","interactionGoalCompletedOnly()"))));1==M&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ONLY_INTERACTION_GOAL_COMPLETED]=1)}var v=e.hasAttachments;if(void 0!==v){if(typeof v!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_ATTACHMENTS","HAS_ATTACHMENTS","hasAttachments()"))));1==v&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_ATTACHMENTS]=1)}var L=e.hasLinks;if(void 0!==L){if(typeof L!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ER
1ROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_LINKS","HAS_LINKS","hasLinks()"))));1==L&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_LINKS]=1)}var D=e.hasMentions;if(void 0!==D){if(typeof D!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_MENTIONS","HAS_MENTIONS","hasMentions()"))));1==D&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_MENTIONS]=1)}var U=e.hasReactions;if(void 0!==U){if(typeof U!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HAS_REACTIONS","HAS_REACTIONS","hasReactions()"))));1==U&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HAS_REACTIONS]=1)}var Y=e.mentionedUIDs;if(void 0!==Y){if(!Array.isArray(Y))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"MENTIONED_UIDS","MENTIONED_UIDS","setMentionedUIDs()"))));0<(null==Y?void 0:Y.length)&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.MENTIONED_UIDS]=Y)}var G=e.attachmentTypes;if(void 0!==G){if(!Array.isArray(G))return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_AN_ARRAY),"SET_TYPES","SET_TYPES","setTypes()"))));0<G.length&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.ATTACHMENT_TYPES]=G)}var w=e.WithParent;if(void 0!==w){if(typeof w!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"WITH_PARENT","WITH_PARENT","withParent()"))));1==w&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.WITH_PARENT]=1)}var K=e.hideQuotedMessages;if(void 0!==K){if(typeof K!==S.COMMON_UTILITY_CONSTANTS.TYPE_CONSTANTS.BOOLEAN)return void n(new i.CometChatException(JSON.parse(c.format(JSON.stringify(S.GENERAL_ERROR.PARAMETER_MUST_BE_A_BOOLEAN),"HIDE_QUOTED_MESSAGES","HIDE_QUOTED_MESSAGES","hideQuotedMessages()"))));1==K&&(e.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_QUOTED_MESSAGES]=1)}if(e.createEndpoint(),e.totalPages){if(1!=e.totalPages);else if(e.lastAffix==e.affix)return void t([])}a.makeApiCall(e.endpointName,{listId:e.listId},e.paginationMeta).then(function(n){return o(e,void 0,void 0,function(){var e,r=this;return s(this,function(i){return e=[],n[S.ResponseConstants.RESPONSE_KEYS.KEY_META][S.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(S.MessageConstatnts.PAGINATION.KEYS.ID)&&0==this.id&&(this.id=parseInt(n.meta.cursor[S.MessageConstatnts.PAGINATION.KEYS.ID])),n[S.ResponseConstants.RESPONSE_KEYS.KEY_META][S.ResponseConstants.RESPONSE_KEYS.KEY_CURSOR].hasOwnProperty(S.MessageConstatnts.PAGINATION.KEYS.SENT_AT)&&0==this.timestamp&&(this.timestamp=n.meta.cursor[S.MessageConstatnts.PAGINATION.KEYS.SENT_AT]),n.meta.pagination.hasOwnProperty("total_pages")&&(this.totalPages=n.meta.pagination.total_pages),n.meta.cursor.hasOwnProperty("affix")&&(this.lastAffix=n.meta.cursor.affix),n.data[0]?(0<this.id&&(this.id=parseInt(n.data[0].id)),0<this.timestamp&&(this.timestamp=n.data[0].sentAt),n.data.map(function(t){return o(r,void 0,void 0,function(){return s(this,function(n){return l.MessageListnerMaping.getInstance().get(S.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST).then(function(e){parseInt(t.id)>e&&l.MessageListnerMaping.getInstance().set(S.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))},function(e){l.MessageListnerMaping.getInstance().set(S.LOCAL_STORE.KEY_MESSAGE_LISTENER_LIST,parseInt(t.id))}),this.affix==S.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[S.MessageConstatnts.PAGINATION.KEYS.ID]=this.id),this.timestamp&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.SENT_AT]=this.timestamp),this.updatedAt&&(this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.UPDATED_AT]=this.updatedAt),e.push(E.MessageController.trasformJSONMessge(t)),[2]})})})):e=[],t(e),[2]})})},function(e){n(new i.CometChatException(e.error))})}catch(e){n(new i.CometChatException(e))}})},e.prototype.createEndpoint=function(){this.parentMessageId?(this.endpointName="getThreadMessages",this.listId=this.parentMessageId.toString(),this.hideReplies&&(this.hideReplies=!1,delete this.paginationMeta[S.MessageConstatnts.PAGINATION.KEYS.HIDE_REPLIES])):(c.isFalsy(this.guid)||c.isFalsy(this.uid))&&c.isFalsy(this.guid)?(c.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[S.MessageConstatnts.PAGINATION.KEYS.PER_PAGE]=this.limit,e[S.MessageConstatnts.PAGINATION.KEYS.AFFIX]=this.affix,(c.isFalsy(this.guid)||c.isFalsy(this.uid))&&c.isFalsy(this.guid)&&c.isFalsy(this.uid)},e.prototype.getFilteredPreviousDataByReceiverId=function(e){return o(this,void 0,void 0,function(){var t,n=this;return s(this,function(o){switch(o.label){case 0:switch(t=[],e){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,u.MessagesStore.getInstance().get(this.uid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 2:return o.sent(),[3,9];case 3:return[4,u.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 4:o.sent(),o.label=5;case 5:return[4,u.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).filter(function(t){return e[t].sender.uid==n.uid}).map(function(n){t=r(t,[e[n]])})})];case 6:case 8:return o.sent(),[3,9];case 7:return[4,u.MessagesStore.getInstance().getAllMessages().then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 9:return[2,t]}})})},e.prototype.getFilteredNextDataByReceiverId=function(e){return o(this,void 0,void 0,function(){var t,n=this;return s(this,function(o){switch(o.label){case 0:switch(t=[],e){case"user":return[3,1];case"group":return[3,3];case"both":return[3,5]}return[3,7];case 1:return[4,u.MessagesStore.getInstance().get(this.uid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 2:return o.sent(),[3,9];case 3:return[4,u.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 4:o.sent(),o.label=5;case 5:return[4,u.MessagesStore.getInstance().get(this.guid).then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).filter(function(t){return e[t].sender.uid==n.uid}).map(function(n){t=r(t,[e[n]])})})];case 6:case 8:return o.sent(),[3,9];case 7:return[4,u.MessagesStore.getInstance().getAllMessages().then(function(e){Object.keys(e).filter(function(e){return parseInt(e)>n.id}).map(function(n){t=r(t,[e[n]])})})];case 9:return[2,t]}})})},e}();t.MessagesRequest=C,t.MessagesRequestBuilder=function(){function e(){this.maxLimit=S.DEFAULT_VALUES.MSGS_MAX_LIMIT,this.timestamp=0,this.id=S.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,this.HasAttachments=!1,this.HasLinks=!1,this.HasMentions=!1,this.HasReactions=!1,this.WithParent=!1,this.HideQuotedMessages=!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=c.getCurrentTime()),this.timestamp=e,this},e.prototype.setMessageId=function(e){return void 0===e&&(e=S.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.hasAttachments=function(e){return this.HasAttachments=e,this},e.prototype.hasLinks=function(e){return this.HasLinks=e,this},e.prototype.hasMentions=function(e){return this.HasMentions=e,this},e.prototype.hasReactions=function(e){return this.HasReactions=e,this},e.prototype.setMentionedUIDs=function(e){return this.mentionedUIDs=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.setAttachmentTypes=function(e){return this.attachmentTypes=e,this},e.prototype.withParent=function(e){return void 0===e&&(e=!1),this.WithParent=e,this},e.prototype.hideQuotedMessages=function(e){return this.HideQuotedMessages=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 C(this)},e}()},function(e,t,n){"use strict";var o=this&&this.__assign||function(){return(o=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)},s=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Prom
1ise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.MessagesStore=void 0;var i=n(5),a=n(1),E=n(0),c=n(11),u=n(14);t.MessagesStore=function(){function e(e){this.store=E.constants.DEFAULT_STORE,a.isFalsy(e)||(this.store=e)}return e.prototype.initializeStorage=function(){var e;return s(this,void 0,void 0,function(){var t,n;return r(this,function(o){switch(o.label){case 0:if(this.messagesStore)return[2];o.label=1;case 1:return o.trys.push([1,5,,6]),(t=u.StorageManager.getInstance()).isStorageInitialized()?(this.messagesStore=t.getStorage(i.CometChat.getAppId(),E.LOCAL_STORE.MESSAGES_STORE),[3,4]):[3,2];case 2:return n=(null==(e=i.CometChat.appSettings)?void 0:e.getStorageMode())||E.StorageMode.LOCAL,[4,t.initialize(n)];case 3:o.sent(),this.messagesStore=t.getStorage(i.CometChat.getAppId(),E.LOCAL_STORE.MESSAGES_STORE),o.label=4;case 4:return[3,6];case 5:return o.sent(),this.messagesStore=c.createInstance({name:a.format(E.LOCAL_STORE.STORE_STRING,i.CometChat.getAppId(),E.LOCAL_STORE.MESSAGES_STORE)}),this.messagesStore.setDriver([c.LOCALSTORAGE,c.INDEXEDDB,c.WEBSQL]),[3,6];case 6:return[2]}})})},e.getInstance=function(){return null==e.MessagesStore&&(e.MessagesStore=new e),e.MessagesStore},e.prototype.set=function(e,t){return s(this,void 0,void 0,function(){return r(this,function(n){switch(n.label){case 0:return[4,this.initializeStorage()];case 1:return n.sent(),[2,this.messagesStore.setItem(e,t)]}})})},e.prototype.remove=function(e){return s(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.messagesStore.removeItem(e)]}})})},e.prototype.clearStore=function(){var e=this;return new Promise(function(t,n){return s(e,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return e.sent(),this.messagesStore.clear().then(function(){t(!0)}).catch(function(e){n(e)}),[3,3];case 2:return n(e.sent()),[3,3];case 3:return[2]}})})})},e.prototype.getAllMessages=function(){return s(this,void 0,void 0,function(){var e,t=this;return r(this,function(n){return e={},[2,new Promise(function(n,i){return s(t,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,this.initializeStorage()];case 1:return t.sent(),this.messagesStore.iterate?this.messagesStore.iterate(function(t,n,s){n!=E.constants.MSG_VER_POST&&t&&"object"==typeof t&&(e=o(o({},e),t))}).then(function(){n(e)}).catch(i):n(e),[3,3];case 2:return i(t.sent()),[3,3];case 3:return[2]}})})})]})})},e.prototype.get=function(e){return s(this,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return[4,this.initializeStorage()];case 1:return t.sent(),[2,this.messagesStore.getItem(e)]}})})},e.prototype.clear=function(e){},e.prototype.selectStore=function(e){this.store=e},e.prototype.storeMessages=function(e){return s(this,void 0,void 0,function(){var t,n,s,c,u,S,p,l,C;return r(this,function(r){switch(r.label){case 0:if(!i.CometChat.user.getUid())return[3,13];t=i.CometChat.user.getUid(),n={},c=s=0,r.label=1;case 1:return r.trys.push([1,12,,13]),[4,this.get(E.constants.MSG_VER_POST)];case 2:return c=r.sent()||0,e.map(function(e){var r;if(!a.isFalsy(e)){0==s&&(s=parseInt(e.getId().toString())),s>e.getId()&&(s=parseInt(e.getId().toString())),c<e.getId()&&(c=parseInt(e.getId().toString()));var i=void 0;i=e.getSender()instanceof Object?e.getSender().getUid():e.getSender(),e.getReceiverType()==E.MessageConstatnts.RECEIVER_TYPE.GROUP?i=e.getReceiver():e.getSender()instanceof Object?e.getSender().getUid()==t&&(i=e.getReceiver()):e.getSender()==t&&(i=e.getReceiver()),n[i]||(n[i]={}),n[i]=o(o({},n[i]),((r={})[e.getId()]=e,r))}}),[4,this.get(E.constants.MSG_VER_PRE)];case 3:return u=r.sent(),0<s&&s<u||null==u?[4,this.set(E.constants.MSG_VER_PRE,s)]:[3,5];case 4:r.sent(),r.label=5;case 5:return 0<c?[4,this.set(E.constants.MSG_VER_POST,c)]:[3,7];case 6:r.sent(),r.label=7;case 7:S=0,p=Object.keys(n),r.label=8;case 8:return S<p.length?(l=p[S],[4,this.get(l)]):[3,11];case 9:null==(C=r.sent())&&(C={}),this.set(l,o(o({},n[l]),C)),r.label=10;case 10:return S++,[3,8];case 11:return[3,13];case 12:return r.sent(),[2,!1];case 13:return[2,!0]}})})},e}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.BlockedUsersRequestBuilder=t.BlockedUsersRequest=void 0;var o=n(6),s=n(1),r=n(15),i=n(2),a=n(0),E=function(){function e(e){this.next_page=1,this.current_page=0,this.total_pages=-1,this.fetchingInProgress=!1,this.page=0,this.pagination={total:0,count:0,per_page:0,current_page:0,total_pages:0,links:[]},s.isFalsy(e)||(this.limit=e.limit,e.searchKeyword&&""!==e.searchKeyword.trim()&&(this.searchKeyword=e.searchKeyword),s.isFalsy(e.direction)||(this.direction=e.direction),void 0!==e.page&&(this.page=Math.max(0,e.page)))}return e.prototype.validateBlockedUsersBuilder=function(){if(void 0===this.limit)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit")));if(isNaN(this.limit))return new i.CometChatException(JSON.parse(s.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(s.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(s.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&&void 0!==this.searchKeyword)return new i.CometChatException(JSON.parse(s.format(JSON.stringify(a.GENERAL_ERROR.PARAMETER_MUST_BE_A_STRING),"SET_SEARCH_KEYWORD","SET_SEARCH_KEYWORD","setSearchKeyword()")));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(s.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 e=this;return new Promise(function(t,n){try{if(e.fetchingInProgress)e.fetchingInProgress=!1,t([]);else{e.fetchingInProgress=!0;var s=e.validateBlockedUsersBuilder();if(s instanceof i.CometChatException)return void n(s);var a=e.getPageToFetch();o.makeApiCall("blockedUsersList",{},e.getNextData()).then(function(n){if(n.meta&&(e.total_pages=n.meta.pagination.total_pages),0<n.data.length){e.current_page=a,e.pagination=n.meta.pagination;var o=[];n.data.map(function(e){o.push(r.UsersController.trasformJSONUser(e))}),t(o)}else t([]);e.fetchingInProgress=!1},function(t){e.fetchingInProgress=!1,n(new i.CometChatException(t.error))})}}catch(t){e.fetchingInProgress=!1,n(new i.CometChatException(t))}})},e.prototype.getDirection=function(){return this.direction},e.prototype.getLimit=function(){return this.limit},e.prototype.getSearchKeyword=function(){return this.searchKeyword},e.prototype.getPage=function(){return this.current_page},e.prototype.getPageToFetch=function(){return 0==this.current_page?this.page+1:this.current_page+1},e.prototype.getNextData=function(){var e={};return e.per_page=this.limit,s.isFalsy(this.direction)||(e.direction=this.direction),this.searchKeyword&&(e.searchKey=encodeURIComponent(this.searchKeyword)),e.page=this.getPageToFetch(),e},e.MAX_LIMIT=2,e.DEFAULT_LIMIT=1,e.directions=a.BlockedUsersConstants.REQUEST_KEYS.DIRECTIONS,e}();t.BlockedUsersRequest=E,t.BlockedUsersRequestBuilder=function(){function e(){this.page=0}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.setPage=function(e){return this.page=Math.max(0,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}()},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};
1Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatHelper=void 0;var s=n(13),r=n(0),i=n(15),a=n(19),E=n(31),c=n(5),u=n(2),S=n(1),p=n(7),l=n(4),C=n(21),d=n(12);t.CometChatHelper=function(){function e(){}return e.processMessage=function(e){try{return s.MessageController.trasformJSONMessge(e)}catch(e){S.Logger.error("CometChatHelper: processMessage",e)}},e.getConversationFromMessage=function(e){return new Promise(function(t,n){try{c.CometChat.getLoggedinUser().then(function(o){if(null!==o){var c=s.MessageController.trasformJSONMessge(e),u=c.receiverType,S=c.conversationId,p=void 0,l=s.MessageController.trasformJSONMessge(e);if(u==r.MessageConstatnts.RECEIVER_TYPE.USER){var C=i.UsersController.trasformJSONUser(c[r.MessageConstatnts.KEYS.SENDER]);p=C.getUid()==o.getUid()?i.UsersController.trasformJSONUser(c[r.MessageConstatnts.KEYS.RECEIVER]):C}else p=a.GroupsController.trasformJSONGroup(c[r.MessageConstatnts.KEYS.RECEIVER]);var d=E.ConversationController.trasformJSONConversation(S,u,l,p,0,[],null,null);t(d)}else n(r.UserErrors.USER_NOT_LOGGED_IN)},function(e){n(new u.CometChatException(e.error))})}catch(e){n(new u.CometChatException(e))}})},e.updateMessageWithReactionInfo=function(e,t,n){var s,r,i,a;try{if(!e||!t||!n||!(e instanceof p.BaseMessage))return new u.CometChatException(d.ERRORS.PARAMETER_MISSING);if(n===l.MESSAGE_REACTION.ACTION.ADDED){if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<(null==(s=e.getReactions())?void 0:s.length)){var E=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});if(-1!==E)(T=e.getReactions())[E].setCount(T[E].getCount()+1),(null==(r=null===c.CometChat||void 0===c.CometChat?void 0:c.CometChat.user)?void 0:r.uid)===t.getUid()&&T[E].setReactedByMe(!0),e.setReactions(T);else{var _=void 0;_=(null==(i=null===c.CometChat||void 0===c.CometChat?void 0:c.CometChat.user)?void 0:i.uid)===t.getUid()?new C.ReactionCount(t.getReaction(),1,!0):new C.ReactionCount(t.getReaction(),1,!1),e.setReactions(o(e.getReactions(),[_]))}}else(null==(a=null===c.CometChat||void 0===c.CometChat?void 0:c.CometChat.user)?void 0:a.uid)===t.getUid()?e.setReactions([new C.ReactionCount(t.getReaction(),1,!0)]):e.setReactions([new C.ReactionCount(t.getReaction(),1,!1)]);return e}}else{if(n!==l.MESSAGE_REACTION.ACTION.REMOVED)return new u.CometChatException(d.ERRORS.PARAMETER_MISSING);if(parseInt(e.getId())===parseInt(t.getMessageId())){if(0<e.getReactions().length){var T,h=e.getReactions().findIndex(function(e){return e.getReaction()===t.getReaction()});-1!==h&&(1<(_=e.getReactions()[h]).getCount()?((T=e.getReactions())[h].setCount(T[h].getCount()-1),c.CometChat.user.getUid()===t.getUid()&&T[h].setReactedByMe(!1)):T=(T=e.getReactions()).filter(function(e,t){return t!==h}),e.setReactions(T))}return e}}}catch(e){return S.Logger.error("CometChatHelper: updateMessageWithReactionInfo",e),new u.CometChatException(e)}},e}()},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(0),s=n(1),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}
1,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,t.CallSettingsBuilder=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 a).build(),this.ShowVirtualBackgroundSetting=!0,this.MainVideoContainerSetting=new E}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}();var i=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=i;var a=function(){function e(){this.AllowBackgroundBlur=!0,this.AllowUserImages=!0,this.ShowDefaultImages=!0,this.SetImages=[],this.EnforceBackgroundBlur=0,this.EnforceBackgroun
1dImage=""}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 i(this)},e}();t.VirtualBackgroundBuilder=a;var E=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=E},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.RTCUser=void 0;var o=n(1);t.RTCUser=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}()},function(e,t,n){"use strict";var o=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},s=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.WSConnectionHelper=void 0;var r=n(5),i=n(0),a=n(45),E=n(50),c=n(1),u=n(51),S=n(29),p=n(32),l=n(27),C=n(34),d=n(28),_=n(70),T=n(71),h=n(72),g=n(73),A=n(74),f=n(75),I=n(76),R=n(77),O=n(78),N=n(88),y=n(89),m=n(18),P=n(36),M=n(33),v=n(4),L=n(90),D=u.ListenerHandlers.getInstance();t.WSConnectionHelper=function(){function e(){}return e.getInstance=function(){try{return null!=this.wsConnectionHelper&&null!=this.wsConnectionHelper||(this.wsConnectionHelper=new e),this.wsConnectionHelper}catch(e){c.Logger.error("WSConnectionHelper: getInstance",e)}},e.prototype.WSLogin=function(e,t){var n=this;try{L.getWSURL().then(function(o){n.connection=new WebSocket(o),t&&n.connection&&n.c
1onnection.readyState==v.READY_STATE.CONNECTING&&t(n.connection.readyState),n.connection.onopen=function(o){n.onOpen(o,t),n.authenticateUser(e)},n.connection.onclose=function(e){n.onClose(e,t)},n.connection.onmessage=function(e){n.onMessage(e)}},function(e){c.Logger.error("WSConnectionHelper :: WSLogin",e)})}catch(e){c.Logger.error("WSConnectionHelper: WSLogin",e)}},e.prototype.onOpen=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){c.Logger.error("WSConnectionHelper: onOpen",e)}},e.prototype.onClose=function(e,t){try{t&&this.connection&&t(this.connection.readyState)}catch(e){c.Logger.error("WSConnectionHelper: onClose",e)}},e.prototype.publishMessageReaction=function(e){var t=e.getMessageReactionEvent();switch(e.getAction()){case v.MESSAGE_REACTION.ACTION.ADDED:D.messageHandlers.map(function(e){e._eventListener.onMessageReactionAdded&&e._eventListener.onMessageReactionAdded(t)});break;case v.MESSAGE_REACTION.ACTION.REMOVED:D.messageHandlers.map(function(e){e._eventListener.onMessageReactionRemoved&&e._eventListener.onMessageReactionRemoved(t)})}},e.prototype.onMessage=function(e){if(e.data&&"string"==typeof e.data)try{var t=JSON.parse(e.data);if(t&&t.action&&t.action===v.KEYS.PONG)return;var n=this.getCometChatEventFromMessage(t);if(n.getDeviceId()===r.CometChat.getSessionId()&&n.getType()!==v.AUTH.TYPE&&n.getType()!==v.MODERATION_STATUS_CHANGED.TYPE)return;switch(n.getType()){case v.MESSAGE_REACTION.TYPE:this.publishMessageReaction(n);break;case v.TYPING_INDICATOR.TYPE:this.publishTypingIndicator(n);break;case v.RECEIPTS.TYPE:this.publishReceipts(n);break;case v.PRESENCE.TYPE:this.publishPresence(n);break;case v.AUTH.TYPE:this.authResponseReceived(n);break;case v.MESSAGE.TYPE:this.publishMessages(n);break;case v.TRANSIENT_MESSAGE.TYPE:this.publishTransientMessage(n);break;case v.INTERACTION_RECEIPT.TYPE:this.publishInteractionReceipt(n);break;case v.MODERATION_STATUS_CHANGED.TYPE:this.publishModerationStatusChangedMessage(n);break;case v.STREAM_MESSAGE.TYPE:this.publishStreamMessages(n);break;default:c.Logger.log("WSHelper: onMessage :: unknown type",e.data)}}catch(e){c.Logger.error("WSHelper: onMessage",e)}else c.Logger.log("WSHelper: onMessage :: object data",e.data)},e.prototype.publishStreamMessages=function(e){try{var t=e.getMessage();D.assistantHandlers.map(function(e){e._eventListener.onAIAssistantEventReceived&&e._eventListener.onAIAssistantEventReceived(t)})}catch(e){c.Logger.error("WSConnectionHelper: publishStreamMessages",e)}},e.prototype.authenticateUser=function(e){var t=this;try{r.CometChat.getLoggedinUser().then(function(n){n?S.KeyStore.getInstance().get("deviceId").then(function(o){c.getAppSettings().then(function(s){var a=null;window&&window.location&&window.location.origin&&(a=window.location.origin);var E="",u={version:i.SDKHeader.sdkVersion,apiVersion:s[i.APP_SETTINGS.KEYS.CHAT_API_VERSION],origin:a,uts:(new Date).getTime()};c.isFalsy(r.CometChat.resource)||(u.resource=r.CometChat.resource),c.isFalsy(r.CometChat.platform)||(u.platform=r.CometChat.platform),c.isFalsy(r.CometChat.language)||(u.language=r.CometChat.language),navigator&&(E=navigator.userAgent);var S={appInfo:u,userAgent:E,deviceId:o,platform:i.SDKHeader.platform},p=new _.CometChatAuthEvent(r.CometChat.getAppId(),"","",n.getUid(),r.CometChat.getSessionId());if(p.setAuth(e),r.CometChat.appSettings.getSubscriptionType()!==C.AppSettings.SUBSCRIPTION_TYPE_NONE&&(p.setPresenceSubscription(r.CometChat.appSettings.getSubscriptionType()),r.CometChat.appSettings.getSubscriptionType()===C.AppSettings.SUBSCRIPTION_TYPE_ROLES&&r.CometChat.appSettings.getRoles()&&0<r.CometChat.appSettings.getRoles().length&&p.setRoles(r.CometChat.appSettings.getRoles())),p.setDeviceId(r.CometChat.getSessionId()),p.setExtraParmaeters(S),L.checkConnection(t.connection)){var l=p.getAsString();t.connection.send(l)}})}):c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},e.prototype.authResponseReceived=function(e){try{"200"===e.getCode()&&"OK"===e.getStatus()&&this.startPingingWS()}catch(e){c.Logger.error("WSConnectionHelper: authResponseReceived",e)}},e.prototype.WSLogout=function(){try{this.clearPingTimer(),L.checkConnection(this.connection)&&this.connection.close(v.LOGOUT_CODE,v.LOGOUT_REASON)}catch(e){c.Logger.error("WSConnectionHelper: WSLogout",e)}},e.prototype.startPingingWS=function(){var t=this;try{e.pingTimer||(e.pingTimer=setInterval(function(){return o(t,void 0,void 0,function(){var e;return s(this,function(t){switch(t.label){case 0:return L.checkConnection(this.connection)?(e=new A.CometChatPingEvent("","","","","").getAsString(),this.connection.send(e),[4,this.listenForPong()]):[3,2];case 1:t.sent()?(c.Logger.log("WSConnectionHelper :: startPingingWS","pong success"),r.CometChat.getConnectionStatus()!=i.CONNECTION_STATUS.CONNECTED&&(this.WSLogout(),this.connection=null,r.CometChat.getInstance().makeWSConnection())):(c.Logger.log("WSConnectionHelper :: startPingingWS","pong failure"),this.WSLogout(),this.connection=null,r.CometChat.getInstance().setConnectionStatus(i.CONNECTION_STATUS.DISCONNECTED),D.connectionHandlers.map(function(e){try{e._eventListener&&(c.isFalsy(e._eventListener.onDisconnected)||e._eventListener.onDisconnected())}catch(e){c.Logger.error("WSConnectionHandlers: Disconnected Status",e)}}),r.CometChat.getInstance().accidentallyDisconnected()),t.label=2;case 2:return[2]}})})},15e3))}catch(e){c.Logger.error("WSConnectionHelper: startPingingWS",e)}},e.prototype.listenForPong=function(){var e=this;return new Promise(function(t,n){var o=setTimeout(function(){t(!1)},3e3);e.connection.addEventListener("message",function(e){e&&e.data&&"string"==typeof e.data&&JSON.parse(e.data).action===v.KEYS.PONG&&(clearTimeout(o),t(!0))})})},e.prototype.clearPingTimer=function(){e.pingTimer&&(clearInterval(e.pingTimer),e.pingTimer=void 0)},e.prototype.sendOnlineEvent=function(){var e=this;try{L.checkConnection(this.connection)&&r.CometChat.getLoggedinUser().then(function(t){if(t){t.authToken&&delete t.authToken;var n={appId:r.CometChat.getAppId(),deviceId:r.CometChat.getSessionId(),type:v.PRESENCE.TYPE,body:{action:v.PRESENCE.ACTION.ONLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:t}};if(L.checkConnection(e.connection)){var o=L.stringifyMessage(n);e.connection.send(o)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: sendOnlineEvent",e)}},e.prototype.sendOfflineEvent=function(){var e=this;try{L.checkConnection(this.connection)&&r.CometChat.getLoggedinUser().then(function(t){if(t){t.authToken&&delete t.authToken;var n={appId:r.CometChat.getAppId(),deviceId:r.CometChat.getSessionId(),type:v.PRESENCE.TYPE,body:{action:v.PRESENCE.ACTION.OFFLINE,timestamp:Math.floor((new Date).getTime()/1e3),user:t}};if(L.checkConnection(e.connection)){var o=L.stringifyMessage(n);e.connection.send(o)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: sendOfflineEvent",e)}},e.prototype.startTypingIndicator=function(e,t,n){var o=this;try{r.CometChat.getLoggedinUser().then(function(s){if(s){var i=new M.TypingIndicator(e,t);s.authToken&&delete s.authToken,i.setSender(s),n&&i.setMetadata(n);var a=new y.CometChatTypingEvent(r.CometChat.getAppId(),e,t,s.getUid(),r.CometChat.getSessionId());
1if(a.setAction(v.TYPING_INDICATOR.ACTION.STARTED),a.setTypingIndicator(i),L.checkConnection(o.connection)){var E=a.getAsString();o.connection.send(E)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: startTypingIndicator",e)}},e.prototype.pauseTypingIndicator=function(e,t,n){var o=this;try{r.CometChat.getLoggedinUser().then(function(s){if(s){var i=new M.TypingIndicator(e,t);s.authToken&&delete s.authToken,i.setSender(s),n&&i.setMetadata(n);var a=new y.CometChatTypingEvent(r.CometChat.getAppId(),e,t,s.getUid(),r.CometChat.getSessionId());if(a.setAction(v.TYPING_INDICATOR.ACTION.ENDED),a.setTypingIndicator(i),L.checkConnection(o.connection)){var E=a.getAsString();o.connection.send(E)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: pauseTypingIndicator",e)}},e.prototype.markAsRead=function(e,t,n,o){var s=this;try{r.CometChat.getMode(),r.CometChat.getLoggedinUser().then(function(i){if(i){var a=new R.CometChatReceiptEvent(r.CometChat.getAppId(),e,t,i.getUid(),r.CometChat.getSessionId(),o);a.setAction(v.RECEIPTS.ACTION.READ);var E=new m.MessageReceipt;if(i.authToken&&delete i.authToken,E.setSender(i),E.setReceiverType(t),E.setReceiver(e),E.setReceiptType(v.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),E.setMessageId(n),E.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),a.setMessageReceipt(E),L.checkConnection(s.connection)){var u=a.getAsString();s.connection.send(u)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: markAsRead",e)}},e.prototype.markAsDelivered=function(e,t,n,o){var s=this;try{r.CometChat.getMode(),r.CometChat.getLoggedinUser().then(function(i){if(i){var a=new R.CometChatReceiptEvent(r.CometChat.getAppId(),e,t,i.getUid(),r.CometChat.getSessionId(),o);a.setAction(v.RECEIPTS.ACTION.DELIVERED);var E=new m.MessageReceipt;if(i.authToken&&delete i.authToken,E.setSender(i),E.setReceiverType(t),E.setReceiver(e),E.setReceiptType(v.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),E.setMessageId(n),E.setTimestamp(Math.floor((new Date).getTime()/1e3).toString()),a.setMessageReceipt(E),L.checkConnection(s.connection)){var u=a.getAsString();s.connection.send(u)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: markAsDelivered",e)}},e.prototype.sendTransientMessage=function(e,t,n){var o=this;try{r.CometChat.getLoggedinUser().then(function(s){if(s){var i=new P.TransientMessage(e,t,n);s.authToken&&delete s.authToken,i.setSender(s);var a=new N.CometChatTransientEvent(r.CometChat.getAppId(),e,t,s.getUid(),r.CometChat.getSessionId());
1if(a.setTransientMessage(i),L.checkConnection(o.connection)){var E=a.getAsString();o.connection.send(E)}}else c.Logger.log("no logged-in user","null")},function(e){c.Logger.log("error in fetching logged-in user",e)})}catch(e){c.Logger.error("WSConnectionHelper: sendTransientMessage",e)}},e.prototype.publishTypingIndicator=function(e){try{var t=e.getTypingIndicator();switch(e.getAction()){case v.TYPING_INDICATOR.ACTION.STARTED:D.messageHandlers.map(function(e){e._eventListener.onTypingStarted&&e._eventListener.onTypingStarted(t)}),E.TypingNotificationController.addIncomingTypingStarted(t);break;case v.TYPING_INDICATOR.ACTION.ENDED:D.messageHandlers.map(function(e){e._eventListener.onTypingEnded&&e._eventListener.onTypingEnded(t)}),E.TypingNotificationController.removeIncomingTypingStarted(t)}}catch(e){c.Logger.error("WSHelper: publishTypingIndicator",e)}},e.prototype.publishReceipts=function(e){try{var t=e.getMessageReceipt();switch(e.getAction()){case v.RECEIPTS.ACTION.DELIVERED:D.messageHandlers.map(function(e){e._eventListener.onMessagesDelivered&&e._eventListener.onMessagesDelivered(t)});break;case v.RECEIPTS.ACTION.READ:D.messageHandlers.map(function(e){e._eventListener.onMessagesRead&&e._eventListener.onMessagesRead(t)});break;case v.RECEIPTS.ACTION.DELIVERED_TO_ALL:D.messageHandlers.map(function(e){e._eventListener.onMessagesDeliveredToAll&&e._eventListener.onMessagesDeliveredToAll(t)});break;case v.RECEIPTS.ACTION.READ_BY_ALL:D.messageHandlers.map(function(e){e._eventListener.onMessagesReadByAll&&e._eventListener.onMessagesReadByAll(t)})}}catch(e){c.Logger.error("WSHelper: publishReceipts",e)}},e.prototype.publishPresence=function(e){try{var t=e.getUser();switch(t.setLastActiveAt(e.getTimestamp()),e.getAction()){case v.PRESENCE.ACTION.ONLINE:case v.PRESENCE.ACTION.AVAILABLE:t.setStatus(i.PresenceConstants.STATUS.ONLINE),D.userHandlers.map(function(e){c.isFalsy(e._eventListener.onUserOnline)||e._eventListener.onUserOnline(t)});break;case v.PRESENCE.ACTION.OFFLINE:t.setStatus(i.PresenceConstants.STATUS.OFFLINE),D.userHandlers.map(function(e){c.isFalsy(e._eventListener.onUserOffline)||e._eventListener.onUserOffline(t)})}}catch(e){c.Logger.error("WSHelper: publishPresence",e)}},e.prototype.publishMessages=function(e){try{var t=e.getMessage();t&&t.getId()&&p.MessageListnerMaping.getInstance().set("all",t.getId()),t instanceof d.Call?this.publishCallMessage(t):t instanceof l.Action?this.publishActionMessage(t):this.publishMessage(t)}catch(e){c.Logger.error("WSHelper: publishMessages",e)}},e.prototype.publishMessage=function(e){try{D.messageHandlers.map(function(t){if(t._eventListener)switch(e.getType()){case i.MessageConstatnts.TYPE.TEXT:c.isFalsy(t._eventListener.onTextMessageReceived)||t._eventListener.onTextMessageReceived(e);break;case i.MessageConstatnts.TYPE.CUSTOM:c.isFalsy(t._eventListener.onCustomMessageReceived)||t._eventListener.onCustomMessageReceived(e);break;default:if(e.getCategory()==i.MessageCategory.CUSTOM)c.isFalsy(t._eventListener.onCustomMessageReceived)||t._eventListener.onCustomMessageReceived(e);else if(e.getCategory()==i.MessageCategory.INTERACTIVE)c.isFalsy(t._eventListener.onInteractiveMessageReceived)||t._eventListener.onInteractiveMessageReceived(e);else if(e.getCategory()===i.MessageCategory.AGENTIC)switch(e.getType()){case i.MessageConstatnts.TYPE.ASSISTANT:c.isFalsy(t._eventListener.onAIAssistantMessageReceived)||t._eventListener.onAIAssistantMessageReceived(e);break;case i.MessageConstatnts.TYPE.TOOL_RESULT:c.isFalsy(t._eventListener.onAIToolResultReceived)||t._eventListener.onAIToolResultReceived(e);break;case i.MessageConstatnts.TYPE.TOOL_ARGUMENTS:c.isFalsy(t._eventListener.onAIToolArgumentsReceived)||t._eventListener.onAIToolArgumentsReceived(e)}else c.isFalsy(t._eventListener.onMediaMessageReceived)||t._eventListener.onMediaMessageReceived(e)}})}catch(e){c.Logger.error("WSHelper: publishMessage",e)}},e.prototype.publishModerationStatusChangedMessage=function(e){var t=e.getMessage();try{D.messageHandlers.map(function(e){e._eventListener&&(c.isFalsy(e._eventListener.onMessageModerated)||e._eventListener.onMessageModerated(t))})}catch(e){c.Logger.error("WSHelper: publishModerationStatusChangedMessage",e)}},e.prototype.publishCallMessage=function(e){try{var t=a.CallController.getInstance().getActiveCall();switch(e.getStatus()){case i.CallConstants.CALL_STATUS.INITIATED:e.getReceiverType()==i.CallConstants.RECEIVER_TYPE_GROUP?D.callHandlers.map(function(t){e.getCallInitiator().getUid().toLocaleLowerCase()!=r.CometChat.user.getUid().toLocaleLowerCase()&&(c.isFalsy(t._eventListener.onIncomingCallReceived)||t._eventListener.onIncomingCallReceived(e))}):D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onIncomingCallReceived)||t._eventListener.onIncomingCallReceived(e)});break;case i.CallConstants.CALL_STATUS.ONGOING:e.getReceiverType()==i.CallConstants.RECEIVER_TYPE_GROUP?e.getCallInitiator().getUid().toLocaleLowerCase()==r.CometChat.user.getUid().toLocaleLowerCase()&&D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallAccepted)||t._eventListener.onOutgoingCallAccepted(e)}):(a.CallController.getInstance().clearTimer(),D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallAccepted)||t._eventListener.onOutgoingCallAccepted(e)}));break;case i.CallConstants.CALL_STATUS.UNANSWERED:if(e.getCallInitiator().getUid().toLocaleLowerCase()==r.CometChat.user.getUid().toLocaleLowerCase())D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)});else{if(null!==t&&t.getSessionId()===e.getSessionId())try{a.CallController.getInstance().endCall()}catch(e){c.Logger.error("CallError",e)}D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onIncomingCallCancelled)||t._eventListener.onIncomingCallCancelled(e)})}break;case i.CallConstants.CALL_STATUS.REJECTED:if(e.getReceiverType()==i.CallConstants.RECEIVER_TYPE_GROUP)e.getCallInitiator().getUid().toLocaleLowerCase()==r.CometChat.user.getUid().toLocaleLowerCase()&&D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)});else{if(null!==t&&t.getSessionId()===e.getSessionId())try{a.CallController.getInstance().endCall()}catch(e){c.Logger.error("CallError",e)}D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)})}break;case i.CallConstants.CALL_STATUS.BUSY:e.getReceiverType()==i.CallConstants.RECEIVER_TYPE_GROUP?e.getCallInitiator().getUid().toLocaleLowerCase()==r.CometChat.user.getUid().toLocaleLowerCase()&&D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onOutgoingCallRejected)||t._eventListener.onOutgoingCallRejected(e)}):D.callHandlers.map(function(n){if(null!==t&&t.getSessionId()===e.getSessionId())try{a.CallController.getInstance().endCall()}catch(e){c.Logger.error("CallError",e)}c.isFalsy(n._eventListener.onOutgoingCallRejected)||n._eventListener.onOutgoingCallRejected(e)});break;case i.CallConstants.CALL_STATUS.CANCELLED:if(D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onIncomingCallCancelled)||t._eventListener.onIncomingCallCancelled(e)}),null!==t&&t.getSessionId()===e.getSessionId())try{a.CallController.getInstance().endCall()}catch(e){c.Logger.error("CallError",e)}break;case i.CallConstants.CALL_STATUS.ENDED:if(D.callHandlers.map(function(t){c.isFalsy(t._eventListener.onCallEndedMessageReceived)||t._eventListener.onCallEndedMessageReceived(e)}),a.CallController.getInstance().getCallListner()&&a.CallController.getInstance().getCallListner()._eventListener.onCallEnded(e),null!==t&&t.getSessionId()===e.getSessionId())try{a.CallController.getInstance().endCall()}catch(e){c.Logger.error("CallError",e)}break;default:c.Logger.log("WSHelper: publishCallMessage :: unknown status",e)}}catch(e){c.Logger.error("WSHelper: publishCallMessage",e)}},e.prototype.publishActionMessage=function(e){try{switch(e.getAction()){case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_JOINED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberJoined)||t._eventListener.onGroupMemberJoined(e,e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_INVITED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberJoined)||t._eventListener.onGroupMemberJoined(e,e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_LEFT:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberLeft)||t._eventListener.onGroupMemberLeft(e,e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_BANNED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberBanned)||t._eventListener.onGroupMemberBanned(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_KICKED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberKicked)||t._eventListener.onGroupMemberKicked(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_UNBANNED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberUnbanned)||t._eventListener.onGroupMemberUnbanned(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_SCOPE_CHANGED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberScopeChanged)||t._eventListener.onGroupMemberScopeChanged(e,e.getActionOn(),e.getNewScope(),e.getOldScope(),e.getActionFor())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_EDITED:D.messageHandlers.map(function(t){c.isFalsy(t._eventListener.onMessageEdited)||t._eventListener.onMessageEdited(e.getActionOn())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MESSAGE_DELETED:D.messageHandlers.map(function(t){c.isFalsy(t._eventListener.onMessageDeleted)||t._eventListener.onMessageDeleted(e.getActionOn())});break;case i.ActionConstatnts.ACTION_TYPE.TYPE_MEMBER_ADDED:D.groupHandlers.map(function(t){c.isFalsy(t._eventListener.onGroupMemberAddedToGroup)||t._eventListener.onGroupMemberAddedToGroup(e,e.getActionOn(),e.getActionBy(),e.getActionFor())});break;default:c.Logger.log("WSHelper: publishActionMessage :: unknown action",e)}}catch(e){c.Logger.error("WSHelper: publishActionMessage",e)}},e.prototype.publishTransientMessage=function(e){try{var t=e.getTransientMessage();D.messageHandlers.map(function(e){e._eventListener.onTransientMessageReceived&&e._eventListener.onTransientMessageReceived(t)})}catch(e){c.Logger.error("WSHelper: publishTransientMessage",e)}},e.prototype.publishInteractionReceipt=function(e){try{var t=e.getInteractionReceipt();D.messageHandlers.map(function(e){e._eventListener.onInteractionGoalCompleted&&e._eventListener.onInteractionGoalCompleted(t)})}catch(e){c.Logger.error("WSHelper: publishInteractionReceipt",e)}},e.prototype.getCometChatEventFromMessage=function(e){try{if(e.hasOwnProperty(v.KEYS.TYPE))switch(e.type){case v.TYPING_INDICATOR.TYPE:return y.CometChatTypingEvent.getTypingEventFromJSON(e);case v.RECEIPTS.TYPE:return R.CometChatReceiptEvent.getReceiptEventFromJSON(e);case v.PRESENCE.TYPE:return f.CometChatPresenceEvent.getPresenceEventFromJSON(e);
1case v.MESSAGE.TYPE:return h.CometChatMessageEvent.getMessageEventFromJSON(e);case v.AUTH.TYPE:return _.CometChatAuthEvent.getAuthEventFromJSON(e);case v.TRANSIENT_MESSAGE.TYPE:return N.CometChatTransientEvent.getTransientEventFromJSON(e);case v.INTERACTION_RECEIPT.TYPE:return T.CometChatInteractionReceiptEvent.getReceiptEventFromJSON(e);case v.MESSAGE_REACTION.TYPE:return I.CometChatReactionEvent.getReactionEventFromJSON(e);case v.MODERATION_STATUS_CHANGED.TYPE:return g.CometChatModerationStatusChangeEvent.getMessageEventFromJSON(e);case v.STREAM_MESSAGE.TYPE:return O.CometChatStreamMessageEvent.getMessageEventFromJSON(e)}}catch(e){c.Logger.error("WSConnectionHelper: getCometChatEventFromMessage",e)}},e.wsConnectionHelper=new e,e}()},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 r=n(4),i=n(34);t.CometChatAuthEvent=function(e){function t(t,n,o,s,i){var a=e.call(this,t,n,o,s,i)||this;return a.roles=[],a.setType(r.AUTH.TYPE),a}return s(t,e),t.prototype.getStatus=function(){return this.status},t.prototype.setStatus=function(e){this.status=e},t.prototype.getCode=function(){return this.code},t.prototype.setCode=function(e){this.code=e},t.prototype.setAuth=function(e){this.auth=e},t.prototype.getAuth=function(){return this.auth},t.prototype.setPresenceSubscription=function(e){this.presenceSubscription=e},t.prototype.getPresenceSubscription=function(){return this.presenceSubscription},t.prototype.setDeviceId=function(e){this.deviceId=e},t.prototype.getdeviceId=function(){return this.deviceId},t.prototype.setExtraParmaeters=function(e){this.params=e},t.prototype.getExtraParameters=function(){return this.params},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.setRoles=function(e){this.roles=e},t.prototype.getRoles=function(){return this.roles},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};t[r.KEYS.AUTH]=this.auth,t[r.KEYS.DEVICE_ID]=this.deviceId;var n=this.getPresenceSubscription(),o=this.getRoles();return(t[r.KEYS.PRESENCE_SUBSCRIPTION]=n)===i.AppSettings.SUBSCRIPTION_TYPE_ROLES&&0<o.length&&(t[r.KEYS.ROLES]=o),t[r.KEYS.PARAMS]=this.params,e[r.KEYS.BODY]=t,e},t.getAuthEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.RECEIVER],s=e[r.KEYS.RECEIVER_TYPE],i=e[r.KEYS.DEVICE_ID],a=e[r.KEYS.SENDER],E=e[r.KEYS.BODY],c=E[r.KEYS.STATUS],u=E[r.KEYS.CODE],S=new t(n,o,s,a,i);return S.setStatus(c),S.setCode(u),S},t}(n(9).CometChatEvent)},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 r=n(4),i=n(9),a=n(26),E=n(52),c=n(3);t.CometChatInteractionReceiptEvent=function(e){function t(t,n,o,s,i,a){var E=e.call(this,t,n,o,s,i,a)||this;return E.setType(r.INTERACTION_RECEIPT.TYPE),E}return s(t,e),t.prototype.getInteractionReceipt=function(){return this.interactionReceipt},t.prototype.setInteractionReceipt=function(e){this.interactionReceipt=e},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[r.KEYS.MESSAGE_ID]=this.interactionReceipt.getMessageId(),t[r.KEYS.USER]=this.interactionReceipt.getSender(),t[r.KEYS.INTERACTIONS]=this.interactionReceipt.getInteractions(),e[r.KEYS.BODY]=t,e},t.getReceiptEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.RECEIVER],s=e[r.KEYS.RECEIVER_TYPE],i=e[r.KEYS.DEVICE_ID],u=e[r.KEYS.SENDER],S=e[r.KEYS.MESSAGE_SENDER],p=e[r.KEYS.BODY],l=p[r.KEYS.USER],C=p[r.KEYS.MESSAGE_ID],d=p[r.KEYS.INTERACTIONS],_=new t(n,o,s,u,i,S),T=new E.InteractionReceipt;
1return T.setSender(new c.User(l)),T.setReceiverType(s),T.setMessageId(C),T.setReceiverId(o),T.setInteractions(d.map(function(e){return a.Interaction.getInteractionFromJSON(e)})),_.setInteractionReceipt(T),_},t}(i.CometChatEvent)},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 r=n(13),i=n(4);t.CometChatMessageEvent=function(e){function t(t,n,o,s,r){var a=e.call(this,t,n,o,s,r)||this;return a.setType(i.MESSAGE.TYPE),a}return s(t,e),t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.getMessageEventFromJSON=function(e){var n=e[i.KEYS.APP_ID],o=e[i.KEYS.RECEIVER],s=e[i.KEYS.RECEIVER_TYPE],a=e[i.KEYS.DEVICE_ID],E=e[i.KEYS.SENDER],c=e[i.KEYS.BODY],u=new t(n,o,s,E,a),S=r.MessageController.trasformJSONMessge(c);return u.setMessage(S),u},t}(n(9).CometChatEvent)},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.CometChatModerationStatusChangeEvent=void 0;var r=n(13),i=n(4);t.CometChatModerationStatusChangeEvent=function(e){function t(t,n,o,s,r){var a=e.call(this,t,n,o,s,r)||this;return a.setType(i.MODERATION_STATUS_CHANGED.TYPE),a}return s(t,e),t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.getMessageEventFromJSON=function(e){var n=e[i.KEYS.APP_ID],o=e[i.KEYS.RECEIVER],s=e[i.KEYS.RECEIVER_TYPE],a=e[i.KEYS.DEVICE_ID],E=e[i.KEYS.SENDER],c=e[i.KEYS.BODY],u=new t(n,o,s,E,a),S=r.MessageController.trasformJSONMessge(c);return u.setMessage(S),u},t}(n(9).CometChatEvent)},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 r=n(4);t.CometChatPingEvent=function(e){function t(t,n,o,s,r){return e.call(this,t,n,o,s,r)||this}return s(t,e),t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e={};return e[r.KEYS.ACTION]=r.KEYS.PING,e[r.KEYS.ACK]="true",e},t}(n(9).CometChatEvent)},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 r=n(4),i=n(9),a=n(3);t.CometChatPresenceEvent=function(e){function t(t,n,o,s,i){var a=e.call(this,t,n,o,s,i)||this;return a.setType(r.PRESENCE.TYPE),a}return s(t,e),t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getUser=function(){return this.user},t.prototype.setUser=function(e){this.user=e},t.prototype.getTimestamp=function(){return this.timestamp},t.prototype.setTimestamp=function(e){this.timestamp=e},t.getPresenceEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.DEVICE_ID],s=e[r.KEYS.SENDER],i=e[r.KEYS.BODY],E=i[r.KEYS.ACTION],c=i[r.KEYS.USER],u=i[r.KEY
1S.TIMESTAMP],S=new t(n,"","",s,o);return S.setAction(E),S.setUser(new a.User(c)),S.setTimestamp(u),S},t}(i.CometChatEvent)},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 r=n(4),i=n(9),a=n(35),E=n(53);t.CometChatReactionEvent=function(e){function t(t,n,o,s,i){var a=e.call(this,t,n,o,s,i)||this;return a.setType(r.MESSAGE_REACTION.TYPE),a}return s(t,e),t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getMessageReactionEvent=function(){return this.reaction},t.prototype.setMessageReactionEvent=function(e){this.reaction=e},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[r.KEYS.ACTION]=this.action,t[r.KEYS.REACTION]=this.reaction,e[r.KEYS.BODY]=t,e},t.getReactionEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.DEVICE_ID],s=e[r.KEYS.SENDER],i=e[r.KEYS.RECEIVER],c=e[r.KEYS.RECEIVER_TYPE],u=e[r.KEYS.BODY],S=u[r.KEYS.ACTION],p=u[r.KEYS.ID],l=u[r.KEYS.MESSAGE_ID],C=u[r.KEYS.UID],d=u[r.KEYS.REACTION],_=u[r.KEYS.REACTED_BY],T=u[r.KEYS.REACTED_AT],h=u[r.KEYS.CONVERSATION_ID],g=u[r.KEYS.PARENT_ID],A=new a.Reaction(p,l,d,C,T,_),f=new E.ReactionEvent(A,i,c,h,g),I=new t(n,i,c,s,o);return I.setAction(S),I.setMessageReactionEvent(f),I},t}(i.CometChatEvent)},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 r=n(4),i=n(9),a=n(18),E=n(3);t.CometChatReceiptEvent=function(e){function t(t,n,o,s,i,a){var E=e.call(this,t,n,o,s,i,a)||this;return E.setType(r.RECEIPTS.TYPE),E}return s(t,e),t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getMessageReceipt=function(){return this.receipt},t.prototype.setMessageReceipt=function(e){this.receipt=e},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[r.KEYS.ACTION]=this.action,t[r.KEYS.MESSAGE_ID]=this.receipt.getMessageId(),t[r.KEYS.USER]=this.receipt.getSender(),e[r.KEYS.BODY]=t,e},t.getReceiptEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.RECEIVER],s=e[r.KEYS.RECEIVER_TYPE],i=e[r.KEYS.DEVICE_ID],c=e[r.KEYS.SENDER],u=e[r.KEYS.BODY],S=u[r.KEYS.ACTION],p=u[r.KEYS.USER],l=u[r.KEYS.MESSAGE_ID],C=u[r.KEYS.TIMESTAMP],d=new t(n,o,s,c,i);d.setAction(S);var _=new a.MessageReceipt;return _.setSender(new E.User(p)),_.setReceiverType(s),_.setReceiver(o),S===r.RECEIPTS.ACTION.DELIVERED&&(_.setReceiptType(r.RECEIPTS.RECEIPT_TYPE.DELIVERY_RECEIPT),_.setDeliveredAt(C)),S===r.RECEIPTS.ACTION.READ&&(_.setReceiptType(r.RECEIPTS.RECEIPT_TYPE.READ_RECEIPT),_.setReadAt(C)),S===r.RECEIPTS.ACTION.READ_BY_ALL&&(_.setReceiptType(r.RECEIPTS.RECEIPT_TYPE.READ_BY_ALL_RECEIPT),_.setReadAt(C)),S===r.RECEIPTS.ACTION.DELIVERED_TO_ALL&&(_.setReceiptType(r.RECEIPTS.RECEIPT_TYPE.DELIVERY_TO_ALL_RECEIPT),_.setDeliveredAt(C)),_.setMessageId(l.toString()),_.setTimestamp(C),d.setMessageReceipt(_),d},t}(i.CometChatEvent)},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)};
1Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatStreamMessageEvent=void 0;var i=n(4),a=n(9),E=n(54),c=n(0);t.CometChatStreamMessageEvent=function(e){function t(t,n,o,s,r){var a=e.call(this,t,n,o,s,r)||this;return a.setType(i.STREAM_MESSAGE.TYPE),a}return s(t,e),t.prototype.getMessage=function(){return this.message},t.prototype.setMessage=function(e){this.message=e},t.createAssistantEventFromMessage=function(e){var t=e.type,n=e.conversationId||"",o=e.id||"",s=e.parentId||"",i=e.data||{timestamp:Date.now()},a={timestamp:i.timestamp||Date.now(),runId:i.runId||"",threadId:i.threadId||""};switch(t){case c.AI_ASSISTANT_EVENTS.RUN_STARTED:return new E.AIAssistantRunStartedEvent(n,o,s,a);case c.AI_ASSISTANT_EVENTS.RUN_FINISHED:return new E.AIAssistantRunFinishedEvent(n,o,s,a);case c.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_START:var u=r(r({},a),{role:i.role||""});return new E.AIAssistantMessageStartedEvent(n,o,s,u);case c.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_END:return new E.AIAssistantMessageEndedEvent(n,o,s,a);case c.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_CONTENT:var S=r(r({},a),{delta:i.delta||""});return new E.AIAssistantContentReceivedEvent(n,o,s,S);case c.AI_ASSISTANT_EVENTS.TOOL_CALL_STARTED:var p=r(r({},a),{toolCallId:i.toolCallId||"",toolCallName:i.toolCallName||"",displayName:i.displayName||"",executionText:i.executionText||""});return new E.AIAssistantToolStartedEvent(n,o,s,p);case c.AI_ASSISTANT_EVENTS.TOOL_CALL_ENDED:var l=r(r({},a),{toolCallId:i.toolCallId||""});return new E.AIAssistantToolEndedEvent(n,o,s,l);case c.AI_ASSISTANT_EVENTS.TOOL_CALL_RESULT:var C=r(r({},a),{toolCallId:i.toolCallId||"",content:i.content||"",role:i.role||""});return new E.AIAssistantToolResultEvent(n,o,s,C);case c.AI_ASSISTANT_EVENTS.TOOL_CALL_ARGUMENT:var d=r(r({},a),{toolCallId:i.toolCallId||"",delta:i.delta||""});return new E.AIAssistantToolArgumentEvent(n,o,s,d);default:var _=r(r({},a),i);return new E.AIAssistantBaseEvent(t,n,o,s,_)}},t.getMessageEventFromJSON=function(e){var n=e[i.KEYS.APP_ID],o=e[i.KEYS.RECEIVER],s=e[i.KEYS.RECEIVER_TYPE],r=e[i.KEYS.DEVICE_ID],a=e[i.KEYS.SENDER],E=e[i.KEYS.BODY],c=new t(n,o,s,a,r),u=t.createAssistantEventFromMessage(E);return c.setMessage(u),c},t}(a.CometChatEvent)},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.AIAssistantRunStartedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantRunStartedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.RUN_STARTED,t,n,o,s)||this}return s(t,e),t}(r.AIAssistantBaseEvent)},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.AIAssistantRunFinishedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantRunFinishedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.RUN_FINISHED,t,n,o,s)||this}return s(t,e),t}(r.AIAssistantBaseEvent)},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.AIAssistantMessageStartedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantMessageStartedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_START,t,n,o,s)||this}return s(t,e),t.prototype.getRole=function(){return this.data.role},t.prototype.setRole=function(e){this.data.role=e},t}(r.AIAssistantBaseEvent)},function(e,t,n){"use strict";
1var 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.AIAssistantMessageEndedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantMessageEndedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_END,t,n,o,s)||this}return s(t,e),t}(r.AIAssistantBaseEvent)},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.AIAssistantContentReceivedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantContentReceivedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TEXT_MESSAGE_CONTENT,t,n,o,s)||this}return s(t,e),t.prototype.getDelta=function(){return this.data.delta},t.prototype.setDelta=function(e){this.data.delta=e},t}(r.AIAssistantBaseEvent)},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.AIAssistantToolStartedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantToolStartedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TOOL_CALL_STARTED,t,n,o,s)||this}return s(t,e),t.prototype.getToolCallId=function(){return this.data.toolCallId},t.prototype.setToolCallId=function(e){this.data.toolCallId=e},t.prototype.getToolCallName=function(){return this.data.toolCallName},t.prototype.setToolCallName=function(e){this.data.toolCallName=e},t.prototype.getDisplayName=function(){return this.data.displayName},t.prototype.setDisplayName=function(e){this.data.displayName=e},t.prototype.getExecutionText=function(){return this.data.executionText},t.prototype.setExecutionText=function(e){this.data.executionText=e},t}(r.AIAssistantBaseEvent)},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.AIAssistantToolArgumentEvent=void 0;var r=n(10),i=n(0);t.AIAssistantToolArgumentEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TOOL_CALL_ARGUMENT,t,n,o,s)||this}return s(t,e),t.prototype.getToolCallId=function(){return this.data.toolCallId},t.prototype.setToolCallId=function(e){this.data.toolCallId=e},t.prototype.getDelta=function(){return this.data.delta},t.prototype.setDelta=function(e){this.data.delta=e},t}(r.AIAssistantBaseEvent)},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.AIAssistantToolEndedEvent=void 0;var r=n(10),i=n(0);t.AIAssistantToolEndedEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TOOL_CALL_ENDED,t,n,o,s)||this}return s(t,e),t.prototype.getToolCallId=function(){return this.data.toolCallId},t.prototype.setToolCallId=function(e){this.data.toolCallId=e},t.fromJSON=function(e){return new t(e.conversationId,e.messageId,e.parentMessageId,e.data)},t}(r.AIAssistantBaseEvent)},function(e,t,n){"use strict";
1var 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.AIAssistantToolResultEvent=void 0;var r=n(10),i=n(0);t.AIAssistantToolResultEvent=function(e){function t(t,n,o,s){return e.call(this,i.AI_ASSISTANT_EVENTS.TOOL_CALL_RESULT,t,n,o,s)||this}return s(t,e),t.prototype.getToolCallId=function(){return this.data.toolCallId},t.prototype.setToolCallId=function(e){this.data.toolCallId=e},t.prototype.getContent=function(){return this.data.content},t.prototype.setContent=function(e){this.data.content=e},t.prototype.getRole=function(){return this.data.role},t.prototype.setRole=function(e){this.data.role=e},t}(r.AIAssistantBaseEvent)},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 r=n(4),i=n(9),a=n(36),E=n(3);t.CometChatTransientEvent=function(e){function t(t,n,o,s,i){var a=e.call(this,t,n,o,s,i)||this;return a.setType(r.TRANSIENT_MESSAGE.TYPE),a}return s(t,e),t.prototype.getTransientMessage=function(){return this.transientMessage},t.prototype.setTransientMessage=function(e){this.transientMessage=e},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[r.KEYS.USER]=this.transientMessage.getSender(),this.transientMessage.getData()&&(t[r.KEYS.DATA]=this.transientMessage.getData()),e[r.KEYS.BODY]=t,e},t.getTransientEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.RECEIVER],s=e[r.KEYS.RECEIVER_TYPE],i=e[r.KEYS.DEVICE_ID],c=e[r.KEYS.SENDER],u=e[r.KEYS.BODY],S=u[r.KEYS.USER],p=u[r.KEYS.DATA],l=new t(n,o,s,c,i),C=new a.TransientMessage(o,s,p);return C.setSender(new E.User(S)),u.hasOwnProperty(r.KEYS.DATA)&&u[r.KEYS.DATA]&&C.setData(p),l.setTransientMessage(C),l},t}(i.CometChatEvent)},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 r=n(4),i=n(9),a=n(33),E=n(3);t.CometChatTypingEvent=function(e){function t(t,n,o,s,i){var a=e.call(this,t,n,o,s,i)||this;return a.setType(r.TYPING_INDICATOR.TYPE),a}return s(t,e),t.prototype.getAction=function(){return this.action},t.prototype.setAction=function(e){this.action=e},t.prototype.getTypingIndicator=function(){return this.typingIndicator},t.prototype.setTypingIndicator=function(e){this.typingIndicator=e},t.prototype.getAsString=function(){return JSON.stringify(this.getAsJSONObject())},t.prototype.getAsJSONObject=function(){var e=this.getCometChatEventJSON(),t={};return t[r.KEYS.ACTION]=this.action,t[r.KEYS.USER]=this.typingIndicator.getSender(),this.typingIndicator.getMetadata()&&(t[r.KEYS.METADATA]=this.typingIndicator.getMetadata()),e[r.KEYS.BODY]=t,e},t.getTypingEventFromJSON=function(e){var n=e[r.KEYS.APP_ID],o=e[r.KEYS.RECEIVER],s=e[r.KEYS.RECEIVER_TYPE],i=e[r.KEYS.DEVICE_ID],c=e[r.KEYS.SENDER],u=e[r.KEYS.BODY],S=u[r.KEYS.ACTION],p=u[r.KEYS.USER],l=u[r.KEYS.METADATA],C=new t(n,o,s,c,i);C.setAction(S);var d=new a.TypingIndicator(o,s);return d.setSender(new E.User(p)),u.hasOwnProperty(r.KEYS.METADATA)&&u[r.KEYS.METADATA]&&d.setMetadata(l),C.setTypingIndicator(d),C},t}(i.CometChatEvent)},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.getWSURL=t.stringifyMessage=t.checkConnection=void 0;var o=n(0),s=n(1),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(e,t){s.getAppSettings().then(function(t){e(r.WS.protocol+s.getChatHost(t)+":"+t[o.APP_SETTINGS.KEYS.CHAT_WSS_PORT])},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(1);t.CCExtension=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}()},function(e,t,n){"use strict";var o=this&&this.__assign||function(){return(o=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)},s=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.PostDetails=void 0;var i=n(0),a=n(29),E=n(6),c=n(37);t.PostDetails=function(){function e(){var e=this;this.wpPlugin={version:""},this.builder={version:""},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)},a.KeyStore.getInstance().get(i.LOCAL_STORE.KEY_DEVICE_ID).then(function(t){t&&(e.deviceId=t)}),this.getSDKVersion(),this.getBuilderVersion(),this.getWPPluginVersion(),this.getPlatform(),this.getOrgin(),setTimeout(function(){e.getCallSDKVersion(),e.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.getBuilderVersion=function(){window.CometChatVisualBuilderReact&&(this.builder=window.CometChatVisualBuilderReact)},e.prototype.getWPPluginVersion=function(){window.CometChatWP&&(this.wpPlugin=window.CometChatWP)},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.getVCBPlatform=function(e){return e?e.includes("react")?e.includes("no-code")?"react-no-code":"react":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(e){return s(this,void 0,void 0,function(){var t;return r(this,function(n){switch(n.label){case 0:return t=(new TextEncoder).encode(e),[4,crypto.subtle.digest("SHA-256",t)];case 1:return[2,Array.from(new Uint8Array(n.sent())).map(function(e){return e.toString(16).padStart(2,"0")}).join("")]}})})},e.prototype.getSessionIdHash=function(){var e,t,n,o;return s(this,void 0,void 0,function(){var s;return r(this,function(r){switch(r.label){case 0:return s=""+i.SDKHeader.sdkVersion+(null!=(e=this.callSDK.version)?e:null)+(null!=(t=this.uiKitSDK.version)?t:null)+(null!=(n=this.builder.version)?n:null)+(null!=(o=this.wpPlugin.version)?o:null)+this.debugMode+(c.CometChat.demoMetaInfo?c.CometChat.demoMetaInfo.version:null),[4,this.encodeSHA256(s)];case 1:return[2,r.sent()]}})})},e.prototype.getStoredSessionIdHash=function(){return s(this,void 0,void 0,function(){return r(this,function(e){switch(e.label){case 0:return[4,a.KeyStore.getInstance().get(i.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 e;return s(this,void 0,void 0,function(){var t,n,u=this;return r(this,function(S){switch(S.label){case 0:return[4,this.get
1SessionIdHash()];case 1:return t=S.sent(),[4,this.getStoredSessionIdHash()];case 2:return S.sent()===t||(n={sessionId:t,data:o(o({cometchat:o(o(o(o(o({},this.builder.version?{vcb:{platform:this.getVCBPlatform(this.builder.name),version:this.builder.version}}:{}),this.wpPlugin.version?{"wordpress-plugin":{platform:"wordpress",version:this.wpPlugin.version}}:{}),this.uiKitSDK.version?{uikit:{platform:this.getUIKitPlatform(this.uiKitSDK.name),version:this.uiKitSDK.version}}:{}),{chatsdk:{platform:"javascript",version:i.SDKHeader.sdkVersion}}),this.callSDK.version?{callssdk:{platform:"javascript",version:this.callSDK.version}}:{})},c.CometChat.demoMetaInfo?{demo:{name:c.CometChat.demoMetaInfo.name,type:c.CometChat.demoMetaInfo.type,version:c.CometChat.demoMetaInfo.version,platform:c.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+" \xd7 "+window.screen.height,userAgent:navigator.userAgent,timezone:this.getTimeZone(),os:{name:this.getOperatingSystem()}},meta:{network:null==(e=navigator.connection)?void 0:e.effectiveType,deviceOrientation:this.getOrientation()}}),generatedAt:Math.ceil((new Date).valueOf()/1e3)},E.makeApiCall("userSessions",{},n).then(function(e){return s(u,void 0,void 0,function(){return r(this,function(t){switch(t.label){case 0:return e.data.sessionId?[4,a.KeyStore.getInstance().set(i.LOCAL_STORE.KEY_SESSION_ID,e.data.sessionId)]:[3,2];case 1:t.sent(),t.label=2;case 2:return[2]}})})})),[2]}})})},e}()},function(e,t,n){"use strict";var o=this&&this.__assign||function(){return(o=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)},s=this&&this.__awaiter||function(e,t,n,o){return new(n||(n=Promise))(function(s,r){function i(e){try{E(o.next(e))}catch(e){r(e)}}function a(e){try{E(o.throw(e))}catch(e){r(e)}}function E(e){var t;e.done?s(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(i,a)}E((o=o.apply(e,t||[])).next())})},r=this&&this.__generator||function(e,t){var n,o,s,r,i={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]};return r={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(r[Symbol.iterator]=function(){return this}),r;function a(r){return function(a){var E=[r,a];if(n)throw TypeError("Generator is already executing.");for(;i;)try{if(n=1,o&&(s=2&E[0]?o.return:E[0]?o.throw||((s=o.return)&&s.call(o),0):o.next)&&!(s=s.call(o,E[1])).done)return s;switch(o=0,s&&(E=[2&E[0],s.value]),E[0]){case 0:case 1:s=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,o=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(!(s=0<(s=i.trys).length&&s[s.length-1])&&(6===E[0]||2===E[0])){i=0;continue}if(3===E[0]&&(!s||E[1]>s[0]&&E[1]<s[3])){i.label=E[1];break}if(6===E[0]&&i.label<s[1]){i.label=s[1],s=E;break}if(s&&i.label<s[2]){i.label=s[2],i.ops.push(E);break}s[2]&&i.ops.pop(),i.trys.pop();continue}E=t.call(e,i)}catch(e){E=[6,e],o=0}finally{n=s=0}if(5&E[0])throw E[1];return{value:E[0]?E[1]:void 0,done:!0}}}};Object.defineProperty(t,"__esModule",{value:!0}),t.ReactionsRequestBuilder=t.ReactionsRequest=void 0;var i=n(2),a=n(6),E=n(1),c=n(0),u=n(12),S=n(35),p=n(3),l=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(t,n){return s(e,void 0,void 0,function(){var e,s,a,S,p;return r(this,function(r){switch(r.label){case 0:if(r.trys.push([0,5,,6]),this.inProgress)return this.inProgress=!1,n(new i.CometChatException(u.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,n(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ER
1ROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];e=o(((S={limit:this.limit})[c.MessageConstatnts.PAGINATION.KEYS.AFFIX]=c.MessageConstatnts.PAGINATION.AFFIX.APPEND,S),null!=(p=this.nextPage)?p:{}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.makeAPICall(e)];case 2:return t(r.sent()),this.inProgress=!1,[3,4];case 3:return s=r.sent(),this.inProgress=!1,n(new i.CometChatException(s)),[3,4];case 4:return[3,6];case 5:return a=r.sent(),this.inProgress=!1,n(new i.CometChatException(a)),[3,6];case 6:return[2]}})})})},e.prototype.fetchPrevious=function(){var e=this;return new Promise(function(t,n){return s(e,void 0,void 0,function(){var e,s,a,S,p;return r(this,function(r){switch(r.label){case 0:if(r.trys.push([0,5,,6]),this.inProgress)return n(new i.CometChatException(u.MESSAGES_REQUEST_ERRORS.REQUEST_IN_PROGRESS_ERROR)),this.inProgress=!1,[2];if(this.inProgress=!0,0==this.msgId)return this.inProgress=!1,n(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ERROR.METHOD_COMPULSORY),"SET_MESSAGE_ID","SET_MESSAGE_ID","Message Id")))),[2];e=o(((S={limit:this.limit})[c.MessageConstatnts.PAGINATION.KEYS.AFFIX]=c.MessageConstatnts.PAGINATION.AFFIX.PREPEND,S),null!=(p=this.previousPage)?p:{}),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.makeAPICall(e)];case 2:return t(r.sent()),this.inProgress=!1,[3,4];case 3:return s=r.sent(),this.inProgress=!1,n(new i.CometChatException(s)),[3,4];case 4:return[3,6];case 5:return a=r.sent(),this.inProgress=!1,n(new i.CometChatException(a)),[3,6];case 6:return[2]}})})})},e.prototype.makeAPICall=function(e){var t=this;return new Promise(function(n,o){try{var u=t.limit;if(void 0===u)return void o(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ERROR.METHOD_COMPULSORY),"SET_LIMIT","SET_LIMIT","Set Limit"))));if(isNaN(u))return void o(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ERROR.PARAMETER_MUST_BE_A_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));if(u>c.DEFAULT_VALUES.REACTIONS_MAX_LIMIT)return void o(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ERROR.LIMIT_EXCEEDED),"SET_LIMIT","SET_LIMIT",c.DEFAULT_VALUES.REACTIONS_MAX_LIMIT))));if(u<c.DEFAULT_VALUES.ZERO)return void o(new i.CometChatException(JSON.parse(E.format(JSON.stringify(c.GENERAL_ERROR.PARAMETER_MUST_BE_A_POSITIVE_NUMBER),"SET_LIMIT","SET_LIMIT","setLimit()"))));t.createEndpoint(),a.makeApiCall(t.endpointName,t.params,e).then(function(e){return s(t,void 0,void 0,function(){var t;return r(this,function(o){return this.paginationMeta=e.meta,e.meta&&e.meta.next&&(this.nextPage=e.meta.next),e.meta&&e.meta.previous&&(this.previousPage=e.meta.previous),t=[],0<e.data.length&&e.data.map(function(e){t.push(new S.Reaction(e.id,e.messageId,e.reaction,e.uid,e.reactedAt,new p.User(e.reactedBy)))}),n(t),[2]})})},function(e){o(new i.CometChatException(e.error))})}catch(e){o(new i.CometChatException(e))}})},e.prototype.createEndpoint=function(){E.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=l,t.ReactionsRequestBuilder=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 l(this)},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ConversationUpdateSettings=void 0;var o=n(0);t.ConversationUpdateSettings=function(){function e(){this.callActivities=!0,this.groupActions=!0,this.customMessages=!0,this.messageReplies=!0}return e.prototype.shouldUpdateOnCallActivities=function(){return this.callActivities},e.prototype.setCallActivities=function(e){this.callActivities=e},e.prototype.shouldUpdateOnGroupActions=function(){return this.groupActions},e.prototype.setGroupActions=function(e){this.groupActions=e},e.prototype.shouldUpdateOnCustomMessages=function(){return this.customMessages},e.prototype.setCustomMessages=function(e){this.customMessages=e},e.prototype.shouldUpdateOnMessageReplies=function(){return this.messageReplies},e.prototype.setMessageReplies=function(e){this.messageReplies=e},e.fromJSON=function(t){var n,s=new e,r=null!=(n=t[o.APP_SETTINGS.KEYS.PARAMETERS])?n:{};return s.setCallActivities(!!r.hasOwnProperty(o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES)&&r[o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CALL_ACTIVITIES]),s.setGroupActions(!!r.hasOwnProperty(o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS)&&r[o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_GROUP_ACTIONS]),s.setCustomMessages(!!r.hasOwnProperty(o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES)&&r[o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_CUSTOM_MESSAGES]),s.setMessageReplies(!!r.hasOwnProperty(o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES)&&r[o.APP_SETTINGS.KEYS.CORE_CONVERSATIONS_UPDATE_ON_REPLIES]),s},e}()},function(e,t,n){var o=n(96),s=n(97);e.exports=function(e,t,n){var r=t&&n||0;"string"==typeof e&&(t="binary"===e?Array(16):null,e=null);var i=(e=e||{}).random||(e.rng||o)();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t)for(var a=0;a<16;++a)t[r+a]=i[a];return t||s(i)}},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=Array(16);e.exports=function(){for(var e,t=0;t<16;t++)0==(3&t)&&(e=0x100000000*Math.random()),s[t]=e>>>((3&t)<<3)&255;return s}}},function(e,t){for(var n=[],o=0;o<256;++o)n[o]=(o+256).toString(16).substr(1);e.exports=function(e,t){var o=t||0;return""+n[e[o++]]+n[e[o++]]+n[e[o++]]+n[e[o++]]+"-"+n[e[o++]]+n[e[o++]]+"-"+n[e[o++]]+n[e[o++]]+"-"+n[e[o++]]+n[e[o++]]+"-"+n[e[o++]]+n[e[o++]]+n[e[o++]]+n[e[o++]]+n[e[o++]]+n[e[o++]]}},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.CometChatNotifications=void 0;var o=n(0),s=n(1),r=n(2),i=n(6),a=n(16),E=n(55),c=n(99),u=n(100),S=n(101),p=n(102),l=n(103),C=n(104),d=n(105);t.CometChatNotifications=function(){function e(){}return e.fetchPushPreferences=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){if(t.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=t.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(t.data):new c.GroupPreferences,o=t.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(t.data):new l.OneOnOnePreferences,s=t.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(t.data):new S.MutePreferences,r=!!t.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=C.PushPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return e(i)}return e(new C.PushPreferences)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.fetchPreferences=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_GET_PREFERENCES,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){if(t.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=t.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(t.data):new c.GroupPreferences,o=t.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(t.data):new l.OneOnOnePreferences,s=t.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(t.data):new S.MutePreferences,r=!!t.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=p.NotificationPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return e(i)}return e(new p.NotificationPreferences)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.updatePushPreferences=function(e){return new Promise(function(t,n){try{s.getAppSettings().then(function(s){var E,u=((E={})[a.APIConstants.KEY_GROUP_PREFERENCES]={},E[a.APIConstants.KEY_MUTE_PREFERENCES]={},E[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},E),p=e.getGroupPreferences(),d=e.getMutePreferences(),_=e.getOneOnOnePreferences(),T=e.getUsePrivacyTemplate();p&&(p.getMessagesPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MESSAGES]=p.getMessagesPreference()),p.getReactionsPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_REACTIONS]=p.getReactionsPreference()),p.getRepliesPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_REPLIES]=p.getRepliesPreference()),p.getMemberAddedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_ADDED]=p.getMemberAddedPreference()),p.getMemberBannedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_BANNED]=p.getMemberBannedPreference()),p.getMemberJoinedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_JOINED]=p.getMemberJoinedPreference()),p.getMemberKickedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_KICKED]=p.getMemberKickedPreference()),p.getMemberLeftPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_LEFT]=p.getMemberLeftPreference()),p.getMemberScopeChangedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=p.getMemberScopeChangedPreference()),p.getMemberUnbannedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=p.getMemberUnbannedPreference())),d&&(
1d.getDNDPreference()&&(u[a.APIConstants.KEY_MUTE_PREFERENCES][a.APIConstants.KEY_MUTE_DND]=d.getDNDPreference()),d.getSchedulePreference()&&(u[a.APIConstants.KEY_MUTE_PREFERENCES][a.APIConstants.KEY_MUTE_SCHEDULE]=d.getSchedulePreference())),_&&(_.getMessagesPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=_.getMessagesPreference()),_.getReactionsPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=_.getReactionsPreference()),_.getRepliesPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_REPLIES]=_.getRepliesPreference())),null!=T&&(u[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=T),0===Object.keys(u[a.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete u[a.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(u[a.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete u[a.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],i.makeApiCall(a.APIConstants.KEY_UPDATE_PREFERENCES,null,u,!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=e.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(e.data):new c.GroupPreferences,o=e.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(e.data):new l.OneOnOnePreferences,s=e.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(e.data):new S.MutePreferences,r=!!e.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=C.PushPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return t(i)}return t(new C.PushPreferences)},function(e){return n(new r.CometChatException(e.error))})},function(e){return n(new r.CometChatException(e))})}catch(e){return n(new r.CometChatException(e))}})},e.updatePreferences=function(e){return new Promise(function(t,n){try{s.getAppSettings().then(function(s){var E,u=((E={})[a.APIConstants.KEY_GROUP_PREFERENCES]={},E[a.APIConstants.KEY_MUTE_PREFERENCES]={},E[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]={},E),C=e.getGroupPreferences(),d=e.getMutePreferences(),_=e.getOneOnOnePreferences(),T=e.getUsePrivacyTemplate();C&&(C.getMessagesPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MESSAGES]=C.getMessagesPreference()),C.getReactionsPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_REACTIONS]=C.getReactionsPreference()),C.getRepliesPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_REPLIES]=C.getRepliesPreference()),C.getMemberAddedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_ADDED]=C.getMemberAddedPreference()),C.getMemberBannedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_BANNED]=C.getMemberBannedPreference()),C.getMemberJoinedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_JOINED]=C.getMemberJoinedPreference()),C.getMemberKickedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_KICKED]=C.getMemberKickedPreference()),C.getMemberLeftPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_LEFT]=C.getMemberLeftPreference()),C.getMemberScopeChangedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]=C.getMemberScopeChangedPreference()),C.getMemberUnbannedPreference()&&(u[a.APIConstants.KEY_GROUP_PREFERENCES][a.APIConstants.KEY_GROUP_MEMBER_UNBANNED]=C.getMemberUnbannedPreference())),d&&(d.getDNDPreference()&&(u[a.APIConstants.KEY_MUTE_PREFERENCES][a.APIConstants.KEY_MUTE_DND]=d.getDNDPreference()),d.getSchedulePreference()&&(u[a.APIConstants.KEY_MUTE_PREFERENCES][a.APIConstants.KEY_MUTE_SCHEDULE]=d.getSchedulePreference())),_&&(_.getMessagesPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_MESSAGES]=_.getMessagesPreference()),_.getReactionsPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_REACTIONS]=_.getReactionsPreference()),_.getRepliesPreference()&&(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][a.APIConstants.KEY_ONE_ON_ONE_REPLIES]=_.getRepliesPreference())),null!=T&&(u[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE]=T),0===Object.keys(u[a.APIConstants.KEY_GROUP_PREFERENCES]).length&&delete u[a.APIConstants.KEY_GROUP_PREFERENCES],0===Object.keys(u[a.APIConstants.KEY_MUTE_PREFERENCES]).length&&delete u[a.APIConstants.KEY_MUTE_PREFERENCES],0===Object.keys(u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]).length&&delete u[a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES],i.makeApiCall(a.APIConstants.KEY_UPDATE_PREFERENCES,null,u,!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){if(e.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=e.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(e.data):new c.GroupPreferences,o=e.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(e.data):new l.OneOnOnePreferences,s=e.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(e.data):new S.MutePreferences,r=!!e.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&e.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=p.NotificationPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return t(i)}return t(new p.NotificationPreferences)},function(e){return n(new r.CometChatException(e.error))})},function(e){return n(new r.CometChatException(e))})}catch(e){return n(new r.CometChatException(e))}})},e.resetPushPreferences=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){if(t.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=t.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(t.data):new c.GroupPreferences,o=t.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(t.data):new l.OneOnOnePreferences,s=t.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(t.data):new S.MutePreferences,r=!!t.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=C.PushPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return e(i)}return e(new C.PushPreferences)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.resetPreferences=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_RESET_PREFERENCES,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){if(t.data){var n=void 0,o=void 0,s=void 0,r=void 0;n=t.data.hasOwnProperty(a.APIConstants.KEY_GROUP_PREFERENCES)?c.GroupPreferences.fromJSON(t.data):new c.GroupPreferences,o=t.data.hasOwnProperty(a.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)?l.OneOnOnePreferences.fromJSON(t.data):new l.OneOnOnePreferences,s=t.data.hasOwnProperty(a.APIConstants.KEY_MUTE_PREFERENCES)?S.MutePreferences.fromJSON(t.data):new S.MutePreferences,r=!!t.data.hasOwnProperty(a.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&t.data[a.APIConstants.KEY_USE_PRIVACY_TEMPLATE];var i=p.NotificationPreferences.fromJSON({groupPreferences:n,oneOnOnePreferences:o,mutePreferences:s,usePrivacyTemplate:r});return e(i)}return e(new p.NotificationPreferences)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.getTokensForRequest=function(e,t,n,o){var s={};return s[a.APIConstants.KEY_PROVIDER_ID]=null!=o?o:a.DEFAULT_PROVIDER_ID,s[a.APIConstants.KEY_TIMEZONE]=e,n===a.PushPlatforms.FCM_WEB&&(s[a.APIConstants.KEY_FCM_TOKEN]=t),s[a.APIConstants.KEY_PLATFORM]=n,s},e.registerPushToken=function(t,n,E){return new Promise(function(c,u){try{s.getAppSettings().then(function(s){var S=Intl.DateTimeFormat().resolvedOptions().timeZone,p=e.getTokensForRequest(S,t,n,E);i.makeApiCall(a.APIConstants.KEY_REGISTER_TOKEN,null,p,!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?c(a.APIResponseConstants.TOKEN_REGIST
1ER_SUCCESS):c(a.APIResponseConstants.TOKEN_REGISTER_ERROR)},function(e){return u(new r.CometChatException(e.error))})},function(e){return u(new r.CometChatException(e))})}catch(e){return u(new r.CometChatException(e))}})},e.unregisterPushToken=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_UNREGISTER_TOKEN,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){return t.data&&t.data.success?e(a.APIResponseConstants.TOKEN_UNREGISTER_SUCCESS):e(a.APIResponseConstants.TOKEN_UNREGISTER_ERROR)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.muteConversations=function(e){return new Promise(function(t,n){try{s.getAppSettings().then(function(s){var E,c=((E={})[a.APIConstants.KEY_CONVERSATIONS]=e,E);i.makeApiCall(a.APIConstants.KEY_MUTE_CONVERSATIONS,null,c,!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(a.APIResponseConstants.MUTE_CONVERSATION_SUCCESS):t(a.APIResponseConstants.MUTE_CONVERSATION_ERROR)},function(e){return n(new r.CometChatException(e.error))})},function(e){return n(new r.CometChatException(e))})}catch(e){return n(new r.CometChatException(e))}})},e.unmuteConversations=function(e){return new Promise(function(t,n){try{s.getAppSettings().then(function(s){var E,c=((E={})[a.APIConstants.KEY_CONVERSATIONS]=e,E);i.makeApiCall(a.APIConstants.KEY_UNMUTE_CONVERSATIONS,null,c,!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(a.APIResponseConstants.UNMUTE_CONVERSATION_SUCCESS):t(a.APIResponseConstants.UNMUTE_CONVERSATION_ERROR)},function(e){return n(new r.CometChatException(e.error))})},function(e){return n(new r.CometChatException(e))})}catch(e){return n(new r.CometChatException(e))}})},e.getMutedConversations=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_GET_MUTED_CONVERSATIONS,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){var n=[];return t.hasOwnProperty("data")&&t.data.hasOwnProperty(a.APIConstants.KEY_MUTED_CONVERSATIONS)&&t.data[a.APIConstants.KEY_MUTED_CONVERSATIONS].forEach(function(e){var t=new u.MutedConversation;t.setId(e.id),t.setType(e.type),t.setUntil(e.until),n.push(t)}),e(n)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.updateTimezone=function(e){return new Promise(function(t,n){try{s.getAppSettings().then(function(s){i.makeApiCall(a.APIConstants.KEY_UPDATE_TIMEZONE,null,{timezone:e},!1,{chatApiVersion:s[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(e){return e.data&&e.data.success?t(a.APIResponseConstants.TIMEZONE_UPDATE_SUCCESS):t(a.APIResponseConstants.TIMEZONE_UPDATE_ERROR)},function(e){return n(new r.CometChatException(e.error))})},function(e){return n(new r.CometChatException(e))})}catch(e){return n(new r.CometChatException(e))}})},e.getTimezone=function(){return new Promise(function(e,t){try{s.getAppSettings().then(function(n){i.makeApiCall(a.APIConstants.KEY_GET_TIMEZONE,null,null,!1,{chatApiVersion:n[o.APP_SETTINGS.KEYS.CHAT_API_VERSION]}).then(function(t){return t.data&&t.data.success?e(t.data):e(a.APIResponseConstants.TIMEZONE_FETCH_ERROR)},function(e){return t(new r.CometChatException(e.error))})},function(e){return t(new r.CometChatException(e))})}catch(e){return t(new r.CometChatException(e))}})},e.MessagesOptions=a.MessagesOptions,e.RepliesOptions=a.RepliesOptions,e.ReactionsOptions=a.ReactionsOptions,e.MemberActionsOptions=a.MemberActionsOptions,e.DayOfWeek=a.DayOfWeek,e.DNDOptions=a.DNDOptions,e.MutedConversationType=a.MutedConversationType,e.PushPlatforms=a.PushPlatforms,e.DaySchedule=E.DaySchedule,e.PushPreferences=C.PushPreferences,e.GroupPreferences=c.GroupPreferences,e.OneOnOnePreferences=l.OneOnOnePreferences,e.MutePreferences=S.MutePreferences,e.MutedConversation=u.MutedConversation,e.UnmutedConversation=d.UnmutedConversation,e.NotificationPreferences=p.NotificationPreferences,e}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.GroupPreferences=void 0;var o=n(16);t.GroupPreferences=function(){function e(){}return e.prototype.getMessagesPreference=function(){return this.groupMessages},e.prototype.getRepliesPreference=function(){return this.groupReplies},e.prototype.getReactionsPreference=function(){return this.groupReactions},e.prototype.getMemberLeftPreference=function(){return this.groupMemberLeft},e.prototype.getMemberAddedPreference=function(){return this.groupMemberAdded},e.prototype.getMemberJoinedPreference=function(){return this.groupMemberJoined},e.prototype.getMemberKickedPreference=function(){return this.groupMemberKicked},e.prototype.getMemberBannedPreference=function(){return this.groupMemberBanned},e.prototype.getMemberUnbannedPreference=function(){return this.groupMemberUnbanned},e.prototype.getMemberScopeChangedPreference=function(){return this.groupMemberScopeChanged},e.prototype.setMessagesPreference=function(e){this.groupMessages=e},e.prototype.setRepliesPreference=function(e){this.groupReplies=e},e.prototype.setReactionsPreference=function(e){this.groupReactions=e},e.prototype.setMemberLeftPreference=function(e){this.groupMemberLeft=e},e.prototype.setMemberAddedPreference=function(e){this.groupMemberAdded=e},e.prototype.setMemberJoinedPreference=function(e){this.groupMemberJoined=e},e.prototype.setMemberKickedPreference=function(e){this.groupMemberKicked=e},e.prototype.setMemberBannedPreference=function(e){this.groupMemberBanned=e},e.prototype.setMemberUnbannedPreference=function(e){this.groupMemberUnbanned=e},e.prototype.setMemberScopeChangedPreference=function(e){this.groupMemberScopeChanged=e},e.fromJSON=function(t){var n=new e;return n.setMessagesPreference(o.MessagesOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MESSAGES]]),n.setRepliesPreference(o.RepliesOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REPLIES]]),n.setReactionsPreference(o.ReactionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_REACTIONS]]),n.setMemberAddedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_ADDED]]),n.setMemberJoinedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_JOINED]]),n.setMemberBannedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_BANNED]]),n.setMemberKickedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_KICKED]]),n.setMemberLeftPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_LEFT]]),n.setMemberScopeChangedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_SCOPE_CHANGED]]),n.setMemberUnbannedPreference(o.MemberActionsOptions[t[o.APIConstants.KEY_GROUP_PREFERENCES][o.APIConstants.KEY_GROUP_MEMBER_UNBANNED]]),n},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutedConversation=void 0,t.MutedConversation=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}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.MutePreferences=void 0;var o=n(16),s=n(55);t.MutePreferences=function(){function e(){}return e.prototype.getDNDPreference=function(){return this.dnd},e.prototype.setDNDPreference=function(e){this.dnd=e},e.prototype.getSchedulePreference=function(){return this.schedule},e.prototype.setSchedulePreference=function(e){this.schedule=e},e.prototype.getScheduleFor=function(e){return this.schedule.get(e)},e.prototype.setScheduleFor=function(e,t){this.schedule.set(e,t)},e.fromJSON=function(t){var n=new e;n.setDNDPreference(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_DND]);var r=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.MONDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.MONDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.MONDAY][o.APIConstants.KEY_MUTE_DND]),i=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.TUESDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.TUESDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.TUESDAY][o.APIConstants.KEY_MUTE_DND]),a=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.WEDNESDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.WEDNESDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.WEDNESDAY][o.APIConstants.KEY_MUTE_DND]),E=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.THURSDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.THURSDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.THURSDAY][o.APIConstants.KEY_MUTE_DND]),c=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.FRIDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.FRIDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.FRIDAY][o.APIConstants.KEY_MUTE_DND]),u=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SATURDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SATURDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SATURDAY][o.APIConstants.KEY_MUTE_DND]),S=new s.DaySchedule(t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SUNDAY][o.APIConstants.KEY_FROM],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SUNDAY][o.APIConstants.KEY_TO],t[o.APIConstants.KEY_MUTE_PREFERENCES][o.APIConstants.KEY_MUTE_SCHEDULE][o.DayOfWeek.SUNDAY][o.APIConstants.KEY_MUTE_DND]),p=new Map([[o.DayOfWeek.MONDAY,r],[o.DayOfWeek.TUESDAY,i],[o.DayOfWeek.WEDNESDAY,a],[o.DayOfWeek.THURSDAY,E],[o.DayOfWeek.FRIDAY,c],[o.DayOfWeek.SATURDAY,u],[o.DayOfWeek.SUNDAY,S]]);return n.setSchedulePreference(p),n},e}()},function(e,t,n){"use strict";
1Object.defineProperty(t,"__esModule",{value:!0}),t.NotificationPreferences=void 0;var o=n(16);t.NotificationPreferences=function(){function e(){}return e.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},e.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},e.prototype.getMutePreferences=function(){return this.mutePreferences},e.prototype.setMutePreferences=function(e){this.mutePreferences=e},e.prototype.getGroupPreferences=function(){return this.groupPreferences},e.prototype.setGroupPreferences=function(e){this.groupPreferences=e},e.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},e.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},e.fromJSON=function(t){var n=new e;return t.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&n.setMutePreferences(t[o.APIConstants.KEY_MUTE_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&n.setGroupPreferences(t[o.APIConstants.KEY_GROUP_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&n.setOneOnOnePreferences(t[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&n.setUsePrivacyTemplate(t[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),n},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.OneOnOnePreferences=void 0;var o=n(16);t.OneOnOnePreferences=function(){function e(){}return e.prototype.getReactionsPreference=function(){return this.oneOnOneMessageReactions},e.prototype.setReactionsPreference=function(e){this.oneOnOneMessageReactions=e},e.prototype.getRepliesPreference=function(){return this.oneOnOneReplies},e.prototype.setRepliesPreference=function(e){this.oneOnOneReplies=e},e.prototype.getMessagesPreference=function(){return this.oneOnOneMessages},e.prototype.setMessagesPreference=function(e){this.oneOnOneMessages=e},e.fromJSON=function(t){var n=new e;return n.setMessagesPreference(o.MessagesOptions[t[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_MESSAGES]]),n.setRepliesPreference(o.RepliesOptions[t[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REPLIES]]),n.setReactionsPreference(o.ReactionsOptions[t[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES][o.APIConstants.KEY_ONE_ON_ONE_REACTIONS]]),n},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.PushPreferences=void 0;var o=n(16);t.PushPreferences=function(){function e(){}return e.prototype.getOneOnOnePreferences=function(){return this.oneOnOnePreferences},e.prototype.setOneOnOnePreferences=function(e){this.oneOnOnePreferences=e},e.prototype.getMutePreferences=function(){return this.mutePreferences},e.prototype.setMutePreferences=function(e){this.mutePreferences=e},e.prototype.getGroupPreferences=function(){return this.groupPreferences},e.prototype.setGroupPreferences=function(e){this.groupPreferences=e},e.prototype.getUsePrivacyTemplate=function(){return this.usePrivacyTemplate},e.prototype.setUsePrivacyTemplate=function(e){this.usePrivacyTemplate=e},e.fromJSON=function(t){var n=new e;return t.hasOwnProperty(o.APIConstants.KEY_MUTE_PREFERENCES)&&n.setMutePreferences(t[o.APIConstants.KEY_MUTE_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_GROUP_PREFERENCES)&&n.setGroupPreferences(t[o.APIConstants.KEY_GROUP_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES)&&n.setOneOnOnePreferences(t[o.APIConstants.KEY_ONE_ON_ONE_PREFERENCES]),t.hasOwnProperty(o.APIConstants.KEY_USE_PRIVACY_TEMPLATE)&&n.setUsePrivacyTemplate(t[o.APIConstants.KEY_USE_PRIVACY_TEMPLATE]),n},e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.UnmutedConversation=void 0,t.UnmutedConversation=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={};function n(o){if(t[o])return t[o].exports;var s=t[o]={i:o,l:!1,exports:{}};return e[o].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}
1),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t||4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(o,s,(function(t){return e[t]}).bind(null,s));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=37)}()}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.