PageSourceSearch

https://www.cocreate.ink/_next/static/chunks/9b398357-fd27f9dad6b133ed.js

js cocreate.ink collected 2026-10-02 14:49:11 UTC 217,493 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2397],{28848:(e,t,n)=>{let i,r,s;n.d(t,{$:()=>rJ,A:()=>eH,B:()=>to,C:()=>eo,D:()=>g,E:()=>eT,F:()=>rH,G:()=>og,H:()=>oy,I:()=>rq,J:()=>re,K:()=>rh,L:()=>er,M:()=>ri,N:()=>i7,O:()=>rs,P:()=>S,Q:()=>rj,R:()=>rK,S:()=>K,T:()=>rE,U:()=>rz,V:()=>sV,W:()=>th,X:()=>rQ,Y:()=>rw,Z:()=>tl,_:()=>d,a:()=>L,a$:()=>ti,a0:()=>tN,a1:()=>I,a2:()=>P,a3:()=>en,a4:()=>T,a5:()=>x,a6:()=>tT,a7:()=>sy,a8:()=>C,a9:()=>N,aA:()=>oc,aB:()=>oh,aC:()=>od,aD:()=>ou,aE:()=>ol,aF:()=>s5,aI:()=>s9,aJ:()=>ez,aK:()=>rN,aL:()=>R,aM:()=>rF,aN:()=>td,aO:()=>te,aP:()=>sB,aQ:()=>H,aR:()=>eg,aS:()=>tn,aT:()=>tD,aU:()=>r2,aV:()=>tI,aW:()=>ej,aX:()=>tL,aY:()=>s8,aZ:()=>tt,a_:()=>eZ,ab:()=>sL,ac:()=>ei,ad:()=>A,ae:()=>b,af:()=>rl,ah:()=>sU,ai:()=>ea,ak:()=>ru,al:()=>rM,am:()=>ty,an:()=>tb,ao:()=>eW,ap:()=>s6,aq:()=>sG,ar:()=>ed,at:()=>eu,au:()=>el,av:()=>ef,aw:()=>e_,ax:()=>ep,ay:()=>of,az:()=>oa,b:()=>_,b0:()=>eh,b1:()=>s3,b2:()=>eJ,b3:()=>rC,b4:()=>V,b5:()=>tO,b6:()=>s0,b7:()=>B,b8:()=>h,b9:()=>M,bA:()=>eQ,bB:()=>eB,bG:()=>t_,bH:()=>tv,ba:()=>F,bb:()=>sZ,bc:()=>sY,bd:()=>sW,be:()=>s$,bf:()=>sJ,bg:()=>sX,bh:()=>sQ,bi:()=>e4,bj:()=>ev,bk:()=>eS,bl:()=>sT,bm:()=>e$,bo:()=>ec,bp:()=>z,bq:()=>eK,br:()=>q,bs:()=>ro,bt:()=>tk,bu:()=>s1,bv:()=>sK,bw:()=>r4,bx:()=>e7,by:()=>e9,bz:()=>s2,c:()=>u,d:()=>l,e:()=>e8,f:()=>ew,g:()=>eN,h:()=>ta,i:()=>G,j:()=>tc,k:()=>eV,l:()=>eX,m:()=>eY,n:()=>e0,o:()=>e5,p:()=>tS,q:()=>E,r:()=>p,s:()=>i8,t:()=>D,u:()=>ey,v:()=>v,w:()=>f,x:()=>w,y:()=>tg,z:()=>tC});var o,a=n(86141).hp,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}function d(e,t,n,i){return new(n||(n=Promise))(function(r,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function _(e,t){var n,i,r,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},o=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return o.next=a(0),o.throw=a(1),o.return=a(2),"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(a){return function(c){var u=[a,c];if(n)throw TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(s=0)),s;)try{if(n=1,i&&(r=2&u[0]?i.return:u[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,u[1])).done)return r;switch(i=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return s.label++,{value:u[1],done:!1};case 5:s.label++,i=u[1],u=[0];continue;case 7:u=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){s=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){s.label=u[1];break}if(6===u[0]&&s.label<r[1]){s.label=r[1],r=u;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(u);break}r[2]&&s.ops.pop(),s.trys.pop();continue}u=t.call(e,s)}catch(e){u=[6,e],i=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}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,s=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){r={error:e}}finally{try{i&&!i.done&&(n=s.return)&&n.call(s)}finally{if(r)throw r.error}}return o}function E(e,t,n){if(n||2==arguments.length)for(var i,r=0,s=t.length;r<s;r++)!i&&r in t||(i||(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var g,v="4.22.9",m=function(){function e(){}return Object.defineProperty(e,"OS_VERSION",{get:function(){return"u">typeof navigator&&navigator.userAgent?navigator.userAgent.replace(/,/g,"."):"noAgent"}
1,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_ERROR=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,s=e.call(this,void 0===r?"":r)||this;return s.shouldThrowOutside=!1,s._detail="",s.name="SendbirdError",s.code=void 0===i?0:i,Object.setPrototypeOf(s,t.prototype),s}return u(t,e),Object.defineProperty(t.prototype,"detail",{get:function(){return this._detail}
1,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."})},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_E
1RROR,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."})},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?x(e,t):U(e,t):typeof t===e)},x=function(e,t,n){return void 0===n&&(n=!1),!(!n||!j(t))||Object.values(e).includes(t)},U=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},F=function(e,t){return void 0===t&&(t=!1),!(!t||!j(e))||"number"==typeof e&&Number.isInteger(e)&&e>=0&&e<=59},q=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("u">typeof Blob)return e instanceof Blob;if("u">typeof File)return e instanceof File}return n},z=function(e,t){if(e===t)return!0;
1if(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,s=t.websocketResponseTimeout,o=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===s?1e4:s,this._sessionTokenRefreshTimeout=void 0===a?60:a,this.websocketPayloadDecompression=void 0===o||o}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)},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,s,o,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 s=null!=(n=_.sent())?n:[],!r||r.version<this._version?9===this._version?[3,3]:[3,6]:[3,10];case 3:return(o=s.find(function(e){return e.includes("groupchannel/sync.meta")}))?[4,this._store.remove(o)]:[3,5];case 4:_.sent(),_.label=5;case 5:return[3,8];case 6:return[4,this._resetPreferenceData(s)];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(s)).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,s=t.customClearOrderComparator,o=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),s?(this._clearOrder=r,this._customClearOrderComparator=s):this._clearOrder=A.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=void 0===o||o,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)?e:this._clearOrderComparatorUseMessageCollectionAccessedAt},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"enableAutoResend",{get:function(){return this._enableAutoResend},enumerable:!1,configurable:!0}),e}();(es=en||(en={})).FEED="feed",es.CHAT="chat",es.CHAT_API="chat_api";var es,eo,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.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])||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])||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 s=[];try{for(var o=f(r.keys()),a=o.next();!a.done;a=o.next()){var c=a.value,u=r.get(c);u.handler(t),u.occurence>0&&(u.occurence--,0===u.occurence&&s.push(c))}}catch(e){n={error:e}}finally{try{a&&!a.done&&(i=o.return)&&i.call(o)}finally{if(n)throw n.error}}s.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=eo||(eo={})).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",(ex=e_||(e_={})).ALL="all",ex.NONE="none",ex.ONLY_REPLY_TO_CHANNEL="only_reply_to_channel",(eU=ef||(ef={})).DEFAULT="default",eU.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",(eF=eg||(eg={})).HIGH="high",eF.NORMAL="normal",eF.LOW="low",(eq=ev||(ev={})).CREATED_AT="created_at",eq.UPDATED_AT="updated_at";var eA,eI,eD,eO,ek,eR,eL,ex,eU,eP,eM,eF,eq,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 eo.FEED:case eo.GROUP:return ej;case eo.OPEN:return eB;default:return null}},tt=function(e){switch(e){case eo.GROUP:return"".concat(eZ,"/group_channels");case eo.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 s=f(t),o=s.next();!o.done;o=s.next())if(o.value===n)return!0}catch(e){i={error:e}}finally{try{o&&!o.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}}return!1},ti=function(e,t,n){var i,r,s,o,a=tn(null!=(i=e.mentionType)?i:null,null!=(r=e.mentionedUserIds)?r:[],n),c=tn(null!=(s=t.mentionType)?s:null,null!=(o=t.mentionedUserIds)?o:[],n);return!a&&c?1:a&&!c?-1:0},tr=function(e,t,n){var i,r=t||new FormData;for(var s in e)if(e.hasOwnProperty(s)){var o=e[s],a=n?"".concat(n,"[").concat(s,"]"):s;G(o)?r.append(a,o,null!=(i=o.name)?i:"filename"):"object"!=typeof o||null===o||Array.isArray(o)||o instanceof Blob?r.append(a,String(o)):r=tr(o,r,a)}return r};(ts=eH||(eH={})).GET="GET",ts.POST="POST",ts.PUT="PUT",ts.DELETE="DELETE",ts.PATCH="PATCH";var ts,to,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,s=t.message,o=e.call(this)||this;switch(o.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:o.error=new D({code:r,message:void 0===s?"":s})}return o}return u(t,e),Object.defineProperty(t.prototype,"invalidateSessionToken",{get:function(){var e;return!!(null==(e=this.error)?void 0:e.isSessionTokenExpiredError)},enumerable:!1,configurable:!0}),t}(eS),th=function(e){function t(t,n,i,r){void 0===r&&(r="");var s,o=this;return(o=e.call(this)||this)._iid=t,o.code=n,o.payload=i,o.requestId=null!=(s=i.req_id)?s:r,o}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,s=t.payload,o=this;return(o=e.call(this)||this).code=i,o.payload=void 0===s?{}:s,o.requestId=null!=(n=o.payload.req_id)?n:ey(),o.ackRequired=r,o.payload.req_id=o.requestId,o}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,s=t.expiringSession,o=e.call(this)||this;return o.path="".concat(eV,"/").concat(encodeURIComponent(n),"/session_key"),o.method=eH.POST,o.params=ew({token:i,services:r,expiring_session:!!(void 0===s||s)}),o.requireAuth=!1,o}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),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,s=n.expires_at,o=n.services;return i.key=r,i.expiresAt=s,i.services=o,i}return u(t,e),t}(tc),tE=function(e){function t(t,n,i){var r,s=this;return(s=e.call(this,t,"LOGI",i)||this).error=null,s.newKey=null,s.newKey=null!=(r=i.new_key)?r:null,s.error=i.error?new D(i):null,s}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,s=void 0===r?D.requestFailed:r,o=e.call(this)||this;return o.request=n,o.deferred=i,o.error=s,o}return u(t,e),t}(eS);(tm=to||(to={})).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,s=e.runtimeId;this.type=t,this.createdAt=r,this.runtimeId=s,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"u"<typeof document&&"u">typeof navigator&&"ReactNative"==navigator.product},tw=function(){return!("u"<typeof navigator||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent))};(i3=ty||(ty={}
1)).CHAT="chat",i3.CALLS="calls",i3.DESK="desk",i3.LIVE="live",i3.UIKIT_CHAT="uikit-chat",i3.UIKIT_LIVE="uikit-live",i3.AI_AGENT="ai-agent",(i4=tb||(tb={})).ANDROID="android",i4.IOS="ios",i4.JS="js",i4.UNREAL="unreal",i4.UNITY="unity",i4.REACT_NATIVE="react-native",i4.FLUTTER="flutter",(i5=tT||(tT={})).ANDROID="android",i5.IOS="ios",i5.WEB="web",i5.MOBILE_WEB="mobile_web",i5.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("u">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,s=t.deviceOS,o=t.customData,a=void 0===o?{}:o;s.version&&(i.os_version=s.version),s.platform&&(i.device_os_platform=s.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!==i6&&i6.apply(this,arguments)||this},i6=tc);var tk=function(e){function t(t,n,i){var r,s=this;return(s=e.call(this,t,"DELM",i)||this).channelUrl=i.channel_url,s.channelType=i.channel_type,s.messageId=Number(i.msg_id),s.silent=i.silent,s.messageCreatedAt=i.message_created_at?Number(i.message_created_at):-1,s.senderId=null!=(r=i.sender_id)?r:void 0,s}return u(t,e),t}(th),tR=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,s=t.logger,o=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=s,this._shouldImportFetchCompat=void 0!==o&&o}return e.prototype._createHeader=function(e,t){var n=this._sdkState,i=n.appId,r=n.appVersion,s=n.sendbirdRuntimeEnvironment,o=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(s)});return t||(o["Content-Type"]="application/json; charset=utf-8"),o["App-Id"]=i,e.requireAuth?!e.hasSessionKey&&this._session.hasSession&&(o["Session-key"]=this._session.sessionKey):this._session.authToken&&(o["Access-token"]=this._session.authToken),o},e.prototype._statLogApiResult=function(e,t,n){e.path.includes("/sdk/statistics")||this._dispatcher.dispatch(new tg(new tC({type:to.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,s,o,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,s=this._isBodyRequired(e),o=this._sdkState.api,a="".concat(o.host).concat(t).concat(s?"":e.query),c=s?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(2640).then(n.bind(n,22640))]:[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,("u">typeof globalThis&&globalThis||"u">typeof self&&self||"u">typeof globalThis&&globalThis||{fetch:null}).fetch=null),"u">typeof AbortController?[3,8]:[4,n.e(2954).then(n.bind(n,22954))];case 7:_.sent(),_.label=8;case 8:return"function"==typeof fetch?[3,10]:[4,n.e(7131).then(n.bind(n,67131))];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 tx(e){let t=e.length;for(;--t>=0;)e[t]=0}let tU=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]),tF=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),tq=Array(576);tx(tq);let tH=Array(60);tx(tH);let tV=Array(512);tx(tV);let tG=Array(256);tx(tG);let tz=Array(29);tx(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}tx(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,s,o=0;for(r=1;r<=15;r++)o=o+n[r-1]<<1,i[r]=o;for(s=0;s<=t;s++){let t=e[2*s+1];0!==t&&(e[2*s]=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,s=2*n;return e[r]<e[s]||e[r]===e[s]&&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,s,o,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,(s=tG[r])+256+1,t),0!==(o=tU[s])&&tZ(e,r-=tz[s],o),tY(e,s=tQ(--i),n),0!==(o=tP[s])&&tZ(e,i-=tj[s],o));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,s=t.stat_desc.elems,o,a,c,u=-1;for(e.heap_len=0,e.heap_max=573,o=0;o<s;o++)0!==n[2*o]?(e.heap[++e.heap_len]=u=o,e.depth[o]=0):n[2*o+1]=0;for(;e.heap_len<2;)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,o=e.heap_len>>1;o>=1;o--)t2(e,n,o);c=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],t2(e,n,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,n[2*c]=n[2*o]+n[2*a],e.depth[c]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,n[2*o+1]=n[2*a+1]=c,e.heap[1]=c++,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,s=t.stat_desc.has_stree,o=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&&(_=o[l-a]),f=n[2*l],e.opt_len+=f*(d+_),s&&(e.static_len+=f*(r[2*l+1]+_)));if(0!==p){do{for(d=c-1;0===e.bl_count[d];)d--;e.bl_count[d]--,e.bl_count[d+1]+=2,e.bl_count[c]--,p-=2}while(p>0);for(d=c;0!==d;d--)for(l=e.bl_count[d];0!==l;)(h=e.heap[--u])>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,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),t[2*(n+1)+1]=65535,i=0;i<=n;i++)r=o,o=t[2*(i+1)+1],++a<c&&r===o||(a<u?e.bl_tree[2*r]+=a:0!==r?(r!==s&&e.bl_tree[2*r]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,s=r,0===o?(c=138,u=3):r===o?(c=6,u=3):(c=7,u=4))},t6=(e,t,n)=>{let i,r,s=-1,o=t[1],a=0,c=7,u=4;for(0===o&&(c=138,u=3),i=0;i<=n;i++)if(r=o,o=t[2*(i+1)+1],!(++a<c&&r===o)){if(a<u)do tY(e,r,e.bl_tree);while(0!=--a);else 0!==r?(r!==s&&(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,s=r,0===o?(c=138,u=3):r===o?(c=6,u=3):(c=7,u=4)}},t8=!1,t9=(e,t,n,i)=>{tZ(e,0+ +!!i,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,o,a,c=Array(16);for(n=0,o=0;o<28;o++)for(tz[o]=n,e=0;e<1<<tU[o];e++)tG[n++]=o;for(tG[n-1]=o,a=0,o=0;o<16;o++)for(tj[o]=a,e=0;e<1<<tP[o];e++)tV[a++]=o;for(a>>=7;o<30;o++)for(tj[o]=a<<7,e=0;e<1<<tP[o]-7;e++)tV[256+a++]=o;for(t=0;t<=15;t++)c[t]=0;for(e=0;e<=143;)tq[2*e+1]=8,e++,c[8]++;for(;e<=255;)tq[2*e+1]=9,e++,c[9]++;for(;e<=279;)tq[2*e+1]=7,e++,c[7]++;for(;e<=287;)tq[2*e+1]=8,e++,c[8]++;for(tJ(tq,287,c),e=0;e<30;e++)tH[2*e+1]=5,tH[2*e]=tX(e,5);i=new tK(tq,tU,257,286,15),r=new tK(tH,tP,0,30,15),s=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,s),e.bi_buf=0,e.bi_valid=0,t$(e)},_tr_stored_block:t9,_tr_flush_block:(e,t,n,i)=>{let r,s,o=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,n=0xf3ffc07f;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),o=(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*tF[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),r=e.opt_len+3+7>>>3,(s=e.static_len+3+7>>>3)<=r&&(r=s)):r=s=n+5,n+4<=r&&-1!==t?t9(e,t,n,i):4===e.strategy||s===r?(tZ(e,2+ +!!i,3),t3(e,tq,tH)):(tZ(e,4+ +!!i,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*tF[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,o+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,tq),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,s=e>>>16&65535,o=0;for(;0!==n;){o=n>2e3?2e3:n,n-=o;do s=s+(r=r+t[i++]|0)|0;while(--o);r%=65521,s%=65521}return r|s<<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?0xedb88320^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:ns,_tr_stored_block:no,_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-9*(e>4),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))},nx=(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)},nU=(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)},nF=(e,t)=>{let n,i,r=e.max_chain_length,s=e.strstart,o=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[s+o-1],f=u[s+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do if(u[(n=t)+o]===f&&u[n+o-1]===_&&u[n]===u[s]&&u[++n]===u[s+1]){s+=2,n++;do;while(u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&u[++s]===u[++n]&&s<d);if(i=258-(d-s),s=d-258,i>o){if(e.match_start=t,o=i,i>=a)break;_=u[s+o-1],f=u[s+o]}}while((t=h[t&l])>c&&0!=--r);return o<=e.lookahead?o:e.lookahead},nq=e=>{let t,n,i,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,s=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,o=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<s&&(0===n&&t!==n_||t===nl||n!==i+e.strm.avail_in)))break;o=+(t===n_&&n===i+e.strm.avail_in),no(e,0,0,o),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===o);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),o?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,s=(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)>=s||(i||t===n_)&&t!==nl&&0===e.strm.avail_in&&i<=r)&&(n=i>r?r:i,o=+(t===n_&&0===e.strm.avail_in&&n===i),no(e,e.block_start,n,o),e.block_start+=n,nL(e.strm)),o?3:1)},nV=(e,t)=>{let n,i;for(;;){if(e.lookahead<262){if(nq(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=nF(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&&(nx(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===n_?(nx(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nx(e,!1),0===e.strm.avail_out)?1:2},nG=(e,t)=>{let n,i,r;for(;;){if(e.lookahead<262){if(nq(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=nF(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&&(nx(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if((i=nc(e,0,e.window[e.strstart-1]))&&nx(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_?(nx(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nx(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};var nQ=(e,t)=>{if(nB(e)||t>
1nf||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,nU(n,31),nU(n,139),nU(n,8),n.gzhead)nU(n,+!!n.gzhead.text+2*!!n.gzhead.hcrc+4*!!n.gzhead.extra+8*!!n.gzhead.name+16*!!n.gzhead.comment),nU(n,255&n.gzhead.time),nU(n,n.gzhead.time>>8&255),nU(n,n.gzhead.time>>16&255),nU(n,n.gzhead.time>>24&255),nU(n,9===n.level?2:4*(n.strategy>=nT||n.level<2)),nU(n,255&n.gzhead.os),n.gzhead.extra&&n.gzhead.extra.length&&(nU(n,255&n.gzhead.extra.length),nU(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(nU(n,0),nU(n,0),nU(n,0),nU(n,0),nU(n,0),nU(n,9===n.level?2:4*(n.strategy>=nT||n.level<2)),nU(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,nU(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,nU(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;nU(n,255&e.adler),nU(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&&(nq(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&&(nx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===n_?(nx(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nx(e,!1),0===e.strm.avail_out)?1:2})(n,t):n.strategy===nC?((e,t)=>{let n,i,r,s,o=e.window;for(;;){if(e.lookahead<=258){if(nq(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=o[r=e.strstart-1])===o[++r]&&i===o[++r]&&i===o[++r]){s=e.strstart+258;do;while(i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&i===o[++r]&&r<s);e.match_length=258-(s-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&&(nx(e,!1),0===e.strm.avail_out))return 1}return e.insert=0,t===n_?(nx(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(nx(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&&(no(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?(nU(n,255&e.adler),nU(n,e.adler>>8&255),nU(n,e.adler>>16&255),nU(n,e.adler>>24&255),nU(n,255&e.total_in),nU(n,e.total_in>>8&255),nU(n,e.total_in>>16&255),nU(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)},nW=e=>{if(nB(e))return ng;let t=e.state.status;return e.state=null,113===t?nI(e,nv):np};let nZ=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);
1var nY=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)nZ(n,t)&&(e[t]=n[t])}}return e},nX=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 nJ=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(e){nJ=!1}let n$=new Uint8Array(256);for(let e=0;e<256;e++)n$[e]=e>=252?6:e>=248?5:e>=240?4:e>=224?3:e>=192?2:1;n$[254]=n$[254]=1;var n0=e=>{if("function"==typeof TextEncoder&&TextEncoder.prototype.encode)return(new TextEncoder).encode(e);let t,n,i,r,s,o=e.length,a=0;for(r=0;r<o;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&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),s=0,r=0;s<a;r++)55296==(64512&(n=e.charCodeAt(r)))&&r+1<o&&56320==(64512&(i=e.charCodeAt(r+1)))&&(n=65536+(n-55296<<10)+(i-56320),r++),n<128?t[s++]=n:(n<2048?t[s++]=192|n>>>6:(n<65536?t[s++]=224|n>>>12:(t[s++]=240|n>>>18,t[s++]=128|n>>>12&63),t[s++]=128|n>>>6&63),t[s++]=128|63&n);return t},n1=(e,t)=>{let n,i,r=t||e.length;if("function"==typeof TextDecoder&&TextDecoder.prototype.decode)return(new TextDecoder).decode(e.subarray(0,t));let s=Array(2*r);for(i=0,n=0;n<r;){let t=e[n++];if(t<128){s[i++]=t;continue}let o=n$[t];if(o>4)s[i++]=65533,n+=o-1;else{for(t&=2===o?31:3===o?15:7;o>1&&n<r;)t=t<<6|63&e[n++],o--;o>1?s[i++]=65533:t<65536?s[i++]=t:(t-=65536,s[i++]=55296|t>>10&1023,s[i++]=56320|1023&t)}}var o=i;if(o<65534&&s.subarray&&nJ)return String.fromCharCode.apply(null,s.length===o?s:s.subarray(0,o));let a="";for(let e=0;e<o;e++)a+=String.fromCharCode(s[e]);return a},n2=(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+n$[e[n]]>t?n:t},n3=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 n4=Object.prototype.toString,{Z_NO_FLUSH:n5,Z_SYNC_FLUSH:n6,Z_FULL_FLUSH:n8,Z_FINISH:n9,Z_OK:n7,Z_STREAM_END:ie,Z_DEFAULT_COMPRESSION:it,Z_DEFAULT_STRATEGY:ii,Z_DEFLATED:ir}=nr;function is(e){let t,n;this.options=nY({level:it,method:ir,chunkSize:16384,windowBits:15,memLevel:8,strategy:ii},e||{});let i=this.options;i.raw&&i.windowBits>0?i.windowBits=-i.windowBits:i.gzip&&i.windowBits>0&&i.windowBits<16&&(i.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new n3,this.strm.avail_out=0;let r=((e,t,n,i,r,s)=>{var o,a;let c;if(!e)return ng;let u=1;if(t===ny&&(t=6),i<0?(u=0,i=-i):i>15&&(u=2,i-=16),r<1||r>9||n!==nA||i<8||i>15||t<0||t>9||s<0||s>nS||8===i&&1!==u)return nI(e,ng);8===i&&(i=9);let l=new nK;return e.state=l,l.strm=e,l.status=42,l.wrap=u,l.gzhead=null,l.w_bits=i,l.w_size=1<<l.w_bits,l.w_mask=l.w_size-1,l.hash_bits=r+7,l.hash_size=1<<l.hash_bits,l.hash_mask=l.hash_size-1,l.hash_shift=~~((l.hash_bits+3-1)/3),l.window=new Uint8Array(2*l.w_size),l.head=new Uint16Array(l.hash_size),l.prev=new Uint16Array(l.w_size),l.lit_bufsize=1<<r+6,l.pending_buf_size=4*l.lit_bufsize,l.pending_buf=new Uint8Array(l.pending_buf_size),l.sym_buf=l.lit_bufsize,l.sym_end=3*(l.lit_bufsize-1),l.level=t,l.strategy=s,l.method=n,(c=(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),t.last_flush=-2,ns(t),np})(o=e))===np&&((a=o.state).window_size=2*a.w_size,nO(a.head),a.max_lazy_match=nj[a.level].max_lazy,a.good_match=nj[a.level].good_length,a.nice_match=nj[a.level].nice_length,a.max_chain_length=nj[a.level].max_chain,a.strstart=0,a.block_start=0,a.lookahead=0,a.insert=0,a.match_length=a.prev_length=2,a.match_available=0,a.ins_h=0),c})(this.strm,i.level,i.method,i.windowBits,i.memLevel,i.strategy);if(r!==n7)throw Error(ni[r]);if(i.header&&(t=this.strm,n=i.header,nB(t)||2!==t.state.wrap||(t.state.gzhead=n)),i.dictionary){let e;if(e="string"==typeof i.dictionary?n0(i.dictionary):"[object ArrayBuffer]"===n4.call(i.dictionary)?new Uint8Array(i.dictionary):i.dictionary,(r=((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 s=e.avail_in,o=e.next_in,a=e.input;for(e.avail_in=n,e.next_in=0,e.input=t,nq(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,nq(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=o,e.input=a,e.avail_in=s,i.wrap=r,np})(this.strm,e))!==n7)throw Error(ni[r]);this._dict_set=!0}}function io(e,t){let n=new is(t);
1if(n.push(e,!0),n.err)throw n.msg||ni[n.err];return n.result}is.prototype.push=function(e,t){let n,i,r=this.strm,s=this.options.chunkSize;if(this.ended)return!1;for(i=t===~~t?t:!0===t?n9:n5,"string"==typeof e?r.input=n0(e):"[object ArrayBuffer]"===n4.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(s),r.next_out=0,r.avail_out=s),(i===n6||i===n8)&&r.avail_out<=6)this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;else{if((n=nQ(r,i))===ie)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=nW(this.strm),this.onEnd(n),this.ended=!0,n===n7;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===n7&&(this.result=nX(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};var ia=function(e,t){let n,i,r,s,o,a,c,u,l,h,d,_,f,p,E,g,v,m,y,b,T,C,S,w,N=e.state;n=e.next_in,S=e.input,i=n+(e.avail_in-5),r=e.next_out,w=e.output,s=r-(t-e.avail_out),o=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-s)){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<o);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<o?o-r+257:257-(r-o),N.hold=d,N.bits=_};let ic=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]),iu=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]),il=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]),ih=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 id=(e,t,n,i,r,s,o,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[s++]=0x1400000,r[s++]=0x1400000,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]&&(o[A[t[n+E]]++]=E);if(0===e?(w=k=o,f=20):1===e?(w=ic,k=iu,f=257):(w=il,k=ih,f=0),S=0,E=0,p=g,_=s,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,o[E]+1<f?(D=0,O=o[E]):o[E]>=f?(D=k[o[E]-f],O=w[o[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+o[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|_-s}}return 0!==S&&(r[_+S]=p-b<<24|4194304),a.bits=m,0};
vendor: 8,873 bytes, line 1
1let{Z_FINISH:i_,Z_BLOCK:ip,Z_TREES:iE,Z_OK:ig,Z_STREAM_END:iv,Z_NEED_DICT:im,Z_STREAM_ERROR:iy,Z_DATA_ERROR:ib,Z_MEM_ERROR:iT,Z_BUF_ERROR:iC,Z_DEFLATED:iS}=nr,iw=e=>(e>>>24&255)+(e>>>8&65280)+((65280&e)<<8)+((255&e)<<24);function iN(){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 iA=e=>{if(!e)return 1;let t=e.state;return+(!t||t.strm!==e||t.mode<16180||t.mode>16211)},iI=e=>{if(iA(e))return iy;let t=e.state;return t.wsize=0,t.whave=0,t.wnext=0,(e=>{if(iA(e))return iy;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,ig})(e)},iD,iO,ik=!0,iR=e=>{if(ik){iD=new Int32Array(512),iO=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(id(1,e.lens,0,288,iD,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;id(2,e.lens,0,32,iO,0,e.work,{bits:5}),ik=!1}e.lencode=iD,e.lenbits=9,e.distcode=iO,e.distbits=5},iL=(e,t,n,i)=>{let r,s=e.state;return null===s.window&&(s.wsize=1<<s.wbits,s.wnext=0,s.whave=0,s.window=new Uint8Array(s.wsize)),i>=s.wsize?(s.window.set(t.subarray(n-s.wsize,n),0),s.wnext=0,s.whave=s.wsize):((r=s.wsize-s.wnext)>i&&(r=i),s.window.set(t.subarray(n-i,n-i+r),s.wnext),(i-=r)?(s.window.set(t.subarray(n-i,n),0),s.wnext=i,s.whave=s.wsize):(s.wnext+=r,s.wnext===s.wsize&&(s.wnext=0),s.whave<s.wsize&&(s.whave+=r))),0};var ix=(e,t)=>{let n,i,r,s,o,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(iA(e)||!e.output||!e.input&&0!==e.avail_in)return iy;16191===(r=e.state).mode&&(r.mode=16192),c=e.next_out,o=e.output,l=e.avail_out,a=e.next_in,s=e.input,u=e.avail_in,h=r.hold,d=r.bits,_=u,f=l,w=ig;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+=s[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)!==iS){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+=s[a++]<<d,d+=8}if(r.flags=h,(255&r.flags)!==iS){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+=s[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+=s[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+=s[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(s.subarray(a,a+p),S)),512&r.flags&&4&r.wrap&&(r.check=nn(r.check,s,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=s[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,s,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=s[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,s,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+=s[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+=s[a++]<<d,d+=8}e.adler=r.check=iw(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,im;e.adler=r.check=1,r.mode=16191;case 16191:if(t===ip||t===iE)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+=s[a++]<<d,d+=8}switch(r.last=1&h,d-=1,3&(h>>>=1)){case 0:r.mode=16193;break;case 1:if(iR(r),r.mode=16199,t===iE){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+=s[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===iE)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;o.set(s.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+=s[a++]<<d,d+=8}if(r.nlen=257+(31&h),d-=5,r.ndist=1+(31&(h>>>=5)),d-=5,r.ncode=4+(15&(h>>>=5)),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+=s[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=id(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+=s[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+=s[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+=s[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+=s[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=id(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=id(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===iE)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,ia(e,f),c=e.next_out,o=e.output,l=e.avail_out,a=e.next_in,s=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+=s[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+=s[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+=s[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+=s[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+=s[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+=s[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=o,E=c-r.offset,p=r.length;p>l&&(p=l),l-=p,r.length-=p;do o[c++]=g[E++];while(--p);0===r.length&&(r.mode=16200);break;case 16205:if(0===l)break e;o[c++]=r.length,l--,r.mode=16200;break;case 16206:if(r.wrap){for(;d<32;){if(0===u)break e;u--,h|=s[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,o,f,c-f):ne(r.check,o,f,c-f)),f=l,4&r.wrap&&(r.flags?h:iw(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+=s[a++]<<d,d+=8}if(4&r.wrap&&h!==(0|r.total)){e.msg="incorrect length check",r.mode=16209;break}h=0,d=0}r.mode=16208;case 16208:w=iv;break e;case 16209:w=ib;break e;case 16210:return iT;default:return iy}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!==i_))&&iL(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,o,f,e.next_out-f):ne(r.check,o,f,e.next_out-f)),e.data_type=r.bits+64*!!r.last+128*(16191===r.mode)+256*(16199===r.mode||16194===r.mode),(0===_&&0===f||t===i_)&&w===ig&&(w=iC),w},iU=e=>{if(iA(e))return iy;let t=e.state;return t.window&&(t.window=null),e.state=null,ig},iP=(e,t)=>{let n,i=t.length;return iA(e)||0!==(n=e.state).wrap&&16190!==n.mode?iy:16190===n.mode&&ne(1,t,i,0)!==n.check?ib:iL(e,t,i,i)?(n.mode=16210,iT):(n.havedict=1,ig)},iM=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:iq,Z_FINISH:iH,Z_OK:iV,Z_STREAM_END:iG,Z_NEED_DICT:iz,Z_STREAM_ERROR:ij,Z_DATA_ERROR:iK,Z_MEM_ERROR:iB}=nr;function iQ(e){this.options=nY({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 n3,this.strm.avail_out=0;let n=((e,t)=>{if(!e)return iy;let n=new iN;e.state=n,n.strm=e,n.window=null,n.mode=16180;let i=((e,t)=>{let n;if(iA(e))return iy;let i=e.state;return t<0?(n=0,t=-t):(n=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?iy:(null!==i.window&&i.wbits!==t&&(i.window=null),i.wrap=n,i.wbits=t,iI(e))})(e,t);return i!==ig&&(e.state=null),i})(this.strm,t.windowBits);if(n!==iV||(this.header=new iM,((e,t)=>{if(iA(e))return;let n=e.state;return 2&n.wrap&&(n.head=t,t.done=!1)})(this.strm,this.header),t.dictionary&&("string"==typeof t.dictionary?t.dictionary=n0(t.dictionary):"[object ArrayBuffer]"===iF.call(t.dictionary)&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(n=iP(this.strm,t.dictionary))!==iV)))throw Error(ni[n])}function iW(e,t){let n=new iQ(t);if(n.push(e),n.err)throw n.msg||ni[n.err];return n.result}iQ.prototype.push=function(e,t){let n,i,r,s=this.strm,o=this.options.chunkSize,a=this.options.dictionary;if(this.ended)return!1;for(i=t===~~t?t:!0===t?iH:iq,"[object ArrayBuffer]"===iF.call(e)?s.input=new 
1Uint8Array(e):s.input=e,s.next_in=0,s.avail_in=s.input.length;;){for(0===s.avail_out&&(s.output=new Uint8Array(o),s.next_out=0,s.avail_out=o),(n=ix(s,i))===iz&&a&&((n=iP(s,a))===iV?n=ix(s,i):n===iK&&(n=iz));s.avail_in>0&&n===iG&&s.state.wrap>0&&0!==e[s.next_in];)iI(s),n=ix(s,i);switch(n){case ij:case iK:case iz:case iB:return this.onEnd(n),this.ended=!0,!1}if(r=s.avail_out,s.next_out&&(0===s.avail_out||n===iG))if("string"===this.options.to){let e=n2(s.output,s.next_out),t=s.next_out-e,n=n1(s.output,e);s.next_out=t,s.avail_out=o-t,t&&s.output.set(s.output.subarray(e,e+t),0),this.onData(n)}else this.onData(s.output.length===s.next_out?s.output:s.output.subarray(0,s.next_out));if(n!==iV||0!==r){if(n===iG)return n=iU(this.strm),this.onEnd(n),this.ended=!0,!0;if(0===s.avail_in)break}}return!0},iQ.prototype.onData=function(e){this.chunks.push(e)},iQ.prototype.onEnd=function(e){e===iV&&("string"===this.options.to?this.result=this.chunks.join(""):this.result=nX(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};let{Deflate:iZ,deflate:iY,deflateRaw:iX,gzip:iJ}={Deflate:is,deflate:io,deflateRaw:function(e,t){return(t=t||{}).raw=!0,io(e,t)},gzip:function(e,t){return(t=t||{}).gzip=!0,io(e,t)},constants:nr},{Inflate:i$,inflate:i0,inflateRaw:i1,ungzip:i2}={Inflate:iQ,inflate:iW,inflateRaw:function(e,t){return(t=t||{}).raw=!0,iW(e,t)},ungzip:iW,constants:nr};var i3,i4,i5,i6,i8,i9=function(e){return d(void 0,void 0,void 0,function(){var t;return _(this,function(n){if(t=i2(e),"u">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)}).join("")]})})},i7=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]}})})},re=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]}})})},rt=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);(rn=i8||(i8={})).CONNECTING="CONNECTING",rn.OPEN="OPEN",rn.CLOSED="CLOSED";var rn,ri,rr=function(e){function t(t,n){var i=n.sdkState,r=n.dispatcher,s=n.logger,o=e.call(this)||this;return o.lastActive=0,o._iid=t,o._sdkState=i,o._dispatcher=r,o._logger=s,o}return u(t,e),Object.defineProperty(t.prototype,"isOpen",{get:function(){return this.connectionState===i8.OPEN},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"connectionState",{get:function(){if(this._ws)switch(this._ws.readyState){case 0:return i8.CONNECTING;case 1:return i8.OPEN}return i8.CLOSED},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ws",{get:function(){var e;return null!=(e=this._ws)?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 rt(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(7131).then(n.bind(n,67131))];case 1:r.sent(),r.label=2;case 2:return re(function(){return d(i,void 0,void 0,function(){return _(this,function(e){return fetch(this._sdkState.api.host).catch(function(){}),[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,s,o,c=this;return _(this,function(u){switch(u.label){case 0:return(null==(o=this._sdkState.websocket)?void 0:o.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,i9(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,i9(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,i9((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 s=u.sent(),this.error(s),[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)}
1,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=tL,this.connectionState===i8.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===i8.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.forceClose=function(){this.cleanUpWebSocket(),this.dispatch("close")},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,s=t.ts,o=e.call(this)||this;return o.all=n,o.feed=i,o.customTypes=r,o.ts=s,o}return u(t,e),t}(eS),ro=function(e){function t(t){var n=t.previousMessageId,i=t.messageCreatedAt,r=t.channelUrl,s=e.call(this)||this;return s.previousMessageId=n,s.messageCreatedAt=i,s.channelUrl=r,s}return u(t,e),t}(eS),ra=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,s=t.logger,o=t.useFetchCompat,a=this;this._ackStateMap=new Map,this._batchableCommandAckStateMap=new Map,this._redundantActionCommands=new Map,this._sdkState=i,this._dispatcher=r,this._logger=s,this.apiClient=new tR(e,{session:n,sdkState:i,dispatcher:r,logger:s,useFetchCompat:void 0!==o&&o}),this.websocketClient=new rr(e,{sdkState:i,dispatcher:r,logger:s}),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===eo.GROUP&&e.payload.previous_message_id&&a._dispatcher.dispatch(new ro({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 s=f(a._batchableCommandAckStateMap.entries()),o=s.next();!o.done;o=s.next()){var c=p(o.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{o&&!o.done&&(n=s.return)&&n.call(s)}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(s){if(!this._sdkState.websocket)throw D.connectionRequired;if(t=new tI,e.ackRequired){i=function(i,s){var o="READ"===e.code?r._batchableCommandAckStateMap:r._ackStateMap;o.has(e.requestId)&&(o.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",s),t.resolve(s)))};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}();(rc=ri||(ri={}))[rc.NONE=0]="NONE",rc[rc.INITIALIZED=1]="INITIALIZED",rc[rc.CONNECTING=2]="CONNECTING",rc[rc.CONNECTED=3]="CONNECTED",rc[rc.RECONNECTING=4]="RECONNECTING",rc[rc.INTERNAL_DISCONNECTED=5]="INTERNAL_DISCONNECTED",rc[rc.EXTERNAL_DISCONNECTED=6]="EXTERNAL_DISCONNECTED",rc[rc.LOGOUT=7]="LOGOUT",rc[rc.DELAYED_CONNECTING=8]="DELAYED_CONNECTING";var rc,ru,rl,rh=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),rd=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}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(){function e(e){var t,n,i,r;this.isEnabled=null!=(t=e.enabled)&&t,this.feedChannels=null!=(n=e.feed_channels)?n:{},this.templateListToken=null!=(i=e.template_list_token)?i:null,this.settingsUpdatedAt=null!=(r=e.settings_updated_at)?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}(),rE=function(e){return"sendbird@".concat(e,"/changelog_include_chat_notifications")},rg=function(){function e(e){var t;this.lastUpdatedAt=null!=(t=e.last_updated_at)?t:0}return e.payloadify=function(e){return ew(eN({last_updated_at:e.lastUpdatedAt}))},e}(),rv=function(){function e(e){var t;this.token=null!=(t=e.template_list_token)?t:""}return e.payloadify=function(e){return ew(eN({template_list_token:e.token}))},e}(),rm=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}(),ry=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 rm(e.default),this.realTime=new rm(e.realtime)}return e.payloadify=function(e){return ew(eN({default:rm.payloadify(e.default),realtime:rm.payloadify(e.realTime)}))},e}(),rb=function(){function e(e){var t;this.templateListToken=null!=(t=e.template_list_token)?t:null}return e.payloadify=function(e){return ew(eN({template_list_token:e.templateListToken}))},e}(),rT=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}(),rC=5;(rL=ru||(ru={}))[rL.NONE=0]="NONE",rL[rL.INCLUDE_REPLY=1]="INCLUDE_REPLY",rL[rL.EXCLUDE_REPLY=2]="EXCLUDE_REPLY",rL[rL.INCLUDE_REPLY_TO_CHANNEL=3]="INCLUDE_REPLY_TO_CHANNEL",(rx=rl||(rl={}))[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 rS=function(){function e(e){var t,n,i,r,s,o,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)?t:[],this.premiumFeatureList=null!=(n=e.premium_feature_list)?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)?i:5,this.allowSdkStatsUpload=null==(r=e.allow_sdk_log_ingestion)||r,this.unreadCountThreadingPolicy=null!=(s=e.unread_cnt_threading_policy)?s:ru.NONE,this.lastMessageThreadingPolicy=null!=(o=e.last_msg_threading_policy)?o:rl.NONE,this.channelRotationInfo=e.channel_rotation?new rT(e.channel_rotation):null,this.uikitConfigInfo=new rg(null!=(a=e.uikit_config)?a:{}),this.notificationInfo=e.notifications?new rp(e.notifications):null,this.messageTemplateInfo=e.message_template?new rv(e.message_template):null,this.aiAgentInfo=e.ai_agent?new rb(e.ai_agent):null,this.statConfigInfo=e.log_publish_config?new ry(e.log_publish_config):new ry,this.disableSuperGroupMack=null!=(c=e.disable_supergroup_mack)&&c,this.configSyncNeeded=null!=(u=e.config_sync_needed)&&u,this.requestDedupIntervalMs=null!=(l=e.request_dedup_interval_ms)?l:500,this.backgroundConnectionCloseTimeout=null!=(h=e.sdk_background_connection_close_timeout)?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?rT.payloadify(e.channelRotationInfo):null,uikit_config:e.uikitConfigInfo?rg.payloadify(e.uikitConfigInfo):null,notifications:e.notificationInfo?rp.payloadify(e.notificationInfo):null,message_template:e.messageTemplateInfo?rv.payloadify(e.messageTemplateInfo):null,log_publish_config:e.statConfigInfo?ry.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}(),rw=function(e){return"sendbird@".concat(e,"/app_configs_info")},rN=function(){function e(e){this._iid="",this._iid=e}return e.payloadify=function(e){return{}},e}(),rA=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),rI=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),rD=function(e){function t(t){var n=t.userId,i=t.metadata,r=t.upsert,s=e.call(this)||this;return s.method=eH.PUT,s.path="".concat(eV,"/").concat(encodeURIComponent(n),"/metadata"),s.params={metadata:i,upsert:r},s}return u(t,e),t}(ta),rO=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),rk=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!==rU&&rU.apply(this,arguments)||this},rU=tc);var rR=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!==rP&&rP.apply(this,arguments)||this},rP=tc);var rL,rx,rU,rP,rM,rF=function(e,t){var n=JSON.parse(JSON.stringify(e));return n._iid&&delete n._iid,t&&t(n),n},rq=function(e,t){var n=JSON.parse(JSON.stringify(e));return t&&t(n),n},rH=function(e){return{do:function(t){e||t()},throw:function(t){if(!e)throw t}}};(rV=rM||(rM={})).ONLINE="online",rV.OFFLINE="offline",rV.NON_AVAILABLE="nonavailable";var rV,rG,rz=function(e){function t(t,n){var i,r,s,o,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)?i:n.user_id)?r:"",v.nickname=null!=(o=null!=(s=n.nickname)?s:n.name)?o:"",v.plainProfileUrl=null!=(c=null!=(a=n.profile_url)?a:n.image)?c:"",v.requireAuth=null!=(u=n.require_auth_for_profile_image)&&u,v.metaData=null!=(l=n.metadata)?l:{},v.connectionStatus=rM.NON_AVAILABLE,x(rM,n.is_online)?v.connectionStatus=n.is_online:L("boolean",n.is_online)&&(v.connectionStatus=n.is_online?rM.ONLINE:rM.OFFLINE),v.isActive=null==(h=n.is_active)||h,v.lastSeenAt=null!=(d=n.last_seen_at)?d:null,v.preferredLanguages=n.preferred_languages?E([],p(n.preferred_languages),!1):null,v.friendDiscoveryKey=null!=(_=n.friend_discovery_key)?_:null,v.friendName=null!=(f=n.friend_name)?f:null,v._hashValue=v._generateHashValue(),v._updatedAt=null!=(g=n.updatedat)?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=rq(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.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=sV.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,s;return _(this,function(o){switch(o.label){case 0:return rH(this._isValidMetaData(e)).throw(D.invalidParameters),n=(t=sV.of(this._iid)).sdkState,i=t.requestQueue,r=new rA({userId:n.userId,metadata:e}),[4,i.send(r)];case 1:return s=o.sent().as(rI).metaData,this._applyMetaData(s),[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,s,o;return _(this,function(a){switch(a.label){case 0:return rH(this._isValidMetaData(e)).throw(D.invalidParameters),i=(n=sV.of(this._iid)).sdkState,r=n.requestQueue,s=new rD({userId:i.userId,metadata:e,upsert:t}),[4,r.send(s)];case 1:return o=a.sent().as(rO).metadata,this._applyMetaData(o),[2,this.metaData]}})})},t.prototype.deleteMetaData=function(e){return d(this,void 0,void 0,function(){var t,n,i,r,s;return _(this,function(o){switch(o.label){case 0:return rH(L("string",e)).throw(D.invalidParameters),n=(t=sV.of(this._iid)).sdkState,i=t.requestQueue,r=new rk({userId:n.userId,metadataKey:e}),[4,i.send(r)];case 1:return o.sent(),this._applyMetaData(((s={})[e]=!0,s),!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=sV.of(this._iid)).sdkState,n=e.requestQueue,i=new rR({userId:t.userId}),[4,n.send(i)];case 1:return r.sent(),this.metaData={},[2]}})})},t}(rN),rj=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),rK=function(){function e(e,t){var n,i,r,s,o,a,c,u,l,h,d,_,f,p;this._iid=e,this.appInfo=new rS(t),this.user=new rz(e,t),this.connectedAt=null!=(n=t.login_ts)?n:0,this.firstConnectedAt=0,this.pingInterval=null!=(i=t.ping_interval)?i:15,this.pongTimeout=null!=(r=t.pong_timeout)?r:5,this.reconnectInterval=null!=(o=null==(s=t.reconnect)?void 0:s.interval)?o:3e3,this.reconnectMaxInterval=null!=(c=null==(a=t.reconnect)?void 0:a.max_interval)?c:6e4,this.reconnectRetryCount=null!=(l=null==(u=t.reconnect)?void 0:u.retry_cnt)?l:5,this.reconnectIntervalMultiple=null!=(d=null==(h=t.reconnect)?void 0:h.mul)?d:2,this.maxUnreadCountOnSuperGroup=null!=(_=t.max_unread_cnt_on_super_group)?_:100,this.profileImageEncryption=!!t.profile_image_encryption,this.concurrentCallLimit=null!=(f=t.concurrent_call_limit)?f:5,this.backOffDelay=null!=(p=t.back_off_delay)?p:100}return e.payloadify=function(e){return ew(eN(l(l(l({},rz.payloadify(e.user)),rS.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=sV.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 rj({userProfile:this}))},e}(),rB=function(e){function t(t){var n=t.request,i=t.features,r=t.options,s=t.statConfigInfo,o=e.call(this)||this;return o.request=void 0===n||n,o.features=l({localCache:!0,notification:!0,aiAgent:!0},void 0===i?{}:i),o.options=l({ingestion:!0}
1,void 0===r?{}:r),o.statConfigInfo=s,o}return u(t,e),t}(eS),rQ=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),rW=function(e){function t(t,n,i){var r,s,o,a,c=this;return(c=e.call(this,t,n,i)||this).error=null,c.services=[],c.userProfile=new rK(t,i),c.deviceTokenLastDeletedAt=null!=(r=i.device_token_last_deleted_at)?r:0,c.key=null!=(s=i.key)?s:"",c.ekey=null!=(o=i.ekey)?o:"",c.error=i.error?new D(i):null,c.services=null!=(a=i.services)?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=sV.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 rQ(this.userProfile.appInfo.configSyncNeeded)),i.dispatch(new rB({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),rZ=function(){function e(){this.type=ri.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}(),rY=function(e){function t(t){void 0===t&&(t={});var n,i=this;return(i=e.call(this)||this).type=ri.LOGOUT,i.name="logout",i._wasPreviouslyConnected=null==(n=t.wasPreviouslyConnected)||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 st,t)];case 2:return r.sent(),this._wasPreviouslyConnected&&i7(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)||t.call(e,n)}),[2]})})}),[2]}})})},t}(rZ),rX=function(e){function t(t){var n=(void 0===t?{}:t).isAlreadyDisconnected,i=e.call(this)||this;return i.type=ri.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||i7(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)||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 r8({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 r5,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 rY,t)];case 1:return n.sent(),[2]}})})},t}(rZ),rJ=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);(r7=rG||(rG={}
1)).ExternalSetBackground="ExternalSetBackground",r7.ExternalDisconnectWebSocket="ExternalDisconnectWebSocket",r7.MaxReconnectRetry="MaxReconnectRetry";var r$=function(){function e(e,t){var n=t.sdkState,i=t.cacheContext,r=t.connectionHandlers,s=t.sessionManager,o=t.websocketClient,a=t.dispatcher,c=t.logger,u=t.disableWebSocketCloseEventHandling,l=t.appStateToggleEnabled,h=this;this._disableWebSocketCloseEventHandling=!1,this._appStateToggleEnabled=!0,this._webSocketClosedCause=null,this._logger=c,this._disableWebSocketCloseEventHandling=void 0!==u&&u,this._appStateToggleEnabled=void 0===l||l,this._context=new ss(e,{sdkState:n,cacheContext:i,connectionHandlers:r,sessionManager:s,websocketClient:o,dispatcher:a,logger:c}),this._sdkState=n,this._sessionManager=s,this._websocketClient=o,this._commandDispatcher=a,this._commandDispatcher.on(function(e){var t=h._context.currentState;if(e instanceof rt&&t.type===ri.CONNECTED){var n=e.retryAfterTime,i=e.reasonCode,r=e.message;t.onDelayedConnecting(h._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"),re(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||re(function(){return d(e,void 0,void 0,function(){return _(this,function(e){switch(e.label){case 0:return this._context.currentState.type!==ri.RECONNECTING?[3,3]:this._isPageHidden?(this._logger.debug("ws closed while reconnecting & page hidden; halt reconnect until foreground"),[4,this._context.currentState.onDisconnect(this._context,{autoReconnect:!1})]):[3,2];case 1:e.sent(),e.label=2;case 2:return[2];case 3:return this._sdkState.isAppActive?this._isPageHidden?(this._logger.debug("ws closed while page hidden; disconnect without reconnect until foreground"),[4,this._context.currentState.onDisconnect(this._context,{autoReconnect:!1})]):[3,5]:(this._commandDispatcher.dispatch(new rJ({event:"pause",reason:"app is not active"})),[2]);case 4:return e.sent(),[2];case 5:return this._sessionManager.isSessionKeyRefreshing?[3,7]:(this._logger.debug("try reconnect by websocket connection closed"),[4,this.reconnect()]);case 6:return e.sent(),[3,9];case 7:return[4,this.disconnectWebSocket()];case 8:e.sent(),e.label=9;case 9:return[2]}})})})}))},Object.defineProperty(e.prototype,"_isPageHidden",{get:function(){return this._appStateToggleEnabled&&"u">typeof document&&"hidden"===document.visibilityState},enumerable:!1,configurable:!0}),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===ri.CONNECTED},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isConnecting",{get:function(){var e=this._context.currentState;return e.type===ri.CONNECTING||e.type===ri.RECONNECTING},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"websocketClient",{get:function(){return this._websocketClient},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"shouldReconnectOnForeground",{get:function(){return!this.isConnected&&!this.isConnecting&&!this._sessionManager.isSessionKeyRefreshing&&this._webSocketClosedCause!==rG.ExternalDisconnectWebSocket},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=rG.ExternalSetBackgroun
1d,[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=rG.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}(),r0=function(e){function t(t){var n=t.retryAfterTime,i=t.reasonCode,r=t.message,s=t.authToken,o=e.call(this)||this;return o.type=ri.DELAYED_CONNECTING,o.name="delayedconnecting",o._timerStartTime=0,o._retryAfterTime=n,o._reasonCode=i,o._message=r,o._authToken=s,o}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(){var n=Date.now();clearTimeout(t._delayConnectTimer),t._delayConnectTimer=void 0,t._timerStartTime=0,e.changeState(new r5({authToken:t._authToken,isSoftRateLimited:!0}),n).catch(function(){})},this._retryAfterTime),e.connectionHandlers.forEach(function(e){var n;null==(n=e.onConnectionDelayed)||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,s=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(),s!==rG.ExternalSetBackground?[3,2]:[4,e.changeState(new r1({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 r1({autoReconnect:i}),t)]:[3,4];case 4:return[4,e.changeState(new rY,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 rX,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 rY,t)];case 1:return n.sent(),[2]}})})},t}(rZ),r1=function(e){function t(t){var n=e.call(this)||this;return n.type=ri.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(),i7(function(){return d(n,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEac
1h(function(e){var t;null==(t=e.onConnectionLost)||t.call(e)}),[2]})})}),this._autoReconnect?[4,e.changeState(new r5,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 r8({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 r0({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 r5,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 rX({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 rY,t)];case 1:return n.sent(),[2]}})})},t}(rZ),r2=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)})]})})},r3=function(){function e(){}return e.prototype.calcTimeout=function(){return 0},e}(),r4=function(e,t,n){return void 0===n&&(n=new r3),d(void 0,void 0,void 0,function(){var i,r,s,o,a,c;return _(this,function(u){switch(u.label){case 0:i=0,r=null,s=function(e){return r=null!=e?e:Error("Halted")},o=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(s,o)];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,r2(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."}})})},r5=function(e){function t(t){var n=void 0===t?{}:t,i=n.authToken,r=n.isSoftRateLimited,s=e.call(this)||this;return s.type=ri.RECONNECTING,s.name="reconnecting",s._callbacks=[],s._authToken=i,s._isSoftRateLimited=null!=r?r:void 0,s}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,s,o,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()}),i7(function(){return d(u,void 0,void 0,function(){return _(this,function(t){return e.connectionHandlers.forEach(function(e){var t;null==(t=e.onReconnectStarted)||t.call(e)}),[2]})})}),i=e.dispatcher,l.label=1;case 1:return l.trys.push([1,4,,12]),r=ey(),s=0,[4,r4(function(t,n){return d(u,void 0,void 0,function(){var i;return _(this,function(o){switch(o.label){case 0:this._haltConnect=t,this._resetConnect=n,o.label=1;case 1:return o.trys.push([1,3,,4]),s++,[4,e.connect({authToken:this._authToken,connectionKey:r,connectionRetryCount:s,isSoftRateLimited:this._isSoftRateLimited})];case 2:return o.sent(),[3,4];case 3:if(i=o.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]}})})},(o=e.sdkState.websocket).reconnectMaxRetry,o.reconnectRetryStrategy)];case 2:return l.sent(),[4,e.changeState(new r6,t)];case 3:return l.sent(),this._flushCallbacks(),i7(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)||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 r0({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 r1({autoReconnect:!1}),t)];
1case 8:l.sent(),a.isSessionExpiredError&&i.dispatch(new tl({reason:a.code,message:a.message})),l.label=9;case 9:return this._flushCallbacks(a),i7(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)||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 r8({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 r1({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 rX,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 rY,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,s;return _(this,function(o){switch(o.label){case 0:return t=Date.now(),(s=new D({code:g.DELAYED_CONNECTING,message:r})).setDetail(JSON.stringify({retry_after:n/1e3,reason_code:i,message:r})),this._halt(s),[4,e.changeState(new r0({retryAfterTime:n,reasonCode:i,message:r,authToken:this._authToken}),t)];case 1:return o.sent(),[2]}})})},t}(rZ),r6=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=ri.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 r5,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 r1({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 rX,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 rY,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(s){switch(s.label){case 0:return t=Date.now(),[4,e.changeState(new r0({retryAfterTime:n,reasonCode:i,message:r}),t)];case 1:return s.sent(),[2]}})})},t}(rZ),r8=function(e){function t(t){var n=t.authToken,i=e.call(this)||this;return i.type=ri.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,s,o,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,r4(function(t){return d(a,void 0,void 0,function(){var n;return _(this,function(s){switch(s.label){case 0:this._haltConnect=t,s.label=1;case 1:return s.trys.push([1,3,,4]),r++,[4,e.connect({authToken:this._authToken,connectionKey:i,connectionRetryCount:r})];case 2:return s.sent(),[3,4];case 3:if(n=s.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 r6,t)];case 3:return c.sent(),i7(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)||n.call(t,e.sdkState.userId)}),[2]})})}),[3,12];case 4:return I(s=c.sent())?[3,10]:[4,e.disconnect()];case 5:return c.sent(),s instanceof D?s.code!==g.DELAYED_CONNECTING?[3,7]:(o=JSON.parse(s.detail),[4,e.changeState(new r0({retryAfterTime:1e3*o.retry_after,reasonCode:o.reason_code,message:o.message,authToken:this._authToken}),t)]):[3,9];case 6:return c.sent(),[3,9];case 7:return s.code===g.CONNECTION_CANCELED?[3,9]:[4,e.changeState(new st,t)];case 8:c.sent(),c.label=9;case 9:return i7(function(){return d(a,void 0,void 0,function(){return _(this,function(e){return this._flushCallbacks(s),[2]})})}),[3,11];case 10:throw s;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,s=void 0!==r&&r,o=t.cause,a=void 0===o?null:o;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:r9(a)),e.hasSession?[4,e.changeState(new r1({autoReconnect:s}),t)]:[3,2];case 1:return n.sent(),[3,4];case 2:return[4,e.changeState(new rY,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(r9((null==t?void 0:t.cause)||null)),n=Date.now(),e.hasSession?[4,e.changeState(new rX,n)]:[3,2];case 1:return i.sent(),[3,4];case 2:return[4,e.changeState(new rY,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 rY,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(s){switch(s.label){case 0:return t=Date.now(),[4,e.changeState(new r0({retryAfterTime:n,reasonCode:i,message:r,authToken:this._authToken}),t)];case 1:return s.sent(),[2]}})})},t}(rZ);function r9(e){var t=D.connectionCanceled;if(e){var n=null;switch(e){case rG.ExternalSetBackground:n="Connection has been canceled due to the application having externally moved to background while in ConnectingState.";break;case rG.ExternalDisconnectWebSocket:n="Connection has been canceled because sb.disconnectWebSocket() was called while in ConnectingState."}n&&t.setDetail(n)}return t}var r7,se,st=function(e){function t(){var t=null!==e&&e.apply(this,arguments)||this;return t.type=ri.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 r8({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 rY({wasPreviouslyConnected:!1}),t)];case 1:return n.sent(),[2]}})})},t}(rZ),sn=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),si=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 sn;try{var i=null!=(e=this.sdkState.websocket.pongTimeout)?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)?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}(),sr=["premium_feature_list","file_upload_size_limit","application_attributes","emoji_hash","multiple_file_send_max_size","notifications","message_template","ai_agent"],ss=function(e){function t(t,n){var i,r=n.sdkState,s=n.cacheContext,o=n.connectionHandlers,a=n.sessionManager,c=n.websocketClient,u=n.dispatcher,l=n.logger,h=n.entryState,d=void 0===h?new st:h,_=this;return(_=e.call(this)||this)._currentConnectionRetryCount=0,_._stateUpdatedAt=0,_._connectingAt=0,_._connectedAt=0,_._logiReceivedAt=0,_._connectionRequestQueue=[],_._iid=t,_.sdkState=r,_.cacheContext=s,_.connectionHandlers=o,_._sessionManager=a,_._websocketClient=c,_._dispatcher=u,_._logger=l,_._currentState=d,(null==(i=_.sdkState.websocket)?void 0:i.pingerDisabled)||(_._pinger=new si({pingDelegate:{send:function(e){return _._websocketClient.send(e)},error:function(e){u.dispatch(new tg(new tC({type:to.WEBSOCKET_DISCONNECT,data:{success:!0,error_code:g.NETWORK_E
1RROR,error_description:"cause=ping_pong_timedout"}}))),_._websocketClient.error(e),_._websocketClient.isOpen&&_._websocketClient.forceClose()}},sdkState:_.sdkState,logger:l})),_._websocketClient.on("open",function(){_._connectedAt=Date.now(),_._tryResolveConnectionRequest()}).on("message",function(e){"LOGI"===e.code&&(_.clearLoginTimer(),_._dispatcher.dispatch(e.as(rW)))}).on("ping-refresh",function(){var e;return null==(e=_._pinger)?void 0:e.refreshTimer()}).on("pong",function(){var e;return null==(e=_._pinger)?void 0:e.pong()}).on("error",function(){var e;return null==(e=_._pinger)?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 rW)_._unresolvedLogi=e,_._tryResolveConnectionRequest();else if(e instanceof rt){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 rh({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)||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)||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,s=i.appVersion,o=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.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(s?"&av=".concat(s):"").concat(l.hasSession?"":"&user_id=".concat(encodeURIComponent(o)),"&pmce=").concat(+!!h,"&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(sr))).concat(this._sessionManager.handler?"&expiring_session=1":"","&use_local_cache=").concat(+!!u,"&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:to.WEBSOCKET_CONNECT,data:{host_url:null==(t=this.sdkState.websocket)?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)?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,s,o,a,c,u,l,h,d,f,p=this;return _(this,function(_){switch(_.label){case 0:return this._unresolvedLogi=void 0,this._logiProcessingTimer&&(clearTimeout(this._logiProcessingTimer),this._logiProcessingTimer=void 0,this._rejectConnectionRequest(D.connectionCanceled)),n=new tI,r=void 0===(i=e.authToken)?"":i,o=void 0===(s=e.connectionKey)?ey():s,c=void 0===(a=e.connectionRetryCount)?1:a,u=e.isSoftRateLimited,this._connectionRequestQueue.push(n),1!==this._connectionRequestQueue.length?[3,2]:(this._currentConnectionKey=o,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.responseTimeout),l=this._sessionManager.session,r&&(l.authToken=r,l.sessionKey=void 0),h=0,[4,this.cacheContext.preference.get(rw(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(rW.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 this._unresolvedLogi=void 0,[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),so=function(e){function t(t){var n=t.appId,i=t.userId,r=t.includeUIKitConfig,s=t.localCacheEnabled,o=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===o||o),include_logi:!0,include_extra_data:String(sr),uikit_config:void 0!==r&&r,use_local_cache:void 0===s||s,app_id:n,config_ts:void 0===a?0:a}),c.requireAuth=!1,c}return u(t,e),t}(ta),sa=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.logi=new rW(t,"LOGI",n),i}return u(t,e),t}(tc);(sc=se||(se={}))[sc.ALL=0]="ALL",sc[sc.WEBSOCKET=1]="WEBSOCKET",sc[sc.API=2]="API";var sc,su,sl,sh=[t_,so],sd=function(){function e(e,t){var n=t.session,i=t.sdkState,r=t.dispatcher,s=t.logger,o=t.useFetchCompat,a=this;this._currentConnectionStateType=ri.INITIALIZED,this._lazyCallQueue=[],this.commandRouter=new ra(e,{session:n,sdkState:i,dispatcher:r,logger:s,useFetchCompat:void 0!==o&&o}),this._session=n,this._logger=s,this._dispatcher=r,this._dispatcher.on(function(e){var t,n,i;if(e instanceof rh){var r=e.stateType;switch(a._currentConnectionStateType=r,r){case ri.CONNECTED:a._resolveLazyCallQueue();break;case ri.INITIALIZED:case ri.INTERNAL_DISCONNECTED:case ri.EXTERNAL_DISCONNECTED:case ri.LOGOUT:a._session.isRefreshing||a._rejectLazyCallQueue((null==(i=a._session)?void 0:i.hasSession)?D.connectionClosed:D.connectionRequired)}}else if(e instanceof rd)a._resolveLazyCallQueue(a._session.hasChatServicePermission?se.ALL:se.API);else if(e instanceof r_||e instanceof rf)a._rejectLazyCallQueue(D.connectionClosed);else if(e instanceof tv){var s=e.request,o=e.deferred,c=e.error;try{for(var u=f(sh),l=u.next();!l.done;l=u.next())if(s instanceof l.value)return void o.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:s,deferred:o})}})}return Object.defineProperty(e.prototype,"isReady",{get:function(){return this._currentConnectionStateType===ri.CONNECTED}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isLazyCallActivated",{get:function(){return this._currentConnectionStateType===ri.CONNECTING||this._currentConnectionStateType===ri.RECONNECTING||this._session.isRefreshing},enumerable:!1,configurable:!0}),e.prototype._classifyLazyCallQueueByScope=function(e){var t,n=[],i=[];switch(e){case se.ALL:t=null;break;case se.WEBSOCKET:t=td;break;case se.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._mergeLazyCallScope=function(e,t){return void 0===e?t:e===t?e:se.ALL},e.prototype._clearWebSocketOpenFlushWait=function(){var e,t=null!=(e=this._waitingForWebSocketOpenFlushScope)?e:se.ALL;return this._webSocketOpenFlushContext&&(this._webSocketOpenFlushContext.close(),this._webSocketOpenFlushContext=void 0),this._webSocketOpenFlushTimeout&&(clearTimeout(this._webSocketOpenFlushTimeout),this._webSocketOpenFlushTimeout=void 0),this._waitingForWebSocketOpenFlushScope=void 0,t},e.prototype._resolveLazyCallQueueAfterWebSocketOpen=function(){var e=this._clearWebSocketOpenFlushWait();this._resolveLazyCallQueue(e)},e.prototype._waitForWebSocketOpenToResolveLazyQueue=function(e){var t=this;this._waitingForWebSocketOpenFlushScope=this._mergeLazyCallScope(this._waitingForWebSocketOpenFlushScope,e),this.commandRouter.websocketClient.isOpen?this._resolveLazyCallQueueAfterWebSocketOpen():this._webSocketOpenFlushContext||(this._webSocketOpenFlushContext=this.commandRouter.websocketClient.once("open",function(){t._resolveLazyCallQueueAfterWebSocketOpen()}),this._webSocketOpenFlushTimeout=setTimeout(function(){var e=t._clearWebSocketOpenFlushWait();t._resolveLazyCallQueue(e)},1e4),this.commandRouter.websocketClient.isOpen&&this._resolveLazyCallQueueAfterWebSocketOpen())},e.prototype._resolveLazyCallQueue=function(e){var t=this;void 0===e&&(e=se.ALL);var n=p(this._classifyLazyCallQueueByScope(e),2),i=n[0],r=n[1];this._lazyCallQueue=r;var s=[];i.forEach(function(e){return d(t,void 0,void 0,function(){var t,n,i,r,o,a=this;return _(this,function(c){switch(c.label){case 0:if(t=e.command,n=e.deferred,i=e.timeout,t instanceof td&&!this.commandRouter.websocketClient.isOpen)return e.timeout||(e.timeout=setTimeout(function(){return a.timeout(t.requestId)},1e4)),s.push(e),[2];i&&clearTimeout(i),c.label=1;case 1:return c.trys.push([1,3,,4]),[4,this.send(t)];case 2:return r=c.sent(),n.resolve(r),[3,4];case 3:return o=c.sent(),n.reject(o),[3,4];case 4:return[2]}})})}),s.length>0&&(this._lazyCallQueue=s.concat(this._lazyCallQueue),this._waitForWebSocketOpenToResolveLazyQueue(e))},e.prototype._rejectLazyCallQueue=function(e,t){var n=this;void 0===t&&(t=se.ALL),t!==se.API&&this._clearWebSocketOpenFlushWait();var i=p(this._classifyLazyCallQueueByScope(t),2),r=i[0],s=i[1];this._lazyCallQueue=s,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)
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}(),s_="sendbird@devicetokens",sf=function(){function e(e){var t=e.type,n=e.token,i=e.device_os,r=e.device_manufacturer,s=e.system_push_enabled;this.type=t,this.token=n,this.deviceOS=i,this.deviceManufacturer=r,this.systemPushEnabled=s}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}(),sp=new WeakMap,sE=function(e){function t(t){var n=t._iid,i=t.session,r=t.cacheContext,s=t.sdkState,o=t.dispatcher,a=t.requestQueue,c=t.logger,u=t.pushNotificationAckManager,l=e.call(this)||this;return l._currentConnectionStateType=ri.INITIALIZED,l._isRefreshingAuthToken=!1,l.currentUser=null,l.session=i,l._iid=n,l._cacheContext=r,l._sdkState=s,l._dispatcher=o,l._requestQueue=a,l._logger=c,l._pushNotificationAckManager=u,l._deviceTokens=[],l._dispatcher.on(function(e){var t,n,i,r,s;if(e instanceof rh)l._currentConnectionStateType=e.stateType;else if(e instanceof tl&&!l.isSessionKeyRefreshing){if(l._currentConnectionStateType===ri.CONNECTING)return;(null==(t=e.error)?void 0:t.isSessionInvalidatedError)?l.clear():((null==(n=e.error)?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.isSessionKeyExpiredError)&&(l._logger.debug("session expired"),null==(s=null==(r=l.handler)?void 0:r.onSessionExpired)||s.call(r),l._currentConnectionStateType===ri.CONNECTED&&l._dispatcher.dispatch(new tg(new tC({type:to.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 sp.get(this)},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(s){switch(s.label){case 0:return t=this.createRefreshWebsocketCommand(e),[4,this._requestQueue.forceSend(t)];case 1:if(i=(n=s.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,r4(function(e){return d(n,void 0,void 0,function(){var n,i,r,s;return _(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this._requestQueue.forceSend(t)];case 1:return i=(n=o.sent().as(tp)).key,r=n.services,this.session.sessionKey=i,this.session.services=r,[3,3];case 2:if(s=o.sent(),!this._isSessionRelatedError(s))throw s;return e(s),[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!==ri.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.onSessionTokenRequired){var i=null,r=function(){i&&(clearTimeout(i),i=null)},s=function(e){r(),t._isRefreshingAuthToken&&(t._isRefreshingAuthToken=!1,n.resolve(e))},o=function(e){r(),t._isRefreshingAuthToken&&(t._isRefreshingAuthToken=!1,n.reject(e))};i=setTimeout(function(){return o()},1e3*this._sdkState.sessionTokenRefreshTimeout),i7(function(){return d(t,void 0,void 0,function(){var e;return _(this,function(t){return(null==(e=this.handler)?void 0:e.onSessionTokenRequired)&&this.handler.onSessionTokenRequired(s,o),[2]})})})}else this._isRefreshingAuthToken=!1,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,s,o;return _(this,function(a){switch(a.label){case 0:return this.session.authToken=t,i=0,[4,this._cacheContext.preference.get(rw(this._sdkState.appId))];case 1:return(r=a.sent())&&(i=r.configTs),s=new so({appId:this._sdkState.appId,userId:e,includeUIKitConfig:!!(null!=(n=this._sdkState.extensions)?n:{}).sb_uikit,localCacheEnabled:this._cacheContext.localCacheEnabled,expiringSession:this.isSessionExpiring,configTs:i}),[4,this._requestQueue.commandRouter.send(s)];case 2:return(o=a.sent().as(sa).logi).error?[3,5]:this.session.hasChatServicePermission?[3,4]:[4,o.applyTo(this._iid)];case 3:a.sent(),a.label=4;case 4:return[3,6];case 5:throw o.error;case 6:return[2]}})})},t.prototype.login=function(e){var t;return d(this,void 0,void 0,function(){var n,i,r,s,o,a,c,u;return _(this,function(l){switch(l.label){case 0:return n=e.key,i=e.ekey,r=e.services,s=e.userProfile,a=void 0===(o=e.deviceTokenLastDeletedAt)?0:o,this.session.sessionKey=n,this.session.services=r,sp.set(this,i),this._deviceTokenCacheEnabled=null==(t=null==s?void 0:s.appInfo)?void 0:t.deviceTokenCache,c=this._cacheContext.preference,this._deviceTokenCacheEnabled?[4,c.get(s_)]:[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 sf(sf.payloadify(e))}),this._deviceTokenLastDeletedAt=u.lastDeletedAt,l.label=4;case 4:return[3,7];case 5:return[4,c.remove(s_)];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 rd),i7(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.onSessionRefreshed)&&this.handler.onSessionRefreshed(),[2]})})})},t.prototype.error=function(e){var t=this;i7(function(){return d(t,void 0,void 0,function(){var t;return _(this,function(n){return(null==(t=this.handler)?void 0:t.onSessionError)&&this.handler.onSessionError(e),[2]})})})},t.prototype.close=function(){var e=this;this.dispatch("close"),this._dispatcher.dispatch(new rf),i7(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.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.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 r_),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.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 r_),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 sf({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(s_,{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(),sp.delete(this),this._deviceTokens=[],this._deviceTokenLastDeletedAt=0,[4,this.saveDeviceToken()];case 1:return e.sent(),this._pushNotificationAckManager.clear(),[2]}})})},t}(eT),sg=function(e,t){var n,i;if(null!==e&&null!==t){var r=Object.keys(e),s=Object.keys(t),o=E([],p(new Set(E(E([],p(r),!1),p(s),!1))),!1),a={};try{for(var c=f(o),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]=sg(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};(sv=su||(su={}
1))[sv.PENDING=0]="PENDING",sv[sv.COLLECT_ONLY=1]="COLLECT_ONLY",sv[sv.ENABLED=2]="ENABLED",sv[sv.DISABLED=3]="DISABLED",(sm=sl||(sl={})).DAILY="daily",sm.DEFAULT="default",sm.REALTIME="realtime";var sv,sm,sy,sb=function(){function e(e){var t=e.deviceId,n=e.cacheContext,i=e.requestQueue;this.queue=[],this.flushWaitQueue=[],this.enabledState=su.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===su.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)?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}(),sT=function(e){function t(t){var n,i,r,s,o=t.type,a=t.data,c=t.ts,u=void 0===c?Date.now():c,l=e.call(this,{type:o,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"),s=String(n.getDate()).padStart(2,"0"),"".concat(i).concat(r).concat(s)),"_").concat(o),l}return u(t,e),t}(tC),sC=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),sS=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,s;return _(this,function(o){switch(o.label){case 0:return this.statConfig=e,this.statConfig.minInterval=864e5,this._mergeQueue(),t.localCacheStat?(this.enabledState=t.enabledStat?su.ENABLED:su.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=su.DISABLED,[4,this.clear()];case 2:o.sent(),o.label=3;case 3:return this.isEnabled&&this._isSendable?[4,this._getUploadStats()]:[3,9];case 4:n=o.sent(),i=Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100),r=0,o.label=5;case 5:return r<n.length?(s=n.slice(r,1+this.statConfig.maxStatCountPerRequest),[4,r2(i)]):[3,9];case 6:return o.sent(),[4,this._flush(s)];case 7:o.sent(),o.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===su.DISABLED?[2,!0]:((n=p((t=this.enabledState===su.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).filter(function(t){return t instanceof sT&&t.key===e.key}),1)[0])?n.data=sg(n.data,e.data):t.push(e),this.enabledState===su.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 sT){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 s=p([e.date.getMonth(),t.getMonth()],2),o=s[0],a=s[1];if(o<a)return!0;if(o===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(s){switch(s.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,s.label=1;case 1:return s.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new sC({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return s.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 s.sent(),[3,9];case 4:return(r=s.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return s.sent(),this.enabledState=su.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=su.COLLECT_ONLY),s.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,s.label=11;case 11:return[2,t]}})})},t}(sb),sw=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!==to.FEATURE_LOCALCACHE_EVENT}):e.filter(function(e){return e.type===to.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(s){switch(s.label){case 0:return this.statConfig=e,this._mergeQueue(),t.requestStat||t.localCacheStat?(this.enabledState=t.enabledStat?su.ENABLED:su.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=s.sent(),r=this,[4,this._filterQueueByType(this.flushWaitQueue,n)];case 2:r.flushWaitQueue=s.sent(),this._save(),s.label=3;case 3:return[3,6];case 4:return this.enabledState=su.DISABLED,[4,this.clear()];case 5:s.sent(),s.label=6;case 6:return this.isEnabled&&this._isSendable(!0)?[4,r2(Math.max(Math.floor(Math.random()*this.statConfig.requestDelayRange),100))]:[3,9];case 7:return s.sent(),[4,this._flush(this.queue)];case 8:s.sent(),s.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===su.DISABLED?[2,!0]:((t=this.enabledState===su.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).push(e),this.enabledState===su.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(s){switch(s.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,s.label=1;case 1:return s.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new sC({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return s.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 s.sent(),[3,9];case 4:return(r=s.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return s.sent(),this.enabledState=su.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=su.COLLECT_ONLY),s.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,s.label=11;case 11:return[2,t]}})})},t}(sb),sN=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),sA=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)?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)?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?su.ENABLED:su.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=su.DISABLED,[4,this.clear()];case 2:n.sent(),n.label=3;case 3:return this.isEnabled&&this._isSendable?[4,r2(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===su.DISABLED?[2,!0]:(t=this.enabledState===su.PENDING||this.isFlushing?this.flushWaitQueue:this.queue,this._isDuplicateStat(e)?[2,!0]:(t.push(e),this.enabledState===su.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(s){switch(s.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,s.label=1;case 1:return s.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new sN({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return s.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 s.sent(),[3,9];case 4:return(r=s.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return s.sent(),this.enabledState=su.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=su.COLLECT_ONLY),s.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,s.label=11;case 11:return[2,t]}})})},t}(sb),sI=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),sD=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?su.ENABLED:su.COLLECT_ONLY,[3,3]):[3,1];case 1:return this.enabledState=su.DISABLED,[4,this.clear()];case 2:n.sent(),n.label=3;case 3:return this.isEnabled&&this._isSendable(!0)?[4,r2(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===su.DISABLED?[2,!0]:((t=this.enabledState===su.PENDING||this.isFlushing?this.flushWaitQueue:this.queue).push(e),this.enabledState===su.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(s){switch(s.label){case 0:if(t=!0,!(e.length>0))return[3,10];if(this.isFlushing)return[3,9];this.isFlushing=!0,s.label=1;case 1:return s.trys.push([1,4,8,9]),n=E([],p(e),!1).slice(0,Math.min(this.limit,this.statConfig.maxStatCountPerRequest)),i=new sI({deviceId:this.deviceId,statLogs:n}),[4,this.requestQueue.send(i)];case 2:return s.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 s.sent(),[3,9];case 4:return(r=s.sent())instanceof D?r.code!==g.NON_AUTHORIZED?[3,6]:[4,this.clear()]:[3,7];case 5:return s.sent(),this.enabledState=su.DISABLED,[3,7];case 6:r.code===g.STAT_UPLOAD_NOT_ALLOWED&&(this.enabledState=su.COLLECT_ONLY),s.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,s.label=11;case 11:return[2,t]}})})},t}(sb),sO=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 sS({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._defaultStatCollector=new sw({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._notificationStatCollector=new sA({deviceId:this.deviceId,cacheContext:this.cacheContext,requestQueue:this.requestQueue}),this._aiAgentStatCollector=new sD({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===to.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!==to.FEATURE_LOCALCACHE&&e.stat_type!==to.NOTIFICATION&&(e.stat_type===to.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===to.NOTIFICATION&&(e.data=ew(l(l({},e.data),{message_id:null!=(t=e.data.notificationId)?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,s,o;return _(this,function(a){return e instanceof tg?(t=e.statLog,this.put(t)):e instanceof rB&&(n=e.request,i=e.features,r=e.options,s=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=s,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!=(o=this._statConfig.realTime)?o: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 sT?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 to.API_RESULT:case to.WEBSOCKET_CONNECT:case to.WEBSOCKET_DISCONNECT:return[3,4];case to.FEATURE_LOCALCACHE:case to.FEATURE_LOCALCACHE_EVENT:return[3,7];case to.NOTIFICATION:return[3,10];case to.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=su.COLLECT_ONLY,this._defaultStatCollector.enabledState=su.COLLECT_ONLY,this._notificationStatCollector.enabledState=su.COLLECT_ONLY,this._aiAgentStatCollector.enabledState=su.COLLECT_ONLY,this.logger.debug(D.statLogUploadLimitExceededError))),[2]}})})},e.prototype.appendStat=function(e,t,n){if(e===to.AI_AGENT_SDK_STATS&&!this._collectAIAgentStat||e===to.NOTIFICATION&&!this._collectionNotificationStat||(e===to.API_RESULT||e===to.WEBSOCKET_CONNECT||e===to.WEBSOCKET_DISCONNECT)&&!this._collectRequestStat||(e===to.FEATURE_LOCALCACHE||e===to.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}(),sk=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}();(sR=sy||(sy={})).DELIVERY_RECEIPT="delivery_receipt",sR.PUSH_ACKNOWLEDGEMENT="push_acknowledgement";var sR,sL,sx=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])&&n},t.prototype.markAsAcked=function(e,t){var n="".concat(e,"_").concat(t);this._pushAckedCache[n]=!0},t.prototype.clear=function(){sV.of(this._iid).logger.debug("clear push acked cache"),this._pushAckedCache={}},t.prototype.parseData=function(e){var t,n,i,r,s=sV.of(this._iid).logger,o=e.sendbird;if("string"==typeof o)try{o=JSON.parse(o)}catch(e){throw s.info("push notification payload does not contain sendbird payload in JSON format."),D.malformedDataError}if(!o||"object"!=typeof o)throw s.info("push notification payload does not contain sendbird payload in JSON format."),D.malformedDataError;var a=null!=(t=o.push_tracking_id)?t:"",c=o.notification_message_id,u=o.notification_channel_key,l=o.notification_template_key,h=o.notification_event_deadline,d=null!=(n=o.session_key)?n:{},_=null!=(i=null==d?void 0:d.key)?i:"",f=null!=(r=null==d?void 0:d.topics)?r:[];if("string"!=typeof a||0===a.length)throw s.info("push tracking id is not available"),D.malformedDataError;if("string"!=typeof c||0===c.length)throw s.info("message id is not available"),D.malformedDataError;return{pushTrackingId:a,sessionKey:_,sessionTopics:f,messageId:c,channelKey:u,templateKey:l,notificationEventDeadline:h}},t}(rN),sU=function(e){this.name=e.name,this._custom=e.custom,this._usedByModerationEngine=e.used_by_moderation_engine},sP=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),sM=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),sF=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=sV.of(this._iid).requestQueue,t=new sP,[4,e.send(t)];case 1:return(n=r.sent().as(sM).reportCategories)&&(i=this._categories).push.apply(i,E([],p(n.map(function(e){return new sU(e)})),!1)),[2]}})})},t}(rN),sq=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),s=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(s).concat(n?"_".concat(n):"")},e.prototype.requestGetChannel=function(e,t,n,i){var r,s,o=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&&(s=u.return)&&s.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=o._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(){o._requestCache.delete(E)},o._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()),s=r.next();!s.done;s=r.next()){var o=p(s.value,2),a=o[0],c=o[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{s&&!s.done&&(i=r.return)&&i.call(r)}finally{if(n)throw n.error}}},e}(),sH={},sV=function(){function e(e,t){var n,i,r,s,o,a,c,u,l,h,d;if(this.connectedAt=0,this.firstConnectedAt=0,this.connectionHandlers=new Map,this.userEventHandlers=new Map,!sH[e]){sH[e]=this;var _=null!=(n=t.options)?n:new K,f=this.sdkState={appId:t.appId,appVersion:null!=(i=t.appVersion)?i:"",appState:"foreground",isAppActive:!0,userId:void 0,extensions:{},api:{host:null!=(r=t.apiHost)?r:"https://api-".concat(t.appId,".sendbird.com")},websocket:{host:null!=(s=t.websocketHost)?s:"wss://ws-".concat(t.appId,".sendbird.com"),pingerDisabled:!!t.noPingpong,pingInterval:void 0,pongTimeout:void 0,connectMaxRetry:2,compression:!0,reconnectMaxRetry:-1,reconnectRetryStrategy:new r3,responseTimeout:_.websocketResponseTimeout},sessionTokenRefreshTimeout:_.sessionTokenRefreshTimeout};this.appInfo=void 0,this.subscribedUnreadMessageCount={all:0,feed:0,customTypes:{},ts:0};var p=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 E=this.cacheContext=new W({encryption:t.encryption,store:t.store,localCacheEnabled:null!=(o=t.localCacheEnabled)&&o,localCacheConfig:null!=(a=t.localCacheConfig)?a:new er});this.debugMode=null!=(c=t.debugMode)&&c,this.maxSuperGroupChannelUnreadCount=m.DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL,this.useMemberInfoInMessage=_.useMemberInfoInMessage,this.typingIndicatorInvalidateTime=_.typingIndicatorInvalidateTime,this.typingIndicatorThrottle=_.typingIndicatorThrottle,this.concurrentCallLimit=void 0,this.backOffDelay=void 0;var g=this.dispatcher=new eC,v=new em;this.requestQueue=new sd(e,{session:v,sdkState:f,dispatcher:g,logger:p,useFetchCompat:t.useFetchCompat}),this.pushNotificationAckManager=new sx(e),this.sessionManager=new sE({_iid:e,session:v,cacheContext:E,sdkState:f,dispatcher:g,requestQueue:this.requestQueue,logger:p,pushNotificationAckManager:this.pushNotificationAckManager}),this.connectionManager=new r$(e,{sdkState:f,cacheContext:this.cacheContext,connectionHandlers:this.connectionHandlers,dispatcher:g,sessionManager:this.sessionManager,websocketClient:this.requestQueue.commandRouter.websocketClient,disableWebSocketCloseEventHandling:null!=(u=t.disableWebSocketCloseEventHandling)&&u,appStateToggleEnabled:null==(l=t.appStateToggleEnabled)||l,logger:p}),this.statManager=new sO({cacheContext:this.cacheContext,requestQueue:this.requestQueue,dispatcher:this.dispatcher,logger:p}),this.appStateToggleEnabled=null==(h=t.appStateToggleEnabled)||h,this.supportMultipleTabs=null!=(d=t.supportMultipleTabs)&&d,this.messageBackgroun
1dSyncThrottleController=new sk({limit:5}),this.reportCategoryManager=new sF(e),this.requestDeduplicator=new sq}return sH[e]}return e.of=function(e){if(sH[e])return sH[e];throw D.lostInstance},e.clear=function(e){sH[e]&&delete sH[e]},e.prototype.hasExtension=function(e){return this.sdkState.extensions&&this.sdkState.extensions[e]},e}(),sG=function(){function e(){}return e.prototype.init=function(e,t){var n=t.sdkState,i=t.dispatcher,r=t.sessionManager,s=t.requestQueue,o=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=s,this._logger=o},e}();(sz=sL||(sL={})).UNKNOWN="UNKNOWN",sz.EVENT_CHANNEL_CREATED="EVENT_CHANNEL_CREATED",sz.EVENT_CHANNEL_UPDATED="EVENT_CHANNEL_UPDATED",sz.EVENT_CHANNEL_DELETED="EVENT_CHANNEL_DELETED",sz.EVENT_CHANNEL_READ="EVENT_CHANNEL_READ",sz.EVENT_CHANNEL_UNREAD="EVENT_CHANNEL_UNREAD",sz.EVENT_CHANNEL_DELIVERED="EVENT_CHANNEL_DELIVERED",sz.EVENT_CHANNEL_INVITED="EVENT_CHANNEL_INVITED",sz.EVENT_CHANNEL_JOINED="EVENT_CHANNEL_JOINED",sz.EVENT_CHANNEL_LEFT="EVENT_CHANNEL_LEFT",sz.EVENT_CHANNEL_ACCEPTED_INVITE="EVENT_CHANNEL_ACCEPTED_INVITE",sz.EVENT_CHANNEL_DECLINED_INVITE="EVENT_CHANNEL_DECLINED_INVITE",sz.EVENT_CHANNEL_OPERATOR_UPDATED="EVENT_CHANNEL_OPERATOR_UPDATED",sz.EVENT_CHANNEL_BANNED="EVENT_CHANNEL_BANNED",sz.EVENT_CHANNEL_UNBANNED="EVENT_CHANNEL_UNBANNED",sz.EVENT_CHANNEL_MUTED="EVENT_CHANNEL_MUTED",sz.EVENT_CHANNEL_UNMUTED="EVENT_CHANNEL_UNMUTED",sz.EVENT_CHANNEL_FROZEN="EVENT_CHANNEL_FROZEN",sz.EVENT_CHANNEL_UNFROZEN="EVENT_CHANNEL_UNFROZEN",sz.EVENT_CHANNEL_HIDDEN="EVENT_CHANNEL_HIDDEN",sz.EVENT_CHANNEL_UNHIDDEN="EVENT_CHANNEL_UNHIDDEN",sz.EVENT_CHANNEL_RESET_HISTORY="EVENT_CHANNEL_RESET_HISTORY",sz.EVENT_CHANNEL_TYPING_STATUS_UPDATE="EVENT_CHANNEL_TYPING_STATUS_UPDATE",sz.EVENT_CHANNEL_MEMBER_COUNT_UPDATED="EVENT_CHANNEL_MEMBER_COUNT_UPDATED",sz.EVENT_CHANNEL_METADATA_CREATED="EVENT_CHANNEL_METADATA_CREATED",sz.EVENT_CHANNEL_METADATA_UPDATED="EVENT_CHANNEL_METADATA_UPDATED",sz.EVENT_CHANNEL_METADATA_DELETED="EVENT_CHANNEL_METADATA_DELETED",sz.EVENT_CHANNEL_METACOUNTER_CREATED="EVENT_CHANNEL_METACOUNTER_CREATED",sz.EVENT_CHANNEL_METACOUNTER_UPDATED="EVENT_CHANNEL_METACOUNTER_UPDATED",sz.EVENT_CHANNEL_METACOUNTER_DELETED="EVENT_CHANNEL_METACOUNTER_DELETED",sz.EVENT_MESSAGE_SENT="EVENT_MESSAGE_SENT",sz.EVENT_MESSAGE_RECEIVED="EVENT_MESSAGE_RECEIVED",sz.EVENT_MESSAGE_UPDATED="EVENT_MESSAGE_UPDATED",sz.EVENT_PINNED_MESSAGE_UPDATED="EVENT_PINNED_MESSAGE_UPDATED",sz.REQUEST_CHANNEL="REQUEST_CHANNEL",sz.REQUEST_CHANNEL_CHANGELOGS="REQUEST_CHANNEL_CHANGELOGS",sz.REFRESH_CHANNEL="REFRESH_CHANNEL",sz.CHANNEL_LASTACCESSEDAT_UPDATED="CHANNEL_LASTACCESSEDAT_UPDATED",sz.SYNC_CHANNEL_BACKGROUND="SYNC_CHANNEL_BACKGROUND",sz.SYNC_CHANNEL_CHANGELOGS="SYNC_CHANNEL_CHANGELOGS",sz.EVENT_MESSAGE_SENT_SUCCESS="EVENT_MESSAGE_SENT_SUCCESS",sz.EVENT_MESSAGE_SENT_FAILED="EVENT_MESSAGE_SENT_FAILED",sz.EVENT_MESSAGE_SENT_PENDING="EVENT_MESSAGE_SENT_PENDING",sz.EVENT_MESSAGE_DELETED="EVENT_MESSAGE_DELETED",sz.EVENT_MESSAGE_FEEDBACK_ADDED="EVENT_MESSAGE_FEEDBACK_ADDED",sz.EVENT_MESSAGE_FEEDBACK_UPDATED="EVENT_MESSAGE_FEEDBACK_UPDATED",sz.EVENT_MESSAGE_FEEDBACK_DELETED="EVENT_MESSAGE_FEEDBACK_DELETED",sz.EVENT_MESSAGE_READ="EVENT_MESSAGE_READ",sz.EVENT_MESSAGE_DELIVERED="EVENT_MESSAGE_DELIVERED",sz.EVENT_MESSAGE_REACTION_UPDATED="EVENT_MESSAGE_REACTION_UPDATED",sz.EVENT_MESSAGE_THREADINFO_UPDATED="EVENT_MESSAGE_THREADINFO_UPDATED",sz.EVENT_MESSAGE_OFFSET_UPDATED="EVENT_MESSAGE_OFFSET_UPDATED",sz.REQUEST_MESSAGE="REQUEST_MESSAGE",sz.EVENT_THREAD_INFO_UPDATED="EVENT_THREADINFO_UPDATED",sz.EVENT_POLL_UPDATED="EVENT_POLL_UPDATED",sz.EVENT_POLL_VOTED="EVENT_POLL_VOTED",sz.SYNC_POLL_CHANGELOGS="SYNC_POLL_CHANGELOGS",sz.EVENT_CHANNEL_CSAT_SUBMITTED="EVENT_CHANNEL_CSAT_SUBMITTED",sz.EVENT_CHANNEL_CONVERSATION_HANDEDOFF="EVENT_CHANNEL_CONVERSATION_HANDEDOFF",sz.REQUEST_RESEND_MESSAGE="REQUEST_RESEND_MESSAGE",sz.REQUEST_THREADED_MESSAGE="REQUEST_THREADED_MESSAGE",sz.REQUEST_MESSAGE_CHANGELOGS="REQUEST_MESSAGE_CHANGELOGS",sz.SYNC_MESSAGE_FILL="SYNC_MESSAGE_FILL",sz.SYNC_MESSAGE_BACKGROUND="SYNC_MESSAGE_BACKGROUND",sz.SYNC_MESSAGE_CHANGELOGS="SYNC_MESSAGE_CHANGELOGS",sz.LOCAL_MESSAGE_PENDING_CREATED="LOCAL_MESSAGE_PENDING_CREATED",sz.LOCAL_MESSAGE_FAILED="LOCAL_MESSAGE_FAILED",sz.LOCAL_MESSAGE_CANCELED="LOCAL_MESSAGE_CANCELED",sz.LOCAL_MESSAGE_RESEND_STARTED="LOCAL_MESSAGE_RESEND_STARTED",l({},sL);var sz,sj,sK=function(e){return e.startsWith("EVENT_")||e.startsWith("LOCAL_MESSAGE_")||e===sL.SYNC_MESSAGE_FILL||e===sL.SYNC_MESSAGE_CHANGELOGS||e===sL.SYNC_POLL_CHANGELOGS},sB=function(e){function t(t){var n=t.messages,i=t.source,r=t.isWebSocketEventComing,s=e.call(this)||this;return s.messages=n,s.source=i,s.isWebSocketEventComing=void 0!==r&&r,s}return u(t,e),t}(eS),sQ=function(e){function t(t){var n=t.messageIds,i=t.source,r=t.isWebSocketEventComing,s=e.call(this)||this;return s.messageIds=n,s.source=i,s.isWebSocketEventComing=void 0!==r&&r,s}return u(t,e),t}(eS),sW=function(e){function t(t){var n=t.messageDeletionTimestamp,i=t.channelUrl,r=t.source,s=e.call(this)||this;return s.messageDeletionTimestamp=n,s.channelUrl=i,s.source=r,s}return u(t,e),t}(eS),sZ=function(e){function t(t){var n=t.event,i=t.source,r=t.isWebSocketEventComing,s=e.call(this)||this;return s.event=n,s.source=i,s.isWebSocketEventComing=void 0!==r&&r,s}return u(t,e),t}(eS),sY=function(e){function t(t){var n=t.event,i=t.source,r=t.isWebSocketEventComing,s=e.call(this)||this;return s.event=n,s.source=i,s.isWebSocketEventComing=void 0!==r&&r,s}return u(t,e),t}(eS),sX=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),sJ=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),s$=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),s0=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);(o=sj||(sj={})).OPEN="open",o.CLOSED="closed";var s1="removed",s2=function(e){switch(e){case"open":return sj.OPEN;case"closed":return sj.CLOSED;default:return null}},s3=function(e){return!e||!!e.text&&L("string",e.text)},s4=function(e){function t(t,n){var i,r,s,o,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)?i:0,l.id=null!=(r=n.id)?r:0,l.text=null!=(s=n.text)?s:null,l.voteCount=null!=(o=n.vote_count)?o:0,l.createdBy=null!=(a=n.created_by)?a:null,l.createdAt=null!=(c=n.created_at)?c:0,l.updatedAt=null!=(u=n.updated_at)?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}(rN),s5=function(e){function t(t,n){var i,r,s,o,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=sj.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)?i:0,E.title=null!=(r=n.title)?r:null,E.createdAt=null!=(s=n.created_at)?s:0,E.updatedAt=null!=(o=n.updated_at)?o:0,E.closeAt=null!=(a=n.close_at)?a:-1,E.status=null!=(c=s2(n.status))?c:sj.CLOSED,E.messageId=null!=(u=n.message_id)?u:0,E.data=null!=(l=n.data)?l:null,E.voterCount=null!=(h=n.voter_count)?h:-1,E.options=n.options?n.options.map(function(e){return new s4(E._iid,e)}):[],E.createdBy=null!=(d=n.created_by)?d:null,E.allowUserSuggestion=null!=(_=n.allow_user_suggestion)&&_,E.allowMultipleVotes=null!=(f=n.allow_multiple_votes)&&f,E.votedPollOptionIds=null!=(p=n.voted_option_ids)?p:[],E}return u(t,e),t.prototype._applyPollUpdatePayload=function(e){var t,n,i,r,s,o,a,c,u=this;this.title=null!=(t=e.title)?t:this.title,this.updatedAt=null!=(n=e.updated_at)?n:this.updatedAt,this.closeAt=null!=(i=e.close_at)?i:this.closeAt,this.status=null!=(r=s2(e.status))?r:this.status,this.data=null!=(s=e.data)?s:this.data,this.voterCount=null!=(o=e.voter_count)?o:this.voterCount,e.options&&(this.options=e.options.map(function(e){return new s4(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)?a:this.allowUserSuggestion,this.allowMultipleVotes=null!=(c=e.allow_multiple_votes)?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 s4.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 s=t[i];r>=s._lastVotedAt&&(s.voteCount=e.vote_count,s._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}(rN),s6=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)?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}(),s8=function(e){function t(t,n,i,r){var s=e.call(this,t,r)||this;return s.channelUrl=n,s.channelType=i,s}return u(t,e),t.prototype._validate=function(){return e.prototype._validate.call(this)&&L("string",this.channelUrl)&&x(eo,this.channelType)},t}(s6),s9=function(e){this.pollId=0,this.messageId=0,this.pollId=e.poll_id,this.messageId=e.message_id,this._payload=e},s7=function(e){function t(t){var n=t.title,i=t.optionTexts,r=t.data,s=t.allowUserSuggestion,o=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:s,allow_multiple_votes:o,close_at:a},c}return u(t,e),t}(ta),oe=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.poll=new s5(t,n),i}return u(t,e),t}(tc),ot=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,s=e.call(this)||this;return s.method=eH.GET,s.path="".concat(eJ,"/").concat(encodeURIComponent(r)),s.params={channel_url:n,channel_type:i},s}return u(t,e),t}(ta),on=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.poll=new s5(t,n),i}return u(t,e),t}(tc),oi=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,s=t.pollOptionId,o=e.call(this)||this;return o.method=eH.GET,o.path="".concat(eJ,"/").concat(encodeURIComponent(r),"/options/").concat(encodeURIComponent(s)),o.params={channel_url:n,channel_type:i},o}return u(t,e),t}(ta),or=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.pollOption=new s4(t,n),i}return u(t,e),t}(tc),os=function(e){function t(t){var n=t.channelType,i=t.channelUrl,r=t.timestamp,s=t.token,o=e.call(this)||this;return o.method=eH.GET,o.path="".concat(te(n),"/").concat(encodeURIComponent(i),"/polls/changelogs"),o.params=ew({change_ts:r,token:s}),o}return u(t,e),t}(ta),oo=function(e){function t(t,n){var i=e.call(this,t,n)||this;return i.updatedPolls=n.updated.map(function(e){return new s5(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),oa={title:"",optionTexts:[],data:void 0,allowUserSuggestion:void 0,allowMultipleVotes:void 0,closeAt:-1},oc=function(e){var t;return L("string",e.title)&&P("string",t=e.optionTexts)&&t.every(function(e){return""!==e.trim()})&&s3(e.data)&&L("boolean",e.allowUserSuggestion,!0)&&L("boolean",e.allowMultipleVotes,!0)&&L("number",e.closeAt,!0)},ou={channelUrl:"",channelType:eo.BASE,pollId:0,pollOptionId:0},ol=function(e){return L("string",e.channelUrl)&&""!==e.channelUrl&&x(eo,e.channelType)&&L("number",e.pollId)&&e.pollId>0&&L("number",e.pollOptionId)&&e.pollOptionId>0},oh={channelUrl:"",channelType:eo.BASE,pollId:0},od=function(e){return L("string",e.channelUrl)&&""!==e.channelUrl&&x(eo,e.channelType)&&L("number",e.pollId)},o_={},of=function(){function e(e,t){var n=t.sdkState,i=t.dispatcher,r=t.sessionManager,s=t.requestQueue,o=t.logger;this._iid=e,this._sdkState=n,this._sessionManager=r,this._requestQueue=s,this._dispatcher=i,this._logger=o,o_[e]=this}return e.of=function(e){return o_[e]},e.prototype.buildPollFromSerializedData=function(e){var t=rq(e);return new s5(this._iid,s5.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 rH(od(e)).throw(D.invalidParameters),t=new ot(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(on).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 rH(oc(e)).throw(D.invalidParameters),t=new s7(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(oe).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 rH(ol(e)).throw(D.invalidParameters),t=new oi(l({},e)),[4,this._requestQueue.send(t)];case 1:return[2,n.sent().as(or).pollOption]}})})},e.prototype.getPollChangeLogs=function(e,t,n,i){return void 0===i&&(i=sL.SYNC_POLL_CHANGELOGS),d(this,void 0,void 0,function(){var r,s,o,a,c,u;return _(this,function(l){switch(l.label){case 0:return r=new os(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 o=(s=l.sent().as(oo)).updatedPolls,a=s.deletedPollIds,c=s.hasMore,u=s.nextToken,o.length>0&&this._dispatcher.dispatch(new sJ({polls:o,source:i})),[2,{updatedPolls:o,deletedPollIds:a,hasMore:c,token:u}]}})})},e}(),op=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.token,s=t.limit,o=e.call(this)||this;return o.method=eH.GET,o.path=eJ,o.params={channel_url:n,channel_type:i,token:r,limit:s},o}return u(t,e),t}(ta),oE=function(e){function t(t,n){var i,r=this;return(r=e.call(this,t,n)||this).polls=(null!=(i=n.polls)?i:[]).map(function(e){return new s5(t,e)}),r.token=n.next,r}return u(t,e),t}(tc),og=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(s){switch(s.label){case 0:return this._val
1idate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=sV.of(this._iid).requestQueue,t=new op(l(l({},this),{token:this._token})),[4,e.send(t)]):[3,2]:[3,5];case 1:return i=(n=s.sent().as(oE)).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}(s8),ov=function(e){function t(t){var n=t.channelUrl,i=t.channelType,r=t.pollId,s=t.pollOptionId,o=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(s),"/voters"),c.params={channel_url:n,channel_type:i,token:o,limit:a},c}return u(t,e),t}(ta),om=function(e){function t(t,n){var i,r=this;return(r=e.call(this,t,n)||this).voters=(null!=(i=n.voters)?i:[]).map(function(e){return new rz(t,e)}),r.token=n.next,r}return u(t,e),t}(tc),oy=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(s){switch(s.label){case 0:return this._validate()?this._isLoading?[3,3]:this._hasNext?(this._isLoading=!0,e=sV.of(this._iid).requestQueue,t=new ov(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=s.sent().as(om)).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}(s8)}}]);

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.