@kungal/ui-core 2.50.1 → 2.51.0
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/CHANGELOG.md +23 -0
- package/dist/index.cjs +1042 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +329 -3
- package/dist/index.d.ts +329 -3
- package/dist/index.js +1027 -1
- package/dist/index.js.map +1 -1
- package/dist/locale/en.cjs +98 -0
- package/dist/locale/en.cjs.map +1 -1
- package/dist/locale/en.d.cts +1 -1
- package/dist/locale/en.d.ts +1 -1
- package/dist/locale/en.js +98 -0
- package/dist/locale/en.js.map +1 -1
- package/dist/{types-Cgq63U6z.d.cts → types-Dc-w7UpA.d.cts} +112 -0
- package/dist/{types-Cgq63U6z.d.ts → types-Dc-w7UpA.d.ts} +112 -0
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -309,6 +309,104 @@ var zh_CN_default = {
|
|
|
309
309
|
nav: "轮播导航",
|
|
310
310
|
goto: "跳到第 {index} 张"
|
|
311
311
|
},
|
|
312
|
+
chat: {
|
|
313
|
+
deletedUser: "已注销用户",
|
|
314
|
+
you: "你",
|
|
315
|
+
senderPrefix: "{name}:",
|
|
316
|
+
today: "今天",
|
|
317
|
+
yesterday: "昨天",
|
|
318
|
+
unreadDivider: "以下为未读消息",
|
|
319
|
+
edited: "已编辑",
|
|
320
|
+
deletedMessage: "消息已删除",
|
|
321
|
+
photo: "图片",
|
|
322
|
+
album: "{count} 张图片",
|
|
323
|
+
media: "媒体",
|
|
324
|
+
draft: "草稿:",
|
|
325
|
+
messages: "消息",
|
|
326
|
+
empty: "还没有消息",
|
|
327
|
+
loading: "加载中…",
|
|
328
|
+
scrollToBottom: "回到底部",
|
|
329
|
+
scrollToBottomUnread: "回到底部,{count} 条新消息",
|
|
330
|
+
unreadCount: "{count} 条未读消息",
|
|
331
|
+
mentioned: "有人提到了你",
|
|
332
|
+
pinned: "已置顶",
|
|
333
|
+
muted: "已静音",
|
|
334
|
+
photoFrom: "{name} 发送的图片",
|
|
335
|
+
openLink: "打开链接 {url}",
|
|
336
|
+
reactions: "回应",
|
|
337
|
+
reactionCount: "{label},{count} 人",
|
|
338
|
+
back: "返回",
|
|
339
|
+
members: "{count} 位成员"
|
|
340
|
+
},
|
|
341
|
+
chatComposer: {
|
|
342
|
+
placeholder: "发消息…",
|
|
343
|
+
send: "发送",
|
|
344
|
+
save: "保存",
|
|
345
|
+
attach: "添加图片",
|
|
346
|
+
removeAttachment: "移除附件",
|
|
347
|
+
retryAttachment: "上传失败,点击重试",
|
|
348
|
+
replyTo: "回复 {name}",
|
|
349
|
+
quoteFrom: "引用 {name}",
|
|
350
|
+
editing: "编辑消息",
|
|
351
|
+
cancelReply: "取消回复",
|
|
352
|
+
cancelEdit: "取消编辑",
|
|
353
|
+
remaining: "还可输入 {count} 字",
|
|
354
|
+
overLimit: "超出 {count} 字",
|
|
355
|
+
dropHint: "松开以添加图片"
|
|
356
|
+
},
|
|
357
|
+
chatMenu: {
|
|
358
|
+
label: "消息操作",
|
|
359
|
+
reply: "回复",
|
|
360
|
+
quote: "引用",
|
|
361
|
+
copy: "复制",
|
|
362
|
+
copied: "已复制",
|
|
363
|
+
edit: "编辑",
|
|
364
|
+
pin: "置顶",
|
|
365
|
+
unpin: "取消置顶",
|
|
366
|
+
delete: "删除",
|
|
367
|
+
report: "举报",
|
|
368
|
+
retry: "重新发送",
|
|
369
|
+
moreReactions: "更多回应",
|
|
370
|
+
fewerReactions: "收起回应"
|
|
371
|
+
},
|
|
372
|
+
chatPinned: {
|
|
373
|
+
label: "置顶消息",
|
|
374
|
+
indexed: "置顶消息 #{index}",
|
|
375
|
+
unpin: "取消置顶"
|
|
376
|
+
},
|
|
377
|
+
chatRequest: {
|
|
378
|
+
title: "消息请求",
|
|
379
|
+
description: "{name} 想给你发消息。接受之前,对方看不到你是否已读。",
|
|
380
|
+
accept: "接受",
|
|
381
|
+
delete: "删除",
|
|
382
|
+
block: "拉黑",
|
|
383
|
+
report: "举报"
|
|
384
|
+
},
|
|
385
|
+
chatService: {
|
|
386
|
+
groupCreated: "{actor} 创建了群组",
|
|
387
|
+
groupCreatedTitled: "{actor} 创建了群组「{title}」",
|
|
388
|
+
membersAdded: "{actor} 邀请了 {users}",
|
|
389
|
+
memberJoined: "{actor} 加入了群组",
|
|
390
|
+
memberLeft: "{actor} 退出了群组",
|
|
391
|
+
memberRemoved: "{actor} 将 {user} 移出了群组",
|
|
392
|
+
titleChanged: "{actor} 将群名改为「{title}」",
|
|
393
|
+
photoChanged: "{actor} 更换了群头像",
|
|
394
|
+
messagePinned: "{actor} 置顶了「{text}」",
|
|
395
|
+
messagePinnedMedia: "{actor} 置顶了一条消息",
|
|
396
|
+
joinedByLink: "{actor} 通过邀请链接加入了群组"
|
|
397
|
+
},
|
|
398
|
+
chatStatus: {
|
|
399
|
+
sending: "发送中",
|
|
400
|
+
sent: "已发送",
|
|
401
|
+
read: "已读",
|
|
402
|
+
failed: "发送失败,点击重试"
|
|
403
|
+
},
|
|
404
|
+
chatTyping: {
|
|
405
|
+
typing: "正在输入…",
|
|
406
|
+
one: "{name} 正在输入…",
|
|
407
|
+
several: "{names} 正在输入…",
|
|
408
|
+
many: "{name} 等 {count} 人正在输入…"
|
|
409
|
+
},
|
|
312
410
|
chip: {
|
|
313
411
|
remove: "移除"
|
|
314
412
|
},
|
|
@@ -481,6 +579,913 @@ var hash = (value) => {
|
|
|
481
579
|
var pickAvatarFallback = (seed = "", pool = []) => pool.length > 0 ? pool[hash(seed) % pool.length] ?? KUN_AVATAR_FALLBACK : KUN_AVATAR_FALLBACK;
|
|
482
580
|
var getRandomSticker = (id = "") => pickAvatarFallback(id);
|
|
483
581
|
|
|
582
|
+
// src/chat/constants.ts
|
|
583
|
+
var KUN_CHAT_TEXT_LIMIT = 4096;
|
|
584
|
+
var KUN_CHAT_ALBUM_LIMIT = 10;
|
|
585
|
+
var KUN_CHAT_TYPING_INTERVAL = 5e3;
|
|
586
|
+
var KUN_CHAT_TYPING_TIMEOUT = 6e3;
|
|
587
|
+
|
|
588
|
+
// src/chat/entities.ts
|
|
589
|
+
var KNOWN_TYPES = /* @__PURE__ */ new Set([
|
|
590
|
+
"bold",
|
|
591
|
+
"italic",
|
|
592
|
+
"underline",
|
|
593
|
+
"strikethrough",
|
|
594
|
+
"spoiler",
|
|
595
|
+
"code",
|
|
596
|
+
"pre",
|
|
597
|
+
"blockquote",
|
|
598
|
+
"text_link",
|
|
599
|
+
"mention",
|
|
600
|
+
"url"
|
|
601
|
+
]);
|
|
602
|
+
var LEAF_TYPES = /* @__PURE__ */ new Set(["code", "pre"]);
|
|
603
|
+
var LINK_TYPES = /* @__PURE__ */ new Set(["text_link", "mention", "url"]);
|
|
604
|
+
var KUN_CHAT_BLOCK_ENTITY_TYPES = /* @__PURE__ */ new Set([
|
|
605
|
+
"pre",
|
|
606
|
+
"blockquote"
|
|
607
|
+
]);
|
|
608
|
+
var NESTING_ORDER = [
|
|
609
|
+
"blockquote",
|
|
610
|
+
"pre",
|
|
611
|
+
"text_link",
|
|
612
|
+
"mention",
|
|
613
|
+
"url",
|
|
614
|
+
"spoiler",
|
|
615
|
+
"bold",
|
|
616
|
+
"italic",
|
|
617
|
+
"underline",
|
|
618
|
+
"strikethrough",
|
|
619
|
+
"code"
|
|
620
|
+
];
|
|
621
|
+
var rank = (type) => NESTING_ORDER.indexOf(type);
|
|
622
|
+
var isHighSurrogate = (code) => code >= 55296 && code <= 56319;
|
|
623
|
+
var isLowSurrogate = (code) => code >= 56320 && code <= 57343;
|
|
624
|
+
var splitsPair = (text, index) => index > 0 && index < text.length && isHighSurrogate(text.charCodeAt(index - 1)) && isLowSurrogate(text.charCodeAt(index));
|
|
625
|
+
var compareRanges = (a, b) => a.start - b.start || b.end - a.end || rank(a.entity.type) - rank(b.entity.type);
|
|
626
|
+
var cleanEntity = (e, offset, length) => {
|
|
627
|
+
const out = { type: e.type, offset, length };
|
|
628
|
+
if (e.type === "mention") out.user_id = e.user_id;
|
|
629
|
+
if (e.type === "text_link") out.url = e.url;
|
|
630
|
+
if (e.type === "pre" && e.language) out.language = e.language;
|
|
631
|
+
return out;
|
|
632
|
+
};
|
|
633
|
+
var FORMAT_TYPES = /* @__PURE__ */ new Set([
|
|
634
|
+
"bold",
|
|
635
|
+
"italic",
|
|
636
|
+
"underline",
|
|
637
|
+
"strikethrough",
|
|
638
|
+
"spoiler"
|
|
639
|
+
]);
|
|
640
|
+
var mergeTouching = (ranges) => {
|
|
641
|
+
const out = [];
|
|
642
|
+
const last = /* @__PURE__ */ new Map();
|
|
643
|
+
for (const r of [...ranges].sort(compareRanges)) {
|
|
644
|
+
const prev = FORMAT_TYPES.has(r.entity.type) ? last.get(r.entity.type) : void 0;
|
|
645
|
+
if (prev && r.start <= prev.end) {
|
|
646
|
+
prev.end = Math.max(prev.end, r.end);
|
|
647
|
+
continue;
|
|
648
|
+
}
|
|
649
|
+
out.push(r);
|
|
650
|
+
if (FORMAT_TYPES.has(r.entity.type)) last.set(r.entity.type, r);
|
|
651
|
+
}
|
|
652
|
+
return out;
|
|
653
|
+
};
|
|
654
|
+
var splitAtQuotes = (ranges) => {
|
|
655
|
+
const cuts = ranges.filter((r) => r.entity.type === "blockquote").flatMap((r) => [r.start, r.end]);
|
|
656
|
+
return ranges.flatMap((r) => {
|
|
657
|
+
if (r.entity.type === "blockquote") return [r];
|
|
658
|
+
const inner = cuts.filter((c) => c > r.start && c < r.end).sort((a, b) => a - b);
|
|
659
|
+
const points = [r.start, ...new Set(inner), r.end];
|
|
660
|
+
return points.slice(1).map((end, i) => ({ entity: r.entity, start: points[i], end }));
|
|
661
|
+
});
|
|
662
|
+
};
|
|
663
|
+
var normalizeKunChatEntities = (text, entities) => {
|
|
664
|
+
if (!entities?.length || !text) return [];
|
|
665
|
+
let ranges = [];
|
|
666
|
+
for (const e of entities) {
|
|
667
|
+
if (!e || !KNOWN_TYPES.has(e.type)) continue;
|
|
668
|
+
if (!Number.isInteger(e.offset) || !Number.isInteger(e.length)) continue;
|
|
669
|
+
if (e.offset < 0 || e.length <= 0) continue;
|
|
670
|
+
if (e.type === "text_link" && (typeof e.url !== "string" || !e.url)) continue;
|
|
671
|
+
if (e.type === "mention" && (typeof e.user_id !== "string" || !e.user_id)) continue;
|
|
672
|
+
let start = e.offset;
|
|
673
|
+
let end = Math.min(e.offset + e.length, text.length);
|
|
674
|
+
if (start >= end) continue;
|
|
675
|
+
if (splitsPair(text, start)) start -= 1;
|
|
676
|
+
if (splitsPair(text, end)) end += 1;
|
|
677
|
+
if (e.type === "blockquote") while (end > start && text[end - 1] === "\n") end--;
|
|
678
|
+
if (start < end) ranges.push({ entity: e, start, end });
|
|
679
|
+
}
|
|
680
|
+
const trimmed = (r) => {
|
|
681
|
+
if (FORMAT_TYPES.has(r.entity.type)) {
|
|
682
|
+
while (r.start < r.end && text[r.start] === "\n") r.start++;
|
|
683
|
+
while (r.end > r.start && text[r.end - 1] === "\n") r.end--;
|
|
684
|
+
}
|
|
685
|
+
return r.start < r.end;
|
|
686
|
+
};
|
|
687
|
+
const queue = splitAtQuotes(mergeTouching(ranges)).filter(trimmed).sort(compareRanges);
|
|
688
|
+
const enqueue = (r) => {
|
|
689
|
+
let i = 0;
|
|
690
|
+
while (i < queue.length && compareRanges(queue[i], r) <= 0) i++;
|
|
691
|
+
queue.splice(i, 0, r);
|
|
692
|
+
};
|
|
693
|
+
const out = [];
|
|
694
|
+
const stack = [];
|
|
695
|
+
while (queue.length) {
|
|
696
|
+
const r = queue.shift();
|
|
697
|
+
while (stack.length && stack[stack.length - 1].end <= r.start) stack.pop();
|
|
698
|
+
const parent = stack[stack.length - 1];
|
|
699
|
+
if (parent && r.end > parent.end) {
|
|
700
|
+
const rest = { entity: r.entity, start: parent.end, end: r.end };
|
|
701
|
+
if (trimmed(rest)) enqueue(rest);
|
|
702
|
+
r.end = parent.end;
|
|
703
|
+
if (!trimmed(r)) continue;
|
|
704
|
+
if (queue.length && compareRanges(r, queue[0]) > 0) {
|
|
705
|
+
enqueue(r);
|
|
706
|
+
continue;
|
|
707
|
+
}
|
|
708
|
+
}
|
|
709
|
+
const blocked = stack.some(
|
|
710
|
+
(a) => LEAF_TYPES.has(a.entity.type) || a.entity.type === r.entity.type || LINK_TYPES.has(a.entity.type) && LINK_TYPES.has(r.entity.type)
|
|
711
|
+
);
|
|
712
|
+
if (blocked) continue;
|
|
713
|
+
stack.push(r);
|
|
714
|
+
out.push(r);
|
|
715
|
+
}
|
|
716
|
+
return out.map((r) => cleanEntity(r.entity, r.start, r.end - r.start));
|
|
717
|
+
};
|
|
718
|
+
var isBlock = (node) => node?.kind === "entity" && KUN_CHAT_BLOCK_ENTITY_TYPES.has(node.entity.type);
|
|
719
|
+
var trimAroundBlocks = (nodes) => {
|
|
720
|
+
const out = [];
|
|
721
|
+
nodes.forEach((node, i) => {
|
|
722
|
+
if (node.kind === "entity") {
|
|
723
|
+
out.push({ ...node, children: trimAroundBlocks(node.children) });
|
|
724
|
+
return;
|
|
725
|
+
}
|
|
726
|
+
let { text, offset } = node;
|
|
727
|
+
if (isBlock(nodes[i - 1]) && text.startsWith("\n")) {
|
|
728
|
+
text = text.slice(1);
|
|
729
|
+
offset += 1;
|
|
730
|
+
}
|
|
731
|
+
if (isBlock(nodes[i + 1]) && text.endsWith("\n")) text = text.slice(0, -1);
|
|
732
|
+
if (text) out.push({ kind: "text", text, offset });
|
|
733
|
+
});
|
|
734
|
+
return out;
|
|
735
|
+
};
|
|
736
|
+
var buildKunChatEntityTree = (text, entities) => {
|
|
737
|
+
const root = {
|
|
738
|
+
kind: "entity",
|
|
739
|
+
entity: { type: "bold", offset: 0, length: text.length },
|
|
740
|
+
children: []
|
|
741
|
+
};
|
|
742
|
+
const stack = [
|
|
743
|
+
{ node: root, end: text.length, cursor: 0 }
|
|
744
|
+
];
|
|
745
|
+
const flushTo = (frame, to) => {
|
|
746
|
+
if (to > frame.cursor) {
|
|
747
|
+
frame.node.children.push({
|
|
748
|
+
kind: "text",
|
|
749
|
+
text: text.slice(frame.cursor, to),
|
|
750
|
+
offset: frame.cursor
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
frame.cursor = Math.max(frame.cursor, to);
|
|
754
|
+
};
|
|
755
|
+
const close = () => {
|
|
756
|
+
const frame = stack.pop();
|
|
757
|
+
flushTo(frame, frame.end);
|
|
758
|
+
stack[stack.length - 1].cursor = frame.end;
|
|
759
|
+
};
|
|
760
|
+
for (const entity of normalizeKunChatEntities(text, entities)) {
|
|
761
|
+
const start = entity.offset;
|
|
762
|
+
while (stack.length > 1 && stack[stack.length - 1].end <= start) close();
|
|
763
|
+
const parent = stack[stack.length - 1];
|
|
764
|
+
flushTo(parent, start);
|
|
765
|
+
const node = { kind: "entity", entity, children: [] };
|
|
766
|
+
parent.node.children.push(node);
|
|
767
|
+
stack.push({ node, end: start + entity.length, cursor: start });
|
|
768
|
+
}
|
|
769
|
+
while (stack.length > 1) close();
|
|
770
|
+
flushTo(stack[0], text.length);
|
|
771
|
+
return trimAroundBlocks(root.children);
|
|
772
|
+
};
|
|
773
|
+
var kunChatTreeText = (nodes) => nodes.map((n) => n.kind === "text" ? n.text : kunChatTreeText(n.children)).join("");
|
|
774
|
+
var sliceKunChatEntities = (text, entities, start, end) => {
|
|
775
|
+
let from = Math.max(0, Math.min(start, text.length));
|
|
776
|
+
let to = Math.max(from, Math.min(end, text.length));
|
|
777
|
+
if (splitsPair(text, from)) from -= 1;
|
|
778
|
+
if (splitsPair(text, to)) to += 1;
|
|
779
|
+
const clipped = normalizeKunChatEntities(text, entities).flatMap((e) => {
|
|
780
|
+
const s = Math.max(e.offset, from);
|
|
781
|
+
const t = Math.min(e.offset + e.length, to);
|
|
782
|
+
return t > s ? [{ ...e, offset: s - from, length: t - s }] : [];
|
|
783
|
+
});
|
|
784
|
+
const sliced = text.slice(from, to);
|
|
785
|
+
return { text: sliced, entities: normalizeKunChatEntities(sliced, clipped) };
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
// src/chat/markdown.ts
|
|
789
|
+
var PAIRS = [
|
|
790
|
+
["**", "bold"],
|
|
791
|
+
["__", "italic"],
|
|
792
|
+
["++", "underline"],
|
|
793
|
+
["~~", "strikethrough"],
|
|
794
|
+
["||", "spoiler"]
|
|
795
|
+
];
|
|
796
|
+
var PAIR_BY_TYPE = new Map(PAIRS.map(([m, t]) => [t, m]));
|
|
797
|
+
var PAIR_CHARS = /* @__PURE__ */ new Set(["*", "_", "+", "~", "|"]);
|
|
798
|
+
var TEXT_SPECIAL = /* @__PURE__ */ new Set(["*", "_", "+", "~", "|", "`", "[", "]"]);
|
|
799
|
+
var LANGUAGE = /^[A-Za-z0-9_+#.-]*$/;
|
|
800
|
+
var MENTION = /^mention:(\d+)$/;
|
|
801
|
+
var backslashRun = (s, i, end) => {
|
|
802
|
+
let k = 0;
|
|
803
|
+
while (i + k < end && s[i + k] === "\\") k++;
|
|
804
|
+
return k;
|
|
805
|
+
};
|
|
806
|
+
var nonBackslash = (s, i, step) => {
|
|
807
|
+
while (i >= 0 && i < s.length && s[i] === "\\") i += step;
|
|
808
|
+
return s[i];
|
|
809
|
+
};
|
|
810
|
+
var escapeAt = (s, i, end) => {
|
|
811
|
+
const k = backslashRun(s, i, end);
|
|
812
|
+
const j = i + k;
|
|
813
|
+
const c = s[j] ?? "";
|
|
814
|
+
const special = c === "`" || c === "[" || c === "]" ? true : PAIR_CHARS.has(c) && (nonBackslash(s, i - 1, -1) === c || nonBackslash(s, j + 1, 1) === c);
|
|
815
|
+
return { k, c, special };
|
|
816
|
+
};
|
|
817
|
+
var skipEscape = (s, i, end) => {
|
|
818
|
+
const { k, special } = escapeAt(s, i, end);
|
|
819
|
+
return i + (special && k % 2 === 1 && i + k < end ? k + 1 : k);
|
|
820
|
+
};
|
|
821
|
+
var findRawCloser = (s, from, end, closer, special) => {
|
|
822
|
+
let p = from;
|
|
823
|
+
while (p < end) {
|
|
824
|
+
if (s[p] === "\\") {
|
|
825
|
+
const k = backslashRun(s, p, end);
|
|
826
|
+
p += s[p + k] === special && k % 2 === 1 ? k + 1 : k;
|
|
827
|
+
continue;
|
|
828
|
+
}
|
|
829
|
+
if (p + closer.length <= end && s.startsWith(closer, p)) return p;
|
|
830
|
+
p++;
|
|
831
|
+
}
|
|
832
|
+
return -1;
|
|
833
|
+
};
|
|
834
|
+
var unescapeRaw = (s, special, closerFollows) => {
|
|
835
|
+
let out = "";
|
|
836
|
+
let p = 0;
|
|
837
|
+
while (p < s.length) {
|
|
838
|
+
if (s[p] !== "\\") {
|
|
839
|
+
out += s[p];
|
|
840
|
+
p++;
|
|
841
|
+
continue;
|
|
842
|
+
}
|
|
843
|
+
const k = backslashRun(s, p, s.length);
|
|
844
|
+
const next = p + k < s.length ? s[p + k] : closerFollows ? special : "";
|
|
845
|
+
if (next !== special) {
|
|
846
|
+
out += "\\".repeat(k);
|
|
847
|
+
p += k;
|
|
848
|
+
} else if (k % 2 === 1) {
|
|
849
|
+
out += "\\".repeat((k - 1) / 2) + special;
|
|
850
|
+
p += k + 1;
|
|
851
|
+
} else {
|
|
852
|
+
out += "\\".repeat(k / 2);
|
|
853
|
+
p += k;
|
|
854
|
+
}
|
|
855
|
+
}
|
|
856
|
+
return out;
|
|
857
|
+
};
|
|
858
|
+
var matchCode = (s, i, end) => {
|
|
859
|
+
if (s[i] !== "`") return null;
|
|
860
|
+
const close = findRawCloser(s, i + 1, end, "`", "`");
|
|
861
|
+
if (close <= i + 1) return null;
|
|
862
|
+
return { end: close + 1, contentStart: i + 1, contentEnd: close };
|
|
863
|
+
};
|
|
864
|
+
var matchPre = (s, i, end) => {
|
|
865
|
+
if (!s.startsWith("```", i)) return null;
|
|
866
|
+
const open = i + 3;
|
|
867
|
+
const close = findRawCloser(s, open, end, "```", "`");
|
|
868
|
+
if (close < 0) return null;
|
|
869
|
+
const trimEnd = (from) => close > from && s[close - 1] === "\n" ? close - 1 : close;
|
|
870
|
+
const nl = s.indexOf("\n", open);
|
|
871
|
+
if (nl >= 0 && nl < close && LANGUAGE.test(s.slice(open, nl))) {
|
|
872
|
+
const contentEnd2 = trimEnd(nl + 1);
|
|
873
|
+
if (contentEnd2 > nl + 1) {
|
|
874
|
+
const language = s.slice(open, nl) || void 0;
|
|
875
|
+
return { end: close + 3, contentStart: nl + 1, contentEnd: contentEnd2, language };
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const contentEnd = trimEnd(open);
|
|
879
|
+
if (contentEnd <= open) return null;
|
|
880
|
+
return { end: close + 3, contentStart: open, contentEnd };
|
|
881
|
+
};
|
|
882
|
+
var matchLink = (s, i, end) => {
|
|
883
|
+
if (s[i] !== "[") return null;
|
|
884
|
+
let p = i + 1;
|
|
885
|
+
while (p < end) {
|
|
886
|
+
if (s[p] === "\\") {
|
|
887
|
+
p = skipEscape(s, p, end);
|
|
888
|
+
continue;
|
|
889
|
+
}
|
|
890
|
+
if (s[p] === "[") return null;
|
|
891
|
+
if (s[p] === "]" && s[p + 1] === "(") {
|
|
892
|
+
if (p === i + 1) return null;
|
|
893
|
+
const close = findRawCloser(s, p + 2, end, ")", ")");
|
|
894
|
+
if (close <= p + 2) return null;
|
|
895
|
+
return {
|
|
896
|
+
end: close + 1,
|
|
897
|
+
labelStart: i + 1,
|
|
898
|
+
labelEnd: p,
|
|
899
|
+
target: unescapeRaw(s.slice(p + 2, close), ")", true)
|
|
900
|
+
};
|
|
901
|
+
}
|
|
902
|
+
const raw = matchPre(s, p, end) ?? matchCode(s, p, end);
|
|
903
|
+
p = raw ? raw.end : p + 1;
|
|
904
|
+
}
|
|
905
|
+
return null;
|
|
906
|
+
};
|
|
907
|
+
var charRun = (s, i, end) => {
|
|
908
|
+
let k = 1;
|
|
909
|
+
while (i + k < end && s[i + k] === s[i]) k++;
|
|
910
|
+
return k;
|
|
911
|
+
};
|
|
912
|
+
var findPairCloser = (s, from, end, marker) => {
|
|
913
|
+
let p = from;
|
|
914
|
+
while (p < end) {
|
|
915
|
+
if (s[p] === "\\") {
|
|
916
|
+
p = skipEscape(s, p, end);
|
|
917
|
+
continue;
|
|
918
|
+
}
|
|
919
|
+
if (PAIR_CHARS.has(s[p])) {
|
|
920
|
+
const run = charRun(s, p, end);
|
|
921
|
+
if (run === 2 && p > from && s.startsWith(marker, p)) return p;
|
|
922
|
+
p += run;
|
|
923
|
+
continue;
|
|
924
|
+
}
|
|
925
|
+
const atom = matchPre(s, p, end) ?? matchCode(s, p, end) ?? matchLink(s, p, end);
|
|
926
|
+
p = atom ? atom.end : p + 1;
|
|
927
|
+
}
|
|
928
|
+
return -1;
|
|
929
|
+
};
|
|
930
|
+
var parseKunChatMarkdown = (source) => {
|
|
931
|
+
let text = "";
|
|
932
|
+
const entities = [];
|
|
933
|
+
const quotedLines = [];
|
|
934
|
+
let atLineStart = true;
|
|
935
|
+
let lineQuoted = false;
|
|
936
|
+
let lineOffset = 0;
|
|
937
|
+
const endLine = () => {
|
|
938
|
+
if (lineQuoted) quotedLines.push([lineOffset, text.length]);
|
|
939
|
+
};
|
|
940
|
+
const parseRange = (start, end) => {
|
|
941
|
+
let i = start;
|
|
942
|
+
while (i < end) {
|
|
943
|
+
if (atLineStart) {
|
|
944
|
+
atLineStart = false;
|
|
945
|
+
lineOffset = text.length;
|
|
946
|
+
lineQuoted = false;
|
|
947
|
+
if (i + 2 <= end && source.startsWith("> ", i)) {
|
|
948
|
+
lineQuoted = true;
|
|
949
|
+
i += 2;
|
|
950
|
+
} else if (source[i] === ">" && (i + 1 === end || source[i + 1] === "\n")) {
|
|
951
|
+
lineQuoted = true;
|
|
952
|
+
i += 1;
|
|
953
|
+
}
|
|
954
|
+
if (source[i] === "\\" && source[i + backslashRun(source, i, end)] === ">") i += 1;
|
|
955
|
+
continue;
|
|
956
|
+
}
|
|
957
|
+
const c = source[i];
|
|
958
|
+
if (c === "\\") {
|
|
959
|
+
const { k, c: next, special } = escapeAt(source, i, end);
|
|
960
|
+
if (!special) {
|
|
961
|
+
text += "\\".repeat(k);
|
|
962
|
+
i += k;
|
|
963
|
+
} else if (k % 2 === 1 && i + k < end) {
|
|
964
|
+
text += "\\".repeat((k - 1) / 2) + next;
|
|
965
|
+
i += k + 1;
|
|
966
|
+
} else {
|
|
967
|
+
text += "\\".repeat(k / 2);
|
|
968
|
+
i += k;
|
|
969
|
+
}
|
|
970
|
+
continue;
|
|
971
|
+
}
|
|
972
|
+
if (c === "\n") {
|
|
973
|
+
endLine();
|
|
974
|
+
text += "\n";
|
|
975
|
+
atLineStart = true;
|
|
976
|
+
i++;
|
|
977
|
+
continue;
|
|
978
|
+
}
|
|
979
|
+
const raw = matchPre(source, i, end);
|
|
980
|
+
const code = raw ? null : matchCode(source, i, end);
|
|
981
|
+
const span = raw ?? code;
|
|
982
|
+
if (span) {
|
|
983
|
+
const offset = text.length;
|
|
984
|
+
text += unescapeRaw(
|
|
985
|
+
source.slice(span.contentStart, span.contentEnd),
|
|
986
|
+
"`",
|
|
987
|
+
source[span.contentEnd] === "`"
|
|
988
|
+
);
|
|
989
|
+
const entity = {
|
|
990
|
+
type: raw ? "pre" : "code",
|
|
991
|
+
offset,
|
|
992
|
+
length: text.length - offset
|
|
993
|
+
};
|
|
994
|
+
if (span.language) entity.language = span.language;
|
|
995
|
+
entities.push(entity);
|
|
996
|
+
i = span.end;
|
|
997
|
+
continue;
|
|
998
|
+
}
|
|
999
|
+
const link = matchLink(source, i, end);
|
|
1000
|
+
if (link) {
|
|
1001
|
+
const offset = text.length;
|
|
1002
|
+
parseRange(link.labelStart, link.labelEnd);
|
|
1003
|
+
const length = text.length - offset;
|
|
1004
|
+
const mention = link.target.match(MENTION);
|
|
1005
|
+
if (length > 0) {
|
|
1006
|
+
entities.push(
|
|
1007
|
+
mention ? { type: "mention", offset, length, user_id: mention[1] } : { type: "text_link", offset, length, url: link.target }
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
i = link.end;
|
|
1011
|
+
continue;
|
|
1012
|
+
}
|
|
1013
|
+
if (PAIR_CHARS.has(c)) {
|
|
1014
|
+
const run = charRun(source, i, end);
|
|
1015
|
+
if (run !== 2) {
|
|
1016
|
+
text += c.repeat(run);
|
|
1017
|
+
i += run;
|
|
1018
|
+
continue;
|
|
1019
|
+
}
|
|
1020
|
+
const [marker, type] = PAIRS.find(([m]) => m[0] === c);
|
|
1021
|
+
const close = findPairCloser(source, i + 2, end, marker);
|
|
1022
|
+
if (close > i + 2) {
|
|
1023
|
+
const offset = text.length;
|
|
1024
|
+
parseRange(i + 2, close);
|
|
1025
|
+
const length = text.length - offset;
|
|
1026
|
+
if (length > 0) entities.push({ type, offset, length });
|
|
1027
|
+
i = close + 2;
|
|
1028
|
+
} else {
|
|
1029
|
+
text += marker;
|
|
1030
|
+
i += 2;
|
|
1031
|
+
}
|
|
1032
|
+
continue;
|
|
1033
|
+
}
|
|
1034
|
+
text += c;
|
|
1035
|
+
i++;
|
|
1036
|
+
}
|
|
1037
|
+
};
|
|
1038
|
+
parseRange(0, source.length);
|
|
1039
|
+
endLine();
|
|
1040
|
+
for (let q = 0; q < quotedLines.length; q++) {
|
|
1041
|
+
const start = quotedLines[q][0];
|
|
1042
|
+
let end = quotedLines[q][1];
|
|
1043
|
+
while (q + 1 < quotedLines.length && quotedLines[q + 1][0] === end + 1) {
|
|
1044
|
+
end = quotedLines[++q][1];
|
|
1045
|
+
}
|
|
1046
|
+
if (end > start) entities.push({ type: "blockquote", offset: start, length: end - start });
|
|
1047
|
+
}
|
|
1048
|
+
return { text, entities: normalizeKunChatEntities(text, entities) };
|
|
1049
|
+
};
|
|
1050
|
+
var formatKunChatMarkdown = (text, entities) => {
|
|
1051
|
+
const withoutUrls = (entities ?? []).filter((e) => e.type !== "url");
|
|
1052
|
+
const first = normalizeKunChatEntities(text, withoutUrls);
|
|
1053
|
+
const inRaw = (i) => first.some((r) => (r.type === "code" || r.type === "pre") && r.offset <= i && i < r.offset + r.length);
|
|
1054
|
+
const breakAt = (i) => text[i] === "\n" && !inRaw(i);
|
|
1055
|
+
const quotes = [];
|
|
1056
|
+
for (const q of first) {
|
|
1057
|
+
if (q.type !== "blockquote") continue;
|
|
1058
|
+
const end = q.offset + q.length;
|
|
1059
|
+
if (!(q.offset === 0 || breakAt(q.offset - 1)) || !(end === text.length || breakAt(end))) continue;
|
|
1060
|
+
const prev = quotes[quotes.length - 1];
|
|
1061
|
+
if (prev && prev.offset + prev.length + 1 === q.offset) prev.length = end - prev.offset;
|
|
1062
|
+
else quotes.push({ ...q });
|
|
1063
|
+
}
|
|
1064
|
+
const list = normalizeKunChatEntities(text, [
|
|
1065
|
+
...withoutUrls.filter((e) => e.type !== "blockquote"),
|
|
1066
|
+
...quotes
|
|
1067
|
+
]);
|
|
1068
|
+
const root = { entity: null, start: 0, end: text.length, children: [] };
|
|
1069
|
+
const stack = [root];
|
|
1070
|
+
for (const entity of list) {
|
|
1071
|
+
const node = {
|
|
1072
|
+
entity,
|
|
1073
|
+
start: entity.offset,
|
|
1074
|
+
end: entity.offset + entity.length,
|
|
1075
|
+
children: []
|
|
1076
|
+
};
|
|
1077
|
+
while (stack.length > 1 && stack[stack.length - 1].end <= node.start) stack.pop();
|
|
1078
|
+
stack[stack.length - 1].children.push(node);
|
|
1079
|
+
stack.push(node);
|
|
1080
|
+
}
|
|
1081
|
+
const atoms = [];
|
|
1082
|
+
const mark = (s) => atoms.push({ kind: "mark", s });
|
|
1083
|
+
const lit = (ch, ctx, inLabel) => atoms.push({ kind: "lit", ch, ctx, inLabel, escape: false });
|
|
1084
|
+
let quoteDepth = 0;
|
|
1085
|
+
const emitText = (from, to, inLabel) => {
|
|
1086
|
+
for (let i = from; i < to; i++) {
|
|
1087
|
+
lit(text[i], "text", inLabel);
|
|
1088
|
+
if (text[i] === "\n" && quoteDepth > 0) mark("> ");
|
|
1089
|
+
}
|
|
1090
|
+
};
|
|
1091
|
+
const emitRaw = (from, to, ctx) => {
|
|
1092
|
+
for (let i = from; i < to; i++) lit(text[i], ctx, false);
|
|
1093
|
+
};
|
|
1094
|
+
const walk = (node, inLabel) => {
|
|
1095
|
+
let cursor = node.start;
|
|
1096
|
+
for (const child of node.children) {
|
|
1097
|
+
emitText(cursor, child.start, inLabel);
|
|
1098
|
+
emitEntity(child, inLabel);
|
|
1099
|
+
cursor = child.end;
|
|
1100
|
+
}
|
|
1101
|
+
emitText(cursor, node.end, inLabel);
|
|
1102
|
+
};
|
|
1103
|
+
const emitEntity = (node, inLabel) => {
|
|
1104
|
+
const e = node.entity;
|
|
1105
|
+
const pair = PAIR_BY_TYPE.get(e.type);
|
|
1106
|
+
if (pair) {
|
|
1107
|
+
mark(pair);
|
|
1108
|
+
walk(node, inLabel);
|
|
1109
|
+
mark(pair);
|
|
1110
|
+
} else if (e.type === "code") {
|
|
1111
|
+
mark("`");
|
|
1112
|
+
emitRaw(node.start, node.end, "code");
|
|
1113
|
+
mark("`");
|
|
1114
|
+
} else if (e.type === "pre") {
|
|
1115
|
+
const language = e.language && LANGUAGE.test(e.language) ? e.language : "";
|
|
1116
|
+
mark(`\`\`\`${language}
|
|
1117
|
+
`);
|
|
1118
|
+
emitRaw(node.start, node.end, "pre");
|
|
1119
|
+
mark("\n```");
|
|
1120
|
+
} else if (e.type === "text_link" || e.type === "mention") {
|
|
1121
|
+
mark("[");
|
|
1122
|
+
walk(node, true);
|
|
1123
|
+
mark("](");
|
|
1124
|
+
const target = e.type === "mention" ? `mention:${e.user_id}` : e.url;
|
|
1125
|
+
for (const ch of target) lit(ch, "url", false);
|
|
1126
|
+
mark(")");
|
|
1127
|
+
} else if (e.type === "blockquote") {
|
|
1128
|
+
mark("> ");
|
|
1129
|
+
quoteDepth++;
|
|
1130
|
+
walk(node, inLabel);
|
|
1131
|
+
quoteDepth--;
|
|
1132
|
+
} else {
|
|
1133
|
+
walk(node, inLabel);
|
|
1134
|
+
}
|
|
1135
|
+
};
|
|
1136
|
+
walk(root, false);
|
|
1137
|
+
return serialize(atoms);
|
|
1138
|
+
};
|
|
1139
|
+
var isLit = (a, ch, ctx) => a?.kind === "lit" && a.ch === ch && a.ctx === ctx;
|
|
1140
|
+
var firstChar = (a) => a === void 0 ? void 0 : a.kind === "mark" ? a.s[0] : a.ch;
|
|
1141
|
+
var rawCharFrom = (atoms, from) => {
|
|
1142
|
+
for (let i = from; i < atoms.length; i++) {
|
|
1143
|
+
const a = atoms[i];
|
|
1144
|
+
if (a.kind === "mark") {
|
|
1145
|
+
const c = [...a.s].find((ch) => ch !== "\\");
|
|
1146
|
+
if (c !== void 0) return c;
|
|
1147
|
+
} else if (a.escape || a.ch !== "\\") {
|
|
1148
|
+
return a.ch;
|
|
1149
|
+
}
|
|
1150
|
+
}
|
|
1151
|
+
return void 0;
|
|
1152
|
+
};
|
|
1153
|
+
var lastNonBackslash = (out) => {
|
|
1154
|
+
let i = out.length - 1;
|
|
1155
|
+
while (i >= 0 && out[i] === "\\") i--;
|
|
1156
|
+
return out[i];
|
|
1157
|
+
};
|
|
1158
|
+
var beforeSpecial = (atoms, j, ctx, out) => {
|
|
1159
|
+
const next = atoms[j];
|
|
1160
|
+
if (next === void 0) return false;
|
|
1161
|
+
if (next.kind === "lit" && next.escape) return true;
|
|
1162
|
+
const c = next.kind === "mark" ? next.s[0] : next.ch;
|
|
1163
|
+
if (ctx !== "text") return c === (ctx === "url" ? ")" : "`");
|
|
1164
|
+
if (next.kind === "mark") return TEXT_SPECIAL.has(c);
|
|
1165
|
+
if (c === "`" || c === "[" || c === "]") return true;
|
|
1166
|
+
return PAIR_CHARS.has(c) && (lastNonBackslash(out) === c || rawCharFrom(atoms, j + 1) === c);
|
|
1167
|
+
};
|
|
1168
|
+
var atTextLineStart = (out) => out === "" || out.endsWith("\n") || out === "> " || out.endsWith("\n> ");
|
|
1169
|
+
var serialize = (atoms) => {
|
|
1170
|
+
atoms.forEach((a, i2) => {
|
|
1171
|
+
if (a.kind !== "lit") return;
|
|
1172
|
+
const prev = atoms[i2 - 1];
|
|
1173
|
+
const next = atoms[i2 + 1];
|
|
1174
|
+
if (a.ctx === "text") {
|
|
1175
|
+
if (PAIR_CHARS.has(a.ch)) {
|
|
1176
|
+
const prevActive = prev?.kind === "mark" ? prev.s.endsWith(a.ch) : prev !== void 0 && !prev.escape && prev.ch === a.ch;
|
|
1177
|
+
a.escape = prevActive || firstChar(next) === a.ch;
|
|
1178
|
+
} else if (a.ch === "`") {
|
|
1179
|
+
a.escape = true;
|
|
1180
|
+
} else if (a.ch === "[") {
|
|
1181
|
+
a.escape = a.inLabel;
|
|
1182
|
+
} else if (a.ch === "]") {
|
|
1183
|
+
a.escape = next?.kind === "lit" && next.ch === "(";
|
|
1184
|
+
}
|
|
1185
|
+
} else if (a.ctx === "code") {
|
|
1186
|
+
a.escape = a.ch === "`";
|
|
1187
|
+
} else if (a.ctx === "url") {
|
|
1188
|
+
a.escape = a.ch === ")";
|
|
1189
|
+
} else if (a.ch === "`") {
|
|
1190
|
+
let s = i2;
|
|
1191
|
+
while (isLit(atoms[s - 1], "`", "pre")) s--;
|
|
1192
|
+
let e = i2;
|
|
1193
|
+
while (isLit(atoms[e + 1], "`", "pre")) e++;
|
|
1194
|
+
a.escape = e - s + 1 >= 3;
|
|
1195
|
+
}
|
|
1196
|
+
});
|
|
1197
|
+
let out = "";
|
|
1198
|
+
let i = 0;
|
|
1199
|
+
while (i < atoms.length) {
|
|
1200
|
+
const a = atoms[i];
|
|
1201
|
+
if (a.kind === "mark") {
|
|
1202
|
+
out += a.s;
|
|
1203
|
+
i++;
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1206
|
+
if (a.ctx === "text" && atTextLineStart(out)) {
|
|
1207
|
+
let j = i;
|
|
1208
|
+
while (isLit(atoms[j], "\\", "text")) j++;
|
|
1209
|
+
if (isLit(atoms[j], ">", "text")) out += "\\";
|
|
1210
|
+
}
|
|
1211
|
+
if (a.ch === "\\") {
|
|
1212
|
+
let j = i;
|
|
1213
|
+
while (isLit(atoms[j], "\\", a.ctx)) j++;
|
|
1214
|
+
out += "\\".repeat(beforeSpecial(atoms, j, a.ctx, out) ? 2 * (j - i) : j - i);
|
|
1215
|
+
i = j;
|
|
1216
|
+
continue;
|
|
1217
|
+
}
|
|
1218
|
+
out += a.escape ? `\\${a.ch}` : a.ch;
|
|
1219
|
+
i++;
|
|
1220
|
+
}
|
|
1221
|
+
return out;
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
// src/chat/album.ts
|
|
1225
|
+
var KUN_CHAT_ALBUM_SIDE = {
|
|
1226
|
+
top: 1,
|
|
1227
|
+
right: 2,
|
|
1228
|
+
bottom: 4,
|
|
1229
|
+
left: 8
|
|
1230
|
+
};
|
|
1231
|
+
var { top: T, right: R, bottom: B, left: L } = KUN_CHAT_ALBUM_SIDE;
|
|
1232
|
+
var sum = (xs) => xs.reduce((a, b) => a + b, 0);
|
|
1233
|
+
var clamp = (v, min, max) => Math.min(Math.max(v, min), max);
|
|
1234
|
+
var tile = (x, y, width, height, sides) => ({
|
|
1235
|
+
x,
|
|
1236
|
+
y,
|
|
1237
|
+
width,
|
|
1238
|
+
height,
|
|
1239
|
+
sides
|
|
1240
|
+
});
|
|
1241
|
+
var layoutComplex = (ratios, averageRatio, maxWidth, minWidth, spacing) => {
|
|
1242
|
+
const maxHeight = maxWidth * 4 / 3;
|
|
1243
|
+
const cropped = ratios.map(
|
|
1244
|
+
(r) => averageRatio > 1.1 ? clamp(r, 1, 2.75) : clamp(r, 0.6667, 1)
|
|
1245
|
+
);
|
|
1246
|
+
const count = cropped.length;
|
|
1247
|
+
const attempts = [];
|
|
1248
|
+
const push = (counts) => {
|
|
1249
|
+
let offset = 0;
|
|
1250
|
+
const heights = counts.map((c) => {
|
|
1251
|
+
const h = (maxWidth - (c - 1) * spacing) / sum(cropped.slice(offset, offset + c));
|
|
1252
|
+
offset += c;
|
|
1253
|
+
return h;
|
|
1254
|
+
});
|
|
1255
|
+
attempts.push({ counts, heights });
|
|
1256
|
+
};
|
|
1257
|
+
for (let first = 1; first !== count; first++) {
|
|
1258
|
+
const second = count - first;
|
|
1259
|
+
if (first <= 3 && second <= 3) push([first, second]);
|
|
1260
|
+
}
|
|
1261
|
+
for (let first = 1; first < count - 1; first++) {
|
|
1262
|
+
for (let second = 1; second < count - first; second++) {
|
|
1263
|
+
const third = count - first - second;
|
|
1264
|
+
if (first <= 3 && second <= (averageRatio < 0.85 ? 4 : 3) && third <= 3) {
|
|
1265
|
+
push([first, second, third]);
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
for (let first = 1; first < count - 1; first++) {
|
|
1270
|
+
for (let second = 1; second < count - first; second++) {
|
|
1271
|
+
for (let third = 1; third < count - first - second; third++) {
|
|
1272
|
+
const fourth = count - first - second - third;
|
|
1273
|
+
if (first <= 3 && second <= 3 && third <= 3 && fourth <= 3) {
|
|
1274
|
+
push([first, second, third, fourth]);
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
if (!attempts.length) {
|
|
1280
|
+
push(Array.from({ length: Math.ceil(count / 3) }, (_, i) => Math.min(3, count - i * 3)));
|
|
1281
|
+
}
|
|
1282
|
+
let best = attempts[0];
|
|
1283
|
+
let bestDiff = Infinity;
|
|
1284
|
+
for (const attempt of attempts) {
|
|
1285
|
+
const { counts, heights } = attempt;
|
|
1286
|
+
const total = sum(heights) + spacing * (counts.length - 1);
|
|
1287
|
+
const tooShort = Math.min(...heights) < minWidth ? 1.5 : 1;
|
|
1288
|
+
const topHeavy = counts.some((c, i) => i > 0 && counts[i - 1] > c) ? 1.5 : 1;
|
|
1289
|
+
const diff = Math.abs(total - maxHeight) * tooShort * topHeavy;
|
|
1290
|
+
if (diff < bestDiff) {
|
|
1291
|
+
best = attempt;
|
|
1292
|
+
bestDiff = diff;
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
const tiles = [];
|
|
1296
|
+
let index = 0;
|
|
1297
|
+
let y = 0;
|
|
1298
|
+
best.counts.forEach((cols, row) => {
|
|
1299
|
+
const lineHeight = best.heights[row];
|
|
1300
|
+
const height = Math.round(lineHeight);
|
|
1301
|
+
let x = 0;
|
|
1302
|
+
for (let col = 0; col < cols; col++) {
|
|
1303
|
+
const sides = (row === 0 ? T : 0) | (row === best.counts.length - 1 ? B : 0) | (col === 0 ? L : 0) | (col === cols - 1 ? R : 0);
|
|
1304
|
+
const width = col === cols - 1 ? maxWidth - x : Math.round(cropped[index] * lineHeight);
|
|
1305
|
+
tiles.push(tile(x, y, width, height, sides));
|
|
1306
|
+
x += width + spacing;
|
|
1307
|
+
index++;
|
|
1308
|
+
}
|
|
1309
|
+
y += height + spacing;
|
|
1310
|
+
});
|
|
1311
|
+
return tiles;
|
|
1312
|
+
};
|
|
1313
|
+
var layoutKunChatAlbum = (sizes, options = {}) => {
|
|
1314
|
+
const maxWidth = options.maxWidth ?? 420;
|
|
1315
|
+
const minWidth = options.minWidth ?? 100;
|
|
1316
|
+
const s = options.spacing ?? 2;
|
|
1317
|
+
const maxHeight = maxWidth;
|
|
1318
|
+
const r = sizes.map((z) => z.width > 0 && z.height > 0 ? z.width / z.height : 1);
|
|
1319
|
+
const n = r.length;
|
|
1320
|
+
const shape = r.map((x) => x > 1.2 ? "w" : x < 0.8 ? "n" : "q").join("");
|
|
1321
|
+
const averageRatio = (1 + sum(r)) / n;
|
|
1322
|
+
const maxSizeRatio = maxWidth / maxHeight;
|
|
1323
|
+
let tiles;
|
|
1324
|
+
if (n === 0) {
|
|
1325
|
+
tiles = [];
|
|
1326
|
+
} else if (n === 1) {
|
|
1327
|
+
tiles = [tile(0, 0, maxWidth, maxWidth / r[0], T | R | B | L)];
|
|
1328
|
+
} else if (n >= 5 || r.some((x) => x > 2)) {
|
|
1329
|
+
tiles = layoutComplex(r, averageRatio, maxWidth, minWidth, s);
|
|
1330
|
+
} else if (n === 2) {
|
|
1331
|
+
const [r0, r1] = r;
|
|
1332
|
+
if (shape === "ww" && averageRatio > 1.4 * maxSizeRatio && r1 - r0 < 0.2) {
|
|
1333
|
+
const h = Math.round(Math.min(maxWidth / r0, maxWidth / r1, (maxHeight - s) / 2));
|
|
1334
|
+
tiles = [tile(0, 0, maxWidth, h, L | T | R), tile(0, h + s, maxWidth, h, L | B | R)];
|
|
1335
|
+
} else if (shape === "ww" || shape === "qq") {
|
|
1336
|
+
const w = (maxWidth - s) / 2;
|
|
1337
|
+
const h = Math.round(Math.min(w / r0, w / r1, maxHeight));
|
|
1338
|
+
tiles = [tile(0, 0, w, h, T | L | B), tile(w + s, 0, w, h, T | R | B)];
|
|
1339
|
+
} else {
|
|
1340
|
+
const w2 = Math.min(
|
|
1341
|
+
Math.round(Math.max(0.4 * (maxWidth - s), (maxWidth - s) / r0 / (1 / r0 + 1 / r1))),
|
|
1342
|
+
maxWidth - s - Math.round(minWidth * 1.5)
|
|
1343
|
+
);
|
|
1344
|
+
const w1 = maxWidth - w2 - s;
|
|
1345
|
+
const h = Math.min(maxHeight, Math.round(Math.min(w1 / r0, w2 / r1)));
|
|
1346
|
+
tiles = [tile(0, 0, w1, h, T | L | B), tile(w1 + s, 0, w2, h, T | R | B)];
|
|
1347
|
+
}
|
|
1348
|
+
} else if (n === 3) {
|
|
1349
|
+
const [r0, r1, r2] = r;
|
|
1350
|
+
if (shape[0] === "n") {
|
|
1351
|
+
const h0 = maxHeight;
|
|
1352
|
+
const h2 = Math.round(Math.min((maxHeight - s) / 2, r1 * (maxWidth - s) / (r2 + r1)));
|
|
1353
|
+
const h1 = h0 - h2 - s;
|
|
1354
|
+
const wR = Math.max(minWidth, Math.round(Math.min((maxWidth - s) / 2, h2 * r2, h1 * r1)));
|
|
1355
|
+
const wL = Math.min(Math.round(h0 * r0), maxWidth - s - wR);
|
|
1356
|
+
tiles = [
|
|
1357
|
+
tile(0, 0, wL, h0, T | L | B),
|
|
1358
|
+
tile(wL + s, 0, wR, h1, T | R),
|
|
1359
|
+
tile(wL + s, h1 + s, wR, h2, B | R)
|
|
1360
|
+
];
|
|
1361
|
+
} else {
|
|
1362
|
+
const h0 = Math.round(Math.min(maxWidth / r0, (maxHeight - s) * 0.66));
|
|
1363
|
+
const w1 = (maxWidth - s) / 2;
|
|
1364
|
+
const h1 = Math.min(maxHeight - h0 - s, Math.round(Math.min(w1 / r1, w1 / r2)));
|
|
1365
|
+
const w2 = maxWidth - w1 - s;
|
|
1366
|
+
tiles = [
|
|
1367
|
+
tile(0, 0, maxWidth, h0, L | T | R),
|
|
1368
|
+
tile(0, h0 + s, w1, h1, B | L),
|
|
1369
|
+
tile(w1 + s, h0 + s, w2, h1, B | R)
|
|
1370
|
+
];
|
|
1371
|
+
}
|
|
1372
|
+
} else {
|
|
1373
|
+
const [r0, r1, r2, r3] = r;
|
|
1374
|
+
if (shape[0] === "w") {
|
|
1375
|
+
const h0 = Math.round(Math.min(maxWidth / r0, (maxHeight - s) * 0.66));
|
|
1376
|
+
const h = Math.round((maxWidth - 2 * s) / (r1 + r2 + r3));
|
|
1377
|
+
const w0 = Math.max(minWidth, Math.round(Math.min((maxWidth - 2 * s) * 0.4, h * r1)));
|
|
1378
|
+
const w2 = Math.round(Math.max(minWidth, (maxWidth - 2 * s) * 0.33, h * r3));
|
|
1379
|
+
const w1 = maxWidth - w0 - w2 - 2 * s;
|
|
1380
|
+
const h1 = Math.min(maxHeight - h0 - s, h);
|
|
1381
|
+
tiles = [
|
|
1382
|
+
tile(0, 0, maxWidth, h0, L | T | R),
|
|
1383
|
+
tile(0, h0 + s, w0, h1, B | L),
|
|
1384
|
+
tile(w0 + s, h0 + s, w1, h1, B),
|
|
1385
|
+
tile(w0 + s + w1 + s, h0 + s, w2, h1, R | B)
|
|
1386
|
+
];
|
|
1387
|
+
} else {
|
|
1388
|
+
const h = maxHeight;
|
|
1389
|
+
const w0 = Math.round(Math.min(h * r0, (maxWidth - s) * 0.6));
|
|
1390
|
+
const w = Math.round((maxHeight - 2 * s) / (1 / r1 + 1 / r2 + 1 / r3));
|
|
1391
|
+
const h0 = Math.round(w / r1);
|
|
1392
|
+
const h1 = Math.round(w / r2);
|
|
1393
|
+
const h2 = h - h0 - h1 - 2 * s;
|
|
1394
|
+
const w1 = Math.max(minWidth, Math.min(maxWidth - w0 - s, w));
|
|
1395
|
+
tiles = [
|
|
1396
|
+
tile(0, 0, w0, h, T | L | B),
|
|
1397
|
+
tile(w0 + s, 0, w1, h0, T | R),
|
|
1398
|
+
tile(w0 + s, h0 + s, w1, h1, R),
|
|
1399
|
+
tile(w0 + s, h0 + h1 + 2 * s, w1, h2, B | R)
|
|
1400
|
+
];
|
|
1401
|
+
}
|
|
1402
|
+
}
|
|
1403
|
+
return {
|
|
1404
|
+
width: Math.max(0, ...tiles.map((t) => t.x + t.width)),
|
|
1405
|
+
height: Math.max(0, ...tiles.map((t) => t.y + t.height)),
|
|
1406
|
+
tiles
|
|
1407
|
+
};
|
|
1408
|
+
};
|
|
1409
|
+
|
|
1410
|
+
// src/chat/grouping.ts
|
|
1411
|
+
var kunChatMessageKey = (message) => message.client_message_id ? `c:${message.client_message_id}` : `m:${message.id}`;
|
|
1412
|
+
var pad = (n) => String(n).padStart(2, "0");
|
|
1413
|
+
var dayFormatters = /* @__PURE__ */ new Map();
|
|
1414
|
+
var kunChatDayKey = (date, timeZone) => {
|
|
1415
|
+
if (!timeZone) {
|
|
1416
|
+
return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`;
|
|
1417
|
+
}
|
|
1418
|
+
let fmt = dayFormatters.get(timeZone);
|
|
1419
|
+
if (!fmt) {
|
|
1420
|
+
fmt = new Intl.DateTimeFormat("en-CA", {
|
|
1421
|
+
timeZone,
|
|
1422
|
+
year: "numeric",
|
|
1423
|
+
month: "2-digit",
|
|
1424
|
+
day: "2-digit"
|
|
1425
|
+
});
|
|
1426
|
+
dayFormatters.set(timeZone, fmt);
|
|
1427
|
+
}
|
|
1428
|
+
const parts = Object.fromEntries(fmt.formatToParts(date).map((p) => [p.type, p.value]));
|
|
1429
|
+
return `${parts.year}-${parts.month}-${parts.day}`;
|
|
1430
|
+
};
|
|
1431
|
+
var albumRepresentative = (messages) => messages.find((m) => m.text) ?? messages[0];
|
|
1432
|
+
var groupKunChatMessages = (messages, options) => {
|
|
1433
|
+
const windowMs = (options.groupWindow ?? 600) * 1e3;
|
|
1434
|
+
const sections = [];
|
|
1435
|
+
let dividerPlaced = options.lastReadSeq == null;
|
|
1436
|
+
let prev = null;
|
|
1437
|
+
const closeGroup = () => {
|
|
1438
|
+
if (prev) prev.row.groupEnd = true;
|
|
1439
|
+
prev = null;
|
|
1440
|
+
};
|
|
1441
|
+
for (let i = 0; i < messages.length; i++) {
|
|
1442
|
+
const message = messages[i];
|
|
1443
|
+
const at = Date.parse(message.created_at);
|
|
1444
|
+
const date = new Date(Number.isNaN(at) ? 0 : at);
|
|
1445
|
+
const key = kunChatDayKey(date, options.timeZone);
|
|
1446
|
+
let section = sections[sections.length - 1];
|
|
1447
|
+
if (!section || key > section.key) {
|
|
1448
|
+
closeGroup();
|
|
1449
|
+
section = { key, date, rows: [] };
|
|
1450
|
+
sections.push(section);
|
|
1451
|
+
}
|
|
1452
|
+
const own = message.sender_id === options.currentUserId;
|
|
1453
|
+
if (!dividerPlaced && !own && message.seq > options.lastReadSeq && message.seq > 0) {
|
|
1454
|
+
closeGroup();
|
|
1455
|
+
section.rows.push({ type: "unread", key: "unread" });
|
|
1456
|
+
dividerPlaced = true;
|
|
1457
|
+
}
|
|
1458
|
+
if (message.kind === "service") {
|
|
1459
|
+
closeGroup();
|
|
1460
|
+
section.rows.push({ type: "service", key: kunChatMessageKey(message), message });
|
|
1461
|
+
continue;
|
|
1462
|
+
}
|
|
1463
|
+
let group = [message];
|
|
1464
|
+
if (message.media_group_id != null) {
|
|
1465
|
+
while (group.length < KUN_CHAT_ALBUM_LIMIT && i + 1 < messages.length && messages[i + 1].kind === "message" && messages[i + 1].media_group_id === message.media_group_id && messages[i + 1].sender_id === message.sender_id) {
|
|
1466
|
+
group = [...group, messages[++i]];
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
const continues = prev !== null && prev.sender === message.sender_id && at - prev.at <= windowMs;
|
|
1470
|
+
if (!continues) closeGroup();
|
|
1471
|
+
const row = {
|
|
1472
|
+
type: "message",
|
|
1473
|
+
key: kunChatMessageKey(message),
|
|
1474
|
+
message: group.length > 1 ? albumRepresentative(group) : message,
|
|
1475
|
+
messages: group,
|
|
1476
|
+
own,
|
|
1477
|
+
groupStart: !continues,
|
|
1478
|
+
groupEnd: false
|
|
1479
|
+
};
|
|
1480
|
+
section.rows.push(row);
|
|
1481
|
+
const last = group[group.length - 1];
|
|
1482
|
+
const lastAt = Date.parse(last.created_at);
|
|
1483
|
+
prev = { sender: message.sender_id, at: Number.isNaN(lastAt) ? at : lastAt, row };
|
|
1484
|
+
}
|
|
1485
|
+
closeGroup();
|
|
1486
|
+
return sections;
|
|
1487
|
+
};
|
|
1488
|
+
|
|
484
1489
|
// src/icons-data.ts
|
|
485
1490
|
var KUN_BUNDLED_ICONS = {
|
|
486
1491
|
"lucide:x": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L6 18M6 6l12 12"/>' },
|
|
@@ -514,6 +1519,27 @@ var KUN_BUNDLED_ICONS = {
|
|
|
514
1519
|
"lucide:search": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m21 21l-4.34-4.34"/><circle cx="11" cy="11" r="8"/></g>' },
|
|
515
1520
|
"lucide:filter": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M22 3H2l8 9.46V19l4 2v-8.54z"/>' },
|
|
516
1521
|
"lucide:heart": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M2 9.5a5.5 5.5 0 0 1 9.591-3.676a.56.56 0 0 0 .818 0A5.49 5.49 0 0 1 22 9.5c0 2.29-1.5 4-3 5.5l-5.492 5.313a2 2 0 0 1-3 .019L5 15c-1.5-1.5-3-3.2-3-5.5"/>' },
|
|
1522
|
+
"lucide:clock": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 6v6l4 2"/></g>' },
|
|
1523
|
+
"lucide:check-check": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18 6L7 17l-5-5m20-2l-7.5 7.5L13 16"/>' },
|
|
1524
|
+
"lucide:circle-alert": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M12 8v4m0 4h.01"/></g>' },
|
|
1525
|
+
"lucide:reply": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M20 18v-2a4 4 0 0 0-4-4H4"/><path d="m9 17l-5-5l5-5"/></g>' },
|
|
1526
|
+
"lucide:quote": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1a6 6 0 0 0 6-6V5a2 2 0 0 0-2-2zM5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2a1 1 0 0 1 1 1v1a2 2 0 0 1-2 2a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1a6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z"/>' },
|
|
1527
|
+
"lucide:pencil": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497zM15 5l4 4"/>' },
|
|
1528
|
+
"lucide:pin": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 17v5M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1a2 2 0 0 0 0-4H8a2 2 0 0 0 0 4a1 1 0 0 1 1 1z"/>' },
|
|
1529
|
+
"lucide:pin-off": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 17v5m3-12.66V7a1 1 0 0 1 1-1a2 2 0 0 0 0-4H7.89M2 2l20 20M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11"/>' },
|
|
1530
|
+
"lucide:trash-2": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 11v6m4-6v6m5-11v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6M3 6h18M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"/>' },
|
|
1531
|
+
"lucide:flag": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528"/>' },
|
|
1532
|
+
"lucide:ban": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="10"/><path d="M4.929 4.929L19.07 19.071"/></g>' },
|
|
1533
|
+
"lucide:paperclip": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m16 6l-8.414 8.586a2 2 0 0 0 2.829 2.829l8.414-8.586a4 4 0 1 0-5.657-5.657l-8.379 8.551a6 6 0 1 0 8.485 8.485l8.379-8.551"/>' },
|
|
1534
|
+
"lucide:send-horizontal": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3.714 3.048a.498.498 0 0 0-.683.627l2.843 7.627a2 2 0 0 1 0 1.396l-2.842 7.627a.498.498 0 0 0 .682.627l18-8.5a.5.5 0 0 0 0-.904zM6 12h16"/>' },
|
|
1535
|
+
"lucide:smile-plus": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M22 11v1a10 10 0 1 1-9-10"/><path d="M8 14s1.5 2 4 2s4-2 4-2M9 9h.01M15 9h.01M16 5h6m-3-3v6"/></g>' },
|
|
1536
|
+
"lucide:image": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="18" height="18" x="3" y="3" rx="2" ry="2"/><circle cx="9" cy="9" r="2"/><path d="m21 15l-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/></g>' },
|
|
1537
|
+
"lucide:at-sign": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><circle cx="12" cy="12" r="4"/><path d="M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8"/></g>' },
|
|
1538
|
+
"lucide:bell": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.268 21a2 2 0 0 0 3.464 0m-10.47-5.674A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326"/>' },
|
|
1539
|
+
"lucide:bell-off": { "body": '<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.268 21a2 2 0 0 0 3.464 0M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742M2 2l20 20M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05"/>' },
|
|
1540
|
+
"lucide:archive": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><rect width="20" height="5" x="2" y="3" rx="1"/><path d="M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8m-10 4h4"/></g>' },
|
|
1541
|
+
"lucide:mail": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m22 7l-8.991 5.727a2 2 0 0 1-2.009 0L2 7"/><rect width="20" height="16" x="2" y="4" rx="2"/></g>' },
|
|
1542
|
+
"lucide:mail-open": { "body": '<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0z"/><path d="m22 10l-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10"/></g>' },
|
|
517
1543
|
"svg-spinners:90-ring-with-bg": { "body": '<path fill="currentColor" d="M12,1A11,11,0,1,0,23,12,11,11,0,0,0,12,1Zm0,19a8,8,0,1,1,8-8A8,8,0,0,1,12,20Z" opacity=".25"/><path fill="currentColor" d="M10.14,1.16a11,11,0,0,0-9,8.92A1.59,1.59,0,0,0,2.46,12,1.52,1.52,0,0,0,4.11,10.7a8,8,0,0,1,6.66-6.61A1.42,1.42,0,0,0,12,2.69h0A1.57,1.57,0,0,0,10.14,1.16Z"><animateTransform attributeName="transform" dur="0.75s" repeatCount="indefinite" type="rotate" values="0 12 12;360 12 12"/></path>' }
|
|
518
1544
|
};
|
|
519
1545
|
|
|
@@ -530,16 +1556,28 @@ var hasKunIcon = (name) => registry.has(name);
|
|
|
530
1556
|
|
|
531
1557
|
exports.KUN_AVATAR_FALLBACK = KUN_AVATAR_FALLBACK;
|
|
532
1558
|
exports.KUN_CATALOG_ZH_CN = KUN_CATALOG_ZH_CN;
|
|
1559
|
+
exports.KUN_CHAT_ALBUM_LIMIT = KUN_CHAT_ALBUM_LIMIT;
|
|
1560
|
+
exports.KUN_CHAT_ALBUM_SIDE = KUN_CHAT_ALBUM_SIDE;
|
|
1561
|
+
exports.KUN_CHAT_BLOCK_ENTITY_TYPES = KUN_CHAT_BLOCK_ENTITY_TYPES;
|
|
1562
|
+
exports.KUN_CHAT_TEXT_LIMIT = KUN_CHAT_TEXT_LIMIT;
|
|
1563
|
+
exports.KUN_CHAT_TYPING_INTERVAL = KUN_CHAT_TYPING_INTERVAL;
|
|
1564
|
+
exports.KUN_CHAT_TYPING_TIMEOUT = KUN_CHAT_TYPING_TIMEOUT;
|
|
533
1565
|
exports.KUN_DEFAULT_ROUNDED = KUN_DEFAULT_ROUNDED;
|
|
534
1566
|
exports.KUN_SHATTER_PHYSICS = KUN_SHATTER_PHYSICS;
|
|
535
1567
|
exports.KUN_SWIPE_DISMISS_PHYSICS = KUN_SWIPE_DISMISS_PHYSICS;
|
|
1568
|
+
exports.buildKunChatEntityTree = buildKunChatEntityTree;
|
|
536
1569
|
exports.cn = cn;
|
|
537
1570
|
exports.decodeIfEncoded = decodeIfEncoded;
|
|
1571
|
+
exports.formatKunChatMarkdown = formatKunChatMarkdown;
|
|
538
1572
|
exports.getKunIcon = getKunIcon;
|
|
539
1573
|
exports.getRandomSticker = getRandomSticker;
|
|
1574
|
+
exports.groupKunChatMessages = groupKunChatMessages;
|
|
540
1575
|
exports.hasKunIcon = hasKunIcon;
|
|
541
1576
|
exports.kunBgClasses = kunBgClasses;
|
|
542
1577
|
exports.kunBorderClasses = kunBorderClasses;
|
|
1578
|
+
exports.kunChatDayKey = kunChatDayKey;
|
|
1579
|
+
exports.kunChatMessageKey = kunChatMessageKey;
|
|
1580
|
+
exports.kunChatTreeText = kunChatTreeText;
|
|
543
1581
|
exports.kunChipSizeClasses = kunChipSizeClasses;
|
|
544
1582
|
exports.kunControlSizeClasses = kunControlSizeClasses;
|
|
545
1583
|
exports.kunControlSquareClasses = kunControlSquareClasses;
|
|
@@ -555,11 +1593,15 @@ exports.kunSolidClasses = kunSolidClasses;
|
|
|
555
1593
|
exports.kunSolidFgClasses = kunSolidFgClasses;
|
|
556
1594
|
exports.kunTextClasses = kunTextClasses;
|
|
557
1595
|
exports.kunVariantClasses = kunVariantClasses;
|
|
1596
|
+
exports.layoutKunChatAlbum = layoutKunChatAlbum;
|
|
1597
|
+
exports.normalizeKunChatEntities = normalizeKunChatEntities;
|
|
1598
|
+
exports.parseKunChatMarkdown = parseKunChatMarkdown;
|
|
558
1599
|
exports.pickAvatarFallback = pickAvatarFallback;
|
|
559
1600
|
exports.randomNum = randomNum;
|
|
560
1601
|
exports.registerKunIcon = registerKunIcon;
|
|
561
1602
|
exports.registerKunIcons = registerKunIcons;
|
|
562
1603
|
exports.resolveRounded = resolveRounded;
|
|
1604
|
+
exports.sliceKunChatEntities = sliceKunChatEntities;
|
|
563
1605
|
exports.translateKunMessage = translateKunMessage;
|
|
564
1606
|
//# sourceMappingURL=index.cjs.map
|
|
565
1607
|
//# sourceMappingURL=index.cjs.map
|