1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7366],{25098:function(e,t,n){let i,r,o;n.d(t,{$:function(){return r$},A:function(){return eH},B:function(){return ts},C:function(){return es},D:function(){return g},E:function(){return eT},F:function(){return rV},G:function(){return sv},H:function(){return sb},I:function(){return rH},J:function(){return rt},K:function(){return rd},L:function(){return er},M:function(){return rr},N:function(){return re},O:function(){return rs},P:function(){return S},Q:function(){return rK},R:function(){return rB},S:function(){return K},T:function(){return rg},U:function(){return rj},V:function(){return oG},W:function(){return th},X:function(){return rW},Y:function(){return rN},Z:function(){return tl},_:function(){return d},a:function(){return L},a$:function(){return q},a0:function(){return tN},a1:function(){return I},a2:function(){return P},a3:function(){return en},a4:function(){return T},a5:function(){return U},a6:function(){return tT},a7:function(){return ob},a8:function(){return C},a9:function(){return N},aA:function(){return el},aB:function(){return eg},aC:function(){return ef},aD:function(){return tn},aE:function(){return tD},aF:function(){return r3},aG:function(){return tI},aH:function(){return e_},aI:function(){return ej},aJ:function(){return tL},aK:function(){return o9},aL:function(){return tt},aM:function(){return eZ},aN:function(){return ti},aO:function(){return eh},aP:function(){return o4},aQ:function(){return eJ},aR:function(){return o7},aS:function(){return rS},aT:function(){return V},aU:function(){return tO},aV:function(){return o1},aW:function(){return sp},aX:function(){return o8},aY:function(){return B},aZ:function(){return h},a_:function(){return M},ab:function(){return oU},ac:function(){return ei},ae:function(){return b},af:function(){return rh},ah:function(){return oP},ai:function(){return ea},ak:function(){return rl},am:function(){return ty},an:function(){return tb},ao:function(){return ez},ap:function(){return rA},aq:function(){return R},ar:function(){return eu},as:function(){return rF},at:function(){return ed},au:function(){return td},av:function(){return te},aw:function(){return o6},ax:function(){return oQ},ay:function(){return ep},az:function(){return H},b:function(){return _},b0:function(){return oY},b1:function(){return oX},b2:function(){return oZ},b3:function(){return o0},b4:function(){return o$},b5:function(){return oJ},b6:function(){return oW},b7:function(){return e4},b8:function(){return ev},b9:function(){return eW},bA:function(){return eQ},bB:function(){return eB},bG:function(){return t_},bH:function(){return tv},ba:function(){return oz},bc:function(){return sc},bd:function(){return su},be:function(){return sd},bf:function(){return s_},bg:function(){return sl},bh:function(){return sh},bk:function(){return eS},bl:function(){return z},bm:function(){return eK},bn:function(){return e$},bo:function(){return F},bp:function(){return ra},bq:function(){return ec},br:function(){return tk},bs:function(){return o2},bt:function(){return oB},bu:function(){return r5},bv:function(){return oC},bw:function(){return e7},bx:function(){return e9},bz:function(){return o3},c:function(){return u},d:function(){return l},e:function(){return e8},f:function(){return ew},g:function(){return eN},h:function(){return ta},i:function(){return G},j:function(){return tc},k:function(){return eV},l:function(){return eX},m:function(){return eY},n:function(){return e0},o:function(){return e5},p:function(){return tS},q:function(){return E},r:function(){return p},s:function(){return i9},t:function(){return D},u:function(){return ey},v:function(){return v},w:function(){return f},x:function(){return w},y:function(){return tg},z:function(){return tC}});var s,a=n(48764).lW,c=function(e,t){return(c=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)};function u(e,t){if("function"!=typeof t&&null!==t)throw TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}c(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var l=function(){return(l=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}).apply(this,arguments)};function h(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var r=0;for(i=Object.getOwnPropertySymbols(e);r<i.length;r++)0>t.indexOf(i[r])&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]])}return n}
1function d(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((i=i.apply(e,t||[])).next())})}function _(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)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 o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===a[0]||2===a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}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 f(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 TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var i,r,o=n.call(e),s=[];try{for(;(void 0===t||t-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}return s}function E(e,t,n){if(n||2==arguments.length)for(var i,r=0,o=t.length;r<o;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 g,v="4.22.0",m=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 v},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}();(y=g||(g={}))[y.NON_AUTHORIZED=400108]="NON_AUTHORIZED",y[y.INVALID_TOKEN=400111]="INVALID_TOKEN",y[y.NOT_FOUND_IN_DATABASE=400201]="NOT_FOUND_IN_DATABASE",y[y.USER_AUTH_DEACTIVATED=400300]="USER_AUTH_DEACTIVATED",y[y.USER_AUTH_DELETED_OR_NOT_FOUND=400301]="USER_AUTH_DELETED_OR_NOT_FOUND",y[y.SESSION_TOKEN_EXPIRED=400302]="SESSION_TOKEN_EXPIRED",y[y.APPLICATION_NOT_FOUND=400304]="APPLICATION_NOT_FOUND",y[y.SESSION_KEY_EXPIRED=400309]="SESSION_KEY_EXPIRED",y[y.SESSION_REVOKED=400310]="SESSION_REVOKED",y[y.INVALID_SESSION_TYPE=400312]="INVALID_SESSION_TYPE",y[y.INVALID_AUTH_FOR_SERVICE=400313]="INVALID_AUTH_FOR_SERVICE",y[y.STAT_UPLOAD_NOT_ALLOWED=403200]="STAT_UPLOAD_NOT_ALLOWED",y[y.NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE=400940]="NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE",y[y.INTERNAL_SERVER_ERROR=500901]="INTERNAL_SERVER_ERROR",y[y.RATE_LIMIT_EXCEEDED=500910]="RATE_LIMIT_EXCEEDED",y[y.INVALID_REQUIRED_FORM_VALUE=400105]="INVALID_REQUIRED_FORM_VALUE",y[y.UNKNOWN_SERVER_ERROR=900200]="UNKNOWN_SERVER_ERROR",y[y.NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE=901500]="NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE",y[y.ERR_DUPLICATED_DATA=400202]="ERR_DUPLICATED_DATA",y[y.DEBUG_MODE_REQUIRED=7e5]="DEBUG_MODE_REQUIRED",y[y.LOST_INSTANCE=700100]="LOST_INSTANCE",y[y.CONNECTION_RENEW=700102]="CONNECTION_RENEW",y[y.INVALID_CONNECTION_STATE_TRANSITION=700200]="INVALID_CONNECTION_STATE_TRANSITION",y[y.INVALID_COMMAND=700700]="INVALID_COMMAND",y[y.XMLHTTPREQUEST_NOT_SUPPORTED=700800]="XMLHTTPREQUEST_NOT_SUPPORTED",y[y.UNKNOWN_ERROR=77e4]="UNKNOWN_ERROR",y[y.INVALID_INITIALIZATION=800100]="INVALID_INITIALIZATION",y[y.CONNECTION_REQUIRED=800101]="CONNECTION_REQUIRED",y[y.CONNECTION_CANCELED=800102]="CONNECTION_CANCELED",y[y.INVALID_PARAMETER=800110]="INVALID_PARAMETER",y[y.NOT_SUPPORTED_ERROR=800111]="NOT_SUPPORTED_ERROR",y[y.NETWORK_E
1RROR=800120]="NETWORK_ERROR",y[y.NETWORK_ROUTING_ERROR=800121]="NETWORK_ROUTING_ERROR",y[y.MALFORMED_DATA=800130]="MALFORMED_DATA",y[y.MALFORMED_ERROR_DATA=800140]="MALFORMED_ERROR_DATA",y[y.WRONG_CHANNEL_TYPE=800150]="WRONG_CHANNEL_TYPE",y[y.MARK_AS_READ_RATE_LIMIT_EXCEEDED=800160]="MARK_AS_READ_RATE_LIMIT_EXCEEDED",y[y.QUERY_IN_PROGRESS=800170]="QUERY_IN_PROGRESS",y[y.ACK_TIMEOUT=800180]="ACK_TIMEOUT",y[y.LOGIN_TIMEOUT=800190]="LOGIN_TIMEOUT",y[y.WEBSOCKET_CONNECTION_CLOSED=800200]="WEBSOCKET_CONNECTION_CLOSED",y[y.WEBSOCKET_CONNECTION_FAILED=800210]="WEBSOCKET_CONNECTION_FAILED",y[y.REQUEST_FAILED=800220]="REQUEST_FAILED",y[y.DELAYED_CONNECTING=800221]="DELAYED_CONNECTING",y[y.FILE_UPLOAD_CANCEL_FAILED=800230]="FILE_UPLOAD_CANCEL_FAILED",y[y.REQUEST_CANCELED=800240]="REQUEST_CANCELED",y[y.REQUEST_DUPLICATED=800250]="REQUEST_DUPLICATED",y[y.FILE_SIZE_LIMIT_EXCEEDED=800260]="FILE_SIZE_LIMIT_EXCEEDED",y[y.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED=800270]="ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED",y[y.SESSION_TOKEN_REQUEST_FAILED=800500]="SESSION_TOKEN_REQUEST_FAILED",y[y.SESSION_TOKEN_REFRESHED=800501]="SESSION_TOKEN_REFRESHED",y[y.SESSION_TOKEN_REFRESH_FAILED=800502]="SESSION_TOKEN_REFRESH_FAILED",y[y.COLLECTION_DISPOSED=800600]="COLLECTION_DISPOSED",y[y.DATABASE_ERROR=800700]="DATABASE_ERROR",y[y.USER_DEACTIVATED=900021]="USER_DEACTIVATED",y[y.CHANNEL_IS_FROZEN=900050]="CHANNEL_IS_FROZEN",y[y.RECEIVER_USER_DEACTIVATED=900081]="RECEIVER_USER_DEACTIVATED";var y,b,T,C,S,w,N,A,I=function(e){return!(e instanceof D&&!e.shouldThrowOutside)},D=function(e){function t(n){var i=n.code,r=n.message,o=e.call(this,void 0===r?"":r)||this;return o.shouldThrowOutside=!1,o._detail="",o.name="SendbirdError",o.code=void 0===i?0:i,Object.setPrototypeOf(o,t.prototype),o}return u(t,e),Object.defineProperty(t.prototype,"detail",{get:function(){return this._detail},enumerable:!1,configurable:!0}),t.prototype.setDetail=function(e){this._detail=e},Object.defineProperty(t.prototype,"isInvalidTokenError",{get:function(){return this.code===g.INVALID_TOKEN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionExpiredError",{get:function(){return this.isSessionTokenExpiredError||this.isSessionKeyExpiredError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionTokenExpiredError",{get:function(){return this.code===g.SESSION_TOKEN_EXPIRED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionKeyExpiredError",{get:function(){return this.code===g.SESSION_KEY_EXPIRED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionInvalidatedError",{get:function(){return this.isSessionRevokedError||this.isUserAuthDeactivedError||this.isUserAuthDeletedOrNotFoundError},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionRevokedError",{get:function(){return this.code===g.SESSION_REVOKED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUserAuthDeactivedError",{get:function(){return this.code===g.USER_AUTH_DEACTIVATED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isUserAuthDeletedOrNotFoundError",{get:function(){return this.code===g.USER_AUTH_DELETED_OR_NOT_FOUND},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isNetworkError",{get:function(){return this.code===g.NETWORK_ERROR||this.code===g.NETWORK_ROUTING_ERROR},enumerable:!1,configurable:!0}),Object.defineProperty(t,"debugModeRequired",{get:function(){return new t({code:g.DEBUG_MODE_REQUIRED,message:"Cannot run this operation in production mode."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"lostInstance",{get:function(){return new t({code:g.LOST_INSTANCE,message:"Instance ID is missing. It should belong to an instance."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"invalidCommand",{get:function(){return new t({code:g.INVALID_COMMAND,message:"Cannot send invalid command."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"unknown",{get:function(){return new t({code:g.UNKNOWN_ERROR,message:"Unknown error occurred."})}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t,"connectionRenew",{get:function(){return new t({code:g.CONNECTION_RENEW,message:"Connection restarts."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"invalidConnectionStateTransition",{get:function(){return new t({code:g.INVALID_CONNECTION_STATE_TRANSITION,message:"Invalid connection state transition."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"xmlHttpRequestNotSupported",{get:function(){return new t({code:g.XMLHTTPREQUEST_NOT_SUPPORTED,message:"Cannot upload file. XMLHttpRequest is not defined in this environment."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"connectionRequired",{get:function(){return new t({code:g.CONNECTION_REQUIRED,message:"Connection is required."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"connectionCanceled",{get:function(){return new t({code:g.CONNECTION_CANCELED,message:"Connection is canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"invalidParameters",{get:function(){return new t({code:g.INVALID_PARAMETER,message:"Invalid parameters."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"notSupportedError",{get:function(){return new t({code:g.NOT_SUPPORTED_ERROR,message:"Given parameters are not supported."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"channelTypeNotSupportedError",{get:function(){return new t({code:g.NOT_SUPPORTED_ERROR,message:"Called method is not supported in the current channel's channel type."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"legacyChatbotFeatureNotSupported",{get:function(){return new t({code:g.NOT_SUPPORTED_ERROR,message:"This is a legacy chatbot feature that is no longer supported. Use AI Agent instead."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"networkError",{get:function(){return new t({code:g.NETWORK_ERROR,message:"There was a network error."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"markAsReadAllRateLimitExceeded",{get:function(){return new t({code:g.MARK_AS_READ_RATE_LIMIT_EXCEEDED,message:"markAsRead rate limit exceeded."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"queryInProgress",{get:function(){return new t({code:g.QUERY_IN_PROGRESS,message:"Query in progress."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"noAckTimeout",{get:function(){return new t({code:g.ACK_TIMEOUT,message:"Command received no ack."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"loginTimeout",{get:function(){return new t({code:g.LOGIN_TIMEOUT,message:"Connection timeout."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"connectionClosed",{get:function(){return new t({code:g.WEBSOCKET_CONNECTION_CLOSED,message:"Connection is closed. Please reconnect."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"requestFailed",{get:function(){return new t({code:g.REQUEST_FAILED,message:"Request failed."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"tooManyRequests",{get:function(){return new t({code:g.REQUEST_DUPLICATED,message:"Too many requests."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"alreadyConnectedAsAnotherUser",{get:function(){return new t({code:g.REQUEST_FAILED,message:"Already logged in as a different user. Call disconnect() first."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fileUploadCanceled",{get:function(){return new t({code:g.FILE_UPLOAD_CANCEL_FAILED,message:"File upload has been canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"requestCanceled",{get:function(){return new t({code:g.REQUEST_CANCELED,message:"Request has been canceled."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"sessionTokenRefreshFailed",{get:function(){return new t({code:g.SESSION_TOKEN_REFRESH_FAILED,message:"Failed to refresh the session key."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"sessionTokenRequestFailed",{get:function(){return new t({code:g.SESSION_TOKEN_REQUEST_FAILED,message:"Failed to get the session token."})}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t,"databaseError",{get:function(){return new t({code:g.DATABASE_ERROR,message:"Database error."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"fileSizeLimitExceededError",{get:function(){return new t({code:g.FILE_SIZE_LIMIT_EXCEEDED,message:"File size exceeds the file size limit."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"statLogUploadLimitExceededError",{get:function(){return new t({code:g.ERR_UPLOAD_STAT_RETRY_COUNT_EXCEEDED,message:"The upload request failed due to the retry count being exceeded."})},enumerable:!1,configurable:!0}),Object.defineProperty(t,"malformedDataError",{get:function(){return new t({code:g.MALFORMED_DATA,message:"Malformed data."})},enumerable:!1,configurable:!0}),t.prototype.throwOutside=function(){throw this.shouldThrowOutside=!0,this},t}(Error),O=[g.CONNECTION_REQUIRED,g.NETWORK_ERROR,g.ACK_TIMEOUT,g.WEBSOCKET_CONNECTION_CLOSED,g.WEBSOCKET_CONNECTION_FAILED,g.FILE_UPLOAD_CANCEL_FAILED,g.REQUEST_CANCELED,g.INTERNAL_SERVER_ERROR,g.RATE_LIMIT_EXCEEDED,g.UNKNOWN_SERVER_ERROR,g.USER_DEACTIVATED,g.CHANNEL_IS_FROZEN,g.RECEIVER_USER_DEACTIVATED],k=[g.WEBSOCKET_CONNECTION_CLOSED,g.WEBSOCKET_CONNECTION_FAILED,g.CONNECTION_REQUIRED],R=function(e,t){if(e!==t){var n=l({},e),i=l({},t);return(!n.hasOwnProperty("messageId")||!i.hasOwnProperty("messageId")||n.messageId===i.messageId)&&(!n.hasOwnProperty("reqId")||!i.hasOwnProperty("reqId")||n.reqId===i.reqId)&&(n.hasOwnProperty("messageId")&&delete n.messageId,n.hasOwnProperty("reqId")&&delete n.reqId,i.hasOwnProperty("messageId")&&delete i.messageId,i.hasOwnProperty("reqId")&&delete i.reqId,JSON.stringify(n)===JSON.stringify(i))}return!0},L=function(e,t,n){return void 0===n&&(n=!1),!(!n||!j(t))||("string"!=typeof e?"object"==typeof e?U(e,t):x(e,t):typeof t===e)},U=function(e,t,n){return void 0===n&&(n=!1),!(!n||!j(t))||Object.values(e).includes(t)},x=function(e,t){return t instanceof e},P=function(e,t,n){return void 0===n&&(n=!1),!(!n||!j(t))||Array.isArray(t)&&t.every(function(t){return L(e,t)})},M=function(e,t){return void 0===t&&(t=!1),!(!t||!j(e))||"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=23},q=function(e,t){return void 0===t&&(t=!1),!(!t||!j(e))||"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=59},F=function(e,t){return void 0===t&&(t=!1),!(!t||!j(e))||"number"==typeof e&&13===e.toString().length},H=function(e){return e>0&&O.indexOf(e)>=0},V=function(e){return e>0&&k.indexOf(e)>=0},G=function(e,t){if(void 0===t&&(t=!1),t&&j(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},z=function(e,t){if(e===t)return!0;if(null==e||null==t||e.length!==t.length)return!1;for(var n=E([],p(e),!1).sort(),i=E([],p(t),!1).sort(),r=0;r<n.length;++r)if(n[r]!==i[r])return!1;return!0},j=function(e){return null==e},K=function(){function e(e){var t=void 0===e?{}:e,n=t.useMemberInfoInMessage,i=t.typingIndicatorInvalidateTime,r=t.typingIndicatorThrottle,o=t.websocketResponseTimeout,s=t.websocketPayloadDecompression,a=t.sessionTokenRefreshTimeout;this._useMemberInfoInMessage=!0,this._typingIndicatorInvalidateTime=1e4,this._typingIndicatorThrottle=1e3,this._websocketResponseTimeout=1e4,this._sessionTokenRefreshTimeout=60,this._useMemberInfoInMessage=void 0===n||n,this._typingIndicatorInvalidateTime=void 0===i?1e4:i,this._typingIndicatorThrottle=void 0===r?1e3:r,this._websocketResponseTimeout=void 0===o?1e4:o,this._sessionTokenRefreshTimeout=void 0===a?60:a,this.websocketPayloadDecompression=void 0===s||s}return Object.defineProperty(e.prototype,"useMemberInfoInMessage",{get:function(){return this._useMemberInfoInMessage},set:function(e){L("boolean",e)&&(this._useMemberInfoInMessage=e)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"typingIndicatorInvalidateTime",{get:function(){return this._typingIndicatorInvalidateTime},set:function(e){L("number",e)&&(this._typingIndicatorInvalidateTime=e)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"typingIndicatorThrottle",{get:function(){return this._typingIndicatorThrottle},set:function(e){L("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){L("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){L("number",e)&&(e<60?e=60:e>1800&&(e=1800),this._sessionTokenRefreshTimeout=e)},enumerable:!1,configurable:!0}),e}(),B={encrypt:function(e){return e},decrypt:function(e){return e}},Q=function(){function e(e){var t=e.store;this._preference=new Map,this._store=t}return e.prototype._savePreferenceKeys=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,this._store.set({key:this._keysAddress,value:E([],p(this._preference.keys()),!1)})];case 1:return e.sent(),[2]}})})},e.prototype.init=function(e,t){var n;return void 0===t&&(t=1),d(this,void 0,void 0,function(){var i,r,o,s,a,c,u,l,h,d;return _(this,function(_){switch(_.label){case 0:return this._version=t,this._keysAddress=e,i="".concat(e,".metadata.version"),[4,this._store.get(i)];case 1:return r=_.sent(),[4,this._store.get(e)];case 2:return o=null!==(n=_.sent())&&void 0!==n?n:[],!r||r.version<this._version?9===this._version?[3,3]:[3,6]:[3,10];case 3:return(s=o.find(function(e){return e.includes("groupchannel/sync.meta")}))?[4,this._store.remove(s)]:[3,5];case 4:_.sent(),_.label=5;case 5:return[3,8];case 6:return[4,this._resetPreferenceData(o)];case 7:_.sent(),_.label=8;case 8:return[4,this._updatePreferenceVersionInfo(i)];case 9:return _.sent(),[3,17];case 10:_.trys.push([10,15,16,17]),c=(a=f(o)).next(),_.label=11;case 11:return c.done?[3,14]:(u=c.value,[4,this._store.get(u)]);case 12:(l=_.sent())&&this._preference.set(u,l),_.label=13;case 13:return c=a.next(),[3,11];case 14:return[3,17];case 15:return h={error:_.sent()},[3,17];case 16:try{c&&!c.done&&(d=a.return)&&d.call(a)}finally{if(h)throw h.error}return[7];case 17:return[2]}})})},e.prototype._updatePreferenceVersionInfo=function(e){return d(this,void 0,void 0,function(){return _(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 d(this,void 0,void 0,function(){return _(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 d(this,void 0,void 0,function(){return _(this,function(t){return[2,this._preference.get(e)]})})},e.prototype.set=function(e,t){return d(this,void 0,void 0,function(){var n;return _(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 d(this,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return[4,this._store.remove(e)
1];case 1:return t.sent(),this._preference.delete(e),[4,this._savePreferenceKeys()];case 2:return t.sent(),[2]}})})},e.prototype.clear=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,this._store.removeMany(E([],p(this._preference.keys()),!1))];case 1:return e.sent(),this._preference.clear(),[4,this._savePreferenceKeys()];case 2:return e.sent(),[2]}})})},e}(),W=function(){function e(e){var t=e.encryption,n=e.store,i=e.localCacheEnabled,r=e.localCacheConfig;this.store=n,this.preference=new Q({store:n}),this.encryption=null!=t?t:B,this.localCacheEnabled=i,this.localCacheConfig=r}return e.prototype.replaceStore=function(e){this.store=e,this.preference=new Q({store:e})},e}();(Z=b||(b={})).SUNDAY="sunday",Z.MONDAY="monday",Z.TUESDAY="tuesday",Z.WEDNESDAY="wednesday",Z.THURSDAY="thursday",Z.FRIDAY="friday",Z.SATURDAY="saturday",(Y=T||(T={})).SUCCESS="success",Y.PENDING="pending",Y.ERROR="error",(X=C||(C={})).DEFAULT="default",X.ALL="all",X.MENTION_ONLY="mention_only",X.OFF="off",(J=S||(S={})).FCM="gcm",J.APNS="apns",J.UNKNOWN="unknown",($=w||(w={})).SESSION_TOKEN="session_token",$.ACCESS_TOKEN="access_token",(ee=N||(N={})).ALTERNATIVE="alternative",ee.DEFAULT="default",(et=A||(A={})).CUSTOM="custom",et.MESSAGE_COLLECTION_ACCESSED_AT="messagecollection_accessed_at";var Z,Y,X,J,$,ee,et,en,ei=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}(),er=function(){function e(e){var t=void 0===e?{}:e,n=t.maxSize,i=t.clearOrder,r=void 0===i?A.MESSAGE_COLLECTION_ACCESSED_AT:i,o=t.customClearOrderComparator,s=t.enableAutoResend,a=t.enableRestoreDB;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(void 0===n?256:n,64),o?(this._clearOrder=r,this._customClearOrderComparator=o):this._clearOrder=A.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=void 0===s||s,this._enableRestoreDB=void 0!==a&&a}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,"enableRestoreDB",{get:function(){return this._enableRestoreDB},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"clearOrderComparator",{get:function(){var e;return this._clearOrder===A.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}();(eo=en||(en={})).FEED="feed",eo.CHAT="chat",eo.CHAT_API="chat_api";var eo,es,ea,ec,eu,el,eh,ed,e_,ef,ep,eE,eg,ev,em=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(en.CHAT))},enumerable:!1,configurable:!0}),e.prototype.clear=function(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]},e}(),ey=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)})},eb=function(){function e(e){var t=e.container;this._container={},this._container=t,this.key=ey()}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}(),eT=function(){function e(){this._container={}}return e.prototype.on=function(e,t){return new eb({container:this._container}).on(e,t)},e.prototype.once=function(e,t){return new eb({container:this._container}).once(e,t)},e.prototype.dispatch=function(e,t){var n,i,r=this._container[e];if(r){var o=[];try{for(var s=f(r.keys()),a=s.next();!a.done;a=s.next()){var c=a.value,u=r.get(c);u.handler(t),u.occurence>0&&(u.occurence--,0===u.occurence&&o.push(c))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=s.return)&&i.call(s)}finally{if(n)throw n.error}}
1o.forEach(function(e){return r.delete(e)})}},e}(),eC=function(){function e(){this._dispatcher=new eT}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}(),eS=function(){},ew=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},eN=function(e){if(null!=e){if("object"==typeof e){if(Array.isArray(e)){for(var t=E([],p(e),!1),n=0;n<t.length;n++)t[n]=eN(t[n]);return t}return Object.keys(e).forEach(function(t){null===e[t]&&delete e[t]}),e}return e}};(eA=es||(es={})).BASE="base",eA.GROUP="group",eA.OPEN="open",eA.FEED="feed",(eI=ea||(ea={})).OPERATOR="operator",eI.NONE="none",(eD=ec||(ec={})).MUTED="muted",eD.UNMUTED="unmuted",(eO=eu||(eu={})).BASE="base",eO.USER="user",eO.FILE="file",eO.ADMIN="admin",(ek=el||(el={})).ALL="",ek.USER="MESG",ek.FILE="FILE",ek.ADMIN="ADMM",(eR=eh||(eh={})).USER="MESG",eR.FILE="FILE",eR.ADMIN="ADMM",(eL=ed||(ed={})).USERS="users",eL.CHANNEL="channel",(eU=e_||(e_={})).ALL="all",eU.NONE="none",eU.ONLY_REPLY_TO_CHANNEL="only_reply_to_channel",(ex=ef||(ef={})).DEFAULT="default",ex.SUPPRESS="suppress",(eP=ep||(ep={})).PENDING="pending",eP.SCHEDULED="scheduled",eP.SUCCEEDED="succeeded",eP.FAILED="failed",eP.CANCELED="canceled",(eM=eE||(eE={})).INREVIEW="InReview",eM.APPROVED="Approved",(eq=eg||(eg={})).HIGH="high",eq.NORMAL="normal",eq.LOW="low",(eF=ev||(ev={})).CREATED_AT="created_at",eF.UPDATED_AT="updated_at";var eA,eI,eD,eO,ek,eR,eL,eU,ex,eP,eM,eq,eF,eH,eV="/".concat("v3","/users"),eG="/".concat("v3","/sdk/users"),ez="/".concat("v3","/storage/file"),ej="/".concat("v3","/group_channels"),eK="/".concat("v3","/sdk/group_channels"),eB="/".concat("v3","/open_channels"),eQ="/".concat("v3","/sdk/open_channels"),eW="/".concat("v3","/search"),eZ="/".concat("v3","/report"),eY="/".concat("v3","/emojis"),eX="/".concat("v3","/emoji_categories"),eJ="/".concat("v3","/polls"),e$="/".concat("v3","/scheduled_messages"),e0="/".concat("v3","/sdk/ui_kit/configuration"),e1="/".concat("v3","/sdk/statistics"),e2="/".concat("v3","/sdk/notification_statistics"),e3="/".concat("v3","/sdk/ai_agent_statistics"),e4="/".concat("v3","/message_templates"),e5="/".concat("v3","/sdk/push_delivery"),e6="/".concat("v3","/report_category"),e8="/".concat("v3","/sdk/applications/settings"),e9="/".concat("v3","/ai_agent"),e7="/".concat("v3","/ai_agent/group_channels"),te=function(e){switch(e){case es.FEED:case es.GROUP:return ej;case es.OPEN:return eB;default:return null}},tt=function(e){switch(e){case es.GROUP:return"".concat(eZ,"/group_channels");case es.OPEN:return"".concat(eZ,"/open_channels");default:return null}},tn=function(e,t,n){var i,r;switch(e){case ed.CHANNEL:return!0;case ed.USERS:if(t)try{for(var o=f(t),s=o.next();!s.done;s=o.next())if(s.value===n)return!0}catch(e){i={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}}return!1},ti=function(e,t,n){var i,r,o,s,a=tn(null!==(i=e.mentionType)&&void 0!==i?i:null,null!==(r=e.mentionedUserIds)&&void 0!==r?r:[],n),c=tn(null!==(o=t.mentionType)&&void 0!==o?o:null,null!==(s=t.mentionedUserIds)&&void 0!==s?s:[],n);return!a&&c?1:a&&!c?-1:0},tr=function(e,t,n){var i,r=t||new FormData;for(var o in e)if(e.hasOwnProperty(o)){var s=e[o],a=n?"".concat(n,"[").concat(o,"]"):o;G(s)?r.append(a,s,null!==(i=s.name)&&void 0!==i?i:"filename"):"object"!=typeof s||null===s||Array.isArray(s)||s instanceof Blob?r.append(a,String(s)):r=tr(s,r,a)}return r};(to=eH||(eH={})).GET="GET",to.POST="POST",to.PUT="PUT",to.DELETE="DELETE",to.PATCH="PATCH";var to,ts,ta=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.params={},t.requireAuth=!0,t.headers={},t.requestId=ey(),t}return u(t,e),t.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(t.prototype,"query",{get:function(){var e=this,t=ew(this.params);return"?".concat(Object.keys(t).map(function(n){return"".concat(encodeURIComponent(n),"=").concat(e.encodeParams(t[n]))}).join("&"))}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"payload",{get:function(){var e=ew(this.params);return Object.keys(e).some(function(t){return G(e[t])})?tr(e):JSON.stringify(e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSessionKey",{get:function(){return void 0!==this.headers["Session-Key"]},enumerable:!1,configurable:!0}),t}(eS),tc=function(e){function t(t,n){var i=e.call(this)||this;return i._iid=t,i._payload=n,i}return u(t,e),Object.defineProperty(t.prototype,"payload",{get:function(){return l({},this._payload)},enumerable:!1,configurable:!0}),t.prototype.as=function(e){return new e(this._iid,this.payload)},t}(eS),tu=function(e){function t(t){var n=e.call(this)||this;return n.requestId=t,n}return u(t,e),t}(eS),tl=function(e){function t(t){var n=t.expires_in,i=t.reason,r=void 0===i?g.SESSION_KEY_EXPIRED:i,o=t.message,s=e.call(this)||this;switch(s.expiresIn=null!=n?n:0,r){case g.SESSION_KEY_EXPIRED:case g.SESSION_TOKEN_EXPIRED:case g.SESSION_REVOKED:case g.USER_AUTH_DEACTIVATED:case g.USER_AUTH_DELETED_OR_NOT_FOUND:s.error=new D({code:r,message:void 0===o?"":o})}return s}return u(t,e),Object.defineProperty(t.prototype,"invalidateSessionToken",{get:function(){var e;return!!(null===(e=this.error)||void 0===e?void 0:e.isSessionTokenExpiredError)},enumerable:!1,configurable:!0}),t}(eS),th=function(e){function t(t,n,i,r){void 0===r&&(r="");var o,s=this;return(s=e.call(this)||this)._iid=t,s.code=n,s.payload=i,s.requestId=null!==(o=i.req_id)&&void 0!==o?o:r,s}return u(t,e),t.createFromRawMessage=function(e,n){var i=n.substring(0,4),r={};try{r=JSON.parse(n.substring(4))}catch(e){i="NOOP"}finally{return new t(e,i,r)}},t.prototype.convertToMessage=function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")},t.prototype.as=function(e){return new e(this._iid,this.code,this.payload)},t}(eS),td=function(e){function t(t){var n,i=t.code,r=t.ackRequired,o=t.payload,s=this;return(s=e.call(this)||this).code=i,s.payload=void 0===o?{}:o,s.requestId=null!==(n=s.payload.req_id)&&void 0!==n?n:ey(),s.ackRequired=r,s.payload.req_id=s.requestId,s}return u(t,e),t.prototype.convertToMessage=function(){return"".concat(this.code).concat(JSON.stringify(this.payload),"\n")},t}(eS),t_=function(e){function t(t){var n=t.userId,i=t.authToken,r=t.services,o=t.expiringSession,s=e.call(this)||this;return s.path="".concat(eV,"/").concat(encodeURIComponent(n),"/session_key"),s.method=eH.POST,s.params=ew({token:i,services:r,expiring_session:!!(void 0===o||o)}),s.requireAuth=!1,s}return u(t,e),t}(ta),tf=function(e){function t(t){var n=t.authToken,i=t.expiringSession,r=t.requestId;return e.call(this,{code:"LOGI",payload:ew({token:n,expiring_session:void 0===i||i?1:0,req_id:void 0===r?void 0:r}),ackRequired:!0})||this}return u(t,e),t}(td),tp=function(e){function t(t,n){var i=e.call(this,t,n)||this,r=n.key,o=n.expires_at,s=n.services;return i.key=r,i.expiresAt=o,i.services=s,i}return u(t,e),t}(tc),tE=function(e){function t(t,n,i){var r,o=this;return(o=e.call(this,t,"LOGI",i)||this).error=null,o.newKey=null,o.newKey=null!==(r=i.new_key)&&void 0!==r?r:null,o.error=i.error?new D(i):null,o}return u(t,e),t}(th),tg=function(e){function t(t){var n=e.call(this)||this;return n.statLog=t,n}return u(t,e),t}(eS),tv=function(e){function t(t){var n=t.request,i=t.deferred,r=t.error,o=void 0===r?D.requestFailed:r,s=e.call(this)||this;return s.request=n,s.deferred=i,s.error=o,s}return u(t,e),t}(eS);(tm=ts||(ts={})).FEATURE_LOCALCACHE="feature:local_cache",tm.FEATURE_LOCALCACHE_EVENT="feature:local_cache_event",tm.NOTIFICATION="noti:stats",tm.WEBSOCKET_CONNECT="ws:connect",tm.WEBSOCKET_DISCONNECT="ws:disconnect",tm.API_RESULT="api:result",tm.AI_AGENT_SDK_STATS="ai_agent:stats";var tm,ty,tb,tT,tC=function(){function e(e){var t=e.type,n=e.data,i=e.ts,r=void 0===i?Date.now():i,o=e.runtimeId;this.type=t,this.createdAt=r,this.runtimeId=o,this.data=n}return e.payloadify=function(e){return ew({stat_type:e.type,ts:e.createdAt,runtime_id:e.runtimeId,data:ew(e.data)})},e}(),tS=function(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"==navigator.product},tw=function(){return!("undefined"==typeof navigator||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(i4=ty||(ty={}
1)).CHAT="chat",i4.CALLS="calls",i4.DESK="desk",i4.LIVE="live",i4.UIKIT_CHAT="uikit-chat",i4.UIKIT_LIVE="uikit-live",i4.AI_AGENT="ai-agent",(i5=tb||(tb={})).ANDROID="android",i5.IOS="ios",i5.JS="js",i5.UNREAL="unreal",i5.UNITY="unity",i5.REACT_NATIVE="react-native",i5.FLUTTER="flutter",(i6=tT||(tT={})).ANDROID="android",i6.IOS="ios",i6.WEB="web",i6.MOBILE_WEB="mobile_web",i6.WINDOWS="windows";var tN="^(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-]+)*))?$",tA=function(){function e(){}return 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(t){var n=tS()?tb.REACT_NATIVE:tb.JS,i={main_sdk_info:"chat/".concat(n,"/").concat(m.SDK_VERSION),device_os_platform:tw()?"mobile-web":"web",os_version:m.OS_VERSION};if(t){var r=t.sendbirdExtensions,o=t.deviceOS,s=t.customData,a=void 0===s?{}:s;o.version&&(i.os_version=o.version),o.platform&&(i.device_os_platform=o.platform),r.length>0&&(i.extension_sdk_info=r.map(function(e){var t=e.product,n=e.platform,i=e.version;return"".concat(t,"/").concat(n,"/").concat(i)}
1).join(",")),Object.keys(i).forEach(function(e){return delete a[e]}),Object.keys(a).length>0&&(i=l(l({},i),a))}var c=e._getFrameWork();return c&&(i.javascript_framework=c),Object.entries(i).map(function(e){var t=p(e,2),n=t[0],i=t[1];return"".concat(n,"=").concat(i)}).join("&")},e.userAgentWithExtension=function(e){var t=tS()?"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"]):tw()?"omobile-web":"oweb";return"".concat(t,"/c").concat(m.SDK_VERSION,"/").concat(n,"/").concat(i,"/").concat(r)},e}(),tI=function(){var e=this;this.promise=new Promise(function(t,n){e.resolve=t,e.reject=function(e){n(e)}})},tD=function(e){function t(t){var n=e.call(this)||this;return n.requestId=t.requestId,n}return u(t,e),t}(eS),tO=function(e){function t(t){var n=e.call(this)||this;return n.method=eH.DELETE,n.path="".concat(te(t.channelType),"/").concat(t.channelUrl,"/messages/").concat(t.messageId),t.messageToken&&(n.params=ew({mesg_token:t.messageToken})),n}return u(t,e),t}(ta);u(function(){return null!==i8&&i8.apply(this,arguments)||this},i8=tc);var tk=function(e){function t(t,n,i){var r,o=this;return(o=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,o.channelType=i.channel_type,o.messageId=Number(i.msg_id),o.silent=i.silent,o.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,o.senderId=null!==(r=i.sender_id)&&void 0!==r?r:void 0,o}return u(t,e),t}(th),tR=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,o=t.logger,s=t.useFetchCompat,a=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 tu&&a.cancel(e.requestId)}),this._logger=o,this._shouldImportFetchCompat=void 0!==s&&s}return e.prototype._createHeader=function(e,t){var n=this._sdkState,i=n.appId,r=n.appVersion,o=n.sendbirdRuntimeEnvironment,s=l(l({},e.headers),{SendBird:"JS,".concat(m.OS_VERSION,",").concat(m.SDK_VERSION,",").concat(i).concat(r?",".concat(r):""),"SB-User-Agent":tA.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":tA.sendbirdSdkUserAgentWithExtension(o)});return t||(s["Content-Type"]="application/json; charset=utf-8"),s["App-Id"]=i,e.requireAuth?!e.hasSessionKey&&this._session.hasSession&&(s["Session-key"]=this._session.sessionKey):this._session.authToken&&(s["Access-token"]=this._session.authToken),s},e.prototype._statLogApiResult=function(e,t,n){e.path.includes("/sdk/statistics")||this._dispatcher.dispatch(new tg(new tC({type:ts.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!==eH.GET&&(t!==eH.DELETE||e instanceof tO)},e.prototype.send=function(e){return d(this,void 0,void 0,function(){var t,i,r,o,s,a,c,u,l,h,d,f,p,E,v,m,y,b,T;return _(this,function(_){switch(_.label){case 0:t=e.path,i=e.method,r=e.uploadProgressHandler,o=this._isBodyRequired(e),s=this._sdkState.api,a="".concat(s.host).concat(t).concat(o?"":e.query),c=o?e.payload:null,u=this._createHeader(e,c instanceof FormData?c:void 0),h=(l=new AbortController).signal,this._abortControl.set(e.requestId,l),d=Date.now(),_.label=1;case 1:return _.trys.push([1,13,,14]),r?[4,n.e(6148).then(n.bind(n,56148))]:[3,6];case 2:f=_.sent().xmlHttpRequest,_.label=3;case 3:return _.trys.push([3,5,,6]),[4,f(this._iid,{requestId:e.requestId,method:e.method,url:a,headers:u,data:null!=c?c:void 0,uploadProgressHandler:r})];case 4:return p=_.sent(),this._logger.debug("receive api response",e.requestId),this._statLogApiResult(e,d),[2,p];case 5:if(!((E=_.sent())instanceof D&&E.code===g.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,n.e(1675).then(n.bind(n,81675))];case 7:_.sent(),_.label=8;case 8:return"function"==typeof fetch?[3,10]:[4,n.e(3789).then(n.bind(n,73789))];case 9:_.sent(),_.label=10;case 10:return[4,fetch(a,{method:i,body:c,headers:u,signal:h})];case 11:return[4,(v=_.sent()).json()];case 12:if(m=_.sent(),v.ok||v.redirected)return this._logger.debug("receive api response",e.requestId),this._statLogApiResult(e,d),[2,new tc(this._iid,m)];if(m){if((y=new D(m)).isSessionExpiredError){if(this._dispatcher.dispatch(new tl
1({reason:y.code,message:y.message})),!(e instanceof t_))return b=new tI,this._dispatcher.dispatch(new tv({request:e,deferred:b,error:y})),[2,b.promise];throw y}throw y.isSessionInvalidatedError&&this._dispatcher.dispatch(new tl({reason:y.code,message:y.message})),y}throw D.requestFailed;case 13:throw T=_.sent(),this._statLogApiResult(e,d,T),T instanceof D?(this._logger.debug("fail api request",T),T):"AbortError"===(null==T?void 0:T.name)?D.requestCanceled:(this._logger.debug("fail api request",T),D.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 tD({requestId:e}))},e.prototype.cancelAll=function(){var e,t;try{for(var n=f(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 tD({}))},e}(),tL=function(){};function tU(e){let t=e.length;for(;--t>=0;)e[t]=0}let tx=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]),tP=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]),tM=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),tq=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tF=Array(576);tU(tF);let tH=Array(60);tU(tH);let tV=Array(512);tU(tV);let tG=Array(256);tU(tG);let tz=Array(29);tU(tz);let tj=Array(30);function tK(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}function tB(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}tU(tj);let tQ=e=>e<256?tV[e]:tV[256+(e>>>7)],tW=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},tZ=(e,t,n)=>{e.bi_valid>16-n?(e.bi_buf|=t<<e.bi_valid&65535,tW(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)},tY=(e,t,n)=>{tZ(e,n[2*t],n[2*t+1])},tX=(e,t)=>{let n=0;do n|=1&e,e>>>=1,n<<=1;while(--t>0);return n>>>1},tJ=(e,t,n)=>{let i=Array(16),r,o,s=0;for(r=1;r<=15;r++)s=s+n[r-1]<<1,i[r]=s;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=tX(i[t]++,t))}},t$=e=>{let t;for(t=0;t<286;t++)e.dyn_ltree[2*t]=0;for(t=0;t<30;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},t0=e=>{e.bi_valid>8?tW(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},t1=(e,t,n,i)=>{let r=2*t,o=2*n;return e[r]<e[o]||e[r]===e[o]&&i[t]<=i[n]},t2=(e,t,n)=>{let i=e.heap[n],r=n<<1;for(;r<=e.heap_len&&(r<e.heap_len&&t1(t,e.heap[r+1],e.heap[r],e.depth)&&r++,!t1(t,i,e.heap[r],e.depth));)e.heap[n]=e.heap[r],n=r,r<<=1;e.heap[n]=i},t3=(e,t,n)=>{let i,r,o,s,a=0;
1if(0!==e.sym_next)do i=(255&e.pending_buf[e.sym_buf+a++])+((255&e.pending_buf[e.sym_buf+a++])<<8),r=e.pending_buf[e.sym_buf+a++],0===i?tY(e,r,t):(tY(e,(o=tG[r])+256+1,t),0!==(s=tx[o])&&tZ(e,r-=tz[o],s),tY(e,o=tQ(--i),n),0!==(s=tP[o])&&tZ(e,i-=tj[o],s));while(a<e.sym_next);tY(e,256,t)},t4=(e,t)=>{let n=t.dyn_tree,i=t.stat_desc.static_tree,r=t.stat_desc.has_stree,o=t.stat_desc.elems,s,a,c,u=-1;for(e.heap_len=0,e.heap_max=573,s=0;s<o;s++)0!==n[2*s]?(e.heap[++e.heap_len]=u=s,e.depth[s]=0):n[2*s+1]=0;for(;e.heap_len<2;)n[2*(c=e.heap[++e.heap_len]=u<2?++u:0)]=1,e.depth[c]=0,e.opt_len--,r&&(e.static_len-=i[2*c+1]);for(t.max_code=u,s=e.heap_len>>1;s>=1;s--)t2(e,n,s);c=o;do s=e.heap[1],e.heap[1]=e.heap[e.heap_len--],t2(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=s,e.heap[--e.heap_max]=a,n[2*c]=n[2*s]+n[2*a],e.depth[c]=(e.depth[s]>=e.depth[a]?e.depth[s]:e.depth[a])+1,n[2*s+1]=n[2*a+1]=c,e.heap[1]=c++,t2(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{let n=t.dyn_tree,i=t.max_code,r=t.stat_desc.static_tree,o=t.stat_desc.has_stree,s=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length,u,l,h,d,_,f,p=0;for(d=0;d<=15;d++)e.bl_count[d]=0;for(n[2*e.heap[e.heap_max]+1]=0,u=e.heap_max+1;u<573;u++)(d=n[2*n[2*(l=e.heap[u])+1]+1]+1)>c&&(d=c,p++),n[2*l+1]=d,l>i||(e.bl_count[d]++,_=0,l>=a&&(_=s[l-a]),f=n[2*l],e.opt_len+=f*(d+_),o&&(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])>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),tJ(n,u,e.bl_count)},t5=(e,t,n)=>{let i,r,o=-1,s=t[1],a=0,c=7,u=4;for(0===s&&(c=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=s,s=t[2*(i+1)+1],++a<c&&r===s||(a<u?e.bl_tree[2*r]+=a:0!==r?(r!==o&&e.bl_tree[2*r]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=r,0===s?(c=138,u=3):r===s?(c=6,u=3):(c=7,u=4))},t6=(e,t,n)=>{let i,r,o=-1,s=t[1],a=0,c=7,u=4;for(0===s&&(c=138,u=3),i=0;i<=n;i++)if(r=s,s=t[2*(i+1)+1],!(++a<c&&r===s)){if(a<u)do tY(e,r,e.bl_tree);while(0!=--a);else 0!==r?(r!==o&&(tY(e,r,e.bl_tree),a--),tY(e,16,e.bl_tree),tZ(e,a-3,2)):a<=10?(tY(e,17,e.bl_tree),tZ(e,a-3,3)):(tY(e,18,e.bl_tree),tZ(e,a-11,7));a=0,o=r,0===s?(c=138,u=3):r===s?(c=6,u=3):(c=7,u=4)}},t8=!1,t9=(e,t,n,i)=>{tZ(e,0+(i?1:0),3),t0(e),tW(e,n),tW(e,~n),n&&e.pending_buf.set(e.window.subarray(t,t+n),e.pending),e.pending+=n};var t7={_tr_init:e=>{t8||((()=>{let e,t,n,s,a;let c=Array(16);for(n=0,s=0;s<28;s++)for(tz[s]=n,e=0;e<1<<tx[s];e++)tG[n++]=s;for(tG[n-1]=s,a=0,s=0;s<16;s++)for(tj[s]=a,e=0;e<1<<tP[s];e++)tV[a++]=s;for(a>>=7;s<30;s++)for(tj[s]=a<<7,e=0;e<1<<tP[s]-7;e++)tV[256+a++]=s;for(t=0;t<=15;t++)c[t]=0;for(e=0;e<=143;)tF[2*e+1]=8,e++,c[8]++;for(;e<=255;)tF[2*e+1]=9,e++,c[9]++;for(;e<=279;)tF[2*e+1]=7,e++,c[7]++;for(;e<=287;)tF[2*e+1]=8,e++,c[8]++;for(tJ(tF,287,c),e=0;e<30;e++)tH[2*e+1]=5,tH[2*e]=tX(e,5);i=new tK(tF,tx,257,286,15),r=new tK(tH,tP,0,30,15),o=new tK([],tM,0,19,7)})(),t8=!0),e.l_desc=new tB(e.dyn_ltree,i),e.d_desc=new tB(e.dyn_dtree,r),e.bl_desc=new tB(e.bl_tree,o),e.bi_buf=0,e.bi_valid=0,t$(e)},_tr_stored_block:t9,_tr_flush_block:(e,t,n,i)=>{let r,o,s=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<256;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),t4(e,e.l_desc),t4(e,e.d_desc),s=(e=>{let t;for(t5(e,e.dyn_ltree,e.l_desc.max_code),t5(e,e.dyn_dtree,e.d_desc.max_code),t4(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*tq[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,(o=e.static_len+3+7>>>3)<=r&&(r=o)):r=o=n+5,n+4<=r&&-1!==t?t9(e,t,n,i):4===e.strategy||o===r?(tZ(e,2+(i?1:0),3),t3(e,tF,tH)):(tZ(e,4+(i?1:0),3),((e,t,n,i)=>{let r;for(tZ(e,t-257,5),tZ(e,n-1,5),tZ(e,i-4,4),r=0;r<i;r++)tZ(e,e.bl_tree[2*tq[r]+1],3);t6(e,e.dyn_ltree,t-1),t6(e,e.dyn_dtree,n-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,s+1),t3(e,e.dyn_ltree,e.dyn_dtree)),t$(e),i&&t0(e)},_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>>
18,e.pending_buf[e.sym_buf+e.sym_next++]=n,0===t?e.dyn_ltree[2*n]++:(e.matches++,t--,e.dyn_ltree[2*(tG[n]+256+1)]++,e.dyn_dtree[2*tQ(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{tZ(e,2,3),tY(e,256,tF),16===e.bi_valid?(tW(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)}},ne=(e,t,n,i)=>{let r=65535&e,o=e>>>16&65535,s=0;for(;0!==n;){s=n>2e3?2e3:n,n-=s;do o=o+(r=r+t[i++]|0)|0;while(--s);r%=65521,o%=65521}return r|o<<16};let nt=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 nn=(e,t,n,i)=>{let r=i+n;e^=-1;for(let n=i;n<r;n++)e=e>>>8^nt[255&(e^t[n])];return~e},ni={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"},nr={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_
1ERRNO:-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};let{_tr_init:no,_tr_stored_block:ns,_tr_flush_block:na,_tr_tally:nc,_tr_align:nu}=t7,{Z_NO_FLUSH:nl,Z_PARTIAL_FLUSH:nh,Z_FULL_FLUSH:nd,Z_FINISH:n_,Z_BLOCK:nf,Z_OK:np,Z_STREAM_END:nE,Z_STREAM_ERROR:ng,Z_DATA_ERROR:nv,Z_BUF_ERROR:nm,Z_DEFAULT_COMPRESSION:ny,Z_FILTERED:nb,Z_HUFFMAN_ONLY:nT,Z_RLE:nC,Z_FIXED:nS,Z_DEFAULT_STRATEGY:nw,Z_UNKNOWN:nN,Z_DEFLATED:nA}=nr,nI=(e,t)=>(e.msg=ni[t],t),nD=e=>2*e-(e>4?9:0),nO=e=>{let t=e.length;for(;--t>=0;)e[t]=0},nk=e=>{let t,n,i,r=e.w_size;i=t=e.hash_size;do n=e.head[--i],e.head[i]=n>=r?n-r:0;while(--t);i=t=r;do n=e.prev[--i],e.prev[i]=n>=r?n-r:0;while(--t)},nR=(e,t,n)=>(t<<e.hash_shift^n)&e.hash_mask,nL=e=>{let t=e.state,n=t.pending;n>e.avail_out&&(n=e.avail_out),0!==n&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+n),e.next_out),e.next_out+=n,t.pending_out+=n,e.total_out+=n,e.avail_out-=n,t.pending-=n,0===t.pending&&(t.pending_out=0))},nU=(e,t)=>{na(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,nL(e.strm)},nx=(e,t)=>{e.pending_buf[e.pending++]=t},nP=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},nM=(e,t,n,i)=>{let r=e.avail_in;return r>i&&(r=i),0===r?0:(e.avail_in-=r,t.set(e.input.subarray(e.next_in,e.next_in+r),n),1===e.state.wrap?e.adler=ne(e.adler,t,r,n):2===e.state.wrap&&(e.adler=nn(e.adler,t,r,n)),e.next_in+=r,e.total_in+=r,r)},nq=(e,t)=>{let n,i,r=e.max_chain_length,o=e.strstart,s=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-262?e.strstart-(e.w_size-262):0,u=e.window,l=e.w_mask,h=e.prev,d=e.strstart+258,_=u[o+s-1],f=u[o+s];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do if(u[(n=t)+s]===f&&u[n+s-1]===_&&u[n]===u[o]&&u[++n]===u[o+1]){o+=2,n++;do;while(u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&u[++o]===u[++n]&&o<d);if(i=258-(d-o),o=d-258,i>s){if(e.match_start=t,s=i,i>=a)break;_=u[o+s-1],f=u[o+s]}}while((t=h[t&l])>c&&0!=--r);return s<=e.lookahead?s:e.lookahead},nF=e=>{let t,n,i;let r=e.w_size;do{if(n=e.window_size-e.lookahead-e.strstart,e.strstart>=r+(r-262)&&(e.window.set(e.window.subarray(r,r+r-n),0),e.match_start-=r,e.strstart-=r,e.block_start-=r,e.insert>e.strstart&&(e.insert=e.strstart),nk(e),n+=r),0===e.strm.avail_in)break;if(t=nM(e.strm,e.window,e.strstart+e.lookahead,n),e.lookahead+=t,e.lookahead+e.insert>=3)for(i=e.strstart-e.insert,e.ins_h=e.window[i],e.ins_h=nR(e,e.ins_h,e.window[i+1]);e.insert&&(e.ins_h=nR(e,e.ins_h,e.window[i+3-1]),e.prev[i&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=i,i++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<262&&0!==e.strm.avail_in)},nH=(e,t)=>{let n,i,r,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,s=0,a=e.strm.avail_in;do{if(n=65535,r=e.bi_valid+42>>3,e.strm.avail_out<r||(r=e.strm.avail_out-r,n>(i=e.strstart-e.block_start)+e.strm.avail_in&&(n=i+e.strm.avail_in),n>r&&(n=r),n<o&&(0===n&&t!==n_||t===nl||n!==i+e.strm.avail_in)))break;s=t===n_&&n===i+e.strm.avail_in?1:0,ns(e,0,0,s),e.pending_buf[e.pending-4]=n,e.pending_buf[e.pending-3]=n>>8,e.pending_buf[e.pending-2]=~n,e.pending_buf[e.pending-1]=~n>>8,nL(e.strm),i&&(i>n&&(i=n),e.strm.output.set(e.window.subarray(e.block_start,e.block_start+i),e.strm.next_out),e.strm.next_out+=i,e.strm.avail_out-=i,e.strm.total_out+=i,e.block_start+=i,n-=i),n&&(nM(e.strm,e.strm.output,e.strm.next_out,n),e.strm.next_out+=n,e.strm.avail_out-=n,e.strm.total_out+=n)}while(0===s);return(a-=e.strm.avail_in)&&(a>=e.w_size?(e.matches=2,e.window.set(e.strm.input.subarray(e.strm.next_in-e.w_size,e.strm.next_in),0),e.strstart=e.w_size,e.insert=e.strstart):(e.window_size-e.strstart<=a&&(e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,e.insert>e.strstart&&(e.insert=e.strstart)),e.window.set(e.strm.input.subarray(e.strm.next_in-a,e.strm.next_in),e.strstart),e.strstart+=a,e.insert+=a>e.w_size-e.insert?e.w_size-e.insert:a),e.block_start=e.strstart),e.high_water<e.strstart&&(e.high_water=e.strstart),s?4:t!==nl&&t!==n_&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(r=e.window_size-e.strstart,e.strm.avail_in>r&&e.block_start>=e.w_size&&(e.block_start-=e.w_size,e.strstart-=e.w_size,e.window.set(e.window.subarray(e.w_size,e.w_size+e.strstart),0),e.matches<2&&e.matches++,r+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),r>e.strm.avail_in&&(r=e.strm.avail_in),r&&(nM(e.strm,e.window,e.strstart,r),e.strstart+=r,e.insert+=r>e.w_size-e.insert?e.w_size-e.insert:r),e.high_water<e.strstart&&(e.high_water=e.strstart),r=e.bi_valid+42>>3,o=(r=e.pending_buf_size-r>65535?65535:e.pending_buf_size-r)>
1e.w_size?e.w_size:r,((i=e.strstart-e.block_start)>=o||(i||t===n_)&&t!==nl&&0===e.strm.avail_in&&i<=r)&&(n=i>r?r:i,s=t===n_&&0===e.strm.avail_in&&n===i?1:0,ns(e,e.block_start,n,s),e.block_start+=n,nL(e.strm)),s?3:1)},nV=(e,t)=>{let n,i;for(;;){if(e.lookahead<262){if(nF(e),e.lookahead<262&&t===nl)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=nR(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==n&&e.strstart-n<=e.w_size-262&&(e.match_length=nq(e,n)),e.match_length>=3){if(i=nc(e,e.strstart-e.match_start,e.match_length-3),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=3){e.match_length--;do e.strstart++,e.ins_h=nR(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart;while(0!=--e.match_length);e.strstart++}else e.strstart+=e.match_length,e.match_length=0,e.ins_h=e.window[e.strstart],e.ins_h=nR(e,e.ins_h,e.window[e.strstart+1])}else i=nc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(nU(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===n_?(nU(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nU(e,!1),0===e.strm.avail_out)?1:2},nG=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<262){if(nF(e),e.lookahead<262&&t===nl)return 1;if(0===e.lookahead)break}if(n=0,e.lookahead>=3&&(e.ins_h=nR(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),e.prev_length=e.match_length,e.prev_match=e.match_start,e.match_length=2,0!==n&&e.prev_length<e.max_lazy_match&&e.strstart-n<=e.w_size-262&&(e.match_length=nq(e,n),e.match_length<=5&&(e.strategy===nb||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){r=e.strstart+e.lookahead-3,i=nc(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=r&&(e.ins_h=nR(e,e.ins_h,e.window[e.strstart+3-1]),n=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart);while(0!=--e.prev_length);if(e.match_available=0,e.match_length=2,e.strstart++,i&&(nU(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=nc(e,0,e.window[e.strstart-1]))&&nU(e,!1),e.strstart++,e.lookahead--,0===e.strm.avail_out)return 1}else e.match_available=1,e.strstart++,e.lookahead--}return e.match_available&&(i=nc(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===n_?(nU(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nU(e,!1),0===e.strm.avail_out)?1:2};function nz(e,t,n,i,r){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=i,this.func=r}let nj=[new nz(0,0,0,0,nH),new nz(4,4,8,4,nV),new nz(4,5,16,8,nV),new nz(4,6,32,32,nV),new nz(4,4,16,16,nG),new nz(8,16,32,32,nG),new nz(8,16,128,128,nG),new nz(8,32,128,256,nG),new nz(32,128,258,1024,nG),new nz(32,258,258,4096,nG)];function nK(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=nA,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(1146),this.dyn_dtree=new Uint16Array(122),this.bl_tree=new Uint16Array(78),nO(this.dyn_ltree),nO(this.dyn_dtree),nO(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(16),this.heap=new Uint16Array(573),nO(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),nO(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}let nB=e=>{if(!e)return 1;let t=e.state;return t&&t.strm===e&&(42===t.status||57===t.status||69===t.status||73===t.status||91===t.status||103===t.status||113===t.status||666===t.status)?0:1},nQ=e=>{if(nB(e))return nI(e,ng);e.total_in=e.total_out=0,e.data_type=nN;let t=e.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=2===t.wrap?57:t.wrap?42:113,e.adler=2===t.wrap?0:1,t.last_flush=-2,no(t),np},nW=e=>{var t;let n=nQ(e);return n===np&&((t=e.state).window_size=2*t.w_size,nO(t.head),t.max_lazy_match=nj[t.level].max_lazy,t.good_match=nj[t.level].good_length,t.nice_match=nj[t.level].nice_length,t.max_chain_length=nj[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=2,t.match_available=0,t.ins_h=0),n};var nZ={deflateInit2:(e,t,n,i,r,o)=>{if(!e)return ng;let s=1;if(t===ny&&(t=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),r<1||r>9||n!==nA||i<8||i>15||t<0||t>9||o<0||o>nS||8===i&&1!==s)return nI(e,ng);8===i&&(i=9);let a=new nK;return e.state=a,a.strm=e,a.status=42,a.wrap=s,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=r+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<r+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=n,nW(e)},deflateSetHeader:(e,t)=>nB(e)||2!==e.state.wrap?ng:(e.state.gzhead=t,np),deflate:(e,t)=>
1{if(nB(e)||t>nf||t<0)return e?nI(e,ng):ng;let n=e.state;if(!e.output||0!==e.avail_in&&!e.input||666===n.status&&t!==n_)return nI(e,0===e.avail_out?nm:ng);let i=n.last_flush;if(n.last_flush=t,0!==n.pending){if(nL(e),0===e.avail_out)return n.last_flush=-1,np}else if(0===e.avail_in&&nD(t)<=nD(i)&&t!==n_)return nI(e,nm);if(666===n.status&&0!==e.avail_in)return nI(e,nm);if(42===n.status&&0===n.wrap&&(n.status=113),42===n.status){let t=nA+(n.w_bits-8<<4)<<8;if(t|=(n.strategy>=nT||n.level<2?0:n.level<6?1:6===n.level?2:3)<<6,0!==n.strstart&&(t|=32),nP(n,t+=31-t%31),0!==n.strstart&&(nP(n,e.adler>>>16),nP(n,65535&e.adler)),e.adler=1,n.status=113,nL(e),0!==n.pending)return n.last_flush=-1,np}if(57===n.status){if(e.adler=0,nx(n,31),nx(n,139),nx(n,8),n.gzhead)nx(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),nx(n,255&n.gzhead.time),nx(n,n.gzhead.time>>8&255),nx(n,n.gzhead.time>>16&255),nx(n,n.gzhead.time>>24&255),nx(n,9===n.level?2:n.strategy>=nT||n.level<2?4:0),nx(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(nx(n,255&n.gzhead.extra.length),nx(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=nn(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=69;else if(nx(n,0),nx(n,0),nx(n,0),nx(n,0),nx(n,0),nx(n,9===n.level?2:n.strategy>=nT||n.level<2?4:0),nx(n,3),n.status=113,nL(e),0!==n.pending)return n.last_flush=-1,np}if(69===n.status){if(n.gzhead.extra){let t=n.pending,i=(65535&n.gzhead.extra.length)-n.gzindex;for(;n.pending+i>n.pending_buf_size;){let r=n.pending_buf_size-n.pending;if(n.pending_buf.set(n.gzhead.extra.subarray(n.gzindex,n.gzindex+r),n.pending),n.pending=n.pending_buf_size,n.gzhead.hcrc&&n.pending>t&&(e.adler=nn(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex+=r,nL(e),0!==n.pending)return n.last_flush=-1,np;t=0,i-=r}let r=new Uint8Array(n.gzhead.extra);n.pending_buf.set(r.subarray(n.gzindex,n.gzindex+i),n.pending),n.pending+=i,n.gzhead.hcrc&&n.pending>t&&(e.adler=nn(e.adler,n.pending_buf,n.pending-t,t)),n.gzindex=0}n.status=73}if(73===n.status){if(n.gzhead.name){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=nn(e.adler,n.pending_buf,n.pending-i,i)),nL(e),0!==n.pending)return n.last_flush=-1,np;i=0}t=n.gzindex<n.gzhead.name.length?255&n.gzhead.name.charCodeAt(n.gzindex++):0,nx(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=nn(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex=0}n.status=91}if(91===n.status){if(n.gzhead.comment){let t,i=n.pending;do{if(n.pending===n.pending_buf_size){if(n.gzhead.hcrc&&n.pending>i&&(e.adler=nn(e.adler,n.pending_buf,n.pending-i,i)),nL(e),0!==n.pending)return n.last_flush=-1,np;i=0}t=n.gzindex<n.gzhead.comment.length?255&n.gzhead.comment.charCodeAt(n.gzindex++):0,nx(n,t)}while(0!==t);n.gzhead.hcrc&&n.pending>i&&(e.adler=nn(e.adler,n.pending_buf,n.pending-i,i))}n.status=103}if(103===n.status){if(n.gzhead.hcrc){if(n.pending+2>n.pending_buf_size&&(nL(e),0!==n.pending))return n.last_flush=-1,np;nx(n,255&e.adler),nx(n,e.adler>>8&255),e.adler=0}if(n.status=113,nL(e),0!==n.pending)return n.last_flush=-1,np}if(0!==e.avail_in||0!==n.lookahead||t!==nl&&666!==n.status){let i=0===n.level?nH(n,t):n.strategy===nT?((e,t)=>{let n;for(;;){if(0===e.lookahead&&(nF(e),0===e.lookahead)){if(t===nl)return 1;break}if(e.match_length=0,n=nc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,n&&(nU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===n_?(nU(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nU(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===nC?((e,t)=>{let n,i,r,o;let s=e.window;for(;;){if(e.lookahead<=258){if(nF(e),e.lookahead<=258&&t===nl)return 1;if(0===e.lookahead)break}if(e.match_length=0,e.lookahead>=3&&e.strstart>0&&(i=s[r=e.strstart-1])===s[++r]&&i===s[++r]&&i===s[++r]){o=e.strstart+258;do;while(i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&r<o);e.match_length=258-(o-r),e.match_length>e.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=3?(n=nc(e,1,e.match_length-3),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(n=nc(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),n&&(nU(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===n_?(nU(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nU(e,!1),0===e.strm.avail_out)?1:2})(n,t):nj[n.level].func(n,t);if(3!==i&&4!==i||(n.status=666),1===i||3===i)return 0===e.avail_out&&(n.last_flush=-1),np;if(2===i&&(t===nh?nu(n):t!==nf&&(ns(n,0,0,!1),t===nd&&(nO(n.head),0===n.lookahead&&(n.strstart=0,n.block_start=0,n.insert=0))),nL(e),0===e.avail_out))return n.last_flush=-1,np}return t!==n_?np:n.wrap<=0?nE:(2===n.wrap?(nx(n,255&e.adler),nx(n,e.adler>>8&255),nx(n,e.adler>>16&255),nx(n,e.adler>>24&255),nx(n,255&e.total_in),nx(n,e.total_in>>8&255),nx(n,e.total_in>>16&255),nx(n,e.total_in>>24&255)):(nP(n,e.adler>>>16),nP(n,65535&e.adler)),nL(e),n.wrap>0&&(n.wrap=-n.wrap),0!==n.pending?np:nE)},deflateEnd:e=>{if(nB(e))return ng;let t=e.state.status;return e.state=null,113===t?nI(e,nv):np},deflateSetDictionary:(e,t)=>{let n=t.length;if(nB(e))return ng;let i=e.state,r=i.wrap;if(2===r||1===r&&42!==i.status||i.lookahead)return ng;if(1===r&&(e.adler=ne(e.adler,t,n,0)),i.wrap=0,n>=i.w_size){0===r&&(nO(i.head),i.strstart=0,i.block_start=0,i.insert=0);let e=new Uint8Array(i.w_size);e.set(t.subarray(n-i.w_size,n),0),t=e,n=i.w_size}let o=e.avail_in,s=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,nF(i);i.lookahead>=3;){let e=i.strstart,t=i.lookahead-2;do i.ins_h=nR(i,i.ins_h,i.window[e+3-1]),i.prev[e&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=e,e++;while(--t);i.strstart=e,i.lookahead=2,nF(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=2,i.match_available=0,e.next_in=s,e.input=a,e.avail_in=o,i.wrap=r,np}};let nY=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);
1var nX=function(e){let t=Array.prototype.slice.call(arguments,1);for(;t.length;){let n=t.shift();if(n){if("object"!=typeof n)throw TypeError(n+"must be non-object");for(let t in n)nY(n,t)&&(e[t]=n[t])}}return e},nJ=e=>{let t=0;for(let n=0,i=e.length;n<i;n++)t+=e[n].length;let n=new Uint8Array(t);for(let t=0,i=0,r=e.length;t<r;t++){let r=e[t];n.set(r,i),i+=r.length}return n};let n$=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){n$=!1}let n0=new Uint8Array(256);for(let e=0;e<256;e++)n0[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;n0[254]=n0[254]=1;var n1=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,r,o,s=e.length,a=0;for(r=0;r<s;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),a+=n<128?1:n<2048?2:n<65536?3:4;for(t=new Uint8Array(a),o=0,r=0;o<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<s&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[o++]=n:(n<2048?t[o++]=192|n>>>6:(n<65536?t[o++]=224|n>>>12:(t[o++]=240|n>>>18,t[o++]=128|n>>>12&63),t[o++]=128|n>>>6&63),t[o++]=128|63&n);return t},n2=(e,t)=>{let n,i;let r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let o=Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){o[i++]=t;continue}let s=n0[t];if(s>4)o[i++]=65533,n+=s-1;else{for(t&=2===s?31:3===s?15:7;s>1&&n<r;)t=t<<6|63&e[n++],s--;s>1?o[i++]=65533:t<65536?o[i++]=t:(t-=65536,o[i++]=55296|t>>10&1023,o[i++]=56320|1023&t)}}return((e,t)=>{if(t<65534&&e.subarray&&n$)return String.fromCharCode.apply(null,e.length===t?e:e.subarray(0,t));let n="";for(let i=0;i<t;i++)n+=String.fromCharCode(e[i]);return n})(o,i)},n3=(e,t)=>{(t=t||e.length)>e.length&&(t=e.length);let n=t-1;for(;n>=0&&128==(192&e[n]);)n--;return n<0||0===n?t:n+n0[e[n]]>t?n:t},n4=function(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0};let n5=Object.prototype.toString,{Z_NO_FLUSH:n6,Z_SYNC_FLUSH:n8,Z_FULL_FLUSH:n9,Z_FINISH:n7,Z_OK:ie,Z_STREAM_END:it,Z_DEFAULT_COMPRESSION:ii,Z_DEFAULT_STRATEGY:ir,Z_DEFLATED:io}=nr;function is(e){this.options=nX({level:ii,method:io,chunkSize:16384,windowBits:15,memLevel:8,strategy:ir},e||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n4,this.strm.avail_out=0;let n=nZ.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(n!==ie)throw Error(ni[n]);if(t.header&&nZ.deflateSetHeader(this.strm,t.header),t.dictionary){let e;if(e="string"==typeof t.dictionary?n1(t.dictionary):"[object ArrayBuffer]"===n5.call(t.dictionary)?new Uint8Array(t.dictionary):t.dictionary,(n=nZ.deflateSetDictionary(this.strm,e))!==ie)throw Error(ni[n]);this._dict_set=!0}}function ia(e,t){let n=new is(t);if(n.push(e,!0),n.err)throw n.msg||ni[n.err];return n.result}is.prototype.push=function(e,t){let n,i;let r=this.strm,o=this.options.chunkSize;if(this.ended)return!1;for(i=t===~~t?t:!0===t?n7:n6,"string"==typeof e?r.input=n1(e):"[object ArrayBuffer]"===n5.call(e)?r.input=new Uint8Array(e):r.input=e,r.next_in=0,r.avail_in=r.input.length;;)if(0===r.avail_out&&(r.output=new Uint8Array(o),r.next_out=0,r.avail_out=o),(i===n8||i===n9)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if((n=nZ.deflate(r,i))===it)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=nZ.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===ie;if(0!==r.avail_out){if(i>0&&r.next_out>0)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else if(0===r.avail_in)break}else this.onData(r.output)}return!0},is.prototype.onData=function(e){this.chunks.push(e)},is.prototype.onEnd=function(e){e===ie&&(this.result=nJ(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ic=function(e,t){let n,i,r,o,s,a,c,u,l,h,d,_,f,p,E,g,v,m,y,b,T,C,S,w;let N=e.state;n=e.next_in,S=e.input,i=n+(e.avail_in-5),r=e.next_out,w=e.output,o=r-(t-e.avail_out),s=r+(e.avail_out-257),a=N.dmax,c=N.wsize,u=N.whave,l=N.wnext,h=N.window,d=N.hold,_=N.bits,f=N.lencode,p=N.distcode,E=(1<<N.lenbits)-1,g=(1<<N.distbits)-1;e:do for(_<15&&(d+=S[n++]<<_,_+=8,d+=S[n++]<<_,_+=8),v=f[d&E];;){if(d>>>=m=v>>>24,_-=m,0==(m=v>>>16&255))w[r++]=65535&v;else{if(!(16&m)){if(64&m){if(32&m){N.mode=16191;break e}e.msg="invalid literal/length code",N.mode=16209;break e}v=f[(65535&v)+(d&(1<<m)-1)];continue}for(y=65535&v,(m&=15)&&(_<m&&(d+=S[n++]<<_,_+=8),y+=d&(1<<m)-1,d>>>=m,_-=m),_<15&&(d+=S[n++]<<_,_+=8,d+=S[n++]<<_,_+=8),v=p[d&g];;){if(d>>>=m=v>>>24,_-=m,16&(m=v>>>16&255)){if(b=65535&v,_<(m&=15)&&(d+=S[n++]<<_,(_+=8)<m&&(d+=S[n++]<<_,_+=8)),(b+=d&(1<<m)-1)>a){e.msg="invalid distance too far back",N.mode=16209;break e}if(d>>>=m,_-=m,b>(m=r-o)){if((m=b-m)>u&&N.sane){e.msg="invalid distance too far back",N.mode=16209;break e}if(T=0,C=h,0===l){if(T+=c-m,m<y){y-=m;do w[r++]=h[T++];while(--m);T=r-b,C=w}}else if(l<m){if(T+=c+l-m,(m-=l)<y){y-=m;do w[r++]=h[T++];while(--m);if(T=0,l<y){y-=m=l;do w[r++]=h[T++];while(--m);T=r-b,C=w}}}else if(T+=l-m,m<y){y-=m;do w[r++]=h[T++];while(--m);T=r-b,C=w}for(;y>2;)w[r++]=C[T++],w[r++]=C[T++],w[r++]=C[T++],y-=3;y&&(w[r++]=C[T++],y>1&&(w[r++]=C[T++]))}else{T=r-b;do w[r++]=w[T++],w[r++]=w[T++],w[r++]=w[T++],y-=3;while(y>2);y&&(w[r++]=w[T++],y>1&&(w[r++]=w[T++]))}break}if(64&m){e.msg="invalid distance code",N.mode=16209;break e}v=p[(65535&v)+(d&(1<<m)-1)]}}break}while(n<i&&r<s);n-=y=_>>3,_-=y<<3,d&=(1<<_)-1,e.next_in=n,e.next_out=r,e.avail_in=n<i?i-n+5:5-(n-i),e.avail_out=r<s?s-r+257:257-(r-s),N.hold=d,N.bits=_};let iu=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),il=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),ih=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),id=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]);var i_=(e,t,n,i,r,o,s,a)=>{let c=a.bits,u,l,h,d,_,f,p=0,E=0,g=0,v=0,m=0,y=0,b=0,T=0,C=0,S=0,w=null,N=new Uint16Array(16),A=new Uint16Array(16),I,D,O,k=null;for(p=0;p<=15;p++)N[p]=0;for(E=0;E<i;E++)N[t[n+E]]++;for(m=c,v=15;v>=1&&0===N[v];v--);if(m>v&&(m=v),0===v)return r[o++]=20971520,r[o++]=20971520,a.bits=1,0;for(g=1;g<v&&0===N[g];g++);for(m<g&&(m=g),T=1,p=1;p<=15;p++)if(T<<=1,(T-=N[p])<0)return -1;if(T>0&&(0===e||1!==v))return -1;for(A[1]=0,p=1;p<15;p++)A[p+1]=A[p]+N[p];for(E=0;E<i;E++)0!==t[n+E]&&(s[A[t[n+E]]++]=E);if(0===e?(w=k=s,f=20):1===e?(w=iu,k=il,f=257):(w=ih,k=id,f=0),S=0,E=0,p=g,_=o,y=m,b=0,h=-1,d=(C=1<<m)-1,1===e&&C>852||2===e&&C>592)return 1;for(;;){I=p-b,s[E]+1<f?(D=0,O=s[E]):s[E]>=f?(D=k[s[E]-f],O=w[s[E]-f]):(D=96,O=0),u=1<<p-b,g=l=1<<y;do r[_+(S>>b)+(l-=u)]=I<<24|D<<16|O;while(0!==l);for(u=1<<p-1;S&u;)u>>=1;if(0!==u?(S&=u-1,S+=u):S=0,E++,0==--N[p]){if(p===v)break;p=t[n+s[E]]}if(p>m&&(S&d)!==h){for(0===b&&(b=m),_+=g,T=1<<(y=p-b);y+b<v&&!((T-=N[y+b])<=0);)y++,T<<=1;if(C+=1<<y,1===e&&C>852||2===e&&C>592)return 1;r[h=S&d]=m<<24|y<<16|_-o}}return 0!==S&&(r[_+S]=p-b<<24|4194304),a.bits=m,0};let{Z_FINISH:ip,Z_BLOCK:iE,Z_TREES:ig,Z_OK:iv,Z_STREAM_END:im,Z_NEED_DICT:iy,Z_STREAM_ERROR:ib,Z_DATA_ERROR:iT,Z_MEM_ERROR:iC,Z_BUF_ER
vendor: 9,107 bytes, line 1
1ROR:iS,Z_DEFLATED:iw}=nr,iN=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function iA(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}let iI=e=>{if(!e)return 1;let t=e.state;return!t||t.strm!==e||t.mode<16180||t.mode>16211?1:0},iD=e=>{if(iI(e))return ib;let t=e.state;return e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=1&t.wrap),t.mode=16180,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,iv},iO=e=>{if(iI(e))return ib;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,iD(e)},ik=(e,t)=>{let n;if(iI(e))return ib;let i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?ib:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,iO(e))},iR,iL,iU=!0,ix=e=>{if(iU){iR=new Int32Array(512),iL=new Int32Array(32);let t=0;for(;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(i_(1,e.lens,0,288,iR,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;i_(2,e.lens,0,32,iL,0,e.work,{bits:5}),iU=!1}e.lencode=iR,e.lenbits=9,e.distcode=iL,e.distbits=5},iP=(e,t,n,i)=>{let r;let o=e.state;return null===o.window&&(o.wsize=1<<o.wbits,o.wnext=0,o.whave=0,o.window=new Uint8Array(o.wsize)),i>=o.wsize?(o.window.set(t.subarray(n-o.wsize,n),0),o.wnext=0,o.whave=o.wsize):((r=o.wsize-o.wnext)>i&&(r=i),o.window.set(t.subarray(n-i,n-i+r),o.wnext),(i-=r)?(o.window.set(t.subarray(n-i,n),0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave<o.wsize&&(o.whave+=r))),0};var iM={inflateReset:iO,inflateInit2:(e,t)=>{if(!e)return ib;let n=new iA;e.state=n,n.strm=e,n.window=null,n.mode=16180;let i=ik(e,t);return i!==iv&&(e.state=null),i},inflate:(e,t)=>{let n,i,r,o,s,a,c,u,l,h,d,_,f,p,E,g,v,m,y,b,T,C,S,w,N=0,A=new Uint8Array(4),I=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(iI(e)||!e.output||!e.input&&0!==e.avail_in)return ib;16191===(r=e.state).mode&&(r.mode=16192),c=e.next_out,s=e.output,l=e.avail_out,a=e.next_in,o=e.input,u=e.avail_in,h=r.hold,d=r.bits,_=u,f=l,w=iv;e:for(;;)switch(r.mode){case 16180:if(0===r.wrap){r.mode=16192;break}for(;d<16;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(2&r.wrap&&35615===h){0===r.wbits&&(r.wbits=15),r.check=0,A[0]=255&h,A[1]=h>>>8&255,r.check=nn(r.check,A,2,0),h=0,d=0,r.mode=16181;break}if(r.head&&(r.head.done=!1),!(1&r.wrap)||(((255&h)<<8)+(h>>8))%31){e.msg="incorrect header check",r.mode=16209;break}if((15&h)!==iw){e.msg="unknown compression method",r.mode=16209;break}if(h>>>=4,d-=4,S=8+(15&h),0===r.wbits&&(r.wbits=S),S>15||S>r.wbits){e.msg="invalid window size",r.mode=16209;break}r.dmax=1<<r.wbits,r.flags=0,e.adler=r.check=1,r.mode=512&h?16189:16191,h=0,d=0;break;case 16181:for(;d<16;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(r.flags=h,(255&r.flags)!==iw){e.msg="unknown compression method",r.mode=16209;break}if(57344&r.flags){e.msg="unknown header flags set",r.mode=16209;break}r.head&&(r.head.text=h>>8&1),512&r.flags&&4&r.wrap&&(A[0]=255&h,A[1]=h>>>8&255,r.check=nn(r.check,A,2,0)),h=0,d=0,r.mode=16182;case 16182:for(;d<32;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.head&&(r.head.time=h),512&r.flags&&4&r.wrap&&(A[0]=255&h,A[1]=h>>>8&255,A[2]=h>>>16&255,A[3]=h>>>24&255,r.check=nn(r.check,A,4,0)),h=0,d=0,r.mode=16183;case 16183:for(;d<16;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.head&&(r.head.xflags=255&h,r.head.os=h>>8),512&r.flags&&4&r.wrap&&(A[0]=255&h,A[1]=h>>>8&255,r.check=nn(r.check,A,2,0)),h=0,d=0,r.mode=16184;case 16184:if(1024&r.flags){for(;d<16;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.length=h,r.head&&(r.head.extra_len=h),512&r.flags&&4&r.wrap&&(A[0]=255&h,A[1]=h>>>8&255,r.check=nn(r.check,A,2,0)),h=0,d=0}else r.head&&(r.head.extra=null);r.mode=16185;case 16185:if(1024&r.flags&&((p=r.length)>u&&(p=u),p&&(r.head&&(S=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(o.subarray(a,a+p),S)),512&r.flags&&4&r.wrap&&(r.check=nn(r.check,o,p,a)),u-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=16186;case 16186:if(2048&r.flags){if(0===u)break e;p=0;do S=o[a+p++],r.head&&S&&r.length<65536&&(r.head.name+=String.fromCharCode(S));while(S&&p<u);if(512&r.flags&&4&r.wrap&&(r.check=nn(r.check,o,p,a)),u-=p,a+=p,S)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=16187;case 16187:if(4096&r.flags){if(0===u)break e;p=0;do S=o[a+p++],r.head&&S&&r.length<65536&&(r.head.comment+=String.fromCharCode(S));while(S&&p<u);if(512&r.flags&&4&r.wrap&&(r.check=nn(r.check,o,p,a)),u-=p,a+=p,S)break e}else r.head&&(r.head.comment=null);r.mode=16188;case 16188:if(512&r.flags){for(;d<16;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(4&r.wrap&&h!==(65535&r.check)){e.msg="header crc mismatch",r.mode=16209;break}h=0,d=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=16191;break;case 16189:for(;d<32;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}e.adler=r.check=iN(h),h=0,d=0,r.mode=16190;case 16190:if(0===r.havedict)return e.next_out=c,e.avail_out=l,e.next_in=a,e.avail_in=u,r.hold=h,r.bits=d,iy;e.adler=r.check=1,r.mode=16191;case 16191:if(t===iE||t===ig)break e;case 16192:if(r.last){h>>>=7&d,d-=7&d,r.mode=16206;break}for(;d<3;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}switch(r.last=1&h,d-=1,3&(h>>>=1)){case 0:r.mode=16193;break;case 1:if(ix(r),r.mode=16199,t===ig){h>>>=2,d-=2;break e}break;case 2:r.mode=16196;break;case 3:e.msg="invalid block type",r.mode=16209}h>>>=2,d-=2;break;case 16193:for(h>>>=7&d,d-=7&d;d<32;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if((65535&h)!=(h>>>16^65535)){e.msg="invalid stored block lengths",r.mode=16209;break}if(r.length=65535&h,h=0,d=0,r.mode=16194,t===ig)break e;case 16194:r.mode=16195;case 16195:if(p=r.length){if(p>u&&(p=u),p>l&&(p=l),0===p)break e;s.set(o.subarray(a,a+p),c),u-=p,a+=p,l-=p,c+=p,r.length-=p;break}r.mode=16191;break;case 16196:for(;d<14;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(r.nlen=257+(31&h),h>>>=5,d-=5,r.ndist=1+(31&h),h>>>=5,d-=5,r.ncode=4+(15&h),h>>>=4,d-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=16209;break}r.have=0,r.mode=16197;case 16197:for(;r.have<r.ncode;){for(;d<3;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.lens[I[r.have++]]=7&h,h>>>=3,d-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,n={bits:r.lenbits},w=i_(0,r.lens,0,19,r.lencode,0,r.work,n),r.lenbits=n.bits,w){e.msg="invalid code lengths set",r.mode=16209;break}r.have=0,r.mode=16198;case 16198:for(;r.have<r.nlen+r.ndist;){for(;v=(N=r.lencode[h&(1<<r.lenbits)-1])>>>24,m=N>>>16&255,y=65535&N,!(v<=d);){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(y<16)h>>>=v,d-=v,r.lens[r.have++]=y;else{if(16===y){for(i=v+2;d<i;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(h>>>=v,d-=v,0===r.have){e.msg="invalid bit length repeat",r.mode=16209;break}S=r.lens[r.have-1],p=3+(3&h),h>>>=2,d-=2}else if(17===y){for(i=v+3;d<i;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}h>>>=v,d-=v,S=0,p=3+(7&h),h>>>=3,d-=3}else{for(i=v+7;d<i;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}h>>>=v,d-=v,S=0,p=11+(127&h),h>>>=7,d-=7}if(r.have+p>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=16209;break}for(;p--;)r.lens[r.have++]=S}}if(16209===r.mode)break;if(0===r.lens[256]){e.msg="invalid code -- missing end-of-block",r.mode=16209;break}if(r.lenbits=9,n={bits:r.lenbits},w=i_(1,r.lens,0,r.nlen,r.lencode,0,r.work,n),r.lenbits=n.bits,w){e.msg="invalid literal/lengths set",r.mode=16209;break}if(r.distbits=6,r.distcode=r.distdyn,n={bits:r.distbits},w=i_(2,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,n),r.distbits=n.bits,w){e.msg="invalid distances set",r.mode=16209;break}if(r.mode=16199,t===ig)break e;case 16199:r.mode=16200;case 16200:if(u>=6&&l>=258){e.next_out=c,e.avail_out=l,e.next_in=a,e.avail_in=u,r.hold=h,r.bits=d,ic(e,f),c=e.next_out,s=e.output,l=e.avail_out,a=e.next_in,o=e.input,u=e.avail_in,h=r.hold,d=r.bits,16191===r.mode&&(r.back=-1);break}for(r.back=0;v=(N=r.lencode[h&(1<<r.lenbits)-1])>>>24,m=N>>>16&255,y=65535&N,!(v<=d);){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(m&&!(240&m)){for(b=v,T=m,C=y;v=(N=r.lencode[C+((h&(1<<b+T)-1)>>b)])>>>24,m=N>>>16&255,y=65535&N,!(b+v<=d);){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}h>>>=b,d-=b,r.back+=b}if(h>>>=v,d-=v,r.back+=v,r.length=y,0===m){r.mode=16205;break}if(32&m){r.back=-1,r.mode=16191;break}if(64&m){e.msg="invalid literal/length code",r.mode=16209;break}r.extra=15&m,r.mode=16201;case 16201:if(r.extra){for(i=r.extra;d<i;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.length+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=16202;case 16202:for(;
1v=(N=r.distcode[h&(1<<r.distbits)-1])>>>24,m=N>>>16&255,y=65535&N,!(v<=d);){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(!(240&m)){for(b=v,T=m,C=y;v=(N=r.distcode[C+((h&(1<<b+T)-1)>>b)])>>>24,m=N>>>16&255,y=65535&N,!(b+v<=d);){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}h>>>=b,d-=b,r.back+=b}if(h>>>=v,d-=v,r.back+=v,64&m){e.msg="invalid distance code",r.mode=16209;break}r.offset=y,r.extra=15&m,r.mode=16203;case 16203:if(r.extra){for(i=r.extra;d<i;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}r.offset+=h&(1<<r.extra)-1,h>>>=r.extra,d-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=16209;break}r.mode=16204;case 16204:if(0===l)break e;if(p=f-l,r.offset>p){if((p=r.offset-p)>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=16209;break}p>r.wnext?(p-=r.wnext,E=r.wsize-p):E=r.wnext-p,p>r.length&&(p=r.length),g=r.window}else g=s,E=c-r.offset,p=r.length;p>l&&(p=l),l-=p,r.length-=p;do s[c++]=g[E++];while(--p);0===r.length&&(r.mode=16200);break;case 16205:if(0===l)break e;s[c++]=r.length,l--,r.mode=16200;break;case 16206:if(r.wrap){for(;d<32;){if(0===u)break e;u--,h|=o[a++]<<d,d+=8}if(f-=l,e.total_out+=f,r.total+=f,4&r.wrap&&f&&(e.adler=r.check=r.flags?nn(r.check,s,f,c-f):ne(r.check,s,f,c-f)),f=l,4&r.wrap&&(r.flags?h:iN(h))!==r.check){e.msg="incorrect data check",r.mode=16209;break}h=0,d=0}r.mode=16207;case 16207:if(r.wrap&&r.flags){for(;d<32;){if(0===u)break e;u--,h+=o[a++]<<d,d+=8}if(4&r.wrap&&h!==(4294967295&r.total)){e.msg="incorrect length check",r.mode=16209;break}h=0,d=0}r.mode=16208;case 16208:w=im;break e;case 16209:w=iT;break e;case 16210:return iC;default:return ib}return e.next_out=c,e.avail_out=l,e.next_in=a,e.avail_in=u,r.hold=h,r.bits=d,(r.wsize||f!==e.avail_out&&r.mode<16209&&(r.mode<16206||t!==ip))&&iP(e,e.output,e.next_out,f-e.avail_out),_-=e.avail_in,f-=e.avail_out,e.total_in+=_,e.total_out+=f,r.total+=f,4&r.wrap&&f&&(e.adler=r.check=r.flags?nn(r.check,s,f,e.next_out-f):ne(r.check,s,f,e.next_out-f)),e.data_type=r.bits+(r.last?64:0)+(16191===r.mode?128:0)+(16199===r.mode||16194===r.mode?256:0),(0===_&&0===f||t===ip)&&w===iv&&(w=iS),w},inflateEnd:e=>{if(iI(e))return ib;let t=e.state;return t.window&&(t.window=null),e.state=null,iv},inflateGetHeader:(e,t)=>{if(iI(e))return ib;let n=e.state;return 2&n.wrap?(n.head=t,t.done=!1,iv):ib},inflateSetDictionary:(e,t)=>{let n;let i=t.length;return iI(e)?ib:0!==(n=e.state).wrap&&16190!==n.mode?ib:16190===n.mode&&ne(1,t,i,0)!==n.check?iT:iP(e,t,i,i)?(n.mode=16210,iC):(n.havedict=1,iv)}},iq=function(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1};let iF=Object.prototype.toString,{Z_NO_FLUSH:iH,Z_FINISH:iV,Z_OK:iG,Z_STREAM_END:iz,Z_NEED_DICT:ij,Z_STREAM_ERROR:iK,Z_DATA_ERROR:iB,Z_MEM_ERROR:iQ}=nr;function iW(e){this.options=nX({chunkSize:65536,windowBits:15,to:""},e||{});let t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,0===t.windowBits&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||e&&e.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(15&t.windowBits||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n4,this.strm.avail_out=0;let n=iM.inflateInit2(this.strm,t.windowBits);if(n!==iG||(this.header=new iq,iM.inflateGetHeader(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=n1(t.dictionary):"[object ArrayBuffer]"===iF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=iM.inflateSetDictionary(this.strm,t.dictionary))!==iG)))throw Error(ni[n])}function iZ(e,t){let n=new iW(t);if(n.push(e),n.err)throw n.msg||ni[n.err];return n.result}iW.prototype.push=function(e,t){let n,i,r;let o=this.strm,s=this.options.chunkSize,a=this.options.dictionary;if(this.ended)return!1;for(i=t===~~t?t:!0===t?iV:iH,"[object ArrayBuffer]"===iF.call(e)?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;;){for(0===o.avail_out&&(o.output=new Uint8Array(s),o.next_out=0,o.avail_out=s),(n=iM.inflate(o,i))===ij&&a&&((n=iM.inflateSetDictionary(o,a))===iG?n=iM.inflate(o,i):n===iB&&(n=ij));o.avail_in>0&&n===iz&&o.state.wrap>0&&0!==e[o.next_in];)iM.inflateReset(o),n=iM.inflate(o,i);switch(n){case iK:case iB:case ij:case iQ:return this.onEnd(n),this.ended=!0,!1}if(r=o.avail_out,o.next_out&&(0===o.avail_out||n===iz)){if("string"===this.options.to){let e=n3(o.output,o.next_out),t=o.next_out-e,n=n2(o.output,e);o.next_out=t,o.avail_out=s-t,t&&o.output.set(o.output.subarray(e,e+t),0),this.onData(n)}else this.onData(o.output.length===o.next_out?o.output:o.output.subarray(0,o.next_out))}if(n!==iG||0!==r){if(n===iz)return n=iM.inflateEnd(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===o.avail_in)break}}return!0},iW.prototype.onData=function(e){this.chunks.push(e)},iW.prototype.onEnd=function(e){e===iG&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=nJ(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};let{Deflate:iY,deflate:iX,deflateRaw:iJ,gzip:i$}={Deflate:is,deflate:ia,deflateRaw:function(e,t){return(t=t||{}).raw=!0,ia(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,ia(e,t)},constants:nr},{Inflate:i0,inflate:i1,inflateRaw:i2,ungzip:i3}={Inflate:iW,inflate:iZ,inflateRaw:function(e,t){return(t=t||{}).raw=!0,iZ(e,t)},ungzip:iZ,constants:nr};var i4,i5,i6,i8,i9,i7=function(e){return d(void 0,void 0,void 0,function(){var t;return _(this,function(n){if(t=i3(e),"undefined"!=typeof TextDecoder)try{return[2,new TextDecoder("utf-8").decode(new Uint8Array(t))]}catch(e){}return[2,Array.from({length:Math.ceil(t.length/8192)},function(e,n){var i=8192*n,r=t.slice(i,i+8192);return String.fromCharCode.apply(null,r)}
1).join("")]})})},re=function(e){return d(void 0,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,e()];case 1:return n.sent(),[3,3];case 2:if(!((t=n.sent())instanceof D))throw t;return t.throwOutside(),[3,3];case 3:return[2]}})})},rt=function(e){return d(void 0,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e()];case 1:case 2:return t.sent(),[3,3];case 3:return[2]}})})},rn=function(e){function t(t){var n=e.call(this)||this;return n.retryAfterTime=1e3*t.retry_after,n.reasonCode=t.reason_code,n.message=t.message,n}return u(t,e),t}(eS);(ri=i9||(i9={})).CONNECTING="CONNECTING",ri.OPEN="OPEN",ri.CLOSED="CLOSED";var ri,rr,ro=function(e){function t(t,n){var i=n.sdkState,r=n.dispatcher,o=n.logger,s=e.call(this)||this;return s.lastActive=0,s._iid=t,s._sdkState=i,s._dispatcher=r,s._logger=o,s}return u(t,e),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this.connectionState===i9.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return i9.CONNECTING;case 1:return i9.OPEN}return i9.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ws",{get:function(){var e;return null!==(e=this._ws)&&void 0!==e?e:null},enumerable:!1,configurable:!0}),t.prototype._handleMessage=function(e){var t=this;e.split("\n").forEach(function(e){if(e){var n=th.createFromRawMessage(t._iid,e);if(t._logger.debug("receive websocket event",n),"LOGI"===n.code)t.dispatch("message",n);else if("PONG"===n.code)t.dispatch("pong");else if("EXPR"===n.code){if(n.payload){var i=new tl(n.payload);i.expiresIn>=0&&t._dispatcher.dispatch(i)}}else if("BUSY"===n.code){if(n.payload){var r=new rn(n.payload);t._dispatcher.dispatch(r)}}else"NOOP"===n.code||t.dispatch("message",n)}})},t.prototype.connect=function(e,t){return void 0===t&&(t=""),d(this,void 0,void 0,function(){var i=this;return _(this,function(r){switch(r.label){case 0:return"function"==typeof fetch?[3,2]:[4,n.e(3789).then(n.bind(n,73789))];case 1:r.sent(),r.label=2;case 2:return rt(function(){return d(i,void 0,void 0,function(){return _(this,function(e){return fetch(this._sdkState.api.host),[2]})})}),this._ws=new WebSocket(e,encodeURIComponent(t)),this._ws.onopen=function(){i._logger.debug("websocket open"),i.dispatch("open")},this._ws.onmessage=function(e){return d(i,void 0,void 0,function(){var t,n,i,r,o,s,c=this;return _(this,function(u){switch(u.label){case 0:return(null===(s=this._sdkState.websocket)||void 0===s?void 0:s.compression)?e.data instanceof Blob?((t=new FileReader).readAsArrayBuffer(e.data),t.onloadend=function(){return d(c,void 0,void 0,function(){var e,n;return _(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,i7(t.result)];case 1:return e=i.sent(),this._handleMessage(e),[3,3];case 2:return n=i.sent(),this.error(n),[3,3];case 3:return[2]}})})},[3,12]):[3,1]:[3,13];case 1:if(!(e.data instanceof ArrayBuffer))return[3,6];u.label=2;case 2:return u.trys.push([2,4,,5]),[4,i7(new Uint8Array(e.data))];case 3:return r=u.sent(),this._handleMessage(r),[3,5];case 4:return n=u.sent(),this.error(n),[3,5];case 5:return[3,12];case 6:if(!(void 0!==a&&e.data instanceof a))return[3,11];u.label=7;case 7:return u.trys.push([7,9,,10]),[4,i7((i=e.data).buffer.slice(i.byteOffset,i.byteOffset+i.byteLength))];case 8:return r=u.sent(),this._handleMessage(r),[3,10];case 9:return o=u.sent(),this.error(o),[3,10];case 10:return[3,12];case 11:"string"==typeof e.data&&this._handleMessage(e.data),u.label=12;case 12:return[3,14];case 13:this._handleMessage(e.data),u.label=14;case 14:return[2]}})})},this._ws.onerror=function(){i._logger.debug("websocket error"),i.dispatch("error",D.networkError)},this._ws.onclose=function(e){i._logger.debug("websocket close",e.code,e.reason),i.cleanUpWebSocket(),i.dispatch("close")},this.lastActive=Date.now(),[2]}})})},t.prototype.cleanUpWebSocket=function(){this._ws&&(this._ws.onopen=tL,this._ws.onmessage=tL,this._ws.onerror=tL,this._ws.onclose
1=tL,this.connectionState===i9.OPEN&&this._ws.close(1e3,"Normal Closure"),this._ws=void 0)},t.prototype.disconnect=function(){var e=this;return new Promise(function(t){if(e._ws){if(e.connectionState===i9.CLOSED)return e.cleanUpWebSocket(),void t();e._ws.onclose=null,e._ws.onclose=function(){e.cleanUpWebSocket(),e.dispatch("close"),t()},e._ws.close()}else t()})},t.prototype.send=function(e){if(!this._ws)throw D.connectionClosed;"PING"!==e.code?this.dispatch("ping-refresh"):this._logger.debug("send ping",e),this._ws.send(e.convertToMessage())},t.prototype.error=function(e){this._logger.debug("websocket error",e),this.dispatch("error",e)},t}(eT),rs=function(e){function t(t){var n=t.all,i=t.feed,r=t.custom_types,o=t.ts,s=e.call(this)||this;return s.all=n,s.feed=i,s.customTypes=r,s.ts=o,s}return u(t,e),t}(eS),ra=function(e){function t(t){var n=t.previousMessageId,i=t.messageCreatedAt,r=t.channelUrl,o=e.call(this)||this;return o.previousMessageId=n,o.messageCreatedAt=i,o.channelUrl=r,o}return u(t,e),t}(eS),rc=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,o=t.logger,s=t.useFetchCompat,a=this;this._ackStateMap=new Map,this._batchableCommandAckStateMap=new Map,this._redundantActionCommands=new Map,this._sdkState=i,this._dispatcher=r,this._logger=o,this.apiClient=new tR(e,{session:n,sdkState:i,dispatcher:r,logger:o,useFetchCompat:void 0!==s&&s}),this.websocketClient=new ro(e,{sdkState:i,dispatcher:r,logger:o}),this.websocketClient.on("message",function(e){var t,n;if(e.payload.unread_cnt&&a._dispatcher.dispatch(new rs(e.payload.unread_cnt)),("MESG"===e.code||"FILE"===e.code||"ADMM"===e.code||"BRDM"===e.code)&&e.payload.channel_type===es.GROUP&&e.payload.previous_message_id&&a._dispatcher.dispatch(new ra({previousMessageId:e.payload.previous_message_id,messageCreatedAt:e.payload.ts,channelUrl:e.payload.channel_url})),e.requestId){if(a._ackStateMap.has(e.requestId)){var i=a._ackStateMap.get(e.requestId);"EROR"!==e.code?i.resolve(e):i.reject(new D({code:e.payload.code,message:e.payload.message}))}else if(a._batchableCommandAckStateMap.has(e.requestId)){var r=Date.now();try{for(var o=f(a._batchableCommandAckStateMap.entries()),s=o.next();!s.done;s=o.next()){var c=p(s.value,2),u=(c[0],c[1]);u.channelUrl===e.payload.channel_url&&u.requestTime<r&&(i=u.ackState,"EROR"!==e.code?i.resolve(e):i.reject(new D({code:e.payload.code,message:e.payload.message})))}}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=o.return)&&n.call(o)}finally{if(t)throw t.error}}}}else if(a._redundantActionCommands.has(e.payload.unique_id)){var l=a._redundantActionCommands.get(e.payload.unique_id),h=null==l?void 0:l.indexOf(e.code);-1!==h&&(null==l||l.splice(h,1)),0===l.length&&a._redundantActionCommands.delete(e.payload.unique_id)}else a._dispatcher.dispatch(e)}).on("close",function(){a._ackStateMap.forEach(function(e){e.reject(D.connectionClosed)}),a._ackStateMap.clear(),a._batchableCommandAckStateMap.clear(),a._redundantActionCommands.clear()})}return e.prototype._sendApiRequest=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return e.params.unique_id&&this._redundantActionCommands.set(e.params.unique_id,["SYEV","READ"]),[4,this.apiClient.send(e)];case 1:return[2,t.sent()]}})})},e.prototype._sendWebsocketRequest=function(e){return d(this,void 0,void 0,function(){var t,n,i,r=this;return _(this,function(o){if(!this._sdkState.websocket)throw D.connectionRequired;if(t=new tI,e.ackRequired){i=function(i,o){var s="READ"===e.code?r._batchableCommandAckStateMap:r._ackStateMap;s.has(e.requestId)&&(s.delete(e.requestId),n&&(clearTimeout(n),n=null),i?(r._logger.debug("fail websocket request",e.requestId,i),t.reject(i)):(r._logger.debug("receive websocket ack",e.requestId,e),r._logger.debug("receive websocket ack",o),t.resolve(o)))};try{n=setTimeout(function(){return i(D.noAckTimeout)},this._sdkState.websocket.responseTimeout),"READ"===e.code?this._batchableCommandAckStateMap.set(e.requestId,{ackState:{resolve:function(e){return i(void 0,e)},reject:function(e){return i(e)}},channelUrl:e.payload.channel_url,requestTime:Date.now()}):this._ackStateMap.set(e.requestId,{resolve:function(e){return i(void 0,e)},reject:function(e){return i(e)}}),this.websocketClient.send(e)}catch(e){i(e)}}else try{this.websocketClient.send(e),t.resolve()}catch(e){t.reject(e)}return[2,t.promise]})})},e.prototype.send=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return e instanceof ta?[4,this._sendApiRequest(e)]:[3,2];case 1:case 3:return[2,t.sent()];
1case 2:return e instanceof td?[4,this._sendWebsocketRequest(e)]:[3,4];case 4:throw D.invalidParameters}})})},e.prototype.cancel=function(e){this.apiClient.cancel(e)},e.prototype.cancelAll=function(){this.apiClient.cancelAll()},e}();(ru=rr||(rr={}))[ru.NONE=0]="NONE",ru[ru.INITIALIZED=1]="INITIALIZED",ru[ru.CONNECTING=2]="CONNECTING",ru[ru.CONNECTED=3]="CONNECTED",ru[ru.RECONNECTING=4]="RECONNECTING",ru[ru.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",ru[ru.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",ru[ru.LOGOUT=7]="LOGOUT",ru[ru.DELAYED_CONNECTING=8]="DELAYED_CONNECTING";var ru,rl,rh,rd=function(e){function t(t){var n=t.stateType,i=e.call(this)||this;return i.stateType=n,i}return u(t,e),t}(eS),r_=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(eS),rf=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(eS),rp=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return u(t,e),t}(eS),rE=function(){function e(e){var t,n,i,r;this.isEnabled=null!==(t=e.enabled)&&void 0!==t&&t,this.feedChannels=null!==(n=e.feed_channels)&&void 0!==n?n:{},this.templateListToken=null!==(i=e.template_list_token)&&void 0!==i?i:null,this.settingsUpdatedAt=null!==(r=e.settings_updated_at)&&void 0!==r?r:0}return e.payloadify=function(e){return ew(eN({enabled:e.isEnabled,feed_channels:e.feedChannels,template_list_token:e.templateListToken,settings_updated_at:e.settingsUpdatedAt}))},e}(),rg=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},rv=function(){function e(e){var t;this.lastUpdatedAt=null!==(t=e.last_updated_at)&&void 0!==t?t:0}return e.payloadify=function(e){return ew(eN({last_updated_at:e.lastUpdatedAt}))},e}(),rm=function(){function e(e){var t;this.token=null!==(t=e.template_list_token)&&void 0!==t?t:""}return e.payloadify=function(e){return ew(eN({template_list_token:e.token}))},e}(),ry=function(){function e(e){void 0===e&&(e={min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}),this.minStatCount=e.min_stat_count,this.minInterval=1e3*e.min_interval,this.maxStatCountPerRequest=e.max_stat_count_per_request,this.lowerThreshold=e.lower_threshold,this.requestDelayRange=1e3*e.request_delay_range}return e.payloadify=function(e){return ew(eN({min_stat_count:e.minStatCount,min_interval:e.minInterval/1e3,max_stat_count_per_request:e.maxStatCountPerRequest,lower_threshold:e.lowerThreshold,request_delay_range:e.requestDelayRange/1e3}))},e}(),rb=function(){function e(e){void 0===e&&(e={default:{min_stat_count:100,min_interval:10800,max_stat_count_per_request:1e3,lower_threshold:10,request_delay_range:180}}),this.default=new ry(e.default),this.realTime=new ry(e.realtime)}return e.payloadify=function(e){return ew(eN({default:ry.payloadify(e.default),realtime:ry.payloadify(e.realTime)}))},e}(),rT=function(){function e(e){var t;this.templateListToken=null!==(t=e.template_list_token)&&void 0!==t?t:null}return e.payloadify=function(e){return ew(eN({template_list_token:e.templateListToken}))},e}(),rC=function(){function e(e){this.enabled=e.enabled,this.orderBy=e.order_by.type,this.excludeRecentHours=e.order_by.exclude_recent_hours,this.bufferRatio=e.buffer_ratio}return e.payloadify=function(e){return ew(eN({enabled:e.enabled,order_by:{type:e.orderBy,exclude_recent_hours:e.excludeRecentHours},buffer_ratio:e.bufferRatio}))},e}(),rS=5;(rU=rl||(rl={}))[rU.NONE=0]="NONE",rU[rU.INCLUDE_REPLY=1]="INCLUDE_REPLY",rU[rU.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",rU[rU.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL",(rx=rh||(rh={}))[rx.NONE=0]="NONE",rx[rx.INCLUDE_REPLY=1]="INCLUDE_REPLY",rx[rx.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",rx[rx.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL";var rw=function(){function e(e){var t,n,i,r,o,s,a,c,u,l,h;void 0===e&&(e={}),this.emojiHash=e.emoji_hash||"",this.uploadSizeLimit=e.file_upload_size_limit?1048576*e.file_upload_size_limit:Number.MAX_SAFE_INTEGER,this.useReaction=!!e.use_reaction,this.applicationAttributes=null!==(t=e.application_attributes)&&void 0!==t?t:[],this.premiumFeatureList=null!==(n=e.premium_feature_list)&&void 0!==n?n:[],this.deviceTokenCache=this.applicationAttributes.includes("sdk_device_token_cac
1he"),this.enabledChannelMemberShipHistory=this.applicationAttributes.includes("channel_membership_history"),this.multipleFilesMessageFileCountLimit=null!==(i=e.multiple_file_send_max_size)&&void 0!==i?i:5,this.allowSdkStatsUpload=null===(r=e.allow_sdk_log_ingestion)||void 0===r||r,this.unreadCountThreadingPolicy=null!==(o=e.unread_cnt_threading_policy)&&void 0!==o?o:rl.NONE,this.lastMessageThreadingPolicy=null!==(s=e.last_msg_threading_policy)&&void 0!==s?s:rh.NONE,this.channelRotationInfo=e.channel_rotation?new rC(e.channel_rotation):null,this.uikitConfigInfo=new rv(null!==(a=e.uikit_config)&&void 0!==a?a:{}),this.notificationInfo=e.notifications?new rE(e.notifications):null,this.messageTemplateInfo=e.message_template?new rm(e.message_template):null,this.aiAgentInfo=e.ai_agent?new rT(e.ai_agent):null,this.statConfigInfo=e.log_publish_config?new rb(e.log_publish_config):new rb,this.disableSuperGroupMack=null!==(c=e.disable_supergroup_mack)&&void 0!==c&&c,this.configSyncNeeded=null!==(u=e.config_sync_needed)&&void 0!==u&&u,this.requestDedupIntervalMs=null!==(l=e.request_dedup_interval_ms)&&void 0!==l?l:500,this.backgroundConnectionCloseTimeout=null!==(h=e.sdk_background_connection_close_timeout)&&void 0!==h?h:30}return e.payloadify=function(e){return ew(eN({emoji_hash:e.emojiHash,file_upload_size_limit:e.uploadSizeLimit/1048576,application_attributes:e.applicationAttributes,premium_feature_list:e.premiumFeatureList,use_reaction:e.useReaction,allow_sdk_log_ingestion:e.allowSdkStatsUpload,unread_cnt_threading_policy:e.unreadCountThreadingPolicy,last_msg_threading_policy:e.lastMessageThreadingPolicy,channel_rotation:e.channelRotationInfo?rC.payloadify(e.channelRotationInfo):null,uikit_config:e.uikitConfigInfo?rv.payloadify(e.uikitConfigInfo):null,notifications:e.notificationInfo?rE.payloadify(e.notificationInfo):null,message_template:e.messageTemplateInfo?rm.payloadify(e.messageTemplateInfo):null,log_publish_config:e.statConfigInfo?rb.payloadify(e.statConfigInfo):null,disable_supergroup_mack:e.disableSuperGroupMack,config_sync_needed:e.configSyncNeeded,request_dedup_interval_ms:e.requestDedupIntervalMs,sdk_background_connection_close_timeout:e.backgroundConnectionCloseTimeout}))},e}(),rN=function(e){return"sendbird@".concat(e,"/app_configs_info")},rA=function(){function e(e){this._iid="",this._iid=e}return e.payloadify=function(e){return{}},e}(),rI=function(e){function t(t){var n=t.userId,i=t.metadata,r=e.call(this)||this;return r.method=eH.POST,r.path="".concat(eV,"/").concat(encodeURIComponent(n),"/metadata"),r.params={metadata:i},r}return u(t,e),t}(ta),rD=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.metaData=n,i}return u(t,e),t}(tc),rO=function(e){function t(t){var n=t.userId,i=t.metadata,r=t.upsert,o=e.call(this)||this;return o.method=eH.PUT,o.path="".concat(eV,"/").concat(encodeURIComponent(n),"/metadata"),o.params={metadata:i,upsert:r},o}return u(t,e),t}(ta),rk=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.metadata=n,i}return u(t,e),t}(tc),rR=function(e){function t(t){var n=t.userId,i=t.metadataKey,r=e.call(this)||this;return r.method=eH.DELETE,r.path="".concat(eV,"/").concat(encodeURIComponent(n),"/metadata/").concat(i),r}return u(t,e),t}(ta);u(function(){return null!==rP&&rP.apply(this,arguments)||this},rP=tc);var rL=function(e){function t(t){var n=t.userId,i=e.call(this)||this;return i.method=eH.DELETE,i.path="".concat(eV,"/").concat(encodeURIComponent(n),"/metadata"),i}return u(t,e),t}(ta);u(function(){return null!==rM&&rM.apply(this,arguments)||this},rM=tc);var rU,rx,rP,rM,rq,rF=function(e,t){var n=JSON.parse(JSON.stringify(e));return n._iid&&delete n._iid,t&&t(n),n},rH=function(e,t){var n=JSON.parse(JSON.stringify(e));return t&&t(n),n},rV=function(e){return{do:function(t){e||t()},throw:function(t){if(!e)throw t}}};(rG=rq||(rq={})).ONLINE="online",rG.OFFLINE="offline",rG.NON_AVAILABLE="nonavailable";var rG,rz,rj=function(e){function t(t,n){var i,r,o,s,a,c,u,l,h,d,_,f,g,v=this;return(v=e.call(this,t)||this).userId=null!==(r=null!==(i=n.guest_id)&&void 0!==i?i:n.user_id)&&void 0!==r?r:"",v.nickname=null!==(s=null!==(o=n.nickname)&&void 0!==o?o:n.name)&&void 0!==s?s:"",v.plainProfileUrl=null!==(c=null!==(a=n.profile_url)&&void 0!==a?a:n.image)&&void 0!==c?c:"",v.requireAuth=null!==(u=n.require_auth_for_profile_image)&&void 0!==u&&u,v.metaData=null!==(l=n.metadata)&&void 0!==l?l:{},v.connectionStatus=rq.NON_AVAILABLE,U(rq,n.is_online)?v.connectionStatus=n.is_online:L("boolean",n.is_online)&&(v.connectionStatus=n.is_online?rq.ONLINE:rq.OFFLINE),v.isActive=null===(h=n.is_active)||void 0===h||h,v.lastSeenAt=null!==(d=n.last_seen_at)&&void 0!==d?d:null,v.preferredLanguages=n.preferred_languages?E([],p(n.preferred_languages),!1):null,v.friendDiscoveryKey=null!==(_=n.friend_discovery_key)&&void 0!==_?_:null,v.friendName=null!==(f=n.friend_name)&&void 0!==f?f:null,v._hashValue=v._generateHashValue(),v._updatedAt=null!==(g=n.updatedat)&&void 0!==g?g:0,v}return u(t,e),t.payloadify=function(t){return ew(eN(l(l({},e.payloadify.call(this,t)),{user_id:t.userId,nickname:t.nickname,profile_url:t.plainProfileUrl,require_auth_for_profile_image:t.requireAuth,metadata:t.metaData,is_online:t.connectionStatus,is_active:t.isActive,last_seen_at:t.lastSeenAt,preferred_languages:t.preferredLanguages,friend_discovery_key:t.friendDiscoveryKey,friend_name:t.friendName})))},t._buildUserFromSerializedData=function(e){var n=rH(e);return new t(n._iid,t.payloadify(n))},t.prototype._generateHashValue=function(){for(var e,t=JSON.stringify({userId:this.userId,nickname:this.nickname,plainProfileUrl:this.plainProfileUrl,friendDiscoveryKey:this.friendDiscoveryKey,friendName:this.friendName,metaData:JSON.stringify(this.metaData),performanceLanguages:null===(e=this.preferredLanguages)||void 0===e?void 0:e.toString(),requireAuth:this.requireAuth}),n=0,i=0;i<t.length;i++)n=(n<<5)-n+t.charCodeAt(i)|0;return n},Object.defineProperty(t.prototype,"profileUrl",{get:function(){var e=oG.of(this._iid).sessionManager;return this.requireAuth&&e.ekey?"".concat(this.plainProfileUrl,"?auth=").concat(e.ekey):this.plainProfileUrl}
1,enumerable:!1,configurable:!0}),t.prototype.serialize=function(){return rF(this)},t.prototype._isValidMetaData=function(e){return!Array.isArray(e)&&Object.keys(e).length>0&&Object.keys(e).map(function(t){return e[t]}).every(function(e){return L("string",e)})},t.prototype._applyMetaData=function(e,t){var n=this;void 0===t&&(t=!1),Object.keys(e).forEach(function(i){t?delete n.metaData[i]:n.metaData[i]=e[i]})},t.prototype.createMetaData=function(e){return d(this,void 0,void 0,function(){var t,n,i,r,o;return _(this,function(s){switch(s.label){case 0:return rV(this._isValidMetaData(e)).throw(D.invalidParameters),n=(t=oG.of(this._iid)).sdkState,i=t.requestQueue,r=new rI({userId:n.userId,metadata:e}),[4,i.send(r)];case 1:return o=s.sent().as(rD).metaData,this._applyMetaData(o),[2,this.metaData]}})})},t.prototype.updateMetaData=function(e,t){return void 0===t&&(t=!1),d(this,void 0,void 0,function(){var n,i,r,o,s;return _(this,function(a){switch(a.label){case 0:return rV(this._isValidMetaData(e)).throw(D.invalidParameters),i=(n=oG.of(this._iid)).sdkState,r=n.requestQueue,o=new rO({userId:i.userId,metadata:e,upsert:t}),[4,r.send(o)];case 1:return s=a.sent().as(rk).metadata,this._applyMetaData(s),[2,this.metaData]}})})},t.prototype.deleteMetaData=function(e){return d(this,void 0,void 0,function(){var t,n,i,r,o;return _(this,function(s){switch(s.label){case 0:return rV(L("string",e)).throw(D.invalidParameters),n=(t=oG.of(this._iid)).sdkState,i=t.requestQueue,r=new rR({userId:n.userId,metadataKey:e}),[4,i.send(r)];case 1:return s.sent(),this._applyMetaData(((o={})[e]=!0,o),!0),[2,this.metaData]}})})},t.prototype.deleteAllMetaData=function(){return d(this,void 0,void 0,function(){var e,t,n,i;return _(this,function(r){switch(r.label){case 0:return t=(e=oG.of(this._iid)).sdkState,n=e.requestQueue,i=new rL({userId:t.userId}),[4,n.send(i)];case 1:return r.sent(),this.metaData={},[2]}})})},t}(rA),rK=function(e){function t(t){var n=t.userProfile,i=e.call(this)||this;return i.userProfile=n,i}return u(t,e),t}(eS),rB=function(){function e(e,t){var n,i,r,o,s,a,c,u,l,h,d,_,f,p;this._iid=e,this.appInfo=new rw(t),this.user=new rj(e,t),this.connectedAt=null!==(n=t.login_ts)&&void 0!==n?n:0,this.firstConnectedAt=0,this.pingInterval=null!==(i=t.ping_interval)&&void 0!==i?i:15,this.pongTimeout=null!==(r=t.pong_timeout)&&void 0!==r?r:5,this.reconnectInterval=null!==(s=null===(o=t.reconnect)||void 0===o?void 0:o.interval)&&void 0!==s?s:3e3,this.reconnectMaxInterval=null!==(c=null===(a=t.reconnect)||void 0===a?void 0:a.max_interval)&&void 0!==c?c:6e4,this.reconnectRetryCount=null!==(l=null===(u=t.reconnect)||void 0===u?void 0:u.retry_cnt)&&void 0!==l?l:5,this.reconnectIntervalMultiple=null!==(d=null===(h=t.reconnect)||void 0===h?void 0:h.mul)&&void 0!==d?d:2,this.maxUnreadCountOnSuperGroup=null!==(_=t.max_unread_cnt_on_super_group)&&void 0!==_?_:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=null!==(f=t.concurrent_call_limit)&&void 0!==f?f:5,this.backOffDelay=null!==(p=t.back_off_delay)&&void 0!==p?p:100}return e.payloadify=function(e){return ew(eN(l(l(l({},rj.payloadify(e.user)),rw.payloadify(e.appInfo)),{login_ts:e.connectedAt,ping_interval:e.pingInterval,pong_timeout:e.pongTimeout,reconnect:{interval:e.reconnectInterval,max_interval:e.reconnectMaxInterval,retry_cnt:e.reconnectRetryCount,mul:e.reconnectIntervalMultiple},max_unread_cnt_on_super_group:e.maxUnreadCountOnSuperGroup,profile_image_encryption:e.profileImageEncryption,concurrent_call_limit:e.concurrentCallLimit,back_off_delay:e.backOffDelay})))},e.prototype.apply=function(){var e=this.reconnectInterval,t=this.reconnectMaxInterval,n=this.reconnectIntervalMultiple,i=oG.of(this._iid);i.sdkState.websocket&&(i.sdkState.websocket.pingInterval=1e3*this.pingInterval,i.sdkState.websocket.pongTimeout=1e3*this.pongTimeout,i.sdkState.websocket.reconnectMaxRetry=this.reconnectRetryCount,i.sdkState.websocket.reconnectRetryStrategy={calcTimeout:function(i){return i>0?1e3*Math.min(e*Math.pow(n,i-1),t):10}}),i.appInfo=this.appInfo,i.sessionManager.currentUser=this.user,i.connectedAt=this.connectedAt,this.firstConnectedAt||(i.firstConnectedAt=this.connectedAt),i.maxSuperGroupChannelUnreadCount=this.maxUnreadCountOnSuperGroup,i.concurrentCallLimit=this.concurrentCallLimit,i.backOffDelay=this.backOffDelay,i.requestDeduplicator.requestDedupInterval=this.appInfo.requestDedupIntervalMs,i.dispatcher.dispatch(new rK({userProfile:this}))},e}(),rQ=function(e){function t(t){var n=t.request,i=t.features,r=t.options,o=t.statConfigInfo,s=e.call(this)||this;return s.request=void 0===n||n,s.features=l({localCache:!0,notification:!0,aiAgent:!0},void 0===i?{}:i),s.options=l({ingestion:!0}
1,void 0===r?{}:r),s.statConfigInfo=o,s}return u(t,e),t}(eS),rW=function(e){function t(t){var n=e.call(this)||this;return n.configSyncNeeded=!1,n.configSyncNeeded=t,n}return u(t,e),t}(eS),rZ=function(e){function t(t,n,i){var r,o,s,a,c=this;return(c=e.call(this,t,n,i)||this).error=null,c.services=[],c.userProfile=new rB(t,i),c.deviceTokenLastDeletedAt=null!==(r=i.device_token_last_deleted_at)&&void 0!==r?r:0,c.key=null!==(o=i.key)&&void 0!==o?o:"",c.ekey=null!==(s=i.ekey)&&void 0!==s?s:"",c.error=i.error?new D(i):null,c.services=null!==(a=i.services)&&void 0!==a?a:[],c.isSessionRefresh="new_key"in i,c}return u(t,e),t.asError=function(e){return new t("","LOGI",l({user_id:"",error:!0},e))},t.prototype.applyTo=function(e){return d(this,void 0,void 0,function(){var t,n,i;return _(this,function(r){switch(r.label){case 0:return this.isSessionRefresh?[2]:this.error?[3,4]:(t=oG.of(e))?(n=t.sessionManager,i=t.dispatcher,[4,n.login(this)]):[3,2];case 1:return r.sent(),this.userProfile.apply(),i.dispatch(new rW(this.userProfile.appInfo.configSyncNeeded)),i.dispatch(new rQ({request:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_request_log_publish"),features:{localCache:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_feature_local_cache_log_publish"),notification:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_noti_stats_log_publish"),aiAgent:this.userProfile.appInfo.applicationAttributes.includes("allow_sdk_ai_agent_stats_log_publish")},options:{ingestion:this.userProfile.appInfo.allowSdkStatsUpload},statConfigInfo:this.userProfile.appInfo.statConfigInfo})),[3,3];case 2:throw D.lostInstance;case 3:return[3,5];case 4:throw this.error;case 5:return[2]}})})},t}(th),rY=function(){function e(){this.type=rr.NONE,this.name="none"}return e.prototype.run=function(e){return d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onReconnect=function(e,t){return t.resetReconnectCount,d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onDisconnect=function(e,t){return t.error,t.autoReconnect,t.cause,d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onDisconnectWebSocket=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onLogout=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e.prototype.onDelayedConnecting=function(e,t){return t.retryAfterTime,t.reasonCode,t.message,d(this,void 0,void 0,function(){return _(this,function(e){return[2]})})},e}(),rX=function(e){function t(t){void 0===t&&(t={});var n,i=this;return(i=e.call(this)||this).type=rr.LOGOUT,i.name="logout",i._wasPreviouslyConnected=null===(n=t.wasPreviouslyConnected)||void 0===n||n,i}return u(t,e),t.prototype.run=function(e){return d(this,void 0,void 0,function(){var t,n,i=this;return _(this,function(r){switch(r.label){case 0:return t=Date.now(),n=e.sdkState.userId,[4,e.logout()];case 1:return r.sent(),[4,e.changeState(new on,t)];case 2:return r.sent(),this._wasPreviouslyConnected&&re(function(){return d(i,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null===(t=e.onDisconnected)||void 0===t||t.call(e,n)}),[2]})})}),[2]}})})},t}(rY),rJ=function(e){function t(t){var n=(void 0===t?{}:t).isAlreadyDisconnected,i=e.call(this)||this;return i.type=rr.EXTERNAL_DISCONNECTED,i.name="externaldisconnected",i._isAlreadyDisconnected=void 0!==n&&n,i}return u(t,e),t.prototype.run=function(e){return d(this,void 0,void 0,function(){var t=this;return _(this,function(n){switch(n.label){case 0:return[4,e.disconnect()];case 1:return n.sent(),this._isAlreadyDisconnected||re(function(){return d(t,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null===(t=e.onConnectionLost)||void 0===t||t.call(e)}),[2]})})}),[2]}})})},t.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return n=Date.now(),[4,e.disconnect()];case 1:return i.sent(),[4,e.changeState(new r9({authToken:t}),n)];case 2:return i.sent(),[2]}})})},t.prototype.onReconnect=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new r6,t)];case 1:return n.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rX,t)];case 1:return n.sent(),[2]}})})},t}(rY),r$=function(e){function t(t){var n=t.event,i=t.reason,r=e.call(this)||this;return r.event=n,r.reason=i,r}return u(t,e),t}(eS);(oe=rz||(rz={}
1)).ExternalSetBackground="ExternalSetBackground",oe.ExternalDisconnectWebSocket="ExternalDisconnectWebSocket",oe.MaxReconnectRetry="MaxReconnectRetry";var r0=function(){function e(e,t){var n=t.sdkState,i=t.cacheContext,r=t.connectionHandlers,o=t.sessionManager,s=t.websocketClient,a=t.dispatcher,c=t.logger,u=t.disableWebSocketCloseEventHandling,l=this;this._disableWebSocketCloseEventHandling=!1,this._webSocketClosedCause=null,this._logger=c,this._disableWebSocketCloseEventHandling=void 0!==u&&u,this._context=new os(e,{sdkState:n,cacheContext:i,connectionHandlers:r,sessionManager:o,websocketClient:s,dispatcher:a,logger:c}),this._sdkState=n,this._sessionManager=o,this._websocketClient=s,this._commandDispatcher=a,this._commandDispatcher.on(function(e){var t=l._context.currentState;if(e instanceof rn&&t.type===rr.CONNECTED){var n=e.retryAfterTime,i=e.reasonCode,r=e.message;t.onDelayedConnecting(l._context,{retryAfterTime:n,reasonCode:i,message:r})}})}return e.prototype._registerEventDispatcher=function(){var e=this;this._disableWebSocketCloseEventHandling||(this._clearEventDispatcher(),this._sessionEventDispatcherContext=this._sessionManager.on("refresh",function(){e.isConnecting||e.isConnected||(e._logger.debug("try reconnect by session key refresh"),rt(function(){return d(e,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,this.reconnect()];case 1:return e.sent(),[2]}})})}))}),this._websocketEventDispatcherContext=this._websocketClient.on("close",function(){"foreground"!==e._sdkState.appState||e._webSocketClosedCause||rt(function(){return d(e,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return this._context.currentState.type===rr.RECONNECTING?[2]:this._sdkState.isAppActive?this._sessionManager.isSessionKeyRefreshing?[3,2]:(this._logger.debug("try reconnect by websocket connection closed"),[4,this.reconnect()]):(this._commandDispatcher.dispatch(new r$({event:"pause",reason:"app is not active"})),[2]);case 1:return e.sent(),[3,4];case 2:return[4,this.disconnectWebSocket()];case 3:e.sent(),e.label=4;case 4:return[2]}})})})}))},e.prototype._clearEventDispatcher=function(){this._sessionEventDispatcherContext&&(this._sessionEventDispatcherContext.close(),this._sessionEventDispatcherContext=void 0),this._websocketEventDispatcherContext&&(this._websocketEventDispatcherContext.close(),this._websocketEventDispatcherContext=void 0)},Object.defineProperty(e.prototype,"isConnected",{get:function(){return this._context.currentState.type===rr.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isConnecting",{get:function(){var e=this._context.currentState;return e.type===rr.CONNECTING||e.type===rr.RECONNECTING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketClient",{get:function(){return this._websocketClient},enumerable:!1,configurable:!0}),e.prototype.connect=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=this._context.currentState,this._webSocketClosedCause=null,[4,t.onConnect(this._context,e)];case 1:return n.sent(),this._registerEventDispatcher(),[2]}})})},e.prototype.reconnect=function(){return d(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:return e=this._context.currentState,this._webSocketClosedCause=null,[4,e.onReconnect(this._context,{})];case 1:return t.sent(),[2]}})})},e.prototype.resetAndReconnect=function(){return d(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:return e=this._context.currentState,this._webSocketClosedCause=null,[4,e.onReconnect(this._context,{resetReconnectCount:!0})];case 1:return t.sent(),[2]}})})},e.prototype.background=function(){return d(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:return e=this._context.currentState,this._webSocketClosedCause=rz.ExternalSetBackground,[4,e.onDisconnect(this._context,{autoReconnect:!1,cause:this._webSocketClosedCause})];case 1:return t.sent(),[2]}})})},e.prototype.disconnect=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return[4,this._context.currentState.onDisconnect(this._context,{error:e,autoReconnect:!0,cause:this._webSocketClosedCause})];case 1:return t.sent(),[2]}})})},e.prototype.disconnectWebSocket=function(e){return void 0===e&&(e=!1),d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=this._context.currentState,e&&(this._webSocketClosedCause=rz.ExternalDisconnectWebSocket),[4,t.onDisconnectWebSocket(this._context,{cause:this._webSocketClosedCause})];case 1:return n.sent(),[2]}})})},e.prototype.logout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=this._context.currentState,this._clearEventDispatcher(),[4,t.onLogout(this._context,e)];case 1:return n.sent(),[2]}})})},e}(),r1=function(e){function t(t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message,o=t.authToken,s=e.call(this)||this;return s.type=rr.DELAYED_CONNECTING,s.name="delayedconnecting",s._timerStartTime=0,s._retryAfterTime=n,s._reasonCode=i,s._message=r,s._authToken=o,s}return u(t,e),t.prototype._clearDelayConnectTimer=function(){this._delayConnectTimer&&(clearTimeout(this._delayConnectTimer),this._delayConnectTimer=void 0),this._timerStartTime=0},t.prototype._startDelayedConnectTimer=function(e){var t=this;this._clearDelayConnectTimer(),this._timerStartTime=Date.now(),this._delayConnectTimer=setTimeout(function(){return d(t,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),clearTimeout(this._delayConnectTimer),this._delayConnectTimer=void 0,this._timerStartTime=0,[4,e.changeState(new r6({authToken:this._authToken,isSoftRateLimited:!0}),t)];case 1:return n.sent(),[2]}})})}
1,this._retryAfterTime),e.connectionHandlers.forEach(function(e){var n;null===(n=e.onConnectionDelayed)||void 0===n||n.call(e,Math.ceil(t._retryAfterTime/1e3))})},t.prototype._calculateRemainDelayConnectTime=function(){this._delayConnectTimer&&(this._retryAfterTime=this._retryAfterTime-(Date.now()-this._timerStartTime))},t.prototype._throwDelayedConnectingError=function(){var e=new D({code:g.DELAYED_CONNECTING,message:this._message});throw e.setDetail(JSON.stringify({retry_after:Math.ceil(this._retryAfterTime/1e3),reason_code:this._reasonCode,message:this._message})),e},t.prototype.run=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){return this._startDelayedConnectTimer(e),[2]})})},t.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(t){return this._delayConnectTimer&&(this._calculateRemainDelayConnectTime(),this._startDelayedConnectTimer(e),this._throwDelayedConnectingError()),[2]})})},t.prototype.onReconnect=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){return this._delayConnectTimer&&(this._calculateRemainDelayConnectTime(),this._startDelayedConnectTimer(e),this._throwDelayedConnectingError()),[2]})})},t.prototype.onDelayedConnecting=function(e,t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message;return d(this,void 0,void 0,function(){return _(this,function(t){return this._retryAfterTime=n,this._reasonCode=i,this._message=r,this._startDelayedConnectTimer(e),[2]})})},t.prototype.onDisconnect=function(e,t){var n=t.autoReconnect,i=void 0!==n&&n,r=t.cause,o=void 0===r?null:r;return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._clearDelayConnectTimer(),o!==rz.ExternalSetBackground?[3,2]:[4,e.changeState(new r2({autoReconnect:i,retryAfterTime:this._retryAfterTime,disconnectedTime:t,reasonCode:this._reasonCode,message:this._message}),t)];case 1:case 3:return n.sent(),[3,6];case 2:return e.hasSession?[4,e.changeState(new r2({autoReconnect:i}),t)]:[3,4];case 4:return[4,e.changeState(new rX,t)];case 5:n.sent(),n.label=6;case 6:return[2]}})})},t.prototype.onDisconnectWebSocket=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._clearDelayConnectTimer(),[4,e.changeState(new rJ,t)];case 1:return n.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._clearDelayConnectTimer(),[4,e.changeState(new rX,t)];case 1:return n.sent(),[2]}})})},t}(rY),r2=function(e){function t(t){var n=e.call(this)||this;return n.type=rr.INTERNAL_DISCONNECTED,n.name="internaldisconnected",n._autoReconnect=!1,n._autoReconnect=t.autoReconnect,n._retryAfter=t.retryAfterTime,n._disconnectedTime=t.disconnectedTime,n._reasonCode=t.reasonCode,n._message=t.message,n}return u(t,e),t.prototype._getDelayedConnectTime=function(e){return this._retryAfter&&this._disconnectedTime?Math.ceil((this._retryAfter-(e-this._disconnectedTime))/1e3):-1},t.prototype.run=function(e){return d(this,void 0,void 0,function(){var t,n=this;return _(this,function(i){switch(i.label){case 0:return t=Date.now(),[4,e.disconnect()];case 1:return i.sent(),re(function(){return d(n,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null===(t=e.onConnectionLost)||void 0===t||t.call(e)}),[2]})})}),this._autoReconnect?[4,e.changeState(new r6,t)]:[3,3];case 2:i.sent(),i.label=3;case 3:return[2]}})})},t.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return n=Date.now(),[4,e.disconnect()];case 1:return i.sent(),[4,e.changeState(new r9({authToken:t}),n)];case 2:return i.sent(),[2]}})})},t.prototype.onReconnect=function(e){return d(this,void 0,void 0,function(){var t,n;return _(this,function(i){switch(i.label){case 0:return t=Date.now(),(n=this._getDelayedConnectTime(t))>0?[4,e.changeState(new r1({retryAfterTime:n,reasonCode:this._reasonCode,message:this._message}),t)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,e.changeState(new r6,t)];case 3:i.sent(),i.label=4;case 4:return[2]}})})},t.prototype.onDisconnectWebSocket=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rJ({isAlreadyDisconnected:!0}),t)];case 1:return n.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rX,t)];case 1:return n.sent(),[2]}})})},t}(rY),r3=function(e){return d(void 0,void 0,void 0,function(){return _(this,function(t){return[2,new Promise(function(t){return setTimeout(t,e)})]})})},r4=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),r5=function(e,t,n){return void 0===n&&(n=new r4),d(void 0,void 0,void 0,function(){var i,r,o,s,a,c;return _(this,function(u){switch(u.label){case 0:i=0,r=null,o=function(e){return r=null!=e?e:Error("Halted")},s=function(){i=0},u.label=1;case 1:if(!(-1===t||i<t))return[3,9];u.label=2;case 2:return u.trys.push([2,4,,8]),[4,e(o,s)];case 3:if(a=u.sent(),r)throw r;return[2,a];case 4:if(c=u.sent(),r)return[3,6];if(++i===t)throw c;return[4,r3(n.calcTimeout(i))];case 5:return u.sent(),[3,7];case 6:throw r;case 7:return[3,8];case 8:return[3,1];case 9:throw"It should not happen."}})})},r6=function(e){function t(t){var n=void 0===t?{}:t,i=n.authToken,r=n.isSoftRateLimited,o=e.call(this)||this;return o.type=rr.RECONNECTING,o.name="reconnecting",o._callbacks=[],o._authToken=i,o._isSoftRateLimited=null!=r?r:void 0,o}return u(t,e),t.prototype._halt=function(e){this._haltConnect&&(this._haltConnect(e),this._haltConnect=void 0)},t.prototype._flushCallbacks=function(e){this._haltConnect=void 0,this._resetConnect=void 0,this._callbacks.forEach(function(t){return t(e)})},t.prototype.run=function(e){return d(this,void 0,void 0,function(){var t,n,i,r,o,s,a,c,u=this;return _(this,function(l){switch(l.label){case 0:t=Date.now(),n=new tI,this._callbacks.push(function(e){return e?n.reject(e):n.resolve()}),re(function(){return d(u,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEac
1h(function(e){var t;null===(t=e.onReconnectStarted)||void 0===t||t.call(e)}),[2]})})}),i=e.dispatcher,l.label=1;case 1:return l.trys.push([1,4,,12]),r=ey(),o=0,[4,r5(function(t,n){return d(u,void 0,void 0,function(){var i;return _(this,function(s){switch(s.label){case 0:this._haltConnect=t,this._resetConnect=n,s.label=1;case 1:return s.trys.push([1,3,,4]),o++,[4,e.connect({authToken:this._authToken,connectionKey:r,connectionRetryCount:o,isSoftRateLimited:this._isSoftRateLimited})];case 2:return s.sent(),[3,4];case 3:if(i=s.sent(),e.clearLoginTimer(),i instanceof D){switch(i.code){case g.CONNECTION_CANCELED:case g.DELAYED_CONNECTING:return t(i),[2]}if(i.isSessionExpiredError||i.isSessionInvalidatedError)return t(i),[2]}throw i;case 4:return[2]}})})},(s=e.sdkState.websocket).reconnectMaxRetry,s.reconnectRetryStrategy)];case 2:return l.sent(),[4,e.changeState(new r8,t)];case 3:return l.sent(),this._flushCallbacks(),re(function(){return d(u,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null===(t=e.onReconnectSucceeded)||void 0===t||t.call(e)}),[2]})})}),[3,12];case 4:return I(a=l.sent())?[3,10]:[4,e.disconnect()];case 5:return l.sent(),a instanceof D?a.code!==g.DELAYED_CONNECTING?[3,7]:(c=JSON.parse(a.detail),[4,e.changeState(new r1({retryAfterTime:1e3*c.retry_after,reasonCode:c.reason_code,message:c.message,authToken:this._authToken}),t)]):[3,9];case 6:return l.sent(),[3,9];case 7:return a.code===g.CONNECTION_CANCELED?[3,9]:[4,e.changeState(new r2({autoReconnect:!1}),t)];case 8:l.sent(),a.isSessionExpiredError&&i.dispatch(new tl({reason:a.code,message:a.message})),l.label=9;case 9:return this._flushCallbacks(a),re(function(){return d(u,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null===(t=e.onReconnectFailed)||void 0===t||t.call(e)}),[2]})})}),[3,11];case 10:throw a;case 11:return[3,12];case 12:return[2,n.promise]}})})},t.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){return n=new tI,this._halt(D.connectionCanceled),e.cancelConnectForRetry(),this._callbacks.push(function(){var i=Date.now();e.changeState(new r9({authToken:t}),i).then(function(){n.resolve()}).catch(function(e){n.reject(e)})}),[2,n.promise]})})},t.prototype.onReconnect=function(e,t){var n=t.resetReconnectCount,i=void 0!==n&&n;return d(this,void 0,void 0,function(){var e;return _(this,function(t){return e=new tI,this._resetConnect&&i&&this._resetConnect(),this._callbacks.push(function(t){return t?e.reject(t):e.resolve()}),[2,e.promise]})})},t.prototype.onDisconnect=function(e,t){t._error;var n=t.autoReconnect,i=void 0===n||n;return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._halt(D.connectionCanceled),[4,e.changeState(new r2({autoReconnect:i}),t)];case 1:return n.sent(),[2]}})})},t.prototype.onDisconnectWebSocket=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._halt(D.connectionCanceled),[4,e.changeState(new rJ,t)];case 1:return n.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._halt(D.connectionCanceled),[4,e.changeState(new rX,t)];case 1:return n.sent(),[2]}})})},t.prototype.onDelayedConnecting=function(e,t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message;return d(this,void 0,void 0,function(){var t,o;return _(this,function(s){switch(s.label){case 0:return t=Date.now(),(o=new D({code:g.DELAYED_CONNECTING,message:r})).setDetail(JSON.stringify({retry_after:n/1e3,reason_code:i,message:r})),this._halt(o),[4,e.changeState(new r1({retryAfterTime:n,reasonCode:i,message:r,authToken:this._authToken}),t)];case 1:return s.sent(),[2]}})})},t}(rY),r8=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=rr.CONNECTED,t.name="connected",t}return u(t,e),t.prototype.onReconnect=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.disconnect()];case 1:return n.sent(),[4,e.changeState(new r6,t)];case 2:return n.sent(),[2]}})})},t.prototype.onDisconnect=function(e,t){var n=t.autoReconnect;return d(this,void 0,void 0,function(){var t;return _(this,function(i){switch(i.label){case 0:return t=Date.now(),[4,e.changeState(new r2({autoReconnect:n}),t)];case 1:return i.sent(),[2]}})})},t.prototype.onDisconnectWebSocket=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rJ,t)];case 1:return n.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rX,t)];case 1:return n.sent(),[2]}})})},t.prototype.onDelayedConnecting=function(e,t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message;return d(this,void 0,void 0,function(){var t;return _(this,function(o){switch(o.label){case 0:return t=Date.now(),[4,e.changeState(new r1({retryAfterTime:n,reasonCode:i,message:r}),t)];case 1:return o.sent(),[2]}})})},t}(rY),r9=function(e){function t(t){var n=t.authToken,i=e.call(this)||this;return i.type=rr.CONNECTING,i.name="connecting",i._authToken="",i._callbacks=[],i._authToken=n,i}return u(t,e),t.prototype._halt=function(e){this._haltConnect&&(this._haltConnect(e),this._haltConnect=void 0)},t.prototype._flushCallbacks=function(e){this._haltConnect=void 0,this._callbacks.forEach(function(t){return t(e)})},t.prototype.run=function(e){return d(this,void 0,void 0,function(){var t,n,i,r,o,s,a=this;return _(this,function(c){switch(c.label){case 0:t=Date.now(),n=new tI,this._callbacks.push(function(e){return e?n.reject(e):n.resolve()}),c.label=1;case 1:return c.trys.push([1,4,,12]),i=ey(),r=0,[4,r5(function(t){return d(a,void 0,void 0,function(){var n;return _(this,function(o){switch(o.label){case 0:this._haltConnect=t,o.label=1;case 1:return o.trys.push([1,3,,4]),r++,[4,e.connect({authToken:this._authToken,connectionKey:i,connectionRetryCount:r})];case 2:return o.sent(),[3,4];case 3:if(n=o.sent(),e.clearLoginTimer(),n instanceof D)switch(n.code){case g.CONNECTION_CANCELED:case g.SESSION_KEY_EXPIRED:case g.SESSION_TOKEN_EXPIRED:case g.SESSION_REVOKED:case g.USER_AUTH_DEACTIVATED:case g.USER_AUTH_DELETED_OR_NOT_FOUND:case g.USER_DEACTIVATED:case g.DELAYED_CONNECTING:return t(n),[2]}throw n;case 4:return[2]}})})}
1,e.sdkState.websocket.connectMaxRetry)];case 2:return c.sent(),[4,e.changeState(new r8,t)];case 3:return c.sent(),re(function(){return d(a,void 0,void 0,function(){return _(this,function(t){return this._flushCallbacks(),e.connectionHandlers.forEach(function(t){var n;null===(n=t.onConnected)||void 0===n||n.call(t,e.sdkState.userId)}),[2]})})}),[3,12];case 4:return I(o=c.sent())?[3,10]:[4,e.disconnect()];case 5:return c.sent(),o instanceof D?o.code!==g.DELAYED_CONNECTING?[3,7]:(s=JSON.parse(o.detail),[4,e.changeState(new r1({retryAfterTime:1e3*s.retry_after,reasonCode:s.reason_code,message:s.message,authToken:this._authToken}),t)]):[3,9];case 6:return c.sent(),[3,9];case 7:return o.code===g.CONNECTION_CANCELED?[3,9]:[4,e.changeState(new on,t)];case 8:c.sent(),c.label=9;case 9:return re(function(){return d(a,void 0,void 0,function(){return _(this,function(e){return this._flushCallbacks(o),[2]})})}),[3,11];case 10:throw o;case 11:return[3,12];case 12:return[2,n.promise]}})})},t.prototype.onConnect=function(e){return d(this,void 0,void 0,function(){var e;return _(this,function(t){return e=new tI,this._callbacks.push(function(t){return t?e.reject(t):e.resolve()}),[2,e.promise]})})},t.prototype.onDisconnect=function(e,t){var n=t.error,i=void 0===n?null:n,r=t.autoReconnect,o=void 0!==r&&r,s=t.cause,a=void 0===s?null:s;return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),this._halt(null!=i?i:r7(a)),e.hasSession?[4,e.changeState(new r2({autoReconnect:o}),t)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,e.changeState(new rX,t)];case 3:n.sent(),n.label=4;case 4:return[2]}})})},t.prototype.onDisconnectWebSocket=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return this._halt(r7((null==t?void 0:t.cause)||null)),n=Date.now(),e.hasSession?[4,e.changeState(new rJ,n)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,e.changeState(new rX,n)];case 3:i.sent(),i.label=4;case 4:return[2]}})})},t.prototype.onLogout=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return n=Date.now(),this._halt(null!=t?t:D.connectionCanceled),[4,e.changeState(new rX,n)];case 1:return i.sent(),[2]}})})},t.prototype.onDelayedConnecting=function(e,t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message;return d(this,void 0,void 0,function(){var t;return _(this,function(o){switch(o.label){case 0:return t=Date.now(),[4,e.changeState(new r1({retryAfterTime:n,reasonCode:i,message:r,authToken:this._authToken}),t)];case 1:return o.sent(),[2]}})})},t}(rY);function r7(e){var t=D.connectionCanceled;if(e){var n=null;switch(e){case rz.ExternalSetBackground:n="Connection has been canceled due to the application having externally moved to background while in ConnectingState.";break;case rz.ExternalDisconnectWebSocket:n="Connection has been canceled because sb.disconnectWebSocket() was called while in ConnectingState."}n&&t.setDetail(n)}return t}var oe,ot,on=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=rr.INITIALIZED,t.name="initialized",t}return u(t,e),t.prototype.onConnect=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return n=Date.now(),[4,e.changeState(new r9({authToken:t}),n)];case 1:return i.sent(),[2]}})})},t.prototype.onLogout=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=Date.now(),[4,e.changeState(new rX({wasPreviouslyConnected:!1}),t)];case 1:return n.sent(),[2]}})})},t}(rY),oi=function(e){function t(){return e.call(this,{code:"PING",payload:{id:Date.now(),active:1},ackRequired:!1})||this}return u(t,e),t}(td),or=function(){function e(e){var t=e.pingDelegate,n=e.sdkState,i=e.logger;this.pingDelegate=t,this.sdkState=n,this._logger=i}return Object.defineProperty(e.prototype,"isWaiting",{get:function(){return!!this._pingTimeoutTimer},enumerable:!1,configurable:!0}),e.prototype.ping=function(){var e,t=this;if(!this.sdkState.websocket)throw D.connectionRequired;var n=new oi;try{var i=null!==(e=this.sdkState.websocket.pongTimeout)&&void 0!==e?e:5e3;this._pingTimeoutTimer=setTimeout(function(){t._logger.debug("pinger.ping() timeout"),t.pingDelegate.error()},i),this.pingDelegate.send(n),this._logger.debug("pinger.ping()")}catch(e){this._logger.debug("pinger.ping() error",e),this._pingTimeoutTimer&&(clearTimeout(this._pingTimeoutTimer),this._pingTimeoutTimer=void 0),this.pingDelegate.error()}return n},e.prototype.pong=function(){this._logger.debug("pinger.pong()"),this._pingTimeoutTimer&&(clearTimeout(this._pingTimeoutTimer),this._pingTimeoutTimer=void 0)},e.prototype.refreshTimer=function(){var e,t=this;if(!this.sdkState.websocket)throw D.connectionRequired;this._logger.debug("pinger.refreshTimer()");var n=null!==(e=this.sdkState.websocket.pingInterval)&&void 0!==e?e:15e3;this.stop(),this._pingTimer=setInterval(function(){t.ping()},n)},e.prototype.start=function(){this._logger.debug("pinger.start()"),this.refreshTimer(),this.ping()},e.prototype.stop=function(){this._logger.debug("pinger.stop()"),this._pingTimer&&(clearInterval(this._pingTimer),this._pingTimer=void 0),this._pingTimeoutTimer&&(clearTimeout(this._pingTimeoutTimer),this._pingTimeoutTimer=void 0)},e}(),oo=["premium_feature_list","file_upload_size_limit","application_attributes","emoji_hash","multiple_file_send_max_size","notifications","message_template","ai_agent"],os=function(e){function t(t,n){var i,r=n.sdkState,o=n.cacheContext,s=n.connectionHandlers,a=n.sessionManager,c=n.websocketClient,u=n.dispatcher,l=n.logger,h=n.entryState,d=void 0===h?new on:h,_=this;return(_=e.call(this)||this)._currentConnectionRetryCount=0,_._stateUpdatedAt=0,_._connectingAt=0,_._connectedAt=0,_._logiReceivedAt=0,_._connectionRequestQueue=[],_._iid=t,_.sdkState=r,_.cacheContext=o,_.connectionHandlers=s,_._sessionManager=a,_._websocketClient=c,_._dispatcher=u,_._logger=l,_._currentState=d,(null===(i=_.sdkState.websocket)||void 0===i?void 0:i.pingerDisabled)||(_._pinger=new or({pingDelegate:{send:function(e){return _._websocketClient.send(e)},error:function(e){u.dispatch(new tg(new tC({type:ts.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:g.NETWORK_E
1RROR,error_description:"cause=ping_pong_timedout"}}))),_._websocketClient.error(e)}},sdkState:_.sdkState,logger:l})),_._websocketClient.on("open",function(){_._connectedAt=Date.now(),_._tryResolveConnectionRequest()}).on("message",function(e){"LOGI"===e.code&&(_.clearLoginTimer(),_._dispatcher.dispatch(e.as(rZ)))}).on("ping-refresh",function(){var e;return null===(e=_._pinger)||void 0===e?void 0:e.refreshTimer()}).on("pong",function(){var e;return null===(e=_._pinger)||void 0===e?void 0:e.pong()}).on("error",function(){var e;return null===(e=_._pinger)||void 0===e?void 0:e.stop()}).on("close",function(){_._logiProcessingTimer=setTimeout(function(){_._logiProcessingTimer=void 0,_._unresolvedLogi||_._rejectConnectionRequest(D.networkError)},500)}),_._dispatcher.on(function(e){if(e instanceof rZ)_._unresolvedLogi=e,_._tryResolveConnectionRequest();else if(e instanceof rn){var t=e.retryAfterTime,n=e.reasonCode,i=e.message,r=new D({code:g.DELAYED_CONNECTING,message:i});r.setDetail(JSON.stringify({retry_after:t/1e3,reason_code:n,message:i})),_._rejectConnectionRequest(r)}}),_}return u(t,e),Object.defineProperty(t.prototype,"currentState",{get:function(){return this._currentState},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"hasSession",{get:function(){return this._sessionManager.session.hasSession},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dispatcher",{get:function(){return this._dispatcher},enumerable:!1,configurable:!0}),t.prototype.changeState=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return t>=this._stateUpdatedAt?(this._currentState=e,this._stateUpdatedAt=t,this._dispatcher.dispatch(new rd({stateType:e.type})),this._logger.debug("connection state changes to ".concat(e.name)),[4,this._currentState.run(this)]):[3,2];case 1:return n.sent(),[2,!0];case 2:return[2,!1]}})})},t.prototype._tryResolveConnectionRequest=function(){var e;return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=this._unresolvedLogi,this._websocketClient.isOpen&&t?(this._unresolvedLogi=void 0,this._logiReceivedAt=Date.now(),t.error?[3,2]:[4,t.applyTo(this._iid)]):[3,3];case 1:return n.sent(),this._statLogConnection(),null===(e=this._pinger)||void 0===e||e.start(),this._connectionRequestQueue.forEach(function(e){return e.resolve()}),this._connectionRequestQueue=[],this.sdkState.appState="foreground",[3,3];case 2:this._logger.warn("login failed: ".concat(t.error)),this._rejectConnectionRequest(t.error),n.label=3;case 3:return[2]}})})},t.prototype._rejectConnectionRequest=function(e){var t;if(null===(t=this._pinger)||void 0===t||t.stop(),this.clearLoginTimer(),this._connectionRequestQueue.length>0){var n=this._connectionRequestQueue;this._connectionRequestQueue=[],n.forEach(function(t){return t.reject(e)}),this._statLogConnection(e)}},t.prototype._url=function(e){var t,n=e.configTs,i=this.sdkState,r=i.appId,o=i.appVersion,s=i.userId,a=i.extensions,c=i.sendbirdRuntimeEnvironment,u=this.cacheContext.localCacheEnabled,l=this._sessionManager.session,h=null===(t=this.sdkState.websocket)||void 0===t?void 0:t.compression,d=!!(null!=a?a:{}).sb_uikit,_=tA.userAgentWithExtension(a);return"".concat(this.sdkState.websocket.host,"/?p=JS&pv=").concat(encodeURIComponent(m.OS_VERSION),"&sv=").concat(encodeURIComponent(m.SDK_VERSION),"&ai=").concat(r).concat(o?"&av=".concat(o):"").concat(l.hasSession?"":"&user_id=".concat(encodeURIComponent(s)),"&pmce=").concat(h?1:0,"&active=1&device_token_types=").concat(encodeURIComponent("gcm,huawei,apns"),"&SB-User-Agent=").concat(_,"&SB-SDK-User-Agent=").concat(encodeURIComponent(tA.sendbirdSdkUserAgentWithExtension(c)),"&Request-Sent-Timestamp=").concat(Date.now().toString(),"&include_extra_data=").concat(encodeURIComponent(String(oo))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(u?1:0,"&include_poll_details=1").concat(d?"&uikit_config=1":"","&config_ts=").concat(n)},t.prototype._statLogConnection=function(e){var t,n;this._dispatcher.dispatch(new tg(new tC({type:ts.WEBSOCKET_CONNECT,data:{host_url:null===(t=this.sdkState.websocket)||void 0===t?void 0:t.host,success:!e,latency:this._connectedAt>
10?this._connectedAt-this._connectingAt:Date.now()-this._connectingAt,logi_latency:this._logiReceivedAt>0?this._logiReceivedAt-this._connectingAt:void 0,connection_id:this._currentConnectionKey,accum_trial:this._currentConnectionRetryCount,is_soft_rate_limited:null!==(n=this._isSoftRateLimited)&&void 0!==n?n:void 0,error_code:null==e?void 0:e.code,error_description:(null==e?void 0:e.code)===g.DELAYED_CONNECTING?null==e?void 0:e.detail:null==e?void 0:e.message}})))},t.prototype.connect=function(e){var t;return void 0===e&&(e={}),d(this,void 0,void 0,function(){var n,i,r,o,s,a,c,u,l,h,d,f,p=this;return _(this,function(_){switch(_.label){case 0:return this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(D.connectionCanceled)),n=new tI,r=void 0===(i=e.authToken)?"":i,s=void 0===(o=e.connectionKey)?ey():o,c=void 0===(a=e.connectionRetryCount)?1:a,u=e.isSoftRateLimited,this._connectionRequestQueue.push(n),1!==this._connectionRequestQueue.length?[3,2]:(this._currentConnectionKey=s,this._currentConnectionRetryCount=c,this._isSoftRateLimited=u,this._connectingAt=Date.now(),this._connectedAt=0,this._logiReceivedAt=0,this._loginTimer=setTimeout(function(){p._loginTimer=void 0,p._rejectConnectionRequest(D.loginTimeout)},null===(t=this.sdkState.websocket)||void 0===t?void 0:t.responseTimeout),l=this._sessionManager.session,r&&(l.authToken=r,l.sessionKey=void 0),h=0,[4,this.cacheContext.preference.get(rN(this.sdkState.appId))]);case 1:(d=_.sent())&&(h=d.configTs),f=this._url({configTs:h}),l.sessionKey||l.authToken?this._websocketClient.connect(f,JSON.stringify(l.hasSession?{auth:l.sessionKey}:{token:l.authToken})):this._websocketClient.connect(f,JSON.stringify({})),_.label=2;case 2:return[2,n.promise]}})})},t.prototype.cancelConnectForRetry=function(){this._dispatcher.dispatch(rZ.asError(D.connectionRenew))},t.prototype.disconnect=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return[4,this._websocketClient.disconnect()];case 1:return e.sent(),[2]}})})},t.prototype.logout=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return this.sdkState.userId=void 0,this._unresolvedLogi=void 0,[4,this.disconnect()];case 1:return e.sent(),[4,this._sessionManager.clear()];case 2:return e.sent(),[2]}})})},t.prototype.clearLoginTimer=function(){this._loginTimer&&(clearTimeout(this._loginTimer),this._loginTimer=void 0)},t}(eT),oa=function(e){function t(t){var n=t.appId,i=t.userId,r=t.includeUIKitConfig,o=t.localCacheEnabled,s=t.expiringSession,a=t.configTs,c=e.call(this)||this;return c.path="".concat(eG,"/").concat(encodeURIComponent(i),"/authentication"),c.method=eH.POST,c.params=ew({expiring_session:!!(void 0===s||s),include_logi:!0,include_extra_data:String(oo),uikit_config:void 0!==r&&r,use_local_cache:void 0===o||o,app_id:n,config_ts:void 0===a?0:a}),c.requireAuth=!1,c}return u(t,e),t}(ta),oc=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.logi=new rZ(t,"LOGI",n),i}return u(t,e),t}(tc);(ou=ot||(ot={}))[ou.ALL=0]="ALL",ou[ou.WEBSOCKET=1]="WEBSOCKET",ou[ou.API=2]="API";var ou,ol,oh,od=[t_,oa],o_=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,o=t.logger,s=t.useFetchCompat,a=this;this._currentConnectionStateType=rr.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new rc(e,{session:n,sdkState:i,dispatcher:r,logger:o,useFetchCompat:void 0!==s&&s}),this._session=n,this._logger=o,this._dispatcher=r,this._dispatcher.on(function(e){var t,n,i;if(e instanceof rd){var r=e.stateType;switch(a._currentConnectionStateType=r,r){case rr.CONNECTED:a._resolveLazyCallQueue();break;case rr.INITIALIZED:case rr.INTERNAL_DISCONNECTED:case rr.EXTERNAL_DISCONNECTED:case rr.LOGOUT:a._session.isRefreshing||a._rejectLazyCallQueue((null===(i=a._session)||void 0===i?void 0:i.hasSession)?D.connectionClosed:D.connectionRequired)}}else if(e instanceof r_)a._session.hasChatServicePermission||a._resolveLazyCallQueue(ot.API);else if(e instanceof rf||e instanceof rp)a._rejectLazyCallQueue(D.connectionClosed);else if(e instanceof tv){var o=e.request,s=e.deferred,c=e.error;try{for(var u=f(od),l=u.next();!l.done;l=u.next())if(o instanceof l.value)return void s.reject(c)}catch(e){t={error:e}}finally{try{l&&!l.done&&(n=u.return)&&n.call(u)}finally{if(t)throw t.error}}a._lazyCallQueue.push({command:o,deferred:s})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===rr.CONNECTED}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===rr.CONNECTING||this._currentConnectionStateType===rr.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(e){var t,n=[],i=[];switch(e){case ot.ALL:t=null;break;case ot.WEBSOCKET:t=td;break;case ot.API:t=ta}var r=!1;return this._lazyCallQueue.forEach(function(e){!t||e.command instanceof t||(r=!0),r?i.push(e):n.push(e)}),[n,i]},e.prototype._resolveLazyCallQueue=function(e){var t=this;void 0===e&&(e=ot.ALL);var n=p(this._classifyLazyCallQueueByScope(e),2),i=n[0],r=n[1];this._lazyCallQueue=r,i.forEach(function(e){return d(t,void 0,void 0,function(){var t,n,i,r,o;return _(this,function(s){switch(s.label){case 0:t=e.command,n=e.deferred,(i=e.timeout)&&clearTimeout(i),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,this.send(t)];case 2:return r=s.sent(),n.resolve(r),[3,4];case 3:return o=s.sent(),n.reject(o),[3,4];case 4:return[2]}})})})},e.prototype._rejectLazyCallQueue=function(e,t){var n=this;void 0===t&&(t=ot.ALL);var i=p(this._classifyLazyCallQueueByScope(t),2),r=i[0],o=i[1];this._lazyCallQueue=o,r.forEach(function(t){return d(n,void 0,void 0,function(){var n;return _(this,function(i){return n=t.deferred,clearTimeout(t.timeout),n.reject(e),[2]})})})},e.prototype.send=function(e){return d(this,void 0,void 0,function(){var t,n,i=this;return _(this,function(r){switch(r.label){case 0:return e instanceof td?this.isReady?(this._logger.debug("send websocket request",e),[4,this.commandRouter.send(e)]):[3,2]:[3,4];case 1:case 5:case 7:return[2,r.sent()];case 2:if(this.isLazyCallActivated)return this._logger.debug("wait websocket request",e),t=new tI,this._lazyCallQueue.push({command:e,deferred:t,timeout:setTimeout(function(){return i.timeout(e.requestId)},1e4)}),[2,t.promise];throw this._logger.debug("fail websocket request"),D.connectionRequired;case 3:case 9:return[3,11];case 4:return e instanceof ta?this._session.hasSession?(this._logger.debug("send api request",e),[4,this.commandRouter.send(e)]):[3,6]:[3,10];case 6:return e.hasSessionKey?(this._logger.debug("send api request with tmp session key",e),[4,this.commandRouter.send(e)]):[3,8];case 8:if(this.isLazyCallActivated)return this._logger.debug("wait api request",e),t=new tI,this._lazyCallQueue.push({command:e,deferred:t,timeout:setTimeout(function(){return i.timeout(e.requestId)},1e4)}),[2,t.promise];throw n=D.connectionRequired,this._logger.debug("fail api request",n),n;case 10:throw D.invalidCommand;case 11:return[2]}})})},e.prototype.forceSend=function(e){return d(this,void 0,void 0,function(){return _(this,function(t){switch(t.label){case 0:return this._logger.debug("send forced request",e),e instanceof td||e instanceof ta?[4,this.commandRouter.send(e)]:[3,2];case 1:return[2,t.sent()];case 2:throw D.invalidCommand}})})},e.prototype.timeout=function(e){this._logger.debug("timeout request",e);var t=this._lazyCallQueue.findIndex(function(t){return t.command.requestId===e});t>-1&&(this._lazyCallQueue[t].deferred.reject(D.connectionRequired),this._lazyCallQueue.splice(t,1))},e.prototype.cancel=function(e){this._logger.debug("cancel api request",e),this.commandRouter.cancel(e)},e.prototype.cancelAll=function(){this._logger.debug("cancel all api requests"),this.commandRouter.cancelAll()},e}(),of="sendbird@devicetokens",op=function(){function e(e){var t=e.type,n=e.token,i=e.device_os,r=e.device_manufacturer,o=e.system_push_enabled;this.type=t,this.token=n,this.deviceOS=i,this.deviceManufacturer=r,this.systemPushEnabled=o}return e.payloadify=function(e){return ew(eN({type:e.type,token:e.token,device_os:e.deviceOS,device_manufacturer:e.deviceManufacturer,system_push_enabled:e.systemPushEnabled}))},e}(),oE=new WeakMap,og=function(e){function t(t){var n=t._iid,i=t.session,r=t.cacheContext,o=t.sdkState,s=t.dispatcher,a=t.requestQueue,c=t.logger,u=t.pushNotificationAckManager,l=e.call(this)||this;return l._currentConnectionStateType=rr.INITIALIZED,l._isRefreshingAuthToken=!1,l.currentUser=null,l.session=i,l._iid=n,l._cacheContext=r,l._sdkState=o,l._dispatcher=s,l._requestQueue=a,l._logger=c,l._pushNotificationAckManager=u,l._deviceTokens=[],l._dispatcher.on(function(e){var t,n,i;if(e instanceof rd){var r=e.stateType;l._currentConnectionStateType=r}else if(e instanceof tl&&l.handler&&!l.isSessionKeyRefreshing){if(l._currentConnectionStateType===rr.CONNECTING)return;(null===(t=e.error)||void 0===t?void 0:t.isSessionInvalidatedError)?l.clear():((null===(n=e.error)||void 0===n?void 0:n.isSessionTokenExpiredError)&&l.refreshAuthToken().catch(function(e){if(I(e)&&"foreground"===l._sdkState.appState)throw e}),(null===(i=e.error)||void 0===i?void 0:i.isSessionKeyExpiredError)&&(l._logger.debug("session expired"),l.handler.onSessionExpired&&l.handler.onSessionExpired(),l._currentConnectionStateType===rr.CONNECTED&&l._dispatcher.dispatch(new tg(new tC({type:ts.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:g.SESSION_KEY_EXPIRED,error_description:"cause=session_expired"}}))),l.refreshSessionKey().catch(function(e){if(I(e)&&"foreground"===l._sdkState.appState)throw e})))}}),l}return u(t,e),Object.defineProperty(t.prototype,"ekey",{get:function(){return oE.get(this)}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceTokens",{get:function(){return this._deviceTokens},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"deviceTokenLastDeletedAt",{get:function(){return this._deviceTokenLastDeletedAt},enumerable:!1,configurable:!0}),t.prototype.indexOfDeviceToken=function(e,t){return this._deviceTokens.findIndex(function(n){return n.type===e&&n.token===t})},t.prototype.hasDeviceToken=function(e,t){return this.indexOfDeviceToken(e,t)>=0},t.prototype.createRefreshWebsocketCommand=function(e,t){return new tf({authToken:e,expiringSession:!0,requestId:t})},t.prototype._refreshSessionKeyByWebSocket=function(e){return d(this,void 0,void 0,function(){var t,n,i,r;return _(this,function(o){switch(o.label){case 0:return t=this.createRefreshWebsocketCommand(e),[4,this._requestQueue.forceSend(t)];case 1:if(i=(n=o.sent().as(tE)).newKey,r=n.error)throw r;return this.session.sessionKey=null!=i?i:this.session.sessionKey,[2]}})})},t.prototype._refreshSessionKeyByApi=function(e){return d(this,void 0,void 0,function(){var t,n=this;return _(this,function(i){switch(i.label){case 0:return t=new t_({userId:this._sdkState.userId,authToken:e,services:this.session.services&&this.session.services.length>0?this.session.services:void 0,expiringSession:!0}),[4,r5(function(e){return d(n,void 0,void 0,function(){var n,i,r,o;return _(this,function(s){switch(s.label){case 0:return s.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(t)];case 1:return i=(n=s.sent().as(tp)).key,r=n.services,this.session.sessionKey=i,this.session.services=r,[3,3];case 2:if(o=s.sent(),!this._isSessionRelatedError(o))throw o;return e(o),[3,3];case 3:return[2]}})})},3)];case 1:return i.sent(),[2]}})})},t.prototype._refreshSessionKey=function(e,t){return void 0===t&&(t=!0),d(this,void 0,void 0,function(){var n,i;return _(this,function(r){switch(r.label){case 0:if(this._currentConnectionStateType!==rr.CONNECTED)return[3,8];r.label=1;case 1:return r.trys.push([1,3,,8]),[4,this._refreshSessionKeyByWebSocket(e)];case 2:return r.sent(),this.complete(),[2];case 3:n=r.sent(),r.label=4;case 4:return r.trys.push([4,6,,7]),[4,this._handleSessionRefreshError(n,t)];case 5:return r.sent(),[2];case 6:return r.sent(),[3,7];case 7:return[3,8];case 8:return r.trys.push([8,10,,12]),[4,this._refreshSessionKeyByApi(e)];case 9:return r.sent(),this.complete(),[3,12];case 10:return i=r.sent(),[4,this._handleSessionRefreshError(i,t)];case 11:return r.sent(),[3,12];case 12:return[2]}})})},t.prototype._receiveNewAuthToken=function(){var e,t=this,n=new tI;if(this._isRefreshingAuthToken=!0,this.session.sessionKey=void 0,this.session.authToken=void 0,null===(e=this.handler)||void 0===e?void 0:e.onSessionTokenRequired){var i=null,r=function(){i&&(clearTimeout(i),i=null)},o=function(e){r(),t._isRefreshingAuthToken&&(t._isRefreshingAuthToken=!1,n.resolve(e))},s=function(e){r(),t._isRefreshingAuthToken&&(t._isRefreshingAuthToken=!1,n.reject(e))};i=setTimeout(function(){return s()},1e3*this._sdkState.sessionTokenRefreshTimeout),re(function(){return d(t,void 0,void 0,function(){var e;return _(this,function(t){return(null===(e=this.handler)||void 0===e?void 0:e.onSessionTokenRequired)&&this.handler.onSessionTokenRequired(o,s),[2]})})})}else n.resolve(null);return n.promise},t.prototype._handleSessionRefreshError=function(e,t){return void 0===t&&(t=!1),d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return e instanceof D&&(e.isSessionTokenExpiredError||e.code===g.APPLICATION_NOT_FOUND)?(this.session.authToken=void 0,t?[4,this._receiveNewAuthToken()]:[3,6]):[3,6];case 1:return(n=i.sent())?(this.session.authToken=n,[4,this._refreshSessionKey(this.session.authToken,!1)]):[3,3];case 2:return i.sent(),[3,5];case 3:return[4,this.clear()];case 4:i.sent(),i.label=5;case 5:return[2];case 6:throw e}})})},t.prototype._isSessionRelatedError=function(e){return e instanceof D&&(e.isSessionExpiredError||e.isSessionInvalidatedError)},Object.defineProperty(t.prototype,"isSessionKeyRefreshing",{get:function(){return this.session.isRefreshing}
1,enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isRefreshingAuthToken",{get:function(){return this._isRefreshingAuthToken},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isSessionExpiring",{get:function(){return!!this.handler},enumerable:!1,configurable:!0}),t.prototype.authenticate=function(e,t){var n;return d(this,void 0,void 0,function(){var i,r,o,s;return _(this,function(a){switch(a.label){case 0:return this.session.authToken=t,i=0,[4,this._cacheContext.preference.get(rN(this._sdkState.appId))];case 1:return(r=a.sent())&&(i=r.configTs),o=new oa({appId:this._sdkState.appId,userId:e,includeUIKitConfig:!!(null!==(n=this._sdkState.extensions)&&void 0!==n?n:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:this.isSessionExpiring,configTs:i}),[4,this._requestQueue.commandRouter.send(o)];case 2:return(s=a.sent().as(oc).logi).error?[3,5]:this.session.hasChatServicePermission?[3,4]:[4,s.applyTo(this._iid)];case 3:a.sent(),a.label=4;case 4:return[3,6];case 5:throw s.error;case 6:return[2]}})})},t.prototype.login=function(e){var t;return d(this,void 0,void 0,function(){var n,i,r,o,s,a,c,u;return _(this,function(l){switch(l.label){case 0:return n=e.key,i=e.ekey,r=e.services,o=e.userProfile,a=void 0===(s=e.deviceTokenLastDeletedAt)?0:s,this.session.sessionKey=n,this.session.services=r,oE.set(this,i),this._deviceTokenCacheEnabled=null===(t=null==o?void 0:o.appInfo)||void 0===t?void 0:t.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(of)]:[3,5];case 1:return(u=l.sent())&&!(u.lastDeletedAt<a)?[3,3]:(this._deviceTokens=[],this._deviceTokenLastDeletedAt=a,[4,this.saveDeviceToken()]);case 2:return l.sent(),[3,4];case 3:this._deviceTokens=u.tokens.map(function(e){return new op(op.payloadify(e))}),this._deviceTokenLastDeletedAt=u.lastDeletedAt,l.label=4;case 4:return[3,7];case 5:return[4,c.remove(of)];case 6:l.sent(),l.label=7;case 7:return[2]}})})},t.prototype.complete=function(){var e=this;this.dispatch("refresh"),this._dispatcher.dispatch(new r_),re(function(){return d(e,void 0,void 0,function(){var e;return _(this,function(t){return this._logger.debug("session refreshed"),(null===(e=this.handler)||void 0===e?void 0:e.onSessionRefreshed)&&this.handler.onSessionRefreshed(),[2]})})})},t.prototype.error=function(e){var t=this;re(function(){return d(t,void 0,void 0,function(){var t;return _(this,function(n){return(null===(t=this.handler)||void 0===t?void 0:t.onSessionError)&&this.handler.onSessionError(e),[2]})})})},t.prototype.close=function(){var e=this;this.dispatch("close"),this._dispatcher.dispatch(new rp),re(function(){return d(e,void 0,void 0,function(){var e;return _(this,function(t){return this._logger.debug("session closed"),(null===(e=this.handler)||void 0===e?void 0:e.onSessionClosed)&&this.handler.onSessionClosed(),[2]})})})},t.prototype.refreshAuthToken=function(){return d(this,void 0,void 0,function(){var e,t;return _(this,function(n){switch(n.label){case 0:if(e=null,!this.isSessionExpiring||this.session.isRefreshing)return[3,9];this.session.isRefreshing=!0,n.label=1;case 1:return n.trys.push([1,7,8,9]),[4,this._receiveNewAuthToken()];case 2:return(e=n.sent())?(this._logger.debug("session refreshing.."),this.session.authToken=e,[4,this._refreshSessionKey(this.session.authToken)]):[3,4];case 3:return n.sent(),[3,6];case 4:return[4,this.clear()];case 5:n.sent(),n.label=6;case 6:return[3,9];case 7:throw n.sent(),t=e?D.sessionTokenRefreshFailed:D.sessionTokenRequestFailed,this._dispatcher.dispatch(new rf),this.error(t),this._logger.debug("refresh auth token error = ",t),t;case 8:return this.session.isRefreshing=!1,[7];case 9:return[2]}})})},t.prototype.refreshSessionKey=function(){return d(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:if(!this.isSessionExpiring||this.session.isRefreshing)return[3,5];this.session.isRefreshing=!0,t.label=1;case 1:return t.trys.push([1,3,4,5]),[4,this._refreshSessionKey(this.session.authToken)];case 2:return t.sent(),[3,5];case 3:throw t.sent(),e=D.sessionTokenRefreshFailed,this._dispatcher.dispatch(new rf),this.error(e),e;case 4:return this.session.isRefreshing=!1,[7];case 5:return[2]}})})},t.prototype.setDeviceToken=function(e,t,n){if(this._deviceTokenCacheEnabled&&0>this.indexOfDeviceToken(e,t)){var i=new op({type:e,token:t,device_os:null==n?void 0:n.deviceOS,device_manufacturer:null==n?void 0:n.deviceManufacturer,system_push_enabled:null==n?void 0:n.systemPushEnabled});return this._deviceTokens.push(i),!0}return!1},t.prototype.unsetDeviceToken=function(e,t){if(this._deviceTokenCacheEnabled){var n=this.indexOfDeviceToken(e,t);n>=0&&this._deviceTokens.splice(n,1)}},t.prototype.unsetDeviceTokens=function(e){this._deviceTokenCacheEnabled&&(this._deviceTokens=e?this._deviceTokens.filter(function(t){return t.type!==e}):[])},t.prototype.setDeviceTokenDeletedAt=function(e){e>0&&(this._deviceTokenLastDeletedAt=e)},t.prototype.saveDeviceToken=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return this._deviceTokenCacheEnabled?[4,this._cacheContext.preference.set(of,{tokens:this._deviceTokens,lastDeletedAt:this._deviceTokenLastDeletedAt})]:[3,2];case 1:e.sent(),e.label=2;case 2:return[2]}})})},t.prototype.clear=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return this.currentUser=null,this.session.clear(),this.close(),oE.delete(this),this._deviceTokens=[],this._deviceTokenLastDeletedAt=0,[4,this.saveDeviceToken()];case 1:return e.sent(),this._pushNotificationAckManager.clear(),[2]}})})},t}(eT),ov=function(e,t){var n,i;if(null!==e&&null!==t){var r=Object.keys(e),o=Object.keys(t),s=E([],p(new Set(E(E([],p(r),!1),p(o),!1))),!1),a={};try{for(var c=f(s),u=c.next();!u.done;u=c.next()){var l=u.value,h=typeof e[l],d=typeof t[l];"undefined"===h?a[l]=t[l]:"undefined"===d?a[l]=e[l]:h!==d?a[l]=t[l]:"object"===h&&e[l]&&t[l]?a[l]=ov(e[l],t[l]):a[l]=t[l]}}catch(e){n={error:e}}finally{try{u&&!u.done&&(i=c.return)&&i.call(c)}finally{if(n)throw n.error}}return a}return t};(om=ol||(ol={}
1))[om.PENDING=0]="PENDING",om[om.COLLECT_ONLY=1]="COLLECT_ONLY",om[om.ENABLED=2]="ENABLED",om[om.DISABLED=3]="DISABLED",(oy=oh||(oh={})).DAILY="daily",oy.DEFAULT="default",oy.REALTIME="realtime";var om,oy,ob,oT=function(){function e(e){var t=e.deviceId,n=e.cacheContext,i=e.requestQueue;this.queue=[],this.flushWaitQueue=[],this.enabledState=ol.PENDING,this.isFlushing=!1,this._sentLogStats=[],this.deviceId=t,this.cacheContext=n,this.requestQueue=i,this.logInfo={deviceId:t,statLogs:[],generation:1,lastFlushedAt:0},this.limit=100}return Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this.enabledState===ol.ENABLED},enumerable:!1,configurable:!0}),e.prototype.init=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return this.key=e,[4,this.cacheContext.preference.get(this.key)];case 1:return(t=n.sent())&&(this.logInfo=t),[2]}})})},e.prototype._mergeQueue=function(){this.flushWaitQueue.length>0&&(this.queue=this.queue.concat(this.flushWaitQueue),this.flushWaitQueue=[])},e.prototype._isDuplicateStat=function(e){var t=this._sentLogStats.find(function(t){var n;return t.channelUrl===e.data.channel_url&&t.messageId===(null!==(n=e.data.notificationId)&&void 0!==n?n:e.data.message_id)&&t.action===e.data.action});return t||this._sentLogStats.push({channelUrl:e.data.channel_url,messageId:e.data.message_id,action:e.data.action}),!!t},e.prototype._save=function(){return d(this,void 0,void 0,function(){var e;return _(this,function(t){switch(t.label){case 0:return e=E(E([],p(this.queue),!1),p(this.flushWaitQueue),!1),[4,this.cacheContext.preference.set(this.key,{deviceId:this.logInfo.deviceId,statLogs:e.map(function(e){return tC.payloadify(e)}),generation:this.logInfo.generation++,lastFlushedAt:this.logInfo.lastFlushedAt})];case 1:return t.sent(),[2]}})})},e.prototype.clear=function(){return d(this,void 0,void 0,function(){return _(this,function(e){return this.queue=[],this.flushWaitQueue=[],this.logInfo.generation=1,this._save(),[2]})})},e}(),oC=function(e){function t(t){var n,i,r,o,s=t.type,a=t.data,c=t.ts,u=void 0===c?Date.now():c,l=e.call(this,{type:s,data:a,ts:u})||this;return l.date=new Date(u),l.key="".concat((i=(n=l.date).getFullYear(),r=String(n.getMonth()+1).padStart(2,"0"),o=String(n.getDate()).padStart(2,"0"),"".concat(i).concat(r).concat(o)),"_").concat(s),l}return u(t,e),t}(tC),oS=function(e){function t(t){var n=t.deviceId,i=t.statLogs,r=e.call(this)||this;return r.method=eH.POST,r.path="".concat(e1),r.params={device_id:n,log_entries:i.map(function(e){return tC.payloadify(e)})},r}return u(t,e),t}(ta),ow=function(e){function t(t){var n=t.deviceId,i=t.cacheContext,r=t.requestQueue;return e.call(this,{deviceId:n,cacheContext:i,requestQueue:r})||this}return u(t,e),Object.defineProperty(t.prototype,"_isSendable",{get:function(){return 0!==this.queue.length&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval},enumerable:!1,configurable:!0}),t.prototype.init=function(t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return[4,e.prototype.init.call(this,t+".daily")];case 1:return n.sent(),this.queue=this.logInfo.statLogs.map(function(e){return new tC({type:e.stat_type,ts:e.ts,data:e.data})}),[2]}})})},t.prototype.setConfig=function(e,t){return d(this,void 0,void 0,function(){var n,i,r,o;return _(this,function(s){switch(s.label){case 0:return this.statConfig=e,this.statConfig.minInterval=864e5,this._mergeQueue(),t.localCacheStat?(this.enabledState=t.enabledStat?ol.ENABLED:ol.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=ol.DISABLED,[4,this.clear()];case 2:s.sent(),s.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:n=s.sent(),i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),r=0,s.label=5;case 5:return r<n.length?(o=n.slice(r,1+this.statConfig.maxStatCountPerRequest),[4,r3(i)]):[3,9];case 6:return s.sent(),[4,this._flush(o)];case 7:s.sent(),s.label=8;case 8:return r+=this.statConfig.maxStatCountPerRequest,[3,5];case 9:return[2]}})})},t.prototype.put=function(e){return d(this,void 0,void 0,function(){var t,n,i;return _(this,function(r){switch(r.label){case 0:return this.enabledState===ol.DISABLED?[2,!0]:((n=p((t=this.enabledState===ol.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).filter(function(t){return t instanceof oC&&t.key===e.key}),1)[0])?n.data=ov(n.data,e.data):t.push(e),this.enabledState===ol.PENDING?[3,2]:[4,this._save()]);case 1:r.sent(),r.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this._isSendable?[4,this._getUploadStats()]:[3,5]):[3,5];case 3:return i=r.sent(),[4,this._flush(i)];case 4:return[2,r.sent()];case 5:return[2,!0]}})})},t.prototype._getUploadStats=function(){return d(this,void 0,void 0,function(){return _(this,function(e){return[2,this.queue.filter(function(e){if(e instanceof oC){var t=new Date,n=p([e.date.getFullYear(),t.getFullYear()],2),i=n[0],r=n[1];if(i<r)return!0;
1if(i===r){var o=p([e.date.getMonth(),t.getMonth()],2),s=o[0],a=o[1];if(s<a)return!0;if(s===a){var c=p([e.date.getDate(),t.getDate()],2);return c[0]<c[1]}}}return!1})]})})},t.prototype._flush=function(e){return d(this,void 0,void 0,function(){var t,n,i,r;return _(this,function(o){switch(o.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new oS({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=E([],p(e),!1).slice(n.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(r=o.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=ol.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=ol.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},t}(oT),oN=function(e){function t(t){var n=t.deviceId,i=t.cacheContext,r=t.requestQueue;return e.call(this,{deviceId:n,cacheContext:i,requestQueue:r})||this}return u(t,e),t.prototype._isSendable=function(e){if(void 0===e&&(e=!1),this.queue.length<this.statConfig.lowerThreshold)return!1;if(e){if(Date.now()-this.logInfo.lastFlushedAt<this.statConfig.minInterval)return!1}else if(this.queue.length<this.statConfig.minStatCount)return!1;return!0},t.prototype._filterQueueByType=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(n){return[2,t?e.filter(function(e){return e.type!==ts.FEATURE_LOCALCACHE_EVENT}):e.filter(function(e){return e.type===ts.FEATURE_LOCALCACHE_EVENT})]})})},t.prototype.init=function(t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return[4,e.prototype.init.call(this,t+".default")];case 1:return n.sent(),this.queue=this.logInfo.statLogs.map(function(e){return e.data=l({message_init_policy:"",starting_point:0},e.data),new tC({type:e.stat_type,ts:e.ts,data:e.data})}),[2]}})})},t.prototype.setConfig=function(e,t){return d(this,void 0,void 0,function(){var n,i,r;return _(this,function(o){switch(o.label){case 0:return this.statConfig=e,this._mergeQueue(),t.requestStat||t.localCacheStat?(this.enabledState=t.enabledStat?ol.ENABLED:ol.COLLECT_ONLY,n=void 0,t.requestStat||(n=!1),t.localCacheStat||(n=!0),void 0===n?[3,3]:(i=this,[4,this._filterQueueByType(this.queue,n)])):[3,4];case 1:return i.queue=o.sent(),r=this,[4,this._filterQueueByType(this.flushWaitQueue,n)];case 2:r.flushWaitQueue=o.sent(),this._save(),o.label=3;case 3:return[3,6];case 4:return this.enabledState=ol.DISABLED,[4,this.clear()];case 5:o.sent(),o.label=6;case 6:return this.isEnabled&&this._isSendable(!0)?[4,r3(Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100))]:[3,9];case 7:return o.sent(),[4,this._flush(this.queue)];case 8:o.sent(),o.label=9;case 9:return[2]}})})},t.prototype.put=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return this.enabledState===ol.DISABLED?[2,!0]:((t=this.enabledState===ol.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).push(e),this.enabledState===ol.PENDING?[3,2]:[4,this._save()]);case 1:n.sent(),n.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this._isSendable()?[4,this._flush(t)]:[3,4]):[3,4];case 3:return[2,n.sent()];case 4:return[2,!0]}})})},t.prototype._flush=function(e){return d(this,void 0,void 0,function(){var t,n,i,r;return _(this,function(o){switch(o.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new oS({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=E([],p(e),!1).slice(n.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(r=o.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=ol.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=ol.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},t}(oT),oA=function(e){function t(t){var n=t.deviceId,i=t.statLogs,r=e.call(this)||this;return r.method=eH.POST,r.path="".concat(e2),r.params={device_id:n,log_entries:i.map(function(e){return tC.payloadify(e)})},r}return u(t,e),t}(ta),oI=function(e){function t(t){var n=t.deviceId,i=t.cacheContext,r=t.requestQueue;return e.call(this,{deviceId:n,cacheContext:i,requestQueue:r})||this}return u(t,e),Object.defineProperty(t.prototype,"_isSendable",{get:function(){return this.queue.length>=this.statConfig.minStatCount&&this.queue.length>this.statConfig.lowerThreshold||this.logInfo.lastFlushedAt>0&&Date.now()-this.logInfo.lastFlushedAt>=this.statConfig.minInterval}
1,enumerable:!1,configurable:!0}),t.prototype.init=function(t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return[4,e.prototype.init.call(this,t+".realtime")];case 1:return n.sent(),this.queue=this.logInfo.statLogs.map(function(e){var t;return e.data=ew(l(l({},e.data),{message_id:null!==(t=e.data.notificationId)&&void 0!==t?t:e.data.message_id,notificationId:void 0})),new tC({type:e.stat_type,ts:e.ts,data:e.data})}),this._sentLogStats=this.queue.map(function(e){var t;return{channelUrl:e.data.channelUrl,messageId:null!==(t=e.data.notificationId)&&void 0!==t?t:e.data.message_id,action:e.data.action}}),[2]}})})},t.prototype.setConfig=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return this.statConfig=e,this._mergeQueue(),t.notificationStat?(this.enabledState=t.enabledStat?ol.ENABLED:ol.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=ol.DISABLED,[4,this.clear()];case 2:n.sent(),n.label=3;case 3:return this.isEnabled&&this._isSendable?[4,r3(Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100))]:[3,6];case 4:return n.sent(),[4,this._flush(this.queue)];case 5:n.sent(),n.label=6;case 6:return[2]}})})},t.prototype.put=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return this.enabledState===ol.DISABLED?[2,!0]:(t=this.enabledState===ol.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(e)?[2,!0]:(t.push(e),this.enabledState===ol.PENDING?[3,2]:[4,this._save()]));case 1:n.sent(),n.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this.isEnabled&&this._isSendable?[4,this._flush(t)]:[3,4]):[3,4];case 3:return[2,n.sent()];case 4:return[2,!0]}})})},t.prototype._flush=function(e){return d(this,void 0,void 0,function(){var t,n,i,r;return _(this,function(o){switch(o.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new oA({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=E([],p(e),!1).slice(n.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(r=o.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=ol.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=ol.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},t}(oT),oD=function(e){function t(t){var n=t.deviceId,i=t.statLogs,r=e.call(this)||this;return r.method=eH.POST,r.path="".concat(e3),r.params={device_id:n,log_entries:i.map(function(e){return tC.payloadify(e)})},r}return u(t,e),t}(ta),oO=function(e){function t(t){var n=t.deviceId,i=t.cacheContext,r=t.requestQueue;return e.call(this,{deviceId:n,cacheContext:i,requestQueue:r})||this}return u(t,e),t.prototype._isSendable=function(e){if(void 0===e&&(e=!1),this.queue.length<this.statConfig.lowerThreshold)return!1;if(e){if(Date.now()-this.logInfo.lastFlushedAt<this.statConfig.minInterval)return!1}else if(this.queue.length<this.statConfig.minStatCount)return!1;return!0},t.prototype.init=function(t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return[4,e.prototype.init.call(this,t+".aiagent")
1];case 1:return n.sent(),this.queue=this.logInfo.statLogs.map(function(e){return new tC({type:e.stat_type,ts:e.ts,data:e.data,runtimeId:e.runtime_id})}),[2]}})})},t.prototype.setConfig=function(e,t){return d(this,void 0,void 0,function(){return _(this,function(n){switch(n.label){case 0:return this.statConfig=e,this._mergeQueue(),t.aiAgentStat?(this.enabledState=t.enabledStat?ol.ENABLED:ol.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=ol.DISABLED,[4,this.clear()];case 2:n.sent(),n.label=3;case 3:return this.isEnabled&&this._isSendable(!0)?[4,r3(Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100))]:[3,6];case 4:return n.sent(),[4,this._flush(this.queue)];case 5:n.sent(),n.label=6;case 6:return[2]}})})},t.prototype.put=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return this.enabledState===ol.DISABLED?[2,!0]:((t=this.enabledState===ol.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).push(e),this.enabledState===ol.PENDING?[3,2]:[4,this._save()]);case 1:n.sent(),n.label=2;case 2:return this.isEnabled?(this._mergeQueue(),this._isSendable()?[4,this._flush(t)]:[3,4]):[3,4];case 3:return[2,n.sent()];case 4:return[2,!0]}})})},t.prototype._flush=function(e){return d(this,void 0,void 0,function(){var t,n,i,r;return _(this,function(o){switch(o.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,o.label=1;case 1:return o.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new oD({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return o.sent(),this.queue=E([],p(e),!1).slice(n.length).concat(this.flushWaitQueue),this.flushWaitQueue=[],this.limit=100,this.logInfo.lastFlushedAt=Date.now(),[4,this._save()];case 3:return o.sent(),[3,9];case 4:return(r=o.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return o.sent(),this.enabledState=ol.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=ol.COLLECT_ONLY),o.label=7;case 7:return this.limit=this.limit+20,t=!1,[3,9];case 8:return this.isFlushing=!1,[7];case 9:return[3,11];case 10:this.isFlushing=!1,o.label=11;case 11:return[2,t]}})})},t}(oT),ok=function(){function e(e){var t=e.cacheContext,n=e.requestQueue,i=e.dispatcher,r=e.logger;this._collectRequestStat=!0,this._collectFeatureLocalCacheStat=!0,this._collectionNotificationStat=!0,this._collectAIAgentStat=!0,this._retryCount=0,this.deviceId=ey(),this.cacheContext=t,this.requestQueue=n,this.dispatcher=i,this.logger=r,this._dailyStatCollector=new ow({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new oN({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._notificationStatCollector=new oI({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._aiAgentStatCollector=new oO({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue})}return e.prototype._migration=function(){return d(this,void 0,void 0,function(){var e,t,n,i;return _(this,function(r){switch(r.label){case 0:return[4,this.cacheContext.preference.get(this.key)];case 1:return(e=r.sent())?(t=[],e.statLogs.forEach(function(e){e.stat_type===ts.FEATURE_LOCALCACHE&&t.push(new tC({type:e.stat_type,ts:e.ts,data:e.data}))}),[4,this.cacheContext.preference.set(this.key+".daily",{deviceId:e.deviceId,statLogs:t.map(function(e){return tC.payloadify(e)}),generation:e.generation,lastFlushedAt:e.lastFlushedAt})]):[3,6];case 2:return r.sent(),n=[],e.statLogs.forEach(function(e){e.stat_type!==ts.FEATURE_LOCALCACHE&&e.stat_type!==ts.NOTIFICATION&&(e.stat_type===ts.FEATURE_LOCALCACHE_EVENT&&(e.data=l({message_init_policy:"",starting_point:0},e.data)),n.push(new tC({type:e.stat_type,ts:e.ts,data:e.data})))}),[4,this.cacheContext.preference.set(this.key+".default",{deviceId:e.deviceId,statLogs:n.map(function(e){return tC.payloadify(e)}),generation:e.generation,lastFlushedAt:e.lastFlushedAt})];
1case 3:return r.sent(),i=[],e.statLogs.forEach(function(e){var t;e.stat_type===ts.NOTIFICATION&&(e.data=ew(l(l({},e.data),{message_id:null!==(t=e.data.notificationId)&&void 0!==t?t:e.data.message_id,notificationId:void 0})),i.push(new tC({type:e.stat_type,ts:e.ts,data:e.data})))}),[4,this.cacheContext.preference.set(this.key+".realtime",{deviceId:e.deviceId,statLogs:i.map(function(e){return tC.payloadify(e)}),generation:e.generation,lastFlushedAt:e.lastFlushedAt})];case 4:return r.sent(),[4,this.cacheContext.preference.remove(this.key)];case 5:r.sent(),r.label=6;case 6:return[2]}})})},e.prototype.init=function(e){return d(this,void 0,void 0,function(){var t=this;return _(this,function(n){switch(n.label){case 0:return this.key=e,[4,this._migration()];case 1:return n.sent(),[4,this._dailyStatCollector.init(this.key)];case 2:return n.sent(),[4,this._defaultStatCollector.init(this.key)];case 3:return n.sent(),[4,this._notificationStatCollector.init(this.key)];case 4:return n.sent(),[4,this._aiAgentStatCollector.init(this.key)];case 5:return n.sent(),this.commandEventContext||(this.commandEventContext=this.dispatcher.on(function(e){return d(t,void 0,void 0,function(){var t,n,i,r,o,s;return _(this,function(a){return e instanceof tg?(t=e.statLog,this.put(t)):e instanceof rQ&&(n=e.request,i=e.features,r=e.options,o=e.statConfigInfo,this._retryCount=0,this._collectRequestStat=n,this._collectFeatureLocalCacheStat=null==i?void 0:i.localCache,this._collectionNotificationStat=null==i?void 0:i.notification,this._collectAIAgentStat=null==i?void 0:i.aiAgent,this._statConfig=o,this._dailyStatCollector.setConfig(this._statConfig.default,{localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:r.ingestion}),this._defaultStatCollector.setConfig(this._statConfig.default,{requestStat:this._collectRequestStat,localCacheStat:this._collectFeatureLocalCacheStat,enabledStat:r.ingestion}),this._notificationStatCollector.setConfig(null!==(s=this._statConfig.realTime)&&void 0!==s?s:this._statConfig.default,{notificationStat:this._collectionNotificationStat,enabledStat:r.ingestion}),this._aiAgentStatCollector.setConfig(this._statConfig.default,{aiAgentStat:this._collectAIAgentStat,enabledStat:r.ingestion})),[2]})})})),[2]}})})},e.prototype.put=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return t=!0,e instanceof oC?this._collectFeatureLocalCacheStat?[4,this._dailyStatCollector.put(e)]:[3,2]:[3,3];case 1:t=n.sent(),n.label=2;case 2:return[3,16];case 3:switch(e.type){case ts.API_RESULT:case ts.WEBSOCKET_CONNECT:case ts.WEBSOCKET_DISCONNECT:return[3,4];case ts.FEATURE_LOCALCACHE:case ts.FEATURE_LOCALCACHE_EVENT:return[3,7];case ts.NOTIFICATION:return[3,10];case ts.AI_AGENT_SDK_STATS:return[3,13]}return[3,16];case 4:return this._collectRequestStat?[4,this._defaultStatCollector.put(e)]:[3,6];case 5:t=n.sent(),n.label=6;case 6:return[3,16];case 7:return this._collectFeatureLocalCacheStat?[4,this._defaultStatCollector.put(e)]:[3,9];case 8:t=n.sent(),n.label=9;case 9:return[3,16];case 10:return this._collectionNotificationStat?[4,this._notificationStatCollector.put(e)]:[3,12];case 11:t=n.sent(),n.label=12;case 12:return[3,16];case 13:return this._collectAIAgentStat?[4,this._aiAgentStatCollector.put(e)]:[3,15];case 14:t=n.sent(),n.label=15;case 15:return[3,16];case 16:return t?this._retryCount=0:(this._retryCount++,this._retryCount>20&&(this._dailyStatCollector.enabledState=ol.COLLECT_ONLY,this._defaultStatCollector.enabledState=ol.COLLECT_ONLY,this._notificationStatCollector.enabledState=ol.COLLECT_ONLY,this._aiAgentStatCollector.enabledState=ol.COLLECT_ONLY,this.logger.debug(D.statLogUploadLimitExceededError))),[2]}})})},e.prototype.appendStat=function(e,t,n){if(e===ts.AI_AGENT_SDK_STATS&&!this._collectAIAgentStat||e===ts.NOTIFICATION&&!this._collectionNotificationStat||(e===ts.API_RESULT||e===ts.WEBSOCKET_CONNECT||e===ts.WEBSOCKET_DISCONNECT)&&!this._collectRequestStat||(e===ts.FEATURE_LOCALCACHE||e===ts.FEATURE_LOCALCACHE_EVENT)&&!this._collectFeatureLocalCacheStat)return!1;var i=new tC({type:e,ts:Date.now(),data:t,runtimeId:n}
1);return this.put(i),!0},e.prototype.close=function(){this.commandEventContext&&(this.commandEventContext.close(),this.commandEventContext=void 0)},e}(),oR=function(){function e(e){var t=e.limit;this.workersByKey={},this.limit=void 0===t?5:t}return e.prototype.run=function(e,t){return d(this,void 0,void 0,function(){var n;return _(this,function(i){switch(i.label){case 0:return this.workersByKey[e]||(this.workersByKey[e]=[]),this.workersByKey[e].length<this.limit?(this.workersByKey[e].push(t),[4,t()]):[3,2];case 1:return n=i.sent(),this.workersByKey[e].pop(),[2,n];case 2:throw D.tooManyRequests}})})},e.prototype.clear=function(e){this.workersByKey[e]=[]},e}();(oL=ob||(ob={})).DELIVERY_RECEIPT="delivery_receipt",oL.PUSH_ACKNOWLEDGEMENT="push_acknowledgement";var oL,oU,ox=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t._pushAckedCache={},t}return u(t,e),t.prototype.isAcked=function(e,t){var n,i="".concat(e,"_").concat(t);return null!==(n=this._pushAckedCache[i])&&void 0!==n&&n},t.prototype.markAsAcked=function(e,t){var n="".concat(e,"_").concat(t);this._pushAckedCache[n]=!0},t.prototype.clear=function(){oG.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},t.prototype.parseData=function(e){var t,n,i,r,o=oG.of(this._iid).logger,s=e.sendbird;if("string"==typeof s)try{s=JSON.parse(s)}catch(e){throw o.info("push notification payload does not contain sendbird payload in JSON format."),D.malformedDataError}if(!s||"object"!=typeof s)throw o.info("push notification payload does not contain sendbird payload in JSON format."),D.malformedDataError;var a=null!==(t=s.push_tracking_id)&&void 0!==t?t:"",c=s.notification_message_id,u=s.notification_channel_key,l=s.notification_template_key,h=s.notification_event_deadline,d=null!==(n=s.session_key)&&void 0!==n?n:{},_=null!==(i=null==d?void 0:d.key)&&void 0!==i?i:"",f=null!==(r=null==d?void 0:d.topics)&&void 0!==r?r:[];if("string"!=typeof a||0===a.length)throw o.info("push tracking id is not available"),D.malformedDataError;if("string"!=typeof c||0===c.length)throw o.info("message id is not available"),D.malformedDataError;return{pushTrackingId:a,sessionKey:_,sessionTopics:f,messageId:c,channelKey:u,templateKey:l,notificationEventDeadline:h}},t}(rA),oP=function(e){this.name=e.name,this._custom=e.custom,this._usedByModerationEngine=e.used_by_moderation_engine},oM=function(e){function t(){var t=e.call(this)||this;return t.method=eH.GET,t.path=e6,t}return u(t,e),t}(ta),oq=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.reportCategories=n.categories,i}return u(t,e),t}(tc),oF=function(e){function t(t){var n=e.call(this,t)||this;return n._categories=[],n}return u(t,e),t.prototype.categories=function(){return d(this,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return 0!==this._categories.length?[3,2]:[4,this._fetchCategories()];case 1:e.sent(),e.label=2;case 2:return[2,this._categories]}})})},t.prototype._fetchCategories=function(){return d(this,void 0,void 0,function(){var e,t,n,i;return _(this,function(r){switch(r.label){case 0:return e=oG.of(this._iid).requestQueue,t=new oM,[4,e.send(t)];case 1:return(n=r.sent().as(oq).reportCategories)&&(i=this._categories).push.apply(i,E([],p(n.map(function(e){return new oP(e)})),!1)),[2]}})})},t}(rA),oH=function(){function e(){this._enabledRequestDedup=!0,this._requestCache=new Map,this._requestDedupInterval=500}return Object.defineProperty(e.prototype,"requestDedupInterval",{set:function(e){this._requestDedupInterval=e,this._requestDedupInterval<=0?this._enabledRequestDedup=!1:e<50&&(this._requestDedupInterval=50)},enumerable:!1,configurable:!0}),e.prototype.normalizePath=function(e){return e.replace("/v3/sdk/","/v3/")},e.prototype._generateCacheKey=function(e){var t=e.path,n=e.time,i=e.params,r=this.normalizePath(t),o=i?Object.entries(i).sort(function(e,t){var n=p(e,1)[0],i=p(t,1)[0];return n.localeCompare(i)}).map(function(e){var t=p(e,2),n=t[0],i=t[1];return"".concat(n,"=").concat(JSON.stringify(i))}).join("&"):"";return"".concat(r,"?").concat(o).concat(n?"_".concat(n):"")},e.prototype.requestGetChannel=function(e,t,n,i){var r,o,s=this;if(void 0===i&&(i=!0),!this._enabledRequestDedup)return t();var a=Date.now(),c=this._generateCacheKey({path:e,params:n});if(i)try{for(var u=f(this._requestCache.entries()),l=u.next();!l.done;l=u.next()){var h=p(l.value,2),d=h[0],_=h[1];if(d.startsWith(c)&&a-_.requestTime<=this._requestDedupInterval)return _.pendingResponse?Promise.resolve(_.pendingResponse):_.promise}}catch(e){r={error:e}}finally{try{l&&!l.done&&(o=u.return)&&o.call(u)}finally{if(r)throw r.error}}var E=i?this._generateCacheKey({path:e,time:a,params:n}):c,g=t().then(function(e){var t=s._requestCache.get(E);
1return t&&(t.pendingResponse=e,t.responseTime=Date.now()),Promise.resolve(e)}).catch(function(e){return Promise.reject(e)}).finally(function(){setTimeout(function(){s._requestCache.delete(E)},s._requestDedupInterval)});return this._requestCache.set(E,{requestTime:a,responseTime:null,promise:g,pendingResponse:null}),g},e.prototype.updatePendingResponse=function(e,t){var n,i;try{for(var r=f(this._requestCache.entries()),o=r.next();!o.done;o=r.next()){var s=p(o.value,2),a=s[0],c=s[1];if(a.includes(e.url)&&c.pendingResponse&&c.responseTime<t){var u=c.pendingResponse.payload,h=e.constructor.payloadify(e,!0),d=l(l({},u),h);c.pendingResponse=new tc(e._iid,d);break}}}catch(e){n={error:e}}finally{try{o&&!o.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},e}(),oV={},oG=function(){function e(e,t){var n,i,r,o,s,a,c,u,l,h;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!oV[e]){oV[e]=this;var d=null!==(n=t.options)&&void 0!==n?n:new K,_=this.sdkState={appId:t.appId,appVersion:null!==(i=t.appVersion)&&void 0!==i?i:"",appState:"foreground",isAppActive:!0,userId:void 0,extensions:{},api:{host:null!==(r=t.apiHost)&&void 0!==r?r:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:null!==(o=t.websocketHost)&&void 0!==o?o:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new r4,responseTimeout:d.websocketResponseTimeout},sessionTokenRefreshTimeout:d.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var f=this.logger=t.logger;this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,"string"==typeof t.localCacheEnabled&&(t.localCacheEnabled="true"===t.localCacheEnabled);var p=this.cacheContext=new W({encryption:t.encryption,store:t.store,localCacheEnabled:null!==(s=t.localCacheEnabled)&&void 0!==s&&s,localCacheConfig:null!==(a=t.localCacheConfig)&&void 0!==a?a:new er});this.debugMode=null!==(c=t.debugMode)&&void 0!==c&&c,this.maxSuperGroupChannelUnreadCount=m.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=d.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=d.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=d.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var E=this.dispatcher=new eC,g=new em;this.requestQueue=new o_(e,{session:g,sdkState:_,dispatcher:E,logger:f,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new ox(e),this.sessionManager=new og({_iid:e,session:g,cacheContext:p,sdkState:_,dispatcher:E,requestQueue:this.requestQueue,logger:f,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new r0(e,{sdkState:_,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:E,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:null!==(u=t.disableWebSocketCloseEventHandling)&&void 0!==u&&u,logger:f}),this.statManager=new ok({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:f}),this.appStateToggleEnabled=null===(l=t.appStateToggleEnabled)||void 0===l||l,this.supportMultipleTabs=null!==(h=t.supportMultipleTabs)&&void 0!==h&&h,this.messageBackgroun
1dSyncThrottleController=new oR({limit:5}),this.reportCategoryManager=new oF(e),this.requestDeduplicator=new oH}return oV[e]}return e.of=function(e){if(oV[e])return oV[e];throw D.lostInstance},e.clear=function(e){oV[e]&&delete oV[e]},e.prototype.hasExtension=function(e){return this.sdkState.extensions&&this.sdkState.extensions[e]},e}(),oz=function(){function e(){}return e.prototype.init=function(e,t){var n=t.sdkState,i=t.dispatcher,r=t.sessionManager,o=t.requestQueue,s=t.logger;t.onlineDetector;var a=t.cacheContext;this._iid=e,this._cacheContext=a,this._sdkState=n,this._dispatcher=i,this._sessionManager=r,this._requestQueue=o,this._logger=s},e}();(oj=oU||(oU={})).UNKNOWN="UNKNOWN",oj.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",oj.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",oj.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",oj.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",oj.EVENT_CHANNEL_UNREAD="EVENT_CHANNEL_UNREAD",oj.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",oj.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",oj.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",oj.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",oj.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",oj.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",oj.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",oj.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",oj.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",oj.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",oj.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",oj.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",oj.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",oj.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",oj.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",oj.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",oj.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",oj.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",oj.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",oj.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",oj.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",oj.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",oj.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",oj.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",oj.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",oj.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",oj.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",oj.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",oj.REQUEST_CHANNEL="REQUEST_CHANNEL",oj.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",oj.REFRESH_CHANNEL="REFRESH_CHANNEL",oj.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",oj.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",oj.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",oj.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",oj.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",oj.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",oj.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",oj.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",oj.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",oj.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",oj.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",oj.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",oj.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",oj.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",oj.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",oj.REQUEST_MESSAGE="REQUEST_MESSAGE",oj.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",oj.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",oj.EVENT_POLL_VOTED="EVENT_POLL_VOTED",oj.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",oj.EVENT_CHANNEL_CSAT_SUBMITTED="EVENT_CHANNEL_CSAT_SUBMITTED",oj.EVENT_CHANNEL_CONVERSATION_HANDEDOFF="EVENT_CHANNEL_CONVERSATION_HANDEDOFF",oj.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",oj.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",oj.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",oj.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",oj.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",oj.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",oj.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",oj.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",oj.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",oj.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED",l({},oU);var oj,oK,oB=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===oU.SYNC_MESSAGE_FILL||e===oU.SYNC_MESSAGE_CHANGELOGS||e===oU.SYNC_POLL_CHANGELOGS},oQ=function(e){function t(t){var n=t.messages,i=t.source,r=t.isWebSocketEventComing,o=e.call(this)||this;return o.messages=n,o.source=i,o.isWebSocketEventComing=void 0!==r&&r,o}return u(t,e),t}(eS),oW=function(e){function t(t){var n=t.messageIds,i=t.source,r=t.isWebSocketEventComing,o=e.call(this)||this;return o.messageIds=n,o.source=i,o.isWebSocketEventComing=void 0!==r&&r,o}return u(t,e),t}(eS),oZ=function(e){function t(t){var n=t.messageDeletionTimestamp,i=t.channelUrl,r=t.source,o=e.call(this)||this;return o.messageDeletionTimestamp=n,o.channelUrl=i,o.source=r,o}return u(t,e),t}(eS),oY=function(e){function t(t){var n=t.event,i=t.source,r=t.isWebSocketEventComing,o=e.call(this)||this;return o.event=n,o.source=i,o.isWebSocketEventComing=void 0!==r&&r,o}return u(t,e),t}(eS),oX=function(e){function t(t){var n=t.event,i=t.source,r=t.isWebSocketEventComing,o=e.call(this)||this;return o.event=n,o.source=i,o.isWebSocketEventComing=void 0!==r&&r,o}return u(t,e),t}(eS),oJ=function(e){function t(t){var n=t.reqId,i=t.source,r=e.call(this)||this;return r.reqId=n,r.source=i,r}return u(t,e),t}(eS),o$=function(e){function t(t){var n=t.polls,i=t.source,r=e.call(this)||this;return r.polls=n,r.source=i,r}return u(t,e),t}(eS),o0=function(e){function t(t){var n=t.event,i=t.source,r=e.call(this)||this;return r.event=n,r.source=i,r}return u(t,e),t}(eS),o1=function(e){function t(t){var n=t.event,i=t.source,r=e.call(this)||this;return r.event=n,r.source=i,r}return u(t,e),t}(eS);(s=oK||(oK={})).OPEN="open",s.CLOSED="closed";var o2="removed",o3=function(e){switch(e){case"open":return oK.OPEN;case"closed":return oK.CLOSED;default:return null}},o4=function(e){return!e||!!e.text&&L("string",e.text)},o5=function(e){function t(t,n){var i,r,o,s,a,c,u,l=this;return(l=e.call(this,t)||this).pollId=0,l.id=0,l.text=null,l.voteCount=0,l.createdBy=null,l.createdAt=0,l.updatedAt=0,l._lastVotedAt=0,l.pollId=null!==(i=n.poll_id)&&void 0!==i?i:0,l.id=null!==(r=n.id)&&void 0!==r?r:0,l.text=null!==(o=n.text)&&void 0!==o?o:null,l.voteCount=null!==(s=n.vote_count)&&void 0!==s?s:0,l.createdBy=null!==(a=n.created_by)&&void 0!==a?a:null,l.createdAt=null!==(c=n.created_at)&&void 0!==c?c:0,l.updatedAt=null!==(u=n.updated_at)&&void 0!==u?u:0,l}return u(t,e),t.payloadify=function(t){return ew(eN(l(l({},e.payloadify.call(this,t)),{vote_count:t.voteCount,poll_id:t.pollId,text:t.text,created_at:t.createdAt,id:t.id,created_by:t.createdBy,updated_at:t.updatedAt})))},t}(rA),o6=function(e){function t(t,n){var i,r,o,s,a,c,u,l,h,d,_,f,p,E=this;return(E=e.call(this,t)||this).id=0,E.title=null,E.createdAt=0,E.updatedAt=0,E.closeAt=-1,E.status=oK.CLOSED,E.messageId=0,E.data=null,E.voterCount=-1,E.options=[],E.createdBy=null,E.allowUserSuggestion=!1,E.allowMultipleVotes=!1,E.votedPollOptionIds=[],E.id=null!==(i=n.id)&&void 0!==i?i:0,E.title=null!==(r=n.title)&&void 0!==r?r:null,E.createdAt=null!==(o=n.created_at)&&void 0!==o?o:0,E.updatedAt=null!==(s=n.updated_at)&&void 0!==s?s:0,E.closeAt=null!==(a=n.close_at)&&void 0!==a?a:-1,E.status=null!==(c=o3(n.status))&&void 0!==c?c:oK.CLOSED,E.messageId=null!==(u=n.message_id)&&void 0!==u?u:0,E.data=null!==(l=n.data)&&void 0!==l?l:null,E.voterCount=null!==(h=n.voter_count)&&void 0!==h?h:-1,E.options=n.options?n.options.map(function(e){return new o5(E._iid,e)}):[],E.createdBy=null!==(d=n.created_by)&&void 0!==d?d:null,E.allowUserSuggestion=null!==(_=n.allow_user_suggestion)&&void 0!==_&&_,E.allowMultipleVotes=null!==(f=n.allow_multiple_votes)&&void 0!==f&&f,E.votedPollOptionIds=null!==(p=n.voted_option_ids)&&void 0!==p?p:[],E}return u(t,e),t.prototype._applyPollUpdatePayload=function(e){var t,n,i,r,o,s,a,c,u=this;this.title=null!==(t=e.title)&&void 0!==t?t:this.title,this.updatedAt=null!==(n=e.updated_at)&&void 0!==n?n:this.updatedAt,this.closeAt=null!==(i=e.close_at)&&void 0!==i?i:this.closeAt,this.status=null!==(r=o3(e.status))&&void 0!==r?r:this.status,this.data=null!==(o=e.data)&&void 0!==o?o:this.data,this.voterCount=null!==(s=e.voter_count)&&void 0!==s?s:this.voterCount,e.options&&(this.options=e.options.map(function(e){return new o5(u._iid,e)}),this.votedPollOptionIds=e.options.filter(function(e){return e.vote_count>0}).map(function(e){return e.id})),this.allowUserSuggestion=null!==(a=e.allow_user_suggestion)&&void 0!==a?a:this.allowUserSuggestion,this.allowMultipleVotes=null!==(c=e.allow_multiple_votes)&&void 0!==c?c:this.allowMultipleVotes},t.payloadify=function(t){return ew(eN(l(l({},e.payloadify.call(this,t)),{id:t.id,title:t.title,created_at:t.createdAt,updated_at:t.updatedAt,close_at:t.closeAt,status:t.status,message_id:t.messageId,data:t.data,voter_count:t.voterCount,options:t.options.map(function(e){return o5.payloadify(e)}),created_by:t.createdBy,allow_user_suggestion:t.allowUserSuggestion,allow_multiple_votes:t.allowMultipleVotes,voted_option_ids:t.votedPollOptionIds})))},t.prototype.applyPollUpdateEvent=function(e){var t=e._payload.poll;return!(!t||this.id!==t.id||t.updated_at<this.updatedAt)&&(this._applyPollUpdatePayload(t),!0)},t.prototype.applyPollVoteEvent=function(e){if(this.id!==e.pollId)return!1;var t=this.options,n=t.map(function(e){return e.id}),i=e._payload,r=Math.floor(i.ts/1e3);
1return i.updated_vote_counts.forEach(function(e){var i=n.indexOf(e.option_id);if(i>-1){var o=t[i];r>=o._lastVotedAt&&(o.voteCount=e.vote_count,o._lastVotedAt=r)}}),i.req_id&&i.voted_option_ids&&(this.votedPollOptionIds=i.voted_option_ids),"number"==typeof i.voter_count&&(this.voterCount=i.voter_count),!0},t.prototype.serialize=function(){return rF(this)},t}(rA),o8=function(){function e(e,t){var n;this.limit=20,this._isLoading=!1,this._hasNext=!0,this._token="",this._iid=e,this.limit=null!==(n=t.limit)&&void 0!==n?n:20}return Object.defineProperty(e.prototype,"hasNext",{get:function(){return this._hasNext},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLoading",{get:function(){return this._isLoading},enumerable:!1,configurable:!0}),e.prototype._validate=function(){return L("number",this.limit)&&this.limit>0},e}(),o9=function(e){function t(t,n,i,r){var o=e.call(this,t,r)||this;return o.channelUrl=n,o.channelType=i,o}return u(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&L("string",this.channelUrl)&&U(es,this.channelType)},t}(o8),o7=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},se=function(e){function t(t){var n=t.title,i=t.optionTexts,r=t.data,o=t.allowUserSuggestion,s=t.allowMultipleVotes,a=t.closeAt,c=e.call(this)||this;return c.method=eH.POST,c.path=eJ,c.params={title:n,options:i,data:r,allow_user_suggestion:o,allow_multiple_votes:s,close_at:a},c}return u(t,e),t}(ta),st=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.poll=new o6(t,n),i}return u(t,e),t}(tc),sn=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,o=e.call(this)||this;return o.method=eH.GET,o.path="".concat(eJ,"/").concat(encodeURIComponent(r)),o.params={channel_url:n,channel_type:i},o}return u(t,e),t}(ta),si=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.poll=new o6(t,n),i}return u(t,e),t}(tc),sr=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,o=t.pollOptionId,s=e.call(this)||this;return s.method=eH.GET,s.path="".concat(eJ,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(o)),s.params={channel_url:n,channel_type:i},s}return u(t,e),t}(ta),so=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.pollOption=new o5(t,n),i}return u(t,e),t}(tc),ss=function(e){function t(t){var n=t.channelType,i=t.channelUrl,r=t.timestamp,o=t.token,s=e.call(this)||this;return s.method=eH.GET,s.path="".concat(te(n),"/").concat(encodeURIComponent(i),"/polls/changelogs"),s.params=ew({change_ts:r,token:o}),s}return u(t,e),t}(ta),sa=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.updatedPolls=n.updated.map(function(e){return new o6(t,e)}),i.deletedPollIds=n.deleted.map(function(e){return e}),i.hasMore=n.has_more,i.nextToken=n.next,i}return u(t,e),t}(tc),sc={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},su=function(e){var t;return L("string",e.title)&&P("string",t=e.optionTexts)&&t.every(function(e){return""!==e.trim()})&&o4(e.data)&&L("boolean",e.allowUserSuggestion,!0)&&L("boolean",e.allowMultipleVotes,!0)&&L("number",e.closeAt,!0)},sl={channelUrl:"",channelType:es.BASE,pollId:0,pollOptionId:0},sh=function(e){return L("string",e.channelUrl)&&""!==e.channelUrl&&U(es,e.channelType)&&L("number",e.pollId)&&e.pollId>0&&L("number",e.pollOptionId)&&e.pollOptionId>0},sd={channelUrl:"",channelType:es.BASE,pollId:0},s_=function(e){return L("string",e.channelUrl)&&""!==e.channelUrl&&U(es,e.channelType)&&L("number",e.pollId)},sf={},sp=function(){function e(e,t){var n=t.sdkState,i=t.dispatcher,r=t.sessionManager,o=t.requestQueue,s=t.logger;this._iid=e,this._sdkState=n,this._sessionManager=r,this._requestQueue=o,this._dispatcher=i,this._logger=s,sf[e]=this}return e.of=function(e){return sf[e]},e.prototype.buildPollFromSerializedData=function(e){var t=rH(e);return new o6(this._iid,o6.payloadify(t))},e.prototype.get=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return rV(s_(e)).throw(D.invalidParameters),t=new sn(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(si).poll]}})})},e.prototype.create=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return rV(su(e)).throw(D.invalidParameters),t=new se(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(st).poll]}})})},e.prototype.getOption=function(e){return d(this,void 0,void 0,function(){var t;return _(this,function(n){switch(n.label){case 0:return rV(sh(e)).throw(D.invalidParameters),t=new sr(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(so).pollOption]}})})},e.prototype.getPollChangeLogs=function(e,t,n,i){return void 0===i&&(i=oU.SYNC_POLL_CHANGELOGS),d(this,void 0,void 0,function(){var r,o,s,a,c,u;return _(this,function(l){switch(l.label){case 0:return r=new ss(eN({channelType:t,channelUrl:e,timestamp:"number"==typeof n?n:null,token:"string"==typeof n?n:null})),[4,this._requestQueue.send(r)];case 1:return s=(o=l.sent().as(sa)).updatedPolls,a=o.deletedPollIds,c=o.hasMore,u=o.nextToken,s.length>0&&this._dispatcher.dispatch(new o$({polls:s,source:i})),[2,{updatedPolls:s,deletedPollIds:a,hasMore:c,token:u}]}})})},e}(),sE=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.token,o=t.limit,s=e.call(this)||this;return s.method=eH.GET,s.path=eJ,s.params={channel_url:n,channel_type:i,token:r,limit:o},s}return u(t,e),t}(ta),sg=function(e){function t(t,n){var i,r=this;return(r=e.call(this,t,n)||this).polls=(null!==(i=n.polls)&&void 0!==i?i:[]).map(function(e){return new o6(t,e)}),r.token=n.next,r}return u(t,e),t}(tc),sv=function(e){function t(t,n){return e.call(this,t,n.channelUrl,n.channelType,n)||this}return u(t,e),t.prototype.next=function(){return d(this,void 0,void 0,function(){var e,t,n,i,r;return _(this,function(o){switch(o.label){case 0:return this._val
1idate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=oG.of(this._iid).requestQueue,t=new sE(l(l({},this),{token:this._token})),[4,e.send(t)]):[3,2]:[3,5];case 1:return i=(n=o.sent().as(sg)).polls,r=n.token,this._token=r,this._hasNext=!!r,this._isLoading=!1,[2,i];case 2:return[2,[]];case 3:throw D.queryInProgress;case 4:return[3,6];case 5:throw D.invalidParameters;case 6:return[2]}})})},t}(o9),sm=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,o=t.pollOptionId,s=t.token,a=t.limit,c=e.call(this)||this;return c.method=eH.GET,c.path="".concat(eJ,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(o),"/voters"),c.params={channel_url:n,channel_type:i,token:s,limit:a},c}return u(t,e),t}(ta),sy=function(e){function t(t,n){var i,r=this;return(r=e.call(this,t,n)||this).voters=(null!==(i=n.voters)&&void 0!==i?i:[]).map(function(e){return new rj(t,e)}),r.token=n.next,r}return u(t,e),t}(tc),sb=function(e){function t(t,n){var i=e.call(this,t,n.channelUrl,n.channelType,n)||this;return i.pollId=n.pollId,i.pollOptionId=n.pollOptionId,i}return u(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&L("number",this.pollId)&&L("number",this.pollOptionId)},t.prototype.next=function(){return d(this,void 0,void 0,function(){var e,t,n,i,r;return _(this,function(o){switch(o.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=oG.of(this._iid).requestQueue,t=new sm(l(l({},this),{pollId:this.pollId,pollOptionId:this.pollOptionId,token:this._token})),[4,e.send(t)]):[3,2]:[3,5];case 1:return i=(n=o.sent().as(sy)).voters,r=n.token,this._token=r,this._hasNext=!!r,this._isLoading=!1,[2,i];case 2:return[2,[]];case 3:throw D.queryInProgress;case 4:return[3,6];case 5:throw D.invalidParameters;case 6:return[2]}})})},t}(o9)}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.