@sendbird/chat
Version:
Sendbird SDK for JavaScript
1 lines • 203 kB
JavaScript
var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])},e(t,n)};function t(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}var n=function(){return n=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n])Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e},n.apply(this,arguments)};function i(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)t.indexOf(i[r])<0&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}function r(e,t,n,i){return new(n||(n=Promise))((function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,a)}c((i=i.apply(e,t||[])).next())}))}function s(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,a[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return s.label++,{value:a[1],done:!1};case 5:s.label++,i=a[1],a=[0];continue;case 7:a=s.ops.pop(),s.trys.pop();continue;default:if(!(r=s.trys,(r=r.length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){s=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){s.label=a[1];break}if(6===a[0]&&s.label<r[1]){s.label=r[1],r=a;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(a);break}r[2]&&s.ops.pop(),s.trys.pop();continue}a=t.call(e,s)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}}function o(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],i=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function c(e,t,n){if(n||2===arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var u,l="4.17.4",h=function(){function e(){}return Object.defineProperty(e,"OS_VERSION",{get:function(){return"undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.replace(/,/g,"."):"noAgent"},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SDK_VERSION",{get:function(){return l},enumerable:!1,configurable:!0}),Object.defineProperty(e,"SDK_MAJOR_VERSION",{get:function(){return e.SDK_VERSION.split(".")[0]},enumerable:!1,configurable:!0}),Object.defineProperty(e,"DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL",{get:function(){return 100},enumerable:!1,configurable:!0}),Object.defineProperty(e,"INTERNAL_CALL",{get:function(){return"ic"},enumerable:!1,configurable:!0}),e}();!function(e){e[e.NON_AUTHORIZED=400108]="NON_AUTHORIZED",e[e.INVALID_TOKEN=400111]="INVALID_TOKEN",e[e.NOT_FOUND_IN_DATABASE=400201]="NOT_FOUND_IN_DATABASE",e[e.USER_AUTH_DEACTIVATED=400300]="USER_AUTH_DEACTIVATED",e[e.USER_AUTH_DELETED_OR_NOT_FOUND=400301]="USER_AUTH_DELETED_OR_NOT_FOUND",e[e.SESSION_TOKEN_EXPIRED=400302]="SESSION_TOKEN_EXPIRED",e[e.APPLICATION_NOT_FOUND=400304]="APPLICATION_NOT_FOUND",e[e.SESSION_KEY_EXPIRED=400309]="SESSION_KEY_EXPIRED",e[e.SESSION_REVOKED=400310]="SESSION_REVOKED",e[e.INVALID_SESSION_TYPE=400312]="INVALID_SESSION_TYPE",e[e.INVALID_AUTH_FOR_SERVICE=400313]="INVALID_AUTH_FOR_SERVICE",e[e.STAT_UPLOAD_NOT_ALLOWED=403200]="STAT_UPLOAD_NOT_ALLOWED",e[e.NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE=400940]="NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE",e[e.INTERNAL_SERVER_ERROR=500901]="INTERNAL_SERVER_ERROR",e[e.RATE_LIMIT_EXCEEDED=500910]="RATE_LIMIT_EXCEEDED",e[e.INVALID_REQUIRED_FORM_VALUE=400105]="INVALID_REQUIRED_FORM_VALUE",e[e.UNKNOWN_SERVER_ERROR=900200]="UNKNOWN_SERVER_ERROR",e[e.NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE=901500]="NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE",e[e.ERR_DUPLICATED_DATA=400202]="ERR_DUPLICATED_DATA",e[e.DEBUG_MODE_REQUIRED=7e5]="DEBUG_MODE_REQUIRED",e[e.LOST_INSTANCE=700100]="LOST_INSTANCE",e[e.CONNECTION_RENEW=700102]="CONNECTION_RENEW",e[e.INVALID_CONNECTION_STATE_TRANSITION=700200]="INVALID_CONNECTION_STATE_TRANSITION",e[e.INVALID_COMMAND=700700]="INVALID_COMMAND",e[e.XMLHTTPREQUEST_NOT_SUPPORTED=700800]="XMLHTTPREQUEST_NOT_SUPPORTED",e[e.UNKNOWN_ERROR=77e4]="UNKNOWN_ERROR",e[e.INVALID_INITIALIZATION=800100]="INVALID_INITIALIZATION",e[e.CONNECTION_REQUIRED=800101]="CONNECTION_REQUIRED",e[e.CONNECTION_CANCELED=800102]="CONNECTION_CANCELED",e[e.INVALID_PARAMETER=800110]="INVALID_PARAMETER",e[e.NOT_SUPPORTED_ERROR=800111]="NOT_SUPPORTED_ERROR",e[e.NETWORK_ERROR=800120]="NETWORK_ERROR",e[e.NETWORK_ROUTING_ERROR=800121]="NETWORK_ROUTING_ERROR",e[e.MALFORMED_DATA=800130]="MALFORMED_DATA",e[e.MALFORMED_ERROR_DATA=800140]="MALFORMED_ERROR_DATA",e[e.WRONG_CHANNEL_TYPE=800150]="WRONG_CHANNEL_TYPE",e[e.MARK_AS_READ_RATE_LIMIT_EXCEEDED=800160]="MARK_AS_READ_RATE_LIMIT_EXCEEDED",e[e.QUERY_IN_PROGRESS=800170]="QUERY_IN_PROGRESS",e[e.ACK_TIMEOUT=800180]="ACK_TIMEOUT",e[e.LOGIN_TIMEOUT=800190]="LOGIN_TIMEOUT",e[e.WEBSOCKET_CONNECTION_CLOSED=800200]="WEBSOCKET_CONNECTION_CLOSED",e[e.WEBSOCKET_CONNECTION_FAILED=800210]="WEBSOCKET_CONNECTION_FAILED",e[e.REQUEST_FAILED=800220]="REQUEST_FAILED",e[e.FILE_UPLOAD_CANCEL_FAILED=800230]="FILE_UPLOAD_CANCEL_FAILED",e[e.REQUEST_CANCELED=800240]="REQUEST_CANCELED",e[e.REQUEST_DUPLICATED=800250]="REQUEST_DUPLICATED",e[e.FILE_SIZE_LIMIT_EXCEEDED=800260]="FILE_SIZE_LIMIT_EXCEEDED",e[e.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED=800270]="ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED",e[e.SESSION_TOKEN_REQUEST_FAILED=800500]="SESSION_TOKEN_REQUEST_FAILED",e[e.SESSION_TOKEN_REFRESHED=800501]="SESSION_TOKEN_REFRESHED",e[e.SESSION_TOKEN_REFRESH_FAILED=800502]="SESSION_TOKEN_REFRESH_FAILED",e[e.COLLECTION_DISPOSED=800600]="COLLECTION_DISPOSED",e[e.DATABASE_ERROR=800700]="DATABASE_ERROR",e[e.USER_DEACTIVATED=900021]="USER_DEACTIVATED",e[e.CHANNEL_IS_FROZEN=900050]="CHANNEL_IS_FROZEN",e[e.RECEIVER_USER_DEACTIVATED=900081]="RECEIVER_USER_DEACTIVATED"}(u||(u={}));var d,_,f,p,E,g,v=function(e){return!(e instanceof m&&!e.shouldThrowOutside)},m=function(e){function n(t){var i=t.code,r=void 0===i?0:i,s=t.message,o=void 0===s?"":s,a=e.call(this,o)||this;return a.shouldThrowOutside=!1,a._detail="",a.name="SendbirdError",a.code=r,Object.setPrototypeOf(a,n.prototype),a}return t(n,e),Object.defineProperty(n.prototype,"detail",{get:function(){return this._detail},enumerable:!1,configurable:!0}),n.prototype.setDetail=function(e){this._detail=e},Object.defineProperty(n.prototype,"isInvalidTokenError",{get:function(){return this.code===u.INVALID_TOKEN},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionExpiredError",{get:function(){return this.isSessionTokenExpiredError||this.isSessionKeyExpiredError},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionTokenExpiredError",{get:function(){return this.code===u.SESSION_TOKEN_EXPIRED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionKeyExpiredError",{get:function(){return this.code===u.SESSION_KEY_EXPIRED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionInvalidatedError",{get:function(){return this.isSessionRevokedError||this.isUserAuthDeactivedError||this.isUserAuthDeletedOrNotFoundError},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isSessionRevokedError",{get:function(){return this.code===u.SESSION_REVOKED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isUserAuthDeactivedError",{get:function(){return this.code===u.USER_AUTH_DEACTIVATED},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isUserAuthDeletedOrNotFoundError",{get:function(){return this.code===u.USER_AUTH_DELETED_OR_NOT_FOUND},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"isNetworkError",{get:function(){return this.code===u.NETWORK_ERROR||this.code===u.NETWORK_ROUTING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(n,"debugModeRequired",{get:function(){return new n({code:u.DEBUG_MODE_REQUIRED,message:"Cannot run this operation in production mode."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"lostInstance",{get:function(){return new n({code:u.LOST_INSTANCE,message:"Instance ID is missing. It should belong to an instance."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"invalidCommand",{get:function(){return new n({code:u.INVALID_COMMAND,message:"Cannot send invalid command."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"unknown",{get:function(){return new n({code:u.UNKNOWN_ERROR,message:"Unknown error occurred."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"connectionRenew",{get:function(){return new n({code:u.CONNECTION_RENEW,message:"Connection restarts."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"invalidConnectionStateTransition",{get:function(){return new n({code:u.INVALID_CONNECTION_STATE_TRANSITION,message:"Invalid connection state transition."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"xmlHttpRequestNotSupported",{get:function(){return new n({code:u.XMLHTTPREQUEST_NOT_SUPPORTED,message:"Cannot upload file. XMLHttpRequest is not defined in this environment."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"connectionRequired",{get:function(){return new n({code:u.CONNECTION_REQUIRED,message:"Connection is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"connectionCanceled",{get:function(){return new n({code:u.CONNECTION_CANCELED,message:"Connection is canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"invalidParameters",{get:function(){return new n({code:u.INVALID_PARAMETER,message:"Invalid parameters."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"notSupportedError",{get:function(){return new n({code:u.NOT_SUPPORTED_ERROR,message:"Given parameters are not supported."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"channelTypeNotSupportedError",{get:function(){return new n({code:u.NOT_SUPPORTED_ERROR,message:"Called method is not supported in the current channel's channel type."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"networkError",{get:function(){return new n({code:u.NETWORK_ERROR,message:"There was a network error."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"markAsReadAllRateLimitExceeded",{get:function(){return new n({code:u.MARK_AS_READ_RATE_LIMIT_EXCEEDED,message:"markAsRead rate limit exceeded."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"queryInProgress",{get:function(){return new n({code:u.QUERY_IN_PROGRESS,message:"Query in progress."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"noAckTimeout",{get:function(){return new n({code:u.ACK_TIMEOUT,message:"Command received no ack."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"loginTimeout",{get:function(){return new n({code:u.LOGIN_TIMEOUT,message:"Connection timeout."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"connectionClosed",{get:function(){return new n({code:u.WEBSOCKET_CONNECTION_CLOSED,message:"Connection is closed. Please reconnect."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"requestFailed",{get:function(){return new n({code:u.REQUEST_FAILED,message:"Request failed."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"tooManyRequests",{get:function(){return new n({code:u.REQUEST_DUPLICATED,message:"Too many requests."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"alreadyConnectedAsAnotherUser",{get:function(){return new n({code:u.REQUEST_FAILED,message:"Already logged in as a different user. Call disconnect() first."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"fileUploadCanceled",{get:function(){return new n({code:u.FILE_UPLOAD_CANCEL_FAILED,message:"File upload has been canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"requestCanceled",{get:function(){return new n({code:u.REQUEST_CANCELED,message:"Request has been canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"sessionTokenRefreshFailed",{get:function(){return new n({code:u.SESSION_TOKEN_REFRESH_FAILED,message:"Failed to refresh the session key."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"sessionTokenRequestFailed",{get:function(){return new n({code:u.SESSION_TOKEN_REQUEST_FAILED,message:"Failed to get the session token."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"databaseError",{get:function(){return new n({code:u.DATABASE_ERROR,message:"Database error."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"fileSizeLimitExceededError",{get:function(){return new n({code:u.FILE_SIZE_LIMIT_EXCEEDED,message:"File size exceeds the file size limit."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"statLogUploadLimitExceededError",{get:function(){return new n({code:u.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED,message:"The upload request failed due to the retry count being exceeded."})},enumerable:!1,configurable:!0}),Object.defineProperty(n,"malformedDataError",{get:function(){return new n({code:u.MALFORMED_DATA,message:"Malformed data."})},enumerable:!1,configurable:!0}),n.prototype.throwOutside=function(){throw this.shouldThrowOutside=!0,this},n}(Error),b=[u.CONNECTION_REQUIRED,u.NETWORK_ERROR,u.ACK_TIMEOUT,u.WEBSOCKET_CONNECTION_CLOSED,u.WEBSOCKET_CONNECTION_FAILED,u.FILE_UPLOAD_CANCEL_FAILED,u.REQUEST_CANCELED,u.INTERNAL_SERVER_ERROR,u.RATE_LIMIT_EXCEEDED,u.UNKNOWN_SERVER_ERROR,u.USER_DEACTIVATED,u.CHANNEL_IS_FROZEN,u.RECEIVER_USER_DEACTIVATED],y=[u.WEBSOCKET_CONNECTION_CLOSED,u.WEBSOCKET_CONNECTION_FAILED,u.CONNECTION_REQUIRED,u.CHANNEL_IS_FROZEN],w=function(e,t){if(e!==t){var i=n({},e),r=n({},t);return(!i.hasOwnProperty("messageId")||!r.hasOwnProperty("messageId")||i.messageId===r.messageId)&&((!i.hasOwnProperty("reqId")||!r.hasOwnProperty("reqId")||i.reqId===r.reqId)&&(i.hasOwnProperty("messageId")&&delete i.messageId,i.hasOwnProperty("reqId")&&delete i.reqId,r.hasOwnProperty("messageId")&&delete r.messageId,r.hasOwnProperty("reqId")&&delete r.reqId,JSON.stringify(i)===JSON.stringify(r)))}return!0},S=function(e,t,n){return void 0===n&&(n=!1),!(!n||!R(t))||("string"!=typeof e?"object"==typeof e?T(e,t):C(e,t):typeof t===e)},T=function(e,t,n){return void 0===n&&(n=!1),!(!n||!R(t))||Object.values(e).includes(t)},C=function(e,t){return t instanceof e},N=function(e,t,n){return void 0===n&&(n=!1),!(!n||!R(t))||Array.isArray(t)&&t.every((function(t){return S(e,t)}))},A=function(e,t){return void 0===t&&(t=!1),!(!t||!R(e))||"number"==typeof e&&13===e.toString().length},I=function(e){return e>0&&b.indexOf(e)>=0},O=function(e){return e>0&&y.indexOf(e)>=0},k=function(e,t){if(void 0===t&&(t=!1),t&&R(e))return!0;var n="object"==typeof e&&null!==e&&e.hasOwnProperty("name")&&"string"==typeof e.name&&e.hasOwnProperty("uri")&&"string"==typeof e.uri&&e.hasOwnProperty("type")&&"string"==typeof e.type;if(!n){if("undefined"!=typeof Blob)return e instanceof Blob;if("undefined"!=typeof File)return e instanceof File}return n},D=function(e,t){if(e===t)return!0;if(null==e||null==t)return!1;if(e.length!==t.length)return!1;for(var n=c([],a(e),!1).sort(),i=c([],a(t),!1).sort(),r=0;r<n.length;++r)if(n[r]!==i[r])return!1;return!0},R=function(e){return null==e},L=function(){function e(e){var t=void 0===e?{}:e,n=t.useMemberInfoInMessage,i=void 0===n||n,r=t.typingIndicatorInvalidateTime,s=void 0===r?1e4:r,o=t.typingIndicatorThrottle,a=void 0===o?1e3:o,c=t.websocketResponseTimeout,u=void 0===c?1e4:c,l=t.websocketPayloadDecompression,h=void 0===l||l,d=t.sessionTokenRefreshTimeout,_=void 0===d?60:d;this._useMemberInfoInMessage=!0,this._typingIndicatorInvalidateTime=1e4,this._typingIndicatorThrottle=1e3,this._websocketResponseTimeout=1e4,this._sessionTokenRefreshTimeout=60,this._useMemberInfoInMessage=i,this._typingIndicatorInvalidateTime=s,this._typingIndicatorThrottle=a,this._websocketResponseTimeout=u,this._sessionTokenRefreshTimeout=_,this.websocketPayloadDecompression=h}return Object.defineProperty(e.prototype,"useMemberInfoInMessage",{get:function(){return this._useMemberInfoInMessage},set:function(e){S("boolean",e)&&(this._useMemberInfoInMessage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"typingIndicatorInvalidateTime",{get:function(){return this._typingIndicatorInvalidateTime},set:function(e){S("number",e)&&(this._typingIndicatorInvalidateTime=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"typingIndicatorThrottle",{get:function(){return this._typingIndicatorThrottle},set:function(e){S("number",e)&&e>=1e3&&e<=9e3&&(this._typingIndicatorThrottle=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketResponseTimeout",{get:function(){return this._websocketResponseTimeout},set:function(e){S("number",e)&&e>=5e3&&e<=3e4&&(this._websocketResponseTimeout=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionTokenRefreshTimeout",{get:function(){return this._sessionTokenRefreshTimeout},set:function(e){S("number",e)&&(e<60?e=60:e>1800&&(e=1800),this._sessionTokenRefreshTimeout=e)},enumerable:!1,configurable:!0}),e}(),x={encrypt:function(e){return e},decrypt:function(e){return e}},U=function(){function e(e){var t=e.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._store.set({key:this._keysAddress,value:c([],a(this._preference.keys()),!1)})];case 1:return e.sent(),[2]}}))}))},e.prototype.init=function(e,t){var n;return void 0===t&&(t=1),r(this,void 0,void 0,(function(){var i,r,a,c,u,l,h,d,_,f,p;return s(this,(function(s){switch(s.label){case 0:return this._version=t,this._keysAddress=e,i="".concat(e,".metadata.version"),[4,this._store.get(i)];case 1:return r=s.sent(),[4,this._store.get(e)];case 2:return a=null!==(n=s.sent())&&void 0!==n?n:[],!r||r.version<this._version?9===this._version?[3,3]:[3,6]:[3,10];case 3:return c=a.find((function(e){return e.includes("groupchannel/sync.meta")})),c?[4,this._store.remove(c)]:[3,5];case 4:s.sent(),s.label=5;case 5:return[3,8];case 6:return[4,this._resetPreferenceData(a)];case 7:s.sent(),s.label=8;case 8:return[4,this._updatePreferenceVersionInfo(i)];case 9:return s.sent(),[3,17];case 10:s.trys.push([10,15,16,17]),u=o(a),l=u.next(),s.label=11;case 11:return l.done?[3,14]:(h=l.value,[4,this._store.get(h)]);case 12:(d=s.sent())&&this._preference.set(h,d),s.label=13;case 13:return l=u.next(),[3,11];case 14:return[3,17];case 15:return _=s.sent(),f={error:_},[3,17];case 16:try{l&&!l.done&&(p=u.return)&&p.call(u)}finally{if(f)throw f.error}return[7];case 17:return[2]}}))}))},e.prototype._updatePreferenceVersionInfo=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._store.set({key:e,value:{version:this._version}})];case 1:return t.sent(),[2]}}))}))},e.prototype._resetPreferenceData=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return this._preference=new Map,[4,this._store.removeMany(e)];case 1:return t.sent(),[2]}}))}))},e.prototype.get=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){return[2,this._preference.get(e)]}))}))},e.prototype.set=function(e,t){return r(this,void 0,void 0,(function(){var n;return s(this,(function(i){switch(i.label){case 0:return n=!this._preference.has(e),[4,this._store.set({key:e,value:t})];case 1:return i.sent(),this._preference.set(e,t),n?[4,this._savePreferenceKeys()]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}}))}))},e.prototype.remove=function(e){return r(this,void 0,void 0,(function(){return s(this,(function(t){switch(t.label){case 0:return[4,this._store.remove(e)];case 1:return t.sent(),this._preference.delete(e),[4,this._savePreferenceKeys()];case 2:return t.sent(),[2]}}))}))},e.prototype.clear=function(){return r(this,void 0,void 0,(function(){return s(this,(function(e){switch(e.label){case 0:return[4,this._store.removeMany(c([],a(this._preference.keys()),!1))];case 1:return e.sent(),this._preference.clear(),[4,this._savePreferenceKeys()];case 2:return e.sent(),[2]}}))}))},e}(),P=function(){function e(e){var t=e.encryption,n=e.store,i=e.localCacheEnabled,r=e.localCacheConfig;this.store=n,this.preference=new U({store:n}),this.encryption=null!=t?t:x,this.localCacheEnabled=i,this.localCacheConfig=r}return e.prototype.replaceStore=function(e){this.store=e,this.preference=new U({store:e})},e}();!function(e){e.SUCCESS="success",e.PENDING="pending",e.ERROR="error"}(d||(d={})),function(e){e.DEFAULT="default",e.ALL="all",e.MENTION_ONLY="mention_only",e.OFF="off"}(_||(_={})),function(e){e.FCM="gcm",e.APNS="apns",e.UNKNOWN="unknown"}(f||(f={})),function(e){e.SESSION_TOKEN="session_token",e.ACCESS_TOKEN="access_token"}(p||(p={})),function(e){e.ALTERNATIVE="alternative",e.DEFAULT="default"}(E||(E={})),function(e){e.CUSTOM="custom",e.MESSAGE_COLLECTION_ACCESSED_AT="messagecollection_accessed_at"}(g||(g={}));var M,q=function(){function e(e){var t=e.channel,n=e.cachedMessageCount;this._cachedMessageCount=0,this._channel=t,this._cachedMessageCount=n}return Object.defineProperty(e.prototype,"channel",{get:function(){return this._channel},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"cachedMessageCount",{get:function(){return this._cachedMessageCount},enumerable:!1,configurable:!0}),e}(),F=function(){function e(e){var t=void 0===e?{}:e,n=t.maxSize,i=void 0===n?256:n,r=t.clearOrder,s=void 0===r?g.MESSAGE_COLLECTION_ACCESSED_AT:r,o=t.customClearOrderComparator,a=t.enableAutoResend,c=void 0===a||a;this._clearOrderComparatorUseMessageCollectionAccessedAt=function(e,t){return e.channel.messageCollectionLastAccessedAt===t.channel.messageCollectionLastAccessedAt?e.channel.lastMessage&&!t.channel.lastMessage?1:!e.channel.lastMessage&&t.channel.lastMessage?-1:e.channel.lastMessage||t.channel.lastMessage?e.channel.lastMessage.createdAt-t.channel.lastMessage.createdAt:0:e.channel.messageCollectionLastAccessedAt>t.channel.messageCollectionLastAccessedAt?1:-1},this._maxSize=Math.max(i,64),o?(this._clearOrder=s,this._customClearOrderComparator=o):this._clearOrder=g.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=c}return Object.defineProperty(e.prototype,"maxSize",{get:function(){return this._maxSize},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrder",{get:function(){return this._clearOrder},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var e;return this._clearOrder===g.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:null!==(e=this._customClearOrderComparator)&&void 0!==e?e:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();!function(e){e.FEED="feed",e.CHAT="chat",e.CHAT_API="chat_api"}(M||(M={}));var H,V,z,G,j,K,B,Q,W,Z,Y,X,J,$=function(){function e(){this.isRefreshing=!1}return Object.defineProperty(e.prototype,"hasSession",{get:function(){return!!this.sessionKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"hasChatServicePermission",{get:function(){var e;return!!(null===(e=this.services)||void 0===e?void 0:e.includes(M.CHAT))},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),ee=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)}))},te=function(){function e(e){var t=e.container;this._container={},this._container=t,this.key=ee()}return e.prototype._register=function(e,t,n){var i;return e in this._container||(this._container[e]=new Map),null===(i=this._container[e])||void 0===i||i.set(this.key,{occurence:t,handler:n}),this},e.prototype.on=function(e,t){return this._register(e,-1,t)},e.prototype.once=function(e,t){return this._register(e,1,t)},e.prototype.close=function(){var e=this;Object.keys(this._container).forEach((function(t){var n;null===(n=e._container[t])||void 0===n||n.delete(e.key)}))},e}(),ne=function(){function e(){this._container={}}return e.prototype.on=function(e,t){return new te({container:this._container}).on(e,t)},e.prototype.once=function(e,t){return new te({container:this._container}).once(e,t)},e.prototype.dispatch=function(e,t){var n,i,r=this._container[e];if(r){var s=[];try{for(var a=o(r.keys()),c=a.next();!c.done;c=a.next()){var u=c.value,l=r.get(u);l.handler(t),l.occurence>0&&(l.occurence--,0===l.occurence&&s.push(u))}}catch(e){n={error:e}}finally{try{c&&!c.done&&(i=a.return)&&i.call(a)}finally{if(n)throw n.error}}s.forEach((function(e){return r.delete(e)}))}},e}(),ie=function(){function e(){this._dispatcher=new ne}return e.prototype.on=function(e){return this._dispatcher.on("event",e)},e.prototype.once=function(e){return this._dispatcher.once("event",e)},e.prototype.dispatch=function(e){this._dispatcher.dispatch("event",e)},e}(),re=function(){},se=function(e){var t={};return e&&Object.keys(e).forEach((function(n){void 0===e[n]||Number.isNaN(e[n])||null===e[n]||(t[n]=e[n])})),t},oe=function(e){if(null!=e){if("object"==typeof e){if(Array.isArray(e)){for(var t=c([],a(e),!1),n=0;n<t.length;n++)t[n]=oe(t[n]);return t}return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e}return e}};!function(e){e.BASE="base",e.GROUP="group",e.OPEN="open",e.FEED="feed"}(H||(H={})),function(e){e.OPERATOR="operator",e.NONE="none"}(V||(V={})),function(e){e.MUTED="muted",e.UNMUTED="unmuted"}(z||(z={})),function(e){e.BASE="base",e.USER="user",e.FILE="file",e.ADMIN="admin"}(G||(G={})),function(e){e.ALL="",e.USER="MESG",e.FILE="FILE",e.ADMIN="ADMM"}(j||(j={})),function(e){e.USER="MESG",e.FILE="FILE",e.ADMIN="ADMM"}(K||(K={})),function(e){e.USERS="users",e.CHANNEL="channel"}(B||(B={})),function(e){e.ALL="all",e.NONE="none",e.ONLY_REPLY_TO_CHANNEL="only_reply_to_channel"}(Q||(Q={})),function(e){e.DEFAULT="default",e.SUPPRESS="suppress"}(W||(W={})),function(e){e.PENDING="pending",e.SCHEDULED="scheduled",e.SUCCEEDED="succeeded",e.FAILED="failed",e.CANCELED="canceled"}(Z||(Z={})),function(e){e.INREVIEW="InReview",e.APPROVED="Approved"}(Y||(Y={})),function(e){e.HIGH="high",e.NORMAL="normal",e.LOW="low"}(X||(X={})),function(e){e.CREATED_AT="created_at",e.UPDATED_AT="updated_at"}(J||(J={}));var ae,ce="v3",ue="/".concat(ce,"/users"),le="/".concat(ce,"/sdk/users"),he="/".concat(ce,"/storage/file"),de="/".concat(ce,"/group_channels"),_e="/".concat(ce,"/sdk/group_channels"),fe="/".concat(ce,"/open_channels"),pe="/".concat(ce,"/sdk/open_channels"),Ee="/".concat(ce,"/search"),ge="/".concat(ce,"/report"),ve="/".concat(ce,"/emojis"),me="/".concat(ce,"/emoji_categories"),be="/".concat(ce,"/polls"),ye="/".concat(ce,"/scheduled_messages"),we="/".concat(ce,"/sdk/ui_kit/configuration"),Se="/".concat(ce,"/sdk/statistics"),Te="/".concat(ce,"/sdk/notification_statistics"),Ce="/".concat(ce,"/notifications"),Ne="/".concat(ce,"/notifications/users"),Ae="/".concat(ce,"/message_templates"),Ie="/".concat(ce,"/sdk/push_delivery"),Oe="/".concat(ce,"/forms"),ke="/".concat(ce,"/report_category"),De="/".concat(ce,"/sdk/applications/settings"),Re=function(e){switch(e){case H.FEED:case H.GROUP:return de;case H.OPEN:return fe;default:return null}},Le=function(e){switch(e){case H.GROUP:return"".concat(ge,"/group_channels");case H.OPEN:return"".concat(ge,"/open_channels");default:return null}},xe=function(e,t,n){var i,r;switch(e){case B.CHANNEL:return!0;case B.USERS:if(t)try{for(var s=o(t),a=s.next();!a.done;a=s.next()){if(a.value===n)return!0}}catch(e){i={error:e}}finally{try{a&&!a.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}return!1},Ue=function(e,t,n){var i,r,s,o,a=xe(null!==(i=e.mentionType)&&void 0!==i?i:null,null!==(r=e.mentionedUserIds)&&void 0!==r?r:[],n),c=xe(null!==(s=t.mentionType)&&void 0!==s?s:null,null!==(o=t.mentionedUserIds)&&void 0!==o?o:[],n);return!a&&c?1:a&&!c?-1:0},Pe=function(e,t,n){var i,r=t||new FormData;for(var s in e)if(e.hasOwnProperty(s)){var o=e[s],a=n?"".concat(n,"[").concat(s,"]"):s;k(o)?r.append(a,o,null!==(i=o.name)&&void 0!==i?i:"filename"):"object"!=typeof o||null===o||Array.isArray(o)||o instanceof Blob?r.append(a,String(o)):r=Pe(o,r,a)}return r};!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(ae||(ae={}));var Me,qe=function(e){function n(){var t=null!==e&&e.apply(this,arguments)||this;return t.params={},t.requireAuth=!0,t.headers={},t.requestId=ee(),t}return t(n,e),n.prototype.encodeParams=function(e){var t=this;return null==e||""===e?encodeURIComponent(""):Array.isArray(e)?e.map((function(e){return t.encodeParams(e)})).join(","):"object"==typeof e?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(String(e))},Object.defineProperty(n.prototype,"query",{get:function(){var e=this,t=se(this.params);return"?".concat(Object.keys(t).map((function(n){return"".concat(encodeURIComponent(n),"=").concat(e.encodeParams(t[n]))})).join("&"))},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"payload",{get:function(){var e=se(this.params);return Object.keys(e).some((function(t){return k(e[t])}))?Pe(e):JSON.stringify(e)},enumerable:!1,configurable:!0}),Object.defineProperty(n.prototype,"hasSessionKey",{get:function(){return void 0!==this.headers["Session-Key"]},enumerable:!1,configurable:!0}),n}(re),Fe=function(e){function i(t,n){var i=e.call(this)||this;return i._iid=t,i._payload=n,i}return t(i,e),Object.defineProperty(i.prototype,"payload",{get:function(){return n({},this._payload)},enumerable:!1,configurable:!0}),i.prototype.as=function(e){return new e(this._iid,this.payload)},i}(re),He=function(e){function n(t){var n=e.call(this)||this;return n.requestId=t,n}return t(n,e),n}(re),Ve=function(e){function n(t){var n=t.expires_in,i=t.reason,r=void 0===i?u.SESSION_KEY_EXPIRED:i,s=t.message,o=void 0===s?"":s,a=e.call(this)||this;switch(a.expiresIn=null!=n?n:0,r){case u.SESSION_KEY_EXPIRED:case u.SESSION_TOKEN_EXPIRED:case u.SESSION_REVOKED:case u.USER_AUTH_DEACTIVATED:case u.USER_AUTH_DELETED_OR_NOT_FOUND:a.error=new m({code:r,message:o})}return a}return t(n,e),Object.defineProperty(n.prototype,"invalidateSessionToken",{get:function(){var e;return!!(null===(e=this.error)||void 0===e?void 0:e.isSessionTokenExpiredError)},enumerable:!1,configurable:!0}),n}(re),ze=function(e){function n(t,n,i,r){void 0===r&&(r="");var s,o=this;return(o=e.call(this)||this)._iid=t,o.code=n,o.payload=i,o.requestId=null!==(s=i.req_id)&&void 0!==s?s:r,o}return t(n,e),n.createFromRawMessage=function(e,t){var i=t.substring(0,4),r={};try{r=JSON.parse(t.substring(4))}catch(e){i="NOOP"}finally{return new n(e,i,r)}},n.prototype.convertToMessage=function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")},n.prototype.as=function(e){return new e(this._iid,this.code,this.payload)},n}(re),Ge=function(e){function n(t){var n,i=t.code,r=t.ackRequired,s=t.payload,o=void 0===s?{}:s,a=this;return(a=e.call(this)||this).code=i,a.payload=o,a.requestId=null!==(n=a.payload.req_id)&&void 0!==n?n:ee(),a.ackRequired=r,a.payload.req_id=a.requestId,a}return t(n,e),n.prototype.convertToMessage=function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")},n}(re),je=function(e){function n(t){var n=t.userId,i=t.authToken,r=t.services,s=t.expiringSession,o=void 0===s||s,a=e.call(this)||this;return a.path="".concat(ue,"/").concat(n,"/session_key"),a.method=ae.POST,a.params=se({token:i,services:r,expiring_session:!!o}),a.requireAuth=!1,a}return t(n,e),n}(qe),Ke=function(e){function n(t){var n=t.authToken,i=t.expiringSession,r=void 0===i||i,s=t.requestId,o=void 0===s?void 0:s;return e.call(this,{code:"LOGI",payload:se({token:n,expiring_session:r?1:0,req_id:o}),ackRequired:!0})||this}return t(n,e),n}(Ge),Be=function(e){function n(t,n){var i=e.call(this,t,n)||this,r=n.key,s=n.expires_at,o=n.services;return i.key=r,i.expiresAt=s,i.services=o,i}return t(n,e),n}(Fe),Qe=function(e){function n(t,n,i){var r,s=this;return(s=e.call(this,t,"LOGI",i)||this).error=null,s.newKey=null,s.newKey=null!==(r=i.new_key)&&void 0!==r?r:null,s.error=i.error?new m(i):null,s}return t(n,e),n}(ze),We=function(e){function n(t){var n=e.call(this)||this;return n.statLog=t,n}return t(n,e),n}(re),Ze=function(e){function n(t){var n=t.request,i=t.deferred,r=t.error,s=void 0===r?m.requestFailed:r,o=e.call(this)||this;return o.request=n,o.deferred=i,o.error=s,o}return t(n,e),n}(re);!function(e){e.FEATURE_LOCALCACHE="feature:local_cache",e.FEATURE_LOCALCACHE_EVENT="feature:local_cache_event",e.NOTIFICATION="noti:stats",e.WEBSOCKET_CONNECT="ws:connect",e.WEBSOCKET_DISCONNECT="ws:disconnect",e.API_RESULT="api:result"}(Me||(Me={}));var Ye,Xe,Je,$e=function(){function e(e){var t=e.type,n=e.data,i=e.ts,r=void 0===i?Date.now():i;this.type=t,this.createdAt=r,this.data=n}return e.payloadify=function(e){return se({stat_type:e.type,ts:e.createdAt,data:se(e.data)})},e}(),et=function(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"==navigator.product},tt=function(){return!("undefined"==typeof navigator||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};!function(e){e.CHAT="chat",e.CALLS="calls",e.DESK="desk",e.LIVE="live",e.UIKIT_CHAT="uikit-chat",e.UIKIT_LIVE="uikit-live"}(Ye||(Ye={})),function(e){e.ANDROID="android",e.IOS="ios",e.JS="js",e.UNREAL="unreal",e.UNITY="unity",e.REACT_NATIVE="react-native",e.FLUTTER="flutter"}(Xe||(Xe={})),function(e){e.ANDROID="android",e.IOS="ios",e.WEB="web",e.MOBILE_WEB="mobile_web",e.WINDOWS="windows"}(Je||(Je={}));var nt="^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$",it=function(){function e(){}var t;return t=e,e._getFrameWork=function(){if("undefined"!=typeof window){if(window.__REACT__)return"react";if(window.__VUE__)return"vue";var e=window.__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e&&e.getFiberRoots&&e.getFiberRoots(1).size>0)return"react";if(window.__NUXT__)return"vue(SSR)";if(window.__NEXT_DATA__||window.__NEXT_P||window.__NEXT_F)return"nextjs"}return""},e.sendbirdSdkUserAgentWithExtension=function(e){var i=et()?Xe.REACT_NATIVE:Xe.JS,r={main_sdk_info:"chat/".concat(i,"/").concat(h.SDK_VERSION),device_os_platform:tt()?"mobile-web":"web",os_version:h.OS_VERSION};if(e){var s=e.sendbirdExtensions,o=e.deviceOS,c=e.customData,u=void 0===c?{}:c;o.version&&(r.os_version=o.version),o.platform&&(r.device_os_platform=o.platform),s.length>0&&(r.extension_sdk_info=s.map((function(e){var t=e.product,n=e.platform,i=e.version;return"".concat(t,"/").concat(n,"/").concat(i)})).join(",")),Object.keys(r).forEach((function(e){return delete u[e]})),Object.keys(u).length>0&&(r=n(n({},r),u))}var l=t._getFrameWork();return l&&(r.javascript_framework=l),Object.entries(r).map((function(e){var t=a(e,2),n=t[0],i=t[1];return"".concat(n,"=").concat(i)})).join("&")},e.userAgentWithExtension=function(e){var t=et()?"reactnative":"JS",n=e.sb_syncmanager?"s".concat(e.sb_syncmanager):"",i=e.sb_uikit?"u".concat(e.sb_uikit):"",r=e["device-os-platform"]?"o".concat(e["device-os-platform"]):tt()?"omobile-web":"oweb";return"".concat(t,"/c").concat(h.SDK_VERSION,"/").concat(n,"/").concat(i,"/").concat(r)},e}(),rt=function(){var e=this;this.promise=new Promise((function(t,n){e.resolve=t,e.reject=function(e){n(e)}}))},st=function(e){function n(t){var n=e.call(this)||this;return n.requestId=t.requestId,n}return t(n,e),n}(re),ot=function(e){function n(t){var n=e.call(this)||this;return n.method=ae.DELETE,n.path="".concat(Re(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(n.params=se({mesg_token:t.messageToken})),n}return t(n,e),n}(qe);!function(e){function n(){return null!==e&&e.apply(this,arguments)||this}t(n,e)}(Fe);var at=function(e){function n(t,n,i){var r,s=this;return(s=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,s.channelType=i.channel_type,s.messageId=Number(i.msg_id),s.silent=i.silent,s.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,s.senderId=null!==(r=i.sender_id)&&void 0!==r?r:void 0,s}return t(n,e),n}(ze),ct=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,s=t.logger,o=t.useFetchCompat,a=void 0!==o&&o,c=this;this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=e,this._session=n,this._sdkState=i,this._dispatcher=r,this._dispatcher.on((function(e){e instanceof He&&c.cancel(e.requestId)})),this._logger=s,this._shouldImportFetchCompat=a}return e.prototype._createHeader=function(e,t){var i=this._sdkState,r=i.appId,s=i.appVersion,o=i.sendbirdRuntimeEnvironment,a=n(n({},e.headers),{SendBird:"JS,".concat(h.OS_VERSION,",").concat(h.SDK_VERSION,",").concat(r).concat(s?",".concat(s):""),"SB-User-Agent":it.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":it.sendbirdSdkUserAgentWithExtension(o)});return t||(a["Content-Type"]="application/json; charset=utf-8"),e.requireAuth&&!e.hasSessionKey&&this._session.hasSession&&(a["Session-Key"]=this._session.sessionKey),a["App-Id"]=r,this._session&&this._session.authToken&&(a["Access-Token"]=this._session.authToken),a},e.prototype._statLogApiResult=function(e,t,n){e.path.includes("/sdk/statistics")||this._dispatcher.dispatch(new We(new $e({type:Me.API_RESULT,data:{endpoint:e.path,method:e.method,success:!n,latency:Date.now()-t,error_code:null==n?void 0:n.code,error_description:null==n?void 0:n.message}})))},e.prototype._isBodyRequired=function(e){var t=e.method;return t!==ae.GET&&(t!==ae.DELETE||e instanceof ot)},e.prototype.send=function(e){return r(this,void 0,void 0,(function(){var t,n,i,r,o,a,c,l,h,d,_,f,p,E,g,v,b,y,w;return s(this,(function(s){switch(s.label){case 0:t=e.path,n=e.method,i=e.uploadProgressHandler,r=this._isBodyRequired(e),o=this._sdkState.api,a="".concat(o.host).concat(t).concat(r?"":e.query),c=r?e.payload:null,l=this._createHeader(e,c instanceof FormData?c:void 0),h=new AbortController,d=h.signal,this._abortControl.set(e.requestId,h),_=Date.now(),s.label=1;case 1:return s.trys.push([1,13,,14]),i?[4,import("./__bundle-ee0ff698.js")]:[3,6];case 2:f=s.sent().xmlHttpRequest,s.label=3;case 3:return s.trys.push([3,5,,6]),[4,f(this._iid,{requestId:e.requestId,method:e.method,url:a,headers:l,data:null!=c?c:void 0,uploadProgressHandler:i})];case 4:return p=s.sent(),this._logger.debug("receive api response",e.requestId),this._statLogApiResult(e,_),[2,p];case 5:if(!((E=s.sent())instanceof m&&E.code===u.XMLHTTPREQUEST_NOT_SUPPORTED))throw E;return this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),[3,6];case 6:return this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,("undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{fetch:null}).fetch=null),"undefined"!=typeof AbortController?[3,8]:[4,import("./__bundle-8b4f432b.js")];case 7:s.sent(),s.label=8;case 8:return"function"==typeof fetch?[3,10]:[4,import("./__bundle-46d64517.js")];case 9:s.sent(),s.label=10;case 10:return[4,fetch(a,{method:n,body:c,headers:l,signal:d})];case 11:return[4,(g=s.sent()).json()];case 12:if(v=s.sent(),g.ok||g.redirected)return this._logger.debug("receive api response",e.requestId),this._statLogApiResult(e,_),[2,new Fe(this._iid,v)];if(v){if((b=new m(v)).isSessionExpiredError){if(this._dispatcher.dispatch(new Ve({reason:b.code,message:b.message})),!(e instanceof je))return y=new rt,this._dispatcher.dispatch(new Ze({request:e,deferred:y,error:b})),[2,y.promise];throw b}throw b.isSessionInvalidatedError?(this._dispatcher.dispatch(new Ve({reason:b.code,message:b.message})),b):b}throw m.requestFailed;case 13:throw w=s.sent(),this._statLogApiResult(e,_,w),w instanceof m?(this._logger.debug("fail api request",w),w):"AbortError"===(null==w?void 0:w.name)?m.requestCanceled:(this._logger.debug("fail api request",w),m.networkError);case 14:return[2]}}))}))},e.prototype.cancel=function(e){this._abortControl.has(e)&&(this._abortControl.get(e).abort(),this._abortControl.delete(e));this._dispatcher.dispatch(new st({requestId:e}))},e.prototype.cancelAll=function(){var e,t;try{for(var n=o(this._abortControl.values()),i=n.next();!i.done;i=n.next()){i.value.abort()}}catch(t){e={error:t}}finally{try{i&&!i.done&&(t=n.return)&&t.call(n)}finally{if(e)throw e.error}}this._abortControl.clear(),this._dispatcher.dispatch(new st({}))},e}(),ut=function(){};function lt(e){let t=e.length;for(;--t>=0;)e[t]=0}const ht=256,dt=286,_t=30,ft=15,pt=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Et=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),gt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),vt=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mt=new Array(576);lt(mt);const bt=new Array(60);lt(bt);const yt=new Array(512);lt(yt);const wt=new Array(256);lt(wt);const St=new Array(29);lt(St);const Tt=new Array(_t);function Ct(e,t,n,i,r){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=i,this.max_length=r,this.has_stree=e&&e.length}let Nt,At,It;function Ot(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}lt(Tt);const kt=e=>e<256?yt[e]:yt[256+(e>>>7)],Dt=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},Rt=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,Dt(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=n-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=n)},Lt=(e,t,n)=>{Rt(e,n[2*t],n[2*t+1])},xt=(e,t)=>{let n=0;do{n|=1&e,e>>>=1,n<<=1}while(--t>0);return n>>>1},Ut=(e,t,n)=>{const i=new Array(16);let r,s,o=0;for(r=1;r<=ft;r++)o=o+n[r-1]<<1,i[r]=o;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=xt(i[t]++,t))}},Pt=e=>{let t;for(t=0;t<dt;t++)e.dyn_ltree[2*t]=0;for(t=0;t<_t;t++)e.dyn_dtree[2*t]=0;for(t=0;t<19;t++)e.bl_tree[2*t]=0;e.dyn_ltree[512]=1,e.opt_len=e.static_len=0,e.sym_next=e.matches=0},Mt=e=>{e.bi_valid>8?Dt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},qt=(e,t,n,i)=>{const r=2*t,s=2*n;return e[r]<e[s]||e[r]===e[s]&&i[t]<=i[n]},Ft=(e,t,n)=>{const i=e.heap[n];let r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&qt(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!qt(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},Ht=(e,t,n)=>{let i,r,s,o,a=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+a++],i+=(255&e.pending_buf[e.sym_buf+a++])<<8,r=e.pending_buf[e.sym_buf+a++],0===i?Lt(e,r,t):(s=wt[r],Lt(e,s+ht+1,t),o=pt[s],0!==o&&(r-=St[s],Rt(e,r,o)),i--,s=kt(i),Lt(e,s,n),o=Et[s],0!==o&&(i-=Tt[s],Rt(e,i,o)))}while(a<e.sym_next);Lt(e,256,t)},Vt=(e,t)=>{const n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,s=t.stat_desc.elems;let o,a,c,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<s;o++)0!==n[2*o]?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)c=e.heap[++e.heap_len]=u<2?++u:0,n[2*c]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=i[2*c+1]);for(t.max_code=u,o=e.heap_len>>1;o>=1;o--)Ft(e,n,o);c=s;do{o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],Ft(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,n[2*c]=n[2*o]+n[2*a],e.depth[c]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,n[2*o+1]=n[2*a+1]=c,e.heap[1]=c++,Ft(e,n,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length;let u,l,h,d,_,f,p=0;for(d=0;d<=ft;d++)e.bl_count[d]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)l=e.heap[u],d=n[2*n[2*l+1]+1]+1,d>c&&(d=c,p++),n[2*l+1]=d,l>i||(e.bl_count[d]++,_=0,l>=a&&(_=o[l-a]),f=n[2*l],e.opt_len+=f*(d+_),s&&(e.static_len+=f*(r[2*l+1]+_)));if(0!==p){do{for(d=c-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(d=c;0!==d;d--)for(l=e.bl_count[d];0!==l;)h=e.heap[--u],h>i||(n[2*h+1]!==d&&(e.opt_len+=(d-n[2*h+1])*n[2*h],n[2*h+1]=d),l--)}})(e,t),Ut(n,u,e.bl_count)},zt=(e,t,n)=>{let i,r,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=t[2*(i+1)+1],++a<c&&r===o||(a<u?e.bl_tree[2*r]+=a:0!==r?(r!==s&&e.bl_tree[2*r]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,s=r,0===o?(c=138,u=3):r===o?(c=6,u=3):(c=7,u=4))},Gt=(e,t,n)=>{let i,r,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++a<c&&r===o)){if(a<u)do{Lt(e,r,e.bl_tree)}while(0!=--a);else 0!==r?(r!==s&&(Lt(e,r,e.bl_tree),a--),Lt(e,16,e.bl_tree),Rt(e,a-3,2)):a<=10?(Lt(e,17,e.bl_tree),Rt(e,a-3,3)):(Lt(e,18,e.bl_tree),Rt(e,a-11,7));a=0,s=r,0===o?(c=138,u=3):r===o?(c=6,u=3):(c=7,u=4)}};let jt=!1;const Kt=(e,t,n,i)=>{Rt(e,0+(i?1:0),3),Mt(e),Dt(e,n),Dt(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var Bt=(e,t,n,i)=>{let r,s,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=4093624447;for(t=0;t<=31;t++,n>>>=1)if(1&n&&0!==e.dyn_ltree[2*t])return 0;if(0!==e.dyn_ltree[18]||0!==e.dyn_ltree[20]||0!==e.dyn_ltree[26])return 1;for(t=32;t<ht;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),Vt(e,e.l_desc),Vt(e,e.d_desc),o=(e=>{let t;for(zt(e,e.dyn_ltree,e.l_desc.max_code),zt(e,e.dyn_dtree,e.d_desc.max_code),Vt(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*vt[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=r&&(r=s)):r=s=n+5,n+4<=r&&-1!==t?Kt(e,t,n,i):4===e.strategy||s===r?(Rt(e,2+(i?1:0),3),Ht(e,mt,bt)):(Rt(e,4+(i?1:0),3),((e,t,n,i)=>{let r;for(Rt(e,t-257,5),Rt(e,n-1,5),Rt(e,i-4,4),r=0;r<i;r++)Rt(e,e.bl_tree[2*vt[r]+1],3);Gt(e,e.dyn_ltree,t-1),Gt(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Ht(e,e.dyn_ltree,e.dyn_dtree)),Pt(e),i&&Mt(e)},Qt={_tr_init:e=>{jt||((()=>{let e,t,n,i,r;const s=new Array(16);for(n=0,i=0;i<28;i++)for(St[i]=n,e=0;e<1<<pt[i];e++)wt[n++]=i;for(wt[n-1]=i,r=0,i=0;i<16;i++)for(Tt[i]=r,e=0;e<1<<Et[i];e++)yt[r++]=i;for(r>>=7;i<_t;i++)for(Tt[i]=r<<7,e=0;e<1<<Et[i]-7;e++)yt[256+r++]=i;for(t=0;t<=ft;t++)s[t]=0;for(e=0;e<=143;)mt[2*e+1]=8,e++,s[8]++;for(;e<=255;)mt[2*e+1]=9,e++,s[9]++;for(;e<=279;)mt[2*e+1]=7,e++,s[7]++;for(;e<=287;)mt[2*e+1]=8,e++,s[8]++;for(Ut(mt,287,s),e=0;e<_t;e++)bt[2*e+1]=5,bt[2*e]=xt(e,5);Nt=new Ct(mt,pt,257,dt,ft),At=new Ct(bt,Et,0,_t,ft),It=new Ct(new Array(0),gt,0,19,7)})(),jt=!0),e.l_desc=new Ot(e.dyn_ltree,Nt),e.d_desc=new Ot(e.dyn_dtree,At),e.bl_desc=new Ot(e.bl_tree,It),e.bi_buf=0,e.bi_valid=0,Pt(e)},_tr_stored_block:Kt,_tr_flush_block:Bt,_tr_tally:(e,t,n)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(wt[n]+ht+1)]++,e.dyn_dtree[2*kt(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{Rt(e,2,3),Lt(e,256,mt),(e=>{16===e.bi_valid?(Dt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Wt=(e,t,n,i)=>{let r=65535&e,s=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do{r=r+t[i++]|0,s=s+r|0}while(--o);r%=65521,s%=65521}return r|s<<16};const Zt=new Uint32Array((()=>{let e,t=[];for(var n=0;n<256;n++){e=n;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[n]=e}return t})());var Yt=(e,t,n,i)=>{const r=Zt,s=i+n;e^=-1;for(let n=i;n<s;n++)e=e>>>8^r[255&(e^t[n])];return~e},Xt={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Jt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:$t,_tr_stored_block:en,_tr_flush_block:tn,_tr_tally:nn,_tr_align:rn}=Qt,{Z_NO_FLUSH:sn,Z_PARTIAL_FLUSH:on,Z_FULL_FLUSH:an,Z_FINISH:cn,Z_BLOCK:un,Z_OK:ln,Z_STREAM_END:hn,Z_STREAM_ERROR:dn,Z_DATA_ERROR:_n,Z_BUF_ERROR:fn,Z_DEFAULT_COMPRESSION:pn,Z_FILTERED:En,Z_HUFFMA