UNPKG

@sendbird/chat

Version:
1 lines 898 kB
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Sendbird={})}(this,(function(e){function t(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function n(e,t,n){return t=u(t),function(e,t){if(t&&("object"==typeof t||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,l()?Reflect.construct(t,n||[],u(e).constructor):t.apply(e,n))}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,_(r.key),r)}}function s(e,t,n){return t&&a(e.prototype,t),n&&a(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function i(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=g(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,a=function(){};return{s:a,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,i=!0,o=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return i=e.done,e},e:function(e){o=!0,s=e},f:function(){try{i||null==n.return||n.return()}finally{if(o)throw s}}}}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!{}.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(arguments.length<3?e:n):a.value}},o.apply(null,arguments)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function c(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&h(e,t)}function l(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(l=function(){return!!e})()}function d(){d=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,a=Object.defineProperty||function(e,t,n){e[t]=n.value},s="function"==typeof Symbol?Symbol:{},i=s.iterator||"@@iterator",o=s.asyncIterator||"@@asyncIterator",u=s.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var s=t&&t.prototype instanceof g?t:g,i=Object.create(s.prototype),o=new M(r||[]);return a(i,"_invoke",{value:T(e,n,o)}),i}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var f="suspendedStart",p="suspendedYield",v="executing",_="completed",m={};function g(){}function y(){}function E(){}var k={};c(k,i,(function(){return this}));var b=Object.getPrototypeOf,C=b&&b(b(U([])));C&&C!==n&&r.call(C,i)&&(k=C);var w=E.prototype=g.prototype=Object.create(k);function x(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function S(e,t){function n(a,s,i,o){var u=h(e[a],e,s);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==typeof l&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,i,o)}),(function(e){n("throw",e,i,o)})):t.resolve(l).then((function(e){c.value=e,i(c)}),(function(e){return n("throw",e,i,o)}))}o(u.arg)}var s;a(this,"_invoke",{value:function(e,r){function a(){return new t((function(t,a){n(e,r,t,a)}))}return s=s?s.then(a,a):a()}})}function T(t,n,r){var a=f;return function(s,i){if(a===v)throw Error("Generator is already running");if(a===_){if("throw"===s)throw i;return{value:e,done:!0}}for(r.method=s,r.arg=i;;){var o=r.delegate;if(o){var u=I(o,r);if(u){if(u===m)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(a===f)throw a=_,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);a=v;var c=h(t,n,r);if("normal"===c.type){if(a=r.done?_:p,c.arg===m)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(a=_,r.method="throw",r.arg=c.arg)}}}function I(t,n){var r=n.method,a=t.iterator[r];if(a===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,I(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),m;var s=h(a,t.iterator,n.arg);if("throw"===s.type)return n.method="throw",n.arg=s.arg,n.delegate=null,m;var i=s.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,m):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,m)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function A(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function U(t){if(t||""===t){var n=t[i];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var a=-1,s=function n(){for(;++a<t.length;)if(r.call(t,a))return n.value=t[a],n.done=!1,n;return n.value=e,n.done=!0,n};return s.next=s}}throw new TypeError(typeof t+" is not iterable")}return y.prototype=E,a(w,"constructor",{value:E,configurable:!0}),a(E,"constructor",{value:y,configurable:!0}),y.displayName=c(E,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,E):(e.__proto__=E,c(e,u,"GeneratorFunction")),e.prototype=Object.create(w),e},t.awrap=function(e){return{__await:e}},x(S.prototype),c(S.prototype,o,(function(){return this})),t.AsyncIterator=S,t.async=function(e,n,r,a,s){void 0===s&&(s=Promise);var i=new S(l(e,n,r,a),s);return t.isGeneratorFunction(n)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(w),c(w,u,"Generator"),c(w,i,(function(){return this})),c(w,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=U,M.prototype={constructor:M,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(A),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function a(r,a){return o.type="throw",o.arg=t,n.next=r,a&&(n.method="next",n.arg=e),!!a}for(var s=this.tryEntries.length-1;s>=0;--s){var i=this.tryEntries[s],o=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var u=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(u&&c){if(this.prev<i.catchLoc)return a(i.catchLoc,!0);if(this.prev<i.finallyLoc)return a(i.finallyLoc)}else if(u){if(this.prev<i.catchLoc)return a(i.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return a(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var a=this.tryEntries[n];if(a.tryLoc<=this.prev&&r.call(a,"finallyLoc")&&this.prev<a.finallyLoc){var s=a;break}}s&&("break"===e||"continue"===e)&&s.tryLoc<=t&&t<=s.finallyLoc&&(s=null);var i=s?s.completion:{};return i.type=e,i.arg=t,s?(this.method="next",this.next=s.finallyLoc,m):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),A(n),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var a=r.arg;A(n)}return a}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:U(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),m}},t}function h(e,t){return h=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},h(e,t)}function f(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,a,s,i,o=[],u=!0,c=!1;try{if(s=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=s.call(n)).done)&&(o.push(r.value),o.length!==t);u=!0);}catch(e){c=!0,a=e}finally{try{if(!u&&null!=n.return&&(i=n.return(),Object(i)!==i))return}finally{if(c)throw a}}return o}}(e,t)||g(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function p(e,t,n,r){var a=o(u(1&r?e.prototype:e),t,n);return 2&r&&"function"==typeof a?function(e){return a.apply(n,e)}:a}function v(e){return function(e){if(Array.isArray(e))return t(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||g(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function _(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t||"default");if("object"!=typeof r)return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function m(e){return m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m(e)}function g(e,n){if(e){if("string"==typeof e)return t(e,n);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?t(e,n):void 0}}function y(e){var t="function"==typeof Map?new Map:void 0;return y=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return function(e,t,n){if(l())return Reflect.construct.apply(null,arguments);var r=[null];r.push.apply(r,t);var a=new(e.bind.apply(e,r));return n&&h(a,n.prototype),a}(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),h(n,e)},y(e)}function E(e,t,n,r){return new(n||(n=Promise))((function(a,s){function i(e){try{u(r.next(e))}catch(e){s(e)}}function o(e){try{u(r.throw(e))}catch(e){s(e)}}function u(e){var t;e.done?a(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(i,o)}u((r=r.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var k,b="4.17.4",C=function(){function e(){r(this,e)}return s(e,null,[{key:"OS_VERSION",get:function(){return"undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.replace(/,/g,"."):"noAgent"}},{key:"SDK_VERSION",get:function(){return b}},{key:"SDK_MAJOR_VERSION",get:function(){return e.SDK_VERSION.split(".")[0]}},{key:"DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL",get:function(){return 100}},{key:"INTERNAL_CALL",get:function(){return"ic"}}])}();e.SendbirdErrorCode=void 0,(k=e.SendbirdErrorCode||(e.SendbirdErrorCode={}))[k.NON_AUTHORIZED=400108]="NON_AUTHORIZED",k[k.INVALID_TOKEN=400111]="INVALID_TOKEN",k[k.NOT_FOUND_IN_DATABASE=400201]="NOT_FOUND_IN_DATABASE",k[k.USER_AUTH_DEACTIVATED=400300]="USER_AUTH_DEACTIVATED",k[k.USER_AUTH_DELETED_OR_NOT_FOUND=400301]="USER_AUTH_DELETED_OR_NOT_FOUND",k[k.SESSION_TOKEN_EXPIRED=400302]="SESSION_TOKEN_EXPIRED",k[k.APPLICATION_NOT_FOUND=400304]="APPLICATION_NOT_FOUND",k[k.SESSION_KEY_EXPIRED=400309]="SESSION_KEY_EXPIRED",k[k.SESSION_REVOKED=400310]="SESSION_REVOKED",k[k.INVALID_SESSION_TYPE=400312]="INVALID_SESSION_TYPE",k[k.INVALID_AUTH_FOR_SERVICE=400313]="INVALID_AUTH_FOR_SERVICE",k[k.STAT_UPLOAD_NOT_ALLOWED=403200]="STAT_UPLOAD_NOT_ALLOWED",k[k.NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE=400940]="NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE",k[k.INTERNAL_SERVER_ERROR=500901]="INTERNAL_SERVER_ERROR",k[k.RATE_LIMIT_EXCEEDED=500910]="RATE_LIMIT_EXCEEDED",k[k.INVALID_REQUIRED_FORM_VALUE=400105]="INVALID_REQUIRED_FORM_VALUE",k[k.UNKNOWN_SERVER_ERROR=900200]="UNKNOWN_SERVER_ERROR",k[k.NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE=901500]="NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE",k[k.ERR_DUPLICATED_DATA=400202]="ERR_DUPLICATED_DATA",k[k.DEBUG_MODE_REQUIRED=7e5]="DEBUG_MODE_REQUIRED",k[k.LOST_INSTANCE=700100]="LOST_INSTANCE",k[k.CONNECTION_RENEW=700102]="CONNECTION_RENEW",k[k.INVALID_CONNECTION_STATE_TRANSITION=700200]="INVALID_CONNECTION_STATE_TRANSITION",k[k.INVALID_COMMAND=700700]="INVALID_COMMAND",k[k.XMLHTTPREQUEST_NOT_SUPPORTED=700800]="XMLHTTPREQUEST_NOT_SUPPORTED",k[k.UNKNOWN_ERROR=77e4]="UNKNOWN_ERROR",k[k.INVALID_INITIALIZATION=800100]="INVALID_INITIALIZATION",k[k.CONNECTION_REQUIRED=800101]="CONNECTION_REQUIRED",k[k.CONNECTION_CANCELED=800102]="CONNECTION_CANCELED",k[k.INVALID_PARAMETER=800110]="INVALID_PARAMETER",k[k.NOT_SUPPORTED_ERROR=800111]="NOT_SUPPORTED_ERROR",k[k.NETWORK_ERROR=800120]="NETWORK_ERROR",k[k.NETWORK_ROUTING_ERROR=800121]="NETWORK_ROUTING_ERROR",k[k.MALFORMED_DATA=800130]="MALFORMED_DATA",k[k.MALFORMED_ERROR_DATA=800140]="MALFORMED_ERROR_DATA",k[k.WRONG_CHANNEL_TYPE=800150]="WRONG_CHANNEL_TYPE",k[k.MARK_AS_READ_RATE_LIMIT_EXCEEDED=800160]="MARK_AS_READ_RATE_LIMIT_EXCEEDED",k[k.QUERY_IN_PROGRESS=800170]="QUERY_IN_PROGRESS",k[k.ACK_TIMEOUT=800180]="ACK_TIMEOUT",k[k.LOGIN_TIMEOUT=800190]="LOGIN_TIMEOUT",k[k.WEBSOCKET_CONNECTION_CLOSED=800200]="WEBSOCKET_CONNECTION_CLOSED",k[k.WEBSOCKET_CONNECTION_FAILED=800210]="WEBSOCKET_CONNECTION_FAILED",k[k.REQUEST_FAILED=800220]="REQUEST_FAILED",k[k.FILE_UPLOAD_CANCEL_FAILED=800230]="FILE_UPLOAD_CANCEL_FAILED",k[k.REQUEST_CANCELED=800240]="REQUEST_CANCELED",k[k.REQUEST_DUPLICATED=800250]="REQUEST_DUPLICATED",k[k.FILE_SIZE_LIMIT_EXCEEDED=800260]="FILE_SIZE_LIMIT_EXCEEDED",k[k.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED=800270]="ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED",k[k.SESSION_TOKEN_REQUEST_FAILED=800500]="SESSION_TOKEN_REQUEST_FAILED",k[k.SESSION_TOKEN_REFRESHED=800501]="SESSION_TOKEN_REFRESHED",k[k.SESSION_TOKEN_REFRESH_FAILED=800502]="SESSION_TOKEN_REFRESH_FAILED",k[k.COLLECTION_DISPOSED=800600]="COLLECTION_DISPOSED",k[k.DATABASE_ERROR=800700]="DATABASE_ERROR",k[k.USER_DEACTIVATED=900021]="USER_DEACTIVATED",k[k.CHANNEL_IS_FROZEN=900050]="CHANNEL_IS_FROZEN",k[k.RECEIVER_USER_DEACTIVATED=900081]="RECEIVER_USER_DEACTIVATED";var w,x,S,T,I,N,A=function(e){return!(e instanceof M&&!e.shouldThrowOutside)},M=function(t){function a(e){var t,s=e.code,i=void 0===s?0:s,o=e.message,u=void 0===o?"":o;return r(this,a),(t=n(this,a,[u])).shouldThrowOutside=!1,t._detail="",t.name="SendbirdError",t.code=i,Object.setPrototypeOf(t,a.prototype),t}return c(a,t),s(a,[{key:"detail",get:function(){return this._detail}},{key:"setDetail",value:function(e){this._detail=e}},{key:"isInvalidTokenError",get:function(){return this.code===e.SendbirdErrorCode.INVALID_TOKEN}},{key:"isSessionExpiredError",get:function(){return this.isSessionTokenExpiredError||this.isSessionKeyExpiredError}},{key:"isSessionTokenExpiredError",get:function(){return this.code===e.SendbirdErrorCode.SESSION_TOKEN_EXPIRED}},{key:"isSessionKeyExpiredError",get:function(){return this.code===e.SendbirdErrorCode.SESSION_KEY_EXPIRED}},{key:"isSessionInvalidatedError",get:function(){return this.isSessionRevokedError||this.isUserAuthDeactivedError||this.isUserAuthDeletedOrNotFoundError}},{key:"isSessionRevokedError",get:function(){return this.code===e.SendbirdErrorCode.SESSION_REVOKED}},{key:"isUserAuthDeactivedError",get:function(){return this.code===e.SendbirdErrorCode.USER_AUTH_DEACTIVATED}},{key:"isUserAuthDeletedOrNotFoundError",get:function(){return this.code===e.SendbirdErrorCode.USER_AUTH_DELETED_OR_NOT_FOUND}},{key:"isNetworkError",get:function(){return this.code===e.SendbirdErrorCode.NETWORK_ERROR||this.code===e.SendbirdErrorCode.NETWORK_ROUTING_ERROR}},{key:"throwOutside",value:function(){throw this.shouldThrowOutside=!0,this}}],[{key:"debugModeRequired",get:function(){return new a({code:e.SendbirdErrorCode.DEBUG_MODE_REQUIRED,message:"Cannot run this operation in production mode."})}},{key:"lostInstance",get:function(){return new a({code:e.SendbirdErrorCode.LOST_INSTANCE,message:"Instance ID is missing. It should belong to an instance."})}},{key:"invalidCommand",get:function(){return new a({code:e.SendbirdErrorCode.INVALID_COMMAND,message:"Cannot send invalid command."})}},{key:"unknown",get:function(){return new a({code:e.SendbirdErrorCode.UNKNOWN_ERROR,message:"Unknown error occurred."})}},{key:"connectionRenew",get:function(){return new a({code:e.SendbirdErrorCode.CONNECTION_RENEW,message:"Connection restarts."})}},{key:"invalidConnectionStateTransition",get:function(){return new a({code:e.SendbirdErrorCode.INVALID_CONNECTION_STATE_TRANSITION,message:"Invalid connection state transition."})}},{key:"xmlHttpRequestNotSupported",get:function(){return new a({code:e.SendbirdErrorCode.XMLHTTPREQUEST_NOT_SUPPORTED,message:"Cannot upload file. XMLHttpRequest is not defined in this environment."})}},{key:"connectionRequired",get:function(){return new a({code:e.SendbirdErrorCode.CONNECTION_REQUIRED,message:"Connection is required."})}},{key:"connectionCanceled",get:function(){return new a({code:e.SendbirdErrorCode.CONNECTION_CANCELED,message:"Connection is canceled."})}},{key:"invalidParameters",get:function(){return new a({code:e.SendbirdErrorCode.INVALID_PARAMETER,message:"Invalid parameters."})}},{key:"notSupportedError",get:function(){return new a({code:e.SendbirdErrorCode.NOT_SUPPORTED_ERROR,message:"Given parameters are not supported."})}},{key:"channelTypeNotSupportedError",get:function(){return new a({code:e.SendbirdErrorCode.NOT_SUPPORTED_ERROR,message:"Called method is not supported in the current channel's channel type."})}},{key:"networkError",get:function(){return new a({code:e.SendbirdErrorCode.NETWORK_ERROR,message:"There was a network error."})}},{key:"markAsReadAllRateLimitExceeded",get:function(){return new a({code:e.SendbirdErrorCode.MARK_AS_READ_RATE_LIMIT_EXCEEDED,message:"markAsRead rate limit exceeded."})}},{key:"queryInProgress",get:function(){return new a({code:e.SendbirdErrorCode.QUERY_IN_PROGRESS,message:"Query in progress."})}},{key:"noAckTimeout",get:function(){return new a({code:e.SendbirdErrorCode.ACK_TIMEOUT,message:"Command received no ack."})}},{key:"loginTimeout",get:function(){return new a({code:e.SendbirdErrorCode.LOGIN_TIMEOUT,message:"Connection timeout."})}},{key:"connectionClosed",get:function(){return new a({code:e.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,message:"Connection is closed. Please reconnect."})}},{key:"requestFailed",get:function(){return new a({code:e.SendbirdErrorCode.REQUEST_FAILED,message:"Request failed."})}},{key:"tooManyRequests",get:function(){return new a({code:e.SendbirdErrorCode.REQUEST_DUPLICATED,message:"Too many requests."})}},{key:"alreadyConnectedAsAnotherUser",get:function(){return new a({code:e.SendbirdErrorCode.REQUEST_FAILED,message:"Already logged in as a different user. Call disconnect() first."})}},{key:"fileUploadCanceled",get:function(){return new a({code:e.SendbirdErrorCode.FILE_UPLOAD_CANCEL_FAILED,message:"File upload has been canceled."})}},{key:"requestCanceled",get:function(){return new a({code:e.SendbirdErrorCode.REQUEST_CANCELED,message:"Request has been canceled."})}},{key:"sessionTokenRefreshFailed",get:function(){return new a({code:e.SendbirdErrorCode.SESSION_TOKEN_REFRESH_FAILED,message:"Failed to refresh the session key."})}},{key:"sessionTokenRequestFailed",get:function(){return new a({code:e.SendbirdErrorCode.SESSION_TOKEN_REQUEST_FAILED,message:"Failed to get the session token."})}},{key:"databaseError",get:function(){return new a({code:e.SendbirdErrorCode.DATABASE_ERROR,message:"Database error."})}},{key:"fileSizeLimitExceededError",get:function(){return new a({code:e.SendbirdErrorCode.FILE_SIZE_LIMIT_EXCEEDED,message:"File size exceeds the file size limit."})}},{key:"statLogUploadLimitExceededError",get:function(){return new a({code:e.SendbirdErrorCode.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED,message:"The upload request failed due to the retry count being exceeded."})}},{key:"malformedDataError",get:function(){return new a({code:e.SendbirdErrorCode.MALFORMED_DATA,message:"Malformed data."})}}])}(y(Error)),U=[e.SendbirdErrorCode.CONNECTION_REQUIRED,e.SendbirdErrorCode.NETWORK_ERROR,e.SendbirdErrorCode.ACK_TIMEOUT,e.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,e.SendbirdErrorCode.WEBSOCKET_CONNECTION_FAILED,e.SendbirdErrorCode.FILE_UPLOAD_CANCEL_FAILED,e.SendbirdErrorCode.REQUEST_CANCELED,e.SendbirdErrorCode.INTERNAL_SERVER_ERROR,e.SendbirdErrorCode.RATE_LIMIT_EXCEEDED,e.SendbirdErrorCode.UNKNOWN_SERVER_ERROR,e.SendbirdErrorCode.USER_DEACTIVATED,e.SendbirdErrorCode.CHANNEL_IS_FROZEN,e.SendbirdErrorCode.RECEIVER_USER_DEACTIVATED],O=[e.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,e.SendbirdErrorCode.WEBSOCKET_CONNECTION_FAILED,e.SendbirdErrorCode.CONNECTION_REQUIRED,e.SendbirdErrorCode.CHANNEL_IS_FROZEN],D=function(e,t){if(e!==t){var n=Object.assign({},e),r=Object.assign({},t);return(!n.hasOwnProperty("messageId")||!r.hasOwnProperty("messageId")||n.messageId===r.messageId)&&((!n.hasOwnProperty("reqId")||!r.hasOwnProperty("reqId")||n.reqId===r.reqId)&&(n.hasOwnProperty("messageId")&&delete n.messageId,n.hasOwnProperty("reqId")&&delete n.reqId,r.hasOwnProperty("messageId")&&delete r.messageId,r.hasOwnProperty("reqId")&&delete r.reqId,JSON.stringify(n)===JSON.stringify(r)))}return!0},R=function(e,t){return!!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&j(t))||("string"!=typeof e?"object"===m(e)?L(e,t):P(e,t):m(t)===e)},L=function(e,t){return!!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&j(t))||Object.values(e).includes(t)},P=function(e,t){return t instanceof e},F=function(e,t){return!!(arguments.length>2&&void 0!==arguments[2]&&arguments[2]&&j(t))||Array.isArray(t)&&t.every((function(t){return R(e,t)}))},q=function(e){return!!(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(e))||"number"==typeof e&&13===e.toString().length},H=function(e){return e>0&&O.indexOf(e)>=0},G=function(e){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&j(e))return!0;var t="object"===m(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(!t){if("undefined"!=typeof Blob)return e instanceof Blob;if("undefined"!=typeof File)return e instanceof File}return t},j=function(e){return null==e},V=function(){return s((function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=t.useMemberInfoInMessage,a=void 0===n||n,s=t.typingIndicatorInvalidateTime,i=void 0===s?1e4:s,o=t.typingIndicatorThrottle,u=void 0===o?1e3:o,c=t.websocketResponseTimeout,l=void 0===c?1e4:c,d=t.websocketPayloadDecompression,h=void 0===d||d,f=t.sessionTokenRefreshTimeout,p=void 0===f?60:f;r(this,e),this._useMemberInfoInMessage=!0,this._typingIndicatorInvalidateTime=1e4,this._typingIndicatorThrottle=1e3,this._websocketResponseTimeout=1e4,this._sessionTokenRefreshTimeout=60,this._useMemberInfoInMessage=a,this._typingIndicatorInvalidateTime=i,this._typingIndicatorThrottle=u,this._websocketResponseTimeout=l,this._sessionTokenRefreshTimeout=p,this.websocketPayloadDecompression=h}),[{key:"useMemberInfoInMessage",get:function(){return this._useMemberInfoInMessage},set:function(e){R("boolean",e)&&(this._useMemberInfoInMessage=e)}},{key:"typingIndicatorInvalidateTime",get:function(){return this._typingIndicatorInvalidateTime},set:function(e){R("number",e)&&(this._typingIndicatorInvalidateTime=e)}},{key:"typingIndicatorThrottle",get:function(){return this._typingIndicatorThrottle},set:function(e){R("number",e)&&e>=1e3&&e<=9e3&&(this._typingIndicatorThrottle=e)}},{key:"websocketResponseTimeout",get:function(){return this._websocketResponseTimeout},set:function(e){R("number",e)&&e>=5e3&&e<=3e4&&(this._websocketResponseTimeout=e)}},{key:"sessionTokenRefreshTimeout",get:function(){return this._sessionTokenRefreshTimeout},set:function(e){R("number",e)&&(e<60?e=60:e>1800&&(e=1800),this._sessionTokenRefreshTimeout=e)}}])}(),z={encrypt:function(e){return e},decrypt:function(e){return e}},B=function(){return s((function e(t){var n=t.store;r(this,e),this._preference=new Map,this._store=n}),[{key:"_savePreferenceKeys",value:function(){return E(this,void 0,void 0,d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._store.set({key:this._keysAddress,value:v(this._preference.keys())});case 2:case"end":return e.stop()}}),e,this)})))}},{key:"init",value:function(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return E(this,void 0,void 0,d().mark((function r(){var a,s,o,u,c,l,h,f;return d().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this._version=n,this._keysAddress=e,a="".concat(e,".metadata.version"),r.next=5,this._store.get(a);case 5:return s=r.sent,r.next=8,this._store.get(e);case 8:if(r.t1=t=r.sent,r.t0=null!==r.t1,!r.t0){r.next=12;break}r.t0=void 0!==t;case 12:if(!r.t0){r.next=16;break}r.t2=t,r.next=17;break;case 16:r.t2=[];case 17:if(o=r.t2,s&&!(s.version<this._version)){r.next=33;break}r.t3=this._version,r.next=9===r.t3?22:27;break;case 22:if(u=o.find((function(e){return e.includes("groupchannel/sync.meta")})),!u){r.next=26;break}return r.next=26,this._store.remove(u);case 26:return r.abrupt("break",29);case 27:return r.next=29,this._resetPreferenceData(o);case 29:return r.next=31,this._updatePreferenceVersionInfo(a);case 31:r.next=52;break;case 33:c=i(o),r.prev=34,c.s();case 36:if((l=c.n()).done){r.next=44;break}return h=l.value,r.next=40,this._store.get(h);case 40:(f=r.sent)&&this._preference.set(h,f);case 42:r.next=36;break;case 44:r.next=49;break;case 46:r.prev=46,r.t4=r.catch(34),c.e(r.t4);case 49:return r.prev=49,c.f(),r.finish(49);case 52:case"end":return r.stop()}}),r,this,[[34,46,49,52]])})))}},{key:"_updatePreferenceVersionInfo",value:function(e){return E(this,void 0,void 0,d().mark((function t(){return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._store.set({key:e,value:{version:this._version}});case 2:case"end":return t.stop()}}),t,this)})))}},{key:"_resetPreferenceData",value:function(e){return E(this,void 0,void 0,d().mark((function t(){return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this._preference=new Map,t.next=3,this._store.removeMany(e);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"get",value:function(e){return E(this,void 0,void 0,d().mark((function t(){return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",this._preference.get(e));case 1:case"end":return t.stop()}}),t,this)})))}},{key:"set",value:function(e,t){return E(this,void 0,void 0,d().mark((function n(){var r;return d().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=!this._preference.has(e),n.next=3,this._store.set({key:e,value:t});case 3:if(this._preference.set(e,t),!r){n.next=7;break}return n.next=7,this._savePreferenceKeys();case 7:case"end":return n.stop()}}),n,this)})))}},{key:"remove",value:function(e){return E(this,void 0,void 0,d().mark((function t(){return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this._store.remove(e);case 2:return this._preference.delete(e),t.next=5,this._savePreferenceKeys();case 5:case"end":return t.stop()}}),t,this)})))}},{key:"clear",value:function(){return E(this,void 0,void 0,d().mark((function e(){return d().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._store.removeMany(v(this._preference.keys()));case 2:return this._preference.clear(),e.next=5,this._savePreferenceKeys();case 5:case"end":return e.stop()}}),e,this)})))}}])}(),K=function(){return s((function e(t){var n=t.encryption,a=t.store,s=t.localCacheEnabled,i=t.localCacheConfig;r(this,e),this.store=a,this.preference=new B({store:a}),this.encryption=null!=n?n:z,this.localCacheEnabled=s,this.localCacheConfig=i}),[{key:"replaceStore",value:function(e){this.store=e,this.preference=new B({store:e})}}])}();e.PushTokenRegistrationState=void 0,(w=e.PushTokenRegistrationState||(e.PushTokenRegistrationState={})).SUCCESS="success",w.PENDING="pending",w.ERROR="error",e.PushTriggerOption=void 0,(x=e.PushTriggerOption||(e.PushTriggerOption={})).DEFAULT="default",x.ALL="all",x.MENTION_ONLY="mention_only",x.OFF="off",e.PushTokenType=void 0,(S=e.PushTokenType||(e.PushTokenType={})).FCM="gcm",S.APNS="apns",S.UNKNOWN="unknown",function(e){e.SESSION_TOKEN="session_token",e.ACCESS_TOKEN="access_token"}(T||(T={})),e.PushTemplate=void 0,(I=e.PushTemplate||(e.PushTemplate={})).ALTERNATIVE="alternative",I.DEFAULT="default",e.CachedDataClearOrder=void 0,(N=e.CachedDataClearOrder||(e.CachedDataClearOrder={})).CUSTOM="custom",N.MESSAGE_COLLECTION_ACCESSED_AT="messagecollection_accessed_at";var Q,W=function(){return s((function e(t){var n=t.channel,a=t.cachedMessageCount;r(this,e),this._cachedMessageCount=0,this._channel=n,this._cachedMessageCount=a}),[{key:"channel",get:function(){return this._channel}},{key:"cachedMessageCount",get:function(){return this._cachedMessageCount}}])}(),Y=function(){return s((function t(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},a=n.maxSize,s=void 0===a?256:a,i=n.clearOrder,o=void 0===i?e.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT:i,u=n.customClearOrderComparator,c=n.enableAutoResend,l=void 0===c||c;r(this,t),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(s,64),u?(this._clearOrder=o,this._customClearOrderComparator=u):this._clearOrder=e.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=l}),[{key:"maxSize",get:function(){return this._maxSize}},{key:"clearOrder",get:function(){return this._clearOrder}},{key:"clearOrderComparator",get:function(){var t;return this._clearOrder===e.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:null!==(t=this._customClearOrderComparator)&&void 0!==t?t:this._clearOrderComparatorUseMessageCollectionAccessedAt}},{key:"enableAutoResend",get:function(){return this._enableAutoResend}}])}();!function(e){e.FEED="feed",e.CHAT="chat",e.CHAT_API="chat_api"}(Q||(Q={}));var Z,X,J,$,ee,te,ne,re,ae,se,ie,oe,ue,ce=function(){return s((function e(){r(this,e),this.isRefreshing=!1}),[{key:"hasSession",get:function(){return!!this.sessionKey}},{key:"hasChatServicePermission",get:function(){var e;return!!(null===(e=this.services)||void 0===e?void 0:e.includes(Q.CHAT))}},{key:"clear",value:function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]}}])}(),le=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)}))},de=function(){return s((function e(t){var n=t.container;r(this,e),this._container={},this._container=n,this.key=le()}),[{key:"_register",value:function(e,t,n){var r;return e in this._container||(this._container[e]=new Map),null===(r=this._container[e])||void 0===r||r.set(this.key,{occurence:t,handler:n}),this}},{key:"on",value:function(e,t){return this._register(e,-1,t)}},{key:"once",value:function(e,t){return this._register(e,1,t)}},{key:"close",value: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)}))}}])}(),he=function(){return s((function e(){r(this,e),this._container={}}),[{key:"on",value:function(e,t){return new de({container:this._container}).on(e,t)}},{key:"once",value:function(e,t){return new de({container:this._container}).once(e,t)}},{key:"dispatch",value:function(e,t){var n=this._container[e];if(n){var r,a=[],s=i(n.keys());try{for(s.s();!(r=s.n()).done;){var o=r.value,u=n.get(o);u.handler(t),u.occurence>0&&(u.occurence--,0===u.occurence&&a.push(o))}}catch(e){s.e(e)}finally{s.f()}a.forEach((function(e){return n.delete(e)}))}}}])}(),fe=function(){return s((function e(){r(this,e),this._dispatcher=new he}),[{key:"on",value:function(e){return this._dispatcher.on("event",e)}},{key:"once",value:function(e){return this._dispatcher.once("event",e)}},{key:"dispatch",value:function(e){this._dispatcher.dispatch("event",e)}}])}(),pe=s((function e(){r(this,e)})),ve=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},_e=function(e){if(null!=e){if("object"===m(e)){if(Array.isArray(e)){for(var t=v(e),n=0;n<t.length;n++)t[n]=_e(t[n]);return t}return Object.keys(e).forEach((function(t){null===e[t]&&delete e[t]})),e}return e}};e.ChannelType=void 0,(Z=e.ChannelType||(e.ChannelType={})).BASE="base",Z.GROUP="group",Z.OPEN="open",Z.FEED="feed",e.Role=void 0,(X=e.Role||(e.Role={})).OPERATOR="operator",X.NONE="none",e.MutedState=void 0,(J=e.MutedState||(e.MutedState={})).MUTED="muted",J.UNMUTED="unmuted",e.MessageType=void 0,($=e.MessageType||(e.MessageType={})).BASE="base",$.USER="user",$.FILE="file",$.ADMIN="admin",e.MessageTypeFilter=void 0,(ee=e.MessageTypeFilter||(e.MessageTypeFilter={})).ALL="",ee.USER="MESG",ee.FILE="FILE",ee.ADMIN="ADMM",function(e){e.USER="MESG",e.FILE="FILE",e.ADMIN="ADMM"}(te||(te={})),e.MentionType=void 0,(ne=e.MentionType||(e.MentionType={})).USERS="users",ne.CHANNEL="channel",e.ReplyType=void 0,(re=e.ReplyType||(e.ReplyType={})).ALL="all",re.NONE="none",re.ONLY_REPLY_TO_CHANNEL="only_reply_to_channel",e.PushNotificationDeliveryOption=void 0,(ae=e.PushNotificationDeliveryOption||(e.PushNotificationDeliveryOption={})).DEFAULT="default",ae.SUPPRESS="suppress",e.SendingStatus=void 0,(se=e.SendingStatus||(e.SendingStatus={})).PENDING="pending",se.SCHEDULED="scheduled",se.SUCCEEDED="succeeded",se.FAILED="failed",se.CANCELED="canceled",e.MessageReviewStatus=void 0,(ie=e.MessageReviewStatus||(e.MessageReviewStatus={})).INREVIEW="InReview",ie.APPROVED="Approved",function(e){e.HIGH="high",e.NORMAL="normal",e.LOW="low"}(oe||(oe={})),function(e){e.CREATED_AT="created_at",e.UPDATED_AT="updated_at"}(ue||(ue={}));var me,ge="v3",ye="/".concat(ge,"/users"),Ee="/".concat(ge,"/sdk/users"),ke="/".concat(ge,"/storage/file"),be="/".concat(ge,"/group_channels"),Ce="/".concat(ge,"/sdk/group_channels"),we="/".concat(ge,"/open_channels"),xe="/".concat(ge,"/sdk/open_channels"),Se="/".concat(ge,"/search"),Te="/".concat(ge,"/report"),Ie="/".concat(ge,"/emojis"),Ne="/".concat(ge,"/emoji_categories"),Ae="/".concat(ge,"/polls"),Me="/".concat(ge,"/scheduled_messages"),Ue="/".concat(ge,"/sdk/ui_kit/configuration"),Oe="/".concat(ge,"/sdk/statistics"),De="/".concat(ge,"/sdk/notification_statistics"),Re="/".concat(ge,"/message_templates"),Le="/".concat(ge,"/sdk/push_delivery"),Pe="/".concat(ge,"/forms"),Fe="/".concat(ge,"/report_category"),qe="/".concat(ge,"/sdk/applications/settings"),He=function(t){switch(t){case e.ChannelType.FEED:case e.ChannelType.GROUP:return be;case e.ChannelType.OPEN:return we;default:return null}},Ge=function(t){switch(t){case e.ChannelType.GROUP:return"".concat(Te,"/group_channels");case e.ChannelType.OPEN:return"".concat(Te,"/open_channels");default:return null}},je=function(t,n,r){switch(t){case e.MentionType.CHANNEL:return!0;case e.MentionType.USERS:if(n){var a,s=i(n);try{for(s.s();!(a=s.n()).done;){if(a.value===r)return!0}}catch(e){s.e(e)}finally{s.f()}}}return!1},Ve=function(e,t,n){var r,a,s,i,o=je(null!==(r=e.mentionType)&&void 0!==r?r:null,null!==(a=e.mentionedUserIds)&&void 0!==a?a:[],n),u=je(null!==(s=t.mentionType)&&void 0!==s?s:null,null!==(i=t.mentionedUserIds)&&void 0!==i?i:[],n);return!o&&u?1:o&&!u?-1:0},ze=function(e,t,n){var r,a=t||new FormData;for(var s in e)if(e.hasOwnProperty(s)){var i=e[s],o=n?"".concat(n,"[").concat(s,"]"):s;G(i)?a.append(o,i,null!==(r=i.name)&&void 0!==r?r:"filename"):"object"!==m(i)||null===i||Array.isArray(i)||i instanceof Blob?a.append(o,String(i)):a=ze(i,a,o)}return a};!function(e){e.GET="GET",e.POST="POST",e.PUT="PUT",e.DELETE="DELETE"}(me||(me={}));var Be,Ke=function(e){function t(){var e;return r(this,t),(e=n(this,t,arguments)).params={},e.requireAuth=!0,e.headers={},e.requestId=le(),e}return c(t,e),s(t,[{key:"encodeParams",value:function(e){var t=this;return null==e||""===e?encodeURIComponent(""):Array.isArray(e)?e.map((function(e){return t.encodeParams(e)})).join(","):"object"===m(e)?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(String(e))}},{key:"query",get:function(){var e=this,t=ve(this.params);return"?".concat(Object.keys(t).map((function(n){return"".concat(encodeURIComponent(n),"=").concat(e.encodeParams(t[n]))})).join("&"))}},{key:"payload",get:function(){var e=ve(this.params);return Object.keys(e).some((function(t){return G(e[t])}))?ze(e):JSON.stringify(e)}},{key:"hasSessionKey",get:function(){return void 0!==this.headers["Session-Key"]}}])}(pe),Qe=function(e){function t(e,a){var s;return r(this,t),(s=n(this,t))._iid=e,s._payload=a,s}return c(t,e),s(t,[{key:"payload",get:function(){return Object.assign({},this._payload)}},{key:"as",value:function(e){return new e(this._iid,this.payload)}}])}(pe),We=function(e){function t(e){var a;return r(this,t),(a=n(this,t)).requestId=e,a}return c(t,e),s(t)}(pe),Ye=function(t){function a(t){var s,i=t.expires_in,o=t.reason,u=void 0===o?e.SendbirdErrorCode.SESSION_KEY_EXPIRED:o,c=t.message,l=void 0===c?"":c;switch(r(this,a),(s=n(this,a)).expiresIn=null!=i?i:0,u){case e.SendbirdErrorCode.SESSION_KEY_EXPIRED:case e.SendbirdErrorCode.SESSION_TOKEN_EXPIRED:case e.SendbirdErrorCode.SESSION_REVOKED:case e.SendbirdErrorCode.USER_AUTH_DEACTIVATED:case e.SendbirdErrorCode.USER_AUTH_DELETED_OR_NOT_FOUND:s.error=new M({code:u,message:l})}return s}return c(a,t),s(a,[{key:"invalidateSessionToken",get:function(){var e;return!!(null===(e=this.error)||void 0===e?void 0:e.isSessionTokenExpiredError)}}])}(pe),Ze=function(e){function t(e,a,s){var i,o,u=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"";return r(this,t),(i=n(this,t))._iid=e,i.code=a,i.payload=s,i.requestId=null!==(o=s.req_id)&&void 0!==o?o:u,i}return c(t,e),s(t,[{key:"convertToMessage",value:function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")}},{key:"as",value:function(e){return new e(this._iid,this.code,this.payload)}}],[{key:"createFromRawMessage",value:function(e,n){var r=n.substring(0,4),a={};try{a=JSON.parse(n.substring(4))}catch(e){r="NOOP"}finally{return new t(e,r,a)}}}])}(pe),Xe=function(e){function t(e){var a,s,i=e.code,o=e.ackRequired,u=e.payload,c=void 0===u?{}:u;return r(this,t),(a=n(this,t)).code=i,a.payload=c,a.requestId=null!==(s=a.payload.req_id)&&void 0!==s?s:le(),a.ackRequired=o,a.payload.req_id=a.requestId,a}return c(t,e),s(t,[{key:"convertToMessage",value:function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")}}])}(pe),Je=function(e){function t(e){var a,s=e.userId,i=e.authToken,o=e.services,u=e.expiringSession,c=void 0===u||u;return r(this,t),(a=n(this,t)).path="".concat(ye,"/").concat(s,"/session_key"),a.method=me.POST,a.params=ve({token:i,services:o,expiring_session:!!c}),a.requireAuth=!1,a}return c(t,e),s(t)}(Ke),$e=function(e){function t(e){var a=e.authToken,s=e.expiringSession,i=void 0===s||s,o=e.requestId,u=void 0===o?void 0:o;return r(this,t),n(this,t,[{code:"LOGI",payload:ve({token:a,expiring_session:i?1:0,req_id:u}),ackRequired:!0}])}return c(t,e),s(t)}(Xe),et=function(e){function t(e,a){var s;r(this,t),s=n(this,t,[e,a]);var i=a.key,o=a.expires_at,u=a.services;return s.key=i,s.expiresAt=o,s.services=u,s}return c(t,e),s(t)}(Qe),tt=function(e){function t(e,a,s){var i,o;return r(this,t),(i=n(this,t,[e,"LOGI",s])).error=null,i.newKey=null,i.newKey=null!==(o=s.new_key)&&void 0!==o?o:null,i.error=s.error?new M(s):null,i}return c(t,e),s(t)}(Ze),nt=function(e){function t(e){var a;return r(this,t),(a=n(this,t)).statLog=e,a}return c(t,e),s(t)}(pe),rt=function(e){function t(e){var a,s=e.request,i=e.deferred,o=e.error,u=void 0===o?M.requestFailed:o;return r(this,t),(a=n(this,t)).request=s,a.deferred=i,a.error=u,a}return c(t,e),s(t)}(pe);!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"}(Be||(Be={}));var at,st,it,ot,ut=function(){return s((function e(t){var n=t.type,a=t.data,s=t.ts,i=void 0===s?Date.now():s;r(this,e),this.type=n,this.createdAt=i,this.data=a}),null,[{key:"payloadify",value:function(e){return ve({stat_type:e.type,ts:e.createdAt,data:ve(e.data)})}}])}(),ct=function(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"==navigator.product},lt=function(){return!("undefined"==typeof navigator||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};e.SendbirdProduct=void 0,(st=e.SendbirdProduct||(e.SendbirdProduct={})).CHAT="chat",st.CALLS="calls",st.DESK="desk",st.LIVE="live",st.UIKIT_CHAT="uikit-chat",st.UIKIT_LIVE="uikit-live",e.SendbirdPlatform=void 0,(it=e.SendbirdPlatform||(e.SendbirdPlatform={})).ANDROID="android",it.IOS="ios",it.JS="js",it.UNREAL="unreal",it.UNITY="unity",it.REACT_NATIVE="react-native",it.FLUTTER="flutter",e.DeviceOsPlatform=void 0,(ot=e.DeviceOsPlatform||(e.DeviceOsPlatform={})).ANDROID="android",ot.IOS="ios",ot.WEB="web",ot.MOBILE_WEB="mobile_web",ot.WINDOWS="windows";var dt=s((function e(){r(this,e)}));at=dt,dt._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""},dt.sendbirdSdkUserAgentWithExtension=function(t){var n=ct()?e.SendbirdPlatform.REACT_NATIVE:e.SendbirdPlatform.JS,r={main_sdk_info:"chat/".concat(n,"/").concat(C.SDK_VERSION),device_os_platform:lt()?"mobile-web":"web",os_version:C.OS_VERSION};if(t){var a=t.sendbirdExtensions,s=t.deviceOS,i=t.customData,o=void 0===i?{}:i;s.version&&(r.os_version=s.version),s.platform&&(r.device_os_platform=s.platform),a.length>0&&(r.extension_sdk_info=a.map((function(e){var t=e.product,n=e.platform,r=e.version;return"".concat(t,"/").concat(n,"/").concat(r)})).join(",")),Object.keys(r).forEach((function(e){return delete o[e]})),Object.keys(o).length>0&&(r=Object.assign(Object.assign({},r),o))}var u=at._getFrameWork();return u&&(r.javascript_framework=u),Object.entries(r).map((function(e){var t=f(e,2),n=t[0],r=t[1];return"".concat(n,"=").concat(r)})).join("&")},dt.userAgentWithExtension=function(e){var t=ct()?"reactnative":"JS",n=e.sb_syncmanager?"s".concat(e.sb_syncmanager):"",r=e.sb_uikit?"u".concat(e.sb_uikit):"",a=e["device-os-platform"]?"o".concat(e["device-os-platform"]):lt()?"omobile-web":"oweb";return"".concat(t,"/c").concat(C.SDK_VERSION,"/").concat(n,"/").concat(r,"/").concat(a)};var ht=s((function e(){var t=this;r(this,e),this.promise=new Promise((function(e,n){t.resolve=e,t.reject=function(e){n(e)}}))})),ft=function(e){function t(e){var a;return r(this,t),(a=n(this,t)).requestId=e.requestId,a}return c(t,e),s(t)}(pe),pt=function(e){function t(e){var a;return r(this,t),(a=n(this,t)).method=me.DELETE,a.path="".concat(He(e.channelType),"/").concat(e.channelUrl,"/messages/").concat(e.messageId),e.messageToken&&(a.params=ve({mesg_token:e.messageToken})),a}return c(t,e),s(t)}(Ke),vt=function(e){function t(e,a,s){var i,o;return r(this,t),(i=n(this,t,[e,"DELM",s])).channelUrl=s.channel_url,i.channelType=s.channel_type,i.messageId=Number(s.msg_id),i.silent=s.silent,i.messageCreatedAt=s.message_created_at?Number(s.message_created_at):-1,i.senderId=null!==(o=s.sender_id)&&void 0!==o?o:void 0,i}return c(t,e),s(t)}(Ze),_t=function(){return s((function e(t,n){var a=this,s=n.session,i=n.sdkState,o=n.dispatcher,u=n.logger,c=n.useFetchCompat,l=void 0!==c&&c;r(this,e),this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=t,this._session=s,this._sdkState=i,this._dispatcher=o,this._dispatcher.on((function(e){e instanceof We&&a.cancel(e.requestId)})),this._logger=u,this._shouldImportFetchCompat=l}),[{key:"_createHeader",value:function(e,t){var n=this._sdkState,r=n.appId,a=n.appVersion,s=n.sendbirdRuntimeEnvironment,i=Object.assign(Object.assign({},e.headers),{SendBird:"JS,".concat(C.OS_VERSION,",").concat(C.SDK_VERSION,",").concat(r).concat(a?",".concat(a):""),"SB-User-Agent":dt.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":dt.sendbirdSdkUserAgentWithExtension(s)});return t||(i["Content-Type"]="application/json; charset=utf-8"),e.requireAuth&&!e.hasSessionKey&&this._session.hasSession&&(i["Session-Key"]=this._session.sessionKey),i["App-Id"]=r,this._session&&this._session.authToken&&(i["Access-Token"]=this._session.authToken),i}},{key:"_statLogApiResult",value:function(e,t,n){e.path.includes("/sdk/statistics")||this._dispatcher.dispatch(new nt(new ut({type:Be.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}})))}},{key:"_isBodyRequired",value:function(e){var t=e.method;return t!==me.GET&&(t!==me.DELETE||e instanceof pt)}},{key:"send",value:function(t){return E(this,void 0,void 0,d().mark((function n(){var r,a,s,i,o,u,c,l,h,f,p,v,_,m,g,y,E,k;return d().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.path,a=t.method,s=t.uploadProgressHandler,i=this._isBodyRequired(t),o=this._sdkState.api,u="".concat(o.host).concat(r).concat(i?"":t.query),c=i?t.payload:null,l=this._createHeader(t,c instanceof FormData?c:void 0),h=new AbortController,f=h.signal,this._abortControl.set(t.requestId,h),p=Date.now(),n.prev=10,!s){n.next=32;break}return n.next=14,Promise.resolve().then((function(){return Zm}));case 14:return v=n.sent,_=v.xmlHttpRequest,n.prev=16,n.next=19,_(this._iid,{requestId:t.requestId,method:t.method,url:u,headers:l,data:null!=c?c:void 0,uploadProgressHandler:s});case 19:return m=n.sent,this._logger.debug("receive api response",t.requestId),this._statLogApiResult(t,p),n.abrupt("return",m);case 25:if(n.prev=25,n.t0=n.catch(16),!(n.t0 instanceof M&&n.t0.code===e.SendbirdErrorCode.XMLHTTPREQUEST_NOT_SUPPORTED)){n.next=31;break}this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored."),n.next=32;break;case 31:throw n.t0;case 32:if(this._shouldImportFetchCompat&&(this._shouldImportFetchCompat=!1,("undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{fetch:null}).fetch=null),"undefined"!=typeof AbortController){n.next=36;break}return n.next=36,Promise.resolve().then((function(){return Xm}));case 36:if("function"==typeof fetch){n.next=39;break}return n.next=39,Promise.resolve().then((function(){return Cg}));case 39:return n.next=41,fetch(u,{method:a,body:c,headers:l,signal:f});case 41:return g=n.sent,n.next=44,g.json();case 44:if(y=n.sent,!g.ok&&!g.redirected){n.next=51;break}return this._logger.debug("receive api response",t.requestId),this._statLogApiResult(t,p),n.abrupt("return",new Qe(this._iid,y));case 51:if(!y){n.next=70;break}if(!(E=new M(y)).isSessionExpiredError){n.next=62;break}if(this._dispatcher.dispatch(new Ye({reason:E.code,message:E.message})),t instanceof Je){n.next=59;break}return k=new ht,this._dispatcher.dispatch(new rt({request:t,deferred:k,error:E})),n.abrupt("return",k.promise);case 59:case 67:throw E;case 62:if(!E.isSessionInvalidatedError){n.next=67;break}throw this._dispatcher.dispatch(new Ye({reason:E.code,message:E.message})),E;case 68:n.next=71;break;case 70:throw M.requestFailed;case 71:n.n