New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@sendbird/chat

Package Overview
Dependencies
Maintainers
1
Versions
120
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sendbird/chat - npm Package Compare versions

Comparing version 4.0.0-beta.4 to 4.0.0-beta.6

bundles/__bundle-00aa62ec.js

2

bundles/groupChannel.js

@@ -1,1 +0,1 @@

import{d as e,e as n,V as a,aa as r,ab as i,q as s,o,p as u,w as l,z as h,j as c,a2 as d,_ as p,n as m,A as f,a7 as v,g as C,h as g,k as b,a as k,b as M,c as N,B as P,S as T,u as x,aO as D}from"./__bundle-a953c60c.js";export{ae as MessageEventSource}from"./__bundle-a953c60c.js";import{r as j,s as q,G as ee,t as te,T as ne,u as re,v as ie,w as se,x as oe,y as ue,z as le,A as he,S as ce,B as de,C as pe,E as me,F as fe,H as ve,I as _e}from"./__bundle-253902ac.js";export{J as CountPreference,A as GroupChannel,F as GroupChannelChangeLogsParams,K as GroupChannelChangeLogsParamsProperties,H as GroupChannelCountParams,O as GroupChannelCountParamsProperties,I as GroupChannelCreateParams,L as GroupChannelCreateParamsProperties,y as GroupChannelEventContext,t as GroupChannelEventSource,w as GroupChannelFilter,Q as GroupChannelHideParams,R as GroupChannelHideParamsProperties,G as GroupChannelListOrder,E as GroupChannelListQuery,V as GroupChannelSearchField,W as GroupChannelUpdateParams,X as GroupChannelUpdateParamsProperties,Y as HiddenChannelFilter,Z as HiddenState,_ as Member,$ as MemberListOrder,a0 as MemberListQuery,a1 as MemberState,a2 as MemberStateFilter,a3 as MessageCollection,a4 as MessageCollectionInitHandler,a5 as MessageCollectionInitPolicy,a6 as MessageEventContext,a7 as MessageFilter,a8 as MutedState,a9 as OperatorFilter,z as PublicChannelFilter,B as PublicGroupChannelListOrder,aa as QueryType,ab as ReadStatus,S as SuperChannelFilter,ac as UnreadChannelFilter,U as UnreadItemKey}from"./__bundle-253902ac.js";import{B as ye}from"./__bundle-6cc2e604.js";import"./__bundle-459ad47d.js";var Ce,ge={},be=function(){function t(t){var r=t._iid,i=this;this._sync=null,this._metadata=null,this._iid=r;var u,l=a.of(this._iid),h=l.sdkState,c=l.logger;this._metadataKey=(u=h.userId,"sendbird:".concat(u,"@groupchannel/sync.meta"));var d=function(e){return"sendbird:".concat(e,"@groupchannel/sync")}(h.userId);this._sync=new j(d,(function(){return e(i,void 0,void 0,(function(){var e,t,a,r,i;return n(this,(function(n){switch(n.label){case 0:return e={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:return n.sent(),c.debug("channel background sync from",this._metadata.token),this._metadata.completed?[3,4]:[4,q.of(this._iid).getMyGroupChannels(this._metadata.token,{includeEmpty:!0,order:ee.CHRONOLOGICAL},100,te.SYNC_CHANNEL_BACKGROUND)];case 2:return t=n.sent(),a=t.channels,r=t.token,e.hasNext=a.length>=100&&!!r,e.nextToken=r,this._metadata.token=r,(i=this._metadata.range).extends.apply(i,s([],o(a.map((function(e){return e.createdAt}))),!1)),this._metadata.completed=!e.hasNext,c.debug("channel background sync progress",e),[4,this.saveMetadata()];case 3:return n.sent(),[3,5];case 4:e.hasNext=!1,e.nextToken="",n.label=5;case 5:return[2,e]}}))}))}))}return t.of=function(e){if(!ge[e]){var n=ge[e]=new t({_iid:e});a.of(e).dispatcher.on((function(e){if(e instanceof r)if(e.stateType===i.CONNECTED)n.resume();else n.pause()}))}return ge[e]},Object.defineProperty(t.prototype,"range",{get:function(){var e;return null===(e=this._metadata)||void 0===e?void 0:e.range},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"completed",{get:function(){var e;return!!(null===(e=this._metadata)||void 0===e?void 0:e.completed)},enumerable:!1,configurable:!0}),t.prototype.loadMetadata=function(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.of(this._iid).cacheContext.store.get(this._metadataKey)];case 1:e=t.sent(),this._metadata={token:e?e.token:"",range:new ne(e?e.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!e&&e.completed},t.label=2;case 2:return[2]}}))}))},t.prototype.saveMetadata=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return this._metadata?[4,a.of(this._iid).cacheContext.store.set({key:this._metadataKey,value:this._metadata,generation:1})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.resume=function(){var e,t;a.of(this._iid).logger.debug("channel background sync resume()"),this._sync.start(null!==(t=null===(e=this._metadata)||void 0===e?void 0:e.token)&&void 0!==t?t:"")},t.prototype.pause=function(){a.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},t}(),we={},Fe=function(){function t(t){var r=t._iid,i=this;this._sync=null,this._metadataKey=null,this._metadata=null,this._iid=r;var s,o=a.of(this._iid).sdkState;this._metadataKey=(s=o.userId,"sendbird:".concat(s,"@groupchannel/changelogs.meta"));var u=function(e){return"sendbird:".concat(e,"@groupchannel/changelogs")}(o.userId);this._sync=new j(u,(function(){return e(i,void 0,void 0,(function(){var e,t,a,r;return n(this,(function(n){switch(n.label){case 0:return e={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:return n.sent(),[4,q.of(this._iid).getMyGroupChannelChangeLogs(this._metadata.token,{},te.SYNC_CHANNEL_CHANGELOGS)];case 2:return t=n.sent(),a=t.hasMore,r=t.token,e.hasNext=a,e.nextToken=r,this._metadata.token=r,[4,this.saveMetadata()];case 3:return n.sent(),[2,e]}}))}))}))}return t.of=function(e){if(!we[e]){var n=we[e]=new t({_iid:e});a.of(e).dispatcher.on((function(e){if(e instanceof r)if(e.stateType===i.CONNECTED)n.resume();else n.pause()}))}return we[e]},t.prototype.loadMetadata=function(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.of(this._iid).cacheContext.store.get(this._metadataKey)];case 1:e=t.sent(),this._metadata={token:e?e.token:""},t.label=2;case 2:return[2]}}))}))},t.prototype.saveMetadata=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return this._metadata?[4,a.of(this._iid).cacheContext.store.set({key:this._metadataKey,value:this._metadata,generation:1})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.resume=function(){this._sync.start(0)},t.prototype.pause=function(){this._sync.stop()},t}(),ke=function(){function t(e,t){var n=t.filter,r=t.order,i=t.limit,s=this;this.channels=[],this._iid=e,this._key="gcc-".concat(h()),this.filter=null!=n?n:new se,this.order=null!=r?r:ee.LATEST_LAST_MESSAGE,this._hasMore=!0,this._token="",this._limit=null!=i?i:oe,be.of(e).resume(),Fe.of(e).resume();var o=a.of(this._iid).sdkState;q.of(this._iid).subscribeGroupChannelEvent(this._key,{onUpdate:function(e,t){var n=e.filter((function(e){return s.filter.match(e,o.userId)})),a=e.filter((function(e){return!s.filter.match(e,o.userId)})).map((function(e){return e.url}));n.length>0&&s._addChannelsToView(n,t),a.length>0&&s._removeChannelsFromView(a,t)},onRemove:function(e,t){s._removeChannelsFromView(e,t)}})}return Object.defineProperty(t.prototype,"hasMore",{get:function(){return this._hasMore},enumerable:!1,configurable:!0}),t.prototype.setGroupChannelCollectionHandler=function(e){this._handler=e},t.prototype._addChannelsToView=function(t,a,r){var i,s,o=this;void 0===r&&(r=!1);var h=[],c=[];try{for(var d=u(t),p=d.next();!p.done;p=d.next()){var m=p.value,f=re(this.channels,m,this.order),v=f.place;if(f.contains)switch(c.push(m),a){case te.EVENT_CHANNEL_UPDATED:case te.EVENT_MESSAGE_RECEIVED:this.channels.splice(v,1);var _=re(this.channels,m,this.order).place;this.channels.splice(_,0,m);break;default:this.channels[v]=m}else if(v===this.channels.length){var y=be.of(this._iid);(r||y.completed)&&(h.push(m),this.channels.push(m))}else h.push(m),this.channels.splice(v,0,m)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(i)throw i.error}}ie(a)&&l((function(){return e(o,void 0,void 0,(function(){var e;return n(this,(function(t){return e=new ue(a),h.length>0&&this._handler.onChannelsAdded(e,h),c.length>0&&this._handler.onChannelsUpdated(e,c),[2]}))}))}))},t.prototype._removeChannelsFromView=function(t,a){var r,i,s=this,o=[],h=function(e){var t=c.channels.findIndex((function(t){return t.url===e}));t>=0&&(o.push(c.channels[t].url),c.channels.splice(t,1))},c=this;try{for(var d=u(t),p=d.next();!p.done;p=d.next()){h(p.value)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}return ie(a)&&o.length>0&&l((function(){return e(s,void 0,void 0,(function(){var e;return n(this,(function(t){return e=new ue(a),this._handler.onChannelsDeleted(e,o),[2]}))}))})),o},t.prototype._getLocalChannels=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,q.of(this._iid).getChannelsFromCache(this._token,this.filter,this.order)];case 1:return[2,e.sent()]}}))}))},t.prototype._getRemoteChannels=function(){return e(this,void 0,void 0,(function(){var e,t,a;return n(this,(function(n){switch(n.label){case 0:return[4,q.of(this._iid).getMyGroupChannels(this._token,c(c({},this.filter),{order:this.order}),this._limit)];case 1:return e=n.sent(),t=e.channels,a=e.token,this._token=a,[2,t]}}))}))},t.prototype.loadMore=function(){return e(this,void 0,void 0,(function(){var t,a=this;return n(this,(function(r){switch(r.label){case 0:return this._hasMore?(t=[],[4,d((function(){return e(a,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,this._getLocalChannels()];case 1:return t=e.sent(),[2]}}))}))}))]):[3,3];case 1:return r.sent(),[4,d((function(){return e(a,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,this._getRemoteChannels()];case 1:return t=e.sent(),[2]}}))}))}))];case 2:return r.sent(),this._addChannelsToView(t,te.REQUEST_CHANNEL,!0),[2,t];case 3:return[2,[]]}}))}))},t.prototype.dispose=function(){q.of(this._iid).unsubscribeGroupChannelEvent(this._key)},t}(),Ge=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return Object.keys(t).forEach((function(e){n.hasOwnProperty(e)&&(n[e]=t[e])})),n}return p(t,e),t}(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onUserJoined=m,t.onUserLeft=m,t.onUserReceivedInvitation=m,t.onUserDeclinedInvitation=m,t.onChannelHidden=m,t.onUnreadMemberStatusUpdated=m,t.onUndeliveredMemberStatusUpdated=m,t.onTypingStatusUpdated=m,t}return p(t,e),t}(ye)),Me=function(e){function t(t){var n=this,a=t.token,r=t.limit,i=t.order,s=t.includeEmpty,o=t.membershipFilter,u=t.channelNameContainsFilter,l=t.channelUrlsFilter,h=t.customTypesFilter,c=t.customTypeStartsWithFilter,d=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,_=t.metadataValues,y=t.metadataValueStartsWith,g=t.includeFrozen,b=t.includeMetaData;return(n=e.call(this)||this).method=f.GET,n.path=v,n.params=C({token:a,limit:r,order:i,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:s,public_mode:le.PUBLIC,public_membership_mode:o,name_contains:u,channel_urls:l,custom_types:h,custom_type_startswith:c,super_mode:d,metadata_order_key:p,metadata_key:m,metadata_values:_,metadata_value_startswith:y,show_frozen:g,show_metadata:b}),n}return p(t,e),t}(g),Se=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.token=null,a.channels=[],a.ts=null;var r=n.next,i=n.channels,s=n.ts;return a.token=r,i&&i.length>0&&(a.channels=i.map((function(e){return e.ts=s,new he(t,e)}))),a.ts="number"==typeof s?s:null,a}return p(t,e),t}(b);!function(e){e.ALL="all",e.JOINED="joined"}(Ce||(Ce={}));var Ee=function(t){function r(e,n){var a,r,i,s,o,u,l,h,c,d,p,m,f,v,_=this;return(_=t.call(this,e,n)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.nicknameContainsFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=Ce.ALL,_.superChannelFilter=ce.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=de.CHRONOLOGICAL,_.includeEmpty=null!==(a=n.includeEmpty)&&void 0!==a&&a,_.includeFrozen=null===(r=n.includeFrozen)||void 0===r||r,_.includeMetaData=null===(i=n.includeMetaData)||void 0===i||i,_.channelUrlsFilter=null!==(s=n.channelUrlsFilter)&&void 0!==s?s:null,_.customTypesFilter=null!==(o=n.customTypesFilter)&&void 0!==o?o:null,_.customTypeStartsWithFilter=null!==(u=n.customTypeStartsWithFilter)&&void 0!==u?u:null,_.channelNameContainsFilter=null!==(l=n.channelNameContainsFilter)&&void 0!==l?l:null,_.membershipFilter=null!==(h=n.membershipFilter)&&void 0!==h?h:Ce.ALL,_.superChannelFilter=null!==(c=n.superChannelFilter)&&void 0!==c?c:ce.ALL,_.metadataKey=null!==(d=n.metadataKey)&&void 0!==d?d:null,_.metadataValues=null!==(p=n.metadataValues)&&void 0!==p?p:null,_.metadataOrderKeyFilter=null!==(m=n.metadataOrderKeyFilter)&&void 0!==m?m:null,_.metadataValueStartsWith=null!==(f=n.metadataValueStartsWith)&&void 0!==f?f:null,_.order=null!==(v=n.order)&&void 0!==v?v:de.CHRONOLOGICAL,_}return p(r,t),r.prototype._validate=function(){return t.prototype._validate.call(this)&&k("boolean",this.includeEmpty)&&k("boolean",this.includeFrozen)&&k("boolean",this.includeMetaData)&&k("string",this.channelNameContainsFilter,!0)&&M("string",this.channelUrlsFilter,!0)&&M("string",this.customTypesFilter,!0)&&k("string",this.customTypeStartsWithFilter,!0)&&N(Ce,this.membershipFilter)&&N(ce,this.superChannelFilter)&&N(de,this.order)&&k("string",this.metadataOrderKeyFilter,!0)&&k("string",this.metadataKey,!0)&&M("string",this.metadataValues,!0)&&k("string",this.metadataValueStartsWith,!0)},r.prototype.next=function(){return e(this,void 0,void 0,(function(){var e,t,r,i,s,o,u,l,h;return n(this,(function(n){switch(n.label){case 0:return this._validate()?this._isLoading?[3,3]:(e=[],this._hasNext?(this._isLoading=!0,t=a.of(this._iid),r=t.requestQueue,i=t.dispatcher,s=new Me(c(c({},this),{token:this._token})),[4,r.send(s)]):[3,2]):[3,5];case 1:return o=n.sent(),u=o.as(Se),l=u.channels,h=u.token,this._token=h,this._hasNext=!!h,i.dispatch(new pe({channels:l,source:te.REQUEST_CHANNEL})),this._isLoading=!1,[2,l];case 2:return[2,e];case 3:throw T.queryInProgress;case 4:return[3,6];case 5:throw T.invalidParameters;case 6:return[2]}}))}))},r}(P),Le=function(t){function a(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="groupChannel",e}return p(a,t),a.prototype.init=function(e,n){var a=n.sdkState,r=n.dispatcher,i=n.sessionManager,s=n.requestQueue,o=n.logger,u=n.cacheContext;t.prototype.init.call(this,e,{sdkState:a,dispatcher:r,sessionManager:i,requestQueue:s,logger:o,cacheContext:u}),this._manager=new q(e,{sdkState:a,cacheContext:u,dispatcher:r,sessionManager:i,requestQueue:s,logger:o})},a.prototype.createGroupChannelCollection=function(e){return void 0===e&&(e={}),new ke(this._iid,e)},a.prototype.createMyGroupChannelListQuery=function(e){return void 0===e&&(e={}),new me(this._iid,e)},a.prototype.createPublicGroupChannelListQuery=function(e){return void 0===e&&(e={}),new Ee(this._iid,e)},a.prototype.addGroupChannelHandler=function(e,t){x(k("string",e)&&t instanceof Ge).throw(T.invalidParameters),this._manager.addHandler(e,t)},a.prototype.removeGroupChannelHandler=function(e){x(k("string",e)).throw(T.invalidParameters),this._manager.removeHandler(e)},a.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},a.prototype.buildGroupChannelFromSerializedData=function(e){return this._manager.buildGroupChannelFromSerializedData(e)},a.prototype.buildGroupChannelListQueryFromSerializedData=function(e){return this._manager.buildGroupChannelListQueryFromSerializedData(e)},a.prototype.buildMemberFromSerializedData=function(e){return this._manager.buildMemberFromSerializedData(e)},a.prototype.getChannel=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(k("string",t)).throw(T.invalidParameters),[2,this._manager.getChannel(t)]}))}))},a.prototype.getChannelWithoutCache=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(k("string",t)).throw(T.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]}))}))},a.prototype.getMyGroupChannelChangeLogsByToken=function(t,a){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(k("string",t)&&a instanceof fe&&a.validate()).throw(T.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,a)];case 1:return[2,e.sent()]}}))}))},a.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,a){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(k("number",t)&&a instanceof fe&&a.validate()).throw(T.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,a)];case 1:return[2,e.sent()]}}))}))},a.prototype.getGroupChannelCount=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof ve&&t.validate()).throw(T.invalidParameters),[2,this._manager.getGroupChannelCount(t)]}))}))},a.prototype.createChannel=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof _e&&t.validate()).throw(T.invalidParameters),[2,this._manager.createChannel(t)]}))}))},a.prototype.createDistinctChannelIfNotExist=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof _e&&t.validate()).throw(T.invalidParameters),t&&(t.isDistinct=!0),[2,this.createChannel(t)]}))}))},a.prototype.createChannelWithUserIds=function(t,a,r,i,s,o){return void 0===a&&(a=!1),void 0===r&&(r=null),void 0===i&&(i=null),void 0===s&&(s=""),void 0===o&&(o=""),e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=new _e).addUserIds(t),e.isDistinct=a,e.name=r,e.data=s,e.customType=o,"string"==typeof i?e.coverUrl=i:e.coverImage=i,[2,this.createChannel(e)]}))}))},a.prototype.markAsReadAll=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){return this._manager.markAsReadAll(),[2]}))}))},a.prototype.markAsReadWithChannelUrls=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(M("string",t)).throw(T.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]}))}))},a.prototype.markAsDelivered=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(k("string",t)).throw(T.invalidParameters),[4,this.getChannel(t)];case 1:return[4,e.sent().markAsDelivered()];case 2:return e.sent(),[2]}}))}))},a}(D);export{ke as GroupChannelCollection,Ge as GroupChannelHandler,Le as GroupChannelModule,Ee as PublicGroupChannelListQuery};
import{d as e,e as n,V as a,ab as r,ac as i,S as s,q as o,o as u,p as l,w as h,z as c,j as d,a3 as p,_ as m,n as f,A as v,a8 as C,g,h as b,k,a as M,b as N,c as T,B as P,u as x,aO as D}from"./__bundle-1d33b216.js";export{af as MessageEventSource}from"./__bundle-1d33b216.js";import{r as j,s as q,G as ee,t as te,T as ne,u as ae,v as re,w as ie,x as se,y as oe,z as ue,A as le,S as he,B as ce,C as de,E as pe,F as me,H as fe,I as ve}from"./__bundle-00aa62ec.js";export{J as CountPreference,A as GroupChannel,F as GroupChannelChangeLogsParams,K as GroupChannelChangeLogsParamsProperties,H as GroupChannelCountParams,O as GroupChannelCountParamsProperties,I as GroupChannelCreateParams,L as GroupChannelCreateParamsProperties,y as GroupChannelEventContext,t as GroupChannelEventSource,w as GroupChannelFilter,Q as GroupChannelHideParams,R as GroupChannelHideParamsProperties,G as GroupChannelListOrder,E as GroupChannelListQuery,V as GroupChannelSearchField,W as GroupChannelUpdateParams,X as GroupChannelUpdateParamsProperties,Y as HiddenChannelFilter,Z as HiddenState,_ as Member,$ as MemberListOrder,a0 as MemberListQuery,a1 as MemberState,a2 as MemberStateFilter,a3 as MessageCollection,a4 as MessageCollectionInitHandler,a5 as MessageCollectionInitPolicy,a6 as MessageEventContext,a7 as MessageFilter,a8 as MutedState,a9 as OperatorFilter,z as PublicChannelFilter,B as PublicGroupChannelListOrder,aa as QueryType,ab as ReadStatus,S as SuperChannelFilter,ac as UnreadChannelFilter,U as UnreadItemKey}from"./__bundle-00aa62ec.js";import{B as _e}from"./__bundle-07c194b5.js";import"./__bundle-a7378a38.js";var ye,Ce={},ge=function(){function t(t){var r=t._iid,i=this;this._sync=null,this._metadata=null,this._iid=r;var l,h=a.of(this._iid),c=h.sdkState,d=h.logger;this._metadataKey=(l=c.userId,"sendbird:".concat(l,"@groupchannel/sync.meta"));var p=function(e){return"sendbird:".concat(e,"@groupchannel/sync")}(c.userId);this._sync=new j(p,(function(){return e(i,void 0,void 0,(function(){var e,t,a,r,i,l;return n(this,(function(n){switch(n.label){case 0:return e={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(n.sent(),d.debug("channel background sync from",this._metadata.token),this._metadata.completed)return[3,9];n.label=2;case 2:return n.trys.push([2,5,,8]),[4,q.of(this._iid).getMyGroupChannels(this._metadata.token,{includeEmpty:!0,order:ee.CHRONOLOGICAL},100,te.SYNC_CHANNEL_BACKGROUND)];case 3:return t=n.sent(),a=t.channels,r=t.token,e.hasNext=a.length>=100&&!!r,e.nextToken=r,this._metadata.token=r,(l=this._metadata.range).extends.apply(l,o([],u(a.map((function(e){return e.createdAt}))),!1)),this._metadata.completed=!e.hasNext,d.debug("channel background sync progress",e),[4,this.saveMetadata()];case 4:return n.sent(),[3,8];case 5:return(i=n.sent())instanceof s&&i.isInvalidTokenError?[4,this.clearMetaData()]:[3,7];case 6:n.sent(),n.label=7;case 7:return[3,8];case 8:return[3,10];case 9:e.hasNext=!1,e.nextToken="",n.label=10;case 10:return[2,e]}}))}))}))}return t.of=function(e){if(!Ce[e]){var n=Ce[e]=new t({_iid:e});a.of(e).dispatcher.on((function(e){if(e instanceof r)if(e.stateType===i.CONNECTED)n.resume();else n.pause()}))}return Ce[e]},Object.defineProperty(t.prototype,"range",{get:function(){var e;return null===(e=this._metadata)||void 0===e?void 0:e.range},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"completed",{get:function(){var e;return!!(null===(e=this._metadata)||void 0===e?void 0:e.completed)},enumerable:!1,configurable:!0}),t.prototype.loadMetadata=function(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.of(this._iid).cacheContext.store.get(this._metadataKey)];case 1:e=t.sent(),this._metadata={token:e?e.token:"",range:new ne(e?e.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!e&&e.completed},t.label=2;case 2:return[2]}}))}))},t.prototype.saveMetadata=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return this._metadata?[4,a.of(this._iid).cacheContext.store.set({key:this._metadataKey,value:this._metadata,generation:1})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.clearMetaData=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,a.of(this._iid).cacheContext.store.remove(this._metadataKey)];case 1:return e.sent(),[2]}}))}))},t.prototype.resume=function(){var e,t;a.of(this._iid).logger.debug("channel background sync resume()"),this._sync.start(null!==(t=null===(e=this._metadata)||void 0===e?void 0:e.token)&&void 0!==t?t:"")},t.prototype.pause=function(){a.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},t}(),be={},we=function(){function t(t){var r=t._iid,i=this;this._sync=null,this._metadataKey=null,this._metadata=null,this._iid=r;var o,u=a.of(this._iid).sdkState;this._metadataKey=(o=u.userId,"sendbird:".concat(o,"@groupchannel/changelogs.meta"));var l=function(e){return"sendbird:".concat(e,"@groupchannel/changelogs")}(u.userId);this._sync=new j(l,(function(){return e(i,void 0,void 0,(function(){var e,t,a,r,i;return n(this,(function(n){switch(n.label){case 0:return e={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:n.sent(),n.label=2;case 2:return n.trys.push([2,5,,8]),[4,q.of(this._iid).getMyGroupChannelChangeLogs(this._metadata.token,{},te.SYNC_CHANNEL_CHANGELOGS)];case 3:return t=n.sent(),a=t.hasMore,r=t.token,e.hasNext=a,e.nextToken=r,this._metadata.token=r,[4,this.saveMetadata()];case 4:return n.sent(),[2,e];case 5:return(i=n.sent())instanceof s&&i.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:n.sent(),n.label=7;case 7:return[3,8];case 8:return[2]}}))}))}))}return t.of=function(e){if(!be[e]){var n=be[e]=new t({_iid:e});a.of(e).dispatcher.on((function(e){if(e instanceof r)if(e.stateType===i.CONNECTED)n.resume();else n.pause()}))}return be[e]},t.prototype.loadMetadata=function(){return e(this,void 0,void 0,(function(){var e;return n(this,(function(t){switch(t.label){case 0:return this._metadata?[3,2]:[4,a.of(this._iid).cacheContext.store.get(this._metadataKey)];case 1:e=t.sent(),this._metadata={token:e?e.token:""},t.label=2;case 2:return[2]}}))}))},t.prototype.saveMetadata=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return this._metadata?[4,a.of(this._iid).cacheContext.store.set({key:this._metadataKey,value:this._metadata,generation:1})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}}))}))},t.prototype.clearMetadata=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){return a.of(this._iid).cacheContext.store.remove(this._metadataKey),[2]}))}))},t.prototype.resume=function(){this._sync.start(0)},t.prototype.pause=function(){this._sync.stop()},t}(),Fe=function(){function t(e,t){var n=t.filter,r=t.order,i=t.limit,s=this;this.channels=[],this._iid=e,this._key="gcc-".concat(c()),this.filter=null!=n?n:new ie,this.order=null!=r?r:ee.LATEST_LAST_MESSAGE,this._hasMore=!0,this._token="",this._limit=null!=i?i:se,ge.of(e).resume(),we.of(e).resume();var o=a.of(this._iid).sdkState;q.of(this._iid).subscribeGroupChannelEvent(this._key,{onUpdate:function(e,t){var n=e.filter((function(e){return s.filter.match(e,o.userId)})),a=e.filter((function(e){return!s.filter.match(e,o.userId)})).map((function(e){return e.url}));n.length>0&&s._addChannelsToView(n,t),a.length>0&&s._removeChannelsFromView(a,t)},onRemove:function(e,t){s._removeChannelsFromView(e,t)}})}return Object.defineProperty(t.prototype,"hasMore",{get:function(){return this._hasMore},enumerable:!1,configurable:!0}),t.prototype.setGroupChannelCollectionHandler=function(e){this._handler=e},t.prototype._addChannelsToView=function(t,a,r){var i,s,o=this;void 0===r&&(r=!1);var u=[],c=[];try{for(var d=l(t),p=d.next();!p.done;p=d.next()){var m=p.value,f=ae(this.channels,m,this.order),v=f.place;if(f.contains)switch(c.push(m),a){case te.EVENT_CHANNEL_UPDATED:case te.EVENT_MESSAGE_RECEIVED:this.channels.splice(v,1);var _=ae(this.channels,m,this.order).place;this.channels.splice(_,0,m);break;default:this.channels[v]=m}else if(v===this.channels.length){var y=ge.of(this._iid);(r||y.completed)&&(u.push(m),this.channels.push(m))}else u.push(m),this.channels.splice(v,0,m)}}catch(e){i={error:e}}finally{try{p&&!p.done&&(s=d.return)&&s.call(d)}finally{if(i)throw i.error}}re(a)&&h((function(){return e(o,void 0,void 0,(function(){var e;return n(this,(function(t){return e=new oe(a),u.length>0&&this._handler.onChannelsAdded(e,u),c.length>0&&this._handler.onChannelsUpdated(e,c),[2]}))}))}))},t.prototype._removeChannelsFromView=function(t,a){var r,i,s=this,o=[],u=function(e){var t=c.channels.findIndex((function(t){return t.url===e}));t>=0&&(o.push(c.channels[t].url),c.channels.splice(t,1))},c=this;try{for(var d=l(t),p=d.next();!p.done;p=d.next()){u(p.value)}}catch(e){r={error:e}}finally{try{p&&!p.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}return re(a)&&o.length>0&&h((function(){return e(s,void 0,void 0,(function(){var e;return n(this,(function(t){return e=new oe(a),this._handler.onChannelsDeleted(e,o),[2]}))}))})),o},t.prototype._getLocalChannels=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,q.of(this._iid).getChannelsFromCache(this._token,this.filter,this.order)];case 1:return[2,e.sent()]}}))}))},t.prototype._getRemoteChannels=function(){return e(this,void 0,void 0,(function(){var e,t,a;return n(this,(function(n){switch(n.label){case 0:return[4,q.of(this._iid).getMyGroupChannels(this._token,d(d({},this.filter),{order:this.order}),this._limit)];case 1:return e=n.sent(),t=e.channels,a=e.token,this._token=a,[2,t]}}))}))},t.prototype.loadMore=function(){return e(this,void 0,void 0,(function(){var t,a=this;return n(this,(function(r){switch(r.label){case 0:return this._hasMore?(t=[],[4,p((function(){return e(a,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,this._getLocalChannels()];case 1:return t=e.sent(),[2]}}))}))}))]):[3,3];case 1:return r.sent(),[4,p((function(){return e(a,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,this._getRemoteChannels()];case 1:return t=e.sent(),[2]}}))}))}))];case 2:return r.sent(),this._addChannelsToView(t,te.REQUEST_CHANNEL,!0),[2,t];case 3:return[2,[]]}}))}))},t.prototype.dispose=function(){q.of(this._iid).unsubscribeGroupChannelEvent(this._key)},t}(),ke=function(e){function t(t){void 0===t&&(t={});var n=e.call(this)||this;return Object.keys(t).forEach((function(e){n.hasOwnProperty(e)&&(n[e]=t[e])})),n}return m(t,e),t}(function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.onUserJoined=f,t.onUserLeft=f,t.onUserReceivedInvitation=f,t.onUserDeclinedInvitation=f,t.onChannelHidden=f,t.onUnreadMemberStatusUpdated=f,t.onUndeliveredMemberStatusUpdated=f,t.onTypingStatusUpdated=f,t}return m(t,e),t}(_e)),Me=function(e){function t(t){var n=this,a=t.token,r=t.limit,i=t.order,s=t.includeEmpty,o=t.membershipFilter,u=t.channelNameContainsFilter,l=t.channelUrlsFilter,h=t.customTypesFilter,c=t.customTypeStartsWithFilter,d=t.superChannelFilter,p=t.metadataOrderKeyFilter,m=t.metadataKey,f=t.metadataValues,_=t.metadataValueStartsWith,y=t.includeFrozen,b=t.includeMetaData;return(n=e.call(this)||this).method=v.GET,n.path=C,n.params=g({token:a,limit:r,order:i,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:s,public_mode:ue.PUBLIC,public_membership_mode:o,name_contains:u,channel_urls:l,custom_types:h,custom_type_startswith:c,super_mode:d,metadata_order_key:p,metadata_key:m,metadata_values:f,metadata_value_startswith:_,show_frozen:y,show_metadata:b}),n}return m(t,e),t}(b),Ge=function(e){function t(t,n){var a=e.call(this,t,n)||this;a.token=null,a.channels=[],a.ts=null;var r=n.next,i=n.channels,s=n.ts;return a.token=r,i&&i.length>0&&(a.channels=i.map((function(e){return e.ts=s,new le(t,e)}))),a.ts="number"==typeof s?s:null,a}return m(t,e),t}(k);!function(e){e.ALL="all",e.JOINED="joined"}(ye||(ye={}));var Ee=function(t){function r(e,n){var a,r,i,s,o,u,l,h,c,d,p,m,f,v,_=this;return(_=t.call(this,e,n)||this).includeEmpty=!1,_.includeFrozen=!0,_.includeMetaData=!0,_.channelUrlsFilter=null,_.customTypesFilter=null,_.customTypeStartsWithFilter=null,_.nicknameContainsFilter=null,_.channelNameContainsFilter=null,_.membershipFilter=ye.ALL,_.superChannelFilter=he.ALL,_.metadataKey=null,_.metadataValues=null,_.metadataOrderKeyFilter=null,_.metadataValueStartsWith=null,_.order=ce.CHRONOLOGICAL,_.includeEmpty=null!==(a=n.includeEmpty)&&void 0!==a&&a,_.includeFrozen=null===(r=n.includeFrozen)||void 0===r||r,_.includeMetaData=null===(i=n.includeMetaData)||void 0===i||i,_.channelUrlsFilter=null!==(s=n.channelUrlsFilter)&&void 0!==s?s:null,_.customTypesFilter=null!==(o=n.customTypesFilter)&&void 0!==o?o:null,_.customTypeStartsWithFilter=null!==(u=n.customTypeStartsWithFilter)&&void 0!==u?u:null,_.channelNameContainsFilter=null!==(l=n.channelNameContainsFilter)&&void 0!==l?l:null,_.membershipFilter=null!==(h=n.membershipFilter)&&void 0!==h?h:ye.ALL,_.superChannelFilter=null!==(c=n.superChannelFilter)&&void 0!==c?c:he.ALL,_.metadataKey=null!==(d=n.metadataKey)&&void 0!==d?d:null,_.metadataValues=null!==(p=n.metadataValues)&&void 0!==p?p:null,_.metadataOrderKeyFilter=null!==(m=n.metadataOrderKeyFilter)&&void 0!==m?m:null,_.metadataValueStartsWith=null!==(f=n.metadataValueStartsWith)&&void 0!==f?f:null,_.order=null!==(v=n.order)&&void 0!==v?v:ce.CHRONOLOGICAL,_}return m(r,t),r.prototype._validate=function(){return t.prototype._validate.call(this)&&M("boolean",this.includeEmpty)&&M("boolean",this.includeFrozen)&&M("boolean",this.includeMetaData)&&M("string",this.channelNameContainsFilter,!0)&&N("string",this.channelUrlsFilter,!0)&&N("string",this.customTypesFilter,!0)&&M("string",this.customTypeStartsWithFilter,!0)&&T(ye,this.membershipFilter)&&T(he,this.superChannelFilter)&&T(ce,this.order)&&M("string",this.metadataOrderKeyFilter,!0)&&M("string",this.metadataKey,!0)&&N("string",this.metadataValues,!0)&&M("string",this.metadataValueStartsWith,!0)},r.prototype.next=function(){return e(this,void 0,void 0,(function(){var e,t,r,i,o,u,l,h,c;return n(this,(function(n){switch(n.label){case 0:return this._validate()?this._isLoading?[3,3]:(e=[],this._hasNext?(this._isLoading=!0,t=a.of(this._iid),r=t.requestQueue,i=t.dispatcher,o=new Me(d(d({},this),{token:this._token})),[4,r.send(o)]):[3,2]):[3,5];case 1:return u=n.sent(),l=u.as(Ge),h=l.channels,c=l.token,this._token=c,this._hasNext=!!c,i.dispatch(new de({channels:h,source:te.REQUEST_CHANNEL})),this._isLoading=!1,[2,h];case 2:return[2,e];case 3:throw s.queryInProgress;case 4:return[3,6];case 5:throw s.invalidParameters;case 6:return[2]}}))}))},r}(P),Se=function(t){function a(){var e=null!==t&&t.apply(this,arguments)||this;return e.name="groupChannel",e}return m(a,t),a.prototype.init=function(e,n){var a=n.sdkState,r=n.dispatcher,i=n.sessionManager,s=n.requestQueue,o=n.logger,u=n.cacheContext;t.prototype.init.call(this,e,{sdkState:a,dispatcher:r,sessionManager:i,requestQueue:s,logger:o,cacheContext:u}),this._manager=new q(e,{sdkState:a,cacheContext:u,dispatcher:r,sessionManager:i,requestQueue:s,logger:o})},a.prototype.createGroupChannelCollection=function(e){return void 0===e&&(e={}),new Fe(this._iid,e)},a.prototype.createMyGroupChannelListQuery=function(e){return void 0===e&&(e={}),new pe(this._iid,e)},a.prototype.createPublicGroupChannelListQuery=function(e){return void 0===e&&(e={}),new Ee(this._iid,e)},a.prototype.addGroupChannelHandler=function(e,t){x(M("string",e)&&t instanceof ke).throw(s.invalidParameters),this._manager.addHandler(e,t)},a.prototype.removeGroupChannelHandler=function(e){x(M("string",e)).throw(s.invalidParameters),this._manager.removeHandler(e)},a.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},a.prototype.buildGroupChannelFromSerializedData=function(e){return this._manager.buildGroupChannelFromSerializedData(e)},a.prototype.buildGroupChannelListQueryFromSerializedData=function(e){return this._manager.buildGroupChannelListQueryFromSerializedData(e)},a.prototype.buildMemberFromSerializedData=function(e){return this._manager.buildMemberFromSerializedData(e)},a.prototype.getChannel=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(M("string",t)).throw(s.invalidParameters),[2,this._manager.getChannel(t)]}))}))},a.prototype.getChannelWithoutCache=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(M("string",t)).throw(s.invalidParameters),[2,this._manager.getChannelWithoutCache(t)]}))}))},a.prototype.getMyGroupChannelChangeLogsByToken=function(t,a){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(M("string",t)&&a instanceof me&&a.validate()).throw(s.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,a)];case 1:return[2,e.sent()]}}))}))},a.prototype.getMyGroupChannelChangeLogsByTimestamp=function(t,a){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(M("number",t)&&a instanceof me&&a.validate()).throw(s.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(t,a)];case 1:return[2,e.sent()]}}))}))},a.prototype.getGroupChannelCount=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof fe&&t.validate()).throw(s.invalidParameters),[2,this._manager.getGroupChannelCount(t)]}))}))},a.prototype.createChannel=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof ve&&t.validate()).throw(s.invalidParameters),[2,this._manager.createChannel(t)]}))}))},a.prototype.createDistinctChannelIfNotExist=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(t instanceof ve&&t.validate()).throw(s.invalidParameters),t&&(t.isDistinct=!0),[2,this.createChannel(t)]}))}))},a.prototype.createChannelWithUserIds=function(t,a,r,i,s,o){return void 0===a&&(a=!1),void 0===r&&(r=null),void 0===i&&(i=null),void 0===s&&(s=""),void 0===o&&(o=""),e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=new ve).addUserIds(t),e.isDistinct=a,e.name=r,e.data=s,e.customType=o,"string"==typeof i?e.coverUrl=i:e.coverImage=i,[2,this.createChannel(e)]}))}))},a.prototype.markAsReadAll=function(){return e(this,void 0,void 0,(function(){return n(this,(function(e){return this._manager.markAsReadAll(),[2]}))}))},a.prototype.markAsReadWithChannelUrls=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return x(N("string",t)).throw(s.invalidParameters),this._manager.markAsReadWithChannelUrls(t),[2]}))}))},a.prototype.markAsDelivered=function(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return x(M("string",t)).throw(s.invalidParameters),[4,this.getChannel(t)];case 1:return[4,e.sent().markAsDelivered()];case 2:return e.sent(),[2]}}))}))},a}(D);export{Fe as GroupChannelCollection,ke as GroupChannelHandler,Se as GroupChannelModule,Ee as PublicGroupChannelListQuery};

@@ -1,1 +0,1 @@

export{ay as AdminMessage,aq as AppleCriticalAlertOptions,aN as BaseMessage,T as FileMessage,Y as FileMessageCreateParams,aR as FileMessageCreateParamsProperties,aM as FileMessageUpdateParams,aS as FileMessageUpdateParamsProperties,av as MentionType,aJ as MessageChangeLogsParams,aT as MessageChangeLogsParamsProperties,aI as MessageListParams,aU as MessageListParamsProperties,ap as MessageMetaArray,E as MessageModule,at as MessageRequestHandler,aV as MessageRetrievalParams,aW as MessageRetrievalParamsProperties,aX as MessageSearchOrder,M as MessageSearchQuery,K as MessageType,J as MessageTypeFilter,aY as OGImage,aZ as OGMetaData,aE as PreviousMessageListQuery,aw as PushNotificationDeliveryOption,a_ as Reaction,aA as ReactionEvent,a$ as ReactionEventOperation,O as ReplyType,ad as RequestState,b0 as ScheduledStatus,ar as ScheduledUserMessage,au as ScheduledUserMessageParams,b1 as ScheduledUserMessageParamsProperties,aF as Sender,b2 as ThreadInfo,aB as ThreadInfoUpdateEvent,b3 as ThreadedMessageListParams,b4 as ThreadedMessageListParamsProperties,b5 as Thumbnail,Q as UserMessage,Z as UserMessageCreateParams,b6 as UserMessageCreateParamsProperties,aL as UserMessageUpdateParams,b7 as UserMessageUpdateParamsProperties}from"./__bundle-a953c60c.js";
export{ay as AdminMessage,aq as AppleCriticalAlertOptions,aN as BaseMessage,X as FileMessage,Z as FileMessageCreateParams,aR as FileMessageCreateParamsProperties,aM as FileMessageUpdateParams,aS as FileMessageUpdateParamsProperties,av as MentionType,aJ as MessageChangeLogsParams,aT as MessageChangeLogsParamsProperties,aI as MessageListParams,aU as MessageListParamsProperties,ap as MessageMetaArray,F as MessageModule,at as MessageRequestHandler,aV as MessageRetrievalParams,aW as MessageRetrievalParamsProperties,aX as MessageSearchOrder,M as MessageSearchQuery,N as MessageType,K as MessageTypeFilter,aY as OGImage,aZ as OGMetaData,aE as PreviousMessageListQuery,aw as PushNotificationDeliveryOption,a_ as Reaction,aA as ReactionEvent,a$ as ReactionEventOperation,Q as ReplyType,b0 as ScheduledStatus,ar as ScheduledUserMessage,au as ScheduledUserMessageParams,b1 as ScheduledUserMessageParamsProperties,aF as Sender,ae as SendingStatus,b2 as ThreadInfo,aB as ThreadInfoUpdateEvent,b3 as ThreadedMessageListParams,b4 as ThreadedMessageListParamsProperties,b5 as Thumbnail,T as UserMessage,$ as UserMessageCreateParams,b6 as UserMessageCreateParamsProperties,aL as UserMessageUpdateParams,b7 as UserMessageUpdateParamsProperties}from"./__bundle-1d33b216.js";

@@ -1,1 +0,1 @@

import{_ as n,d as e,e as t,I as r,b as a,a as i,i as s,A as o,aP as u,aQ as c,h as l,k as h,a8 as d,U as p,W as f,aa as v,ab as C,p as _,t as y,ag as m,w as g,F as U,ah as E,u as w,S as T,ao as N,V as H,j as O,a9 as I,g as M,X as b,n as x,B as D,aO as P}from"./__bundle-a953c60c.js";import{U as A,e as L,F as R,h as k,g as F,f as S,i as q,j as Q,k as z,C as K,l as W,T as j,m as B,D as G,n as X,o as V,p as Z,q as Y,A as $,a as J}from"./__bundle-459ad47d.js";import{B as nn}from"./__bundle-6cc2e604.js";var en=function(r){function a(){var n=null!==r&&r.apply(this,arguments)||this;return n._channels=new Map,n._enteredChannelUrls=[],n}return n(a,r),Object.defineProperty(a.prototype,"enteredChannels",{get:function(){var n=this;return this._enteredChannelUrls.map((function(e){return n._channels.get(e)})).filter((function(n){return null!==n}))},enumerable:!1,configurable:!0}),a.prototype.isEnteredChannel=function(n){return this._enteredChannelUrls.includes(n)},a.prototype.enter=function(n){this._enteredChannelUrls.indexOf(n)<0&&this._enteredChannelUrls.push(n)},a.prototype.exit=function(n){var e=this._enteredChannelUrls.indexOf(n);e>=0&&this._enteredChannelUrls.splice(e,1)},a.prototype.exitAll=function(){this._enteredChannelUrls=[]},a.prototype.get=function(n){var r;return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,null!==(r=this._channels.get(n))&&void 0!==r?r:null]}))}))},a.prototype.upsert=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){return n.forEach((function(n){if(e._channels.has(n.url)){var t=e._channels.get(n.url);Object.assign(t,n)}else e._channels.set(n.url,n)})),[2]}))}))},a.prototype.remove=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return this._channels.delete(n),this.exit(n),[2]}))}))},a.prototype.clear=function(){return e(this,void 0,void 0,(function(){return t(this,(function(n){return this._channels.clear(),this._enteredChannelUrls=[],[2]}))}))},a}(r),tn=function(){this.channelUrl=null,this.name=null,this.coverUrlOrImage=null,this.data=null,this.customType=null,this.operatorUserIds=null},rn=function(e){function t(n){var t=e.call(this)||this;if(n)for(var r in n)t.hasOwnProperty(r)&&(t[r]=n[r]);return t}return n(t,e),t.prototype.validate=function(){return a("string",this.operatorUserIds,!0)&&(i("string",this.coverUrlOrImage)||s(this.coverUrlOrImage)||null===this.coverUrlOrImage)&&i("string",this.name,!0)&&i("string",this.data,!0)&&i("string",this.customType,!0)&&(i("string",this.channelUrl)&&/^\w+$/.test(this.channelUrl)||null===this.channelUrl)},t}(tn),an=function(e){function t(n){var t=n.channelUrl,r=n.isInternalCall,a=e.call(this)||this;return a.method=o.GET,a.path="".concat(r?u:c,"/").concat(encodeURIComponent(t)),a}return n(t,e),t}(l),sn=function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=null,r.channel=new En(n,t),r}return n(t,e),t}(h),on=function(e){function t(n){var t=this,r=n.channelUrl,a=n.coverUrlOrImage,u=n.name,l=n.data,h=n.customType,d=n.operatorUserIds;return(t=e.call(this)||this).method=o.POST,t.path=c,t.params={channel_url:r,cover_url:i("string",a)?a:null,cover_file:s(a)?a:null,name:u,data:l,custom_type:h,operators:d},t}return n(t,e),t}(l);!function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=new En(n,t),r}n(t,e)}(h);var un=function(e){function t(n){var t=n.channelUrl;return e.call(this,{code:"ENTR",payload:{channel_url:t},ackRequired:!0})||this}return n(t,e),t}(d),cn=function(e){function t(n,t,r){var a,i,s=this;return s=e.call(this,n,"ENTR",r)||this,r.data&&(s.participantCount=null!==(a=r.data.participant_count)&&void 0!==a?a:0,s.user=new p(n,r.data),s.ts=null!==(i=r.data.edge_ts)&&void 0!==i?i:0),s}return n(t,e),t}(f),ln=function(e){function t(n){var t=n.channelUrl;return e.call(this,{code:"EXIT",payload:{channel_url:t},ackRequired:!0})||this}return n(t,e),t}(d),hn=function(e){function t(n,t,r){var a,i,s=this;return s=e.call(this,n,"EXIT",r)||this,r.data&&(s.participantCount=null!==(a=r.data.participant_count)&&void 0!==a?a:0,s.user=new p(n,r.data),s.ts=null!==(i=r.data.edge_ts)&&void 0!==i?i:0),s}return n(t,e),t}(f),dn={},pn=function(){function n(n,e){var t=e.sdkState,r=e.dispatcher,a=e.requestQueue,i=this;this._sdkState=t,this._requestQueue=a,this._dispatcher=r,this._openChannelCache=new en(n),this._openChannelHandlers=new Map,this._dispatcher.on((function(n){var e,t;if(n instanceof f)i._handleEvent(n);else if(n instanceof v&&n.stateType===C.CONNECTED){var r=i._openChannelCache.enteredChannels;try{for(var a=_(r),s=a.next();!s.done;s=a.next()){s.value.enter()}}catch(n){e={error:n}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}}})),dn[n]=this}return n.of=function(n){return dn[n]},n.prototype.buildOpenChannelFromSerializedData=function(n){var e=y(n);return new En(e._iid,En.payloadify(e))},n.prototype.getChannelFromCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this._openChannelCache.get(n)];case 1:return[2,e.sent()]}}))}))},n.prototype.upsertChannelsToCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this._openChannelCache.upsert(n)];case 1:return e.sent(),[2]}}))}))},n.prototype.removeChannelsFromCache=function(n){return e(this,void 0,void 0,(function(){var e,r,a,i,s,o;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),e=_(n),r=e.next(),t.label=1;case 1:return r.done?[3,4]:(a=r.value,[4,this._openChannelCache.remove(a)]);case 2:t.sent(),t.label=3;case 3:return r=e.next(),[3,1];case 4:return[3,7];case 5:return i=t.sent(),s={error:i},[3,7];case 6:try{r&&!r.done&&(o=e.return)&&o.call(e)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}))},n.prototype.setEnteredToCache=function(n){this._openChannelCache.enter(n.url)},n.prototype.setExitedToCache=function(n){this._openChannelCache.exit(n.url)},n.prototype._handleEvent=function(n){return e(this,void 0,void 0,(function(){var r,a,i,s,o,u,c,l,h,d,p,f,v,C,y,w,T,N,H,O,I,M,b,x,D,P,J,nn,en,tn,rn,an,sn,on,un,ln,dn,pn,fn,vn,Cn,_n,yn,mn,gn,Un,En,wn,Tn,Nn,Hn,On,In,Mn,bn,xn,Dn,Pn,An,Ln=this;return t(this,(function(Rn){switch(Rn.label){case 0:switch(Rn.trys.push([0,51,,52]),n.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"MRCT":return[3,10];case"MTHD":return[3,13];case"MCNT":return[3,16];case"SYEV":return[3,27]}return[3,50];case 1:return s=null,"MESG"===n.code?s=n.as(Y):"FILE"===n.code?s=n.as(E):"ADMM"!==n.code&&"BRDM"!=n.code||(s=n.as($)),s?(r=s.message,a=s.isMentioned,r.channelType!==U.OPEN?[3,3]:[4,this.getChannel(r.channelUrl,!0)]):[3,3];case 2:i=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,s,o,u;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())s=e.value,this._openChannelCache.isEnteredChannel(i.url)&&s.onMessageReceived(i,r),a&&s.onMentionReceived(i,r)}catch(n){o={error:n}}finally{try{e&&!e.done&&(u=n.return)&&u.call(n)}finally{if(o)throw o.error}}return[2]}))}))})),Rn.label=3;case 3:return[3,50];case 4:return s=null,"MEDI"===n.code?s=n.as(X):"FEDI"===n.code?s=n.as(V):"AEDI"===n.code&&(s=n.as(Z)),s?(o=s.message).channelType!==U.OPEN?[3,6]:[4,this.getChannel(o.channelUrl,!0)]:[3,6];case 5:u=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a,i;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())r=e.value,this._openChannelCache.isEnteredChannel(u.url)&&r.onMessageUpdated(u,o)}catch(n){a={error:n}}finally{try{e&&!e.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}return[2]}))}))})),Rn.label=6;case 6:return[3,50];case 7:return c=n.as(G),I=c.channelUrl,p=c.channelType,l=c.messageId,p!==U.OPEN?[3,9]:[4,this.getChannel(I,!0)];case 8:h=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a,i;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())r=e.value,this._openChannelCache.isEnteredChannel(h.url)&&r.onMessageDeleted(h,l)}catch(n){a={error:n}}finally{try{e&&!e.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}return[2]}))}))})),Rn.label=9;case 9:return[3,50];case 10:return d=n.as(B),I=d.channelUrl,p=d.channelType,f=d.event,p!==U.OPEN?[3,12]:[4,this.getChannel(I,!0)];case 11:v=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onReactionUpdated(v,f)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=12;case 12:return[3,50];case 13:return(C=n.as(j).event).channelType!==U.OPEN?[3,15]:[4,this.getChannel(C.channelUrl,!0)];case 14:y=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onThreadInfoUpdated(y,C)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=15;case 15:return[3,50];case 16:w=n.as(W).openChannelMemberCounts,T=[],Rn.label=17;case 17:Rn.trys.push([17,22,23,24]),N=_(w),H=N.next(),Rn.label=18;case 18:return H.done?[3,21]:(O=H.value,I=O.channelUrl,an=O.participantCount,M=O.updatedAt,[4,this.getChannelFromCache(I)]);case 19:(b=Rn.sent())&&b._updateParticipantCount(an,M)&&T.push(b),Rn.label=20;case 20:return H=N.next(),[3,18];case 21:return[3,24];case 22:return x=Rn.sent(),Pn={error:x},[3,24];case 23:try{H&&!H.done&&(An=N.return)&&An.call(N)}finally{if(Pn)throw Pn.error}return[7];case 24:return T.length>0?[4,this.upsertChannelsToCache(T)]:[3,26];case 25:Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onChannelMemberCountChanged(T)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=26;case 26:return[3,50];case 27:if(!(D=n.as(K).event).isOpenChannelEvent)return[3,49];switch(D.category){case k.CHANNEL_ENTER:return[3,28];case k.CHANNEL_EXIT:return[3,30];case k.CHANNEL_OPERATOR_UPDATE:return[3,32];case k.USER_CHANNEL_MUTE:case k.USER_CHANNEL_UNMUTE:return[3,34];case k.USER_CHANNEL_BAN:case k.USER_CHANNEL_UNBAN:return[3,36];case k.CHANNEL_FREEZE:case k.CHANNEL_UNFREEZE:return[3,38];case k.CHANNEL_DELETED:return[3,40];case k.CHANNEL_PROP_CHANGED:return[3,43];case k.CHANNEL_META_DATA_CHANGED:return[3,45];case k.CHANNEL_META_COUNTERS_CHANGED:return[3,47]}return[3,49];case 28:return[4,this.getChannel(D.channelUrl,!0)];case 29:return P=Rn.sent(),J=n.as(cn),an=J.participantCount,nn=J.user,en=P._updateParticipantCount(an,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onUserEntered(P,nn),en&&n.onChannelParticipantCountChanged(P)})),[2]}))}))})),[3,49];case 30:return[4,this.getChannel(D.channelUrl,!0)];case 31:return tn=Rn.sent(),rn=n.as(hn),an=rn.participantCount,sn=rn.user,on=tn._updateParticipantCount(an,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onUserExited(tn,sn),on&&n.onChannelParticipantCountChanged(tn)})),[2]}))}))})),[3,49];case 32:return[4,this.getChannel(D.channelUrl,!0)];case 33:return un=Rn.sent(),ln=n.as(z).operators,un.operators=ln,this.upsertChannelsToCache([un]),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onOperatorUpdated(un,ln)})),[2]}))}))})),[3,49];case 34:return[4,this.getChannel(D.channelUrl,!0)];case 35:return dn=Rn.sent(),pn=D.category===k.USER_CHANNEL_MUTE,fn=n.as(pn?q:Q).user,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){pn?n.onUserMuted(dn,fn):n.onUserUnmuted(dn,fn)})),[2]}))}))})),[3,49];case 36:return[4,this.getChannel(D.channelUrl,!0)];case 37:return vn=Rn.sent(),Cn=D.category===k.USER_CHANNEL_BAN,_n=n.as(Cn?F:S).user,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){Cn?n.onUserBanned(vn,_n):n.onUserUnbanned(vn,_n)})),[2]}))}))})),[3,49];case 38:return[4,this.getChannel(D.channelUrl,!0)];case 39:return yn=Rn.sent(),mn=n.as(R).freeze,yn.isFrozen=mn,this.upsertChannelsToCache([yn]),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){mn?n.onChannelFrozen(yn):n.onChannelUnfrozen(yn)})),[2]}))}))})),[3,49];case 40:return[4,this.getChannel(D.channelUrl,!0)];case 41:return gn=Rn.sent(),[4,this.removeChannelsFromCache([gn.url])];case 42:return Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onChannelDeleted(gn.url,gn.channelType)})),[2]}))}))})),[3,49];case 43:return[4,this.getChannelWithoutCache(D.channelUrl,!0)];case 44:return Un=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onChannelChanged(Un)})),[2]}))}))})),[3,49];case 45:return[4,this.getChannel(D.channelUrl,!0)];case 46:return En=Rn.sent(),wn=n.as(L),Tn=wn.created,Nn=wn.updated,Hn=wn.deleted,Tn&&En._upsertCachedMetaData(Tn,D.ts),Nn&&En._upsertCachedMetaData(Nn,D.ts),Hn&&En._removeFromCachedMetaData(Hn,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){Tn&&n.onMetaDataCreated(En,Tn),Nn&&n.onMetaDataUpdated(En,Nn),Hn&&n.onMetaDataDeleted(En,Hn)})),[2]}))}))})),[3,49];case 47:return[4,this.getChannel(D.channelUrl,!0)];case 48:return On=Rn.sent(),In=n.as(A),Mn=In.created,bn=In.updated,xn=In.deleted,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){Mn&&n.onMetaCounterCreated(On,Mn),bn&&n.onMetaCounterUpdated(On,bn),xn&&n.onMetaCounterDeleted(On,xn)})),[2]}))}))})),[3,49];case 49:return[3,50];case 50:return[3,52];case 51:if(Dn=Rn.sent(),m(Dn))throw Dn;return[3,52];case 52:return[2]}}))}))},n.prototype.addHandler=function(n,e){this._openChannelHandlers.set(n,e)},n.prototype.removeHandler=function(n){this._openChannelHandlers.delete(n)},n.prototype.clearHandler=function(){this._openChannelHandlers.clear()},n.prototype.getChannel=function(n,r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:w(i("string",n)).throw(T.invalidParameters),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.getChannelFromCache(n)];case 2:return(e=t.sent())?[2,e]:[3,4];case 3:return t.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(n)];case 5:return[2,t.sent()]}}))}))},n.prototype.getChannelWithoutCache=function(n,r){return void 0===r&&(r=!1),e(this,void 0,void 0,(function(){var e,a,s;return t(this,(function(t){switch(t.label){case 0:return w(i("string",n)).throw(T.invalidParameters),e=new an({channelUrl:n,isInternalCall:r}),[4,this._requestQueue.send(e)];case 1:return a=t.sent(),s=a.as(sn).channel,[4,this.upsertChannelsToCache([s])];case 2:return t.sent(),[2,s]}}))}))},n.prototype.createChannel=function(n){return e(this,void 0,void 0,(function(){var e,r,a;return t(this,(function(t){switch(t.label){case 0:return w(n instanceof rn&&n.validate()).throw(T.invalidParameters),e=new on(n),[4,this._requestQueue.send(e)];case 1:return r=t.sent(),a=r.as(sn).channel,this.upsertChannelsToCache([a]),[2,a]}}))}))},n}(),fn=function(){this.name=null,this.coverUrlOrImage=null,this.data=null,this.customType=null,this.operatorUserIds=null},vn=function(e){function t(n){var t=e.call(this)||this;if(n)for(var r in n)t.hasOwnProperty(r)&&(t[r]=n[r]);return t}return n(t,e),t.prototype.validate=function(){return a("string",this.operatorUserIds,!0)&&(i("string",this.coverUrlOrImage)||s(this.coverUrlOrImage)||null===this.coverUrlOrImage)&&i("string",this.name,!0)&&i("string",this.data,!0)&&i("string",this.customType,!0)},t}(fn),Cn=function(e){function t(n){var t=this,r=n.channelUrl,a=n.token,i=n.limit;return(t=e.call(this)||this).method=o.GET,t.path="".concat(c,"/").concat(encodeURIComponent(r),"/participants"),t.params={token:a,limit:i},t}return n(t,e),t}(l),_n=function(e){function t(n,t){var r=e.call(this,n,t)||this;r.token=null,r.participants=[];var a=t.next,i=t.participants;return r.token=a,r.participants=i.map((function(e){return new p(n,e)})),r}return n(t,e),t}(h),yn=function(r){function a(n,e,t){return r.call(this,n,e,U.OPEN,t)||this}return n(a,r),a.prototype._validate=function(){return r.prototype._validate.call(this)},a.prototype.next=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,n=H.of(this._iid).requestQueue,e=new Cn(O(O({},this),{token:this._token})),[4,n.send(e)]):[3,2]:[3,5];case 1:return r=t.sent(),a=r.as(_n),i=a.participants,s=a.token,this._token=s,this._hasNext=!!s,this._isLoading=!1,[2,i];case 2:return[2,[]];case 3:throw T.queryInProgress;case 4:return[3,6];case 5:throw T.invalidParameters;case 6:return[2]}}))}))},a}(N),mn=function(e){function t(n){var t=this,r=n.channelUrl,a=n.coverUrlOrImage,u=n.name,l=n.data,h=n.customType,d=n.operatorUserIds;return(t=e.call(this)||this).method=o.PUT,t.path="".concat(c,"/").concat(encodeURIComponent(r)),t.params={cover_url:i("string",a)?a:null,cover_file:s(a)?a:null,name:u,data:l,custom_type:h,operators:d},t}return n(t,e),t}(l),gn=function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=new En(n,t),r}return n(t,e),t}(h),Un=function(e){function t(n){var t=this,r=n.channelUrl;return(t=e.call(this)||this).method=o.DELETE,t.path="".concat(c,"/").concat(encodeURIComponent(r)),t}return n(t,e),t}(l);!function(e){function t(n,t){return e.call(this,n,t)||this}n(t,e)}(h);var En=function(r){function a(n,e){var t,a=this;return(a=r.call(this,n,e)||this)._lastParticipantCountUpdated=0,a.participantCount=0,a.operators=[],a.channelType=U.OPEN,a.participantCount=null!==(t=e.participant_count)&&void 0!==t?t:0,a.operators=Array.isArray(e.operators)?e.operators.map((function(e){return new p(n,e)})):[],a}return n(a,r),a.payloadify=function(n){return n?M(O(O({},J.payloadify(n)),{participant_count:n.participantCount,operators:n.operators.map((function(n){return p.payloadify(n)}))})):null},a.prototype.serialize=function(){return I(this)},a.prototype.isOperator=function(n){return n instanceof p?this.isOperator(n.userId):this.operators.some((function(e){return e.userId===n}))},a.prototype._updateParticipantCount=function(n,e){return e>this._lastParticipantCountUpdated&&(this.participantCount=n,this._lastParticipantCountUpdated=e,!0)},a.prototype.createParticipantListQuery=function(n){return new yn(this._iid,this.url,n)},a.prototype.refresh=function(){return e(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return[4,pn.of(this._iid).getChannelWithoutCache(this.url)];case 1:return[2,n.sent()]}}))}))},a.prototype.enter=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new un({channelUrl:this.url}),[4,n.send(e)];case 1:return r=t.sent(),a=r.as(cn),i=a.participantCount,s=a.ts,this._updateParticipantCount(i,s),pn.of(this._iid).setEnteredToCache(this),[2]}}))}))},a.prototype.exit=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new ln({channelUrl:this.url}),[4,n.send(e)];case 1:return r=t.sent(),a=r.as(hn),i=a.participantCount,s=a.ts,this._updateParticipantCount(i,s),pn.of(this._iid).setExitedToCache(this),b.of(this._iid).fileMessageQueue.cancel(this),[2]}}))}))},a.prototype.updateChannel=function(n){return e(this,void 0,void 0,(function(){var e,r,a,i;return t(this,(function(t){switch(t.label){case 0:return w(n instanceof vn&&n.validate()).throw(T.invalidParameters),e=H.of(this._iid).requestQueue,r=new mn(O({channelUrl:this.url},n)),[4,e.send(r)];case 1:return a=t.sent(),i=a.as(gn).channel,[4,pn.of(this._iid).upsertChannelsToCache([i])];case 2:return t.sent(),[2,i]}}))}))},a.prototype.updateChannelWithOperatorUserIds=function(n,r,a,i,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){return(e=new vn).name=n,e.coverUrlOrImage=r,e.data=a,e.operatorUserIds=i,e.customType=s,[2,this.updateChannel(e)]}))}))},a.prototype.delete=function(){return e(this,void 0,void 0,(function(){var n,e;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new Un({channelUrl:this.url}),[4,n.send(e)];case 1:return t.sent(),[4,pn.of(this._iid).removeChannelsFromCache([this.url])];case 2:return t.sent(),[2]}}))}))},a}(J),wn=function(e){function t(n){void 0===n&&(n={});var t=e.call(this)||this;return Object.keys(n).forEach((function(e){t.hasOwnProperty(e)&&(t[e]=n[e])})),t}return n(t,e),t}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.onUserEntered=x,n.onUserExited=x,n.onChannelParticipantCountChanged=x,n}return n(t,e),t}(nn)),Tn=function(e){function t(n){var t=this,r=n.token,a=n.limit,i=n.nameKeyword,s=n.urlKeyword,u=n.customTypes,l=n.includeFrozen,h=n.includeMetaData;return(t=e.call(this)||this).method=o.GET,t.path=c,t.params=M({token:r,limit:a,name_contains:i,url_contains:s,custom_types:u,show_frozen:l,show_metadata:h}),t}return n(t,e),t}(l),Nn=function(e){function t(n,t){var r=e.call(this,n,t)||this;r.token=null,r.channels=[],r.ts=null;var a=t.next,i=t.channels,s=t.ts;return r.token=a,i&&i.length>0&&(r.channels=i.map((function(e){return new En(n,e)}))),r.ts="number"==typeof s?s:null,r}return n(t,e),t}(h),Hn=function(r){function s(n,e){var t,a,i,s,o,u=this;return(u=r.call(this,n,e)||this).includeFrozen=!0,u.includeMetaData=!0,u.nameKeyword=null,u.urlKeyword=null,u.customTypes=null,u.includeFrozen=null===(t=e.includeFrozen)||void 0===t||t,u.includeMetaData=null===(a=e.includeMetaData)||void 0===a||a,u.nameKeyword=null!==(i=e.nameKeyword)&&void 0!==i?i:null,u.urlKeyword=null!==(s=e.urlKeyword)&&void 0!==s?s:null,u.customTypes=null!==(o=e.customTypes)&&void 0!==o?o:null,u}return n(s,r),s.prototype._validate=function(){return r.prototype._validate.call(this)&&i("boolean",this.includeFrozen)&&i("boolean",this.includeMetaData)&&i("string",this.nameKeyword,!0)&&i("string",this.urlKeyword,!0)&&a("string",this.customTypes,!0)},s.prototype.next=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return this._validate()?this._isLoading?[3,4]:this._hasNext?(this._isLoading=!0,n=H.of(this._iid).requestQueue,e=new Tn(O(O({},this),{token:this._token})),[4,n.send(e)]):[3,3]:[3,6];case 1:return r=t.sent(),a=r.as(Nn),i=a.channels,s=a.token,this._token=s,this._hasNext=!!s,[4,pn.of(this._iid).upsertChannelsToCache(i)];case 2:return t.sent(),this._isLoading=!1,[2,i];case 3:return[2,[]];case 4:throw T.queryInProgress;case 5:return[3,7];case 6:throw T.invalidParameters;case 7:return[2]}}))}))},s}(D),On=function(r){function a(){var n=null!==r&&r.apply(this,arguments)||this;return n.name="openChannel",n}return n(a,r),a.prototype.init=function(n,e){var t=e.sdkState,a=e.dispatcher,i=e.sessionManager,s=e.requestQueue,o=e.logger,u=e.cacheContext;r.prototype.init.call(this,n,{sdkState:t,dispatcher:a,sessionManager:i,requestQueue:s,logger:o,cacheContext:u}),this._manager=new pn(n,{sdkState:t,dispatcher:a,requestQueue:s})},a.prototype.createOpenChannelListQuery=function(n){return void 0===n&&(n={}),new Hn(this._iid,n)},a.prototype.addOpenChannelHandler=function(n,e){this._manager.addHandler(n,e)},a.prototype.removeOpenChannelHandler=function(n){this._manager.removeHandler(n)},a.prototype.removeAllOpenChannelHandlers=function(){this._manager.clearHandler()},a.prototype.buildOpenChannelFromSerializedData=function(n){return this._manager.buildOpenChannelFromSerializedData(n)},a.prototype.getChannel=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.getChannel(n)]}))}))},a.prototype.getChannelWithoutCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.getChannelWithoutCache(n)]}))}))},a.prototype.createChannel=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.createChannel(n)]}))}))},a.prototype.createChannelWithOperatorUserIds=function(n,r,a,i,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){return(e=new rn).name=n,e.coverUrlOrImage=r,e.data=a,e.operatorUserIds=i,e.customType=s,[2,this._manager.createChannel(e)]}))}))},a}(P);export{En as OpenChannel,rn as OpenChannelCreateParams,tn as OpenChannelCreateParamsProperties,wn as OpenChannelHandler,Hn as OpenChannelListQuery,On as OpenChannelModule,vn as OpenChannelUpdateParams,fn as OpenChannelUpdateParamsProperties,yn as ParticipantListQuery};
import{_ as n,d as e,e as t,I as r,b as a,a as i,i as s,A as o,aP as u,aQ as c,h as l,k as h,a9 as d,U as p,W as f,ab as v,ac as C,p as _,t as y,ah as m,w as g,G as U,ai as E,u as w,S as T,ao as N,V as H,j as b,aa as O,g as I,Y as M,n as x,B as D,aO as P}from"./__bundle-1d33b216.js";import{U as A,e as L,F as R,h as k,g as F,f as S,i as q,j as Q,k as z,C as K,l as G,T as W,m as j,D as B,n as X,o as V,p as Y,q as Z,A as $,a as J}from"./__bundle-a7378a38.js";import{B as nn}from"./__bundle-07c194b5.js";var en=function(r){function a(){var n=null!==r&&r.apply(this,arguments)||this;return n._channels=new Map,n._enteredChannelUrls=[],n}return n(a,r),Object.defineProperty(a.prototype,"enteredChannels",{get:function(){var n=this;return this._enteredChannelUrls.map((function(e){return n._channels.get(e)})).filter((function(n){return null!==n}))},enumerable:!1,configurable:!0}),a.prototype.isEnteredChannel=function(n){return this._enteredChannelUrls.includes(n)},a.prototype.enter=function(n){this._enteredChannelUrls.indexOf(n)<0&&this._enteredChannelUrls.push(n)},a.prototype.exit=function(n){var e=this._enteredChannelUrls.indexOf(n);e>=0&&this._enteredChannelUrls.splice(e,1)},a.prototype.exitAll=function(){this._enteredChannelUrls=[]},a.prototype.get=function(n){var r;return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,null!==(r=this._channels.get(n))&&void 0!==r?r:null]}))}))},a.prototype.upsert=function(n){return e(this,void 0,void 0,(function(){var e=this;return t(this,(function(t){return n.forEach((function(n){if(e._channels.has(n.url)){var t=e._channels.get(n.url);Object.assign(t,n)}else e._channels.set(n.url,n)})),[2]}))}))},a.prototype.remove=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return this._channels.delete(n),this.exit(n),[2]}))}))},a.prototype.clear=function(){return e(this,void 0,void 0,(function(){return t(this,(function(n){return this._channels.clear(),this._enteredChannelUrls=[],[2]}))}))},a}(r),tn=function(){this.channelUrl=null,this.name=null,this.coverUrlOrImage=null,this.data=null,this.customType=null,this.operatorUserIds=null},rn=function(e){function t(n){var t=e.call(this)||this;if(n)for(var r in n)t.hasOwnProperty(r)&&(t[r]=n[r]);return t}return n(t,e),t.prototype.validate=function(){return a("string",this.operatorUserIds,!0)&&(i("string",this.coverUrlOrImage)||s(this.coverUrlOrImage)||null===this.coverUrlOrImage)&&i("string",this.name,!0)&&i("string",this.data,!0)&&i("string",this.customType,!0)&&(i("string",this.channelUrl)&&/^\w+$/.test(this.channelUrl)||null===this.channelUrl)},t}(tn),an=function(e){function t(n){var t=n.channelUrl,r=n.isInternalCall,a=e.call(this)||this;return a.method=o.GET,a.path="".concat(r?u:c,"/").concat(encodeURIComponent(t)),a}return n(t,e),t}(l),sn=function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=null,r.channel=new En(n,t),r}return n(t,e),t}(h),on=function(e){function t(n){var t=this,r=n.channelUrl,a=n.coverUrlOrImage,u=n.name,l=n.data,h=n.customType,d=n.operatorUserIds;return(t=e.call(this)||this).method=o.POST,t.path=c,t.params={channel_url:r,cover_url:i("string",a)?a:null,cover_file:s(a)?a:null,name:u,data:l,custom_type:h,operators:d},t}return n(t,e),t}(l);!function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=new En(n,t),r}n(t,e)}(h);var un=function(e){function t(n){var t=n.channelUrl;return e.call(this,{code:"ENTR",payload:{channel_url:t},ackRequired:!0})||this}return n(t,e),t}(d),cn=function(e){function t(n,t,r){var a,i,s=this;return s=e.call(this,n,"ENTR",r)||this,r.data&&(s.participantCount=null!==(a=r.data.participant_count)&&void 0!==a?a:0,s.user=new p(n,r.data),s.ts=null!==(i=r.data.edge_ts)&&void 0!==i?i:0),s}return n(t,e),t}(f),ln=function(e){function t(n){var t=n.channelUrl;return e.call(this,{code:"EXIT",payload:{channel_url:t},ackRequired:!0})||this}return n(t,e),t}(d),hn=function(e){function t(n,t,r){var a,i,s=this;return s=e.call(this,n,"EXIT",r)||this,r.data&&(s.participantCount=null!==(a=r.data.participant_count)&&void 0!==a?a:0,s.user=new p(n,r.data),s.ts=null!==(i=r.data.edge_ts)&&void 0!==i?i:0),s}return n(t,e),t}(f),dn={},pn=function(){function n(n,e){var t=e.sdkState,r=e.dispatcher,a=e.requestQueue,i=this;this._sdkState=t,this._requestQueue=a,this._dispatcher=r,this._openChannelCache=new en(n),this._openChannelHandlers=new Map,this._dispatcher.on((function(n){var e,t;if(n instanceof f)i._handleEvent(n);else if(n instanceof v&&n.stateType===C.CONNECTED){var r=i._openChannelCache.enteredChannels;try{for(var a=_(r),s=a.next();!s.done;s=a.next()){s.value.enter()}}catch(n){e={error:n}}finally{try{s&&!s.done&&(t=a.return)&&t.call(a)}finally{if(e)throw e.error}}}})),dn[n]=this}return n.of=function(n){return dn[n]},n.prototype.buildOpenChannelFromSerializedData=function(n){var e=y(n);return new En(e._iid,En.payloadify(e))},n.prototype.getChannelFromCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this._openChannelCache.get(n)];case 1:return[2,e.sent()]}}))}))},n.prototype.upsertChannelsToCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){switch(e.label){case 0:return[4,this._openChannelCache.upsert(n)];case 1:return e.sent(),[2]}}))}))},n.prototype.removeChannelsFromCache=function(n){return e(this,void 0,void 0,(function(){var e,r,a,i,s,o;return t(this,(function(t){switch(t.label){case 0:t.trys.push([0,5,6,7]),e=_(n),r=e.next(),t.label=1;case 1:return r.done?[3,4]:(a=r.value,[4,this._openChannelCache.remove(a)]);case 2:t.sent(),t.label=3;case 3:return r=e.next(),[3,1];case 4:return[3,7];case 5:return i=t.sent(),s={error:i},[3,7];case 6:try{r&&!r.done&&(o=e.return)&&o.call(e)}finally{if(s)throw s.error}return[7];case 7:return[2]}}))}))},n.prototype.setEnteredToCache=function(n){this._openChannelCache.enter(n.url)},n.prototype.setExitedToCache=function(n){this._openChannelCache.exit(n.url)},n.prototype._handleEvent=function(n){return e(this,void 0,void 0,(function(){var r,a,i,s,o,u,c,l,h,d,p,f,v,C,y,w,T,N,H,b,O,I,M,x,D,P,J,nn,en,tn,rn,an,sn,on,un,ln,dn,pn,fn,vn,Cn,_n,yn,mn,gn,Un,En,wn,Tn,Nn,Hn,bn,On,In,Mn,xn,Dn,Pn,An,Ln=this;return t(this,(function(Rn){switch(Rn.label){case 0:switch(Rn.trys.push([0,51,,52]),n.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"MRCT":return[3,10];case"MTHD":return[3,13];case"MCNT":return[3,16];case"SYEV":return[3,27]}return[3,50];case 1:return s=null,"MESG"===n.code?s=n.as(Z):"FILE"===n.code?s=n.as(E):"ADMM"!==n.code&&"BRDM"!=n.code||(s=n.as($)),s?(r=s.message,a=s.isMentioned,r.channelType!==U.OPEN?[3,3]:[4,this.getChannel(r.channelUrl,!0)]):[3,3];case 2:i=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,s,o,u;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())s=e.value,this._openChannelCache.isEnteredChannel(i.url)&&s.onMessageReceived(i,r),a&&s.onMentionReceived(i,r)}catch(n){o={error:n}}finally{try{e&&!e.done&&(u=n.return)&&u.call(n)}finally{if(o)throw o.error}}return[2]}))}))})),Rn.label=3;case 3:return[3,50];case 4:return s=null,"MEDI"===n.code?s=n.as(X):"FEDI"===n.code?s=n.as(V):"AEDI"===n.code&&(s=n.as(Y)),s?(o=s.message).channelType!==U.OPEN?[3,6]:[4,this.getChannel(o.channelUrl,!0)]:[3,6];case 5:u=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a,i;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())r=e.value,this._openChannelCache.isEnteredChannel(u.url)&&r.onMessageUpdated(u,o)}catch(n){a={error:n}}finally{try{e&&!e.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}return[2]}))}))})),Rn.label=6;case 6:return[3,50];case 7:return c=n.as(B),O=c.channelUrl,p=c.channelType,l=c.messageId,p!==U.OPEN?[3,9]:[4,this.getChannel(O,!0)];case 8:h=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a,i;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())r=e.value,this._openChannelCache.isEnteredChannel(h.url)&&r.onMessageDeleted(h,l)}catch(n){a={error:n}}finally{try{e&&!e.done&&(i=n.return)&&i.call(n)}finally{if(a)throw a.error}}return[2]}))}))})),Rn.label=9;case 9:return[3,50];case 10:return d=n.as(j),O=d.channelUrl,p=d.channelType,f=d.event,p!==U.OPEN?[3,12]:[4,this.getChannel(O,!0)];case 11:v=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onReactionUpdated(v,f)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=12;case 12:return[3,50];case 13:return(C=n.as(W).event).channelType!==U.OPEN?[3,15]:[4,this.getChannel(C.channelUrl,!0)];case 14:y=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onThreadInfoUpdated(y,C)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=15;case 15:return[3,50];case 16:w=n.as(G).openChannelMemberCounts,T=[],Rn.label=17;case 17:Rn.trys.push([17,22,23,24]),N=_(w),H=N.next(),Rn.label=18;case 18:return H.done?[3,21]:(b=H.value,O=b.channelUrl,an=b.participantCount,I=b.updatedAt,[4,this.getChannelFromCache(O)]);case 19:(M=Rn.sent())&&M._updateParticipantCount(an,I)&&T.push(M),Rn.label=20;case 20:return H=N.next(),[3,18];case 21:return[3,24];case 22:return x=Rn.sent(),Pn={error:x},[3,24];case 23:try{H&&!H.done&&(An=N.return)&&An.call(N)}finally{if(Pn)throw Pn.error}return[7];case 24:return T.length>0?[4,this.upsertChannelsToCache(T)]:[3,26];case 25:Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){var n,e,r,a;return t(this,(function(t){try{for(n=_(this._openChannelHandlers.values()),e=n.next();!e.done;e=n.next())e.value.onChannelMemberCountChanged(T)}catch(n){r={error:n}}finally{try{e&&!e.done&&(a=n.return)&&a.call(n)}finally{if(r)throw r.error}}return[2]}))}))})),Rn.label=26;case 26:return[3,50];case 27:if(!(D=n.as(K).event).isOpenChannelEvent)return[3,49];switch(D.category){case k.CHANNEL_ENTER:return[3,28];case k.CHANNEL_EXIT:return[3,30];case k.CHANNEL_OPERATOR_UPDATE:return[3,32];case k.USER_CHANNEL_MUTE:case k.USER_CHANNEL_UNMUTE:return[3,34];case k.USER_CHANNEL_BAN:case k.USER_CHANNEL_UNBAN:return[3,36];case k.CHANNEL_FREEZE:case k.CHANNEL_UNFREEZE:return[3,38];case k.CHANNEL_DELETED:return[3,40];case k.CHANNEL_PROP_CHANGED:return[3,43];case k.CHANNEL_META_DATA_CHANGED:return[3,45];case k.CHANNEL_META_COUNTERS_CHANGED:return[3,47]}return[3,49];case 28:return[4,this.getChannel(D.channelUrl,!0)];case 29:return P=Rn.sent(),J=n.as(cn),an=J.participantCount,nn=J.user,en=P._updateParticipantCount(an,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onUserEntered(P,nn),en&&n.onChannelParticipantCountChanged(P)})),[2]}))}))})),[3,49];case 30:return[4,this.getChannel(D.channelUrl,!0)];case 31:return tn=Rn.sent(),rn=n.as(hn),an=rn.participantCount,sn=rn.user,on=tn._updateParticipantCount(an,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onUserExited(tn,sn),on&&n.onChannelParticipantCountChanged(tn)})),[2]}))}))})),[3,49];case 32:return[4,this.getChannel(D.channelUrl,!0)];case 33:return un=Rn.sent(),ln=n.as(z).operators,un.operators=ln,this.upsertChannelsToCache([un]),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onOperatorUpdated(un,ln)})),[2]}))}))})),[3,49];case 34:return[4,this.getChannel(D.channelUrl,!0)];case 35:return dn=Rn.sent(),pn=D.category===k.USER_CHANNEL_MUTE,fn=n.as(pn?q:Q).user,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){pn?n.onUserMuted(dn,fn):n.onUserUnmuted(dn,fn)})),[2]}))}))})),[3,49];case 36:return[4,this.getChannel(D.channelUrl,!0)];case 37:return vn=Rn.sent(),Cn=D.category===k.USER_CHANNEL_BAN,_n=n.as(Cn?F:S).user,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){Cn?n.onUserBanned(vn,_n):n.onUserUnbanned(vn,_n)})),[2]}))}))})),[3,49];case 38:return[4,this.getChannel(D.channelUrl,!0)];case 39:return yn=Rn.sent(),mn=n.as(R).freeze,yn.isFrozen=mn,this.upsertChannelsToCache([yn]),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){mn?n.onChannelFrozen(yn):n.onChannelUnfrozen(yn)})),[2]}))}))})),[3,49];case 40:return[4,this.getChannel(D.channelUrl,!0)];case 41:return gn=Rn.sent(),[4,this.removeChannelsFromCache([gn.url])];case 42:return Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onChannelDeleted(gn.url,gn.channelType)})),[2]}))}))})),[3,49];case 43:return[4,this.getChannelWithoutCache(D.channelUrl,!0)];case 44:return Un=Rn.sent(),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){n.onChannelChanged(Un)})),[2]}))}))})),[3,49];case 45:return[4,this.getChannel(D.channelUrl,!0)];case 46:return En=Rn.sent(),wn=n.as(L),Tn=wn.created,Nn=wn.updated,Hn=wn.deleted,Tn&&En._upsertCachedMetaData(Tn,D.ts),Nn&&En._upsertCachedMetaData(Nn,D.ts),Hn&&En._removeFromCachedMetaData(Hn,D.ts),g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){Tn&&n.onMetaDataCreated(En,Tn),Nn&&n.onMetaDataUpdated(En,Nn),Hn&&n.onMetaDataDeleted(En,Hn)})),[2]}))}))})),[3,49];case 47:return[4,this.getChannel(D.channelUrl,!0)];case 48:return bn=Rn.sent(),On=n.as(A),In=On.created,Mn=On.updated,xn=On.deleted,g((function(){return e(Ln,void 0,void 0,(function(){return t(this,(function(n){return this._openChannelHandlers.forEach((function(n){In&&n.onMetaCounterCreated(bn,In),Mn&&n.onMetaCounterUpdated(bn,Mn),xn&&n.onMetaCounterDeleted(bn,xn)})),[2]}))}))})),[3,49];case 49:return[3,50];case 50:return[3,52];case 51:if(Dn=Rn.sent(),m(Dn))throw Dn;return[3,52];case 52:return[2]}}))}))},n.prototype.addHandler=function(n,e){this._openChannelHandlers.set(n,e)},n.prototype.removeHandler=function(n){this._openChannelHandlers.delete(n)},n.prototype.clearHandler=function(){this._openChannelHandlers.clear()},n.prototype.getChannel=function(n,r){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){switch(t.label){case 0:w(i("string",n)).throw(T.invalidParameters),t.label=1;case 1:return t.trys.push([1,3,,4]),[4,this.getChannelFromCache(n)];case 2:return(e=t.sent())?[2,e]:[3,4];case 3:return t.sent(),[3,4];case 4:return[4,this.getChannelWithoutCache(n)];case 5:return[2,t.sent()]}}))}))},n.prototype.getChannelWithoutCache=function(n,r){return void 0===r&&(r=!1),e(this,void 0,void 0,(function(){var e,a,s;return t(this,(function(t){switch(t.label){case 0:return w(i("string",n)).throw(T.invalidParameters),e=new an({channelUrl:n,isInternalCall:r}),[4,this._requestQueue.send(e)];case 1:return a=t.sent(),s=a.as(sn).channel,[4,this.upsertChannelsToCache([s])];case 2:return t.sent(),[2,s]}}))}))},n.prototype.createChannel=function(n){return e(this,void 0,void 0,(function(){var e,r,a;return t(this,(function(t){switch(t.label){case 0:return w(n instanceof rn&&n.validate()).throw(T.invalidParameters),e=new on(n),[4,this._requestQueue.send(e)];case 1:return r=t.sent(),a=r.as(sn).channel,this.upsertChannelsToCache([a]),[2,a]}}))}))},n}(),fn=function(){this.name=null,this.coverUrlOrImage=null,this.data=null,this.customType=null,this.operatorUserIds=null},vn=function(e){function t(n){var t=e.call(this)||this;if(n)for(var r in n)t.hasOwnProperty(r)&&(t[r]=n[r]);return t}return n(t,e),t.prototype.validate=function(){return a("string",this.operatorUserIds,!0)&&(i("string",this.coverUrlOrImage)||s(this.coverUrlOrImage)||null===this.coverUrlOrImage)&&i("string",this.name,!0)&&i("string",this.data,!0)&&i("string",this.customType,!0)},t}(fn),Cn=function(e){function t(n){var t=this,r=n.channelUrl,a=n.token,i=n.limit;return(t=e.call(this)||this).method=o.GET,t.path="".concat(c,"/").concat(encodeURIComponent(r),"/participants"),t.params={token:a,limit:i},t}return n(t,e),t}(l),_n=function(e){function t(n,t){var r=e.call(this,n,t)||this;r.token=null,r.participants=[];var a=t.next,i=t.participants;return r.token=a,r.participants=i.map((function(e){return new p(n,e)})),r}return n(t,e),t}(h),yn=function(r){function a(n,e,t){return r.call(this,n,e,U.OPEN,t)||this}return n(a,r),a.prototype._validate=function(){return r.prototype._validate.call(this)},a.prototype.next=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,n=H.of(this._iid).requestQueue,e=new Cn(b(b({},this),{token:this._token})),[4,n.send(e)]):[3,2]:[3,5];case 1:return r=t.sent(),a=r.as(_n),i=a.participants,s=a.token,this._token=s,this._hasNext=!!s,this._isLoading=!1,[2,i];case 2:return[2,[]];case 3:throw T.queryInProgress;case 4:return[3,6];case 5:throw T.invalidParameters;case 6:return[2]}}))}))},a}(N),mn=function(e){function t(n){var t=this,r=n.channelUrl,a=n.coverUrlOrImage,u=n.name,l=n.data,h=n.customType,d=n.operatorUserIds;return(t=e.call(this)||this).method=o.PUT,t.path="".concat(c,"/").concat(encodeURIComponent(r)),t.params={cover_url:i("string",a)?a:null,cover_file:s(a)?a:null,name:u,data:l,custom_type:h,operators:d},t}return n(t,e),t}(l),gn=function(e){function t(n,t){var r=e.call(this,n,t)||this;return r.channel=new En(n,t),r}return n(t,e),t}(h),Un=function(e){function t(n){var t=this,r=n.channelUrl;return(t=e.call(this)||this).method=o.DELETE,t.path="".concat(c,"/").concat(encodeURIComponent(r)),t}return n(t,e),t}(l);!function(e){function t(n,t){return e.call(this,n,t)||this}n(t,e)}(h);var En=function(r){function a(n,e){var t,a=this;return(a=r.call(this,n,e)||this)._lastParticipantCountUpdated=0,a.participantCount=0,a.operators=[],a.channelType=U.OPEN,a.participantCount=null!==(t=e.participant_count)&&void 0!==t?t:0,a.operators=Array.isArray(e.operators)?e.operators.map((function(e){return new p(n,e)})):[],a}return n(a,r),a.payloadify=function(n){return n?I(b(b({},J.payloadify(n)),{participant_count:n.participantCount,operators:n.operators.map((function(n){return p.payloadify(n)}))})):null},a.prototype.serialize=function(){return O(this)},a.prototype.isOperator=function(n){return n instanceof p?this.isOperator(n.userId):this.operators.some((function(e){return e.userId===n}))},a.prototype._updateParticipantCount=function(n,e){return e>this._lastParticipantCountUpdated&&(this.participantCount=n,this._lastParticipantCountUpdated=e,!0)},a.prototype.createParticipantListQuery=function(n){return new yn(this._iid,this.url,n)},a.prototype.refresh=function(){return e(this,void 0,void 0,(function(){return t(this,(function(n){switch(n.label){case 0:return[4,pn.of(this._iid).getChannelWithoutCache(this.url)];case 1:return[2,n.sent()]}}))}))},a.prototype.enter=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new un({channelUrl:this.url}),[4,n.send(e)];case 1:return r=t.sent(),a=r.as(cn),i=a.participantCount,s=a.ts,this._updateParticipantCount(i,s),pn.of(this._iid).setEnteredToCache(this),[2]}}))}))},a.prototype.exit=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new ln({channelUrl:this.url}),[4,n.send(e)];case 1:return r=t.sent(),a=r.as(hn),i=a.participantCount,s=a.ts,this._updateParticipantCount(i,s),pn.of(this._iid).setExitedToCache(this),M.of(this._iid).fileMessageQueue.cancel(this),[2]}}))}))},a.prototype.updateChannel=function(n){return e(this,void 0,void 0,(function(){var e,r,a,i;return t(this,(function(t){switch(t.label){case 0:return w(n instanceof vn&&n.validate()).throw(T.invalidParameters),e=H.of(this._iid).requestQueue,r=new mn(b({channelUrl:this.url},n)),[4,e.send(r)];case 1:return a=t.sent(),i=a.as(gn).channel,[4,pn.of(this._iid).upsertChannelsToCache([i])];case 2:return t.sent(),[2,i]}}))}))},a.prototype.updateChannelWithOperatorUserIds=function(n,r,a,i,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){return(e=new vn).name=n,e.coverUrlOrImage=r,e.data=a,e.operatorUserIds=i,e.customType=s,[2,this.updateChannel(e)]}))}))},a.prototype.delete=function(){return e(this,void 0,void 0,(function(){var n,e;return t(this,(function(t){switch(t.label){case 0:return n=H.of(this._iid).requestQueue,e=new Un({channelUrl:this.url}),[4,n.send(e)];case 1:return t.sent(),[4,pn.of(this._iid).removeChannelsFromCache([this.url])];case 2:return t.sent(),[2]}}))}))},a}(J),wn=function(e){function t(n){void 0===n&&(n={});var t=e.call(this)||this;return Object.keys(n).forEach((function(e){t.hasOwnProperty(e)&&(t[e]=n[e])})),t}return n(t,e),t}(function(e){function t(){var n=null!==e&&e.apply(this,arguments)||this;return n.onUserEntered=x,n.onUserExited=x,n.onChannelParticipantCountChanged=x,n}return n(t,e),t}(nn)),Tn=function(e){function t(n){var t=this,r=n.token,a=n.limit,i=n.nameKeyword,s=n.urlKeyword,u=n.customTypes,l=n.includeFrozen,h=n.includeMetaData;return(t=e.call(this)||this).method=o.GET,t.path=c,t.params=I({token:r,limit:a,name_contains:i,url_contains:s,custom_types:u,show_frozen:l,show_metadata:h}),t}return n(t,e),t}(l),Nn=function(e){function t(n,t){var r=e.call(this,n,t)||this;r.token=null,r.channels=[],r.ts=null;var a=t.next,i=t.channels,s=t.ts;return r.token=a,i&&i.length>0&&(r.channels=i.map((function(e){return new En(n,e)}))),r.ts="number"==typeof s?s:null,r}return n(t,e),t}(h),Hn=function(r){function s(n,e){var t,a,i,s,o,u=this;return(u=r.call(this,n,e)||this).includeFrozen=!0,u.includeMetaData=!0,u.nameKeyword=null,u.urlKeyword=null,u.customTypes=null,u.includeFrozen=null===(t=e.includeFrozen)||void 0===t||t,u.includeMetaData=null===(a=e.includeMetaData)||void 0===a||a,u.nameKeyword=null!==(i=e.nameKeyword)&&void 0!==i?i:null,u.urlKeyword=null!==(s=e.urlKeyword)&&void 0!==s?s:null,u.customTypes=null!==(o=e.customTypes)&&void 0!==o?o:null,u}return n(s,r),s.prototype._validate=function(){return r.prototype._validate.call(this)&&i("boolean",this.includeFrozen)&&i("boolean",this.includeMetaData)&&i("string",this.nameKeyword,!0)&&i("string",this.urlKeyword,!0)&&a("string",this.customTypes,!0)},s.prototype.next=function(){return e(this,void 0,void 0,(function(){var n,e,r,a,i,s;return t(this,(function(t){switch(t.label){case 0:return this._validate()?this._isLoading?[3,4]:this._hasNext?(this._isLoading=!0,n=H.of(this._iid).requestQueue,e=new Tn(b(b({},this),{token:this._token})),[4,n.send(e)]):[3,3]:[3,6];case 1:return r=t.sent(),a=r.as(Nn),i=a.channels,s=a.token,this._token=s,this._hasNext=!!s,[4,pn.of(this._iid).upsertChannelsToCache(i)];case 2:return t.sent(),this._isLoading=!1,[2,i];case 3:return[2,[]];case 4:throw T.queryInProgress;case 5:return[3,7];case 6:throw T.invalidParameters;case 7:return[2]}}))}))},s}(D),bn=function(r){function a(){var n=null!==r&&r.apply(this,arguments)||this;return n.name="openChannel",n}return n(a,r),a.prototype.init=function(n,e){var t=e.sdkState,a=e.dispatcher,i=e.sessionManager,s=e.requestQueue,o=e.logger,u=e.cacheContext;r.prototype.init.call(this,n,{sdkState:t,dispatcher:a,sessionManager:i,requestQueue:s,logger:o,cacheContext:u}),this._manager=new pn(n,{sdkState:t,dispatcher:a,requestQueue:s})},a.prototype.createOpenChannelListQuery=function(n){return void 0===n&&(n={}),new Hn(this._iid,n)},a.prototype.addOpenChannelHandler=function(n,e){this._manager.addHandler(n,e)},a.prototype.removeOpenChannelHandler=function(n){this._manager.removeHandler(n)},a.prototype.removeAllOpenChannelHandlers=function(){this._manager.clearHandler()},a.prototype.buildOpenChannelFromSerializedData=function(n){return this._manager.buildOpenChannelFromSerializedData(n)},a.prototype.getChannel=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.getChannel(n)]}))}))},a.prototype.getChannelWithoutCache=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.getChannelWithoutCache(n)]}))}))},a.prototype.createChannel=function(n){return e(this,void 0,void 0,(function(){return t(this,(function(e){return[2,this._manager.createChannel(n)]}))}))},a.prototype.createChannelWithOperatorUserIds=function(n,r,a,i,s){return e(this,void 0,void 0,(function(){var e;return t(this,(function(t){return(e=new rn).name=n,e.coverUrlOrImage=r,e.data=a,e.operatorUserIds=i,e.customType=s,[2,this._manager.createChannel(e)]}))}))},a}(P);export{En as OpenChannel,rn as OpenChannelCreateParams,tn as OpenChannelCreateParamsProperties,wn as OpenChannelHandler,Hn as OpenChannelListQuery,bn as OpenChannelModule,vn as OpenChannelUpdateParams,fn as OpenChannelUpdateParamsProperties,yn as ParticipantListQuery};
{
"version": "4.0.0-beta.4",
"version": "4.0.0-beta.6",
"description": "Sendbird SDK for JavaScript",

@@ -23,2 +23,3 @@ "name": "@sendbird/chat",

"exports": {
"./package.json": "./package.json",
".": "./bundles/sendbird.js",

@@ -29,2 +30,3 @@ "./message": "./bundles/message.js",

},
"react-native": "./bundles/sendbird.js",
"typesVersions": {

@@ -31,0 +33,0 @@ "*": {

@@ -5,3 +5,3 @@ # [Sendbird](https://sendbird.com) Chat SDK for JavaScript

![Languages](https://img.shields.io/badge/language-TYPESCRIPT-orange.svg)
[![npm](https://img.shields.io/npm/v/sendbird.svg?style=popout&colorB=red)](https://www.npmjs.com/package/@sendbird/chat)
[![npm](https://img.shields.io/npm/v/@sendbird/chat.svg?style=popout&colorB=red)](https://www.npmjs.com/package/@sendbird/chat)

@@ -8,0 +8,0 @@ ## Table of contents

@@ -705,9 +705,2 @@ declare class AdminMessage extends BaseMessage {

declare enum RequestState {
PENDING = 'pending',
FAILED = 'failed',
CANCELED = 'canceled',
SUCCEEDED = 'succeeded',
}
declare class RestrictedUser extends User {

@@ -737,3 +730,3 @@ readonly restrictionInfo: RestrictionInfo;

replyToChannel: boolean;
requestState: RequestState;
sendingStatus: SendingStatus;
requestedMentionUserIds: string[];

@@ -882,2 +875,9 @@ errorCode: number;

declare enum SendingStatus {
PENDING = 'pending',
FAILED = 'failed',
CANCELED = 'canceled',
SUCCEEDED = 'succeeded',
}
declare class SessionHandler {

@@ -884,0 +884,0 @@ onSessionExpired: () => void;

@@ -34,3 +34,2 @@ export {

ReplyType,
RequestState,
ScheduledStatus,

@@ -41,2 +40,3 @@ ScheduledUserMessage,

Sender,
SendingStatus,
ThreadedMessageListParams,

@@ -43,0 +43,0 @@ ThreadedMessageListParamsProperties,

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc