(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[799],{12088:function(){},18897:function(a,b,c){"use strict";c.d(b,{A1:function(){return e},HO:function(){return d},Sq:function(){return am},y3:function(){return ah}});var d,e,f,g,h=c(84663),i=c(35058),j=c(50926),k=c(89531),l=c(73576),m=function(a){function b(b){var c=b.aiAgentId,d=b.userId,e=b.language,f=b.country,g=b.context,i=b.forceCreateChannel,j=b.knownActiveChannelUrl,k=b.shouldSendFirstMessage,l=b.agentVersion,m=a.call(this)||this;return m.method=h.A.POST,m.path="".concat(h.by,"/ai_agents/").concat(encodeURIComponent(c),"/messenger_settings"),m.requireAuth=!1,m.params=(0,h.f)({user_id:d,country:f,language:e,context:g,force_create:i,known_active_channel_url:j,should_send_first_message:k,agent_version:l}),m}return(0,h.c)(b,a),b}(h.h),n=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.settings=c,d}return(0,h.c)(b,a),b}(h.j),o=function(a){function b(b){var c=b.aiAgentId,d=b.authorizationCodes,e=a.call(this)||this;return e.method=h.A.POST,e.path="".concat(h.by,"/ai_agents/").concat(encodeURIComponent(c),"/customer_provided_auth_codes"),e.params={cpa_authorization_codes:d.map(function(a){var b=a.key,c=a.code,d=a.redirectURI;return(0,h.f)({key:b,code:c,redirect_uri:d})})},e}return(0,h.c)(b,a),b}(h.h),p=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.cpaAuthorizations=c.cpa_authorizations.map(function(a){var b=a.key,c=a.status,d=a.error_code,e=a.error_message;return(0,h.f)({key:b,status:c,errorCode:null!=d?d:void 0,errorMessage:null!=e?e:void 0})}),d}return(0,h.c)(b,a),b}(h.j),q=function(a){function b(b){var c=b.aiAgentId,d=b.key,e=b.context,f=b.language,g=a.call(this)||this;return g.method=h.A.POST,g.path="".concat(h.by,"/ai_agents/").concat(encodeURIComponent(c),"/nudge_messages"),g.params=(0,h.f)({event_key:d,language:f,context:e}),g}return(0,h.c)(b,a),b}(h.h),r=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.response=c,d}return(0,h.c)(b,a),b}(h.j),s=function(a){function b(b){var c=this,d=b.token,e=b.limit,f=b.aiAgentId,g=b.status,i=b.reverse,j=b.order;return(c=a.call(this)||this).method=h.A.GET,c.path="".concat(h.by,"/my_conversations"),c.params=(0,h.f)({token:d,limit:e,reverse:i,order:j,status:g,bot_userid:f}),c}return(0,h.c)(b,a),b}(h.h),t=function(a){function b(b,c){var d=a.call(this,b,c)||this;d.conversations=[];var e=c.next_token,f=c.conversations;return d.token=e,f&&f.length>0&&(d.conversations=f.map(function(a){return new i.J(a)})),d}return(0,h.c)(b,a),b}(h.j),u={limit:10},v=function(a){function b(b){var c=this,d=b.limit,e=void 0===d?u.limit:d,f=b.keys,g=b.token;return(c=a.call(this)||this).method=h.A.GET,c.path="".concat(h.by,"/sdk_message_templates"),c.params=(0,h.f)({limit:e,keys:f,token:g}),c}return(0,h.c)(b,a),b}(h.h),w=function(a){function b(b,c){var d=a.call(this,b,c)||this,e=c.templates,f=c.template_list_token;return d.token=f,d.templates=e.map(function(a){return{template:JSON.stringify(a)}}),d}return(0,h.c)(b,a),b}(h.j),x=function(a){function b(b){var c=this,d=b.key;return(c=a.call(this)||this).method=h.A.GET,c.path="".concat(h.by,"/sdk_message_templates/").concat(d),c}return(0,h.c)(b,a),b}(h.h),y=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.template=JSON.stringify(c),d}return(0,h.c)(b,a),b}(h.j);(f=d||(d={})).INCLUDE="include",f.EXCLUDE="exclude",(g=e||(e={})).INCLUDE="include",g.EXCLUDE="exclude";var z,A,B={aiAgentChannelFilter:d.INCLUDE,aiAgentConversationStatusFilter:[i.K.OPEN,i.K.CLOSED],aiAgentIds:[],deskChannelFilter:e.INCLUDE,pinnedChannelUrls:[],copilotConversationOnly:!1,copilotSupportChannelUrl:void 0},C=function(a){function b(b){var c=a.call(this)||this,d=(0,h.d)((0,h.d)({},B),b),e=d.aiAgentChannelFilter,f=d.aiAgentIds,g=d.deskChannelFilter,i=d.aiAgentConversationStatusFilter,j=d.pinnedChannelUrls,k=d.copilotConversationOnly,l=d.copilotSupportChannelUrl,m=d.userId,n=d.token,o=d.limit;return c.method=h.A.GET,c.path="".concat(h.bE,"/").concat(encodeURIComponent(m),"/my_group_channels"),c.params=(0,h.f)({token:n,limit:o,ai_agent_channel_filter:e,desk_channel_filter:g,copilot_conversation_only:k,copilot_support_channel_url:l}),i&&i.length>0&&(c.params.ai_agent_conversation_status_filter=i),f&&f.length>0&&(c.params.ai_agent_ids=f),j&&j.length>0&&(c.params.pinned_channel_urls=j),c}return(0,h.c)(b,a),b}(h.h),D=function(a){function b(b,c){var d=a.call(this,b,c)||this;d.channels=[];var e=c.next,f=c.channels,g=c.ts;return d.token=e,f&&f.length>0&&(d.channels=f.map(function(a){return a.ts=g,new i.b(b,a)})),d.ts=null!=g?g:0,d}return(0,h.c)(b,a),b}(h.j),E={aiAgentChannelFilter:d.INCLUDE,aiAgentIds:[],deskChannelFilter:e.INCLUDE,pinnedChannelUrls:[],copilotConversationOnly:!1,copilotSupportChannelUrl:void 0},F=function(a){return(0,h.a5)(d,a.aiAgentChannelFilter,!0)&&(0,h.a2)("string",a.aiAgentIds,!0)&&(0,h.a5)(e,a.deskChannelFilter,!0)&&(0,h.a2)("string",a.pinnedChannelUrls,!0)&&(0,h.a)("boolean",a.copilotConversationOnly,!0)&&(0,h.a)("string",a.copilotSupportChannelUrl,!0)},G=function(a){function b(b){var c=b.userId,d=b.ts,e=b.token,f=b.params,g=a.call(this)||this,i=(0,h.d)((0,h.d)({},E),f),j=i.aiAgentChannelFilter,k=i.aiAgentIds,l=i.deskChannelFilter,m=i.pinnedChannelUrls,n=i.copilotConversationOnly,o=i.copilotSupportChannelUrl;return g.method=h.A.GET,g.path="".concat(h.bE,"/").concat(encodeURIComponent(c),"/my_group_channels/changelogs"),g.params=(0,h.f)({token:e,change_ts:d,ai_agent_channel_filter:j,desk_channel_filter:l,copilot_conversation_only:n,copilot_support_channel_url:o}),k&&k.length>0&&(g.params.ai_agent_ids=k),m&&m.length>0&&(g.params.pinned_channel_urls=m),g}return(0,h.c)(b,a),b}(h.h),H=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.updatedChannels=c.updated.map(function(a){var d=Object.assign(a,{ts:c.ts});return new i.b(b,d)}),d.deletedChannelUrls=c.deleted,d.hasMore=c.has_more,d.token=c.next,d.ts=c.ts,d}return(0,h.c)(b,a),b}(h.j),I={aiAgentChannelFilter:d.INCLUDE,aiAgentConversationStatusFilter:[i.K.OPEN,i.K.CLOSED],aiAgentIds:[],deskChannelFilter:e.INCLUDE,pinnedChannelUrls:[],copilotConversationOnly:!1,copilotSupportChannelUrl:void 0},J=function(a){function b(b){var c=b.userId,d=b.params,e=a.call(this)||this,f=(0,h.d)((0,h.d)({},I),d),g=f.aiAgentChannelFilter,i=f.aiAgentConversationStatusFilter,j=f.aiAgentIds,k=f.deskChannelFilter,l=f.pinnedChannelUrls,m=f.copilotConversationOnly,n=f.copilotSupportChannelUrl;return e.method=h.A.GET,e.path="".concat(h.bE,"/").concat(encodeURIComponent(c),"/my_group_channels/unread_message_count"),e.params=(0,h.f)({ai_agent_channel_filter:g,desk_channel_filter:k,copilot_conversation_only:m,copilot_support_channel_url:n}),i&&i.length>0&&(e.params.ai_agent_conversation_status_filter=i),j&&j.length>0&&(e.params.ai_agent_ids=j),l&&l.length>0&&(e.params.pinned_channel_urls=l),e}return(0,h.c)(b,a),b}(h.h),K=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.total=c.total,d.aiAgentChannelCount=c.ai_agent_channel,d.deskChannelCount=c.desk_channel,d.pinnedChannel=c.pinned_channel.map(function(a){return{channelUrl:a.channel_url,count:a.count}}),d}return(0,h.c)(b,a),b}(h.j),L=function(a){function b(b){var c=b.channelUrl,d=b.key,e=b.requestId,f=b.action,g=b.data,i=a.call(this)||this;return i.method=h.A.POST,i.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/challenge"),i.params=(0,h.f)((0,h.g)({key:d,request_id:e,action:f,data:g})),i}return(0,h.c)(b,a),b}(h.h),M=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.result=null!=c?c:{},d}return(0,h.c)(b,a),b}(h.j),N=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.key,f=b.data,g=a.call(this)||this;return g.method=h.A.POST,g.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/forms/").concat(encodeURIComponent(e),"/submit"),g.params=(0,h.f)((0,h.g)({data:f})),g}return(0,h.c)(b,a),b}(h.h),O=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.result=null!=c?c:{},d}return(0,h.c)(b,a),b}(h.j),P=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.key,f=a.call(this)||this;return f.method=h.A.POST,f.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/forms/").concat(encodeURIComponent(e),"/cancel"),f.params={},f}return(0,h.c)(b,a),b}(h.h),Q=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.key,f=b.channel,g=b.data,i=a.call(this)||this;return i.method=h.A.POST,i.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/otps/").concat(encodeURIComponent(e),"/request"),i.params=(0,h.f)((0,h.g)({channel:f,data:g})),i}return(0,h.c)(b,a),b}(h.h),R=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.result=null!=c?c:{},d}return(0,h.c)(b,a),b}(h.j),S=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.key,f=b.code,g=a.call(this)||this;return g.method=h.A.POST,g.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/otps/").concat(encodeURIComponent(e),"/verify"),g.params=(0,h.f)((0,h.g)({code:f})),g}return(0,h.c)(b,a),b}(h.h),T=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.result=null!=c?c:{},d}return(0,h.c)(b,a),b}(h.j),U=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.key,f=a.call(this)||this;return f.method=h.A.POST,f.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/otps/").concat(encodeURIComponent(e),"/cancel"),f.params={},f}return(0,h.c)(b,a),b}(h.h),V=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.rating,f=b.comment,g=a.call(this)||this;return g.method=h.A.POST,g.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/feedback"),g.params=(0,h.f)((0,h.g)({rating:e,comment:f})),g}return(0,h.c)(b,a),b}(h.h),W=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.id=c.id,d.rating=c.rating,d.comment=c.comment,d}return(0,h.c)(b,a),b}(h.j),X=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.rating,f=b.comment,g=a.call(this)||this;return g.method=h.A.PUT,g.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/feedback"),g.params=(0,h.f)((0,h.g)({rating:e,comment:f})),g}return(0,h.c)(b,a),b}(h.h),Y=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.id=c.id,d.rating=c.rating,d.comment=c.comment,d}return(0,h.c)(b,a),b}(h.j),Z=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=a.call(this)||this;return e.method=h.A.DELETE,e.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/feedback"),e.params={},e}return(0,h.c)(b,a),b}(h.h),$=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=b.status,f=b.detail,g=a.call(this)||this;return g.method=h.A.POST,g.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/user_action_messages"),g.params={status:e,detail:null!=f?f:""},g}return(0,h.c)(b,a),b}(h.h),_=function(a){function b(b){var c=b.channelUrl,d=b.messageId,e=a.call(this)||this;return e.method=h.A.POST,e.path="".concat(h.bx,"/").concat(encodeURIComponent(c),"/messages/").concat(encodeURIComponent(d),"/steward_tasks/cancel"),e.params={},e}return(0,h.c)(b,a),b}(h.h),aa=function(a){if("number"==typeof a)return Number.isSafeInteger(a)&&a>0?a:void 0;if("string"==typeof a&&0!==a.trim().length){var b=Number(a);return Number.isSafeInteger(b)&&b>0?b:void 0}},ab=function(){function a(a){var b=a.dispatcher;this._block=null,this._dispatcher=b}return a.prototype._isTargetChannel=function(a){var b;return a.hasAiBot&&!!(null===(b=a.conversation)|| void 0===b?void 0:b.aiAgentId)},a.prototype._blockOf=function(a){var b=this._block;return b&&b.channelUrl===a.url&&this._isTargetChannel(a)?b:null},a.prototype.onUserMessageSent=function(a,b){this._isTargetChannel(a)&&(this._block={channelUrl:a.url,conversationId:a.conversation.id,userMessageId:b,firstTypingStartTs:null,typingStartCount:0})},a.prototype._botBlockOf=function(a,b){var c=this._blockOf(a);return c&&b===a.conversation.aiAgentId?c:null},a.prototype.hasOpenBlockFor=function(a){var b;return(null===(b=this._block)|| void 0===b?void 0:b.channelUrl)===a},a.prototype.onTypingStart=function(a,b){var c=this._botBlockOf(a,b.userId);c&&(null===c.firstTypingStartTs&&(c.firstTypingStartTs=Date.now()),c.typingStartCount++)},a.prototype.onTypingEnd=function(a,b){var c=this._botBlockOf(a,b.userId);c&&null!==c.firstTypingStartTs&&this._commit(c,String(Date.now()-c.firstTypingStartTs))},a.prototype.onBotMessageUpdated=function(a,b,c){var d=this._botBlockOf(a,b);d&&function(a,b){var c;if(!a)return!1;try{var d=JSON.parse(a);if(!d||"object"!=typeof d)return!1;var e=d;if(!1!==e.stream)return!1;var f=null!==(c=aa(e.user_message_id))&& void 0!==c?c:aa(e.respond_mesg_id);return void 0===f||f===b}catch(g){return!1}}(c,d.userMessageId)&&(this._block=null)},a.prototype.onEnterBackground=function(){var a=this._block;a&&null!==a.firstTypingStartTs&&this._commit(a,"-1",{switch_to_background:!0})},a.prototype.clear=function(){this._block=null},a.prototype._commit=function(a,b,c){this._block=null,this._dispatcher.dispatch(new h.z(new h.B({type:h.D.AI_AGENT_ASSERTION,data:{key:"typing_event_duration",value:b,conversation_id:a.conversationId,extra:(0,h.d)({tpst_count:a.typingStartCount},c)}})))},a}(),ac=function(a){function b(b){var c=b.userId,d=b.params,e=a.call(this)||this;return e.method=h.A.PUT,e.path="".concat(h.bE,"/").concat(encodeURIComponent(c),"/memory_state"),e.params=(0,h.f)({enabled:d.enabled,context_ai_agent_id:d.contextAiAgentId}),e}return(0,h.c)(b,a),b}(h.h),ad=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.memory=c.memory,d}return(0,h.c)(b,a),b}(h.j),ae=function(a){function b(b){var c=b.userId,d=b.params,e=a.call(this)||this;return e.method=h.A.DELETE,e.path="".concat(h.bE,"/").concat(encodeURIComponent(c),"/memories"),e.params=(0,h.f)({context_ai_agent_id:(void 0===d?{}:d).contextAiAgentId}),e}return(0,h.c)(b,a),b}(h.h),af={},ag=function(){function a(a,b){var c=b.sdkState,d=b.requestQueue,e=b.logger,f=b.dispatcher,g=this;this._iid=a,this._sdkState=c,this._requestQueue=d,this._logger=e,this._dispatcher=f,this._aiAgentHandlers=new Map,this._groupChannelCache=i.L.of(this._iid),this._typingEventDurationTracker=new ab({dispatcher:f}),this._dispatcher.on(function(a){var b,c;if(a instanceof h.W)g._handleEvent(a).catch(function(a){if((0,h.a1)(a)&&"foreground"===g._sdkState.appState)throw a});else if(a instanceof h.aP){if(a.source===h.ab.EVENT_MESSAGE_SENT_SUCCESS){var d=function(a){a instanceof k.az&&a.channelType===h.C.GROUP&&(0,h.N)(function(){return(0,h._)(g,void 0,void 0,function(){var b;return(0,h.b)(this,function(c){switch(c.label){case 0:return[4,this._groupChannelCache.get(a.channelUrl)];case 1:return(b=c.sent())&&this._typingEventDurationTracker.onUserMessageSent(b,a.messageId),[2]}})})})};try{for(var e=(0,h.x)(a.messages),f=e.next();!f.done;f=e.next())d(f.value)}catch(i){b={error:i}}finally{try{f&&!f.done&&(c=e.return)&&c.call(e)}finally{if(b)throw b.error}}}}else a instanceof l.A?g._typingEventDurationTracker.onEnterBackground():a instanceof h.K&&a.stateType===h.M.LOGOUT&&g._typingEventDurationTracker.clear()}),af[a]=this}return a.prototype._handleEvent=function(a){var b;return(0,h._)(this,void 0,void 0,function(){var c,d,e,f,g,l,m,n,o,p,q,r,s,t=this;return(0,h.b)(this,function(u){switch(u.label){case 0:switch(a.code){case"AIEV":return[3,1];case"MEDI":case"FEDI":return[3,2];case"SYEV":return[3,4]}return[3,6];case 1:return(0,h.N)(function(){return(0,h._)(t,void 0,void 0,function(){return(0,h.b)(this,function(b){return this._aiAgentHandlers.forEach(function(b){b(a.payload)}),[2]})})}),[3,6];case 2:return d=(c=a.payload).channel_url,e=c.channel,this._typingEventDurationTracker.hasOpenBlockFor(null!==(b=null==e?void 0:e.channel_url)&& void 0!==b?b:d)?(f=void 0,(g=(f="MEDI"===a.code?a.as(k.aA):a.as(k.aB)).message).channelType!==h.C.GROUP?[2]:(l=g instanceof k.az?g.sender.userId:void 0,[4,this._groupChannelCache.get(g.channelUrl)])):[2];case 3:return(s=u.sent())&&this._typingEventDurationTracker.onBotMessageUpdated(s,l,g.data),[3,6];case 4:return n=(m=a.payload).cat,o=m.channel_url,p=m.channel_type,n!==j.a.TYPING_START&&n!==j.a.TYPING_END?[2]:p!==h.C.GROUP?[2]:(q=n===j.a.TYPING_START,r=a.as(q?i.N:i.R).user,[4,this._groupChannelCache.get(o)]);case 5:return(s=u.sent())?(q?this._typingEventDurationTracker.onTypingStart(s,r):this._typingEventDurationTracker.onTypingEnd(s,r),[3,6]):[2];case 6:return[2]}})})},a.of=function(a){return af[a]},Object.defineProperty(a.prototype,"handlers",{get:function(){return(0,h.s)([],(0,h.t)(this._aiAgentHandlers.values()),!1)},enumerable:!1,configurable:!0}),a.prototype.addEventHandler=function(a,b){this._aiAgentHandlers.set(a,b)},a.prototype.removeEventHandler=function(a){this._aiAgentHandlers.delete(a)},a.prototype.clearEventHandler=function(){this._aiAgentHandlers.clear()},a.prototype.requestMessengerSettings=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new m(a),[4,b.forceSend(c)];case 1:return[2,(d=e.sent()).as(n).settings]}})})},a.prototype.submitCustomerProvidedAuthCodes=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new o(a),[4,b.send(c)];case 1:return[2,{cpaAuthorizations:(d=e.sent()).as(p).cpaAuthorizations}]}})})},a.prototype.requestNudgeMessage=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new q(a),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(r).response]}})})},a.prototype.setUserMemoryState=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new ac({userId:this._sdkState.userId,params:a}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(ad).memory]}})})},a.prototype.clearUserMemories=function(a){return void 0===a&&(a={}),(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new ae({userId:this._sdkState.userId,params:a}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.getConversations=function(a,b,c){return(0,h._)(this,void 0,void 0,function(){var d,e,f,g,i,j;return(0,h.b)(this,function(k){switch(k.label){case 0:return d=h.V.of(this._iid).requestQueue,e=new s((0,h.d)((0,h.d)({},b),{token:a,limit:c})),[4,d.send(e)];case 1:return i=(g=(f=k.sent()).as(t)).conversations,j=g.token,[2,{conversations:i,token:j}]}})})},a.prototype.getMessageTemplates=function(a){return void 0===a&&(a={}),(0,h._)(this,void 0,void 0,function(){var b,c,d,e,f,g,i;return(0,h.b)(this,function(h){switch(h.label){case 0:return b=a.keys,c=a.limit,d=new v({keys:b,limit:c}),[4,this._requestQueue.send(d)];case 1:return g=(f=(e=h.sent()).as(w)).templates,i=f.token,[2,{templates:g,token:i}]}})})},a.prototype.getMessageTemplate=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=new x({key:a}),[4,this._requestQueue.send(b)];case 1:return[2,{template:(c=d.sent()).as(y).template}]}})})},a.prototype.getMyGroupChannels=function(a,b,c,d){return void 0===d&&(d=h.ab.REQUEST_CHANNEL),(0,h._)(this,void 0,void 0,function(){var e,f,g,j,k,l;return(0,h.b)(this,function(m){switch(m.label){case 0:return e=new C((0,h.d)((0,h.d)({},b),{userId:this._sdkState.userId,token:a,limit:c})),[4,this._requestQueue.send(e)];case 1:return j=(g=(f=m.sent()).as(D)).channels,k=g.token,l=g.ts,this._dispatcher.dispatch(new i.V({channels:j,context:{source:d}})),[2,{channels:j,token:k,ts:l}]}})})},a.prototype.getMyGroupChannelChangeLogs=function(a,b,c){return void 0===c&&(c=h.ab.REQUEST_CHANNEL_CHANGELOGS),(0,h._)(this,void 0,void 0,function(){var d,e,f,g,j,k,l,m,n;return(0,h.b)(this,function(o){switch(o.label){case 0:return d="string"==typeof a?a:null,e="number"==typeof a?a:null,f=new G((0,h.g)({userId:this._sdkState.userId,ts:e,token:d,params:b})),[4,this._requestQueue.send(f)];case 1:return k=(j=(g=o.sent()).as(H)).updatedChannels,l=j.deletedChannelUrls,m=j.hasMore,n=j.ts,k.length>0&&this._dispatcher.dispatch(new i.V({channels:k,context:{source:c},ts:n})),l.length>0&&this._dispatcher.dispatch(new i.W({channelUrls:l,context:{source:c}})),[2,{updatedChannels:k,deletedChannelUrls:l,hasMore:m,token:j.token}]}})})},a.prototype.getChannelsFromCache=function(a,b,c,d,e){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(f){switch(f.label){case 0:return[4,this._groupChannelCache.fetch({token:a,filter:b,order:c,limit:d,excludeChannelUrls:e})];case 1:return[2,f.sent()]}})})},a.prototype.getUnreadMessageCount=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d,e,f,g,i;return(0,h.b)(this,function(h){switch(h.label){case 0:return b=new J({userId:this._sdkState.userId,params:a}),[4,this._requestQueue.send(b)];case 1:return e=(d=(c=h.sent()).as(K)).total,f=d.aiAgentChannelCount,g=d.deskChannelCount,i=d.pinnedChannel,[2,{total:e,aiAgentChannelCount:f,deskChannelCount:g,pinnedChannel:i}]}})})},a.prototype.submitForm=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new N({channelUrl:a.channelUrl,messageId:a.messageId,key:a.formKey,data:a.formData}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(O).result]}})})},a.prototype.sendChallengeAction=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new L(a),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(M).result]}})})},a.prototype.cancelForm=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new P({channelUrl:a.channelUrl,messageId:a.messageId,key:a.formKey}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.requestOTP=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new Q({channelUrl:a.channelUrl,messageId:a.messageId,key:a.otpKey,channel:a.otpChannel,data:a.otpData}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(R).result]}})})},a.prototype.verifyOTP=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new S({channelUrl:a.channelUrl,messageId:a.messageId,key:a.otpKey,code:a.code}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(T).result]}})})},a.prototype.cancelOTP=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new U({channelUrl:a.channelUrl,messageId:a.messageId,key:a.otpKey}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.createMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d,e;return(0,h.b)(this,function(f){switch(f.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new V({channelUrl:a.channelUrl,messageId:a.messageId,rating:a.rating,comment:a.comment}),[4,b.send(c)];case 1:return[2,{id:(e=(d=f.sent()).as(W)).id,rating:e.rating,comment:e.comment}]}})})},a.prototype.updateMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d,e;return(0,h.b)(this,function(f){switch(f.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new X({channelUrl:a.channelUrl,messageId:a.messageId,rating:a.rating,comment:a.comment}),[4,b.send(c)];case 1:return[2,{id:(e=(d=f.sent()).as(Y)).id,rating:e.rating,comment:e.comment}]}})})},a.prototype.deleteMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new Z({channelUrl:a.channelUrl,messageId:a.messageId}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.submitUserActionMessage=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new $({channelUrl:a.channelUrl,messageId:a.messageId,status:a.status,detail:a.detail}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.updateContext=function(a,b,c){return(0,h._)(this,void 0,void 0,function(){var d,e,f;return(0,h.b)(this,function(g){switch(g.label){case 0:return d=h.V.of(this._iid).requestQueue,e=new i.Y({aiAgentId:a,channelUrl:b,context:c}),[4,d.send(e)];case 1:return[2,(f=g.sent()).as(i.X).contextObject]}})})},a.prototype.cancelStewardTask=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:return b=h.V.of(this._iid).requestQueue,c=new _({channelUrl:a.channelUrl,messageId:a.messageId}),[4,b.send(c)];case 1:return d.sent(),[2]}})})},a.prototype.patchContext=function(a,b,c){return(0,h._)(this,void 0,void 0,function(){var d,e,f;return(0,h.b)(this,function(g){switch(g.label){case 0:return d=h.V.of(this._iid).requestQueue,e=new i._({aiAgentId:a,channelUrl:b,context:c}),[4,d.send(e)];case 1:return[2,(f=g.sent()).as(i.Z).contextObject]}})})},a}();(A=z||(z={})).CREATED_AT="created_at",A.UPDATED_AT="updated_at";var ah,ai,aj={status:void 0,aiAgentId:void 0,reverse:!1,order:z.UPDATED_AT},ak=function(a){function b(b,c){var d,e,f,g,h=this;return(h=a.call(this,b,c)||this).status=null!==(d=c.status)&& void 0!==d?d:void 0,h.aiAgentId=null!==(e=c.aiAgentId)&& void 0!==e?e:void 0,h.reverse=null!==(f=c.reverse)&& void 0!==f?f:aj.reverse,h.order=null!==(g=c.order)&& void 0!==g?g:aj.order,h}return(0,h.c)(b,a),b.prototype._validate=function(){return a.prototype._validate.call(this)&&(0,h.a5)(i.K,this.status,!0)&&(0,h.a)("string",this.aiAgentId,!0)&&(0,h.a)("boolean",this.reverse)&&(0,h.a5)(z,this.order)},b.prototype.serialize=function(){return(0,h.aM)(this)},b.prototype.next=function(){return(0,h._)(this,void 0,void 0,function(){var a,b,c,d;return(0,h.b)(this,function(e){switch(e.label){case 0:return a=ag.of(this._iid),this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,[4,a.getConversations(this._token,(0,h.g)((0,h.d)({},this)),this.limit)]):[3,2]:[3,5];case 1:return c=(b=e.sent()).conversations,d=b.token,this._token=d,this._hasNext=!!d,this._isLoading=!1,[2,c];case 2:return[2,[]];case 3:throw h.q.queryInProgress;case 4:return[3,6];case 5:throw h.q.invalidParameters;case 6:return[2]}})})},b}(h.ap),al=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d._ts=0,d.aiAgentChannelFilter=B.aiAgentChannelFilter,d.aiAgentIds=B.aiAgentIds,d.deskChannelFilter=B.deskChannelFilter,d.pinnedChannelUrls=B.pinnedChannelUrls,d.copilotConversationOnly=B.copilotConversationOnly,d.copilotSupportChannelUrl=B.copilotSupportChannelUrl,c.aiAgentChannelFilter&&(d.aiAgentChannelFilter=c.aiAgentChannelFilter),c.aiAgentConversationStatusFilter&&(d.aiAgentConversationStatusFilter=c.aiAgentConversationStatusFilter),c.aiAgentIds&&(d.aiAgentIds=c.aiAgentIds),c.deskChannelFilter&&(d.deskChannelFilter=c.deskChannelFilter),c.pinnedChannelUrls&&(d.pinnedChannelUrls=c.pinnedChannelUrls),c.copilotConversationOnly&&(d.copilotConversationOnly=c.copilotConversationOnly),c.copilotSupportChannelUrl&&(d.copilotSupportChannelUrl=c.copilotSupportChannelUrl),d}return(0,h.c)(b,a),b.prototype._validate=function(){return a.prototype._validate.call(this)&&(0,h.a5)(d,this.aiAgentChannelFilter)&&(0,h.a2)(i.K,this.aiAgentConversationStatusFilter,!0)&&(0,h.a2)("string",this.aiAgentIds)&&(0,h.a5)(e,this.deskChannelFilter)&&(0,h.a2)("string",this.pinnedChannelUrls)&&(0,h.a)("boolean",this.copilotConversationOnly,!0)&&(0,h.a)("string",this.copilotSupportChannelUrl,!0)},b.prototype.serialize=function(){return(0,h.aM)(this)},Object.defineProperty(b.prototype,"lastResponseAt",{get:function(){return this._ts},enumerable:!1,configurable:!0}),b.prototype.belongsTo=function(a){return!!this.pinnedChannelUrls.includes(a.url)||(a.isAIAgent?!!a.conversation&&this.aiAgentChannelFilter!==d.EXCLUDE&&(!this.aiAgentIds||!(this.aiAgentIds.length>0)||!!this.aiAgentIds.includes(a.conversation.aiAgentId))&&(!this.aiAgentConversationStatusFilter||!(this.aiAgentConversationStatusFilter.length>0)||!!this.aiAgentConversationStatusFilter.some(function(b){var c;return(null===(c=a.conversation)|| void 0===c?void 0:c.status)===b})):!!a.isDesk&&this.deskChannelFilter!==e.EXCLUDE)},b.prototype.next=function(){return(0,h._)(this,void 0,void 0,function(){var a,b,c,d,e,f;return(0,h.b)(this,function(g){switch(g.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,a=ag.of(this._iid),b=(0,h.g)({aiAgentChannelFilter:this.aiAgentChannelFilter,aiAgentConversationStatusFilter:this.aiAgentConversationStatusFilter,aiAgentIds:this.aiAgentIds,deskChannelFilter:this.deskChannelFilter,pinnedChannelUrls:this.pinnedChannelUrls,copilotConversationOnly:this.copilotConversationOnly,copilotSupportChannelUrl:this.copilotSupportChannelUrl}),[4,a.getMyGroupChannels(this._token,b,this.limit)]):[3,2]:[3,5];case 1:return d=(c=g.sent()).channels,e=c.token,f=c.ts,this._token=e,this._hasNext=!!e,this._isLoading=!1,this._ts=f,[2,d];case 2:return[2,[]];case 3:throw h.q.queryInProgress;case 4:return[3,6];case 5:throw h.q.invalidParameters;case 6:return[2]}})})},b}(h.ap);(ai=ah||(ah={})).GOOD="good",ai.BAD="bad";var am=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.name="aiAgent",b._runtimeId=(0,h.u)(),b}return(0,h.c)(b,a),b.prototype.init=function(b,c){var d=c.sdkState,e=c.dispatcher,f=c.sessionManager,g=c.requestQueue,h=c.logger,i=c.onlineDetector,j=c.cacheContext;a.prototype.init.call(this,b,{sdkState:d,dispatcher:e,sessionManager:f,requestQueue:g,logger:h,onlineDetector:i,cacheContext:j}),this._manager=new ag(b,{sdkState:d,requestQueue:g,logger:h,dispatcher:e})},b.prototype.addEventHandler=function(a,b){(0,h.p)((0,h.a)("string",a)).throw(h.q.invalidParameters),this._manager.addEventHandler(a,b)},b.prototype.removeEventHandler=function(a){(0,h.p)((0,h.a)("string",a)).throw(h.q.invalidParameters),this._manager.removeEventHandler(a)},b.prototype.removeAllEventHandlers=function(){this._manager.clearEventHandler()},b.prototype.updateContext=function(a,b,c){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(d){return(0,h.p)((0,h.a)("string",a)&&(0,h.a)("string",b)&&(0,h.a)("object",c)).throw(h.q.invalidParameters),[2,this._manager.updateContext(a,b,c)]})})},b.prototype.patchContext=function(a,b,c){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(d){return(0,h.p)((0,h.a)("string",a)&&(0,h.a)("string",b)&&(0,h.a)("object",c)).throw(h.q.invalidParameters),[2,this._manager.patchContext(a,b,c)]})})},b.prototype.requestMessengerSettings=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d,e,f,g,i,j,k;return(0,h.b)(this,function(l){return b=a.aiAgentId,c=a.userId,d=a.language,e=a.country,f=a.context,g=a.forceCreateChannel,i=a.knownActiveChannelUrl,j=a.shouldSendFirstMessage,k=a.agentVersion,(0,h.p)((0,h.a)("string",b)&&(0,h.a)("string",c,!0)&&(0,h.a)("string",d,!0)&&(0,h.a)("string",e,!0)&&(0,h.a)("object",f,!0)&&(0,h.a)("boolean",g,!0)&&(0,h.a)("string",i,!0)&&(0,h.a)("boolean",j,!0)&&(0,h.a)("number",k,!0)).throw(h.q.invalidParameters),[2,this._manager.requestMessengerSettings(a)]})})},b.prototype.submitCustomerProvidedAuthCodes=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){return b=a.aiAgentId,c=a.authorizationCodes,(0,h.p)((0,h.a)("string",b)&&Array.isArray(c)).throw(h.q.invalidParameters),[2,this._manager.submitCustomerProvidedAuthCodes(a)]})})},b.prototype.requestNudgeMessage=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c,d,e;return(0,h.b)(this,function(f){return b=a.aiAgentId,c=a.key,d=a.context,e=a.language,(0,h.p)((0,h.a)("string",b)&&(0,h.a)("string",c)&&(0,h.a)("object",d,!0)&&(0,h.a)("string",e,!0)).throw(h.q.invalidParameters),[2,this._manager.requestNudgeMessage(a)]})})},b.prototype.setUserMemoryState=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("boolean",a.enabled)&&(0,h.a)("string",a.contextAiAgentId,!0)).throw(h.q.invalidParameters),[2,this._manager.setUserMemoryState(a)]})})},b.prototype.clearUserMemories=function(a){return void 0===a&&(a={}),(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.contextAiAgentId,!0)).throw(h.q.invalidParameters),[2,this._manager.clearUserMemories(a)]})})},b.prototype.createConversationListQuery=function(a){return void 0===a&&(a={}),new ak(this._iid,a)},b.prototype.createMyGroupChannelListQuery=function(a){return void 0===a&&(a={}),new al(this._iid,a)},b.prototype.getMyGroupChannelChangeLogsByToken=function(a,b){return void 0===b&&(b={}),(0,h._)(this,void 0,void 0,function(){var c;return(0,h.b)(this,function(d){switch(d.label){case 0:return c=(0,h.d)((0,h.d)({},E),b),(0,h.p)((0,h.a)("string",a)&&F(c)).throw(h.q.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(a,c)];case 1:return[2,d.sent()]}})})},b.prototype.getMyGroupChannelChangeLogsByTimestamp=function(a,b){return void 0===b&&(b={}),(0,h._)(this,void 0,void 0,function(){var c;return(0,h.b)(this,function(d){switch(d.label){case 0:return c=(0,h.d)((0,h.d)({},E),b),(0,h.p)((0,h.a)("number",a)&&F(c)).throw(h.q.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(a,c)];case 1:return[2,d.sent()]}})})},b.prototype.getUnreadMessageCount=function(a){return void 0===a&&(a={}),(0,h._)(this,void 0,void 0,function(){var b;return(0,h.b)(this,function(c){return b=(0,h.d)((0,h.d)({},I),a),(0,h.p)((0,h.a5)(d,b.aiAgentChannelFilter,!0)&&(0,h.a2)(i.K,b.aiAgentConversationStatusFilter,!0)&&(0,h.a2)("string",b.aiAgentIds,!0)&&(0,h.a5)(e,b.deskChannelFilter,!0)&&(0,h.a2)("string",b.pinnedChannelUrls,!0)&&(0,h.a)("boolean",b.copilotConversationOnly,!0)&&(0,h.a)("string",b.copilotSupportChannelUrl,!0)).throw(h.q.invalidParameters),[2,this._manager.getUnreadMessageCount(b)]})})},b.prototype.getMessageTemplates=function(a){return void 0===a&&(a={}),(0,h._)(this,void 0,void 0,function(){var b;return(0,h.b)(this,function(c){var d;return b=(0,h.d)((0,h.d)({},u),a),(0,h.p)((d=b,(0,h.a)("number",d.limit,!0)&&(0,h.a2)("string",d.keys,!0))).throw(h.q.invalidParameters),[2,this._manager.getMessageTemplates(a)]})})},b.prototype.getMessageTemplate=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a)).throw(h.q.invalidParameters),[2,this._manager.getMessageTemplate(a)]})})},b.prototype.submitForm=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.formKey)&&(0,h.a)("object",a.formData)).throw(h.q.invalidParameters),[2,this._manager.submitForm(a)]})})},b.prototype.cancelForm=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.formKey)).throw(h.q.invalidParameters),[2,this._manager.cancelForm(a)]})})},b.prototype.sendChallengeAction=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("string",a.key)&&(0,h.a)("string",a.requestId)&&(0,h.a)("string",a.action)&&(0,h.a)("object",a.data,!0)).throw(h.q.invalidParameters),[2,this._manager.sendChallengeAction(a)]})})},b.prototype.createMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a5)(ah,a.rating)&&(0,h.a)("string",a.comment,!0)).throw(h.q.invalidParameters),[2,this._manager.createMessageFeedback(a)]})})},b.prototype.updateMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a5)(ah,a.rating)&&(0,h.a)("string",a.comment,!0)).throw(h.q.invalidParameters),[2,this._manager.updateMessageFeedback(a)]})})},b.prototype.requestOTP=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.otpKey)&&(0,h.a)("string",a.otpChannel)&&(0,h.a)("object",a.otpData)).throw(h.q.invalidParameters),[2,this._manager.requestOTP(a)]})})},b.prototype.verifyOTP=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.otpKey)&&(0,h.a)("string",a.code)).throw(h.q.invalidParameters),[2,this._manager.verifyOTP(a)]})})},b.prototype.cancelOTP=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.otpKey)).throw(h.q.invalidParameters),[2,this._manager.cancelOTP(a)]})})},b.prototype.deleteMessageFeedback=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)).throw(h.q.invalidParameters),[2,this._manager.deleteMessageFeedback(a)]})})},b.prototype.submitUserActionMessage=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)&&(0,h.a)("string",a.status)&&(0,h.a)("string",a.detail,!0)).throw(h.q.invalidParameters),[2,this._manager.submitUserActionMessage(a)]})})},b.prototype.cancelStewardTask=function(a){return(0,h._)(this,void 0,void 0,function(){return(0,h.b)(this,function(b){return(0,h.p)((0,h.a)("string",a.channelUrl)&&(0,h.a)("number",a.messageId)).throw(h.q.invalidParameters),[2,this._manager.cancelStewardTask(a)]})})},b.prototype.appendStat=function(a,b){return(a===h.D.AI_AGENT_SDK_STATS||a===h.D.AI_AGENT_ASSERTION)&&h.V.of(this._iid).statManager.appendStat(a,b,this._runtimeId)},b}(h.aq)},32703:function(a,b,c){"use strict";c.d(b,{RC:function(){return s},pe:function(){return x},rY:function(){return B}});var d,e,f=c(84663),g=c(35058),h=c(89531),i=c(82861),j=function(){this.onUserMuted=f.aX,this.onUserUnmuted=f.aX,this.onUserBanned=f.aX,this.onUserUnbanned=f.aX,this.onChannelChanged=f.aX,this.onChannelDeleted=f.aX,this.onChannelFrozen=f.aX,this.onChannelUnfrozen=f.aX,this.onOperatorUpdated=f.aX,this.onChannelMemberCountChanged=f.aX,this.onMetaDataCreated=f.aX,this.onMetaDataUpdated=f.aX,this.onMetaDataDeleted=f.aX,this.onMetaCounterCreated=f.aX,this.onMetaCounterUpdated=f.aX,this.onMetaCounterDeleted=f.aX,this.onMessageReceived=f.aX,this.onMessageUpdated=f.aX,this.onMessageDeleted=f.aX,this.onMentionReceived=f.aX,this.onReactionUpdated=f.aX,this.onThreadInfoUpdated=f.aX},k={},l=function(){function a(a){var b=a._iid,c=a.limit,d=this;this.ref=0,this._iid=b,this._limit=void 0===c?100:c;var e,h,j=f.V.of(this._iid),k=j.sdkState,l=j.dispatcher,m=j.logger,n=j.cacheContext,o=j.statManager;this._metadataKey=(e=k.userId,"sendbird:".concat(e,"@groupchannel/sync.meta"));var p=(h=k.userId,"sendbird:".concat(h,"@groupchannel/sync"));this._sync=new i.c(p,function(){return(0,f._)(d,void 0,void 0,function(){var a,b,c,d,e,h,j,l,p,q,r,s,t,u,v,w;return(0,f.b)(this,function(x){switch(x.label){case 0:return a={hasNext:!0,nextToken:""},[4,this.loadMetadata()];case 1:if(x.sent(),m.debug("channel background sync from",null===(p=this._metadata)|| void 0===p?void 0:p.token),null===(q=this._metadata)|| void 0===q?void 0:q.completed)return[3,14];b={includeEmpty:!0,includeMetaData:!0,hiddenChannelFilter:g.H.ALL,order:i.G.CHRONOLOGICAL},x.label=2;case 2:if(x.trys.push([2,9,12,13]),b.order!==i.G.LATEST_LAST_MESSAGE)return[3,6];x.label=3;case 3:return x.trys.push([3,5,,6]),[4,n.preference.get((0,f.T)(k.appId))];case 4:return c=x.sent(),b.includeChatNotification=Boolean(c),[3,6];case 5:return x.sent(),b.includeChatNotification=!1,[3,6];case 6:return[4,g.G.of(this._iid).getMyGroupChannels(null!==(s=null===(r=this._metadata)|| void 0===r?void 0:r.token)&& void 0!==s?s:"",b,this._limit,f.ab.SYNC_CHANNEL_BACKGROUND)];case 7:return e=(d=x.sent()).channels,h=d.token,a.hasNext=e.length>=this._limit&&!!h,a.nextToken=h,this._metadata&&(this._metadata.token=h,(l=this._metadata.range).extends.apply(l,(0,f.s)([],(0,f.t)(e.map(function(a){return a.createdAt})),!1)),this._metadata.completed=!a.hasNext),m.debug("channel background sync progress",a),[4,this.saveMetadata()];case 8:return x.sent(),[3,13];case 9:return j=x.sent(),m.debug("channel background sync error",j),j instanceof f.q&&j.isInvalidTokenError?[4,this.clearMetaData()]:[3,11];case 10:x.sent(),x.label=11;case 11:throw j;case 12:return o.put(new f.B({type:f.D.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:"",measured_on:"channel_back_sync",event:"cache_fetch",max_db_size:null!==(u=null===(t=n.localCacheConfig)|| void 0===t?void 0:t.maxSize)&& void 0!==u?u:0,use_local_cache:n.localCacheEnabled,starting_point:0,message_init_policy:null!==(w=null===(v=b.order)|| void 0===v?void 0:v.toString())&& void 0!==w?w:"",collection_id:k.userId}})),[7];case 13:return[3,15];case 14:a.hasNext=!1,a.nextToken="",x.label=15;case 15:return[2,a]}})})}),this._connectionEventContext=l.on(function(a){a instanceof f.K?a.stateType===f.M.CONNECTED?d.resume():d.pause():a instanceof i.F&&d.resume()})}return a.of=function(b){return k[b]||(k[b]=new a({_iid:b})),k[b].ref++,k[b]},a.clear=function(a){k[a]&&k[a].close()},Object.defineProperty(a.prototype,"range",{get:function(){var a,b;return null!==(b=null===(a=this._metadata)|| void 0===a?void 0:a.range)&& void 0!==b?b:new g.T({})},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"completed",{get:function(){var a;return!!(null===(a=this._metadata)|| void 0===a?void 0:a.completed)},enumerable:!1,configurable:!0}),a.prototype.loadMetadata=function(){return(0,f._)(this,void 0,void 0,function(){var a;return(0,f.b)(this,function(b){switch(b.label){case 0:return this._metadata?[3,2]:[4,f.V.of(this._iid).cacheContext.preference.get(this._metadataKey)];case 1:a=b.sent(),this._metadata={token:a?a.token:"",range:new g.T(a?a.range:{top:Number.MAX_SAFE_INTEGER,bottom:0}),completed:!!a&&a.completed},b.label=2;case 2:return[2,this._metadata]}})})},a.prototype.saveMetadata=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return this._metadata?[4,f.V.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return a.sent(),[2,!0];case 2:return[2,!1]}})})},a.prototype.clearMetaData=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,f.V.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return a.sent(),this._metadata=void 0,[2]}})})},a.prototype.resume=function(){var a,b,c=f.V.of(this._iid),d=c.logger;c.sessionManager.session.hasSession&&(d.debug("channel background sync resume()"),this._sync.start(null!==(b=null===(a=this._metadata)|| void 0===a?void 0:a.token)&& void 0!==b?b:""))},a.prototype.pause=function(){f.V.exists(this._iid)&&f.V.of(this._iid).logger.debug("channel background sync stop()"),this._sync.stop()},a.prototype.close=function(){this.ref--,this.ref<=0&&(this.ref=0,this.pause(),this._connectionEventContext.close(),delete k[this._iid])},a}(),m={},n=function(){function a(a){var b=a._iid,c=a.prefix,d=a.fetcher,e=this;this.ref=0,this._iid=b,this._fetcher=d,this._prefix=c;var h,j,k,l,m=f.V.of(this._iid),n=m.logger,o=m.sdkState,p=m.dispatcher,q=m.cacheContext,r=m.statManager;this._metadataKey=(h=o.userId,(j=this._prefix)?"sendbird:".concat(h,":").concat(j,"@groupchannel/changelogs.meta"):"sendbird:".concat(h,"@groupchannel/changelogs.meta")),this._subscribers=new f.E;var s=(k=o.userId,(l=this._prefix)?"sendbird:".concat(k,":").concat(l,"@groupchannel/changelogs"):"sendbird:".concat(k,"@groupchannel/changelogs"));this._sync=new i.c(s,function(){return(0,f._)(e,void 0,void 0,function(){var a,b,c,d,e,h,i,j,k,l,m;return(0,f.b)(this,function(p){switch(p.label){case 0:return a={hasNext:!0,nextToken:0},[4,this.loadMetadata()];case 1:p.sent(),n.debug("channel changelog sync from",null===(k=this._metadata)|| void 0===k?void 0:k.token),b=g.G.of(this._iid),p.label=2;case 2:return p.trys.push([2,5,8,12]),[4,this._fetcher(null!==(m=null===(l=this._metadata)|| void 0===l?void 0:l.token)&& void 0!==m?m:"")];case 3:return d=(c=p.sent()).updatedChannels,e=c.deletedChannelUrls,h=c.hasMore,i=c.token,this._subscribers.dispatch("progress",{updatedChannels:d,deletedChannelUrls:e,hasMore:h,token:i}),a.hasNext=h,a.nextToken=i,this._metadata&&(this._metadata.token=i),n.debug("channel changelog sync progress",a),[4,this.saveMetadata()];case 4:return p.sent(),q.localCacheEnabled&&r.put(new f.B({type:f.D.FEATURE_LOCALCACHE_EVENT,ts:Date.now(),data:{channel_url:"",measured_on:"channel_change_log_sync",event:d.length>0||e.length>0?"cache_miss":"cache_hit",max_db_size:d.length,use_local_cache:q.localCacheEnabled,starting_point:0,message_init_policy:e.length.toString(),collection_id:o.userId}})),[3,12];case 5:return j=p.sent(),n.debug("channel changelog sync error",j),j instanceof f.q&&j.isInvalidTokenError?[4,this.clearMetadata()]:[3,7];case 6:p.sent(),p.label=7;case 7:throw j;case 8:return a.hasNext?[3,11]:[4,(0,f.aU)(500)];case 9:return p.sent(),[4,b.removeChannelsByRotation()];case 10:p.sent(),p.label=11;case 11:return[7];case 12:return[2,a]}})})}),this._sync.on("stop",function(){e._subscribers.dispatch("pause")}),this._connectionEventContext=p.on(function(a){a instanceof f.K?a.stateType===f.M.CONNECTED?e.resume():e.pause():a instanceof i.F&&e.resume()})}return a.of=function(b){var c=b._iid,d=b.prefix,e=b.fetcher,f=d?"".concat(c,":").concat(d):c;return m[f]||(m[f]=new a({_iid:c,prefix:d,fetcher:e})),m[f].ref++,m[f]},a.clear=function(a){var b=a._iid,c=a.prefix,d=c?"".concat(b,":").concat(c):b;m[d]&&m[d].close()},Object.defineProperty(a.prototype,"isRunning",{get:function(){return this._sync.isRunning},enumerable:!1,configurable:!0}),a.prototype.loadMetadata=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return this._metadata?[3,2]:(b=(a=f.V.of(this._iid)).cacheContext,c=a.firstConnectedAt,[4,b.preference.get(this._metadataKey)]);case 1:d=e.sent(),this._metadata={token:d?d.token:c},e.label=2;case 2:return[2,this._metadata]}})})},a.prototype.saveMetadata=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return this._metadata?[4,f.V.of(this._iid).cacheContext.preference.set(this._metadataKey,this._metadata)]:[3,2];case 1:return a.sent(),[2,!0];case 2:return[2,!1]}})})},a.prototype.clearMetadata=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,f.V.of(this._iid).cacheContext.preference.remove(this._metadataKey)];case 1:return a.sent(),this._metadata=void 0,[2]}})})},a.prototype.on=function(a,b){return this._subscribers.on(a,b)},a.prototype.resume=function(){f.V.of(this._iid).sessionManager.session.hasSession&&this._sync.start(0)},a.prototype.pause=function(){this._sync.stop()},a.prototype.close=function(){if(this.ref--,this.ref<=0){var a=this._prefix?"".concat(this._iid,":").concat(this._prefix):this._iid;this.ref=0,this.pause(),this._connectionEventContext.close(),delete m[a]}},a}(),o=function(a,b){var c,d,e,f;switch(b){case i.G.LATEST_LAST_MESSAGE:return null!==(d=null===(c=a.lastMessage)|| void 0===c?void 0:c.createdAt)&& void 0!==d?d:a.createdAt;case i.G.CHRONOLOGICAL:return a.createdAt;case i.G.CHANNEL_NAME_ALPHABETICAL:return a.name;default:return null!==(f=null===(e=a.lastMessage)|| void 0===e?void 0:e.createdAt)&& void 0!==f?f:a.createdAt}},p=function(a,b){return a.findIndex(function(a){return a.isIdentical(b)})},q=function(a,b,c){if(a.length>0){for(var d=p(a,b),e=0,f=a.length-1,g=Math.floor((e+f)/2);e0)g=Math.floor((e+(f=g))/2);else{if(!(h<0))return{place:g,oldPosition:d};g=Math.floor(((e=g+1)+f)/2)}}return{place:r(a[g],b,c)>=0?g:g+1,oldPosition:d}}return{place:a.length,oldPosition:-1}},r=function(a,b,c){switch(c){case i.G.LATEST_LAST_MESSAGE:return a.lastMessage&&b.lastMessage?0==(d=b.lastMessage.createdAt-a.lastMessage.createdAt)?b.createdAt-a.createdAt:d:a.lastMessage?-1:b.lastMessage?1:b.createdAt-a.createdAt;case i.G.CHRONOLOGICAL:return b.createdAt-a.createdAt;case i.G.CHANNEL_NAME_ALPHABETICAL:var d;return 0===(d=a.name.localeCompare(b.name))?a.createdAt-b.createdAt:d;default:return 0}},s=function(){function a(a,b){var c,d=this;this._channels=[],this._isInitialized=!1,this._isLoadMoreChannelFetchActive=!1,this._iid=a,this._fetcher=b.fetcher,this._isDisposed=!1,this._isGetRemoteChannelsSucceeded=!0,this._includeChangesOnInitialLoad=null!==(c=b.includeChangesOnInitialLoad)&& void 0!==c&&c,this.filter=b.filter,this._channelFilter=b.filter,this.order=b.order,this._hasMore=!0,this._token="",this._limit=b.limit,this._localCacheToken=null;var e=f.V.of(this._iid),g=e.cacheContext,h=e.dispatcher;g.localCacheEnabled&&(this._backgroundSync=l.of(a),this._backgroundSync.resume()),this._changelogSync=n.of({_iid:this._iid,prefix:b.syncKeyPrefix,fetcher:this._fetcher.changeLogSync}),this._changelogSync.resume(),h.on(function(a){a instanceof f.K&&(a.stateType===f.M.CONNECTED?d._isGetRemoteChannelsSucceeded||(0,f._)(d,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,this._revokeLoadMore()];case 1:return a.sent(),[2]}})}):a.stateType===f.M.LOGOUT&&d.dispose())})}return Object.defineProperty(a.prototype,"hasMore",{get:function(){return!this._isDisposed&&this._hasMore},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"handler",{get:function(){return this._handler},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"channels",{get:function(){return this._channels},enumerable:!1,configurable:!0}),a.prototype._subscribeChannelEvent=function(a,b){g.G.of(this._iid).subscribeChannelEvent(a,b)},a.prototype._unsubscribeChannelEvent=function(a){g.G.of(this._iid).unsubscribeChannelEvent(a)},Object.defineProperty(a.prototype,"_isLoadMoreChannelFetchInProgress",{get:function(){return this._isLoadMoreChannelFetchActive},enumerable:!1,configurable:!0}),a.prototype._prepareLoadMoreChannels=function(a){return a},a.prototype.setGroupChannelCollectionHandler=function(a){this._handler=a},a.prototype._addChannelsToView=function(a,b,c){var d,e,h,j,k=this;void 0===c&&(c=!1);var l=[],m=[],n=[];try{for(var o=(0,f.x)(a),r=o.next();!r.done;r=o.next()){var s=r.value,t=p(this._channels,s);t>=0&&this._channels.splice(t,1);var u=q(this._channels,s,this.order).place;if(t<0)u===this._channels.length?!c&&this.hasMore||(l.push(s),this._channels.push(s)):(l.push(s),this._channels.splice(u,0,s));else switch(b.source){case f.ab.EVENT_CHANNEL_UPDATED:case f.ab.EVENT_MESSAGE_RECEIVED:case f.ab.SYNC_CHANNEL_CHANGELOGS:case f.ab.EVENT_MESSAGE_SENT:this.order===i.G.CHANNEL_NAME_ALPHABETICAL&&this.hasMore&&u===this._channels.length?n.push(s):(this._channels.splice(u,0,s),m.push(s));break;default:this._channels.splice(u,0,s),m.push(s)}}}catch(v){d={error:v}}finally{try{r&&!r.done&&(e=o.return)&&e.call(o)}finally{if(d)throw d.error}}if(n.length>0)try{for(var w=(0,f.x)(n),x=w.next();!x.done;x=w.next()){s=x.value;var y=p(this._channels,s);-1!==y&&this._channels.splice(y,1)}}catch(z){h={error:z}}finally{try{x&&!x.done&&(j=w.return)&&j.call(w)}finally{if(h)throw h.error}}(0,g.s)(b.source)&&(0,f.N)(function(){return(0,f._)(k,void 0,void 0,function(){var a,c,d;return(0,f.b)(this,function(e){return l.length>0&&(null===(a=this.handler)|| void 0===a?void 0:a.onChannelsAdded)&&this.handler.onChannelsAdded(b,l),m.length>0&&(null===(c=this.handler)|| void 0===c?void 0:c.onChannelsUpdated)&&this.handler.onChannelsUpdated(b,m),n.length>0&&(null===(d=this.handler)|| void 0===d?void 0:d.onChannelsDeleted)&&this.handler.onChannelsDeleted(b,n.map(function(a){return a.url})),[2]})})})},a.prototype._removeChannelsFromView=function(a,b){var c,d,e=this,h=[],i=function(a){var b=j._channels.findIndex(function(b){return b.url===a});b>=0&&(h.push(j._channels[b].url),j._channels.splice(b,1))},j=this;try{for(var k=(0,f.x)(a),l=k.next();!l.done;l=k.next())i(l.value)}catch(m){c={error:m}}finally{try{l&&!l.done&&(d=k.return)&&d.call(k)}finally{if(c)throw c.error}}return(0,g.s)(b.source)&&h.length>0&&(0,f.N)(function(){return(0,f._)(e,void 0,void 0,function(){var a;return(0,f.b)(this,function(c){return(null===(a=this.handler)|| void 0===a?void 0:a.onChannelsDeleted)&&this.handler.onChannelsDeleted(b,h),[2]})})}),h},a.prototype._getLocalChannels=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c;return(0,f.b)(this,function(d){switch(d.label){case 0:return a=g.G.of(this._iid),b=this.channels.length>0?new Set(this.channels.map(function(a){return a.url})):void 0,[4,a.getChannelsFromCache(this._localCacheToken,this._channelFilter,this.order,this._limit,b)];case 1:return(c=d.sent()).length>0&&(this._localCacheToken=o(c[c.length-1],this.order)),[2,c]}})})},a.prototype._getRemoteChannels=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c;return(0,f.b)(this,function(d){switch(d.label){case 0:return[4,this._fetcher.getRemoteChannels(this._token,this.filter,this.order,this._limit)];case 1:return b=(a=d.sent()).channels,c=a.token,this._token=c,this._hasMore=!!c,b.length>0&&(this._localCacheToken=o(b[b.length-1],this.order)),[2,b]}})})},a.prototype._beginLoadMoreChannelFetch=function(){this._isLoadMoreChannelFetchActive=!0},a.prototype._endLoadMoreChannelFetch=function(){this._isLoadMoreChannelFetchActive=!1},a.prototype._revokeLoadMore=function(){return(0,f._)(this,void 0,void 0,function(){var a;return(0,f.b)(this,function(b){switch(b.label){case 0:if(this._isDisposed)return[2];b.label=1;case 1:return b.trys.push([1,3,,4]),[4,this._getRemoteChannels()];case 2:return a=b.sent(),this._isGetRemoteChannelsSucceeded=!0,this._addChannelsToView(a,{source:f.ab.REQUEST_CHANNEL},!0),[3,4];case 3:return b.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,4];case 4:return[2]}})})},a.prototype.loadMore=function(){var a,b,c;return(0,f._)(this,void 0,void 0,function(){var d,e,g,h,i,j,k,l,m,n,o,r,s,t,u,v,w,x,y,z,A,B=this;return(0,f.b)(this,function(C){switch(C.label){case 0:if(this._isDisposed)throw new f.q({code:f.F.COLLECTION_DISPOSED,message:"Collection has been disposed."});return d=null,this._includeChangesOnInitialLoad&&0===this._channels.length&&this._changelogSync.isRunning?[4,new Promise(function(a){B._changelogSyncSubscriberContext=B._changelogSync.on("progress",function(b){return a(b)}).on("pause",function(){return a(null)})})]:[3,2];case 1:d=C.sent(),null===(a=this._changelogSyncSubscriberContext)|| void 0===a||a.close(),C.label=2;case 2:return g=(e=f.V.of(this._iid)).cacheContext,h=e.connectionManager,i=e.statManager,this._isInitialized?[3,5]:(this._isInitialized=!0,g.localCacheEnabled?[4,null===(b=this._backgroundSync)|| void 0===b?void 0:b.loadMetadata()]:[3,4]);case 3:C.sent(),C.label=4;case 4:i.put(new f.bl({type:f.D.FEATURE_LOCALCACHE,data:{use_local_cache:g.localCacheEnabled,collection_interface:{group_channel:!0}}})),C.label=5;case 5:if(j=[],!this._hasMore)return[3,14];this._beginLoadMoreChannelFetch(),C.label=6;case 6:return C.trys.push([6,,12,13]),g.localCacheEnabled&&(!h.isConnected||(null===(c=this._backgroundSync)|| void 0===c?void 0:c.completed))?[4,(0,f.J)(function(){return(0,f._)(B,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,this._getLocalChannels()];case 1:return j=a.sent(),[2]}})})})]:[3,8];case 7:return C.sent(),this._hasMore=j.length>=this._limit,[3,11];case 8:return C.trys.push([8,10,,11]),[4,this._getRemoteChannels()];case 9:return j=C.sent(),this._isGetRemoteChannelsSucceeded=!0,[3,11];case 10:return C.sent(),this._isGetRemoteChannelsSucceeded=!1,[3,11];case 11:return j=this._prepareLoadMoreChannels(j),[3,13];case 12:return this._endLoadMoreChannelFetch(),[7];case 13:this._addChannelsToView(j,{source:f.ab.REQUEST_CHANNEL},!0),this._hasMore||(this._localCacheToken=null),C.label=14;case 14:if(d){k=f.V.of(this._iid).sdkState,l=d.updatedChannels.filter(function(a){return B._channelFilter.match(a,k.userId)});try{for(n=(m=(0,f.x)(l)).next();!n.done;n=m.next())o=n.value,(w=p(j,o))>=0?j[w]=o:(r=q(j,o,this.order).place,j.splice(r,0,o)),this._addChannelsToView([o],{source:f.ab.REQUEST_CHANNEL},!0)}catch(D){x={error:D}}finally{try{n&&!n.done&&(y=m.return)&&y.call(m)}finally{if(x)throw x.error}}s=j.map(function(a){return a.url});try{for(u=(t=(0,f.x)(d.deletedChannelUrls)).next();!u.done;u=t.next())v=u.value,(w=s.indexOf(v))>=0&&(j.splice(w,1),s.splice(w,1))}catch(E){z={error:E}}finally{try{u&&!u.done&&(A=t.return)&&A.call(t)}finally{if(z)throw z.error}}this._removeChannelsFromView(d.deletedChannelUrls,{source:f.ab.REQUEST_CHANNEL})}return[2,j]}})})},a.prototype.dispose=function(){var a,b,c;this._isDisposed||(this._isDisposed=!0,this._channels.length>0&&this._channels.splice(0,this._channels.length),this._localCacheToken=null,null===(a=this._backgroundSync)|| void 0===a||a.close(),null===(b=this._changelogSync)|| void 0===b||b.close(),null===(c=this._changelogSyncSubscriberContext)|| void 0===c||c.close())},a}(),t=function(a){function b(b,c){void 0===c&&(c={});var d,e,j,k,l=this;(l=a.call(this,b,(0,f.d)((0,f.d)({},c),{filter:null!==(d=c.filter)&& void 0!==d?d:new g.a,order:null!==(e=c.order)&& void 0!==e?e:i.G.LATEST_LAST_MESSAGE,limit:null!==(j=c.limit)&& void 0!==j?j:h.ah,fetcher:(k=b,{getRemoteChannels:function(a,b,c,d){return g.G.of(k).getMyGroupChannels(a,(0,f.g)((0,f.d)((0,f.d)({},b),{userIdsFilter:b.userIdsFilter,searchFilter:b.searchFilter,order:c})),d)},changeLogSync:function(a){return(0,f._)(void 0,void 0,void 0,function(){var b,c,d,e,h;return(0,f.b)(this,function(i){switch(i.label){case 0:b={includeEmpty:!0,includeMetaData:!0},d=(c=f.V.of(k)).cacheContext,e=c.sdkState,i.label=1;case 1:return i.trys.push([1,3,,4]),[4,d.preference.get((0,f.T)(e.appId))];case 2:return h=i.sent(),b.includeChatNotification=Boolean(h),[3,4];case 3:return i.sent(),b.includeChatNotification=!1,[3,4];case 4:return[2,g.G.of(k).getMyGroupChannelChangeLogs(a,b,f.ab.SYNC_CHANNEL_CHANGELOGS)]}})})}})}))||this)._hasCompletedInitialLoadMore=!1,l._pendingInitialMessageEventChannels=new Map,l._key="gcc-".concat((0,f.u)());var m=f.V.of(l._iid).sdkState;return l._subscribeChannelEvent(l._key,{onUpdate:function(a,b){var c,d,e=b.source;if(l._shouldBufferInitialMessageEvent(e)){var h=g.G.of(l._iid);try{for(var i=(0,f.x)(a),j=i.next();!j.done;j=i.next()){var k=j.value;l.filter.match(k,m.userId)?l._pendingInitialMessageEventChannels.set(k.url,{channel:h.buildGroupChannelFromSerializedData(k.serialize()),context:b}):l._pendingInitialMessageEventChannels.delete(k.url)}}catch(n){c={error:n}}finally{try{j&&!j.done&&(d=i.return)&&d.call(i)}finally{if(c)throw c.error}}}else if((0,g.s)(e)){var o=a.filter(function(a){return l.filter.match(a,m.userId)}),p=a.filter(function(a){return!l.filter.match(a,m.userId)}).map(function(a){return a.url});o.length>0&&l._addChannelsToView(o,b,!1),p.length>0&&l._removeChannelsFromView(p,b)}},onRemove:function(a,b){var c,d;try{for(var e=(0,f.x)(a),g=e.next();!g.done;g=e.next()){var h=g.value;l._pendingInitialMessageEventChannels.delete(h)}}catch(i){c={error:i}}finally{try{g&&!g.done&&(d=e.return)&&d.call(e)}finally{if(c)throw c.error}}l._removeChannelsFromView(a,b)}}),l}return(0,f.c)(b,a),b.prototype._shouldBufferInitialMessageEvent=function(a){return!this._hasCompletedInitialLoadMore&&this._isLoadMoreChannelFetchInProgress&&(a===f.ab.EVENT_MESSAGE_RECEIVED||a===f.ab.EVENT_MESSAGE_SENT)},b.prototype._prepareLoadMoreChannels=function(a){if(this._hasCompletedInitialLoadMore||(this._hasCompletedInitialLoadMore=!0,0===this._pendingInitialMessageEventChannels.size))return a;var b,c,d=!1,e=[];try{for(var g=(0,f.x)(a),h=g.next();!h.done;h=g.next()){var i=h.value,j=this._pendingInitialMessageEventChannels.get(i.url);j?(d=!0,this._pendingInitialMessageEventChannels.delete(i.url),e.push(j.channel)):e.push(i)}}catch(k){b={error:k}}finally{try{h&&!h.done&&(c=g.return)&&c.call(g)}finally{if(b)throw b.error}}return this._pendingInitialMessageEventChannels.clear(),d?e:a},b.prototype.dispose=function(){this._pendingInitialMessageEventChannels.clear(),a.prototype.dispose.call(this),this._unsubscribeChannelEvent(this._key)},b}(s),u=function(a){function b(b){var c=this,d=b.token,e=b.limit,h=b.order,i=b.includeEmpty,j=b.membershipFilter,k=b.channelNameContainsFilter,l=b.channelUrlsFilter,m=b.customTypesFilter,n=b.customTypeStartsWithFilter,o=b.superChannelFilter,p=b.metadataOrderKeyFilter,q=b.metadataKey,r=b.metadataValues,s=b.metadataValueStartsWith,t=b.includeFrozen,u=b.includeMetaData;return(c=a.call(this)||this).method=f.A.GET,c.path=f.aW,c.params=(0,f.f)((0,f.g)({token:d,limit:e,order:h,show_member:!0,show_read_receipt:!0,show_delivery_receipt:!0,show_empty:i,public_mode:g.P.PUBLIC,public_membership_mode:j,name_contains:k,channel_urls:l,custom_types:m,custom_type_startswith:n,super_mode:o,metadata_order_key:p,metadata_key:q,metadata_values:r,metadata_value_startswith:s,show_frozen:t,show_metadata:u})),c}return(0,f.c)(b,a),b}(f.h),v=function(a){function b(b,c){var d=a.call(this,b,c)||this;d.channels=[];var e=c.next,f=c.channels,h=c.ts;return d.token=e,f&&f.length>0&&(d.channels=f.map(function(a){return a.ts=h,new g.b(b,a)})),d.ts="number"==typeof h?h:0,d}return(0,f.c)(b,a),b}(f.j);(e=d||(d={})).ALL="all",e.JOINED="joined";var w=function(a){function b(b,c){var e,f,h,j,k,l,m,n,o,p,q,r,s,t,u=this;return(u=a.call(this,b,c)||this).includeEmpty=!1,u.includeFrozen=!0,u.includeMetaData=!0,u.channelUrlsFilter=null,u.customTypesFilter=null,u.customTypeStartsWithFilter=null,u.channelNameContainsFilter=null,u.membershipFilter=d.ALL,u.superChannelFilter=g.S.ALL,u.metadataKey=null,u.metadataValues=null,u.metadataOrderKeyFilter=null,u.metadataValueStartsWith=null,u.order=i.P.CHRONOLOGICAL,u.includeEmpty=null!==(e=c.includeEmpty)&& void 0!==e&&e,u.includeFrozen=null===(f=c.includeFrozen)|| void 0===f||f,u.includeMetaData=null===(h=c.includeMetaData)|| void 0===h||h,u.channelUrlsFilter=null!==(j=c.channelUrlsFilter)&& void 0!==j?j:null,u.customTypesFilter=null!==(k=c.customTypesFilter)&& void 0!==k?k:null,u.customTypeStartsWithFilter=null!==(l=c.customTypeStartsWithFilter)&& void 0!==l?l:null,u.channelNameContainsFilter=null!==(m=c.channelNameContainsFilter)&& void 0!==m?m:null,u.membershipFilter=null!==(n=c.membershipFilter)&& void 0!==n?n:d.ALL,u.superChannelFilter=null!==(o=c.superChannelFilter)&& void 0!==o?o:g.S.ALL,u.metadataKey=null!==(p=c.metadataKey)&& void 0!==p?p:null,u.metadataValues=null!==(q=c.metadataValues)&& void 0!==q?q:null,u.metadataOrderKeyFilter=null!==(r=c.metadataOrderKeyFilter)&& void 0!==r?r:null,u.metadataValueStartsWith=null!==(s=c.metadataValueStartsWith)&& void 0!==s?s:null,u.order=null!==(t=c.order)&& void 0!==t?t:i.P.CHRONOLOGICAL,u}return(0,f.c)(b,a),b.prototype._validate=function(){return a.prototype._validate.call(this)&&(0,f.a)("boolean",this.includeEmpty)&&(0,f.a)("boolean",this.includeFrozen)&&(0,f.a)("boolean",this.includeMetaData)&&(0,f.a)("string",this.channelNameContainsFilter,!0)&&(0,f.a2)("string",this.channelUrlsFilter,!0)&&(0,f.a2)("string",this.customTypesFilter,!0)&&(0,f.a)("string",this.customTypeStartsWithFilter,!0)&&(0,f.a5)(d,this.membershipFilter)&&(0,f.a5)(g.S,this.superChannelFilter)&&(0,f.a5)(i.P,this.order)&&(0,f.a)("string",this.metadataOrderKeyFilter,!0)&&(0,f.a)("string",this.metadataKey,!0)&&(0,f.a2)("string",this.metadataValues,!0)&&(0,f.a)("string",this.metadataValueStartsWith,!0)},b.prototype.next=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g,h;return(0,f.b)(this,function(i){switch(i.label){case 0:return this._validate()?this._isLoading?[3,3]:(a=[],this._hasNext?(this._isLoading=!0,b=f.V.of(this._iid).requestQueue,c=new u((0,f.g)((0,f.d)((0,f.d)({},this),{token:this._token}))),[4,b.send(c)]):[3,2]):[3,5];case 1:return g=(e=(d=i.sent()).as(v)).channels,h=e.token,this._token=h,this._hasNext=!!h,this._isLoading=!1,[2,g];case 2:return[2,a];case 3:throw f.q.queryInProgress;case 4:return[3,6];case 5:throw f.q.invalidParameters;case 6:return[2]}})})},b}(f.ap),x=function(a){function b(b){void 0===b&&(b={});var c=a.call(this)||this;return Object.keys(b).forEach(function(a){c.hasOwnProperty(a)&&(c[a]=b[a])}),c}return(0,f.c)(b,a),b}(function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.onUserJoined=f.aX,b.onUserLeft=f.aX,b.onUserReceivedInvitation=f.aX,b.onUserDeclinedInvitation=f.aX,b.onChannelHidden=f.aX,b.onUnreadMemberStatusUpdated=f.aX,b.onUserMarkedRead=f.aX,b.onUserMarkedUnread=f.aX,b.onUndeliveredMemberStatusUpdated=f.aX,b.onTypingStatusUpdated=f.aX,b.onPollUpdated=f.aX,b.onPollVoted=f.aX,b.onPollDeleted=f.aX,b.onPinnedMessageUpdated=f.aX,b}return(0,f.c)(b,a),b}(j)),y=function(a){function b(b){var c=this,d=b.token,e=b.limit,g=b.order,h=b.reverse,i=b.channelUrl,j=b.messageTypeFilter,k=b.scheduledStatus;return(c=a.call(this)||this).method=f.A.GET,c.path="".concat(f.bm),c.params=(0,f.f)((0,f.g)({token:d,limit:e,reverse:h,channel_url:i,order:g,message_type:j,status:k})),c}return(0,f.c)(b,a),b}(f.h),z=function(a){function b(b,c){var d=a.call(this,b,c)||this;d.scheduledMessages=[];var e=c.next,f=c.scheduled_messages;return d.token=e,d.scheduledMessages=f.map(function(a){return(0,h.Q)(b,a)}),d}return(0,f.c)(b,a),b}(f.j),A=function(a){function b(b,c){var d,e,g,h,i,j=this;return(j=a.call(this,b,c)||this).channelUrl=null,j.order=null,j.reverse=!1,j.scheduledStatus=null,j.messageTypeFilter=f.au.ALL,j.channelUrl=null!==(d=c.channelUrl)&& void 0!==d?d:null,j.order=null!==(e=c.order)&& void 0!==e?e:null,j.reverse=null!==(g=c.reverse)&& void 0!==g&&g,j.scheduledStatus=null!==(h=c.scheduledStatus)&& void 0!==h?h:null,j.messageTypeFilter=null!==(i=c.messageTypeFilter)&& void 0!==i?i:f.au.ALL,j}return(0,f.c)(b,a),b.prototype._validate=function(){return a.prototype._validate.call(this)&&(0,f.a)("string",this.channelUrl,!0)&&((0,f.a5)(i.e,this.order)||null===this.order)&&(0,f.a)("boolean",this.reverse)&&((0,f.a2)(h.ai,this.scheduledStatus)||null===this.scheduledStatus)&&(0,f.a5)(f.au,this.messageTypeFilter)},b.prototype.next=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,a=f.V.of(this._iid).requestQueue,b=new y((0,f.g)((0,f.d)((0,f.d)({},this),{token:this._token}))),[4,a.send(b)]):[3,2]:[3,5];case 1:return e=(d=(c=h.sent()).as(z)).scheduledMessages,g=d.token,this._token=g,this._hasNext=!!g,this._isLoading=!1,[2,e];case 2:return[2,[]];case 3:throw f.q.queryInProgress;case 4:return[3,6];case 5:throw f.q.invalidParameters;case 6:return[2]}})})},b}(f.ap),B=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.name="groupChannel",b}return(0,f.c)(b,a),b.prototype.init=function(b,c){var d=c.sdkState,e=c.dispatcher,f=c.sessionManager,h=c.requestQueue,i=c.logger,j=c.onlineDetector,k=c.cacheContext;a.prototype.init.call(this,b,{sdkState:d,dispatcher:e,sessionManager:f,requestQueue:h,logger:i,onlineDetector:j,cacheContext:k}),this._manager=new g.G(b,{sdkState:d,cacheContext:k,dispatcher:e,sessionManager:f,requestQueue:h,logger:i})},b.prototype.createGroupChannelCollection=function(a){return void 0===a&&(a={}),new t(this._iid,a)},b.prototype.createMyGroupChannelListQuery=function(a){return void 0===a&&(a={}),new g.c(this._iid,a)},b.prototype.createInactiveChannelListQuery=function(a){return void 0===a&&(a={}),new g.I(this._iid,a)},b.prototype.createPublicGroupChannelListQuery=function(a){return void 0===a&&(a={}),new w(this._iid,a)},b.prototype.createScheduledMessageListQuery=function(a){return void 0===a&&(a={}),new A(this._iid,a)},b.prototype.addGroupChannelHandler=function(a,b){(0,f.p)((0,f.a)("string",a)&&b instanceof x).throw(f.q.invalidParameters),this._manager.addHandler(a,b)},b.prototype.removeGroupChannelHandler=function(a){(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),this._manager.removeHandler(a)},b.prototype.removeAllGroupChannelHandlers=function(){this._manager.clearHandler()},b.prototype.buildGroupChannelFromSerializedData=function(a){return this._manager.buildGroupChannelFromSerializedData(a)},b.prototype.buildGroupChannelListQueryFromSerializedData=function(a){return this._manager.buildGroupChannelListQueryFromSerializedData(a)},b.prototype.buildInactiveChannelListQueryFromSerializedData=function(a){return this._manager.buildInactiveChannelListQueryFromSerializedData(a)},b.prototype.buildMemberFromSerializedData=function(a){return this._manager.buildMemberFromSerializedData(a)},b.prototype.getChannel=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),[2,this._manager.getChannel(a)]})})},b.prototype.getChannelWithoutCache=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),[2,this._manager.getChannelWithoutCache(a)]})})},b.prototype.getMyGroupChannelChangeLogsByToken=function(a,b){return void 0===b&&(b={}),(0,f._)(this,void 0,void 0,function(){var c;return(0,f.b)(this,function(d){switch(d.label){case 0:return c=(0,f.d)((0,f.d)({},g.d),b),(0,f.p)((0,f.a)("string",a)&&(0,g.v)(c)).throw(f.q.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(a,c)];case 1:return[2,d.sent()]}})})},b.prototype.getMyGroupChannelChangeLogsByTimestamp=function(a,b){return void 0===b&&(b={}),(0,f._)(this,void 0,void 0,function(){var c;return(0,f.b)(this,function(d){switch(d.label){case 0:return c=(0,f.d)((0,f.d)({},g.d),b),(0,f.p)((0,f.a)("number",a)&&(0,g.v)(c)).throw(f.q.invalidParameters),[4,this._manager.getMyGroupChannelChangeLogs(a,c)];case 1:return[2,d.sent()]}})})},b.prototype.getGroupChannelCount=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},g.e),a),(0,f.p)((0,g.f)(b)).throw(f.q.invalidParameters),[2,this._manager.getGroupChannelCount(b)]})})},b.prototype.getUnreadItemCount=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,this._manager.getUnreadItemCount(a)];case 1:return[2,b.sent()]}})})},b.prototype.getTotalUnreadChannelCount=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,this._manager.getTotalUnreadChannelCount()];case 1:return[2,a.sent()]}})})},b.prototype.getTotalUnreadMessageCount=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,this._manager.getTotalUnreadMessageCount(a)];case 1:return[2,b.sent()]}})})},b.prototype.getTotalScheduledMessageCount=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,this._manager.getTotalScheduledMessageCount(a)];case 1:return[2,b.sent()]}})})},b.prototype.getSubscribedTotalUnreadMessageCount=function(){return this._manager.getSubscribedTotalUnreadMessageCount()},b.prototype.getSubscribedCustomTypeTotalUnreadMessageCount=function(){return this._manager.getSubscribedCustomTypeTotalUnreadMessageCount()},b.prototype.getSubscribedCustomTypeUnreadMessageCount=function(a){return this._manager.getSubscribedCustomTypeUnreadMessageCount(a)},b.prototype.createChannel=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},g.g),a),(0,f.p)((0,g.h)(b)).throw(f.q.invalidParameters),[2,this._manager.createChannel(b)]})})},b.prototype.createDistinctChannelIfNotExist=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},g.g),a),(0,f.p)((0,g.h)(b)).throw(f.q.invalidParameters),b&&(b.isDistinct=!0),[2,this.createChannel(b)]})})},b.prototype.createChannelWithUserIds=function(a,b,c,d,e,h){return void 0===b&&(b=!1),void 0===e&&(e=""),void 0===h&&(h=""),(0,f._)(this,void 0,void 0,function(){var i;return(0,f.b)(this,function(j){return i=(0,f.d)((0,f.d)({},g.g),{invitedUserIds:a,isDistinct:b,name:c,data:e,customType:h}),"string"==typeof d?i.coverUrl=d:i.coverImage=d,[2,this.createChannel(i)]})})},b.prototype.markAsReadAll=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return this._manager.markAsReadAll(),[2]})})},b.prototype.markAsReadWithChannelUrls=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),this._manager.markAsReadWithChannelUrls(a),[2]})})},b.prototype.markAsDelivered=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),[4,this.getChannel(a)];case 1:return[4,b.sent().markAsDelivered()];case 2:return b.sent(),[2]}})})},b}(f.aq)},11966:function(a,b,c){"use strict";c.d(b,{ZP:function(){return aY}});var d,e,f=c(84663),g=c(89531),h={channelUrl:"",channelType:f.C.BASE,messageId:0,includeReactions:!1,includeMetaArray:!1,includeParentMessageInfo:!1,includeThreadInfo:!1},i=function(a){function b(b){var c=b.channelCustomType,d=b.keyword,e=b.limit,g=b.reverse,h=b.exactMatch,i=b.channelUrl,j=b.order,k=b.messageTimestampFrom,l=b.messageTimestampTo,m=b.advancedQuery,n=b.targetFields,o=b.nextToken,p=a.call(this)||this;return p.method=f.A.GET,p.path="".concat(f.ao,"/messages"),p.params=(0,f.f)({custom_type:c,query:d,limit:e,reverse:g,exact_match:h,channel_url:i,message_ts_from:k,message_ts_to:l,sort_field:j,advanced_query:m,target_fields:n,after:o}),p}return(0,f.c)(b,a),b}(f.h),j=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.messages=c.results.map(function(a){return(0,g.Q)(b,a)}),d.hasNext=c.has_next,d.nextToken=c.end_cursor,d.totalCount=c.total_count,d}return(0,f.c)(b,a),b}(f.j);(e=d||(d={})).SCORE="score",e.TIMESTAMP="ts";var k,l,m=function(a){function b(b,c){var e,f,g,h,i,j,k,l,m,n=this;return(n=a.call(this,b,c)||this).keyword="",n.reverse=!1,n.exactMatch=!1,n.channelUrl=null,n.channelCustomType=null,n.messageTimestampFrom=null,n.messageTimestampTo=null,n.order=d.SCORE,n.advancedQuery=!1,n.targetFields=null,n._nextToken="",n.totalCount=-1,n.keyword=c.keyword,n.reverse=null!==(e=c.reverse)&& void 0!==e&&e,n.exactMatch=null!==(f=c.exactMatch)&& void 0!==f&&f,n.channelUrl=null!==(g=c.channelUrl)&& void 0!==g?g:null,n.channelCustomType=null!==(h=c.channelCustomType)&& void 0!==h?h:null,n.messageTimestampFrom=null!==(i=c.messageTimestampFrom)&& void 0!==i?i:null,n.messageTimestampTo=null!==(j=c.messageTimestampTo)&& void 0!==j?j:null,n.order=null!==(k=c.order)&& void 0!==k?k:d.SCORE,n.advancedQuery=null!==(l=c.advancedQuery)&& void 0!==l&&l,n.targetFields=null!==(m=c.targetFields)&& void 0!==m?m:null,n}return(0,f.c)(b,a),b.prototype._validate=function(){return a.prototype._validate.call(this)&&(0,f.a)("string",this.keyword)&&this.keyword.length>0&&(0,f.a)("boolean",this.reverse)&&(0,f.a)("boolean",this.exactMatch)&&(0,f.a)("string",this.channelUrl,!0)&&(0,f.a)("string",this.channelCustomType,!0)&&(0,f.a)("number",this.messageTimestampFrom,!0)&&(0,f.a)("number",this.messageTimestampTo,!0)&&(0,f.a5)(d,this.order)&&(0,f.a)("boolean",this.advancedQuery)&&(0,f.a2)("string",this.targetFields,!0)},b.prototype.next=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g,h,k;return(0,f.b)(this,function(l){switch(l.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,a=f.V.of(this._iid).requestQueue,b=new i((0,f.g)((0,f.d)((0,f.d)({},this),{nextToken:this._nextToken?this._nextToken:null}))),[4,a.send(b)]):[3,2]:[3,5];case 1:return e=(d=(c=l.sent()).as(j)).messages,g=d.hasNext,h=d.nextToken,k=d.totalCount,this._nextToken=h,this._hasNext=g,this._isLoading=!1,this.totalCount=k,[2,e];case 2:return[2,[]];case 3:throw f.q.queryInProgress;case 4:return[3,6];case 5:throw f.q.invalidParameters;case 6:return[2]}})})},b}(f.ap),n={channelUrl:"",scheduledMessageId:0};(l=k||(k={})).GOOD="good",l.BAD="bad";var o,p,q={reverse:!1,limit:20};(p=o||(o={})).TEXT="text",p.TEXTAREA="textarea",p.NUMBER="number",p.PHONE="phone",p.EMAIL="email",p.CHIP="chip";var r,s=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.name="message",b}return(0,f.c)(b,a),b.prototype.init=function(b,c){var d=c.sdkState,e=c.dispatcher,f=c.sessionManager,h=c.requestQueue,i=c.logger,j=c.onlineDetector,k=c.cacheContext;a.prototype.init.call(this,b,{sdkState:d,dispatcher:e,sessionManager:f,requestQueue:h,logger:i,onlineDetector:j,cacheContext:k}),this._manager=new g.T(b,{sdkState:d,dispatcher:e,requestQueue:h,onlineDetector:j,cacheContext:k})},b.prototype.buildMessageFromSerializedData=function(a){return this._manager.buildMessageFromSerializedData(a)},b.prototype.buildSenderFromSerializedData=function(a){return this._manager.buildSenderFromSerializedData(a)},b.prototype.getMessage=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c;return(0,f.b)(this,function(d){switch(d.label){case 0:var e;return b=(0,f.d)((0,f.d)({},h),a),(0,f.p)((e=b,(0,f.a)("string",e.channelUrl)&&(0,f.a5)(f.C,e.channelType)&&(0,f.a)("number",e.messageId)&&(0,f.a)("boolean",e.includeReactions,!0)&&(0,f.a)("boolean",e.includeMetaArray,!0)&&(0,f.a)("boolean",e.includeParentMessageInfo,!0)&&(0,f.a)("boolean",e.includeThreadInfo,!0))).throw(f.q.invalidParameters),[4,this._manager.getMessage(b)];case 1:if((c=d.sent())instanceof g.V||c instanceof g.W||null===c)return[2,c];throw"Unknown message type is given."}})})},b.prototype.getScheduledMessage=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){var d;return b=(0,f.d)((0,f.d)({},n),a),(0,f.p)((d=b,(0,f.a)("string",d.channelUrl)&&""!==d.channelUrl&&(0,f.a)("number",d.scheduledMessageId)&&d.scheduledMessageId>0)).throw(f.q.invalidParameters),[2,this._manager.getScheduledMessage(b)]})})},b.prototype.getMessageTemplatesByToken=function(a,b){return void 0===b&&(b={}),(0,f._)(this,void 0,void 0,function(){var c;return(0,f.b)(this,function(d){var e;return c=(0,f.d)((0,f.d)({},q),b),(0,f.p)((0,f.a)("string",a,!0)&&(e=c,(0,f.a)("boolean",e.reverse,!0)&&(0,f.a)("number",e.limit,!0)&&(0,f.a2)("string",e.keys,!0))).throw(f.q.invalidParameters),[2,this._manager.getMessageTemplatesByToken(a,c)]})})},b.prototype.getMessageTemplate=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),[2,this._manager.getMessageTemplate(a)]})})},b}(f.aq),t=function(a){function b(){var b=null!==a&&a.apply(this,arguments)||this;return b.name="poll",b}return(0,f.c)(b,a),b.prototype.init=function(b,c){var d=c.sdkState,e=c.dispatcher,g=c.sessionManager,h=c.requestQueue,i=c.logger,j=c.onlineDetector,k=c.cacheContext;a.prototype.init.call(this,b,{sdkState:d,dispatcher:e,sessionManager:g,requestQueue:h,logger:i,onlineDetector:j,cacheContext:k}),this._manager=new f.ay(b,{sdkState:d,dispatcher:e,sessionManager:g,requestQueue:h,logger:i,onlineDetector:j,cacheContext:k})},b.prototype.create=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},f.az),a),(0,f.p)((0,f.aA)(b)).throw(f.q.invalidParameters),[2,this._manager.create(b)]})})},b.prototype.get=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},f.aB),a),(0,f.p)((0,f.aC)(b)).throw(f.q.invalidParameters),[2,this._manager.get(b)]})})},b.prototype.getOption=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){return b=(0,f.d)((0,f.d)({},f.aD),a),(0,f.p)((0,f.aE)(b)).throw(f.q.invalidParameters),[2,this._manager.getOption(b)]})})},b.prototype.buildPollFromSerializedData=function(a){return this._manager.buildPollFromSerializedData(a)},b}(f.aq),u=c(82861),v=function(a){function b(){return null!==a&&a.apply(this,arguments)||this}return(0,f.c)(b,a),b}(f.bk),w=c(73576),x=function(a){this.key=a.key,this.url=a.url},y=function(a){this.id=a.id,this.name=a.name,this.url=a.url,this.emojis=a.emojis?a.emojis.map(function(a){return new x(a)}):[]},z=function(a){this.emojiHash=a.emoji_hash||"",this.emojiCategories=a.emoji_categories?a.emoji_categories.map(function(a){return new y(a)}):[]},A={profileImage:void 0,profileUrl:void 0,nickname:void 0},B=function(a){return{v2:function(){return(0,f._)(void 0,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,a.commitSchema([{collectionName:g.a,keyName:g.b,index:[(0,u.g)(u.G.LATEST_LAST_MESSAGE),(0,u.g)(u.G.CHRONOLOGICAL),(0,u.g)(u.G.CHANNEL_NAME_ALPHABETICAL)]},{collectionName:g.N,keyName:g.c,index:[(0,g.g)(g.M.CHANNEL_LATEST),(0,g.g)(g.M.NEWEST_CHILD_MESSAGE)]},{collectionName:g.d,keyName:g.e,index:[(0,g.g)(g.M.CHANNEL_LATEST),(0,g.g)(g.M.NEWEST_CHILD_MESSAGE)]},{collectionName:g.f,keyName:g.h}])];case 1:return[2,b.sent()]}})})},v3:function(){return(0,f._)(void 0,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:var c;return[4,a.commitSchema([{collectionName:g.i,keyName:g.j,index:[["-lastMessageUpdatedAt","-createdAt","syncIndex"]]}])];case 1:return[2,b.sent()]}})})},v4:function(){return(0,f._)(void 0,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,a.commitSchema([{collectionName:g.k,keyName:g.l,index:[(0,g.m)()]}])];case 1:return[2,b.sent()]}})})},v5:function(){return(0,f._)(void 0,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,a.commitSchema([{collectionName:g.n,keyName:g.o,index:[["-userId","-updatedAt"]]}])];case 1:return[2,b.sent()]}})})}}},C=function(a){var b=new g.L;return function(c,d){return(0,f._)(void 0,void 0,void 0,function(){var e,h,i,j;return(0,f.b)(this,function(k){switch(k.label){case 0:switch(c){case 1:case 2:case 3:case 4:return[3,1];case 5:return[3,2];case 6:return[3,4];case 7:return[3,11]}return[3,15];case 1:case 10:case 14:return d(),[3,16];case 2:return[4,a.reset()];case 3:return k.sent(),d(),[3,16];case 4:return k.trys.push([4,9,,10]),h=(e=B(a)).v2,i=e.v3,j=e.v4,[4,h()];case 5:return k.sent(),[4,i()];case 6:return k.sent(),[4,j()];case 7:return k.sent(),[4,a.collection(g.N).removeIf({where:{channelType:f.C.OPEN}})];case 8:return k.sent(),[3,10];case 9:return k.sent(),b.warn("Failed to migrate to v2, v3, v4"),[3,10];case 11:return k.trys.push([11,13,,14]),[4,(0,B(a).v5)()];case 12:return k.sent(),[3,14];case 13:return k.sent(),b.warn("Failed to migrate to v5"),[3,14];case 15:d(),k.label=16;case 16:return[2]}})})}},D=function(){return"undefined"!=typeof document?document.visibilityState:"visible"},E=function(a){function b(b){var c=b.getVisibilityState,d=b.initialState,e=b.isEnabled,g=b.pauseCheckDelay,h=b.supportMultipleTabs,i=b.localCacheEnabled,j=a.call(this)||this;return j._currentVisibility="visible",j._activeTimestamp=0,j._storageKey="",j._onMessage=function(a){if(j.isActive){var b=a.data;if(b.tabId!==j._tabId&&"SB_ACTIVE_APP"===b.type){if(b.timestamp<=j._activeTimestamp)return;j._changeAppStateToInactive()}}},j._onStorage=function(a){if(j.isActive&&a.key===j._storageKey&&a.newValue)try{var b=JSON.parse(a.newValue);if(b.tabId===j._tabId||b.timestamp<=j._activeTimestamp)return;j._changeAppStateToInactive()}catch(c){console.warn("failed to parse active tab info from storage",c)}},j._toggleFocusState=function(){j.isActive||"visible"===j._currentVisibility&&j._changeAppStateToActive()},j._toggleStateByVisibilityState=function(){var a=j._getVisibilityState();if("visible"===a&&j.dispatch("page_visible"),"visible"===a){if("hidden"===j._currentVisibility){if(j.isActive)return;j._changeAppStateToActive(),j._dispatchAppStateEvent()}}else if("hidden"===a&&"visible"===j._currentVisibility){if(!j.isActive)return;j._changeAppStateToInactive()}j._currentVisibility=a},j._dispatchAppStateEvent=function(){j.isActive?j.dispatch("resume"):(j._clearPauseTimer(),j._pauseCheckDelay&&(j._pauseDelayTimer=setTimeout(function(){j._pauseDelayTimer=void 0,j.dispatch("pause")},j._pauseCheckDelay)))},j._dispatchLocalCacheEvent=function(){j.isActive?j.dispatch("enable_local_cache"):j.dispatch("disable_local_cache")},j._changeAppStateToActive=function(){if(j._clearPauseTimer(),j._activeTimestamp=Date.now(),j._currentState="ACTIVE",!j._supportMultipleTabs&&j._pauseCheckDelay||j._dispatchLocalCacheEvent(),j._supportMultipleTabs){var a={tabId:j._tabId,timestamp:j._activeTimestamp};j._broadcastChannel?j._broadcastChannel.postMessage((0,f.d)({type:"SB_ACTIVE_APP"},a)):localStorage.setItem(j._storageKey,JSON.stringify(a))}},j._changeAppStateToInactive=function(){var a=j._getVisibilityState();j._currentState="INACTIVE",!j._supportMultipleTabs&&j._pauseCheckDelay||j._dispatchLocalCacheEvent(),"hidden"===a&&j._dispatchAppStateEvent()},j._clearPauseTimer=function(){j._pauseDelayTimer&&(clearTimeout(j._pauseDelayTimer),j._pauseDelayTimer=void 0)},j._getVisibilityState=void 0===c?D:c,j._isEnabled=void 0===e||e,j._supportMultipleTabs=!!(void 0!==i&&i)&& void 0!==h&&h,j._pauseCheckDelay=g,j._currentVisibility=void 0===d?"visible":d,j}return(0,f.c)(b,a),Object.defineProperty(b.prototype,"isActive",{get:function(){return"ACTIVE"===this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"currentVisibility",{get:function(){return this._currentVisibility},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isAvailableBroadCast",{get:function(){return"undefined"!=typeof BroadcastChannel},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isAvailable",{get:function(){return"undefined"!=typeof window&&!!window.addEventListener&&!!window.removeEventListener},enumerable:!1,configurable:!0}),b.prototype.start=function(a){var b=a.appId,c=a.userId,d=a.backgroundConnectionCloseTimeout;if(this._isEnabled&&this.isAvailable){if(void 0!==d&& -1!==d&&(this._pauseCheckDelay=0===d?10:1e3*d),this._supportMultipleTabs){var e="sendbird-".concat(b,"-").concat(c);if(this._tabId="".concat(e,"-").concat((0,f.u)()),this._storageKey="".concat("sendbird-active-app:").concat(b,"-").concat(c),this.isAvailableBroadCast)try{this._broadcastChannel=new BroadcastChannel(e),this._broadcastChannel.onmessage=this._onMessage}catch(g){window.addEventListener("storage",this._onStorage,{capture:!0})}else window.addEventListener("storage",this._onStorage,{capture:!0});window.addEventListener("focus",this._toggleFocusState,{capture:!0}),window.addEventListener("pointerdown",this._toggleFocusState,{capture:!0})}window.addEventListener("visibilitychange",this._toggleStateByVisibilityState,{capture:!0}),"hidden"!==this.currentVisibility?this._changeAppStateToActive():this._currentState="INACTIVE"}},b.prototype.stop=function(){this._isEnabled&&this.isAvailable&&(this._clearPauseTimer(),this._supportMultipleTabs&&(this._broadcastChannel?(this._broadcastChannel.onmessage=null,this._broadcastChannel.close(),this._broadcastChannel=void 0):window.removeEventListener("storage",this._onStorage,{capture:!0}),window.removeEventListener("focus",this._toggleFocusState,{capture:!0}),window.removeEventListener("pointerdown",this._toggleFocusState,{capture:!0})),window.removeEventListener("visibilitychange",this._toggleStateByVisibilityState,{capture:!0}),this._tabId="",this._currentState="INACTIVE",this._activeTimestamp=0)},b}(f.E),F=function(){function a(a){var b=a.logger,c=a.connectionDelegate,d=void 0===c?null:c,e=this;this._onlineWorker=function(){var a;return null===(a=e.connectionDelegate)|| void 0===a?void 0:a.reconnect()},this._offlineWorker=function(){var a;return null===(a=e.connectionDelegate)|| void 0===a?void 0:a.disconnect()},this.unsubscribes=[],this._onlineListener=function(a){if(e.isAvailableOnWeb)return window.addEventListener("online",a),function(){return window.removeEventListener("online",a,!1)}},this._offlineListener=function(a){if(e.isAvailableOnWeb)return window.addEventListener("offline",a),function(){return window.removeEventListener("offline",a,!1)}},this.logger=b,d&&(this.connectionDelegate=d)}return Object.defineProperty(a.prototype,"isAvailableOnWeb",{get:function(){return"undefined"!=typeof window&&!!window.addEventListener&&"ononline"in window&&"onoffline"in window&&"undefined"!=typeof navigator&& void 0!==navigator.onLine},enumerable:!1,configurable:!0}),a.prototype.setOnlineListener=function(a){Boolean(a)&&"function"==typeof a&&(this._onlineListener=a)},a.prototype.setOfflineListener=function(a){Boolean(a)&&"function"==typeof a&&(this._offlineListener=a)},a.prototype.start=function(){this.unsubscribes=[this._onlineListener(this._onlineWorker),this._offlineListener(this._offlineWorker)]},a.prototype.stop=function(){var a=this;this.unsubscribes.forEach(function(b){try{null==b||b()}catch(c){a.logger.warn(c.message)}}),this.unsubscribes=[]},a.prototype.isOnline=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return this.isAvailableOnWeb?[2,navigator.onLine]:[2,new Promise(function(a){fetch("https://www.google.com",{method:f.A.GET,mode:"no-cors"}).then(function(){return a(!0)}).catch(function(){return a(!1)})})]})})},a}(),G=function(a){function b(b){var c,d=this;return(d=a.call(this)||this).method=f.A.GET,d.path=f.e,d.params=(0,f.f)((0,f.g)({ts:"number"==typeof b.token?b.token:void 0,token:"string"==typeof b.token?b.token:void 0,limit:null!==(c=b.limit)&& void 0!==c?c:100})),d}return(0,f.c)(b,a),b}(f.h),H=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.configs=c.configs,d.hasMore=c.has_more,d.nextToken=c.next,d.ts=c.ts,d}return(0,f.c)(b,a),b}(f.j),I=function(a){function b(b){var c=b.userId,d=b.nickname,e=b.profileUrl,g=b.profileImage,h=b.preferredLanguages,i=a.call(this)||this;return i.method=f.A.PUT,i.path="".concat(f.k,"/").concat(encodeURIComponent(c)),i.params=(0,f.f)((0,f.g)({nickname:d,profile_url:e,profile_file:g,preferred_languages:h})),i}return(0,f.c)(b,a),b}(f.h),J=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.user=new f.U(b,(0,f.d)({},c)),d}return(0,f.c)(b,a),b}(f.j),K=function(a){function b(b){var c=b.userId,d=b.token,e=b.deviceOS,g=b.deviceManufacturer,h=b.systemPushEnabled,i=b.unique,j=a.call(this)||this;return j.method=f.A.POST,j.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/apns"),j.params=(0,f.f)({apns_device_token:d,always_push:!0,device_os:e,device_manufacturer:g,system_push_enabled:h,is_unique:i}),j}return(0,f.c)(b,a),b}(f.h),L=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),M=function(a){function b(b){var c=b.userId,d=b.token,e=b.deviceOS,g=b.deviceManufacturer,h=b.systemPushEnabled,i=b.unique,j=a.call(this)||this;return j.method=f.A.POST,j.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/gcm"),j.params=(0,f.f)({gcm_reg_token:d,always_push:!0,device_os:e,device_manufacturer:g,system_push_enabled:h,is_unique:i}),j}return(0,f.c)(b,a),b}(f.h),N=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),O=function(a){function b(b){var c=b.userId,d=b.token,e=a.call(this)||this;return e.method=f.A.DELETE,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/apns/").concat(encodeURIComponent(d)),e}return(0,f.c)(b,a),b}(f.h),P=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.token=c.token,d.user=new f.U(b,c.user),d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),Q=function(a){function b(b){var c=b.userId,d=b.token,e=a.call(this)||this;return e.method=f.A.DELETE,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/gcm/").concat(encodeURIComponent(d)),e}return(0,f.c)(b,a),b}(f.h),R=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.token=c.token,d.user=new f.U(b,c.user),d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),S=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.DELETE,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/apns"),d}return(0,f.c)(b,a),b}(f.h),T=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.type=c.type?f.P[c.type.toLowerCase()]:f.P.UNKNOWN,d.user=new f.U(b,c.user),d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),U=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.DELETE,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/gcm"),d}return(0,f.c)(b,a),b}(f.h),V=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.type=c.type?f.P[c.type.toLowerCase()]:f.P.UNKNOWN,d.user=new f.U(b,c.user),d.lastDeletedAt=c.device_token_last_deleted_at,d}return(0,f.c)(b,a),b}(f.j),W=function(a){function b(b){var c=b.userId,d=b.type,e=b.token,g=b.ts,h=a.call(this)||this;return h.method=f.A.GET,h.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/").concat(encodeURIComponent(d),"/device_tokens"),h.params={created_ts:g,token:e},h}return(0,f.c)(b,a),b}(f.h),X=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.pushTokens={type:c.type?f.P[c.type.toLowerCase()]:f.P.UNKNOWN,deviceTokens:c.device_tokens,hasMore:c.has_more,token:c.token},d}return(0,f.c)(b,a),b}(f.j),Y=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/channel_invitation_preference"),d}return(0,f.c)(b,a),b}(f.h),Z=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.autoAccept=c.auto_accept,d}return(0,f.c)(b,a),b}(f.j),$=function(a){function b(b){var c=b.userId,d=b.willAutoAccept,e=a.call(this)||this;return e.method=f.A.PUT,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/channel_invitation_preference"),e.params={auto_accept:d},e}return(0,f.c)(b,a),b}(f.h),_=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.autoAccept=c.auto_accept,d}return(0,f.c)(b,a),b}(f.j),aa=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),d}return(0,f.c)(b,a),b}(f.h),ab=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.preference={doNotDisturbOn:c.do_not_disturb,startHour:c.start_hour,startMin:c.start_min,endHour:c.end_hour,endMin:c.end_min,timezone:c.timezone},d}return(0,f.c)(b,a),b}(f.j),ac=function(a){function b(b){var c=b.userId,d=b.doNotDisturbOn,e=b.startHour,g=b.startMin,h=b.endHour,i=b.endMin,j=b.timezone,k=a.call(this)||this;return k.method=f.A.PUT,k.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),k.params={do_not_disturb:d,start_hour:e,start_min:g,end_hour:h,end_min:i,timezone:j},k}return(0,f.c)(b,a),b}(f.h),ad=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.preference={doNotDisturbOn:c.do_not_disturb,startHour:c.start_hour,startMin:c.start_min,endHour:c.end_hour,endMin:c.end_min,timezone:c.timezone},d}return(0,f.c)(b,a),b}(f.j),ae=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),d}return(0,f.c)(b,a),b}(f.h),af=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.snoozePeriod={isSnoozeOn:c.snooze_enabled},"number"==typeof c.snooze_start_ts&&(d.snoozePeriod.startTs=c.snooze_start_ts),"number"==typeof c.snooze_end_ts&&(d.snoozePeriod.endTs=c.snooze_end_ts),d}return(0,f.c)(b,a),b}(f.j),ag=function(a){function b(b){var c=b.userId,d=b.snoozeOn,e=b.startTs,g=b.endTs,h=a.call(this)||this;return h.method=f.A.PUT,h.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),h.params={snooze_enabled:d,snooze_start_ts:e,snooze_end_ts:g},h}return(0,f.c)(b,a),b}(f.h),ah=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.snoozePeriod={isSnoozeOn:c.snooze_enabled},"number"==typeof c.snooze_start_ts&&(d.snoozePeriod.startTs=c.snooze_start_ts),"number"==typeof c.snooze_end_ts&&(d.snoozePeriod.endTs=c.snooze_end_ts),d}return(0,f.c)(b,a),b}(f.j),ai=function(a){function b(b){var c=b.userId,d=b.blockedUserId,e=a.call(this)||this;return e.method=f.A.POST,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/block"),e.params={target_id:d},e}return(0,f.c)(b,a),b}(f.h);r=f.j,(0,f.c)(function(a,b){var c=r.call(this,a,b)||this;return c.user=new f.U(a,b),c},r);var aj,ak=function(a){function b(b){var c=b.userId,d=b.unblockedUserId,e=a.call(this)||this;return e.method=f.A.DELETE,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/block/").concat(encodeURIComponent(d)),e}return(0,f.c)(b,a),b}(f.h);aj=f.j,(0,f.c)(function(){return null!==aj&&aj.apply(this,arguments)||this},aj);var al,am=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),d}return(0,f.c)(b,a),b}(f.h),an=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.pushTriggerOption=c.push_trigger_option,d}return(0,f.c)(b,a),b}(f.j),ao=function(a){function b(b){var c=b.userId,d=b.pushTriggerOption,e=a.call(this)||this;return e.method=f.A.PUT,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),e.params={push_trigger_option:d},e}return(0,f.c)(b,a),b}(f.h),ap=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.pushTriggerOption=c.push_trigger_option,d}return(0,f.c)(b,a),b}(f.j),aq=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/template"),d}return(0,f.c)(b,a),b}(f.h),ar=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.name=c.name,d}return(0,f.c)(b,a),b}(f.j),as=function(a){function b(b){var c=b.userId,d=b.templateName,e=a.call(this)||this;return e.method=f.A.PUT,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push/template"),e.params={name:d},e}return(0,f.c)(b,a),b}(f.h),at=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.name=c.name,d}return(0,f.c)(b,a),b}(f.j),au=function(a){function b(b){var c=b.userId,d=b.token,e=a.call(this)||this;return e.method=f.A.GET,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/friends/changelogs"),e.params={token:d},e}return(0,f.c)(b,a),b}(f.h),av=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.changelogs={addedUsers:c.added.map(function(a){return new f.U(b,a)}),updatedUsers:c.updated.map(function(a){return new f.U(b,a)}),deletedUserIds:c.deleted,hasMore:c.has_more,token:c.next},d}return(0,f.c)(b,a),b}(f.j),aw=function(a){function b(b){var c=b.userId,d=b.discoveries,e=a.call(this)||this;return e.method=f.A.PUT,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/friend_discoveries"),e.params={friend_discoveries:d.map(function(a){return{friend_discovery_key:a.friendDiscoveryKey,friend_name:a.friendName}})},e}return(0,f.c)(b,a),b}(f.h),ax=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.friendDiscoveryRequestId=c.friend_discovery_request_id,d}return(0,f.c)(b,a),b}(f.j),ay=function(a){function b(b){var c=b.userId,d=b.discoveryKeys,e=a.call(this)||this;return e.method=f.A.DELETE,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/friend_discoveries"),e.params={friend_discovery_keys:d},e}return(0,f.c)(b,a),b}(f.h);al=f.j,(0,f.c)(function(){return null!==al&&al.apply(this,arguments)||this},al);var az,aA=function(a){function b(b){var c=b.userId,d=b.userIds,e=a.call(this)||this;return e.method=f.A.POST,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/friends"),e.params={user_ids:d},e}return(0,f.c)(b,a),b}(f.h),aB=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.users=c.users.map(function(a){return new f.U(b,a)}),d}return(0,f.c)(b,a),b}(f.j),aC=function(a){function b(b){var c=b.userId,d=b.userIds,e=a.call(this)||this;return e.method=f.A.DELETE,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/friends"),e.params={user_ids:d},e}return(0,f.c)(b,a),b}(f.h);az=f.j,(0,f.c)(function(){return null!==az&&az.apply(this,arguments)||this},az);var aD,aE=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/allow_friend_discovery"),d.params={},d}return(0,f.c)(b,a),b}(f.h),aF=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.allowFriendDiscovery=c.allow_friend_discovery,d}return(0,f.c)(b,a),b}(f.j),aG=function(a){function b(b){var c=b.userId,d=b.allowFriendDiscovery,e=a.call(this)||this;return e.method=f.A.PUT,e.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/allow_friend_discovery"),e.params={allow_friend_discovery:d},e}return(0,f.c)(b,a),b}(f.h);aD=f.j,(0,f.c)(function(){return null!==aD&&aD.apply(this,arguments)||this},aD);var aH,aI,aJ=function(a){function b(b){var c=b.doNotDisturbOn,d=b.userId,e=b.weeklyDndSchedules,h=b.timezone,i=a.call(this)||this;return i.method=f.A.PUT,i.path="".concat(f.k,"/").concat(encodeURIComponent(d),"/push_preference"),i.params=(0,f.f)({do_not_disturb:void 0===c||c,dnd_schedules:e?g.D.payloadify(e):[],timezone:h}),i}return(0,f.c)(b,a),b}(f.h),aK=function(a){function b(b,c){var d,e=this;return(e=a.call(this,b,c)||this).preference={doNotDisturbOn:c.do_not_disturb,dndSchedules:g.D.buildDndScheduleFromPayload(null!==(d=c.dnd_schedules)&& void 0!==d?d:[]),timezone:c.timezone},e}return(0,f.c)(b,a),b}(f.j),aL=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),d}return(0,f.c)(b,a),b}(f.h),aM=function(a){function b(b,c){var d,e=this;return(e=a.call(this,b,c)||this).preference={doNotDisturbOn:c.do_not_disturb,dndSchedules:g.D.buildDndScheduleFromPayload(null!==(d=c.dnd_schedules)&& void 0!==d?d:[]),timezone:c.timezone},e}return(0,f.c)(b,a),b}(f.j),aN=function(a){function b(b){var c=b.userId,d=a.call(this)||this;return d.method=f.A.DELETE,d.path="".concat(f.k,"/").concat(encodeURIComponent(c),"/push_preference"),d}return(0,f.c)(b,a),b}(f.h),aO=function(a){function b(){var b=a.call(this)||this;return b.method=f.A.GET,b.path=f.l,b}return(0,f.c)(b,a),b}(f.h),aP=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.emojiContainer=new z(c),d}return(0,f.c)(b,a),b}(f.j),aQ=function(a){function b(b){var c=b.categoryId,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.l,"/").concat(c),d}return(0,f.c)(b,a),b}(f.h),aR=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.emojiCategory=new y(c),d}return(0,f.c)(b,a),b}(f.j),aS=function(a){function b(b){var c=b.key,d=a.call(this)||this;return d.method=f.A.GET,d.path="".concat(f.m,"/").concat(c),d}return(0,f.c)(b,a),b}(f.h),aT=function(a){function b(b,c){var d=a.call(this,b,c)||this;return d.emoji=new x(c),d}return(0,f.c)(b,a),b}(f.j),aU=function(a){function b(){var b=a.call(this)||this;return b.method=f.A.GET,b.path="".concat(f.n),b}return(0,f.c)(b,a),b}(f.h),aV=function(a){function b(b,c){var d,e=this,f=null!=c?c:{};return(e=a.call(this,b,c)||this).uikitConfiguration={string:JSON.stringify(f),json:f},e.updatedAt=null!==(d=null==c?void 0:c.updated_at)&& void 0!==d?d:0,e}return(0,f.c)(b,a),b}(f.j);(aI=aH||(aH={})).DELIVERED="DELIVERED",aI.CLICKED="CLICKED";var aW,aX=function(a){function b(b){var c=b.deviceToken,d=b.pushTrackingId,e=b.messageId,g=b.allowedPushNotification,h=b.channelKey,i=b.templateKey,j=b.eventType,k=b.notificationEventDeadline,l=a.call(this)||this;return l.method=f.A.POST,l.path=f.o,l.params=(0,f.f)({device_token:c,push_tracking_id:d,message_id:e,allowed_push_notification:g,channel_key:h,template_key:i,event_type:j,notification_event_deadline:k}),l}return(0,f.c)(b,a),b}(f.h),aY=function(){function a(a,b,c){var d=this;this._storeInitialized=!1,this._iid=a,this.options=b;var e=f.V.of(a),g=e.sdkState,h=e.cacheContext,i=e.dispatcher,j=e.sessionManager,k=e.requestQueue,l=e.logger,m=e.userEventHandlers,n=e.appStateToggleEnabled,o=e.supportMultipleTabs;this._onlineDetector=new F({logger:l,connectionDelegate:{reconnect:function(){return(0,f._)(d,void 0,void 0,function(){var b,c,d,e,g,h;return(0,f.b)(this,function(j){switch(j.label){case 0:if(c=(b=f.V.of(a)).sdkState,d=b.connectionManager,(e=b.sessionManager).session.hasSession)return[3,5];j.label=1;case 1:return j.trys.push([1,3,,4]),[4,d.connect(e.session.authToken)];case 2:return j.sent(),[3,4];case 3:if(g=j.sent(),(0,f.a1)(g))throw g;return l.debug("connect failed by reconnect event = ",g),[3,4];case 4:return[3,9];case 5:if("foreground"!==c.appState)return[3,9];j.label=6;case 6:return j.trys.push([6,8,,9]),[4,d.resetAndReconnect()];case 7:return j.sent(),[3,9];case 8:if(h=j.sent(),(0,f.a1)(h))throw h;return l.debug("resetAndReconnect failed by reconnect event = ",h),[3,9];case 9:return i.dispatch(new v),[2]}})})},disconnect:function(){(0,f.J)(function(){return(0,f._)(d,void 0,void 0,function(){var b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return c=(b=f.V.of(a)).connectionManager,d=b.dispatcher,[4,c.disconnect()];case 1:return e.sent(),d.dispatch(new f.z(new f.B({type:f.D.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:f.F.NETWORK_ERROR,error_description:"cause=network_closed"}}))),[2]}})})})}}});var p=new u.A(a,{localCacheEnabled:h.localCacheEnabled,enableAutoResend:h.localCacheConfig.enableAutoResend,hasAiAgentModule:c.some(function(a){return"aiAgent"===a.name}),dispatcher:i,sdkState:g,logger:l});c.forEach(function(b){b.init(a,{sdkState:g,cacheContext:h,dispatcher:i,sessionManager:j,requestQueue:k,logger:l,onlineDetector:d._onlineDetector}),d[b.name]=b}),this._appStateChangeDetector=new E({isEnabled:n,supportMultipleTabs:o,localCacheEnabled:h.localCacheEnabled}),this._appStateChangeDetector.on("resume",function(){l.debug("the page resumes from freeze"),d.setForegroundState()}).on("pause",function(){l.debug("the page freezes"),d.setBackgroundState()}).on("enable_local_cache",function(){l.debug("the local cache is enabled because the page is active"),h.localCacheEnabled=!0,d._setAppActiveState(!0),"foreground"===g.appState&&i.dispatch(new u.F)}).on("disable_local_cache",function(){l.debug("the local cache is disabled because the page is inactive"),h.localCacheEnabled=!1,d._setAppActiveState(!1)}).on("page_visible",function(){d.setForegroundState()}),i.on(function(b){var c;if(b instanceof f.K)b.stateType===f.M.CONNECTED&&p.processNonAutoResendRegisteredPendingMessages();else if(b instanceof f.W){if("USEV"===b.code){var e=b.as(u.U).event;if(e.category===u.a.FRIEND_DISCOVERED){var i=u.b.getDataAsFriendDiscoveredEvent(a,e).friendDiscoveries;(0,f.N)(function(){return(0,f._)(d,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,m.forEach(function(a){a.onFriendsDiscovered&&a.onFriendsDiscovered(i)})]})})})}}}else if(b instanceof f.O){var j=f.V.of(d._iid).subscribedUnreadMessageCount,k=!1,n=b.ts;"number"==typeof n&&n>j.ts&&(j.all!==b.all&&(k=!0),j.all=b.all>=0?b.all:0,b.customTypes&&Object.keys(b.customTypes).forEach(function(a){j.customTypes[a]!==b.customTypes[a]&&(k=!0),j.customTypes[a]=b.customTypes[a]}),k=k&&j.ts>0,j.ts=n),k&&(0,f.N)(function(){return(0,f._)(d,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,m.forEach(function(a){a.onTotalUnreadMessageCountChanged&&a.onTotalUnreadMessageCountChanged({groupChannelCount:j.all,feedChannelCount:j.feed,customTypeUnreadCount:j.customTypes}),a.onTotalUnreadMessageCountUpdated&&a.onTotalUnreadMessageCountUpdated(j.all,j.customTypes)})]})})})}else if(b instanceof f.Q)h.preference.set(d._getUserProfileCacheKey(g.userId),f.R.payloadify(b.userProfile)),(null===(c=b.userProfile.appInfo.notificationInfo)|| void 0===c?void 0:c.isEnabled)&&h.preference.set((0,f.T)(d.appId),{value:!0});else if(b instanceof f.X)b.configSyncNeeded&&(0,f.J)(function(){return(0,f._)(d,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,this._getAppConfigsInfo()];case 1:return a.sent(),[2]}})})});else if(b instanceof u.S)h.preference.set((0,f.Y)(d.appId),{configTs:b.configTs});else if(b instanceof f.Z)b.error&&b.error.isSessionInvalidatedError&&(l.debug("session revoked."),d._internalDisconnect(b.error));else if(b instanceof f.$)switch(b.event){case"resume":d.setForegroundState();break;case"pause":d.setBackgroundState()}})}return a.init=function(b){var c=b.appId,d=b.appVersion,e=b.modules,h=b.options,i=void 0===h?new f.S:h,j=b.debugMode,k=void 0!==j&&j,l=b.customApiHost,m=b.customWebSocketHost,n=b.newInstance,o=void 0!==n&&n,p=b.logLevel,q=b.localCacheEnabled,r=b.localCacheConfig,u=void 0===r?new f.L:r,v=b.localCacheEncryption,w=b.supportMultipleTabs,x=b.useAsyncStorageStore,y=void 0===x?null:x,z=b.useMMKVStorageStore,A=void 0===z?null:z,B=b.appStateToggleEnabled;if((0,f.p)((0,f.a)("string",c)&&c.length>0).throw(f.q.invalidParameters),aW&&!o&&aW.appId!==c&&aW._release(),!aW||o){var C="su-".concat((0,f.u)()),D=null!=v?v:{encrypt:function(a){return a},decrypt:function(a){return a}},E=new g.L;E.level=null!=p?p:g.p.WARN;var F=new g.q({encryption:D});k||((0,f.r)()?A?F=new g.r({MMKV:A,encryption:D}):y&&(F=new g.A({AsyncStorage:y,encryption:D}),E.warn("AsyncStorage store is deprecated due to the small size limit. Please use MMKVStorage store instead.")):F=new g.I({encryption:D})),new f.V(C,{appId:c,appVersion:d,options:i,apiHost:null!=l?l:"https://api-".concat(c,".sendbird.com"),websocketHost:null!=m?m:"wss://ws-".concat(c,".sendbird.com"),store:F,encryption:D,logger:E,localCacheEnabled:void 0!==q&&q,localCacheConfig:u,debugMode:k,appStateToggleEnabled:void 0===B||B,supportMultipleTabs:void 0!==w&&w});var G=[new s,new t],H=new a(C,i,(0,f.s)((0,f.s)([],(0,f.t)(void 0===e?[]:e),!1),(0,f.t)(G),!1));return aW||(aW=H),H}return aW},Object.defineProperty(a,"instance",{get:function(){return aW},enumerable:!1,configurable:!0}),Object.defineProperty(a,"version",{get:function(){return f.v},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"appId",{get:function(){return f.V.of(this._iid).sdkState.appId},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"appInfo",{get:function(){var a=f.V.of(this._iid).appInfo;return null!=a?a:null},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"appVersion",{get:function(){var a;return null!==(a=f.V.of(this._iid).sdkState.appVersion)&& void 0!==a?a:""},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"debugMode",{get:function(){return!!f.V.of(this._iid).debugMode},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"logLevel",{get:function(){return f.V.of(this._iid).logger.level},set:function(a){f.V.of(this._iid).logger.level=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isCacheEnabled",{get:function(){return f.V.of(this._iid).cacheContext.localCacheEnabled},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"localCacheConfig",{get:function(){var a=f.V.of(this._iid).cacheContext;return a.localCacheEnabled?a.localCacheConfig:null},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"ekey",{get:function(){return f.V.of(this._iid).sessionManager.ekey},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"currentUser",{get:function(){var a;return null!==(a=f.V.of(this._iid).sessionManager.currentUser)&& void 0!==a?a:null},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"connectionState",{get:function(){var a=f.V.of(this._iid).connectionManager;return a.isConnected?f.w.OPEN:a.isConnecting?f.w.CONNECTING:f.w.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"lastConnectedAt",{get:function(){var a=f.V.of(this._iid),b=a.connectedAt;return a.connectionManager.isConnected?b:0},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fcmPushToken",{get:function(){var a;return null!==(a=this._fcmPushToken)&& void 0!==a?a:null},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"apnsPushToken",{get:function(){var a;return null!==(a=this._apnsPushToken)&& void 0!==a?a:null},enumerable:!1,configurable:!0}),a.prototype._getNestDBVersion=function(){return 8},a.prototype._getPreferenceVersion=function(){return 9},a.prototype._getPreferenceCacheKey=function(a){return"sendbird@".concat(this.appId,"/").concat(a,".pref")},a.prototype._getUserProfileCacheKey=function(a){return"sendbird@".concat(this.appId,"/").concat(a,".profile")},a.prototype._internalDisconnect=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return c=(b=f.V.of(this._iid)).connectionManager,d=b.sdkState,e=b.requestQueue,this._appStateChangeDetector.stop(),this._onlineDetector.stop(),e.cancelAll(a?"session_invalidated":"explicit_disconnect"),[4,c.logout(a)];case 1:return g.sent(),[4,this.clearCachedData()];case 2:return g.sent(),d.appState="foreground",d.isAppActive=!1,[2]}})})},a.prototype._getAppConfigsInfo=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g,h,i,j=this;return(0,f.b)(this,function(k){switch(k.label){case 0:return b=(a=f.V.of(this._iid)).requestQueue,c=a.dispatcher,d=a.cacheContext,e=a.sdkState,g={},[4,d.preference.get((0,f.Y)(e.appId))];case 1:return(i=k.sent())&&(h=i.configTs),new u.c("appConfigsInfo",function(a){return(0,f._)(j,void 0,void 0,function(){var d,e,h,i,j,k,l,m;return(0,f.b)(this,function(f){switch(f.label){case 0:return d={hasNext:!0,nextToken:a},e=new G({token:a}),[4,b.send(e)];case 1:return j=(i=(h=f.sent()).as(H)).configs,k=i.hasMore,l=i.nextToken,m=i.ts,Object.keys(j).forEach(function(a){g[a]=j[a]}),d.hasNext=k,d.nextToken=l,k||c.dispatch(new u.d({appConfigsInfo:g,configTs:m})),[2,d]}})})}).start(h),[2]}})})},a.prototype.getMemoryStoreForDebugging=function(){var a=f.V.of(this._iid),b=a.debugMode,c=a.cacheContext;if(b)return c.store instanceof g.q?c.store:null;throw f.q.debugModeRequired},a.prototype.addExtension=function(a,b){var c=f.V.of(this._iid).sdkState;["sb_uikit","sb_syncmanager","device-os-platform"].indexOf(a)> -1&&c.extensions&&(c.extensions[a]=b)},a.prototype.addSendbirdExtensions=function(a,b,c){var d,e,g=f.V.of(this._iid),h=g.logger,i=g.sdkState,j=RegExp(f.a0);if(0===a.length)return h.debug("sb.addSendbirdExtensions() has failed because the given sendbirdExtensions is empty."),!1;if(a.find(function(a){return!j.test(a.version)}))return h.debug("sb.addSendbirdExtensions() has failed because the given version did not satisfy the SemVer specification."),!1;if(c)try{for(var k=(0,f.x)(Object.entries(c)),l=k.next();!l.done;l=k.next()){var m=(0,f.t)(l.value,2),n=m[0],o=m[1];if(/&|=/.test(n)||/&|=/.test(o))return h.debug("sb.addSendbirdExtensions() has failed because the given customData includes at least one invalid character: = or &."),!1}}catch(p){d={error:p}}finally{try{l&&!l.done&&(e=k.return)&&e.call(k)}finally{if(d)throw d.error}}return i.sendbirdRuntimeEnvironment={sendbirdExtensions:a,deviceOS:b,customData:c},!0},a.prototype.setOnlineListener=function(a){this._onlineDetector.setOnlineListener(a)},a.prototype.setOfflineListener=function(a){this._onlineDetector.setOfflineListener(a)},a.prototype._safeInitializeStore=function(a){return(0,f._)(this,void 0,void 0,function(){var b;return(0,f.b)(this,function(c){switch(c.label){case 0:b=f.V.of(this._iid).cacheContext,c.label=1;case 1:return c.trys.push([1,3,,5]),[4,b.store.init(a)];case 2:return c.sent(),this._storeInitialized=!0,[3,5];case 3:return c.sent(),b.replaceStore(new g.q),[4,this._safeInitializeStore(a)];case 4:return c.sent(),[3,5];case 5:return[2]}})})},a.prototype.initializeCache=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,h,i,j,k,l;return(0,f.b)(this,function(m){switch(m.label){case 0:if(c=(b=f.V.of(this._iid)).sdkState,d=b.cacheContext,e=b.dispatcher,h=b.logger,c.userId&&c.userId===a)return[3,13];i="sendbird@".concat(c.appId,"/").concat(a,".db"),m.label=1;case 1:return m.trys.push([1,9,11,13]),d.localCacheEnabled?d.nestdb&&d.nestdb.state!==g.s.CLOSED&&d.nestdb.name===i?[3,3]:(j="sendbird@".concat(c.appId,"/").concat(a,".db"),(k=d.nestdb=new g.w({name:j,version:this._getNestDBVersion(),store:d.store,config:new g.x({dbname:j,cacheLimit:64,itemSizeLimit:61440})})).on("upgrade",C(k)),k.on("storeReplaced",function(a){d.replaceStore(a),d.localCacheEnabled=!1,k.on("upgrade",C(k))}),[4,k.open()]):[3,6];case 2:return m.sent(),this._storeInitialized=!0,e.dispatch(new u.D(this._iid,{userId:a})),[3,5];case 3:return[4,this._safeInitializeStore(i)];case 4:m.sent(),m.label=5;case 5:return c.userId=a,[3,8];case 6:return[4,this._safeInitializeStore(i)];case 7:m.sent(),c.userId=a,m.label=8;case 8:return[3,13];case 9:return l=m.sent(),h.warn("Nest DB Open Failed. ",l),d.store instanceof g.q||(d.replaceStore(new g.q),d.localCacheEnabled=!1),[4,this._safeInitializeStore(i)];case 10:throw m.sent(),c.userId=a,f.q.databaseError;case 11:return[4,this._setupPreference(a)];case 12:return m.sent(),[7];case 13:return[2]}})})},a.prototype.getCacheDataSize=function(){return(0,f._)(this,void 0,void 0,function(){var a;return(0,f.b)(this,function(b){switch(b.label){case 0:return(a=f.V.of(this._iid).cacheContext).localCacheEnabled&&a.nestdb?[4,a.nestdb.estimateUsage()]:[3,2];case 1:return[2,b.sent()];case 2:return[2,0]}})})},a.prototype.clearCachedData=function(){return(0,f._)(this,void 0,void 0,function(){var a;return(0,f.b)(this,function(b){switch(b.label){case 0:return(a=f.V.of(this._iid).cacheContext).localCacheEnabled&&a.nestdb?[4,a.nestdb.clear()]:[3,2];case 1:b.sent(),a.nestdb.trim(),b.label=2;case 2:return this._storeInitialized?[4,a.preference.clear()]:[3,4];case 3:b.sent(),b.label=4;case 4:return[2]}})})},a.prototype.clearCachedMessages=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e=this;return(0,f.b)(this,function(h){switch(h.label){case 0:return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),b=f.V.of(this._iid).cacheContext,c=g.u.of(this._iid),d=g.v.of(this._iid),c&&d?[4,Promise.all(a.map(function(a){return(0,f._)(e,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return[4,c.removeMessagesOfChannel(a)];case 1:return b.sent(),[4,d.removeMessagesOfChannel(a)];case 2:return b.sent(),[2]}})})}))]:[3,2];case 1:h.sent(),h.label=2;case 2:return b.localCacheEnabled&&b.nestdb&&b.nestdb.trim(),[2]}})})},a.prototype._setupPreference=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return c=(b=f.V.of(this._iid)).sdkState,d=b.cacheContext,e=b.statManager,[4,d.preference.init(this._getPreferenceCacheKey(a),this._getPreferenceVersion())];case 1:return h.sent(),[4,d.preference.get(this._getUserProfileCacheKey(a))];case 2:return(g=h.sent())&&new f.R(this._iid,g).apply(),[4,e.init("sendbird@".concat(c.appId,"/").concat(a,".statlog"))];case 3:return h.sent(),[2]}})})},a.prototype._willReuseOpenedCacheDatabase=function(a){var b=f.V.of(this._iid),c=b.sdkState,d=b.cacheContext,e="sendbird@".concat(c.appId,"/").concat(a,".db");return!(!d.localCacheConfig||!d.nestdb||d.nestdb.state===g.s.CLOSED||d.nestdb.name!==e)},a.prototype._ready=function(a,b,c){return void 0===c&&(c={}),(0,f._)(this,void 0,void 0,function(){var d,e,g,h,i,j,k,l;return(0,f.b)(this,function(m){switch(m.label){case 0:return(0,f.p)((0,f.a)("string",a)&&(0,f.a)("string",b,!0)).throw(f.q.invalidParameters),e=(d=f.V.of(this._iid)).sdkState,g=d.cacheContext,h=d.connectionManager,i=d.dispatcher,j=c.errorForOtherUser,e.userId&&e.userId!==a?j?[3,2]:[4,h.logout()]:[3,3];case 1:return m.sent(),[3,3];case 2:throw j;case 3:return m.trys.push([3,5,,6]),k=this._willReuseOpenedCacheDatabase(a),[4,this.initializeCache(a)];case 4:return m.sent(),g.localCacheEnabled&&k&&i.dispatch(new u.R),[3,6];case 5:return m.sent(),l=f.V.of(this._iid).logger,g.localCacheEnabled=!1,l.warn("Cache initialization failed - cache is not available."),[3,6];case 6:return[2]}})})},a.prototype.authenticateFeed=function(a,b){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(c){switch(c.label){case 0:return[4,this.authenticate(a,b)];case 1:return[2,c.sent()]}})})},a.prototype.authenticate=function(a,b,c){var d;return void 0===c&&(c=f.y.SESSION_TOKEN),(0,f._)(this,void 0,void 0,function(){var e,h,i;return(0,f.b)(this,function(j){switch(j.label){case 0:return h=(e=f.V.of(this._iid)).sessionManager,i=e.connectionManager,[4,this._ready(a,b,{errorForOtherUser:i.isConnected?f.q.alreadyConnectedAsAnotherUser:void 0})];case 1:return j.sent(),(null===(d=h.session.services)|| void 0===d?void 0:d.includes(f.a3.CHAT))?[3,3]:(h.handler||b&&c!==f.y.ACCESS_TOKEN||this.setSessionHandler(new g.S),[4,h.authenticate(a,b)]);case 2:j.sent(),j.label=3;case 3:return[2,this.currentUser]}})})},a.prototype.connect=function(a,b){var c;return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(d){switch(d.label){case 0:return[4,this._ready(a,b)];case 1:d.sent(),d.label=2;case 2:return d.trys.push([2,,4,5]),[4,f.V.of(this._iid).connectionManager.connect(b)];case 3:return d.sent(),[3,5];case 4:return this._onlineDetector.start(),this._appStateChangeDetector.start({appId:this.appId,userId:a,backgroundConnectionCloseTimeout:null===(c=this.appInfo)|| void 0===c?void 0:c.backgroundConnectionCloseTimeout}),[7];case 5:return[2,this.currentUser]}})})},a.prototype.reconnect=function(){var a=f.V.of(this._iid),b=a.connectionManager,c=a.sdkState,d=a.sessionManager,e=a.dispatcher,g=d.session.hasSession;return g&&(e.dispatch(new f.z(new f.B({type:f.D.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:0,error_description:"cause=explicit_reconnect"}}))),this._appStateChangeDetector.start({appId:this.appId,userId:this.currentUser.userId,backgroundConnectionCloseTimeout:this.appInfo.backgroundConnectionCloseTimeout}),this._onlineDetector.start(),b.resetAndReconnect().then(function(){c.appState="foreground"}).catch(function(){})),g},a.prototype.disconnect=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,this._internalDisconnect()];case 1:return a.sent(),[2]}})})},a.prototype.disconnectWebSocket=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c;return(0,f.b)(this,function(d){switch(d.label){case 0:return b=(a=f.V.of(this._iid)).connectionManager,c=a.requestQueue,a.dispatcher.dispatch(new f.z(new f.B({type:f.D.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:0,error_description:"cause=explicit_disconnect_websocket"}}))),this._appStateChangeDetector.stop(),this._onlineDetector.stop(),c.cancelAll("explicit_disconnect_websocket"),[4,b.disconnectWebSocket(!0)];case 1:return d.sent(),[2]}})})},a.prototype._release=function(){var a=this;if(f.V.exists(this._iid)){var b=f.V.of(this._iid),c=b.cacheContext,d=b.requestQueue,e=b.logger,g=d.commandRouter.websocketClient,h=function(a,b){try{b()}catch(c){e.debug("release: ".concat(a," failed = "),c)}};h("app state detector stop",function(){return a._appStateChangeDetector.stop()}),h("online detector stop",function(){return a._onlineDetector.stop()}),h("request cancellation",function(){return d.cancelAll("app_id_changed")}),h("websocket force close",function(){g.ws&&g.forceClose(!1)}),h("nestdb close",function(){var a;null===(a=c.nestdb)|| void 0===a||a.close()}),f.V.clear(this._iid),aW===this&&(aW=void 0)}else aW===this&&(aW=void 0)},a.prototype.setBackgroundState=function(){var a=f.V.of(this._iid),b=a.connectionManager,c=a.sdkState,d=a.logger,e=a.dispatcher;"foreground"===c.appState&&(c.appState="background",c.isAppActive=!1,d.debug("going background state"),e.dispatch(new w.A),e.dispatch(new f.z(new f.B({type:f.D.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:f.F.WEBSOCKET_CONNECTION_CLOSED,error_description:"cause=background"}}))),b.background().catch(function(a){d.debug("setBackgroundState error = ",a)}))},a.prototype.setForegroundState=function(){var a=f.V.of(this._iid),b=a.connectionManager,c=a.sdkState,d=a.dispatcher,e=a.logger;"background"===c.appState?(c.appState="foreground",c.isAppActive=!0,e.debug("going foreground state"),b.resetAndReconnect().catch(function(a){e.debug("setForgroundState error = ",a)}),d.dispatch(new v)):"foreground"===c.appState&&b.shouldReconnectOnForeground&&(e.debug("foreground resume: connection is not alive, reconnecting"),b.resetAndReconnect().catch(function(a){e.debug("setForegroundState (foreground reconnect) error = ",a)}),d.dispatch(new v))},a.prototype._setAppActiveState=function(a){f.V.of(this._iid).sdkState.isAppActive=a},a.prototype.setSessionHandler=function(a){(0,f.p)(a instanceof g.S).throw(f.q.invalidParameters),f.V.of(this._iid).sessionManager.handler=a},a.prototype.addUserEventHandler=function(a,b){(0,f.p)((0,f.a)("string",a)&&b instanceof g.U).throw(f.q.invalidParameters),f.V.of(this._iid).userEventHandlers.set(a,b)},a.prototype.removeUserEventHandler=function(a){f.V.of(this._iid).userEventHandlers.delete(a)},a.prototype.removeAllUserEventHandler=function(){f.V.of(this._iid).userEventHandlers.clear()},a.prototype.addConnectionHandler=function(a,b){(0,f.p)((0,f.a)("string",a)&&b instanceof g.C).throw(f.q.invalidParameters),f.V.of(this._iid).connectionHandlers.set(a,b)},a.prototype.removeConnectionHandler=function(a){f.V.of(this._iid).connectionHandlers.delete(a)},a.prototype.removeAllConnectionHandler=function(){f.V.of(this._iid).connectionHandlers.clear()},a.prototype.createApplicationUserListQuery=function(a){return void 0===a&&(a={}),new g.t(this._iid,a)},a.prototype.createBlockedUserListQuery=function(a){return void 0===a&&(a={}),new g.B(this._iid,a)},a.prototype.createFriendListQuery=function(a){return void 0===a&&(a={}),new g.F(this._iid,a)},a.prototype.createMessageSearchQuery=function(a){return new m(this._iid,a)},a.prototype.createPollListQuery=function(a){return new f.G(this._iid,(0,f.d)({},a))},a.prototype.createPollVoterListQuery=function(a){return new f.H(this._iid,(0,f.d)({},a))},a.prototype.buildUserFromSerializedData=function(a){var b=(0,f.I)(a);return new f.U(this._iid,f.U.payloadify(b))},a.prototype.updateCurrentUserInfo=function(a){return void 0===a&&(a={}),(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g,h,i;return(0,f.b)(this,function(j){switch(j.label){case 0:var k;return b=(0,f.d)((0,f.d)({},A),a),(0,f.p)((k=b,(0,f.i)(k.profileImage,!0)&&(0,f.a)("string",k.profileUrl,!0)&&(0,f.a)("string",k.nickname,!0))).throw(f.q.invalidParameters),this.currentUser?(d=(c=f.V.of(this._iid)).sdkState,e=c.requestQueue,g=new I((0,f.d)({userId:d.userId},b)),[4,e.send(g)]):[3,2];case 1:return i=(h=j.sent()).as(J).user,this.currentUser&&(b.nickname&&(this.currentUser.nickname=i.nickname),(b.profileUrl||b.profileImage)&&(this.currentUser.plainProfileUrl=i.profileUrl)),[2,i];case 2:throw f.q.connectionRequired}})})},a.prototype.updateCurrentUserInfoWithPreferredLanguages=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g,h;return(0,f.b)(this,function(i){switch(i.label){case 0:return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),this.currentUser?(c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new I({userId:c.userId,preferredLanguages:a}),[4,d.send(e)]):[3,2];case 1:return h=(g=i.sent()).as(J).user,this.currentUser&&(this.currentUser.preferredLanguages=h.preferredLanguages),[2,h];case 2:throw f.q.connectionRequired}})})},a.prototype.registerFCMPushTokenForCurrentUser=function(a,b){var c,d;return(0,f._)(this,void 0,void 0,function(){var e,g,h,i,j,k,l,m=this;return(0,f.b)(this,function(n){switch(n.label){case 0:if((0,f.p)((0,f.a)("string",a)&&(0,f.a)("string",null==b?void 0:b.deviceManufacturer,!0)&&(0,f.a)("boolean",null==b?void 0:b.unique,!0)).throw(f.q.invalidParameters),0===a.trim().length)return f.V.of(this._iid).logger.warn("registerFCMPushTokenForCurrentUser() failed because the token is empty."),[2,f.a4.ERROR];if((null==b?void 0:b.deviceOS)&&(0,f.p)((0,f.a5)(f.a6,b.deviceOS.platform,!0)&&(0,f.a)("string",b.deviceOS.version,!0)).throw(f.q.invalidParameters),!this.currentUser)return[3,6];e={deviceOS:"".concat((null===(c=null==b?void 0:b.deviceOS)|| void 0===c?void 0:c.platform)||f.a6.ANDROID,"-").concat((null===(d=null==b?void 0:b.deviceOS)|| void 0===d?void 0:d.version)||"unknown"),deviceManufacturer:null==b?void 0:b.deviceManufacturer,systemPushEnabled:null==b?void 0:b.systemPushEnabled},n.label=1;case 1:return n.trys.push([1,4,,5]),h=(g=f.V.of(this._iid)).sessionManager,i=g.sdkState,j=g.requestQueue,!(null==b?void 0:b.unique)&&h.hasDeviceToken(f.P.FCM,a)?[2,f.a4.SUCCESS]:(k=new M({userId:i.userId,token:a,deviceOS:e.deviceOS,deviceManufacturer:e.deviceManufacturer,systemPushEnabled:e.systemPushEnabled,unique:null==b?void 0:b.unique}),[4,j.send(k)]);case 2:return l=n.sent(),[4,(0,f.J)(function(){return(0,f._)(m,void 0,void 0,function(){var c;return(0,f.b)(this,function(d){switch(d.label){case 0:return c=l.as(N).lastDeletedAt,(null==b?void 0:b.unique)&&"number"==typeof c&&(h.unsetDeviceTokens(),h.setDeviceTokenDeletedAt(c)),h.setDeviceToken(f.P.FCM,a,e),[4,h.saveDeviceToken()];case 1:return d.sent(),[2]}})})})];case 3:return n.sent(),this._fcmPushToken="",[2,f.a4.SUCCESS];case 4:return n.sent(),[2,f.a4.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=a,[2,f.a4.PENDING];case 7:return[2]}})})},a.prototype.unregisterFCMPushTokenForCurrentUser=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g,h,i,j=this;return(0,f.b)(this,function(k){switch(k.label){case 0:if((0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),0===a.trim().length)return f.V.of(this._iid).logger.warn("unregisterFCMPushTokenForCurrentUser() failed because the token is empty."),[2,f.a4.ERROR];if(!this.currentUser)return[3,6];k.label=1;case 1:return k.trys.push([1,4,,5]),c=(b=f.V.of(this._iid)).sessionManager,d=b.sdkState,e=b.requestQueue,g=new Q({userId:d.userId,token:a}),[4,e.send(g)];case 2:return i=(h=k.sent()).as(R).lastDeletedAt,[4,(0,f.J)(function(){return(0,f._)(j,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return c.unsetDeviceToken(f.P.FCM,a),c.setDeviceTokenDeletedAt(i),[4,c.saveDeviceToken()];case 1:return b.sent(),[2]}})})})];case 3:return k.sent(),this._fcmPushToken="",[2,f.a4.SUCCESS];case 4:return k.sent(),[2,f.a4.ERROR];case 5:return[3,7];case 6:return this._fcmPushToken=a,[2,f.a4.PENDING];case 7:return[2]}})})},a.prototype.unregisterFCMPushTokenAllForCurrentUser=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g,h,i=this;return(0,f.b)(this,function(j){switch(j.label){case 0:return this.currentUser?(b=(a=f.V.of(this._iid)).sessionManager,c=a.sdkState,d=a.requestQueue,e=new U({userId:c.userId}),[4,d.send(e)]):[3,3];case 1:return h=(g=j.sent()).as(V).lastDeletedAt,[4,(0,f.J)(function(){return(0,f._)(i,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return b.unsetDeviceTokens(f.P.FCM),b.setDeviceTokenDeletedAt(h),[4,b.saveDeviceToken()];case 1:return a.sent(),[2]}})})})];case 2:j.sent(),j.label=3;case 3:return[2]}})})},a.prototype.registerAPNSPushTokenForCurrentUser=function(a,b){var c,d;return(0,f._)(this,void 0,void 0,function(){var e,g,h,i,j,k,l,m=this;return(0,f.b)(this,function(n){switch(n.label){case 0:if((0,f.p)((0,f.a)("string",a)&&(0,f.a)("string",null==b?void 0:b.deviceManufacturer,!0)&&(0,f.a)("boolean",null==b?void 0:b.unique,!0)).throw(f.q.invalidParameters),0===a.trim().length)return f.V.of(this._iid).logger.warn("registerAPNSPushTokenForCurrentUser() failed because the token is empty."),[2,f.a4.ERROR];if((null==b?void 0:b.deviceOS)&&(0,f.p)((0,f.a5)(f.a6,b.deviceOS.platform,!0)&&(0,f.a)("string",b.deviceOS.version,!0)).throw(f.q.invalidParameters),!this.currentUser)return[3,6];e={deviceOS:"".concat((null===(c=null==b?void 0:b.deviceOS)|| void 0===c?void 0:c.platform)||f.a6.IOS,"-").concat((null===(d=null==b?void 0:b.deviceOS)|| void 0===d?void 0:d.version)||"unknown"),deviceManufacturer:null==b?void 0:b.deviceManufacturer,systemPushEnabled:null==b?void 0:b.systemPushEnabled},n.label=1;case 1:return n.trys.push([1,4,,5]),h=(g=f.V.of(this._iid)).sessionManager,i=g.sdkState,j=g.requestQueue,!(null==b?void 0:b.unique)&&h.hasDeviceToken(f.P.APNS,a)?[2,f.a4.SUCCESS]:(k=new K({userId:i.userId,token:a,deviceOS:e.deviceOS,deviceManufacturer:e.deviceManufacturer,systemPushEnabled:e.systemPushEnabled,unique:null==b?void 0:b.unique}),[4,j.send(k)]);case 2:return l=n.sent(),[4,(0,f.J)(function(){return(0,f._)(m,void 0,void 0,function(){var c;return(0,f.b)(this,function(d){switch(d.label){case 0:return c=l.as(L).lastDeletedAt,(null==b?void 0:b.unique)&&"number"==typeof c&&(h.unsetDeviceTokens(),h.setDeviceTokenDeletedAt(c)),h.setDeviceToken(f.P.APNS,a,e),[4,h.saveDeviceToken()];case 1:return d.sent(),[2]}})})})];case 3:return n.sent(),this._apnsPushToken="",[2,f.a4.SUCCESS];case 4:return n.sent(),[2,f.a4.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=a,[2,f.a4.PENDING];case 7:return[2]}})})},a.prototype.unregisterAPNSPushTokenForCurrentUser=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g,h,i,j=this;return(0,f.b)(this,function(k){switch(k.label){case 0:if((0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),0===a.trim().length)return f.V.of(this._iid).logger.warn("unregisterAPNSPushTokenForCurrentUser() failed because the token is empty."),[2,f.a4.ERROR];if(!this.currentUser)return[3,6];k.label=1;case 1:return k.trys.push([1,4,,5]),c=(b=f.V.of(this._iid)).sessionManager,d=b.sdkState,e=b.requestQueue,g=new O({userId:d.userId,token:a}),[4,e.send(g)];case 2:return i=(h=k.sent()).as(P).lastDeletedAt,[4,(0,f.J)(function(){return(0,f._)(j,void 0,void 0,function(){return(0,f.b)(this,function(b){switch(b.label){case 0:return c.unsetDeviceToken(f.P.APNS,a),c.setDeviceTokenDeletedAt(i),[4,c.saveDeviceToken()];case 1:return b.sent(),[2]}})})})];case 3:return k.sent(),this._apnsPushToken="",[2,f.a4.SUCCESS];case 4:return k.sent(),[2,f.a4.ERROR];case 5:return[3,7];case 6:return this._apnsPushToken=a,[2,f.a4.PENDING];case 7:return[2]}})})},a.prototype.unregisterAPNSPushTokenAllForCurrentUser=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e,g,h,i=this;return(0,f.b)(this,function(j){switch(j.label){case 0:return this.currentUser?(b=(a=f.V.of(this._iid)).sessionManager,c=a.sdkState,d=a.requestQueue,e=new S({userId:c.userId}),[4,d.send(e)]):[3,3];case 1:return h=(g=j.sent()).as(T).lastDeletedAt,[4,(0,f.J)(function(){return(0,f._)(i,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return b.unsetDeviceTokens(f.P.APNS),b.setDeviceTokenDeletedAt(h),[4,b.saveDeviceToken()];case 1:return a.sent(),[2]}})})})];case 2:j.sent(),j.label=3;case 3:return[2]}})})},a.prototype.markPushNotificationAsDelivered=function(a,b){var c;return void 0===b&&(b=!0),(0,f._)(this,void 0,void 0,function(){var d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w;return(0,f.b)(this,function(x){switch(x.label){case 0:if(e=(d=f.V.of(this._iid)).logger,g=d.sessionManager,h=d.requestQueue,i=d.pushNotificationAckManager,e.debug("markPushNotificationAsDelivered:",a),j=aH.DELIVERED,k=i.parseData(a),l=k.pushTrackingId,m=k.sessionTopics,n=k.sessionKey,o=k.messageId,p=k.channelKey,q=k.templateKey,r=k.notificationEventDeadline,!n||!m.includes(f.a7.PUSH_ACKNOWLEDGEMENT))throw e.info("Can't use markPushNotificationAsDelivered() feature."),f.q.malformedDataError;if(i.isAcked(l,j))return e.info("already delivered push notification:",l),[2];s=Boolean(p),t=b&&s,u=null===(c=g.deviceTokens[0])|| void 0===c?void 0:c.token,v=new aX({deviceToken:null!=u?u:"",pushTrackingId:l,eventType:j,messageId:o,channelKey:p,templateKey:q,notificationEventDeadline:r,allowedPushNotification:t}),n&&(v.headers["Session-Key"]=n),x.label=1;case 1:return x.trys.push([1,3,,4]),[4,h.send(v)];case 2:return x.sent(),i.markAsAcked(l,j),[3,4];case 3:throw w=x.sent(),e.debug("failed to mark push notification as delivered. push tracking id: ".concat(l,". error: ").concat(w)),w;case 4:return[2]}})})},a.prototype.markPushNotificationAsClicked=function(a){var b;return(0,f._)(this,void 0,void 0,function(){var c,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t;return(0,f.b)(this,function(u){switch(u.label){case 0:if(d=(c=f.V.of(this._iid)).logger,e=c.sessionManager,g=c.requestQueue,h=c.pushNotificationAckManager,d.debug("markPushNotificationAsClicked:",a),i=aH.CLICKED,j=h.parseData(a),k=j.pushTrackingId,l=j.sessionTopics,m=j.sessionKey,n=j.messageId,o=j.channelKey,p=j.templateKey,q=j.notificationEventDeadline,!m||!l.includes(f.a7.PUSH_ACKNOWLEDGEMENT))throw d.info("Can't use markPushNotificationAsClicked() feature."),f.q.malformedDataError;if(h.isAcked(k,i))return d.info("already clicked push notification:",k),[2];r=null===(b=e.deviceTokens[0])|| void 0===b?void 0:b.token,s=new aX({deviceToken:null!=r?r:"",pushTrackingId:k,eventType:i,messageId:n,channelKey:o,templateKey:p,notificationEventDeadline:q}),m&&(s.headers["Session-Key"]=m),u.label=1;case 1:return u.trys.push([1,3,,4]),[4,g.send(s)];case 2:return u.sent(),h.markAsAcked(k,i),[3,4];case 3:throw t=u.sent(),d.debug("failed to mark push notification as clicked. push tracking id: ".concat(k,". error: ").concat(t)),t;case 4:return[2]}})})},a.prototype.getChannelInvitationPreference=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new Y({userId:b.userId}),[4,c.send(d)];case 1:return[2,{autoAccept:(e=g.sent()).as(Z).autoAccept}]}})})},a.prototype.setChannelInvitationPreference=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return(0,f.p)((0,f.a)("boolean",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new $({userId:c.userId,willAutoAccept:a}),[4,d.send(e)];case 1:return[2,{autoAccept:(g=h.sent()).as(_).autoAccept}]}})})},a.prototype.getDoNotDisturb=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new aa({userId:b.userId}),[4,c.send(d)];case 1:return[2,(e=g.sent()).as(ab).preference]}})})},a.prototype.setDoNotDisturb=function(a,b,c,d,e,g){return void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0),void 0===g&&(g=""),(0,f._)(this,void 0,void 0,function(){var h,i,j,k,l;return(0,f.b)(this,function(m){switch(m.label){case 0:return(0,f.p)((0,f.a)("boolean",a)&&(0,f.a)("number",b)&&(0,f.a)("number",c)&&(0,f.a)("number",d)&&(0,f.a)("number",e)&&(0,f.a)("string",g)).throw(f.q.invalidParameters),i=(h=f.V.of(this._iid)).sdkState,j=h.requestQueue,k=new ac({userId:i.userId,doNotDisturbOn:a,startHour:b,startMin:c,endHour:d,endMin:e,timezone:g}),[4,j.send(k)];case 1:return[2,(l=m.sent()).as(ad).preference]}})})},a.prototype.setWeeklyDoNotDisturb=function(a,b){return void 0===b&&(b=""),(0,f._)(this,void 0,void 0,function(){var c,d,e,h,i;return(0,f.b)(this,function(j){switch(j.label){case 0:return(0,f.p)(a instanceof g.D&&a.isValid()&&(0,f.a)("string",b)).throw(f.q.invalidParameters),d=(c=f.V.of(this._iid)).sdkState,e=c.requestQueue,h=new aJ({userId:d.userId,weeklyDndSchedules:a,timezone:b}),[4,e.send(h)];case 1:return[2,(i=j.sent()).as(aK).preference]}})})},a.prototype.getWeeklyDoNotDisturb=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new aL({userId:b.userId}),[4,c.send(d)];case 1:return[2,(e=g.sent()).as(aM).preference]}})})},a.prototype.clearWeeklyDoNotDisturb=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new aN({userId:b.userId}),[4,c.send(d)];case 1:return e.sent(),[2]}})})},a.prototype.getSnoozePeriod=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new ae({userId:b.userId}),[4,c.send(d)];case 1:return[2,(e=g.sent()).as(af).snoozePeriod]}})})},a.prototype.setSnoozePeriod=function(a,b,c){return void 0===b&&(b=0),void 0===c&&(c=0),(0,f._)(this,void 0,void 0,function(){var d,e,g,h,i;return(0,f.b)(this,function(j){switch(j.label){case 0:return(0,f.p)((0,f.a)("boolean",a)&&(0,f.a)("number",b)&&(0,f.a)("number",c)).throw(f.q.invalidParameters),e=(d=f.V.of(this._iid)).sdkState,g=d.requestQueue,h=new ag({userId:e.userId,snoozeOn:a,startTs:b,endTs:c}),[4,g.send(h)];case 1:return[2,(i=j.sent()).as(ah).snoozePeriod]}})})},a.prototype.getMyPushTokensByToken=function(a,b){return(0,f._)(this,void 0,void 0,function(){var c,d,e,g,h,i,j,k,l,m,n,o;return(0,f.b)(this,function(p){switch(p.label){case 0:return(0,f.p)((0,f.a)("string",a)&&(0,f.a5)(f.P,b)).throw(f.q.invalidParameters),d=(c=f.V.of(this._iid)).sdkState,e=c.requestQueue,g=c.sessionManager,h=new W({userId:d.userId,type:b,token:a}),[4,e.send(h)];case 1:j=(i=p.sent()).as(X).pushTokens;try{for(l=(k=(0,f.x)(j.deviceTokens)).next();!l.done;l=k.next())m=l.value,g.setDeviceToken(j.type,m)}catch(q){n={error:q}}finally{try{l&&!l.done&&(o=k.return)&&o.call(k)}finally{if(n)throw n.error}}return[4,g.saveDeviceToken()];case 2:return p.sent(),[2,j]}})})},a.prototype.getPushTriggerOption=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new am({userId:b.userId}),[4,c.send(d)];case 1:return[2,e.sent().as(an).pushTriggerOption]}})})},a.prototype.setPushTriggerOption=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)((0,f.a5)(f.a8,a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new ao({userId:c.userId,pushTriggerOption:a}),[4,d.send(e)];case 1:return[2,g.sent().as(ap).pushTriggerOption]}})})},a.prototype.getPushTemplate=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new aq({userId:b.userId}),[4,c.send(d)];case 1:return[2,e.sent().as(ar).name]}})})},a.prototype.setPushTemplate=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)((0,f.a5)(f.a9,a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new as({userId:c.userId,templateName:a}),[4,d.send(e)];case 1:return[2,g.sent().as(at).name]}})})},a.prototype.blockUser=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)(a instanceof f.U||(0,f.a)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new ai({userId:c.userId,blockedUserId:a instanceof f.U?a.userId:a}),[4,d.send(e)];case 1:return g.sent(),[2]}})})},a.prototype.blockUserWithUserId=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return[2,this.blockUser(a)]})})},a.prototype.unblockUser=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)(a instanceof f.U||(0,f.a)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new ak({userId:c.userId,unblockedUserId:a instanceof f.U?a.userId:a}),[4,d.send(e)];case 1:return g.sent(),[2]}})})},a.prototype.unblockUserWithUserId=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return[2,this.unblockUser(a)]})})},a.prototype.getFriendChangeLogsByToken=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return(0,f.p)((0,f.a)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new au({userId:c.userId,token:a}),[4,d.send(e)];case 1:return[2,(g=h.sent()).as(av).changelogs]}})})},a.prototype.getAllowFriendDiscovery=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return b=(a=f.V.of(this._iid)).sdkState,c=a.requestQueue,d=new aE({userId:b.userId}),[4,c.send(d)];case 1:return[2,(e=g.sent()).as(aF).allowFriendDiscovery]}})})},a.prototype.setAllowFriendDiscovery=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)((0,f.a)("boolean",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new aG({userId:c.userId,allowFriendDiscovery:a}),[4,d.send(e)];case 1:return g.sent(),[2,a]}})})},a.prototype.uploadFriendDiscoveries=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new aw({userId:c.userId,discoveries:a}),[4,d.send(e)];case 1:return[2,(g=h.sent()).as(ax).friendDiscoveryRequestId]}})})},a.prototype.deleteFriendDiscovery=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return[2,this.deleteFriendDiscoveries([a])]})})},a.prototype.deleteFriendDiscoveries=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new ay({userId:c.userId,discoveryKeys:a}),[4,d.send(e)];case 1:return g.sent(),[2]}})})},a.prototype.addFriends=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e,g;return(0,f.b)(this,function(h){switch(h.label){case 0:return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new aA({userId:c.userId,userIds:a}),[4,d.send(e)];case 1:return[2,(g=h.sent()).as(aB).users]}})})},a.prototype.deleteFriend=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(b){return[2,this.deleteFriends([a])]})})},a.prototype.deleteFriends=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d,e;return(0,f.b)(this,function(g){switch(g.label){case 0:return(0,f.p)((0,f.a2)("string",a)).throw(f.q.invalidParameters),c=(b=f.V.of(this._iid)).sdkState,d=b.requestQueue,e=new aC({userId:c.userId,userIds:a}),[4,d.send(e)];case 1:return g.sent(),[2]}})})},a.prototype.getAllEmoji=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c;return(0,f.b)(this,function(d){switch(d.label){case 0:return a=f.V.of(this._iid).requestQueue,b=new aO,[4,a.send(b)];case 1:return[2,(c=d.sent()).as(aP).emojiContainer]}})})},a.prototype.getEmojiCategory=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return b=f.V.of(this._iid).requestQueue,c=new aQ({categoryId:a}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(aR).emojiCategory]}})})},a.prototype.getEmoji=function(a){return(0,f._)(this,void 0,void 0,function(){var b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return b=f.V.of(this._iid).requestQueue,c=new aS({key:a}),[4,b.send(c)];case 1:return[2,(d=e.sent()).as(aT).emoji]}})})},a.prototype.getUIKitConfiguration=function(){return(0,f._)(this,void 0,void 0,function(){var a,b,c,d;return(0,f.b)(this,function(e){switch(e.label){case 0:return a=f.V.of(this._iid),(0,f.p)(a.hasExtension("sb_uikit")).throw(f.q.notSupportedError),b=a.requestQueue,c=new aU,[4,b.send(c)];case 1:return[2,(d=e.sent()).as(aV).uikitConfiguration]}})})},a.prototype.getReportCategoryInfoList=function(){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){switch(a.label){case 0:return[4,f.V.of(this._iid).reportCategoryManager.categories()];case 1:return[2,a.sent()]}})})},a}()},50926:function(a,b,c){"use strict";c.d(b,{A:function(){return n},B:function(){return m},C:function(){return j},M:function(){return r},O:function(){return k},P:function(){return s},R:function(){return p},T:function(){return q},U:function(){return l},a:function(){return d},b:function(){return o}});var d,e,f=c(84663),g=c(89531),h=function(a,b){this.pollId=0,this.messageId=0,this.pollId=b.poll.id,this.messageId=b.poll.message_id,this._iid=a,this._payload=b};(e=d||(d={}))[e.NONE=0]="NONE",e[e.CHANNEL_ENTER=10102]="CHANNEL_ENTER",e[e.CHANNEL_EXIT=10103]="CHANNEL_EXIT",e[e.USER_CHANNEL_MUTE=10201]="USER_CHANNEL_MUTE",e[e.USER_CHANNEL_UNMUTE=10200]="USER_CHANNEL_UNMUTE",e[e.USER_CHANNEL_BAN=10601]="USER_CHANNEL_BAN",e[e.USER_CHANNEL_UNBAN=10600]="USER_CHANNEL_UNBAN",e[e.CHANNEL_FREEZE=10701]="CHANNEL_FREEZE",e[e.CHANNEL_UNFREEZE=10700]="CHANNEL_UNFREEZE",e[e.TYPING_START=10900]="TYPING_START",e[e.TYPING_END=10901]="TYPING_END",e[e.CHANNEL_JOIN=1e4]="CHANNEL_JOIN",e[e.CHANNEL_LEAVE=10001]="CHANNEL_LEAVE",e[e.CHANNEL_OPERATOR_UPDATE=10002]="CHANNEL_OPERATOR_UPDATE",e[e.CHANNEL_INVITE=10020]="CHANNEL_INVITE",e[e.CHANNEL_ACCEPT_INVITE=10021]="CHANNEL_ACCEPT_INVITE",e[e.CHANNEL_DECLINE_INVITE=10022]="CHANNEL_DECLINE_INVITE",e[e.CHANNEL_PROP_CHANGED=11e3]="CHANNEL_PROP_CHANGED",e[e.CHANNEL_DELETED=12e3]="CHANNEL_DELETED",e[e.CHANNEL_META_DATA_CHANGED=11100]="CHANNEL_META_DATA_CHANGED",e[e.CHANNEL_META_COUNTERS_CHANGED=11200]="CHANNEL_META_COUNTERS_CHANGED",e[e.CHANNEL_HIDE=13e3]="CHANNEL_HIDE",e[e.CHANNEL_UNHIDE=13001]="CHANNEL_UNHIDE",e[e.PINNED_MESSAGE_CHANGED=11300]="PINNED_MESSAGE_CHANGED";var i=function(){function a(a){var b;this.channelUrl=a.channel_url,this.channelType=a.channel_type,this.category=a.cat,this.data=null!==(b=a.data)&& void 0!==b?b:{},this.ts=a.ts}return Object.defineProperty(a.prototype,"isGroupChannelEvent",{get:function(){return this.channelType===f.C.GROUP},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"isOpenChannelEvent",{get:function(){return this.channelType===f.C.OPEN},enumerable:!1,configurable:!0}),a}(),j=function(a){function b(b,c,d){var e=a.call(this,b,"SYEV",d)||this;return e.event=new i(d),e}return(0,f.c)(b,a),b}(f.W),k=function(a){function b(b,c,d){var e=a.call(this,b,c,d)||this,g=d.data.operators;return e.operators=(void 0===g?[]:g).map(function(a){return new f.U(e._iid,a)}),e}return(0,f.c)(b,a),b}(j),l=function(a){function b(b,c,d){var e,h=this;return(h=a.call(this,b,"SYEV",d)||this).pinnedMessageIds=[],h.latestPinnedMessage=null,h.ts=0,d.data&&(h.pinnedMessageIds=null!==(e=d.data.pinned_message_ids)&& void 0!==e?e:[],h.latestPinnedMessage=d.data.latest_pinned_message?(0,g.Q)(b,(0,f.d)({},d.data.latest_pinned_message)):null),h.ts=d.ts,h}return(0,f.c)(b,a),b}(f.W),m=function(a){function b(b,c){var d=a.call(this,b)||this;return d._logger=c.logger,d._sdkState=c.sdkState,d._sessionManager=c.sessionManager,d._requestQueue=c.requestQueue,d._dispatcher=c.dispatcher,d._cacheContext=c.cacheContext,d._channelType=c.channelType,d}return(0,f.c)(b,a),Object.defineProperty(b.prototype,"_messageBroadcast",{get:function(){return g.a$.of(this._iid)},enumerable:!1,configurable:!0}),b.prototype.subscribeMessageEvent=function(a,b){this._messageBroadcast.subscribe(a,b)},b.prototype.unsubscribeMessageEvent=function(a){this._messageBroadcast.unsubscribe(a)},b.prototype.getMessageFromCache=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,null]})})},b.prototype.getExactlyMatchingMessagesForTokenFromCache=function(a,b,c,d){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,[]]})})},b.prototype.getMessagesFromCache=function(a,b,c,d,e,g,h){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,[]]})})},b.prototype.getPollMessagesFromCache=function(a,b,c,d){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,[]]})})},b.prototype.getCachedMessageCountBetween=function(a,b,c,d){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,0]})})},b.prototype.getUnsentMessagesFromCache=function(a,b){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2,[]]})})},b.prototype.removeFailedMessageFromCache=function(a){return(0,f._)(this,void 0,void 0,function(){return(0,f.b)(this,function(a){return[2]})})},b}(f.aK),n=function(a){function b(b,c,d){var e,h,i,j,k=this;(k=a.call(this,b,"ADMM",d)||this).message=new g.X(b,d);var l=f.V.of(b).sdkState;return k.isMentioned=(0,f.aS)(k.message.mentionType,null!==(i=null!==(e=k.message.mentionedUserIds)&& void 0!==e?e:null===(h=k.message.mentionedUsers)|| void 0===h?void 0:h.map(function(a){return a.userId}))&& void 0!==i?i:[],l.userId),k.forceUpdateLastMessage=null!==(j=d.force_update_last_message)&& void 0!==j&&j,k}return(0,f.c)(b,a),b}(f.W),o=function(a){function b(b,c,d){var e,h,i,j,k,l=this;(l=a.call(this,b,"AEDI",d)||this).message=new g.X(b,d);var m=f.V.of(b).sdkState;return l.mentionCountChange=(0,f.a$)({mentionType:null===(e=d.old_values)|| void 0===e?void 0:e.mention_type,mentionedUserIds:null!==(i=null===(h=d.old_values)|| void 0===h?void 0:h.mentioned_user_ids)&& void 0!==i?i:[]},(0,f.g)({mentionType:l.message.mentionType,mentionedUserIds:null!==(j=l.message.mentionedUserIds)&& void 0!==j?j:null===(k=l.message.mentionedUsers)|| void 0===k?void 0:k.map(function(a){return a.userId})}),m.userId),l}return(0,f.c)(b,a),b}(f.W),p=function(a){function b(b,c,d){var e=a.call(this,b,"MRCT",d)||this;return e.channelUrl=d.channel_url,e.channelType=d.channel_type,e.event=new g.a7(d),e}return(0,f.c)(b,a),b}(f.W),q=function(a){function b(b,c,d){var e=a.call(this,b,"MTHD",d)||this;return e.event=new g.ac(b,d),e}return(0,f.c)(b,a),b}(f.W),r=function(a){function b(b,c,d){var e=a.call(this,b,"MCNT",d)||this;return e.groupChannelMemberCounts=d.group_channels.map(function(a){return{channelUrl:a.channel_url,memberCount:a.member_count,joinedMemberCount:a.joined_member_count,updatedAt:a.ts}}),e.openChannelMemberCounts=d.open_channels.map(function(a){return{channelUrl:a.channel_url,participantCount:a.participant_count,updatedAt:a.ts}}),e}return(0,f.c)(b,a),b}(f.W),s=function(a){function b(b,c,d){var e=a.call(this,b,"PEDI",d)||this;return e.event=new h(b,d),e.status=(0,f.bz)(d.poll.status)||d.poll.status,e.channelUrl=d.channel_url,e.channelType=d.channel_type,e}return(0,f.c)(b,a),b}(f.W)},82861:function(a,b,c){"use strict";c.d(b,{A:function(){return u},D:function(){return r},F:function(){return B},G:function(){return j},I:function(){return l},P:function(){return k},R:function(){return s},S:function(){return y},U:function(){return z},a:function(){return n},b:function(){return x},c:function(){return C},d:function(){return A},e:function(){return m},f:function(){return q},g:function(){return p}});var d,e,f,g,h=c(84663),i=c(89531);(d=j||(j={})).LATEST_LAST_MESSAGE="latest_last_message",d.CHRONOLOGICAL="chronological",d.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",d.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical",(e=k||(k={})).CHRONOLOGICAL="chronological",e.CHANNEL_NAME_ALPHABETICAL="channel_name_alphabetical",e.METADATA_VALUE_ALPHABETICAL="metadata_value_alphabetical",(f=l||(l={})).LATEST="latest",f.OLDEST="oldest",(g=m||(m={})).CREATED_AT="created_at",g.SCHEDULED_AT="scheduled_at";var j,k,l,m,n,o,p=function(a){switch(a){case j.LATEST_LAST_MESSAGE:return["-lastMessageUpdatedAt","-createdAt","syncIndex"];case j.CHRONOLOGICAL:return["-createdAt","syncIndex"];case j.CHANNEL_NAME_ALPHABETICAL:return["name"];default:return["-lastMessageUpdatedAt","-createdAt","syncIndex"]}},q=function(a){function b(b){var c=b.message,d=a.call(this)||this;return d.message=c,d}return(0,h.c)(b,a),b}(h.bk),r=function(a){function b(b,c){var d=c.userId,e=a.call(this)||this;return e._iid=b,e.userId=d,e}return(0,h.c)(b,a),b}(h.bk),s=function(a){function b(){return a.call(this)||this}return(0,h.c)(b,a),b}(h.bk),t={},u=function(){function a(a,b){var c=b.localCacheEnabled,d=b.enableAutoResend,e=b.hasAiAgentModule,f=b.dispatcher,g=b.sdkState,i=b.logger,j=this;this._iid=a,t[a]=this,this._localCacheEnabled=c,this._enableAutoResend=d,this._hasAiAgentModule=e,this._changePendingMessageToFailOnFirstConnection=!1,this._isProcessingAutoResend=!1,this._autoResendQueue=[],this._dispatcher=f,this._logger=i,this._sdkState=g,this._localCacheEnabled&&f.on(function(a){if(a instanceof h.K)switch(a.stateType){case h.M.CONNECTED:j._isProcessingAutoResend||j.processAutoResendRegisteredPendingMessages().then(function(){return j._processNextAutoResend()});break;case h.M.INTERNAL_DISCONNECTED:case h.M.EXTERNAL_DISCONNECTED:j._isProcessingAutoResend=!1}else a instanceof r&&j._hasAiAgentModule&&(j._changePendingMessageToFailOnFirstConnection=!0)})}return a.of=function(a){return t[a]},a.prototype.processNonAutoResendRegisteredPendingMessages=function(){return(0,h._)(this,void 0,void 0,function(){var a=this;return(0,h.b)(this,function(b){switch(b.label){case 0:return this._enableAutoResend?[4,(0,h.J)(function(){return(0,h._)(a,void 0,void 0,function(){var a,b,c,d,e,f;return(0,h.b)(this,function(g){switch(g.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:a=g.sent();try{for(c=(b=(0,h.x)(a)).next();!c.done;c=b.next())0===(d=c.value).errorCode&&(this._logger.debug("cached pending message is not auto-resend registered. changing its sending status to failed: ",d.reqId),d.sendingStatus=h.ax.FAILED,d.errorCode=h.F.ACK_TIMEOUT,this._dispatcher.dispatch(new h.aP({messages:[d],source:h.ab.LOCAL_MESSAGE_FAILED})))}catch(i){e={error:i}}finally{try{c&&!c.done&&(f=b.return)&&f.call(b)}finally{if(e)throw e.error}}return[2]}})})})]:[2];case 1:return b.sent(),[2]}})})},a.prototype.processAutoResendRegisteredPendingMessages=function(){return(0,h._)(this,void 0,void 0,function(){var a=this;return(0,h.b)(this,function(b){switch(b.label){case 0:return[4,(0,h.J)(function(){return(0,h._)(a,void 0,void 0,function(){var a,b,c,d,e,f,g,i;return(0,h.b)(this,function(j){switch(j.label){case 0:return[4,this._fetchAllCachedPendingMessages()];case 1:a=j.sent();try{for(c=(b=(0,h.x)(a)).next();!c.done;c=b.next())d=c.value,this._enableAutoResend&&d.errorCode&&(0,h.b4)(d.errorCode)&&(e=(new Date).getTime(),f=d.createdAt+2592e5,!this._changePendingMessageToFailOnFirstConnection&&e<=f?0>this._autoResendQueue.map(function(a){return a.reqId}).indexOf(d.reqId)&&this._autoResendQueue.push(d):(this._changePendingMessageToFailOnFirstConnection?this._logger.debug("auto-resend registered pending message is not resent because the AI Agent module is loaded. changing its sending status to failed: ",d.reqId):this._logger.debug("auto-resend registered pending messaged expired. expiration date: ",new Date(f).toLocaleString()),d.sendingStatus=h.ax.FAILED,this._dispatcher.dispatch(new h.aP({messages:[d],source:h.ab.LOCAL_MESSAGE_FAILED}))))}catch(k){g={error:k}}finally{try{c&&!c.done&&(i=b.return)&&i.call(b)}finally{if(g)throw g.error}}return this._changePendingMessageToFailOnFirstConnection=!1,[2]}})})})];case 1:return b.sent(),[2]}})})},a.prototype.completeCurrentAndProcessNextAutoResend=function(a){if(this._localCacheEnabled&&this._enableAutoResend&&(a.sendingStatus===h.ax.SUCCEEDED||a.sendingStatus===h.ax.FAILED&&!(0,h.b4)(a.errorCode))){var b=this.indexOf(a);b>=0&&this._autoResendQueue.splice(b,1),0===b&&this._processNextAutoResend()}},a.prototype._fetchAllCachedPendingMessages=function(){return(0,h._)(this,void 0,void 0,function(){var a,b;return(0,h.b)(this,function(c){switch(c.label){case 0:return a=i.v.of(this._iid),(b=new i.ag).replyType=h.aw.ALL,[4,a.fetch({sendingStatus:h.ax.PENDING,backward:!0,filter:b})];case 1:return[2,c.sent()]}})})},a.prototype.indexOf=function(a){return this._autoResendQueue.length>0?this._autoResendQueue.map(function(a){return a.reqId}).indexOf(a.reqId):-1},a.prototype._processNextAutoResend=function(){return(0,h._)(this,void 0,void 0,function(){var a;return(0,h.b)(this,function(b){if(this._localCacheEnabled&&this._enableAutoResend&&"foreground"===this._sdkState.appState)try{this._autoResendQueue.length>0?(this._isProcessingAutoResend||(this._logger.debug("auto-resend queue started."),this._isProcessingAutoResend=!0),a=this._autoResendQueue[0],this._dispatcher.dispatch(new q({message:a})),this._logger.debug("processing auto-resend for message request id: ",a.reqId)):(this._logger.debug("auto-resend queue finished."),this._isProcessingAutoResend=!1)}catch(c){this._logger.warn("process auto-resend error: ",c),this._isProcessingAutoResend=!1}return[2]})})},a}();(o=n||(n={}))[o.USER_BLOCK=20001]="USER_BLOCK",o[o.USER_UNBLOCK=2e4]="USER_UNBLOCK",o[o.FRIEND_DISCOVERED=20900]="FRIEND_DISCOVERED";var v,w,x=function(){function a(a){this.category=a.cat,this.data=a.data}return a.getDataAsUserBlockEvent=function(a,b){var c=b.data,d=c.blocker,e=c.blockee;return{blocker:new h.U(a,d),blockee:new h.U(a,e)}},a.getDataAsFriendDiscoveredEvent=function(a,b){var c=b.data.friend_discoveries;return{friendDiscoveries:Array.isArray(c)?c.map(function(b){return new h.U(a,b)}):[]}},a}(),y=function(a){function b(b){var c=b.configTs,d=a.call(this)||this;return d.configTs=c,d}return(0,h.c)(b,a),b}(h.bk),z=function(a){function b(b,c,d){var e=a.call(this,b,"USEV",d)||this;return e.event=new x(d),e}return(0,h.c)(b,a),b}(h.W),A=function(a){function b(b){var c=b.appConfigsInfo,d=b.configTs,e=a.call(this)||this;return e.appConfigsInfo={},e.configTs=0,e.appConfigsInfo=c,e.configTs=d,e}return(0,h.c)(b,a),b}(h.bk),B=function(a){function b(){return a.call(this)||this}return(0,h.c)(b,a),b}(h.bk);(w=v||(v={}))[w.IDLE=0]="IDLE",w[w.RUNNING=1]="RUNNING",w[w.END=2]="END";var C=function(a){function b(b,c,d,e){var f=a.call(this)||this;return f._state=v.IDLE,f._retryCount=0,f._retryLimit=3,f.priority=0,f._worker=c,f}return(0,h.c)(b,a),Object.defineProperty(b.prototype,"isIdle",{get:function(){return this._state===v.IDLE},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isRunning",{get:function(){return this._state===v.RUNNING},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"isDone",{get:function(){return this._state===v.END},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"retryCount",{get:function(){return this._retryCount},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"retryLimit",{get:function(){return this._retryLimit},enumerable:!1,configurable:!0}),b.prototype._run=function(a){return(0,h._)(this,void 0,void 0,function(){var b,c;return(0,h.b)(this,function(d){switch(d.label){case 0:if(!this.isRunning)return[3,4];d.label=1;case 1:return d.trys.push([1,3,,4]),[4,this._worker(a)];case 2:return b=d.sent(),this._retryCount=0,this.dispatch("progress",b),b.hasNext?this._run(b.nextToken):this.end(),[3,4];case 3:return c=d.sent(),this.dispatch("error",c),this._retryCount{let c=(a?Math[a]:Math.trunc)(b);return 0===c?0:c}}c.d(b,{u:function(){return d}})},4776:function(a,b,c){"use strict";c.d(b,{d:function(){return e}});var d=c(99179);function e(a,...b){let c=d.L.bind(null,a||b.find(a=>"object"==typeof a));return b.map(c)}},35873:function(a,b,c){"use strict";c.d(b,{I7:function(){return h},dP:function(){return e},jE:function(){return d},vh:function(){return g},yJ:function(){return f}});let d=6048e5,e=864e5,f=6e4,g=36e5,h=Symbol.for("constructDateFrom")},99179:function(a,b,c){"use strict";c.d(b,{L:function(){return e}});var d=c(35873);function e(a,b){return"function"==typeof a?a(b):a&&"object"==typeof a&&d.I7 in a?a[d.I7](b):a instanceof Date?new a.constructor(b):new Date(b)}},14444:function(a,b,c){"use strict";c.d(b,{A:function(){return g}});var d=c(97989),e=c(4776),f=c(35873);function g(a,b,c){let[g,h]=(0,e.d)(c?.in,a,b),i=(+g- +h)/f.vh;return(0,d.u)(c?.roundingMethod)(i)}},43828:function(a,b,c){"use strict";c.d(b,{X:function(){return g}});var d=c(97989),e=c(35873),f=c(4798);function g(a,b,c){var g,h;let i=(g=a,h=b,(+(0,f.Q)(g)- +(0,f.Q)(h))/e.yJ);return(0,d.u)(c?.roundingMethod)(i)}},73309:function(a,b,c){"use strict";c.d(b,{WU:function(){return I}});var d=c(64409),e=c(77831),f=c(4798);function g(a){let b=(0,f.Q)(a),c=new Date(Date.UTC(b.getFullYear(),b.getMonth(),b.getDate(),b.getHours(),b.getMinutes(),b.getSeconds(),b.getMilliseconds()));return c.setUTCFullYear(b.getFullYear()),+a- +c}var h=c(4776),i=c(35873),j=c(57581),k=c(21009);function l(a,b){return(0,k.z)(a,{...b,weekStartsOn:1})}var m=c(99179);function n(a,b){let c=(0,f.Q)(a,b?.in),d=c.getFullYear(),e=(0,m.L)(c,0);e.setFullYear(d+1,0,4),e.setHours(0,0,0,0);let g=l(e),h=(0,m.L)(c,0);h.setFullYear(d,0,4),h.setHours(0,0,0,0);let i=l(h);return c.getTime()>=g.getTime()?d+1:c.getTime()>=i.getTime()?d:d-1}function o(a,b){let c=(0,f.Q)(a,b?.in),d=c.getFullYear(),g=(0,e.j)(),h=(((b?.firstWeekContainsDate??b?.locale?.options?.firstWeekContainsDate)??g.firstWeekContainsDate)??g.locale?.options?.firstWeekContainsDate)??1,i=(0,m.L)(b?.in||a,0);i.setFullYear(d+1,0,h),i.setHours(0,0,0,0);let j=(0,k.z)(i,b),l=(0,m.L)(b?.in||a,0);l.setFullYear(d,0,h),l.setHours(0,0,0,0);let n=(0,k.z)(l,b);return+c>= +j?d+1:+c>= +n?d:d-1}function p(a,b){let c=Math.abs(a).toString().padStart(b,"0");return(a<0?"-":"")+c}let q={y(a,b){let c=a.getFullYear(),d=c>0?c:1-c;return p("yy"===b?d%100:d,b.length)},M(a,b){let c=a.getMonth();return"M"===b?String(c+1):p(c+1,2)},d:(a,b)=>p(a.getDate(),b.length),a(a,b){let c=a.getHours()/12>=1?"pm":"am";switch(b){case"a":case"aa":return c.toUpperCase();case"aaa":return c;case"aaaaa":return c[0];default:return"am"===c?"a.m.":"p.m."}},h:(a,b)=>p(a.getHours()%12||12,b.length),H:(a,b)=>p(a.getHours(),b.length),m:(a,b)=>p(a.getMinutes(),b.length),s:(a,b)=>p(a.getSeconds(),b.length),S(a,b){let c=b.length,d=a.getMilliseconds();return p(Math.trunc(d*Math.pow(10,c-3)),b.length)}},r={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},s={G:function(a,b,c){let d=a.getFullYear()>0?1:0;switch(b){case"G":case"GG":case"GGG":return c.era(d,{width:"abbreviated"});case"GGGGG":return c.era(d,{width:"narrow"});default:return c.era(d,{width:"wide"})}},y:function(a,b,c){if("yo"===b){let d=a.getFullYear(),e=d>0?d:1-d;return c.ordinalNumber(e,{unit:"year"})}return q.y(a,b)},Y:function(a,b,c,d){let e=o(a,d),f=e>0?e:1-e;if("YY"===b){let g=f%100;return p(g,2)}return"Yo"===b?c.ordinalNumber(f,{unit:"year"}):p(f,b.length)},R:function(a,b){let c=n(a);return p(c,b.length)},u:function(a,b){let c=a.getFullYear();return p(c,b.length)},Q:function(a,b,c){let d=Math.ceil((a.getMonth()+1)/3);switch(b){case"Q":return String(d);case"QQ":return p(d,2);case"Qo":return c.ordinalNumber(d,{unit:"quarter"});case"QQQ":return c.quarter(d,{width:"abbreviated",context:"formatting"});case"QQQQQ":return c.quarter(d,{width:"narrow",context:"formatting"});default:return c.quarter(d,{width:"wide",context:"formatting"})}},q:function(a,b,c){let d=Math.ceil((a.getMonth()+1)/3);switch(b){case"q":return String(d);case"qq":return p(d,2);case"qo":return c.ordinalNumber(d,{unit:"quarter"});case"qqq":return c.quarter(d,{width:"abbreviated",context:"standalone"});case"qqqqq":return c.quarter(d,{width:"narrow",context:"standalone"});default:return c.quarter(d,{width:"wide",context:"standalone"})}},M:function(a,b,c){let d=a.getMonth();switch(b){case"M":case"MM":return q.M(a,b);case"Mo":return c.ordinalNumber(d+1,{unit:"month"});case"MMM":return c.month(d,{width:"abbreviated",context:"formatting"});case"MMMMM":return c.month(d,{width:"narrow",context:"formatting"});default:return c.month(d,{width:"wide",context:"formatting"})}},L:function(a,b,c){let d=a.getMonth();switch(b){case"L":return String(d+1);case"LL":return p(d+1,2);case"Lo":return c.ordinalNumber(d+1,{unit:"month"});case"LLL":return c.month(d,{width:"abbreviated",context:"standalone"});case"LLLLL":return c.month(d,{width:"narrow",context:"standalone"});default:return c.month(d,{width:"wide",context:"standalone"})}},w:function(a,b,c,d){let g=function(a,b){let c=(0,f.Q)(a,b?.in),d=+(0,k.z)(c,b)- +function(a,b){let c=(0,e.j)(),d=(((b?.firstWeekContainsDate??b?.locale?.options?.firstWeekContainsDate)??c.firstWeekContainsDate)??c.locale?.options?.firstWeekContainsDate)??1,f=o(a,b),g=(0,m.L)(b?.in||a,0);g.setFullYear(f,0,d),g.setHours(0,0,0,0);let h=(0,k.z)(g,b);return h}(c,b);return Math.round(d/i.jE)+1}(a,d);return"wo"===b?c.ordinalNumber(g,{unit:"week"}):p(g,b.length)},I:function(a,b,c){let d=function(a,b){let c=(0,f.Q)(a,void 0),d=+l(c)- +function(a,b){let c=n(a,b),d=(0,m.L)(b?.in||a,0);return d.setFullYear(c,0,4),d.setHours(0,0,0,0),l(d)}(c);return Math.round(d/i.jE)+1}(a);return"Io"===b?c.ordinalNumber(d,{unit:"week"}):p(d,b.length)},d:function(a,b,c){return"do"===b?c.ordinalNumber(a.getDate(),{unit:"date"}):q.d(a,b)},D:function(a,b,c){let d=function(a,b){let c=(0,f.Q)(a,void 0),d=function(a,b,c){let[d,e]=(0,h.d)(void 0,a,b),f=(0,j.b)(d),k=(0,j.b)(e),l=+f-g(f),m=+k-g(k);return Math.round((l-m)/i.dP)}(c,function(a,b){let c=(0,f.Q)(a,void 0);return c.setFullYear(c.getFullYear(),0,1),c.setHours(0,0,0,0),c}(c));return d+1}(a);return"Do"===b?c.ordinalNumber(d,{unit:"dayOfYear"}):p(d,b.length)},E:function(a,b,c){let d=a.getDay();switch(b){case"E":case"EE":case"EEE":return c.day(d,{width:"abbreviated",context:"formatting"});case"EEEEE":return c.day(d,{width:"narrow",context:"formatting"});case"EEEEEE":return c.day(d,{width:"short",context:"formatting"});default:return c.day(d,{width:"wide",context:"formatting"})}},e:function(a,b,c,d){let e=a.getDay(),f=(e-d.weekStartsOn+8)%7||7;switch(b){case"e":return String(f);case"ee":return p(f,2);case"eo":return c.ordinalNumber(f,{unit:"day"});case"eee":return c.day(e,{width:"abbreviated",context:"formatting"});case"eeeee":return c.day(e,{width:"narrow",context:"formatting"});case"eeeeee":return c.day(e,{width:"short",context:"formatting"});default:return c.day(e,{width:"wide",context:"formatting"})}},c:function(a,b,c,d){let e=a.getDay(),f=(e-d.weekStartsOn+8)%7||7;switch(b){case"c":return String(f);case"cc":return p(f,b.length);case"co":return c.ordinalNumber(f,{unit:"day"});case"ccc":return c.day(e,{width:"abbreviated",context:"standalone"});case"ccccc":return c.day(e,{width:"narrow",context:"standalone"});case"cccccc":return c.day(e,{width:"short",context:"standalone"});default:return c.day(e,{width:"wide",context:"standalone"})}},i:function(a,b,c){let d=a.getDay(),e=0===d?7:d;switch(b){case"i":return String(e);case"ii":return p(e,b.length);case"io":return c.ordinalNumber(e,{unit:"day"});case"iii":return c.day(d,{width:"abbreviated",context:"formatting"});case"iiiii":return c.day(d,{width:"narrow",context:"formatting"});case"iiiiii":return c.day(d,{width:"short",context:"formatting"});default:return c.day(d,{width:"wide",context:"formatting"})}},a:function(a,b,c){let d=a.getHours(),e=d/12>=1?"pm":"am";switch(b){case"a":case"aa":return c.dayPeriod(e,{width:"abbreviated",context:"formatting"});case"aaa":return c.dayPeriod(e,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return c.dayPeriod(e,{width:"narrow",context:"formatting"});default:return c.dayPeriod(e,{width:"wide",context:"formatting"})}},b:function(a,b,c){let d=a.getHours(),e;switch(e=12===d?r.noon:0===d?r.midnight:d/12>=1?"pm":"am",b){case"b":case"bb":return c.dayPeriod(e,{width:"abbreviated",context:"formatting"});case"bbb":return c.dayPeriod(e,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return c.dayPeriod(e,{width:"narrow",context:"formatting"});default:return c.dayPeriod(e,{width:"wide",context:"formatting"})}},B:function(a,b,c){let d=a.getHours(),e;switch(e=d>=17?r.evening:d>=12?r.afternoon:d>=4?r.morning:r.night,b){case"B":case"BB":case"BBB":return c.dayPeriod(e,{width:"abbreviated",context:"formatting"});case"BBBBB":return c.dayPeriod(e,{width:"narrow",context:"formatting"});default:return c.dayPeriod(e,{width:"wide",context:"formatting"})}},h:function(a,b,c){if("ho"===b){let d=a.getHours()%12;return 0===d&&(d=12),c.ordinalNumber(d,{unit:"hour"})}return q.h(a,b)},H:function(a,b,c){return"Ho"===b?c.ordinalNumber(a.getHours(),{unit:"hour"}):q.H(a,b)},K:function(a,b,c){let d=a.getHours()%12;return"Ko"===b?c.ordinalNumber(d,{unit:"hour"}):p(d,b.length)},k:function(a,b,c){let d=a.getHours();return(0===d&&(d=24),"ko"===b)?c.ordinalNumber(d,{unit:"hour"}):p(d,b.length)},m:function(a,b,c){return"mo"===b?c.ordinalNumber(a.getMinutes(),{unit:"minute"}):q.m(a,b)},s:function(a,b,c){return"so"===b?c.ordinalNumber(a.getSeconds(),{unit:"second"}):q.s(a,b)},S:function(a,b){return q.S(a,b)},X:function(a,b,c){let d=a.getTimezoneOffset();if(0===d)return"Z";switch(b){case"X":return u(d);case"XXXX":case"XX":return v(d);default:return v(d,":")}},x:function(a,b,c){let d=a.getTimezoneOffset();switch(b){case"x":return u(d);case"xxxx":case"xx":return v(d);default:return v(d,":")}},O:function(a,b,c){let d=a.getTimezoneOffset();switch(b){case"O":case"OO":case"OOO":return"GMT"+t(d,":");default:return"GMT"+v(d,":")}},z:function(a,b,c){let d=a.getTimezoneOffset();switch(b){case"z":case"zz":case"zzz":return"GMT"+t(d,":");default:return"GMT"+v(d,":")}},t:function(a,b,c){return p(Math.trunc(+a/1e3),b.length)},T:function(a,b,c){return p(+a,b.length)}};function t(a,b=""){let c=a>0?"-":"+",d=Math.abs(a),e=Math.trunc(d/60),f=d%60;return 0===f?c+String(e):c+String(e)+b+p(f,2)}function u(a,b){if(a%60==0){let c=a>0?"-":"+";return c+p(Math.abs(a)/60,2)}return v(a,b)}function v(a,b=""){let c=Math.abs(a),d=p(Math.trunc(c/60),2),e=p(c%60,2);return(a>0?"-":"+")+d+b+e}let w=(a,b)=>{switch(a){case"P":return b.date({width:"short"});case"PP":return b.date({width:"medium"});case"PPP":return b.date({width:"long"});default:return b.date({width:"full"})}},x=(a,b)=>{switch(a){case"p":return b.time({width:"short"});case"pp":return b.time({width:"medium"});case"ppp":return b.time({width:"long"});default:return b.time({width:"full"})}},y=(a,b)=>{let c=a.match(/(P+)(p+)?/)||[],d=c[1],e=c[2];if(!e)return w(a,b);let f;switch(d){case"P":f=b.dateTime({width:"short"});break;case"PP":f=b.dateTime({width:"medium"});break;case"PPP":f=b.dateTime({width:"long"});break;default:f=b.dateTime({width:"full"})}return f.replace("{{date}}",w(d,b)).replace("{{time}}",x(e,b))},z={p:x,P:y},A=/^D+$/,B=/^Y+$/,C=["D","DD","YY","YYYY"],D=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,E=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,F=/^'([^]*?)'?$/,G=/''/g,H=/[a-zA-Z]/;function I(a,b,c){var g,h;let i=(0,e.j)(),j=(c?.locale??i.locale)??d._,k=(((c?.firstWeekContainsDate??c?.locale?.options?.firstWeekContainsDate)??i.firstWeekContainsDate)??i.locale?.options?.firstWeekContainsDate)??1,l=(((c?.weekStartsOn??c?.locale?.options?.weekStartsOn)??i.weekStartsOn)??i.locale?.options?.weekStartsOn)??0,m=(0,f.Q)(a,c?.in);if(!((h=g=m)instanceof Date)&&("object"!=typeof h||"[object Date]"!==Object.prototype.toString.call(h))&&"number"!=typeof g||isNaN(+(0,f.Q)(g)))throw RangeError("Invalid time value");let n=b.match(E).map(a=>{let b=a[0];if("p"===b||"P"===b){let c=z[b];return c(a,j.formatLong)}return a}).join("").match(D).map(a=>{if("''"===a)return{isToken:!1,value:"'"};let b=a[0];if("'"===b)return{isToken:!1,value:J(a)};if(s[b])return{isToken:!0,value:a};if(b.match(H))throw RangeError("Format string contains an unescaped latin alphabet character `"+b+"`");return{isToken:!1,value:a}});j.localize.preprocessor&&(n=j.localize.preprocessor(m,n));let o={firstWeekContainsDate:k,weekStartsOn:l,locale:j};return n.map(d=>{var e,f;if(!d.isToken)return d.value;let g=d.value;(!c?.useAdditionalWeekYearTokens&&(e=g,B.test(e))|| !c?.useAdditionalDayOfYearTokens&&(f=g,A.test(f)))&&!function(a,b,c){let d=function a(b,c,d){let e="Y"===b[0]?"years":"days of the month";return`Use \`${b.toLowerCase()}\` instead of \`${b}\` (in \`${c}\`) for formatting ${e} to the input \`${d}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}(a,b,c);if(console.warn(d),C.includes(a))throw RangeError(d)}(g,b,String(a));let h=s[g[0]];return h(m,g,j.localize,o)}).join("")}function J(a){let b=a.match(F);return b?b[1].replace(G,"'"):a}},23815:function(a,b,c){"use strict";c.d(b,{K:function(){return f}});var d=c(4776),e=c(57581);function f(a,b,c){let[f,g]=(0,d.d)(c?.in,a,b);return+(0,e.b)(f)== +(0,e.b)(g)}},37236:function(a,b,c){"use strict";c.d(b,{x:function(){return f}});var d=c(4798);function e(a,b){let c=(0,d.Q)(a,b?.in);return c.setSeconds(0,0),c}function f(a,b){return+e(a)== +e(b)}},70946:function(a,b,c){"use strict";c.d(b,{z:function(){return f}});var d=c(99179),e=c(23815);function f(a,b){var c;return(0,e.K)((0,d.L)(b?.in||a,a),(c=b?.in||a,(0,d.L)(c,Date.now())))}},71017:function(a,b,c){"use strict";function d(a){return (b={})=>{let c=b.width?String(b.width):a.defaultWidth,d=a.formats[c]||a.formats[a.defaultWidth];return d}}c.d(b,{l:function(){return d}})},90985:function(a,b,c){"use strict";function d(a){return(b,c)=>{let d=c?.context?String(c.context):"standalone",e;if("formatting"===d&&a.formattingValues){let f=a.defaultFormattingWidth||a.defaultWidth,g=c?.width?String(c.width):f;e=a.formattingValues[g]||a.formattingValues[f]}else{let h=a.defaultWidth,i=c?.width?String(c.width):a.defaultWidth;e=a.values[i]||a.values[h]}let j=a.argumentCallback?a.argumentCallback(b):b;return e[j]}}c.d(b,{Y:function(){return d}})},93620:function(a,b,c){"use strict";function d(a){return(b,c={})=>{let d=c.width,g=d&&a.matchPatterns[d]||a.matchPatterns[a.defaultMatchWidth],h=b.match(g);if(!h)return null;let i=h[0],j=d&&a.parsePatterns[d]||a.parsePatterns[a.defaultParseWidth],k=Array.isArray(j)?f(j,a=>a.test(i)):e(j,a=>a.test(i)),l;l=a.valueCallback?a.valueCallback(k):k,l=c.valueCallback?c.valueCallback(l):l;let m=b.slice(i.length);return{value:l,rest:m}}}function e(a,b){for(let c in a)if(Object.prototype.hasOwnProperty.call(a,c)&&b(a[c]))return c}function f(a,b){for(let c=0;c{let d=b.match(a.matchPattern);if(!d)return null;let e=d[0],f=b.match(a.parsePattern);if(!f)return null;let g=a.valueCallback?a.valueCallback(f[0]):f[0];g=c.valueCallback?c.valueCallback(g):g;let h=b.slice(e.length);return{value:g,rest:h}}}c.d(b,{y:function(){return d}})},64409:function(a,b,c){"use strict";c.d(b,{"_":function(){return p}});let d={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},e=(a,b,c)=>{let e,f=d[a];return(e="string"==typeof f?f:1===b?f.one:f.other.replace("{{count}}",b.toString()),c?.addSuffix)?c.comparison&&c.comparison>0?"in "+e:e+" ago":e};var f=c(71017);let g={date:(0,f.l)({formats:{full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},defaultWidth:"full"}),time:(0,f.l)({formats:{full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},defaultWidth:"full"}),dateTime:(0,f.l)({formats:{full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},defaultWidth:"full"})},h={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},i=(a,b,c,d)=>h[a];var j=c(90985);let k=(a,b)=>{let c=Number(a),d=c%100;if(d>20||d<10)switch(d%10){case 1:return c+"st";case 2:return c+"nd";case 3:return c+"rd"}return c+"th"},l={ordinalNumber:k,era:(0,j.Y)({values:{narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},defaultWidth:"wide"}),quarter:(0,j.Y)({values:{narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},defaultWidth:"wide",argumentCallback:a=>a-1}),month:(0,j.Y)({values:{narrow:["J","F","M","A","M","J","J","A","S","O","N","D"],abbreviated:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec",],wide:["January","February","March","April","May","June","July","August","September","October","November","December",]},defaultWidth:"wide"}),day:(0,j.Y)({values:{narrow:["S","M","T","W","T","F","S"],short:["Su","Mo","Tu","We","Th","Fr","Sa"],abbreviated:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],wide:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday",]},defaultWidth:"wide"}),dayPeriod:(0,j.Y)({values:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"}},defaultWidth:"wide",formattingValues:{narrow:{am:"a",pm:"p",midnight:"mi",noon:"n",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},abbreviated:{am:"AM",pm:"PM",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"},wide:{am:"a.m.",pm:"p.m.",midnight:"midnight",noon:"noon",morning:"in the morning",afternoon:"in the afternoon",evening:"in the evening",night:"at night"}},defaultFormattingWidth:"wide"})};var m=c(93620),n=c(79311);let o={ordinalNumber:(0,n.y)({matchPattern:/^(\d+)(th|st|nd|rd)?/i,parsePattern:/\d+/i,valueCallback:a=>parseInt(a,10)}),era:(0,m.t)({matchPatterns:{narrow:/^(b|a)/i,abbreviated:/^(b\.?\s?c\.?|b\.?\s?c\.?\s?e\.?|a\.?\s?d\.?|c\.?\s?e\.?)/i,wide:/^(before christ|before common era|anno domini|common era)/i},defaultMatchWidth:"wide",parsePatterns:{any:[/^b/i,/^(a|c)/i]},defaultParseWidth:"any"}),quarter:(0,m.t)({matchPatterns:{narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},defaultMatchWidth:"wide",parsePatterns:{any:[/1/i,/2/i,/3/i,/4/i]},defaultParseWidth:"any",valueCallback:a=>a+1}),month:(0,m.t)({matchPatterns:{narrow:/^[jfmasond]/i,abbreviated:/^(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,wide:/^(january|february|march|april|may|june|july|august|september|october|november|december)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^j/i,/^f/i,/^m/i,/^a/i,/^m/i,/^j/i,/^j/i,/^a/i,/^s/i,/^o/i,/^n/i,/^d/i,],any:[/^ja/i,/^f/i,/^mar/i,/^ap/i,/^may/i,/^jun/i,/^jul/i,/^au/i,/^s/i,/^o/i,/^n/i,/^d/i,]},defaultParseWidth:"any"}),day:(0,m.t)({matchPatterns:{narrow:/^[smtwf]/i,short:/^(su|mo|tu|we|th|fr|sa)/i,abbreviated:/^(sun|mon|tue|wed|thu|fri|sat)/i,wide:/^(sunday|monday|tuesday|wednesday|thursday|friday|saturday)/i},defaultMatchWidth:"wide",parsePatterns:{narrow:[/^s/i,/^m/i,/^t/i,/^w/i,/^t/i,/^f/i,/^s/i],any:[/^su/i,/^m/i,/^tu/i,/^w/i,/^th/i,/^f/i,/^sa/i]},defaultParseWidth:"any"}),dayPeriod:(0,m.t)({matchPatterns:{narrow:/^(a|p|mi|n|(in the|at) (morning|afternoon|evening|night))/i,any:/^([ap]\.?\s?m\.?|midnight|noon|(in the|at) (morning|afternoon|evening|night))/i},defaultMatchWidth:"any",parsePatterns:{any:{am:/^a/i,pm:/^p/i,midnight:/^mi/i,noon:/^no/i,morning:/morning/i,afternoon:/afternoon/i,evening:/evening/i,night:/night/i}},defaultParseWidth:"any"})},p={code:"en-US",formatDistance:e,formatLong:g,formatRelative:i,localize:l,match:o,options:{weekStartsOn:0,firstWeekContainsDate:1}}},57581:function(a,b,c){"use strict";c.d(b,{b:function(){return e}});var d=c(4798);function e(a,b){let c=(0,d.Q)(a,b?.in);return c.setHours(0,0,0,0),c}},21009:function(a,b,c){"use strict";c.d(b,{z:function(){return f}});var d=c(77831),e=c(4798);function f(a,b){let c=(0,d.j)(),f=(((b?.weekStartsOn??b?.locale?.options?.weekStartsOn)??c.weekStartsOn)??c.locale?.options?.weekStartsOn)??0,g=(0,e.Q)(a,b?.in),h=g.getDay();return g.setDate(g.getDate()-((h