k2-im 0.1.12 → 0.1.13
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.js +1 -1
- package/dist/chat-kit-vue.js +1 -1
- package/dist/chat-kit.js +1 -1
- package/dist/{chunk-ZV7BEDOX.js → chunk-3IPQMVX7.js} +1 -1
- package/dist/chunk-CLQGUCX2.js +1 -0
- package/dist/{chunk-J77VLO7C.js → chunk-LEJRPEOW.js} +1 -1
- package/dist/{chunk-6QR5GVQ3.js → chunk-OWCMN7YM.js} +2 -2
- package/dist/chunk-P5N4THAS.js +2 -0
- package/dist/{chunk-MKV7J6WB.js → chunk-RBUTQQZS.js} +1 -1
- package/dist/{chunk-TQF5HUEX.js → chunk-UJCCXFRT.js} +1 -1
- package/dist/i18n.js +1 -1
- package/dist/index.d.ts +44 -1
- package/dist/index.js +1 -1
- package/dist/sdk.d.ts +44 -1
- package/dist/sdk.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-BO5YFCS4.js +0 -1
- package/dist/chunk-ZAIRD3YB.js +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import {c as c$1}from'./chunk-
|
|
1
|
+
import {c as c$1}from'./chunk-UJCCXFRT.js';import {o}from'./chunk-CLQGUCX2.js';var w=864e5,P=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function u(e){return e!=null&&Number.isFinite(e)&&e>0&&!Number.isNaN(new Date(e).getTime())}function v(e,n){if(u(e))return e;if(u(n))return n}function b(e,n){return v(e,n)}function m(e){if(!u(e))return "";let n=new Date(e);return `${n.getFullYear()}-${n.getMonth()+1}-${n.getDate()}`}function h(e,n){return u(e)?u(n)?m(e)!==m(n):true:false}function F(e,n){return T(e,n,"conversation")}function L(e,n){return T(e,n,"separator")}function T(e,n,r){if(!u(e))return "";let t=n.now??new Date;if(Number.isNaN(t.getTime()))return "";let o=new Date(e),a=y(t)-y(o),i=c$1(n.locale);return o.getFullYear()!==t.getFullYear()?A(o):a===0?r==="conversation"?k(o):i.today:a===1?i.yesterday:a>=2&&a<=6?x(o,i):D(o)}function y(e){return Date.UTC(e.getFullYear(),e.getMonth(),e.getDate())/w}function x(e,n){return n.weekdays[P[e.getDay()]]}function k(e){return `${c(e.getHours())}:${c(e.getMinutes())}`}function A(e){return `${e.getFullYear()}/${c(e.getMonth()+1)}/${c(e.getDate())}`}function D(e){return `${c(e.getMonth()+1)}/${c(e.getDate())}`}function c(e){return String(e).padStart(2,"0")}function O(e){if(e.markers.length===0)return null;let n=e.viewportTop+e.overlayTop;if(e.markers[0].top>n+1)return null;let r=0;for(let d=0;d<e.markers.length&&!(e.markers[d].top>n+1);d+=1)r=d;let t=e.markers[r],o=n+e.overlayHeight,a=e.markers.filter(d=>d.top<o+1&&d.top+d.height>n-1).at(-1),i=a===void 0?0:Math.max(0,Math.min(a.top+a.height,o)-Math.max(a.top,n)),s=a===void 0?1:Math.max(1,Math.min(a.height,e.overlayHeight)),l=Math.min(1,i/s);return {key:t.key,label:t.label,inlineOpacity:1-l,...a===void 0?{}:{inlineDateKey:a.key}}}var C={text:"text",image:"image",video:"video",voice:"voice",file:"file",sticker:"sticker",contact:"contact",miniProgram:"miniProgram",game:"game",transfer:"transfer",redPacket:"redPacket",call:"call",system:"system",unknown:"unknown"};function S(e){switch(e.contentType){case "text":return typeof e.body.text=="string";case "image":return e.body.image!==void 0&&typeof e.body.image.url=="string";case "video":return e.body.video!==void 0&&typeof e.body.video.url=="string";case "voice":return e.body.voice!==void 0;case "file":return e.body.file!==void 0;case "sticker":return e.body.sticker!==void 0;case "contact":return e.body.contact!==void 0;case "miniProgram":return e.body.miniProgram!==void 0&&typeof e.body.miniProgram.appId=="string";case "transfer":return e.body.transfer!==void 0&&typeof e.body.transfer.serialNumber=="string";case "redPacket":{let n=e.body.redPacket;return n!==void 0&&n.packetId.trim()!==""&&(n.packetType===1||n.packetType===2||n.packetType===3||n.packetType===4)}case "call":return e.body.call!==void 0&&(e.body.call.callKind==="audio"||e.body.call.callKind==="video")&&typeof e.body.call.durationMs=="number";case "game":{let n=e.body.game;return n?.gameType==="dice"?Number.isInteger(n.value)&&n.value>=1&&n.value<=6:n?.gameType==="rock-paper-scissors"&&Number.isInteger(n.value)&&n.value>=1&&n.value<=3}case "system":return e.body.system!==void 0;case "unknown":return e.body.unknown!==void 0}}function I(e){return e.encryption.decryptFailed===true?"decrypt-failed":S(e)?e.contentType==="sticker"?o(e.body.sticker.imageType):C[e.contentType]:"unknown"}function _(e){let n=[...e.leadingItems??[]],r=e.entryUnread.state==="located"?e.entryUnread:null,t,o=null,a=false;for(let i of e.messages){let s=b(i.createdAt,i.serverTime),l=s!==void 0&&h(s,t);s!==void 0&&l&&n.push({kind:"date-separator",key:`date-${m(s)}-${i.id}`,label:e.formatDate(s)}),t=s,!a&&r!==null&&i.id===r.firstMessageId&&(n.push({kind:"entry-unread",key:`entry-unread-${i.id}`,...r.count===void 0?{}:{count:r.count}}),a=true);let d=e.beforeMessageItems?.(i)??[];if(n.push(...d),I(i)==="system"){n.push({kind:"system",key:i.id,message:i}),o=null;continue}n.push({kind:"message",key:`message-${i.id}`,message:i,firstOfRun:l||i.senderId!==o}),o=i.senderId;}return n}function U(e){let n=e.targetTop-e.viewportTop,r=e.currentScrollTop+n-(e.viewportHeight-e.targetHeight)/2,t=Math.max(0,e.scrollHeight-e.viewportHeight);return Math.min(t,Math.max(0,r))}function j(e){return e!==null&&e.clientWidth>0&&e.clientHeight>0}function G(e){return e.locatedAt<=0||e.duration<0||e.now<e.locatedAt?false:e.now-e.locatedAt<=e.duration}function q(e){return !Number.isFinite(e.topThreshold)||e.topThreshold<0?false:e.currentScrollTop<e.previousScrollTop&&e.currentScrollTop<=e.topThreshold}function H(e,n){return e.find(r=>r.bottom>n.top&&r.top<n.bottom)??e[0]}function f(e){return e.anchorTop??e.top}function B(e,n){let r=H(e,n);return r===void 0?void 0:{id:r.id,offset:f(r)-n.top}}function J(e,n,r){if(e===void 0)return;let t=n.find(o=>o.id===e.id);return t!==void 0&&t.bottom>r.top&&t.top<r.bottom?{id:e.id,offset:f(t)-r.top}:B(n,r)??e}function V(e,n,r){if(e===void 0)return;let t=n.find(o=>o.id===e.id);return t===void 0?void 0:f(t)-r.top-e.offset}function Q(e,n,r=3){return !Number.isFinite(r)||r<=0?[]:e.filter(t=>t.bottom>n.top&&t.top<n.bottom).slice(0,Math.floor(r)).map(t=>({id:t.id,offset:f(t)-n.top}))}function X(e,n,r){for(let t of e){let o=V(t,n,r);if(o!==void 0)return o}}function Z(e){return e.sameConversation&&!e.isHistoryWindow&&!e.isLocating&&!e.isLocateProtected&&e.userKeptLatestIntent}function ee(e){return e.isPageVisible&&!e.isHistoryWindow&&!e.isLocating&&!e.isLocateProtected&&(e.isOwnMessage||e.isAtBottom)}function ne(e){return e.isLoadingOlder&&e.previousTailId!==void 0&&e.previousTailId!==e.currentTailId&&e.previousMessageIds.includes(e.currentTailId)}function re(e,n){return e!==void 0&&!n.has(e)}async function te(e,n){let r=0;for(;e()&&!(await n()<=0);)r+=1;return r}function oe(e){return e.hasMoreHistory&&Number.isFinite(e.scrollHeight)&&Number.isFinite(e.clientHeight)&&e.scrollHeight>0&&e.clientHeight>0&&e.scrollHeight<=e.clientHeight}function ie(e){return e.isHistoryWindow&&!e.isPageSettling&&e.isAtBottom&&(e.currentScrollTop>e.previousScrollTop||e.allowStationaryBoundary===true)}function M(e){return !e.isPageVisible||!e.isAtBottom||e.isHistoryWindow}function ae(e){let n=Math.max(0,e.margin);return e.messageTop<e.viewportBottom-n&&e.messageBottom>e.viewportTop+n}function le(e){let n=new Set;function r(s){return s===n.size?false:(e?.(n.size),true)}function t(s){let l=n.size;for(let d of s)d!==""&&n.add(d);return r(l)}function o(s,l){return M(l)&&t(s)}function a(s){let l=n.size;for(let d of s)n.delete(d);return r(l)}function i(){let s=n.size;return n.clear(),r(s)}return {get count(){return n.size},add:t,trackRemote:o,acknowledgeVisible:a,clear:i}}export{M as A,ae as B,le as C,v as a,b,m as c,h as d,F as e,L as f,O as g,I as h,_ as i,U as j,j as k,G as l,q as m,H as n,B as o,J as p,V as q,Q as r,X as s,Z as t,ee as u,ne as v,re as w,te as x,oe as y,ie as z};
|