PageSourceSearch

https://directdental.com/packs/js/sendbird-0ce62d85-4251e014d4ff37d7ca0f.chunk.js

js directdental.com collected 2026-10-04 15:28:36 UTC 220,415 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkDDSJobs=self.webpackChunkDDSJobs||[]).push([[6428],{73195:function(e,t,n){n.d(t,{P:function(){return r}});var r=function(e,t){this.pollId=0,this.messageId=0,this.pollId=t.poll.id,this.messageId=t.poll.message_id,this._iid=e,this._payload=t}},36089:function(e,t,n){n.d(t,{G:function(){return Le},H:function(){return f},P:function(){return h},S:function(){return _},T:function(){return De},a:function(){return N},b:function(){return Lt},c:function(){return Te},d:function(){return T},e:function(){return U},f:function(){return I},g:function(){return A},h:function(){return M},i:function(){return P},s:function(){return O},t:function(){return Ue},v:function(){return S}});var r,s,a=n(22929),i=n(96389),o=n(18130),u=n(86212),c=n(29403),l=n(37813);(s=r||(r={})).NONE="none",s.JOINED="joined",s.INVITED="invited",s.LEFT="left";var h,d,_,p,f,E,v,g,m=function(e){function t(t,n){var s=e.call(this,t,n)||this;return s.state=null,s.role=null,s.isMuted=!1,s.isBlockedByMe=!1,s.isBlockingMe=!1,s.state=(0,a.a2)(r,n.state)?n.state:null,s.role=(0,a.a2)(a.ad,n.role)?n.role:null,"boolean"==typeof n.is_muted&&(s.isMuted=n.is_muted),"boolean"==typeof n.is_blocked_by_me&&(s.isBlockedByMe=n.is_blocked_by_me),"boolean"==typeof n.is_blocking_me&&(s.isBlockingMe=n.is_blocking_me),s}return(0,a.c)(t,e),t.payloadify=function(t){return(0,a.e)((0,a.u)((0,a.j)((0,a.j)({},e.payloadify.call(this,t)),{state:t.state,role:t.role,is_muted:t.isMuted,is_blocked_by_me:t.isBlockedByMe,is_blocking_me:t.isBlockingMe})))},t}(i.J),C=function(e){function t(t,n){var r,s,i=this;return(i=e.call(this,t)||this).channelUrl=null!==(r=n.channel_url)&&void 0!==r?r:"",i.channelType=null!==(s=n.channel_type)&&void 0!==s?s:a.C.GROUP,i.member=new a.U(i._iid,n.user),i.deliveryAt=n.ts,i}return(0,a.c)(t,e),t}(a.ak);!function(e){e.ALL="all",e.PUBLIC="public",e.PRIVATE="private"}(h||(h={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(d||(d={})),function(e){e.ALL="all",e.SUPER="super",e.NON_SUPER="nonsuper",e.BROADCAST_ONLY="broadcast_only",e.EXCLUSIVE_ONLY="exclusive_only"}(_||(_={})),function(e){e.ALL="all",e.UNREAD_MESSAGE="unread_message"}(p||(p={})),function(e){e.ALL="all",e.UNHIDDEN="unhidden_only",e.HIDDEN="hidden_only",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(f||(f={})),function(e){e.ALL="all",e.OPERATOR="operator",e.NONOPERATOR="nonoperator"}(E||(E={})),function(e){e.AND="AND",e.OR="OR"}(v||(v={})),function(e){e.MEMBER_NICKNAME="member_nickname",e.CHANNEL_NAME="channel_name"}(g||(g={}));var y,N=function(){function e(e){var t,n,r,s,a,i,o,u,c,l,E,v,g,m,C,y,N,b,A,M;this._searchFilter=null,this._userIdsFilter=null,this.metadataKey=null,this.metadataValues=null,this.metadataValueStartsWith=null,this.includeEmpty=null!==(t=null==e?void 0:e.includeEmpty)&&void 0!==t&&t,this.nicknameContainsFilter=null!==(n=null==e?void 0:e.nicknameContainsFilter)&&void 0!==n?n:null,this.nicknameStartsWithFilter=null!==(r=null==e?void 0:e.nicknameStartsWithFilter)&&void 0!==r?r:null,this.nicknameExactMatchFilter=null!==(s=null==e?void 0:e.nicknameExactMatchFilter)&&void 0!==s?s:null,this.channelNameContainsFilter=null!==(a=null==e?void 0:e.channelNameContainsFilter)&&void 0!==a?a:"",this.myMemberStateFilter=null!==(i=null==e?void 0:e.myMemberStateFilter)&&void 0!==i?i:d.ALL,this.customTypesFilter=null!==(o=null==e?void 0:e.customTypesFilter)&&void 0!==o?o:null,this.channelUrlsFilter=null!==(u=null==e?void 0:e.channelUrlsFilter)&&void 0!==u?u:null,this.superChannelFilter=null!==(c=null==e?void 0:e.superChannelFilter)&&void 0!==c?c:_.ALL,this.publicChannelFilter=null!==(l=null==e?void 0:e.publicChannelFilter)&&void 0!==l?l:h.ALL,this.customTypeStartsWithFilter=null!==(E=null==e?void 0:e.customTypeStartsWithFilter)&&void 0!==E?E:null,this.unreadChannelFilter=null!==(v=null==e?void 0:e.unreadChannelFilter)&&void 0!==v?v:p.ALL,this.hiddenChannelFilter=null!==(g=null==e?void 0:e.hiddenChannelFilter)&&void 0!==g?g:f.UNHIDDEN,this.includeFrozen=null===(m=null==e?void 0:e.includeFrozen)||void 0===m||m,this.metadataKey=null!==(C=null==e?void 0:e.metadataKey)&&void 0!==C?C:null,this.metadataValues=null!==(y=null==e?void 0:e.metadataValues)&&void 0!==y?y:null,this.metadataValueStartsWith=null!==(N=null==e?void 0:e.metadataValueStartsWith)&&void 0!==N?N:null,this._userIdsFilter=null!==(b=null==e?void 0:e.userIdsFilter)&&void 0!==b?b:null,this._searchFilter=null!==(A=null==e?void 0:e.searchFilter)&&void 0!==A?A:null,(null==e?void 0:e.createdAfter)&&(this.createdAfter=e.createdAfter),(null==e?void 0:e.createdBefore)&&(this.createdBefore=e.createdBefore),this.includeMetaData=null===(M=null==e?void 0:e.includeMetaData)||void 0===M||M}return e.prototype._isFriend=function(e){return!(!e||!e.friendDiscoveryKey&&!e.friendName)},Object.defineProperty(e.prototype,"searchFilter",{get:function(){return this._searchFilter}
1,enumerable:!1,configurable:!0}),e.prototype.setSearchFilter=function(e,t){Array.isArray(e)&&0!==e.length&&"string"==typeof t&&t&&(this._searchFilter={query:t,fields:e})},Object.defineProperty(e.prototype,"userIdsFilter",{get:function(){return this._userIdsFilter},enumerable:!1,configurable:!0}),e.prototype.setUserIdsFilter=function(e,t,n){void 0===n&&(n=v.AND),this._userIdsFilter={userIds:e,includeMode:t,queryType:n}},e.prototype.clone=function(){var t,n=new e;this.searchFilter&&n.setSearchFilter(this.searchFilter.fields,null!==(t=this.searchFilter.query)&&void 0!==t?t:void 0),this.userIdsFilter&&n.setUserIdsFilter(this.userIdsFilter.userIds,this.userIdsFilter.includeMode,this.userIdsFilter.queryType);var r=JSON.parse(JSON.stringify(this));return Object.keys(r).forEach(function(e){n[e]=r[e]}),n},e.prototype.match=function(e,t){var n;if(this._searchFilter){var r=this._searchFilter,s=r.query,i=r.fields;if(s&&i&&i.length>0&&!i.some(function(t){switch(t){case g.CHANNEL_NAME:return e.name.toLowerCase().includes(s.toLowerCase());case g.MEMBER_NICKNAME:return e.members.some(function(e){return e.nickname.toLowerCase().includes(s.toLowerCase())});default:return!0}}))return!1}if(this._userIdsFilter){var o=this._userIdsFilter,u=o.userIds,c=o.includeMode,l=o.queryType,E=e.members.map(function(e){return e.userId});if(c){if(u.length>0)switch(l){case v.AND:if(u.some(function(e){return!E.includes(e)}))return!1;break;case v.OR:if(u.every(function(e){return!E.includes(e)}))return!1}}else{if(u.includes(t)||u.push(t),e.members.length>u.length)return!1;if(!(0,a.aY)(u,E))return!1}}if(!this.includeEmpty&&!e.lastMessage)return!1;if(!this.includeFrozen&&e.isFrozen)return!1;if(this.customTypesFilter&&this.customTypesFilter.length>0&&!this.customTypesFilter.includes("*")&&!this.customTypesFilter.includes(e.customType))return!1;if(this.customTypeStartsWithFilter&&!new RegExp("^".concat(this.customTypeStartsWithFilter)).test(e.customType))return!1;if(this.channelNameContainsFilter&&!e.name.toLowerCase().includes(this.channelNameContainsFilter.toLowerCase()))return!1;if(this.nicknameContainsFilter){var m=this.nicknameContainsFilter.toLowerCase();if(!e.members.some(function(e){return e.userId!==t&&e.nickname.toLowerCase().includes(m)}))return!1}if(this.nicknameStartsWithFilter){var C=this.nicknameStartsWithFilter.toLowerCase();if(!e.members.some(function(e){return e.userId!==t&&e.nickname.toLowerCase().startsWith(C)}))return!1}if(this.nicknameExactMatchFilter){var y=this.nicknameExactMatchFilter.toLowerCase();if(!e.members.some(function(e){return e.userId!==t&&e.nickname.toLowerCase()!=y}))return!1}if(this.channelUrlsFilter&&this.channelUrlsFilter.length>0&&!this.channelUrlsFilter.includes(e.url))return!1;if(this.myMemberStateFilter)switch(this.myMemberStateFilter){case d.ALL:if("none"===e.myMemberState)return!1;break;case d.JOINED:if("joined"!==e.myMemberState)return!1;break;case d.INVITED:if("invited"!==e.myMemberState)return!1;break;case d.INVITED_BY_FRIEND:if("invited"!==e.myMemberState||!this._isFriend(e.inviter))return!1;break;case d.INVITED_BY_NON_FRIEND:if("invited"!==e.myMemberState||this._isFriend(e.inviter))return!1}if(this.hiddenChannelFilter)switch(this.hiddenChannelFilter){case f.UNHIDDEN:if(e.isHidden||"unhidden"!==e.hiddenState)return!1;break;case f.HIDDEN:if(!e.isHidden)return!1;break;case f.HIDDEN_ALLOW_AUTO_UNHIDE:if(!e.isHidden||"hidden_allow_auto_unhide"!==e.hiddenState)return!1;break;case f.HIDDEN_PREVENT_AUTO_UNHIDE:if(!e.isHidden||"hidden_prevent_auto_unhide"!==e.hiddenState)return!1}if(this.unreadChannelFilter&&this.unreadChannelFilter===p.UNREAD_MESSAGE&&0===e.unreadMessageCount)return!1;if(this.publicChannelFilter)switch(this.publicChannelFilter){case h.PUBLIC:if(!e.isPublic)return!1;break;case h.PRIVATE:if(e.isPublic)return!1}if(this.superChannelFilter)switch(this.superChannelFilter){case _.SUPER:if(!e.isSuper)return!1;break;case _.NON_SUPER:if(e.isSuper)return!1}if(this.includeMetaData&&this.metadataKey){if(void 0===(null===(n=e.cachedMetaData)||void 0===n?void 0:n[this.metadataKey]))return!1;if(this.metadataValues&&!this.metadataValues.includes(e.cachedMetaData[this.metadataKey]))return!1;
1if(this.metadataValueStartsWith&&!e.cachedMetaData[this.metadataKey].startsWith(this.metadataValueStartsWith))return!1}return!(this.createdAfter&&e.createdAt<this.createdAfter)&&!(this.createdBefore&&e.createdAt>this.createdBefore)},e}(),b=function(e){function t(t,n){var r=n.sdkState,s=n.cacheContext,a=e.call(this,t)||this;return a._channels=new Map,a._sdkState=r,a._cacheContext=s,a}return(0,a.c)(t,e),Object.defineProperty(t.prototype,"collection",{get:function(){var e=this._cacheContext.nestdb;return(0,a.F)(!!e).throw(a.t.databaseError),e.collection(i.a)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"localCacheEnabled",{get:function(){return this._cacheContext.localCacheEnabled&&!!this.collection},enumerable:!1,configurable:!0}),t.prototype._serialize=function(e,t){return void 0===t&&(t=0),(0,a.j)((0,a.j)({},e.serialize()),{lastMessageUpdatedAt:e.lastMessage?e.lastMessage.createdAt:0,syncIndex:t})},t.prototype._deserialize=function(e){return Le.of(this._iid).buildGroupChannelFromSerializedData(e)},Object.defineProperty(t.prototype,"channels",{get:function(){return(0,a.q)([],(0,a.r)(this._channels.values()),!1)},enumerable:!1,configurable:!0}),t.prototype.isCachedInMemory=function(e){return this._channels.has(e)},t.prototype.filterOffsetChanged=function(e){var t=this;return e.filter(function(e){if(t._channels.has(e.url))return t._channels.get(e.url).messageOffsetTimestamp<e.messageOffsetTimestamp})},t.prototype.get=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n;return(0,a.b)(this,function(r){switch(r.label){case 0:return this._channels.has(e)?[3,3]:this.localCacheEnabled?[4,this.collection.getByKey(e)]:[3,2];case 1:if(t=r.sent())return n=this._deserialize(t),this._channels.set(e,n),[2,n];r.label=2;case 2:return[2,void 0];case 3:return[2,this._channels.get(e)]}})})},t.prototype.fetch=function(e){var t=e.token,n=e.limit,r=void 0===n?i.V:n,s=e.backward,o=void 0!==s&&s,c=e.filter,l=void 0===c?new N:c,h=e.order,d=void 0===h?u.G.LATEST_LAST_MESSAGE:h,_=e.borderlineChannelUrl;return(0,a._)(this,void 0,void 0,function(){var e,n,s,i,c,h=this;return(0,a.b)(this,function(a){switch(a.label){case 0:return this.localCacheEnabled?(e=!!_,n=(0,u.g)(d),s={where:function(n){if(t)switch(d){case u.G.CHANNEL_NAME_ALPHABETICAL:if(!o&&n.name.localeCompare(t)<0||o&&n.name.localeCompare(t)>0)return!1;break;case u.G.CHRONOLOGICAL:if(!o&&n.createdAt>t||o&&n.createdAt<t)return!1;break;case u.G.LATEST_LAST_MESSAGE:if(!o&&n.lastMessageUpdatedAt>t||o&&n.lastMessageUpdatedAt<t)return!1}return e&&_&&_===n.url?(e=!1,!1):!e&&l.match(h._deserialize(n),h._sdkState.userId)},index:n,backward:o},[4,this.collection.query(s)]):[3,3];case 1:return[4,a.sent().fetch({limit:r})];case 2:return i=a.sent(),(c=i.map(function(e){return h._deserialize(e)})).forEach(function(e){!l.includeMetaData&&e.cachedMetaData&&e._clearCachedMetaData(),h._channels.has(e.url)||h._channels.set(e.url,e)}),[2,c];case 3:return[2,[]]}})})},t.prototype.upsert=function(e,t){return(0,a._)(this,void 0,void 0,function(){var n,r,s,i=this;return(0,a.b)(this,function(a){switch(a.label){case 0:if(n=[],e.forEach(function(e){if(i._channels.has(e.url)){var r=i._channels.get(e.url);r._pinnedMessagesUpdatedAt<e._pinnedMessagesUpdatedAt&&(r._pinnedMessagesUpdatedAt=e._pinnedMessagesUpdatedAt),r._messageCollectionLastAccessedAt>e._messageCollectionLastAccessedAt&&(e._messageCollectionLastAccessedAt=r._messageCollectionLastAccessedAt),e.cachedMetaData instanceof Map&&e.cachedMetaData.size>0&&t&&(r._updateCachedMetaData(e.cachedMetaData,t).isUpdated||Object.assign(e,{_cachedMetaData:r.cachedMetaData})),r._update(e),n.push(r)}else i._channels.set(e.url,e),n.push(e)}),!this.localCacheEnabled)return[3,2];for(r=[],s=0;s<n.length;s++)r.push(this._serialize(n[s],s));return[4,this.collection.upsertMany(r)];case 1:a.sent(),a.label=2;case 2:return[2,n]}})})},t.prototype.remove=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,o;return(0,a.b)(this,function(u){switch(u.label){case 0:u.trys.push([0,5,6,7]),t=(0,a.w)(e),n=t.next(),u.label=1;case 1:return n.done?[3,4]:(r=n.value,this._channels.delete(r),this.localCacheEnabled?[4,this.collection.remove(r)]:[3,3]);case 2:u.sent(),u.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return s=u.sent(),i={error:s},[3,7];
1case 6:try{n&&!n.done&&(o=t.return)&&o.call(t)}finally{if(i)throw i.error}return[7];case 7:return[2]}})})},t.prototype.clear=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return this.clearMemoryCache(),this.localCacheEnabled?[4,this.collection.clear()]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},t.prototype.clearMemoryCache=function(){this._channels.clear()},t.prototype._setBlockStateOfAllChannels=function(e,t,n){return(0,a._)(this,void 0,void 0,function(){var r,s,i,o,u,c,l,h,d,_,p,f,E,v,g,m,C,y,N;return(0,a.b)(this,function(b){switch(b.label){case 0:if(r=[],e===this._sdkState.userId)try{for(s=(0,a.w)(this._channels.values()),i=s.next();!i.done;i=s.next()){h=i.value;try{for(v=void 0,o=(0,a.w)(h.members),u=o.next();!u.done;u=o.next())if((p=u.value).userId===t){p.isBlockedByMe=n,r.push(h);break}}catch(e){v={error:e}}finally{try{u&&!u.done&&(g=o.return)&&g.call(o)}finally{if(v)throw v.error}}}}catch(e){f={error:e}}finally{try{i&&!i.done&&(E=s.return)&&E.call(s)}finally{if(f)throw f.error}}else if(t===this._sdkState.userId)try{for(c=(0,a.w)(this._channels.values()),l=c.next();!l.done;l=c.next()){h=l.value;try{for(y=void 0,d=(0,a.w)(h.members),_=d.next();!_.done;_=d.next())if((p=_.value).userId===e){p.isBlockingMe=n,r.push(h);break}}catch(e){y={error:e}}finally{try{_&&!_.done&&(N=d.return)&&N.call(d)}finally{if(y)throw y.error}}}}catch(e){m={error:e}}finally{try{l&&!l.done&&(C=c.return)&&C.call(c)}finally{if(m)throw m.error}}return r.length>0?[4,this.upsert(r)]:[3,2];case 1:b.sent(),b.label=2;case 2:return[2]}})})},t.prototype.block=function(e,t){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,this._setBlockStateOfAllChannels(e,t,!0)];case 1:return n.sent(),[2]}})})},t.prototype.unblock=function(e,t){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,this._setBlockStateOfAllChannels(e,t,!1)];case 1:return n.sent(),[2]}})})},t.prototype.markAsRead=function(e,t){return void 0===t&&(t=(0,a.q)([],(0,a.r)(this._channels.keys()),!1)),(0,a._)(this,void 0,void 0,function(){var n,r,s,i,o,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:n=[],h.label=1;case 1:h.trys.push([1,6,7,8]),r=(0,a.w)(t),s=r.next(),h.label=2;case 2:return s.done?[3,5]:(i=s.value,[4,this.get(i)]);case 3:(null==(o=h.sent())?void 0:o._updateUnreadMemberState(this._sdkState.userId,e))&&(o._updateUnreadCount(0,0),n.push(o)),h.label=4;case 4:return s=r.next(),[3,2];case 5:return[3,8];case 6:return u=h.sent(),c={error:u},[3,8];case 7:try{s&&!s.done&&(l=r.return)&&l.call(r)}finally{if(c)throw c.error}return[7];case 8:return n.length>0?[4,this.upsert(n)]:[3,10];case 9:h.sent(),h.label=10;case 10:return[2]}})})},t}(a.ak),A={invitedUserIds:void 0,channelUrl:void 0,coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isSuper:void 0,isBroadcast:void 0,isExclusive:void 0,isPublic:void 0,isDiscoverable:void 0,isStrict:void 0,isEphemeral:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},M=function(e){return(0,a.$)("string",e.invitedUserIds,!0)&&(0,a.a)("string",e.channelUrl,!0)&&(0,a.a)("string",e.coverUrl,!0)&&((0,a.i)(e.coverImage)||(0,a.a)("string",e.coverImage,!0))&&(0,a.a)("boolean",e.isDistinct,!0)&&(0,a.a)("boolean",e.isSuper,!0)&&(0,a.a)("boolean",e.isBroadcast,!0)&&(0,a.a)("boolean",e.isExclusive,!0)&&(0,a.a)("boolean",e.isPublic,!0)&&(0,a.a)("boolean",e.isStrict,!0)&&(0,a.a)("boolean",e.isDiscoverable,!0)&&(0,a.a)("boolean",e.isEphemeral,!0)&&(0,a.a)("string",e.accessCode,!0)&&(0,a.a)("string",e.name,!0)&&(0,a.a)("string",e.data,!0)&&(0,a.a)("string",e.customType,!0)&&(0,a.$)("string",e.operatorUserIds,!0)&&(0,a.a)("number",e.messageSurvivalSeconds,!0)},T={customTypes:void 0,includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1},S=function(e){return(0,a.$)("string",e.customTypes,!0)&&(0,a.a)("boolean",e.includeEmpty,!0)&&(0,a.a)("boolean",e.includeFrozen,!0)&&(0,a.a)("boolean",e.includeMetaData,!0)&&(0,a.a)("boolean",e.includeChatNotification,!0)},U={myMemberStateFilter:d.ALL},I=function(e){return(0,a.a2)(d,e.myMemberStateFilter)};!function(e){e.GROUP_CHANNEL_UNREAD_MENTION_COUNT="group_channel_unread_mention_count",e.NONSUPER_UNREAD_MENTION_COUNT="non_super_group_channel_unread_mention_count",e.SUPER_UNREAD_MENTION_COUNT="super_group_channel_unread_mention_count",e.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT="group_channel_unread_message_count",e.NONSUPER_UNREAD_MESSAGE_COUNT="non_super_group_channel_unread_message_count",e.SUPER_UNREAD_MESSAGE_COUNT="super_group_channel_unread_message_count",e.GROUP_CHANNEL_INVITATION_COUNT="group_channel_invitation_count",e.NONSUPER_INVITATION_COUNT="non_super_group_channel_invitation_count",e.SUPER_INVITATION_COUNT="super_group_channel_invitation_count"}(y||(y={}));var D,w={keys:[y.GROUP_CHANNEL_UNREAD_MENTION_COUNT,y.NONSUPER_UNREAD_MENTION_COUNT,y.SUPER_UNREAD_MENTION_COUNT,y.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT,y.NONSUPER_UNREAD_MESSAGE_COUNT,y.SUPER_UNREAD_MESSAGE_COUNT,y.GROUP_CHANNEL_INVITATION_COUNT,y.NONSUPER_INVITATION_COUNT,y.SUPER_INVITATION_COUNT],customTypeFilters:void 0,customTypesFilter:void 0},L={channelCustomTypesFilter:void 0,superChannelFilter:_.ALL},R={channelUrl:void 0,scheduledStatus:void 0,messageTypeFilter:a.au.ALL},P=(0,a.j)({},o.C),O=function(e){return e.startsWith("EVENT_")||e===o.C.SYNC_CHANNEL_CHANGELOGS||e===o.C.REFRESH_CHANNEL}
1,x=function(e){function t(t){var n=t.channels,r=t.context,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=t.ts,o=e.call(this)||this;return o.channels=n,o.context=r,o.isWebSocketEventComing=a,o.ts=i,o}return(0,a.c)(t,e),t}(a.aU),F=function(e){function t(t){var n=t.channelUrls,r=t.context,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=e.call(this)||this;return i.channelUrls=n,i.context=r,i.isWebSocketEventComing=a,i}return(0,a.c)(t,e),t}(a.aU),k=function(e){function t(t){var n=t.channel,r=e.call(this)||this;return r.channel=n,r}return(0,a.c)(t,e),t}(a.aU),V=function(){function e(e){var t=e.groupChannelCache,n=e.userInfoCache,r=e.messageCache,s=e.unsentMessageCache,i=e.dispatcher,c=this;this._observers=new Map,i.on(function(e){return(0,a._)(c,void 0,void 0,function(){var i,c,l,h,d,_,p,f,E,v,g,m,C,y,N,b,A,M,T=this;return(0,a.b)(this,function(S){switch(S.label){case 0:if(!(e instanceof x))return[3,19];if(i=e.channels,C=e.context,y=e.isWebSocketEventComing,c=i.filter(function(e){return e instanceof Lt}),C.source!==o.C.EVENT_CHANNEL_RESET_HISTORY&&C.source!==o.C.EVENT_CHANNEL_HIDDEN)return[3,9];S.label=1;case 1:S.trys.push([1,6,7,8]),l=(0,a.w)(c),h=l.next(),S.label=2;case 2:return h.done?[3,5]:(E=h.value,[4,r.removeUnderOffset(E.url,E.messageOffsetTimestamp)]);case 3:S.sent(),S.label=4;case 4:return h=l.next(),[3,2];case 5:return[3,8];case 6:return d=S.sent(),N={error:d},[3,8];case 7:try{h&&!h.done&&(b=l.return)&&b.call(l)}finally{if(N)throw N.error}return[7];case 8:return[3,17];case 9:_=t.filterOffsetChanged(c),S.label=10;case 10:S.trys.push([10,15,16,17]),p=(0,a.w)(_),f=p.next(),S.label=11;case 11:return f.done?[3,14]:(E=f.value,[4,r.removeUnderOffset(E.url,E.messageOffsetTimestamp)]);case 12:S.sent(),S.label=13;case 13:return f=p.next(),[3,11];case 14:return[3,17];case 15:return v=S.sent(),A={error:v},[3,17];case 16:try{f&&!f.done&&(M=p.return)&&M.call(p)}finally{if(A)throw A.error}return[7];case 17:return[4,t.upsert(c,e.ts)];case 18:return g=S.sent(),y||this._broadcastUpdateEvent(g,C),[3,25];case 19:return e instanceof F?(m=e.channelUrls,C=e.context,y=e.isWebSocketEventComing,[4,t.remove(m)]):[3,22];case 20:return S.sent(),[4,(0,a.H)(function(){return(0,a._)(T,void 0,void 0,function(){var e,t,n,i,o,u;return(0,a.b)(this,function(c){switch(c.label){case 0:c.trys.push([0,6,7,8]),e=(0,a.w)(m),t=e.next(),c.label=1;case 1:return t.done?[3,5]:(n=t.value,[4,r.removeMessagesOfChannel(n)]);case 2:return c.sent(),[4,s.removeMessagesOfChannel(n)];case 3:c.sent(),c.label=4;case 4:return t=e.next(),[3,1];case 5:return[3,8];case 6:return i=c.sent(),o={error:i},[3,8];case 7:try{t&&!t.done&&(u=e.return)&&u.call(e)}finally{if(o)throw o.error}return[7];case 8:return[2]}})})})];case 21:return S.sent(),y||this._broadcastRemoveEvent(m,C),[3,25];case 22:return e instanceof u.D?[4,t.fetch({token:Number.MAX_SAFE_INTEGER,limit:Number.MAX_SAFE_INTEGER})]:[3,25];case 23:return S.sent(),[4,n.fetch({limit:Number.MAX_SAFE_INTEGER})];case 24:S.sent(),S.label=25;case 25:return[2]}})})})}return e.prototype._broadcastUpdateEvent=function(e,t){var n,r;try{for(var s=(0,a.w)(this._observers.values()),i=s.next();!i.done;i=s.next()){var o=i.value;o.onUpdate&&o.onUpdate(e,t)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},e.prototype._broadcastRemoveEvent=function(e,t){var n,r;try{for(var s=(0,a.w)(this._observers.values()),i=s.next();!i.done;i=s.next()){var o=i.value;o.onRemove&&o.onRemove(e,t)}}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}},e.prototype.subscribe=function(e,t){this._observers.set(e,t)},e.prototype.unsubscribe=function(e){this._observers.delete(e)},e.prototype.unsubscribeAll=function(){this._observers.clear()},e}(),H=function(e){function t(t){var n=t.userId,r=t.ts,s=t.token,i=t.filter,o=t.includeChatNotification,u=void 0!==o&&o,c=e.call(this)||this,l=(0,a.j)((0,a.j)({},T),i),h=l.customTypes,d=l.includeEmpty,_=l.includeFrozen;return c.method=a.A.GET,c.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/my_group_channels/changelogs"),c.params=(0,a.e)((0,a.u)({show_delivery_receipt:!0,show_member:!0,show_read_receipt:!0,
1change_ts:r||null,token:s,custom_types:h,show_empty:d,show_frozen:_,include_chat_notification:u})),c}return(0,a.c)(t,e),t}(a.f),G=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.updatedChannels=n.updated.map(function(e){return new Lt(t,Object.assign(e,{ts:n.ts}))}),r.deletedChannelUrls=n.deleted,r.hasMore=n.has_more,r.token=n.next,r.ts=n.ts,r}return(0,a.c)(t,e),t}(a.g),B=function(e){function t(t){var n=t.channelUrl,r=t.isInternalCall,s=t.showLatestMessage,i=e.call(this)||this;return i.method=a.A.GET,i.path="".concat(r?a.aZ:a.aC,"/").concat(encodeURIComponent(n)),i.params={show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_latest_message:null!=s&&s,show_conversation:!0},i}return(0,a.c)(t,e),t}(a.f),q=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.channel=new Lt(t,n),r}return(0,a.c)(t,e),t}(a.g),j={includeEmpty:!1,includeFrozen:!0,includeMetaData:!0,includeChatNotification:!1,channelUrlsFilter:void 0,customTypesFilter:void 0,customTypeStartsWithFilter:void 0,nicknameContainsFilter:void 0,nicknameStartsWithFilter:void 0,nicknameExactMatchFilter:void 0,channelNameContainsFilter:void 0,myMemberStateFilter:d.ALL,unreadChannelFilter:p.ALL,superChannelFilter:_.ALL,publicChannelFilter:h.ALL,hiddenChannelFilter:f.ALL,userIdsFilter:{userIds:[],includeMode:!0,queryType:v.AND},searchFilter:{query:void 0,fields:[]},metadataKey:void 0,metadataValues:void 0,metadataOrderKeyFilter:void 0,metadataValueStartsWith:void 0,order:u.G.LATEST_LAST_MESSAGE,createdAfter:void 0,createdBefore:void 0},K=function(e){function t(t){var n=this,r=t.userId,s=t.token,i=t.limit,o=t.order,u=t.includeEmpty,c=t.myMemberStateFilter,l=t.superChannelFilter,h=t.publicChannelFilter,d=t.unreadChannelFilter,_=t.nicknameContainsFilter,p=t.nicknameStartsWithFilter,f=t.nicknameExactMatchFilter,E=t.channelNameContainsFilter,v=t.channelUrlsFilter,g=t.customTypesFilter,m=t.customTypeStartsWithFilter,C=t.hiddenChannelFilter,y=t.metadataOrderKeyFilter,N=t.metadataKey,b=t.metadataValues,A=t.metadataValueStartsWith,M=t.includeFrozen,T=t.includeMetaData,S=t.searchFilter,U=t.userIdsFilter,I=t.includeChatNotification,D=void 0!==I&&I,w=t.includeLeftChannel,L=void 0!==w&&w,R=t.createdAfter,P=t.createdBefore;return(n=e.call(this)||this).method=a.A.GET,n.path="".concat(a.h,"/").concat(encodeURIComponent(r),"/my_group_channels"),n.params=(0,a.e)({token:s,limit:i,order:null!=o?o:j.order,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:null!=u?u:j.includeEmpty,member_state_filter:null!=c?c:j.myMemberStateFilter,super_mode:null!=l?l:j.superChannelFilter,public_mode:null!=h?h:j.publicChannelFilter,unread_filter:null!=d?d:j.unreadChannelFilter,members_nickname_contains:_,members_nickname_startswith:p,members_nickname:f,name_contains:E,channel_urls:v,custom_types:g,custom_type_startswith:m,hidden_mode:C,metadata_order_key:y,metadata_key:N,metadata_values:b,metadata_value_startswith:A,show_frozen:M,show_metadata:T,include_chat_notification:D,include_left_channel:L,created_after:R,created_before:P}),S&&S.query&&S.fields&&(n.params.search_query=S.query,n.params.search_fields=S.fields),U&&U.userIds&&U.userIds.length>0&&(U.includeMode?(n.params.members_include_in=U.userIds,n.params.query_type=U.queryType.toUpperCase()):n.params.members_exactly_in=U.userIds),n}return(0,a.c)(t,e),t}(a.f),z=function(e){function t(t,n){var r=e.call(this,t,n)||this;r.channels=[];var s=n.next,a=n.channels,i=n.ts;return r.token=s,a&&a.length>0&&(r.channels=a.map(function(e){return e.ts=i,new Lt(t,e)})),r.ts=null!=i?i:0,r}return(0,a.c)(t,e),t}(a.g),W=function(e){function t(t){var n=t.userId,r=t.filter,s=e.call(this)||this,i=r.myMemberStateFilter;return s.method=a.A.GET,s.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/group_channel_count"),s.params={state:null!=i?i:d.ALL},s}return(0,a.c)(t,e),t}(a.f),Q=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.groupChannelCount=n.group_channel_count,r}return(0,a.c)(t,e),t}(a.g),Y=function(e){function t(t){var n=t.userId,r=t.filter,s=e.call(this)||this,i=r.keys,o=r.customTypeFilters,u=r.customTypesFilter;return s.method=a.A.GET,s.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/unread_item_count"),s.params=(0,a.e)({item_keys:i,custom_types:null!=u?u:o}),s}return(0,a.c)(t,e),t}(a.f),J=function(e){function t(t,n){var r=e.call(this,t,n)||this;return"number"==typeof n[y.GROUP_CHANNEL_UNREAD_MENTION_COUNT]&&(r.groupChannelUnreadMentionCount=n[y.GROUP_CHANNEL_UNREAD_MENTION_COUNT]),"number"==typeof n[y.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]&&(r.groupChannelUnreadMessageCount=n[y.GROUP_CHANNEL_UNREAD_MESSAGE_COUNT]),"number"==typeof n[y.GROUP_CHANNEL_INVITATION_COUNT]&&(r.groupChannelInvitationCount=n[y.GROUP_CHANNEL_INVITATION_COUNT]),"number"==typeof n[y.SUPER_UNREAD_MENTION_COUNT]&&(r.superGroupChannelUnreadMentionCount=n[y.SUPER_UNREAD_MENTION_COUNT]),"number"==typeof n[y.SUPER_UNREAD_MESSAGE_COUNT]&&(r.superGroupChannelUnreadMessageCount=n[y.SUPER_UNREAD_MESSAGE_COUNT]),"number"==typeof n[y.SUPER_INVITATION_COUNT]&&(r.superGroupChannelInvitationCount=n[y.SUPER_INVITATION_COUNT]),"number"==typeof n[y.NONSUPER_UNREAD_MENTION_COUNT]&&(r.nonSuperGroupChannelUnreadMentionCount=n[y.NONSUPER_UNREAD_MENTION_COUNT]),"number"==typeof n[y.NONSUPER_UNREAD_MESSAGE_COUNT]&&(r.nonSuperGroupChannelUnreadMessageCount=n[y.NONSUPER_UNREAD_MESSAGE_COUNT]),"number"==typeof n[y.NONSUPER_INVITATION_COUNT]&&(r.nonSuperGroupChannelInvitationCount=n[y.NONSUPER_INVITATION_COUNT]),r}return(0,a.c)(t,e),t}(a.g),X=function(e){function t(t){var n=t.userId,r=e.call(this)||this;return r.method=a.A.GET,r.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/unread_channel_c
1ount"),r}return(0,a.c)(t,e),t}(a.f),$=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.unreadCount=n.unread_count,r}return(0,a.c)(t,e),t}(a.g),Z=function(e){function t(t){var n=t.userId,r=t.filter,s=t.includeFeedChannel,i=void 0!==s&&s,o=e.call(this)||this,u=r.channelCustomTypesFilter,c=r.superChannelFilter;return o.method=a.A.GET,o.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/unread_message_count"),o.params={super_mode:null!=c?c:_.ALL,custom_types:u,include_feed_channel:i},o}return(0,a.c)(t,e),t}(a.f),ee=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.unreadCount=n.unread_count,r.unreadFeedCount=n.unread_feed_count,r}return(0,a.c)(t,e),t}(a.g),te=function(e){function t(t){var n=t.channelUrl,r=t.scheduledStatus,s=t.messageTypeFilter,i=e.call(this)||this;return i.method=a.A.GET,i.path="".concat(a.aW,"/count"),i.params={channel_url:n,status:re(r)},s&&(i.params.message_type=s),i}return(0,a.c)(t,e),t}(a.f),ne=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.count=n.count,r}return(0,a.c)(t,e),t}(a.g),re=function(e){if(!e)return[];var t=[];return e.forEach(function(e){switch(e){case i.X.PENDING:t.push(i.$.PENDING);break;case i.X.SENT:t.push(i.$.IN_QUEUE),t.push(i.$.SENT);break;case i.X.CANCELED:t.push(i.$.CANCELED);break;case i.X.FAILED:t.push(i.$.FAILED)}}),t},se=function(e){function t(t){var n=this,r=t.userId,s=t.channelUrl,i=t.coverUrl,o=t.coverImage,u=t.isDistinct,c=t.isSuper,l=t.isBroadcast,h=t.isPublic,d=t.isExclusive,_=t.isDiscoverable,p=t.isStrict,f=t.isEphemeral,E=t.accessCode,v=t.name,g=t.data,m=t.customType,C=t.messageSurvivalSeconds,y=t.invitedUserIds,N=t.operatorUserIds;return(n=e.call(this)||this).method=a.A.POST,n.path=a.aC,n.params=(0,a.e)({user_ids:(0,a.q)([r],(0,a.r)(null!=y?y:[]),!1).filter(function(e,t,n){return t===n.indexOf(e)}),channel_url:s,cover_url:i,cover_file:o,is_distinct:u,is_super:c,is_broadcast:l,is_exclusive:d,is_public:h,is_discoverable:_,strict:p,is_ephemeral:f,access_code:E,name:v,data:g,custom_type:m,operator_ids:N,message_survival_seconds:C}),n}return(0,a.c)(t,e),t}(a.f),ae=function(e){function t(t,n){var r,s=this;return(s=e.call(this,t,n)||this).channel=new Lt(t,n),s.isCreated=null===(r=n.is_created)||void 0===r||r,s}return(0,a.c)(t,e),t}(a.g),ie=function(e){function t(t){var n=t.userId,r=t.channelUrls,s=e.call(this)||this;return s.method=a.A.PUT,s.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/mark_as_read_all"),s.params={channel_urls:r},s}return(0,a.c)(t,e),t}(a.f);D=a.g,(0,a.c)(function(){return null!==D&&D.apply(this,arguments)||this},D);var oe=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userId,i=t.accessCode;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/join"),n.params={user_id:s,access_code:i},n}return(0,a.c)(t,e),t}(a.f),ue=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.channel=new Lt(t,n),r}return(0,a.c)(t,e),t}(a.g),ce=function(e){function t(t,n,r){var s=e.call(this,t,n,r)||this,a=r.data,i=a.member_count,o=void 0===i?0:i,u=a.joined_member_count,c=void 0===u?0:u,l=a.users,h=void 0===l?null:l;return s.memberCount=o,s.joinedMemberCount=c,s.members=Array.isArray(h)?h.map(function(e){return new m(t,e)}):[new m(t,r.data)],s}return(0,a.c)(t,e),t}(c.C),le=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userId,i=t.shouldRemoveOperatorStatus;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/leave"),n.params={user_id:s,should_remove_operator_status:i},n}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(t,n){return e.call(this,t,n)||this},e)}(a.g);var he=function(e){function t(t,n,r){var s=e.call(this,t,n,r)||this,a=r.data,i=a.member_count,o=void 0===i?0:i,u=a.joined_member_count,c=void 0===u?0:u;return s.memberCount=o,s.joinedMemberCount=c,s.member=new m(s._iid,r.data),s}return(0,a.c)(t,e),t}(c.C),de=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userIds;return(n=e.call(this)||this).method=a.A.POST,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/invite"),n.params={user_ids:s},n}return(0,a.c)(t,e),t}(a.f),_e=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.channel=new Lt(t,n),r}return(0,a.c)(t,e),t}(a.g),pe=function(e){function t(t,n,r){var s=e.call(this,t,n,r)||this;s.inviter=null;var i=r.data,o=i.member_count,u=void 0===o?0:o,c=i.joined_member_count,l=void 0===c?0:c,h=i.inviter,d=i.invitees,_=void 0===d?[]:d;return s.memberCount=u,s.joinedMemberCount=l,h&&Object.keys(h).length>0&&(s.inviter=new a.U(t,h)),s.invitees=_.map(function(e){return new m(t,e)}),s}return(0,a.c)(t,e),t}(c.C),fe=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userId;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/decline"),n.params={user_id:s},n}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(t,n){var s=e.call(this,t,n)||this;return s.channel=new Lt(t,n),s.channel.myMemberState=r.NONE,s},e)}(a.g);var Ee=function(e){function t(t,n,r){var s=e.call(this,t,n,r)||this,i=r.data,o=i.member_count,u=i.joined_member_count,c=i.inviter,l=i.invitee;return s.memberCount=null!=o?o:0,s.joinedMemberCount=null!=u?u:0,s.inviter=new a.U(t,c),s.invitee=new m(t,l),s}return(0,a.c)(t,e),t}(c.C),ve={hidePreviousMessages:!1,allowAutoUnhide:!0},ge=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userId,i=t.hidePreviousMessages,o=t.allowAutoUnhide;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/hide"),n.params={user_id:s,hide_previous_messages:null!=i?i:ve.hidePreviousMessages,allow_auto_unhide:null!=o?o:ve.allowAutoUnhide},n}return(0,a.c)(t,e),t}(a.f),me=function(e){function t(t,n){var r=e.call(this,t,n)||this,s=n.ts_message_offset;return r.messageOffsetTimestamp=s,r}return(0,a.c)(t,e),t}(a.g),Ce=function(e){function t(t,n,r){var s,a,i,o=this;return(o=e.call(this,t,"SYEV",r)||this).allowAutoUnhide=null,o.hidePreviousMessages=null,o.messageOffsetTimestamp=null,r.data&&(o.allowAutoUnhide=null!==(s=r.data.allow_auto_unhide)&&void 0!==s?s:null,o.hidePreviousMessages=null!==(a=r.data.hide_previous_messages)&&void 0!==a?a:null),o.messageOffsetTimestamp=null!==(i=r.ts_message_offset)&&void 0!==i?i:null,o}return(0,a.c)(t,e),t}(a.W),ye=function(e){function t(t){var n=t.channelUrl,r=t.time;return e.call(this,{code:"TPST",ackRequired:!1,payload:{channel_url:n,time:r}})||this}return(0,a.c)(t,e),t}(a.ap),Ne=function(e){function t(t,n,r){var s=e.call(this,t,"SYEV",r)||this;return s.user=new a.U(t,r.data),s}return(0,a.c)(t,e),t}(a.W),be=function(e){function t(t){var n=t.channelUrl,r=t.time;return e.call(this,{code:"TPEN",ackRequired:!1,payload:{channel_url:n,time:r}})||this}return(0,a.c)(t,e),t}(a.ap),Ae=function(e){function t(t,n,r){var s=e.call(this,t,"SYEV",r)||this;return s.user=new a.U(t,r.data),s}return(0,a.c)(t,e),t}(a.W),Me=function(e){function t(t){var n=t.channelUrl,r=t.messageId;return e.call(this,{code:"MACK",ackRequired:!1,payload:{channel_url:n,msg_id:r}})||this}return(0,a.c)(t,e),t}(a.ap),Te=function(e){function t(t,n){var r,s,a,i,o,c,l,E,g,m,C,y,N,b,A,M,T,S,U,I,D,w,L,R=this;return(R=e.call(this,t,n)||this).includeEmpty=!1,R.includeFrozen=!0,R.includeMetaData=!0,R.includeChatNotification=!1,R.channelUrlsFilter=null,R.customTypesFilter=null,R.customTypeStartsWithFilter=null,R.nicknameContainsFilter=null,R.nicknameStartsWithFilter=null,R.nicknameExactMatchFilter=null,R.channelNameContainsFilter="",R.myMemberStateFilter=d.ALL,R.unreadChannelFilter=p.ALL,R.superChannelFilter=_.ALL,R.publicChannelFilter=h.ALL,R.hiddenChannelFilter=f.UNHIDDEN,R.searchFilter={fields:[],query:null},R.userIdsFilter={userIds:[],includeMode:!0,queryType:v.AND},R.metadataKey=null,R.metadataValues=null,R.metadataOrderKeyFilter=null,R.metadataValueStartsWith=null,R.order=u.G.LATEST_LAST_MESSAGE,R.includeEmpty=null!==(r=n.includeEmpty)&&void 0!==r&&r,R.includeFrozen=null===(s=n.includeFrozen)||void 0===s||s,R.includeMetaData=null===(a=n.includeMetaData)||void 0===a||a,R.includeChatNotification=null!==(i=n.includeChatNotification)&&void 0!==i&&i,R.channelUrlsFilter=null!==(o=n.channelUrlsFilter)&&void 0!==o?o:null,R.customTypesFilter=null!==(c=n.customTypesFilter)&&void 0!==c?c:null,R.customTypeStartsWithFilter=null!==(l=n.customTypeStartsWithFilter)&&void 0!==l?l:"",R.nicknameContainsFilter=null!==(E=n.nicknameContainsFilter)&&void 0!==E?E:null,R.nicknameStartsWithFilter=null!==(g=n.nicknameStartsWithFilter)&&void 0!==g?g:null,R.nicknameExactMatchFilter=null!==(m=n.nicknameExactMatchFilter)&&void 0!==m?m:null,R.channelNameContainsFilter=null!==(C=n.channelNameContainsFilter)&&void 0!==C?C:"",R.myMemberStateFilter=null!==(y=n.myMemberStateFilter)&&void 0!==y?y:d.ALL,R.unreadChannelFilter=null!==(N=n.unreadChannelFilter)&&void 0!==N?N:p.ALL,R.superChannelFilter=null!==(b=n.superChannelFilter)&&void 0!==b?b:_.ALL,R.publicChannelFilter=null!==(A=n.publicChannelFilter)&&void 0!==A?A:h.ALL,R.hiddenChannelFilter=null!==(M=n.hiddenChannelFilter)&&void 0!==M?M:f.UNHIDDEN,R.searchFilter=null!==(T=n.searchFilter)&&void 0!==T?T:{fields:[],query:null},R.userIdsFilter=null!==(S=n.userIdsFilter)&&void 0!==S?S:{userIds:[],includeMode:!0,queryType:v.AND},R.metadataKey=null!==(U=n.metadataKey)&&void 0!==U?U:null,R.metadataValues=null!==(I=n.metadataValues)&&void 0!==I?I:null,R.metadataOrderKeyFilter=null!==(D=n.metadataOrderKeyFilter)&&void 0!==D?D:null,R.metadataValueStartsWith=null!==(w=n.metadataValueStartsWith)&&void 0!==w?w:null,R.order=null!==(L=n.order)&&void 0!==L?L:u.G.LATEST_LAST_MESSAGE,n.createdAfter&&(R.createdAfter=n.createdAfter),n.createdBefore&&(R.createdBefore=n.createdBefore),R}return(0,a.c)(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&(0,a.a)("boolean",this.includeEmpty)&&(0,a.a)("boolean",this.includeFrozen)&&(0,a.a)("boolean",this.includeMetaData)&&(0,a.a)("string",this.channelNameContainsFilter)&&(0,a.$)("string",this.channelUrlsFilter,!0)&&(0,a.$)("string",this.customTypesFilter,!0)&&(0,a.a)("string",this.customTypeStartsWithFilter)&&(0,a.a)("string",this.nicknameContainsFilter,!0)&&(0,a.a)("string",this.nicknameStartsWithFilter,!0)&&(0,a.a)("string",this.nicknameExactMatchFilter,!0)&&(0,a.a2)(d,this.myMemberStateFilter)&&(0,a.a2)(_,this.superChannelFilter)&&(0,a.a2)(h,this.publicChannelFilter)&&(0,a.a2)(p,this.unreadChannelFilter)&&(0,a.a2)(f,this.hiddenChannelFilter)&&(0,a.$)(g,this.searchFilter.fields)&&(0,a.a)("string",this.searchFilter.query,!0)&&(0,a.$)("string",this.userIdsFilter.userIds)&&(0,a.a)("boolean",this.userIdsFilter.includeMode)&&(0,a.a2)(v,this.userIdsFilter.queryType)&&(0,a.a2)(u.G,this.order)&&(0,a.a)("string",this.metadataOrderKeyFilter,!0)&&(0,a.a)("string",this.metadataKey,!0)&&(0,a.$)("string",this.metadataValues,!0)&&(0,a.a)("string",this.metadataValueStartsWith,!0)&&(0,a.a_)(this.createdAfter,!0)&&(0,a.a_)(this.createdBefore,!0)},t.prototype.serialize=function(){return(0,a.an)(this)},t.prototype.next=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n;return(0,a.b)(this,function(r){switch(r.label){case 0:return this._val
1idate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,Le.of(this._iid).getMyGroupChannels(this._token,(0,a.u)((0,a.j)({},this)),this.limit,o.C.REQUEST_CHANNEL,!0)]):[3,2]:[3,5];case 1:return e=r.sent(),t=e.channels,n=e.token,this._token=n,this._hasNext=!!n,this._isLoading=!1,[2,t];case 2:return[2,[]];case 3:throw a.t.queryInProgress;case 4:return[3,6];case 5:throw a.t.invalidParameters;case 6:return[2]}})})},t}(a.aM),Se=function(e){function t(t){var n=t.channelUrl,r=t.userId,s=e.call(this)||this;return s.method=a.A.PUT,s.path="".concat(a.aC,"/").concat(encodeURIComponent(n),"/messages/mark_as_delivered"),s.params=(0,a.e)({user_id:r}),s}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(){return null!==e&&e.apply(this,arguments)||this},e)}(a.g);var Ue,Ie=function(e){function t(t,n,r){var s=e.call(this,t,"DLVR",r)||this;return s.channelUrl=r.channel_url,s.deliveredStateUpdate=r.updated,s}return(0,a.c)(t,e),t}(a.W),De=function(){function e(e){var t=e.top,n=void 0===t?Number.MAX_SAFE_INTEGER:t,r=e.bottom,s=void 0===r?0:r;this.top=n,this.bottom=s}return e.prototype.includes=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.every(function(t){return e.top<=t&&t<=e.bottom})},e.prototype.overlap=function(e){return this.includes(e.top)||this.includes(e.bottom)},e.prototype.intersect=function(){for(var e=this,t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.some(function(t){return e.top<=t&&t<=e.bottom})},e.prototype.extends=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this.top=Math.min.apply(Math,(0,a.q)([this.top],(0,a.r)(e),!1)),this.bottom=Math.max.apply(Math,(0,a.q)([this.bottom],(0,a.r)(e),!1))},e}(),we={},Le=function(e){function t(t,n){var r,s=this;return(s=e.call(this,t,(0,a.j)((0,a.j)({},n),{channelType:a.C.GROUP}))||this)._leftChannels=new Map,s._markAsReadAllLastSentAt=0,s._forceDisableMack=null!==(r=n.forceDisableMack)&&void 0!==r&&r,s._groupChannelHandlers=new Map,s._groupChannelCache=new b(s._iid,{sdkState:n.sdkState,cacheContext:n.cacheContext}),s._userInfoCache=new i.a0(s._iid,{sdkState:n.sdkState,cacheContext:n.cacheContext}),s._groupChannelBroadcast=new V({dispatcher:n.dispatcher,groupChannelCache:s._groupChannelCache,userInfoCache:s._userInfoCache,messageCache:i.v.of(s._iid),unsentMessageCache:i.w.of(s._iid)}),setInterval(function(){var e,t,n=function(e){e.invalidateTypingStatus()&&(s._dispatcher.dispatch(new x({channels:[e],context:{source:o.C.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),s._groupChannelHandlers.forEach(function(t){t.onTypingStatusUpdated&&t.onTypingStatusUpdated(e)}))};try{for(var r=(0,a.w)(s._groupChannelCache.channels),i=r.next();!i.done;i=r.next())n(i.value)}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}},1e3),s._dispatcher.on(function(e){if(e instanceof a.W)s._handleEvent(e).catch(function(e){if((0,a.Z)(e)&&"foreground"===s._sdkState.appState)throw e});else if(e instanceof u.f)(0,a._)(s,void 0,void 0,function(){var t,n;return(0,a.b)(this,function(r){switch(r.label){case 0:return t=e.message,[4,this.getChannelFromCache(t.channelUrl)];case 1:return(n=r.sent())&&!n.isFrozen?[3,3]:[4,this.getChannelWithoutCache(t.channelUrl,!0)];case 2:n=r.sent(),r.label=3;case 3:return n.isFrozen||(t instanceof i.a2?n._autoResendUserMessage(t):t instanceof i.a3&&n._autoResendFileMessage(t)),[2]}})});else if(e instanceof u.R)s.reduceDBSize();else if(e instanceof u.d){var t=e.appConfigsInfo,n=e.configTs,r=t.message_purge_offset;r&&s._messageDataRetention(r),s._dispatcher.dispatch(new u.S({configTs:n}))}else e instanceof i.a1&&(0,a._)(s,void 0,void 0,function(){var t,n,r,s,o,u=this;return(0,a.b)(this,function(c){switch(c.label){case 0:return t=e.channelUrl,n=e.channelType,r=e.parentMessage,s=new i.a4(this._iid,{channel_type:a.C.GROUP,channel_url:t,parent_message_id:r.messageId,thread_info:i.a5.payloadify(r.threadInfo)}),n!==a.C.GROUP?[3,2]:[4,this.getChannel(t,!0)];case 1:o=c.sent(),(0,a.K)(function(){return(0,a._)(u,void 0,void 0,function(){var e,t,n,r,i;return(0,a.b)(this,function(u){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onThreadInfoUpdated&&n.onThreadInfoUpdated(o,s)}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}),c.label=2;case 2:return[2]}})})}),we[t]||(we[t]=s),s}return(0,a.c)(t,e),Object.defineProperty(t.prototype,"_messageCache",{get:function(){return i.v.of(this._iid)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"_unsentMessageCache",{get:function(){return i.w.of(this._iid)},enumerable:!1,configurable:!0}),t.of=function(e){return we[e]||(we[e]=new t(e,a.V.of(e))),we[e]},t.clear=function(e){we[e]&&delete we[e]},Object.defineProperty(t.prototype,"handlers",{get:function(){return(0,a.q)([],(0,a.r)(this._groupChannelHandlers.values()),!1)},enumerable:!1,configurable:!0}),t.prototype.buildGroupChannelFromSerializedData=function(e){var t=(0,a.G)(e);return new Lt(this._iid,Lt.payloadify(t))},t.prototype.buildGroupChannelListQueryFromSerializedData=function(e){var t=(0,a.G)(e);return new Te(this._iid,t)},t.prototype.buildMemberFromSerializedData=function(e){var t=(0,a.G)(e);return new m(this._iid,m.payloadify(t))},t.prototype.getChannelFromCache=function(e){var t;return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,this._groupChannelCache.get(e)];case 1:return[2,null!==(t=n.sent())&&void 0!==t?t:null]}})})},t.prototype.getChannelsFromCache=function(e,t,n,r,s){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(a){switch(a.label){case 0:return[4,this._groupChannelCache.fetch({token:e,filter:t,order:n,limit:r,borderlineChannelUrl:s})];case 1:return[2,a.sent()]}})})},t.prototype.upsertChannelsToCache=function(e){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this._groupChannelCache.upsert(e)];case 1:return[2,t.sent()]}})})},t.prototype.removeChannelsFromCache=function(e){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this._groupChannelCache.remove(e)];case 1:return t.sent(),[2]}})})},t.prototype.clearChannelsFromCache=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return[4,this._groupChannelCache.clear()];case 1:return e.sent(),[2]}})})},t.prototype.reduceDBSize=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,o,u,c,l,h,d,_,p,f,E;return(0,a.b)(this,function(v){switch(v.label){case 0:return e=i.v.of(this._iid),t=a.V.of(this._iid).cacheContext,n=t.localCacheConfig,r=t.nestdb,t.localCacheEnabled&&r&&r.state==i.x.OPENED?(s=1024*n.maxSize*1024,[4,r.estimateUsage()]):[2];case 1:if((o=v.sent())<s)return[2];u=[],c=this._groupChannelCache.channels,l={},p=0,v.label=2;case 2:return p<c.length?[4,this.getMessagesFromCache(c[p].url,0,"prev",new i.T)]:[3,5];case 3:h=v.sent(),l[c[p].url]=JSON.stringify(h).length,d=new a.a8({channel:c[p],cachedMessageCount:h.length}),u.push(d),v.label=4;case 4:return p++,[3,2];case 5:_=u.sort(n.clearOrderComparator),p=0,v.label=6;case 6:return p<_.length?[4,e.removeMessagesOfChannel(_[p].channel.url)]:[3,10];case 7:return v.sent(),[4,e._getGroupChannelPreferenceSize(_[p].channel.url)];case 8:if(f=v.sent(),E=l[_[p].channel.url]+f,(o-=E)<s)return[3,10];v.label=9;case 9:return p++,[3,6];case 10:return[4,i.a0.of(this._iid).clear()];case 11:return v.sent(),[2]}})})},t.prototype._messageDataRetention=function(e){var t;return(0,a._)(this,void 0,void 0,function(){var n,r,s,u,c,l,h,d,_,p,f=this;return(0,a.b)(this,function(E){switch(E.label){case 0:n=[],r=i.v.of(this._iid),s=function(s){var i,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return i=s.customType,c=null!==(t=e[i])&&void 0!==t?t:e.global,[4,r.removeUnderOffset(s.url,c,!0)];case 1:return l.sent(),s.lastMessage&&s.lastMessage.createdAt<=c&&(s.lastMessage=null,n.push(s),(0,a.K)(function(){return(0,a._)(f,void 0,void 0,function(){var e,t,n,r,i;return(0,a.b)(this,function(o){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onChannelChanged&&n.onChannelChanged(s)}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})})),u._dispatcher.dispatch(new o.g({channelUrl:s.url,messageDeletionTimestamp:c,source:o.C.EVENT_MESSAGE_OFFSET_UPDATED})),[2]}})},u=this,E.label=1;case 1:E.trys.push([1,6,7,8]),c=(0,a.w)(this._groupChannelCache.channels),l=c.next(),E.label=2;case 2:return l.done?[3,5]:(h=l.value,[5,s(h)]);case 3:E.sent(),E.label=4;case 4:return l=c.next(),[3,2];case 5:return[3,8];case 6:return d=E.sent(),_={error:d},[3,8];
1case 7:try{l&&!l.done&&(p=c.return)&&p.call(c)}finally{if(_)throw _.error}return[7];case 8:return n.length>0&&this._dispatcher.dispatch(new x({channels:n,context:{source:o.C.EVENT_CHANNEL_UPDATED}})),[2]}})})},t.prototype._isSuperGroupMackDisabled=function(e){var t=a.V.of(this._iid).appInfo;return!(!e.isSuper||e.isBroadcast||!(null==t?void 0:t.disableSuperGroupMack))},t.prototype._getCachedUserInfo=function(e){return this._userInfoCache.getUserInfoFromCache(e)},t.prototype._upsertCachedUserInfo=function(e,t){a.V.of(this._iid).useMemberInfoInMessage&&this._userInfoCache.upsert(e,t)},t.prototype._handleEvent=function(e){var t,n;return(0,a._)(this,void 0,void 0,function(){var s,l,h,d,_,p,f,E,v,g,m,C,y,N,b,A,M,T,S,U,I,D,w,L,R,P,O,k,V,H,G,B,q,j,K,z,W,Q,Y,J,X,$,Z,ee,te,ne,re,se,ae,ie,oe,ue,le,de,_e,fe,ve,ge,me,ye,be,Te,Se,Ue,De,we,Le,Re,Pe,Oe,xe,Fe,ke,Ve,He,Ge,Be,qe,je,Ke,ze,We,Qe,Ye,Je,Xe,$e,Ze,et,tt,nt,rt,st,at,it,ot,ut,ct,lt,ht,dt,_t,pt,ft,Et,gt,mt,Ct,yt,Nt,bt,At,Mt,Tt,St,Ut,It,Dt,wt,Lt,Rt,Pt,Ot,xt,Ft,kt,Vt,Ht,Gt,Bt,qt,jt,Kt,zt,Wt,Qt,Yt,Jt,Xt,$t,Zt,en,tn,nn,rn,sn,an,on,un,cn,ln,hn,dn,_n,pn,fn,En,vn,gn,mn,Cn,yn,Nn,bn,An,Mn,Tn,Sn,Un,In,Dn,wn,Ln=this;return(0,a.b)(this,function(Rn){switch(Rn.label){case 0:switch(Rn.trys.push([0,88,,89]),e.code){case"MESG":case"FILE":case"ADMM":case"BRDM":return[3,1];case"MEDI":case"FEDI":case"AEDI":return[3,4];case"DELM":return[3,7];case"READ":return[3,10];case"DLVR":return[3,13];case"MRCT":return[3,15];case"MTHD":return[3,27];case"MCNT":return[3,31];case"PEDI":return[3,40];case"VOTE":return[3,43];case"SYEV":return[3,46];case"USEV":return[3,86]}return[3,87];case 1:return v=null,"MESG"===e.code?v=e.as(i.ak):"FILE"===e.code?v=e.as(i.al):"ADMM"!==e.code&&"BRDM"!=e.code||(v=e.as(c.A)),v?(s=v.message,l=v.isMentioned,h=v.forceUpdateLastMessage,s.channelType!==a.C.GROUP?[3,3]:(Q=this._groupChannelCache.isCachedInMemory(s.channelUrl),P=s instanceof i.ag&&s.sender.userId===this._sdkState.userId,[4,this.getChannel(s.channelUrl,!0)])):[3,3];case 2:if(d=Rn.sent(),_=a.V.of(this._iid),y=_.useMemberInfoInMessage,sn=_.requestDeduplicator,this._forceDisableMack||this._isSuperGroupMackDisabled(d)||s instanceof i.aj||P||(0,a.H)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return e=new Me(s),[4,this._requestQueue.send(e)];case 1:return t.sent(),[2]}})})}),s instanceof i.ag){p=s.sender,d.isSuper&&this._upsertCachedUserInfo(p,s.createdAt);try{for(f=(0,a.w)(d.members),E=f.next();!E.done;E=f.next())if((Tt=E.value).userId===s.sender.userId){y&&(Tt.nickname=s.sender.nickname,Tt.plainProfileUrl=s.sender.plainProfileUrl,Tt.metaData=s.sender.metaData,Tt.isBlockedByMe=s.sender.isBlockedByMe);break}}catch(e){dn={error:e}}finally{try{E&&!E.done&&(_n=f.return)&&_n.call(f)}finally{if(dn)throw dn.error}}y&&l&&(null===(t=s.mentionedUsers)||void 0===t||t.forEach(function(e){var t,n;try{for(var r=(0,a.w)(d.members),s=r.next();!s.done;s=r.next()){var i=s.value;if(e.userId===i.userId){i.nickname=e.nickname,i.plainProfileUrl=e.plainProfileUrl,i.metaData=e.metaData;break}}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}})),P&&(T=this._sessionManager.currentUser)&&(T.nickname=s.sender.nickname,T.plainProfileUrl=s.sender.plainProfileUrl,T.metaData=s.sender.metaData)}s.silent&&!P||(d.isEphemeral||Q)&&(d._updateLastMessage(s),P||d._shouldUpdateUnreadCountWith(s)&&d._updateUnreadCount(d.unreadMessageCount+1,d.unreadMentionCount+(l?1:0))),h&&d._updateLastMessage(s),sn.updatePendingResponse(d,Date.now()),this._dispatcher.dispatch(new x({channels:[d],context:{source:o.C.EVENT_MESSAGE_RECEIVED}})),s.silent&&!P||(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onChannelChanged&&n.onChannelChanged(d)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),this._dispatcher.dispatch(new o.M({messages:[s],source:o.C.EVENT_MESSAGE_RECEIVED})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,i;return(0,a.b)(this,function(o){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onMessageReceived&&n.onMessageReceived(d,s),l&&n.onMentionReceived&&n.onMentionReceived(d,s)}catch(e){r={error:e}}finally{try{t&&!t.done&&(i=e.return)&&i.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=3;case 3:return[3,87];case 4:return v=null,"MEDI"===e.code?v=e.as(i.ah):"FEDI"===e.code?v=e.as(i.ai):"AEDI"===e.code&&(v=e.as(c.b)),v?(g=v.message,m=v.mentionCountChange,C=a.V.of(this._iid),y=C.useMemberInfoInMessage,sn=C.requestDeduplicator,g.threadInfo&&(g.threadInfo.unreadReplyCount=void 0),g.channelType!==a.C.GROUP?[3,6]:(Q=this._groupChannelCache.isCachedInMemory(g.channelUrl),[4,this.getChannel(g.channelUrl,!0)])):[3,6];case 5:if(N=Rn.sent(),P=!1,g instanceof i.ag){P=g.sender.userId===this._sdkState.userId,N.isSuper&&this._upsertCachedUserInfo(g.sender,g.updatedAt);try{for(b=(0,a.w)(N.members),A=b.next();!A.done;A=b.next())if((Tt=A.value).userId===g.sender.userId){y&&(Tt.nickname=g.sender.nickname,Tt.plainProfileUrl=g.sender.plainProfileUrl,Tt.metaData=g.sender.metaData,Tt.isBlockedByMe=g.sender.isBlockedByMe);break}}catch(e){pn={error:e}}finally{try{A&&!A.done&&(fn=b.return)&&fn.call(b)}finally{if(pn)throw pn.error}}}j=!1,P?(M=g.sender,(T=this._sessionManager.currentUser)&&(T.nickname=M.nickname,T.plainProfileUrl=M.plainProfileUrl,T.metaData=M.metaData)):N.isReadMessage(g)||0!==m&&!g.silent&&Q&&(N._updateUnreadCount(N.unreadMessageCount,N.unreadMentionCount+m),j=!0),N._updateLastMessage(g)?j=!0:(null===(n=N.lastMessage)||void 0===n?void 0:n.isIdentical(g))&&(Q?N._updateLastMessage(g)&&(j=!0):j=!0),S=!1,N.lastPinnedMessage&&N.lastPinnedMessage.messageId===g.messageId&&(N.lastPinnedMessage=g,j=!0,S=!0),j&&(sn.updatePendingResponse(N,Date.now()),this._dispatcher.dispatch(new x({channels:[N],context:{source:S?o.C.EVENT_PINNED_MESSAGE_UPDATED:o.C.EVENT_MESSAGE_UPDATED}})),g.silent&&!P||(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onChannelChanged&&n.onChannelChanged(N)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),S&&(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onPinnedMessageUpdated&&n.onPinnedMessageUpdated(N)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})})),this._dispatcher.dispatch(new o.M({messages:[g],source:o.C.EVENT_MESSAGE_UPDATED})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onMessageUpdated&&n.onMessageUpdated(N,g),m>0&&n.onMentionReceived&&n.onMentionReceived(N,g)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=6;case 6:return[3,87];case 7:return U=e.as(a.a$),Re=U.channelUrl,Pe=U.channelType,I=U.messageId,D=U.silent,
1w=U.messageCreatedAt,L=U.senderId,Pe!==a.C.GROUP?[3,9]:[4,this.getChannel(Re,!0)];case 8:R=Rn.sent(),P=L===this._sdkState.userId,D||P||w>0&&R.myLastRead<w&&R.unreadMessageCount>0&&(R._updateUnreadCount(R.unreadMessageCount-1,0),(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(R,Date.now())),this._dispatcher.dispatch(new o.j({messageIds:[I],source:o.C.EVENT_MESSAGE_DELETED})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onMessageDeleted&&n.onMessageDeleted(R,I)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=9;case 9:return[3,87];case 10:return(O=e.as(i.af).readStatus).channelType!==a.C.GROUP?[3,12]:(Q=this._groupChannelCache.isCachedInMemory(O.channelUrl),[4,this.getChannel(O.channelUrl,!0)]);case 11:if(k=Rn.sent(),V=O.reader.userId===this._sdkState.userId,H=!0,Q&&(H=k._updateUnreadMemberState(O.reader.userId,O.readAt,O.isExcluded)),O.isExcluded){if(H){try{for(G=(0,a.w)(this._groupChannelHandlers.values()),B=G.next();!B.done;B=G.next())(q=B.value).onUserMarkedUnread!==a.aD?q.onUserMarkedUnread(k,[O.reader.userId]):q.onUnreadMemberStatusUpdated&&q.onUnreadMemberStatusUpdated(k)}catch(e){En={error:e}}finally{try{B&&!B.done&&(vn=G.return)&&vn.call(G)}finally{if(En)throw En.error}}this._dispatcher.dispatch(new x({channels:[k],context:{source:o.C.EVENT_CHANNEL_UNREAD,userIds:[O.reader.userId]}}))}}else j=!0,V&&(Q?k.unreadMentionCount>0||k.unreadMessageCount>0?k._updateUnreadCount(0,0):j=!1:0!==k.unreadMessageCount&&0!==k.unreadMentionCount&&(j=!1)),j&&(this._dispatcher.dispatch(new x({channels:[k],context:{source:H?o.C.EVENT_CHANNEL_READ:o.C.EVENT_CHANNEL_UPDATED,userIds:[O.reader.userId]}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())n=t.value,V?n.onChannelChanged!==a.aD&&n.onChannelChanged(k):H&&(n.onUserMarkedRead!==a.aD?n.onUserMarkedRead(k,[O.reader.userId]):n.onUnreadMemberStatusUpdated!==a.aD&&n.onUnreadMemberStatusUpdated(k))}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}));Rn.label=12;case 12:return[3,87];case 13:return K=e.as(Ie),Re=K.channelUrl,z=K.deliveredStateUpdate,W=void 0===z?{}:z,Q=this._groupChannelCache.isCachedInMemory(Re),[4,this.getChannel(Re,!0)];case 14:return Y=Rn.sent(),Q&&Object.keys(W).forEach(function(e){Y._updateUndeliveredMemberState(e,W[e])}),Object.keys(W).some(function(e){return e!==Ln._sdkState.userId})&&(this._dispatcher.dispatch(new x({channels:[Y],context:{source:o.C.EVENT_CHANNEL_DELIVERED}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onUndeliveredMemberStatusUpdated&&n.onUndeliveredMemberStatusUpdated(Y)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})})),[3,87];case 15:return J=e.as(c.R),Re=J.channelUrl,Pe=J.channelType,X=J.event,Pe!==a.C.GROUP?[3,26]:[4,this.getChannel(Re,!0)];case 16:return $=Rn.sent(),[4,this.getMessageFromCache(X.messageId)];case 17:if(oe=Rn.sent(),!$.isSuper)return[3,25];Rn.label=18;case 18:Rn.trys.push([18,23,24,25]),Z=(0,a.w)(Object.keys(X._sampledUserInfoList)),ee=Z.next(),Rn.label=19;case 19:return ee.done?[3,22]:(te=ee.value,[4,this._userInfoCache.get(te)]);case 20:(ne=Rn.sent())?(ne.plainProfileUrl=X._sampledUserInfoList[te].profile_url,ne.nickname=X._sampledUserInfoList[te].nickname,this._upsertCachedUserInfo(ne,X.updatedAt)):(re=new a.U(this._iid,{user_id:te,nickname:X._sampledUserInfoList[te].nickname,profile_url:X._sampledUserInfoList[te].profile_url,require_auth_for_profile_image:X._sampledUserInfoList[te].require_auth_for_profile_image}),this._upsertCachedUserInfo(re,X.updatedAt)),Rn.label=21;case 21:return ee=Z.next(),[3,19];case 22:return[3,25];case 23:return se=Rn.sent(),gn={error:se},[3,25];case 24:try{ee&&!ee.done&&(mn=Z.return)&&mn.call(Z)}finally{if(gn)throw gn.error}
1return[7];case 25:oe?oe instanceof i.ae&&(oe.applyReactionEvent(X),this._dispatcher.dispatch(new o.M({messages:[oe],source:o.C.EVENT_MESSAGE_REACTION_UPDATED}))):this._dispatcher.dispatch(new o.R({event:X,source:o.C.EVENT_MESSAGE_REACTION_UPDATED})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onReactionUpdated&&n.onReactionUpdated($,X)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=26;case 26:return[3,87];case 27:return(ae=e.as(c.T).event).channelType!==a.C.GROUP?[3,30]:[4,this.getChannel(ae.channelUrl,!0)];case 28:return ie=Rn.sent(),[4,this.getMessageFromCache(ae.targetMessageId)];case 29:if((oe=Rn.sent())?oe instanceof i.ae&&(oe.applyThreadInfoUpdateEvent(ae),this._dispatcher.dispatch(new o.M({messages:[oe],source:o.C.EVENT_MESSAGE_THREADINFO_UPDATED}))):this._dispatcher.dispatch(new o.T({event:ae,source:o.C.EVENT_MESSAGE_THREADINFO_UPDATED})),ie.isSuper)try{for(ue=(0,a.w)(ae.threadInfo.mostRepliedUsers),le=ue.next();!le.done;le=ue.next())Ct=le.value,this._upsertCachedUserInfo(Ct,ae.threadInfo.updatedAt)}catch(e){Cn={error:e}}finally{try{le&&!le.done&&(yn=ue.return)&&yn.call(ue)}finally{if(Cn)throw Cn.error}}(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onThreadInfoUpdated&&n.onThreadInfoUpdated(ie,ae)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=30;case 30:return[3,87];case 31:de=e.as(c.M).groupChannelMemberCounts,_e=[],Rn.label=32;case 32:Rn.trys.push([32,37,38,39]),fe=(0,a.w)(de),ve=fe.next(),Rn.label=33;case 33:return ve.done?[3,36]:(ge=ve.value,Re=ge.channelUrl,_t=ge.memberCount,pt=ge.joinedMemberCount,me=ge.updatedAt,[4,this.getChannelFromCache(Re)]);case 34:(ye=Rn.sent())&&ye._setLatestMemberCount(_t,pt,me)&&_e.push(ye),Rn.label=35;case 35:return ve=fe.next(),[3,33];case 36:return[3,39];case 37:return be=Rn.sent(),Nn={error:be},[3,39];case 38:try{ve&&!ve.done&&(bn=fe.return)&&bn.call(fe)}finally{if(Nn)throw Nn.error}return[7];case 39:return _e.length>0&&(this._dispatcher.dispatch(new x({channels:_e,context:{source:o.C.EVENT_CHANNEL_MEMBER_COUNT_UPDATED}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onChannelMemberCountChanged&&n.onChannelMemberCountChanged(_e)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})})),[3,87];case 40:return Te=e.as(c.P),Se=Te.event,Ue=Te.status,Re=Te.channelUrl,Pe=Te.channelType,Re&&Pe===a.C.GROUP?[4,this.getChannel(Re,!0)]:[3,42];case 41:De=Rn.sent(),this._dispatcher.dispatch(new o.h({event:Se,source:o.C.EVENT_POLL_UPDATED})),(0,a.K)(Ue===o.t?function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onPollDeleted&&n.onPollDeleted(De,Se.pollId)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}:function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onPollUpdated&&n.onPollUpdated(De,Se)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=42;case 42:return[3,87];case 43:return we=e.as(i.ad),Le=we.event,Re=we.channelUrl,Pe=we.channelType,Re&&Pe===a.C.GROUP?[4,this.getChannel(Re,!0)]:[3,45];case 44:Oe=Rn.sent(),this._dispatcher.dispatch(new o.e({event:Le,source:o.C.EVENT_POLL_VOTED})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onPollVoted&&n.onPollVoted(Oe,Le)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),Rn.label=45;case 45:return[3,87];case 46:if(!(xe=e.as(c.C).event).isGroupChannelEvent)return[3,85];switch(xe.category){case c.a.CHANNEL_JOIN:return[3,47];case c.a.CHANNEL_LEAVE:return[3,49];case c.a.CHANNEL_OPERATOR_UPDATE:return[3,53];case c.a.CHANNEL_INVITE:return[3,55];case c.a.CHANNEL_DECLINE_INVITE:return[3,57];case c.a.TYPING_START:case c.a.TYPING_END:return[3,59];case c.a.USER_CHANNEL_MUTE:case c.a.USER_CHANNEL_UNMUTE:return[3,61];case c.a.USER_CHANNEL_BAN:return[3,63];case c.a.USER_CHANNEL_UNBAN:return[3,67];case c.a.CHANNEL_FREEZE:case c.a.CHANNEL_UNFREEZE:return[3,69];case c.a.CHANNEL_HIDE:return[3,71];case c.a.CHANNEL_UNHIDE:return[3,73];case c.a.CHANNEL_DELETED:return[3,75];case c.a.CHANNEL_PROP_CHANGED:return[3,76];case c.a.CHANNEL_META_DATA_CHANGED:return[3,79];case c.a.CHANNEL_META_COUNTERS_CHANGED:return[3,81];case c.a.PINNED_MESSAGE_CHANGED:return[3,83]}return[3,85];case 47:return[4,this.getChannel(xe.channelUrl,!0)];case 48:if(Fe=Rn.sent(),ke=e.as(ce),Ve=ke.memberCount,He=ke.joinedMemberCount,Ge=ke.members,Be=!1,Ge.forEach(function(e){Fe.isExclusive||Fe.isSuper||Fe.isBroadcast?Be=Be||Fe._setLatestMemberCount(Ve,He,xe.ts):(e.state=r.JOINED,Fe.addMember(e,xe.ts),Ln._updateJoinedMemberCount(Fe)),e.userId===Ln._sdkState.userId&&(Fe.myMemberState=r.JOINED)}),Fe.isSuper)try{for(qe=(0,a.w)(Ge),je=qe.next();!je.done;je=qe.next())Tt=je.value,this._upsertCachedUserInfo(Tt,xe.ts)}catch(e){An={error:e}}finally{try{je&&!je.done&&(Mn=qe.return)&&Mn.call(qe)}finally{if(An)throw An.error}}return(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(Fe,Date.now()),this._dispatcher.dispatch(new x({channels:[Fe],context:{source:o.C.EVENT_CHANNEL_JOINED,users:Ge}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEac
1h(function(e){var t,n;try{for(var r=(0,a.w)(Ge),s=r.next();!s.done;s=r.next()){var i=s.value;e.onUserJoined&&e.onUserJoined(Fe,i)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}Fe.isBroadcast&&Be&&e.onChannelMemberCountChanged&&e.onChannelMemberCountChanged([Fe])}),[2]})})}),[3,85];case 49:return(St=this._leftChannels.get(xe.channelUrl))?(ze=St.channel,[3,52]):[3,50];case 50:return[4,this.getChannel(xe.channelUrl,!0)];case 51:ze=Rn.sent(),Rn.label=52;case 52:return Ke=ze,We=e.as(he),_t=We.memberCount,pt=We.joinedMemberCount,Qe=We.member,Ye=!1,Je=a.V.of(this._iid),Xe=Je.appInfo,sn=Je.requestDeduplicator,Ke.isExclusive||Ke.isSuper||Ke.isBroadcast?Ye=Ke._setLatestMemberCount(_t,pt,xe.ts):((null==Xe?void 0:Xe.enabledChannelMemberShipHistory)?(($e=Ke.members.find(function(e){return e.userId===Qe.userId}))&&($e.state=r.LEFT),Ke.memberCount=_t):Ke.removeMember(Qe),this._updateJoinedMemberCount(Ke)),Qe.userId===this._sdkState.userId?(Ke.myMemberState=r.NONE,Ke.invitedAt=0,Ke.joinedAt=0,Ke._updateUnreadCount(0,0),Ke.isPublic?this._dispatcher.dispatch(new x({channels:[Ke],context:{source:o.C.EVENT_CHANNEL_LEFT,user:Qe}})):(this._markAsLeave(Ke),this._dispatcher.dispatch(new F({channelUrls:[Ke.url],context:{source:o.C.EVENT_CHANNEL_LEFT,user:Qe}})))):this._dispatcher.dispatch(new x({channels:[Ke],context:{source:o.C.EVENT_CHANNEL_LEFT,user:Qe}})),sn.updatePendingResponse(Ke,Date.now()),Ke.isSuper&&this._upsertCachedUserInfo(Qe,xe.ts),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onUserLeft&&e.onUserLeft(Ke,Qe),Ke.isBroadcast&&Ye&&e.onChannelMemberCountChanged&&e.onChannelMemberCountChanged([Ke])}),[2]})})}),[3,85];case 53:return[4,this.getChannel(xe.channelUrl,!0)];case 54:Ze=Rn.sent(),et=e.as(c.O).operators,tt=et.map(function(e){return e.userId});try{for(nt=(0,a.w)(Ze.members),rt=nt.next();!rt.done;rt=nt.next())(Tt=rt.value).role=tt.includes(Tt.userId)?a.ad.OPERATOR:a.ad.NONE}catch(e){Tn={error:e}}finally{try{rt&&!rt.done&&(Sn=nt.return)&&Sn.call(nt)}finally{if(Tn)throw Tn.error}}return Ze.myRole=tt.includes(this._sdkState.userId)?a.ad.OPERATOR:a.ad.NONE,(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(Ze,Date.now()),this._dispatcher.dispatch(new x({channels:[Ze],context:{source:o.C.EVENT_CHANNEL_OPERATOR_UPDATED,operators:et}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onOperatorUpdated&&e.onOperatorUpdated(Ze,et)}),[2]})})}),[3,85];case 55:return[4,this.getChannel(xe.channelUrl,!0)];case 56:st=Rn.sent(),at=e.as(pe),_t=at.memberCount,pt=at.joinedMemberCount,it=at.inviter,(ot=at.invitees).forEach(function(e){return e.state=r.INVITED});try{for(ut=(0,a.w)(ot),ct=ut.next();!ct.done;ct=ut.next())lt=ct.value,st.isExclusive||st.isSuper||st.isBroadcast?(st.isSuper&&this._userInfoCache.upsert(lt,xe.ts),st._setLatestMemberCount(_t,pt,xe.ts)):st.addMember(lt,xe.ts),this._sdkState.userId===lt.userId&&(st.hiddenState=vt.UNHIDDEN,st.myMemberState!==r.JOINED&&(st.myMemberState=r.INVITED),st.invitedAt=xe.ts)}catch(e){Un={error:e}}finally{try{ct&&!ct.done&&(In=ut.return)&&In.call(ut)}finally{if(Un)throw Un.error}}return(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(st,Date.now()),this._dispatcher.dispatch(new x({channels:[st],context:{source:o.C.EVENT_CHANNEL_INVITED,inviter:it,invitees:ot}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onUserReceivedInvitation&&e.onUserReceivedInvitation(st,it,ot)}),[2]})})}),[3,85];case 57:return[4,this.getChannel(xe.channelUrl,!0)];case 58:return ht=Rn.sent(),dt=e.as(Ee),_t=dt.memberCount,pt=dt.joinedMemberCount,ft=dt.inviter,Et=dt.invitee,ht.isExclusive||ht.isSuper||ht.isBroadcast?(ht.isSuper&&this._userInfoCache.upsert(Et,xe.ts),ht._setLatestMemberCount(_t,pt,xe.ts)):ht.removeMember(Et),this._sdkState.userId===Et.userId?(ht.invitedAt=0,ht.myMemberState=r.NONE,ht.isPublic?this._dispatcher.dispatch(new x({channels:[ht],context:{source:o.C.EVENT_CHANNEL_DECLINED_INVITE,inviter:ft,invitee:Et}})):this._dispatcher.dispatch(new F({channelUrls:[ht.url],context:{source:o.C.EVENT_CHANNEL_DECLINED_INVITE,inviter:ft,invitee:Et}}))):this._dispatcher.dispatch(new x({channels:[ht],context:{source:o.C.EVENT_CHANNEL_DECLINED_INVITE,inviter:ft,invitee:Et}})),(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(ht,Date.now()),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEac
1h(function(e){e.onUserDeclinedInvitation&&e.onUserDeclinedInvitation(ht,ft,Et)}),[2]})})}),[3,85];case 59:return[4,this.getChannel(xe.channelUrl,!0)];case 60:return gt=Rn.sent(),mt=xe.category===c.a.TYPING_START,Ct=e.as(mt?Ne:Ae).user,gt._updateTypingStatus(Ct,mt?xe.ts:0),(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(gt,Date.now()),this._dispatcher.dispatch(new x({channels:[gt],context:{source:o.C.EVENT_CHANNEL_TYPING_STATUS_UPDATE}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onTypingStatusUpdated&&e.onTypingStatusUpdated(gt)}),[2]})})}),[3,85];case 61:return[4,this.getChannel(xe.channelUrl,!0)];case 62:yt=Rn.sent(),Nt=xe.category===c.a.USER_CHANNEL_MUTE,(bt=e.as(Nt?i.ab:i.ac).user).userId===this._sdkState.userId&&(yt.myMutedState=Nt?a.aX.MUTED:a.aX.UNMUTED,yt._myMutedRemainingTime=bt.restrictionInfo.remainingDuration);try{for(At=(0,a.w)(yt.members),Mt=At.next();!Mt.done;Mt=At.next())if((Tt=Mt.value).userId===bt.userId){Tt.isMuted=Nt;break}}catch(e){Dn={error:e}}finally{try{Mt&&!Mt.done&&(wn=At.return)&&wn.call(At)}finally{if(Dn)throw Dn.error}}return yt.isSuper&&this._userInfoCache.upsert(bt,xe.ts),(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(yt,Date.now()),this._dispatcher.dispatch(new x({channels:[yt],context:{source:Nt?o.C.EVENT_CHANNEL_MUTED:o.C.EVENT_CHANNEL_UNMUTED,user:bt}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){Nt?e.onUserMuted&&e.onUserMuted(yt,bt):e.onUserUnmuted&&e.onUserUnmuted(yt,bt)}),[2]})})}),[3,85];case 63:return(St=this._leftChannels.get(xe.channelUrl))?(It=St.channel,[3,66]):[3,64];case 64:return[4,this.getChannel(xe.channelUrl,!0)];case 65:It=Rn.sent(),Rn.label=66;case 66:return Ut=It,this._markAsLeave(Ut),Dt=e.as(i.aa).user,Rt=Dt.userId===this._sdkState.userId,Ut.isSuper&&this._userInfoCache.upsert(Dt,xe.ts),Rt&&this._dispatcher.dispatch(new F({channelUrls:[Ut.url],context:{source:o.C.EVENT_CHANNEL_BANNED,user:Dt}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onUserBanned&&e.onUserBanned(Ut,Dt)}),[2]})})}),[3,85];case 67:return[4,this.getChannel(xe.channelUrl,!0)];case 68:return wt=Rn.sent(),Lt=e.as(i.a9).user,Rt=Lt.userId===this._sdkState.userId,wt.isSuper&&this._userInfoCache.upsert(Lt,xe.ts),Rt&&this._dispatcher.dispatch(new F({channelUrls:[wt.url],context:{source:o.C.EVENT_CHANNEL_UNBANNED,user:Lt}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onUserUnbanned&&e.onUserUnbanned(wt,Lt)}),[2]})})}),[3,85];case 69:return[4,this.getChannel(xe.channelUrl,!0)];case 70:return Pt=Rn.sent(),Ot=e.as(i.a8).freeze,Pt.isFrozen=Ot,(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(Pt,Date.now()),this._dispatcher.dispatch(new x({channels:[Pt],context:{source:Ot?o.C.EVENT_CHANNEL_FROZEN:o.C.EVENT_CHANNEL_UNFROZEN}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){Ot?e.onChannelFrozen&&e.onChannelFrozen(Pt):e.onChannelUnfrozen&&e.onChannelUnfrozen(Pt)}),[2]})})}),[3,85];case 71:return[4,this.getChannel(xe.channelUrl,!0)];case 72:return xt=Rn.sent(),Ft=e.as(Ce),kt=Ft.allowAutoUnhide,Vt=Ft.hidePreviousMessages,Ht=Ft.messageOffsetTimestamp,null!==kt&&(xt.hiddenState=kt?vt.HIDDEN_ALLOW_AUTO_UNHIDE:vt.HIDDEN_PREVENT_AUTO_UNHIDE),null!==Vt&&Vt&&xt._updateUnreadCount(0,0),null!==Ht&&(xt.messageOffsetTimestamp=Ht),(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(xt,Date.now()),this._dispatcher.dispatch(new x({channels:[xt],context:{source:o.C.EVENT_CHANNEL_HIDDEN}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onChannelHidden&&e.onChannelHidden(xt)}),[2]})})}),[3,85];case 73:return[4,this.getChannel(xe.channelUrl,!0)];case 74:return(Gt=Rn.sent()).hiddenState=vt.UNHIDDEN,(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(Gt,Date.now()),this._dispatcher.dispatch(new x({channels:[Gt],context:{source:o.C.EVENT_CHANNEL_UNHIDDEN}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEac
1h(function(e){e.onChannelChanged&&e.onChannelChanged(Gt)}),[2]})})}),[3,85];case 75:return this._dispatcher.dispatch(new F({channelUrls:[xe.channelUrl],context:{source:o.C.EVENT_CHANNEL_DELETED}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onChannelDeleted&&e.onChannelDeleted(xe.channelUrl,a.C.GROUP)}),[2]})})}),[3,85];case 76:return[4,(0,a.az)(50)];case 77:return Rn.sent(),[4,this.getChannelWithoutCache(xe.channelUrl,!0,!1)];case 78:return Bt=Rn.sent(),this._dispatcher.dispatch(new x({channels:[Bt],context:{source:o.C.EVENT_CHANNEL_UPDATED}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onChannelChanged&&e.onChannelChanged(Bt)}),[2]})})}),[3,85];case 79:return[4,this.getChannel(xe.channelUrl,!0)];case 80:return qt=Rn.sent(),jt=e.as(i.a7),Kt=jt.created,zt=jt.updated,Wt=jt.deleted,Kt&&(qt._upsertCachedMetaData(Kt,xe.ts),this._dispatcher.dispatch(new x({channels:[qt],context:{source:o.C.EVENT_CHANNEL_METADATA_CREATED,metaData:Kt},ts:xe.ts}))),zt&&(qt._upsertCachedMetaData(zt,xe.ts),this._dispatcher.dispatch(new x({channels:[qt],context:{source:o.C.EVENT_CHANNEL_METADATA_UPDATED,metaData:zt},ts:xe.ts}))),Wt&&(qt._removeFromCachedMetaData(Wt,xe.ts),this._dispatcher.dispatch(new x({channels:[qt],context:{source:o.C.EVENT_CHANNEL_METADATA_DELETED,metaDataKeys:Wt},ts:xe.ts}))),(Kt||zt||Wt)&&(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(qt,Date.now()),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){Kt&&e.onMetaDataCreated&&e.onMetaDataCreated(qt,Kt),zt&&e.onMetaDataUpdated&&e.onMetaDataUpdated(qt,zt),Wt&&e.onMetaDataDeleted&&e.onMetaDataDeleted(qt,Wt)}),[2]})})}),[3,85];case 81:return[4,this.getChannel(xe.channelUrl,!0)];case 82:return Qt=Rn.sent(),Yt=e.as(i.a6),Jt=Yt.created,Xt=Yt.updated,$t=Yt.deleted,Jt&&this._dispatcher.dispatch(new x({channels:[Qt],context:{source:o.C.EVENT_CHANNEL_METACOUNTER_CREATED,metaCounters:Jt}})),Xt&&this._dispatcher.dispatch(new x({channels:[Qt],context:{source:o.C.EVENT_CHANNEL_METACOUNTER_UPDATED,metaCounters:Xt}})),$t&&this._dispatcher.dispatch(new x({channels:[Qt],context:{source:o.C.EVENT_CHANNEL_METACOUNTER_DELETED,metaCounterKeys:$t}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){Jt&&e.onMetaCounterCreated&&e.onMetaCounterCreated(Qt,Jt),Xt&&e.onMetaCounterUpdated&&e.onMetaCounterUpdated(Qt,Xt),$t&&e.onMetaCounterDeleted&&e.onMetaCounterDeleted(Qt,$t)}),[2]})})}),[3,85];case 83:return[4,this.getChannel(xe.channelUrl,!0)];case 84:return Zt=Rn.sent(),en=e.as(c.U),tn=en.pinnedMessageIds,nn=en.latestPinnedMessage,(rn=en.ts)>Zt._pinnedMessagesUpdatedAt&&(Zt.pinnedMessageIds=null!=tn?tn:[],Zt.lastPinnedMessage=nn,Zt._pinnedMessagesUpdatedAt=rn,(sn=a.V.of(this._iid).requestDeduplicator).updatePendingResponse(Zt,Date.now()),this._dispatcher.dispatch(new x({channels:[Zt],context:{source:o.C.EVENT_PINNED_MESSAGE_UPDATED}})),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){try{for(e=(0,a.w)(this._groupChannelHandlers.values()),t=e.next();!t.done;t=e.next())(n=t.value).onChannelChanged&&n.onChannelChanged(Zt)}catch(e){r={error:e}}finally{try{t&&!t.done&&(s=e.return)&&s.call(e)}finally{if(r)throw r.error}}return[2]})})}),(0,a.K)(function(){return(0,a._)(Ln,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._groupChannelHandlers.forEach(function(e){e.onPinnedMessageUpdated&&e.onPinnedMessageUpdated(Zt)}),[2]})})})),[3,85];case 85:return[3,87];case 86:switch((an=e.as(u.U).event).category){case u.a.USER_BLOCK:on=u.b.getDataAsUserBlockEvent(this._iid,an),cn=on.blocker,ln=on.blockee,this._groupChannelCache.block(cn.userId,ln.userId);break;case u.a.USER_UNBLOCK:un=u.b.getDataAsUserBlockEvent(this._iid,an),cn=un.blocker,ln=un.blockee,this._groupChannelCache.unblock(cn.userId,ln.userId)}return[3,87];case 87:return[3,89];case 88:if(hn=Rn.sent(),(0,a.Z)(hn))throw hn;return[3,89];case 89:return[2]}})})},t.prototype._markAsLeave=function(e){var t,n=this,r=null!==(t=this._leftChannels.get(e.url))&&void 0!==t?t:{channel:e,ref:0};r.ref++,this._leftChannels.set(e.url,r),setTimeout(function(){r.ref--,0===r.ref&&n._leftChannels.delete(e.url)},1e4)},t.prototype.addHandler=function(e,t){this._groupChannelHandlers.set(e,t)},t.prototype.removeHandler=function(e){this._groupChannelHandlers.delete(e)},t.prototype.clearHandler=function(){this._groupChannelHandlers.clear()},t.prototype.subscribeChannelEvent=function(e,t){this._groupChannelBroadcast.subscribe(e,t)},t.prototype.unsubscribeChannelEvent=function(e){this._groupChannelBroadcast.unsubscribe(e)},t.prototype._updateJoinedMemberCount=function(e){e.joinedMemberCount=e.members.filter(function(e){return e.state===r.JOINED}).length},t.prototype.getChannel=function(e,t){return void 0===t&&(t=!1),(0,a._)(this,void 0,void 0,function(){var n;return(0,a.b)(this,function(r){switch(r.label){case 0:(0,a.F)((0,a.a)("string",e)).throw(a.t.invalidParameters),r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this.getChannelFromCache(e)];
1case 2:return(n=r.sent())?[2,n]:[3,4];case 3:return r.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(e,t)];case 5:return[2,r.sent()]}})})},t.prototype.getChannelWithoutCache=function(e,t,n){return void 0===t&&(t=!1),void 0===n&&(n=!0),(0,a._)(this,void 0,void 0,function(){var r,s,i,o,u,c,l=this;return(0,a.b)(this,function(h){switch(h.label){case 0:return(0,a.F)((0,a.a)("string",e)).throw(a.t.invalidParameters),r=a.V.of(this._iid).requestDeduplicator,s=new B({channelUrl:e,isInternalCall:t}),[4,r.requestGetChannel(s.path,function(){return l._requestQueue.send(s)},s.params,n)];case 1:switch(i=h.sent(),o=i.as(q).channel,u=o.unreadMessageCount,c=o.unreadMentionCount,o.myCountPreference){case Et.UNREAD_MESSAGE_COUNT_ONLY:c=0;break;case Et.UNREAD_MENTION_COUNT_ONLY:u=0;break;case Et.OFF:u=0,c=0}return o._updateUnreadCount(u,c),[4,this.upsertChannelsToCache([o])];case 2:return[2,h.sent()[0]]}})})},t.prototype.refreshChannel=function(e,t,n,s){return void 0===t&&(t=!0),void 0===n&&(n=o.C.REFRESH_CHANNEL),void 0===s&&(s=!1),(0,a._)(this,void 0,void 0,function(){var i,o,u,c,l,h,d=this;return(0,a.b)(this,function(_){switch(_.label){case 0:return _.trys.push([0,5,,6]),i=a.V.of(this._iid).requestDeduplicator,o=new B({channelUrl:e,isInternalCall:t,showLatestMessage:s}),[4,i.requestGetChannel(o.path,function(){return d._requestQueue.send(o)},o.params)];case 1:return u=_.sent(),(c=u.as(q).channel).myMemberState!==r.NONE?[3,2]:(this._dispatcher.dispatch(new F({channelUrls:[c.url],context:{source:n}})),[3,4]);case 2:return[4,this.upsertChannelsToCache([c])];case 3:l=_.sent(),this._dispatcher.dispatch(new x({channels:l,context:{source:n}})),_.label=4;case 4:return[3,6];case 5:return(h=_.sent()).code!==a.D.NON_AUTHORIZED&&h.code!==a.D.NOT_FOUND_IN_DATABASE||this._dispatcher.dispatch(new F({channelUrls:[e],context:{source:n}})),[3,6];case 6:return[2]}})})},t.prototype.getMyGroupChannels=function(e,t,n,r,s){return void 0===r&&(r=o.C.REQUEST_CHANNEL),void 0===s&&(s=!1),(0,a._)(this,void 0,void 0,function(){var i,o,u,c,l,h,d,_,p;return(0,a.b)(this,function(f){switch(f.label){case 0:return t.createdAfter&&(t.createdAfter=Math.floor(t.createdAfter/1e3)),t.createdBefore&&(t.createdBefore=Math.floor(t.createdBefore/1e3)),i=!1,s&&(o=a.V.of(this._iid),u=o.appInfo,(c=o.cacheContext)&&!c.localCacheEnabled&&(null==u?void 0:u.enabledChannelMemberShipHistory)&&(null==u?void 0:u.applicationAttributes.includes("left_user_view_support"))&&(i=!0)),l=new K((0,a.j)((0,a.j)({},t),{userId:this._sdkState.userId,token:e,limit:n,includeLeftChannel:s&&i})),[4,this._requestQueue.send(l)];case 1:return h=f.sent(),d=h.as(z),_=d.channels,p=d.token,this._dispatcher.dispatch(new x({channels:_,context:{source:r}})),[2,{channels:_,token:p}]}})})},t.prototype.getMyGroupChannelChangeLogs=function(e,t,n){return void 0===n&&(n=o.C.REQUEST_CHANNEL_CHANGELOGS),(0,a._)(this,void 0,void 0,function(){var r,s,i,o,u,c,l,h;return(0,a.b)(this,function(d){switch(d.label){case 0:return r=(0,a.j)((0,a.j)({},T),t),(0,a.F)(((0,a.a)("string",e)||(0,a.a)("number",e))&&S(r)).throw(a.t.invalidParameters),s=new H((0,a.u)({userId:this._sdkState.userId,ts:"number"==typeof e?e:null,token:"string"==typeof e?e:null,filter:r})),[4,this._requestQueue.send(s)];case 1:return i=d.sent(),o=i.as(G),u=o.updatedChannels,c=o.deletedChannelUrls,l=o.hasMore,h=o.ts,u.length>0&&this._dispatcher.dispatch(new x({channels:u,context:{source:n},ts:h})),c.length>0&&this._dispatcher.dispatch(new F({channelUrls:c,context:{source:n}})),[2,{updatedChannels:u,deletedChannelUrls:c,hasMore:l,token:o.token}]}})})},t.prototype.getGroupChannelCount=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n;return(0,a.b)(this,function(r){switch(r.label){case 0:return t=(0,a.j)((0,a.j)({},U),e),(0,a.F)(I(t)).throw(a.t.invalidParameters),n=new W({userId:this._sdkState.userId,filter:t}),[4,this._requestQueue.send(n)];case 1:return[2,r.sent().as(Q).groupChannelCount]}})})},t.prototype.getUnreadItemCount=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,o,u,c,l,h,d,_,p,f,E,v;return(0,a.b)(this,function(g){switch(g.label){case 0:return t=(0,a.j)((0,a.j)({},w),e),(0,a.F)(function(e){return(0,a.$)(y,e.keys)&&(0,a.$)("string",e.customTypeFilters,!0)&&(0,a.$)("string",e.customTypesFilter,!0)}(t)).throw(a.t.invalidParameters),n=a.V.of(this._iid),r=n.sdkState,s=n.requestQueue,i=new Y({userId:r.userId,filter:t}),[4,s.send(i)];case 1:return o=g.sent(),u=o.as(J),c=u.groupChannelUnreadMentionCount,l=u.groupChannelUnreadMessageCount,h=u.groupChannelInvitationCount,d=u.superGroupChannelUnreadMentionCount,_=u.superGroupChannelUnreadMessageCount,p=u.superGroupChannelInvitationCount,f=u.nonSuperGroupChannelUnreadMentionCount,E=u.nonSuperGroupChannelUnreadMessageCount,v=u.nonSuperGroupChannelInvitationCount,[2,(0,a.e)({groupChannelUnreadMentionCount:c,groupChannelUnreadMessageCount:l,groupChannelInvitationCount:h,superGroupChannelUnreadMentionCount:d,superGroupChannelUnreadMessageCount:_,superGroupChannelInvitationCount:p,nonSuperGroupChannelUnreadMentionCount:f,nonSuperGroupChannelUnreadMessageCount:E,nonSuperGroupChannelInvitationCount:v})]}})})},t.prototype.getTotalUnreadChannelCount=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return e=a.V.of(this._iid),t=e.sdkState,n=e.requestQueue,r=new X({userId:t.userId}),[4,n.send(r)];case 1:return[2,s.sent().as($).unreadCount]}})})},t.prototype.getTotalUnreadMessageCount=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return t=(0,a.j)((0,a.j)({},L),e),(0,a.F)(function(e){return(0,a.$)("string",e.channelCustomTypesFilter,!0)&&(0,a.a2)(_,e.superChannelFilter)}(t)).throw(a.t.invalidParameters),n=a.V.of(this._iid),r=n.sdkState,s=n.requestQueue,i=new Z({userId:r.userId,filter:t}),[4,s.send(i)];case 1:return[2,o.sent().as(ee).unreadCount]}})})},t.prototype.getTotalScheduledMessageCount=function(e){return void 0===e&&(e={}),(0,a._)(this,void 0,void 0,function(){var t,n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return t=(0,a.j)((0,a.j)({},R),e),(0,a.F)(function(e){return(0,a.a)("string",e.channelUrl,!0)&&(0,a.$)(i.X,e.scheduledStatus,!0)&&(0,a.a2)(a.au,e.messageTypeFilter)}(t)).throw(a.t.invalidParameters),n=a.V.of(this._iid).requestQueue,r=new te(t),[4,n.send(r)];case 1:return[2,s.sent().as(ne).count]}})})},t.prototype.getSubscribedTotalUnreadMessageCount=function(){var e=a.V.of(this._iid).subscribedUnreadMessageCount;return e.all>=0?e.all:0}
1,t.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){var e=0,t=a.V.of(this._iid).subscribedUnreadMessageCount;return Object.keys(t.customTypes).forEach(function(n){e+=t.customTypes[n]}),e},t.prototype.getSubscribedCustomTypeUnreadMessageCount=function(e){var t;return null!==(t=a.V.of(this._iid).subscribedUnreadMessageCount.customTypes[e])&&void 0!==t?t:0},t.prototype.createChannel=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s;return(0,a.b)(this,function(i){switch(i.label){case 0:return t=(0,a.j)((0,a.j)({},A),e),(0,a.F)(M(t)).throw(a.t.invalidParameters),t.isPublic||(t.accessCode=void 0),n=new se((0,a.j)({userId:this._sdkState.userId},t)),[4,this._requestQueue.send(n)];case 1:return r=i.sent(),s=r.as(ae).channel,[4,this.upsertChannelsToCache([s])];case 2:return i.sent(),[2,s]}})})},t.prototype.markAsReadAll=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i,o,u;return(0,a.b)(this,function(c){switch(c.label){case 0:return e=Date.now(),(0,a.F)(e-this._markAsReadAllLastSentAt>=1e3).throw(a.t.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=e,t=new ie({userId:this._sdkState.userId}),[4,this._requestQueue.send(t)];case 1:c.sent(),n=this._groupChannelCache.channels;try{for(r=(0,a.w)(n),s=r.next();!s.done;s=r.next())(i=s.value)._updateUnreadMemberState(this._sdkState.userId,e),i._updateUnreadCount(0,0)}catch(e){o={error:e}}finally{try{s&&!s.done&&(u=r.return)&&u.call(r)}finally{if(o)throw o.error}}return n.length>0?[4,this.upsertChannelsToCache(n)]:[3,3];case 2:c.sent(),c.label=3;case 3:return[2]}})})},t.prototype.markAsReadWithChannelUrls=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,o,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:return t=Date.now(),(0,a.F)((0,a.$)("string",e)&&t-this._markAsReadAllLastSentAt>=1e3).throw(a.t.markAsReadAllRateLimitExceeded),this._markAsReadAllLastSentAt=t,n=new ie({userId:this._sdkState.userId,channelUrls:e}),[4,this._requestQueue.send(n)];case 1:h.sent(),r=this._groupChannelCache.channels,s=[];try{for(i=(0,a.w)(r),o=i.next();!o.done;o=i.next())u=o.value,e.includes(u.url)&&(u._updateUnreadMemberState(this._sdkState.userId,t),u._updateUnreadCount(0,0),s.push(u))}catch(e){c={error:e}}finally{try{o&&!o.done&&(l=i.return)&&l.call(i)}finally{if(c)throw c.error}}return s.length>0?[4,this.upsertChannelsToCache(s)]:[3,3];case 2:h.sent(),h.label=3;case 3:return[2]}})})},t.prototype.markAsDelivered=function(e){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this.getChannel(e)];case 1:return[4,t.sent().markAsDelivered()];case 2:return t.sent(),[2]}})})},t.prototype.getMessageFromCache=function(e){var t;return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,this._messageCache.get(e)];case 1:return[2,null!==(t=n.sent())&&void 0!==t?t:null]}})})},t.prototype.getExactlyMatchingMessagesForTokenFromCache=function(e,t,n){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(r){switch(r.label){case 0:return[4,this._messageCache.fetch({channelUrl:e,token:t,filter:n,exactMatch:!0})];case 1:return[2,r.sent()]}})})},t.prototype.getMessagesFromCache=function(e,t,n,r,s,o){return void 0===s&&(s=i.am),void 0===o&&(o=!0),(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(a){switch(a.label){case 0:return[4,this._messageCache.fetch({channelUrl:e,token:t,limit:s,filter:r,backward:"next"===n,inclusive:o})];case 1:return[2,a.sent()]}})})},t.prototype.getPollMessagesFromCache=function(e,t,n,r){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(s){switch(s.label){case 0:return[4,this._messageCache.fetch({channelUrl:e,token:t,limit:r,filter:n,backward:!1,isPollOnly:!0})];case 1:return[2,s.sent()]}})})},t.prototype.getCachedMessageCountBetween=function(e,t,n,r){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(s){switch(s.label){case 0:return[4,this._messageCache.countBetween(e,t,new De({top:n,bottom:r}))];case 1:return[2,s.sent()]}})})},t.prototype.getUnsentMessagesFromCache=function(e,t){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,this._unsentMessageCache.fetch({channelUrl:e,filter:t})];case 1:return[2,n.sent()]}})})},t.prototype.removeFailedMessageFromCache=function(e){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this._unsentMessageCache.remove([e])];case 1:return t.sent(),[2]}})})},t}(c.B),Re=function(e,t){return t instanceof i.ag?e.findIndex(function(e){return e instanceof i.ag&&t.isIdentical(e)}):e.findIndex(function(e){return e.isIdentical(t)})},Pe=function(e,t){return e.findIndex(function(e){return e instanceof i.ae?e.messageId===t:e instanceof i.an?e.notificationId===t:void 0})},Oe=function(e,t){if(e.length>0){for(var n=0,r=e.length-1,s=Math.floor((n+r)/2);n<r;){var a=e[s].createdAt-t.createdAt;if(a>0)r=s,s=Math.floor((n+r)/2);else{if(!(a<0))return s;n=s+1,s=Math.floor((n+r)/2)}}return e[s].createdAt>t.createdAt?s:s+1}return e.length},xe={},Fe=function(){function e(e){var t=e._iid,n=e.channel,r=e.limit,s=void 0===r?100:r,c=this;this.ref=0,this._iid=t,this._channel=n,this._limit=s,this._prevSyncLoopCount=0;
1var l,h,d=a.V.of(this._iid),_=d.sdkState,p=d.cacheContext,f=d.dispatcher,E=d.logger,v=d.statManager,g=d.messageBackgroundSyncThrottleController;this._metadataKey=(l=_.userId,h=n.url,"sendbird:".concat(l,"@groupchannel/").concat(h,"/message/sync.meta"));var m=function(e,t){return"sendbird:".concat(e,"@groupchannel/").concat(t,"/message/sync")}(_.userId,n.url);this._prevSync=new u.c(m,function(e){return(0,a._)(c,void 0,void 0,function(){var t=this;return(0,a.b)(this,function(r){switch(r.label){case 0:return[4,g.run("message-background-sync-".concat(n.url,"-prev"),function(){return(0,a._)(t,void 0,void 0,function(){var t,r,s,u,c,l,h,d,_,f,g,m;return(0,a.b)(this,function(C){switch(C.label){case 0:return t={hasNext:!0,nextToken:0},this._prevSyncLoopCount++,[4,this.loadMetadata()];case 1:if(C.sent(),E.debug("message background prev sync from",null===(l=this._metadata)||void 0===l?void 0:l.range.top),null===(h=this._metadata)||void 0===h?void 0:h.previousComplete)return[3,10];C.label=2;case 2:return C.trys.push([2,5,8,9]),[4,i.ao.of(this._iid)._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,(null===(_=null===(d=this._metadata)||void 0===d?void 0:d.range)||void 0===_?void 0:_.top)?this._metadata.range.top:e,{prevResultSize:this._limit,nextResultSize:0,replyType:a.aB.ALL,includeReactions:!0,includeMetaArray:!0,includeParentMessageInfo:!0,includeThreadInfo:!0,isInclusive:!0},o.C.SYNC_MESSAGE_BACKGROUND,!1,!1,i.ap.INTERNAL_BACKSYNC)];case 3:return(r=C.sent().messages).length>0&&(s=r.map(function(e){return e.createdAt}),(null===(f=this._metadata)||void 0===f?void 0:(c=f.range).intersect.apply(c,(0,a.q)([],(0,a.r)(s),!1)))?this.extendRange(r):this._metadata={range:new De({top:Math.min.apply(Math,(0,a.q)([],(0,a.r)(s),!1)),bottom:Math.max.apply(Math,(0,a.q)([],(0,a.r)(s),!1))}),previousComplete:!1}),t.hasNext=r.length>=this._limit&&this._prevSyncLoopCount<1,this._metadata&&(t.nextToken=this._metadata.range.top,this._metadata.previousComplete=r.length<this._limit),E.debug("message background prev sync progress",t),[4,this.saveMetadata()];case 4:return C.sent(),[3,9];case 5:return u=C.sent(),E.debug("message background prev sync error",u),u instanceof a.t&&u.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];
1case 6:C.sent(),C.label=7;case 7:throw u;case 8:return v.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:n.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:null!==(m=null===(g=p.localCacheConfig)||void 0===g?void 0:g.maxSize)&&void 0!==m?m:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 9:return[3,11];case 10:t.hasNext=!1,C.label=11;case 11:return[2,t]}})})})];case 1:return[2,r.sent()]}})})}),this._nextSync=new u.c(m,function(e){return(0,a._)(c,void 0,void 0,function(){var t=this;return(0,a.b)(this,function(r){switch(r.label){case 0:return[4,g.run("message-background-sync-".concat(n.url,"-next"),function(){return(0,a._)(t,void 0,void 0,function(){var t,r,s,u,c,l,h,d,_,f,g;return(0,a.b)(this,function(m){switch(m.label){case 0:return t={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:m.sent(),E.debug("message background next sync from",null===(l=this._metadata)||void 0===l?void 0:l.range.bottom),m.label=2;case 2:return m.trys.push([2,5,6,7]),[4,i.ao.of(this._iid)._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,(null===(d=null===(h=this._metadata)||void 0===h?void 0:h.range)||void 0===d?void 0:d.bottom)?this._metadata.range.bottom:e,{prevResultSize:0,nextResultSize:this._limit,replyType:a.aB.ALL,includeReactions:!0,includeMetaArray:!0,includeParentMessageInfo:!0,includeThreadInfo:!0,isInclusive:!0},o.C.SYNC_MESSAGE_BACKGROUND,!1,!1,i.ap.INTERNAL_BACKSYNC)];case 3:return(r=m.sent().messages).length>0&&(s=r.map(function(e){return e.createdAt}),(null===(_=this._metadata)||void 0===_?void 0:(c=_.range).intersect.apply(c,(0,a.q)([],(0,a.r)(s),!1)))?this.extendRange(r):this._metadata={range:new De({top:Math.min.apply(Math,(0,a.q)([],(0,a.r)(s),!1)),bottom:Math.max.apply(Math,(0,a.q)([],(0,a.r)(s),!1))}),previousComplete:!1}),t.hasNext=r.length>=this._limit,this._metadata&&(t.nextToken=this._metadata.range.bottom),E.debug("message background next sync progress",t),[4,this.saveMetadata()];case 4:return m.sent(),[3,7];case 5:throw u=m.sent(),E.debug("message background next sync error",u),u;case 6:return v.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:n.url,measured_on:"back_sync",event:"cache_fetch",max_db_size:null!==(g=null===(f=p.localCacheConfig)||void 0===f?void 0:f.maxSize)&&void 0!==g?g:0,use_local_cache:p.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[2,t]}})})})];case 1:return[2,r.sent()]}})})}),this._connectionEventContext=f.on(function(e){e instanceof a.I&&(e.stateType===a.J.CONNECTED?c.resume():c.pause())})}return e.of=function(t,n){return xe[t]||(xe[t]={}),xe[t][n.url]||(xe[t][n.url]=new e({_iid:t,channel:n})),xe[t][n.url].ref++,xe[t][n.url]},e.clear=function(e,t){xe[e]&&xe[e][t]&&(xe[e][t].close(),delete xe[e])},Object.defineProperty(e.prototype,"range",{get:function(){var e,t;return null!==(t=null===(e=this._metadata)||void 0===e?void 0:e.range)&&void 0!==t?t:new De({})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"previousComplete",{get:function(){var e;return!!(null===(e=this._metadata)||void 0===e?void 0:e.previousComplete)},enumerable:!1,configurable:!0}),e.prototype.isWrappingMessages=function(e){var t;return null===(t=this.range)||void 0===t?void 0:t.includes.apply(t,(0,a.q)([],(0,a.r)(e.map(function(e){return e.createdAt})),!1))},e.prototype.extendRange=function(e){var t;this._metadata&&(t=this._metadata.range).extends.apply(t,(0,a.q)([],(0,a.r)(e.map(function(e){return e.createdAt})),!1))},e.prototype.loadMetadata=function(){return(0,a._)(this,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.V.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:e=t.sent(),this._metadata=e?{range:new De(e.range),previousComplete:e.previousComplete}:{range:new De({}),previousComplete:!1},t.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return this._metadata?[4,a.V.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return e.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return[4,a.V.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return e.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(e){var t,n,r,s;
1void 0===e&&(e=Date.now());var i=a.V.of(this._iid),o=i.logger,u=i.sessionManager;i.cacheContext.localCacheEnabled&&u.session.hasSession&&(o.debug("message background sync resume()"),this._prevSyncLoopCount=0,this._metadata&&this._metadata.previousComplete||this._prevSync.start(null!==(n=null===(t=this._metadata)||void 0===t?void 0:t.range.top)&&void 0!==n?n:e),this._nextSync.start(null!==(s=null===(r=this._metadata)||void 0===r?void 0:r.range.bottom)&&void 0!==s?s:e))},e.prototype.pause=function(){a.V.of(this._iid).logger.debug("message background sync stop()"),this._prevSync.stop(),this._nextSync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete xe[this._iid][this._channel.url])},e}(),ke={},Ve=function(){function e(e){var t=e._iid,n=e.channel,r=e.includeParams,s=this;this.ref=0,this._iid=t,this._channel=n,this._includeParams=r;var c,l,h=a.V.of(this._iid),d=h.logger,_=h.sdkState,p=h.dispatcher;this._metadataKey=(c=_.userId,l=n.url,"sendbird:".concat(c,"@groupchannel/").concat(l,"/message/changelogs.meta"));var f=function(e,t){return"sendbird:".concat(e,"@groupchannel/").concat(t,"/message/changelogs")}(_.userId,this._channel.url);this._sync=new u.c(f,function(){return(0,a._)(s,void 0,void 0,function(){var e,t,n,r,s,u,c,l,h;return(0,a.b)(this,function(_){switch(_.label){case 0:return e={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:_.sent(),d.debug("message changelog sync from",null===(h=this._metadata)||void 0===h?void 0:h.token),_.label=2;case 2:return _.trys.push([2,5,,8]),[4,i.ao.of(this._iid).getMessageChangelogs(this._channel.url,this._channel.channelType,this._metadata.token,(0,a.j)({replyType:a.aB.ALL},this._includeParams),o.C.SYNC_MESSAGE_CHANGELOGS)];case 3:return t=_.sent(),n=t.updatedMessages,r=t.deletedMessageIds,s=t.hasMore,u=t.token,c=t.forceUseNextToken,e.hasNext=s,e.nextToken=u,n.length>0||r.length>0?this._metadata&&(this._metadata.token=u):c&&this._metadata&&(this._metadata.token=u),d.debug("message changelog sync progress",e),[4,this.saveMetadata()];case 4:return _.sent(),[3,8];case 5:return l=_.sent(),d.debug("message changelog sync error",l),l instanceof a.t&&l.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:_.sent(),_.label=7;case 7:throw l;case 8:return[2,e]}})})}),this._connectionEventContext=p.on(function(e){e instanceof a.I&&(e.stateType===a.J.CONNECTED?s.resume():s.pause())})}return e.of=function(t,n,r){return ke[t]||(ke[t]={}),ke[t][n.url]||(ke[t][n.url]=new e({_iid:t,channel:n,includeParams:r})),ke[t][n.url].ref++,ke[t][n.url]},e.clear=function(e,t){ke[e]&&ke[e][t]&&(ke[e][t].close(),delete ke[e])},e.prototype.loadMetadata=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return this._metadata?[3,2]:(e=a.V.of(this._iid),t=e.cacheContext,n=e.firstConnectedAt,[4,t.preference.get(this._metadataKey)]);case 1:r=s.sent(),this._metadata={token:r?r.token:n},s.label=2;case 2:return[2,this._metadata]}})})},e.prototype.saveMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return this._metadata?[4,a.V.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return e.sent(),[2,!0];case 2:return[2,!1]}})})},e.prototype.clearMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return[4,a.V.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return e.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){var e=a.V.of(this._iid),t=e.logger;e.sessionManager.session.hasSession&&(t.debug("message changelog sync resume()"),this._sync.start(0))},e.prototype.pause=function(){a.V.of(this._iid).logger.debug("message changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete ke[this._iid][this._channel.url])},e}(),He={},Ge=function(){function e(e){var t=e._iid,n=e.channel,r=e.hasPollMessage,s=this;this.ref=0,this._iid=t,this._channel=n;var i,c,l=a.V.of(this._iid),h=l.logger,d=l.sdkState,_=l.dispatcher;this._metadataKey=(i=d.userId,c=n.url,"sendbird:".concat(i,"@groupchannel/").concat(c,"/poll/changelogs.meta"));var p=function(e,t){return"sendbird:".concat(e,"@groupchannel/").concat(t,"/poll/changelogs")}(d.userId,this._channel.url);this._sync=new u.c(p,function(){return(0,a._)(s,void 0,void 0,function(){var e,t,n,s,i,u,c,l;return(0,a.b)(this,function(d){switch(d.label){case 0:return e={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return d.sent(),h.debug("poll changelog sync from",null===(l=this._metadata)||void 0===l?void 0:l.token),(t=!this._metadata||!this._metadata.token)?[4,r()]:[3,3];case 2:t=!d.sent(),d.label=3;case 3:if(t)return[2,{hasNext:!1,nextToken:0}];this._metadata||(n=a.V.of(this._iid).firstConnectedAt,this._metadata={token:n}),d.label=4;case 4:return d.trys.push([4,7,,10]),[4,o.f.of(this._iid).getPollChangeLogs(this._channel.url,this._channel.channelType,this._metadata.token)];case 5:return s=d.sent(),i=s.hasMore,u=s.token,e.hasNext=i,e.nextToken=u,this._metadata.token=u,h.debug("poll changelog sync progress",e),[4,this.saveMetadata()];case 6:return d.sent(),[3,10];case 7:return c=d.sent(),h.debug("poll changelog sync error",c),c instanceof a.t&&c.isInvalidTokenError?[4,this.clearMetadata()]:[3,9];case 8:d.sent(),d.label=9;case 9:throw c;case 10:return[2,e]}})})}),this._connectionEventContext=_.on(function(e){e instanceof a.I&&(e.stateType===a.J.CONNECTED?s.resume():s.pause())})}return e.of=function(t,n,r){return He[t]||(He[t]={}),He[t][n.url]||(He[t][n.url]=new e({_iid:t,channel:n,hasPollMessage:r})),He[t][n.url].ref++,He[t][n.url]},e.prototype.loadMetadata=function(){return(0,a._)(this,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.V.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:e=t.sent(),this._metadata=e?{token:e.token}:void 0,t.label=2;case 2:return[2]}})})},e.prototype.saveMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return this._metadata?[4,a.V.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},e.prototype.clearMetadata=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return[4,a.V.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return e.sent(),this._metadata=void 0,[2]}})})},e.prototype.resume=function(){a.V.of(this._iid).logger.debug("poll changelog sync resume()"),this._sync.start(0)},e.prototype.pause=function(){a.V.of(this._iid).logger.debug("poll changelog sync pause()"),this._sync.stop()},e.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete He[this._iid][this._channel.url])},e}(),Be=function(e){function t(t){var n,r,s,i,o,u,c,l,h,d,_=this;return(_=e.call(this)||this).method=a.A.GET,_.path="".concat((0,a.aq)(t.channelType),"/").concat(t.channelUrl,"/messages_gap"),_.params=(0,a.e)({prev_start_ts:t.prevStart,prev_end_ts:t.prevEnd,prev_cache_count:t.prevCount,next_start_ts:t.nextStart,next_end_ts:t.nextEnd,next_cache_count:t.nextCount,huge_gap_threshold:null!==(n=t.threshold)&&void 0!==n?n:null,reverse:!0,custom_types:null!==(r=t.customTypes)&&void 0!==r?r:["*"],message_type:null!==(s=t.messageType)&&void 0!==s?s:null,include_reply_type:null!==(i=t.replyType)&&void 0!==i?i:a.aB.NONE,include_reactions_summary:null===(o=t.includeReactions)||void 0===o||o,include_meta_array:null===(u=t.includeMetaArray)||void 0===u||u,include_thread_info:null===(c=t.includeThreadInfo)||void 0===c||c,include_parent_message_info:null===(l=t.includeParentMessageInfo)||void 0===l||l,with_sorted_meta_array:null===(h=t.includeMetaArray)||void 0===h||h,show_subchannel_messages_only:null!==(d=t.showSubchannelMessagesOnly)&&void 0!==d&&d,include_poll_details:!0,checking_continuous_messages:t.checkingContinuousMessages}),_}return(0,a.c)(t,e),t}(a.f),qe=function(e){function t(t,n){var r,s,a,o,u,c,l=this;return(l=e.call(this,t,n)||this).isHugeGap=n.is_huge_gap,l.prevMessages=(null!==(r=n.prev_messages)&&void 0!==r?r:[]).map(function(e){return(0,i.W)(t,e)}),l.prevHasMore=null!==(s=n.prev_hasmore)&&void 0!==s&&s,l.isContinuousPrevMessages=null!==(a=n.is_continuous_prev_messages)&&void 0!==a&&a,l.nextMessages=(null!==(o=n.next_messages)&&void 0!==o?o:[]).map(function(e){return(0,i.W)(t,e)}),l.nextHasmore=null!==(u=n.next_hasmore)&&void 0!==u&&u,l.isContinuousNextMessages=null!==(c=n.is_continuous_next_messages)&&void 0!==c&&c,l}return(0,a.c)(t,e),t}(a.g),je={includeMetaArray:!0,includeReactions:!0,includeThreadInfo:!0,includeParentMessageInfo:!0};!function(e){e.CACHE_AND_REPLACE_BY_API="cache_and_replace_by_api"}(Ue||(Ue={}));var Ke,ze,We,Qe=function(){function e(){this._onCacheResult=a.aD,this._onApiResult=a.aD}return e.prototype._invokeResponse=function(e,t,n){var r=this;(0,a.K)(function(){return(0,a._)(r,void 0,void 0,function(){return(0,a.b)(this,function(r){switch(e){case"local":this._onCacheResult(t,n);break;case"remote":this._onApiResult(t,n)}return[2]})})})},e.prototype.onCacheResult=function(e){return this._onCacheResult=e,this},e.prototype.onApiResult=function(e){return this._onApiResult=e,this},e}(),Ye=function(){function e(e,t){var n=t.filter,s=t.startingPoint,c=t.limit,l=t.prevResultLimit,h=t.nextResultLimit,d=t.channel,_=t.channelManager,p=t.disableBackgroun
1dSync,f=void 0!==p&&p,E=this;this._messages=[],this._unsentMessages=[],this._isLoadingPrevious=!1,this._isLoadingNext=!1,this._iid=e,this._key="mc-".concat((0,a.o)()),this._isDisposed=!1,this.filter=null!=n?n:new i.T,this._channel=d,this._syncRange=new De({}),this._hasPrevious=!0,this._hasNext=!0,this._startingPoint="number"==typeof s&&Number.isFinite(s)?s:Number.MAX_SAFE_INTEGER,this._limit=c||i.am,this._prevResultLimit=null!=l?l:Math.floor(this._limit/2),this._nextResultLimit=null!=h?h:Math.floor(this._limit/2),this._channelManager=_;var v=a.V.of(this._iid).statManager;this._channelManager.subscribeChannelEvent(this._key,{onUpdate:function(e,t){var n=t.source,r=e.findIndex(function(e){return e.isIdentical(E.channel)});r>=0&&(E._replaceChannelOfCollection(e[r]),E.channel._runIfHandleableWithGroupChannel(function(e){switch(n){case o.C.EVENT_CHANNEL_UPDATED:for(var r=!1,s=0;s<E._messages.length;s++)if(E._messages[s].createdAt>=e.messageOffsetTimestamp){r=!0;var i=s;if(i>0){var u=E._messages.splice(0,i);E._removeMessagesFromView(u.map(function(e){return E.keyOf(e)}),o.C.EVENT_MESSAGE_OFFSET_UPDATED)}break}!r&&E._messages.length>0&&E._removeMessagesFromView(E._messages.map(function(e){return E.keyOf(e)}),o.C.EVENT_MESSAGE_OFFSET_UPDATED);break;case o.C.EVENT_CHANNEL_UNMUTED:var c=a.V.of(E._iid).sdkState,l=t.user;c.userId===l.userId&&E._clearCheckMyMutedTimer();break;case o.C.EVENT_CHANNEL_MUTED:c=a.V.of(E._iid).sdkState,l=t.user,c.userId===l.userId&&-1!==e._myMutedRemainingTime&&E._startCheckMyMutedTimer(e._myMutedRemainingTime);break;case o.C.EVENT_CHANNEL_LEFT:e.isPublic&&E._clearCheckMyMutedTimer()}(0,a.K)(function(){return(0,a._)(E,void 0,void 0,function(){var e;return(0,a.b)(this,function(r){return O(n)&&(null===(e=this._handler)||void 0===e?void 0:e.onChannelUpdated)&&this._handler.onChannelUpdated(t,this.channel),[2]})})})}),E._postprocessChannelUpdateEvent(e[r],n))},onRemove:function(e,t){var n=e.indexOf(E.channel.url);n>=0&&E._channel._runIfHandleableWithGroupChannel(function(s){s.myMemberState=r.NONE,E._clearCheckMyMutedTimer(),(0,a.K)(function(){return(0,a._)(E,void 0,void 0,function(){var e;return(0,a.b)(this,function(n){return(null===(e=this._handler)||void 0===e?void 0:e.onChannelDeleted)&&this._handler.onChannelDeleted(t,this.channel.url),[2]})})}),E._postprocessChannelRemoveEvent(e[n])})}}),this._channelManager.subscribeMessageEvent(this._key,{onUpdate:function(e,t){var n,r,s=[],i=[];try{for(var u=(0,a.w)(e),c=u.next();!c.done;c=u.next()){var l=c.value;l.channelUrl===E._channel.url&&(E.filter.match(l)?s.push(l):i.push(E.keyOf(l)))}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}if((0,o.u)(t)){if(s.length>0)switch(t){case o.C.LOCAL_MESSAGE_CANCELED:case o.C.LOCAL_MESSAGE_RESEND_STARTED:case o.C.EVENT_MESSAGE_SENT_FAILED:case o.C.EVENT_MESSAGE_SENT_SUCCESS:case o.C.EVENT_MESSAGE_UPDATED:case o.C.EVENT_MESSAGE_THREADINFO_UPDATED:case o.C.EVENT_MESSAGE_REACTION_UPDATED:case o.C.EVENT_MESSAGE_FEEDBACK_ADDED:case o.C.EVENT_MESSAGE_FEEDBACK_UPDATED:case o.C.EVENT_MESSAGE_FEEDBACK_DELETED:case o.C.SYNC_MESSAGE_CHANGELOGS:E._updateMessagesToView(s,t);break;case o.C.EVENT_MESSAGE_SENT_PENDING:E._addMessagesToView(s,t);break;case o.C.EVENT_MESSAGE_RECEIVED:E.hasNext||E._addMessagesToView(s,t);break;case o.C.SYNC_MESSAGE_FILL:E._addMessagesToView(s,t)}i.length>0&&E._removeMessagesFromView(i,t)}E._postprocessMessageUpdateEvent(e,t)},onRemove:function(e,t){E._removeMessagesFromView(e,t),E._postprocessMessageRemoveEvent(e)},onRemoveUnsent:function(e,t){E._removeUnsentMessageFromView(e,t)},onPollChangeLogUpdate:function(e,t){E._updatePollsToView(e,t)},onPollUpdate:function(e,t){E._applyPollUpdateEventToView(e,t)},onPollVote:function(e,t){E._applyPollVoteEventToView(e,t)},onReactionUpdate:function(e,t){E._applyReactionEventToView(e,t)},onThreadInfoUpdate:function(e,t){E._applyThreadInfoEventToView(e,t)},onDeletedByRetentionPolicy:function(e,t,n){t===E.channel.url&&E._messageRetention(e,n)}});var g=a.V.of(this._iid),m=g.cacheContext,C=g.dispatcher,y=g.messageBackgroun
1dSyncThrottleController;this._channel._updateMessageCollectionLastAccessedAt(),C.dispatch(new x({channels:[this._channel],context:{source:o.C.CHANNEL_LASTACCESSEDAT_UPDATED}})),this._backgroundSync=Fe.of(this._iid,this._channel),!f&&this._shouldStartBackgroundSync()&&this._backgroundSync.resume(this._startingPoint),this._changelogSync=Ve.of(this._iid,this._channel,this.changelogIncludeParams),this._changelogSync.resume(),this._pollChangelogSync=Ge.of(this._iid,this._channel,this._hasPollMessage.bind(this)),this._pollChangelogSync.resume(),this._prevFill=new u.c(this._key,function(e){return(0,a._)(E,void 0,void 0,function(){var t=this;return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,y.run("message-fill-sync-".concat(d.url,"-prev"),function(){return(0,a._)(t,void 0,void 0,function(){var t,n,r,s,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:return[4,this._getRemoteMessages(e,{prevLimit:this._prevResultLimit,source:o.C.SYNC_MESSAGE_FILL,checkingContinuousMessages:m.localCacheEnabled,sdkSource:i.ap.INTERNAL_FILL_GAP})];case 1:return t=h.sent(),n=t.messages,r=t.isContinuousMessages,n.length>0?(s=Math.min.apply(Math,(0,a.q)([],(0,a.r)(n.map(function(e){return e.createdAt})),!1)),this._syncRange.extends(s),r&&(null===(u=this._backgroundSync)||void 0===u||u.range.extends(s)),[2,{hasNext:n.length>=this._prevResultLimit&&this.viewTop<s,nextToken:this._syncRange.top}]):(m.localCacheEnabled&&v.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:null!==(l=null===(c=m.localCacheConfig)||void 0===c?void 0:c.maxSize)&&void 0!==l?l:0,use_local_cache:m.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})})];case 1:return[2,n.sent()]}})})}),this._nextFill=new u.c(this._key,function(e){return(0,a._)(E,void 0,void 0,function(){var t=this;return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,y.run("message-fill-sync-".concat(d.url,"-next"),function(){return(0,a._)(t,void 0,void 0,function(){var t,n,r,s,u,c,l,h;return(0,a.b)(this,function(d){switch(d.label){case 0:return[4,this._getRemoteMessages(e,{nextLimit:this._nextResultLimit,source:o.C.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:m.localCacheEnabled,sdkSource:i.ap.INTERNAL_FILL_GAP})];case 1:return t=d.sent(),n=t.messages,r=t.isContinuousMessages,s=t.hasNext,n.length>0?(u=Math.max.apply(Math,(0,a.q)([],(0,a.r)(n.map(function(e){return e.createdAt})),!1)),this._syncRange.extends(u),r&&(null===(c=this._backgroundSync)||void 0===c||c.range.extends(u)),[2,{hasNext:s,nextToken:this._syncRange.bottom}]):(m.localCacheEnabled&&v.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:null!==(h=null===(l=m.localCacheConfig)||void 0===l?void 0:l.maxSize)&&void 0!==h?h:0,use_local_cache:m.localCacheEnabled,starting_point:0,message_init_policy:""}})),[2,{hasNext:!1,nextToken:0}])}})})})];case 1:return[2,n.sent()]}})})}),this._connectionEventContext=C.on(function(e){if(e instanceof a.I)switch(e.stateType){case a.J.CONNECTED:(0,a.H)(function(){return(0,a._)(E,void 0,void 0,function(){return(0,a.b)(this,function(e){return this._activate(),[2]})})});break;case a.J.LOGOUT:E.dispose();break;default:E._clearCheckMyMutedTimer(),E._prevFill.stop(),E._nextFill.stop()}})}return e.prototype.keyOf=function(e){return 0},Object.defineProperty(e.prototype,"changelogIncludeParams",{get:function(){return{includeReactions:!0,includeThreadInfo:!0,includeMetaArray:!0,includeParentMessageInfo:!0}},enumerable:!1,configurable:!0}),e.prototype._postprocessChannelUpdateEvent=function(e,t){},e.prototype._postprocessChannelRemoveEvent=function(e){},e.prototype._postprocessMessageUpdateEvent=function(e,t){},e.prototype._postprocessMessageRemoveEvent=function(e){},Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"succeededMessages",{get:function(){return(0,a.q)([],(0,a.r)(this._messages),!1)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"failedMessages",{get:function(){return this._unsentMessages.filter(function(e){return e.sendingStatus===a.as.FAILED})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pendingMessages",{get:function(){return this._unsentMessages.filter(function(e){return e.sendingStatus===a.as.PENDING})},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasPrevious",{get:function(){return this._hasPrevious},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewTop",{get:function(){return Math.min.apply(Math,(0,a.q)((0,a.q)([],(0,a.r)(this._messages.map(function(e){return e.createdAt})),!1),[Number.MAX_SAFE_INTEGER],!1))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"viewBottom",{get:function(){return Math.max.apply(Math,(0,a.q)((0,a.q)([],(0,a.r)(this._messages.map(function(e){return e.createdAt})),!1),[0],!1))},enumerable:!1,configurable:!0}),e.prototype._activate=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return a.V.of(this._iid).logger.debug("check huge gap"),this._checkHugeGap(),[4,this._refreshChannel(o.C.SYNC_CHANNEL_CHANGELOGS)];case 1:return e.sent(),[2]}})})},e.prototype._replaceChannelOfCollection=function(e){this._channel.isGroupChannel()?this._channel=e:this._channel.isFeedChannel()&&(this._channel._groupChannel=e._groupChannel)},e.prototype._shouldStartBackgroundSync=function(){var e=a.V.of(this._iid).cacheContext;return this.channel.isGroupChannel()?e.localCacheEnabled&&!this.channel.isSuper:e.localCacheEnabled},e.prototype._setBaseMessageCollectionHandler=function(e){this._handler=e},e.prototype._filterUnderOffsetMessage=function(e){return e},e.prototype._updateChildMessagesInView=function(e){var t=[];return this._messages.forEach(function(n){n instanceof i.ae&&n.parentMessageId===e.messageId&&n.applyParentMessage(e)&&t.push(n)}),t},e.prototype._updatePollsToView=function(e,t){var n,r,s=this,i=[];try{for(var u=(0,a.w)(e),c=u.next();!c.done;c=u.next()){var l=c.value,h=Pe(this._messages,l.messageId);if(h>=0){var d=this._messages[h];d.isUserMessage()&&d.applyPoll(l),i.push(d)}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return i.length>0&&(0,o.u)(t)&&(0,a.K)(function(){return(0,a._)(s,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(s){return e={source:t},i.length>0&&(null===(r=(n=this._handler).onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,i)),[2]})})}),i},e.prototype._applyPollUpdateEventToView=function(e,t){var n=this,r=Pe(this._messages,e.messageId);if(r>=0){var s=this._messages[r];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollUpdateEvent(e)&&(0,o.u)(t)&&(0,a.K)(function(){return(0,a._)(n,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(a){return e={source:t},null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,[s]),[2]})})})}},e.prototype._applyPollVoteEventToView=function(e,t){var n=this,r=Pe(this._messages,e.messageId);if(r>=0){var s=this._messages[r];s&&s.isUserMessage()&&s.poll&&s.poll.applyPollVoteEvent(e)&&(0,o.u)(t)&&(0,a.K)(function(){return(0,a._)(n,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(a){return e={source:t},null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,[s]),[2]})})})}},e.prototype._applyReactionEventToView=function(e,t){var n=this,r=Pe(this._messages,e.messageId);if(r>=0){var s=this._messages[r];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&(0,o.u)(t)&&(s.applyReactionEvent(e),(0,a.K)(function(){return(0,a._)(n,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(a){return e={source:t},null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,[s]),[2]})})}))}},e.prototype._applyThreadInfoEventToView=function(e,t){var n=this,r=Pe(this._messages,e.targetMessageId);if(r>=0){var s=this._messages[r];s&&(s.isUserMessage()||s.isFileMessage()||s.isMultipleFilesMessage())&&
1(0,o.u)(t)&&(s.applyThreadInfoUpdateEvent(e),(0,a.K)(function(){return(0,a._)(n,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(a){return e={source:t},null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,[s]),[2]})})}))}},e.prototype._removeMessagesFromView=function(e,t){var n,r,s=this,i=[],u=[],c=function(e){var t=l._messages.findIndex(function(t){return s.keyOf(t)===e});if(t>=0){var n=l._messages[t];i.push(l.keyOf(n)),u.push(n),l._messages.splice(t,1)}},l=this;try{for(var h=(0,a.w)(e),d=h.next();!d.done;d=h.next())c(d.value)}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}return(0,o.u)(t)&&u.length>0&&(0,a.K)(function(){return(0,a._)(s,void 0,void 0,function(){var e,n,r;return(0,a.b)(this,function(s){return e={source:t},null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesDeleted)||void 0===r||r.call(n,e,this.channel,i,u),[2]})})}),i},e.prototype._messageRetention=function(e,t){var n,r,s=[];try{for(var i=(0,a.w)(this._messages),o=i.next();!o.done;o=i.next()){var u=o.value;u.createdAt<=e&&s.push(this.keyOf(u))}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}s.length>0&&this._removeMessagesFromView(s,t)},e.prototype._removeUnsentMessageFromView=function(e,t){var n=this._unsentMessages.findIndex(function(t){return t.reqId===e});n>=0&&this._unsentMessages.splice(n,1)},e.prototype._getLocalMessages=function(e,t){var n=t.prevLimit,r=void 0===n?0:n,s=t.nextLimit,i=void 0===s?0:s,o=t.inclusive,u=void 0===o||o;return(0,a._)(this,void 0,void 0,function(){var t,n,s,o,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return t=[],u?[4,this._channelManager.getExactlyMatchingMessagesForTokenFromCache(this._channel.url,e,this.filter)]:[3,2];case 1:t=l.sent(),l.label=2;case 2:return r>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,e,"prev",this.filter,r,!1)]:[3,4];case 3:return s=l.sent(),[3,5];case 4:s=[],l.label=5;case 5:return n=s,i>0?[4,this._channelManager.getMessagesFromCache(this._channel.url,e,"next",this.filter,i,!1)]:[3,7];case 6:return c=l.sent(),[3,8];case 7:c=[],l.label=8;case 8:return o=c,[2,{messages:(0,a.q)((0,a.q)((0,a.q)([],(0,a.r)(t),!1),(0,a.r)(n),!1),(0,a.r)(o),!1).sort(function(e,t){return t.createdAt-e.createdAt}),prevMessagesCount:n.length,nextMessagesCount:o.length}]}})})},e.prototype._getRemoteMessages=function(e,t){var n=t.prevLimit,r=void 0===n?0:n,s=t.nextLimit,u=void 0===s?0:s,c=t.source,l=void 0===c?o.C.REQUEST_MESSAGE:c,h=t.reverse,d=void 0!==h&&h,_=t.checkingHasNext,p=void 0!==_&&_,f=t.checkingContinuousMessages,E=void 0!==f&&f,v=t.sdkSource;return(0,a._)(this,void 0,void 0,function(){var t,n;return(0,a.b)(this,function(s){switch(s.label){case 0:return t=i.ao.of(this._iid),r>0||u>0?[4,t._getMessagesByTimestampForCollection(this._channel.url,this._channel.channelType,e,(0,a.u)((0,a.j)((0,a.j)((0,a.j)({},this.filter),je),{isInclusive:!0,reverse:d,prevResultSize:r,nextResultSize:u})),l,p,E,v)]:[3,2];case 1:return n=s.sent(),[3,3];case 2:n={messages:[],isContinuousMessages:!1},s.label=3;case 3:return[2,n]}})})},e.prototype._checkHugeGap=function(){var e,t,n,r,s;return(0,a._)(this,void 0,void 0,function(){var u,c,l,h,d,_,p,f,E,v,g,m,C,y,N,b,A,M,T,S,U,I,D,w,L,R=this;return(0,a.b)(this,function(P){switch(P.label){case 0:return u=a.V.of(this._iid),c=u.dispatcher,l=u.requestQueue,h=u.cacheContext,d=u.statManager,_=u.logger,this._messages.length>0?(p=this._syncRange.top,f=this.viewTop,E=this._syncRange.bottom,v=this.hasNext?this.viewBottom:Number.MAX_SAFE_INTEGER,[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,f,p)]):[3,8];case 1:return g=P.sent(),[4,this._channelManager.getCachedMessageCountBetween(this._channel.url,this.filter,E,v)];case 2:m=P.sent(),P.label=3;case 3:return P.trys.push([3,5,6,7]),[4,(0,a.b0)(function(){return(0,a._)(R,void 0,void 0,function(){var e,t,n,r,s,i,u,d,_,C,y,N,b,A,M,T,S,U=this;return(0,a.b)(this,function(I){switch(I.label){case 0:return e=new Be((0,a.j)((0,a.j)({channelUrl:this._channel.url,channelType:this._channel.channelType,prevStart:f,prevEnd:p,prevCount:g,nextStart:E,nextEnd:v,nextCount:m,checkingContinuousMessages:h.localCacheEnabled},this.filter),je)),[4,l.send(e)];case 1:return t=I.sent(),n=t.as(qe),r=n.isHugeGap,s=n.prevMessages,i=void 0===s?[]:s,u=n.prevHasMore,d=n.isContinuousPrevMessages,_=n.nextMessages,C=void 0===_?[]:_,y=n.nextHasmore,N=n.isContinuousNextMessages,r?(0,a.K)(function(){return(0,a._)(U,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){return(null===(e=this._handler)||void 0===e?void 0:e.onHugeGapDetected)&&this._handler.onHugeGapDetected(),[2]})})}):(b=this.viewTop,A=this.viewBottom,M=Math.min.apply(Math,(0,a.q)([Number.MAX_SAFE_INTEGER,b],(0,a.r)(i.map(function(e){return e.createdAt})),!1)),T=Math.max.apply(Math,(0,a.q)([0,A],(0,a.r)(C.map(function(e){return e.createdAt})),!1)),c.dispatch(new o.M({messages:i,source:o.C.SYNC_MESSAGE_FILL})),c.dispatch(new o.M({messages:C,source:o.C.SYNC_MESSAGE_FILL})),this._syncRange.extends(M,T),(d||N)&&(null===(S=this._backgroundSync)||void 0===S||S.range.extends(M,T)),u&&this._prevFill.start(M),y&&this._nextFill.start(T)),[2]}})})},1)];case 4:return P.sent(),[3,7];case 5:return C=P.sent(),_.debug("Failed HugeGap Check ",C),[3,7];case 6:return h.localCacheEnabled&&d.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:null!==(t=null===(e=h.localCacheConfig)||void 0===e?void 0:e.maxSize)&&void 0!==t?t:0,use_local_cache:h.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 7:return[3,13];case 8:y=Date.now(),P.label=9;case 9:return P.trys.push([9,11,12,13]),[4,this._getRemoteMessages(y,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,source:o.C.SYNC_MESSAGE_FILL,checkingHasNext:!0,checkingContinuousMessages:h.localCacheEnabled,sdkSource:i.ap.INTERNAL_FILL_GAP})];case 10:if(N=P.sent(),b=N.messages,A=N.isContinuousMessages,M=N.hasNext,b.length>0){for(T=b.map(function(e){return e.createdAt}),S=0,U=0,I=0;I<T.length;I++)(D=T[I])<=y?S++:D>=y&&U++;this._hasPrevious=S>=this._prevResultLimit,this._hasNext=null!=M?M:U>=this._nextResultLimit,(L=this._syncRange).extends.apply(L,(0,a.q)([],(0,a.r)(T),
1!1)),A&&(null===(n=this._backgroundSync)||void 0===n||n.range.extends(this._syncRange.top,this._syncRange.bottom)),this._addMessagesToView(b,o.C.SYNC_MESSAGE_FILL)}else this._hasPrevious=!1,this._hasNext=!1;return[3,13];case 11:return(w=P.sent())instanceof a.t&&w.code===a.D.NOT_FOUND_IN_DATABASE&&(this._hasPrevious=!1,this._hasNext=!1),[3,13];case 12:return h.localCacheEnabled&&d.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,measured_on:"gap_check",event:"cache_fetch",max_db_size:null!==(s=null===(r=h.localCacheConfig)||void 0===r?void 0:r.maxSize)&&void 0!==s?s:0,use_local_cache:h.localCacheEnabled,starting_point:0,message_init_policy:""}})),[7];case 13:return[2]}})})},e.prototype._loadUnsentMessages=function(){return(0,a._)(this,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return e=this,[4,this._channelManager.getUnsentMessagesFromCache(this._channel.url,this.filter)];case 1:return e._unsentMessages=t.sent(),[2]}})})},e.prototype._hasPollMessage=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){switch(e.label){case 0:return[4,this._channelManager.getPollMessagesFromCache(this._channel.url,Date.now()+6e5,this.filter,1)];case 1:return e.sent().length>0?[2,!0]:[2,!1]}})})},e.prototype._refreshChannel=function(e,t){return void 0===t&&(t=!1),(0,a._)(this,void 0,void 0,function(){var n,r,s=this;return(0,a.b)(this,function(i){switch(i.label){case 0:n=a.V.of(this._iid).logger,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this._channelManager.refreshChannel(this.channel.url,!0,e,t)];case 2:return i.sent(),this.channel._runIfHandleableWithGroupChannel(function(e){e.myMutedState===a.aX.MUTED&&(0,a.H)(function(){return(0,a._)(s,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this.channel.getMyMutedInfo()];case 1:return(e=t.sent()).isMuted&&-1!==e.remainingDuration&&this._startCheckMyMutedTimer(e.remainingDuration),[2]}})})})}),[3,4];case 3:return r=i.sent(),n.warn("Failed to refresh channel",r),[3,4];case 4:return[2]}})})},e.prototype._startCheckMyMutedTimer=function(e){var t=this;this._clearCheckMyMutedTimer(),this._checkMyMutedStateTimer=setTimeout(function(){return(0,a._)(t,void 0,void 0,function(){var e,t,n,r=this;return(0,a.b)(this,function(s){switch(s.label){case 0:this._checkMyMutedStateTimer=void 0,e=!0,s.label=1;case 1:return s.trys.push([1,3,4,5]),[4,this._channel.getMyMutedInfo()];case 2:return t=s.sent(),e=!t.isMuted,[3,5];case 3:return s.sent(),e=!0,[3,5];case 4:return e&&(n=a.V.of(this._iid).sessionManager,this.channel._runIfHandleableWithGroupChannel(function(e){var t,s;e.myMutedState=a.aX.UNMUTED;var i={source:o.C.EVENT_CHANNEL_UNMUTED,user:n.currentUser};null===(s=null===(t=r._handler)||void 0===t?void 0:t.onChannelUpdated)||void 0===s||s.call(t,i,r.channel)})),[7];case 5:return[2]}})})},e+1e3)},e.prototype._clearCheckMyMutedTimer=function(){this._checkMyMutedStateTimer&&(clearTimeout(this._checkMyMutedStateTimer),this._checkMyMutedStateTimer=void 0)},e.prototype._setHasNextAndHasPrevious=function(e,t){for(var n=e.map(function(e){return e.createdAt}),r=0,s=0,a=0;a<n.length;a++){var i=n[a];i<this._startingPoint?r++:i>this._startingPoint&&s++}this._hasPrevious=r>=this._prevResultLimit,this._hasNext=null!=t?t:s>=this._nextResultLimit},e.prototype.initialize=function(e){var t=this,n=new Qe;this._messages=[],this._unsentMessages=[],this._syncRange=new De({}),this._hasNext=!0,this._hasPrevious=!0;var r=[],s={messages:[],prevMessagesCount:0,nextMessagesCount:0};return(0,a.K)(function(){return(0,a._)(t,void 0,void 0,function(){var t,u,c,l,h,d=this;return(0,a.b)(this,function(_){switch(_.label){case 0:return[4,null===(h=this._backgroundSync)||void 0===h?void 0:h.loadMetadata()];case 1:return t=_.sent(),u=a.V.of(this._iid),c=u.cacheContext,l=u.statManager,e===Ue.CACHE_AND_REPLACE_BY_API&&this._getLocalMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit}).then(function(e){return(0,a._)(d,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return s=e,r=this._filterUnderOffsetMessage(s.messages),this._addMessagesToView(r,o.C.REQUEST_MESSAGE),[4,this._loadUnsentMessages()];case 1:return t.sent(),n._invokeResponse("local",null,r),[2]}})})}).catch(function(e){if((0,a.Z)(e))throw e;n._invokeResponse("local",e,null)}).finally(function(){return(0,a._)(d,void 0,void 0,function(){var u,c,h,d,_,p,f,E=this;return(0,a.b)(this,function(v){switch(v.label){case 0:return u=a.V.of(this._iid).cacheContext,c=!0,h=!0,d=!1,u.localCacheEnabled&&r.length>0&&(_=t.range).includes.apply(_,(0,a.q)([],(0,a.r)(r.map(function(e){return e.createdAt})),!1))&&(!t.previousComplete&&s.prevMessagesCount<this._prevResultLimit?h=!0:this._startingPoint>t.range.bottom||s.nextMessagesCount<this._nextResultLimit?d=!0:h=!1),[4,this._refreshChannel(o.C.REFRESH_CHANNEL,d)];case 1:return v.sent(),d&&this._channel._runIfHandleableWithGroupChannel
1(function(e){var t=Math.max.apply(Math,(0,a.q)([],(0,a.r)(r.map(function(e){return e.createdAt})),!1));e._latestMessageInfo&&t>=e._latestMessageInfo.createdAt&&(h=!1)}),h?(c=!1,this._getRemoteMessages(this._startingPoint,{prevLimit:this._prevResultLimit,nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:u.localCacheEnabled,sdkSource:i.ap.EXTERNAL_COLLECTION}).then(function(e){var t,r,s,i=e.messages,u=e.isContinuousMessages,c=e.hasNext,l=E._filterUnderOffsetMessage(i);E._messages=[],l.length>0?(E._setHasNextAndHasPrevious(l,c),(t=E._syncRange).extends.apply(t,(0,a.q)([],(0,a.r)(l.map(function(e){return e.createdAt})),!1)),u&&(null===(r=E._backgroundSync)||void 0===r?void 0:r.range.overlap(E._syncRange))&&(null===(s=E._backgroundSync)||void 0===s||s.range.extends(E._syncRange.top,E._syncRange.bottom)),E._addMessagesToView(l,o.C.REQUEST_MESSAGE)):(E._hasPrevious=!1,E._hasNext=!1),n._invokeResponse("remote",null,l)}).catch(function(e){if((0,a.Z)(e))throw e;n._invokeResponse("remote",e,null)})):(this._setHasNextAndHasPrevious(r),n._invokeResponse("remote",null,r)),u.localCacheEnabled&&l.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"initial_load",event:c?"cache_hit":"cache_miss",max_db_size:null!==(f=null===(p=u.localCacheConfig)||void 0===p?void 0:p.maxSize)&&void 0!==f?f:0,message_init_policy:e,use_local_cache:u.localCacheEnabled,collection_id:this._key}})),[2]}})})}),l.put(new a.aV({type:a.B.FEATURE_LOCALCACHE,data:{use_local_cache:c.localCacheEnabled,collection_interface:{message_init_policy:e,message:!0}}})),[2]}})})}),n},e.prototype.loadPrevious=function(){var e,t,n;return(0,a._)(this,void 0,void 0,function(){var r,s,u,c,l,h,d,_,p=this;return(0,a.b)(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new a.t({code:a.D.COLLECTION_DISPOSED,message:"Collection has been disposed."});return r=a.V.of(this._iid),s=r.cacheContext,u=r.statManager,c=r.logger,this._hasPrevious?this._isLoadingPrevious?(c.warn("Messages are already fetching."),[2,[]]):(this._isLoadingPrevious=!0,l=this.viewTop,h=[],[4,(0,a.H)(function(){return(0,a._)(p,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this._getLocalMessages(l,{prevLimit:this._prevResultLimit,inclusive:!1})];case 1:return e=t.sent(),h=this._filterUnderOffsetMessage(e.messages),[2]}})})})]):[2,[]];case 1:return f.sent(),d=h.length>=this._prevResultLimit,s.localCacheEnabled&&u.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:d?"cache_hit":"cache_miss",max_db_size:null!==(t=null===(e=s.localCacheConfig)||void 0===e?void 0:e.maxSize)&&void 0!==t?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),d&&(null===(n=this._backgroundSync)||void 0===n?void 0:n.isWrappingMessages(h))?[3,3]:(_=!1,[4,(0,a.H)(function(){return(0,a._)(p,void 0,void 0,function(){var e,t,n,r,s,o,c,d=this;return(0,a.b)(this,function(p){switch(p.label){case 0:return e=a.V.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{prevLimit:this._prevResultLimit,reverse:!0,checkingContinuousMessages:e.localCacheEnabled,sdkSource:i.ap.EXTERNAL_COLLECTION})];case 1:return t=p.sent(),(h=this._filterUnderOffsetMessage(t.messages)).length>0&&((n=this._syncRange).extends.apply(n,(0,a.q)([],(0,a.r)(h.map(function(e){return e.createdAt})),!1)),(null===(r=this._backgroundSync)||void 0===r?void 0:r.range.overlap(this._syncRange))&&t.isContinuousMessages&&(_=!0,null===(s=this._backgroundSync)||void 0===s||s.range.extends(this._syncRange.top))),h=h.filter(function(e){return Re(d._messages,e)<0}),this._hasPrevious=h.length>=this._prevResultLimit,_&&u.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_prev",event:"cache_fetch",max_db_size:null!==(c=null===(o=e.localCacheConfig)||void 0===o?void 0:o.maxSize)&&void 0!==c?c:0,use_local_cache:e.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(h,o.C.REQUEST_MESSAGE),[3,4];case 3:this._hasPrevious=h.length>=this._prevResultLimit,h.length>0&&this._addMessagesToView(h,o.C.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingPrevious=!1,[2,h]}})})},e.prototype.loadNext=function(){var e,t,n;return(0,a._)(this,void 0,void 0,function(){var r,s,u,c,l,h,d,_,p=this;return(0,a.b)(this,function(f){switch(f.label){case 0:if(this._isDisposed)throw new a.t({code:a.D.COLLECTION_DISPOSED,message:"Collection has been disposed."});return r=a.V.of(this._iid),s=r.cacheContext,u=r.statManager,c=r.logger,this._hasNext?this._isLoadingNext?(c.warn("Messages are already fetching."),[2,[]]):(this._isLoadingNext=!0,l=this.viewBottom,h=[],[4,(0,a.H)(function(){return(0,a._)(p,void 0,void 0,function(){var e;return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,this._getLocalMessages(l,{nextLimit:this._nextResultLimit,inclusive:!1})];case 1:return e=t.sent(),h=this._filterUnderOffsetMessage(e.messages),[2]}})})})]):[2,[]];case 1:return f.sent(),d=h.length>=this._nextResultLimit,s.localCacheEnabled&&u.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:d?"cache_hit":"cache_miss",max_db_size:null!==(t=null===(e=s.localCacheConfig)||void 0===e?void 0:e.maxSize)&&void 0!==t?t:0,use_local_cache:s.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),d&&(null===(n=this._backgroundSync)||void 0===n?void 0:n.isWrappingMessages(h))?[3,3]:(_=!1,[4,(0,a.H)(function(){return(0,a._)(p,void 0,void 0,function(){var e,t,n,r,s,o,c,d,p=this;return(0,a.b)(this,function(f){switch(f.label){case 0:return e=a.V.of(this._iid).cacheContext,[4,this._getRemoteMessages(l,{nextLimit:this._nextResultLimit,reverse:!0,checkingHasNext:!0,checkingContinuousMessages:e.localCacheEnabled,sdkSource:i.ap.EXTERNAL_COLLECTION})];case 1:return t=f.sent(),(h=this._filterUnderOffsetMessage(t.messages)).length>0&&((n=this._syncRange).extends.apply(n,(0,a.q)([],(0,a.r)(h.map(function(e){return e.createdAt})),!1)),(null===(r=this._backgroundSync)||void 0===r?void 0:r.range.overlap(this._syncRange))&&t.isContinuousMessages&&(_=!0,null===(s=this._backgroundSync)||void 0===s||s.range.extends(this._syncRange.bottom))),h=h.filter(function(e){return Re(p._messages,e)<0}),this._hasNext=null!==(o=t.hasNext)&&void 0!==o?o:h.length>=this._nextResultLimit,_&&u.put(new a.z({type:a.B.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:this.channel.url,starting_point:this._startingPoint,measured_on:"load_next",event:"cache_fetch",max_db_size:null!==(d=null===(c=e.localCacheConfig)||void 0===c?void 0:c.maxSize)&&void 0!==d?d:0,use_local_cache:e.localCacheEnabled,collection_id:this._key,message_init_policy:""}})),[2]}})})})]);case 2:return f.sent(),this._addMessagesToView(h,o.C.REQUEST_MESSAGE),[3,4];case 3:this._hasNext=h.length>=this._nextResultLimit,h.length>0&&this._addMessagesToView(h,o.C.REQUEST_MESSAGE),f.label=4;case 4:return this._isLoadingNext=!1,[2,h]}})})},e.prototype.removeFailedMessage=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:if(this._isDisposed)throw new a.t({code:a.D.COLLECTION_DISPOSED,message:"Collection has been disposed."});return[4,this._channelManager.removeFailedMessageFromCache(e)];case 1:return n.sent(),(t=this._unsentMessages.findIndex(function(t){return t.reqId===e}))>-1&&this._unsentMessages.splice(t,1),[2]}})})},e.prototype.dispose=function(){var e,t,n,s=this;if(!this._isDisposed){this._isDisposed=!0;var i=a.V.of(this._iid),u=i.cacheContext,c=i.dispatcher;this._messages=[],this._clearCheckMyMutedTimer(),this._channel._runIfHandleableWithGroupChannel
1(function(e){e.myMemberState!==r.NONE&&(s._channel._updateMessageCollectionLastAccessedAt(),c.dispatch(new x({channels:[s._channel],context:{source:o.C.CHANNEL_LASTACCESSEDAT_UPDATED}})))}),u.localCacheEnabled&&(this._prevFill.stop(),this._nextFill.stop()),null===(e=this._backgroundSync)||void 0===e||e.close(),null===(t=this._changelogSync)||void 0===t||t.close(),null===(n=this._pollChangelogSync)||void 0===n||n.close(),this._channelManager.unsubscribeChannelEvent(this._key),this._channelManager.unsubscribeMessageEvent(this._key),this._connectionEventContext&&this._connectionEventContext.close()}},e}(),Je=function(e){function t(t,n){return e.call(this,t,(0,a.j)((0,a.j)({},n),{channelManager:Le.of(t)}))||this}return(0,a.c)(t,e),t.prototype.keyOf=function(e){return e.messageId},t.prototype.initialize=function(t){return e.prototype.initialize.call(this,t)},t.prototype.setMessageCollectionHandler=function(e){this._setBaseMessageCollectionHandler(e)},t.prototype._addMessagesToView=function(e,t){var n,r,s=this,u=this._filterUnderOffsetMessage(e),c=[],l=[];try{for(var h=(0,a.w)(u),d=h.next();!d.done;d=h.next()){var _=d.value;if(t===o.C.SYNC_MESSAGE_FILL)if(_.messageId>0){if((v=Re(this._messages,_))<0){Re(this._unsentMessages,_)<0&&c.push(_);var p=Oe(this._messages,_);this._messages.splice(p,0,_)}}else _ instanceof i.ag&&(v=Re(this._unsentMessages,_))<0&&Re(this._messages,_)<0&&(this._unsentMessages.push(_),c.push(_));else if(_.messageId>0){if((v=Re(this._messages,_))<0){var f=Re(this._unsentMessages,_);f<0?c.push(_):(this._unsentMessages.splice(f,1),l.push(_)),p=Oe(this._messages,_),this._messages.splice(p,0,_)}else l.push(_),this._messages[v]=_;if(_.updatedAt>0){var E=this._updateChildMessagesInView(_);l.push.apply(l,(0,a.q)([],(0,a.r)(E),!1))}}else if(_ instanceof i.ag){var v;(v=Re(this._unsentMessages,_))<0?Re(this._messages,_)<0&&(this._unsentMessages.push(_),c.push(_)):(l.push(_),this._unsentMessages[v]=_)}}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}(0,o.u)(t)&&(0,a.K)(function(){return(0,a._)(s,void 0,void 0,function(){var e,n,r,s,i;return(0,a.b)(this,function(a){return e={source:t},c.length>0&&(null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesAdded)||void 0===r||r.call(n,e,this.channel,c)),l.length>0&&(null===(i=null===(s=this._handler)||void 0===s?void 0:s.onMessagesUpdated)||void 0===i||i.call(s,e,this.channel,l)),[2]})})})},t.prototype._updateMessagesToView=function(e,t){var n,r,s=this,u=[],c=[],l=[];try{for(var h=(0,a.w)(e),d=h.next();!d.done;d=h.next()){var _,p=d.value;if(p.messageId>0)if((_=Re(this._messages,p))>=0)c.push(p),this._messages[_]=p;else{var f=Re(this._unsentMessages,p);if(f>=0){var E=(0,a.r)(this._unsentMessages.splice(f,1),1)[0];if(this.hasNext&&E)l.push(E);else{c.push(p);var v=Oe(this._messages,p);this._messages.splice(v,0,p)}}else{var g=this._messages.map(function(e){return e.createdAt});(p.createdAt<Math.min.apply(Math,(0,a.q)([],(0,a.r)(g),!1))&&!this._hasPrevious||p.createdAt>Math.max.apply(Math,(0,a.q)([],(0,a.r)(g),!1))&&!this._hasNext)&&u.push(p)}}else p instanceof i.ag&&(_=Re(this._unsentMessages,p))>
1=0&&(c.push(p),this._unsentMessages[_]=p)}}catch(e){n={error:e}}finally{try{d&&!d.done&&(r=h.return)&&r.call(h)}finally{if(n)throw n.error}}return(0,o.u)(t)&&(0,a.K)(function(){return(0,a._)(s,void 0,void 0,function(){var e,n,r,s,i;return(0,a.b)(this,function(a){return e={source:t},c.length>0?null===(r=null===(n=this._handler)||void 0===n?void 0:n.onMessagesUpdated)||void 0===r||r.call(n,e,this.channel,c):l.length>0?null===(i=null===(s=this._handler)||void 0===s?void 0:s.onMessagesDeleted)||void 0===i||i.call(s,e,this.channel,[],l):u.length>0&&this._addMessagesToView(u,t),[2]})})}),c},t}(Ye),Xe={coverUrl:void 0,coverImage:void 0,isDistinct:void 0,isPublic:void 0,isDiscoverable:void 0,accessCode:void 0,name:void 0,data:void 0,customType:void 0,operatorUserIds:void 0,messageSurvivalSeconds:void 0},$e=function(e){function t(t){var n=this,r=t.channelUrl,s=t.token,i=t.limit,o=t.order,u=t.mutedMemberFilter,c=t.memberStateFilter,l=t.nicknameStartsWithFilter,h=t.operatorFilter;return(n=e.call(this)||this).method=a.A.GET,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/members"),n.params={token:s,limit:i,order:o,muted_member_filter:u,member_state_filter:c,nickname_startswith:l,operator_filter:h,show_member_is_muted:!0,show_read_receipt:!0,show_delivery_receipt:!0},n}return(0,a.c)(t,e),t}(a.f),Ze=function(e){function t(t,n){var r=e.call(this,t,n)||this;r.members=[];var s=n.next,a=n.members;return r.token=s,a&&a.length>0&&(r.members=a.map(function(e){return new m(t,e)})),r}return(0,a.c)(t,e),t}(a.g);!function(e){e.ALL="all",e.MUTED="muted",e.UNMUTED="unmuted"}(Ke||(Ke={})),function(e){e.MEMBER_NICKNAME_ALPHABETICAL="member_nickname_alphabetical",e.OPERATOR_THEN_MEMBER_ALPHABETICAL="operator_then_member_alphabetical"}(ze||(ze={})),function(e){e.ALL="all",e.JOINED="joined_only",e.INVITED="invited_only",e.INVITED_BY_FRIEND="invited_by_friend",e.INVITED_BY_NON_FRIEND="invited_by_non_friend"}(We||(We={}));var et=function(e){function t(t,n,r){var s,i,o,u,c=this;return(c=e.call(this,t,n,a.C.GROUP,r)||this).mutedMemberFilter=Ke.ALL,c.memberStateFilter=We.ALL,c.nicknameStartsWithFilter=null,c.operatorFilter=E.ALL,c.order=ze.MEMBER_NICKNAME_ALPHABETICAL,c.mutedMemberFilter=null!==(s=r.mutedMemberFilter)&&void 0!==s?s:Ke.ALL,c.memberStateFilter=null!==(i=r.memberStateFilter)&&void 0!==i?i:We.ALL,c.nicknameStartsWithFilter=null!==(o=r.nicknameStartsWithFilter)&&void 0!==o?o:null,c.order=null!==(u=r.order)&&void 0!==u?u:ze.MEMBER_NICKNAME_ALPHABETICAL,c}return(0,a.c)(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&(0,a.a2)(Ke,this.mutedMemberFilter)&&(0,a.a2)(We,this.memberStateFilter)&&((0,a.a)("string",this.nicknameStartsWithFilter)||null===this.nicknameStartsWithFilter)&&(0,a.a2)(E,this.operatorFilter)&&(0,a.a2)(ze,this.order)},t.prototype.next=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=a.V.of(this._iid).requestQueue,t=new $e((0,a.u)((0,a.j)((0,a.j)({},this),{token:this._token}))),[4,e.send(t)]):[3,2]:[3,5];case 1:return n=o.sent(),r=n.as(Ze),s=r.members,i=r.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,s];case 2:return[2,[]];case 3:throw a.t.queryInProgress;case 4:return[3,6];case 5:throw a.t.invalidParameters;case 6:return[2]}})})},t}(o.c),tt=function(e){function t(t){var n=this,r=t.channelUrl,s=t.userId,i=t.accessCode;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/accept"),n.params={user_id:s,access_code:i},n}return(0,a.c)(t,e),t}(a.f),nt=function(e){function t(t,n){var s=e.call(this,t,n)||this;return s.channel=new Lt(t,n),s.channel.myMemberState=r.JOINED,s}return(0,a.c)(t,e),t}(a.g),rt=function(e){function t(t){var n=this,r=t.channelUrl,s=t.isDistinct,i=t.isPublic,o=t.isDiscoverable,u=t.coverUrl,c=t.coverImage,l=t.accessCode,h=t.name,d=t.data,_=t.customType,p=t.operatorUserIds,f=t.messageSurvivalSeconds;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r)),n.params=(0,a.e)({is_distinct:s,is_public:i,is_discoverable:o,name:h,data:d,custom_type:_,cover_url:u,cover_file:c,access_code:l,operator_ids:p,message_survival_seconds:f}),n}return(0,a.c)(t,e),t}(a.f),st=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.channel=new Lt(t,n),r}return(0,a.c)(t,e),t}(a.g),at=function(e){function t(t){var n=this,r=t.channelUrl;return(n=e.call(this)||this).method=a.A.DELETE,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r)),n}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(t,n){return e.call(this,t,n)||this},e)}(a.g);var it=function(e){function t(t){var n=this,r=t.channelUrl;return(n=e.call(this)||this).method=a.A.DELETE,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/hide"),n}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(){return null!==e&&e.apply(this,arguments)||this},e)}(a.g);var ot=function(e){function t(t){var n=t.userId,r=t.channelUrl,s=t.countPreference,i=e.call(this)||this;return i.method=a.A.PUT,i.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/count_preference/").concat(encodeURIComponent(r)),i.params={count_preference:s},i}return(0,a.c)(t,e),t}(a.f),ut=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.countPreference=n.count_preference,r}return(0,a.c)(t,e),t}(a.g),ct=function(e){function t(t){var n=this,r=t.channelUrl,s=t.locale;return(n=e.call(this)||this).method=a.A.PUT,n.path="".concat(a.aC,"/").concat(encodeURIComponent(r),"/reset_user_history"),n.params=(0,a.e)({locale:s}),n}return(0,a.c)(t,e),t}(a.f),lt=function(e){function t(t,n){var r=e.call(this,t,n)||this,s=n.ts_message_offset;return r.messageOffsetTimestamp=s,r}return(0,a.c)(t,e),t}(a.g),ht=(0,a.j)((0,a.j)({},i.aq),{scheduledAt:void 0,file:void 0,fileUrl:void 0,fileName:void 0,mimeType:void 0,fileSize:void 0,thumbnailSizes:void 0,requireAuth:!1}),dt=(0,a.j)((0,a.j)({},i.as),{scheduledAt:void 0}),_t=function(e){function t(t){var n,r,s=this;s=e.call(this)||this;var o=[];t.mentionType===a.ao.USERS&&(t.mentionedUserIds?o=t.mentionedUserIds:t.mentionedUsers&&(o=t.mentionedUsers.map(function(e){return e.userId})));var u=t.channelType,c=t.channelUrl,l=t.scheduledMessageId;return s.method=a.A.PUT,s.path="".concat((0,a.aq)(u),"/").concat(encodeURIComponent(c),"/scheduled_messages/").concat(encodeURIComponent(l)),s.params=(0,a.e)((0,a.u)({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:a.aH.FILE,url:t.fileUrl,file_name:t.fileName,file_size:t.fileSize,file_type:t.mimeType,thumbnails:null===(n=t._thumbnails)||void 0===n?void 0:n.map(function(e){return i.au.payloadify(e)}),custom_type:t.customType,data:t.data,require_auth:t.requireAuth,mention_type:t.mentionType,mentioned_user_ids:o,sorted_metaarray:null===(r=t.metaArrays)||void 0===r?void 0:r.map(function(e){return i.av.payloadify(e)}),apple_critical_alert_options:t.appleCriticalAlertOptions?i.aw.payloadify(t.appleCriticalAlertOptions):null,push_option:t.pushNotificationDeliveryOption})),s}return(0,a.c)(t,e),t}(a.f),pt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.message=new i.a3(t,n),r}return(0,a.c)(t,e),t}(a.g),ft=function(e){function t(t){var n,r=this;r=e.call(this)||this;var s=[];t.mentionType===a.ao.USERS&&(t.mentionedUserIds?s=t.mentionedUserIds:t.mentionedUsers&&(s=t.mentionedUsers.map(function(e){return e.userId})));var o=t.channelType,u=t.channelUrl,c=t.scheduledMessageId;return r.method=a.A.PUT,r.path="".concat((0,a.aq)(o),"/").concat(encodeURIComponent(u),"/scheduled_messages/").concat(encodeURIComponent(c)),r.params=(0,a.e)((0,a.u)({req_id:t.reqId,scheduled_at:t.scheduledAt,message_type:a.aH.USER,message:t.message,custom_type:t.customType,data:t.data,mention_type:t.mentionType,mentioned_user_ids:s,sorted_metaarray:null===(n=t.metaArrays)||void 0===n?void 0:n.map(function(e){return i.av.payloadify(e)}),apple_critical_alert_options:t.appleCriticalAlertOptions?i.aw.payloadify(t.appleCriticalAlertOptions):null,target_langs:t.translationTargetLanguages,push_option:t.pushNotificationDeliveryOption})),r}return(0,a.c)(t,e),t}(a.f);!function(e){(0,a.c)(function(t,n){var r=e.call(this,t,n)||this;return r.message=new i.a2(t,n),r},e)}(a.g);var Et,vt,gt=function(e){function t(t){var n=e.call(this)||this,r=t.channelType,s=t.channelUrl,i=t.scheduledMessageId;return n.method=a.A.DELETE,n.path="".concat((0,a.aq)(r),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(i)),n}return(0,a.c)(t,e),t}(a.f),mt=function(e){function t(t){var n=e.call(this)||this,r=t.channelType,s=t.channelUrl,i=t.scheduledMessageId;return n.method=a.A.POST,n.path="".concat((0,a.aq)(r),"/").concat(encodeURIComponent(s),"/scheduled_messages/").concat(encodeURIComponent(i),"/send_now"),n}return(0,a.c)(t,e),t}(a.f),Ct=function(e){function t(t){var n=t.userId,r=t.channelUrl,s=t.pushTriggerOption,i=e.call(this)||this;return i.method=a.A.PUT,i.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/push_preference/").concat(encodeURIComponent(r)),i.params={push_trigger_option:s},i}return(0,a.c)(t,e),t}(a.f),yt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.pushTriggerOption=n.push_trigger_option,r.enabled=n.enable,r}return(0,a.c)(t,e),t}(a.g),Nt=function(e){function t(t){var n=t.userId,r=t.channelUrl,s=e.call(this)||this;return s.method=a.A.GET,s.path="".concat(a.h,"/").concat(encodeURIComponent(n),"/push_preference/").concat(encodeURIComponent(r)),s}return(0,a.c)(t,e),t}(a.f),bt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.pushTriggerOption=n.push_trigger_option,r.enabled=n.enable,r}return(0,a.c)(t,e),t}(a.g),At=function(e){function t(t){var n=this,r=t.channelUrl,s=t.channelType;return(n=e.call(this)||this).method=a.A.GET,n.path="".concat((0,a.aq)(s),"/").concat(encodeURIComponent(r),"/message_purge_offset"),n}return(0,a.c)(t,e),t}(a.f),Mt=function(e){function t(t,n){var r=e.call(this,t,n)||this,s=n.message_purge_offset;return r.messageDeletionTimestamp=s,r}return(0,a.c)(t,e),t}(a.g),Tt=function(e){function t(t){var n=this,r=t.channelUrl;return(n=e.call(this)||this).method=a.A.POST,n.path="".concat(a.b1,"/").concat(encodeURIComponent(r),"/submit_csat"),n.params=(0,a.e)({csat:t.csat,csat_reason:t.csatReason,csat_type:t.csatType,is_resolved:t.isResolved}),n}return(0,a.c)(t,e),t}(a.f),St=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.conversation=new l.C(n.conversation),r}return(0,a.c)(t,e),t}(a.g),Ut=function(e){function t(t){var n=this,r=t.channelUrl;return(n=e.call(this)||this).method=a.A.POST,n.path="".concat(a.b1,"/").concat(encodeURIComponent(r),"/handoff"),n.params={},n}return(0,a.c)(t,e),t}(a.f),It=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.conversation=new l.C(n.conversation),r}return(0,a.c)(t,e),t}(a.g),Dt=function(e){function t(t){var n=this,r=t.channelUrl;return(n=e.call(this)||this).method=a.A.POST,n.path="".concat(a.b1,"/").concat(encodeURIComponent(r),"/close_conversation"),n.params={},n}return(0,a.c)(t,e),t}(a.f),wt=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.conversation=new l.C(n.conversation),r}return(0,a.c)(t,e),t}(a.g);!function(e){e.ALL="all",e.UNREAD_MESSAGE_COUNT_ONLY="unread_message_count_only",e.UNREAD_MENTION_COUNT_ONLY="unread_mention_count_only",e.OFF="off"}(Et||(Et={})),function(e){e.UNHIDDEN="unhidden",e.HIDDEN_ALLOW_AUTO_UNHIDE="hidden_allow_auto_unhide",e.HIDDEN_PREVENT_AUTO_UNHIDE="hidden_prevent_auto_unhide"}(vt||(vt={}));var Lt=function(e){function t(t,n){var s,o,u,c,h,d,_,p,f,E,v,g,C,y,N,b,A,M,T,S,U,I=this;return(I=e.call(this,t,n)||this)._unreadMemberStateMap=new Map,I._undeliveredMemberStateMap=new Map,I._typingStatus=new Map,I._lastMemberCountUpdated=0,I._typingStarted=0,I._typingEnded=0,I._hasBotInfo={general:!1,ai:!1},I.isDistinct=!1,I.isSuper=!1,I.isBroadcast=!1,I.isExclusive=!1,I.isPublic=!1,I.isDiscoverable=!0,I.isChatNotification=!1,I.isAccessCodeRequired=!1,I.isPushEnabled=!1,I.unreadMessageCount=0,I.unreadMentionCount=0,I.totalUnreadReplyCount=0,I.members=[],I.memberCount=0,I.joinedMemberCount=0,I.hiddenState=vt.UNHIDDEN,I.lastMessage=null,I.messageOffsetTimestamp=0,I.messageSurvivalSeconds=-1,I.myMemberState=r.NONE,I.myRole=a.ad.NONE,I.myMutedState=a.aX.UNMUTED,I.myLastRead=0,I.myCountPreference=Et.ALL,I.myPushTriggerOption=a.a5.DEFAULT,I.inviter=null,I.invitedAt=0,I.joinedAt=0,I.lastPinnedMessage=null,I.conversation=null,I._latestMessageInfo=null,I._pinnedMessagesUpdatedAt=0,I._myMutedRemainingTime=-1,I._messageDeletionTimestamp=0,I.channelType=a.C.GROUP,I.isDistinct=null!==(o=n.is_distinct)&&void 0!==o&&o,I.isSuper=null!==(u=n.is_super)&&void 0!==u&&u,I.isBroadcast=null!==(c=n.is_broadcast)&&void 0!==c&&c,I.isExclusive=null!==(h=n.is_exclusive)&&void 0!==h&&h,I.isPublic=null!==(d=n.is_public)&&void 0!==d&&d,I.isDiscoverable=null!==(_=n.is_discoverable)&&void 0!==_?_:I.isPublic,I.isChatNotification=null!==(p=n.is_chat_notification)&&void 0!==p&&p,I.isAccessCodeRequired=null!==(f=n.is_access_code_required)&&void 0!==f&&f,I.isPushEnabled=null!==(E=n.is_push_enabled)&&void 0!==E&&E,Array.isArray(n.members)&&(s=I.members).push.apply(s,(0,a.q)([],(0,a.r)(n.members.map(function(e){return new m(I._iid,e)})),!1)),I.memberCount=null!==(v=n.member_count)&&void 0!==v?v:0,I.joinedMemberCount=null!==(g=n.joined_member_count)&&void 0!==g?g:0,I.hiddenState=(0,a.a2)(vt,n.hidden_state)?n.hidden_state:vt.UNHIDDEN,I.messageOffsetTimestamp=null!==(C=n.ts_message_offset)&&void 0!==C?C:0,I.messageSurvivalSeconds=null!==(y=n.message_survival_seconds)&&void 0!==y?y:-1,I.lastMessage=n.last_message?(0,i.W)(I._iid,(0,a.j)({channel_type:I.channelType},n.last_message)):null,n.read_receipt&&Object.keys(n.read_receipt).forEach(function(e){(0,a.a)("number",n.read_receipt[e])&&I._updateUnreadMemberState(e,n.read_receipt[e])}),n.delivery_receipt&&Object.keys(n.delivery_receipt).forEach(function(e){(0,a.a)("number",n.delivery_receipt[e])&&I._updateUndeliveredMemberState(e,n.delivery_receipt[e])}),I.myMemberState=(0,a.a2)(r,n.member_state)?n.member_state:r.NONE,I.myRole=(0,a.a2)(a.ad,n.my_role)?n.my_role:a.ad.NONE,(0,a.a2)(a.aX,n.is_muted)?I.myMutedState=n.is_muted:(0,a.a)("boolean",n.is_muted)?I.myMutedState=n.is_muted?a.aX.MUTED:a.aX.UNMUTED:I.myMutedState=a.aX.UNMUTED,I.myCountPreference=(0,a.a2)(Et,n.count_preference)?n.count_preference:Et.ALL,I.myPushTriggerOption=(0,a.a2)(a.a5,n.push_trigger_option)?n.push_trigger_option:a.a5.ALL,I.myLastRead=null!==(N=n.user_last_read)&&void 0!==N?N:0,I.inviter=n.inviter?new a.U(I._iid,n.inviter):null,I.invitedAt=null!==(b=n.invited_at)&&void 0!==b?b:0,I.joinedAt=null!==(A=n.joined_ts)&&void 0!==A?A:0,I._updateUnreadCount(null!==(M=n.unread_message_count)&&void 0!==M?M:0,null!==(T=n.unread_mention_count)&&void 0!==T?T:0),I.totalUnreadReplyCount=null!==(S=n.total_unread_thread_message_count)&&void 0!==S?S:0,I.lastPinnedMessage=n.latest_pinned_message?(0,i.W)(I._iid,(0,a.j)({channel_type:I.channelType},n.latest_pinned_message)):null,I.conversation=n.conversation?new l.C(n.conversation):null,n.latest_message&&(I._latestMessageInfo={messageId:n.latest_message.message_id,createdAt:n.latest_message.created_at}),I._hasBotInfo={general:!!n.has_bot,ai:!!n.has_ai_bot},I._messageDeletionTimestamp=null!==(U=n.message_purge_offset)&&void 0!==U?U:0,I}return(0,a.c)(t,e),Object.defineProperty(t.prototype,"isHidden",{get:function(){return this.hiddenState!==vt.UNHIDDEN}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isTyping",{get:function(){return this._typingStatus.size>0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cachedUnreadMemberState",{get:function(){var e,t,n={};try{for(var r=(0,a.w)(this._unreadMemberStateMap),s=r.next();!s.done;s=r.next()){var i=(0,a.r)(s.value,2),o=i[0],u=i[1];n[o]=u}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"cachedUndeliveredMemberState",{get:function(){var e,t,n={};try{for(var r=(0,a.w)(this._undeliveredMemberStateMap),s=r.next();!s.done;s=r.next()){var i=(0,a.r)(s.value,2),o=i[0],u=i[1];n[o]=u}}catch(t){e={error:t}}finally{try{s&&!s.done&&(t=r.return)&&t.call(r)}finally{if(e)throw e.error}}return n},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasBot",{get:function(){return this._hasBotInfo.general},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasAiBot",{get:function(){return this._hasBotInfo.ai},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"messageDeletionTimestamp",{get:function(){return this._messageDeletionTimestamp},enumerable:!1,configurable:!0}),t.payloadify=function(t,n){void 0===n&&(n=!1);var r=(0,a.j)((0,a.j)({},e.payloadify.call(this,t,n)),{is_access_code_required:t.isAccessCodeRequired,is_distinct:t.isDistinct,is_super:t.isSuper,is_broadcast:t.isBroadcast,is_exclusive:t.isExclusive,is_public:t.isPublic,is_discoverable:t.isDiscoverable,is_muted:t.myMutedState,is_push_enabled:t.isPushEnabled,unread_message_count:t.unreadMessageCount,unread_mention_count:t.unreadMentionCount,total_unread_thread_message_count:t.totalUnreadReplyCount,push_trigger_option:t.myPushTriggerOption,count_preference:t.myCountPreference,hidden_state:t.hiddenState,member_count:t.memberCount,joined_member_count:t.joinedMemberCount,member_state:t.myMemberState,my_role:t.myRole,user_last_read:t.myLastRead,ts_message_offset:t.messageOffsetTimestamp,message_survival_seconds:t.messageSurvivalSeconds,read_receipt:t.cachedUnreadMemberState,delivery_receipt:t.cachedUndeliveredMemberState,members:t.members.map(function(e){return m.payloadify(e)}),last_message:t.lastMessage?(0,i.ax)(t.lastMessage):null,inviter:t.inviter?a.U.payloadify(t.inviter):null,invited_at:t.invitedAt,joined_ts:t.joinedAt,latest_pinned_message:t.lastPinnedMessage?(0,i.ax)(t.lastPinnedMessage):null,latest_message:t._latestMessageInfo?{message_id:t._latestMessageInfo.messageId,created_at:t._latestMessageInfo.createdAt}:null,has_bot:t.hasBot,has_ai_bot:t.hasAiBot,message_purge_offset:t.messageDeletionTimestamp,conversation:t.conversation?l.C.payloadify(t.conversation):null});return n?r:(0,a.e)((0,a.u)(r))},t.prototype._shouldUpdateLastMessageWith=function(e){if(e.silent)return!1;var t=a.V.of(this._iid).appInfo;switch(null==t?void 0:t.lastMessageThreadingPolicy){case a.aa.NONE:case a.aa.INCLUDE_REPLY:break;case a.aa.EXCLUDE_REPLY:if(e.parentMessageId>0)return!1;break;case a.aa.INCLUDE_REPLY_TO_CHANNEL:if(e instanceof i.ag&&e.parentMessageId>0&&!e.replyToChannel)return!1}return!this.lastMessage||this.lastMessage.createdAt<e.createdAt||this.lastMessage.createdAt===e.createdAt&&this.lastMessage.messageId===e.messageId&&this.lastMessage.updatedAt<e.updatedAt},t.prototype._tryUpdateLastMessageAndCallEvents=function(e,t){var n=a.V.of(this._iid).dispatcher,r=Le.of(this._iid);this._updateLastMessage(t),r.handlers.map(function(t){t.onChannelChanged&&t.onChannelChanged(e)}),n.dispatch(new x({channels:[e],context:{source:o.C.EVENT_MESSAGE_SENT}}))},t.prototype._shouldUpdateUnreadCountWith=function(e){var t=a.V.of(this._iid).appInfo;switch(null==t?void 0:t.unreadCountThreadingPolicy){case a.af.NONE:case a.af.INCLUDE_REPLY:break;case a.af.EXCLUDE_REPLY:if(e.parentMessageId>0)return!1;break;case a.af.INCLUDE_REPLY_TO_CHANNEL:if(e instanceof i.ag&&e.parentMessageId>0&&!e.replyToChannel)return!1}return!0},t.prototype._updateLastMessage=function(e){return!!this._shouldUpdateLastMessageWith(e)&&(this.lastMessage=e,!0)},t.prototype._updateUnreadCount=function(e,t){if("number"==typeof e&&e>=0)if(this.myCountPreference===Et.ALL||this.myCountPreference===Et.UNREAD_MESSAGE_COUNT_ONLY)if(this.isExclusive||this.isSuper||this.isBroadcast){var n=a.V.of(this._iid).maxSuperGroupChannelUnreadCount;this.unreadMessageCount=n&&e>=n?n:e}else this.unreadMessageCount=e;else this.unreadMessageCount=0;else this.unreadMessageCount=0;"number"==typeof t&&t>=0&&(this.myCountPreference===Et.ALL||this.myCountPreference===Et.UNREAD_MENTION_COUNT_ONLY)?this.unreadMentionCount=t:this.unreadMentionCount=0},t.prototype._updateUnreadMemberState=function(e,t,n){void 0===n&&(n=!1);var r=this._unreadMemberStateMap.get(e);return!!(!r||n||!n&&r<t)&&r!==t&&(this._unreadMemberStateMap.set(e,t),a.V.of(this._iid).sdkState.userId===e&&(this.myLastRead=t),!0)},t.prototype._updateUndeliveredMemberState=function(e,t){var n=this._undeliveredMemberStateMap.get(e);return(!n||n<t)&&(this._undeliveredMemberStateMap.set(e,t),!0)},t.prototype._updateTypingStatus=function(e,t){void 0===t&&(t=(new Date).getTime()),t>0?this._typingStatus.set(e.userId,{user:e,ts:t}):this._typingStatus.delete(e.userId)},t.prototype._clearTypingStatus=function(){this._typingStatus.clear(),this._typingStarted=0,this._typingEnded=0},t.prototype._setLatestMemberCount=function(e,t,n){var r=!1;return n>=this._lastMemberCountUpdated&&(this._lastMemberCountUpdated=n,r=e!==this.memberCount||t!==this.joinedMemberCount,this.memberCount=e,this.joinedMemberCount=t),r},t.prototype.isReadMessage=function(e){var t=a.V.of(this._iid).sdkState,n=this._unreadMemberStateMap.get(t.userId);return!!n&&n>=e.createdAt},t.prototype.serialize=function(){var e=this;return(0,a.an)(this,function(t){t.cachedUnreadMemberState=e.cachedUnreadMemberState,t.cachedUndeliveredMemberState=e.cachedUndeliveredMemberState,Object.assign(t,e._seri
1alizeCachedMetaData())})},t.prototype.createMessageCollection=function(e){return void 0===e&&(e={}),new Je(this._iid,(0,a.j)((0,a.j)({},e),{channel:this}))},t.prototype.createMemberListQuery=function(e){return void 0===e&&(e={}),new et(this._iid,this.url,e)},t.prototype.createThreadedParentMessageListQuery=function(e){return void 0===e&&(e={}),new i.ay(this._iid,this.url,this.channelType,e)},t.prototype.addMember=function(e,t){if(void 0===t&&(t=0),!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var n=this.members.findIndex(function(t){return t.userId===e.userId});if(n>-1){var s=this.members[n];s.state===r.JOINED&&(e.state=s.state),this.members.splice(n,1),this.memberCount--}this.members.push(e),this.memberCount++,this._updateUnreadMemberState(e.userId,t),this._updateUndeliveredMemberState(e.userId,t)}},t.prototype.removeMember=function(e){if(!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var t=e instanceof m?e.userId:e,n=this.members.findIndex(function(e){return e.userId===t});if(n>-1)return this.members.splice(n,1),this.memberCount--,!0}return!1},t.prototype.getUnreadMemberCount=function(e){var t,n;if(e instanceof i.ag&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=a.V.of(this._iid).sdkState,o=e.createdAt,u=0;try{for(var c=(0,a.w)(this.members),l=c.next();!l.done;l=c.next()){var h=l.value;s.userId!==h.userId&&h.state===r.JOINED&&e.sender.userId!==h.userId&&(this.cachedUnreadMemberState[h.userId]||0)<o&&u++}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return u}return 0},t.prototype.getUndeliveredMemberCount=function(e){var t,n;if(e instanceof i.ag&&!this.isExclusive&&!this.isSuper&&!this.isBroadcast){var s=a.V.of(this._iid).sdkState,o=e.createdAt,u=0;try{for(var c=(0,a.w)(this.members),l=c.next();!l.done;l=c.next()){var h=l.value;s.userId!==h.userId&&h.state===r.JOINED&&e.sender.userId!==h.userId&&(this.cachedUndeliveredMemberState[h.userId]||0)<o&&u++}}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=c.return)&&n.call(c)}finally{if(t)throw t.error}}return u}return 0},t.prototype.getReadMembers=function(e,t){var n=this;void 0===t&&(t=!1);var r=a.V.of(this._iid).sdkState;if(!r.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var s=e instanceof i.ag?e.sender:null,o=[];return this.members.forEach(function(a){if(t||a.userId!==r.userId&&a.userId!==(null==s?void 0:s.userId)){var i=n._unreadMemberStateMap.get(a.userId);i&&i>=e.createdAt&&o.push(a)}}),o},t.prototype.getUnreadMembers=function(e,t){var n=this;void 0===t&&(t=!1);var r=a.V.of(this._iid).sdkState;if(!r.userId||this.isExclusive||this.isSuper||this.isBroadcast)return[];var s=e instanceof i.ag?e.sender:null,o=[];return this.members.forEach(function(a){if(t||a.userId!==r.userId&&a.userId!==(null==s?void 0:s.userId)){var i=n._unreadMemberStateMap.get(a.userId);i&&i<e.createdAt&&o.push(a)}}),o},t.prototype.getReadStatus=function(e){var t=this;void 0===e&&(e=!1);var n=a.V.of(this._iid).sdkState;if(!n.userId||this.isExclusive||this.isSuper||this.isBroadcast)return null;var r={};return this.members.forEach(function(s){if(e||s.userId!==n.userId){var a=t._unreadMemberStateMap.get(s.userId);r[s.userId]=new i._(t._iid,{channel_url:t.url,channel_type:t.channelType,user:m.payloadify(s),ts:null!=a?a:0})}}),r},t.prototype.getDeliveryStatus=function(e){var t=this;void 0===e&&(e=!0);var n=a.V.of(this._iid).sdkState;if(!n.userId||this.isExclusive||this.isSuper||this.isBroadcast)return null;var r={};return this.members.forEach(function(s){if(e||s.userId!==n.userId){var a=t._undeliveredMemberStateMap.get(s.userId);r[s.userId]=new C(t._iid,{channel_url:t.url,channel_type:t.channelType,user:m.payloadify(s),ts:null!=a?a:0})}}),r},t.prototype.getTypingUsers=function(){var e=[];return this._typingStatus.forEach(function(t){var n=t.user;e.push(n)}),e},t.prototype.invalidateTypingStatus=function(){var e=this,t=a.V.of(this._iid).typingIndicatorInvalidateTime,n=Date.now(),r=!1;return this._typingStatus.forEach(function(s,a){var i=s.ts;n-i>=t&&(e._typingStatus.delete(a),r=!0)}),r},t.prototype.refresh=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(e){return[2,this._refresh()]})})},t.prototype._refresh=function(e){return void 0===e&&(e=!1),(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u;return(0,a.b)(this,function(c){switch(c.label){case 0:return t=a.V.of(this._iid),n=t.requestQueue,r=t.dispatcher,s=new B({channelUrl:this.url}),[4,n.send(s)];case 1:return i=c.sent(),u=i.as(q).channel,this._update(u),e||r.dispatch(new x({channels:[u],context:{source:o.C.REFRESH_CHANNEL}})),[2,this]}})})},t.prototype.freeze=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,e.prototype.freeze.call(this)];case 1:return t.sent(),a.V.of(this._iid).dispatcher.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_FROZEN},isWebSocketEventComing:!0})),[2]}})})},t.prototype.unfreeze=function(){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){switch(t.label){case 0:return[4,e.prototype.unfreeze.call(this)];case 1:return t.sent(),a.V.of(this._iid).dispatcher.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UNFROZEN},isWebSocketEventComing:!0})),[2]}})})},t.prototype.updateChannel=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return t=(0,a.j)((0,a.j)({},Xe),e),(0,a.F)(function(e){return(0,a.a)("string",e.coverUrl,!0)&&((0,a.i)(e.coverImage)||(0,a.a)("string",e.coverImage,!0))&&(0,a.a)("boolean",e.isDistinct,!0)&&(0,a.a)("boolean",e.isPublic,!0)&&(0,a.a)("boolean",e.isDiscoverable,!0)&&(0,a.a)("string",e.accessCode,!0)&&(0,a.a)("string",e.name,!0)&&(0,a.a)("string",e.data,!0)&&(0,a.a)("string",e.customType,!0)&&(0,a.$)("string",e.operatorUserIds,!0)&&(0,a.a)("number",e.messageSurvivalSeconds,!0)}(t)).throw(a.t.invalidParameters),n=a.V.of(this._iid),r=n.dispatcher,s=n.requestQueue,i=new rt((0,a.j)({channelUrl:this.url},t)),[4,s.send(i)];case 1:return u=l.sent(),c=u.as(st).channel,this._update(c),r.dispatch(new x({channels:[c],context:{source:o.C.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.invite=function(e){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(t){return(0,a.F)(e.every(function(e){return e instanceof a.U})).throw(a.t.invalidParameters),[2,this.inviteWithUserIds(e.map(function(e){return e.userId}))]})})},t.prototype.inviteWithUserIds=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return(0,a.F)((0,a.$)("string",e)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.dispatcher,r=t.requestQueue,s=t.sessionManager,i=new de({channelUrl:this.url,userIds:e}),[4,r.send(i)];case 1:return u=l.sent(),c=u.as(_e).channel,this._update(c),n.dispatch(new x({channels:[c],context:{source:o.C.EVENT_CHANNEL_INVITED,inviter:s.currentUser,invitees:[]},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.join=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,s,i,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:return(0,a.F)((0,a.a)("string",e,!0)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.dispatcher,s=t.sdkState,i=t.requestQueue,u=new oe({channelUrl:this.url,userId:s.userId,accessCode:e}),[4,i.send(u)];case 1:return c=h.sent(),(l=c.as(ue).channel).myMemberState=this.myMemberState=r.JOINED,this._update(l),n.dispatch(new x({channels:[l],context:{source:o.C.EVENT_CHANNEL_JOINED,users:[]},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.leave=function(e){return void 0===e&&(e=!1),(0,a._)(this,void 0,void 0,function(){var t,n,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return t=a.V.of(this._iid),n=t.sdkState,s=t.requestQueue,i=new le({channelUrl:this.url,userId:n.userId,shouldRemoveOperatorStatus:e}),[4,s.send(i)];case 1:return o.sent(),this.myMemberState=r.NONE,[2]}})})},t.prototype.acceptInvitation=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,s,i,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:return(0,a.F)((0,a.a)("string",e,!0)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.dispatcher,s=t.sdkState,i=t.requestQueue,u=new tt({channelUrl:this.url,userId:s.userId,accessCode:e}),[4,i.send(u)];case 1:return c=h.sent(),(l=c.as(nt).channel).myMemberState=this.myMemberState=r.JOINED,this._update(l),n.dispatch(new x({channels:[l],context:{source:o.C.EVENT_CHANNEL_ACCEPTED_INVITE},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.declineInvitation=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,s;return(0,a.b)(this,function(i){switch(i.label){case 0:return e=a.V.of(this._iid),t=e.sdkState,n=e.requestQueue,s=new fe({channelUrl:this.url,userId:t.userId}),[4,n.send(s)];case 1:return i.sent(),this.myMemberState=r.NONE,[2,this]}})})},t.prototype.sendUserMessage=function(t){var n=this,r=new i.aK,s=a.V.of(this._iid).dispatcher,c=u.A.of(this._iid);return e.prototype.sendUserMessage.call(this,t).onPending(function(e){c.completeCurrentAndProcessNextAutoResend(e),r._trigger(e)}).onFailed(function(e,t){t&&c.completeCurrentAndProcessNextAutoResend(t),r._triggerFailed(e,t)}).onSucceeded(function(e){c.completeCurrentAndProcessNextAutoResend(e),n._updateLastMessage(e),Le.of(n._iid).handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(n)}),s.dispatch(new x({channels:[n],context:{source:o.C.EVENT_MESSAGE_SENT}})),r._trigger(e)}),r},t.prototype.updateUserMessage=function(t,n){return(0,a._)(this,void 0,void 0,function(){var r,s,i,u,c=this;return(0,a.b)(this,function(l){switch(l.label){case 0:return r=a.V.of(this._iid).dispatcher,[4,e.prototype.updateUserMessage.call(this,t,n)];case 1:return s=l.sent(),i=this._updateLastMessage(s),u=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,i=!0,u=!0),i&&(Le.of(this._iid).handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(c)}),r.dispatch(new x({channels:[this],context:{source:u?o.C.EVENT_PINNED_MESSAGE_UPDATED:o.C.EVENT_MESSAGE_UPDATED}}))),u&&Le.of(this._iid).handlers.map(function(e){e.onPinnedMessageUpdated&&e.onPinnedMessageUpdated(c)}),r.dispatch(new o.M({messages:[s],source:o.C.EVENT_MESSAGE_UPDATED})),[2,s]}})})},t.prototype._autoResendUserMessage=function(t){var n=this,r=new i.aK,s=a.V.of(this._iid).dispatcher,c=u.A.of(this._iid);return e.prototype._autoResendUserMessage.call(this,t).onPending(function(e){c.completeCurrentAndProcessNextAutoResend(e),r._trigger(e)}).onFailed(function(e,t){c.completeCurrentAndProcessNextAutoResend(t),r._triggerFailed(e,t)}).onSucceeded(function(e){var t=Le.of(n._iid);
1c.completeCurrentAndProcessNextAutoResend(e),n._updateLastMessage(e),t.handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(n)}),s.dispatch(new x({channels:[n],context:{source:o.C.EVENT_MESSAGE_SENT}})),r._trigger(e)}),r},t.prototype.sendFileMessage=function(t){var n=this,r=new i.aK,s=a.V.of(this._iid).dispatcher,c=u.A.of(this._iid);return e.prototype.sendFileMessage.call(this,t).onPending(function(e){c.completeCurrentAndProcessNextAutoResend(e),r._trigger(e)}).onFailed(function(e,t){t&&c.completeCurrentAndProcessNextAutoResend(t),r._triggerFailed(e,t)}).onSucceeded(function(e){var t=Le.of(n._iid);c.completeCurrentAndProcessNextAutoResend(e),n._updateLastMessage(e),t.handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(n)}),s.dispatch(new x({channels:[n],context:{source:o.C.EVENT_MESSAGE_SENT}})),r._trigger(e)}),r},t.prototype.sendMultipleFilesMessage=function(t){var n=this,r=new i.az,s=a.V.of(this._iid).dispatcher;return e.prototype.sendMultipleFilesMessage.call(this,t).onPending(function(e){r._trigger(e)}).onFailed(function(e,t){r._triggerFailed(e,t)}).onSucceeded(function(e){var t=Le.of(n._iid);n._updateLastMessage(e),t.handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(n)}),s.dispatch(new x({channels:[n],context:{source:o.C.EVENT_MESSAGE_SENT}})),r._trigger(e)}).onFileUploaded(function(e,t,n,s){r._triggerOnFileUploaded(e,t,n,s)}),r},t.prototype.updateFileMessage=function(t,n){return(0,a._)(this,void 0,void 0,function(){var r,s,i,u,c=this;return(0,a.b)(this,function(l){switch(l.label){case 0:return r=a.V.of(this._iid).dispatcher,[4,e.prototype.updateFileMessage.call(this,t,n)];case 1:return s=l.sent(),i=this._updateLastMessage(s),u=!1,this.lastPinnedMessage&&this.lastPinnedMessage.messageId===s.messageId&&(this.lastPinnedMessage=s,i=!0,u=!0),i&&(Le.of(this._iid).handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(c)}),r.dispatch(new x({channels:[this],context:{source:u?o.C.EVENT_PINNED_MESSAGE_UPDATED:o.C.EVENT_MESSAGE_UPDATED}}))),u&&Le.of(this._iid).handlers.map(function(e){e.onPinnedMessageUpdated&&e.onPinnedMessageUpdated(c)}),r.dispatch(new o.M({messages:[s],source:o.C.EVENT_MESSAGE_UPDATED})),[2,s]}})})},t.prototype._autoResendFileMessage=function(t){var n=this,r=new i.aK,s=a.V.of(this._iid).dispatcher,c=u.A.of(this._iid);return e.prototype._autoResendFileMessage.call(this,t).onPending(function(e){c.completeCurrentAndProcessNextAutoResend(e),r._trigger(e)}).onFailed(function(e,t){c.completeCurrentAndProcessNextAutoResend(t),r._triggerFailed(e,t)}).onSucceeded(function(e){var t=Le.of(n._iid);
1c.completeCurrentAndProcessNextAutoResend(e),n._updateLastMessage(e),t.handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(n)}),s.dispatch(new x({channels:[n],context:{source:o.C.EVENT_MESSAGE_SENT}})),r._trigger(e)}),r},t.prototype.deleteMessage=function(t){return(0,a._)(this,void 0,void 0,function(){return(0,a.b)(this,function(n){switch(n.label){case 0:return[4,e.prototype.deleteMessage.call(this,t)];case 1:return n.sent(),0===t.messageId&&t instanceof i.ag&&a.V.of(this._iid).dispatcher.dispatch(new o.U({reqId:t.reqId,source:o.C.EVENT_MESSAGE_DELETED})),[2]}})})},t.prototype.hide=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u,c,l;return(0,a.b)(this,function(h){switch(h.label){case 0:return t=(0,a.j)((0,a.j)({},ve),e),(0,a.F)(function(e){return(0,a.a)("boolean",e.hidePreviousMessages,!0)&&(0,a.a)("boolean",e.allowAutoUnhide,!0)}(t)).throw(a.t.invalidParameters),n=a.V.of(this._iid),r=n.dispatcher,s=n.sdkState,i=n.requestQueue,u=new ge((0,a.j)({channelUrl:this.url,userId:s.userId},t)),[4,i.send(u)];case 1:return c=h.sent(),l=c.as(me).messageOffsetTimestamp,this.hiddenState=t.allowAutoUnhide?vt.HIDDEN_ALLOW_AUTO_UNHIDE:vt.HIDDEN_PREVENT_AUTO_UNHIDE,t.hidePreviousMessages&&this._updateUnreadCount(0,0),l&&(this.messageOffsetTimestamp=l),r.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_HIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.unhide=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return e=a.V.of(this._iid),t=e.dispatcher,n=e.requestQueue,r=new it({channelUrl:this.url}),[4,n.send(r)];case 1:return s.sent(),this.hiddenState=vt.UNHIDDEN,t.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UNHIDDEN},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype.delete=function(){return(0,a._)(this,void 0,void 0,function(){var e,t;return(0,a.b)(this,function(n){switch(n.label){case 0:return e=a.V.of(this._iid).requestQueue,t=new at({channelUrl:this.url}),[4,e.send(t)];case 1:return n.sent(),[2]}})})},t.prototype.markAsRead=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,u,c,l=this;return(0,a.b)(this,function(h){switch(h.label){case 0:return e=a.V.of(this._iid),t=e.dispatcher,n=e.requestQueue,r=new i.aL({channelUrl:this.url}),[4,n.send(r)];case 1:return s=h.sent(),u=s.as(i.af).readStatus,this._updateUnreadMemberState(u.reader.userId,u.readAt),c=!1,(this.unreadMessageCount>0||this.unreadMentionCount>0)&&(this._updateUnreadCount(0,0),c=!0),Le.of(this._iid).handlers.map(function(e){c&&e.onChannelChanged&&e.onChannelChanged(l),e.onUserMarkedRead&&e.onUserMarkedRead(l,[u.reader.userId])}),t.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_READ,userIds:[u.reader.userId]}})),[2]}})})},t.prototype.markAsUnread=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,u,c,l,h,d,_,p,f,E=this;return(0,a.b)(this,function(v){switch(v.label){case 0:return t=a.V.of(this._iid),n=t.sdkState,r=t.dispatcher,s=t.requestQueue,u=new i.aN({channelUrl:this.url,channelType:this.channelType,messageId:e.messageId,userId:n.userId,isExcluded:!0,uniqueId:"read-".concat((0,a.o)())}),[4,s.send(u)];case 1:return c=v.sent(),l=c.as(i.aM),h=l.readAt,d=l.unreadMessageCount,_=l.userId,p=l.isExcluded,f=l.totalUnreadCount,this._updateUnreadMemberState(_,h,p),this._updateUnreadCount(d,this.unreadMentionCount),r.dispatch(new a.M(f)),Le.of(this._iid).handlers.map(function(e){e.onChannelChanged&&e.onChannelChanged(E),e.onUserMarkedUnread&&e.onUserMarkedUnread(E,[_])}),r.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UNREAD,userIds:[_]}})),[2]}})})},t.prototype.markAsDelivered=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return e=a.V.of(this._iid),t=e.sdkState,n=e.requestQueue,r=new Se({channelUrl:this.url,userId:t.userId}),[4,n.send(r)];case 1:return s.sent(),[2]}})})},t.prototype.startTyping=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){switch(i.label){case 0:return e=a.V.of(this._iid),t=e.requestQueue,n=e.typingIndicatorThrottle,(r=(new Date).getTime())-this._typingStarted>=n?(this._typingStarted=r,this._typingEnded=0,s=new ye({channelUrl:this.url,time:this._typingStarted}),[4,t.send(s)]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},t.prototype.endTyping=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s;return(0,a.b)(this,function(i){switch(i.label){case 0:return e=a.V.of(this._iid),t=e.requestQueue,n=e.typingIndicatorThrottle,(r=(new Date).getTime())-this._typingEnded>=n?(this._typingStarted=0,this._typingEnded=r,s=new be({channelUrl:this.url,time:this._typingStarted}),[4,t.send(s)]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}})})},t.prototype.createScheduledUserMessage=function(e){e=(0,a.j)((0,a.j)({},i.aA),e),(0,a.F)((0,i.aB)(e)).throw(a.t.invalidParameters);var t=new i.aK;return this._createScheduledUserMessage(e,t),t},t.prototype.updateScheduledUserMessage=function(e,t){return(0,a._)(this,void 0,void 0,function(){var n,r,s;return(0,a.b)(this,function(o){switch(o.label){case 0:return n=(0,a.j)((0,a.j)({},dt),t),(0,a.F)(function(e){return(0,i.at)(e)&&(0,a.a)("number",e.scheduledAt,!0)}(n)).throw(a.t.invalidParameters),r=a.V.of(this._iid).requestQueue,s=new ft((0,a.j)({reqId:this._generateRequestId(),scheduledMessageId:e,channelType:this.channelType,channelUrl:this.url},n)),[4,r.send(s)];case 1:return[2,o.sent().as(i.aO).message]}})})},t.prototype.createScheduledFileMessage=function(e){var t=this;e=(0,a.j)((0,a.j)({},i.aC),e),(0,a.F)((0,i.aD)(e)).throw(a.t.invalidParameters);var n=Date.now(),r=this._generateRequestId(),s=new i.aK;return(0,a.az)(i.aP).then(function(){var i=t._createPendingScheduledFileMessage(e,r,n);(0,a.K)(function(){return(0,a._)(t,void 0,void 0,function(){return(0,a.b)(this,function(e){return[2,s._trigger(i)]})})})}),(0,a.i)(e.file)?this._uploadFileAndUpdateParams(e).then(function(){return t._createScheduledFileMessage(e,s,r,n)}):this._createScheduledFileMessage(e,s,r,n),s},t.prototype.updateScheduledFileMessage=function(e,t){return(0,a._)(this,void 0,void 0,function(){var n,r;return(0,a.b)(this,function(s){switch(s.label){case 0:return n=(0,a.j)((0,a.j)({}
1,ht),t),(0,a.F)(function(e){return(0,i.ar)(e)&&(0,a.a)("number",e.scheduledAt,!0)&&((0,a.i)(e.file)||(0,a.a)("string",e.fileUrl))&&(0,a.a)("string",e.fileName,!0)&&(0,a.a)("string",e.mimeType,!0)&&(0,a.a)("number",e.fileSize,!0)&&(null===e.thumbnailSizes||void 0===e.thumbnailSizes||e.thumbnailSizes.every(function(e){return(0,a.a)("object",e)&&e.maxWidth>0&&e.maxHeight>0}))}(n)).throw(a.t.invalidParameters),(0,a.i)(n.file)?[4,this._uploadFileAndUpdateParams(n)]:[3,2];case 1:s.sent(),s.label=2;case 2:return r=new _t((0,a.j)({reqId:this._generateRequestId(),scheduledMessageId:e,channelType:this.channelType,channelUrl:this.url},n)),[4,a.V.of(this._iid).requestQueue.send(r)];case 3:return[2,s.sent().as(pt).message]}})})},t.prototype.cancelScheduledMessage=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:return t=new gt({scheduledMessageId:e,channelType:this.channelType,channelUrl:this.url}),[4,a.V.of(this._iid).requestQueue.send(t)];case 1:return n.sent(),[2]}})})},t.prototype.sendScheduledMessageNow=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:return t=new mt({scheduledMessageId:e,channelType:this.channelType,channelUrl:this.url}),[4,a.V.of(this._iid).requestQueue.send(t)];case 1:return n.sent(),[2]}})})},t.prototype.getMyPushTriggerOption=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return e=a.V.of(this._iid),t=e.sdkState,n=e.requestQueue,r=new Nt({userId:t.userId,channelUrl:this.url}),[4,n.send(r)];case 1:return s=o.sent(),i=s.as(bt).pushTriggerOption,this.myPushTriggerOption=i,[2,i]}})})},t.prototype.setMyPushTriggerOption=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return(0,a.F)((0,a.a2)(a.a5,e)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.dispatcher,r=t.sdkState,s=t.requestQueue,i=new Ct({userId:r.userId,channelUrl:this.url,pushTriggerOption:e}),[4,s.send(i)];case 1:return u=l.sent(),c=u.as(yt).pushTriggerOption,this.myPushTriggerOption=c,n.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,c]}})})},t.prototype.setMyCountPreference=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u,c;return(0,a.b)(this,function(l){switch(l.label){case 0:return(0,a.F)((0,a.a2)(Et,e)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.dispatcher,r=t.sdkState,s=t.requestQueue,i=new ot({channelUrl:this.url,userId:r.userId,countPreference:e}),[4,s.send(i)];case 1:return u=l.sent(),c=u.as(ut).countPreference,this.myCountPreference=c,this._updateUnreadCount(this.unreadMessageCount,this.unreadMentionCount),n.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UPDATED},isWebSocketEventComing:!0})),[2,c]}})})},t.prototype.resetMyHistory=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(u){switch(u.label){case 0:return e=a.V.of(this._iid),t=e.dispatcher,n=e.requestQueue,r=new ct({channelUrl:this.url}),[4,n.send(r)];case 1:return s=u.sent(),i=s.as(lt).messageOffsetTimestamp,this.messageOffsetTimestamp=i,this.lastMessage&&this.lastMessage.createdAt<i&&(this.lastMessage=null),this._updateUnreadCount(0,0),this.totalUnreadReplyCount=0,t.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_RESET_HISTORY},isWebSocketEventComing:!0})),[2,this]}})})},t.prototype._uploadFileAndUpdateParams=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,o,u,c,l,h,d;return(0,a.b)(this,function(_){switch(_.label){case 0:return(0,a.i)(e.file)?(t=a.V.of(this._iid).requestQueue,n=new i.aR({file:e.file,channelUrl:this.url,thumbnailSizes:e.thumbnailSizes,requestId:this._generateRequestId()}),[4,t.send(n)]):[3,2];case 1:r=_.sent(),s=r.as(i.aQ),o=s.url,u=s.fileSize,c=void 0===u?e.fileSize:u,l=s.thumbnails,h=s.requireAuth,d=void 0!==h&&h,e.fileUrl=o,e.fileSize=c,e.requireAuth=d,e._thumbnails=l,_.label=2;case 2:return[2]}})})},t.prototype.resendMessage=function(e,t){var n,r=this;if((0,a.F)(e instanceof i.ag&&!e.scheduledInfo&&e.isResendable).throw(a.t.invalidParameters),e.isUserMessage()){var s=null!==(n=e.messageParams)&&void 0!==n?n:(0,i.aE)(e),o=new i.aK;return this._sendUserMessage(s,i.aF.RESEND,e.reqId).onPending(function(e){o._trigger(e)}).onFailed(function(e,t){o._triggerFailed(e,t)}).onSucceeded(function(e){r._tryUpdateLastMessageAndCallEvents(r,e),o._trigger(e)}),o}
1if(e.isFileMessage()){var u=this._validateFailedFileMessageHasFile(e,t);(0,a.F)(u).throw(a.t.invalidParameters),s=(0,i.aG)(e,t);var c=new i.aK;return this._sendFileMessage(s,i.aF.RESEND,e.reqId).onPending(function(e){c._trigger(e)}).onFailed(function(e,t){c._triggerFailed(e,t)}).onSucceeded(function(e){r._tryUpdateLastMessageAndCallEvents(r,e),c._trigger(e)}),c}if(e.isMultipleFilesMessage()){s=e.messageParams;var l=new i.az;return this._sendMultipleFilesMessage(s,i.aF.RESEND,e.reqId).onPending(function(e){l._trigger(e)}).onFailed(function(e,t){l._triggerFailed(e,t)}).onSucceeded(function(e){r._tryUpdateLastMessageAndCallEvents(r,e),l._trigger(e)}).onFileUploaded(function(e,t,n,r){l._triggerOnFileUploaded(e,t,n,r)}),l}},t.prototype.copyMessage=function(e,t){var n=this;if((0,a.F)(e instanceof i.E&&t instanceof i.ag&&t.sendingStatus===a.as.SUCCEEDED&&this.url===t.channelUrl&&!t.scheduledInfo).throw(a.t.invalidParameters),t.isUserMessage()){(0,a.F)(!t.poll).throw(a.t.notSupportedError);var r=(0,i.aH)(t),s=new i.aK;return e._sendUserMessage(r).onPending(function(e){s._trigger(e)}).onFailed(function(e,t){s._triggerFailed(e,t)}).onSucceeded(function(t){e.isGroupChannel()&&n._tryUpdateLastMessageAndCallEvents(e,t),s._trigger(t)}),s}if(t.isFileMessage()){r=(0,i.aI)(t);var o=new i.aK;return e._sendFileMessage(r).onPending(function(e){o._trigger(e)}).onFailed(function(e,t){o._triggerFailed(e,t)}).onSucceeded(function(t){e.isGroupChannel()&&n._tryUpdateLastMessageAndCallEvents(e,t),o._trigger(t)}),o}if(t.isMultipleFilesMessage()){if(e.isGroupChannel()){r=(0,i.aJ)(t);var u=new i.az;return e._sendMultipleFilesMessage(r,i.aF.COPY).onPending(function(e){u._trigger(e)}).onFailed(function(e,t){u._triggerFailed(e,t)}).onSucceeded(function(t){n._tryUpdateLastMessageAndCallEvents(e,t),u._trigger(t)}).onFileUploaded(function(e,t,n,r){u._triggerOnFileUploaded(e,t,n,r)}),u}throw a.t.channelTypeNotSupportedError}},t.prototype.getMessageDeletionTimestamp=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return e=a.V.of(this._iid),t=e.requestQueue,n=e.dispatcher,r=new At({channelUrl:this.url,channelType:this.channelType}),[4,t.send(r)];case 1:return s=o.sent(),i=s.as(Mt).messageDeletionTimestamp,this._messageDeletionTimestamp=i,n.dispatch(new k({channel:this})),[2,i]}})})},t.prototype.submitCSAT=function(e){return(0,a._)(this,void 0,void 0,function(){var t,n,r,s,i,u;return(0,a.b)(this,function(c){switch(c.label){case 0:return(0,a.F)((0,a.a)("number",e.csat)&&(0,a.a)("string",e.csatType)&&(0,a.a)("string",e.csatReason,!0)&&(0,a.a)("boolean",e.isResolved,!0)).throw(a.t.invalidParameters),t=a.V.of(this._iid),n=t.requestQueue,r=t.dispatcher,s=new Tt((0,a.j)({channelUrl:this.url},e)),[4,n.send(s)];case 1:return i=c.sent(),u=i.as(St).conversation,this.conversation=u,r.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_CSAT_SUBMITTED}})),[2,u]}})})},t.prototype.markConversationAsHandoff=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(u){switch(u.label){case 0:return e=a.V.of(this._iid),t=e.requestQueue,n=e.dispatcher,r=new Ut({channelUrl:this.url}),[4,t.send(r)];case 1:return s=u.sent(),i=s.as(It).conversation,this.conversation=i,n.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_CONVERSATION_HANDEDOFF}})),[2,i]}})})},t.prototype.closeConversation=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(u){switch(u.label){case 0:return e=a.V.of(this._iid),t=e.requestQueue,n=e.dispatcher,r=new Dt({channelUrl:this.url}),[4,t.send(r)];case 1:return s=u.sent(),i=s.as(wt).conversation,this.conversation=i,n.dispatch(new x({channels:[this],context:{source:o.C.EVENT_CHANNEL_UPDATED}})),[2,i]}})})},t}(i.E)},86212:function(e,t,n){n.d(t,{A:function(){return p},D:function(){return v},G:function(){return r},P:function(){return s},R:function(){return g},S:function(){return m},U:function(){return C},a:function(){return l},b:function(){return E},c:function(){return N},d:function(){return y},e:function(){return a},f:function(){return d},g:function(){return h}});var r,s,a,i,o=n(22929),u=n(96389),c=n(18130);(i=r||(r={})).LATEST_LAST_MESSAGE="latest_last_message",i.CHRONOLOGICAL="chronological",i.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",i.METADATA_VALUE_ALPHABETICAL="metadata_value_alph
1abetical",function(e){e.CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical"}(s||(s={})),function(e){e.CREATED_AT="created_at",e.SCHEDULED_AT="scheduled_at"}(a||(a={}));var l,h=function(e){switch(e){case r.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case r.CHRONOLOGICAL:return["-createdAt","syncIndex"];case r.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},d=function(e){function t(t){var n=t.message,r=e.call(this)||this;return r.message=n,r}return(0,o.c)(t,e),t}(o.aU),_={},p=function(){function e(e,t){var n=t.localCacheEnabled,r=t.enableAutoResend,s=t.dispatcher,a=t.sdkState,i=t.logger,u=this;this._iid=e,_[e]=this,this._localCacheEnabled=n,this._enableAutoResend=r,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=s,this._logger=i,this._sdkState=a,this._localCacheEnabled&&s.on(function(e){if(e instanceof o.I)switch(e.stateType){case o.J.CONNECTED:u._isProcessingAutoResend||u.processAutoResendRegisteredPendingMessages().then(function(){return u._processNextAutoResend()});break;case o.J.INTERNAL_DISCONNECTED:case o.J.EXTERNAL_DISCONNECTED:u._isProcessingAutoResend=!1}})}return e.of=function(e){return _[e]},e.prototype.processNonAutoResendRegisteredPendingMessages=function(){return(0,o._)(this,void 0,void 0,function(){var e=this;return(0,o.b)(this,function(t){switch(t.label){case 0:return this._enableAutoResend?[4,(0,o.H)(function(){return(0,o._)(e,void 0,void 0,function(){var e,t,n,r,s,a;return(0,o.b)(this,function(i){switch(i.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:e=i.sent();try{for(t=(0,o.w)(e),n=t.next();!n.done;n=t.next())0===(r=n.value).errorCode&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",r.reqId),r.sendingStatus=o.as.FAILED,r.errorCode=o.D.ACK_TIMEOUT,this._dispatcher.dispatch(new c.M({messages:[r],source:c.C.LOCAL_MESSAGE_FAILED})))}catch(e){s={error:e}}finally{try{n&&!n.done&&(a=t.return)&&a.call(t)}finally{if(s)throw s.error}}return[2]}})})})]:[2];case 1:return t.sent(),[2]}})})},e.prototype.processAutoResendRegisteredPendingMessages=function(){return(0,o._)(this,void 0,void 0,function(){var e=this;return(0,o.b)(this,function(t){switch(t.label){case 0:return[4,(0,o.H)(function(){return(0,o._)(e,void 0,void 0,function(){var e,t,n,r,s,a,i,u;return(0,o.b)(this,function(l){switch(l.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:e=l.sent();try{for(t=(0,o.w)(e),n=t.next();!n.done;n=t.next())r=n.value,this._enableAutoResend&&r.errorCode&&(0,o.aK)(r.errorCode)&&(s=(new Date).getTime(),a=r.createdAt+2592e5,this._enableAutoResend&&s<=a?this._autoResendQueue.map(function(e){return e.reqId}).indexOf(r.reqId)<0&&this._autoResendQueue.push(r):(this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(a).toLocaleString()),r.sendingStatus=o.as.FAILED,this._dispatcher.dispatch(new c.M({messages:[r],source:c.C.LOCAL_MESSAGE_FAILED}))))}catch(e){i={error:e}}finally{try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(i)throw i.error}}return[2]}})})})];case 1:return t.sent(),[2]}})})},e.prototype.completeCurrentAndProcessNextAutoResend=function(e){if(this._localCacheEnabled&&this._enableAutoResend&&
1(e.sendingStatus===o.as.SUCCEEDED||e.sendingStatus===o.as.FAILED&&!(0,o.aK)(e.errorCode))){var t=this.indexOf(e);t>=0&&this._autoResendQueue.splice(t,1),0===t&&this._processNextAutoResend()}},e.prototype._fetchAllCachedPendingMessages=function(){return(0,o._)(this,void 0,void 0,function(){var e,t;return(0,o.b)(this,function(n){switch(n.label){case 0:return e=u.w.of(this._iid),(t=new u.T).replyType=o.aB.ALL,[4,e.fetch({sendingStatus:o.as.PENDING,backward:!0,filter:t})];case 1:return[2,n.sent()]}})})},e.prototype.indexOf=function(e){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(e){return e.reqId}).indexOf(e.reqId):-1},e.prototype._processNextAutoResend=function(){return(0,o._)(this,void 0,void 0,function(){var e;return(0,o.b)(this,function(t){if(this._localCacheEnabled&&this._enableAutoResend&&"foreground"===this._sdkState.appState)try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),e=this._autoResendQueue[0],this._dispatcher.dispatch(new d({message:e})),this._logger.debug("processing auto-resend for message request id: ",e.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(e){this._logger.warn("process auto-resend error: ",e),this._isProcessingAutoResend=!1}return[2]})})},e}();!function(e){e[e.USER_BLOCK=20001]="USER_BLOCK",e[e.USER_UNBLOCK=2e4]="USER_UNBLOCK",e[e.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED"}(l||(l={}));var f,E=function(){function e(e){this.category=e.cat,this.data=e.data}return e.getDataAsUserBlockEvent=function(e,t){var n=t.data,r=n.blocker,s=n.blockee;return{blocker:new o.U(e,r),blockee:new o.U(e,s)}},e.getDataAsFriendDiscoveredEvent=function(e,t){var n=t.data.friend_discoveries;return{friendDiscoveries:Array.isArray(n)?n.map(function(t){return new o.U(e,t)}):[]}},e}(),v=function(e){function t(t,n){var r=n.userId,s=e.call(this)||this;return s._iid=t,s.userId=r,s}return(0,o.c)(t,e),t}(o.aU),g=function(e){function t(){return e.call(this)||this}return(0,o.c)(t,e),t}(o.aU),m=function(e){function t(t){var n=t.configTs,r=e.call(this)||this;return r.configTs=n,r}return(0,o.c)(t,e),t}(o.aU),C=function(e){function t(t,n,r){var s=e.call(this,t,"USEV",r)||this;return s.event=new E(r),s}return(0,o.c)(t,e),t}(o.W),y=function(e){function t(t){var n=t.appConfigsInfo,r=t.configTs,s=e.call(this)||this;return s.appConfigsInfo={},s.configTs=0,s.appConfigsInfo=n,s.configTs=r,s}return(0,o.c)(t,e),t}(o.aU);!function(e){e[e.IDLE=0]="IDLE",e[e.RUNNING=1]="RUNNING",e[e.END=2]="END"}(f||(f={}));var N=function(e){function t(t,n,r,s){var a=e.call(this)||this;return a._state=f.IDLE,a._retryCount=0,a._retryLimit=3,a.priority=0,a._worker=n,a}return(0,o.c)(t,e),Object.defineProperty(t.prototype,"isIdle",{get:function(){return this._state===f.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRunning",{get:function(){return this._state===f.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isDone",{get:function(){return this._state===f.END},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),t.prototype._run=function(e){return(0,o._)(this,void 0,void 0,function(){var t,n;return(0,o.b)(this,function(r){switch(r.label){case 0:if(!this.isRunning)return[3,4];r.label=1;case 1:return r.trys.push([1,3,,4]),[4,this._worker(e)];case 2:return t=r.sent(),this._retryCount=0,this.dispatch("progress",t),t.hasNext?this._run(t.nextToken):this.end(),[3,4];case 3:return n=r.sent(),this.dispatch("error",n),this._retryCount<this._retryLimit?(this._retryCount++,this._run(e)):this.stop(),[3,4];case 4:return[2]}})})},t.prototype.start=function(e){this.isIdle&&(this._state=f.RUNNING,this._run(e))},t.prototype.stop=function(){this._state=f.IDLE,this.dispatch("stop")},t.prototype.end=function(){this._state=f.END,this.dispatch("end")},t}(o.E)},18130:function(e,t,n){n.d(t,{C:function(){return r},M:function(){return u},P:function(){return B},R:function(){return h},T:function(){return d},U:function(){return _},a:function(){return K},b:function(){return y},c:function(){return N},d:function(){return b},e:function(){return E},f:function(){return V},g:function(){return l},h:function(){return f},i:function(){return p},j:function(){return c},k:function(){return L},l:function(){return R},m:function(){return x},n:function(){return F},o:function(){return P},p:function(){return O},t:function(){return v},u:function(){return o},v:function(){return m},w:function(){return g}});var r,s,a=n(22929);(s=r||(r={})).UNKNOWN="UNKNOWN",s.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",s.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",s.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",s.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",s.EVENT_CHANNEL_UNREAD="EVENT_CHANNEL_UNREAD",s.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",s.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",s.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",s.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",s.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",s.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",s.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",s.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",s.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",s.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",s.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",s.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",s.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",s.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",s.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",s.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",s.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",s.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",s.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",s.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",s.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",s.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",s.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",s.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",s.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",s.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",s.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",s.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",s.REQUEST_CHANNEL="REQUEST_CHANNEL",s.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",s.REFRESH_CHANNEL="REFRESH_CHANNEL",s.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",s.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",s.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",s.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",s.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",s.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",s.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",s.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",s.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",s.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",s.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",s.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",s.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",s.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",s.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",s.REQUEST_MESSAGE="REQUEST_MESSAGE",s.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",s.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",s.EVENT_POLL_VOTED="EVENT_POLL_VOTED",s.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",s.EVENT_CHANNEL_CSAT_SUBMITTED="EVENT_CHANNEL_CSAT_SUBMITTED",s.EVENT_CHANNEL_CONVERSATION_HANDEDOFF="EVENT_CHANNEL_CONVERSATION_HANDEDOFF",s.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",s.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",s.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",s.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",s.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",s.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",s.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",s.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",s.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",s.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED";(0,a.j)({},r);var i,o=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===r.SYNC_MESSAGE_FILL||e===r.SYNC_MESSAGE_CHANGELOGS||e===r.SYNC_POLL_CHANGELOGS},u=function(e){function t(t){var n=t.messages,r=t.source,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=e.call(this)||this;return i.messages=n,i.source=r,i.isWebSocketEventComing=a,i}return(0,a.c)(t,e),t}(a.aU),c=function(e){function t(t){var n=t.messageIds,r=t.source,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=e.call(this)||this;return i.messageIds=n,i.source=r,i.isWebSocketEventComing=a,i}return(0,a.c)(t,e),t}(a.aU),l=function(e){function t(t){var n=t.messageDeletionTimestamp,r=t.channelUrl,s=t.source,a=e.call(this)||this;return a.messageDeletionTimestamp=n,a.channelUrl=r,a.source=s,a}return(0,a.c)(t,e),t}(a.aU),h=function(e){function t(t){var n=t.event,r=t.source,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=e.call(this)||this;return i.event=n,i.source=r,i.isWebSocketEventComing=a,i}return(0,a.c)(t,e),t}(a.aU),d=function(e){function t(t){var n=t.event,r=t.source,s=t.isWebSocketEventComing,a=void 0!==s&&s,i=e.call(this)||this;return i.event=n,i.source=r,i.isWebSocketEventComing=a,i}return(0,a.c)(t,e),t}(a.aU),_=function(e){function t(t){var n=t.reqId,r=t.source,s=e.call(this)||this;return s.reqId=n,s.source=r,s}return(0,a.c)(t,e),t}(a.aU),p=function(e){function t(t){var n=t.polls,r=t.source,s=e.call(this)||this;return s.polls=n,s.source=r,s}return(0,a.c)(t,e),t}(a.aU),f=function(e){function t(t){var n=t.event,r=t.source,s=e.call(this)||this;return s.event=n,s.source=r,s}return(0,a.c)(t,e),t}(a.aU),E=function(e){function t(t){var n=t.event,r=t.source,s=e.call(this)||this;return s.event=n,s.source=r,s}return(0,a.c)(t,e),t}(a.aU);!function(e){e.OPEN="open",e.CLOSED="closed"}(i||(i={}));var v="removed",g=function(e){switch(e){case"open":return i.OPEN;case"closed":return i.CLOSED;default:return null}},m=function(e){return!e||!!e.text&&(0,a.a)("string",e.text)},C=function(e){function t(t,n){var r,s,a,i,o,u,c,l=this;return(l=e.call(this,t)||this).pollId=0,l.id=0,l.text=null,l.voteCount=0,l.createdBy=null,l.createdAt=0,l.updatedAt=0,l._lastVotedAt=0,l.pollId=null!==(r=n.poll_id)&&void 0!==r?r:0,l.id=null!==(s=n.id)&&void 0!==s?s:0,l.text=null!==(a=n.text)&&void 0!==a?a:null,l.voteCount=null!==(i=n.vote_count)&&void 0!==i?i:0,l.createdBy=null!==(o=n.created_by)&&void 0!==o?o:null,l.createdAt=null!==(u=n.created_at)&&void 0!==u?u:0,l.updatedAt=null!==(c=n.updated_at)&&void 0!==c?c:0,l}return(0,a.c)(t,e),t.payloadify=function(t){return(0,a.e)((0,a.u)((0,a.j)((0,a.j)({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},t}(a.ak),y=function(e){function t(t,n){var r,s,a,o,u,c,l,h,d,_,p,f,E,v=this;return(v=e.call(this,t)||this).id=0,v.title=null,v.createdAt=0,v.updatedAt=0,v.closeAt=-1,v.status=i.CLOSED,v.messageId=0,v.data=null,v.voterCount=-1,v.options=[],v.createdBy=null,v.allowUserSuggestion=!1,v.allowMultipleVotes=!1,v.votedPollOptionIds=[],v.id=null!==(r=n.id)&&void 0!==r?r:0,v.title=null!==(s=n.title)&&void 0!==s?s:null,v.createdAt=null!==(a=n.created_at)&&void 0!==a?a:0,v.updatedAt=null!==(o=n.updated_at)&&void 0!==o?o:0,v.closeAt=null!==(u=n.close_at)&&void 0!==u?u:-1,v.status=null!==(c=g(n.status))&&void 0!==c?c:i.CLOSED,v.messageId=null!==(l=n.message_id)&&void 0!==l?l:0,v.data=null!==(h=n.data)&&void 0!==h?h:null,v.voterCount=null!==(d=n.voter_count)&&void 0!==d?d:-1,v.options=n.options?n.options.map(function(e){return new C(v._iid,e)}):[],v.createdBy=null!==(_=n.created_by)&&void 0!==_?_:null,v.allowUserSuggestion=null!==(p=n.allow_user_suggestion)&&void 0!==p&&p,v.allowMultipleVotes=null!==(f=n.allow_multiple_votes)&&void 0!==f&&f,v.votedPollOptionIds=null!==(E=n.voted_option_ids)&&void 0!==E?E:[],v}return(0,a.c)(t,e),t.prototype._applyPollUpdatePayload=function(e){var t,n,r,s,a,i,o,u,c=this;this.title=null!==(t=e.title)&&void 0!==t?t:this.title,this.updatedAt=null!==(n=e.updated_at)&&void 0!==n?n:this.updatedAt,this.closeAt=null!==(r=e.close_at)&&void 0!==r?r:this.closeAt,this.status=null!==(s=g(e.status))&&void 0!==s?s:this.status,this.data=null!==(a=e.data)&&void 0!==a?a:this.data,this.voterCount=null!==(i=e.voter_count)&&void 0!==i?i:this.voterCount,e.options&&(this.options=e.options.map(function(e){return new C(c._iid,e)}),this.votedPollOptionIds=e.options.filter(function(e){return e.vote_count>0}).map(function(e){return e.id})),this.allowUserSuggestion=null!==(o=e.allow_user_suggestion)&&void 0!==o?o:this.allowUserSuggestion,this.allowMultipleVotes=null!==(u=e.allow_multiple_votes)&&void 0!==u?u:this.allowMultipleVotes},t.payloadify=function(t){return(0,a.e)((0,a.u)((0,a.j)((0,a.j)({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(e){return C.payloadify(e)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},t.prototype.applyPollUpdateEvent=function(e){var t=e._payload.poll;return!(!t||this.id!==t.id||t.updated_at<this.updatedAt)&&(this._applyPollUpdatePayload(t),!0)},t.prototype.applyPollVoteEvent=function(e){if(this.id!==e.pollId)return!1;var t=this.options,n=t.map(function(e){return e.id}),r=e._payload,s=Math.floor(r.ts/1e3);
1return r.updated_vote_counts.forEach(function(e){var r=n.indexOf(e.option_id);if(r>-1){var a=t[r];s>=a._lastVotedAt&&(a.voteCount=e.vote_count,a._lastVotedAt=s)}}),r.req_id&&r.voted_option_ids&&(this.votedPollOptionIds=r.voted_option_ids),"number"==typeof r.voter_count&&(this.voterCount=r.voter_count),!0},t.prototype.serialize=function(){return(0,a.an)(this)},t}(a.ak),N=function(e){function t(t,n,r,s){var a=e.call(this,t,s)||this;return a.channelUrl=n,a.channelType=r,a}return(0,a.c)(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&(0,a.a)("string",this.channelUrl)&&(0,a.a2)(a.C,this.channelType)},t}(a.aM),b=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},A=function(e){function t(t){var n=t.title,r=t.optionTexts,s=t.data,i=t.allowUserSuggestion,o=t.allowMultipleVotes,u=t.closeAt,c=e.call(this)||this;return c.method=a.A.POST,c.path=a.aI,c.params={title:n,options:r,data:s,allow_user_suggestion:i,allow_multiple_votes:o,close_at:u},c}return(0,a.c)(t,e),t}(a.f),M=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.poll=new y(t,n),r}return(0,a.c)(t,e),t}(a.g),T=function(e){function t(t){var n=t.channelUrl,r=t.channelType,s=t.pollId,i=e.call(this)||this;return i.method=a.A.GET,i.path="".concat(a.aI,"/").concat(encodeURIComponent(s)),i.params={channel_url:n,channel_type:r},i}return(0,a.c)(t,e),t}(a.f),S=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.poll=new y(t,n),r}return(0,a.c)(t,e),t}(a.g),U=function(e){function t(t){var n=t.channelUrl,r=t.channelType,s=t.pollId,i=t.pollOptionId,o=e.call(this)||this;return o.method=a.A.GET,o.path="".concat(a.aI,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(i)),o.params={channel_url:n,channel_type:r},o}return(0,a.c)(t,e),t}(a.f),I=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.pollOption=new C(t,n),r}return(0,a.c)(t,e),t}(a.g),D=function(e){function t(t){var n=t.channelType,r=t.channelUrl,s=t.timestamp,i=t.token,o=e.call(this)||this;return o.method=a.A.GET,o.path="".concat((0,a.aq)(n),"/").concat(encodeURIComponent(r),"/polls/changelogs"),o.params=(0,a.e)({change_ts:s,token:i}),o}return(0,a.c)(t,e),t}(a.f),w=function(e){function t(t,n){var r=e.call(this,t,n)||this;return r.updatedPolls=n.updated.map(function(e){return function(e,t){return new y(e,t)}(t,e)}),r.deletedPollIds=n.deleted.map(function(e){return e}),r.hasMore=n.has_more,r.nextToken=n.next,r}return(0,a.c)(t,e),t}(a.g),L={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},R=function(e){return(0,a.a)("string",e.title)&&(t=e.optionTexts,(0,a.$)("string",t)&&t.every(function(e){return""!==e.trim()}))&&m(e.data)&&(0,a.a)("boolean",e.allowUserSuggestion,!0)&&(0,a.a)("boolean",e.allowMultipleVotes,!0)&&(0,a.a)("number",e.closeAt,!0);var t},P={channelUrl:"",channelType:a.C.BASE,pollId:0,pollOptionId:0},O=function(e){return(0,a.a)("string",e.channelUrl)&&""!==e.channelUrl&&(0,a.a2)(a.C,e.channelType)&&(0,a.a)("number",e.pollId)&&e.pollId>0&&(0,a.a)("number",e.pollOptionId)&&e.pollOptionId>0},x={channelUrl:"",channelType:a.C.BASE,pollId:0},F=function(e){return(0,a.a)("string",e.channelUrl)&&""!==e.channelUrl&&(0,a.a2)(a.C,e.channelType)&&(0,a.a)("number",e.pollId)},k={},V=function(){function e(e,t){var n=t.sdkState,r=t.dispatcher,s=t.sessionManager,a=t.requestQueue,i=t.logger;this._iid=e,this._sdkState=n,this._sessionManager=s,this._requestQueue=a,this._dispatcher=r,this._logger=i,k[e]=this}return e.of=function(e){return k[e]},e.prototype.buildPollFromSerializedData=function(e){var t=(0,a.G)(e);return new y(this._iid,y.payloadify(t))},e.prototype.get=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:return(0,a.F)(F(e)).throw(a.t.invalidParameters),t=new T((0,a.j)({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(S).poll]}})})},e.prototype.create=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:return(0,a.F)(R(e)).throw(a.t.invalidParameters),t=new A((0,a.j)({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(M).poll]}})})},e.prototype.getOption=function(e){return(0,a._)(this,void 0,void 0,function(){var t;return(0,a.b)(this,function(n){switch(n.label){case 0:return(0,a.F)(O(e)).throw(a.t.invalidParameters),t=new U((0,a.j)({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(I).pollOption]}})})},e.prototype.getPollChangeLogs=function(e,t,n,s){return void 0===s&&(s=r.SYNC_POLL_CHANGELOGS),(0,a._)(this,void 0,void 0,function(){var r,i,o,u,c,l,h;return(0,a.b)(this,function(d){switch(d.label){case 0:return r=new D((0,a.u)({channelType:t,channelUrl:e,timestamp:"number"==typeof n?n:null,token:"string"==typeof n?n:null})),[4,this._requestQueue.send(r)];case 1:return i=d.sent(),o=i.as(w),u=o.updatedPolls,c=o.deletedPollIds,l=o.hasMore,h=o.nextToken,u.length>0&&this._dispatcher.dispatch(new p({polls:u,source:s})),[2,{updatedPolls:u,deletedPollIds:c,hasMore:l,token:h}]}})})},e}(),H=function(e){function t(t){var n=t.channelUrl,r=t.channelType,s=t.token,i=t.limit,o=e.call(this)||this;return o.method=a.A.GET,o.path=a.aI,o.params={channel_url:n,channel_type:r,token:s,limit:i},o}return(0,a.c)(t,e),t}(a.f),G=function(e){function t(t,n){var r,s=this;return(s=e.call(this,t,n)||this).polls=(null!==(r=n.polls)&&void 0!==r?r:[]).map(function(e){return new y(t,e)}),s.token=n.next,s}return(0,a.c)(t,e),t}(a.g),B=function(e){function t(t,n){return e.call(this,t,n.channelUrl,n.channelType,n)||this}return(0,a.c)(t,e),t.prototype.next=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return this._val
1idate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=a.V.of(this._iid).requestQueue,t=new H((0,a.j)((0,a.j)({},this),{token:this._token})),[4,e.send(t)]):[3,2]:[3,5];case 1:return n=o.sent(),r=n.as(G),s=r.polls,i=r.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,s];case 2:return[2,[]];case 3:throw a.t.queryInProgress;case 4:return[3,6];case 5:throw a.t.invalidParameters;case 6:return[2]}})})},t}(N),q=function(e){function t(t){var n=t.channelUrl,r=t.channelType,s=t.pollId,i=t.pollOptionId,o=t.token,u=t.limit,c=e.call(this)||this;return c.method=a.A.GET,c.path="".concat(a.aI,"/").concat(encodeURIComponent(s),"/options/").concat(encodeURIComponent(i),"/voters"),c.params={channel_url:n,channel_type:r,token:o,limit:u},c}return(0,a.c)(t,e),t}(a.f),j=function(e){function t(t,n){var r,s=this;return(s=e.call(this,t,n)||this).voters=(null!==(r=n.voters)&&void 0!==r?r:[]).map(function(e){return new a.U(t,e)}),s.token=n.next,s}return(0,a.c)(t,e),t}(a.g),K=function(e){function t(t,n){var r=e.call(this,t,n.channelUrl,n.channelType,n)||this;return r.pollId=n.pollId,r.pollOptionId=n.pollOptionId,r}return(0,a.c)(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&(0,a.a)("number",this.pollId)&&(0,a.a)("number",this.pollOptionId)},t.prototype.next=function(){return(0,a._)(this,void 0,void 0,function(){var e,t,n,r,s,i;return(0,a.b)(this,function(o){switch(o.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=a.V.of(this._iid).requestQueue,t=new q((0,a.j)((0,a.j)({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,e.send(t)]):[3,2]:[3,5];case 1:return n=o.sent(),r=n.as(j),s=r.voters,i=r.token,this._token=i,this._hasNext=!!i,this._isLoading=!1,[2,s];case 2:return[2,[]];case 3:throw a.t.queryInProgress;case 4:return[3,6];case 5:throw a.t.invalidParameters;case 6:return[2]}})})},t}(N)}}]);
2//# sourceMappingURL=sendbird-0ce62d85-4251e014d4ff37d7ca0f.chunk.js.map

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.