@jboltai/tokui 0.2.2 → 0.2.4

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/tokui.mjs CHANGED
@@ -135,6 +135,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
135
135
  "agent.thinking": "思考",
136
136
  "agent.generating": "生成",
137
137
  "agent.total": "总计",
138
+ "agent.defaultName": "智能体",
139
+ "terminal.title": "终端",
140
+ "sandbox.title": "预览",
141
+ "canvas.title": "画布",
142
+ "toolCall.defaultName": "工具",
143
+ "artifact.codeTab": "代码",
144
+ "artifact.previewTab": "预览",
145
+ "testResult.total": "总计:{n}",
138
146
  "picker.noMatch": "无匹配项",
139
147
  "rate.defaultLabel": "评分",
140
148
  "select.placeholder": "请选择",
@@ -290,6 +298,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
290
298
  "agent.thinking": "Thinking",
291
299
  "agent.generating": "Generating",
292
300
  "agent.total": "Total",
301
+ "agent.defaultName": "Agent",
302
+ "terminal.title": "Terminal",
303
+ "sandbox.title": "Preview",
304
+ "canvas.title": "Canvas",
305
+ "toolCall.defaultName": "tool",
306
+ "artifact.codeTab": "Code",
307
+ "artifact.previewTab": "Preview",
308
+ "testResult.total": "Total: {n}",
293
309
  "bubble.you": "You",
294
310
  "bubble.ai": "AI",
295
311
  "bubble.system": "System",
@@ -602,16 +618,20 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
602
618
  })), m = /* @__PURE__ */ o(((e, t) => {
603
619
  function n(e) {
604
620
  let t = !1;
605
- for (let n = 0; n < e.length; n++) if (e[n] === "\"") t = !t;
606
- else if (e[n] === "]" && !t) return n;
621
+ for (let n = 0; n < e.length; n++) if (e[n] === "\"") {
622
+ if (!t && e[n + 1] === "]") continue;
623
+ t = !t;
624
+ } else if (e[n] === "]" && !t) return n;
607
625
  return -1;
608
626
  }
609
627
  function r(e) {
610
628
  let t = !1, n = 0;
611
629
  for (let r = 0; r < e.length; r++) {
612
630
  let i = e[r];
613
- if (i === "\"") t = !t;
614
- else if (!t) {
631
+ if (i === "\"") {
632
+ if (!t && e[r + 1] === "]") continue;
633
+ t = !t;
634
+ } else if (!t) {
615
635
  if (i === "[") n++;
616
636
  else if (i === "]") {
617
637
  if (n === 0) return r;
@@ -621,7 +641,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
621
641
  }
622
642
  return -1;
623
643
  }
624
- var i = new Set(/* @__PURE__ */ "form.table.thead.tbody.card.ft.row.col.list.select.radio.checkbox.code.imgs.md.textarea.tabs.tab.accordion.collapse.dialog.btngroup.picker.timeline.steps.drawer.ol.ul.i.item.think.think-chain.think-step.bubble.toolbar.badge-box.dropdown.transfer.callout.cascader.tree.tn.desc.carousel.popover.input-tag.watermark.menu.print-area.chat-input.msg-actions.tool-call.diff.quick-reply.plan.file-tree.ft-folder.terminal.sandbox.test-result.quote.toggle-group.conversations.welcome.welcome-feature.suggestions.attachments.artifact.artifact-code.artifact-preview.scroll-area.sidebar.sidebar-content.sidebar-footer.command.command-group.hover-card.hover-trigger.hover-content.resizable.canvas.canvas-content.chart.ins.katex.mermaid.p.tour.affix.preview-group.segmented.anchor.float-button.masonry".split("."));
644
+ var i = new Set(/* @__PURE__ */ "form.table.thead.tbody.card.ft.row.col.list.grid.cell.select.radio.checkbox.code.imgs.md.textarea.tabs.tab.accordion.collapse.dialog.btngroup.picker.timeline.steps.drawer.ol.ul.i.item.think.think-chain.think-step.bubble.toolbar.badge-box.dropdown.transfer.callout.cascader.tree.tn.desc.carousel.popover.input-tag.watermark.menu.print-area.chat-input.msg-actions.tool-call.diff.quick-reply.plan.file-tree.ft-folder.terminal.sandbox.test-result.quote.toggle-group.conversations.welcome.welcome-feature.suggestions.attachments.artifact.artifact-code.artifact-preview.scroll-area.sidebar.sidebar-content.sidebar-footer.command.command-group.hover-card.hover-trigger.hover-content.resizable.canvas.canvas-content.chart.ins.katex.mermaid.p.tour.affix.preview-group.segmented.anchor.float-button.masonry".split("."));
625
645
  function a(e) {
626
646
  if (!e || e.type !== "chart") return !1;
627
647
  var t = e.attrs || {};
@@ -658,7 +678,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
658
678
  "sub",
659
679
  "sup",
660
680
  "kbd"
661
- ]), d = new Set(/* @__PURE__ */ "stripe.dis.ro.req.chk.multi.disabled.readonly.required.checked.multiple.striped.auto.plain.round.closable.bordered.open.pill.dot.leaf.inline.rounded.container.copy.regenerate.like.dislike.visible.delete.controls.active.collapsible.toggle.search.thumb.reset.print.show-total.live.approval.streaming.range.half.sortable.filter.virtual.lazy.pagination.mask".split(".")), f = null;
681
+ ]), d = new Set(/* @__PURE__ */ "stripe.dis.ro.req.chk.multi.disabled.readonly.required.checked.multiple.striped.auto.plain.round.closable.bordered.open.pill.dot.leaf.inline.rounded.container.copy.regenerate.like.dislike.visible.delete.controls.active.collapsible.collapsed.toggle.search.thumb.reset.print.show-total.live.approval.streaming.range.half.sortable.filter.virtual.lazy.pagination.mask".split(".")), f = null;
662
682
  function p(e) {
663
683
  f = e;
664
684
  }
@@ -730,6 +750,20 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
730
750
  }
731
751
  }
732
752
  t.content = i.join(" ");
753
+ for (let e = 0; e < 4; e++) {
754
+ let e = !1;
755
+ for (let n of Object.keys(t.attrs)) {
756
+ let r = t.attrs[n];
757
+ if (typeof r != "string") continue;
758
+ let i = r.match(/^([\s\S]*?)\s+([a-zA-Z][a-zA-Z0-9]{0,6}):([\s\S]*)$/);
759
+ if (!i || !i[1] || !h.has(i[2]) || t.attrs[i[2]] !== void 0) continue;
760
+ t.attrs[n] = i[1];
761
+ let a = i[3];
762
+ !a && t.content && (a = t.content, t.content = ""), t.attrs[i[2]] = a.replace(/^"|"$/g, ""), t._lastRepairKey = i[2], e = !0;
763
+ }
764
+ if (!e) break;
765
+ }
766
+ t._lastRepairKey && t.content && t.content.endsWith("\"") && (t.attrs[t._lastRepairKey] += " " + t.content.slice(0, -1), t.content = ""), delete t._lastRepairKey;
733
767
  let a = {
734
768
  ol: "list",
735
769
  ul: "list",
@@ -820,7 +854,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
820
854
  this.reset(), this._dslText = e, this.buffer = e, this._tryParse(), this._flush();
821
855
  }
822
856
  _flush() {
823
- if (this.buffer.trim() && this._tryParse(), this.buffer.trim()) {
857
+ if (this._flushing = !0, this.buffer.trim() && this._tryParse(), this._flushing = !1, this.buffer.trim()) {
824
858
  let e;
825
859
  if (this._isRawContent()) {
826
860
  let t = this.stack[this.stack.length - 1], n = this.streaming && t && t._rawEmittedLen ? t._rawEmittedLen : 0;
@@ -932,7 +966,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
932
966
  continue;
933
967
  }
934
968
  let e = /^tr\b/.test(this.buffer) ? r(this.buffer) : n(this.buffer);
935
- if (e === -1) break;
969
+ if (e === -1 && this._flushing && (e = this.buffer.indexOf("]")), e === -1) break;
936
970
  let t = e, a = !0, o = this.buffer.slice(0, e), s = -1;
937
971
  {
938
972
  let e = !1;
@@ -1014,7 +1048,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1014
1048
  "input-tag",
1015
1049
  "watermark",
1016
1050
  "badge-box"
1017
- ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, l = e.type === "tn" && e.attrs.leaf !== void 0, d = e.type === "input-tag" && e.attrs.tags, f = e.type === "katex" && !!e.attrs.f, p = r || l || d || f || o(e) || s(e), m = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart" && e.type !== "masonry", h = a(e);
1051
+ ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, l = e.type === "tn" && e.attrs.leaf !== void 0, d = e.type === "input-tag" && e.attrs.tags, f = e.type === "katex" && !!e.attrs.f, p = r || l || d || f || o(e) || s(e), m = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart" && e.type !== "masonry" && e.type !== "grid", h = a(e);
1018
1052
  h && (e._previewKey = e._dslStart), i.has(e.type) && !m && !p && !h ? this.stack.length >= this.maxDepth ? (console.warn("TokUI Parser: 嵌套深度超过 maxDepth (" + this.maxDepth + "),按自闭合处理"), this.stack.length > 0 && this.stack[this.stack.length - 1].children.push(e), this.onNode(e)) : (e._stream = "open", this.stack.push(e), this.onNode(e)) : (this.stack.length > 0 && this.stack[this.stack.length - 1].children.push(e), this.onNode(e));
1019
1053
  }
1020
1054
  _emitBuffered(e) {
@@ -1033,7 +1067,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1033
1067
  "input-tag",
1034
1068
  "watermark",
1035
1069
  "badge-box"
1036
- ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, c = e.type === "tn" && e.attrs.leaf !== void 0, l = e.type === "input-tag" && e.attrs.tags, d = e.type === "katex" && !!e.attrs.f, f = r || c || l || d || o(e) || s(e), p = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart" && e.type !== "masonry", m = a(e);
1070
+ ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, c = e.type === "tn" && e.attrs.leaf !== void 0, l = e.type === "input-tag" && e.attrs.tags, d = e.type === "katex" && !!e.attrs.f, f = r || c || l || d || o(e) || s(e), p = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart" && e.type !== "masonry" && e.type !== "grid", m = a(e);
1037
1071
  m && (e._previewKey = e._dslStart), i.has(e.type) && !p && !f && !m ? this.stack.length >= this.maxDepth ? (console.warn("TokUI Parser: 嵌套深度超过 maxDepth (" + this.maxDepth + "),按自闭合处理"), this.stack.length > 0 ? this.stack[this.stack.length - 1].children.push(e) : this.onNode(e)) : this.stack.push(e) : this.stack.length > 0 ? this.stack[this.stack.length - 1].children.push(e) : this.onNode(e);
1038
1072
  }
1039
1073
  startStream() {
@@ -1317,6 +1351,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1317
1351
  "right",
1318
1352
  "inline"
1319
1353
  ]),
1354
+ grid: new Set(["dense", "flush"]),
1320
1355
  dv: new Set([
1321
1356
  "dashed",
1322
1357
  "dotted",
@@ -1366,7 +1401,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1366
1401
  kbd: new Set(["sm", "lg"])
1367
1402
  }, m = class {
1368
1403
  constructor(e) {
1369
- this.registry = {}, this.eventBus = e, this.slotStack = [], this._boundElements = [], this._onError = null, this._onComponentEvent = null;
1404
+ this.registry = {}, this.eventBus = e, this.slotStack = [], this._boundElements = [], this._cleanupElements = [], this._onError = null, this._onComponentEvent = null, this.streamAnimation = !0;
1405
+ }
1406
+ _streamFadeIn(e) {
1407
+ this.streamAnimation && (!e || e.nodeType !== 1 || this.slotStack.length > 0 || e.classList.add("tokui-fade-in"));
1370
1408
  }
1371
1409
  createReporter(e, t, n) {
1372
1410
  var r = this, i = c(t && t.on), a = t && t.id != null && t.id !== "" ? String(t.id) : null;
@@ -1431,7 +1469,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1431
1469
  var f = s("div", { class: "tokui-error__detail" });
1432
1470
  f.textContent = String(t.message || t), u.appendChild(f), l = u;
1433
1471
  }
1434
- return this._applyVariants(l, e), l && l.nodeType === 1 && e.type && e.type !== "_text" && l.setAttribute("data-tokui-tag", e.type), l;
1472
+ if (this._applyVariants(l, e), l && l.nodeType === 1 && e.type && e.type !== "_text") {
1473
+ l.setAttribute("data-tokui-tag", e.type), l._tokuiType ||= e.type;
1474
+ var p = e.attrs && e.attrs.id != null && e.attrs.id !== "" ? String(e.attrs.id) : null;
1475
+ p && !l.getAttribute("id") && !(typeof l.querySelector == "function" && l.querySelector("[id=\"" + p.replace(/"/g, "\\\"") + "\"]")) && l.setAttribute("id", p);
1476
+ }
1477
+ return l;
1435
1478
  }
1436
1479
  _applyVariants(e, t) {
1437
1480
  var n = t.attrs && t.attrs.v;
@@ -1450,7 +1493,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1450
1493
  mount(e, t) {
1451
1494
  this._mountRoot = t;
1452
1495
  let n = this.render(e);
1453
- return n.nodeType === 1 && n.classList.add("tokui-fade-in"), t.appendChild(n), this.bindEvents(n), n._streamCloseHook && n._streamCloseHook(), n;
1496
+ return !n || !n.nodeType ? null : (n.nodeType === 1 && n.classList.add("tokui-fade-in"), t.appendChild(n), this.bindEvents(n), n._streamCloseHook && n._streamCloseHook(), n);
1454
1497
  }
1455
1498
  mountStreaming(e, t) {
1456
1499
  return this._mountRoot = t, e._stream === "skeleton-pending" ? this._streamSkeletonPending(e, t) : e._stream === "skeleton-finalize" ? this._streamSkeletonFinalize(e, t) : e._streamPreview ? this._streamChartPreview(e, t) : e.type === "tr" && e._stream === "open" ? this._streamTrOpen(e, t) : e.type === "tr" && e._stream === "preview" ? this._streamTrPreview(e) : e.type === "tr" && e._stream === "finalize" ? this._streamTrFinalize(e, t) : e._stream === "open" ? this._streamOpen(e, t) : e._stream === "close" ? this._streamClose(e) : e.type === "chart" && e._previewKey !== void 0 ? this._streamChartFinalize(e, t) : this._streamChild(e, t);
@@ -1460,7 +1503,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1460
1503
  let n = e._previewKey, r = this._pendingCharts[n];
1461
1504
  if (r) return r._tokuiChartUpdate && r._tokuiChartUpdate(e.attrs), r;
1462
1505
  let i = this.render(e), a = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, o = a ? a.slot : t;
1463
- return i.nodeType === 1 && i.classList.add("tokui-fade-in"), o.appendChild(i), this._pendingCharts[n] = i, i;
1506
+ return this._streamFadeIn(i), o.appendChild(i), this._pendingCharts[n] = i, i;
1464
1507
  }
1465
1508
  _streamChartFinalize(e, t) {
1466
1509
  this._pendingCharts = this._pendingCharts || {};
@@ -1471,7 +1514,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1471
1514
  var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null;
1472
1515
  n && n.el && (e._tbodyEl = n.el);
1473
1516
  var r = this.render(e, n ? n.containerType : void 0);
1474
- return r && r.nodeType === 1 && r.classList.add("tokui-fade-in"), (n ? n.slot : t).appendChild(r), this._trRegistry = this._trRegistry || {}, this._trRegistry[e._trKey] = r, r;
1517
+ return this._streamFadeIn(r), (n ? n.slot : t).appendChild(r), this._trRegistry = this._trRegistry || {}, this._trRegistry[e._trKey] = r, r;
1475
1518
  }
1476
1519
  _streamTrPreview(e) {
1477
1520
  this._trRegistry = this._trRegistry || {};
@@ -1486,7 +1529,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1486
1529
  _streamSkeletonPending(e, t) {
1487
1530
  this._pendingSkeletons = this._pendingSkeletons || {};
1488
1531
  var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = n ? n.slot : t, i = this._buildSkeleton(e.type);
1489
- return i && i.nodeType === 1 && i.classList.add("tokui-fade-in"), r && r.appendChild(i), this._pendingSkeletons[e._skelKey] = i, i;
1532
+ return this._streamFadeIn(i), r && r.appendChild(i), this._pendingSkeletons[e._skelKey] = i, i;
1490
1533
  }
1491
1534
  _streamSkeletonFinalize(e, t) {
1492
1535
  this._pendingSkeletons = this._pendingSkeletons || {};
@@ -1509,7 +1552,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1509
1552
  }
1510
1553
  _streamOpen(e, t) {
1511
1554
  let n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = this.render(e, n ? n.containerType : void 0);
1512
- r && r.nodeType === 1 && (r._tokuiStreamActive = !0), r.nodeType === 1 && !r.classList.contains("tokui-hover-card__content-temp") && r.classList.add("tokui-fade-in");
1555
+ r && r.nodeType === 1 && (r._tokuiStreamActive = !0), r.nodeType === 1 && !r.classList.contains("tokui-hover-card__content-temp") && this._streamFadeIn(r);
1513
1556
  let i = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1].slot : t;
1514
1557
  if (e.type === "ft" && this.slotStack.length > 0) {
1515
1558
  let e = this.slotStack[this.slotStack.length - 1];
@@ -1547,7 +1590,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1547
1590
  let t = this.slotStack.pop();
1548
1591
  if (this.bindEvents(t.el), t.el._streamCloseHook && t.el._streamCloseHook(), t.el._tokuiType === e.type || this._getNodeType(t.el) === e.type) break;
1549
1592
  }
1550
- return null;
1593
+ return this._flushPendingDels && this._flushPendingDels(), null;
1551
1594
  }
1552
1595
  _streamChild(e, t) {
1553
1596
  var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = n ? n.containerType : void 0, i = n ? n.slot : t;
@@ -1558,7 +1601,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1558
1601
  var s = o.querySelector("input[type=radio]");
1559
1602
  s && (s.name = a);
1560
1603
  }
1561
- return o.nodeType === 1 && o.classList.add("tokui-fade-in"), i.appendChild(o), o;
1604
+ return this._streamFadeIn(o), i.appendChild(o), o;
1562
1605
  }
1563
1606
  if (e.type === "opt" && n && n.el._slot && n.el._slot._checkboxName) {
1564
1607
  var c = n.el._slot._checkboxName, l = this.render(e, "checkbox");
@@ -1566,7 +1609,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1566
1609
  var u = l.querySelector("input[type=checkbox]");
1567
1610
  u && (u.name = c);
1568
1611
  }
1569
- return l.nodeType === 1 && l.classList.add("tokui-fade-in"), i.appendChild(l), l;
1612
+ return this._streamFadeIn(l), i.appendChild(l), l;
1570
1613
  }
1571
1614
  if (e.type === "opt" && n && n.el._slot && n.el._slot._segmentedName) {
1572
1615
  var d = n.el._slot._segmentedName, f = this.render(e, "segmented");
@@ -1574,24 +1617,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1574
1617
  var p = f.querySelector("input[type=radio]");
1575
1618
  p && (p.name = d);
1576
1619
  }
1577
- return f.nodeType === 1 && f.classList.add("tokui-fade-in"), i.appendChild(f), f;
1620
+ return this._streamFadeIn(f), i.appendChild(f), f;
1578
1621
  }
1579
1622
  if (e.type === "opt" && n && n.containerType === "picker") {
1580
1623
  var m = n.slot, h = this.render(e, "picker");
1581
- h.nodeType === 1 && h.classList.add("tokui-fade-in");
1624
+ this._streamFadeIn(h);
1582
1625
  var g = m.querySelector(".tokui-picker-empty");
1583
1626
  return g ? m.insertBefore(h, g) : m.appendChild(h), h;
1584
1627
  }
1585
1628
  if (e.type === "opt" && n && n.containerType === "transfer" && n.el._tokuiTransferAppend) {
1586
1629
  var _ = n.el._tokuiTransferAppend(e);
1587
- return _ && _.nodeType === 1 && _.classList.add("tokui-fade-in"), null;
1630
+ return this._streamFadeIn(_), null;
1588
1631
  }
1589
1632
  if (e.type === "conv" && n && n.el && typeof n.el._renderConvChild == "function") {
1590
1633
  var v = n.el._renderConvChild(e);
1591
- return v && v.nodeType === 1 && v.classList.add("tokui-fade-in"), i.appendChild(v), v;
1634
+ return this._streamFadeIn(v), i.appendChild(v), v;
1635
+ }
1636
+ if (e.type === "_text") {
1637
+ var y = i.childNodes, b = y && y.length ? y[y.length - 1] : null, x;
1638
+ return b && b.nodeType === 3 ? (b.textContent += e.content, x = b) : (x = document.createTextNode(e.content), i.appendChild(x)), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), x;
1592
1639
  }
1593
- var y = this.render(e, r);
1594
- return y.nodeType === 1 && y.classList.add("tokui-fade-in"), i.appendChild(y), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), this.slotStack.length === 0 && this.bindEvents(y), y;
1640
+ var S = this.render(e, r);
1641
+ return this._streamFadeIn(S), i.appendChild(S), n && n.el && n.el._streamAppendHook && n.el._streamAppendHook(e), this.slotStack.length === 0 && this.bindEvents(S), S;
1595
1642
  }
1596
1643
  _collectFormData(e) {
1597
1644
  let t = {};
@@ -1622,18 +1669,30 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
1622
1669
  let t = e.className && e.className.match && e.className.match(/tokui-(\w+)/);
1623
1670
  return t ? t[1] : "";
1624
1671
  }
1672
+ _registerCleanup(e, t) {
1673
+ !e || typeof t != "function" || (e._tokuiCleanupFns || (e._tokuiCleanupFns = [], this._cleanupElements.push(e)), e._tokuiCleanupFns.push(t));
1674
+ }
1625
1675
  destroy() {
1626
- this._boundElements.forEach(function(e) {
1676
+ this._cleanupElements.forEach(function(e) {
1677
+ (e._tokuiCleanupFns || []).forEach(function(e) {
1678
+ try {
1679
+ e();
1680
+ } catch {}
1681
+ }), delete e._tokuiCleanupFns;
1682
+ }), this._cleanupElements = [], this._boundElements.forEach(function(e) {
1627
1683
  e.listeners.forEach(function(t) {
1628
1684
  e.element.removeEventListener(t.type, t.fn);
1629
1685
  }), delete e.element._tokuiBound, delete e.element._tokuiClickBound;
1630
- }), this._boundElements = [], this.slotStack = [];
1686
+ }), this._boundElements = [], this.slotStack = [], (this._delTimers || []).forEach(function(e) {
1687
+ clearTimeout(e);
1688
+ }), this._delTimers = [], this._pendingDels = [];
1631
1689
  }
1632
1690
  resetSlotStack() {
1633
1691
  for (; this.slotStack.length > 0;) {
1634
1692
  let e = this.slotStack.pop();
1635
1693
  this.bindEvents(e.el);
1636
1694
  }
1695
+ this._flushPendingDels && this._flushPendingDels();
1637
1696
  }
1638
1697
  bindEvents(e) {
1639
1698
  if (!this.eventBus || e.nodeType !== 1 || e._tokuiBound) return;
@@ -5651,7 +5710,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5651
5710
  sort: "<path d=\"M11 5h10\"/><path d=\"M11 9h7\"/><path d=\"M11 13h4\"/><path d=\"m3 17 3 3 3-3\"/><path d=\"M6 18V4\"/>",
5652
5711
  star: "<polygon points=\"12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2\"/>",
5653
5712
  link: "<path d=\"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71\"/><path d=\"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71\"/>",
5654
- menu: "<line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"/>"
5713
+ menu: "<line x1=\"3\" y1=\"12\" x2=\"21\" y2=\"12\"/><line x1=\"3\" y1=\"6\" x2=\"21\" y2=\"6\"/><line x1=\"3\" y1=\"18\" x2=\"21\" y2=\"18\"/>",
5714
+ sparkles: "<path d=\"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .962 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.962 0z\"/><path d=\"M20 3v4\"/><path d=\"M22 5h-4\"/><path d=\"M4 17v2\"/><path d=\"M5 18H3\"/>",
5715
+ lightbulb: "<path d=\"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5\"/><path d=\"M9 18h6\"/><path d=\"M10 22h4\"/>",
5716
+ "chevron-right": "<path d=\"m9 18 6-6-6-6\"/>"
5655
5717
  };
5656
5718
  function r(e, t) {
5657
5719
  var r = n[e];
@@ -7927,7 +7989,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7927
7989
  var n = typeof l == "function" ? u().t : window.TokUI && window.TokUI._internal && window.TokUI._internal.t || function(e) {
7928
7990
  return e;
7929
7991
  };
7930
- function r(e) {
7992
+ function r(e, t) {
7993
+ if (typeof l == "function") try {
7994
+ return v().iconSvg(e, t);
7995
+ } catch {
7996
+ return "";
7997
+ }
7998
+ var n = typeof window < "u" && window.TokUI && window.TokUI._internal;
7999
+ return n && n.iconSvg ? n.iconSvg(e, t) : "";
8000
+ }
8001
+ function i(e) {
7931
8002
  if (!e) return null;
7932
8003
  let t = {
7933
8004
  primary: "var(--tokui-primary)",
@@ -7940,7 +8011,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7940
8011
  };
7941
8012
  return t[e] ? t[e] : /^[0-9a-fA-F]{6}$/.test(e) ? "#" + e : null;
7942
8013
  }
7943
- var i = {
8014
+ var a = {
7944
8015
  js: {
7945
8016
  keywords: /\b(abstract|arguments|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|eval|export|extends|finally|for|from|function|if|implements|import|in|instanceof|interface|let|new|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\b/g,
7946
8017
  types: /\b(Array|Boolean|Date|Error|Function|Infinity|JSON|Map|Math|NaN|Number|Object|Promise|RegExp|Set|String|Symbol|WeakMap|WeakSet|console|document|window|undefined|null|true|false|parseInt|parseFloat|isNaN|isFinite|require|module|exports|process|Buffer)\b/g
@@ -7994,8 +8065,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7994
8065
  shell: null,
7995
8066
  zsh: null
7996
8067
  };
7997
- Object.keys(i).forEach(function(e) {
7998
- if (i[e] === null) {
8068
+ Object.keys(a).forEach(function(e) {
8069
+ if (a[e] === null) {
7999
8070
  var t = {
8000
8071
  javascript: "js",
8001
8072
  jsx: "js",
@@ -8006,24 +8077,24 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8006
8077
  shell: "bash",
8007
8078
  zsh: "bash"
8008
8079
  }[e];
8009
- t && i[t] && (i[e] = i[t]);
8080
+ t && a[t] && (a[e] = a[t]);
8010
8081
  }
8011
8082
  });
8012
- function a(e, t) {
8083
+ function o(e, t) {
8013
8084
  if (!e) return "";
8014
- var n = String(e), r = i[t];
8085
+ var n = String(e), r = a[t];
8015
8086
  if (!r) return n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8016
- var a = [], o = "\0PH_", s = "\0", c = /\x00PH_(\d+)\x00/g;
8087
+ var i = [], o = "\0PH_", s = "\0", c = /\x00PH_(\d+)\x00/g;
8017
8088
  function l() {
8018
- return o + String(a.length).padStart(5, "0") + s;
8089
+ return o + String(i.length).padStart(5, "0") + s;
8019
8090
  }
8020
8091
  function u(e, t) {
8021
8092
  var n = l(), r = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8022
- return a.push("<span class=\"tok-" + t + "\">" + r + "</span>"), n;
8093
+ return i.push("<span class=\"tok-" + t + "\">" + r + "</span>"), n;
8023
8094
  }
8024
8095
  function d(e, t) {
8025
8096
  var n = l();
8026
- return a.push("<span class=\"tok-" + t + "\">" + e + "</span>"), n;
8097
+ return i.push("<span class=\"tok-" + t + "\">" + e + "</span>"), n;
8027
8098
  }
8028
8099
  t === "json" && (n = n.replace(/(["'])(?:(?!\1|\\).|\\.)*\1(?=\s*:)/g, function(e) {
8029
8100
  return u(e, "type");
@@ -8040,7 +8111,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8040
8111
  })), n = n.replace(/\/\*[\s\S]*?\*\//g, function(e) {
8041
8112
  return e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").split("\n").map(function(e) {
8042
8113
  var t = l();
8043
- return a.push("<span class=\"tok-cmt\">" + e + "</span>"), t;
8114
+ return i.push("<span class=\"tok-cmt\">" + e + "</span>"), t;
8044
8115
  }).join("\n");
8045
8116
  });
8046
8117
  var f = n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
@@ -8055,10 +8126,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8055
8126
  }), f = f.replace(/(&amp;&amp;|\|\||===|!==|=&gt;|\.\.\.|\+\+|--|[+\-*/%=!|^~?:]+)/g, function(e) {
8056
8127
  return d(e, "op");
8057
8128
  }), f = f.replace(c, function(e, t) {
8058
- return a[parseInt(t)];
8129
+ return i[parseInt(t)];
8059
8130
  }), f;
8060
8131
  }
8061
- function o(e) {
8132
+ function s(e) {
8062
8133
  var t = e === "sql", n = e !== "css" && e !== "html", r = {
8063
8134
  mode: "default",
8064
8135
  returnTo: "default"
@@ -8134,9 +8205,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8134
8205
  feed: a
8135
8206
  };
8136
8207
  }
8137
- function s(e) {
8208
+ function c(e) {
8138
8209
  let { el: t } = typeof l == "function" ? h() : window.TokUI._internal;
8139
- function s(e, t) {
8210
+ function c(e, t) {
8140
8211
  return t && typeof e.offsetLeft == "number" ? {
8141
8212
  kx: t.left - e.offsetLeft,
8142
8213
  ky: t.top - e.offsetTop
@@ -8154,10 +8225,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8154
8225
  "h6"
8155
8226
  ].forEach((n) => {
8156
8227
  e.register(n, (e) => {
8157
- let i = t(n, { class: `tokui-${n}` }, e.content || e.attrs && e.attrs.tx);
8158
- e.attrs && e.attrs.id && (i.id = e.attrs.id);
8159
- let a = r(e.attrs.bg), o = r(e.attrs.fc), s = e.attrs.v || "";
8160
- return a && (s.includes("underline") || s.includes("ribbon") || s.includes("badge") || s.includes("pill") ? i.style.setProperty("--tokui-title-bg", a) : i.style.background = a), o && (i.style.color = o), i;
8228
+ let r = t(n, { class: `tokui-${n}` }, e.content || e.attrs && e.attrs.tx);
8229
+ e.attrs && e.attrs.id && (r.id = e.attrs.id);
8230
+ let a = i(e.attrs.bg), o = i(e.attrs.fc), s = e.attrs.v || "";
8231
+ return a && (s.includes("underline") || s.includes("ribbon") || s.includes("badge") || s.includes("pill") ? r.style.setProperty("--tokui-title-bg", a) : r.style.background = a), o && (r.style.color = o), r;
8161
8232
  });
8162
8233
  }), e.register("p", (e, n) => {
8163
8234
  var r = { class: "tokui-p" };
@@ -8209,14 +8280,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8209
8280
  }), a;
8210
8281
  });
8211
8282
  }), e.register("tag", (e) => {
8212
- let i = e.attrs || {}, a = i.tx || e.content || "", o = ["tokui-tag"], s = i.t || "";
8283
+ let r = e.attrs || {}, a = r.tx || e.content || "", o = ["tokui-tag"], s = r.t || "";
8213
8284
  s && s !== "default" && o.push("tokui-tag--" + s);
8214
- let c = i.s || "";
8215
- c && c !== "medium" && o.push("tokui-tag--" + c), i.round !== void 0 && o.push("tokui-tag--round"), i.bordered !== void 0 && o.push("tokui-tag--bordered"), i.dis !== void 0 && o.push("tokui-tag--disabled");
8216
- let l = t("span", { class: o.join(" ") }), u = r(i.bg), d = r(i.fc);
8285
+ let c = r.s || "";
8286
+ c && c !== "medium" && o.push("tokui-tag--" + c), r.round !== void 0 && o.push("tokui-tag--round"), r.bordered !== void 0 && o.push("tokui-tag--bordered"), r.dis !== void 0 && o.push("tokui-tag--disabled");
8287
+ let l = t("span", { class: o.join(" ") }), u = i(r.bg), d = i(r.fc);
8217
8288
  u && (l.style.background = u), d && (l.style.color = d);
8218
8289
  let f = t("span", { class: "tokui-tag__content" });
8219
- if (f.textContent = a, l.appendChild(f), i.closable !== void 0) {
8290
+ if (f.textContent = a, l.appendChild(f), r.closable !== void 0) {
8220
8291
  o.push("tokui-tag--closable"), l.className = o.join(" ");
8221
8292
  let e = t("span", {
8222
8293
  class: "tokui-tag__close",
@@ -8341,18 +8412,18 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8341
8412
  }), n || (t.setAttribute("aria-checked", "true"), t.classList.add("tokui-toggle--pressed"));
8342
8413
  }), c._slot = c, c._tokuiType = "toggle-group", c;
8343
8414
  }), e.register("dv", (e) => {
8344
- let n = e.attrs || {}, i = n.tx || e.content || "", a = n.vert !== void 0, o = a ? "span" : "div", s = ["tokui-dv"];
8415
+ let n = e.attrs || {}, r = n.tx || e.content || "", a = n.vert !== void 0, o = a ? "span" : "div", s = ["tokui-dv"];
8345
8416
  if (n.v && s.push("tokui-dv--" + n.v), n.size && s.push("tokui-dv--" + n.size), a && s.push("tokui-dv--vert"), n.plain !== void 0 && s.push("tokui-dv--plain"), a) return t(o, { class: s.join(" ") });
8346
- if (i) {
8417
+ if (r) {
8347
8418
  s.push("tokui-dv--text");
8348
8419
  let e = n.align || "center";
8349
8420
  e !== "center" && s.push("tokui-dv--" + e);
8350
- let a = t(o, { class: s.join(" ") }), c = {}, l = r(n.bg);
8421
+ let a = t(o, { class: s.join(" ") }), c = {}, l = i(n.bg);
8351
8422
  l && (c.borderColor = l), n.th && (c.borderWidth = n.th), Object.keys(c).length && (c.borderColor && (a.style.borderColor = c.borderColor), c.borderWidth && (a.style.borderWidth = c.borderWidth));
8352
8423
  let u = t("span", { class: "tokui-dv-text" });
8353
- return u.textContent = i, a.appendChild(u), a;
8424
+ return u.textContent = r, a.appendChild(u), a;
8354
8425
  }
8355
- let c = t(o, { class: s.join(" ") }), l = {}, u = r(n.bg);
8426
+ let c = t(o, { class: s.join(" ") }), l = {}, u = i(n.bg);
8356
8427
  return u && (l.borderColor = u), n.th && (l.borderWidth = n.th), Object.keys(l).length && (l.borderColor && (c.style.borderColor = l.borderColor), l.borderWidth && (c.style.borderWidth = l.borderWidth)), c;
8357
8428
  }), e.register("progress", (e) => {
8358
8429
  let n = e.attrs || {}, r = Math.min(100, Math.max(0, parseInt(n.v) || 0)), i = n.l || "", a = n.t || "line", o = n.s || "", s = n.status || "", c = n.stripe !== void 0, l = "";
@@ -8406,15 +8477,15 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8406
8477
  e.status !== void 0 && (d.classList.remove("tokui-progress--success", "tokui-progress--error"), e.status === "success" ? d.classList.add("tokui-progress--success") : e.status === "error" && d.classList.add("tokui-progress--error"));
8407
8478
  }, d;
8408
8479
  });
8409
- function y(t) {
8480
+ function v(t) {
8410
8481
  var n = null, r = e._mountRoot;
8411
8482
  return r && typeof r.querySelector == "function" && (n = r.querySelector("[id=\"" + String(t).replace(/"/g, "\\\"") + "\"]")), n ||= document.getElementById(t), n;
8412
8483
  }
8413
- function b(t) {
8484
+ function x(t) {
8414
8485
  for (var n = t, r = e._mountRoot || null; n && !n._tokuiType && n.parentElement && n.parentElement !== r;) n = n.parentElement;
8415
8486
  return n || t;
8416
8487
  }
8417
- function x(t, n, r) {
8488
+ function S(t, n, r) {
8418
8489
  if (e._onComponentEvent) try {
8419
8490
  e._onComponentEvent({
8420
8491
  type: t,
@@ -8431,26 +8502,53 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8431
8502
  return e.trim();
8432
8503
  }).filter(Boolean), i = 0;
8433
8504
  r.forEach(function(e) {
8434
- for (var n = y(e); n && typeof n._update != "function";) n = n.parentElement;
8505
+ for (var n = v(e); n && typeof n._update != "function";) n = n.parentElement;
8435
8506
  n && typeof n._update == "function" && (n._update(t), i++);
8436
- }), x("upd", String(n), {
8507
+ }), S("upd", String(n), {
8437
8508
  applied: i > 0,
8438
8509
  targets: r.length,
8439
8510
  hits: i
8440
8511
  });
8441
8512
  }
8442
8513
  return document.createTextNode("");
8443
- }), e.register("del", (t) => {
8444
- var n = (t.attrs || {}).id;
8445
- if (n && typeof document < "u") {
8446
- var r = !1, i = y(n);
8447
- if (i) {
8448
- var a = b(i);
8449
- (e.slotStack || []).some(function(e) {
8450
- return e.el === a || typeof a.contains == "function" && a.contains(e.el);
8451
- }) ? console.warn("TokUI: del 目标 \"" + n + "\" 正在流式输出中(未闭合),已跳过;请在容器闭合后再发 del") : a.parentNode && (a.parentNode.removeChild(a), r = !0);
8452
- }
8453
- x("del", String(n), { removed: r });
8514
+ });
8515
+ function C(t) {
8516
+ var n = !1, r = v(t);
8517
+ if (!r) {
8518
+ console.warn("TokUI: del 目标 \"" + t + "\" 不存在(组件未渲染或 id 拼写有误),已跳过"), S("del", t, { removed: !1 });
8519
+ return;
8520
+ }
8521
+ var i = x(r);
8522
+ if ((e.slotStack || []).some(function(e) {
8523
+ return e.el === i || typeof i.contains == "function" && i.contains(e.el);
8524
+ })) {
8525
+ e._pendingDels = e._pendingDels || [], e._pendingDels.indexOf(t) === -1 && (e._pendingDels.push(t), console.warn("TokUI: del 目标 \"" + t + "\" 正在流式输出中(未闭合),已排队,容器闭合后自动执行")), S("del", t, {
8526
+ removed: !1,
8527
+ queued: !0
8528
+ });
8529
+ return;
8530
+ }
8531
+ i.parentNode && (i.parentNode.removeChild(i), n = !0), S("del", t, { removed: n });
8532
+ }
8533
+ e._flushPendingDels = function() {
8534
+ var t = e._pendingDels;
8535
+ !t || !t.length || (e._pendingDels = [], t.forEach(function(e) {
8536
+ C(e);
8537
+ }));
8538
+ }, e.register("del", (t) => {
8539
+ var n = t.attrs || {}, r = n.id;
8540
+ if (r && typeof document < "u") {
8541
+ var i = String(r), a = parseInt(n.delay, 10);
8542
+ if (a > 0) {
8543
+ var o = setTimeout(function() {
8544
+ var t = e._delTimers || [], n = t.indexOf(o);
8545
+ n !== -1 && t.splice(n, 1), C(i);
8546
+ }, a);
8547
+ e._delTimers = e._delTimers || [], e._delTimers.push(o), S("del", i, {
8548
+ removed: !1,
8549
+ delayed: a
8550
+ });
8551
+ } else C(i);
8454
8552
  }
8455
8553
  return document.createTextNode("");
8456
8554
  }), e.register("ins", (n, r) => {
@@ -8489,9 +8587,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8489
8587
  o = !0;
8490
8588
  var t = i.after || i.before || i.into, n = 0;
8491
8589
  if (t) {
8492
- var r = y(t);
8590
+ var r = v(t);
8493
8591
  if (r) {
8494
- var l = b(r), u, d;
8592
+ var l = x(r), u, d;
8495
8593
  if (i.into) {
8496
8594
  var f = l._tokuiType || "";
8497
8595
  c[f] ? console.warn("TokUI: ins into 不支持结构性容器 \"" + f + "\"(子节点有专用挂载协议),已跳过") : (u = l._slot || l, d = null);
@@ -8504,7 +8602,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8504
8602
  }
8505
8603
  }
8506
8604
  }
8507
- x("ins", String(t || ""), { moved: n });
8605
+ S("ins", String(t || ""), { moved: n });
8508
8606
  }
8509
8607
  }
8510
8608
  var u = t("span", {
@@ -8516,8 +8614,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8516
8614
  l(), u.parentNode && u.parentNode.removeChild(u);
8517
8615
  }, n.children && n.children.length && l(), u;
8518
8616
  });
8519
- function S(e, t) {
8520
- var n = m("mermaid");
8617
+ function w(e, t) {
8618
+ var n = _("mermaid");
8521
8619
  if (!(!n || !e) && (typeof t == "string" ? /```mermaid\n/.test(t) || typeof e.querySelector == "function" && e.querySelector(".tokui-md__mermaid") : String(e.innerHTML || "").indexOf("tokui-md__mermaid") !== -1 || typeof e.querySelector == "function" && e.querySelector(".tokui-md__mermaid"))) {
8522
8620
  var r = typeof e.querySelectorAll == "function" ? Array.prototype.slice.call(e.querySelectorAll(".tokui-md__mermaid")) : [], i = [];
8523
8621
  if (r.forEach(function(e) {
@@ -8534,12 +8632,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8534
8632
  } catch {}
8535
8633
  }
8536
8634
  }
8537
- typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.runMdMermaid = S, window.TokUI._internal.simpleMarkdown = v, window.TokUI._internal.renderKatexHtml = _), e.register("md", (e) => {
8635
+ typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.runMdMermaid = w, window.TokUI._internal.simpleMarkdown = b, window.TokUI._internal.renderKatexHtml = y), e.register("md", (e) => {
8538
8636
  let n = t("div", { class: "tokui-md" }), r = "";
8539
- return r = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "", r && (n._rawMd = r, n.innerHTML = v(r), p(n), S(n, r)), n._streamCloseHook = function() {
8637
+ return r = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "", r && (n._rawMd = r, n.innerHTML = b(r), m(n), w(n, r)), n._streamCloseHook = function() {
8540
8638
  let e = "";
8541
8639
  for (let t of Array.from(n.childNodes)) t.nodeType === 3 && (e += t.textContent);
8542
- e && (n._rawMd = e, n.innerHTML = v(e), p(n), S(n, e));
8640
+ e && (n._rawMd = e, n.innerHTML = b(e), m(n), w(n, e));
8543
8641
  }, n._tokuiType = "md", n;
8544
8642
  }), e.register("katex", (e) => {
8545
8643
  var n = e.attrs && e.attrs.f, r = !n, i = t("div", { class: "tokui-katex" + (r ? " tokui-katex--block" : " tokui-katex--inline") }), a = function() {
@@ -8547,10 +8645,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8547
8645
  return e.content || "";
8548
8646
  }).join("") : e.content || "");
8549
8647
  }();
8550
- return a && (i._rawMd = a, i.innerHTML = _(a, r)), i._streamCloseHook = function() {
8648
+ return a && (i._rawMd = a, i.innerHTML = y(a, r)), i._streamCloseHook = function() {
8551
8649
  var e = "";
8552
8650
  for (let t of Array.from(i.childNodes)) t.nodeType === 3 && (e += t.textContent);
8553
- e && (i._rawMd = e, i.innerHTML = _(e, !0));
8651
+ e && (i._rawMd = e, i.innerHTML = y(e, !0));
8554
8652
  }, i._slot = i, i._tokuiType = "katex", i;
8555
8653
  }), e.register("mermaid", (e) => {
8556
8654
  var n = t("div", { class: "tokui-mermaid" }), r = function() {
@@ -8560,7 +8658,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8560
8658
  }, i = function(e) {
8561
8659
  n.innerHTML = "";
8562
8660
  var r = t("div", { class: "tokui-md__mermaid" }), i = t("pre", { class: "tokui-code" }), a = t("code", { class: "language-mermaid" }, e);
8563
- i.appendChild(a), r.appendChild(i), n.appendChild(r), n._rawMd = e, S(n);
8661
+ i.appendChild(a), r.appendChild(i), n.appendChild(r), n._rawMd = e, w(n);
8564
8662
  }, a = r();
8565
8663
  return a && i(a), n._streamCloseHook = function() {
8566
8664
  var e = "";
@@ -8568,65 +8666,65 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8568
8666
  e && i(e);
8569
8667
  }, n._slot = n, n._tokuiType = "mermaid", n;
8570
8668
  });
8571
- function C(e) {
8669
+ function T(e) {
8572
8670
  return String(e).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
8573
8671
  }
8574
- function w(e) {
8672
+ function E(e) {
8575
8673
  return e.split("\n").map(function(e) {
8576
8674
  return "<span class=\"code-line\">" + (e || " ") + "</span>";
8577
8675
  }).join("");
8578
8676
  }
8579
- e.register("code", (e) => {
8580
- let r = t("pre", { class: "tokui-code" }), s = e.attrs.lang || "text", c = t("code", { class: `language-${s}` });
8581
- var l = "";
8582
- l = e.children && e.children.length > 0 ? e.children.map((e) => e.content || "").join("") : e.content || "";
8583
- var u = s !== "text" && i[s];
8584
- function d() {
8585
- c.innerHTML = w(u ? a(l, s) : C(l)), c._codeLineEls = null;
8677
+ e.register("code", (r) => {
8678
+ let i = t("pre", { class: "tokui-code" }), c = r.attrs.lang || "text", l = t("code", { class: `language-${c}` });
8679
+ var u = "";
8680
+ u = r.children && r.children.length > 0 ? r.children.map((e) => e.content || "").join("") : r.content || "";
8681
+ var d = c !== "text" && a[c];
8682
+ function f() {
8683
+ l.innerHTML = E(d ? o(u, c) : T(u)), l._codeLineEls = null;
8586
8684
  }
8587
- d(), r.appendChild(c), r._slot = c, r._tokuiType = "code";
8588
- var f = o(s), p = 0, m = 0, h = !1;
8589
- function g() {
8590
- if (h) {
8591
- d();
8685
+ f(), i.appendChild(l), i._slot = l, i._tokuiType = "code";
8686
+ var p = s(c), m = 0, h = 0, g = !1;
8687
+ function _() {
8688
+ if (g) {
8689
+ f();
8592
8690
  return;
8593
8691
  }
8594
- for (var e = l.split("\n"), n = e.length - 1, r = m; p < n;) f.feed(e[p]), p++, f.st.mode === "default" && (m = p);
8595
- var i = e.slice(r).join("\n"), o = (u ? a(i, s) : C(i)).split("\n");
8596
- if (o.length !== e.length - r) {
8597
- h = !0, d();
8692
+ for (var e = u.split("\n"), n = e.length - 1, r = h; m < n;) p.feed(e[m]), m++, p.st.mode === "default" && (h = m);
8693
+ var i = e.slice(r).join("\n"), a = (d ? o(i, c) : T(i)).split("\n");
8694
+ if (a.length !== e.length - r) {
8695
+ g = !0, f();
8598
8696
  return;
8599
8697
  }
8600
- for (var g = 0; g < o.length; g++) if (o[g].split("<span").length - 1 != o[g].split("</span>").length - 1) {
8601
- h = !0, d();
8698
+ for (var s = 0; s < a.length; s++) if (a[s].split("<span").length - 1 != a[s].split("</span>").length - 1) {
8699
+ g = !0, f();
8602
8700
  return;
8603
8701
  }
8604
- c._codeLineEls ||= (c.innerHTML = "", []);
8605
- for (var _ = c.childNodes; _.length > 0;) {
8702
+ l._codeLineEls ||= (l.innerHTML = "", []);
8703
+ for (var _ = l.childNodes; _.length > 0;) {
8606
8704
  var v = _[_.length - 1];
8607
8705
  if (!v || v.nodeType !== 3) break;
8608
- c.removeChild(v);
8706
+ l.removeChild(v);
8609
8707
  }
8610
- for (var y = c._codeLineEls; y.length < e.length;) {
8708
+ for (var y = l._codeLineEls; y.length < e.length;) {
8611
8709
  var b = t("span", { class: "code-line" });
8612
- y.push(b), c.appendChild(b);
8710
+ y.push(b), l.appendChild(b);
8613
8711
  }
8614
8712
  for (var x = r; x < e.length; x++) {
8615
- var S = o[x - r];
8713
+ var S = a[x - r];
8616
8714
  y[x].innerHTML = S === "" ? " " : S;
8617
8715
  }
8618
8716
  }
8619
- var _ = t("button", {
8717
+ var v = e.createReporter("code", r.attrs || {}, i), y = t("button", {
8620
8718
  class: "tokui-code__copy",
8621
8719
  type: "button"
8622
8720
  });
8623
- return _.textContent = n("common.copy"), _.addEventListener("click", function() {
8624
- l && navigator.clipboard && navigator.clipboard.writeText(l), _.textContent = n("common.copied"), _.classList.add("tokui-code__copy--done"), setTimeout(function() {
8625
- _.textContent = n("common.copy"), _.classList.remove("tokui-code__copy--done");
8721
+ return y.textContent = n("common.copy"), y.addEventListener("click", function() {
8722
+ u && navigator.clipboard && navigator.clipboard.writeText(u), y.textContent = n("common.copied"), y.classList.add("tokui-code__copy--done"), v("copy", {}), setTimeout(function() {
8723
+ y.textContent = n("common.copy"), y.classList.remove("tokui-code__copy--done");
8626
8724
  }, 2e3);
8627
- }), r.appendChild(_), r._streamAppendHook = function(e) {
8628
- e && e.type === "_text" && e.content && (l += e.content, g());
8629
- }, r._streamCloseHook = d, r;
8725
+ }), i.appendChild(y), i._streamAppendHook = function(e) {
8726
+ e && e.type === "_text" && e.content && (u += e.content, _());
8727
+ }, i._streamCloseHook = f, i;
8630
8728
  }), e.register("callout", (e, n) => {
8631
8729
  var r = e.attrs || {}, i = r.t || "info", a = r.tt || "", o = {
8632
8730
  info: "ℹ",
@@ -8650,44 +8748,76 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8650
8748
  var d = t("div", { class: "tokui-callout__content" }), f = e.children && e.children.length, p = r.tx || e.content || "";
8651
8749
  return f ? n(e.children).forEach(function(e) {
8652
8750
  e && e.nodeType && d.appendChild(e);
8653
- }) : p && (d.textContent = p), l.appendChild(d), s.appendChild(l), s._slot = d, s;
8654
- }), e.register("think", (e, r) => {
8655
- var i = e.attrs || {}, a = i.tt || n("think.title"), o = t("details", { class: "tokui-think" });
8656
- i.open !== void 0 && o.setAttribute("open", "");
8657
- var s = t("summary", { class: "tokui-think__summary" }), c = t("span", { class: "tokui-think__icon" });
8658
- c.textContent = "💭", s.appendChild(c);
8659
- var l = t("span", { class: "tokui-think__title" });
8660
- l.textContent = a, s.appendChild(l), o.appendChild(s);
8661
- var u = t("div", { class: "tokui-think__body" });
8662
- return e.content && (u.textContent = e.content), r(e.children || []).forEach(function(e) {
8663
- e && e.nodeType && u.appendChild(e);
8664
- }), o.appendChild(u), o._slot = u, o._tokuiType = "think", o;
8665
- }), e.register("think-chain", (e, r) => {
8666
- var i = e.attrs || {}, a = i.tt || n("thinkChain.title"), o = i.status || "", s = ["tokui-think-chain"];
8667
- o && s.push("tokui-think-chain--" + o);
8668
- var c = t("details", { class: s.join(" ") });
8669
- i.open !== void 0 && c.setAttribute("open", "");
8670
- var l = t("summary", { class: "tokui-think-chain__summary" }), u = t("span", { class: "tokui-think-chain__icon" });
8671
- u.textContent = "🧠", l.appendChild(u);
8672
- var d = t("span", { class: "tokui-think-chain__title" });
8673
- d.textContent = a, l.appendChild(d), c.appendChild(l);
8674
- var f = t("div", { class: "tokui-think-chain__steps" });
8675
- return r(e.children || []).forEach(function(e) {
8676
- e && e.nodeType && f.appendChild(e);
8677
- }), c.appendChild(f), c._slot = f, c._tokuiType = "think-chain", c;
8751
+ }) : p && (d.textContent = p), l.appendChild(d), s.appendChild(l), d._tokuiType = "callout", s._slot = d, s._tokuiType = "callout", s;
8752
+ }), e.register("think", (e, i) => {
8753
+ var a = e.attrs || {}, o = a.tt || n("think.title"), s = { class: "tokui-think" };
8754
+ a.id && (s.id = a.id);
8755
+ var c = t("details", s);
8756
+ a.open !== void 0 && c.setAttribute("open", "");
8757
+ var l = t("summary", { class: "tokui-think__summary" }), u = t("span", {
8758
+ class: "tokui-think__icon",
8759
+ "aria-hidden": "true"
8760
+ });
8761
+ u.innerHTML = r("lightbulb", 15), l.appendChild(u);
8762
+ var d = t("span", { class: "tokui-think__title" });
8763
+ d.textContent = o, l.appendChild(d);
8764
+ var f = t("span", {
8765
+ class: "tokui-think__chevron",
8766
+ "aria-hidden": "true"
8767
+ });
8768
+ f.innerHTML = r("chevron-right", 16), l.appendChild(f), c.appendChild(l);
8769
+ var p = t("div", { class: "tokui-think__body" });
8770
+ return e.content && (p.textContent = e.content), i(e.children || []).forEach(function(e) {
8771
+ e && e.nodeType && p.appendChild(e);
8772
+ }), c.appendChild(p), c._slot = p, c._tokuiType = "think", c;
8773
+ }), e.register("think-chain", (e, i) => {
8774
+ var a = e.attrs || {}, o = a.tt || n("thinkChain.title"), s = a.status || "", c = ["tokui-think-chain"];
8775
+ s && c.push("tokui-think-chain--" + s);
8776
+ var l = { class: c.join(" ") };
8777
+ a.id && (l.id = a.id);
8778
+ var u = t("details", l);
8779
+ a.open !== void 0 && u.setAttribute("open", "");
8780
+ var d = t("summary", { class: "tokui-think-chain__summary" }), f = t("span", {
8781
+ class: "tokui-think-chain__icon",
8782
+ "aria-hidden": "true"
8783
+ });
8784
+ f.innerHTML = r("sparkles", 15), d.appendChild(f);
8785
+ var p = t("span", { class: "tokui-think-chain__title" });
8786
+ p.textContent = o, d.appendChild(p);
8787
+ var m = t("span", {
8788
+ class: "tokui-think-chain__chevron",
8789
+ "aria-hidden": "true"
8790
+ });
8791
+ m.innerHTML = r("chevron-right", 16), d.appendChild(m), u.appendChild(d);
8792
+ var h = t("div", { class: "tokui-think-chain__steps" });
8793
+ return i(e.children || []).forEach(function(e) {
8794
+ e && e.nodeType && h.appendChild(e);
8795
+ }), u.appendChild(h), u._slot = h, u._tokuiType = "think-chain", u;
8678
8796
  }), e.register("think-step", (e, n) => {
8679
8797
  var r = e.attrs || {}, i = r.status || "pending", a = r.tt || "", o = r.dur || "", s = t("div", { class: ["tokui-think-step", "tokui-think-step--" + i].join(" ") }), c = t("div", { class: "tokui-think-step__header" });
8680
8798
  if (i === "done") {
8681
- var l = t("span", { class: "tokui-think-step__icon" });
8682
- l.textContent = "", c.appendChild(l);
8799
+ var l = t("span", {
8800
+ class: "tokui-think-step__icon",
8801
+ "aria-hidden": "true"
8802
+ });
8803
+ l.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M20 6L9 17l-5-5\"/></svg>", c.appendChild(l);
8683
8804
  } else if (i === "running") {
8684
- var u = t("span", { class: "tokui-think-step__spinner" });
8805
+ var u = t("span", {
8806
+ class: "tokui-think-step__spinner",
8807
+ "aria-hidden": "true"
8808
+ });
8685
8809
  c.appendChild(u);
8686
- } else if (i === "error") {
8687
- var d = t("span", { class: "tokui-think-step__icon tokui-think-step__icon--error" });
8688
- d.textContent = "✗", c.appendChild(d);
8810
+ } else if (i === "error" || i === "danger") {
8811
+ var d = t("span", {
8812
+ class: "tokui-think-step__icon tokui-think-step__icon--" + i,
8813
+ "aria-hidden": "true"
8814
+ });
8815
+ d.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"13\" height=\"13\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"3\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M18 6L6 18\"/><path d=\"M6 6l12 12\"/></svg>", c.appendChild(d);
8689
8816
  } else {
8690
- var f = t("span", { class: "tokui-think-step__dot" });
8817
+ var f = t("span", {
8818
+ class: "tokui-think-step__dot",
8819
+ "aria-hidden": "true"
8820
+ });
8691
8821
  c.appendChild(f);
8692
8822
  }
8693
8823
  if (a) {
@@ -8705,21 +8835,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8705
8835
  }), s.appendChild(h);
8706
8836
  var g = t("div", { class: "tokui-think-step__line" });
8707
8837
  return s.appendChild(g), s._slot = h, s._tokuiType = "think-step", s;
8708
- }), e.register("copy", (e) => {
8709
- var r = e.attrs || {}, i = r.tx || n("common.copy"), a = r.tt || n("common.copied"), o = t("button", {
8838
+ }), e.register("copy", (r) => {
8839
+ var i = r.attrs || {}, a = i.tx || n("common.copy"), o = i.tt || n("common.copied"), s = t("button", {
8710
8840
  class: "tokui-copy",
8711
8841
  type: "button"
8712
8842
  });
8713
- return o.textContent = i, o.addEventListener("click", function() {
8843
+ s.textContent = a;
8844
+ var c = e.createReporter("copy", {}, s);
8845
+ return s.addEventListener("click", function() {
8714
8846
  var e = "";
8715
- if (r.id && typeof document < "u") {
8716
- var t = document.getElementById(r.id);
8847
+ if (i.id && typeof document < "u") {
8848
+ var t = document.getElementById(i.id);
8717
8849
  t && (e = t.textContent || "");
8718
8850
  }
8719
- navigator.clipboard && e && navigator.clipboard.writeText(e), o.textContent = a, o.classList.add("tokui-copy--done"), setTimeout(function() {
8720
- o.textContent = i, o.classList.remove("tokui-copy--done");
8851
+ navigator.clipboard && e && navigator.clipboard.writeText(e), s.textContent = o, s.classList.add("tokui-copy--done"), c("copy", {}), setTimeout(function() {
8852
+ s.textContent = a, s.classList.remove("tokui-copy--done");
8721
8853
  }, 2e3);
8722
- }), o;
8854
+ }), s;
8723
8855
  }), e.register("spin", (e) => {
8724
8856
  var n = e.attrs || {}, r = n.t || "spinner", i = n.s || "", a = n.tx || "", o = ["tokui-spin", "tokui-spin--" + r];
8725
8857
  i === "sm" || i === "small" ? o.push("tokui-spin--sm") : (i === "lg" || i === "large") && o.push("tokui-spin--lg");
@@ -8733,24 +8865,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8733
8865
  l.textContent = a, s.appendChild(l);
8734
8866
  }
8735
8867
  return s;
8736
- }), e.register("thumb", (e) => {
8737
- var r = e.attrs || {}, i = r.t || "up", a = r.v === "active", o = r.s || "", s = "";
8738
- o === "sm" || o === "small" ? s = " tokui-thumb--sm" : (o === "lg" || o === "large") && (s = " tokui-thumb--lg");
8739
- var c = t("button", {
8740
- class: "tokui-thumb tokui-thumb--" + i + (a ? " tokui-thumb--active" : "") + s,
8868
+ }), e.register("thumb", (r) => {
8869
+ var i = r.attrs || {}, a = i.t || "up", o = i.v === "active", s = i.s || "", c = "";
8870
+ s === "sm" || s === "small" ? c = " tokui-thumb--sm" : (s === "lg" || s === "large") && (c = " tokui-thumb--lg");
8871
+ var l = t("button", {
8872
+ class: "tokui-thumb tokui-thumb--" + a + (o ? " tokui-thumb--active" : "") + c,
8741
8873
  type: "button",
8742
- "aria-label": n(i === "up" ? "like.up" : "like.down"),
8743
- "aria-pressed": String(a)
8744
- }), l = o === "lg" || o === "large" ? 22 : o === "sm" || o === "small" ? 14 : 18, u = i === "up" ? "<svg viewBox=\"0 0 24 24\" width=\"" + l + "\" height=\"" + l + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"/></svg>" : "<svg viewBox=\"0 0 24 24\" width=\"" + l + "\" height=\"" + l + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"/></svg>", d = t("span", { class: "tokui-thumb__icon" });
8745
- return d.innerHTML = u, c.appendChild(d), c.addEventListener("click", function() {
8746
- if (c.classList.toggle("tokui-thumb--active"), c.setAttribute("aria-pressed", String(c.classList.contains("tokui-thumb--active"))), r.clk) {
8747
- var e = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
8748
- e && typeof e.emit == "function" && e.emit(r.clk, {
8749
- direction: i,
8750
- active: c.classList.contains("tokui-thumb--active")
8751
- });
8752
- }
8753
- }), c;
8874
+ "aria-label": n(a === "up" ? "like.up" : "like.down"),
8875
+ "aria-pressed": String(o)
8876
+ }), u = s === "lg" || s === "large" ? 22 : s === "sm" || s === "small" ? 14 : 18, d = a === "up" ? "<svg viewBox=\"0 0 24 24\" width=\"" + u + "\" height=\"" + u + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"/></svg>" : "<svg viewBox=\"0 0 24 24\" width=\"" + u + "\" height=\"" + u + "\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"/></svg>", f = t("span", { class: "tokui-thumb__icon" });
8877
+ f.innerHTML = d, l.appendChild(f);
8878
+ var p = e.createReporter("thumb", i, l);
8879
+ return l.addEventListener("click", function() {
8880
+ l.classList.toggle("tokui-thumb--active"), l.setAttribute("aria-pressed", String(l.classList.contains("tokui-thumb--active"))), i.clk && e.eventBus && typeof e.eventBus.emit == "function" && e.eventBus.emit(i.clk, {
8881
+ direction: a,
8882
+ active: l.classList.contains("tokui-thumb--active")
8883
+ }), p("like", { value: a });
8884
+ }), l;
8754
8885
  }), e.register("file", (e) => {
8755
8886
  var r = e.attrs || {}, i = r.n || n("file.unnamed"), a = r.s || "", o = r.t || "default", s = r.u || "", c = r.tt || "", l = {
8756
8887
  pdf: {
@@ -8824,22 +8955,24 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8824
8955
  }
8825
8956
  return d;
8826
8957
  }), e.register("bubble", (e, r) => {
8827
- var i = e.attrs || {}, a = i.role || "ai", o = i.model || "", s = i.time || "", c = t("div", { class: "tokui-bubble tokui-bubble--" + a }), l = t("div", { class: "tokui-bubble__row" }), u = t("span", { class: "tokui-bubble__avatar" });
8828
- u.textContent = n(a === "user" ? "bubble.you" : "bubble.ai"), l.appendChild(u);
8829
- var d = t("div", { class: "tokui-bubble__content" }), f = t("div", { class: "tokui-bubble__header" }), p = t("span", {});
8830
- if (p.textContent = n(a === "user" ? "bubble.you" : a === "system" ? "bubble.system" : "bubble.assistant"), f.appendChild(p), o) {
8831
- var m = t("span", { class: "tokui-badge tokui-badge--info tokui-badge--pill" });
8832
- m.textContent = o, f.appendChild(m);
8958
+ var i = e.attrs || {}, a = i.role || "ai", o = i.model || "", s = i.time || "", c = { class: "tokui-bubble tokui-bubble--" + a };
8959
+ i.id && (c.id = i.id);
8960
+ var l = t("div", c), u = t("div", { class: "tokui-bubble__row" }), d = t("span", { class: "tokui-bubble__avatar" });
8961
+ d.textContent = n(a === "user" ? "bubble.you" : "bubble.ai"), u.appendChild(d);
8962
+ var f = t("div", { class: "tokui-bubble__content" }), p = t("div", { class: "tokui-bubble__header" }), m = t("span", {});
8963
+ if (m.textContent = n(a === "user" ? "bubble.you" : a === "system" ? "bubble.system" : "bubble.assistant"), p.appendChild(m), o) {
8964
+ var h = t("span", { class: "tokui-badge tokui-badge--info tokui-badge--pill" });
8965
+ h.textContent = o, p.appendChild(h);
8833
8966
  }
8834
- d.appendChild(f);
8835
- var h = t("div", { class: "tokui-bubble__body" });
8967
+ f.appendChild(p);
8968
+ var g = t("div", { class: "tokui-bubble__body" });
8836
8969
  if (r(e.children || []).forEach(function(e) {
8837
- e && e.nodeType && h.appendChild(e);
8838
- }), d.appendChild(h), s) {
8839
- var g = t("div", { class: "tokui-bubble__time" });
8840
- g.textContent = s, d.appendChild(g);
8970
+ e && e.nodeType && g.appendChild(e);
8971
+ }), f.appendChild(g), s) {
8972
+ var _ = t("div", { class: "tokui-bubble__time" });
8973
+ _.textContent = s, f.appendChild(_);
8841
8974
  }
8842
- return l.appendChild(d), c.appendChild(l), h._slot = h, h._tokuiType = "bubble", c._slot = h, c._tokuiType = "bubble", c;
8975
+ return u.appendChild(f), l.appendChild(u), g._slot = g, g._tokuiType = "bubble", l._slot = g, l._tokuiType = "bubble", l;
8843
8976
  }), e.register("toolbar", (e, n) => {
8844
8977
  var r = e.attrs || {}, i = r.pos || "bottom", a = r.align || "right", o = t("div", { class: "tokui-toolbar tokui-toolbar--" + i + " tokui-toolbar--" + a });
8845
8978
  return n(e.children || []).forEach(function(e) {
@@ -8915,11 +9048,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8915
9048
  }
8916
9049
  return s;
8917
9050
  });
8918
- var T = null;
9051
+ var D = null;
8919
9052
  e.register("toast", (e) => {
8920
9053
  var n = e.attrs || {}, r = n.id || "", i = n.t || "info", a = n.tx || "", o = parseInt(n.duration, 10) || 2e3, s = n.pos || "top";
8921
- (!T || !T.parentNode) && (T = document.querySelector(".tokui-toast-container"), T || (T = t("div", { class: "tokui-toast-container" }), document.body.appendChild(T)));
8922
- var c = T, l = t("div", {
9054
+ (!D || !D.parentNode) && (D = document.querySelector(".tokui-toast-container"), D || (D = t("div", { class: "tokui-toast-container" }), document.body.appendChild(D)));
9055
+ var c = D, l = t("div", {
8923
9056
  class: "tokui-toast tokui-toast--" + i + (s === "bottom" ? " tokui-toast--bottom" : ""),
8924
9057
  role: "alert",
8925
9058
  "aria-live": "polite"
@@ -8959,11 +9092,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8959
9092
  }
8960
9093
  return s;
8961
9094
  }), e.register("avatar", (e) => {
8962
- var n = e.attrs || {}, i = n.s || "", a = n.tx || "", o = n.size || "md", s = ["tokui-avatar"];
8963
- if (i) {
9095
+ var n = e.attrs || {}, r = n.s || "", a = n.tx || "", o = n.size || "md", s = ["tokui-avatar"];
9096
+ if (r) {
8964
9097
  var c = t("img", {
8965
9098
  class: s.join(" "),
8966
- src: i,
9099
+ src: r,
8967
9100
  alt: a
8968
9101
  });
8969
9102
  return c.classList.add("tokui-avatar--" + o), c;
@@ -8973,7 +9106,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8973
9106
  l.textContent = a.slice(0, 2);
8974
9107
  var u = n.bg;
8975
9108
  if (u) {
8976
- var d = r(u);
9109
+ var d = i(u);
8977
9110
  d && (l.style.backgroundColor = d);
8978
9111
  } else if (a) {
8979
9112
  for (var f = [
@@ -8990,7 +9123,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8990
9123
  }
8991
9124
  var h = n.fc;
8992
9125
  if (h) {
8993
- var g = r(h);
9126
+ var g = i(h);
8994
9127
  g && (l.style.color = g);
8995
9128
  }
8996
9129
  return l;
@@ -9000,16 +9133,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9000
9133
  tabindex: "0"
9001
9134
  });
9002
9135
  o.textContent = a;
9003
- function c() {
9136
+ function s() {
9004
9137
  if (r && !o._tooltipEl) {
9005
9138
  var e = document.createElement("div");
9006
9139
  e.className = "tokui-tooltip__popup tokui-tooltip__popup--" + i, e.setAttribute("role", "tooltip");
9007
9140
  var t = "tokui-tip-" + Math.random().toString(36).slice(2, 8);
9008
9141
  e.id = t, o.setAttribute("aria-describedby", t), e.textContent = r, document.body.appendChild(e);
9009
- var n = o.getBoundingClientRect(), a = e.getBoundingClientRect(), c = 8, l, u;
9010
- i === "top" ? (l = n.left + n.width / 2 - a.width / 2, u = n.top - a.height - c) : i === "bottom" ? (l = n.left + n.width / 2 - a.width / 2, u = n.bottom + c) : i === "left" ? (l = n.left - a.width - c, u = n.top + n.height / 2 - a.height / 2) : i === "right" && (l = n.right + c, u = n.top + n.height / 2 - a.height / 2);
9011
- var d = s(e, a);
9012
- l + d.kx < 4 && (l = 4), l + d.kx + a.width > window.innerWidth - 4 && (l = window.innerWidth - a.width - 4), u + d.ky < 4 && (u = n.bottom + c), e.style.left = l + "px", e.style.top = u + "px", e.classList.add("tokui-tooltip__popup--visible"), o._tooltipEl = e;
9142
+ var n = o.getBoundingClientRect(), a = e.getBoundingClientRect(), s = 8, l, u;
9143
+ i === "top" ? (l = n.left + n.width / 2 - a.width / 2, u = n.top - a.height - s) : i === "bottom" ? (l = n.left + n.width / 2 - a.width / 2, u = n.bottom + s) : i === "left" ? (l = n.left - a.width - s, u = n.top + n.height / 2 - a.height / 2) : i === "right" && (l = n.right + s, u = n.top + n.height / 2 - a.height / 2);
9144
+ var d = c(e, a);
9145
+ l + d.kx < 4 && (l = 4), l + d.kx + a.width > window.innerWidth - 4 && (l = window.innerWidth - a.width - 4), u + d.ky < 4 && (u = n.bottom + s), e.style.left = l + "px", e.style.top = u + "px", e.classList.add("tokui-tooltip__popup--visible"), o._tooltipEl = e;
9013
9146
  }
9014
9147
  }
9015
9148
  function l() {
@@ -9021,14 +9154,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9021
9154
  }, 150), o._tooltipEl = null, o.removeAttribute("aria-describedby");
9022
9155
  }
9023
9156
  }
9024
- return o.addEventListener("mouseenter", c), o.addEventListener("focus", c), o.addEventListener("mouseleave", l), o.addEventListener("blur", l), o.addEventListener("keydown", function(e) {
9157
+ return o.addEventListener("mouseenter", s), o.addEventListener("focus", s), o.addEventListener("mouseleave", l), o.addEventListener("blur", l), o.addEventListener("keydown", function(e) {
9025
9158
  e.key === "Escape" && l();
9026
9159
  }), o;
9027
9160
  }), e.register("pagination", (r) => {
9028
- var i = r.attrs || {}, a = parseInt(i.total, 10) || 1, o = i.clk || "", s = i.s || "", c = i["show-total"] !== void 0, l = i.count || "", u = parseInt(i.page, 10) || 1, f = ["tokui-pagination"];
9029
- s === "sm" ? f.push("tokui-pagination--sm") : s === "lg" && f.push("tokui-pagination--lg");
9161
+ var i = r.attrs || {}, a = parseInt(i.total, 10) || 1, o = i.clk || "", s = i.s || "", c = i["show-total"] !== void 0, l = i.count || "", u = parseInt(i.page, 10) || 1, d = ["tokui-pagination"];
9162
+ s === "sm" ? d.push("tokui-pagination--sm") : s === "lg" && d.push("tokui-pagination--lg");
9030
9163
  var p = t("nav", {
9031
- class: f.join(" "),
9164
+ class: d.join(" "),
9032
9165
  role: "navigation",
9033
9166
  "aria-label": n("pagination.aria")
9034
9167
  });
@@ -9052,7 +9185,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9052
9185
  "aria-label": n("pagination.prev"),
9053
9186
  disabled: e <= 1
9054
9187
  });
9055
- o.textContent = "‹", h.appendChild(o), d(e, a).forEach(function(n) {
9188
+ o.textContent = "‹", h.appendChild(o), f(e, a).forEach(function(n) {
9056
9189
  if (n === "...") {
9057
9190
  var r = t("span", { class: "tokui-pagination__ellipsis" });
9058
9191
  r.textContent = "...", h.appendChild(r);
@@ -9137,7 +9270,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9137
9270
  }), s.appendChild(u), l.addEventListener("click", function(e) {
9138
9271
  e.stopPropagation();
9139
9272
  var t = u.classList.contains("tokui-dropdown__panel--open");
9140
- if (f(), !t) {
9273
+ if (p(), !t) {
9141
9274
  var n = l.getBoundingClientRect();
9142
9275
  u.style.top = n.bottom + 4 + "px", u.style.left = n.left + "px", u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true");
9143
9276
  }
@@ -9146,7 +9279,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9146
9279
  t && !t.classList.contains("tokui-dropdown__item--disabled") && (u.classList.remove("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "false"));
9147
9280
  }), s._slot = u, s._tokuiType = "dropdown", l.addEventListener("keydown", function(e) {
9148
9281
  if (e.key === "ArrowDown" || e.key === "Enter") {
9149
- e.preventDefault(), u.classList.contains("tokui-dropdown__panel--open") || (f(), u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true"));
9282
+ e.preventDefault(), u.classList.contains("tokui-dropdown__panel--open") || (p(), u.classList.add("tokui-dropdown__panel--open"), l.setAttribute("aria-expanded", "true"));
9150
9283
  var t = u.querySelectorAll(".tokui-dropdown__item:not(.tokui-dropdown__item--disabled)");
9151
9284
  t.length > 0 && t[0].focus();
9152
9285
  }
@@ -9233,7 +9366,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9233
9366
  requestAnimationFrame(e);
9234
9367
  } else m.textContent = i;
9235
9368
  } else m.textContent = i;
9236
- return u.appendChild(f), u._update = function(e) {
9369
+ if (u.appendChild(f), n.l) {
9370
+ var x = t("div", { class: "tokui-stat__label" });
9371
+ x.textContent = n.l, u.appendChild(x);
9372
+ }
9373
+ return u._update = function(e) {
9237
9374
  if (e.v !== void 0) {
9238
9375
  var t = u.querySelector(".tokui-stat__number");
9239
9376
  t && (t.textContent = e.v);
@@ -9255,7 +9392,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9255
9392
  var o = t("div", a);
9256
9393
  return o.textContent = r, o;
9257
9394
  }), e.register("popover", (e, r) => {
9258
- var i = e.attrs || {}, a = i.tx || n("trigger.default"), o = i.pos || "top", c = i.tt || "", l = i.w || "", u = i.trig || "click", d = t("span", { class: "tokui-popover" }), f = t("span", {
9395
+ var i = e.attrs || {}, a = i.tx || n("trigger.default"), o = i.pos || "top", s = i.tt || "", l = i.w || "", u = i.trig || "click", d = t("span", { class: "tokui-popover" }), f = t("span", {
9259
9396
  class: "tokui-popover__trigger",
9260
9397
  tabindex: "0",
9261
9398
  role: "button",
@@ -9269,9 +9406,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9269
9406
  });
9270
9407
  l && (p.style.width = l);
9271
9408
  var m = t("div", { class: "tokui-popover__arrow" });
9272
- if (p.appendChild(m), c) {
9409
+ if (p.appendChild(m), s) {
9273
9410
  var h = t("div", { class: "tokui-popover__title" });
9274
- h.textContent = c, p.appendChild(h);
9411
+ h.textContent = s, p.appendChild(h);
9275
9412
  }
9276
9413
  var g = t("div", { class: "tokui-popover__body" });
9277
9414
  r(e.children || []).forEach(function(e) {
@@ -9280,7 +9417,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9280
9417
  function _() {
9281
9418
  var e = f.getBoundingClientRect(), t = p.getBoundingClientRect(), n = 10, r, i;
9282
9419
  o === "top" ? (r = e.left + e.width / 2 - t.width / 2, i = e.top - t.height - n) : o === "bottom" ? (r = e.left + e.width / 2 - t.width / 2, i = e.bottom + n) : o === "left" ? (r = e.left - t.width - n, i = e.top + e.height / 2 - t.height / 2) : o === "right" && (r = e.right + n, i = e.top + e.height / 2 - t.height / 2);
9283
- var a = s(p, t);
9420
+ var a = c(p, t);
9284
9421
  r + a.kx < 4 && (r = 4), r + a.kx + t.width > window.innerWidth - 4 && (r = window.innerWidth - t.width - 4), i + a.ky < 4 && (i = e.bottom + n), p.style.left = r + "px", p.style.top = i + "px";
9285
9422
  }
9286
9423
  function v() {
@@ -9306,7 +9443,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9306
9443
  e.key === "Escape" && (y(), typeof f.focus == "function" && f.focus());
9307
9444
  })), typeof window < "u" && window.addEventListener("scroll", y, !0), d._slot = g, d._tokuiType = "popover", d;
9308
9445
  }), e.register("hover-card", (e, n) => {
9309
- var r = e.attrs || {}, i = r.pos || "bottom", a = r.w || "", o = parseInt(r.delay) || 300, c = t("span", {
9446
+ var r = e.attrs || {}, i = r.pos || "bottom", a = r.w || "", o = parseInt(r.delay) || 300, s = t("span", {
9310
9447
  class: "tokui-hover-card tokui-hover-card--" + i,
9311
9448
  "data-delay": String(o)
9312
9449
  }), l = null, u = null;
@@ -9331,65 +9468,65 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9331
9468
  }), n([e]).forEach(function(e) {
9332
9469
  if (e && e.nodeType) if (e._tokuiType === "hover-trigger") for (; e.firstChild;) l.appendChild(e.firstChild);
9333
9470
  else l.appendChild(e);
9334
- }), c.appendChild(l);
9471
+ }), s.appendChild(l);
9335
9472
  else if (e.type === "hover-content") {
9336
9473
  var r = d();
9337
9474
  u = r.panel, n([e]).forEach(function(e) {
9338
9475
  if (e && e.nodeType) if (e._tokuiType === "hover-content") for (; e.firstChild;) r.body.appendChild(e.firstChild);
9339
9476
  else r.body.appendChild(e);
9340
- }), c.appendChild(u);
9477
+ }), s.appendChild(u);
9341
9478
  } else n([e]).forEach(function(e) {
9342
- e && e.nodeType && c.appendChild(e);
9479
+ e && e.nodeType && s.appendChild(e);
9343
9480
  });
9344
9481
  });
9345
9482
  function f(e) {
9346
- var t = c.querySelector(".tokui-hover-card__trigger");
9483
+ var t = s.querySelector(".tokui-hover-card__trigger");
9347
9484
  if (t) {
9348
9485
  var n = t.getBoundingClientRect(), r = e.getBoundingClientRect(), a = 8, o, l;
9349
9486
  i === "bottom" ? (o = n.left + n.width / 2 - r.width / 2, l = n.bottom + a) : i === "top" ? (o = n.left + n.width / 2 - r.width / 2, l = n.top - r.height - a) : i === "left" ? (o = n.left - r.width - a, l = n.top + n.height / 2 - r.height / 2) : i === "right" && (o = n.right + a, l = n.top + n.height / 2 - r.height / 2);
9350
- var u = s(e, r);
9487
+ var u = c(e, r);
9351
9488
  o + u.kx < 4 && (o = 4), o + u.kx + r.width > window.innerWidth - 4 && (o = window.innerWidth - r.width - 4), l + u.ky < 4 && (l = n.bottom + a), e.style.left = o + "px", e.style.top = l + "px";
9352
9489
  }
9353
9490
  }
9354
9491
  var p = null, m = null;
9355
9492
  function h() {
9356
9493
  clearTimeout(m), p = setTimeout(function() {
9357
- var e = c.querySelector(".tokui-hover-card__content");
9494
+ var e = s.querySelector(".tokui-hover-card__content");
9358
9495
  e && (f(e), e.classList.add("tokui-hover-card__content--visible"));
9359
9496
  }, o);
9360
9497
  }
9361
9498
  function g() {
9362
9499
  clearTimeout(p), m = setTimeout(function() {
9363
- var e = c.querySelector(".tokui-hover-card__content");
9500
+ var e = s.querySelector(".tokui-hover-card__content");
9364
9501
  e && e.classList.remove("tokui-hover-card__content--visible");
9365
9502
  }, 150);
9366
9503
  }
9367
- return c.addEventListener("mouseenter", h), c.addEventListener("mouseleave", g), c.addEventListener("focusin", h), c.addEventListener("focusout", g), c.addEventListener("keydown", function(e) {
9504
+ return s.addEventListener("mouseenter", h), s.addEventListener("mouseleave", g), s.addEventListener("focusin", h), s.addEventListener("focusout", g), s.addEventListener("keydown", function(e) {
9368
9505
  if (e.key === "Escape") {
9369
9506
  clearTimeout(p), clearTimeout(m);
9370
- var t = c.querySelector(".tokui-hover-card__content");
9507
+ var t = s.querySelector(".tokui-hover-card__content");
9371
9508
  t && t.classList.remove("tokui-hover-card__content--visible");
9372
9509
  }
9373
- }), typeof window < "u" && window.addEventListener && window.addEventListener("scroll", g, !0), c._slot = c, c._tokuiType = "hover-card", c._streamCloseHook = function() {
9374
- for (var e = null, n = null, r = [], i = 0; i < c.children.length; i++) {
9375
- var a = c.children[i];
9510
+ }), typeof window < "u" && window.addEventListener && window.addEventListener("scroll", g, !0), s._slot = s, s._tokuiType = "hover-card", s._streamCloseHook = function() {
9511
+ for (var e = null, n = null, r = [], i = 0; i < s.children.length; i++) {
9512
+ var a = s.children[i];
9376
9513
  a._tokuiType === "hover-trigger" ? e = a : a._tokuiType === "hover-content" ? n = a : r.push(a);
9377
9514
  }
9378
9515
  if (!(!e && !n)) {
9379
- for (; c.firstChild;) c.removeChild(c.firstChild);
9516
+ for (; s.firstChild;) s.removeChild(s.firstChild);
9380
9517
  var o = t("span", {
9381
9518
  class: "tokui-hover-card__trigger",
9382
9519
  tabindex: "0"
9383
9520
  });
9384
9521
  if (e) for (; e.firstChild;) o.appendChild(e.firstChild);
9385
- c.appendChild(o);
9386
- var s = d();
9387
- if (n) for (; n.firstChild;) s.body.appendChild(n.firstChild);
9388
- c.appendChild(s.panel), r.forEach(function(e) {
9389
- c.appendChild(e);
9522
+ s.appendChild(o);
9523
+ var c = d();
9524
+ if (n) for (; n.firstChild;) c.body.appendChild(n.firstChild);
9525
+ s.appendChild(c.panel), r.forEach(function(e) {
9526
+ s.appendChild(e);
9390
9527
  });
9391
9528
  }
9392
- }, c;
9529
+ }, s;
9393
9530
  }), e.register("hover-trigger", (e, n) => {
9394
9531
  var r = t("span");
9395
9532
  return e.children && e.children.length > 0 && n(e.children).forEach(function(e) {
@@ -9561,7 +9698,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9561
9698
  var w = setInterval(C, 1e3);
9562
9699
  return m._countdownTimer = w, m._tokuiType = "countdown", m;
9563
9700
  }), e.register("popconfirm", (e) => {
9564
- var r = e.attrs || {}, i = r.tt || "", a = r.clk || "", o = r.t || "primary", c = r.pos || "top", l = r["ok-text"] || n("common.ok"), u = r["cancel-text"] || n("common.cancel"), d = e.content || r.tx || n("popconfirm.trigger"), f = t("span", { class: "tokui-popconfirm" }), p = t("button", {
9701
+ var r = e.attrs || {}, i = r.tt || "", a = r.clk || "", o = r.t || "primary", s = r.pos || "top", l = r["ok-text"] || n("common.ok"), u = r["cancel-text"] || n("common.cancel"), d = e.content || r.tx || n("popconfirm.trigger"), f = t("span", { class: "tokui-popconfirm" }), p = t("button", {
9565
9702
  class: "tokui-popconfirm__trigger",
9566
9703
  type: "button",
9567
9704
  tabindex: "0",
@@ -9581,7 +9718,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9581
9718
  function h() {
9582
9719
  m();
9583
9720
  var e = t("div", {
9584
- class: "tokui-popconfirm__popup tokui-popconfirm__popup--" + c,
9721
+ class: "tokui-popconfirm__popup tokui-popconfirm__popup--" + s,
9585
9722
  role: "dialog",
9586
9723
  "aria-label": i || n("popconfirm.aria")
9587
9724
  }), r = t("div", { class: "tokui-popconfirm__arrow" });
@@ -9612,8 +9749,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9612
9749
  function v() {
9613
9750
  if (p.getBoundingClientRect) {
9614
9751
  var t = p.getBoundingClientRect(), n = e.getBoundingClientRect(), r = 8, i, a;
9615
- c === "top" ? (i = t.left + t.width / 2 - n.width / 2, a = t.top - n.height - r) : c === "bottom" ? (i = t.left + t.width / 2 - n.width / 2, a = t.bottom + r) : c === "left" ? (i = t.left - n.width - r, a = t.top + t.height / 2 - n.height / 2) : c === "right" && (i = t.right + r, a = t.top + t.height / 2 - n.height / 2);
9616
- var o = s(e, n);
9752
+ s === "top" ? (i = t.left + t.width / 2 - n.width / 2, a = t.top - n.height - r) : s === "bottom" ? (i = t.left + t.width / 2 - n.width / 2, a = t.bottom + r) : s === "left" ? (i = t.left - n.width - r, a = t.top + t.height / 2 - n.height / 2) : s === "right" && (i = t.right + r, a = t.top + t.height / 2 - n.height / 2);
9753
+ var o = c(e, n);
9617
9754
  i + o.kx < 4 && (i = 4), i + o.kx + n.width > window.innerWidth - 4 && (i = window.innerWidth - n.width - 4), a + o.ky < 4 && (a = t.bottom + r), e.style.left = i + "px", e.style.top = a + "px";
9618
9755
  }
9619
9756
  e.classList.add("tokui-popconfirm__popup--visible");
@@ -9626,7 +9763,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9626
9763
  f._popconfirmPopup && !f._popconfirmPopup.contains(e.target) && !f.contains(e.target) && m();
9627
9764
  }), f.addEventListener("keydown", function(e) {
9628
9765
  e.key === "Escape" && m(!0);
9629
- }), typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("scroll", m, !0), f._tokuiPopconfirmPos = c, f._tokuiType = "popconfirm", f;
9766
+ }), typeof window < "u" && typeof window.addEventListener == "function" && window.addEventListener("scroll", m, !0), f._tokuiPopconfirmPos = s, f._tokuiType = "popconfirm", f;
9630
9767
  }), e.register("watermark", (e, n) => {
9631
9768
  var r = e.attrs || {}, i = r.tx || "TokUI", a = r.font || (r.s === "sm" ? "12" : r.s === "lg" ? "20" : "16"), o = r.gap || "40", s = r.ro || "-22", c = r.c || "rgba(0,0,0,0.2)", l = t("div", { class: "tokui-watermark" });
9632
9769
  l.style.overflow = "hidden", l.style.borderRadius = "8px";
@@ -9646,56 +9783,56 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9646
9783
  l.appendChild(_);
9647
9784
  var y = t("div", { class: "tokui-watermark__overlay" });
9648
9785
  return y.style.backgroundImage = "url(" + u.toDataURL() + ")", y.style.backgroundRepeat = "repeat", y.style.borderRadius = "8px", l.appendChild(y), l._slot = _, l._tokuiType = "watermark", l;
9649
- }), e.register("backtop", (e) => {
9650
- var r = e.attrs || {}, i = parseInt(r.t) || 200, a = r.v || "circle", o = r.tx || "↑", s = r.s || "", c = r.bottom || "40", l = r.right || "40", u = r.container !== void 0, d = ["tokui-backtop"];
9651
- a === "round" ? d.push("tokui-backtop--round") : a === "square" && d.push("tokui-backtop--square"), s === "sm" ? d.push("tokui-backtop--sm") : s === "lg" && d.push("tokui-backtop--lg"), u && d.push("tokui-backtop--container");
9652
- var f = t("div", {
9653
- class: d.join(" "),
9786
+ }), e.register("backtop", (r) => {
9787
+ var i = r.attrs || {}, a = parseInt(i.t) || 200, o = i.v || "circle", s = i.tx || "↑", c = i.s || "", l = i.bottom || "40", u = i.right || "40", d = i.container !== void 0, f = ["tokui-backtop"];
9788
+ o === "round" ? f.push("tokui-backtop--round") : o === "square" && f.push("tokui-backtop--square"), c === "sm" ? f.push("tokui-backtop--sm") : c === "lg" && f.push("tokui-backtop--lg"), d && f.push("tokui-backtop--container");
9789
+ var p = t("div", {
9790
+ class: f.join(" "),
9654
9791
  role: "button",
9655
9792
  "aria-label": n("backToTop.aria"),
9656
9793
  tabindex: "0"
9657
9794
  });
9658
- return u ? f.style.bottom = c + "px" : (f.style.bottom = c + "px", f.style.right = l + "px"), f.textContent = o, typeof window < "u" && requestAnimationFrame(function() {
9659
- for (var e = window, t = f.parentElement; t;) {
9660
- var n = getComputedStyle(t);
9661
- if ((n.overflowY === "auto" || n.overflowY === "scroll") && t.scrollHeight > t.clientHeight) {
9662
- e = t;
9795
+ return d ? p.style.bottom = l + "px" : (p.style.bottom = l + "px", p.style.right = u + "px"), p.textContent = s, typeof window < "u" && requestAnimationFrame(function() {
9796
+ for (var t = window, n = p.parentElement; n;) {
9797
+ var r = getComputedStyle(n);
9798
+ if ((r.overflowY === "auto" || r.overflowY === "scroll") && n.scrollHeight > n.clientHeight) {
9799
+ t = n;
9663
9800
  break;
9664
9801
  }
9665
- t = t.parentElement;
9802
+ n = n.parentElement;
9666
9803
  }
9667
- f.addEventListener("click", function() {
9668
- e === window ? window.scrollTo({
9804
+ p.addEventListener("click", function() {
9805
+ t === window ? window.scrollTo({
9669
9806
  top: 0,
9670
9807
  behavior: "smooth"
9671
- }) : e.scrollTo({
9808
+ }) : t.scrollTo({
9672
9809
  top: 0,
9673
9810
  behavior: "smooth"
9674
9811
  });
9675
- }), f.addEventListener("keydown", function(t) {
9676
- (t.key === "Enter" || t.key === " ") && (t.preventDefault(), e === window ? window.scrollTo({
9812
+ }), p.addEventListener("keydown", function(e) {
9813
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), t === window ? window.scrollTo({
9677
9814
  top: 0,
9678
9815
  behavior: "smooth"
9679
- }) : e.scrollTo({
9816
+ }) : t.scrollTo({
9680
9817
  top: 0,
9681
9818
  behavior: "smooth"
9682
9819
  }));
9683
9820
  });
9684
- var r = function() {
9685
- (e === window ? window.pageYOffset : e.scrollTop) > i ? f.classList.add("tokui-backtop--visible") : f.classList.remove("tokui-backtop--visible");
9686
- }, a = !1, o = function() {
9687
- a || (a = !0, (typeof window < "u" && window.requestAnimationFrame ? function(e) {
9821
+ var i = function() {
9822
+ (t === window ? window.pageYOffset : t.scrollTop) > a ? p.classList.add("tokui-backtop--visible") : p.classList.remove("tokui-backtop--visible");
9823
+ }, o = !1, s = function() {
9824
+ o || (o = !0, (typeof window < "u" && window.requestAnimationFrame ? function(e) {
9688
9825
  window.requestAnimationFrame(e);
9689
9826
  } : function(e) {
9690
9827
  e();
9691
9828
  })(function() {
9692
- a = !1, r();
9829
+ o = !1, i();
9693
9830
  }));
9694
9831
  };
9695
- e.addEventListener("scroll", o, { passive: !0 }), r(), f._backtopCleanup = function() {
9696
- e.removeEventListener("scroll", o);
9697
- };
9698
- }), f;
9832
+ t.addEventListener("scroll", s, { passive: !0 }), i(), p._backtopCleanup = function() {
9833
+ t.removeEventListener("scroll", s);
9834
+ }, e._registerCleanup(p, p._backtopCleanup);
9835
+ }), p;
9699
9836
  }), e.register("affix", (n, r) => {
9700
9837
  var i = n.attrs || {}, a = i.top === void 0 ? null : parseInt(i.top) || 0, o = i.bottom === void 0 ? null : parseInt(i.bottom) || 0;
9701
9838
  a === null && o === null && (a = 0);
@@ -9709,8 +9846,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9709
9846
  return e();
9710
9847
  };
9711
9848
  u(function() {
9712
- var e = null;
9713
- function n() {
9849
+ var n = null;
9850
+ function r() {
9714
9851
  if (s && typeof document < "u" && typeof document.querySelector == "function") {
9715
9852
  var e = document.querySelector(s);
9716
9853
  if (e) return e;
@@ -9724,13 +9861,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9724
9861
  }
9725
9862
  return null;
9726
9863
  }
9727
- var r = !1, i = null;
9728
- function d() {
9729
- if (e) {
9730
- var t = e.getBoundingClientRect();
9864
+ var i = !1, d = null;
9865
+ function f() {
9866
+ if (n) {
9867
+ var e = n.getBoundingClientRect();
9731
9868
  return {
9732
- top: t.top,
9733
- bottom: t.bottom
9869
+ top: e.top,
9870
+ bottom: e.bottom
9734
9871
  };
9735
9872
  }
9736
9873
  return {
@@ -9738,30 +9875,30 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9738
9875
  bottom: window.innerHeight || 768
9739
9876
  };
9740
9877
  }
9741
- var f = function() {
9878
+ var p = function() {
9742
9879
  if (typeof c.getBoundingClientRect == "function") {
9743
- (!s || !e) && (e = n());
9744
- var u = r && i ? i : c;
9745
- if (typeof u.getBoundingClientRect == "function") {
9746
- var f = u.getBoundingClientRect(), p = d(), m = a === null ? f.top > p.bottom - o - f.height : f.top - p.top < a;
9747
- if (m && !r) {
9748
- r = !0;
9880
+ (!s || !n) && (n = r());
9881
+ var e = i && d ? d : c;
9882
+ if (typeof e.getBoundingClientRect == "function") {
9883
+ var u = e.getBoundingClientRect(), p = f(), m = a === null ? u.top > p.bottom - o - u.height : u.top - p.top < a;
9884
+ if (m && !i) {
9885
+ i = !0;
9749
9886
  var h = c.getBoundingClientRect();
9750
- i = t("div", { class: "tokui-affix__placeholder" }), i.style.height = h.height + "px", i.style.width = h.width + "px", c.parentNode && c.parentNode.insertBefore(i, c), c.style.width = h.width + "px", c.style.top = a === null ? p.bottom - o - h.height + "px" : p.top + a + "px", c.classList.add("tokui-affix--fixed"), l("change", { fixed: !0 });
9751
- } else !m && r && (r = !1, c.classList.remove("tokui-affix--fixed"), c.style.top = "", c.style.width = "", i && i.parentNode && i.parentNode.removeChild(i), i = null, l("change", { fixed: !1 }));
9887
+ d = t("div", { class: "tokui-affix__placeholder" }), d.style.height = h.height + "px", d.style.width = h.width + "px", c.parentNode && c.parentNode.insertBefore(d, c), c.style.width = h.width + "px", c.style.top = a === null ? p.bottom - o - h.height + "px" : p.top + a + "px", c.classList.add("tokui-affix--fixed"), l("change", { fixed: !0 });
9888
+ } else !m && i && (i = !1, c.classList.remove("tokui-affix--fixed"), c.style.top = "", c.style.width = "", d && d.parentNode && d.parentNode.removeChild(d), d = null, l("change", { fixed: !1 }));
9752
9889
  }
9753
9890
  }
9754
- }, p = !1, m = function() {
9755
- p || (p = !0, u(function() {
9756
- p = !1, f();
9891
+ }, m = !1, h = function() {
9892
+ m || (m = !0, u(function() {
9893
+ m = !1, p();
9757
9894
  }));
9758
9895
  };
9759
- window.addEventListener && window.addEventListener("scroll", m, {
9896
+ window.addEventListener && window.addEventListener("scroll", h, {
9760
9897
  capture: !0,
9761
9898
  passive: !0
9762
- }), window.addEventListener && window.addEventListener("resize", m, { passive: !0 }), f(), c._streamCloseHook = f, c._affixCleanup = function() {
9763
- window.removeEventListener && (window.removeEventListener("scroll", m, { capture: !0 }), window.removeEventListener("resize", m));
9764
- };
9899
+ }), window.addEventListener && window.addEventListener("resize", h, { passive: !0 }), p(), c._streamCloseHook = p, c._affixCleanup = function() {
9900
+ window.removeEventListener && (window.removeEventListener("scroll", h, { capture: !0 }), window.removeEventListener("resize", h));
9901
+ }, e._registerCleanup(c, c._affixCleanup);
9765
9902
  });
9766
9903
  }
9767
9904
  return c;
@@ -9936,176 +10073,180 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
9936
10073
  }
9937
10074
  return f._notifDuration = c, f;
9938
10075
  }), e.register("chat-input", (r, i) => {
9939
- var a = r.attrs || {}, o = a.ph || "", s = a.clk || "", c = a.dis !== void 0, l = parseInt(a.max) || 0, u = a.auto !== void 0, d = parseInt(a.rows) || 2, f = t("div", { class: "tokui-chat-input" }), p = t("textarea", {
10076
+ var a = r.attrs || {}, o = a.ph || "", s = a.clk || "", c = a.dis !== void 0, l = parseInt(a.max) || 0, u = a.auto !== void 0, d = parseInt(a.rows) || 2, f = { class: "tokui-chat-input" };
10077
+ a.id && (f.id = a.id);
10078
+ var p = t("div", f), m = t("textarea", {
9940
10079
  class: "tokui-chat-input__textarea",
9941
10080
  rows: String(d),
9942
10081
  placeholder: o
9943
10082
  });
9944
- c && (p.setAttribute("disabled", ""), p.classList.add("tokui-chat-input__textarea--disabled")), u && p.classList.add("tokui-chat-input__textarea--auto"), f.appendChild(p);
9945
- var m = t("div", { class: "tokui-chat-input__actions" });
10083
+ c && (m.setAttribute("disabled", ""), m.classList.add("tokui-chat-input__textarea--disabled")), u && m.classList.add("tokui-chat-input__textarea--auto"), p.appendChild(m);
10084
+ var h = t("div", { class: "tokui-chat-input__actions" });
9946
10085
  r.children && r.children.length > 0 && i(r.children).forEach(function(e) {
9947
- e && e.nodeType && m.appendChild(e);
10086
+ e && e.nodeType && h.appendChild(e);
9948
10087
  });
9949
- var h = t("button", {
10088
+ var g = t("button", {
9950
10089
  class: "tokui-chat-input__send",
9951
10090
  type: "button",
9952
10091
  "aria-label": n("common.send")
9953
10092
  });
9954
- h.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><path d=\"M10 3a1 1 0 0 1 .7.3l5 5a1 1 0 0 1-1.4 1.4L11 6.4V16a1 1 0 1 1-2 0V6.4l-3.3 3.3a1 1 0 0 1-1.4-1.4l5-5A1 1 0 0 1 10 3z\"/></svg>", c && (h.setAttribute("disabled", ""), h.classList.add("tokui-chat-input__send--disabled")), m.appendChild(h);
9955
- var g = e.createReporter("chat-input", a, f), _ = t("button", {
10093
+ g.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><path d=\"M10 3a1 1 0 0 1 .7.3l5 5a1 1 0 0 1-1.4 1.4L11 6.4V16a1 1 0 1 1-2 0V6.4l-3.3 3.3a1 1 0 0 1-1.4-1.4l5-5A1 1 0 0 1 10 3z\"/></svg>", c && (g.setAttribute("disabled", ""), g.classList.add("tokui-chat-input__send--disabled")), h.appendChild(g);
10094
+ var _ = e.createReporter("chat-input", a, p), v = t("button", {
9956
10095
  class: "tokui-chat-input__stop",
9957
10096
  type: "button",
9958
10097
  "aria-label": n("common.stop")
9959
10098
  });
9960
- if (_.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><rect x=\"5\" y=\"5\" width=\"10\" height=\"10\" rx=\"1.5\"/></svg>", _.addEventListener("click", function() {
9961
- if (g("stop", {}), f.classList.remove("tokui-chat-input--streaming"), !String(a.on || "").split(",").some(function(e) {
10099
+ if (v.innerHTML = "<svg viewBox=\"0 0 20 20\" width=\"18\" height=\"18\" fill=\"currentColor\"><rect x=\"5\" y=\"5\" width=\"10\" height=\"10\" rx=\"1.5\"/></svg>", v.addEventListener("click", function() {
10100
+ if (_("stop", {}), p.classList.remove("tokui-chat-input--streaming"), !String(a.on || "").split(",").some(function(e) {
9962
10101
  return e.trim().indexOf("stop:") === 0;
9963
10102
  })) {
9964
10103
  var t = e._tokuiInstance || typeof window < "u" && window.TokUI && window.TokUI._instance;
9965
10104
  t && typeof t.disconnect == "function" && t.disconnect();
9966
10105
  }
9967
- }), m.appendChild(_), a.streaming !== void 0 && f.classList.add("tokui-chat-input--streaming"), f.appendChild(m), l > 0) {
9968
- var v = t("span", { class: "tokui-chat-input__counter" });
9969
- v.textContent = "0/" + l, f.appendChild(v), p.addEventListener("input", function() {
9970
- var e = (p.value || "").length;
9971
- v.textContent = e + "/" + l, e > l ? v.classList.add("tokui-chat-input__counter--over") : v.classList.remove("tokui-chat-input__counter--over");
10106
+ }), h.appendChild(v), a.streaming !== void 0 && p.classList.add("tokui-chat-input--streaming"), p.appendChild(h), l > 0) {
10107
+ var y = t("span", { class: "tokui-chat-input__counter" });
10108
+ y.textContent = "0/" + l, p.appendChild(y), m.addEventListener("input", function() {
10109
+ var e = (m.value || "").length;
10110
+ y.textContent = e + "/" + l, e > l ? y.classList.add("tokui-chat-input__counter--over") : y.classList.remove("tokui-chat-input__counter--over");
9972
10111
  });
9973
10112
  }
9974
- u && p.addEventListener("input", function() {
9975
- p.style.height = "auto", p.style.height = p.scrollHeight + "px";
10113
+ u && m.addEventListener("input", function() {
10114
+ m.style.height = "auto", m.style.height = m.scrollHeight + "px";
9976
10115
  });
9977
- var y = a.mention || "";
9978
- if (y) {
9979
- p.setAttribute("role", "combobox"), p.setAttribute("aria-expanded", "false");
9980
- var b = t("div", {
10116
+ var b = a.mention || "";
10117
+ if (b) {
10118
+ m.setAttribute("role", "combobox"), m.setAttribute("aria-expanded", "false");
10119
+ var x = t("div", {
9981
10120
  class: "tokui-chat-input__mention",
9982
10121
  role: "listbox"
9983
10122
  });
9984
- b.style.display = "none", f.appendChild(b);
9985
- var x = [], S = -1, C = null, w = function() {
9986
- b.style.display = "none", x = [], S = -1, C = null, p.setAttribute("aria-expanded", "false");
9987
- }, T = function() {
9988
- var e = p.selectionStart == null ? (p.value || "").length : p.selectionStart, t = (p.value || "").slice(0, e).match(/(^|\s)@([^\s@]*)$/);
10123
+ x.style.display = "none", p.appendChild(x);
10124
+ var S = [], C = -1, w = null, T = function() {
10125
+ x.style.display = "none", S = [], C = -1, w = null, m.setAttribute("aria-expanded", "false");
10126
+ }, E = function() {
10127
+ var e = m.selectionStart == null ? (m.value || "").length : m.selectionStart, t = (m.value || "").slice(0, e).match(/(^|\s)@([^\s@]*)$/);
9989
10128
  return t ? {
9990
10129
  query: t[2],
9991
10130
  start: e - t[2].length - 1,
9992
10131
  end: e
9993
10132
  } : null;
9994
- }, E = function(e) {
9995
- var t = x[e];
9996
- if (!(!t || !C)) {
9997
- var n = typeof t == "string" ? t : t.v == null ? t.tx : t.v, r = typeof t == "string" ? t : t.tx == null ? t.v : t.tx, i = p.value || "";
9998
- p.value = i.slice(0, C.start) + "@" + r + " " + i.slice(C.end);
9999
- var o = C.start + String(r).length + 2;
10000
- typeof p.setSelectionRange == "function" && p.setSelectionRange(o, o), g("mention", {
10133
+ }, D = function(e) {
10134
+ var t = S[e];
10135
+ if (!(!t || !w)) {
10136
+ var n = typeof t == "string" ? t : t.v == null ? t.tx : t.v, r = typeof t == "string" ? t : t.tx == null ? t.v : t.tx, i = m.value || "";
10137
+ m.value = i.slice(0, w.start) + "@" + r + " " + i.slice(w.end);
10138
+ var o = w.start + String(r).length + 2;
10139
+ typeof m.setSelectionRange == "function" && m.setSelectionRange(o, o), _("mention", {
10001
10140
  value: n,
10002
10141
  name: a.n || void 0
10003
- }), w(), typeof p.focus == "function" && p.focus();
10142
+ }), T(), typeof m.focus == "function" && m.focus();
10004
10143
  }
10005
- }, D = function(e) {
10006
- if (b.innerHTML = "", x = e.slice(0, 8), !x.length) {
10007
- w();
10144
+ }, O = function(e) {
10145
+ if (x.innerHTML = "", S = e.slice(0, 8), !S.length) {
10146
+ T();
10008
10147
  return;
10009
10148
  }
10010
- S = 0, x.forEach(function(e, n) {
10149
+ C = 0, S.forEach(function(e, n) {
10011
10150
  var r = typeof e == "string" ? e : e.tx == null ? e.v : e.tx, i = t("div", {
10012
10151
  class: "tokui-chat-input__mention-item" + (n === 0 ? " tokui-chat-input__mention-item--active" : ""),
10013
10152
  role: "option",
10014
10153
  "aria-selected": n === 0 ? "true" : "false"
10015
10154
  }, r);
10016
10155
  i.addEventListener("mousedown", function(e) {
10017
- e && e.preventDefault && e.preventDefault(), E(n);
10018
- }), b.appendChild(i);
10019
- }), b.style.display = "", p.setAttribute("aria-expanded", "true");
10156
+ e && e.preventDefault && e.preventDefault(), D(n);
10157
+ }), x.appendChild(i);
10158
+ }), x.style.display = "", m.setAttribute("aria-expanded", "true");
10020
10159
  };
10021
- p.addEventListener("keydown", function(e) {
10022
- if (b.style.display !== "none") if (e.key === "ArrowDown" || e.key === "ArrowUp") {
10023
- e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, S = (S + (e.key === "ArrowDown" ? 1 : -1) + x.length) % x.length;
10024
- for (var t = 0; t < b.childNodes.length; t++) {
10025
- var n = b.childNodes[t];
10026
- n.classList && (t === S ? (n.classList.add("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "true")) : (n.classList.remove("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "false")));
10160
+ m.addEventListener("keydown", function(e) {
10161
+ if (x.style.display !== "none") if (e.key === "ArrowDown" || e.key === "ArrowUp") {
10162
+ e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, C = (C + (e.key === "ArrowDown" ? 1 : -1) + S.length) % S.length;
10163
+ for (var t = 0; t < x.childNodes.length; t++) {
10164
+ var n = x.childNodes[t];
10165
+ n.classList && (t === C ? (n.classList.add("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "true")) : (n.classList.remove("tokui-chat-input__mention-item--active"), n.setAttribute("aria-selected", "false")));
10027
10166
  }
10028
- } else e.key === "Enter" || e.key === "Tab" ? (e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, E(S)) : e.key === "Escape" && (e._tokuiMentionHandled = !0, w());
10029
- }), p.addEventListener("input", function() {
10030
- var t = T();
10167
+ } else e.key === "Enter" || e.key === "Tab" ? (e.preventDefault && e.preventDefault(), e._tokuiMentionHandled = !0, D(C)) : e.key === "Escape" && (e._tokuiMentionHandled = !0, T());
10168
+ }), m.addEventListener("input", function() {
10169
+ var t = E();
10031
10170
  if (!t) {
10032
- w();
10171
+ T();
10033
10172
  return;
10034
10173
  }
10035
10174
  if (e.eventBus) {
10036
- var n = e.eventBus.getHandler(y);
10175
+ var n = e.eventBus.getHandler(b);
10037
10176
  if (!n) {
10038
- e._warnMissingHandler(y), w();
10177
+ e._warnMissingHandler(b), T();
10039
10178
  return;
10040
10179
  }
10041
- C = t;
10180
+ w = t;
10042
10181
  var r;
10043
10182
  try {
10044
10183
  r = n({ value: t.query });
10045
10184
  } catch (e) {
10046
- console.warn("TokUI: mention 数据源异常", e), w();
10185
+ console.warn("TokUI: mention 数据源异常", e), T();
10047
10186
  return;
10048
10187
  }
10049
10188
  r && typeof r.then == "function" ? r.then(function(e) {
10050
- C && C.query === t.query && Array.isArray(e) && D(e);
10189
+ w && w.query === t.query && Array.isArray(e) && O(e);
10051
10190
  }).catch(function() {
10052
- w();
10053
- }) : Array.isArray(r) ? D(r) : w();
10191
+ T();
10192
+ }) : Array.isArray(r) ? O(r) : T();
10054
10193
  }
10055
- }), p.addEventListener("blur", function() {
10056
- setTimeout(w, 150);
10194
+ }), m.addEventListener("blur", function() {
10195
+ setTimeout(T, 150);
10057
10196
  });
10058
10197
  }
10059
- function O() {
10198
+ function k() {
10060
10199
  if (!c) {
10061
- var t = p.value || "";
10200
+ var t = m.value || "";
10062
10201
  if (t.trim()) {
10063
- if (s && (f.setAttribute("data-tokui-clk-value", t), e.eventBus)) {
10202
+ if (s && (p.setAttribute("data-tokui-clk-value", t), e.eventBus)) {
10064
10203
  var n = e.eventBus.getHandler(s);
10065
- n ? n({ value: t }, null, f) : e._warnMissingHandler(s);
10204
+ n ? n({ value: t }, null, p) : e._warnMissingHandler(s);
10066
10205
  }
10067
- g("send", { value: t }), p.value = "", l > 0 && (v.textContent = "0/" + l, v.classList.remove("tokui-chat-input__counter--over")), u && (p.style.height = "auto");
10206
+ _("send", { value: t }), m.value = "", l > 0 && (y.textContent = "0/" + l, y.classList.remove("tokui-chat-input__counter--over")), u && (m.style.height = "auto");
10068
10207
  }
10069
10208
  }
10070
10209
  }
10071
- return p.addEventListener("keydown", function(e) {
10072
- e._tokuiMentionHandled || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), O());
10073
- }), h.addEventListener("click", function() {
10074
- O();
10075
- }), f._update = function(e) {
10076
- e.dis !== void 0 && (c = !!e.dis, c ? (p.setAttribute("disabled", ""), p.classList.add("tokui-chat-input__textarea--disabled"), h.setAttribute("disabled", ""), h.classList.add("tokui-chat-input__send--disabled")) : (p.removeAttribute("disabled"), p.classList.remove("tokui-chat-input__textarea--disabled"), h.removeAttribute("disabled"), h.classList.remove("tokui-chat-input__send--disabled"))), e.streaming !== void 0 && (e.streaming !== "false" && e.streaming !== !1 ? f.classList.add("tokui-chat-input--streaming") : f.classList.remove("tokui-chat-input--streaming"));
10077
- }, f._slot = p, f._tokuiType = "chat-input", f;
10210
+ return m.addEventListener("keydown", function(e) {
10211
+ e._tokuiMentionHandled || e.key === "Enter" && !e.shiftKey && (e.preventDefault(), k());
10212
+ }), g.addEventListener("click", function() {
10213
+ k();
10214
+ }), p._update = function(e) {
10215
+ e.dis !== void 0 && (c = e.dis !== "false" && e.dis !== !1, c ? (m.setAttribute("disabled", ""), m.classList.add("tokui-chat-input__textarea--disabled"), g.setAttribute("disabled", ""), g.classList.add("tokui-chat-input__send--disabled")) : (m.removeAttribute("disabled"), m.classList.remove("tokui-chat-input__textarea--disabled"), g.removeAttribute("disabled"), g.classList.remove("tokui-chat-input__send--disabled"))), e.streaming !== void 0 && (e.streaming !== "false" && e.streaming !== !1 ? p.classList.add("tokui-chat-input--streaming") : p.classList.remove("tokui-chat-input--streaming"));
10216
+ }, p._slot = h, p._tokuiType = "chat-input", p;
10078
10217
  }), e.register("msg-actions", (r, i) => {
10079
10218
  var a = r.attrs || {}, o = a.clk || "", s = "tokui-msg-actions";
10080
10219
  a.visible && (s += " tokui-msg-actions--visible");
10081
- var c = t("div", { class: s }), l = {
10220
+ var c = { class: s };
10221
+ a.id && (c.id = a.id);
10222
+ var l = t("div", c), u = {
10082
10223
  copy: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"8\" y=\"8\" width=\"13\" height=\"13\" rx=\"2\"/><path d=\"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2\"/></svg>",
10083
10224
  regenerate: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8\"/><path d=\"M21 3v5h-5\"/><path d=\"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16\"/><path d=\"M3 21v-5h5\"/></svg>",
10084
10225
  like: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M7 10v12\"/><path d=\"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z\"/></svg>",
10085
10226
  dislike: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M17 14V2\"/><path d=\"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z\"/></svg>",
10086
10227
  delete: "<svg viewBox=\"0 0 24 24\" width=\"15\" height=\"15\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"3 6 5 6 21 6\"/><path d=\"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2\"/></svg>"
10087
- }, u = [];
10088
- a.copy !== void 0 && u.push({
10228
+ }, d = [];
10229
+ a.copy !== void 0 && d.push({
10089
10230
  act: "copy",
10090
- icon: l.copy,
10231
+ icon: u.copy,
10091
10232
  label: n("actions.copy")
10092
- }), a.regenerate !== void 0 && u.push({
10233
+ }), a.regenerate !== void 0 && d.push({
10093
10234
  act: "regenerate",
10094
- icon: l.regenerate,
10235
+ icon: u.regenerate,
10095
10236
  label: n("actions.regenerate")
10096
- }), a.like !== void 0 && (u.push({
10237
+ }), a.like !== void 0 && (d.push({
10097
10238
  act: "like",
10098
- icon: l.like,
10239
+ icon: u.like,
10099
10240
  label: n("actions.like")
10100
- }), u.push({
10241
+ }), d.push({
10101
10242
  act: "dislike",
10102
- icon: l.dislike,
10243
+ icon: u.dislike,
10103
10244
  label: n("actions.dislike")
10104
- })), a.delete !== void 0 && u.push({
10245
+ })), a.delete !== void 0 && d.push({
10105
10246
  act: "delete",
10106
- icon: l.delete,
10247
+ icon: u.delete,
10107
10248
  label: n("actions.delete")
10108
- }), u.forEach(function(e) {
10249
+ }), d.forEach(function(e) {
10109
10250
  var n = t("button", {
10110
10251
  class: "tokui-msg-actions__btn",
10111
10252
  type: "button",
@@ -10113,102 +10254,128 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10113
10254
  "aria-label": e.label,
10114
10255
  title: e.label
10115
10256
  }), r = t("span", { class: "tokui-msg-actions__icon" });
10116
- r.innerHTML = e.icon, n.appendChild(r), c.appendChild(n);
10257
+ r.innerHTML = e.icon, n.appendChild(r), l.appendChild(n);
10117
10258
  }), r.children && r.children.length > 0 && i(r.children).forEach(function(e) {
10118
- e && e.nodeType && c.appendChild(e);
10259
+ e && e.nodeType && l.appendChild(e);
10119
10260
  });
10120
- var d = e.createReporter("msg-actions", a, c);
10121
- return o && c.setAttribute("data-tokui-clk", o), c.addEventListener("click", function(e) {
10261
+ var f = e.createReporter("msg-actions", a, l);
10262
+ return o && l.setAttribute("data-tokui-clk", o), l.addEventListener("click", function(e) {
10122
10263
  var t = e.target.closest && e.target.closest(".tokui-msg-actions__btn");
10123
10264
  if (t) {
10124
10265
  var n = t.getAttribute("data-act");
10125
- n && (c.setAttribute("data-tokui-clk-act", n), d("action", { act: n }));
10266
+ n && (l.setAttribute("data-tokui-clk-act", n), f("action", { act: n }));
10126
10267
  }
10127
- }), c._slot = c, c._tokuiType = "msg-actions", c;
10268
+ }), l._slot = l, l._tokuiType = "msg-actions", l;
10128
10269
  }), e.register("tool-call", (r, i) => {
10129
- var a = r.attrs || {}, o = a.name || "tool", s = a.status || "pending", c = a.duration || "", l = { class: "tokui-tool-call tokui-tool-call--" + s };
10130
- a.id && (l.id = a.id);
10131
- var u = t("div", l), d = t("div", { class: "tokui-tool-call__header" }), f = t("span", { class: "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + s });
10132
- d.appendChild(f);
10133
- var p = t("span", { class: "tokui-tool-call__name" });
10134
- p.textContent = o, d.appendChild(p);
10135
- var m = t("span", { class: "tokui-tool-call__status" }), h = {
10136
- pending: n("status.pending"),
10137
- running: n("status.running"),
10138
- done: n("status.done"),
10139
- error: n("status.error"),
10140
- denied: n("status.denied")
10141
- };
10142
- if (m.textContent = h[s] || s, d.appendChild(m), c) {
10143
- var g = t("span", { class: "tokui-tool-call__duration" });
10144
- g.textContent = c, d.appendChild(g);
10270
+ var a = r.attrs || {}, o = a.name || n("toolCall.defaultName"), s = a.status || "pending", c = a.duration || "", l = a.collapsed !== void 0, u = { class: "tokui-tool-call tokui-tool-call--" + s + (l ? " tokui-tool-call--collapsed" : "") };
10271
+ a.id && (u.id = a.id);
10272
+ var d = t("div", u), f = t("div", {
10273
+ class: "tokui-tool-call__header",
10274
+ role: "button",
10275
+ tabindex: "0",
10276
+ "aria-expanded": String(!l)
10277
+ }), p = t("span", { class: "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + s });
10278
+ f.appendChild(p);
10279
+ var m = t("span", { class: "tokui-tool-call__name" });
10280
+ m.textContent = o, f.appendChild(m);
10281
+ var h = t("span", { class: "tokui-tool-call__status" });
10282
+ function g(e) {
10283
+ return {
10284
+ pending: n("status.pending"),
10285
+ running: n("status.running"),
10286
+ done: n("status.done"),
10287
+ error: n("status.error"),
10288
+ denied: n("status.denied")
10289
+ }[e] || e;
10290
+ }
10291
+ if (h.textContent = g(s), f.appendChild(h), c) {
10292
+ var _ = t("span", { class: "tokui-tool-call__duration" });
10293
+ _.textContent = c, f.appendChild(_);
10294
+ }
10295
+ var v = t("span", {
10296
+ class: "tokui-tool-call__chevron",
10297
+ "aria-hidden": "true"
10298
+ });
10299
+ v.textContent = "▾", f.appendChild(v), d.appendChild(f);
10300
+ var y = t("div", { class: "tokui-tool-call__body" });
10301
+ function b() {
10302
+ var e = d.classList.toggle("tokui-tool-call--collapsed");
10303
+ f.setAttribute("aria-expanded", String(!e));
10145
10304
  }
10146
- u.appendChild(d);
10147
- var _ = t("div", { class: "tokui-tool-call__body" });
10148
- if (r.content) {
10149
- var v = t("div", { class: "tokui-tool-call__params" });
10150
- v.textContent = r.content, _.appendChild(v);
10305
+ if (f.addEventListener("click", b), f.addEventListener("keydown", function(e) {
10306
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), b());
10307
+ }), r.content) {
10308
+ var x = t("div", { class: "tokui-tool-call__params" });
10309
+ x.textContent = r.content, y.appendChild(x);
10151
10310
  }
10152
10311
  if (i(r.children || []).forEach(function(e) {
10153
- e && e.nodeType && _.appendChild(e);
10154
- }), u.appendChild(_), a.approval !== void 0 && s === "pending") {
10155
- var y = e.createReporter("tool-call", a, u), b = a.clk || "", x = t("div", { class: "tokui-tool-call__approval" }), S = t("button", {
10312
+ e && e.nodeType && y.appendChild(e);
10313
+ }), d.appendChild(y), a.approval !== void 0 && s === "pending") {
10314
+ var S = e.createReporter("tool-call", a, d), C = a.clk || "", w = t("div", { class: "tokui-tool-call__approval" }), T = t("button", {
10156
10315
  class: "tokui-tool-call__approve",
10157
10316
  type: "button"
10158
- }, n("actions.approve")), C = t("button", {
10317
+ }, n("actions.approve")), E = t("button", {
10159
10318
  class: "tokui-tool-call__deny",
10160
10319
  type: "button"
10161
- }, n("actions.deny")), w = function(t) {
10162
- S.setAttribute("disabled", ""), C.setAttribute("disabled", ""), (t ? S : C).classList.add("tokui-tool-call__approval--chosen"), x.classList.add("tokui-tool-call__approval--decided");
10320
+ }, n("actions.deny")), D = function(t) {
10321
+ T.setAttribute("disabled", ""), E.setAttribute("disabled", ""), (t ? T : E).classList.add("tokui-tool-call__approval--chosen"), w.classList.add("tokui-tool-call__approval--decided");
10163
10322
  var n = {
10164
10323
  approved: t,
10165
10324
  id: a.id || null,
10166
10325
  name: o
10167
10326
  };
10168
- if (b && e.eventBus) {
10169
- var r = e.eventBus.getHandler(b);
10170
- r && r(n, null, u);
10327
+ if (C && e.eventBus) {
10328
+ var r = e.eventBus.getHandler(C);
10329
+ r && r(n, null, d);
10171
10330
  }
10172
- y("approval", n);
10331
+ S("approval", n);
10173
10332
  };
10174
- S.addEventListener("click", function() {
10175
- w(!0);
10176
- }), C.addEventListener("click", function() {
10177
- w(!1);
10178
- }), x.appendChild(S), x.appendChild(C), u.appendChild(x);
10333
+ T.addEventListener("click", function() {
10334
+ D(!0);
10335
+ }), E.addEventListener("click", function() {
10336
+ D(!1);
10337
+ }), w.appendChild(T), w.appendChild(E), d.appendChild(w);
10179
10338
  }
10180
- return u._slot = _, u._tokuiType = "tool-call", u._update = function(e) {
10181
- if (e.status && (u.className = "tokui-tool-call tokui-tool-call--" + e.status, f.className = "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + e.status, m.textContent = h[e.status] || e.status), e.duration) {
10182
- var n = u.querySelector(".tokui-tool-call__duration");
10183
- n || (n = t("span", { class: "tokui-tool-call__duration" }), d.appendChild(n)), n.textContent = e.duration;
10339
+ return d._slot = y, d._tokuiType = "tool-call", d._update = function(e) {
10340
+ if (e.status) {
10341
+ var n = d.classList.contains("tokui-tool-call--collapsed");
10342
+ d.className = "tokui-tool-call tokui-tool-call--" + e.status + (n ? " tokui-tool-call--collapsed" : ""), p.className = "tokui-tool-call__status-dot tokui-tool-call__status-dot--" + e.status, h.textContent = g(e.status);
10343
+ }
10344
+ if (e.duration) {
10345
+ var r = d.querySelector(".tokui-tool-call__duration");
10346
+ r || (r = t("span", { class: "tokui-tool-call__duration" }), f.appendChild(r)), r.textContent = e.duration;
10184
10347
  }
10185
10348
  if (e.result) {
10186
- var r = t("div", { class: "tokui-tool-call__result" });
10187
- r.textContent = e.result, _.appendChild(r);
10349
+ var i = y.querySelector(".tokui-tool-call__result");
10350
+ i || (i = t("div", { class: "tokui-tool-call__result" }), y.appendChild(i)), i.textContent = e.result;
10188
10351
  }
10189
10352
  if (e.error) {
10190
- var i = t("div", { class: "tokui-tool-call__error" });
10191
- i.textContent = e.error, _.appendChild(i);
10353
+ var a = y.querySelector(".tokui-tool-call__error");
10354
+ a || (a = t("div", { class: "tokui-tool-call__error" }), y.appendChild(a)), a.textContent = e.error;
10192
10355
  }
10193
- }, u;
10356
+ }, d;
10194
10357
  }), e.register("typing", (e) => {
10195
- for (var n = e.attrs || {}, r = t("div", { class: "tokui-typing" }), i = t("span", { class: "tokui-typing__dots" }), a = 0; a < 3; a++) {
10196
- var o = t("span", { class: "tokui-typing__dot" });
10197
- o.style.animationDelay = a * .15 + "s", i.appendChild(o);
10358
+ var n = e.attrs || {}, r = { class: "tokui-typing" };
10359
+ n.id && (r.id = n.id);
10360
+ for (var i = t("div", r), a = t("span", { class: "tokui-typing__dots" }), o = 0; o < 3; o++) {
10361
+ var s = t("span", { class: "tokui-typing__dot" });
10362
+ s.style.animationDelay = o * .15 + "s", a.appendChild(s);
10198
10363
  }
10199
- if (r.appendChild(i), n.text) {
10200
- var s = t("span", { class: "tokui-typing__text" });
10201
- s.textContent = n.text, r.appendChild(s);
10364
+ if (i.appendChild(a), n.text) {
10365
+ var c = t("span", { class: "tokui-typing__text" });
10366
+ c.textContent = n.text, i.appendChild(c);
10202
10367
  }
10203
- return r;
10368
+ return i._tokuiType = "typing", i;
10204
10369
  }), e.register("quick-reply", (n, r) => {
10205
- var i = n.attrs || {}, a = i.clk || "", o = t("div", { class: "tokui-quick-reply" }), s = t("div", { class: "tokui-quick-reply__items" }), c = e.createReporter("quick-reply", i, o);
10206
- function l(t) {
10370
+ var i = n.attrs || {}, a = i.clk || "", o = { class: "tokui-quick-reply" };
10371
+ i.id && (o.id = i.id);
10372
+ var s = t("div", o), c = t("div", { class: "tokui-quick-reply__items" }), l = e.createReporter("quick-reply", i, s);
10373
+ function u(t) {
10207
10374
  if (a && e.eventBus) {
10208
10375
  var n = e.eventBus.getHandler(a);
10209
- n ? n({ value: t }, null, o) : e._warnMissingHandler(a);
10376
+ n ? n({ value: t }, null, s) : e._warnMissingHandler(a);
10210
10377
  }
10211
- c("select", { value: t });
10378
+ l("select", { value: t });
10212
10379
  }
10213
10380
  return i.items && i.items.split(",").forEach(function(e) {
10214
10381
  var n = e.trim(), r = t("button", {
@@ -10216,16 +10383,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10216
10383
  type: "button"
10217
10384
  });
10218
10385
  r.textContent = n, r.addEventListener("click", function() {
10219
- l(n);
10220
- }), s.appendChild(r);
10386
+ u(n);
10387
+ }), c.appendChild(r);
10221
10388
  }), n.children && n.children.length && r(n.children).forEach(function(e) {
10222
- e && e.nodeType && s.appendChild(e);
10223
- }), o.appendChild(s), o._slot = s, o._tokuiType = "quick-reply", o;
10389
+ e && e.nodeType && c.appendChild(e);
10390
+ }), s.appendChild(c), s._slot = c, s._tokuiType = "quick-reply", s;
10224
10391
  }), e.register("suggestions", (e, n) => {
10225
10392
  var r = e.attrs || {}, i = Math.min(4, Math.max(1, parseInt(r.cols) || 2)), a = t("div", { class: "tokui-suggestions" });
10226
10393
  r.clk && a.setAttribute("data-tokui-clk", r.clk), r.id && (a.id = r.id);
10227
10394
  var o = t("div", { class: "tokui-suggestions__grid tokui-suggestions__grid--" + i });
10228
- return o.style.gridTemplateColumns = "repeat(" + i + ", 1fr)", e.children && e.children.length && n(e.children).forEach(function(e) {
10395
+ return e.children && e.children.length && n(e.children).forEach(function(e) {
10229
10396
  e && e.nodeType && o.appendChild(e);
10230
10397
  }), a.appendChild(o), a._slot = o, a._tokuiType = "suggestions", a;
10231
10398
  }), e.register("suggestion", (n) => {
@@ -10254,48 +10421,53 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10254
10421
  return s.appendChild(d), s.addEventListener("keydown", function(e) {
10255
10422
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), s.click());
10256
10423
  }), s;
10257
- }), e.register("source", (e) => {
10258
- var n = e.attrs || {}, r = n.n || "1", i = n.tt || "", a = n.sn || "", o = n.u || n.url || "", s = t("div", { class: "tokui-source" }), c = t("span", { class: "tokui-source__num" });
10259
- c.textContent = r, s.appendChild(c);
10260
- var l = t("div", { class: "tokui-source__body" });
10261
- if (i) {
10262
- var u = o ? t("a", {
10424
+ }), e.register("source", (n) => {
10425
+ var r = n.attrs || {}, i = r.n || "1", a = r.tt || "", o = r.sn || "", s = r.u || r.url || "", c = t("div", { class: "tokui-source" }), l = t("span", { class: "tokui-source__num" });
10426
+ l.textContent = i, c.appendChild(l);
10427
+ var u = t("div", { class: "tokui-source__body" }), d = e.createReporter("source", r, c);
10428
+ if (a) {
10429
+ var f;
10430
+ s ? (f = t("a", {
10263
10431
  class: "tokui-source__title",
10264
- href: o,
10432
+ href: s,
10265
10433
  target: "_blank"
10266
- }) : t("span", { class: "tokui-source__title" });
10267
- u.textContent = i, l.appendChild(u);
10434
+ }), f.addEventListener("click", function() {
10435
+ d("open", {
10436
+ url: s,
10437
+ title: a
10438
+ });
10439
+ })) : f = t("span", { class: "tokui-source__title" }), f.textContent = a, u.appendChild(f);
10268
10440
  }
10269
- if (a) {
10270
- var d = t("div", { class: "tokui-source__snippet" });
10271
- d.textContent = a, l.appendChild(d);
10441
+ if (o) {
10442
+ var p = t("div", { class: "tokui-source__snippet" });
10443
+ p.textContent = o, u.appendChild(p);
10272
10444
  }
10273
- return s.appendChild(l), s;
10445
+ return c.appendChild(u), c;
10274
10446
  });
10275
- function E(e, n) {
10447
+ function O(e, n) {
10276
10448
  var r = t("div", { class: "tokui-diff__line" }), i = t("span", { class: "tokui-diff__num" }), a = t("span", { class: "tokui-diff__code" });
10277
10449
  return e.startsWith("+") ? (r.classList.add("tokui-diff__line--add"), n.newLine++, i.textContent = n.newLine, a.textContent = e) : e.startsWith("-") ? (r.classList.add("tokui-diff__line--remove"), n.oldLine++, i.textContent = n.oldLine, a.textContent = e) : (r.classList.add("tokui-diff__line--context"), n.oldLine++, n.newLine++, i.textContent = n.oldLine, a.textContent = e || " "), r.appendChild(i), r.appendChild(a), r;
10278
10450
  }
10279
- function D(e, t) {
10451
+ function k(e, t) {
10280
10452
  e.innerHTML = "";
10281
10453
  for (var n = t.split("\n"), r = n.length - 1, i = {
10282
10454
  oldLine: 0,
10283
10455
  newLine: 0
10284
- }, a = 0; a < r; a++) e.appendChild(E(n[a], i));
10285
- var o = E(n[r], {
10456
+ }, a = 0; a < r; a++) e.appendChild(O(n[a], i));
10457
+ var o = O(n[r], {
10286
10458
  oldLine: i.oldLine,
10287
10459
  newLine: i.newLine
10288
10460
  });
10289
10461
  e.appendChild(o), e._diffFrozenCount = r, e._diffState = i, e._diffGrowingEl = o;
10290
10462
  }
10291
- function O(e, t) {
10463
+ function A(e, t) {
10292
10464
  if (typeof e._diffFrozenCount != "number" || !e._diffState) {
10293
- D(e, t);
10465
+ k(e, t);
10294
10466
  return;
10295
10467
  }
10296
- for (var n = t.split("\n"), r = n.length - 1, i = e._diffState, a = e._diffGrowingEl, o = e._diffFrozenCount; o < r; o++) e.insertBefore(E(n[o], i), a || null);
10468
+ for (var n = t.split("\n"), r = n.length - 1, i = e._diffState, a = e._diffGrowingEl, o = e._diffFrozenCount; o < r; o++) e.insertBefore(O(n[o], i), a || null);
10297
10469
  e._diffFrozenCount = r;
10298
- var s = E(n[r], {
10470
+ var s = O(n[r], {
10299
10471
  oldLine: i.oldLine,
10300
10472
  newLine: i.newLine
10301
10473
  });
@@ -10307,29 +10479,31 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10307
10479
  }
10308
10480
  }
10309
10481
  e.register("diff", (e, n) => {
10310
- var r = e.attrs || {}, i = t("div", { class: "tokui-diff" });
10482
+ var r = e.attrs || {}, i = { class: "tokui-diff" };
10483
+ r.id && (i.id = r.id);
10484
+ var a = t("div", i);
10311
10485
  if (r.title || r.lang) {
10312
- var a = t("div", { class: "tokui-diff__header" });
10486
+ var o = t("div", { class: "tokui-diff__header" });
10313
10487
  if (r.title) {
10314
- var o = t("span", { class: "tokui-diff__title" });
10315
- o.textContent = r.title, a.appendChild(o);
10488
+ var s = t("span", { class: "tokui-diff__title" });
10489
+ s.textContent = r.title, o.appendChild(s);
10316
10490
  }
10317
10491
  if (r.lang) {
10318
- var s = t("span", { class: "tokui-diff__lang" });
10319
- s.textContent = r.lang, a.appendChild(s);
10492
+ var c = t("span", { class: "tokui-diff__lang" });
10493
+ c.textContent = r.lang, o.appendChild(c);
10320
10494
  }
10321
- i.appendChild(a);
10495
+ a.appendChild(o);
10322
10496
  }
10323
- var c = t("div", { class: "tokui-diff__content" }), l = "";
10324
- l = e.children && e.children.length > 0 ? e.children.map(function(e) {
10497
+ var l = t("div", { class: "tokui-diff__content" }), u = "";
10498
+ u = e.children && e.children.length > 0 ? e.children.map(function(e) {
10325
10499
  return e.content || "";
10326
10500
  }).join("") : e.content || "";
10327
- function u() {
10328
- D(c, l);
10501
+ function d() {
10502
+ k(l, u);
10329
10503
  }
10330
- return u(), i.appendChild(c), i._slot = c, i._tokuiType = "diff", i._streamAppendHook = function(e) {
10331
- e && e.type === "_text" && e.content && (l += e.content, O(c, l));
10332
- }, i._streamCloseHook = u, i;
10504
+ return d(), a.appendChild(l), a._slot = l, a._tokuiType = "diff", a._streamAppendHook = function(e) {
10505
+ e && e.type === "_text" && e.content && (u += e.content, A(l, u));
10506
+ }, a._streamCloseHook = d, a;
10333
10507
  }), e.register("plan", (e, n) => {
10334
10508
  var r = e.attrs || {}, i = t("div", { class: "tokui-plan" });
10335
10509
  if (r.tt) {
@@ -10340,14 +10514,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10340
10514
  return n(e.children || []).forEach(function(e) {
10341
10515
  e && e.nodeType && o.appendChild(e);
10342
10516
  }), i.appendChild(o), i._slot = o, i._tokuiType = "plan", i;
10343
- }), e.register("plan-step", (e, n) => {
10344
- var r = e.attrs || {}, i = {
10517
+ }), e.register("plan-step", (e) => {
10518
+ var n = e.attrs || {}, r = {
10345
10519
  pending: 1,
10346
10520
  doing: 1,
10347
10521
  done: 1,
10348
10522
  error: 1,
10349
10523
  skipped: 1
10350
- }, a = {
10524
+ }, i = {
10351
10525
  running: "doing",
10352
10526
  active: "doing",
10353
10527
  progress: "doing",
@@ -10368,41 +10542,46 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10368
10542
  fail: "error",
10369
10543
  failed: "error",
10370
10544
  failure: "error"
10371
- }, o = String(r.status || "pending").toLowerCase(), s = t("div", { class: "tokui-plan-step tokui-plan-step--" + (a[o] || (i[o] ? o : "pending")) }), c = t("span", { class: "tokui-plan-step__dot" });
10372
- s.appendChild(c);
10373
- var l = t("div", { class: "tokui-plan-step__content" });
10374
- if (r.tt) {
10375
- var u = t("div", { class: "tokui-plan-step__title" });
10376
- u.textContent = r.tt, l.appendChild(u);
10377
- }
10378
- if (r.desc) {
10379
- var d = t("div", { class: "tokui-plan-step__desc" });
10380
- d.textContent = r.desc, l.appendChild(d);
10545
+ };
10546
+ function a(e) {
10547
+ var t = String(e || "pending").toLowerCase();
10548
+ return i[t] || (r[t] ? t : "pending");
10381
10549
  }
10382
- if (e.content) {
10550
+ var o = { class: "tokui-plan-step tokui-plan-step--" + a(n.status) };
10551
+ n.id && (o.id = n.id);
10552
+ var s = t("div", o), c = t("span", { class: "tokui-plan-step__dot" });
10553
+ s.appendChild(c);
10554
+ var l = t("div", { class: "tokui-plan-step__content" }), u = null;
10555
+ n.tt && (u = t("div", { class: "tokui-plan-step__title" }), u.textContent = n.tt, l.appendChild(u));
10556
+ var d = null;
10557
+ if (n.desc && (d = t("div", { class: "tokui-plan-step__desc" }), d.textContent = n.desc, l.appendChild(d)), e.content) {
10383
10558
  var f = t("div", { class: "tokui-plan-step__text" });
10384
10559
  f.textContent = e.content, l.appendChild(f);
10385
10560
  }
10386
- n(e.children || []).forEach(function(e) {
10387
- e && e.nodeType && l.appendChild(e);
10388
- }), s.appendChild(l);
10561
+ s.appendChild(l);
10389
10562
  var p = t("div", { class: "tokui-plan-step__line" });
10390
- return s.appendChild(p), s;
10563
+ return s.appendChild(p), s._update = function(e) {
10564
+ e.status && (s.className = "tokui-plan-step tokui-plan-step--" + a(e.status)), e.tt !== void 0 && (u || (u = t("div", { class: "tokui-plan-step__title" }), l.insertBefore(u, l.childNodes[0] || null)), u.textContent = e.tt), e.desc !== void 0 && (d || (d = t("div", { class: "tokui-plan-step__desc" }), l.appendChild(d)), d.textContent = e.desc);
10565
+ }, s;
10391
10566
  }), e.register("agent", (e, r) => {
10392
- var i = e.attrs || {}, a = i.name || "Agent", o = i.status || "idle", s = i.action || "", c = i.duration || "", l = { class: "tokui-agent tokui-agent--" + o };
10567
+ var i = e.attrs || {}, a = i.name || n("agent.defaultName"), o = i.status || "idle", s = i.action || "", c = i.duration || "", l = { class: "tokui-agent tokui-agent--" + o };
10393
10568
  i.id && (l.id = i.id);
10394
10569
  var u = t("div", l), d = t("div", { class: "tokui-agent__header" }), f = t("span", { class: "tokui-agent__status-dot tokui-agent__status-dot--" + o });
10395
10570
  d.appendChild(f);
10396
10571
  var p = t("span", { class: "tokui-agent__name" });
10397
10572
  p.textContent = a, d.appendChild(p);
10398
- var m = t("span", { class: "tokui-agent__status" }), h = {
10399
- idle: n("status.idle"),
10400
- running: n("status.running"),
10401
- paused: n("status.paused"),
10402
- done: n("status.done"),
10403
- error: n("status.error")
10404
- };
10405
- if (m.textContent = h[o] || o, d.appendChild(m), c) {
10573
+ var m = t("span", { class: "tokui-agent__status" });
10574
+ function h(e) {
10575
+ var t = {
10576
+ idle: "status.idle",
10577
+ running: "status.running",
10578
+ paused: "status.paused",
10579
+ done: "status.done",
10580
+ error: "status.error"
10581
+ };
10582
+ return t[e] ? n(t[e]) : e;
10583
+ }
10584
+ if (m.textContent = h(o), d.appendChild(m), c) {
10406
10585
  var g = t("span", { class: "tokui-agent__duration" });
10407
10586
  g.textContent = c, d.appendChild(g);
10408
10587
  }
@@ -10410,14 +10589,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10410
10589
  var _ = t("div", { class: "tokui-agent__action" });
10411
10590
  _.textContent = s, u.appendChild(_);
10412
10591
  }
10413
- if (e.children && e.children.length) {
10414
- var v = t("div", { class: "tokui-agent__body" });
10415
- r(e.children).forEach(function(e) {
10416
- e && e.nodeType && v.appendChild(e);
10417
- }), u.appendChild(v), u._slot = v;
10418
- }
10419
- return u._tokuiType = "agent", u._update = function(e) {
10420
- e.status && (u.className = "tokui-agent tokui-agent--" + e.status, f.className = "tokui-agent__status-dot tokui-agent__status-dot--" + e.status, m.textContent = h[e.status] || e.status), e.action && _ && (_.textContent = e.action), e.duration && g && (g.textContent = e.duration);
10592
+ var v = t("div", { class: "tokui-agent__body" });
10593
+ return r(e.children || []).forEach(function(e) {
10594
+ e && e.nodeType && v.appendChild(e);
10595
+ }), u.appendChild(v), u._slot = v, u._tokuiType = "agent", u._update = function(e) {
10596
+ e.status && (u.className = "tokui-agent tokui-agent--" + e.status, f.className = "tokui-agent__status-dot tokui-agent__status-dot--" + e.status, m.textContent = h(e.status)), e.action && _ && (_.textContent = e.action), e.duration && g && (g.textContent = e.duration);
10421
10597
  }, u;
10422
10598
  }), e.register("file-tree", (e, n) => {
10423
10599
  var r = t("div", {
@@ -10427,32 +10603,36 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10427
10603
  return n(e.children || []).forEach(function(e) {
10428
10604
  e && e.nodeType && r.appendChild(e);
10429
10605
  }), r._slot = r, r._tokuiType = "file-tree", r;
10430
- }), e.register("ft-folder", (e, n) => {
10431
- var r = e.attrs || {}, i = r.name || "folder", a = r.open !== void 0, o = t("div", { class: "tokui-file-tree__folder" + (a ? " tokui-file-tree__folder--open" : "") }), s = t("div", {
10606
+ }), e.register("ft-folder", (n, r) => {
10607
+ var i = n.attrs || {}, a = i.name || "folder", o = i.open !== void 0, s = t("div", { class: "tokui-file-tree__folder" + (o ? " tokui-file-tree__folder--open" : "") }), c = t("div", {
10432
10608
  class: "tokui-file-tree__folder-name",
10433
10609
  role: "treeitem",
10434
10610
  tabindex: "0",
10435
- "aria-expanded": String(a)
10436
- }), c = t("span", { class: "tokui-file-tree__folder-toggle" });
10437
- c.textContent = a ? "▾" : "▸", s.appendChild(c);
10438
- var l = t("span", { class: "tokui-file-tree__folder-icon" });
10439
- l.textContent = "📁", s.appendChild(l);
10440
- var u = t("span", { class: "tokui-file-tree__name" });
10441
- u.textContent = i, s.appendChild(u), o.appendChild(s);
10442
- var d = t("div", {
10611
+ "aria-expanded": String(o)
10612
+ }), l = t("span", { class: "tokui-file-tree__folder-toggle" });
10613
+ l.textContent = o ? "▾" : "▸", c.appendChild(l);
10614
+ var u = t("span", { class: "tokui-file-tree__folder-icon" });
10615
+ u.textContent = "📁", c.appendChild(u);
10616
+ var d = t("span", { class: "tokui-file-tree__name" });
10617
+ d.textContent = a, c.appendChild(d), s.appendChild(c);
10618
+ var f = t("div", {
10443
10619
  class: "tokui-file-tree__folder-children",
10444
10620
  role: "group"
10445
10621
  });
10446
- a || (d.style.display = "none"), n(e.children || []).forEach(function(e) {
10447
- e && e.nodeType && d.appendChild(e);
10448
- }), o.appendChild(d);
10449
- function f() {
10450
- var e = o.classList.toggle("tokui-file-tree__folder--open");
10451
- c.textContent = e ? "▾" : "▸", d.style.display = e ? "" : "none", s.setAttribute("aria-expanded", String(e));
10622
+ o || (f.style.display = "none"), r(n.children || []).forEach(function(e) {
10623
+ e && e.nodeType && f.appendChild(e);
10624
+ }), s.appendChild(f);
10625
+ var p = e.createReporter("ft-folder", i, s);
10626
+ function m() {
10627
+ var e = s.classList.toggle("tokui-file-tree__folder--open");
10628
+ l.textContent = e ? "▾" : "▸", f.style.display = e ? "" : "none", c.setAttribute("aria-expanded", String(e)), p("toggle", {
10629
+ name: a,
10630
+ open: e
10631
+ });
10452
10632
  }
10453
- return s.addEventListener("click", f), s.addEventListener("keydown", function(e) {
10454
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), f());
10455
- }), o._slot = d, o._tokuiType = "ft-folder", o;
10633
+ return c.addEventListener("click", m), c.addEventListener("keydown", function(e) {
10634
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m());
10635
+ }), s._slot = f, s._tokuiType = "ft-folder", s;
10456
10636
  }), e.register("ft-file", (e) => {
10457
10637
  var n = e.attrs || {}, r = n.name || "file", i = n.badge || "", a = t("div", {
10458
10638
  class: "tokui-file-tree__file",
@@ -10465,32 +10645,34 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10465
10645
  c.textContent = i, a.appendChild(c);
10466
10646
  }
10467
10647
  return a;
10468
- }), e.register("terminal", (e, r) => {
10469
- var i = e.attrs || {}, a = i.title || "Terminal", o = i.status || "", s = t("div", { class: "tokui-terminal" + (o && o !== "0" ? " tokui-terminal--error" : "") }), c = t("div", { class: "tokui-terminal__titlebar" }), l = t("span", { class: "tokui-terminal__dots" });
10648
+ }), e.register("terminal", (r, i) => {
10649
+ var a = r.attrs || {}, o = a.title || n("terminal.title"), s = a.status || "", c = { class: "tokui-terminal" + (s && s !== "0" ? " tokui-terminal--error" : "") };
10650
+ a.id && (c.id = a.id);
10651
+ var l = t("div", c), u = t("div", { class: "tokui-terminal__titlebar" }), d = t("span", { class: "tokui-terminal__dots" });
10470
10652
  [
10471
10653
  "🔴",
10472
10654
  "🟡",
10473
10655
  "🟢"
10474
10656
  ].forEach(function(e) {
10475
10657
  var n = t("span", { class: "tokui-terminal__dot" });
10476
- n.textContent = e, l.appendChild(n);
10477
- }), c.appendChild(l);
10478
- var u = t("span", { class: "tokui-terminal__title" });
10479
- u.textContent = a, c.appendChild(u), s.appendChild(c);
10480
- var d = t("div", { class: "tokui-terminal__content" });
10481
- e.content && (d.textContent = e.content), r(e.children || []).forEach(function(e) {
10482
- e && e.nodeType && d.appendChild(e);
10483
- }), s.appendChild(d);
10484
- var f = t("button", {
10658
+ n.textContent = e, d.appendChild(n);
10659
+ }), u.appendChild(d);
10660
+ var f = t("span", { class: "tokui-terminal__title" });
10661
+ f.textContent = o, u.appendChild(f), l.appendChild(u);
10662
+ var p = t("div", { class: "tokui-terminal__content" });
10663
+ r.content && (p.textContent = r.content), i(r.children || []).forEach(function(e) {
10664
+ e && e.nodeType && p.appendChild(e);
10665
+ }), l.appendChild(p);
10666
+ var m = e.createReporter("terminal", a, l), h = t("button", {
10485
10667
  class: "tokui-terminal__copy",
10486
10668
  type: "button"
10487
10669
  });
10488
- return f.textContent = n("actions.copy"), f.addEventListener("click", function() {
10489
- var e = d.textContent || "";
10490
- typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), f.textContent = n("common.copied"), f.classList.add("tokui-terminal__copy--done"), setTimeout(function() {
10491
- f.textContent = n("actions.copy"), f.classList.remove("tokui-terminal__copy--done");
10670
+ return h.textContent = n("actions.copy"), h.addEventListener("click", function() {
10671
+ var e = p.textContent || "";
10672
+ typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), h.textContent = n("common.copied"), h.classList.add("tokui-terminal__copy--done"), m("copy", {}), setTimeout(function() {
10673
+ h.textContent = n("actions.copy"), h.classList.remove("tokui-terminal__copy--done");
10492
10674
  }, 2e3);
10493
- }), c.appendChild(f), s._slot = d, s._tokuiType = "terminal", s;
10675
+ }), u.appendChild(h), l._slot = p, l._tokuiType = "terminal", l;
10494
10676
  }), e.register("shimmer", (e) => {
10495
10677
  var n = e.attrs || {}, r = n.t || "text", i = parseInt(n.rows) || 3, a = t("div", { class: "tokui-shimmer tokui-shimmer--" + r });
10496
10678
  if (r === "card") {
@@ -10554,57 +10736,59 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10554
10736
  preload: "metadata"
10555
10737
  });
10556
10738
  return r && d.setAttribute("src", r), d.setAttribute("controls", ""), o.appendChild(d), o;
10557
- }), e.register("quote", (e, n) => {
10558
- var r = e.attrs || {}, i = t("div", { class: "tokui-quote" }), a = t("div", { class: "tokui-quote__bar" });
10559
- i.appendChild(a);
10560
- var o = t("div", { class: "tokui-quote__content" });
10561
- if (r.role) {
10562
- var s = t("span", { class: "tokui-quote__role" });
10563
- s.textContent = r.role === "user" ? "User" : "AI", o.appendChild(s);
10564
- }
10565
- if (r.tx) {
10566
- var c = t("div", { class: "tokui-quote__text" });
10567
- c.textContent = r.tx, o.appendChild(c);
10568
- }
10569
- return r.msgid && i.setAttribute("data-msgid", r.msgid), n(e.children || []).forEach(function(e) {
10570
- e && e.nodeType && o.appendChild(e);
10571
- }), i.appendChild(o), i._slot = o, i._tokuiType = "quote", i;
10572
- }), e.register("sandbox", (e, n) => {
10573
- var r = e.attrs || {}, i = r.lang || "", a = r.title || "Preview", o = r.height || "200", s = t("div", { class: "tokui-sandbox" }), c = t("div", { class: "tokui-sandbox__header" }), l = t("span", { class: "tokui-sandbox__title" });
10574
- if (l.textContent = a, c.appendChild(l), i) {
10575
- var u = t("span", { class: "tokui-sandbox__lang" });
10576
- u.textContent = i, c.appendChild(u);
10739
+ }), e.register("quote", (e, r) => {
10740
+ var i = e.attrs || {}, a = t("div", { class: "tokui-quote" }), o = t("div", { class: "tokui-quote__bar" });
10741
+ a.appendChild(o);
10742
+ var s = t("div", { class: "tokui-quote__content" });
10743
+ if (i.role) {
10744
+ var c = t("span", { class: "tokui-quote__role" });
10745
+ c.textContent = i.role === "user" ? n("bubble.you") : n("bubble.ai"), s.appendChild(c);
10577
10746
  }
10578
- s.appendChild(c);
10579
- var d = t("div", { class: "tokui-sandbox__preview" });
10580
- d.style.height = o + "px";
10581
- var f = e.content || "";
10582
- if (!f && e.children && (f = e.children.filter(function(e) {
10747
+ if (i.tx) {
10748
+ var l = t("div", { class: "tokui-quote__text" });
10749
+ l.textContent = i.tx, s.appendChild(l);
10750
+ }
10751
+ return i.msgid && a.setAttribute("data-msgid", i.msgid), r(e.children || []).forEach(function(e) {
10752
+ e && e.nodeType && s.appendChild(e);
10753
+ }), a.appendChild(s), a._slot = s, a._tokuiType = "quote", a;
10754
+ }), e.register("sandbox", (e, r) => {
10755
+ var i = e.attrs || {}, a = i.lang || "", o = i.title || n("sandbox.title"), s = i.height || "200", c = t("div", { class: "tokui-sandbox" }), l = t("div", { class: "tokui-sandbox__header" }), u = t("span", { class: "tokui-sandbox__title" });
10756
+ if (u.textContent = o, l.appendChild(u), a) {
10757
+ var d = t("span", { class: "tokui-sandbox__lang" });
10758
+ d.textContent = a, l.appendChild(d);
10759
+ }
10760
+ c.appendChild(l);
10761
+ var f = t("div", { class: "tokui-sandbox__preview" });
10762
+ f.style.height = s + "px";
10763
+ var p = e.content || "";
10764
+ if (!p && e.children && (p = e.children.filter(function(e) {
10583
10765
  return e.type === "_text" && e.content;
10584
10766
  }).map(function(e) {
10585
10767
  return e.content;
10586
- }).join("")), i === "html") {
10587
- var p = t("iframe", {
10768
+ }).join("")), a === "html") {
10769
+ var m = t("iframe", {
10588
10770
  class: "tokui-sandbox__iframe",
10589
10771
  sandbox: "allow-scripts",
10590
10772
  frameborder: "0",
10591
10773
  title: e.attrs && (e.attrs.tt || e.attrs.title) || "sandbox"
10592
10774
  });
10593
- f && p.setAttribute("srcdoc", f), d.appendChild(p), s._slot = { appendChild: function(e) {
10594
- var t = e.nodeType === 3 ? e.nodeValue : e.textContent || "";
10595
- if (!t) return e;
10596
- var n = p.getAttribute("srcdoc") || "";
10597
- return p.setAttribute("srcdoc", n + t), e;
10598
- } };
10775
+ p && m.setAttribute("srcdoc", p), f.appendChild(m);
10776
+ var h = "";
10777
+ c._slot = { appendChild: function(e) {
10778
+ var t = e.nodeType === 3 ? e.nodeValue || e.textContent || "" : e.textContent || "";
10779
+ return t && (h += t), e;
10780
+ } }, c._streamCloseHook = function() {
10781
+ h && m.setAttribute("srcdoc", h);
10782
+ };
10599
10783
  } else {
10600
- var m = t("pre", { class: "tokui-sandbox__code" });
10601
- f && (m.textContent = f), n((e.children || []).filter(function(e) {
10784
+ var g = t("pre", { class: "tokui-sandbox__code" }), _ = t("code", {});
10785
+ p && (_.textContent = p), g.appendChild(_), g.__code = _, r((e.children || []).filter(function(e) {
10602
10786
  return e.type !== "_text";
10603
10787
  })).forEach(function(e) {
10604
- e && e.nodeType && m.appendChild(e);
10605
- }), d.appendChild(m), s._slot = d;
10788
+ e && e.nodeType && g.appendChild(e);
10789
+ }), f.appendChild(g), c._slot = _;
10606
10790
  }
10607
- return s.appendChild(d), s._tokuiType = "sandbox", s;
10791
+ return c.appendChild(f), c._tokuiType = "sandbox", c;
10608
10792
  }), e.register("commit", (e) => {
10609
10793
  var n = e.attrs || {}, r = t("div", { class: "tokui-commit" }), i = n.hash || "", a = n.msg || "", o = n.author || "", s = n.branch || "", c = n.time || "", l = n.additions || "", u = n.deletions || "", d = t("div", { class: "tokui-commit__row" });
10610
10794
  if (i) {
@@ -10642,8 +10826,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10642
10826
  r.appendChild(v);
10643
10827
  }
10644
10828
  return r;
10645
- }), e.register("test-result", (e, n) => {
10646
- var r = e.attrs || {}, i = t("div", { class: "tokui-test-result" }), a = t("div", { class: "tokui-test-result__summary" });
10829
+ }), e.register("test-result", (e, r) => {
10830
+ var i = e.attrs || {}, a = t("div", { class: "tokui-test-result" }), o = t("div", { class: "tokui-test-result__summary" });
10647
10831
  if ([
10648
10832
  {
10649
10833
  key: "pass",
@@ -10661,25 +10845,25 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10661
10845
  icon: "○"
10662
10846
  }
10663
10847
  ].forEach(function(e) {
10664
- if (r[e.key]) {
10848
+ if (i[e.key]) {
10665
10849
  var n = t("span", { class: "tokui-test-result__count tokui-test-result__count" + e.cls });
10666
- n.textContent = e.icon + " " + r[e.key], a.appendChild(n);
10850
+ n.textContent = e.icon + " " + i[e.key], o.appendChild(n);
10667
10851
  }
10668
- }), r.total) {
10669
- var o = t("span", { class: "tokui-test-result__count tokui-test-result__count--total" });
10670
- o.textContent = "Total: " + r.total, a.appendChild(o);
10852
+ }), i.total) {
10853
+ var s = t("span", { class: "tokui-test-result__count tokui-test-result__count--total" });
10854
+ s.textContent = n("testResult.total", { n: i.total }), o.appendChild(s);
10671
10855
  }
10672
- if (r.duration) {
10673
- var s = t("span", { class: "tokui-test-result__duration" });
10674
- s.textContent = r.duration, a.appendChild(s);
10856
+ if (i.duration) {
10857
+ var c = t("span", { class: "tokui-test-result__duration" });
10858
+ c.textContent = i.duration, o.appendChild(c);
10675
10859
  }
10676
- i.appendChild(a);
10677
- var c = t("div", { class: "tokui-test-result__cases" });
10678
- return n(e.children || []).forEach(function(e) {
10679
- e && e.nodeType && c.appendChild(e);
10680
- }), i.appendChild(c), i._slot = c, i._tokuiType = "test-result", i;
10860
+ a.appendChild(o);
10861
+ var l = t("div", { class: "tokui-test-result__cases" });
10862
+ return r(e.children || []).forEach(function(e) {
10863
+ e && e.nodeType && l.appendChild(e);
10864
+ }), a.appendChild(l), a._slot = l, a._tokuiType = "test-result", a;
10681
10865
  });
10682
- function k(e) {
10866
+ function j(e) {
10683
10867
  var n = e.attrs || {}, r = n.status || "pass", i = t("div", {
10684
10868
  class: "tokui-test-case tokui-test-case--" + r,
10685
10869
  "data-tokui-tag": e.type
@@ -10700,38 +10884,38 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10700
10884
  }
10701
10885
  return i;
10702
10886
  }
10703
- e.register("test-case", (e) => k(e)), e.register("case", (e) => k(e)), e.register("conversations", (r, i) => {
10887
+ e.register("test-case", (e) => j(e)), e.register("case", (e) => j(e)), e.register("conversations", (r, i) => {
10704
10888
  var a = r.attrs || {}, o = a.clk || "", s = a.act || "", c = t("div", {
10705
10889
  class: "tokui-conversations",
10706
10890
  role: "list"
10707
10891
  }), l = e.createReporter("conversations", a, c), u = (r.children || []).filter(function(e) {
10708
10892
  return e.type === "conv";
10709
10893
  }), d = null;
10710
- if (u.length === 0) return d = t("div", { class: "tokui-conversations__empty" }), d.textContent = n("chat.emptySessions"), c.appendChild(d), c._slot = c, c._tokuiType = "conversations", c._convHandlerName = o, c._convActiveAct = s, c._renderConvChild = function(e) {
10711
- return M(e, o, s, c, l);
10894
+ if (u.length === 0) return d = t("div", { class: "tokui-conversations__empty" }), d.textContent = n("chat.emptySessions"), c.appendChild(d), c._slot = c, c._tokuiType = "conversations", c._convHandlerName = o, c._convActiveAct = s, c._renderConvChild = function(t) {
10895
+ return P(t, o, s, c, l, e.eventBus);
10712
10896
  }, c._streamCloseHook = function() {
10713
10897
  c.querySelector(".tokui-conv") && d && d.parentNode && d.parentNode.removeChild(d);
10714
10898
  }, c;
10715
- var f = j(u);
10716
- return f.forEach(function(e) {
10899
+ var f = N(u);
10900
+ return f.forEach(function(n) {
10717
10901
  if (f.length > 1) {
10718
- var n = t("div", { class: "tokui-conversations__group-header" });
10719
- n.textContent = e.label, c.appendChild(n);
10902
+ var r = t("div", { class: "tokui-conversations__group-header" });
10903
+ r.textContent = n.label, c.appendChild(r);
10720
10904
  }
10721
- e.items.forEach(function(e) {
10722
- var t = M(e, o, s, c, l);
10723
- c.appendChild(t);
10905
+ n.items.forEach(function(t) {
10906
+ var n = P(t, o, s, c, l, e.eventBus);
10907
+ c.appendChild(n);
10724
10908
  });
10725
10909
  }), c._slot = c, c._tokuiType = "conversations", c;
10726
- }), e.register("conv", (e) => M(e, "", "", null, null));
10727
- function A(e) {
10910
+ }), e.register("conv", (t) => P(t, "", "", null, null, e.eventBus));
10911
+ function M(e) {
10728
10912
  return /^\d{1,2}:\d{2}$/.test(e);
10729
10913
  }
10730
- function j(e) {
10914
+ function N(e) {
10731
10915
  var t = [], r = [], i = [];
10732
10916
  e.forEach(function(e) {
10733
- var n = e.attrs && e.attrs.time || "";
10734
- A(n) ? t.push(e) : n === "昨天" ? r.push(e) : i.push(e);
10917
+ var a = e.attrs && e.attrs.time || "";
10918
+ M(a) ? t.push(e) : a === n("time.yesterday") ? r.push(e) : i.push(e);
10735
10919
  });
10736
10920
  var a = [];
10737
10921
  return t.length && a.push({
@@ -10748,47 +10932,41 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10748
10932
  items: e
10749
10933
  }];
10750
10934
  }
10751
- function M(e, r, i, a, o) {
10752
- var s = e.attrs || {}, c = s.tt || "", l = s.time || "", u = s.id || c, d = s.active === !0 || s.active === "true";
10753
- !d && i && s.act && s.act === i && (d = !0);
10754
- var f = ["tokui-conv"];
10755
- d && f.push("tokui-conv--active");
10756
- var p = t("div", {
10757
- class: f.join(" "),
10935
+ function P(e, r, i, a, o, s) {
10936
+ var c = e.attrs || {}, l = c.tt || "", u = c.time || "", d = c.id || l, f = c.active === !0 || c.active === "true";
10937
+ !f && i && c.act && c.act === i && (f = !0);
10938
+ var p = ["tokui-conv"];
10939
+ f && p.push("tokui-conv--active");
10940
+ var m = t("div", {
10941
+ class: p.join(" "),
10758
10942
  role: "listitem",
10759
10943
  tabindex: "0",
10760
10944
  "data-tokui-tag": "conv"
10761
10945
  });
10762
- d && p.setAttribute("aria-current", "true");
10763
- var m = t("div", { class: "tokui-conv__title" });
10764
- if (m.textContent = c, p.appendChild(m), l) {
10765
- var h = t("span", { class: "tokui-conv__time" });
10766
- h.textContent = l, p.appendChild(h);
10946
+ f && m.setAttribute("aria-current", "true");
10947
+ var h = t("div", { class: "tokui-conv__title" });
10948
+ if (h.textContent = l, m.appendChild(h), u) {
10949
+ var g = t("span", { class: "tokui-conv__time" });
10950
+ g.textContent = u, m.appendChild(g);
10767
10951
  }
10768
- var g = t("div", { class: "tokui-conv__actions" }), _ = t("button", {
10952
+ var _ = t("div", { class: "tokui-conv__actions" }), v = t("button", {
10769
10953
  class: "tokui-conv__delete",
10770
10954
  type: "button",
10771
10955
  "aria-label": n("common.delete")
10772
10956
  });
10773
- return _.textContent = "×", g.appendChild(_), p.appendChild(g), p.addEventListener("click", function(e) {
10774
- if (!(e.target.closest && e.target.closest(".tokui-conv__delete"))) {
10775
- if ((a ? a.querySelectorAll(".tokui-conv") : [p]).forEach(function(e) {
10776
- e.classList.remove("tokui-conv--active"), e.removeAttribute("aria-current");
10777
- }), p.classList.add("tokui-conv--active"), p.setAttribute("aria-current", "true"), r) {
10778
- var t = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
10779
- t && typeof t.emit == "function" && t.emit(r, {
10780
- tt: c,
10781
- time: l,
10782
- act: s.act || ""
10783
- });
10784
- }
10785
- o && o("change", { value: u });
10786
- }
10787
- }), p.addEventListener("keydown", function(e) {
10788
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), p.click());
10789
- }), _.addEventListener("click", function(e) {
10790
- e.stopPropagation(), p.parentNode && p.parentNode.removeChild(p), o && o("delete", { value: u });
10791
- }), p;
10957
+ return v.textContent = "×", _.appendChild(v), m.appendChild(_), m.addEventListener("click", function(e) {
10958
+ e.target.closest && e.target.closest(".tokui-conv__delete") || ((a ? a.querySelectorAll(".tokui-conv") : [m]).forEach(function(e) {
10959
+ e.classList.remove("tokui-conv--active"), e.removeAttribute("aria-current");
10960
+ }), m.classList.add("tokui-conv--active"), m.setAttribute("aria-current", "true"), r && s && typeof s.emit == "function" && s.emit(r, {
10961
+ tt: l,
10962
+ time: u,
10963
+ act: c.act || ""
10964
+ }), o && o("change", { value: d }));
10965
+ }), m.addEventListener("keydown", function(e) {
10966
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), m.click());
10967
+ }), v.addEventListener("click", function(e) {
10968
+ e.stopPropagation(), m.parentNode && m.parentNode.removeChild(m), o && o("delete", { value: d });
10969
+ }), m;
10792
10970
  }
10793
10971
  e.register("welcome", (e, n) => {
10794
10972
  var r = e.attrs || {}, i = r.tt || "", a = r.st || "", o = r.bd ? String(r.bd).split(",") : [], s = r.hd || "", c = r.ft || "", l = t("div", { class: "tokui-welcome" });
@@ -10827,8 +11005,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10827
11005
  }
10828
11006
  return l._slot = h, l._tokuiType = "welcome", l;
10829
11007
  });
10830
- function N(e) {
10831
- var n = e.attrs || {}, r = n.tt || "", i = n.tx || "", a = n.i || "code", o = n.clk || "", s = {
11008
+ function F(n) {
11009
+ var r = n.attrs || {}, i = r.tt || "", a = r.tx || "", o = r.i || "code", s = r.clk || "", c = {
10832
11010
  code: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><polyline points=\"16 18 22 12 16 6\"/><polyline points=\"8 6 2 12 8 18\"/></svg>",
10833
11011
  chart: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><line x1=\"18\" y1=\"20\" x2=\"18\" y2=\"10\"/><line x1=\"12\" y1=\"20\" x2=\"12\" y2=\"4\"/><line x1=\"6\" y1=\"20\" x2=\"6\" y2=\"14\"/></svg>",
10834
11012
  doc: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z\"/><polyline points=\"14 2 14 8 20 8\"/><line x1=\"16\" y1=\"13\" x2=\"8\" y2=\"13\"/><line x1=\"16\" y1=\"17\" x2=\"8\" y2=\"17\"/></svg>",
@@ -10837,35 +11015,39 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10837
11015
  chat: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z\"/></svg>",
10838
11016
  table: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"16\" rx=\"1\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/><line x1=\"9\" y1=\"10\" x2=\"9\" y2=\"20\"/></svg>",
10839
11017
  form: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M9 11l3 3L22 4\"/><path d=\"M21 12v7a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11\"/></svg>"
10840
- }, c = {
10841
- class: ["tokui-welcome-feature", "tokui-welcome-feature--" + a].join(" "),
11018
+ }, l = {
11019
+ class: ["tokui-welcome-feature", "tokui-welcome-feature--" + o].join(" "),
10842
11020
  role: "button",
10843
11021
  tabindex: "0",
10844
- "data-tokui-tag": e.type
11022
+ "data-tokui-tag": n.type
10845
11023
  };
10846
- o && (c["data-tokui-clk"] = o), Object.keys(n).forEach(function(e) {
10847
- e.indexOf("data-") === 0 && (c[e] = n[e]);
11024
+ s && (l["data-tokui-clk"] = s), Object.keys(r).forEach(function(e) {
11025
+ e.indexOf("data-") === 0 && (l[e] = r[e]);
10848
11026
  });
10849
- var l = t("div", c), u = t("div", { class: "tokui-welcome-feature__icon" });
10850
- u.innerHTML = s[a] || s.code, l.appendChild(u);
10851
- var d = t("div", { class: "tokui-welcome-feature__body" });
10852
- if (r) {
10853
- var f = t("div", { class: "tokui-welcome-feature__title" });
10854
- f.textContent = r, d.appendChild(f);
10855
- }
11027
+ var u = t("div", l), d = t("div", { class: "tokui-welcome-feature__icon" });
11028
+ d.innerHTML = c[o] || c.code, u.appendChild(d);
11029
+ var f = t("div", { class: "tokui-welcome-feature__body" });
10856
11030
  if (i) {
10857
- var p = t("div", { class: "tokui-welcome-feature__desc" });
10858
- p.textContent = i, d.appendChild(p);
11031
+ var p = t("div", { class: "tokui-welcome-feature__title" });
11032
+ p.textContent = i, f.appendChild(p);
10859
11033
  }
10860
- return l.appendChild(d), l._tokuiType = "welcome-feature", l;
11034
+ if (a) {
11035
+ var m = t("div", { class: "tokui-welcome-feature__desc" });
11036
+ m.textContent = a, f.appendChild(m);
11037
+ }
11038
+ u.appendChild(f);
11039
+ var h = e.createReporter("welcome-feature", r, u);
11040
+ return u.addEventListener("click", function() {
11041
+ h("select", { value: i || a });
11042
+ }), u._tokuiType = "welcome-feature", u;
10861
11043
  }
10862
- e.register("welcome-feature", (e) => N(e)), e.register("feature", (e) => N(e)), e.register("attachments", (e, n) => {
11044
+ e.register("welcome-feature", (e) => F(e)), e.register("feature", (e) => F(e)), e.register("attachments", (e, n) => {
10863
11045
  var r = (e.attrs || {}).clk || "", i = t("div", { class: "tokui-attachments" });
10864
11046
  return r && i.setAttribute("data-tokui-clk", r), n(e.children || []).forEach(function(e) {
10865
11047
  e && e.nodeType && i.appendChild(e);
10866
11048
  }), i._slot = i, i._tokuiType = "attachments", i;
10867
- }), e.register("attach", (e) => {
10868
- var r = e.attrs || {}, i = r.t || "default", a = r.s || n("file.unnamed"), o = r.u || "", s = r.size || "", l = r.clk || "", u = {
11049
+ }), e.register("attach", (r) => {
11050
+ var i = r.attrs || {}, a = i.t || "default", o = i.s || n("file.unnamed"), s = i.u || "", c = i.size || "", l = i.clk || "", u = {
10869
11051
  pdf: "#f5222d",
10870
11052
  code: "#1677ff",
10871
11053
  excel: "#52c41a",
@@ -10876,147 +11058,150 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
10876
11058
  audio: "#13c2c2",
10877
11059
  image: "#eb2f96",
10878
11060
  default: "#8c8c8c"
10879
- }, d = u[i] || u.default, f = t("div", { class: "tokui-attach tokui-attach--" + i });
10880
- if (l && f.setAttribute("data-tokui-clk", l), i === "image" && o) {
10881
- var p = t("img", {
11061
+ }, f = u[a] || u.default, p = t("div", { class: "tokui-attach tokui-attach--" + a });
11062
+ if (l && p.setAttribute("data-tokui-clk", l), a === "image" && s) {
11063
+ var m = t("img", {
10882
11064
  class: "tokui-attach__thumb",
10883
- src: o,
10884
- alt: a
11065
+ src: s,
11066
+ alt: o
10885
11067
  });
10886
- f.appendChild(p);
11068
+ p.appendChild(m);
10887
11069
  } else {
10888
- var m = t("div", { class: "tokui-attach__icon" });
10889
- m.innerHTML = c(i, d), f.appendChild(m);
10890
- }
10891
- var h = t("div", { class: "tokui-attach__info" }), g = t("div", { class: "tokui-attach__name" });
10892
- if (g.textContent = a, o && (g.style.cursor = "pointer", g.setAttribute("tabindex", "0"), g.setAttribute("role", "link"), g.addEventListener("click", function() {
10893
- typeof window < "u" && window.open(o, "_blank");
10894
- }), g.addEventListener("keydown", function(e) {
10895
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), typeof window < "u" && window.open(o, "_blank"));
10896
- })), h.appendChild(g), s) {
10897
- var _ = t("div", { class: "tokui-attach__size" });
10898
- _.textContent = s, h.appendChild(_);
10899
- }
10900
- f.appendChild(h);
10901
- var v = t("div", { class: "tokui-attach__actions" });
10902
- if (o) {
10903
- var y = t("a", {
11070
+ var h = t("div", { class: "tokui-attach__icon" });
11071
+ h.innerHTML = d(a, f), p.appendChild(h);
11072
+ }
11073
+ var g = t("div", { class: "tokui-attach__info" }), _ = t("div", { class: "tokui-attach__name" });
11074
+ if (_.textContent = o, s && (_.style.cursor = "pointer", _.setAttribute("tabindex", "0"), _.setAttribute("role", "link"), _.addEventListener("click", function() {
11075
+ typeof window < "u" && window.open(s, "_blank");
11076
+ }), _.addEventListener("keydown", function(e) {
11077
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), typeof window < "u" && window.open(s, "_blank"));
11078
+ })), g.appendChild(_), c) {
11079
+ var v = t("div", { class: "tokui-attach__size" });
11080
+ v.textContent = c, g.appendChild(v);
11081
+ }
11082
+ p.appendChild(g);
11083
+ var y = t("div", { class: "tokui-attach__actions" }), b = e.createReporter("attach", i, p);
11084
+ if (s) {
11085
+ var x = t("a", {
10904
11086
  class: "tokui-attach__action",
10905
- href: o,
11087
+ href: s,
10906
11088
  target: "_blank",
10907
11089
  rel: "noopener noreferrer",
10908
11090
  download: ""
10909
11091
  });
10910
- y.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 2v9M4.5 7.5L8 11l3.5-3.5M2 13h12\"/></svg>", y.title = n("common.download"), v.appendChild(y);
11092
+ x.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M8 2v9M4.5 7.5L8 11l3.5-3.5M2 13h12\"/></svg>", x.title = n("common.download"), y.appendChild(x);
10911
11093
  }
10912
- var b = t("button", {
11094
+ var S = t("button", {
10913
11095
  class: "tokui-attach__action tokui-attach__action--del",
10914
11096
  type: "button"
10915
11097
  });
10916
- return b.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4l8 8M12 4l-8 8\"/></svg>", b.title = n("common.delete"), b.addEventListener("click", function(e) {
10917
- if (e.stopPropagation(), l) {
10918
- var t = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
10919
- t && typeof t.emit == "function" && t.emit(l, {
10920
- name: a,
10921
- url: o,
10922
- type: i
10923
- });
10924
- }
10925
- f.parentNode && f.parentNode.removeChild(f);
10926
- }), v.appendChild(b), f.appendChild(v), f._tokuiType = "attach", f;
10927
- }), e.register("artifact", (r, o) => {
11098
+ return S.innerHTML = "<svg viewBox=\"0 0 16 16\" width=\"14\" height=\"14\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><path d=\"M4 4l8 8M12 4l-8 8\"/></svg>", S.title = n("common.delete"), S.addEventListener("click", function(t) {
11099
+ t.stopPropagation(), l && e.eventBus && typeof e.eventBus.emit == "function" && e.eventBus.emit(l, {
11100
+ name: o,
11101
+ url: s,
11102
+ type: a
11103
+ }), b("delete", {
11104
+ name: o,
11105
+ url: s,
11106
+ type: a
11107
+ }), p.parentNode && p.parentNode.removeChild(p);
11108
+ }), y.appendChild(S), p.appendChild(y), p._tokuiType = "attach", p;
11109
+ }), e.register("artifact", (r, i) => {
10928
11110
  var s = r.attrs || {}, c = s.tt || "Artifact", l = s.lang || "text";
10929
11111
  s.pos, s.w;
10930
- var u = t("div", { class: "tokui-artifact" }), d = t("div", { class: "tokui-artifact__header" }), f = t("span", { class: "tokui-artifact__title" });
10931
- f.textContent = c, d.appendChild(f);
10932
- var p = t("div", {
11112
+ var u = { class: "tokui-artifact" };
11113
+ s.id && (u.id = s.id);
11114
+ var d = t("div", u), f = t("div", { class: "tokui-artifact__header" }), p = t("span", { class: "tokui-artifact__title" });
11115
+ p.textContent = c, f.appendChild(p);
11116
+ var m = t("div", {
10933
11117
  class: "tokui-artifact__tabs",
10934
11118
  role: "tablist"
10935
- }), m = t("button", {
11119
+ }), h = t("button", {
10936
11120
  class: "tokui-artifact__tab tokui-artifact__tab--code tokui-artifact__tab--active",
10937
11121
  type: "button",
10938
11122
  role: "tab",
10939
11123
  "aria-selected": "true"
10940
11124
  });
10941
- m.textContent = "Code", p.appendChild(m);
10942
- var h = t("button", {
11125
+ h.textContent = n("artifact.codeTab"), m.appendChild(h);
11126
+ var g = t("button", {
10943
11127
  class: "tokui-artifact__tab tokui-artifact__tab--preview",
10944
11128
  type: "button",
10945
11129
  role: "tab",
10946
11130
  "aria-selected": "false"
10947
11131
  });
10948
- h.textContent = "Preview", p.appendChild(h), d.appendChild(p);
10949
- var g = t("button", {
11132
+ g.textContent = n("artifact.previewTab"), m.appendChild(g), f.appendChild(m);
11133
+ var _ = t("button", {
10950
11134
  class: "tokui-artifact__close",
10951
11135
  type: "button",
10952
11136
  "aria-label": n("common.close")
10953
11137
  });
10954
- g.innerHTML = "&times;", d.appendChild(g), u.appendChild(d);
10955
- var _ = t("div", { class: "tokui-artifact__code" }), v = "", y = (r.children || []).filter(function(e) {
11138
+ _.innerHTML = "&times;", f.appendChild(_), d.appendChild(f);
11139
+ var v = t("div", { class: "tokui-artifact__code" }), y = "", b = (r.children || []).filter(function(e) {
10956
11140
  return e.type === "artifact-code";
10957
11141
  });
10958
- y.length > 0 && (v = (y[0].children || []).map(function(e) {
11142
+ b.length > 0 && (y = (b[0].children || []).map(function(e) {
10959
11143
  return e.content || "";
10960
11144
  }).join(""));
10961
- var b = t("pre", { class: "tokui-code" }), x = t("code", { class: "language-" + l });
10962
- l !== "text" && i[l] ? x.innerHTML = w(a(v, l)) : x.innerHTML = w(C(v)), b.appendChild(x), _.appendChild(b);
10963
- var S = t("button", {
11145
+ var x = t("pre", { class: "tokui-code" }), S = t("code", { class: "language-" + l });
11146
+ l !== "text" && a[l] ? S.innerHTML = E(o(y, l)) : S.innerHTML = E(T(y)), x.appendChild(S), v.appendChild(x);
11147
+ var C = y, w = e.createReporter("artifact", s, d), D = t("button", {
10964
11148
  class: "tokui-artifact__code-copy",
10965
11149
  type: "button"
10966
11150
  });
10967
- S.textContent = n("common.copy"), S.addEventListener("click", function() {
10968
- var e = x.textContent || "";
10969
- typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(e), S.textContent = n("common.copied"), S.classList.add("tokui-artifact__code-copy--done"), setTimeout(function() {
10970
- S.textContent = n("common.copy"), S.classList.remove("tokui-artifact__code-copy--done");
11151
+ D.textContent = n("common.copy"), D.addEventListener("click", function() {
11152
+ typeof navigator < "u" && navigator.clipboard && navigator.clipboard.writeText(C), w("copy", {}), D.textContent = n("common.copied"), D.classList.add("tokui-artifact__code-copy--done"), setTimeout(function() {
11153
+ D.textContent = n("common.copy"), D.classList.remove("tokui-artifact__code-copy--done");
10971
11154
  }, 2e3);
10972
- }), _.appendChild(S), u.appendChild(_);
10973
- var T = t("div", { class: "tokui-artifact__preview" });
10974
- T.style.display = "none";
10975
- var E = t("iframe", {
11155
+ }), v.appendChild(D), d.appendChild(v);
11156
+ var O = t("div", { class: "tokui-artifact__preview" });
11157
+ O.style.display = "none";
11158
+ var k = t("iframe", {
10976
11159
  class: "tokui-artifact__iframe",
10977
11160
  sandbox: "allow-scripts",
10978
11161
  frameborder: "0",
10979
11162
  title: c || "artifact"
10980
- }), D = "";
10981
- D = l === "html" ? v : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + v.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", E.setAttribute("srcdoc", D), T.appendChild(E), u.appendChild(T);
10982
- var O = t("div", { class: "tokui-artifact__resize" });
10983
- u.appendChild(O), m.addEventListener("click", function() {
10984
- _.style.display = "", T.style.display = "none", m.classList.add("tokui-artifact__tab--active"), h.classList.remove("tokui-artifact__tab--active"), m.setAttribute("aria-selected", "true"), h.setAttribute("aria-selected", "false");
10985
- }), h.addEventListener("click", function() {
10986
- _.style.display = "none", T.style.display = "", h.classList.add("tokui-artifact__tab--active"), m.classList.remove("tokui-artifact__tab--active"), h.setAttribute("aria-selected", "true"), m.setAttribute("aria-selected", "false");
10987
- });
10988
- var k = e.createReporter("artifact", s, u);
10989
- g.addEventListener("click", function() {
10990
- if (k("close", {}), typeof CustomEvent == "function" && typeof u.dispatchEvent == "function") {
11163
+ }), A = "";
11164
+ A = l === "html" ? y : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + y.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", k.setAttribute("srcdoc", A), O.appendChild(k), d.appendChild(O);
11165
+ var j = t("div", { class: "tokui-artifact__resize" });
11166
+ d.appendChild(j), h.addEventListener("click", function() {
11167
+ v.style.display = "", O.style.display = "none", h.classList.add("tokui-artifact__tab--active"), g.classList.remove("tokui-artifact__tab--active"), h.setAttribute("aria-selected", "true"), g.setAttribute("aria-selected", "false");
11168
+ }), g.addEventListener("click", function() {
11169
+ v.style.display = "none", O.style.display = "", g.classList.add("tokui-artifact__tab--active"), h.classList.remove("tokui-artifact__tab--active"), g.setAttribute("aria-selected", "true"), h.setAttribute("aria-selected", "false");
11170
+ }), _.addEventListener("click", function() {
11171
+ if (w("close", {}), typeof CustomEvent == "function" && typeof d.dispatchEvent == "function") {
10991
11172
  var e = new CustomEvent("tokui-artifact-close", {
10992
11173
  bubbles: !0,
10993
- detail: { artifact: u }
11174
+ detail: { artifact: d }
10994
11175
  });
10995
- u.dispatchEvent(e);
11176
+ d.dispatchEvent(e);
10996
11177
  }
10997
- u.style.display = "none";
11178
+ d.style.display = "none";
10998
11179
  });
10999
- var A = !1;
11000
- O.addEventListener("mousedown", function(e) {
11001
- A = !0, e.preventDefault(), document.addEventListener("mousemove", j), document.addEventListener("mouseup", M);
11180
+ var M = !1;
11181
+ j.addEventListener("mousedown", function(e) {
11182
+ M = !0, e.preventDefault(), document.addEventListener("mousemove", N), document.addEventListener("mouseup", P);
11002
11183
  });
11003
- function j(e) {
11004
- if (A) {
11005
- var t = u.getBoundingClientRect();
11184
+ function N(e) {
11185
+ if (M) {
11186
+ var t = d.getBoundingClientRect();
11006
11187
  if (t) {
11007
11188
  var n = t.bottom - e.clientY;
11008
- n = Math.max(120, n), u.style.height = n + "px";
11189
+ n = Math.max(120, n), d.style.height = n + "px";
11009
11190
  }
11010
11191
  }
11011
11192
  }
11012
- function M() {
11013
- A = !1, document.removeEventListener("mousemove", j), document.removeEventListener("mouseup", M);
11014
- }
11015
- return u._slot = x, u._tokuiType = "artifact", u._artifactCode = v, setTimeout(function() {
11016
- u.querySelectorAll(".tokui-artifact-preview-standalone").forEach(function(e) {
11193
+ function P() {
11194
+ M = !1, document.removeEventListener("mousemove", N), document.removeEventListener("mouseup", P);
11195
+ }
11196
+ return typeof document < "u" && e._registerCleanup(d, function() {
11197
+ P();
11198
+ }), d._slot = S, d._tokuiType = "artifact", d._artifactCode = y, d._streamAppendHook = function(e) {
11199
+ e && e.type === "_text" && e.content && (C += e.content);
11200
+ }, setTimeout(function() {
11201
+ d.querySelectorAll(".tokui-artifact-preview-standalone").forEach(function(e) {
11017
11202
  e.parentNode && e.parentNode.removeChild(e);
11018
11203
  });
11019
- }, 0), u._streamCloseHook = function() {
11204
+ }, 0), d._streamCloseHook = function() {
11020
11205
  var e = (r.children || []).find(function(e) {
11021
11206
  return e.type === "artifact-code";
11022
11207
  }), t;
@@ -11025,21 +11210,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11025
11210
  }).join("");
11026
11211
  else {
11027
11212
  t = "";
11028
- for (var n = u.querySelectorAll("pre"), o = 0; o < n.length; o++) if (n[o]._tokuiType === "artifact-code") {
11029
- var s = n[o].querySelector("code");
11213
+ for (var n = d.querySelectorAll("pre"), i = 0; i < n.length; i++) if (n[i]._tokuiType === "artifact-code") {
11214
+ var s = n[i].querySelector("code");
11030
11215
  if (s) {
11031
11216
  t = s.textContent || "";
11032
11217
  break;
11033
11218
  }
11034
11219
  }
11035
- t ||= u._artifactCode || "";
11220
+ t ||= C || d._artifactCode || "";
11036
11221
  }
11037
- l !== "text" && i[l] ? x.innerHTML = w(a(t, l)) : x.innerHTML = w(C(t)), u._artifactCode = t;
11222
+ l !== "text" && a[l] ? S.innerHTML = E(o(t, l)) : S.innerHTML = E(T(t)), d._artifactCode = t, C = t;
11038
11223
  var c = "";
11039
- c = l === "html" ? t : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", E.setAttribute("srcdoc", c);
11040
- var d = u.querySelector(".tokui-artifact-preview-standalone");
11041
- d && d.parentNode && d.parentNode.removeChild(d);
11042
- }, u;
11224
+ c = l === "html" ? t : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + t.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", k.setAttribute("srcdoc", c);
11225
+ var u = d.querySelector(".tokui-artifact-preview-standalone");
11226
+ u && u.parentNode && u.parentNode.removeChild(u);
11227
+ }, d;
11043
11228
  }), e.register("artifact-code", (e, n) => {
11044
11229
  var r = "";
11045
11230
  r = e.children && e.children.length > 0 ? e.children.map(function(e) {
@@ -11064,44 +11249,44 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11064
11249
  return e.children && e.children.length > 0 && (s = e.children.map(function(e) {
11065
11250
  return e.content || "";
11066
11251
  }).join("")), s && o.setAttribute("srcdoc", s), a.appendChild(o), a._tokuiType = "artifact-preview", a;
11067
- }), e.register("command", (e, r) => {
11068
- var i = e.attrs || {}, a = i.ph || n("command.placeholder"), o = t("div", { class: "tokui-command" });
11069
- i.id && (o.id = i.id), i.clk && o.setAttribute("data-tokui-cmd-clk", i.clk);
11070
- var s = t("div", { class: "tokui-command__overlay" });
11071
- o.appendChild(s);
11072
- var c = t("div", {
11252
+ }), e.register("command", (r, i) => {
11253
+ var a = r.attrs || {}, o = a.ph || n("command.placeholder"), s = t("div", { class: "tokui-command" });
11254
+ a.id && (s.id = a.id), a.clk && s.setAttribute("data-tokui-cmd-clk", a.clk);
11255
+ var c = e.createReporter("command", a, s), l = t("div", { class: "tokui-command__overlay" });
11256
+ s.appendChild(l);
11257
+ var u = t("div", {
11073
11258
  class: "tokui-command__panel",
11074
11259
  role: "dialog",
11075
11260
  "aria-modal": "true",
11076
11261
  "aria-label": n("command.aria")
11077
- }), l = t("div", { class: "tokui-command__input-wrap" }), u = t("span", {
11262
+ }), d = t("div", { class: "tokui-command__input-wrap" }), f = t("span", {
11078
11263
  class: "tokui-command__search-icon",
11079
11264
  "aria-hidden": "true"
11080
11265
  });
11081
- u.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"M21 21l-4.35-4.35\"/></svg>", l.appendChild(u);
11082
- var d = t("input", {
11266
+ f.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"18\" height=\"18\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><path d=\"M21 21l-4.35-4.35\"/></svg>", d.appendChild(f);
11267
+ var p = t("input", {
11083
11268
  class: "tokui-command__input",
11084
11269
  type: "text",
11085
- placeholder: a,
11270
+ placeholder: o,
11086
11271
  autocomplete: "off",
11087
11272
  autofocus: "true"
11088
11273
  });
11089
- l.appendChild(d), c.appendChild(l);
11090
- var f = t("div", {
11274
+ d.appendChild(p), u.appendChild(d);
11275
+ var m = t("div", {
11091
11276
  class: "tokui-command__list",
11092
11277
  role: "listbox"
11093
11278
  });
11094
- r(e.children || []).forEach(function(e) {
11095
- e && e.nodeType && f.appendChild(e);
11279
+ i(r.children || []).forEach(function(e) {
11280
+ e && e.nodeType && m.appendChild(e);
11096
11281
  });
11097
- var p = t("div", { class: "tokui-command__empty" });
11098
- p.textContent = n("command.noResult"), p.style.display = "none", f.appendChild(p), c.appendChild(f), o.appendChild(c);
11099
- var m = [], h = [];
11100
- function g() {
11101
- m = Array.from(f.querySelectorAll(".tokui-command__item")), h = Array.from(f.querySelectorAll(".tokui-command__group"));
11282
+ var h = t("div", { class: "tokui-command__empty" });
11283
+ h.textContent = n("command.noResult"), h.style.display = "none", m.appendChild(h), u.appendChild(m), s.appendChild(u);
11284
+ var g = [], _ = [];
11285
+ function v() {
11286
+ g = Array.from(m.querySelectorAll(".tokui-command__item")), _ = Array.from(m.querySelectorAll(".tokui-command__group"));
11102
11287
  }
11103
- g();
11104
- function _(e, t) {
11288
+ v();
11289
+ function y(e, t) {
11105
11290
  if (!t) return {
11106
11291
  match: !0,
11107
11292
  score: 0
@@ -11120,7 +11305,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11120
11305
  score: 0
11121
11306
  };
11122
11307
  }
11123
- function v(e, t) {
11308
+ function b(e, t) {
11124
11309
  if (!t) return document.createTextNode(e);
11125
11310
  var n = e.toLowerCase(), r = t.toLowerCase(), i = n.indexOf(r);
11126
11311
  if (i === -1) return document.createTextNode(e);
@@ -11129,138 +11314,121 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11129
11314
  var l = document.createElement("mark");
11130
11315
  return l.className = "tokui-command__highlight", l.textContent = s, a.appendChild(l), c && a.appendChild(document.createTextNode(c)), a;
11131
11316
  }
11132
- function y(e) {
11317
+ function x(e) {
11133
11318
  var t = 0;
11134
- m.forEach(function(n) {
11135
- var r = n.getAttribute("data-value") || n.textContent || "";
11136
- if (_(r, e).match) {
11319
+ g.forEach(function(n) {
11320
+ var r = n.getAttribute("data-value") || n.textContent || "", i = y(r, e);
11321
+ if (n._cmdVisible = i.match, i.match) {
11137
11322
  n.style.display = "", t++;
11138
- var i = n.querySelector(".tokui-command__item-text");
11139
- i && (i.innerHTML = "", i.appendChild(v(r, e)));
11323
+ var a = n.querySelector(".tokui-command__item-text");
11324
+ a && (a.innerHTML = "", a.appendChild(b(n._cmdText == null ? r : n._cmdText, e)));
11140
11325
  } else n.style.display = "none", n.classList.remove("tokui-command__item--selected");
11141
- }), h.forEach(function(e) {
11142
- var t = e.querySelectorAll(".tokui-command__item:not([style*=\"display: none\"])");
11143
- e.style.display = t.length === 0 ? "none" : "";
11144
- }), p.style.display = t === 0 ? "" : "none", b = -1, t > 0 && (b = 0, S());
11326
+ }), _.forEach(function(e) {
11327
+ for (var t = e.querySelectorAll(".tokui-command__item"), n = !1, r = 0; r < t.length; r++) if (t[r]._cmdVisible) {
11328
+ n = !0;
11329
+ break;
11330
+ }
11331
+ e.style.display = n ? "" : "none";
11332
+ }), h.style.display = t === 0 ? "" : "none", S = -1, t > 0 && (S = 0, w());
11145
11333
  }
11146
- d.addEventListener("input", function() {
11147
- y(d.value.trim());
11334
+ p.addEventListener("input", function() {
11335
+ x(p.value.trim());
11148
11336
  });
11149
- var b = -1;
11150
- function x() {
11151
- return m.filter(function(e) {
11152
- return e.style.display !== "none";
11337
+ var S = -1;
11338
+ function C() {
11339
+ return g.filter(function(e) {
11340
+ return e._cmdVisible !== !1;
11153
11341
  });
11154
11342
  }
11155
- function S() {
11156
- x().forEach(function(e, t) {
11157
- t === b ? (e.classList.add("tokui-command__item--selected"), e.setAttribute("aria-selected", "true"), e.scrollIntoView && e.scrollIntoView({ block: "nearest" })) : (e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false"));
11343
+ function w() {
11344
+ C().forEach(function(e, t) {
11345
+ t === S ? (e.classList.add("tokui-command__item--selected"), e.setAttribute("aria-selected", "true"), e.scrollIntoView && e.scrollIntoView({ block: "nearest" })) : (e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false"));
11158
11346
  });
11159
11347
  }
11160
- function C(e) {
11161
- if (e) {
11162
- var t = e.getAttribute("data-tokui-cmd-clk");
11163
- if (t) {
11164
- var n = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11165
- n && typeof n.emit == "function" && n.emit(t, {
11166
- value: e.getAttribute("data-value"),
11167
- text: e.textContent
11168
- });
11169
- }
11170
- var r = o.getAttribute("data-tokui-cmd-clk");
11171
- if (r) {
11172
- var i = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11173
- i && typeof i.emit == "function" && i.emit(r, {
11174
- value: e.getAttribute("data-value"),
11175
- text: e.textContent,
11176
- clk: t
11177
- });
11178
- }
11179
- T();
11180
- }
11181
- }
11182
- d.addEventListener("keydown", function(e) {
11183
- var t = x();
11184
- e.key === "ArrowDown" ? (e.preventDefault(), t.length > 0 && (b = (b + 1) % t.length, S())) : e.key === "ArrowUp" ? (e.preventDefault(), t.length > 0 && (b = b <= 0 ? t.length - 1 : b - 1, S())) : e.key === "Enter" ? (e.preventDefault(), b >= 0 && b < t.length && C(t[b])) : e.key === "Escape" && (e.preventDefault(), T());
11348
+ function T(t) {
11349
+ if (t) {
11350
+ var n = t.getAttribute("data-tokui-cmd-clk"), r = t.getAttribute("data-value"), i = t.querySelector ? t.querySelector(".tokui-command__item-text") : null, a = t._cmdText == null ? i ? i.textContent : t.textContent : t._cmdText, o = e.eventBus;
11351
+ n && o && typeof o.emit == "function" && o.emit(n, {
11352
+ value: r,
11353
+ text: a
11354
+ });
11355
+ var l = s.getAttribute("data-tokui-cmd-clk");
11356
+ l && o && typeof o.emit == "function" && o.emit(l, {
11357
+ value: r,
11358
+ text: a,
11359
+ clk: n
11360
+ }), c("select", {
11361
+ value: r,
11362
+ text: a
11363
+ }), D();
11364
+ }
11365
+ }
11366
+ p.addEventListener("keydown", function(e) {
11367
+ var t = C();
11368
+ e.key === "ArrowDown" ? (e.preventDefault(), t.length > 0 && (S = (S + 1) % t.length, w())) : e.key === "ArrowUp" ? (e.preventDefault(), t.length > 0 && (S = S <= 0 ? t.length - 1 : S - 1, w())) : e.key === "Enter" ? (e.preventDefault(), S >= 0 && S < t.length && T(t[S])) : e.key === "Escape" && (e.preventDefault(), D());
11185
11369
  });
11186
- function w() {
11187
- g(), y(d.value || ""), o.classList.add("tokui-command--open"), o._prevFocus = typeof document < "u" && document.activeElement || null;
11370
+ function E() {
11371
+ v(), x(p.value || ""), s.classList.add("tokui-command--open"), s._prevFocus = typeof document < "u" && document.activeElement || null;
11188
11372
  var e = function() {
11189
- o.classList.contains("tokui-command--open") && typeof d.focus == "function" && d.focus();
11373
+ s.classList.contains("tokui-command--open") && typeof p.focus == "function" && p.focus();
11190
11374
  };
11191
11375
  typeof requestAnimationFrame == "function" ? requestAnimationFrame(e) : setTimeout(e, 0);
11192
11376
  }
11193
- function T() {
11194
- o.classList.remove("tokui-command--open"), d.value = "", y(""), b = -1;
11195
- var e = o._prevFocus;
11377
+ function D() {
11378
+ s.classList.remove("tokui-command--open"), p.value = "", x(""), S = -1;
11379
+ var e = s._prevFocus;
11196
11380
  if (e && typeof e.focus == "function") try {
11197
11381
  e.focus();
11198
11382
  } catch {}
11199
- o._prevFocus = null;
11383
+ s._prevFocus = null;
11200
11384
  }
11201
- o.addEventListener("keydown", function(e) {
11202
- if (!(e.key !== "Tab" || !o.classList.contains("tokui-command--open"))) {
11203
- var t = c.querySelectorAll("input, button, [tabindex=\"0\"]");
11385
+ s.addEventListener("keydown", function(e) {
11386
+ if (!(e.key !== "Tab" || !s.classList.contains("tokui-command--open"))) {
11387
+ var t = u.querySelectorAll("input, button, [tabindex=\"0\"]");
11204
11388
  if (t.length) {
11205
11389
  var n = t[0], r = t[t.length - 1], i = typeof document < "u" ? document.activeElement : null;
11206
11390
  e.shiftKey && i === n ? (e.preventDefault(), r.focus()) : !e.shiftKey && i === r && (e.preventDefault(), n.focus());
11207
11391
  }
11208
11392
  }
11209
- }), s.addEventListener("click", function() {
11210
- T();
11393
+ }), l.addEventListener("click", function() {
11394
+ D();
11211
11395
  });
11212
- function E(e) {
11213
- (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), o.classList.contains("tokui-command--open") ? T() : w());
11214
- }
11215
- return i.hotkey !== void 0 && typeof document < "u" && document.addEventListener("keydown", E), o._tokuiType = "command", o._slot = f, o._openCommand = w, o._closeCommand = T, o._streamCloseHook = function() {
11216
- g(), y(d.value || "");
11217
- }, o;
11396
+ function O(e) {
11397
+ (e.metaKey || e.ctrlKey) && e.key === "k" && (e.preventDefault(), s.classList.contains("tokui-command--open") ? D() : E());
11398
+ }
11399
+ return a.hotkey !== void 0 && typeof document < "u" && (document.addEventListener("keydown", O), e._registerCleanup(s, function() {
11400
+ document.removeEventListener("keydown", O);
11401
+ })), s._tokuiType = "command", s._slot = m, s._openCommand = E, s._closeCommand = D, s._selectItem = T, s._hoverSelectItem = function(e) {
11402
+ var t = C().indexOf(e);
11403
+ t !== -1 && (S = t, w());
11404
+ }, s._streamCloseHook = function() {
11405
+ v(), x(p.value || "");
11406
+ }, s;
11218
11407
  });
11219
- function P(e) {
11220
- var n = e.attrs || {}, r = n.tx || "", i = n.v || r, a = t("div", {
11408
+ function I(e) {
11409
+ var n = e.attrs || {}, r = n.tx || "", i = t("div", {
11221
11410
  class: "tokui-command__item",
11222
11411
  role: "option",
11223
11412
  tabindex: "-1",
11224
- "data-value": i,
11413
+ "data-value": n.v || r,
11225
11414
  "aria-selected": "false",
11226
11415
  "data-tokui-tag": e.type
11227
11416
  });
11228
- n.clk && a.setAttribute("data-tokui-cmd-clk", n.clk);
11229
- var o = t("span", { class: "tokui-command__item-text" });
11230
- if (o.textContent = r, a.appendChild(o), n.shortcut) {
11231
- var s = t("span", { class: "tokui-command__item-shortcut" });
11232
- s.textContent = n.shortcut, a.appendChild(s);
11233
- }
11234
- return a.addEventListener("click", function() {
11235
- var e = a.closest ? a.closest(".tokui-command") : null;
11236
- if (e && e._closeCommand) {
11237
- var t = a.getAttribute("data-tokui-cmd-clk");
11238
- if (t) {
11239
- var n = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11240
- n && typeof n.emit == "function" && n.emit(t, {
11241
- value: i,
11242
- text: r
11243
- });
11244
- }
11245
- var o = e.getAttribute("data-tokui-cmd-clk");
11246
- if (o) {
11247
- var s = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
11248
- s && typeof s.emit == "function" && s.emit(o, {
11249
- value: i,
11250
- text: r,
11251
- clk: t
11252
- });
11253
- }
11254
- e._closeCommand();
11255
- }
11256
- }), a.addEventListener("mouseenter", function() {
11257
- var e = a.closest ? a.closest(".tokui-command__list") : null;
11258
- e && (Array.from(e.querySelectorAll(".tokui-command__item:not([style*=\"display: none\"])")).forEach(function(e) {
11259
- e.classList.remove("tokui-command__item--selected"), e.setAttribute("aria-selected", "false");
11260
- }), a.classList.add("tokui-command__item--selected"), a.setAttribute("aria-selected", "true"));
11261
- }), a;
11417
+ n.clk && i.setAttribute("data-tokui-cmd-clk", n.clk);
11418
+ var a = t("span", { class: "tokui-command__item-text" });
11419
+ if (a.textContent = r, i.appendChild(a), i._cmdText = r, n.shortcut) {
11420
+ var o = t("span", { class: "tokui-command__item-shortcut" });
11421
+ o.textContent = n.shortcut, i.appendChild(o);
11422
+ }
11423
+ return i.addEventListener("click", function() {
11424
+ var e = i.closest ? i.closest(".tokui-command") : null;
11425
+ e && typeof e._selectItem == "function" && e._selectItem(i);
11426
+ }), i.addEventListener("mouseenter", function() {
11427
+ var e = i.closest ? i.closest(".tokui-command") : null;
11428
+ e && typeof e._hoverSelectItem == "function" && e._hoverSelectItem(i);
11429
+ }), i;
11262
11430
  }
11263
- typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.buildCommandItem = P), e.register("command-group", (e, n) => {
11431
+ typeof window < "u" && window.TokUI && window.TokUI._internal && (window.TokUI._internal.buildCommandItem = I), e.register("command-group", (e, n) => {
11264
11432
  var r = (e.attrs || {}).tt || "", i = t("div", {
11265
11433
  class: "tokui-command__group",
11266
11434
  role: "group"
@@ -11273,8 +11441,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11273
11441
  return n(e.children || []).forEach(function(e) {
11274
11442
  e && e.nodeType && i.appendChild(e);
11275
11443
  }), i._slot = i, i._tokuiType = "command-group", i;
11276
- }), e.register("command-item", (e) => P(e)), e.register("canvas", (e, r) => {
11277
- var i = e.attrs || {}, a = i.tt || "Canvas", o = i.pos || "right", s = parseInt(i.w) || 400, c = i.open !== void 0, l = i.closable === void 0 || i.closable === !0, u = ["tokui-canvas", "tokui-canvas--" + o];
11444
+ }), e.register("command-item", (e) => I(e)), e.register("canvas", (e, r) => {
11445
+ var i = e.attrs || {}, a = i.tt || n("canvas.title"), o = i.pos || "right", s = parseInt(i.w) || 400, c = i.open !== void 0, l = i.closable === void 0 || i.closable === !0, u = ["tokui-canvas", "tokui-canvas--" + o];
11278
11446
  c && u.push("tokui-canvas--open");
11279
11447
  var d = t("div", { class: u.join(" ") });
11280
11448
  d.style.setProperty("--tokui-canvas-w", s + "px");
@@ -11322,7 +11490,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11322
11490
  }), r._slot = r, r._tokuiType = "canvas-content", r;
11323
11491
  });
11324
11492
  }
11325
- function c(e, t) {
11493
+ function d(e, t) {
11326
11494
  var n = "1.5", r = "round", i = "round", a = "<path d=\"M6 2h8l6 6v12a2 2 0 01-2 2H6a2 2 0 01-2-2V4a2 2 0 012-2z\" fill=\"none\" stroke=\"" + t + "\" stroke-width=\"" + n + "\" stroke-linecap=\"" + r + "\" stroke-linejoin=\"" + i + "\"/><path d=\"M14 2v6h6\" fill=\"none\" stroke=\"" + t + "\" stroke-width=\"" + n + "\" stroke-linecap=\"" + r + "\" stroke-linejoin=\"" + i + "\"/>", o = {
11327
11495
  pdf: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\">" + a + "<text x=\"12\" y=\"16.5\" text-anchor=\"middle\" font-size=\"5.5\" font-weight=\"700\" font-family=\"sans-serif\" fill=\"" + t + "\">PDF</text></svg>",
11328
11496
  word: "<svg viewBox=\"0 0 24 24\" width=\"24\" height=\"24\" fill=\"none\">" + a + "<text x=\"12\" y=\"16.5\" text-anchor=\"middle\" font-size=\"7\" font-weight=\"700\" font-family=\"sans-serif\" fill=\"" + t + "\">W</text></svg>",
@@ -11337,7 +11505,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11337
11505
  };
11338
11506
  return o[e] || o.default;
11339
11507
  }
11340
- function d(e, t) {
11508
+ function f(e, t) {
11341
11509
  if (t <= 7) {
11342
11510
  for (var n = [], r = 1; r <= t; r++) n.push(r);
11343
11511
  return n;
@@ -11347,7 +11515,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11347
11515
  for (var a = Math.max(2, e - 1), o = Math.min(t - 1, e + 1), s = a; s <= o; s++) i.push(s);
11348
11516
  return e < t - 2 && i.push("..."), i.push(t), i;
11349
11517
  }
11350
- function f() {
11518
+ function p() {
11351
11519
  typeof document > "u" || document.querySelectorAll(".tokui-dropdown__panel--open").forEach(function(e) {
11352
11520
  e.classList.remove("tokui-dropdown__panel--open"), e.style.top = "", e.style.left = "";
11353
11521
  var t = e.parentElement.querySelector(".tokui-dropdown__trigger");
@@ -11355,9 +11523,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11355
11523
  });
11356
11524
  }
11357
11525
  typeof document < "u" && typeof document.addEventListener == "function" && document.addEventListener("click", function() {
11358
- f();
11526
+ p();
11359
11527
  });
11360
- function p(e) {
11528
+ function m(e) {
11361
11529
  let t = e.querySelectorAll(".tokui-md-img");
11362
11530
  if (!t.length) return;
11363
11531
  let n = Array.from(t).map(function(e) {
@@ -11370,10 +11538,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11370
11538
  });
11371
11539
  });
11372
11540
  }
11373
- function m(e) {
11541
+ function _(e) {
11374
11542
  return typeof window < "u" && window && window[e] ? window[e] : null;
11375
11543
  }
11376
- function _(e, t) {
11544
+ function y(e, t) {
11377
11545
  var n = null;
11378
11546
  if (typeof window < "u" && window.katex && (n = window.katex), n && typeof n.renderToString == "function") try {
11379
11547
  var r = n.renderToString(e, {
@@ -11384,7 +11552,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11384
11552
  } catch {}
11385
11553
  return (t ? "$$" + e + "$$" : "$" + e + "$").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11386
11554
  }
11387
- function v(e) {
11555
+ function b(e) {
11388
11556
  if (!e) return "";
11389
11557
  function t(e) {
11390
11558
  return e.trim().replace(/^\|/, "").replace(/\|$/, "").split("|").map(function(e) {
@@ -11399,7 +11567,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11399
11567
  function r(e) {
11400
11568
  return String(e).replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11401
11569
  }
11402
- function o(e) {
11570
+ function i(e) {
11403
11571
  return e = e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"), e = e.replace(/\*\*(.+?)\*\*/g, "<strong>$1</strong>"), e = e.replace(/\*(.+?)\*/g, "<em>$1</em>"), e = e.replace(/~~(.+?)~~/g, "<del>$1</del>"), e = e.replace(/`([^`]+)`/g, "<code>$1</code>"), e = e.replace(/!\[([^\]]*)\]\(([^)]+)\)/g, function(e, t, n) {
11404
11572
  return /^https?:\/\//i.test(n) ? "<img src=\"" + r(n) + "\" alt=\"" + r(t) + "\" class=\"tokui-md-img\" />" : e;
11405
11573
  }), e = e.replace(/\[([^\]]+)\]\(([^)]+)\)/g, function(e, t, n) {
@@ -11429,7 +11597,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11429
11597
  }), "TOKUIMATH" + n + "";
11430
11598
  });
11431
11599
  function l(e) {
11432
- return _(e.tex, e.display);
11600
+ return y(e.tex, e.display);
11433
11601
  }
11434
11602
  function u(e) {
11435
11603
  return e.replace(/\x02TOKUIMATH(\d+)\x03/g, function(e, t) {
@@ -11442,12 +11610,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11442
11610
  if (r) {
11443
11611
  var d = s[parseInt(r[1])], f = d.lang || "text";
11444
11612
  if (f === "mermaid") return "<div class=\"tokui-md__mermaid\"><pre class=\"tokui-code\"><code class=\"language-mermaid\">" + d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</code></pre></div>";
11445
- var p = i[f] ? a(d.code, f) : d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11613
+ var p = a[f] ? o(d.code, f) : d.code.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
11446
11614
  return "<pre class=\"tokui-code\"><code class=\"language-" + f + "\">" + p + "</code></pre>";
11447
11615
  }
11448
11616
  var m = e.match(/^\x02TOKUIMATH(\d+)\x03$/);
11449
11617
  if (m && c[parseInt(m[1])].display) return l(c[parseInt(m[1])]);
11450
- e = o(e), e = u(e);
11618
+ e = i(e), e = u(e);
11451
11619
  for (var h = e.split("\n"), g = [], _ = !1, v = !1, y = !1, b = !1, x = -1, S = 0; S < h.length; S++) if (h[S].trim().indexOf("|") === 0) {
11452
11620
  x = S;
11453
11621
  break;
@@ -11505,10 +11673,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
11505
11673
  }
11506
11674
  }).join("");
11507
11675
  }
11508
- typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.registerBasicComponents = s, window.TokUI._internal.resolveColor = r, window.TokUI._internal.highlightCode = a), t !== void 0 && t.exports && (t.exports = {
11509
- registerBasicComponents: s,
11510
- resolveColor: r,
11511
- highlightCode: a
11676
+ typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.registerBasicComponents = c, window.TokUI._internal.resolveColor = i, window.TokUI._internal.highlightCode = o), t !== void 0 && t.exports && (t.exports = {
11677
+ registerBasicComponents: c,
11678
+ resolveColor: i,
11679
+ highlightCode: o
11512
11680
  });
11513
11681
  })), C = /* @__PURE__ */ o(((e, t) => {
11514
11682
  var n = typeof l == "function" ? u().t : window.TokUI && window.TokUI._internal && window.TokUI._internal.t || function(e) {
@@ -14779,7 +14947,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14779
14947
  var i = a(e.attrs.style);
14780
14948
  i && (r.style = i);
14781
14949
  let o = t("div", r);
14782
- if (e.attrs.w && (o.style.width = /^\d+$/.test(e.attrs.w) ? e.attrs.w + "px" : e.attrs.w), e.attrs.tt) {
14950
+ if (u(o, e.attrs), e.attrs.w && (o.style.width = /^\d+$/.test(e.attrs.w) ? e.attrs.w + "px" : e.attrs.w), e.attrs.tt) {
14783
14951
  var s = "tokui-card-header", c = e.attrs.hc || "";
14784
14952
  e.attrs.ht && (s += " tokui-card-header--" + e.attrs.ht), c && [
14785
14953
  "primary",
@@ -14802,21 +14970,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14802
14970
  "info",
14803
14971
  "dark"
14804
14972
  ].indexOf(c) === -1) {
14805
- var u = e.attrs.ht || "", d = /^(#[0-9a-fA-F]{3,8}|rgba?\([\d\s.,%]+\)|[a-zA-Z]+)$/.test(c) ? c : "";
14806
- u === "fill" || u === "pill" ? d && (l.style.background = "color-mix(in srgb, " + d + " 10%, transparent)", l.style.color = d, u === "fill" ? l.style.borderBottom = "1px solid color-mix(in srgb, " + d + " 22%, transparent)" : l.style.borderColor = "color-mix(in srgb, " + d + " 22%, transparent)") : u === "accent" ? l.style.borderLeftColor = c : u === "underline" ? l.style.setProperty("--tokui-card-header-underline-color", c) : u === "dot" && l.style.setProperty("--tokui-card-header-dot-color", c);
14973
+ var d = e.attrs.ht || "", f = /^(#[0-9a-fA-F]{3,8}|rgba?\([\d\s.,%]+\)|[a-zA-Z]+)$/.test(c) ? c : "";
14974
+ d === "fill" || d === "pill" ? f && (l.style.background = "color-mix(in srgb, " + f + " 10%, transparent)", l.style.color = f, d === "fill" ? l.style.borderBottom = "1px solid color-mix(in srgb, " + f + " 22%, transparent)" : l.style.borderColor = "color-mix(in srgb, " + f + " 22%, transparent)") : d === "accent" ? l.style.borderLeftColor = c : d === "underline" ? l.style.setProperty("--tokui-card-header-underline-color", c) : d === "dot" && l.style.setProperty("--tokui-card-header-dot-color", c);
14807
14975
  }
14808
14976
  o.appendChild(l);
14809
14977
  }
14810
- let f = [], p = [];
14978
+ let p = [], m = [];
14811
14979
  (e.children || []).forEach((e) => {
14812
- e.type === "ft" ? p.push(e) : f.push(e);
14980
+ e.type === "ft" ? m.push(e) : p.push(e);
14813
14981
  });
14814
- let m = t("div", { class: "tokui-card-body" });
14815
- return e.attrs.tx && (m.textContent = e.attrs.tx), n(f).forEach((e) => {
14816
- e && e.nodeType && m.appendChild(e);
14817
- }), o.appendChild(m), n(p).forEach((e) => {
14982
+ let h = t("div", { class: "tokui-card-body" });
14983
+ return e.attrs.tx && (h.textContent = e.attrs.tx), n(p).forEach((e) => {
14984
+ e && e.nodeType && h.appendChild(e);
14985
+ }), o.appendChild(h), n(m).forEach((e) => {
14818
14986
  e && e.nodeType && o.appendChild(e);
14819
- }), o._slot = m, o._tokuiType = "card", o._update = function(e) {
14987
+ }), o._slot = h, o._tokuiType = "card", o._update = function(e) {
14820
14988
  if (e.tt !== void 0) {
14821
14989
  var t = o.querySelector(".tokui-card-header");
14822
14990
  t && (t.textContent = e.tt);
@@ -14834,27 +15002,143 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14834
15002
  }), e._stream !== "open" && !i.childNodes.length && !r ? null : (i._slot = i, i._tokuiType = "ft", i._streamCloseHook = function() {
14835
15003
  !i.childNodes.length && !r && i.parentNode && i.parentNode.removeChild(i);
14836
15004
  }, i);
14837
- }), e.register("row", (e, n) => {
15005
+ });
15006
+ var o = /^\d+(\.\d+)?(px|%|em|rem|vw|vh)$/;
15007
+ function s(e) {
15008
+ if (e == null) return null;
15009
+ var t = String(e).trim();
15010
+ return /^\d+(\.\d+)?$/.test(t) ? t + "px" : o.test(t) ? t : null;
15011
+ }
15012
+ var c = {
15013
+ default: 1,
15014
+ dark: 1,
15015
+ modern: 1,
15016
+ "modern-dark": 1
15017
+ };
15018
+ function u(e, t) {
15019
+ var n = t && t.theme;
15020
+ n && c[n] && e.setAttribute("data-tokui-theme", n);
15021
+ }
15022
+ function d(e) {
15023
+ if (o.test(e) || /^\d+(\.\d+)?fr$/.test(e) || e === "auto" || e === "min-content" || e === "max-content") return e;
15024
+ var t = e.match(/^minmax\(([^,]+),([^)]+)\)$/);
15025
+ if (t) {
15026
+ var n = t[1].trim(), r = t[2].trim(), i = o.test(n) || n === "auto" || n === "min-content" || n === "max-content", a = o.test(r) || /^\d+(\.\d+)?fr$/.test(r) || r === "auto" || r === "min-content" || r === "max-content";
15027
+ return i && a ? "minmax(" + n + ", " + r + ")" : null;
15028
+ }
15029
+ var s = e.match(/^fit-content\(([^)]+)\)$/);
15030
+ return s && o.test(s[1].trim()) ? "fit-content(" + s[1].trim() + ")" : null;
15031
+ }
15032
+ function f(e) {
15033
+ if (!e) return null;
15034
+ var t = String(e).trim();
15035
+ if (!t) return null;
15036
+ if (/^\d{1,2}$/.test(t)) {
15037
+ var n = parseInt(t);
15038
+ return n >= 1 && n <= 24 ? "repeat(" + n + ", 1fr)" : null;
15039
+ }
15040
+ var r = t.match(/^auto:(.+)$/);
15041
+ if (r) {
15042
+ var i = s(r[1]);
15043
+ return i ? "repeat(auto-fill, minmax(" + i + ", 1fr))" : null;
15044
+ }
15045
+ var a = t.split(/\s+/);
15046
+ if (a.length > 24) return null;
15047
+ for (var o = [], c = 0; c < a.length; c++) {
15048
+ var l = d(a[c]);
15049
+ if (!l) return null;
15050
+ o.push(l);
15051
+ }
15052
+ return o.join(" ");
15053
+ }
15054
+ var p = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
15055
+ function m(e) {
15056
+ if (!e) return null;
15057
+ var t = String(e).split("|");
15058
+ if (t.length > 24) return null;
15059
+ for (var n = [], r = 0; r < t.length; r++) {
15060
+ var i = t[r].trim().split(/\s+/).filter(Boolean);
15061
+ if (!i.length || i.length > 24) return null;
15062
+ for (var a = 0; a < i.length; a++) if (i[a] !== "." && !p.test(i[a])) return null;
15063
+ n.push("\"" + i.join(" ") + "\"");
15064
+ }
15065
+ return n.join(" ");
15066
+ }
15067
+ e.register("row", (e, n) => {
14838
15068
  let r = t("div", { class: "tokui-row" });
15069
+ if (e.attrs) {
15070
+ let t = s(e.attrs.gutter);
15071
+ t && (r.style.gap = t);
15072
+ let n = s(e.attrs.gy);
15073
+ n && (r.style.rowGap = n);
15074
+ }
14839
15075
  return n(e.children).forEach((e) => {
14840
15076
  e && e.nodeType && r.appendChild(e);
14841
15077
  }), r._slot = r, r._tokuiType = "row", r;
14842
15078
  }), e.register("col", (e, n) => {
14843
- let r = e.attrs && (e.attrs.span || e.attrs.cols), i = t("div", { class: "tokui-col" });
15079
+ let r = e.attrs && (e.attrs.span || e.attrs.cols), i = t("div", { class: "tokui-col" }), a = 0;
14844
15080
  if (r) {
14845
- let e = parseInt(r), t = isNaN(e) ? 1 : Math.min(12, Math.max(1, e));
14846
- i.classList.add("tokui-col--" + t), i.style.gridColumn = `span ${t}`;
15081
+ let e = parseInt(r);
15082
+ a = isNaN(e) ? 1 : Math.min(12, Math.max(1, e)), i.classList.add("tokui-col--" + a), i.style.gridColumn = `span ${a}`;
15083
+ }
15084
+ if (e.attrs && e.attrs.offset) {
15085
+ let t = parseInt(e.attrs.offset);
15086
+ if (!isNaN(t) && t >= 1 && t <= 11) {
15087
+ let e = a || 1, n = Math.min(t + 1, 13 - e);
15088
+ i.style.gridColumn = `${n} / span ${e}`;
15089
+ }
15090
+ }
15091
+ if (e.attrs && e.attrs.rspan) {
15092
+ let t = parseInt(e.attrs.rspan);
15093
+ !isNaN(t) && t >= 1 && t <= 12 && (i.style.gridRow = `span ${t}`);
14847
15094
  }
14848
15095
  return e.content && (i.textContent = e.content), n(e.children).forEach((e) => {
14849
15096
  e && e.nodeType && i.appendChild(e);
14850
15097
  }), i._slot = i, i._tokuiType = "col", i;
15098
+ }), e.register("grid", (e, n) => {
15099
+ let r = e.attrs || {}, i = t("div", { class: "tokui-grid" });
15100
+ u(i, r);
15101
+ let a = f(r.cols);
15102
+ a && (i.style.gridTemplateColumns = a);
15103
+ let o = f(r.rows);
15104
+ o && (i.style.gridTemplateRows = o);
15105
+ let c = m(r.areas);
15106
+ c && (i.style.gridTemplateAreas = c);
15107
+ let l = s(r.gap);
15108
+ l && (i.style.gap = l);
15109
+ let d = s(r.gx);
15110
+ d && (i.style.columnGap = d);
15111
+ let p = s(r.gy);
15112
+ p && (i.style.rowGap = p);
15113
+ let h = s(r.h);
15114
+ h && (i.style.height = h);
15115
+ let g = s(r.minh);
15116
+ return g && (i.style.minHeight = g), n(e.children).forEach((e) => {
15117
+ e && e.nodeType && i.appendChild(e);
15118
+ }), i._slot = i, i._tokuiType = "grid", i;
15119
+ }), e.register("cell", (e, n) => {
15120
+ let r = e.attrs || {}, i = t("div", { class: "tokui-cell" });
15121
+ if (u(i, r), r.area && p.test(String(r.area)) && (i.style.gridArea = String(r.area)), r.c) {
15122
+ let e = String(r.c).trim();
15123
+ if (/^\d{1,2}$/.test(e)) {
15124
+ let t = Math.min(24, Math.max(1, parseInt(e)));
15125
+ i.style.gridColumn = "span " + t;
15126
+ } else /^\d{1,2}\s*\/\s*-?\d{1,2}$/.test(e) && (i.style.gridColumn = e.replace(/\s+/g, " "));
15127
+ }
15128
+ if (r.r) {
15129
+ let e = parseInt(r.r);
15130
+ !isNaN(e) && e >= 1 && e <= 24 && (i.style.gridRow = "span " + e);
15131
+ }
15132
+ return /^(start|center|end|stretch)$/.test(r.align || "") && (i.style.alignSelf = r.align), /^(start|center|end|stretch)$/.test(r.justify || "") && (i.style.justifySelf = r.justify), e.content && (i.textContent = e.content), n(e.children).forEach((e) => {
15133
+ e && e.nodeType && i.appendChild(e);
15134
+ }), i._slot = i, i._tokuiType = "cell", i;
14851
15135
  }), e.register("list", (e, n) => {
14852
15136
  let r = t(e.attrs && e.attrs.t === "ol" ? "ol" : "ul", { class: e.attrs && e.attrs.plain ? "tokui-list tokui-list--plain" : "tokui-list" });
14853
15137
  return n(e.children).forEach((e) => {
14854
15138
  e && e.nodeType && r.appendChild(e);
14855
15139
  }), r._slot = r, r._tokuiType = "list", r;
14856
15140
  });
14857
- function o(e, n) {
15141
+ function _(e, n) {
14858
15142
  var r = e.attrs || {}, i = parseInt(r.span) || 1, a = t("div", {
14859
15143
  class: "tokui-desc__item",
14860
15144
  "data-tokui-tag": e.type
@@ -14870,16 +15154,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14870
15154
  }
14871
15155
  e.register("item", (e, n, r) => {
14872
15156
  var i;
14873
- if (r === "desc") i = o(e);
14874
- else if (r === "carousel") i = d(e, n);
15157
+ if (r === "desc") i = _(e);
15158
+ else if (r === "carousel") i = x(e, n);
14875
15159
  else if (r === "command-group") {
14876
15160
  var a = typeof window < "u" && window.TokUI && window.TokUI._internal && window.TokUI._internal.buildCommandItem || null;
14877
15161
  a && (i = a(e));
14878
15162
  }
14879
15163
  if (!i) {
14880
15164
  i = t("li", { class: "tokui-list-item" });
14881
- var s = e.content || e.attrs && e.attrs.tx || "";
14882
- s && (i.textContent = s), n(e.children || []).forEach((e) => {
15165
+ var o = e.content || e.attrs && e.attrs.tx || "";
15166
+ o && (i.textContent = o), n(e.children || []).forEach((e) => {
14883
15167
  e && e.nodeType && i.appendChild(e);
14884
15168
  }), i._slot = i;
14885
15169
  }
@@ -14894,28 +15178,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14894
15178
  i._tabId = a, i._tabCount = 0;
14895
15179
  var o = e.createReporter("tabs", n.attrs, i);
14896
15180
  (n.children || []).forEach((e, t) => {
14897
- e.type === "tab" && (s(i, e, r, a, t), i._tabCount = t + 1);
15181
+ e.type === "tab" && (v(i, e, r, a, t), i._tabCount = t + 1);
14898
15182
  }), i._slot = i, i._tokuiType = "tabs";
14899
- function c(e) {
15183
+ function s(e) {
14900
15184
  i.querySelectorAll(".tokui-tabs-label").forEach(function(t) {
14901
15185
  var n = t.getAttribute("data-index") === String(e);
14902
15186
  t.setAttribute("aria-selected", String(n)), t.setAttribute("tabindex", n ? "0" : "-1");
14903
15187
  });
14904
15188
  }
14905
- return i._syncTabAria = c, i.addEventListener("keydown", function(e) {
15189
+ return i._syncTabAria = s, i.addEventListener("keydown", function(e) {
14906
15190
  if (!(e.key !== "ArrowRight" && e.key !== "ArrowLeft")) {
14907
15191
  var t = Array.from(i.querySelectorAll(".tokui-tabs-label")), n = t.indexOf(e.target);
14908
15192
  if (n !== -1) {
14909
15193
  e.preventDefault();
14910
15194
  var r = e.key === "ArrowRight" ? (n + 1) % t.length : (n - 1 + t.length) % t.length, a = i.querySelector("#" + t[r].getAttribute("for"));
14911
- a && (a.checked = !0, c(r), t[r].focus());
15195
+ a && (a.checked = !0, s(r), t[r].focus());
14912
15196
  }
14913
15197
  }
14914
15198
  }), i.addEventListener("change", function(e) {
14915
15199
  var t = e.target;
14916
15200
  if (!(!t || !t.classList || !t.classList.contains("tokui-tabs-input"))) {
14917
15201
  var n = parseInt(t.getAttribute("data-index"), 10);
14918
- c(n);
15202
+ s(n);
14919
15203
  var r = i.querySelector(".tokui-tabs-label[data-index=\"" + n + "\"]");
14920
15204
  o("change", {
14921
15205
  index: n,
@@ -14925,16 +15209,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
14925
15209
  }), i._update = function(e) {
14926
15210
  if (e.v !== void 0) {
14927
15211
  var t = i.querySelector("input[data-index=\"" + e.v + "\"]");
14928
- t && (t.checked = !0, c(e.v));
15212
+ t && (t.checked = !0, s(e.v));
14929
15213
  }
14930
15214
  }, i._streamCloseHook = function() {
14931
15215
  if (i._tokuiStreamActive) {
14932
15216
  var e = i.querySelector("input[data-index=\"0\"]");
14933
- e && (e.checked = !0, c(0));
15217
+ e && (e.checked = !0, s(0));
14934
15218
  }
14935
15219
  }, i;
14936
15220
  });
14937
- function s(e, n, r, i, a) {
15221
+ function v(e, n, r, i, a) {
14938
15222
  var o = {
14939
15223
  type: "radio",
14940
15224
  name: i,
@@ -15425,7 +15709,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15425
15709
  }
15426
15710
  return r.appendChild(a), r;
15427
15711
  });
15428
- function c(e) {
15712
+ function y(e) {
15429
15713
  for (var t = e.querySelectorAll(".tokui-desc__item--last-row"), n = 0; n < t.length; n++) t[n].classList.remove("tokui-desc__item--last-row");
15430
15714
  var r = e.querySelectorAll(".tokui-desc__item");
15431
15715
  if (r.length) {
@@ -15444,14 +15728,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15444
15728
  if (!o) for (var u = (Math.ceil(r.length / a) - 1) * a; u < r.length; u++) r[u].classList.add("tokui-desc__item--last-row");
15445
15729
  }
15446
15730
  }
15447
- function u(e) {
15448
- if (c(e), typeof MutationObserver > "u") return;
15731
+ function b(e) {
15732
+ if (y(e), typeof MutationObserver > "u") return;
15449
15733
  var t = !1;
15450
15734
  function n() {
15451
15735
  t || (t = !0, (typeof requestAnimationFrame == "function" ? requestAnimationFrame : function(e) {
15452
15736
  e();
15453
15737
  })(function() {
15454
- t = !1, e.isConnected && c(e);
15738
+ t = !1, e.isConnected && y(e);
15455
15739
  }));
15456
15740
  }
15457
15741
  var r = new MutationObserver(function() {
@@ -15462,22 +15746,22 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15462
15746
  n();
15463
15747
  });
15464
15748
  r.observe(e, { childList: !0 }), typeof requestAnimationFrame == "function" && requestAnimationFrame(function() {
15465
- e.isConnected && c(e);
15749
+ e.isConnected && y(e);
15466
15750
  });
15467
15751
  }
15468
15752
  e.register("desc", (e, n) => {
15469
15753
  var r = e.attrs || {}, i = parseInt(r.cols) || 3, a = ["tokui-desc"];
15470
15754
  r.stripe !== void 0 && a.push("tokui-desc--stripe"), r.bordered !== void 0 && a.push("tokui-desc--bordered"), (r.v === "horizontal" || r.v === "h") && a.push("tokui-desc--horizontal");
15471
- var s = t("div", { class: a.join(" ") });
15472
- s.style.setProperty("--tokui-desc-cols", String(i)), r.lw && s.style.setProperty("--tokui-desc-label-w", r.lw);
15473
- var c = (e.children || []).filter(function(e) {
15755
+ var o = t("div", { class: a.join(" ") });
15756
+ o.style.setProperty("--tokui-desc-cols", String(i)), r.lw && o.style.setProperty("--tokui-desc-label-w", r.lw);
15757
+ var s = (e.children || []).filter(function(e) {
15474
15758
  return e.type === "desc-item" || e.type === "item";
15475
15759
  });
15476
- return c.length > 0 && c.forEach(function(e) {
15477
- s.appendChild(o(e, i));
15478
- }), u(s), s._slot = s, s._tokuiType = "desc", s;
15479
- }), e.register("desc-item", (e) => o(e));
15480
- function d(e, n) {
15760
+ return s.length > 0 && s.forEach(function(e) {
15761
+ o.appendChild(_(e, i));
15762
+ }), b(o), o._slot = o, o._tokuiType = "desc", o;
15763
+ }), e.register("desc-item", (e) => _(e));
15764
+ function x(e, n) {
15481
15765
  var r = e.attrs || {}, i = t("div", {
15482
15766
  class: "tokui-carousel__slide",
15483
15767
  "data-tokui-tag": e.type
@@ -15500,11 +15784,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15500
15784
  e.register("carousel", (r, i) => {
15501
15785
  var a = r.attrs || {}, o = a.thumb !== void 0, s = { class: "tokui-carousel" + (o ? " tokui-carousel--thumb" : "") };
15502
15786
  a.id && (s.id = a.id), s["data-carousel"] = a.id || "carousel-" + Math.random().toString(36).slice(2, 8);
15503
- var c = t("div", s), l = e.createReporter("carousel", a, c), u = t("div", { class: "tokui-carousel__viewport" }), f = t("div", { class: "tokui-carousel__track" });
15504
- function p(e) {
15787
+ var c = t("div", s), l = e.createReporter("carousel", a, c), u = t("div", { class: "tokui-carousel__viewport" }), d = t("div", { class: "tokui-carousel__track" });
15788
+ function f(e) {
15505
15789
  return e = String(e).trim(), /^\d+(\.\d+)?$/.test(e) ? e + "px" : e;
15506
15790
  }
15507
- function m(e) {
15791
+ function p(e) {
15508
15792
  var t = String(e).split(":");
15509
15793
  if (t.length === 2) {
15510
15794
  var n = parseFloat(t[0]), r = parseFloat(t[1]);
@@ -15513,45 +15797,45 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15513
15797
  var i = parseFloat(e);
15514
15798
  return i > 0 ? i : 0;
15515
15799
  }
15516
- if (a.w && (c.style.width = p(a.w)), a.h) u.style.height = p(a.h), c.classList.add("tokui-carousel--sized");
15800
+ if (a.w && (c.style.width = f(a.w)), a.h) u.style.height = f(a.h), c.classList.add("tokui-carousel--sized");
15517
15801
  else if (a.ratio) {
15518
- var h = m(a.ratio);
15519
- h && (u.style.aspectRatio = String(h), c.classList.add("tokui-carousel--sized"));
15802
+ var m = p(a.ratio);
15803
+ m && (u.style.aspectRatio = String(m), c.classList.add("tokui-carousel--sized"));
15520
15804
  }
15521
- var g = (r.children || []).filter(function(e) {
15805
+ var h = (r.children || []).filter(function(e) {
15522
15806
  return e.type === "carousel-item" || e.type === "item" || e.type === "img";
15523
15807
  });
15524
- g.forEach(function(e) {
15525
- if (e.type === "carousel-item" || e.type === "item") f.appendChild(d(e, i));
15808
+ h.forEach(function(e) {
15809
+ if (e.type === "carousel-item" || e.type === "item") d.appendChild(x(e, i));
15526
15810
  else if (e.type === "img") {
15527
15811
  var n = t("div", { class: "tokui-carousel__slide" });
15528
15812
  i([e]).forEach(function(e) {
15529
15813
  e && e.nodeType && n.appendChild(e);
15530
- }), f.appendChild(n);
15814
+ }), d.appendChild(n);
15531
15815
  }
15532
- }), u.appendChild(f);
15533
- var _ = t("button", {
15816
+ }), u.appendChild(d);
15817
+ var g = t("button", {
15534
15818
  class: "tokui-carousel__arrow tokui-carousel__arrow--prev",
15535
15819
  "aria-label": n("layout.carouselPrev"),
15536
15820
  "data-dir": "prev"
15537
15821
  });
15538
- _.innerHTML = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"15 18 9 12 15 6\"/></svg>", u.appendChild(_);
15539
- var v = t("button", {
15822
+ g.innerHTML = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"15 18 9 12 15 6\"/></svg>", u.appendChild(g);
15823
+ var _ = t("button", {
15540
15824
  class: "tokui-carousel__arrow tokui-carousel__arrow--next",
15541
15825
  "aria-label": n("layout.carouselNext"),
15542
15826
  "data-dir": "next"
15543
15827
  });
15544
- v.innerHTML = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"9 6 15 12 9 18\"/></svg>", u.appendChild(v), c.appendChild(u);
15545
- var y = null, b = null, x = !1;
15828
+ _.innerHTML = "<svg width=\"20\" height=\"20\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\"><polyline points=\"9 6 15 12 9 18\"/></svg>", u.appendChild(_), c.appendChild(u);
15829
+ var v = null, y = null, b = !1;
15546
15830
  function S() {
15547
- return Array.prototype.filter.call(f.children, function(e) {
15831
+ return Array.prototype.filter.call(d.children, function(e) {
15548
15832
  return e && e.nodeType === 1 && /\btokui-carousel__slide\b/.test(e.className || "");
15549
15833
  });
15550
15834
  }
15551
15835
  function C() {
15552
- if (!x) {
15836
+ if (!b) {
15553
15837
  var e = S();
15554
- e.length && (x = !0, o ? (b = t("div", { class: "tokui-carousel__thumbs" }), e.forEach(function(e, r) {
15838
+ e.length && (b = !0, o ? (y = t("div", { class: "tokui-carousel__thumbs" }), e.forEach(function(e, r) {
15555
15839
  var i = e.querySelector("img"), a = i ? i.getAttribute("src") : "", o = e.querySelector(".tokui-carousel__slide-title"), s = o ? (o.textContent || "").trim() : "", c = t("button", {
15556
15840
  class: "tokui-carousel__thumb" + (r === 0 ? " tokui-carousel__thumb--active" : ""),
15557
15841
  "aria-label": n("layout.carouselIndex", { n: r + 1 }),
@@ -15564,21 +15848,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15564
15848
  });
15565
15849
  l.style.width = "100%", l.style.height = "100%", l.style.objectFit = "cover", c.appendChild(l);
15566
15850
  } else c.textContent = String(r + 1);
15567
- b.appendChild(c);
15568
- }), c.appendChild(b)) : (y = t("div", { class: "tokui-carousel__dots" }), e.forEach(function(e, r) {
15851
+ y.appendChild(c);
15852
+ }), c.appendChild(y)) : (v = t("div", { class: "tokui-carousel__dots" }), e.forEach(function(e, r) {
15569
15853
  var i = t("button", {
15570
15854
  class: "tokui-carousel__dot" + (r === 0 ? " tokui-carousel__dot--active" : ""),
15571
15855
  "aria-label": n("layout.carouselIndex", { n: r + 1 }),
15572
15856
  "data-index": String(r)
15573
15857
  });
15574
- y.appendChild(i);
15575
- }), u.appendChild(y)));
15858
+ v.appendChild(i);
15859
+ }), u.appendChild(v)));
15576
15860
  }
15577
15861
  }
15578
- c._slot = f, c._tokuiType = "carousel";
15862
+ c._slot = d, c._tokuiType = "carousel";
15579
15863
  function w() {
15580
15864
  C();
15581
- var e = 0, t = S(), r = y ? y.querySelectorAll(".tokui-carousel__dot") : [], i = b ? b.querySelectorAll(".tokui-carousel__thumb") : [], o = null;
15865
+ var e = 0, t = S(), r = v ? v.querySelectorAll(".tokui-carousel__dot") : [], i = y ? y.querySelectorAll(".tokui-carousel__thumb") : [], o = null;
15582
15866
  function s() {
15583
15867
  r.forEach && r.forEach(function(t, n) {
15584
15868
  n === e ? (t.classList.add("tokui-carousel__dot--active"), t.setAttribute("aria-current", "true")) : (t.classList.remove("tokui-carousel__dot--active"), t.removeAttribute("aria-current"));
@@ -15591,20 +15875,20 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15591
15875
  });
15592
15876
  }
15593
15877
  function u(n, r) {
15594
- n < 0 && (n = t.length - 1), n >= t.length && (n = 0), e = n, f.style.transform = "translateX(-" + e * 100 + "%)", s(), r && l("change", { index: e });
15878
+ n < 0 && (n = t.length - 1), n >= t.length && (n = 0), e = n, d.style.transform = "translateX(-" + e * 100 + "%)", s(), r && l("change", { index: e });
15595
15879
  }
15596
- _.addEventListener("click", function() {
15880
+ g.addEventListener("click", function() {
15597
15881
  u(e - 1, !0), p();
15598
- }), v.addEventListener("click", function() {
15882
+ }), _.addEventListener("click", function() {
15599
15883
  u(e + 1, !0), p();
15600
- }), y && y.addEventListener("click", function(e) {
15884
+ }), v && v.addEventListener("click", function(e) {
15601
15885
  var t = e.target.closest(".tokui-carousel__dot");
15602
15886
  t && (u(parseInt(t.getAttribute("data-index")), !0), p());
15603
- }), b && b.addEventListener("click", function(e) {
15887
+ }), y && y.addEventListener("click", function(e) {
15604
15888
  var t = e.target.closest(".tokui-carousel__thumb");
15605
15889
  t && (u(parseInt(t.getAttribute("data-index")), !0), p());
15606
15890
  });
15607
- function d() {
15891
+ function f() {
15608
15892
  if (!o) {
15609
15893
  var t = parseInt(a.auto);
15610
15894
  t && t > 0 && (o = setInterval(function() {
@@ -15613,30 +15897,30 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15613
15897
  }
15614
15898
  }
15615
15899
  function p() {
15616
- o && clearInterval(o), d();
15900
+ o && clearInterval(o), f();
15617
15901
  }
15618
15902
  function m() {
15619
15903
  o &&= (clearInterval(o), null);
15620
15904
  }
15621
- d(), c.addEventListener("mouseenter", m), c.addEventListener("mouseleave", d), c.addEventListener("focusin", m), c.addEventListener("focusout", d), c.setAttribute("tabindex", "0"), c.setAttribute("role", "region"), c.setAttribute("aria-roledescription", "carousel"), c.setAttribute("aria-label", n("carousel.aria")), c.addEventListener("keydown", function(t) {
15905
+ f(), c.addEventListener("mouseenter", m), c.addEventListener("mouseleave", f), c.addEventListener("focusin", m), c.addEventListener("focusout", f), c.setAttribute("tabindex", "0"), c.setAttribute("role", "region"), c.setAttribute("aria-roledescription", "carousel"), c.setAttribute("aria-label", n("carousel.aria")), c.addEventListener("keydown", function(t) {
15622
15906
  t.key === "ArrowLeft" ? (u(e - 1, !0), p()) : t.key === "ArrowRight" && (u(e + 1, !0), p());
15623
15907
  });
15624
- var h = 0, g = 0, x = 0, w = !1, T = 0, E = null, D = typeof window < "u" && window.requestAnimationFrame ? function(e) {
15908
+ var h = 0, b = 0, x = 0, w = !1, T = 0, E = null, D = typeof window < "u" && window.requestAnimationFrame ? function(e) {
15625
15909
  window.requestAnimationFrame(e);
15626
15910
  } : function(e) {
15627
15911
  e();
15628
15912
  };
15629
15913
  function O(t) {
15630
- g = t - h;
15631
- var n = -(e * x) + g;
15632
- f.style.transform = "translateX(" + n + "px)";
15914
+ b = t - h;
15915
+ var n = -(e * x) + b;
15916
+ d.style.transform = "translateX(" + n + "px)";
15633
15917
  }
15634
15918
  function k(e) {
15635
- w = !0, h = e, g = 0, E = null, x = c.offsetWidth, f.style.transition = "none", p();
15919
+ w = !0, h = e, b = 0, E = null, x = c.offsetWidth, d.style.transition = "none", p();
15636
15920
  }
15637
- f.addEventListener("mousedown", function(e) {
15921
+ d.addEventListener("mousedown", function(e) {
15638
15922
  k(e.clientX);
15639
- }), f.addEventListener("touchstart", function(e) {
15923
+ }), d.addEventListener("touchstart", function(e) {
15640
15924
  k(e.touches[0].clientX);
15641
15925
  }, { passive: !0 });
15642
15926
  function A(e) {
@@ -15651,17 +15935,17 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15651
15935
  }, { passive: !0 }));
15652
15936
  function j() {
15653
15937
  if (w) {
15654
- w = !1, E !== null && (O(E), E = null), f.style.transition = "";
15938
+ w = !1, E !== null && (O(E), E = null), d.style.transition = "";
15655
15939
  var t = x * .2;
15656
- g < -t ? u(e + 1, !0) : g > t ? u(e - 1, !0) : u(e);
15940
+ b < -t ? u(e + 1, !0) : b > t ? u(e - 1, !0) : u(e);
15657
15941
  }
15658
15942
  }
15659
15943
  typeof document < "u" && document.addEventListener && (document.addEventListener("mouseup", j), document.addEventListener("touchend", j));
15660
15944
  }
15661
- return g.length > 0 && w(), c._streamCloseHook = function() {
15945
+ return h.length > 0 && w(), c._streamCloseHook = function() {
15662
15946
  w();
15663
15947
  }, c;
15664
- }), e.register("carousel-item", (e, t) => d(e, t)), e.register("tn", (e, n) => {
15948
+ }), e.register("carousel-item", (e, t) => x(e, t)), e.register("tn", (e, n) => {
15665
15949
  var r = e.attrs.leaf !== void 0, i = e.attrs.open !== void 0, a = e.attrs.dis !== void 0, o = e.attrs.load && !(e.children && e.children.length) ? String(e.attrs.load) : null, s = t("div", {
15666
15950
  class: "tokui-tree-node" + (r ? " tokui-tree-node--leaf" : "") + (i ? " tokui-tree-node--open" : "") + (a ? " tokui-tree-node--disabled" : ""),
15667
15951
  role: "treeitem",
@@ -15849,12 +16133,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15849
16133
  return (n.children || []).filter(function(e) {
15850
16134
  return e.type === "menu-item";
15851
16135
  }).forEach(function(e) {
15852
- var t = m(e, s);
16136
+ var t = w(e, s);
15853
16137
  o.appendChild(t);
15854
16138
  }), o._slot = o, o._tokuiType = "menu", o._activeClk = s, o._report = e.createReporter("menu", i, o), o._update = function(e) {
15855
16139
  if (!(e.act !== "activate" || e.v === void 0)) {
15856
- for (var t = o.querySelectorAll(".tokui-menu__item"), n = 0; n < t.length; n++) if (f(t[n]) === String(e.v)) {
15857
- p(t[n], !0);
16140
+ for (var t = o.querySelectorAll(".tokui-menu__item"), n = 0; n < t.length; n++) if (S(t[n]) === String(e.v)) {
16141
+ C(t[n], !0);
15858
16142
  break;
15859
16143
  }
15860
16144
  }
@@ -15866,18 +16150,18 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15866
16150
  }
15867
16151
  }), o;
15868
16152
  });
15869
- function f(e) {
16153
+ function S(e) {
15870
16154
  if (e._menuValue !== void 0) return e._menuValue;
15871
16155
  var t = e.querySelector(".tokui-menu__text");
15872
16156
  return t ? t.textContent : e.textContent;
15873
16157
  }
15874
- function p(e, t) {
16158
+ function C(e, t) {
15875
16159
  var n = e.closest(".tokui-menu");
15876
16160
  n && n.querySelectorAll(".tokui-menu__item--active").forEach(function(e) {
15877
16161
  e.classList.remove("tokui-menu__item--active"), e.removeAttribute("aria-current");
15878
- }), e.classList.add("tokui-menu__item--active"), e.setAttribute("aria-current", "true"), !t && n && n._report && n._report("change", { value: f(e) });
16162
+ }), e.classList.add("tokui-menu__item--active"), e.setAttribute("aria-current", "true"), !t && n && n._report && n._report("change", { value: S(e) });
15879
16163
  }
15880
- function m(e, n) {
16164
+ function w(e, n) {
15881
16165
  var r = e.attrs || {}, i = ["tokui-menu__item"], a = r.dis !== void 0;
15882
16166
  a && i.push("tokui-menu__item--disabled"), n && r.clk === n && i.push("tokui-menu__item--active");
15883
16167
  var o = {
@@ -15893,7 +16177,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15893
16177
  }
15894
16178
  var l = t("span", { class: "tokui-menu__text" }, r.tx || e.content || "");
15895
16179
  return s.appendChild(l), s._menuValue = r.id || r.v || r.tx || e.content || "", r.dis === void 0 && (r.clk && s.setAttribute("data-tokui-clk", r.clk), s.addEventListener("click", function() {
15896
- p(s);
16180
+ C(s);
15897
16181
  })), s;
15898
16182
  }
15899
16183
  e.register("menu-item", (e) => {
@@ -15907,15 +16191,15 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15907
16191
  i && (a["aria-disabled"] = "true"), n.act !== void 0 && (a["aria-current"] = "true");
15908
16192
  var o = t("div", a);
15909
16193
  return o._tokuiKeySelf = !0, n.i && o.appendChild(t("span", { class: "tokui-menu__icon" }, n.i)), o.appendChild(t("span", { class: "tokui-menu__text" }, n.tx || e.content || "")), o._menuValue = n.id || n.v || n.tx || e.content || "", n.dis === void 0 && (n.clk && o.setAttribute("data-tokui-clk", n.clk), o.addEventListener("click", function() {
15910
- p(o);
16194
+ C(o);
15911
16195
  })), o;
15912
16196
  }), e.register("anchor", (r, i) => {
15913
16197
  var a = r.attrs || {}, o = t("nav", {
15914
16198
  class: "tokui-anchor",
15915
16199
  "aria-label": n("anchor.aria")
15916
16200
  });
15917
- a.id && (o.id = a.id), o._anchorOffset = parseInt(a.top) || 12, o._report = e.createReporter("anchor", a, o), v(a.opt).forEach(function(e) {
15918
- o.appendChild(_(o, e.v, e.tx, 0));
16201
+ a.id && (o.id = a.id), o._anchorOffset = parseInt(a.top) || 12, o._report = e.createReporter("anchor", a, o), E(a.opt).forEach(function(e) {
16202
+ o.appendChild(T(o, e.v, e.tx, 0));
15919
16203
  }), i(r.children || []).forEach(function(e) {
15920
16204
  e && e.nodeType && o.appendChild(e);
15921
16205
  }), o._slot = o, o._tokuiType = "anchor";
@@ -15928,7 +16212,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15928
16212
  if (s(), o._streamCloseHook = s, o._update = function(e) {
15929
16213
  if (e.v !== void 0) {
15930
16214
  for (var t = String(e.v).replace(/^#/, ""), n = o.querySelectorAll(".tokui-anchor__item"), r = 0; r < n.length; r++) if (n[r]._anchorValue === t) {
15931
- y(o, n[r], !0), o._spySuppressUntil = Date.now() + 900;
16215
+ D(o, n[r], !0), o._spySuppressUntil = Date.now() + 900;
15932
16216
  break;
15933
16217
  }
15934
16218
  }
@@ -15959,7 +16243,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15959
16243
  var l = document.getElementById(i[0]._anchorValue);
15960
16244
  l && typeof l.getBoundingClientRect == "function" && (a = i[0]);
15961
16245
  }
15962
- a && y(o, a, !0);
16246
+ a && D(o, a, !0);
15963
16247
  }
15964
16248
  }, r = !1, i = function() {
15965
16249
  r || (r = !0, c(function() {
@@ -15985,13 +16269,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
15985
16269
  a._anchorValue = r;
15986
16270
  function o() {
15987
16271
  var e = a.closest(".tokui-anchor");
15988
- e && (y(e, a, !1), e._spySuppressUntil = Date.now() + 900, b(r));
16272
+ e && (D(e, a, !1), e._spySuppressUntil = Date.now() + 900, O(r));
15989
16273
  }
15990
16274
  return a.addEventListener("click", o), a.addEventListener("keydown", function(e) {
15991
16275
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
15992
16276
  }), a;
15993
16277
  });
15994
- function _(e, n, r, i) {
16278
+ function T(e, n, r, i) {
15995
16279
  i = Math.min(i || 0, 3);
15996
16280
  var a = t("div", {
15997
16281
  class: "tokui-anchor__item" + (i > 0 ? " tokui-anchor__item--depth-" + i : ""),
@@ -16001,13 +16285,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16001
16285
  }, r);
16002
16286
  a._anchorValue = n;
16003
16287
  function o() {
16004
- y(e, a, !1), e._spySuppressUntil = Date.now() + 900, b(n);
16288
+ D(e, a, !1), e._spySuppressUntil = Date.now() + 900, O(n);
16005
16289
  }
16006
16290
  return a.addEventListener("click", o), a.addEventListener("keydown", function(e) {
16007
16291
  (e.key === "Enter" || e.key === " ") && (e.preventDefault(), o());
16008
16292
  }), a;
16009
16293
  }
16010
- function v(e) {
16294
+ function E(e) {
16011
16295
  return !e || typeof e != "string" ? [] : e.split(";").map(function(e) {
16012
16296
  return e.trim();
16013
16297
  }).filter(Boolean).map(function(e) {
@@ -16021,12 +16305,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16021
16305
  };
16022
16306
  });
16023
16307
  }
16024
- function y(e, t, n) {
16308
+ function D(e, t, n) {
16025
16309
  e.querySelectorAll(".tokui-anchor__item--active").forEach(function(e) {
16026
16310
  e.classList.remove("tokui-anchor__item--active"), e.removeAttribute("aria-current");
16027
16311
  }), t.classList.add("tokui-anchor__item--active"), t.setAttribute("aria-current", "true"), !n && e._report && e._report("change", { value: t._anchorValue });
16028
16312
  }
16029
- function b(e) {
16313
+ function O(e) {
16030
16314
  var t = document.getElementById(e);
16031
16315
  t && typeof t.scrollIntoView == "function" && t.scrollIntoView({
16032
16316
  behavior: "smooth",
@@ -16149,59 +16433,61 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16149
16433
  }, s._streamCloseHook = function() {
16150
16434
  y();
16151
16435
  }, s._tokuiType = "scroll-area", s;
16152
- }), e.register("sidebar", (e, r) => {
16153
- var i = e.attrs || {}, a = i.w || "260", o = i.pos || "left", s = i.collapsible !== void 0, c = i.bg || "", l = i.fc || "", u = ["tokui-sidebar", "tokui-sidebar--" + o];
16154
- s && u.push("tokui-sidebar--collapsible");
16155
- var d = { class: u.join(" ") };
16156
- i.id && (d.id = i.id);
16157
- var f = t("div", d);
16158
- f.style.setProperty("--tokui-sidebar-w", a + "px"), c && f.style.setProperty("--tokui-sidebar-bg", c), l && f.style.setProperty("--tokui-sidebar-fc", l), c && f.style.setProperty("--tokui-sidebar-footer-bg", "rgba(0,0,0,0.15)"), c && f.style.setProperty("--tokui-sidebar-header-bg", "rgba(0,0,0,0.15)"), c && f.style.setProperty("--tokui-sidebar-border", "rgba(255,255,255,0.1)");
16159
- var p = [], m = [], h = [];
16160
- if ((e.children || []).forEach(function(e) {
16161
- e.type === "sidebar-content" ? p.push(e) : e.type === "sidebar-footer" ? m.push(e) : h.push(e);
16162
- }), i.tt || s) {
16163
- var g = t("div", { class: "tokui-sidebar__header" });
16164
- if (i.tt) {
16165
- var _ = t("div", { class: "tokui-sidebar__title" }, i.tt);
16166
- g.appendChild(_);
16167
- }
16168
- if (s) {
16169
- var v = t("button", {
16436
+ }), e.register("sidebar", (r, i) => {
16437
+ var a = r.attrs || {}, o = a.w || "260", s = a.pos || "left", c = a.collapsible !== void 0, l = a.bg || "", u = a.fc || "", d = ["tokui-sidebar", "tokui-sidebar--" + s];
16438
+ c && d.push("tokui-sidebar--collapsible");
16439
+ var f = { class: d.join(" ") };
16440
+ a.id && (f.id = a.id);
16441
+ var p = t("div", f);
16442
+ p.style.setProperty("--tokui-sidebar-w", o + "px"), l && p.style.setProperty("--tokui-sidebar-bg", l), u && p.style.setProperty("--tokui-sidebar-fc", u), l && p.style.setProperty("--tokui-sidebar-footer-bg", "rgba(0,0,0,0.15)"), l && p.style.setProperty("--tokui-sidebar-header-bg", "rgba(0,0,0,0.15)"), l && p.style.setProperty("--tokui-sidebar-border", "rgba(255,255,255,0.1)");
16443
+ var m = [], h = [], g = [];
16444
+ if ((r.children || []).forEach(function(e) {
16445
+ e.type === "sidebar-content" ? m.push(e) : e.type === "sidebar-footer" ? h.push(e) : g.push(e);
16446
+ }), a.tt || c) {
16447
+ var _ = t("div", { class: "tokui-sidebar__header" });
16448
+ if (a.tt) {
16449
+ var v = t("div", { class: "tokui-sidebar__title" }, a.tt);
16450
+ _.appendChild(v);
16451
+ }
16452
+ if (c) {
16453
+ var y = t("button", {
16170
16454
  class: "tokui-sidebar__toggle",
16171
16455
  "aria-label": n("sidebar.toggle"),
16172
16456
  "aria-expanded": "true",
16173
16457
  type: "button"
16174
16458
  });
16175
- v.textContent = "☰", v.addEventListener("click", function() {
16176
- f.classList.toggle("tokui-sidebar--collapsed");
16177
- var e = f.classList.contains("tokui-sidebar--collapsed");
16178
- v.setAttribute("aria-expanded", String(!e));
16179
- }), f._toggleBtn = v, g.appendChild(v);
16180
- }
16181
- f.appendChild(g);
16182
- }
16183
- var y = t("div", { class: "tokui-sidebar__content" });
16184
- if (p.forEach(function(e) {
16185
- r(e.children || []).forEach(function(e) {
16186
- e && e.nodeType && y.appendChild(e);
16459
+ y.textContent = "☰";
16460
+ var b = e.createReporter("sidebar", a, p);
16461
+ y.addEventListener("click", function() {
16462
+ p.classList.toggle("tokui-sidebar--collapsed");
16463
+ var e = p.classList.contains("tokui-sidebar--collapsed");
16464
+ y.setAttribute("aria-expanded", String(!e)), b("toggle", { collapsed: e });
16465
+ }), p._toggleBtn = y, _.appendChild(y);
16466
+ }
16467
+ p.appendChild(_);
16468
+ }
16469
+ var x = t("div", { class: "tokui-sidebar__content" });
16470
+ if (m.forEach(function(e) {
16471
+ i(e.children || []).forEach(function(e) {
16472
+ e && e.nodeType && x.appendChild(e);
16187
16473
  });
16188
- }), r(h).forEach(function(e) {
16189
- e && e.nodeType && y.appendChild(e);
16190
- }), f.appendChild(y), m.length > 0) {
16191
- var b = t("div", { class: "tokui-sidebar__footer" });
16192
- m.forEach(function(e) {
16193
- r(e.children || []).forEach(function(e) {
16194
- e && e.nodeType && b.appendChild(e);
16474
+ }), i(g).forEach(function(e) {
16475
+ e && e.nodeType && x.appendChild(e);
16476
+ }), p.appendChild(x), h.length > 0) {
16477
+ var S = t("div", { class: "tokui-sidebar__footer" });
16478
+ h.forEach(function(e) {
16479
+ i(e.children || []).forEach(function(e) {
16480
+ e && e.nodeType && S.appendChild(e);
16195
16481
  });
16196
- }), f.appendChild(b);
16482
+ }), p.appendChild(S);
16197
16483
  }
16198
- return f._slot = y, f._tokuiType = "sidebar", f._update = function(e) {
16484
+ return p._slot = x, p._tokuiType = "sidebar", p._update = function(e) {
16199
16485
  if (e.tt !== void 0) {
16200
- var t = f.querySelector(".tokui-sidebar__title");
16486
+ var t = p.querySelector(".tokui-sidebar__title");
16201
16487
  t && (t.textContent = e.tt);
16202
16488
  }
16203
- e.act === "collapse" ? f.classList.add("tokui-sidebar--collapsed") : e.act === "expand" ? f.classList.remove("tokui-sidebar--collapsed") : e.act === "toggle" && f.classList.toggle("tokui-sidebar--collapsed"), e.act && f._toggleBtn && f._toggleBtn.setAttribute("aria-expanded", String(!f.classList.contains("tokui-sidebar--collapsed")));
16204
- }, e._dsl !== void 0 && (f._dslNode = e), f;
16489
+ e.act === "collapse" ? p.classList.add("tokui-sidebar--collapsed") : e.act === "expand" ? p.classList.remove("tokui-sidebar--collapsed") : e.act === "toggle" && p.classList.toggle("tokui-sidebar--collapsed"), e.act && p._toggleBtn && p._toggleBtn.setAttribute("aria-expanded", String(!p.classList.contains("tokui-sidebar--collapsed")));
16490
+ }, r._dsl !== void 0 && (p._dslNode = r), p;
16205
16491
  }), e.register("sidebar-content", (e, n) => {
16206
16492
  var r = t("div", { class: "tokui-sidebar__content" });
16207
16493
  return n(e.children || []).forEach(function(e) {
@@ -16244,8 +16530,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
16244
16530
  theme: "default",
16245
16531
  locale: null,
16246
16532
  streaming: !0,
16533
+ streamAnimation: !0,
16247
16534
  onEvent: null
16248
- }, e), this.renderer = new n(i), s(this.renderer), this.renderer._tokuiInstance = this;
16535
+ }, e), this.renderer = new n(i), s(this.renderer), this.renderer.streamAnimation = this.options.streamAnimation !== !1, this.renderer._tokuiInstance = this;
16249
16536
  var t = this;
16250
16537
  this.renderer._onComponentEvent = function(e) {
16251
16538
  t.options.eventFilter && !t.options.eventFilter(e) || t.options.onEvent && t.options.onEvent("component", e);