laudantiumculpa
Version:
Sendbird SDK for JavaScript
2 lines • 151 kB
JavaScript
function e(e,t,s,i){return new(s||(s=Promise))((function(n,o){function r(e){try{l(i.next(e))}catch(e){o(e)}}function a(e){try{l(i.throw(e))}catch(e){o(e)}}function l(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,a)}l((i=i.apply(e,t||[])).next())}))}"function"==typeof SuppressedError&&SuppressedError;var t,s="4.11.2";class i{static get OS_VERSION(){return"undefined"!=typeof navigator&&navigator.userAgent?navigator.userAgent.replace(/,/g,"."):"noAgent"}static get SDK_VERSION(){return s}static get SDK_MAJOR_VERSION(){return i.SDK_VERSION.split(".")[0]}static get DEFAULT_MAX_UNREAD_COUNT_OF_SUPER_GROUP_CHANNEL(){return 100}static get INTERNAL_CALL(){return"ic"}}exports.SendbirdErrorCode=void 0,(t=exports.SendbirdErrorCode||(exports.SendbirdErrorCode={}))[t.NON_AUTHORIZED=400108]="NON_AUTHORIZED",t[t.INVALID_TOKEN=400111]="INVALID_TOKEN",t[t.NOT_FOUND_IN_DATABASE=400201]="NOT_FOUND_IN_DATABASE",t[t.USER_AUTH_DEACTIVATED=400300]="USER_AUTH_DEACTIVATED",t[t.USER_AUTH_DELETED_OR_NOT_FOUND=400301]="USER_AUTH_DELETED_OR_NOT_FOUND",t[t.SESSION_TOKEN_EXPIRED=400302]="SESSION_TOKEN_EXPIRED",t[t.APPLICATION_NOT_FOUND=400304]="APPLICATION_NOT_FOUND",t[t.SESSION_KEY_EXPIRED=400309]="SESSION_KEY_EXPIRED",t[t.SESSION_REVOKED=400310]="SESSION_REVOKED",t[t.INVALID_SESSION_TYPE=400312]="INVALID_SESSION_TYPE",t[t.STAT_UPLOAD_NOT_ALLOWED=403200]="STAT_UPLOAD_NOT_ALLOWED",t[t.NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE=400940]="NOT_SUPPORTED_PINNED_MESSAGE_IN_REVIEW_MESSAGE",t[t.INTERNAL_SERVER_ERROR=500901]="INTERNAL_SERVER_ERROR",t[t.RATE_LIMIT_EXCEEDED=500910]="RATE_LIMIT_EXCEEDED",t[t.INVALID_FORM_KEY=400111]="INVALID_FORM_KEY",t[t.INVALID_REQUIRED_FORM_VALUE=400105]="INVALID_REQUIRED_FORM_VALUE",t[t.UNKNOWN_SERVER_ERROR=900200]="UNKNOWN_SERVER_ERROR",t[t.NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE=901500]="NOT_SUPPORTED_FEATURE_IN_IN_REVIEW_MESSAGE",t[t.ERR_DUPLICATED_DATA=400202]="ERR_DUPLICATED_DATA",t[t.DEBUG_MODE_REQUIRED=7e5]="DEBUG_MODE_REQUIRED",t[t.LOST_INSTANCE=700100]="LOST_INSTANCE",t[t.CONNECTION_RENEW=700102]="CONNECTION_RENEW",t[t.INVALID_CONNECTION_STATE_TRANSITION=700200]="INVALID_CONNECTION_STATE_TRANSITION",t[t.INVALID_COMMAND=700700]="INVALID_COMMAND",t[t.XMLHTTPREQUEST_NOT_SUPPORTED=700800]="XMLHTTPREQUEST_NOT_SUPPORTED",t[t.UNKNOWN_ERROR=77e4]="UNKNOWN_ERROR",t[t.INVALID_INITIALIZATION=800100]="INVALID_INITIALIZATION",t[t.CONNECTION_REQUIRED=800101]="CONNECTION_REQUIRED",t[t.CONNECTION_CANCELED=800102]="CONNECTION_CANCELED",t[t.INVALID_PARAMETER=800110]="INVALID_PARAMETER",t[t.NOT_SUPPORTED_ERROR=800111]="NOT_SUPPORTED_ERROR",t[t.NETWORK_ERROR=800120]="NETWORK_ERROR",t[t.NETWORK_ROUTING_ERROR=800121]="NETWORK_ROUTING_ERROR",t[t.MALFORMED_DATA=800130]="MALFORMED_DATA",t[t.MALFORMED_ERROR_DATA=800140]="MALFORMED_ERROR_DATA",t[t.WRONG_CHANNEL_TYPE=800150]="WRONG_CHANNEL_TYPE",t[t.MARK_AS_READ_RATE_LIMIT_EXCEEDED=800160]="MARK_AS_READ_RATE_LIMIT_EXCEEDED",t[t.QUERY_IN_PROGRESS=800170]="QUERY_IN_PROGRESS",t[t.ACK_TIMEOUT=800180]="ACK_TIMEOUT",t[t.LOGIN_TIMEOUT=800190]="LOGIN_TIMEOUT",t[t.WEBSOCKET_CONNECTION_CLOSED=800200]="WEBSOCKET_CONNECTION_CLOSED",t[t.WEBSOCKET_CONNECTION_FAILED=800210]="WEBSOCKET_CONNECTION_FAILED",t[t.REQUEST_FAILED=800220]="REQUEST_FAILED",t[t.FILE_UPLOAD_CANCEL_FAILED=800230]="FILE_UPLOAD_CANCEL_FAILED",t[t.REQUEST_CANCELED=800240]="REQUEST_CANCELED",t[t.REQUEST_DUPLICATED=800250]="REQUEST_DUPLICATED",t[t.FILE_SIZE_LIMIT_EXCEEDED=800260]="FILE_SIZE_LIMIT_EXCEEDED",t[t.SESSION_TOKEN_REQUEST_FAILED=800500]="SESSION_TOKEN_REQUEST_FAILED",t[t.SESSION_TOKEN_REFRESHED=800501]="SESSION_TOKEN_REFRESHED",t[t.SESSION_TOKEN_REFRESH_FAILED=800502]="SESSION_TOKEN_REFRESH_FAILED",t[t.COLLECTION_DISPOSED=800600]="COLLECTION_DISPOSED",t[t.DATABASE_ERROR=800700]="DATABASE_ERROR";const n=e=>!(e instanceof o&&!e.shouldThrowOutside);class o extends Error{constructor({code:e=0,message:t=""}){super(t),this.shouldThrowOutside=!1,this._detail="",this.name="SendbirdError",this.code=e,Object.setPrototypeOf(this,o.prototype)}get detail(){return this._detail}setDetail(e){this._detail=e}get isInvalidTokenError(){return this.code===exports.SendbirdErrorCode.INVALID_TOKEN}get isSessionExpiredError(){return this.isSessionTokenExpiredError||this.isSessionKeyExpiredError}get isSessionTokenExpiredError(){return this.code===exports.SendbirdErrorCode.SESSION_TOKEN_EXPIRED}get isSessionKeyExpiredError(){return this.code===exports.SendbirdErrorCode.SESSION_KEY_EXPIRED}get isSessionInvalidatedError(){return this.isSessionRevokedError||this.isUserAuthDeactivedError||this.isUserAuthDeletedOrNotFoundError}get isSessionRevokedError(){return this.code===exports.SendbirdErrorCode.SESSION_REVOKED}get isUserAuthDeactivedError(){return this.code===exports.SendbirdErrorCode.USER_AUTH_DEACTIVATED}get isUserAuthDeletedOrNotFoundError(){return this.code===exports.SendbirdErrorCode.USER_AUTH_DELETED_OR_NOT_FOUND}get isNetworkError(){return this.code===exports.SendbirdErrorCode.NETWORK_ERROR||this.code===exports.SendbirdErrorCode.NETWORK_ROUTING_ERROR}static get debugModeRequired(){return new o({code:exports.SendbirdErrorCode.DEBUG_MODE_REQUIRED,message:"Cannot run this operation in production mode."})}static get lostInstance(){return new o({code:exports.SendbirdErrorCode.LOST_INSTANCE,message:"Instance ID is missing. It should belong to an instance."})}static get invalidCommand(){return new o({code:exports.SendbirdErrorCode.INVALID_COMMAND,message:"Cannot send invalid command."})}static get unknown(){return new o({code:exports.SendbirdErrorCode.UNKNOWN_ERROR,message:"Unknown error occurred."})}static get connectionRenew(){return new o({code:exports.SendbirdErrorCode.CONNECTION_RENEW,message:"Connection restarts."})}static get invalidConnectionStateTransition(){return new o({code:exports.SendbirdErrorCode.INVALID_CONNECTION_STATE_TRANSITION,message:"Invalid connection state transition."})}static get xmlHttpRequestNotSupported(){return new o({code:exports.SendbirdErrorCode.XMLHTTPREQUEST_NOT_SUPPORTED,message:"Cannot upload file. XMLHttpRequest is not defined in this environment."})}static get connectionRequired(){return new o({code:exports.SendbirdErrorCode.CONNECTION_REQUIRED,message:"Connection is required."})}static get connectionCanceled(){return new o({code:exports.SendbirdErrorCode.CONNECTION_CANCELED,message:"Connection is canceled."})}static get invalidParameters(){return new o({code:exports.SendbirdErrorCode.INVALID_PARAMETER,message:"Invalid parameters."})}static get notSupportedError(){return new o({code:exports.SendbirdErrorCode.NOT_SUPPORTED_ERROR,message:"Given parameters are not supported."})}static get channelTypeNotSupportedError(){return new o({code:exports.SendbirdErrorCode.NOT_SUPPORTED_ERROR,message:"Called method is not supported in the current channel's channel type."})}static get networkError(){return new o({code:exports.SendbirdErrorCode.NETWORK_ERROR,message:"There was a network error."})}static get markAsReadAllRateLimitExceeded(){return new o({code:exports.SendbirdErrorCode.MARK_AS_READ_RATE_LIMIT_EXCEEDED,message:"markAsRead rate limit exceeded."})}static get queryInProgress(){return new o({code:exports.SendbirdErrorCode.QUERY_IN_PROGRESS,message:"Query in progress."})}static get noAckTimeout(){return new o({code:exports.SendbirdErrorCode.ACK_TIMEOUT,message:"Command received no ack."})}static get loginTimeout(){return new o({code:exports.SendbirdErrorCode.LOGIN_TIMEOUT,message:"Connection timeout."})}static get connectionClosed(){return new o({code:exports.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,message:"Connection is closed. Please reconnect."})}static get requestFailed(){return new o({code:exports.SendbirdErrorCode.REQUEST_FAILED,message:"Request failed."})}static get alreadyConnectedAsAnotherUser(){return new o({code:exports.SendbirdErrorCode.REQUEST_FAILED,message:"Already logged in as a different user. Call disconnect() first."})}static get fileUploadCanceled(){return new o({code:exports.SendbirdErrorCode.FILE_UPLOAD_CANCEL_FAILED,message:"File upload has been canceled."})}static get requestCanceled(){return new o({code:exports.SendbirdErrorCode.REQUEST_CANCELED,message:"Request has been canceled."})}static get sessionTokenRefreshFailed(){return new o({code:exports.SendbirdErrorCode.SESSION_TOKEN_REFRESH_FAILED,message:"Failed to refresh the session key."})}static get sessionTokenRequestFailed(){return new o({code:exports.SendbirdErrorCode.SESSION_TOKEN_REQUEST_FAILED,message:"Failed to get the session token."})}static get databaseError(){return new o({code:exports.SendbirdErrorCode.DATABASE_ERROR,message:"Database error."})}static get fileSizeLimitExceededError(){return new o({code:exports.SendbirdErrorCode.FILE_SIZE_LIMIT_EXCEEDED,message:"File size exceeds the file size limit."})}throwOutside(){throw this.shouldThrowOutside=!0,this}}const r=[exports.SendbirdErrorCode.CONNECTION_REQUIRED,exports.SendbirdErrorCode.NETWORK_ERROR,exports.SendbirdErrorCode.ACK_TIMEOUT,exports.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,exports.SendbirdErrorCode.WEBSOCKET_CONNECTION_FAILED,exports.SendbirdErrorCode.FILE_UPLOAD_CANCEL_FAILED,exports.SendbirdErrorCode.REQUEST_CANCELED,exports.SendbirdErrorCode.INTERNAL_SERVER_ERROR,exports.SendbirdErrorCode.RATE_LIMIT_EXCEEDED,exports.SendbirdErrorCode.UNKNOWN_SERVER_ERROR],a=[exports.SendbirdErrorCode.WEBSOCKET_CONNECTION_CLOSED,exports.SendbirdErrorCode.WEBSOCKET_CONNECTION_FAILED,exports.SendbirdErrorCode.CONNECTION_REQUIRED],l=(e,t,s=!1)=>!(!s||!_(t))||("string"!=typeof e?"object"==typeof e?d(e,t):c(e,t):typeof t===e),d=(e,t,s=!1)=>!(!s||!_(t))||Object.values(e).includes(t),c=(e,t)=>t instanceof e,h=(e,t,s=!1)=>!(!s||!_(t))||Array.isArray(t)&&t.every((t=>l(e,t))),u=(e,t=!1)=>{if(t&&_(e))return!0;const s="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(!s){if("undefined"!=typeof Blob)return e instanceof Blob;if("undefined"!=typeof File)return e instanceof File}return s},_=e=>null==e;class p{constructor({useMemberInfoInMessage:e=!0,typingIndicatorInvalidateTime:t=1e4,typingIndicatorThrottle:s=1e3,websocketResponseTimeout:i=1e4,websocketPayloadDecompression:n=!0,sessionTokenRefreshTimeout:o=60}={}){this._useMemberInfoInMessage=!0,this._typingIndicatorInvalidateTime=1e4,this._typingIndicatorThrottle=1e3,this._websocketResponseTimeout=1e4,this._sessionTokenRefreshTimeout=60,this._useMemberInfoInMessage=e,this._typingIndicatorInvalidateTime=t,this._typingIndicatorThrottle=s,this._websocketResponseTimeout=i,this._sessionTokenRefreshTimeout=o,this.websocketPayloadDecompression=n}get useMemberInfoInMessage(){return this._useMemberInfoInMessage}set useMemberInfoInMessage(e){l("boolean",e)&&(this._useMemberInfoInMessage=e)}get typingIndicatorInvalidateTime(){return this._typingIndicatorInvalidateTime}set typingIndicatorInvalidateTime(e){l("number",e)&&(this._typingIndicatorInvalidateTime=e)}get typingIndicatorThrottle(){return this._typingIndicatorThrottle}set typingIndicatorThrottle(e){l("number",e)&&e>=1e3&&e<=9e3&&(this._typingIndicatorThrottle=e)}get websocketResponseTimeout(){return this._websocketResponseTimeout}set websocketResponseTimeout(e){l("number",e)&&e>=5e3&&e<=3e4&&(this._websocketResponseTimeout=e)}get sessionTokenRefreshTimeout(){return this._sessionTokenRefreshTimeout}set sessionTokenRefreshTimeout(e){l("number",e)&&(e<60?e=60:e>1800&&(e=1800),this._sessionTokenRefreshTimeout=e)}}const E={encrypt:e=>e,decrypt:e=>e};class g{constructor({store:e}){this._preference=new Map,this._store=e}_savePreferenceKeys(){return e(this,void 0,void 0,(function*(){yield this._store.set({key:this._keysAddress,value:[...this._preference.keys()]})}))}init(t,s=1){var i;return e(this,void 0,void 0,(function*(){this._version=s,this._keysAddress=t;const e=`${t}.metadata.version`,n=yield this._store.get(e),o=null!==(i=yield this._store.get(t))&&void 0!==i?i:[];if(!n||n.version<this._version)yield this._resetPreferenceData(o,e);else for(const e of o){const t=yield this._store.get(e);t&&this._preference.set(e,t)}}))}_resetPreferenceData(t,s){return e(this,void 0,void 0,(function*(){this._preference=new Map,yield this._store.removeMany(t),yield this._store.set({key:s,value:{version:this._version}})}))}get(t){return e(this,void 0,void 0,(function*(){return this._preference.get(t)}))}set(t,s){return e(this,void 0,void 0,(function*(){const e=!this._preference.has(t);yield this._store.set({key:t,value:s}),this._preference.set(t,s),e&&(yield this._savePreferenceKeys())}))}remove(t){return e(this,void 0,void 0,(function*(){yield this._store.remove(t),this._preference.delete(t),yield this._savePreferenceKeys()}))}clear(){return e(this,void 0,void 0,(function*(){yield this._store.removeMany([...this._preference.keys()]),this._preference.clear(),yield this._savePreferenceKeys()}))}}class f{constructor({encryption:e,store:t,localCacheEnabled:s,localCacheConfig:i}){this.store=t,this.preference=new g({store:t}),this.encryption=null!=e?e:E,this.localCacheEnabled=s,this.localCacheConfig=i}replaceStore(e){this.store=e,this.preference=new g({store:e})}}var v,S,m,T,C;exports.PushTokenRegistrationState=void 0,(v=exports.PushTokenRegistrationState||(exports.PushTokenRegistrationState={})).SUCCESS="success",v.PENDING="pending",v.ERROR="error",exports.PushTriggerOption=void 0,(S=exports.PushTriggerOption||(exports.PushTriggerOption={})).DEFAULT="default",S.ALL="all",S.MENTION_ONLY="mention_only",S.OFF="off",exports.PushTokenType=void 0,(m=exports.PushTokenType||(exports.PushTokenType={})).FCM="gcm",m.APNS="apns",m.UNKNOWN="unknown",exports.PushTemplate=void 0,(T=exports.PushTemplate||(exports.PushTemplate={})).ALTERNATIVE="alternative",T.DEFAULT="default",exports.CachedDataClearOrder=void 0,(C=exports.CachedDataClearOrder||(exports.CachedDataClearOrder={})).CUSTOM="custom",C.MESSAGE_COLLECTION_ACCESSED_AT="messagecollection_accessed_at";class N{constructor({maxSize:e=256,clearOrder:t=exports.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT,customClearOrderComparator:s,enableAutoResend:i=!0}={}){this._clearOrderComparatorUseMessageCollectionAccessedAt=(e,t)=>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(e,64),s?(this._clearOrder=t,this._customClearOrderComparator=s):this._clearOrder=exports.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT,this._enableAutoResend=i}get maxSize(){return this._maxSize}get clearOrder(){return this._clearOrder}get clearOrderComparator(){var e;return this._clearOrder===exports.CachedDataClearOrder.MESSAGE_COLLECTION_ACCESSED_AT?this._clearOrderComparatorUseMessageCollectionAccessedAt:null!==(e=this._customClearOrderComparator)&&void 0!==e?e:this._clearOrderComparatorUseMessageCollectionAccessedAt}get enableAutoResend(){return this._enableAutoResend}}var A;exports.SessionService=void 0,(A=exports.SessionService||(exports.SessionService={})).FEED="feed",A.CHAT="chat";class y{constructor(){this.isRefreshing=!1}get hasSession(){return!!this.sessionKey}clear(){this.authToken=void 0,this.sessionKey=void 0,this.services=[]}}const w=()=>{let e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(t=>{const s=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?s:3&s|8).toString(16)}))};class b{constructor({container:e}){this._container={},this._container=e,this.key=w()}_register(e,t,s){var i;return e in this._container||(this._container[e]=new Map),null===(i=this._container[e])||void 0===i||i.set(this.key,{occurence:t,handler:s}),this}on(e,t){return this._register(e,-1,t)}once(e,t){return this._register(e,1,t)}close(){var e;for(const t in this._container)null===(e=this._container[t])||void 0===e||e.delete(this.key)}}class x{constructor(){this._container={}}on(e,t){return new b({container:this._container}).on(e,t)}once(e,t){return new b({container:this._container}).once(e,t)}dispatch(e,t){const s=this._container[e];if(s){const e=[];for(const i of s.keys()){const n=s.get(i);n.handler(t),n.occurence>0&&(n.occurence--,0===n.occurence&&e.push(i))}e.forEach((e=>s.delete(e)))}}}class I{constructor(){this._dispatcher=new x}on(e){return this._dispatcher.on("event",e)}once(e){return this._dispatcher.once("event",e)}dispatch(e){this._dispatcher.dispatch("event",e)}}class R{}const O=e=>{const t={};return e&&Object.keys(e).forEach((s=>{void 0===e[s]||Number.isNaN(e[s])||null===e[s]||(t[s]=e[s])})),t},k=e=>{if(null!=e){if("object"==typeof e){if(Array.isArray(e)){const t=[...e];for(const e in t)t[e]=k(t[e]);return t}for(const t in e)null===e[t]&&delete e[t];return e}return e}};var D,L,U,P,M,F,H,q,V,z,G,K,B;exports.ChannelType=void 0,(D=exports.ChannelType||(exports.ChannelType={})).BASE="base",D.GROUP="group",D.OPEN="open",D.FEED="feed",exports.Role=void 0,(L=exports.Role||(exports.Role={})).OPERATOR="operator",L.NONE="none",exports.MutedState=void 0,(U=exports.MutedState||(exports.MutedState={})).MUTED="muted",U.UNMUTED="unmuted",exports.MessageType=void 0,(P=exports.MessageType||(exports.MessageType={})).BASE="base",P.USER="user",P.FILE="file",P.ADMIN="admin",exports.MessageTypeFilter=void 0,(M=exports.MessageTypeFilter||(exports.MessageTypeFilter={})).ALL="",M.USER="MESG",M.FILE="FILE",M.ADMIN="ADMM",exports.ServerSideMessageType=void 0,(F=exports.ServerSideMessageType||(exports.ServerSideMessageType={})).USER="MESG",F.FILE="FILE",F.ADMIN="ADMM",exports.MentionType=void 0,(H=exports.MentionType||(exports.MentionType={})).USERS="users",H.CHANNEL="channel",exports.ReplyType=void 0,(q=exports.ReplyType||(exports.ReplyType={})).ALL="all",q.NONE="none",q.ONLY_REPLY_TO_CHANNEL="only_reply_to_channel",exports.PushNotificationDeliveryOption=void 0,(V=exports.PushNotificationDeliveryOption||(exports.PushNotificationDeliveryOption={})).DEFAULT="default",V.SUPPRESS="suppress",exports.SendingStatus=void 0,(z=exports.SendingStatus||(exports.SendingStatus={})).PENDING="pending",z.SCHEDULED="scheduled",z.SUCCEEDED="succeeded",z.FAILED="failed",z.CANCELED="canceled",exports.MessageReviewStatus=void 0,(G=exports.MessageReviewStatus||(exports.MessageReviewStatus={})).INREVIEW="InReview",G.APPROVED="Approved",exports.NotificationPriority=void 0,(K=exports.NotificationPriority||(exports.NotificationPriority={})).HIGH="high",K.NORMAL="normal",K.LOW="low",exports.MessageTemplateListOrder=void 0,(B=exports.MessageTemplateListOrder||(exports.MessageTemplateListOrder={})).CREATED_AT="created_at",B.UPDATED_AT="updated_at";const W="v3",j=`/${W}/users`,Q=`/${W}/storage/file`,$=`/${W}/group_channels`,Z=`/${W}/sdk/group_channels`,Y=`/${W}/open_channels`,X=`/${W}/sdk/open_channels`,J=`/${W}/search`,ee=`/${W}/report`,te=`/${W}/emojis`,se=`/${W}/emoji_categories`,ie=`/${W}/polls`,ne=`/${W}/scheduled_messages`,oe=`/${W}/sdk/ui_kit/configuration`,re=`/${W}/sdk/statistics`,ae=`/${W}/notifications`,le=`/${W}/message_templates`,de=e=>{switch(e){case exports.ChannelType.FEED:case exports.ChannelType.GROUP:return $;case exports.ChannelType.OPEN:return Y;default:return null}},ce=(e,t,s)=>{switch(e){case exports.MentionType.CHANNEL:return!0;case exports.MentionType.USERS:if(t)for(const e of t)if(e===s)return!0}return!1},he=(e,t,s)=>{var i;let n=t||new FormData;for(const t in e){if(!e.hasOwnProperty(t))continue;const o=e[t],r=s?`${s}[${t}]`:t;u(o)?n.append(r,o,null!==(i=o.name)&&void 0!==i?i:"filename"):"object"!=typeof o||null===o||Array.isArray(o)||o instanceof Blob?n.append(r,String(o)):n=he(o,n,r)}return n};var ue;exports.APIRequestMethod=void 0,(ue=exports.APIRequestMethod||(exports.APIRequestMethod={})).GET="GET",ue.POST="POST",ue.PUT="PUT",ue.DELETE="DELETE";class _e extends R{constructor(){super(...arguments),this.params={},this.requireAuth=!0,this.headers={},this.requestId=w()}encodeParams(e){return null==e||""===e?encodeURIComponent(""):Array.isArray(e)?e.map((e=>this.encodeParams(e))).join(","):"object"==typeof e?encodeURIComponent(JSON.stringify(e)):encodeURIComponent(String(e))}get query(){const e=O(this.params);return`?${Object.keys(e).map((t=>`${encodeURIComponent(t)}=${this.encodeParams(e[t])}`)).join("&")}`}get payload(){const e=O(this.params);return Object.keys(e).some((t=>u(e[t])))?he(e):JSON.stringify(e)}}class pe extends R{constructor(e,t){super(),this._iid=e,this._payload=t}get payload(){return Object.assign({},this._payload)}as(e){return new e(this._iid,this.payload)}}class Ee extends R{constructor(e){super(),this.requestId=e}}class ge extends R{constructor({expires_in:e,reason:t=exports.SendbirdErrorCode.SESSION_KEY_EXPIRED}){switch(super(),this.expiresIn=null!=e?e:0,t){case exports.SendbirdErrorCode.SESSION_KEY_EXPIRED:case exports.SendbirdErrorCode.SESSION_TOKEN_EXPIRED:case exports.SendbirdErrorCode.SESSION_REVOKED:case exports.SendbirdErrorCode.USER_AUTH_DEACTIVATED:case exports.SendbirdErrorCode.USER_AUTH_DELETED_OR_NOT_FOUND:this.error=new o({code:t})}}get invalidateSessionToken(){var e;return!!(null===(e=this.error)||void 0===e?void 0:e.isSessionTokenExpiredError)}}class fe extends R{constructor(e,t,s,i=""){var n;super(),this._iid=e,this.code=t,this.payload=s,this.requestId=null!==(n=s.req_id)&&void 0!==n?n:i}static createFromRawMessage(e,t){let s=t.substring(0,4),i={};try{i=JSON.parse(t.substring(4))}catch(e){s="NOOP"}finally{return new fe(e,s,i)}}convertToMessage(){return`${this.code}${JSON.stringify(this.payload)}\n`}as(e){return new e(this._iid,this.code,this.payload)}}class ve extends R{constructor({code:e,ackRequired:t,payload:s={}}){var i;super(),this.code=e,this.payload=s,this.requestId=null!==(i=this.payload.req_id)&&void 0!==i?i:w(),this.ackRequired=t,this.payload.req_id=this.requestId}convertToMessage(){return`${this.code}${JSON.stringify(this.payload)}\n`}}class Se extends _e{constructor({userId:e,authToken:t,services:s,expiringSession:i=!0}){super(),this.path=`${j}/${e}/session_key`,this.method=exports.APIRequestMethod.POST,this.params=O({token:t,services:s,expiring_session:!!i}),this.requireAuth=!1}}class me extends ve{constructor({authToken:e,expiringSession:t=!0,requestId:s}){super({code:"LOGI",payload:{token:e,expiring_session:t?1:0,req_id:s},ackRequired:!0})}}class Te extends pe{constructor(e,t){super(e,t);const{key:s,expires_at:i,services:n}=t;this.key=s,this.expiresAt=i,this.services=n}}class Ce extends fe{constructor(e,t,s){var i;super(e,"LOGI",s),this.error=null,this.newKey=null,this.newKey=null!==(i=s.new_key)&&void 0!==i?i:null,this.error=s.error?new o(s):null}}class Ne extends R{constructor(e){super(),this.statLog=e}}class Ae extends R{constructor({request:e,deferred:t,error:s=o.requestFailed}){super(),this.request=e,this.deferred=t,this.error=s}}var ye;exports.StatType=void 0,(ye=exports.StatType||(exports.StatType={})).FEATURE_LOCALCACHE="feature:local_cache",ye.FEATURE_LOCALCACHE_EVENT="feature:local_cache_event",ye.NOTIFICATION="noti:stats",ye.WEBSOCKET_CONNECT="ws:connect",ye.API_RESULT="api:result";class we{constructor({type:e,data:t,ts:s=Date.now()}){this.type=e,this.createdAt=s,this.data=t}static payloadify(e){return O({stat_type:e.type,ts:e.createdAt,data:O(e.data)})}}const be=()=>"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"==navigator.product,xe=()=>!("undefined"==typeof navigator||!/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|Windows Phone/i.test(navigator.userAgent));var Ie,Re,Oe;exports.SendbirdProduct=void 0,(Ie=exports.SendbirdProduct||(exports.SendbirdProduct={})).CHAT="chat",Ie.CALLS="calls",Ie.DESK="desk",Ie.LIVE="live",Ie.UIKIT_CHAT="uikit-chat",Ie.UIKIT_LIVE="uikit-live",exports.SendbirdPlatform=void 0,(Re=exports.SendbirdPlatform||(exports.SendbirdPlatform={})).ANDROID="android",Re.IOS="ios",Re.JS="js",Re.UNREAL="unreal",Re.UNITY="unity",Re.REACT_NATIVE="react-native",Re.FLUTTER="flutter",exports.DeviceOsPlatform=void 0,(Oe=exports.DeviceOsPlatform||(exports.DeviceOsPlatform={})).ANDROID="android",Oe.IOS="ios",Oe.WEB="web",Oe.MOBILE_WEB="mobile_web",Oe.WINDOWS="windows";class ke{}ke.sendbirdSdkUserAgentWithExtension=e=>{let t={main_sdk_info:`chat/${be()?exports.SendbirdPlatform.REACT_NATIVE:exports.SendbirdPlatform.JS}/${i.SDK_VERSION}`,device_os_platform:xe()?"mobile-web":"web",os_version:i.OS_VERSION};if(e){const{sendbirdExtensions:s,deviceOS:i,customData:n={}}=e;i.version&&(t.os_version=i.version),i.platform&&(t.device_os_platform=i.platform),s.length>0&&(t.extension_sdk_info=s.map((({product:e,platform:t,version:s})=>`${e}/${t}/${s}`)).join(",")),Object.keys(t).forEach((e=>delete n[e])),Object.keys(n).length>0&&(t=Object.assign(Object.assign({},t),n))}return Object.entries(t).map((([e,t])=>`${e}=${t}`)).join("&")},ke.userAgentWithExtension=e=>{const t=be()?"reactnative":"JS",s=e.sb_syncmanager?`s${e.sb_syncmanager}`:"",n=e.sb_uikit?`u${e.sb_uikit}`:"",o=e["device-os-platform"]?`o${e["device-os-platform"]}`:xe()?"omobile-web":"oweb";return`${t}/c${i.SDK_VERSION}/${s}/${n}/${o}`};class De{constructor(){this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=e=>{t(e)}}))}}class Le extends R{constructor(e){super(),this.requestId=e.requestId}}class Ue{constructor(e,{session:t,sdkState:s,dispatcher:i,logger:n,useFetchCompat:o=!1}){this._abortControl=new Map,this._shouldImportFetchCompat=!1,this._iid=e,this._session=t,this._sdkState=s,this._dispatcher=i,this._dispatcher.on((e=>{e instanceof Ee&&this.cancel(e.requestId)})),this._logger=n,this._shouldImportFetchCompat=o}_createHeader(e,t){const{appId:s,appVersion:n,sendbirdRuntimeEnvironment:o}=this._sdkState,r=Object.assign(Object.assign({},e.headers),{SendBird:`JS,${i.OS_VERSION},${i.SDK_VERSION},${s}${n?`,${n}`:""}`,"SB-User-Agent":ke.userAgentWithExtension(this._sdkState.extensions),"Request-Sent-Timestamp":Date.now().toString(),"SB-SDK-User-Agent":ke.sendbirdSdkUserAgentWithExtension(o)});return t||(r["Content-Type"]="application/json; charset=utf-8"),e.requireAuth&&this._session.hasSession&&(r["Session-Key"]=this._session.sessionKey),this._session&&this._session.authToken&&(r["App-Id"]=s,r["Access-Token"]=this._session.authToken),r}_statLogApiResult(e,t,s){this._dispatcher.dispatch(new Ne(new we({type:exports.StatType.API_RESULT,data:{endpoint:e.path,method:e.method,success:!s,latency:Date.now()-t,error_code:null==s?void 0:s.code,error_description:null==s?void 0:s.message}})))}send(t){return e(this,void 0,void 0,(function*(){const{path:e,method:s,uploadProgressHandler:i}=t,n=![exports.APIRequestMethod.GET,exports.APIRequestMethod.DELETE].includes(s),{api:r}=this._sdkState,a=`${r.host}${e}${n?"":t.query}`,l=n?t.payload:null,d=this._createHeader(t,l instanceof FormData?l:void 0),c=new AbortController,{signal:h}=c;this._abortControl.set(t.requestId,c);const u=Date.now();try{if(i){const{xmlHttpRequest:e}=yield Promise.resolve().then((function(){return require("./__bundle-c4456427.cjs")}));try{const s=yield e(this._iid,{requestId:t.requestId,method:t.method,url:a,headers:d,data:null!=l?l:void 0,uploadProgressHandler:i});return this._logger.debug("receive api response",t.requestId),this._statLogApiResult(t,u),s}catch(e){if(!(e instanceof o&&e.code===exports.SendbirdErrorCode.XMLHTTPREQUEST_NOT_SUPPORTED))throw e;this._logger.debug("XMLHttpRequest is not available in this environment. progressHandler is ignored.")}}if(this._shouldImportFetchCompat){this._shouldImportFetchCompat=!1;("undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||"undefined"!=typeof global&&global||{fetch:null}).fetch=null}"undefined"==typeof AbortController&&(yield Promise.resolve().then((function(){return require("./__bundle-1b7cc98e.cjs")}))),"function"!=typeof fetch&&(yield Promise.resolve().then((function(){return require("./__bundle-79e0398d.cjs")})));const e=yield fetch(a,{method:s,body:l,headers:d,signal:h}),n=yield e.json();if(e.ok||e.redirected)return this._logger.debug("receive api response",t.requestId),this._statLogApiResult(t,u),new pe(this._iid,n);if(n){const e=new o(n);if(e.isSessionExpiredError){if(this._dispatcher.dispatch(new ge({reason:e.code})),!(t instanceof Se)){const s=new De;return this._dispatcher.dispatch(new Ae({request:t,deferred:s,error:e})),s.promise}throw e}throw e.isSessionInvalidatedError?(this._dispatcher.dispatch(new ge({reason:e.code})),e):e}throw o.requestFailed}catch(e){if(this._statLogApiResult(t,u,e),e instanceof o)throw this._logger.debug("fail api request",e),e;if("AbortError"===(null==e?void 0:e.name))throw o.requestCanceled;{const e=o.networkError;throw this._logger.debug("fail api request",e),e}}}))}cancel(e){if(this._abortControl.has(e)){this._abortControl.get(e).abort(),this._abortControl.delete(e)}this._dispatcher.dispatch(new Le({requestId:e}))}cancelAll(){for(const e of this._abortControl.values())e.abort();this._abortControl.clear(),this._dispatcher.dispatch(new Le({}))}}const Pe=()=>{};
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */function Me(e){let t=e.length;for(;--t>=0;)e[t]=0}const Fe=256,He=286,qe=30,Ve=15,ze=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]),Ge=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]),Ke=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Be=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),We=new Array(576);Me(We);const je=new Array(60);Me(je);const Qe=new Array(512);Me(Qe);const $e=new Array(256);Me($e);const Ze=new Array(29);Me(Ze);const Ye=new Array(qe);function Xe(e,t,s,i,n){this.static_tree=e,this.extra_bits=t,this.extra_base=s,this.elems=i,this.max_length=n,this.has_stree=e&&e.length}let Je,et,tt;function st(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}Me(Ye);const it=e=>e<256?Qe[e]:Qe[256+(e>>>7)],nt=(e,t)=>{e.pending_buf[e.pending++]=255&t,e.pending_buf[e.pending++]=t>>>8&255},ot=(e,t,s)=>{e.bi_valid>16-s?(e.bi_buf|=t<<e.bi_valid&65535,nt(e,e.bi_buf),e.bi_buf=t>>16-e.bi_valid,e.bi_valid+=s-16):(e.bi_buf|=t<<e.bi_valid&65535,e.bi_valid+=s)},rt=(e,t,s)=>{ot(e,s[2*t],s[2*t+1])},at=(e,t)=>{let s=0;do{s|=1&e,e>>>=1,s<<=1}while(--t>0);return s>>>1},lt=(e,t,s)=>{const i=new Array(16);let n,o,r=0;for(n=1;n<=Ve;n++)r=r+s[n-1]<<1,i[n]=r;for(o=0;o<=t;o++){let t=e[2*o+1];0!==t&&(e[2*o]=at(i[t]++,t))}},dt=e=>{let t;for(t=0;t<He;t++)e.dyn_ltree[2*t]=0;for(t=0;t<qe;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},ct=e=>{e.bi_valid>8?nt(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0},ht=(e,t,s,i)=>{const n=2*t,o=2*s;return e[n]<e[o]||e[n]===e[o]&&i[t]<=i[s]},ut=(e,t,s)=>{const i=e.heap[s];let n=s<<1;for(;n<=e.heap_len&&(n<e.heap_len&&ht(t,e.heap[n+1],e.heap[n],e.depth)&&n++,!ht(t,i,e.heap[n],e.depth));)e.heap[s]=e.heap[n],s=n,n<<=1;e.heap[s]=i},_t=(e,t,s)=>{let i,n,o,r,a=0;if(0!==e.sym_next)do{i=255&e.pending_buf[e.sym_buf+a++],i+=(255&e.pending_buf[e.sym_buf+a++])<<8,n=e.pending_buf[e.sym_buf+a++],0===i?rt(e,n,t):(o=$e[n],rt(e,o+Fe+1,t),r=ze[o],0!==r&&(n-=Ze[o],ot(e,n,r)),i--,o=it(i),rt(e,o,s),r=Ge[o],0!==r&&(i-=Ye[o],ot(e,i,r)))}while(a<e.sym_next);rt(e,256,t)},pt=(e,t)=>{const s=t.dyn_tree,i=t.stat_desc.static_tree,n=t.stat_desc.has_stree,o=t.stat_desc.elems;let r,a,l,d=-1;for(e.heap_len=0,e.heap_max=573,r=0;r<o;r++)0!==s[2*r]?(e.heap[++e.heap_len]=d=r,e.depth[r]=0):s[2*r+1]=0;for(;e.heap_len<2;)l=e.heap[++e.heap_len]=d<2?++d:0,s[2*l]=1,e.depth[l]=0,e.opt_len--,n&&(e.static_len-=i[2*l+1]);for(t.max_code=d,r=e.heap_len>>1;r>=1;r--)ut(e,s,r);l=o;do{r=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ut(e,s,1),a=e.heap[1],e.heap[--e.heap_max]=r,e.heap[--e.heap_max]=a,s[2*l]=s[2*r]+s[2*a],e.depth[l]=(e.depth[r]>=e.depth[a]?e.depth[r]:e.depth[a])+1,s[2*r+1]=s[2*a+1]=l,e.heap[1]=l++,ut(e,s,1)}while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],((e,t)=>{const s=t.dyn_tree,i=t.max_code,n=t.stat_desc.static_tree,o=t.stat_desc.has_stree,r=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,l=t.stat_desc.max_length;let d,c,h,u,_,p,E=0;for(u=0;u<=Ve;u++)e.bl_count[u]=0;for(s[2*e.heap[e.heap_max]+1]=0,d=e.heap_max+1;d<573;d++)c=e.heap[d],u=s[2*s[2*c+1]+1]+1,u>l&&(u=l,E++),s[2*c+1]=u,c>i||(e.bl_count[u]++,_=0,c>=a&&(_=r[c-a]),p=s[2*c],e.opt_len+=p*(u+_),o&&(e.static_len+=p*(n[2*c+1]+_)));if(0!==E){do{for(u=l-1;0===e.bl_count[u];)u--;e.bl_count[u]--,e.bl_count[u+1]+=2,e.bl_count[l]--,E-=2}while(E>0);for(u=l;0!==u;u--)for(c=e.bl_count[u];0!==c;)h=e.heap[--d],h>i||(s[2*h+1]!==u&&(e.opt_len+=(u-s[2*h+1])*s[2*h],s[2*h+1]=u),c--)}})(e,t),lt(s,d,e.bl_count)},Et=(e,t,s)=>{let i,n,o=-1,r=t[1],a=0,l=7,d=4;for(0===r&&(l=138,d=3),t[2*(s+1)+1]=65535,i=0;i<=s;i++)n=r,r=t[2*(i+1)+1],++a<l&&n===r||(a<d?e.bl_tree[2*n]+=a:0!==n?(n!==o&&e.bl_tree[2*n]++,e.bl_tree[32]++):a<=10?e.bl_tree[34]++:e.bl_tree[36]++,a=0,o=n,0===r?(l=138,d=3):n===r?(l=6,d=3):(l=7,d=4))},gt=(e,t,s)=>{let i,n,o=-1,r=t[1],a=0,l=7,d=4;for(0===r&&(l=138,d=3),i=0;i<=s;i++)if(n=r,r=t[2*(i+1)+1],!(++a<l&&n===r)){if(a<d)do{rt(e,n,e.bl_tree)}while(0!=--a);else 0!==n?(n!==o&&(rt(e,n,e.bl_tree),a--),rt(e,16,e.bl_tree),ot(e,a-3,2)):a<=10?(rt(e,17,e.bl_tree),ot(e,a-3,3)):(rt(e,18,e.bl_tree),ot(e,a-11,7));a=0,o=n,0===r?(l=138,d=3):n===r?(l=6,d=3):(l=7,d=4)}};let ft=!1;const vt=(e,t,s,i)=>{ot(e,0+(i?1:0),3),ct(e),nt(e,s),nt(e,~s),s&&e.pending_buf.set(e.window.subarray(t,t+s),e.pending),e.pending+=s};var St=(e,t,s,i)=>{let n,o,r=0;e.level>0?(2===e.strm.data_type&&(e.strm.data_type=(e=>{let t,s=4093624447;for(t=0;t<=31;t++,s>>>=1)if(1&s&&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<Fe;t++)if(0!==e.dyn_ltree[2*t])return 1;return 0})(e)),pt(e,e.l_desc),pt(e,e.d_desc),r=(e=>{let t;for(Et(e,e.dyn_ltree,e.l_desc.max_code),Et(e,e.dyn_dtree,e.d_desc.max_code),pt(e,e.bl_desc),t=18;t>=3&&0===e.bl_tree[2*Be[t]+1];t--);return e.opt_len+=3*(t+1)+5+5+4,t})(e),n=e.opt_len+3+7>>>3,o=e.static_len+3+7>>>3,o<=n&&(n=o)):n=o=s+5,s+4<=n&&-1!==t?vt(e,t,s,i):4===e.strategy||o===n?(ot(e,2+(i?1:0),3),_t(e,We,je)):(ot(e,4+(i?1:0),3),((e,t,s,i)=>{let n;for(ot(e,t-257,5),ot(e,s-1,5),ot(e,i-4,4),n=0;n<i;n++)ot(e,e.bl_tree[2*Be[n]+1],3);gt(e,e.dyn_ltree,t-1),gt(e,e.dyn_dtree,s-1)})(e,e.l_desc.max_code+1,e.d_desc.max_code+1,r+1),_t(e,e.dyn_ltree,e.dyn_dtree)),dt(e),i&&ct(e)},mt={_tr_init:e=>{ft||((()=>{let e,t,s,i,n;const o=new Array(16);for(s=0,i=0;i<28;i++)for(Ze[i]=s,e=0;e<1<<ze[i];e++)$e[s++]=i;for($e[s-1]=i,n=0,i=0;i<16;i++)for(Ye[i]=n,e=0;e<1<<Ge[i];e++)Qe[n++]=i;for(n>>=7;i<qe;i++)for(Ye[i]=n<<7,e=0;e<1<<Ge[i]-7;e++)Qe[256+n++]=i;for(t=0;t<=Ve;t++)o[t]=0;for(e=0;e<=143;)We[2*e+1]=8,e++,o[8]++;for(;e<=255;)We[2*e+1]=9,e++,o[9]++;for(;e<=279;)We[2*e+1]=7,e++,o[7]++;for(;e<=287;)We[2*e+1]=8,e++,o[8]++;for(lt(We,287,o),e=0;e<qe;e++)je[2*e+1]=5,je[2*e]=at(e,5);Je=new Xe(We,ze,257,He,Ve),et=new Xe(je,Ge,0,qe,Ve),tt=new Xe(new Array(0),Ke,0,19,7)})(),ft=!0),e.l_desc=new st(e.dyn_ltree,Je),e.d_desc=new st(e.dyn_dtree,et),e.bl_desc=new st(e.bl_tree,tt),e.bi_buf=0,e.bi_valid=0,dt(e)},_tr_stored_block:vt,_tr_flush_block:St,_tr_tally:(e,t,s)=>(e.pending_buf[e.sym_buf+e.sym_next++]=t,e.pending_buf[e.sym_buf+e.sym_next++]=t>>8,e.pending_buf[e.sym_buf+e.sym_next++]=s,0===t?e.dyn_ltree[2*s]++:(e.matches++,t--,e.dyn_ltree[2*($e[s]+Fe+1)]++,e.dyn_dtree[2*it(t)]++),e.sym_next===e.sym_end),_tr_align:e=>{ot(e,2,3),rt(e,256,We),(e=>{16===e.bi_valid?(nt(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=255&e.bi_buf,e.bi_buf>>=8,e.bi_valid-=8)})(e)}};var Tt=(e,t,s,i)=>{let n=65535&e|0,o=e>>>16&65535|0,r=0;for(;0!==s;){r=s>2e3?2e3:s,s-=r;do{n=n+t[i++]|0,o=o+n|0}while(--r);n%=65521,o%=65521}return n|o<<16|0};const Ct=new Uint32Array((()=>{let e,t=[];for(var s=0;s<256;s++){e=s;for(var i=0;i<8;i++)e=1&e?3988292384^e>>>1:e>>>1;t[s]=e}return t})());var Nt=(e,t,s,i)=>{const n=Ct,o=i+s;e^=-1;for(let s=i;s<o;s++)e=e>>>8^n[255&(e^t[s])];return-1^e},At={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"},yt={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8};const{_tr_init:wt,_tr_stored_block:bt,_tr_flush_block:xt,_tr_tally:It,_tr_align:Rt}=mt,{Z_NO_FLUSH:Ot,Z_PARTIAL_FLUSH:kt,Z_FULL_FLUSH:Dt,Z_FINISH:Lt,Z_BLOCK:Ut,Z_OK:Pt,Z_STREAM_END:Mt,Z_STREAM_ERROR:Ft,Z_DATA_ERROR:Ht,Z_BUF_ERROR:qt,Z_DEFAULT_COMPRESSION:Vt,Z_FILTERED:zt,Z_HUFFMAN_ONLY:Gt,Z_RLE:Kt,Z_FIXED:Bt,Z_DEFAULT_STRATEGY:Wt,Z_UNKNOWN:jt,Z_DEFLATED:Qt}=yt,$t=258,Zt=262,Yt=42,Xt=113,Jt=666,es=(e,t)=>(e.msg=At[t],t),ts=e=>2*e-(e>4?9:0),ss=e=>{let t=e.length;for(;--t>=0;)e[t]=0},is=e=>{let t,s,i,n=e.w_size;t=e.hash_size,i=t;do{s=e.head[--i],e.head[i]=s>=n?s-n:0}while(--t);t=n,i=t;do{s=e.prev[--i],e.prev[i]=s>=n?s-n:0}while(--t)};let ns=(e,t,s)=>(t<<e.hash_shift^s)&e.hash_mask;const os=e=>{const t=e.state;let s=t.pending;s>e.avail_out&&(s=e.avail_out),0!==s&&(e.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+s),e.next_out),e.next_out+=s,t.pending_out+=s,e.total_out+=s,e.avail_out-=s,t.pending-=s,0===t.pending&&(t.pending_out=0))},rs=(e,t)=>{xt(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,os(e.strm)},as=(e,t)=>{e.pending_buf[e.pending++]=t},ls=(e,t)=>{e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=255&t},ds=(e,t,s,i)=>{let n=e.avail_in;return n>i&&(n=i),0===n?0:(e.avail_in-=n,t.set(e.input.subarray(e.next_in,e.next_in+n),s),1===e.state.wrap?e.adler=Tt(e.adler,t,n,s):2===e.state.wrap&&(e.adler=Nt(e.adler,t,n,s)),e.next_in+=n,e.total_in+=n,n)},cs=(e,t)=>{let s,i,n=e.max_chain_length,o=e.strstart,r=e.prev_length,a=e.nice_match;const l=e.strstart>e.w_size-Zt?e.strstart-(e.w_size-Zt):0,d=e.window,c=e.w_mask,h=e.prev,u=e.strstart+$t;let _=d[o+r-1],p=d[o+r];e.prev_length>=e.good_match&&(n>>=2),a>e.lookahead&&(a=e.lookahead);do{if(s=t,d[s+r]===p&&d[s+r-1]===_&&d[s]===d[o]&&d[++s]===d[o+1]){o+=2,s++;do{}while(d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&d[++o]===d[++s]&&o<u);if(i=$t-(u-o),o=u-$t,i>r){if(e.match_start=t,r=i,i>=a)break;_=d[o+r-1],p=d[o+r]}}}while((t=h[t&c])>l&&0!=--n);return r<=e.lookahead?r:e.lookahead},hs=e=>{const t=e.w_size;let s,i,n;do{if(i=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-Zt)&&(e.window.set(e.window.subarray(t,t+t-i),0),e.match_start-=t,e.strstart-=t,e.block_start-=t,e.insert>e.strstart&&(e.insert=e.strstart),is(e),i+=t),0===e.strm.avail_in)break;if(s=ds(e.strm,e.window,e.strstart+e.lookahead,i),e.lookahead+=s,e.lookahead+e.insert>=3)for(n=e.strstart-e.insert,e.ins_h=e.window[n],e.ins_h=ns(e,e.ins_h,e.window[n+1]);e.insert&&(e.ins_h=ns(e,e.ins_h,e.window[n+3-1]),e.prev[n&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=n,n++,e.insert--,!(e.lookahead+e.insert<3)););}while(e.lookahead<Zt&&0!==e.strm.avail_in)},us=(e,t)=>{let s,i,n,o=e.pending_buf_size-5>e.w_size?e.w_size:e.pending_buf_size-5,r=0,a=e.strm.avail_in;do{if(s=65535,n=e.bi_valid+42>>3,e.strm.avail_out<n)break;if(n=e.strm.avail_out-n,i=e.strstart-e.block_start,s>i+e.strm.avail_in&&(s=i+e.strm.avail_in),s>n&&(s=n),s<o&&(0===s&&t!==Lt||t===Ot||s!==i+e.strm.avail_in))break;r=t===Lt&&s===i+e.strm.avail_in?1:0,bt(e,0,0,r),e.pending_buf[e.pending-4]=s,e.pending_buf[e.pending-3]=s>>8,e.pending_buf[e.pending-2]=~s,e.pending_buf[e.pending-1]=~s>>8,os(e.strm),i&&(i>s&&(i=s),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,s-=i),s&&(ds(e.strm,e.strm.output,e.strm.next_out,s),e.strm.next_out+=s,e.strm.avail_out-=s,e.strm.total_out+=s)}while(0===r);return a-=e.strm.avail_in,a&&(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),r?4:t!==Ot&&t!==Lt&&0===e.strm.avail_in&&e.strstart===e.block_start?2:(n=e.window_size-e.strstart,e.strm.avail_in>n&&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++,n+=e.w_size,e.insert>e.strstart&&(e.insert=e.strstart)),n>e.strm.avail_in&&(n=e.strm.avail_in),n&&(ds(e.strm,e.window,e.strstart,n),e.strstart+=n,e.insert+=n>e.w_size-e.insert?e.w_size-e.insert:n),e.high_water<e.strstart&&(e.high_water=e.strstart),n=e.bi_valid+42>>3,n=e.pending_buf_size-n>65535?65535:e.pending_buf_size-n,o=n>e.w_size?e.w_size:n,i=e.strstart-e.block_start,(i>=o||(i||t===Lt)&&t!==Ot&&0===e.strm.avail_in&&i<=n)&&(s=i>n?n:i,r=t===Lt&&0===e.strm.avail_in&&s===i?1:0,bt(e,e.block_start,s,r),e.block_start+=s,os(e.strm)),r?3:1)},_s=(e,t)=>{let s,i;for(;;){if(e.lookahead<Zt){if(hs(e),e.lookahead<Zt&&t===Ot)return 1;if(0===e.lookahead)break}if(s=0,e.lookahead>=3&&(e.ins_h=ns(e,e.ins_h,e.window[e.strstart+3-1]),s=e.prev[e.strstart&e.w_mask]=e.head[e.ins_h],e.head[e.ins_h]=e.strstart),0!==s&&e.strstart-s<=e.w_size-Zt&&(e.match_length=cs(e,s)),e.match_length>=3)if(i=It(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=ns(e,e.ins_h,e.window[e.strstart+3-1]),s=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=ns(e,e.ins_h,e.window[e.strstart+1]);else i=It(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++;if(i&&(rs(e,!1),0===e.strm.avail_out))return 1}return e.insert=e.strstart<2?e.strstart:2,t===Lt?(rs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(rs(e,!1),0===e.strm.avail_out)?1:2},ps=(e,t)=>{let s,i,n;for(;;){if(e.lookahead<Zt){if(hs(e),e.lookahead<Zt&&t===Ot)return 1;if(0===e.lookahead)break}if(s=0,e.lookahead>=3&&(e.ins_h=ns(e,e.ins_h,e.window[e.strstart+3-1]),s=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!==s&&e.prev_length<e.max_lazy_match&&e.strstart-s<=e.w_size-Zt&&(e.match_length=cs(e,s),e.match_length<=5&&(e.strategy===zt||3===e.match_length&&e.strstart-e.match_start>4096)&&(e.match_length=2)),e.prev_length>=3&&e.match_length<=e.prev_length){n=e.strstart+e.lookahead-3,i=It(e,e.strstart-1-e.prev_match,e.prev_length-3),e.lookahead-=e.prev_length-1,e.prev_length-=2;do{++e.strstart<=n&&(e.ins_h=ns(e,e.ins_h,e.window[e.strstart+3-1]),s=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&&(rs(e,!1),0===e.strm.avail_out))return 1}else if(e.match_available){if(i=It(e,0,e.window[e.strstart-1]),i&&rs(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=It(e,0,e.window[e.strstart-1]),e.match_available=0),e.insert=e.strstart<2?e.strstart:2,t===Lt?(rs(e,!0),0===e.strm.avail_out?3:4):e.sym_next&&(rs(e,!1),0===e.strm.avail_out)?1:2};function Es(e,t,s,i,n){this.good_length=e,this.max_lazy=t,this.nice_length=s,this.max_chain=i,this.func=n}const gs=[new Es(0,0,0,0,us),new Es(4,4,8,4,_s),new Es(4,5,16,8,_s),new Es(4,6,32,32,_s),new Es(4,4,16,16,ps),new Es(8,16,32,32,ps),new Es(8,16,128,128,ps),new Es(8,32,128,256,ps),new Es(32,128,258,1024,ps),new Es(32,258,258,4096,ps)];function fs(){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=Qt,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),ss(this.dyn_ltree),ss(this.dyn_dtree),ss(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),ss(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(573),ss(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}const vs=e=>{if(!e)return 1;const t=e.state;return!t||t.strm!==e||t.status!==Yt&&57!==t.status&&69!==t.status&&73!==t.status&&91!==t.status&&103!==t.status&&t.status!==Xt&&t.status!==Jt?1:0},Ss=e=>{if(vs(e))return es(e,Ft);e.total_in=e.total_out=0,e.data_type=jt;const 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?Yt:Xt,e.adler=2===t.wrap?0:1,t.last_flush=-2,wt(t),Pt},ms=e=>{const t=Ss(e);var s;return t===Pt&&((s=e.state).window_size=2*s.w_size,ss(s.head),s.max_lazy_match=gs[s.level].max_lazy,s.good_match=gs[s.level].good_length,s.nice_match=gs[s.level].nice_length,s.max_chain_length=gs[s.level].max_chain,s.strstart=0,s.block_start=0,s.lookahead=0,s.insert=0,s.match_length=s.prev_length=2,s.match_available=0,s.ins_h=0),t},Ts=(e,t,s,i,n,o)=>{if(!e)return Ft;let r=1;if(t===Vt&&(t=6),i<0?(r=0,i=-i):i>15&&(r=2,i-=16),n<1||n>9||s!==Qt||i<8||i>15||t<0||t>9||o<0||o>Bt||8===i&&1!==r)return es(e,Ft);8===i&&(i=9);const a=new fs;return e.state=a,a.strm=e,a.status=Yt,a.wrap=r,a.gzhead=null,a.w_bits=i,a.w_size=1<<a.w_bits,a.w_mask=a.w_size-1,a.hash_bits=n+7,a.hash_size=1<<a.hash_bits,a.hash_mask=a.hash_size-1,a.hash_shift=~~((a.hash_bits+3-1)/3),a.window=new Uint8Array(2*a.w_size),a.head=new Uint16Array(a.hash_size),a.prev=new Uint16Array(a.w_size),a.lit_bufsize=1<<n+6,a.pending_buf_size=4*a.lit_bufsize,a.pending_buf=new Uint8Array(a.pending_buf_size),a.sym_buf=a.lit_bufsize,a.sym_end=3*(a.lit_bufsize-1),a.level=t,a.strategy=o,a.method=s,ms(e)};var Cs={deflateInit:(e,t)=>Ts(e,t,Qt,15,8,Wt),deflateInit2:Ts,deflateReset:ms,deflateResetKeep:Ss,deflateSetHeader:(e,t)=>vs(e)||2!==e.state.wrap?Ft:(e.state.gzhead=t,Pt),deflate:(e,t)=>{if(vs(e)||t>Ut||t<0)return e?es(e,Ft):Ft;const s=e.state;if(!e.output||0!==e.avail_in&&!e.input||s.status===Jt&&t!==Lt)return es(e,0===e.avail_out?qt:Ft);const i=s.last_flush;if(s.last_flush=t,0!==s.pending){if(os(e),0===e.avail_out)return s.last_flush=-1,Pt}else if(0===e.avail_in&&ts(t)<=ts(i)&&t!==Lt)return es(e,qt);if(s.status===Jt&&0!==e.avail_in)return es(e,qt);if(s.status===Yt&&0===s.wrap&&(s.status=Xt),s.status===Yt){let t=Qt+(s.w_bits-8<<4)<<8,i=-1;if(i=s.strategy>=Gt||s.level<2?0:s.level<6?1:6===s.level?2:3,t|=i<<6,0!==s.strstart&&(t|=32),t+=31-t%31,ls(s,t),0!==s.strstart&&(ls(s,e.adler>>>16),ls(s,65535&e.adler)),e.adler=1,s.status=Xt,os(e),0!==s.pending)return s.last_flush=-1,Pt}if(57===s.status)if(e.adler=0,as(s,31),as(s,139),as(s,8),s.gzhead)as(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),as(s,255&s.gzhead.time),as(s,s.gzhead.time>>8&255),as(s,s.gzhead.time>>16&255),as(s,s.gzhead.time>>24&255),as(s,9===s.level?2:s.strategy>=Gt||s.level<2?4:0),as(s,255&s.gzhead.os),s.gzhead.extra&&s.gzhead.extra.length&&(as(s,255&s.gzhead.extra.length),as(s,s.gzhead.extra.length>>8&255)),s.gzhead.hcrc&&(e.adler=Nt(e.adler,s.pending_buf,s.pending,0)),s.gzindex=0,s.status=69;else if(as(s,0),as(s,0),as(s,0),as(s,0),as(s,0),as(s,9===s.level?2:s.strategy>=Gt||s.level<2?4:0),as(s,3),s.status=Xt,os(e),0!==s.pending)return s.last_flush=-1,Pt;if(69===s.status){if(s.gzhead.extra){let t=s.pending,i=(65535&s.gzhead.extra.length)-s.gzindex;for(;s.pending+i>s.pending_buf_size;){let n=s.pending_buf_size-s.pending;if(s.pending_buf.set(s.gzhead.extra.subarray(s.gzindex,s.gzindex+n),s.pending),s.pending=s.pending_buf_size,s.gzhead.hcrc&&s.pending>t&&(e.adler=Nt(e.adler,s.pending_buf,s.pending-t,t)),s.gzindex+=n,os(e),0!==s.pending)return s.last_flush=-1,Pt;t=0,i-=n}let n=new Uint8Array(s.gzhead.extra);s.pending_buf.set(n.subarray(s.gzindex,s.gzindex+i),s.pending),s.pending+=i,s.gzhead.hcrc&&s.pending>t&&(e.adler=Nt(e.adler,s.pending_buf,s.pending-t,t)),s.gzindex=0}s.status=73}if(73===s.status){if(s.gzhead.name){let t,i=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>i&&(e.adler=Nt(e.adler,s.pending_buf,s.pending-i,i)),os(e),0!==s.pending)return s.last_flush=-1,Pt;i=0}t=s.gzindex<s.gzhead.name.length?255&s.gzhead.name.charCodeAt(s.gzindex++):0,as(s,t)}while(0!==t);s.gzhead.hcrc&&s.pending>i&&(e.adler=Nt(e.adler,s.pending_buf,s.pending-i,i)),s.gzindex=0}s.status=91}if(91===s.status){if(s.gzhead.comment){let t,i=s.pending;do{if(s.pending===s.pending_buf_size){if(s.gzhead.hcrc&&s.pending>i&&(e.adler=Nt(e.adler,s.pending_buf,s.pending-i,i)),os(e),0!==s.pending)return s.last_flush=-1,Pt;i=0}t=s.gzindex<s.gzhead.comment.length?255&s.gzhead.comment.charCodeA