k2-im 0.1.29 → 0.1.31
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.
- package/dist/browser.js +1 -1
- package/dist/chat-kit-pinia.d.ts +217 -22
- package/dist/chat-kit-pinia.js +1 -1
- package/dist/chat-kit-vue.d.ts +69 -14
- package/dist/chat-kit-vue.js +1 -1
- package/dist/chat-kit.d.ts +312 -24
- package/dist/chat-kit.js +1 -1
- package/dist/chunk-7463JUEH.js +2 -0
- package/dist/chunk-CIY4WBFJ.js +2 -0
- package/dist/chunk-MKKCUSUP.js +1 -0
- package/dist/chunk-O23EXDM5.js +2 -0
- package/dist/chunk-PJVCTNC5.js +1 -0
- package/dist/chunk-SMWPQSGR.js +7 -0
- package/dist/chunk-UFGEIUBV.js +1 -0
- package/dist/i18n.d.ts +56 -7
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +318 -25
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +169 -19
- package/dist/sdk.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-AFLOPH2O.js +0 -1
- package/dist/chunk-AULYARAI.js +0 -2
- package/dist/chunk-BZFBUHDE.js +0 -1
- package/dist/chunk-HZD2QAZB.js +0 -2
- package/dist/chunk-R6BJQWPW.js +0 -1
- package/dist/chunk-TKWU3IO7.js +0 -7
- package/dist/chunk-XICYFDN4.js +0 -2
package/dist/chat-kit.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{
|
|
1
|
+
export{q as DEFAULT_LOADING_MINIMUM_VISIBLE_MS,p as DEFAULT_LOADING_SHOW_DELAY_MS,v as MINI_PROGRAM_GAME_PREVIEW_FALLBACK_HEIGHT,u as MINI_PROGRAM_GAME_PREVIEW_FALLBACK_WIDTH,e as MINI_PROGRAM_LANG_NUMBERS,M as SPIKE_STEP,I as calculateMediaBox,t as canPromoteMediaPresentationSource,z as captureRuntimeClientOperation,y as captureRuntimeOperation,n as channelMiniProgramRelKey,x as createConversationPrefetchController,r as createDelayedLoadingIndicator,G as createLinkMatcher,f as csvIncludes,d as decideChannelMiniProgramRelOpen,K as formatFileSize,J as formatMediaDuration,L as getFileExtension,F as hasLinkCandidate,D as highlightSegments,a as isMiniProgramShowTypeOpenable,A as mediaService,E as normalizeLinkHref,P as placeholderWaveform,B as readService,O as resampleWaveform,s as resolveBestMediaPresentationSource,h as resolveChannelMiniProgramRelIcon,g as resolveChannelMiniProgramRelName,j as resolveChannelMiniProgramRelOpenSurface,i as resolveChannelMiniProgramRelUrl,k as resolveChannelPinnedGameCopy,o as resolveConversationListPresentation,H as resolveMediaPresentation,c as resolveMiniProgramFloatLinkUrl,w as resolveMiniProgramGamePreviewLayout,b as resolveMiniProgramOpenUrl,C as resolveQuotedMessagePresentation,m as resolveVisibleChannelMiniProgramRels,l as sortChannelMiniProgramFloatingItems,N as spikeCountForDuration}from'./chunk-7463JUEH.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,N as MAX_BATCH_FILES,a as MAX_RECENT_EMOJI_COUNT,g as UNICODE_EMOJI_CATALOG,M as blockReasonForChannelSession,L as blockReasonForChannelState,T as blockReasonForGroupState,W as blockReasonForSession,G as canEditMessage,w as canPinChannelMessage,v as canPinGroupMessage,x as canPinMessage,F as canRecallMessage,da as cancelMediaUpload,R as classifyGifFile,Q as classifyMediaFile,s as countUnreadConversations,u as createChatRuntime,p as createEmojiMatcher,I as decideConversationAction,K as decideMemberTargetAction,J as decideMessageAction,l as emojiAssetUrl,n as emojiUrlByCode,Da as fetchConversationFileBatch,Ea as fetchConversationImageBatch,Ba as fetchConversationMessageBatch,Fa as fetchConversationVideoBatch,Ga as fetchConversationVoiceBatch,Ha as fetchNextConversationSearchBatch,r as formatConversationUnreadBadge,ga as forwardService,o as hasEmojiCandidate,S as isGifFile,y as isPinnedMessageProtected,_ as isVoiceStorageConfigured,O as mediaBatchBudgetBytes,la as messageService,e as parseUnicodeEmojiCode,qa as pinnedMessageService,d as prependRecentEmoji,Aa as profileService,Z as replaceInterruptedMediaFile,U as requiresConversationEncryption,B as resolveChannelMemberAvatarUrl,A as resolveChannelMemberDisplayName,k as resolveEmojiToken,E as resolveFriendDisplayName,ra as resolveImProfileAccessDestination,z as resolveMemberDisplayName,t as resolveMessageNotificationDecision,D as resolvePublicNickname,C as resolveSenderAvatarUrl,q as resolveStandaloneEmojiMessage,h as resolveUnicodeEmoji,ea as retryMessage,P as runMediaSendBatch,ca as sendAsFilesBatch,H as sendBlockReasonForDecision,aa as sendMediaAlbum,Y as sendMediaFile,ba as sendMediaFilesBatch,X as sendText,$ as sendVoice,V as supportsConversationMention,f as unicodeEmojiTextFromCode}from'./chunk-PJVCTNC5.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-MKKCUSUP.js';import'./chunk-UFGEIUBV.js';import'./chunk-O23EXDM5.js';import'./chunk-SMWPQSGR.js';export{va as canTransmit,ta as canTransmitByType,ua as canTransmitContent,sa as requiresForwardTypeConfirmation}from'./chunk-CIY4WBFJ.js';import'./chunk-WOT6VMZA.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import {p}from'./chunk-PJVCTNC5.js';import {e,a as a$1}from'./chunk-MKKCUSUP.js';import {j as j$1,h}from'./chunk-UFGEIUBV.js';import {la}from'./chunk-CIY4WBFJ.js';import {a}from'./chunk-WOT6VMZA.js';function te(e){return e==="default"||e==="board-game-link"||e==="game-preview"}function re(e){return (e??"").trim().replace(/^[?&]+/,"").trim()}function ie(e,t){let n=re(t);return e===""||n===""?e:e+(e.includes("?")?"&":"?")+n}function N(e){return e===""||e.startsWith("/")||e.startsWith("?")||e.startsWith("&")?false:e.includes(".")}function oe(e){return e===""?"":/^https?:\/\//i.test(e)?e:`https://${e}`}function P(e){return ie(ae(e),e.gamePath)}function ae(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:N(n)?`https://${n}`:i}function C(e){let t=e.domain?.trim()??"",n=e.suffixAddress?.trim()??"",i=e.h5Url?.trim()??"";return /^https?:\/\//i.test(n)?n:N(n)?`https://${n}`:t!==""?oe(P({domain:t,suffixAddress:n,h5Url:i})):/^https?:\/\//i.test(i)?i:N(i)?`https://${i}`:""}function se(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 le(e,t){if(e.configType==="float-link"){let r=C({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=P({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url});return n===""||i===""?{kind:"refuse"}:{kind:"open-game",game:se(e,t.name),currencyType:t.currentCurrencyType??""}}var D={"zh-CN":1,"zh-TW":2,"en-US":3,"vi-VN":4,"th-TH":5};function G(e,t){let n=String(t).trim();return n===""||n==="0"?false:(e??"").split(",").map(i=>i.trim()).filter(i=>i!=="").includes(n)}function V(e){return e in D?e:"en-US"}function W(e,t){let i={"zh-CN":e.nameZhHans,"zh-TW":e.nameZhHant,"en-US":e.nameEn,"vi-VN":e.nameVi,"th-TH":e.nameTh}[V(t)]?.trim()??"";return i!==""?i:[e.nameEn,e.nameZhHans,e.nameZhHant,e.nameVi,e.nameTh].map(r=>r?.trim()??"").find(r=>r!=="")??""}function de(e){return e.icon?.trim()||e.iconSmall?.trim()||e.iconMedium?.trim()||e.iconLarge?.trim()||""}function j(e){return P({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})}function K(e){return (e.appId?.trim()??"")!==""}function ce(e){return e.configType==="float-game"?K(e)&&j(e)!=="":e.configType==="float-link"?C({domain:e.domain,suffixAddress:e.suffixAddress,h5Url:e.h5Url})!=="":false}function ue(e){return e.configType==="float-game"?"half":"page"}function me(e){let t=W(e.rel,e.locale);return {title:e.channelDescription?.trim()??"",tag:t,name:t}}function $(e){return [...e].sort((t,n)=>t.configType===n.configType?0:t.configType==="float-game"?1:n.configType==="float-game"?-1:0)}function fe(e,t){if(e===void 0)return {pinnedGame:null,floatingItems:[]};let n=D[V(t.locale)],i=e.filter(r=>r.configType!=="unknown"&&G(r.langTypes,n)&&G(r.currencyTypes,t.currencyType??""));return {pinnedGame:i.find(r=>r.configType==="pinned-game"&&K(r))??null,floatingItems:$(i.filter(r=>(r.configType==="float-link"||r.configType==="float-game")&&ce(r)))}}function pe(e,t){return [e,t.configType,t.appId??"",t.suffixAddress??t.h5Url??""].join("|")}var z=p();function ge(e$1,t){let n=t.suppressDraft===true?null:e$1.draft,i=n?.text.trim()??"",r,o="",s="";return n!==null?r=i===""?[]:Me(e$1,i,t.locale):ye(e$1)?r=x(Ie(e$1,t)):e$1.lastMessageSummary?.kind==="channel-moderation-deleted"||e$1.lastMessageDeletedForEveryone!==void 0?r=x(R(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=x(R(e$1,e$1.lastMessageSummary?.kind==="recalled"?e$1.lastMessageSummary:{kind:"recalled",by:e$1.lastMessageRecalled?.by??""},t)):(o=Pe(e$1,t),s=e$1.mentionUnreadCount>0?t.labels.mentionBadge:"",r=ve(e$1,t)),{preview:`${s}${o}${r.map(l=>l.text).join("")}`||(n===null?t.labels.emptyPreview:""),previewSegments:r,...he(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 x(e){return [{kind:"text",text:e}]}function he(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 Q(e){return e.map(t=>t.kind==="emoji"?{kind:"emoji",text:t.text,code:t.code}:{kind:t.kind,text:t.text})}function Me(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 Q(la(t,{mention:a,resolveName:l=>o[l]??l,atAllDisplay:j$1(n),matchers:[z]}))}function ve(e,t){let n=e.lastMessageSummary;if(n!==void 0&&n.kind!=="text")return x(R(e,n,t));let i=(n?.kind==="text"?n.text:e.lastMessagePreview).trim();if(i==="")return x(t.labels.emptyPreview);let r=e.lastMessageMention?.atUsersName;return Q(la(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:[z]}))}function R(e,t,n){return h(Ce(t),{locale:n.locale,selfId:n.accountId,resolveName:i=>n.resolveName(e.ref,i)})}function ye(e){return e.lastMessageSummary?.kind==="system"||e.lastMessageSenderId==="system"||e.lastMessageSystemEvent!==void 0}function Ie(e,t){return e.lastMessageSummary?.kind==="system"?R(e,e.lastMessageSummary,t):e.lastMessageSystemEvent===void 0?e.lastMessagePreview.trim()||t.labels.emptyPreview:R(e,{kind:"system",system:{eventType:e.lastMessageSystemEvent,...e.lastMessageSystemTargetsSelf===true?{targetUserIds:[t.accountId]}:{},...e.lastMessagePreview.trim()===""?{}:{fallbackText:e.lastMessagePreview.trim()}}},t)}function Pe(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 Ce(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 xe=160,Re=220;function be(e){let t=Math.max(0,e.showDelayMs??160),n=Math.max(0,e.minimumVisibleMs??220),i=e.now??Date.now,r=e.setTimer??((d,f)=>setTimeout(d,f)),o=e.clearTimer??(d=>clearTimeout(d)),s="",a=false,l=false,c=0,u,g,p=false;function y(){u!==void 0&&o(u),u=void 0;}function h(){g!==void 0&&o(g),g=void 0;}function M(d){l!==d&&(l=d,c=d?i():0,e.onVisibleChange(d));}function m(d){y(),u=r(()=>{u=void 0,!(p||!a||s!==d)&&M(true);},t);}function v(){if(y(),!l)return;let d=n-Math.max(0,i()-c);if(d<=0){M(false);return}h(),g=r(()=>{g=void 0,!(p||a)&&M(false);},d);}return {update(d,f){if(p)return;if(s!==f){s=f,a=d,y(),h(),M(false),d&&m(f);return}if(a=d,d){h(),!l&&u===void 0&&m(f);return}v();},dispose(){p||(p=true,a=false,y(),h(),M(false));}}}var w={placeholder:0,thumbnail:1,local:2,original:3};function Se(e){let t;for(let n of e)n.value!==void 0&&(t===void 0||w[n.quality]>w[t.quality])&&(t=n);return t}function we(e,t){return w[t]>=w[e]}var Ae=280,Le=180;function Te(e){return /^data:image\//i.test(e)?true:/\.(?:png|jpe?g|gif|webp|bmp|avif|heic|heif|svg)(?:[?#]|$)/i.test(e)}function q(e,t){return typeof e=="number"&&Number.isFinite(e)&&e>0?e:t}function Ee(e){let t=e.gamePreviewUrl?.trim()??"";return t===""?{url:"",sourceWidth:280,sourceHeight:180,render:"empty"}:{url:t,sourceWidth:q(e.gamePreviewWidth,280),sourceHeight:q(e.gamePreviewHeight,180),render:e.imageLoadFailed===true||!Te(t)?"document":"image"}}function A(e){return `${e.conversationType}:${e.conversationId}`}function ke(e,t){let n=t===null?null:A(t),i=new Set;return e.filter(r=>{let o=A(r.ref);return r.ref.conversationType!=="group"&&r.ref.conversationType!=="channel"||o===n||i.has(o)?false:(i.add(o),true)}).map((r,o)=>({item:r,index:o})).sort((r,o)=>Number(o.item.pinned)-Number(r.item.pinned)||+(o.item.unreadCount>0)-+(r.item.unreadCount>0)||r.index-o.index).slice(0,20).map(({item:r})=>({conversationType:r.ref.conversationType,conversationId:r.ref.conversationId}))}function Ue(e){let t=false,n=null,i,r=false,o=0,s=false,a,l=new Set,c;function u(m,v,d){let f=`${m}:${v??""}`;f!==a&&(a=f,e.diagnostics?.record("debug","chat-kit","history","conversation-prefetch-state",()=>({conversation:d,data:{phase:m,reason:v,attemptedCount:l.size}})));}function g(){o+=1,r=false,i?.(),i=void 0;}function p(){g(),c?.controller.abort(),c=void 0,s=false,l.clear(),n=null,a=void 0;}function y(){return ke(e.getCandidates(),e.getActiveRef()).filter(m=>!l.has(A(m)))}async function h(){if(r=false,i=void 0,t)return;if(!e.getRunnable()){u("paused","host-not-ready");return}let m=e.getClient();if(m!==n||m===null){M();return}let v=y()[0];if(c!==void 0)return;if(v===void 0){u("exhausted","no-candidates");return}let d={controller:new AbortController,key:A(v)};c=d,s=false,l.add(d.key),u("running",void 0,v);let f=false;try{let S=await m.conversations.prefetchRecent([v],{signal:d.controller.signal});if(c!==d)return;f=S.some(ne=>ne.status==="cancelled"),f&&l.delete(d.key);}catch(S){c===d&&!d.controller.signal.aborted&&e.onError(S);}finally{c===d&&(d.controller.signal.aborted&&l.delete(d.key),c=void 0,s||!f&&!d.controller.signal.aborted?M():u("paused",d.controller.signal.aborted?"host-cancelled":"sdk-cancelled"));}}function M(){if(t)return;let m=e.getClient();if(m!==n&&(p(),n=m),!e.getRunnable()||n===null){g(),c?.controller.abort(),u("paused",n===null?"client-unavailable":"host-not-ready");return}if(c!==void 0){s=true;return}if(r)return;if(y().length===0){u("exhausted","no-candidates");return}r=true,u("scheduled");let v=++o,d=e.scheduleIdle(()=>{r&&v===o&&h();});r&&(i=d);}return {refresh:M,reset:p,dispose(){t=true,p();}}}function Oe(e){let t=e.getGeneration();return Object.freeze({isCurrent:()=>e.getGeneration()===t})}function F(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 X={};a(X,{acquireMediaBlob:()=>Ge,detectImageMime:()=>J,detectVideoMime:()=>Y,loadCachedImageObjectUrl:()=>je,loadCachedMediaAlbumItemObjectUrl:()=>Ve,loadCachedVideoObjectUrl:()=>He,loadFileObjectUrl:()=>Ke,loadImageObjectUrl:()=>We,loadMediaAlbumItemObjectUrl:()=>Be,loadVideoObjectUrl:()=>Fe,loadVoiceBytes:()=>De,prepareLocalMediaPreview:()=>Ne});function L(e,t){if(e.conversationType!=="supergroup")return {conversation:{conversationType:e.conversationType,conversationId:e.conversationId},messageId:e.id,...t===void 0?{}:{itemIndex:t}}}async function b(e,t,n,i){let r=e.getClient(),o=L(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(c=>c.direction==="download"&&c.messageId===o.messageId&&c.itemIndex===i&&c.ref.conversationType===o.conversation.conversationType&&c.ref.conversationId===o.conversation.conversationId);l!==void 0&&n(l.percent);});try{return await r.media.download(o)}finally{s?.();}}function _e(e){return typeof e=="object"&&e!==null&&"code"in e&&e.code==="IM_SDK_MEDIA_DOWNLOAD_CANCELED"}async function Ne(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 J(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 T(e){let t=new Uint8Array(await e.slice(0,12).arrayBuffer()),n=J(t);return n===null?null:URL.createObjectURL(e.type===n?e:e.slice(0,e.size,n))}function Y(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 Ge(e,t,n){return e.acquireMediaBlob({conversationType:t.conversationType,conversationId:t.conversationId,messageId:t.id,...n===void 0?{}:{itemIndex:n}})}async function De(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 b(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 Fe(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 b(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 He(e,t){let n=e.getClient(),i=L(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||Y(s);return e.getGeneration()!==r?null:URL.createObjectURL(o.type===a?o:o.slice(0,o.size,a))}catch{return null}}async function Be(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 c=await b(e,t,r,n);if(a&&c.size===0)return e.getGeneration()===l&&i.setNote(i.t("media.videoOpenEmpty")),null;let u=a?URL.createObjectURL(c):await T(c);return u===null?(e.getGeneration()===l&&i.setNote(i.t("media.imageInvalid",{size:c.size})),null):e.getGeneration()!==l?(URL.revokeObjectURL(u),null):u}catch(c){return e.getGeneration()===l&&!_e(c)&&i.setNote(i.t(a?"media.videoLoadFailed":"media.imageLoadFailed",{reason:c instanceof Error?c.message:String(c)})),null}}async function Ve(e,t,n){let i=e.getClient(),r=t.body.mediaAlbum?.items[n],o=L(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 T(a);return l===null?null:e.getGeneration()!==s?(URL.revokeObjectURL(l),null):l}catch{return null}}async function We(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 b(e,t),a=await T(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 je(e,t){let n=e.getClient(),i=L(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 T(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 b(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 Z={};a(Z,{markReadUpTo:()=>$e});function $e(e,t,n,i){let r=F(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 ze(e){return e.deletedForEveryone!==void 0?"hidden":e.recalled!==void 0?"recalled":"content"}function Qe(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 qe=/\b(?:https?:\/\/|www\.)[^\s<>"')】]+/gi,Je=/\b(?:https?:\/\/|www\.)/i,Ye=/[),.!?;:,。!?;:、)】]+$/u;function ee(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 Xe(e){return Je.test(e)}function Ze(){return e=>{let t=[];for(let n of e.matchAll(qe)){if(n.index===void 0)continue;let i=n[0].replace(Ye,"");if(i==="")continue;let r=ee(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 I(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 en(e){if(I(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&&I(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(I(n.preferredWidth,`${r}.preferredWidth`),I(n.minWidth,`${r}.minWidth`),I(n.maxWidth,`${r}.maxWidth`),I(n.minHeight,`${r}.minHeight`),I(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 nn(e){let{intrinsicWidth:t,intrinsicHeight:n,availableWidth:i,policy:r}=e;I(i,"availableWidth"),en(r);let o=Number.isFinite(t)&&Number.isFinite(n)&&t>0&&n>0,s=o?t/n:r.fallbackAspectRatio,a=r.rules.find(h=>{let M=h.minAspectRatio===void 0||s>=h.minAspectRatio,m=h.maxAspectRatio===void 0||s<h.maxAspectRatio;return M&&m});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,c=Math.min(i,a.maxWidth,Math.max(a.minWidth,l)),u=Math.max(1,Math.round(c)),g=u/s,p=Math.min(a.maxHeight,Math.max(a.minHeight,g)),y=Math.max(1,Math.round(p));return {width:u,height:y,aspectRatio:u/y,sourceAspectRatio:s,ruleId:a.id,fit:a.fit,aspectClamped:p!==g}}function tn(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 rn(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 on(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 an(e){let t=e.lastIndexOf(".");return t>-1&&t<e.length-1?e.slice(t+1).toLowerCase():""}var sn=4;function ln(e){let t=Math.min(Math.max(e/1e3,0)/10,1);return Math.round(22+24*t)}function dn(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,c=e[Math.min(e.length-1,s+1)]??0;n.push((a+l+c)/3);}return n}function cn(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{X as A,Z as B,ze as C,Qe as D,ee as E,Xe as F,Ze as G,nn as H,tn as I,rn as J,on as K,an as L,sn as M,ln as N,dn as O,cn as P,te as a,P as b,C as c,le as d,D as e,G as f,W as g,de as h,j as i,ue as j,me as k,$ as l,fe as m,pe as n,ge as o,xe as p,Re as q,be as r,Se as s,we as t,Ae as u,Le as v,Ee as w,Ue as x,Oe as y,F as z};
|