k2-im 0.1.25 → 0.1.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1020,8 +1020,8 @@ type ChannelMiniProgramRelConfigType = 'pinned-game' | 'float-link' | 'float-gam
1020
1020
  /**
1021
1021
  * 频道资料上的关联小程序(`/user_radio/info` 的 `mini_program_rel_list`)。
1022
1022
  *
1023
- * @remarks 这不是消息 22。语言/币种 CSV 原样保留,由宿主按大厅状态过滤。
1024
- * 打开小程序、半屏 iframe 与鉴权属于宿主,不进本 DTO。
1023
+ * @remarks 这不是消息 22。语言/币种 CSV 原样保留,SDK 不过滤;可见性与打开资格由 Chat Kit 纯函数处理。
1024
+ * 打开器、半屏 iframe 与鉴权属于宿主,不进本 DTO。
1025
1025
  */
1026
1026
  interface ChannelMiniProgramRel {
1027
1027
  configType: ChannelMiniProgramRelConfigType;
@@ -1,6 +1,3 @@
1
- /** IM 领域支持的 5 个展示 locale(与宿主规范 locale 一致)。 */
2
- type ImLocale = 'en-US' | 'th-TH' | 'vi-VN' | 'zh-CN' | 'zh-TW';
3
-
4
1
  /** 媒体业务类型:实现据此选对象存储逻辑桶;sticker 对应 app-sticker。 */
5
2
  type MediaKind = 'image' | 'video' | 'voice' | 'file' | 'sticker';
6
3
 
@@ -1020,8 +1017,8 @@ type ChannelMiniProgramRelConfigType = 'pinned-game' | 'float-link' | 'float-gam
1020
1017
  /**
1021
1018
  * 频道资料上的关联小程序(`/user_radio/info` 的 `mini_program_rel_list`)。
1022
1019
  *
1023
- * @remarks 这不是消息 22。语言/币种 CSV 原样保留,由宿主按大厅状态过滤。
1024
- * 打开小程序、半屏 iframe 与鉴权属于宿主,不进本 DTO。
1020
+ * @remarks 这不是消息 22。语言/币种 CSV 原样保留,SDK 不过滤;可见性与打开资格由 Chat Kit 纯函数处理。
1021
+ * 打开器、半屏 iframe 与鉴权属于宿主,不进本 DTO。
1025
1022
  */
1026
1023
  interface ChannelMiniProgramRel {
1027
1024
  configType: ChannelMiniProgramRelConfigType;
@@ -2543,18 +2540,6 @@ interface ImPushApi {
2543
2540
  subscribe: (listener: (snapshot: ImPushSnapshot) => void) => () => void;
2544
2541
  }
2545
2542
 
2546
- /**
2547
- * IM 语义文案 catalog 的键、参数和完整性合同。
2548
- * 键描述领域含义而非组件位置,使 Web/H5/SSR 可共享 formatter,宿主布局文案不进入此 schema。
2549
- */
2550
-
2551
- /**
2552
- * 命令/生命周期「操作提示」文案 key(formatServiceText 用;供 kit services / runtime 产语义码、宿主按 locale 渲染)。
2553
- * 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
2554
- * 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
2555
- */
2556
- type ImServiceTextKey = 'common.notConnected' | 'common.selectOrOpenConversation' | 'common.conversationTypeNotReady' | 'common.conversationNotReady' | `recall.${RecallFailReason}` | `edit.${EditFailReason}` | 'localDelete.done' | 'localDelete.notFound' | 'localDelete.inFlight' | 'localDelete.failed' | 'channelDelete.notFound' | 'channelDelete.unsupported' | 'channelDelete.notSent' | 'channelDelete.unavailable' | 'channelDelete.forbidden' | 'channelDelete.timeout' | 'channelDelete.failed' | 'channelDelete.disconnected' | 'directBlock.contactRequired' | 'groupBlock.left' | 'groupBlock.removed' | 'groupBlock.dismissed' | 'groupBlock.unknownRestricted' | 'channelBlock.guest' | 'channelBlock.left' | 'channelBlock.removed' | 'channelBlock.dismissed' | 'channelBlock.muted' | 'channelBlock.allMembersMuted' | 'channelBlock.currentUserMuted' | 'channelBlock.blacklisted' | 'channelBlock.unknownRestricted' | 'channelProfile.loadFailed' | 'channelProfile.notFound' | 'channelProfile.retryAction' | 'channelMembers.title' | 'channelMembers.searchPlaceholder' | 'channelMembers.loading' | 'channelMembers.loadFailed' | 'channelMembers.retryAction' | 'channelMembers.empty' | 'channelMembers.loadingMore' | 'channelMembers.loadMoreFailed' | 'channelMembers.exhausted' | 'channelMembers.loadMoreAction' | 'label.image' | 'label.video' | 'label.file' | 'label.sticker' | 'send.failed' | 'send.retryFailed' | 'send.cancelFailed' | 'send.mediaFailed' | 'send.mediaEmpty' | 'send.mediaCancelled' | 'send.mediaCountLimit' | 'send.mediaTooLarge' | 'send.mediaFormatMismatch' | 'send.videoTooLong' | 'send.videoDurationUnavailable' | 'send.voiceEmpty' | 'send.voiceStorageNotConfigured' | 'send.voiceCancelled' | 'send.voiceFailed' | 'media.uploadWaiting' | 'media.voiceNotReady' | 'media.voiceLoadEmpty' | 'media.voiceLoadFailed' | 'media.videoOpenEmpty' | 'media.videoLoadFailed' | 'media.imageInvalid' | 'media.imageLoadFailed' | 'media.fileDownloadEmpty' | 'media.fileDownloadFailed' | 'conversation.muteEnableFailed' | 'conversation.muteDisableFailed' | 'conversation.backgroundLoadFailed' | 'read.markReadFailed' | 'storage.failed' | 'sync.failed' | 'draft.saveFailed' | 'history.returnLatestFailed' | 'pinned.forbidden' | 'pinned.network' | 'pinned.contract' | 'pinned.unsupported' | 'pinned.failed' | 'pinned.previewUnavailable' | 'pinned.locateFailed' | 'pinned.recalled' | 'pinned.deleted' | 'pinned.protected' | 'pinned.pinAction' | 'pinned.unpinAction' | 'pinned.unpinConfirm' | 'pinned.cancelAction' | 'lifecycle.missingLoginState' | 'lifecycle.prepareFailed' | 'lifecycle.missingConnectParams' | 'lifecycle.connectFailed' | 'lifecycle.disposed' | 'forward.emptyInput' | 'forward.allSkipped' | 'forward.partialSkipped' | 'forward.done' | 'forward.failed';
2557
-
2558
2543
  /**
2559
2544
  * 后端协议的目标服务命名。
2560
2545
  *
@@ -4051,6 +4036,8 @@ interface ImChannelPermissions {
4051
4036
  dismissChannel?: boolean;
4052
4037
  transferOwnership?: boolean;
4053
4038
  }
4039
+ /** 产品层频道关联小程序;字段与 Core `ChannelMiniProgramRel` 相同,避免宿主再读 wire。 */
4040
+ type ImChannelMiniProgramRel = ChannelMiniProgramRel;
4054
4041
  /**
4055
4042
  * default CHANNEL 资料 DTO。
4056
4043
  *
@@ -6200,6 +6187,110 @@ interface ImClient extends Omit<ImProductClient, 'capabilities' | 'channels' | '
6200
6187
  */
6201
6188
  type ImAdvancedClient = ImClient;
6202
6189
 
6190
+ /**
6191
+ * 频道 rel 能否打开:跨宿主纯决策。打开器、Toast、分享快照仍归 Host。
6192
+ * 置顶/悬浮游戏都要有 appId 和可拼地址;无 appId 的置顶游戏根本不会进入可见列表。
6193
+ */
6194
+
6195
+ interface ChannelMiniProgramOpenGame {
6196
+ id: string;
6197
+ name: string;
6198
+ cover: string;
6199
+ appId?: string;
6200
+ developerId?: string;
6201
+ domain?: string;
6202
+ suffixAddress?: string;
6203
+ h5Url?: string;
6204
+ isDynamic?: boolean;
6205
+ productId?: number;
6206
+ }
6207
+ type ChannelMiniProgramRelOpenDecision = {
6208
+ kind: 'refuse';
6209
+ } | {
6210
+ kind: 'open-link';
6211
+ url: string;
6212
+ } | {
6213
+ kind: 'open-game';
6214
+ game: ChannelMiniProgramOpenGame;
6215
+ currencyType: number | string;
6216
+ };
6217
+ declare function decideChannelMiniProgramRelOpen(rel: ImChannelMiniProgramRel, input: {
6218
+ name: string;
6219
+ currentCurrencyType: number | null;
6220
+ }): ChannelMiniProgramRelOpenDecision;
6221
+
6222
+ /**
6223
+ * 频道 `miniProgramRels` 的跨宿主可见性与展示纯规则。
6224
+ * SDK mapper 原样保留 CSV 和空 appId;是否展示由这里按当前语言号与大厅币种决定。
6225
+ */
6226
+
6227
+ /** 与旧 H5 `languageGetNumber` / 频道 rel `lang_types` 一致:1 简中 2 繁中 3 英 4 越 5 泰。 */
6228
+ declare const MINI_PROGRAM_LANG_NUMBERS: {
6229
+ readonly 'zh-CN': 1;
6230
+ readonly 'zh-TW': 2;
6231
+ readonly 'en-US': 3;
6232
+ readonly 'vi-VN': 4;
6233
+ readonly 'th-TH': 5;
6234
+ };
6235
+ type MiniProgramHostLocale = keyof typeof MINI_PROGRAM_LANG_NUMBERS;
6236
+ declare function csvIncludes(csv: string | undefined, value: string | number): boolean;
6237
+ /** 频道 rel 名称按当前 locale 取对应字段,再按 en → 简中 → 繁中 → 越 → 泰回退。 */
6238
+ declare function resolveChannelMiniProgramRelName(rel: ImChannelMiniProgramRel, locale: string): string;
6239
+ declare function resolveChannelMiniProgramRelIcon(rel: ImChannelMiniProgramRel): string;
6240
+ declare function resolveChannelMiniProgramRelUrl(rel: ImChannelMiniProgramRel): string;
6241
+ interface VisibleChannelMiniProgramRels {
6242
+ pinnedGame: ImChannelMiniProgramRel | null;
6243
+ floatingItems: readonly ImChannelMiniProgramRel[];
6244
+ }
6245
+ /** 置顶游戏与消息卡共用全屏;右下角最底部悬浮游戏走半屏。 */
6246
+ type ChannelMiniProgramRelOpenSurface = 'page' | 'half';
6247
+ /**
6248
+ * 频道 rel 打开面:只有 `float-game` 半屏,其余与点击小程序消息一致走全屏。
6249
+ * `float-link` 实际仍开外链,surface 不影响决策。
6250
+ */
6251
+ declare function resolveChannelMiniProgramRelOpenSurface(rel: ImChannelMiniProgramRel): ChannelMiniProgramRelOpenSurface;
6252
+ /**
6253
+ * 对齐 iOS `ChatSetTopMsgViewMiniProgramMsgContentView setChannelInfo`:
6254
+ * 主标题取频道简介,胶囊取 rel 当前语言游戏名。
6255
+ * `rel.introduction` 是产品/社交内容简介,不是频道简介,不能拿来当标题。
6256
+ */
6257
+ declare function resolveChannelPinnedGameCopy(input: {
6258
+ channelDescription?: string | null;
6259
+ rel: ImChannelMiniProgramRel;
6260
+ locale: string;
6261
+ }): {
6262
+ title: string;
6263
+ tag: string;
6264
+ name: string;
6265
+ };
6266
+ /** 右下角浮窗:链接在上、游戏在最底部。 */
6267
+ declare function sortChannelMiniProgramFloatingItems(items: readonly ImChannelMiniProgramRel[]): ImChannelMiniProgramRel[];
6268
+ /**
6269
+ * 按当前语言号与大厅币种过滤 `miniProgramRels`。
6270
+ * `undefined` 表示 info 尚未回填,不展示;空数组表示 info 已确认没有配置。
6271
+ * 置顶游戏还要有 appId 才展示,对齐 iOS `hasGamePromptWithChannelInfo`。
6272
+ */
6273
+ declare function resolveVisibleChannelMiniProgramRels(rels: readonly ImChannelMiniProgramRel[] | undefined, input: {
6274
+ locale: string;
6275
+ currencyType: number | string | null | undefined;
6276
+ }): VisibleChannelMiniProgramRels;
6277
+ declare function channelMiniProgramRelKey(conversationId: string, rel: ImChannelMiniProgramRel): string;
6278
+
6279
+ /** IM 领域支持的 5 个展示 locale(与宿主规范 locale 一致)。 */
6280
+ type ImLocale = 'en-US' | 'th-TH' | 'vi-VN' | 'zh-CN' | 'zh-TW';
6281
+
6282
+ /**
6283
+ * IM 语义文案 catalog 的键、参数和完整性合同。
6284
+ * 键描述领域含义而非组件位置,使 Web/H5/SSR 可共享 formatter,宿主布局文案不进入此 schema。
6285
+ */
6286
+
6287
+ /**
6288
+ * 命令/生命周期「操作提示」文案 key(formatServiceText 用;供 kit services / runtime 产语义码、宿主按 locale 渲染)。
6289
+ * 二期收敛:kit 框架无关层不再直接产中文,改产本联合里的码 + 参数(如 {reason}/{label}/{size}),由宿主经 im-i18n 渲染。
6290
+ * 动态原始报错(error.message)作为 `{reason}` 参数拼接,不入 catalog(属诊断,不翻译)。
6291
+ */
6292
+ type ImServiceTextKey = 'common.notConnected' | 'common.selectOrOpenConversation' | 'common.conversationTypeNotReady' | 'common.conversationNotReady' | `recall.${RecallFailReason}` | `edit.${EditFailReason}` | 'localDelete.done' | 'localDelete.notFound' | 'localDelete.inFlight' | 'localDelete.failed' | 'channelDelete.notFound' | 'channelDelete.unsupported' | 'channelDelete.notSent' | 'channelDelete.unavailable' | 'channelDelete.forbidden' | 'channelDelete.timeout' | 'channelDelete.failed' | 'channelDelete.disconnected' | 'directBlock.contactRequired' | 'groupBlock.left' | 'groupBlock.removed' | 'groupBlock.dismissed' | 'groupBlock.unknownRestricted' | 'channelBlock.guest' | 'channelBlock.left' | 'channelBlock.removed' | 'channelBlock.dismissed' | 'channelBlock.muted' | 'channelBlock.allMembersMuted' | 'channelBlock.currentUserMuted' | 'channelBlock.blacklisted' | 'channelBlock.unknownRestricted' | 'channelProfile.loadFailed' | 'channelProfile.notFound' | 'channelProfile.retryAction' | 'channelMembers.title' | 'channelMembers.searchPlaceholder' | 'channelMembers.loading' | 'channelMembers.loadFailed' | 'channelMembers.retryAction' | 'channelMembers.empty' | 'channelMembers.loadingMore' | 'channelMembers.loadMoreFailed' | 'channelMembers.exhausted' | 'channelMembers.loadMoreAction' | 'label.image' | 'label.video' | 'label.file' | 'label.sticker' | 'send.failed' | 'send.retryFailed' | 'send.cancelFailed' | 'send.mediaFailed' | 'send.mediaEmpty' | 'send.mediaCancelled' | 'send.mediaCountLimit' | 'send.mediaTooLarge' | 'send.mediaFormatMismatch' | 'send.videoTooLong' | 'send.videoDurationUnavailable' | 'send.voiceEmpty' | 'send.voiceStorageNotConfigured' | 'send.voiceCancelled' | 'send.voiceFailed' | 'media.uploadWaiting' | 'media.voiceNotReady' | 'media.voiceLoadEmpty' | 'media.voiceLoadFailed' | 'media.videoOpenEmpty' | 'media.videoLoadFailed' | 'media.imageInvalid' | 'media.imageLoadFailed' | 'media.fileDownloadEmpty' | 'media.fileDownloadFailed' | 'conversation.muteEnableFailed' | 'conversation.muteDisableFailed' | 'conversation.backgroundLoadFailed' | 'read.markReadFailed' | 'storage.failed' | 'sync.failed' | 'draft.saveFailed' | 'history.returnLatestFailed' | 'pinned.forbidden' | 'pinned.network' | 'pinned.contract' | 'pinned.unsupported' | 'pinned.failed' | 'pinned.previewUnavailable' | 'pinned.locateFailed' | 'pinned.recalled' | 'pinned.deleted' | 'pinned.protected' | 'pinned.pinAction' | 'pinned.unpinAction' | 'pinned.unpinConfirm' | 'pinned.cancelAction' | 'lifecycle.missingLoginState' | 'lifecycle.prepareFailed' | 'lifecycle.missingConnectParams' | 'lifecycle.connectFailed' | 'lifecycle.disposed' | 'forward.emptyInput' | 'forward.allSkipped' | 'forward.partialSkipped' | 'forward.done' | 'forward.failed';
6293
+
6203
6294
  /** 会话列表摘要的框架无关分段;宿主可自行决定表情使用图片、文本或其它组件呈现。 */
6204
6295
  type ConversationListPreviewSegment = {
6205
6296
  kind: 'text' | 'mention';
@@ -6355,6 +6446,20 @@ type MessageNotificationDecision = {
6355
6446
  /** PC/H5 共用的实时消息提醒规则;离线历史回放不逐条弹通知。 */
6356
6447
  declare function resolveMessageNotificationDecision(input: MessageNotificationInput): MessageNotificationDecision;
6357
6448
 
6449
+ /**
6450
+ * 拼装频道 rel / 消息 22 打开小程序用的地址。
6451
+ * 有 host 时按大厅规则拼 suffix;只有 suffix 时只接受完整 URL 或带点的主机名,
6452
+ * 不能把 `/path` 当成域名。
6453
+ */
6454
+ interface MiniProgramOpenUrlInput {
6455
+ domain?: string;
6456
+ suffixAddress?: string;
6457
+ h5Url?: string;
6458
+ }
6459
+ declare function resolveMiniProgramOpenUrl(input: MiniProgramOpenUrlInput): string;
6460
+ /** 悬浮外链:suffix 已是完整地址或主机名时直接用;只有路径时必须拼到 domain 上。 */
6461
+ declare function resolveMiniProgramFloatLinkUrl(input: MiniProgramOpenUrlInput): string;
6462
+
6358
6463
  /**
6359
6464
  * 官方 Chat Kit 和受控诊断工具使用的 SDK internal 入口。
6360
6465
  * 它暴露完整 client、adapter 装配和领域原子,但仍不属于普通产品 API;生产宿主不得据此解析协议或持有密钥。
@@ -8586,5 +8691,5 @@ declare function resampleWaveform(data: readonly number[], targetCount: number):
8586
8691
  */
8587
8692
  declare function placeholderWaveform(seed: string, count: number): number[];
8588
8693
 
8589
- export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, classifyGifFile, createChatRuntime, createDelayedLoadingIndicator, createEmojiMatcher, createLinkMatcher, createNewMessageBadgeController, createThreadItems, decideConversationAction, decideMemberTargetAction, decideMessageAction, emojiAssetUrl, emojiUrlByCode, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatFileSize, formatMediaDuration, forward_service as forwardService, getFileExtension, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, message_service as messageService, normalizeLinkHref, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveUnicodeEmoji, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, spikeCountForDuration, supportsConversationMention, unicodeEmojiTextFromCode };
8590
- export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CenteredMessageScrollInput, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ConversationCapabilityAction, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationSearchCategory, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, FormatTimeDisplayContext, ForwardCommandHooks, GifFileClassification, HighlightSegment, ImChannelMemberPresentation, ImChannelMentionPresentation, ImChannelProfilePresentation, ImForwardOperationResult, ImGroupMemberPresentation, ImMediaBatchSendResult, ImMessageActionResult, ImMessageBodyKind, ImMessageView, ImPinnedMessageActionResult, ImPinnedMessageSnapshot, ImProfileAccessDestination, ImQuotedMessagePresentation, ImTextResolver, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MessageCapabilityAction, MessageCapabilityInput, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SendCapabilityMode, SendCommandHooks, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, UnicodeEmojiEntry };
8694
+ export { DEFAULT_EMOJI_ASSET_BASE, DEFAULT_LOADING_MINIMUM_VISIBLE_MS, DEFAULT_LOADING_SHOW_DELAY_MS, EMOJI_CATALOG, EMOJI_GAME_DICE_STABLE_KEY, EMOJI_GAME_RPS_STABLE_KEY, EMOJI_TOKEN_RE, MAX_BATCH_FILES, MAX_RECENT_EMOJI_COUNT, MINI_PROGRAM_LANG_NUMBERS, SPIKE_STEP, UNICODE_EMOJI_CATALOG, blockReasonForChannelSession, blockReasonForChannelState, blockReasonForGroupState, blockReasonForSession, calculateMediaBox, canEditMessage, canPinChannelMessage, canPinGroupMessage, canPinMessage, canPromoteMediaPresentationSource, canRecallMessage, canTransmit, canTransmitByType, canTransmitContent, cancelMediaUpload, captureRuntimeClientOperation, captureRuntimeOperation, channelMiniProgramRelKey, classifyGifFile, createChatRuntime, createDelayedLoadingIndicator, createEmojiMatcher, createLinkMatcher, createNewMessageBadgeController, createThreadItems, csvIncludes, decideChannelMiniProgramRelOpen, decideConversationAction, decideMemberTargetAction, decideMessageAction, emojiAssetUrl, emojiUrlByCode, fetchConversationFileBatch, fetchConversationImageBatch, fetchConversationMessageBatch, fetchConversationVideoBatch, fetchConversationVoiceBatch, fetchNextConversationSearchBatch, formatChatDateSeparator, formatConversationDisplayTime, formatFileSize, formatMediaDuration, forward_service as forwardService, getFileExtension, getLocalDayKey, hasEmojiCandidate, hasLinkCandidate, highlightSegments, isGifFile, isMessageLocateScrollProtected, isMessageTailChangeFromOlderWindowTrim, isMessageViewportMeasurable, isMessageVisibleForNewMessageBadge, isPinnedMessageProtected, isVoiceStorageConfigured, loadOlderUntilBoundary, mediaBatchBudgetBytes, media_service as mediaService, message_service as messageService, normalizeLinkHref, parseUnicodeEmojiCode, pinnedMessage_service as pinnedMessageService, placeholderWaveform, prependRecentEmoji, profile_service as profileService, read_service as readService, refreshPrependMessageAnchorPosition, replaceInterruptedMediaFile, requiresConversationEncryption, requiresForwardTypeConfirmation, resampleWaveform, resolveBestMediaPresentationSource, resolveCenteredMessageScrollTop, resolveChannelMemberAvatarUrl, resolveChannelMemberDisplayName, resolveChannelMiniProgramRelIcon, resolveChannelMiniProgramRelName, resolveChannelMiniProgramRelOpenSurface, resolveChannelMiniProgramRelUrl, resolveChannelPinnedGameCopy, resolveConversationListPresentation, resolveDisplayTimestamp, resolveEmojiToken, resolveFriendDisplayName, resolveImProfileAccessDestination, resolveImThreadActiveDate, resolveMediaPresentation, resolveMemberDisplayName, resolveMessageBodyKind, resolveMessageNotificationDecision, resolveMessageTimelineTimestamp, resolveMiniProgramFloatLinkUrl, resolveMiniProgramOpenUrl, resolvePrependMessageAnchor, resolvePrependMessageAnchorAdjustment, resolvePrependMessageAnchorPosition, resolvePublicNickname, resolveQuotedMessagePresentation, resolveSenderAvatarUrl, resolveStandaloneEmojiMessage, resolveSurvivingMessageAnchorAdjustment, resolveUnicodeEmoji, resolveVisibleChannelMiniProgramRels, resolveVisibleMessageAnchorPositions, retryMessage, runMediaSendBatch, sendAsFilesBatch, sendBlockReasonForDecision, sendMediaAlbum, sendMediaFile, sendMediaFilesBatch, sendText, sendVoice, shouldCompleteInitialViewport, shouldFillInitialHistoryViewport, shouldFollowIncomingMessage, shouldLoadNewerHistoryPage, shouldPrefetchOlderHistory, shouldRestoreMessageViewportFocus, shouldShowChatDateSeparator, shouldTrackRemoteMessageForBadge, sortChannelMiniProgramFloatingItems, spikeCountForDuration, supportsConversationMention, unicodeEmojiTextFromCode };
8695
+ export type { ApplySessionResult, BrowseMessagesInput, CanPinMessageInput, CenteredMessageScrollInput, ChannelMiniProgramOpenGame, ChannelMiniProgramRelOpenDecision, ChannelMiniProgramRelOpenSurface, ChatMediaMessageRef, ChatProfileAdapter, ChatRuntime, ChatRuntimeCredentials, ChatRuntimeFactories, ChatRuntimeHostDeps, ChatRuntimeOpResult, ConversationCapabilityAction, ConversationListPresentation, ConversationListPresentationLabels, ConversationListPresentationOptions, ConversationListPreviewMediaKind, ConversationListPreviewSegment, ConversationSearchCategory, CreateThreadItemsInput, DelayedLoadingIndicator, DelayedLoadingIndicatorOptions, EmojiEntry, EmojiRecentItem, EmojiSegment, FormatTimeDisplayContext, ForwardCommandHooks, GifFileClassification, HighlightSegment, ImChannelMemberPresentation, ImChannelMentionPresentation, ImChannelProfilePresentation, ImForwardOperationResult, ImGroupMemberPresentation, ImMediaBatchSendResult, ImMessageActionResult, ImMessageBodyKind, ImMessageView, ImPinnedMessageActionResult, ImPinnedMessageSnapshot, ImProfileAccessDestination, ImQuotedMessagePresentation, ImTextResolver, ImThreadActiveDateSnapshot, ImThreadDateMarkerMetric, ImThreadDecoration, ImThreadEncryptionItem, ImThreadIntent, ImThreadItem, ImThreadPresentationAdapter, ImThreadReadActions, ImThreadReadTargetResolver, ImThreadViewportMetrics, IncomingMessageFollowInput, InitialHistoryViewportFillInput, InitialViewportCompletionInput, LinkSegment, MediaBatchBudgetOptions, MediaBatchLimitInfo, MediaLimitItem, MediaObjectUrlLease, MediaPresentationFit, MediaPresentationPolicy, MediaPresentationRule, MediaPresentationSourceCandidate, MediaPresentationSourceQuality, MediaSendBatchResult, MemberTargetCapabilityAction, MemberTargetCapabilityInput, MessageCapabilityAction, MessageCapabilityInput, MessageLocateScrollProtectionInput, MessageNotificationDecision, MessageNotificationInput, MiniProgramHostLocale, MiniProgramOpenUrlInput, NewMessageBadgeController, NewMessageBadgeCountListener, NewMessageBadgeVisibilityInput, NewerHistoryPageTriggerInput, OlderHistoryPrefetchInput, PrependAnchorCandidate, PrependAnchorViewport, PrependMessageAnchorPosition, RemoteMessageBadgeTrackingInput, ResolveMediaPresentationInput, ResolvedMediaPresentation, RichExtraSegment, RuntimeClientOperation, RuntimeOperation, SearchBatchResult, SearchFilesInput, SearchMessagesInput, SearchTextMessagesInput, SendCapabilityMode, SendCommandHooks, SendVoicePayload, SenderProfileEntry, ServiceNoteHooks, StandaloneEmojiMessage, UnicodeEmojiEntry, VisibleChannelMiniProgramRels };
package/dist/chat-kit.js CHANGED
@@ -1 +1 @@
1
- export{c as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,b as DEFAULT_LOADING_SHOW_DELAY_MS,u as SPIKE_STEP,q as calculateMediaBox,f as canPromoteMediaPresentationSource,h as captureRuntimeClientOperation,g as captureRuntimeOperation,d as createDelayedLoadingIndicator,o as createLinkMatcher,s as formatFileSize,r as formatMediaDuration,t as getFileExtension,n as hasLinkCandidate,l as highlightSegments,i as mediaService,m as normalizeLinkHref,x as placeholderWaveform,j as readService,w as resampleWaveform,e as resolveBestMediaPresentationSource,a as resolveConversationListPresentation,p as resolveMediaPresentation,k as resolveQuotedMessagePresentation,v as spikeCountForDuration}from'./chunk-F5GJAS6A.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,L as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,K as blockReasonForChannelSession,J as blockReasonForChannelState,Q as blockReasonForGroupState,T as blockReasonForSession,E as canEditMessage,u as canPinChannelMessage,t as canPinGroupMessage,v as canPinMessage,D as canRecallMessage,aa as cancelMediaUpload,O as classifyGifFile,s as createChatRuntime,p as createEmojiMatcher,G as decideConversationAction,I as decideMemberTargetAction,H as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Aa as fetchConversationFileBatch,Ba as fetchConversationImageBatch,ya as fetchConversationMessageBatch,Ca as fetchConversationVideoBatch,Da as fetchConversationVoiceBatch,Ea as fetchNextConversationSearchBatch,da as forwardService,o as hasEmojiCandidate,P as isGifFile,w as isPinnedMessageProtected,X as isVoiceStorageConfigured,M as mediaBatchBudgetBytes,ia as messageService,e as parseUnicodeEmojiCode,na as pinnedMessageService,d as prependRecentEmoji,xa as profileService,W as replaceInterruptedMediaFile,R as requiresConversationEncryption,z as resolveChannelMemberAvatarUrl,y as resolveChannelMemberDisplayName,k as resolveEmojiToken,C as resolveFriendDisplayName,oa as resolveImProfileAccessDestination,x as resolveMemberDisplayName,r as resolveMessageNotificationDecision,B as resolvePublicNickname,A as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ba as retryMessage,N as runMediaSendBatch,$ as sendAsFilesBatch,F as sendBlockReasonForDecision,Z as sendMediaAlbum,V as sendMediaFile,_ as sendMediaFilesBatch,U as sendText,Y as sendVoice,S as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-V7ULSSTZ.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-UNGWXAYA.js';import'./chunk-VMKTMZ3K.js';import'./chunk-SVJGRV4M.js';import'./chunk-GMVR64GN.js';export{ra as canTransmit,pa as canTransmitByType,qa as canTransmitContent,oa as requiresForwardTypeConfirmation}from'./chunk-LX7YEO5G.js';import'./chunk-WOT6VMZA.js';
1
+ export{p as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,o as DEFAULT_LOADING_SHOW_DELAY_MS,d as MINI_PROGRAM_LANG_NUMBERS,H as SPIKE_STEP,D as calculateMediaBox,s as canPromoteMediaPresentationSource,u as captureRuntimeClientOperation,t as captureRuntimeOperation,m as channelMiniProgramRelKey,q as createDelayedLoadingIndicator,B as createLinkMatcher,e as csvIncludes,c as decideChannelMiniProgramRelOpen,F as formatFileSize,E as formatMediaDuration,G as getFileExtension,A as hasLinkCandidate,y as highlightSegments,v as mediaService,z as normalizeLinkHref,K as placeholderWaveform,w as readService,J as resampleWaveform,r as resolveBestMediaPresentationSource,g as resolveChannelMiniProgramRelIcon,f as resolveChannelMiniProgramRelName,i as resolveChannelMiniProgramRelOpenSurface,h as resolveChannelMiniProgramRelUrl,j as resolveChannelPinnedGameCopy,n as resolveConversationListPresentation,C as resolveMediaPresentation,b as resolveMiniProgramFloatLinkUrl,a as resolveMiniProgramOpenUrl,x as resolveQuotedMessagePresentation,l as resolveVisibleChannelMiniProgramRels,k as sortChannelMiniProgramFloatingItems,I as spikeCountForDuration}from'./chunk-WYQXQOLW.js';export{j as DEFAULT_EMOJI_ASSET_BASE,i as EMOJI_CATALOG,c as EMOJI_GAME_DICE_STABLE_KEY,b as EMOJI_GAME_RPS_STABLE_KEY,m as EMOJI_TOKEN_RE,L as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,K as blockReasonForChannelSession,J as blockReasonForChannelState,Q as blockReasonForGroupState,T as blockReasonForSession,E as canEditMessage,u as canPinChannelMessage,t as canPinGroupMessage,v as canPinMessage,D as canRecallMessage,aa as cancelMediaUpload,O as classifyGifFile,s as createChatRuntime,p as createEmojiMatcher,G as decideConversationAction,I as decideMemberTargetAction,H as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Aa as fetchConversationFileBatch,Ba as fetchConversationImageBatch,ya as fetchConversationMessageBatch,Ca as fetchConversationVideoBatch,Da as fetchConversationVoiceBatch,Ea as fetchNextConversationSearchBatch,da as forwardService,o as hasEmojiCandidate,P as isGifFile,w as isPinnedMessageProtected,X as isVoiceStorageConfigured,M as mediaBatchBudgetBytes,ia as messageService,e as parseUnicodeEmojiCode,na as pinnedMessageService,d as prependRecentEmoji,xa as profileService,W as replaceInterruptedMediaFile,R as requiresConversationEncryption,z as resolveChannelMemberAvatarUrl,y as resolveChannelMemberDisplayName,k as resolveEmojiToken,C as resolveFriendDisplayName,oa as resolveImProfileAccessDestination,x as resolveMemberDisplayName,r as resolveMessageNotificationDecision,B as resolvePublicNickname,A as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ba as retryMessage,N as runMediaSendBatch,$ as sendAsFilesBatch,F as sendBlockReasonForDecision,Z as sendMediaAlbum,V as sendMediaFile,_ as sendMediaFilesBatch,U as sendText,Y as sendVoice,S as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-V7ULSSTZ.js';export{C as createNewMessageBadgeController,i as createThreadItems,f as formatChatDateSeparator,e as formatConversationDisplayTime,c as getLocalDayKey,l as isMessageLocateScrollProtected,v as isMessageTailChangeFromOlderWindowTrim,k as isMessageViewportMeasurable,B as isMessageVisibleForNewMessageBadge,x as loadOlderUntilBoundary,p as refreshPrependMessageAnchorPosition,j as resolveCenteredMessageScrollTop,a as resolveDisplayTimestamp,g as resolveImThreadActiveDate,h as resolveMessageBodyKind,b as resolveMessageTimelineTimestamp,n as resolvePrependMessageAnchor,q as resolvePrependMessageAnchorAdjustment,o as resolvePrependMessageAnchorPosition,s as resolveSurvivingMessageAnchorAdjustment,r as resolveVisibleMessageAnchorPositions,t as shouldCompleteInitialViewport,y as shouldFillInitialHistoryViewport,u as shouldFollowIncomingMessage,z as shouldLoadNewerHistoryPage,m as shouldPrefetchOlderHistory,w as shouldRestoreMessageViewportFocus,d as shouldShowChatDateSeparator,A as shouldTrackRemoteMessageForBadge}from'./chunk-UNGWXAYA.js';import'./chunk-VMKTMZ3K.js';import'./chunk-SVJGRV4M.js';import'./chunk-GMVR64GN.js';export{ra as canTransmit,pa as canTransmitByType,qa as canTransmitContent,oa as requiresForwardTypeConfirmation}from'./chunk-LX7YEO5G.js';import'./chunk-WOT6VMZA.js';
@@ -0,0 +1,2 @@
1
+ import {p}from'./chunk-V7ULSSTZ.js';import {e,a as a$1}from'./chunk-UNGWXAYA.js';import {j as j$1,h}from'./chunk-VMKTMZ3K.js';import {ha}from'./chunk-LX7YEO5G.js';import {a}from'./chunk-WOT6VMZA.js';function E(e){return e===""||e.startsWith("/")||e.startsWith("?")||e.startsWith("&")?false:e.includes(".")}function X(e){return e===""?"":/^https?:\/\//i.test(e)?e:`https://${e}`}function y(e){let t=e.domain?.trim()??"",n=e.suffixAddress?.trim()??"",i=e.h5Url?.trim()??"";if(t!==""){if(n==="")return t;if(n.startsWith("/"))return t.replace(/\/$/,"")+n;let r=n.replace(/^&/,""),o=t.includes("?")?"&":n.includes("?")?"":"?";return t+o+r}return /^https?:\/\//i.test(n)?n:E(n)?`https://${n}`:i}function x(e){let t=e.domain?.trim()??"",n=e.suffixAddress?.trim()??"",i=e.h5Url?.trim()??"";return /^https?:\/\//i.test(n)?n:E(n)?`https://${n}`:t!==""?X(y({domain:t,suffixAddress:n,h5Url:i})):/^https?:\/\//i.test(i)?i:E(i)?`https://${i}`:""}function Z(e,t){return {id:e.appId??t,name:t,cover:"",...e.appId===void 0?{}:{appId:e.appId},...e.developerId===void 0?{}:{developerId:e.developerId},...e.domain===void 0?{}:{domain:e.domain},...e.suffixAddress===void 0?{}:{suffixAddress:e.suffixAddress},...e.h5Url===void 0?{}:{h5Url:e.h5Url},...e.isDynamic===void 0?{}:{isDynamic:e.isDynamic},...e.productId===void 0?{}:{productId:e.productId}}}function ee(e,t){if(e.configType==="float-link"){let r=x({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url});return r===""?{kind:"refuse"}:{kind:"open-link",url:r}}if(e.configType!=="pinned-game"&&e.configType!=="float-game")return {kind:"refuse"};let n=e.appId?.trim()??"",i=y({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url});return n===""||i===""?{kind:"refuse"}:{kind:"open-game",game:Z(e,t.name),currencyType:t.currentCurrencyType??""}}var N={"zh-CN":1,"zh-TW":2,"en-US":3,"vi-VN":4,"th-TH":5};function O(e,t){let n=String(t).trim();return n===""||n==="0"?false:(e??"").split(",").map(i=>i.trim()).filter(i=>i!=="").includes(n)}function G(e){return e in N?e:"en-US"}function V(e,t){let i={"zh-CN":e.nameZhHans,"zh-TW":e.nameZhHant,"en-US":e.nameEn,"vi-VN":e.nameVi,"th-TH":e.nameTh}[G(t)]?.trim()??"";return i!==""?i:[e.nameEn,e.nameZhHans,e.nameZhHant,e.nameVi,e.nameTh].map(r=>r?.trim()??"").find(r=>r!=="")??""}function ne(e){return e.icon?.trim()||e.iconSmall?.trim()||e.iconMedium?.trim()||e.iconLarge?.trim()||""}function B(e){return y({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})}function H(e){return (e.appId?.trim()??"")!==""}function te(e){return e.configType==="float-game"?H(e)&&B(e)!=="":e.configType==="float-link"?x({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})!=="":false}function re(e){return e.configType==="float-game"?"half":"page"}function ie(e){let t=V(e.rel,e.locale);return {title:e.channelDescription?.trim()??"",tag:t,name:t}}function j(e){return [...e].sort((t,n)=>t.configType===n.configType?0:t.configType==="float-game"?1:n.configType==="float-game"?-1:0)}function oe(e,t){if(e===void 0)return {pinnedGame:null,floatingItems:[]};let n=N[G(t.locale)],i=e.filter(r=>r.configType!=="unknown"&&O(r.langTypes,n)&&O(r.currencyTypes,t.currencyType??""));return {pinnedGame:i.find(r=>r.configType==="pinned-game"&&H(r))??null,floatingItems:j(i.filter(r=>(r.configType==="float-link"||r.configType==="float-game")&&te(r)))}}function ae(e,t){return [e,t.configType,t.appId??"",t.suffixAddress??t.h5Url??""].join("|")}var W=p();function se(e$1,t){let n=t.suppressDraft===true?null:e$1.draft,i=n?.text.trim()??"",r,o="",s="";return n!==null?r=i===""?[]:de(e$1,i,t.locale):me(e$1)?r=I(ue(e$1,t)):e$1.lastMessageSummary?.kind==="channel-moderation-deleted"||e$1.lastMessageDeletedForEveryone!==void 0?r=I(C(e$1,e$1.lastMessageSummary?.kind==="channel-moderation-deleted"?e$1.lastMessageSummary:{kind:"channel-moderation-deleted",by:e$1.lastMessageDeletedForEveryone?.by??""},t)):e$1.lastMessageSummary?.kind==="recalled"||e$1.lastMessageRecalled!==void 0?r=I(C(e$1,e$1.lastMessageSummary?.kind==="recalled"?e$1.lastMessageSummary:{kind:"recalled",by:e$1.lastMessageRecalled?.by??""},t)):(o=fe(e$1,t),s=e$1.mentionUnreadCount>0?t.labels.mentionBadge:"",r=ce(e$1,t)),{preview:`${s}${o}${r.map(l=>l.text).join("")}`||(n===null?t.labels.emptyPreview:""),previewSegments:r,...le(e$1,n!==null),senderPrefix:o,mentionBadge:s,time:e(a$1(n?.updatedAt,e$1.timestamp),{locale:t.locale,...t.now===void 0?{}:{now:t.now}}),hasDraft:n!==null}}function I(e){return [{kind:"text",text:e}]}function le(e,t){let n=e.lastMessageSummary;if(t||e.lastMessageDeletedForEveryone!==void 0||e.lastMessageRecalled!==void 0||e.lastMessageSystemEvent!==void 0||n===void 0)return {};if(n.kind==="mediaAlbum"){let{imageCount:i,videoCount:r,caption:o,firstItemKind:s}=n;return i<=0&&r<=0?{}:o!==void 0&&o!==""&&s!==void 0?{previewMediaKind:s}:i>0&&r>0?{previewMediaKind:"mediaAlbum"}:{previewMediaKind:r>0?"video":"image"}}return n.kind==="image"||n.kind==="video"||n.kind==="gif"||n.kind==="sticker"?{previewMediaKind:n.kind}:{}}function $(e){return e.map(t=>t.kind==="emoji"?{kind:"emoji",text:t.text,code:t.code}:{kind:t.kind,text:t.text})}function de(e,t,n){let i=e.draft?.mentions??[],r=[],o={},s=false;for(let l of i){if(l.userId==="0"){s=true;continue}r.includes(l.userId)||r.push(l.userId),l.displayName.trim()!==""&&(o[l.userId]=l.displayName);}let a=s||r.length>0?{atAll:s,atUserIds:r,...Object.keys(o).length===0?{}:{atUsersName:o}}:void 0;return $(ha(t,{mention:a,resolveName:l=>o[l]??l,atAllDisplay:j$1(n),matchers:[W]}))}function ce(e,t){let n=e.lastMessageSummary;if(n!==void 0&&n.kind!=="text")return I(C(e,n,t));let i=(n?.kind==="text"?n.text:e.lastMessagePreview).trim();if(i==="")return I(t.labels.emptyPreview);let r=e.lastMessageMention?.atUsersName;return $(ha(i,{mention:e.lastMessageMention===void 0?void 0:{...e.lastMessageMention,atUserIds:[...e.lastMessageMention.atUserIds]},resolveName:o=>t.resolveName(e.ref,o,r?.[o]),selfId:t.accountId,atAllDisplay:j$1(t.locale),matchers:[W]}))}function C(e,t,n){return h(pe(t),{locale:n.locale,selfId:n.accountId,resolveName:i=>n.resolveName(e.ref,i)})}function me(e){return e.lastMessageSummary?.kind==="system"||e.lastMessageSenderId==="system"||e.lastMessageSystemEvent!==void 0}function ue(e,t){return e.lastMessageSummary?.kind==="system"?C(e,e.lastMessageSummary,t):e.lastMessageSystemEvent===void 0?e.lastMessagePreview.trim()||t.labels.emptyPreview:C(e,{kind:"system",system:{eventType:e.lastMessageSystemEvent,...e.lastMessageSystemTargetsSelf===true?{targetUserIds:[t.accountId]}:{},...e.lastMessagePreview.trim()===""?{}:{fallbackText:e.lastMessagePreview.trim()}}},t)}function fe(e,t){let n=e.lastMessageSenderId;return e.ref.conversationType!=="group"&&e.ref.conversationType!=="channel"||n===void 0||n===""||n==="system"?"":`${n===t.accountId?t.labels.selfSender:t.resolveName(e.ref,n)}: `}function pe(e){return e.kind!=="system"?e:{kind:"system",system:{eventType:e.system.eventType,...e.system.operatorId===void 0?{}:{operatorId:e.system.operatorId},...e.system.targetUserIds===void 0?{}:{targetUserIds:[...e.system.targetUserIds]},...e.system.fallbackText===void 0?{}:{fallbackText:e.system.fallbackText}}}}var ge=160,he=220;function Me(e){let t=Math.max(0,e.showDelayMs??160),n=Math.max(0,e.minimumVisibleMs??220),i=e.now??Date.now,r=e.setTimer??((c,v)=>setTimeout(c,v)),o=e.clearTimer??(c=>clearTimeout(c)),s="",a=false,l=false,d=0,m,f,p=false;function h(){m!==void 0&&o(m),m=void 0;}function u(){f!==void 0&&o(f),f=void 0;}function M(c){l!==c&&(l=c,d=c?i():0,e.onVisibleChange(c));}function R(c){h(),m=r(()=>{m=void 0,!(p||!a||s!==c)&&M(true);},t);}function Y(){if(h(),!l)return;let c=n-Math.max(0,i()-d);if(c<=0){M(false);return}u(),f=r(()=>{f=void 0,!(p||a)&&M(false);},c);}return {update(c,v){if(p)return;if(s!==v){s=v,a=c,h(),u(),M(false),c&&R(v);return}if(a=c,c){u(),!l&&m===void 0&&R(v);return}Y();},dispose(){p||(p=true,a=false,h(),u(),M(false));}}}var b={placeholder:0,thumbnail:1,local:2,original:3};function ve(e){let t;for(let n of e)n.value!==void 0&&(t===void 0||b[n.quality]>b[t.quality])&&(t=n);return t}function ye(e,t){return b[t]>=b[e]}function xe(e){let t=e.getGeneration();return Object.freeze({isCurrent:()=>e.getGeneration()===t})}function D(e){let t=e.getClient();if(t===null)return null;let n=e.getGeneration();return Object.freeze({client:t,isCurrent:()=>e.getGeneration()===n&&e.getClient()===t})}var Q={};a(Q,{acquireMediaBlob:()=>Pe,detectImageMime:()=>K,detectVideoMime:()=>z,loadCachedImageObjectUrl:()=>Te,loadCachedMediaAlbumItemObjectUrl:()=>Le,loadCachedVideoObjectUrl:()=>Se,loadFileObjectUrl:()=>ke,loadImageObjectUrl:()=>Ae,loadMediaAlbumItemObjectUrl:()=>we,loadVideoObjectUrl:()=>be,loadVoiceBytes:()=>Re,prepareLocalMediaPreview:()=>Ce});function S(e,t){if(e.conversationType!=="supergroup")return {conversation:{conversationType:e.conversationType,conversationId:e.conversationId},messageId:e.id,...t===void 0?{}:{itemIndex:t}}}async function P(e,t,n,i){let r=e.getClient(),o=S(t,i);if(r===null||o===void 0)throw new Error("media download unavailable");let s=n===void 0?void 0:r.media.subscribe(a=>{let l=a.find(d=>d.direction==="download"&&d.messageId===o.messageId&&d.itemIndex===i&&d.ref.conversationType===o.conversation.conversationType&&d.ref.conversationId===o.conversation.conversationId);l!==void 0&&n(l.percent);});try{return await r.media.download(o)}finally{s?.();}}function Ie(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="IM_SDK_MEDIA_DOWNLOAD_CANCELED"}async function Ce(e,t){let n=e.getClient();if(n===null)return null;let i=e.getGeneration(),r=await n.media.prepareLocalPreview(t);return r===null||e.getGeneration()!==i?null:r}function K(e){return e.length>=3&&e[0]===255&&e[1]===216&&e[2]===255?"image/jpeg":e.length>=8&&e[0]===137&&e[1]===80&&e[2]===78&&e[3]===71?"image/png":e.length>=6&&e[0]===71&&e[1]===73&&e[2]===70?"image/gif":e.length>=12&&e[8]===87&&e[9]===69&&e[10]===66&&e[11]===80?"image/webp":null}async function w(e){let t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=K(t);return n===null?null:URL.createObjectURL(e.type===n?e:e.slice(0,e.size,n))}function z(e){return e.length>=4&&e[0]===26&&e[1]===69&&e[2]===223&&e[3]===163?"video/webm":(e.length>=8&&e[4]===102&&e[5]===116&&e[6]===121&&e[7]===112,"video/mp4")}function Pe(e,t,n){return e.acquireMediaBlob({conversationType:t.conversationType,conversationId:t.conversationId,messageId:t.id,...n===void 0?{}:{itemIndex:n}})}async function Re(e,t,n){let i=e.getClient(),r=t.body.voice;if(i===null||r===void 0)return null;let o=e.getSelfVoiceBytes(t.id);if(o!==void 0)return o;let s=e.getGeneration();try{let a=new Uint8Array(await(await P(e,t)).arrayBuffer());return a.length===0?(e.getGeneration()===s&&n.setNote(n.t("media.voiceLoadEmpty")),null):a}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.voiceLoadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}async function be(e,t,n,i){let r=e.getClient(),o=t.body.video;if(r===null||o===void 0)return null;let s=e.getGeneration();try{let a=await P(e,t,i);if(a.size===0)return e.getGeneration()===s&&n.setNote(n.t("media.videoOpenEmpty")),null;let l=URL.createObjectURL(a);return e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.videoLoadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}async function Se(e,t){let n=e.getClient(),i=S(t);if(n===null||i===void 0||t.body.video===void 0)return null;let r=e.getGeneration();try{let o=await n.media.getCached(i);if(o===null||o.size===0||e.getGeneration()!==r)return null;let s=new Uint8Array(await o.slice(0,12).arrayBuffer()),a=o.type||z(s);return e.getGeneration()!==r?null:URL.createObjectURL(o.type===a?o:o.slice(0,o.size,a))}catch{return null}}async function we(e,t,n,i,r){let o=e.getClient(),s=t.body.mediaAlbum?.items[n];if(o===null||s===void 0)return null;let a=s.kind==="video",l=e.getGeneration();try{let d=await P(e,t,r,n);if(a&&d.size===0)return e.getGeneration()===l&&i.setNote(i.t("media.videoOpenEmpty")),null;let m=a?URL.createObjectURL(d):await w(d);return m===null?(e.getGeneration()===l&&i.setNote(i.t("media.imageInvalid",{size:d.size})),null):e.getGeneration()!==l?(URL.revokeObjectURL(m),null):m}catch(d){return e.getGeneration()===l&&!Ie(d)&&i.setNote(i.t(a?"media.videoLoadFailed":"media.imageLoadFailed",{reason:d instanceof Error?d.message:String(d)})),null}}async function Le(e,t,n){let i=e.getClient(),r=t.body.mediaAlbum?.items[n],o=S(t,n);if(i===null||o===void 0||r===void 0||!/^https?:\/\//i.test(r.url))return null;let s=e.getGeneration();try{let a=await i.media.getCached(o);if(a===null||a.size===0||e.getGeneration()!==s)return null;let l=r.kind==="video"?URL.createObjectURL(a):await w(a);return l===null?null:e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch{return null}}async function Ae(e,t,n){let i=e.getClient(),r=t.body.image;if(i===null||r===void 0)return null;let o=e.getGeneration();try{let s=await P(e,t),a=await w(s);return a===null?(e.getGeneration()===o&&n.setNote(n.t("media.imageInvalid",{size:s.size})),null):e.getGeneration()!==o?(URL.revokeObjectURL(a),null):a}catch(s){return e.getGeneration()===o&&n.setNote(n.t("media.imageLoadFailed",{reason:s instanceof Error?s.message:String(s)})),null}}async function Te(e,t){let n=e.getClient(),i=S(t);if(n===null||i===void 0||t.body.image===void 0)return null;let r=e.getGeneration();try{let o=await n.media.getCached(i);if(o===null||o.size===0||e.getGeneration()!==r)return null;let s=await w(o);return s===null?null:e.getGeneration()!==r?(URL.revokeObjectURL(s),null):s}catch{return null}}async function ke(e,t,n,i){let r=e.getClient(),o=t.body.file;if(r===null||o===void 0)return null;let s=e.getGeneration();try{let a=await P(e,t,i);if(a.size===0)return e.getGeneration()===s&&n.setNote(n.t("media.fileDownloadEmpty")),null;let l=URL.createObjectURL(a);return e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch(a){return e.getGeneration()===s&&n.setNote(n.t("media.fileDownloadFailed",{reason:a instanceof Error?a.message:String(a)})),null}}var q={};a(q,{markReadUpTo:()=>Ue});function Ue(e,t,n,i){let r=D(e);if(r===null||t.conversationId===""||n==="")return;let o=r.client.conversations.list().find(a=>a.id===t.conversationId&&a.type===t.conversationType);if(o?.manuallyUnread===true&&o.unreadCount<=0){r.client.conversations.markConversationRead(t).catch(a=>{r.isCurrent()&&e.getDiagnostics().record("warn","chat-kit","conversation","clear-manual-unread-skipped",()=>({conversation:t,error:{message:"\u6E05\u9664\u624B\u5DE5\u672A\u8BFB\u63D0\u9192\u5931\u8D25",data:a}}));});return}if(o?.type==="group"&&o.unreadCount<=0)return;let s=i.getConversationHandle();s===void 0||s.ref.conversationId!==t.conversationId||s.ref.conversationType!==t.conversationType||s.markRead(n).catch(a=>{r.isCurrent()&&i.getConversationHandle()===s&&e.getDiagnostics().record("warn","chat-kit","message","mark-read-skipped",()=>({conversation:t,data:{messageId:n},error:{message:"markRead \u8DF3\u8FC7",data:a}}));});}function Ee(e){return e.deletedForEveryone!==void 0?"hidden":e.recalled!==void 0?"recalled":"content"}function Oe(e,t){if(t.length===0)return [{text:e,hit:false}];let n=[],i=0;for(let[r,o]of t)r>i&&n.push({text:e.slice(i,r),hit:false}),n.push({text:e.slice(r,o),hit:true}),i=o;return i<e.length&&n.push({text:e.slice(i),hit:false}),n}var Ne=/\b(?:https?:\/\/|www\.)[^\s<>"')】]+/gi,De=/\b(?:https?:\/\/|www\.)/i,Fe=/[),.!?;:,。!?;:、)】]+$/u;function J(e){let t=/^www\./i.test(e)?`https://${e}`:e;try{let n=new URL(t);return n.protocol==="http:"||n.protocol==="https:"?n.href:void 0}catch{return}}function _e(e){return De.test(e)}function Ge(){return e=>{let t=[];for(let n of e.matchAll(Ne)){if(n.index===void 0)continue;let i=n[0].replace(Fe,"");if(i==="")continue;let r=J(i);r!==void 0&&t.push({start:n.index,end:n.index+i.length-1,segment:{kind:"link",text:i,href:r}});}return t}}function g(e,t){if(!Number.isFinite(e)||e<=0)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${t} \u5FC5\u987B\u662F\u5927\u4E8E 0 \u7684\u6709\u9650\u6570`)}function Ve(e){if(g(e.fallbackAspectRatio,"fallbackAspectRatio"),!Array.isArray(e.rules)||e.rules.length===0)throw new Error("\u5A92\u4F53\u5C55\u793A\u7B56\u7565 rules \u4E0D\u80FD\u4E3A\u7A7A");let t=new Set;e.rules.forEach((n,i)=>{let r=`rules[${i}]`;if(n.id.trim()==="")throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.id \u4E0D\u80FD\u4E3A\u7A7A`);if(t.has(n.id))throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565\u89C4\u5219 id \u91CD\u590D\uFF1A${n.id}`);if(t.add(n.id),n.minAspectRatio!==void 0&&(!Number.isFinite(n.minAspectRatio)||n.minAspectRatio<0))throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.minAspectRatio \u5FC5\u987B\u662F\u5927\u4E8E\u7B49\u4E8E 0 \u7684\u6709\u9650\u6570`);if(n.maxAspectRatio!==void 0&&g(n.maxAspectRatio,`${r}.maxAspectRatio`),n.minAspectRatio!==void 0&&n.maxAspectRatio!==void 0&&n.minAspectRatio>=n.maxAspectRatio)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r} \u7684\u5BBD\u9AD8\u6BD4\u4E0B\u754C\u5FC5\u987B\u5C0F\u4E8E\u4E0A\u754C`);if(g(n.preferredWidth,`${r}.preferredWidth`),g(n.minWidth,`${r}.minWidth`),g(n.maxWidth,`${r}.maxWidth`),g(n.minHeight,`${r}.minHeight`),g(n.maxHeight,`${r}.maxHeight`),n.minWidth>n.preferredWidth||n.preferredWidth>n.maxWidth)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.preferredWidth \u5FC5\u987B\u4F4D\u4E8E minWidth \u548C maxWidth \u4E4B\u95F4`);if(n.minHeight>n.maxHeight)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.minHeight \u4E0D\u80FD\u5927\u4E8E maxHeight`);if(typeof n.allowUpscale!="boolean")throw new TypeError(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.allowUpscale \u5FC5\u987B\u662F boolean`);if(n.fit!=="cover"&&n.fit!=="contain")throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565 ${r}.fit \u53EA\u652F\u6301 cover \u6216 contain`)});}function Be(e){let{intrinsicWidth:t,intrinsicHeight:n,availableWidth:i,policy:r}=e;g(i,"availableWidth"),Ve(r);let o=Number.isFinite(t)&&Number.isFinite(n)&&t>0&&n>0,s=o?t/n:r.fallbackAspectRatio,a=r.rules.find(u=>{let M=u.minAspectRatio===void 0||s>=u.minAspectRatio,R=u.maxAspectRatio===void 0||s<u.maxAspectRatio;return M&&R});if(a===void 0)throw new Error(`\u5A92\u4F53\u5C55\u793A\u7B56\u7565\u6CA1\u6709\u5339\u914D\u5BBD\u9AD8\u6BD4 ${s}`);let l=!a.allowUpscale&&o?Math.min(a.preferredWidth,t):a.preferredWidth,d=Math.min(i,a.maxWidth,Math.max(a.minWidth,l)),m=Math.max(1,Math.round(d)),f=m/s,p=Math.min(a.maxHeight,Math.max(a.minHeight,f)),h=Math.max(1,Math.round(p));return {width:m,height:h,aspectRatio:m/h,sourceAspectRatio:s,ruleId:a.id,fit:a.fit,aspectClamped:p!==f}}function He(e,t,n,i){if(!Number.isFinite(e)||!Number.isFinite(t)||e<=0||t<=0)return null;let r=Math.min(n/e,i/t,1);return {width:`${Math.max(1,Math.round(e*r))}px`,aspectRatio:`${e} / ${t}`}}function je(e){if(!Number.isFinite(e)||e<=0)return "0:00";let t=Math.floor(e),n=Math.floor(t/3600),i=Math.floor(t%3600/60),r=t%60,o=s=>s.toString().padStart(2,"0");return n>0?`${n}:${o(i)}:${o(r)}`:`${i}:${o(r)}`}function We(e){if(!Number.isFinite(e)||e<=0)return "0 B";let t=["B","KB","MB","GB","TB"],n=Math.min(t.length-1,Math.floor(Math.log(e)/Math.log(1024))),i=e/1024**n;return `${n===0?i:Math.round(i*10)/10} ${t[n]}`}function $e(e){let t=e.lastIndexOf(".");return t>-1&&t<e.length-1?e.slice(t+1).toLowerCase():""}var Ke=4;function ze(e){let t=Math.min(Math.max(e/1e3,0)/10,1);return Math.round(22+24*t)}function Qe(e,t){if(e.length===0)return Array.from({length:t},()=>0);let n=[],i=(e.length-1)/Math.max(1,t-1);for(let r=0;r<t;r+=1){let o=r*i,s=Math.round(o),a=e[Math.max(0,s-1)]??0,l=e[Math.min(e.length-1,s)]??0,d=e[Math.min(e.length-1,s+1)]??0;n.push((a+l+d)/3);}return n}function qe(e,t){let n=2166136261;for(let r=0;r<e.length;r+=1)n^=e.charCodeAt(r),n=Math.imul(n,16777619);let i=[];for(let r=0;r<t;r+=1)n=Math.imul(n^n>>>15,2246822519)>>>0,i.push(90+n%111);return i}
2
+ export{_e as A,Ge as B,Be as C,He as D,je as E,We as F,$e as G,Ke as H,ze as I,Qe as J,qe as K,y as a,x as b,ee as c,N as d,O as e,V as f,ne as g,B as h,re as i,ie as j,j as k,oe as l,ae as m,se as n,ge as o,he as p,Me as q,ve as r,ye as s,xe as t,D as u,Q as v,q as w,Ee as x,Oe as y,J as z};