@jboltai/tokui 0.1.0 → 0.1.2

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
@@ -225,13 +225,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
225
225
  else if (e[n] === "]" && !t) return n;
226
226
  return -1;
227
227
  }
228
- var r = new Set(/* @__PURE__ */ "form.table.thead.tbody.card.ft.row.col.list.select.radio.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.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.p".split("."));
229
- function i(e) {
228
+ function r(e) {
229
+ let t = !1, n = 0;
230
+ for (let r = 0; r < e.length; r++) {
231
+ let i = e[r];
232
+ if (i === "\"") t = !t;
233
+ else if (!t) {
234
+ if (i === "[") n++;
235
+ else if (i === "]") {
236
+ if (n === 0) return r;
237
+ n--;
238
+ }
239
+ }
240
+ }
241
+ return -1;
242
+ }
243
+ var i = new Set(/* @__PURE__ */ "form.table.thead.tbody.card.ft.row.col.list.select.radio.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.p".split("."));
244
+ function a(e) {
230
245
  if (!e || e.type !== "chart") return !1;
231
246
  var t = e.attrs || {};
232
247
  return !!(t.d || t.tasks || t.rows || t.nodes && t.flows || t.v !== void 0 && (t.t === "gauge" || t.t === "progress"));
233
248
  }
234
- var a = new Set([
249
+ var o = new Set([
235
250
  "a",
236
251
  "_text",
237
252
  "tag",
@@ -244,8 +259,30 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
244
259
  "mark",
245
260
  "sub",
246
261
  "sup"
247
- ]), o = 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.open.active.collapsible.toggle.search".split("."));
248
- function s(e) {
262
+ ]), s = 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.open.active.collapsible.toggle.search.thumb.reset.print".split(".")), c = null;
263
+ function l(e) {
264
+ c = e;
265
+ }
266
+ function u(e) {
267
+ if (c) return c[e];
268
+ if (typeof window < "u" && window.TokUI && window.TokUI._internal) {
269
+ var t = window.TokUI._internal.VARIANTS;
270
+ return t ? t[e] : null;
271
+ }
272
+ return null;
273
+ }
274
+ var d = new Set(/* @__PURE__ */ "t.l.tx.tt.ph.u.s.n.v.w.h.clk.sub.act.mtd.dis.ro.req.chk.id.bg.fc.cap.cols.span.min.max.step.alt.target.src.name.value.pre.pos".split("."));
275
+ function f(e, t) {
276
+ for (var n = [];;) {
277
+ var r = t.match(/^([\s\S]*?[^\x00-\x7f])([a-zA-Z][a-zA-Z0-9]{0,6}):([\s\S]*)$/);
278
+ if (!r) break;
279
+ var i = r[2];
280
+ if (!d.has(i)) break;
281
+ n.push([e, r[1]]), e = i, t = r[3];
282
+ }
283
+ return n.push([e, t]), n;
284
+ }
285
+ function p(e) {
249
286
  if (!e || !e.trim()) return {
250
287
  type: "_text",
251
288
  attrs: {},
@@ -261,19 +298,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
261
298
  t.type = r[0];
262
299
  let i = [];
263
300
  for (let e = 1; e < r.length; e++) {
264
- let a = r[e], s = a.indexOf(":");
265
- if (s > 0) {
266
- let e = a.slice(0, s);
301
+ let a = r[e], o = a.indexOf(":");
302
+ if (o > 0) {
303
+ let e = a.slice(0, o);
267
304
  if (/^[a-zA-Z][a-zA-Z0-9_-]*$/.test(e)) {
268
- let r = a.slice(s + 1);
269
- r = r.replace(/__QUOTE(\d+)__/g, (e, t) => n[parseInt(t)]), t.attrs[e] = r;
305
+ let r = a.slice(o + 1);
306
+ r = r.replace(/__QUOTE(\d+)__/g, (e, t) => n[parseInt(t)]), /[^\x00-\x7f]/.test(r) && r.indexOf(":") !== -1 ? f(e, r).forEach(function(e) {
307
+ t.attrs[e[0]] = e[1];
308
+ }) : t.attrs[e] = r;
270
309
  } else {
271
310
  let e = a.replace(/__QUOTE(\d+)__/g, (e, t) => `"${n[parseInt(t)]}"`);
272
311
  i.push(e);
273
312
  }
274
313
  } else {
275
314
  let e = a.replace(/__QUOTE(\d+)__/g, (e, t) => n[parseInt(t)]);
276
- if (o.has(e)) t.attrs[e] = !0;
315
+ if (t.attrs.v) {
316
+ let n = u(t.type);
317
+ if (n && n.has && n.has(e)) {
318
+ t.attrs.v = t.attrs.v + "," + e;
319
+ continue;
320
+ }
321
+ }
322
+ if (s.has(e)) t.attrs[e] = !0;
277
323
  else {
278
324
  let e = a.match(/^__QUOTE(\d+)__$/);
279
325
  if (e) i.push(n[parseInt(e[1])]);
@@ -292,12 +338,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
292
338
  };
293
339
  return a[t.type] && ((t.type === "ol" || t.type === "ul") && (t.attrs.t = t.type), t.type = a[t.type]), t;
294
340
  }
295
- var c = class {
341
+ var m = class {
296
342
  constructor(e, t) {
297
343
  this.onNode = e || (() => {}), this.streaming = t && t.streaming !== !1, this.maxBuffer = t && t.maxBuffer || 1048576, this.maxDepth = t && t.maxDepth || 100, this.buffer = "", this.stack = [], this.state = "TEXT", this._totalOffset = 0, this._dslText = "", this._tagStartPos = -1;
298
344
  }
299
345
  reset() {
300
- this.buffer = "", this.stack = [], this.state = "TEXT", this._totalOffset = 0, this._dslText = "", this._tagStartPos = -1;
346
+ this.buffer = "", this.stack = [], this.state = "TEXT", this._totalOffset = 0, this._dslText = "", this._tagStartPos = -1, this._lastTrPreview = "", this._trOpenKey = -2;
301
347
  }
302
348
  feed(e) {
303
349
  if (this.buffer.length + e.length > this.maxBuffer && (console.warn("TokUI Parser: buffer 超过 maxBuffer (" + this.maxBuffer + "),截断输入"), e = e.slice(0, this.maxBuffer - this.buffer.length)), this._dslText += e, this.buffer += e, this._tryParse(), this.streaming && this.state === "TEXT" && this.stack.length > 0 && !this._isRawContent() && !this.buffer.startsWith("[")) {
@@ -339,18 +385,31 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
339
385
  let e = this.buffer;
340
386
  if ((e.match(/"/g) || []).length % 2 == 1 && (/\b(d|tasks|rows|nodes|flows)\s*:\s*"[^"]*$/.test(e) ? e += "\"" : e = null), e !== null) {
341
387
  this._lastChartPreview = this.buffer;
342
- let t = s(e);
343
- t.type === "chart" && i(t) && (t._streamPreview = !0, t._previewKey = this._tagStartPos, this.onNode(t));
388
+ let t = p(e);
389
+ t.type === "chart" && a(t) && (t._streamPreview = !0, t._previewKey = this._tagStartPos, this.onNode(t));
344
390
  }
345
391
  }
346
392
  if (this.streaming && this.state === "TAG_OPEN" && /^(hrow|flow)\s/.test(this.buffer) && /\bv\s*:/.test(this.buffer) && this.buffer !== this._lastKidPreview) {
347
393
  let e = this.buffer;
348
394
  if ((e.match(/"/g) || []).length % 2 == 1 && (/\bv\s*:\s*"[^"]*$/.test(e) ? e += "\"" : e = null), e !== null) {
349
395
  this._lastKidPreview = this.buffer;
350
- let t = s(e);
396
+ let t = p(e);
351
397
  (t.type === "hrow" || t.type === "flow") && (t._kidPreview = !0, this.onNode(t));
352
398
  }
353
399
  }
400
+ if (this.streaming && this.state === "TAG_OPEN" && /^tr\b/.test(this.buffer) && this.buffer !== this._lastTrPreview) {
401
+ let e = this.buffer;
402
+ if ((e.match(/"/g) || []).length % 2 == 1 && (/"[^"]*$/.test(e) ? e += "\"" : e = null), e !== null) {
403
+ this._lastTrPreview = this.buffer;
404
+ let t = p(e);
405
+ t.type === "tr" && (this._trOpenKey !== this._tagStartPos && (this._trOpenKey = this._tagStartPos, this.onNode({
406
+ type: "tr",
407
+ _stream: "open",
408
+ _trKey: this._tagStartPos,
409
+ attrs: t.attrs
410
+ })), t._stream = "preview", t._trKey = this._tagStartPos, this.onNode(t));
411
+ }
412
+ }
354
413
  }
355
414
  parse(e) {
356
415
  this.reset(), this._dslText = e, this.buffer = e, this._tryParse(), this._flush();
@@ -467,28 +526,28 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
467
526
  this.buffer = this.buffer.slice(1), this._totalOffset += 1, this.state = "TAG_CLOSE";
468
527
  continue;
469
528
  }
470
- let e = n(this.buffer);
529
+ let e = /^tr\b/.test(this.buffer) ? r(this.buffer) : n(this.buffer);
471
530
  if (e === -1) break;
472
- let t = e, i = !0, a = this.buffer.slice(0, e), o = -1;
531
+ let t = e, a = !0, o = this.buffer.slice(0, e), s = -1;
473
532
  {
474
533
  let e = !1;
475
- for (let t = 0; t < a.length; t++) {
476
- let n = a[t];
534
+ for (let t = 0; t < o.length; t++) {
535
+ let n = o[t];
477
536
  if (n === "\"") e = !e;
478
537
  else if (n === "[" && !e) {
479
- o = t;
538
+ s = t;
480
539
  break;
481
540
  }
482
541
  }
483
542
  }
484
- if (o > 0 && !this._isRawContent()) {
485
- let e = s(a.slice(0, o).trim());
486
- r.has(e.type) && (t = o, i = !1);
543
+ if (s > 0 && !this._isRawContent()) {
544
+ let e = p(o.slice(0, s).trim());
545
+ i.has(e.type) && (t = s, a = !1);
487
546
  }
488
547
  let c = this.buffer.slice(0, t);
489
- this.buffer = this.buffer.slice(t + +!!i);
490
- let l = s(c);
491
- if (i || (l._implicitOpen = !0), l._dslStart = this._tagStartPos, l._dslEnd = this._totalOffset + t + +!!i, l._dsl = this._dslText.slice(l._dslStart, l._dslEnd), this._totalOffset = l._dslEnd, this.streaming ? this._emitStreaming(l) : this._emitBuffered(l), this.state = "TEXT", !i) continue;
548
+ this.buffer = this.buffer.slice(t + +!!a);
549
+ let l = p(c);
550
+ if (a || (l._implicitOpen = !0), l._dslStart = this._tagStartPos, l._dslEnd = this._totalOffset + t + +!!a, l._dsl = this._dslText.slice(l._dslStart, l._dslEnd), this._totalOffset = l._dslEnd, this.streaming ? this._emitStreaming(l) : this._emitBuffered(l), this.state = "TEXT", !a) continue;
492
551
  }
493
552
  if (this.state === "TAG_CLOSE") {
494
553
  let e = this.buffer.indexOf("]");
@@ -539,17 +598,19 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
539
598
  e._stream = "close", this.onNode(e);
540
599
  }
541
600
  let t = this.stack.length > 0 && this.stack[this.stack.length - 1].type === "p" ? this.stack[this.stack.length - 1] : null;
542
- if (t && t.content && !a.has(e.type)) {
601
+ if (t && t.content && !o.has(e.type)) {
543
602
  let e = this.stack.pop();
544
603
  e._stream = "close", this.onNode(e);
545
604
  }
605
+ e.type === "tr" && this._trOpenKey === e._dslStart && (e._stream = "finalize", e._trKey = e._dslStart);
546
606
  let n = new Set([
547
607
  "tn",
548
608
  "popover",
549
609
  "input-tag",
550
- "watermark"
551
- ]), o = r.has(e.type) && !n.has(e.type) && e.attrs.tx, s = e.type === "tn" && e.attrs.leaf !== void 0, c = e.type === "input-tag" && e.attrs.tags, l = o || s || c, u = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart", d = i(e);
552
- d && (e._previewKey = e._dslStart), r.has(e.type) && !u && !l && !d ? 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));
610
+ "watermark",
611
+ "badge-box"
612
+ ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, s = e.type === "tn" && e.attrs.leaf !== void 0, c = e.type === "input-tag" && e.attrs.tags, l = r || s || c, u = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart", d = a(e);
613
+ d && (e._previewKey = e._dslStart), i.has(e.type) && !u && !l && !d ? 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));
553
614
  }
554
615
  _emitBuffered(e) {
555
616
  if (e.type === "item") for (; this.stack.length > 0 && this.stack[this.stack.length - 1].type === "item";) {
@@ -557,7 +618,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
557
618
  this.stack.length > 0 && this.stack[this.stack.length - 1].children.push(e);
558
619
  }
559
620
  let t = this.stack.length > 0 && this.stack[this.stack.length - 1].type === "p" ? this.stack[this.stack.length - 1] : null;
560
- if (t && t.content && !a.has(e.type)) {
621
+ if (t && t.content && !o.has(e.type)) {
561
622
  let e = this.stack.pop();
562
623
  this.stack.length > 0 ? this.stack[this.stack.length - 1].children.push(e) : this.onNode(e);
563
624
  }
@@ -565,9 +626,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
565
626
  "tn",
566
627
  "popover",
567
628
  "input-tag",
568
- "watermark"
569
- ]), o = r.has(e.type) && !n.has(e.type) && e.attrs.tx, s = e.type === "tn" && e.attrs.leaf !== void 0, c = e.type === "input-tag" && e.attrs.tags, l = o || s || c, u = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart", d = i(e);
570
- d && (e._previewKey = e._dslStart), r.has(e.type) && !u && !l && !d ? 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);
629
+ "watermark",
630
+ "badge-box"
631
+ ]), r = i.has(e.type) && !n.has(e.type) && e.attrs.tx, s = e.type === "tn" && e.attrs.leaf !== void 0, c = e.type === "input-tag" && e.attrs.tags, l = r || s || c, u = e.attrs.cols && e.type !== "desc" && e.type !== "suggestions" && e.type !== "chart", d = a(e);
632
+ d && (e._previewKey = e._dslStart), i.has(e.type) && !u && !l && !d ? 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);
571
633
  }
572
634
  startStream() {
573
635
  this.reset();
@@ -576,13 +638,63 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
576
638
  this._flush();
577
639
  }
578
640
  };
579
- typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.TokUIParser = c, window.TokUI._internal.parseTag = s, window.TokUI._internal.CONTAINERS = r), t !== void 0 && t.exports && (t.exports = {
580
- TokUIParser: c,
581
- parseTag: s,
582
- CONTAINERS: r
641
+ typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.TokUIParser = m, window.TokUI._internal.parseTag = p, window.TokUI._internal.setVariantHints = l, window.TokUI._internal.CONTAINERS = i), t !== void 0 && t.exports && (t.exports = {
642
+ TokUIParser: m,
643
+ parseTag: p,
644
+ setVariantHints: l,
645
+ CONTAINERS: i
583
646
  });
584
647
  })), m = /* @__PURE__ */ o(((e, t) => {
585
- function n(e, t, n) {
648
+ function n(e) {
649
+ var t = e || {}, n = t.form != null && t.form !== "" ? String(t.form) : null;
650
+ return t.print === void 0 ? t.reset === void 0 ? t.sub !== void 0 && t.sub !== !1 && t.sub !== "" ? {
651
+ act: "submit",
652
+ formId: n,
653
+ handler: t.sub === !0 ? null : String(t.sub),
654
+ target: null,
655
+ trigger: !1
656
+ } : {
657
+ act: null,
658
+ formId: n,
659
+ handler: t.clk ? String(t.clk) : null,
660
+ target: null,
661
+ trigger: !1
662
+ } : {
663
+ act: "reset",
664
+ formId: n,
665
+ handler: t.reset === !0 || t.reset === "" || t.reset == null ? null : String(t.reset),
666
+ target: null,
667
+ trigger: !1
668
+ } : {
669
+ act: "print",
670
+ formId: n,
671
+ handler: null,
672
+ target: t.print === !0 || t.print === "" || t.print == null ? "self" : String(t.print),
673
+ trigger: !0
674
+ };
675
+ }
676
+ function r(e, t) {
677
+ if (!e) return null;
678
+ if (t) {
679
+ var n = e.ownerDocument && e.ownerDocument.getElementById ? e.ownerDocument : typeof document < "u" ? document : null, r = n && n.getElementById ? n.getElementById(t) : null;
680
+ if (r && r.tagName === "FORM") return r;
681
+ }
682
+ return e.closest ? e.closest("form") : null;
683
+ }
684
+ function i(e, t) {
685
+ if (!e) return null;
686
+ if (t && t !== "self") {
687
+ var n = e.ownerDocument && e.ownerDocument.getElementById ? e.ownerDocument : typeof document < "u" ? document : null;
688
+ return n && n.getElementById ? n.getElementById(t) : null;
689
+ }
690
+ return e.closest && (e.closest(".tokui-print-area") || e.closest(".tokui-card")) || null;
691
+ }
692
+ function a(e) {
693
+ if (e && typeof CustomEvent == "function" && typeof e.dispatchEvent == "function") try {
694
+ e.dispatchEvent(new CustomEvent("tokuireset", { bubbles: !0 }));
695
+ } catch {}
696
+ }
697
+ function o(e, t, n) {
586
698
  let r = document.createElement(e);
587
699
  return t && Object.entries(t).forEach(([e, t]) => {
588
700
  if (t != null && !(e.startsWith("on") || e === "formaction")) {
@@ -594,7 +706,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
594
706
  }
595
707
  }), n != null && (r.textContent = n), r;
596
708
  }
597
- var r = {
709
+ var s = {
598
710
  img: new Set([
599
711
  "avatar",
600
712
  "rounded",
@@ -756,7 +868,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
756
868
  cascader: new Set(["error", "success"]),
757
869
  upload: new Set(["sm", "lg"]),
758
870
  tree: new Set(["sm", "lg"])
759
- }, i = class {
871
+ }, c = class {
760
872
  constructor(e) {
761
873
  this.registry = {}, this.eventBus = e, this.slotStack = [], this._boundElements = [], this._onError = null;
762
874
  }
@@ -766,32 +878,32 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
766
878
  onError(e) {
767
879
  this._onError = e;
768
880
  }
769
- render(e, t, r) {
770
- if ((r || 0) > 50) return console.warn("TokUI Renderer: 渲染深度超过 50,可能存在循环嵌套"), document.createTextNode("");
881
+ render(e, t, n) {
882
+ if ((n || 0) > 50) return console.warn("TokUI Renderer: 渲染深度超过 50,可能存在循环嵌套"), document.createTextNode("");
771
883
  if (e.type === "_text") return document.createTextNode(e.content);
772
- let i = this.registry[e.type];
773
- if (!i) {
774
- let t = n("div", {
884
+ let r = this.registry[e.type];
885
+ if (!r) {
886
+ let t = o("div", {
775
887
  class: "tokui-unknown",
776
888
  "data-tokui-type": e.type
777
889
  });
778
890
  return e.content && (t.textContent = e.content), t;
779
891
  }
780
- var a = this, o = r || 0;
781
- let s = (t) => t.map((t) => a.render(t, e.type, o + 1));
892
+ var i = this, a = n || 0;
893
+ let s = (t) => t.map((t) => i.render(t, e.type, a + 1));
782
894
  var c;
783
895
  try {
784
- c = i(e, s, t);
896
+ c = r(e, s, t);
785
897
  } catch (t) {
786
- if (console.warn("TokUI Renderer: 组件渲染异常", e.type, t), a._onError) try {
787
- a._onError(e.type, t, e);
898
+ if (console.warn("TokUI Renderer: 组件渲染异常", e.type, t), i._onError) try {
899
+ i._onError(e.type, t, e);
788
900
  } catch {}
789
- var l = n("details", {
901
+ var l = o("details", {
790
902
  class: "tokui-error",
791
903
  "data-tokui-type": e.type
792
- }), u = n("summary", { class: "tokui-error__summary" });
904
+ }), u = o("summary", { class: "tokui-error__summary" });
793
905
  u.textContent = "[" + e.type + "] 渲染失败", l.appendChild(u);
794
- var d = n("div", { class: "tokui-error__detail" });
906
+ var d = o("div", { class: "tokui-error__detail" });
795
907
  d.textContent = String(t.message || t), l.appendChild(d), c = l;
796
908
  }
797
909
  return this._applyVariants(c, e), c && c.nodeType === 1 && e.type && e.type !== "_text" && c.setAttribute("data-tokui-tag", e.type), c;
@@ -799,13 +911,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
799
911
  _applyVariants(e, t) {
800
912
  var n = t.attrs && t.attrs.v;
801
913
  if (!(!n || !e || e.nodeType !== 1)) {
802
- var i = r[t.type];
803
- if (i) {
804
- var a = e._variantTarget || e;
914
+ var r = s[t.type];
915
+ if (r) {
916
+ var i = e._variantTarget || e;
805
917
  n.split(",").map(function(e) {
806
918
  return e.trim();
807
919
  }).filter(Boolean).forEach(function(e) {
808
- i.has(e) && a.classList.add("tokui-" + t.type + "--" + e);
920
+ r.has(e) && i.classList.add("tokui-" + t.type + "--" + e);
809
921
  });
810
922
  }
811
923
  }
@@ -815,7 +927,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
815
927
  return n.nodeType === 1 && (n.style.animation = "tokuiFadeIn 0.3s ease"), t.appendChild(n), this.bindEvents(n), n._streamCloseHook && n._streamCloseHook(), n;
816
928
  }
817
929
  mountStreaming(e, t) {
818
- return e._streamPreview ? this._streamChartPreview(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);
930
+ return 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);
819
931
  }
820
932
  _streamChartPreview(e, t) {
821
933
  this._pendingCharts = this._pendingCharts || {};
@@ -829,34 +941,54 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
829
941
  let n = e._previewKey, r = this._pendingCharts[n];
830
942
  return r ? (r._tokuiChartUpdate && r._tokuiChartUpdate(e.attrs), delete this._pendingCharts[n], r) : this._streamChild(e, t);
831
943
  }
944
+ _streamTrOpen(e, t) {
945
+ var n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null;
946
+ n && n.el && (e._tbodyEl = n.el);
947
+ var r = this.render(e, n ? n.containerType : void 0);
948
+ return r && r.nodeType === 1 && (r.style.animation = "tokuiFadeIn 0.3s ease"), (n ? n.slot : t).appendChild(r), this._trRegistry = this._trRegistry || {}, this._trRegistry[e._trKey] = r, r;
949
+ }
950
+ _streamTrPreview(e) {
951
+ this._trRegistry = this._trRegistry || {};
952
+ var t = this._trRegistry[e._trKey];
953
+ return t && t._tokuiTrReconcile && t._tokuiTrReconcile(e.content || "", !1, e.attrs), t;
954
+ }
955
+ _streamTrFinalize(e, t) {
956
+ this._trRegistry = this._trRegistry || {};
957
+ var n = this._trRegistry[e._trKey];
958
+ return n ? (n._tokuiTrReconcile && n._tokuiTrReconcile(e.content || "", !0, e.attrs), delete this._trRegistry[e._trKey], n) : this._streamChild(e, t);
959
+ }
832
960
  _streamOpen(e, t) {
833
- let n = this.render(e);
834
- n.nodeType === 1 && !n.classList.contains("tokui-hover-card__content-temp") && (n.style.animation = "tokuiFadeIn 0.3s ease");
835
- let r = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1].slot : t;
961
+ let n = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1] : null, r = this.render(e, n ? n.containerType : void 0);
962
+ r && r.nodeType === 1 && (r._tokuiStreamActive = !0), r.nodeType === 1 && !r.classList.contains("tokui-hover-card__content-temp") && (r.style.animation = "tokuiFadeIn 0.3s ease");
963
+ let i = this.slotStack.length > 0 ? this.slotStack[this.slotStack.length - 1].slot : t;
836
964
  if (e.type === "ft" && this.slotStack.length > 0) {
837
965
  let e = this.slotStack[this.slotStack.length - 1];
838
- (e.containerType === "card" || e.containerType === "dialog" || e.containerType === "drawer") && (r = e.el);
966
+ (e.containerType === "card" || e.containerType === "dialog" || e.containerType === "drawer") && (i = e.el);
839
967
  }
840
- if (e.type === "tab" && n._isTab && this.slotStack.length > 0) {
968
+ if (e.type === "tab" && r._isTab && this.slotStack.length > 0) {
841
969
  let t = this.slotStack[this.slotStack.length - 1];
842
970
  if (t.containerType === "tabs" && t.el._tabId) {
843
- let r = t.el, i = r._tabId, a = r._tabCount || 0, o = document.createElement("input");
844
- o.type = "radio", o.name = i, o.className = "tokui-tabs-input", o.id = i + "-" + a, o.setAttribute("data-index", String(a)), a === 0 && (o.checked = !0), r.appendChild(o);
971
+ let n = t.el, i = n._tabId, a = n._tabCount || 0, o = document.createElement("input");
972
+ o.type = "radio", o.name = i, o.className = "tokui-tabs-input", o.id = i + "-" + a, o.setAttribute("data-index", String(a)), o.checked = !0, n.appendChild(o);
845
973
  let s = document.createElement("label");
846
- return s.className = "tokui-tabs-label", s.setAttribute("for", i + "-" + a), s.setAttribute("data-index", String(a)), s.setAttribute("data-tokui-tag", "tab"), s.textContent = n._tabTitle || "Tab " + (a + 1), r.appendChild(s), n.setAttribute("data-index", String(a)), r.appendChild(n), r._tabCount = a + 1, this.slotStack.push({
847
- slot: n._slot || n,
848
- el: n,
974
+ return s.className = "tokui-tabs-label", s.setAttribute("for", i + "-" + a), s.setAttribute("data-index", String(a)), s.setAttribute("data-tokui-tag", "tab"), s.textContent = r._tabTitle || "Tab " + (a + 1), n.appendChild(s), r.setAttribute("data-index", String(a)), n.appendChild(r), n._tabCount = a + 1, this.slotStack.push({
975
+ slot: r._slot || r,
976
+ el: r,
849
977
  containerType: e.type
850
- }), n;
978
+ }), r;
851
979
  }
852
980
  }
853
- r.appendChild(n);
854
- let i = n._slot || n;
981
+ if (e.type === "collapse" && this.slotStack.length > 0 && this.slotStack[this.slotStack.length - 1].containerType === "accordion") {
982
+ for (var a = this.slotStack[this.slotStack.length - 1].el.querySelectorAll(".tokui-collapse"), o = 0; o < a.length; o++) a[o] !== r && (a[o].removeAttribute("open"), a[o].setAttribute("aria-expanded", "false"));
983
+ r.setAttribute("open", ""), r.setAttribute("aria-expanded", "true");
984
+ }
985
+ i.appendChild(r);
986
+ let s = r._slot || r;
855
987
  return this.slotStack.push({
856
- slot: i,
857
- el: n,
988
+ slot: s,
989
+ el: r,
858
990
  containerType: e.type
859
- }), n;
991
+ }), r;
860
992
  }
861
993
  _streamClose(e) {
862
994
  for (; this.slotStack.length > 0;) {
@@ -991,12 +1123,109 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
991
1123
  });
992
1124
  }
993
1125
  }
1126
+ let i = [];
1127
+ e.hasAttribute && e.hasAttribute("data-tokui-act") && i.push(e), e.querySelectorAll("[data-tokui-act]").forEach((e) => i.push(e)), i.forEach((e) => {
1128
+ if (e._tokuiActBound) return;
1129
+ e._tokuiActBound = !0;
1130
+ let n = e.getAttribute("data-tokui-act"), r = e.getAttribute("data-tokui-form");
1131
+ var i = function(i) {
1132
+ i && typeof i.preventDefault == "function" && i.preventDefault(), n === "submit" ? t._doSubmit(e, r) : n === "reset" ? t._doReset(e, r) : n === "print" && t._triggerPrint(e);
1133
+ };
1134
+ e.addEventListener("click", i), t._boundElements.push({
1135
+ element: e,
1136
+ listeners: [{
1137
+ type: "click",
1138
+ fn: i
1139
+ }]
1140
+ });
1141
+ });
1142
+ }
1143
+ _doSubmit(e, t) {
1144
+ var n = r(e, t);
1145
+ if (n) {
1146
+ var i = e.getAttribute("data-tokui-sub"), a = this._collectFormData(n);
1147
+ if (i) {
1148
+ var o = this.eventBus.getHandler(i);
1149
+ o && o(a, null, n);
1150
+ }
1151
+ }
1152
+ }
1153
+ _doReset(e, t) {
1154
+ var n = r(e, t);
1155
+ if (n) {
1156
+ if (typeof n.reset == "function") try {
1157
+ n.reset();
1158
+ } catch {}
1159
+ a(n), n.querySelectorAll("[data-tokui-resettable]").forEach(function(e) {
1160
+ typeof e._tokuiReset == "function" && e._tokuiReset();
1161
+ });
1162
+ var i = e.getAttribute("data-tokui-handler");
1163
+ if (i) {
1164
+ var o = this.eventBus.getHandler(i);
1165
+ o && o(null, null, n);
1166
+ }
1167
+ }
1168
+ }
1169
+ _triggerPrint(e) {
1170
+ var t = i(e, e.getAttribute("data-tokui-target") || "self");
1171
+ if (t && !(typeof window > "u" || typeof document > "u" || !document.body || typeof window.print != "function")) {
1172
+ t.classList.add("tokui-print-target"), document.body.setAttribute("data-tokui-printing", "1");
1173
+ for (var n = [], r = document.body.children || [], a = 0; a < r.length; a++) {
1174
+ var o = r[a];
1175
+ o && o.nodeType === 1 && o !== t && !(o.contains && o.contains(t)) && (o.setAttribute("data-tokui-print-hidden", "1"), n.push(o));
1176
+ }
1177
+ for (var s = [
1178
+ ["position", "static"],
1179
+ ["transform", "none"],
1180
+ ["perspective", "none"],
1181
+ ["filter", "none"],
1182
+ ["backdrop-filter", "none"],
1183
+ ["will-change", "auto"],
1184
+ ["contain", "none"]
1185
+ ], c = [], l = t.parentNode; l && l.nodeType === 1 && l !== document.documentElement;) {
1186
+ var u = typeof getComputedStyle == "function" ? getComputedStyle(l) : null;
1187
+ if (u) {
1188
+ for (var d = null, f = 0; f < s.length; f++) {
1189
+ var p = s[f][0], m = s[f][1], h = u.getPropertyValue(p);
1190
+ h && h !== m && h !== "normal" && (d ||= {}, d[p] = {
1191
+ v: l.style.getPropertyValue(p),
1192
+ p: l.style.getPropertyPriority(p)
1193
+ }, l.style.setProperty(p, m, "important"));
1194
+ }
1195
+ d && c.push({
1196
+ el: l,
1197
+ saved: d
1198
+ });
1199
+ }
1200
+ l = l.parentNode;
1201
+ }
1202
+ var g = !1, _ = function() {
1203
+ if (!g) {
1204
+ g = !0, t.classList.remove("tokui-print-target"), typeof document < "u" && document.body && document.body.removeAttribute("data-tokui-printing");
1205
+ for (var e = 0; e < n.length; e++) n[e].removeAttribute("data-tokui-print-hidden");
1206
+ for (var r = 0; r < c.length; r++) {
1207
+ var i = c[r];
1208
+ for (var a in i.saved) Object.prototype.hasOwnProperty.call(i.saved, a) && i.el.style.setProperty(a, i.saved[a].v, i.saved[a].p);
1209
+ }
1210
+ typeof window < "u" && typeof window.removeEventListener == "function" && window.removeEventListener("afterprint", _);
1211
+ }
1212
+ };
1213
+ typeof window.addEventListener == "function" && window.addEventListener("afterprint", _);
1214
+ try {
1215
+ window.print();
1216
+ } catch {}
1217
+ setTimeout(_, 1e3);
1218
+ }
994
1219
  }
995
1220
  };
996
- typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.el = n, window.TokUI._internal.VARIANTS = r, window.TokUI._internal.TokUIRenderer = i), t !== void 0 && t.exports && (t.exports = {
997
- el: n,
998
- TokUIRenderer: i,
999
- VARIANTS: r
1221
+ typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.el = o, window.TokUI._internal.VARIANTS = s, window.TokUI._internal.TokUIRenderer = c, window.TokUI._internal.resolveButtonAction = n, window.TokUI._internal.resolveTargetForm = r, window.TokUI._internal.resolvePrintScope = i, window.TokUI._internal.broadcastTokuiReset = a), t !== void 0 && t.exports && (t.exports = {
1222
+ el: o,
1223
+ TokUIRenderer: c,
1224
+ VARIANTS: s,
1225
+ resolveButtonAction: n,
1226
+ resolveTargetForm: r,
1227
+ resolvePrintScope: i,
1228
+ broadcastTokuiReset: a
1000
1229
  });
1001
1230
  })), h = /* @__PURE__ */ o(((e, t) => {
1002
1231
  function n(e) {
@@ -3671,14 +3900,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
3671
3900
  "h6"
3672
3901
  ].forEach((r) => {
3673
3902
  e.register(r, (e) => {
3674
- let i = t(r, { class: `tokui-${r}` }, e.content), a = n(e.attrs.bg), o = n(e.attrs.fc), s = e.attrs.v || "";
3903
+ let i = t(r, { class: `tokui-${r}` }, e.content || e.attrs && e.attrs.tx), a = n(e.attrs.bg), o = n(e.attrs.fc), s = e.attrs.v || "";
3675
3904
  return a && (s.includes("underline") ? i.style.setProperty("--tokui-title-bg", a) : i.style.background = a), o && (i.style.color = o), i;
3676
3905
  });
3677
3906
  }), e.register("p", (e, n) => {
3678
3907
  var r = { class: "tokui-p" };
3679
3908
  e.attrs && e.attrs.id && (r.id = e.attrs.id);
3680
- var i = t("p", r);
3681
- return e.content && i.appendChild(document.createTextNode(e.content)), e.children && e.children.length && n(e.children).forEach(function(e) {
3909
+ var i = t("p", r), a = e.content || e.attrs && e.attrs.tx;
3910
+ return a && i.appendChild(document.createTextNode(a)), e.children && e.children.length && n(e.children).forEach(function(e) {
3682
3911
  e && e.nodeType && i.appendChild(e);
3683
3912
  }), i;
3684
3913
  }), e.register("a", (e) => {
@@ -4115,9 +4344,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
4115
4344
  }, d;
4116
4345
  }), e.register("badge-box", (e, n) => {
4117
4346
  var r = e.attrs || {}, i = t("span", { class: "tokui-badge-box" });
4118
- e.children && e.children.length && e.children.forEach(function(e) {
4119
- var t = n(e);
4120
- t && i.appendChild(t);
4347
+ e.children && e.children.length && n(e.children).forEach(function(e) {
4348
+ e && i.appendChild(e);
4121
4349
  });
4122
4350
  var a = r.t || r.status || "error", o = a === "primary" ? "var(--tokui-primary)" : a === "success" ? "var(--tokui-success)" : a === "warning" ? "var(--tokui-warning)" : a === "info" ? "var(--tokui-info)" : "var(--tokui-danger)", s;
4123
4351
  if (r.dot) s = t("sup", { class: "tokui-badge-box__dot" }), s.style.background = o;
@@ -4126,7 +4354,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
4126
4354
  (isNaN(l) || l < 0) && (l = 0);
4127
4355
  var u = l > c ? c + "+" : String(l);
4128
4356
  s = t("sup", { class: "tokui-badge-box__count" }), s.textContent = u, s.style.background = o;
4129
- } else r.label && (s = t("sup", { class: "tokui-badge-box__text" }), s.textContent = r.label, a === "default" ? (s.style.background = "var(--tokui-stripe, #f5f5f5)", s.style.color = "var(--tokui-text-secondary, #666)") : s.style.background = o);
4357
+ } else (r.tx || r.label) && (s = t("sup", { class: "tokui-badge-box__text" }), s.textContent = r.tx || r.label, a === "default" ? (s.style.background = "var(--tokui-stripe, #f5f5f5)", s.style.color = "var(--tokui-text-secondary, #666)") : s.style.background = o);
4130
4358
  return s && i.appendChild(s), i;
4131
4359
  }), e.register("skeleton", (e) => {
4132
4360
  var n = e.attrs || {}, r = n.t || "text", i = parseInt(n.rows, 10) || 3, a = n.w || "", o = n.h || "", s = t("div", {
@@ -4411,7 +4639,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
4411
4639
  return s;
4412
4640
  }), e.register("stat", (e) => {
4413
4641
  var n = e.attrs || {}, r = n.tt || "", i = n.v || "0", a = n.pre || "", o = n.suf || "", s = n.trend || "", c = parseInt(n.anim) || 0, l = parseInt(n.dec) || 0, u = t("div", { class: "tokui-stat" });
4414
- if (r) {
4642
+ if (n.id && (u.id = n.id), r) {
4415
4643
  var d = t("div", { class: "tokui-stat__title" });
4416
4644
  d.textContent = r, u.appendChild(d);
4417
4645
  }
@@ -5659,32 +5887,61 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5659
5887
  }), n && u.setAttribute("data-tokui-clk", n), u;
5660
5888
  }
5661
5889
  e.register("welcome", (e, n) => {
5662
- var r = e.attrs || {}, i = r.tt || "", a = r.st || "", o = t("div", { class: "tokui-welcome" });
5663
- if (i) {
5664
- var s = t("div", { class: "tokui-welcome__title" });
5665
- s.textContent = i, o.appendChild(s);
5890
+ 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" });
5891
+ if (i || a || o.length) {
5892
+ var u = t("div", { class: "tokui-welcome__hero" });
5893
+ if (i) {
5894
+ var d = t("div", { class: "tokui-welcome__title" });
5895
+ d.textContent = i, u.appendChild(d);
5896
+ }
5897
+ if (a) {
5898
+ var f = t("div", { class: "tokui-welcome__subtitle" });
5899
+ f.textContent = a, u.appendChild(f);
5900
+ }
5901
+ if (o.length) {
5902
+ var p = t("div", { class: "tokui-welcome__badges" });
5903
+ o.forEach(function(e) {
5904
+ var n = String(e).trim();
5905
+ if (n) {
5906
+ var r = t("span", { class: "tokui-welcome__badge" });
5907
+ r.textContent = n, p.appendChild(r);
5908
+ }
5909
+ }), u.appendChild(p);
5910
+ }
5911
+ l.appendChild(u);
5666
5912
  }
5667
- if (a) {
5668
- var c = t("div", { class: "tokui-welcome__subtitle" });
5669
- c.textContent = a, o.appendChild(c);
5913
+ if (s) {
5914
+ var m = t("div", { class: "tokui-welcome__section" });
5915
+ m.textContent = s, l.appendChild(m);
5670
5916
  }
5671
- var l = t("div", { class: "tokui-welcome__grid" });
5672
- return n(e.children || []).forEach(function(e) {
5673
- e && e.nodeType && l.appendChild(e);
5674
- }), o.appendChild(l), o._slot = l, o._tokuiType = "welcome", o;
5917
+ var h = t("div", { class: "tokui-welcome__grid" });
5918
+ if (n(e.children || []).forEach(function(e) {
5919
+ e && e.nodeType && h.appendChild(e);
5920
+ }), l.appendChild(h), c) {
5921
+ var g = t("div", { class: "tokui-welcome__footer" });
5922
+ g.textContent = c, l.appendChild(g);
5923
+ }
5924
+ return l._slot = h, l._tokuiType = "welcome", l;
5675
5925
  });
5676
5926
  function x(e) {
5677
5927
  var n = e.attrs || {}, r = n.tt || "", i = n.tx || "", a = n.i || "code", o = n.clk || "", s = {
5678
5928
  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>",
5679
5929
  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>",
5680
- 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>"
5930
+ 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>",
5931
+ dashboard: "<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=\"3\" width=\"8\" height=\"10\" rx=\"1\"/><rect x=\"13\" y=\"3\" width=\"8\" height=\"6\" rx=\"1\"/><rect x=\"13\" y=\"13\" width=\"8\" height=\"8\" rx=\"1\"/><rect x=\"3\" y=\"17\" width=\"8\" height=\"4\" rx=\"1\"/></svg>",
5932
+ print: "<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=\"6 9 6 2 18 2 18 9\"/><path d=\"M6 18H4a2 2 0 0 1-2-2v-5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2v5a2 2 0 0 1-2 2h-2\"/><rect x=\"6\" y=\"14\" width=\"12\" height=\"8\" rx=\"1\"/></svg>",
5933
+ 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>",
5934
+ 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>",
5935
+ 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>"
5681
5936
  }, c = {
5682
5937
  class: ["tokui-welcome-feature", "tokui-welcome-feature--" + a].join(" "),
5683
5938
  role: "button",
5684
5939
  tabindex: "0",
5685
5940
  "data-tokui-tag": e.type
5686
5941
  };
5687
- o && (c["data-tokui-clk"] = o);
5942
+ o && (c["data-tokui-clk"] = o), Object.keys(n).forEach(function(e) {
5943
+ e.indexOf("data-") === 0 && (c[e] = n[e]);
5944
+ });
5688
5945
  var l = t("div", c), u = t("div", { class: "tokui-welcome-feature__icon" });
5689
5946
  u.innerHTML = s[a] || s.code, l.appendChild(u);
5690
5947
  var d = t("div", { class: "tokui-welcome-feature__body" });
@@ -5696,13 +5953,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5696
5953
  var p = t("div", { class: "tokui-welcome-feature__desc" });
5697
5954
  p.textContent = i, d.appendChild(p);
5698
5955
  }
5699
- return l.appendChild(d), o && l.addEventListener("click", function() {
5700
- var e = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal.eventBus : null;
5701
- e && typeof e.emit == "function" && e.emit(o, {
5702
- title: r,
5703
- icon: a
5704
- });
5705
- }), l._tokuiType = "welcome-feature", l;
5956
+ return l.appendChild(d), l._tokuiType = "welcome-feature", l;
5706
5957
  }
5707
5958
  e.register("welcome-feature", (e) => x(e)), e.register("feature", (e) => x(e)), e.register("attachments", (e, n) => {
5708
5959
  var r = (e.attrs || {}).clk || "", i = t("div", { class: "tokui-attachments" });
@@ -5849,14 +6100,26 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
5849
6100
  }, 0), c._streamCloseHook = function() {
5850
6101
  var t = (e.children || []).find(function(e) {
5851
6102
  return e.type === "artifact-code";
5852
- }), n = t ? (t.children || []).map(function(e) {
6103
+ }), n;
6104
+ if (t) n = (t.children || []).map(function(e) {
5853
6105
  return e.content || "";
5854
- }).join("") : c._artifactCode || "";
6106
+ }).join("");
6107
+ else {
6108
+ n = "";
6109
+ for (var a = c.querySelectorAll("pre"), o = 0; o < a.length; o++) if (a[o]._tokuiType === "artifact-code") {
6110
+ var l = a[o].querySelector("code");
6111
+ if (l) {
6112
+ n = l.textContent || "";
6113
+ break;
6114
+ }
6115
+ }
6116
+ n ||= c._artifactCode || "";
6117
+ }
5855
6118
  s !== "text" && r[s] ? x.innerHTML = p(i(n, s)) : x.innerHTML = p(f(n)), c._artifactCode = n;
5856
- var a = "";
5857
- a = s === "html" ? n : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", w.setAttribute("srcdoc", a);
5858
- var o = c.querySelector(".tokui-artifact-preview-standalone");
5859
- o && o.parentNode && o.parentNode.removeChild(o);
6119
+ var u = "";
6120
+ u = s === "html" ? n : "<pre style=\"margin:0;padding:16px;font-family:monospace;font-size:13px;white-space:pre-wrap;word-break:break-word;\">" + n.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;") + "</pre>", w.setAttribute("srcdoc", u);
6121
+ var d = c.querySelector(".tokui-artifact-preview-standalone");
6122
+ d && d.parentNode && d.parentNode.removeChild(d);
5860
6123
  }, c;
5861
6124
  }), e.register("artifact-code", (e, n) => {
5862
6125
  var r = "";
@@ -6267,7 +6530,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6267
6530
  })), v = /* @__PURE__ */ o(((e, t) => {
6268
6531
  function n(e, t) {
6269
6532
  let n = t("div", {});
6270
- return n.style.display = "flex", n.style.gap = "6px", n.style.alignItems = "center", e.split("|").forEach((e) => {
6533
+ return n.style.display = "inline-flex", n.style.gap = "6px", n.style.alignItems = "center", e.split("|").forEach((e) => {
6271
6534
  let r = e.trim();
6272
6535
  if (!r) return;
6273
6536
  let i = r.split(/\s+/), a = "", o = {
@@ -6312,9 +6575,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6312
6575
  }
6313
6576
  };
6314
6577
  function o(e) {
6315
- var t = e.indexOf("/"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1).trim().toLowerCase() : "", i = n.indexOf(":");
6578
+ var t = e.indexOf("/"), n = t > 0 ? e.slice(0, t) : e, r = t > 0 ? e.slice(t + 1) : "", i = "", a = "";
6579
+ if (r) {
6580
+ var o = r.split("/");
6581
+ i = o[0].trim().toLowerCase(), a = o[1] ? o[1].trim().toLowerCase() : "";
6582
+ }
6583
+ var s = n.indexOf(":");
6316
6584
  return {
6317
- name: i > 0 ? n.slice(0, i) : n,
6585
+ name: s > 0 ? n.slice(0, s) : n,
6318
6586
  align: {
6319
6587
  c: "center",
6320
6588
  center: "center",
@@ -6322,11 +6590,18 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6322
6590
  right: "right",
6323
6591
  l: "left",
6324
6592
  left: "left"
6325
- }[r] || ""
6593
+ }[i] || "",
6594
+ color: {
6595
+ primary: "primary",
6596
+ success: "success",
6597
+ warning: "warning",
6598
+ danger: "danger",
6599
+ info: "info"
6600
+ }[a] || ""
6326
6601
  };
6327
6602
  }
6328
- let s = [], c = [], u = 0;
6329
- function d(e) {
6603
+ let s = [], c = [], u = [], d = 0, f = null;
6604
+ function h(e) {
6330
6605
  let t = e.querySelector(".tokui-chk-all");
6331
6606
  if (!t) return;
6332
6607
  let n = e.querySelectorAll(".tokui-chk-row"), r = e.querySelectorAll(".tokui-chk-row:checked");
@@ -6338,53 +6613,73 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6338
6613
  role: "table"
6339
6614
  };
6340
6615
  e.attrs.id && (r.id = e.attrs.id), e.attrs.stripe !== void 0 && (r.class += " tokui-table--stripe");
6341
- let i = t("div", { class: "tokui-table-wrapper" }), s = t("table", r);
6342
- (e.attrs.cap || e.attrs.caption) && s.appendChild(t("caption", {}, e.attrs.cap || e.attrs.caption));
6343
- let c = [], l = [], u = e.children.find((e) => e.type === "thead");
6344
- return u && u.attrs.cols && u.attrs.cols.split(",").forEach((e) => {
6345
- let t = o(e);
6346
- c.push(a[t.name] ? t.name : null), l.push(t.align);
6347
- }), e.children.forEach((e) => {
6348
- e._colTypes = c, e._colAligns = l;
6349
- }), n(e.children).forEach((e) => {
6350
- e && e.nodeType && s.appendChild(e);
6351
- }), i.appendChild(s), i._slot = s, i._tokuiType = "table", i;
6616
+ let i = t("div", { class: "tokui-table-wrapper" }), a = t("table", r);
6617
+ return (e.attrs.cap || e.attrs.caption) && a.appendChild(t("caption", {}, e.attrs.cap || e.attrs.caption)), f = a, n(e.children).forEach((e) => {
6618
+ e && e.nodeType && a.appendChild(e);
6619
+ }), i.appendChild(a), i._slot = a, i._tokuiType = "table", i;
6352
6620
  }), e.register("thead", (e) => {
6353
- let n = t("thead", { class: "tokui-thead" }), r = t("tr", { class: "tokui-thead-row" });
6354
- return e.attrs.cols ? (s = [], c = [], u = 0, e.attrs.cols.split(",").forEach((e) => {
6355
- let n = o(e), i = n.name, l = n.align ? "tokui-col-" + n.align : "", u = { scope: "col" };
6356
- if (s.push(a[i] ? i : null), c.push(n.align), i === "chk") {
6357
- u.class = "tokui-col-chk" + (l ? " " + l : "");
6358
- let e = t("input", {
6359
- type: "checkbox",
6360
- class: "tokui-chk-all"
6361
- });
6362
- e.addEventListener("change", function() {
6363
- let t = e.closest("table");
6364
- t && (t.querySelectorAll(".tokui-chk-row").forEach(function(t) {
6365
- t.checked = e.checked;
6366
- }), e.indeterminate = !1);
6621
+ let n = t("thead", { class: "tokui-thead" });
6622
+ if (e.attrs.cols) {
6623
+ s = [], c = [], u = [], d = 0;
6624
+ let r = e.attrs.cols.split(";"), i = r.length - 1, l = r.map(function(e) {
6625
+ return g(e).map(function(e) {
6626
+ let t = o(e), n = S(t.name);
6627
+ return {
6628
+ text: n.text,
6629
+ align: t.align,
6630
+ color: t.color,
6631
+ colspan: n.colspan || 1,
6632
+ rowspan: n.rowspan || 1
6633
+ };
6367
6634
  });
6368
- let n = t("th", u);
6369
- n.appendChild(e), r.appendChild(n);
6370
- return;
6371
- }
6372
- if (i === "#") {
6373
- u.class = "tokui-col-seq" + (l ? " " + l : ""), r.appendChild(t("th", u, "#"));
6374
- return;
6375
- }
6376
- u.class = l, r.appendChild(t("th", u, i));
6377
- })) : e.children.forEach((e) => {
6378
- let n = e.attrs && e.attrs.n || "";
6379
- r.appendChild(t("th", {
6380
- scope: "col",
6381
- "data-tokui-tag": e.type === "tcol" ? "tcol" : null
6382
- }, n));
6383
- }), n.appendChild(r), n._slot = r, n._tokuiType = "thead", n;
6635
+ }), p = l.length ? l[0].reduce(function(e, t) {
6636
+ return e + t.colspan;
6637
+ }, 0) : 0;
6638
+ f && p > 0 && (f.style.minWidth = "calc(" + p + " * var(--tokui-table-min-col-w, 96px))");
6639
+ let m = [];
6640
+ l.forEach(function(e, r) {
6641
+ let o = b(e, m, p), l = t("tr", { class: "tokui-thead-row" });
6642
+ o.forEach(function(e) {
6643
+ let n = e.cell, o = n.align ? "tokui-col-" + n.align : "", d = n.color ? "tokui-text--" + n.color : "", f = { scope: "col" };
6644
+ if (e.colspan >= 2 && (f.colspan = String(e.colspan)), e.rowspan >= 2 && (f.rowspan = String(e.rowspan)), r + e.rowspan - 1 >= i) for (var p = 0; p < e.colspan; p++) c[e.col + p] = n.align || "", s[e.col + p] = a[n.text] ? n.text : null, u[e.col + p] = n.color || "";
6645
+ if (n.text === "chk") {
6646
+ f.class = "tokui-col-chk" + (o ? " " + o : "") + (d ? " " + d : "");
6647
+ let e = t("input", {
6648
+ type: "checkbox",
6649
+ class: "tokui-chk-all"
6650
+ });
6651
+ e.addEventListener("change", function() {
6652
+ let t = e.closest("table");
6653
+ t && (t.querySelectorAll(".tokui-chk-row").forEach(function(t) {
6654
+ t.checked = e.checked;
6655
+ }), e.indeterminate = !1);
6656
+ });
6657
+ let n = t("th", f);
6658
+ n.appendChild(e), l.appendChild(n);
6659
+ return;
6660
+ }
6661
+ if (n.text === "#") {
6662
+ f.class = "tokui-col-seq" + (o ? " " + o : "") + (d ? " " + d : ""), l.appendChild(t("th", f, "#"));
6663
+ return;
6664
+ }
6665
+ f.class = (o + " " + d).trim(), l.appendChild(t("th", f, n.text));
6666
+ }), n.appendChild(l);
6667
+ });
6668
+ } else {
6669
+ let r = t("tr", { class: "tokui-thead-row" });
6670
+ e.children.forEach((e) => {
6671
+ let n = e.attrs && e.attrs.n || "";
6672
+ r.appendChild(t("th", {
6673
+ scope: "col",
6674
+ "data-tokui-tag": e.type === "tcol" ? "tcol" : null
6675
+ }, n));
6676
+ }), n.appendChild(r);
6677
+ }
6678
+ return n._slot = n.lastChild || n, n._tokuiType = "thead", n;
6384
6679
  }), e.register("tbody", (e, n) => {
6385
- let r = t("tbody", { class: "tokui-tbody" }), i = e._colTypes || s, a = e._colAligns || c;
6386
- return e.children.forEach((e) => {
6387
- e._colTypes = i, e._colAligns = a, e._seqNum = ++u;
6680
+ let r = t("tbody", { class: "tokui-tbody" }), i = e._colTypes || s, a = e._colAligns || c, o = e._colColors || u;
6681
+ return r._tokuiOccupancy = [], r._tokuiMaxCols = a.length || i.length, e.children.forEach((e) => {
6682
+ e._colTypes = i, e._colAligns = a, e._colColors = o, e._seqNum = ++d, e._tbodyEl = r;
6388
6683
  }), n(e.children).forEach((e) => {
6389
6684
  e && e.nodeType && r.appendChild(e);
6390
6685
  }), r.addEventListener("mousedown", function(e) {
@@ -6402,10 +6697,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6402
6697
  let e = Math.min(s, a), n = Math.max(s, a), r = t.checked;
6403
6698
  for (let t = e; t <= n; t++) i[t].checked = r;
6404
6699
  } else a >= 0 && (n.__tokuiChkAnchor = a);
6405
- d(n);
6700
+ h(n);
6406
6701
  }), r._slot = r, r._tokuiType = "tbody", r;
6407
6702
  });
6408
- function f(e) {
6703
+ function g(e) {
6409
6704
  let t = [], n = "", r = !1;
6410
6705
  for (let i = 0; i < e.length; i++) {
6411
6706
  let a = e[i];
@@ -6413,80 +6708,185 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6413
6708
  }
6414
6709
  return t.push(n), t;
6415
6710
  }
6711
+ function _(e) {
6712
+ return e.length > 1 && e.charAt(0) === "\"" && e.charAt(e.length - 1) === "\"" && e.indexOf("\"", 1) === e.length - 1 ? e.slice(1, -1) : e;
6713
+ }
6714
+ function v(e) {
6715
+ for (var t = [], n = "", r = !1, i = 0, a = 0; a < e.length; a++) {
6716
+ var o = e[a];
6717
+ o === "\"" ? r = !r : r ? n += o : o === "[" ? (i++, n += o) : o === "]" ? (i--, n += o) : o === "," && i === 0 ? (t.push(n), n = "") : n += o;
6718
+ }
6719
+ return t.push(n), t;
6720
+ }
6721
+ function y(e, n) {
6722
+ var r = { class: "tokui-td tokui-td--skeleton" }, i = n.colAligns[e];
6723
+ i && (r.class += " tokui-col-" + i);
6724
+ var a = t("td", r);
6725
+ return a.appendChild(t("span", { class: "tokui-skeleton" })), a;
6726
+ }
6727
+ function b(e, t, n) {
6728
+ for (var r = [], i = 0, a = 0; a < e.length; a++) {
6729
+ for (var o = e[a], s = o.colspan || 1, c = o.rowspan || 1; i < n && t[i] > 0;) --t[i], i++;
6730
+ r.push({
6731
+ cell: o,
6732
+ col: i,
6733
+ colspan: s,
6734
+ rowspan: c
6735
+ });
6736
+ for (var l = 0; l < s; l++) t[i + l] = c > 1 ? c - 1 : 0;
6737
+ i += s;
6738
+ }
6739
+ for (; i < n && t[i] > 0;) --t[i], i++;
6740
+ return r;
6741
+ }
6742
+ function x(e, t, n) {
6743
+ return !t || !n ? null : b(e.map(function(e) {
6744
+ var t = S(e);
6745
+ return {
6746
+ colspan: t.colspan || 1,
6747
+ rowspan: t.rowspan || 1
6748
+ };
6749
+ }), n, t._tokuiMaxCols || e.length).map(function(e) {
6750
+ return e.col;
6751
+ });
6752
+ }
6753
+ function S(e) {
6754
+ e = String(e);
6755
+ var t = e.match(/=([cr]\d+){1,2}$/);
6756
+ if (!t) return {
6757
+ text: e,
6758
+ colspan: 0,
6759
+ rowspan: 0
6760
+ };
6761
+ var n = t[0], r = e.slice(0, e.length - n.length), i = 0, a = 0, o = n.match(/c(\d+)/), s = n.match(/r(\d+)/);
6762
+ return o && (i = parseInt(o[1], 10) || 0), s && (a = parseInt(s[1], 10) || 0), {
6763
+ text: r,
6764
+ colspan: i,
6765
+ rowspan: a
6766
+ };
6767
+ }
6768
+ function C(e, r, a) {
6769
+ var o = a.colTypes, s = a.colAligns, c = a.seqNum, l = a.colspanVal, u = a.cellCols && a.cellCols[r] != null ? a.cellCols[r] : r, d = { class: "tokui-td" }, f = s[u];
6770
+ f && (d.class += " tokui-col-" + f);
6771
+ var p = a.colColors && a.colColors[u];
6772
+ if (p && (d.class += " tokui-text--" + p), r === 0 && l >= 2 && (d.colspan = String(l)), r > 0 && r < l) return null;
6773
+ var m = S(e), h = m.text.trim();
6774
+ if (m.colspan >= 2 && (d.colspan = String(m.colspan)), m.rowspan >= 2 && (d.rowspan = String(m.rowspan)), o[u] === "chk") {
6775
+ d.class += " tokui-col-chk";
6776
+ var g = t("td", d);
6777
+ return g.appendChild(t("input", {
6778
+ type: "checkbox",
6779
+ class: "tokui-chk-row"
6780
+ })), g;
6781
+ }
6782
+ if (o[u] === "#") return d.class += " tokui-col-seq", t("td", d, String(c));
6783
+ var _ = i(h);
6784
+ if (_) {
6785
+ d.class += " tokui-td--inline";
6786
+ var v = t("td", d);
6787
+ return v.appendChild(_), v;
6788
+ }
6789
+ if (h.startsWith("btn:")) {
6790
+ d.class += " tokui-col-action";
6791
+ var y = t("td", d);
6792
+ return y.appendChild(n(h, t)), y;
6793
+ }
6794
+ if (h.startsWith("tag:")) {
6795
+ var b = t("td", d), x = h.split(/\s+/), C = "", w = { class: "tokui-tag" };
6796
+ return x.forEach(function(e) {
6797
+ e.startsWith("tag:") ? C = e.slice(4) : e.startsWith("t:") && (w.class += " tokui-tag--" + e.slice(2));
6798
+ }), b.appendChild(t("span", w, C)), b;
6799
+ }
6800
+ if (h.startsWith("progress")) {
6801
+ var T = t("td", d), E = h.split(/\s+/), D = 0, O = "span", k = "";
6802
+ if (E.forEach(function(e) {
6803
+ e.startsWith("v:") ? D = parseInt(e.slice(2)) || 0 : e.startsWith("t:") ? O = e.slice(2) : e.startsWith("status:") && (k = e.slice(7));
6804
+ }), O === "span") {
6805
+ var A = t("span", { class: "tokui-progress tokui-progress--span" }), j = t("span", { class: "tokui-progress__mini-bar" }), M = "tokui-progress__mini-fill";
6806
+ k === "error" ? M += " tokui-progress--error" : D >= 80 && (M += " tokui-progress--success");
6807
+ var N = t("span", { class: M });
6808
+ N.style.width = D + "%", j.appendChild(N), A.appendChild(j);
6809
+ var P = t("span", { class: "tokui-progress__span-text" });
6810
+ P.textContent = D + "%", A.appendChild(P), T.appendChild(A);
6811
+ }
6812
+ return T;
6813
+ }
6814
+ return t("td", d, h);
6815
+ }
6816
+ function w(e, t) {
6817
+ e._tokuiCellText = [], e._tokuiCellTds = [];
6818
+ var n = "\0SKELETON\0";
6819
+ function r(t, n) {
6820
+ if (t) {
6821
+ for (var r = null, i = n + 1; i < e._tokuiCellTds.length; i++) if (e._tokuiCellTds[i] && e._tokuiCellTds[i].parentNode === e) {
6822
+ r = e._tokuiCellTds[i];
6823
+ break;
6824
+ }
6825
+ r ? e.insertBefore(t, r) : e.appendChild(t);
6826
+ }
6827
+ }
6828
+ return e._tokuiTrReconcile = function(i, a, o) {
6829
+ o && o.v && String(o.v).split(",").forEach(function(t) {
6830
+ t = t.trim(), t && e.classList.add("tokui-table-row--" + t);
6831
+ });
6832
+ var s = v(_(i || "")), c = t.tbodyEl && t.tbodyEl._tokuiOccupancy;
6833
+ c && (t.cellCols = x(s, t.tbodyEl, a ? c : c.slice()));
6834
+ for (var l = 0; l < s.length; l++) {
6835
+ var u = s[l], d = u.trim(), f = l === s.length - 1, p = (/^\[/.test(d) || /^(btn|tag|progress)\b/.test(d)) && f && !a, m = p ? n : u;
6836
+ if (e._tokuiCellText[l] !== m) {
6837
+ var h = e._tokuiCellTds[l];
6838
+ h && h.parentNode === e && e.removeChild(h);
6839
+ var g = p ? y(l, t) : C(u, l, t);
6840
+ r(g, l), e._tokuiCellTds[l] = g || null, e._tokuiCellText[l] = m;
6841
+ }
6842
+ }
6843
+ for (var b = s.length; b < e._tokuiCellTds.length; b++) {
6844
+ var S = e._tokuiCellTds[b];
6845
+ S && S.parentNode === e && e.removeChild(S), e._tokuiCellTds[b] = null;
6846
+ }
6847
+ e._tokuiCellTds.length = s.length, e._tokuiCellText.length = s.length;
6848
+ }, e;
6849
+ }
6416
6850
  e.register("tr", (e) => {
6417
- let r = t("tr", {
6851
+ let n = t("tr", {
6418
6852
  class: "tokui-table-row",
6419
6853
  role: "row"
6420
6854
  });
6421
- var a = e.attrs && e.attrs.cs ? parseInt(e.attrs.cs) : 0;
6422
- let o = e._colTypes || s, l = e._colAligns || c, d = e._seqNum || ++u;
6855
+ e.attrs && e.attrs.v && String(e.attrs.v).split(",").forEach(function(e) {
6856
+ e = e.trim(), e && n.classList.add("tokui-table-row--" + e);
6857
+ });
6858
+ var r = e.attrs && e.attrs.cs ? parseInt(e.attrs.cs) : 0;
6859
+ let i = e._colTypes || s, a = {
6860
+ colTypes: i,
6861
+ colAligns: e._colAligns || c,
6862
+ colColors: e._colColors || u,
6863
+ seqNum: e._seqNum || ++d,
6864
+ colspanVal: r,
6865
+ tbodyEl: e._tbodyEl
6866
+ };
6867
+ if (e._stream === "open") return w(n, a), n;
6423
6868
  if (e.content) {
6424
- var p = e.content;
6425
- p.length > 1 && p.charAt(0) === "\"" && p.charAt(p.length - 1) === "\"" && (p = p.slice(1, -1)), f(p).forEach((e, s) => {
6426
- let c = { class: "tokui-td" }, u = l[s];
6427
- if (u && (c.class += " tokui-col-" + u), s === 0 && a >= 2 && (c.colspan = String(a)), s > 0 && s < a) return;
6428
- let f = e.trim();
6429
- if (o[s] === "chk") {
6430
- c.class += " tokui-col-chk";
6431
- let e = t("td", c);
6432
- e.appendChild(t("input", {
6433
- type: "checkbox",
6434
- class: "tokui-chk-row"
6435
- })), r.appendChild(e);
6436
- return;
6437
- }
6438
- if (o[s] === "#") {
6439
- c.class += " tokui-col-seq", r.appendChild(t("td", c, String(d)));
6440
- return;
6441
- }
6442
- let p = i(f);
6443
- if (p) {
6444
- c.class += " tokui-td--inline";
6445
- let e = t("td", c);
6446
- e.appendChild(p), r.appendChild(e);
6447
- return;
6448
- }
6449
- if (f.startsWith("btn:")) {
6450
- c.class += " tokui-col-action";
6451
- let e = t("td", c);
6452
- e.appendChild(n(f, t)), r.appendChild(e);
6453
- return;
6454
- }
6455
- if (f.startsWith("tag:")) {
6456
- let e = t("td", c), n = f.split(/\s+/), i = "", a = { class: "tokui-tag" };
6457
- n.forEach((e) => {
6458
- e.startsWith("tag:") ? i = e.slice(4) : e.startsWith("t:") && (a.class += " tokui-tag--" + e.slice(2));
6459
- });
6460
- let o = t("span", a, i);
6461
- e.appendChild(o), r.appendChild(e);
6462
- return;
6463
- }
6464
- if (f.startsWith("progress")) {
6465
- let e = t("td", c), n = f.split(/\s+/), i = 0, a = "span", o = "";
6466
- if (n.forEach((e) => {
6467
- e.startsWith("v:") ? i = parseInt(e.slice(2)) || 0 : e.startsWith("t:") ? a = e.slice(2) : e.startsWith("status:") && (o = e.slice(7));
6468
- }), a === "span") {
6469
- let n = t("span", { class: "tokui-progress tokui-progress--span" }), r = t("span", { class: "tokui-progress__mini-bar" }), a = "tokui-progress__mini-fill";
6470
- o === "error" ? a += " tokui-progress--error" : i >= 80 && (a += " tokui-progress--success");
6471
- let s = t("span", { class: a });
6472
- s.style.width = i + "%", r.appendChild(s), n.appendChild(r);
6473
- let c = t("span", { class: "tokui-progress__span-text" });
6474
- c.textContent = i + "%", n.appendChild(c), e.appendChild(n);
6475
- }
6476
- r.appendChild(e);
6477
- return;
6478
- }
6479
- r.appendChild(t("td", c, f));
6869
+ var o = _(e.content);
6870
+ let t = v(o);
6871
+ a.cellCols = x(t, a.tbodyEl, a.tbodyEl && a.tbodyEl._tokuiOccupancy);
6872
+ var l = t.some(function(e) {
6873
+ return /=([cr]\d+)/.test(e);
6874
+ }), f = a.cellCols && a.cellCols.some(function(e, t) {
6875
+ return e !== t;
6876
+ }), p = o.indexOf("[tr") !== -1;
6877
+ !l && !f && i.length > 0 && t.length !== i.length && r < 2 && console.warn("TokUI Table: tr 单元格数 " + t.length + " != 列数 " + i.length + " → 列错位。" + (p ? "⚠️ 内容含 [tr 残留,疑似 tr 未正确闭合(引号未配对/含字面 [ ] 未引号包)→ parser 标签断裂、串行。" : t.length > i.length ? "疑似单元格内含逗号未用双引号包裹(如 12,800.00、\"a,b,c\")。" : "疑似列标题(thead cols)含逗号被切散、或该行缺格。") + "规则:tr 不要外层引号、含逗号单元格直引号包。tr 原文: " + o), t.forEach((e, t) => {
6878
+ let r = C(e, t, a);
6879
+ r && n.appendChild(r);
6480
6880
  });
6481
6881
  }
6482
- return r;
6882
+ return n;
6483
6883
  }), e.register("tcol", () => document.createTextNode(""));
6484
6884
  }
6485
6885
  typeof window < "u" && (window.TokUI = window.TokUI || {}, window.TokUI._internal = window.TokUI._internal || {}, window.TokUI._internal.registerTableComponents = r), t !== void 0 && t.exports && (t.exports = { registerTableComponents: r });
6486
6886
  })), y = /* @__PURE__ */ o(((e, t) => {
6487
6887
  function n(e) {
6488
- let { el: t } = typeof l == "function" ? m() : window.TokUI._internal, n = typeof l == "function" ? _().resolveColor : window.TokUI._internal.resolveColor;
6489
- function r(e) {
6888
+ let { el: t, resolveButtonAction: n } = typeof l == "function" ? m() : window.TokUI._internal, r = typeof l == "function" ? _().resolveColor : window.TokUI._internal.resolveColor;
6889
+ function i(e) {
6490
6890
  if (!e) return null;
6491
6891
  var t = e.indexOf("|");
6492
6892
  return t === -1 ? {
@@ -6497,7 +6897,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6497
6897
  variant: e.substring(t + 1)
6498
6898
  };
6499
6899
  }
6500
- function i(e) {
6900
+ function a(e) {
6501
6901
  if (!e) return null;
6502
6902
  var t = e.indexOf("|"), n = t === -1 ? e : e.substring(0, t), r = t === -1 ? null : e.substring(t + 1), i = n.indexOf(":");
6503
6903
  return i === -1 ? {
@@ -6510,35 +6910,35 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6510
6910
  variant: r
6511
6911
  };
6512
6912
  }
6513
- function a(e) {
6913
+ function o(e) {
6514
6914
  var t = e.attrs;
6515
6915
  return !!(t.pre || t.app || t.prebtn || t.appbtn);
6516
6916
  }
6517
- function o(e, n) {
6518
- var a = t("div", { class: "tokui-input-group" });
6917
+ function s(e, n) {
6918
+ var r = t("div", { class: "tokui-input-group" });
6519
6919
  if (e.attrs.pre) {
6520
- var o = r(e.attrs.pre), s = o.variant ? "tokui-input-pre tokui-input-pre--" + o.variant : "tokui-input-pre";
6521
- a.appendChild(t("span", { class: s }, o.text));
6920
+ var o = i(e.attrs.pre), s = o.variant ? "tokui-input-pre tokui-input-pre--" + o.variant : "tokui-input-pre";
6921
+ r.appendChild(t("span", { class: s }, o.text));
6522
6922
  }
6523
6923
  if (e.attrs.prebtn) {
6524
- var o = i(e.attrs.prebtn), s = o.variant ? "tokui-input-prebtn tokui-input-prebtn--" + o.variant : "tokui-input-prebtn", c = {
6924
+ var o = a(e.attrs.prebtn), s = o.variant ? "tokui-input-prebtn tokui-input-prebtn--" + o.variant : "tokui-input-prebtn", c = {
6525
6925
  class: s,
6526
6926
  type: "button"
6527
6927
  };
6528
- o.handler && (c["data-tokui-clk"] = o.handler), a.appendChild(t("button", c, o.text));
6928
+ o.handler && (c["data-tokui-clk"] = o.handler), r.appendChild(t("button", c, o.text));
6529
6929
  }
6530
- if (a.appendChild(n), e.attrs.appbtn) {
6531
- var o = i(e.attrs.appbtn), s = o.variant ? "tokui-input-appbtn tokui-input-appbtn--" + o.variant : "tokui-input-appbtn", c = {
6930
+ if (r.appendChild(n), e.attrs.appbtn) {
6931
+ var o = a(e.attrs.appbtn), s = o.variant ? "tokui-input-appbtn tokui-input-appbtn--" + o.variant : "tokui-input-appbtn", c = {
6532
6932
  class: s,
6533
6933
  type: "button"
6534
6934
  };
6535
- o.handler && (c["data-tokui-clk"] = o.handler), a.appendChild(t("button", c, o.text));
6935
+ o.handler && (c["data-tokui-clk"] = o.handler), r.appendChild(t("button", c, o.text));
6536
6936
  }
6537
6937
  if (e.attrs.app) {
6538
- var o = r(e.attrs.app), s = o.variant ? "tokui-input-app tokui-input-app--" + o.variant : "tokui-input-app";
6539
- a.appendChild(t("span", { class: s }, o.text));
6938
+ var o = i(e.attrs.app), s = o.variant ? "tokui-input-app tokui-input-app--" + o.variant : "tokui-input-app";
6939
+ r.appendChild(t("span", { class: s }, o.text));
6540
6940
  }
6541
- return a;
6941
+ return r;
6542
6942
  }
6543
6943
  e.register("form", (e, n) => {
6544
6944
  let r = { class: "tokui-form" };
@@ -6552,11 +6952,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6552
6952
  e && e.nodeType && a.appendChild(e);
6553
6953
  }), a._slot = a, a._tokuiType = "form", a;
6554
6954
  });
6555
- var s = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/></svg>";
6955
+ var c = "<svg viewBox=\"0 0 24 24\" width=\"16\" height=\"16\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><circle cx=\"11\" cy=\"11\" r=\"8\"/><line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"/></svg>";
6556
6956
  e.register("input", (e) => {
6557
6957
  var n = e.attrs.v ? e.attrs.v.split(",").map(function(e) {
6558
6958
  return e.trim();
6559
- }) : [], r = n.indexOf("inline") !== -1, i = e.attrs.search !== void 0, c = e.attrs.search === "right", l = t("div", { class: r ? "tokui-field tokui-field--inline" : "tokui-field" });
6959
+ }) : [], r = n.indexOf("inline") !== -1, i = e.attrs.search !== void 0, a = e.attrs.search === "right", l = t("div", { class: r ? "tokui-field tokui-field--inline" : "tokui-field" });
6560
6960
  if (e.attrs.l) {
6561
6961
  var u = { class: "tokui-label" };
6562
6962
  e.attrs.id && (u.for = e.attrs.id), l.appendChild(t("label", u, e.attrs.l));
@@ -6570,13 +6970,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6570
6970
  e.attrs.w && (f.style.width = e.attrs.w);
6571
6971
  var p = null;
6572
6972
  if (i) {
6573
- p = t("div", { class: "tokui-search-input" }), c && p.classList.add("tokui-search-input--right");
6973
+ p = t("div", { class: "tokui-search-input" }), a && p.classList.add("tokui-search-input--right");
6574
6974
  var m = t("span", { class: "tokui-search-input__icon" });
6575
- m.innerHTML = s, p.appendChild(m), p.appendChild(f);
6975
+ m.innerHTML = c, p.appendChild(m), p.appendChild(f);
6576
6976
  }
6577
6977
  var h = p || f;
6578
- if (a(e)) {
6579
- var g = o(e, h);
6978
+ if (o(e)) {
6979
+ var g = s(e, h);
6580
6980
  n.indexOf("pill") !== -1 && g.classList.add("tokui-input-group--pill"), l.appendChild(g);
6581
6981
  } else l.appendChild(h);
6582
6982
  var _ = null;
@@ -6591,12 +6991,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6591
6991
  var i = { class: "tokui-label" };
6592
6992
  e.attrs.id && (i.for = e.attrs.id), r.appendChild(t("label", i, e.attrs.l));
6593
6993
  }
6594
- var s = {
6994
+ var a = {
6595
6995
  class: "tokui-input",
6596
6996
  type: "password"
6597
6997
  };
6598
- e.attrs.id && (s.id = e.attrs.id), e.attrs.n ? s.name = e.attrs.n : e.attrs.id && (s.name = e.attrs.id), e.attrs.ph && (s.placeholder = e.attrs.ph), e.attrs.ml && (s.maxlength = e.attrs.ml), e.attrs.min !== void 0 && (s.min = e.attrs.min), e.attrs.max !== void 0 && (s.max = e.attrs.max), e.attrs.req !== void 0 && (s.required = "required"), e.attrs.dis !== void 0 && (s.disabled = "disabled"), e.attrs.ro !== void 0 && (s.readonly = "readonly"), e.attrs.req !== void 0 && (s["aria-required"] = "true"), e.attrs.val !== void 0 && (s.value = e.attrs.val);
6599
- var c = t("input", s);
6998
+ e.attrs.id && (a.id = e.attrs.id), e.attrs.n ? a.name = e.attrs.n : e.attrs.id && (a.name = e.attrs.id), e.attrs.ph && (a.placeholder = e.attrs.ph), e.attrs.ml && (a.maxlength = e.attrs.ml), e.attrs.min !== void 0 && (a.min = e.attrs.min), e.attrs.max !== void 0 && (a.max = e.attrs.max), e.attrs.req !== void 0 && (a.required = "required"), e.attrs.dis !== void 0 && (a.disabled = "disabled"), e.attrs.ro !== void 0 && (a.readonly = "readonly"), e.attrs.req !== void 0 && (a["aria-required"] = "true"), e.attrs.val !== void 0 && (a.value = e.attrs.val);
6999
+ var c = t("input", a);
6600
7000
  e.attrs.w && (c.style.width = e.attrs.w);
6601
7001
  var l = null;
6602
7002
  if (e.attrs.toggle !== void 0 && !e.attrs.dis) {
@@ -6611,8 +7011,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6611
7011
  c.type = e ? "text" : "password", l.innerHTML = e ? u : d, l.classList.toggle("tokui-pwd-toggle--active", e);
6612
7012
  });
6613
7013
  }
6614
- if (a(e) || l) {
6615
- var f = o(e, c);
7014
+ if (o(e) || l) {
7015
+ var f = s(e, c);
6616
7016
  if (l) {
6617
7017
  var p = c.nextSibling;
6618
7018
  p ? f.insertBefore(l, p) : f.appendChild(l);
@@ -6673,10 +7073,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6673
7073
  let n = { class: "tokui-label" };
6674
7074
  e.attrs.id && (n.for = e.attrs.id), s.appendChild(t("label", n, e.attrs.l));
6675
7075
  }
6676
- let l = ["tokui-picker"];
6677
- r && l.push("tokui-picker--multi"), i && l.push("tokui-picker--disabled");
6678
- let f = t("div", {
6679
- class: l.join(" "),
7076
+ let c = ["tokui-picker"];
7077
+ r && c.push("tokui-picker--multi"), i && c.push("tokui-picker--disabled");
7078
+ let l = t("div", {
7079
+ class: c.join(" "),
6680
7080
  "data-tokui-picker": e.attrs.id || "",
6681
7081
  role: "listbox",
6682
7082
  "aria-expanded": "false"
@@ -6687,33 +7087,33 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6687
7087
  });
6688
7088
  let h = t("div", { class: "tokui-picker-control" });
6689
7089
  r && e.children.forEach((e) => {
6690
- e.attrs && e.attrs.chk !== void 0 && h.appendChild(u(e, f, a));
7090
+ e.attrs && e.attrs.chk !== void 0 && h.appendChild(d(e, l, a));
6691
7091
  });
6692
7092
  let g = {
6693
7093
  class: "tokui-picker-search",
6694
7094
  type: "text",
6695
7095
  autocomplete: "off"
6696
7096
  };
6697
- o && !m && (g.placeholder = o), i && (g.disabled = "disabled"), m && (g.value = m), h.appendChild(t("input", g)), h.appendChild(t("span", { class: "tokui-picker-arrow" })), f.appendChild(h);
7097
+ o && !m && (g.placeholder = o), i && (g.disabled = "disabled"), m && (g.value = m), h.appendChild(t("input", g)), h.appendChild(t("span", { class: "tokui-picker-arrow" })), l.appendChild(h);
6698
7098
  let _ = t("ul", { class: "tokui-picker-dropdown" });
6699
7099
  e.children.forEach((e) => {
6700
- _.appendChild(c(e));
7100
+ _.appendChild(u(e));
6701
7101
  });
6702
7102
  var v = t("li", { class: "tokui-picker-empty" }, "无匹配项");
6703
- return v.style.display = "none", _.appendChild(v), f.appendChild(_), r ? e.children.forEach((e) => {
6704
- e.attrs && e.attrs.chk !== void 0 && f.appendChild(t("input", {
7103
+ return v.style.display = "none", _.appendChild(v), l.appendChild(_), r ? e.children.forEach((e) => {
7104
+ e.attrs && e.attrs.chk !== void 0 && l.appendChild(t("input", {
6705
7105
  type: "hidden",
6706
7106
  name: a,
6707
7107
  value: e.attrs.v || ""
6708
7108
  }));
6709
- }) : f.appendChild(t("input", {
7109
+ }) : l.appendChild(t("input", {
6710
7110
  type: "hidden",
6711
7111
  name: a,
6712
7112
  value: p
6713
- })), s.appendChild(f), s._variantTarget = f, s._slot = _, s._tokuiType = "picker", s._streamCloseHook = function() {
7113
+ })), s.appendChild(l), s._variantTarget = l, s._slot = _, s._tokuiType = "picker", s._streamCloseHook = function() {
6714
7114
  var e = _.querySelectorAll(".tokui-picker-option--selected");
6715
7115
  if (!r && e.length > 0) {
6716
- var n = e[0], o = f.querySelector(".tokui-picker-search"), s = f.querySelector("input[type=hidden]");
7116
+ var n = e[0], o = l.querySelector(".tokui-picker-search"), s = l.querySelector("input[type=hidden]");
6717
7117
  o && !o.value && (o.value = n.getAttribute("data-text")), s && !s.value && (s.value = n.getAttribute("data-value"));
6718
7118
  }
6719
7119
  r && e.length > 0 && e.forEach(function(e) {
@@ -6721,18 +7121,41 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6721
7121
  class: "tokui-picker-tag",
6722
7122
  "data-value": r
6723
7123
  }, n + " "), o = t("span", { class: "tokui-picker-tag-close" }, "×");
6724
- i.appendChild(o), h.insertBefore(i, h.querySelector(".tokui-picker-search")), f.appendChild(t("input", {
7124
+ i.appendChild(o), h.insertBefore(i, h.querySelector(".tokui-picker-search")), l.appendChild(t("input", {
6725
7125
  type: "hidden",
6726
7126
  name: a,
6727
7127
  value: r
6728
7128
  }));
6729
- }), !i && typeof document < "u" && d(f, {
7129
+ }), !i && typeof document < "u" && f(l, {
6730
7130
  multi: r,
6731
7131
  name: a
6732
7132
  });
7133
+ }, s.setAttribute("data-tokui-resettable", ""), s._tokuiReset = function() {
7134
+ var e = l.querySelector(".tokui-picker-search"), n = l.querySelector("input[type=hidden]"), i = _.querySelectorAll(".tokui-picker-option");
7135
+ r ? (h.querySelectorAll(".tokui-picker-tag").forEach(function(e) {
7136
+ h.removeChild(e);
7137
+ }), l.querySelectorAll("input[type=hidden][name=\"" + a + "\"]").forEach(function(e) {
7138
+ l.removeChild(e);
7139
+ }), i.forEach(function(n) {
7140
+ var r = n.getAttribute("data-selected-initial") === "1";
7141
+ if (n.classList.toggle("tokui-picker-option--selected", r), r) {
7142
+ var i = n.getAttribute("data-text"), o = n.getAttribute("data-value"), s = t("span", {
7143
+ class: "tokui-picker-tag",
7144
+ "data-value": o
7145
+ }, i + " ");
7146
+ s.appendChild(t("span", { class: "tokui-picker-tag-close" }, "×")), h.insertBefore(s, e), l.appendChild(t("input", {
7147
+ type: "hidden",
7148
+ name: a,
7149
+ value: o
7150
+ }));
7151
+ }
7152
+ })) : (e && (e.value = m), n && (n.value = p), i.forEach(function(e) {
7153
+ var t = !!p && e.getAttribute("data-value") === p;
7154
+ e.classList.toggle("tokui-picker-option--selected", t);
7155
+ }));
6733
7156
  }, s;
6734
7157
  });
6735
- function c(e) {
7158
+ function u(e) {
6736
7159
  let n = e.attrs && e.attrs.v || "", r = e.attrs && e.attrs.tx || n || e.content || "", i = e.attrs && e.attrs.chk !== void 0, a = t("li", {
6737
7160
  class: "tokui-picker-option",
6738
7161
  "data-value": n,
@@ -6741,16 +7164,16 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6741
7164
  role: "option",
6742
7165
  "aria-selected": String(i)
6743
7166
  }, r);
6744
- return i && a.classList.add("tokui-picker-option--selected"), a;
7167
+ return i && a.classList.add("tokui-picker-option--selected"), i && a.setAttribute("data-selected-initial", "1"), a;
6745
7168
  }
6746
- function u(e, n, r) {
7169
+ function d(e, n, r) {
6747
7170
  let i = e.attrs && e.attrs.tx || e.attrs && e.attrs.v || e.content || "", a = t("span", {
6748
7171
  class: "tokui-picker-tag",
6749
7172
  "data-value": e.attrs && e.attrs.v || e.content || ""
6750
7173
  }, i + " "), o = t("span", { class: "tokui-picker-tag-close" }, "×");
6751
7174
  return a.appendChild(o), a;
6752
7175
  }
6753
- function d(e, n) {
7176
+ function f(e, n) {
6754
7177
  var r = n.multi, i = n.name, a = e.querySelector(".tokui-picker-control"), o = e.querySelector(".tokui-picker-search"), s = e.querySelector(".tokui-picker-dropdown"), c = e.querySelector(".tokui-picker-empty"), l = !1, u = -1;
6755
7178
  function d() {
6756
7179
  return Array.from(s.querySelectorAll(".tokui-picker-option")).filter(function(e) {
@@ -6889,10 +7312,10 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6889
7312
  e.attrs.id && (i.id = e.attrs.id);
6890
7313
  let a = e.attrs.n || e.attrs.id || "radio";
6891
7314
  return i._radioName = a, e.children.forEach((e) => {
6892
- i.appendChild(f(e, a));
7315
+ i.appendChild(p(e, a));
6893
7316
  }), r.appendChild(i), r._slot = i, r._tokuiType = "radio", r;
6894
7317
  });
6895
- function f(e, n) {
7318
+ function p(e, n) {
6896
7319
  let r = t("label", { class: "tokui-radio-item" });
6897
7320
  r.setAttribute("data-tokui-tag", "opt");
6898
7321
  let i = {
@@ -6905,8 +7328,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6905
7328
  return r.appendChild(t("span", { class: "tokui-radio-text" }, a)), r;
6906
7329
  }
6907
7330
  e.register("opt", (e, n, r) => {
6908
- if (r === "radio") return f(e, "");
6909
- if (r === "picker") return c(e);
7331
+ if (r === "radio") return p(e, "");
7332
+ if (r === "picker") return u(e);
6910
7333
  let i = e.attrs ? e.attrs.v : "", a = e.attrs && e.attrs.tx || i || e.content || "";
6911
7334
  return t("option", { value: i }, a);
6912
7335
  }), e.register("checkbox", (e) => {
@@ -6950,9 +7373,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6950
7373
  s(null, e, r);
6951
7374
  });
6952
7375
  }
6953
- return r._update = function(e) {
7376
+ r._update = function(e) {
6954
7377
  e.chk === !0 || e.chk === "true" ? (o.checked = !0, a.setAttribute("aria-checked", "true")) : (e.chk === !1 || e.chk === "false") && (o.checked = !1, a.setAttribute("aria-checked", "false")), e.dis === !0 || e.dis === "true" ? o.disabled = !0 : (e.dis === !1 || e.dis === "false") && (o.disabled = !1);
6955
- }, n.attrs.id && (r.id = n.attrs.id), r;
7378
+ }, n.attrs.id && (r.id = n.attrs.id);
7379
+ var c = n.attrs.chk !== void 0;
7380
+ return r.setAttribute("data-tokui-resettable", ""), r._tokuiReset = function() {
7381
+ o.checked = c, a.setAttribute("aria-checked", String(c));
7382
+ }, r;
6956
7383
  }), e.register("slider", (e) => {
6957
7384
  var n = parseFloat(e.attrs.min) || 0, r = parseFloat(e.attrs.max) || 100, i = parseFloat(e.attrs.step) || 1, a = parseFloat(e.attrs.v) || 0;
6958
7385
  a < n && (a = n), a > r && (a = r);
@@ -6997,7 +7424,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
6997
7424
  };
6998
7425
  s.addEventListener("mousedown", g), s.addEventListener("touchstart", g, { passive: !1 });
6999
7426
  }
7000
- return o._update = function(e) {
7427
+ o._update = function(e) {
7001
7428
  if (e.v !== void 0) {
7002
7429
  var t = parseFloat(e.v) || 0;
7003
7430
  isNaN(n) || (t = Math.max(n, t)), isNaN(r) || (t = Math.min(r, t)), a = t;
@@ -7005,6 +7432,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7005
7432
  l.style.width = i + "%", u.style.left = i + "%", d.textContent = String(a), f.value = a, u.setAttribute("aria-valuenow", String(a));
7006
7433
  }
7007
7434
  e.dis === !0 || e.dis === "true" ? s.classList.add("tokui-slider--disabled") : (e.dis === !1 || e.dis === "false") && s.classList.remove("tokui-slider--disabled");
7435
+ };
7436
+ var _ = a;
7437
+ return o.setAttribute("data-tokui-resettable", ""), o._tokuiReset = function() {
7438
+ a = _;
7439
+ var e = (a - n) / (r - n) * 100;
7440
+ l.style.width = e + "%", u.style.left = e + "%", d.textContent = String(a), f.value = a, u.setAttribute("aria-valuenow", String(a));
7008
7441
  }, s._variantTarget = s, o.appendChild(s), o;
7009
7442
  }), e.register("rate", (e) => {
7010
7443
  var n = parseInt(e.attrs.max) || 5, r = parseInt(e.attrs.v) || 0, i = e.attrs.tx || "★", a = "☆", o = t("div", { class: "tokui-field" });
@@ -7029,7 +7462,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7029
7462
  d.textContent = u < r ? i : a, u < r && d.classList.add("tokui-rate__star--active"), l.push(d), s.appendChild(d);
7030
7463
  }
7031
7464
  var f = t("span", { class: "tokui-rate__text" });
7032
- return r > 0 && (f.textContent = r + "/" + n), s.appendChild(f), s.appendChild(c), e.attrs.dis === void 0 ? (s.addEventListener("mouseover", function(e) {
7465
+ r > 0 && (f.textContent = r + "/" + n), s.appendChild(f), s.appendChild(c), e.attrs.dis === void 0 ? (s.addEventListener("mouseover", function(e) {
7033
7466
  var t = e.target;
7034
7467
  if (t.classList.contains("tokui-rate__star")) for (var n = parseInt(t.getAttribute("data-index")), r = 0; r < l.length; r++) l[r].textContent = r < n ? i : a, l[r].classList.toggle("tokui-rate__star--hover", r < n);
7035
7468
  }), s.addEventListener("mouseout", function() {
@@ -7061,6 +7494,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7061
7494
  for (var t = 0; t < l.length; t++) l[t].textContent = t < r ? i : a, l[t].classList.toggle("tokui-rate__star--active", t < r), l[t].setAttribute("aria-checked", String(t < r));
7062
7495
  }
7063
7496
  e.dis === !0 || e.dis === "true" ? s.classList.add("tokui-rate--disabled") : (e.dis === !1 || e.dis === "false") && s.classList.remove("tokui-rate--disabled");
7497
+ };
7498
+ var p = r;
7499
+ return o.setAttribute("data-tokui-resettable", ""), o._tokuiReset = function() {
7500
+ r = p, c.value = r, f.textContent = r > 0 ? r + "/" + n : "";
7501
+ for (var e = 0; e < l.length; e++) l[e].textContent = e < r ? i : a, l[e].classList.toggle("tokui-rate__star--active", e < r), l[e].setAttribute("aria-checked", String(e < r));
7064
7502
  }, s._variantTarget = s, o.appendChild(s), o;
7065
7503
  }), e.register("transfer", (e, n) => {
7066
7504
  var r = t("div", { class: "tokui-field" });
@@ -7153,7 +7591,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7153
7591
  }
7154
7592
  function b(e) {
7155
7593
  var t = e.attrs && e.attrs.v || "", n = e.attrs && e.attrs.tx || t, i = e.attrs && e.attrs.chk !== void 0, a = o(t, n, r._transferOptIdx++);
7156
- return i ? (u._body.appendChild(a), u._items.push(a)) : (l._body.appendChild(a), l._items.push(a)), _(l), _(u), g(), a;
7594
+ return a.setAttribute("data-tokui-init-side", i ? "right" : "left"), i ? (u._body.appendChild(a), u._items.push(a)) : (l._body.appendChild(a), l._items.push(a)), _(l), _(u), g(), a;
7157
7595
  }
7158
7596
  p.addEventListener("click", function() {
7159
7597
  v(l, u);
@@ -7165,7 +7603,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7165
7603
  return b(e);
7166
7604
  }, e.children && e.children.length && y(e.children), r._streamCloseHook = function() {
7167
7605
  x.innerHTML = "";
7168
- }, r._slot = x, r._tokuiType = "transfer", i._variantTarget = i, r.appendChild(i), r;
7606
+ }, r._slot = x, r._tokuiType = "transfer", i._variantTarget = i, r.setAttribute("data-tokui-resettable", ""), r._tokuiReset = function() {
7607
+ l._items.concat(u._items).forEach(function(e) {
7608
+ var t = (e.getAttribute("data-tokui-init-side") || "left") === "right" ? u : l, n = u._items.indexOf(e) === -1 ? l : u;
7609
+ n !== t && (n._items.splice(n._items.indexOf(e), 1), t._body.appendChild(e), t._items.push(e)), e._cb && (e._cb.checked = !1);
7610
+ }), _(l), _(u), g();
7611
+ }, r.appendChild(i), r;
7169
7612
  }), e.register("numinput", (e) => {
7170
7613
  var n = parseFloat(e.attrs.min), r = parseFloat(e.attrs.max), i = parseFloat(e.attrs.step) || 1, a = parseFloat(e.attrs.v) || 0;
7171
7614
  isNaN(n) || (a = Math.max(n, a)), isNaN(r) || (a = Math.min(r, a));
@@ -7209,15 +7652,19 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7209
7652
  isNaN(e) && (e = 0), t(e);
7210
7653
  });
7211
7654
  }
7212
- return s._update = function(e) {
7655
+ s._update = function(e) {
7213
7656
  if (e.v !== void 0) {
7214
7657
  var t = parseFloat(e.v) || 0;
7215
7658
  isNaN(n) || (t = Math.max(n, t)), isNaN(r) || (t = Math.min(r, t)), a = t, d.value = String(a), m.value = a;
7216
7659
  }
7217
7660
  e.dis === !0 || e.dis === "true" ? (d.disabled = !0, c.classList.add("tokui-numinput--disabled")) : (e.dis === !1 || e.dis === "false") && (d.disabled = !1, c.classList.remove("tokui-numinput--disabled"));
7661
+ };
7662
+ var h = a;
7663
+ return s.setAttribute("data-tokui-resettable", ""), s._tokuiReset = function() {
7664
+ a = h, d.value = String(a), d.setAttribute("value", String(a)), m.value = a;
7218
7665
  }, s.appendChild(c), s._variantTarget = c, s;
7219
7666
  });
7220
- var p = new Set([
7667
+ var h = new Set([
7221
7668
  "primary",
7222
7669
  "danger",
7223
7670
  "success",
@@ -7230,25 +7677,35 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7230
7677
  "block"
7231
7678
  ]);
7232
7679
  e.register("btn", (e) => {
7233
- var r = e.attrs.sub ? "submit" : "button", i = "tokui-btn";
7234
- e.attrs.t && p.has(e.attrs.t) && (i += " tokui-btn--" + e.attrs.t);
7235
- let a = {
7236
- class: i,
7237
- type: r
7680
+ let i = n(e.attrs);
7681
+ var a = i.act === "submit" ? "submit" : i.act === "reset" ? "reset" : "button", o = "tokui-btn";
7682
+ e.attrs.t && h.has(e.attrs.t) && (o += " tokui-btn--" + e.attrs.t), i.act === "print" && (o += " tokui-btn--print");
7683
+ let s = {
7684
+ class: o,
7685
+ type: a
7238
7686
  };
7239
- e.attrs.clk && (a["data-tokui-clk"] = e.attrs.clk), e.attrs.sub && (a["data-tokui-sub"] = e.attrs.sub), e.attrs.id && (a.id = e.attrs.id), e.attrs.dis !== void 0 && (a.disabled = "disabled"), Object.keys(e.attrs).forEach((t) => {
7240
- t.startsWith("data-") && (a[t] = e.attrs[t]);
7241
- });
7242
- let o = "";
7243
- e.attrs.w && (o += "width:" + e.attrs.w + ";");
7244
- let s = n(e.attrs.bg);
7245
- s && (o += "background:" + s + ";");
7246
- let c = n(e.attrs.fc);
7247
- c && (o += "color:" + c + ";"), e.attrs.radius && (o += "border-radius:" + e.attrs.radius + ";"), o && (a.style = o);
7248
- let l = t("button", a, e.attrs.tx || e.content || "按钮");
7249
- return l._tokuiType = "btn", l._update = function(e) {
7250
- e.dis === !0 || e.dis === "true" ? l.disabled = !0 : (e.dis === !1 || e.dis === "false") && (l.disabled = !1), e.tx !== void 0 && (l.textContent = e.tx);
7251
- }, l;
7687
+ i.formId && (s["data-tokui-form"] = i.formId), i.act && (s["data-tokui-act"] = i.act), i.act === "submit" && i.handler && (s["data-tokui-sub"] = i.handler), i.act === "reset" && i.handler && (s["data-tokui-handler"] = i.handler), i.act === "print" && (s["data-tokui-target"] = i.target, s["data-tokui-print-trigger"] = ""), !i.act && i.handler && (s["data-tokui-clk"] = i.handler), e.attrs.id && (s.id = e.attrs.id), e.attrs.dis !== void 0 && (s.disabled = "disabled"), Object.keys(e.attrs).forEach((t) => {
7688
+ t.startsWith("data-") && (s[t] = e.attrs[t]);
7689
+ });
7690
+ let c = "";
7691
+ e.attrs.w && (c += "width:" + e.attrs.w + ";");
7692
+ let l = r(e.attrs.bg);
7693
+ l && (c += "background:" + l + ";");
7694
+ let u = r(e.attrs.fc);
7695
+ u && (c += "color:" + u + ";"), e.attrs.radius && (c += "border-radius:" + e.attrs.radius + ";"), c && (s.style = c);
7696
+ let d = t("button", s, e.attrs.tx || e.content || "按钮");
7697
+ return d._tokuiType = "btn", d._update = function(e) {
7698
+ e.dis === !0 || e.dis === "true" ? d.disabled = !0 : (e.dis === !1 || e.dis === "false") && (d.disabled = !1), e.tx !== void 0 && (d.textContent = e.tx);
7699
+ }, d;
7700
+ }), e.register("print-area", (e, n) => {
7701
+ let r = { class: "tokui-print-area" };
7702
+ e.attrs.id && (r.id = e.attrs.id);
7703
+ let i = t("div", r);
7704
+ e.attrs.tt && i.appendChild(t("div", { class: "tokui-print-area__title" }, e.attrs.tt));
7705
+ let a = t("div", { class: "tokui-print-area__body" });
7706
+ return n(e.children).forEach((e) => {
7707
+ e && e.nodeType && a.appendChild(e);
7708
+ }), i.appendChild(a), i._slot = a, i._tokuiType = "print-area", i;
7252
7709
  }), e.register("btngroup", (e, n) => {
7253
7710
  let r = { class: "tokui-btn-group" };
7254
7711
  e.attrs.id && (r.id = e.attrs.id);
@@ -7392,7 +7849,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7392
7849
  }), typeof document < "u" && document.addEventListener("click", function() {
7393
7850
  v.isOpen && b();
7394
7851
  }));
7395
- function x(t) {
7852
+ var x = {
7853
+ hidden: "",
7854
+ text: ""
7855
+ };
7856
+ function S(t) {
7396
7857
  if (v.tree = t, e.attrs.v) {
7397
7858
  for (var n = String(e.attrs.v).split("/"), r = !0, i = [], a = t, o = 0; o < n.length; o++) {
7398
7859
  for (var s = !1, l = 0; l < a.length; l++) if (a[l].v === n[o]) {
@@ -7406,10 +7867,13 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7406
7867
  }
7407
7868
  r && i.length === n.length && (c.value = i.join(" / "), d.value = e.attrs.v);
7408
7869
  }
7870
+ x.hidden = d.value, x.text = c.value;
7409
7871
  }
7410
- return e.children && e.children.length && x(p(e.children)), a._streamCloseHook = function() {
7411
- f.innerHTML = "", x(p(e.children));
7412
- }, a._slot = f, a._tokuiType = "cascader", a._variantTarget = o, a;
7872
+ return e.children && e.children.length && S(p(e.children)), a._streamCloseHook = function() {
7873
+ f.innerHTML = "", S(p(e.children));
7874
+ }, a._slot = f, a._tokuiType = "cascader", a._variantTarget = o, a.setAttribute("data-tokui-resettable", ""), a._tokuiReset = function() {
7875
+ d.value = x.hidden, c.value = x.text, v.isOpen && b();
7876
+ }, a;
7413
7877
  }), e.register("upload", (e) => {
7414
7878
  var n = e.attrs.dis !== void 0, r = e.attrs.multi !== void 0, i = parseInt(e.attrs.max) || 0, a = e.attrs.ph || "点击或拖拽文件至此处上传", o = e.attrs.accept || "", s = t("div", { class: "tokui-field" });
7415
7879
  e.attrs.l && s.appendChild(t("label", { class: "tokui-label" }, e.attrs.l)), e.attrs.id && (s.id = e.attrs.id);
@@ -7490,24 +7954,24 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7490
7954
  }
7491
7955
  })), s.appendChild(c), s._variantTarget = c, s;
7492
7956
  });
7493
- function h(e) {
7957
+ function g(e) {
7494
7958
  if (!e) return null;
7495
7959
  var t = e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})/);
7496
7960
  return t ? new Date(parseInt(t[1]), parseInt(t[2]) - 1, parseInt(t[3])) : null;
7497
7961
  }
7498
- function g(e) {
7962
+ function v(e) {
7499
7963
  if (!e) return null;
7500
7964
  var t = e.match(/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})/);
7501
7965
  return t ? new Date(parseInt(t[1]), parseInt(t[2]) - 1, parseInt(t[3]), parseInt(t[4]), parseInt(t[5])) : null;
7502
7966
  }
7503
- function v(e, t) {
7967
+ function y(e, t) {
7504
7968
  var n = e.getFullYear(), r = e.getMonth() + 1, i = e.getDate(), a = e.getHours(), o = e.getMinutes(), s = e.getSeconds();
7505
7969
  return t.replace("YYYY", String(n)).replace("MM", r < 10 ? "0" + r : String(r)).replace("DD", i < 10 ? "0" + i : String(i)).replace("HH", a < 10 ? "0" + a : String(a)).replace("mm", o < 10 ? "0" + o : String(o)).replace("ss", s < 10 ? "0" + s : String(s));
7506
7970
  }
7507
- function y(e, t, n, r) {
7971
+ function b(e, t, n, r) {
7508
7972
  return r.replace("HH", e < 10 ? "0" + e : String(e)).replace("mm", t < 10 ? "0" + t : String(t)).replace("ss", n < 10 ? "0" + n : String(n));
7509
7973
  }
7510
- function b(e, t) {
7974
+ function x(e, t) {
7511
7975
  var n = e.querySelector(".tokui-timepicker-column-list");
7512
7976
  if (n) {
7513
7977
  var r = n.querySelectorAll(".tokui-timepicker-column-item");
@@ -7516,8 +7980,8 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7516
7980
  }));
7517
7981
  }
7518
7982
  }
7519
- function x(e, t) {
7520
- b(e, t);
7983
+ function S(e, t) {
7984
+ x(e, t);
7521
7985
  var n = e.querySelector(".tokui-timepicker-column-list");
7522
7986
  if (n) {
7523
7987
  var r = n.querySelectorAll(".tokui-timepicker-column-item");
@@ -7531,7 +7995,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7531
7995
  }
7532
7996
  }
7533
7997
  }
7534
- function S(e) {
7998
+ function C(e) {
7535
7999
  var t = e.querySelector(".tokui-timepicker-column-list");
7536
8000
  if (!t) return 0;
7537
8001
  var n = t.querySelectorAll(".tokui-timepicker-column-item");
@@ -7546,14 +8010,14 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7546
8010
  var u = n[0].offsetHeight || 32, d = Math.round((t.scrollTop + (t.clientHeight || 192) / 2) / u) - 0;
7547
8011
  return Math.max(0, Math.min(d, n.length - 1));
7548
8012
  }
7549
- function C(e, n, r) {
8013
+ function w(e, n, r) {
7550
8014
  for (var i = t("div", { class: "tokui-timepicker-column" }), a = t("div", { class: "tokui-timepicker-column-list" }), o = 0; o < n; o++) {
7551
8015
  var s = t("div", {
7552
8016
  class: "tokui-timepicker-column-item" + (o === r ? " tokui-timepicker-column-item--selected" : ""),
7553
8017
  "data-value": String(o)
7554
8018
  }, o < 10 ? "0" + o : String(o));
7555
8019
  s.addEventListener("click", function(e) {
7556
- e.stopPropagation(), x(i, parseInt(this.getAttribute("data-value"), 10));
8020
+ e.stopPropagation(), S(i, parseInt(this.getAttribute("data-value"), 10));
7557
8021
  }), a.appendChild(s);
7558
8022
  }
7559
8023
  i.appendChild(a);
@@ -7562,48 +8026,48 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7562
8026
  };
7563
8027
  return a.addEventListener("scroll", function() {
7564
8028
  c || (c = 1, l(function() {
7565
- c = 0, b(i, S(i));
8029
+ c = 0, x(i, C(i));
7566
8030
  }));
7567
8031
  }), i._label = e, i;
7568
8032
  }
7569
- function w(e) {
7570
- var t = S(e);
7571
- b(e, t);
8033
+ function T(e) {
8034
+ var t = C(e);
8035
+ x(e, t);
7572
8036
  var n = e.querySelector(".tokui-timepicker-column-list").querySelectorAll(".tokui-timepicker-column-item");
7573
8037
  return parseInt(n[t].getAttribute("data-value")) || 0;
7574
8038
  }
7575
- function T(e, t) {
7576
- x(e, t);
8039
+ function E(e, t) {
8040
+ S(e, t);
7577
8041
  }
7578
- var E = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal._datePickers = window.TokUI._internal._datePickers || /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
7579
- function D(e) {
8042
+ var D = typeof window < "u" && window.TokUI && window.TokUI._internal ? window.TokUI._internal._datePickers = window.TokUI._internal._datePickers || /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set();
8043
+ function O(e) {
7580
8044
  var t = [];
7581
- E.forEach(function(n) {
8045
+ D.forEach(function(n) {
7582
8046
  n !== e && t.push(n);
7583
8047
  }), t.forEach(function(e) {
7584
8048
  try {
7585
8049
  e();
7586
8050
  } catch {}
7587
- }), E.add(e);
8051
+ }), D.add(e);
7588
8052
  }
7589
- function O(e) {
7590
- E.delete(e);
8053
+ function k(e) {
8054
+ D.delete(e);
7591
8055
  }
7592
- function k() {
8056
+ function A() {
7593
8057
  var e = [];
7594
- E.forEach(function(t) {
8058
+ D.forEach(function(t) {
7595
8059
  e.push(t);
7596
- }), E.clear(), e.forEach(function(e) {
8060
+ }), D.clear(), e.forEach(function(e) {
7597
8061
  try {
7598
8062
  e();
7599
8063
  } catch {}
7600
8064
  });
7601
8065
  }
7602
- typeof window < "u" && !window.TokUI._internal._dateScrollBound && (window.addEventListener("scroll", k), window.TokUI._internal._dateScrollBound = !0);
7603
- function A() {
8066
+ typeof window < "u" && !window.TokUI._internal._dateScrollBound && (window.addEventListener("scroll", A), window.TokUI._internal._dateScrollBound = !0);
8067
+ function j() {
7604
8068
  return typeof window < "u" && window.innerWidth ? window.innerWidth : typeof document < "u" && document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : 1024;
7605
8069
  }
7606
- function j(e, n, r, i, a) {
8070
+ function M(e, n, r, i, a) {
7607
8071
  var o = t("div", { class: "tokui-datepicker-header" }), s = t("button", {
7608
8072
  class: "tokui-datepicker-nav tokui-datepicker-nav--prev",
7609
8073
  type: "button"
@@ -7660,32 +8124,32 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7660
8124
  u.appendChild(f);
7661
8125
  var p = t("span", { class: "tokui-datepicker-icon" });
7662
8126
  p.innerHTML = "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/></svg>", u.appendChild(p), l.appendChild(u);
7663
- var m = t("div", { class: "tokui-datepicker-dropdown" }), g = /* @__PURE__ */ new Date(), _, y, b;
7664
- o && (b = h(o), b && (_ = b.getFullYear(), y = b.getMonth())), _ || (_ = g.getFullYear(), y = g.getMonth());
8127
+ var m = t("div", { class: "tokui-datepicker-dropdown" }), h = /* @__PURE__ */ new Date(), _, v, b;
8128
+ o && (b = g(o), b && (_ = b.getFullYear(), v = b.getMonth())), _ || (_ = h.getFullYear(), v = h.getMonth());
7665
8129
  var x = t("input", { type: "hidden" });
7666
8130
  n.n ? x.name = n.n : n.id && (x.name = n.id), x.value = o, l.appendChild(x);
7667
8131
  function S(e, t) {
7668
8132
  m.innerHTML = "";
7669
- var n = j(e, t, b, g, m);
8133
+ var n = M(e, t, b, h, m);
7670
8134
  n.prevBtn.addEventListener("click", function(e) {
7671
- e.stopPropagation(), y--, y < 0 && (y = 11, _--), S(_, y);
8135
+ e.stopPropagation(), v--, v < 0 && (v = 11, _--), S(_, v);
7672
8136
  }), n.nextBtn.addEventListener("click", function(e) {
7673
- e.stopPropagation(), y++, y > 11 && (y = 0, _++), S(_, y);
8137
+ e.stopPropagation(), v++, v > 11 && (v = 0, _++), S(_, v);
7674
8138
  });
7675
8139
  }
7676
- S(_, y), m.style.display = "none", l.appendChild(m);
8140
+ S(_, v), m.style.display = "none", l.appendChild(m);
7677
8141
  var C = !1;
7678
8142
  function w() {
7679
8143
  if (!(r || C)) {
7680
- D(T), C = !0, m.style.display = "", l.classList.add("tokui-datepicker--open");
8144
+ O(T), C = !0, m.style.display = "", l.classList.add("tokui-datepicker--open");
7681
8145
  var e = u.getBoundingClientRect();
7682
8146
  m.style.left = e.left + "px", m.style.top = e.bottom + 4 + "px", m.style.width = "auto";
7683
- var t = A();
8147
+ var t = j();
7684
8148
  e.left + m.offsetWidth > t - 8 && (m.style.left = Math.max(8, t - m.offsetWidth - 8) + "px");
7685
8149
  }
7686
8150
  }
7687
8151
  function T() {
7688
- C && (C = !1, m.style.display = "none", l.classList.remove("tokui-datepicker--open"), O(T));
8152
+ C && (C = !1, m.style.display = "none", l.classList.remove("tokui-datepicker--open"), k(T));
7689
8153
  }
7690
8154
  return r || (u.addEventListener("click", function(e) {
7691
8155
  e.stopPropagation(), C ? T() : w();
@@ -7694,9 +8158,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7694
8158
  var t = e.target.closest(".tokui-datepicker-day");
7695
8159
  if (!(!t || t.classList.contains("tokui-datepicker-day--other"))) {
7696
8160
  var r = parseInt(t.getAttribute("data-day"));
7697
- b = new Date(_, y, r);
7698
- var a = v(b, i);
7699
- if (f.value = a, x.value = a, T(), S(_, y), n.clk) {
8161
+ b = new Date(_, v, r);
8162
+ var a = y(b, i);
8163
+ if (f.value = a, x.value = a, T(), S(_, v), n.clk) {
7700
8164
  var o = typeof window < "u" && window.TokUI && window.TokUI._eventBus ? window.TokUI._eventBus.getHandler(n.clk) : null;
7701
8165
  o && o({
7702
8166
  value: a,
@@ -7729,35 +8193,35 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7729
8193
  var _ = o.split(":");
7730
8194
  m = parseInt(_[0]) || 0, h = parseInt(_[1]) || 0, g = parseInt(_[2]) || 0;
7731
8195
  }
7732
- var v = t("div", { class: "tokui-timepicker-dropdown" }), b = i.indexOf("ss") !== -1 || i.indexOf("s") !== -1, x = t("div", { class: "tokui-timepicker-columns" }), S = C("时", 24, m), E = C("分", 60, h);
7733
- x.appendChild(S), x.appendChild(E);
7734
- var k = null;
7735
- b && (k = C("秒", 60, g), x.appendChild(k)), v.appendChild(x);
7736
- var j = t("div", { class: "tokui-timepicker-footer" }), M = t("button", {
8196
+ var v = t("div", { class: "tokui-timepicker-dropdown" }), y = i.indexOf("ss") !== -1 || i.indexOf("s") !== -1, x = t("div", { class: "tokui-timepicker-columns" }), S = w("时", 24, m), C = w("分", 60, h);
8197
+ x.appendChild(S), x.appendChild(C);
8198
+ var D = null;
8199
+ y && (D = w("秒", 60, g), x.appendChild(D)), v.appendChild(x);
8200
+ var A = t("div", { class: "tokui-timepicker-footer" }), M = t("button", {
7737
8201
  class: "tokui-timepicker-confirm",
7738
8202
  type: "button"
7739
8203
  }, "确定");
7740
- j.appendChild(M), v.appendChild(j);
8204
+ A.appendChild(M), v.appendChild(A);
7741
8205
  var N = t("input", { type: "hidden" });
7742
8206
  n.n ? N.name = n.n : n.id && (N.name = n.id), N.value = o, l.appendChild(N), v.style.display = "none", l.appendChild(v);
7743
8207
  var P = !1;
7744
8208
  function F() {
7745
8209
  if (!(r || P)) {
7746
- D(I), P = !0, v.style.display = "", l.classList.add("tokui-timepicker--open");
8210
+ O(I), P = !0, v.style.display = "", l.classList.add("tokui-timepicker--open");
7747
8211
  var e = u.getBoundingClientRect();
7748
8212
  v.style.left = e.left + "px", v.style.top = e.bottom + 4 + "px", v.style.width = "auto";
7749
- var t = A();
7750
- e.left + v.offsetWidth > t - 8 && (v.style.left = Math.max(8, t - v.offsetWidth - 8) + "px"), T(S, m), T(E, h), b && k && T(k, g);
8213
+ var t = j();
8214
+ e.left + v.offsetWidth > t - 8 && (v.style.left = Math.max(8, t - v.offsetWidth - 8) + "px"), E(S, m), E(C, h), y && D && E(D, g);
7751
8215
  }
7752
8216
  }
7753
8217
  function I() {
7754
- P && (P = !1, v.style.display = "none", l.classList.remove("tokui-timepicker--open"), O(I));
8218
+ P && (P = !1, v.style.display = "none", l.classList.remove("tokui-timepicker--open"), k(I));
7755
8219
  }
7756
8220
  return r || (u.addEventListener("click", function(e) {
7757
8221
  e.stopPropagation(), P ? I() : F();
7758
8222
  }), M.addEventListener("click", function(e) {
7759
- e.stopPropagation(), m = w(S), h = w(E), b && k && (g = w(k));
7760
- var t = y(m, h, g, i);
8223
+ e.stopPropagation(), m = T(S), h = T(C), y && D && (g = T(D));
8224
+ var t = b(m, h, g, i);
7761
8225
  if (f.value = t, N.value = t, I(), n.clk) {
7762
8226
  var r = typeof window < "u" && window.TokUI && window.TokUI._eventBus ? window.TokUI._eventBus.getHandler(n.clk) : null;
7763
8227
  r && r({
@@ -7787,21 +8251,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7787
8251
  u.appendChild(f);
7788
8252
  var p = t("span", { class: "tokui-datetimepicker-icon" });
7789
8253
  p.innerHTML = "<svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"3\" y=\"4\" width=\"18\" height=\"18\" rx=\"2\"/><line x1=\"16\" y1=\"2\" x2=\"16\" y2=\"6\"/><line x1=\"8\" y1=\"2\" x2=\"8\" y2=\"6\"/><line x1=\"3\" y1=\"10\" x2=\"21\" y2=\"10\"/></svg>", u.appendChild(p), l.appendChild(u);
7790
- var m = /* @__PURE__ */ new Date(), _, y, b, x = 0, S = 0, E = 0;
7791
- o && (b = g(o) || h(o), b && (_ = b.getFullYear(), y = b.getMonth(), x = b.getHours(), S = b.getMinutes(), E = b.getSeconds())), _ || (_ = m.getFullYear(), y = m.getMonth());
7792
- var k = t("input", { type: "hidden" });
7793
- n.n ? k.name = n.n : n.id && (k.name = n.id), k.value = o, l.appendChild(k);
7794
- var M = t("div", { class: "tokui-datetimepicker-dropdown" }), N = t("div", { class: "tokui-datetimepicker-date" }), P = i.indexOf("ss") !== -1 || i.indexOf("s") !== -1, F = t("div", { class: "tokui-datetimepicker-time" }), I = t("div", { class: "tokui-timepicker-columns" }), L = C("时", 24, x), R = C("分", 60, S);
8254
+ var m = /* @__PURE__ */ new Date(), h, _, b, x = 0, S = 0, C = 0;
8255
+ o && (b = v(o) || g(o), b && (h = b.getFullYear(), _ = b.getMonth(), x = b.getHours(), S = b.getMinutes(), C = b.getSeconds())), h || (h = m.getFullYear(), _ = m.getMonth());
8256
+ var D = t("input", { type: "hidden" });
8257
+ n.n ? D.name = n.n : n.id && (D.name = n.id), D.value = o, l.appendChild(D);
8258
+ var A = t("div", { class: "tokui-datetimepicker-dropdown" }), N = t("div", { class: "tokui-datetimepicker-date" }), P = i.indexOf("ss") !== -1 || i.indexOf("s") !== -1, F = t("div", { class: "tokui-datetimepicker-time" }), I = t("div", { class: "tokui-timepicker-columns" }), L = w("时", 24, x), R = w("分", 60, S);
7795
8259
  I.appendChild(L), I.appendChild(R);
7796
8260
  var z = null;
7797
- P && (z = C("秒", 60, E), I.appendChild(z)), F.appendChild(I);
8261
+ P && (z = w("秒", 60, C), I.appendChild(z)), F.appendChild(I);
7798
8262
  function B(e, t) {
7799
8263
  N.innerHTML = "";
7800
- var n = j(e, t, b, m, N);
8264
+ var n = M(e, t, b, m, N);
7801
8265
  n.prevBtn.addEventListener("click", function(e) {
7802
- e.stopPropagation(), y--, y < 0 && (y = 11, _--), B(_, y);
8266
+ e.stopPropagation(), _--, _ < 0 && (_ = 11, h--), B(h, _);
7803
8267
  }), n.nextBtn.addEventListener("click", function(e) {
7804
- e.stopPropagation(), y++, y > 11 && (y = 0, _++), B(_, y);
8268
+ e.stopPropagation(), _++, _ > 11 && (_ = 0, h++), B(h, _);
7805
8269
  });
7806
8270
  }
7807
8271
  var V = t("div", { class: "tokui-datetimepicker-footer" }), H = t("button", {
@@ -7810,19 +8274,19 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7810
8274
  }, "确定");
7811
8275
  V.appendChild(H);
7812
8276
  var U = t("div", { class: "tokui-datetimepicker-body" });
7813
- U.appendChild(N), U.appendChild(F), M.appendChild(U), M.appendChild(V), B(_, y), M.style.display = "none", l.appendChild(M);
8277
+ U.appendChild(N), U.appendChild(F), A.appendChild(U), A.appendChild(V), B(h, _), A.style.display = "none", l.appendChild(A);
7814
8278
  var W = !1;
7815
8279
  function G() {
7816
8280
  if (!(r || W)) {
7817
- D(K), W = !0, M.style.display = "", l.classList.add("tokui-datetimepicker--open");
8281
+ O(K), W = !0, A.style.display = "", l.classList.add("tokui-datetimepicker--open");
7818
8282
  var e = u.getBoundingClientRect();
7819
- M.style.left = e.left + "px", M.style.top = e.bottom + 4 + "px", M.style.width = "auto";
7820
- var t = M.offsetWidth, n = A();
7821
- e.left + t > n - 8 && (M.style.left = Math.max(8, n - t - 8) + "px"), T(L, x), T(R, S), P && z && T(z, E);
8283
+ A.style.left = e.left + "px", A.style.top = e.bottom + 4 + "px", A.style.width = "auto";
8284
+ var t = A.offsetWidth, n = j();
8285
+ e.left + t > n - 8 && (A.style.left = Math.max(8, n - t - 8) + "px"), E(L, x), E(R, S), P && z && E(z, C);
7822
8286
  }
7823
8287
  }
7824
8288
  function K() {
7825
- W && (W = !1, M.style.display = "none", l.classList.remove("tokui-datetimepicker--open"), O(K));
8289
+ W && (W = !1, A.style.display = "none", l.classList.remove("tokui-datetimepicker--open"), k(K));
7826
8290
  }
7827
8291
  return r || (u.addEventListener("click", function(e) {
7828
8292
  e.stopPropagation(), W ? K() : G();
@@ -7831,12 +8295,12 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7831
8295
  var t = e.target.closest(".tokui-datepicker-day");
7832
8296
  if (!(!t || t.classList.contains("tokui-datepicker-day--other"))) {
7833
8297
  var n = parseInt(t.getAttribute("data-day"));
7834
- b = new Date(_, y, n), B(_, y);
8298
+ b = new Date(h, _, n), B(h, _);
7835
8299
  }
7836
8300
  }), H.addEventListener("click", function(e) {
7837
- e.stopPropagation(), b ||= new Date(_, y, m.getDate()), x = w(L), S = w(R), P && z && (E = w(z)), b.setHours(x, S, E);
7838
- var t = v(b, i);
7839
- if (f.value = t, k.value = t, K(), n.clk) {
8301
+ e.stopPropagation(), b ||= new Date(h, _, m.getDate()), x = T(L), S = T(R), P && z && (C = T(z)), b.setHours(x, S, C);
8302
+ var t = y(b, i);
8303
+ if (f.value = t, D.value = t, K(), n.clk) {
7840
8304
  var r = typeof window < "u" && window.TokUI && window.TokUI._eventBus ? window.TokUI._eventBus.getHandler(n.clk) : null;
7841
8305
  r && r({
7842
8306
  value: t,
@@ -7956,17 +8420,21 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7956
8420
  return c.textContent = r.tx || e.content || "", a.appendChild(c), a;
7957
8421
  }
7958
8422
  e.register("item", (e, n, r) => {
7959
- if (r === "desc") return i(e);
7960
- if (r === "carousel") return o(e, n);
7961
- if (r === "command-group") {
7962
- var a = typeof window < "u" && window.TokUI && window.TokUI._internal && window.TokUI._internal.buildCommandItem || null;
7963
- if (a) return a(e);
7964
- }
7965
- let s = t("li", { class: "tokui-list-item" });
7966
- var c = e.content || e.attrs && e.attrs.tx || "";
7967
- return c && (s.textContent = c), n(e.children || []).forEach((e) => {
7968
- e && e.nodeType && s.appendChild(e);
7969
- }), s._slot = s, s._tokuiType = "item", s;
8423
+ var a;
8424
+ if (r === "desc") a = i(e);
8425
+ else if (r === "carousel") a = c(e, n);
8426
+ else if (r === "command-group") {
8427
+ var o = typeof window < "u" && window.TokUI && window.TokUI._internal && window.TokUI._internal.buildCommandItem || null;
8428
+ o && (a = o(e));
8429
+ }
8430
+ if (!a) {
8431
+ a = t("li", { class: "tokui-list-item" });
8432
+ var s = e.content || e.attrs && e.attrs.tx || "";
8433
+ s && (a.textContent = s), n(e.children || []).forEach((e) => {
8434
+ e && e.nodeType && a.appendChild(e);
8435
+ }), a._slot = a;
8436
+ }
8437
+ return a.nodeType === 1 && (a._tokuiType = "item"), a;
7970
8438
  }), e.register("tabs", (e, n) => {
7971
8439
  let r = t("div", {
7972
8440
  class: "tokui-tabs",
@@ -7988,6 +8456,11 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
7988
8456
  var t = r.querySelector("input[data-index=\"" + e.v + "\"]");
7989
8457
  t && (t.checked = !0);
7990
8458
  }
8459
+ }, r._streamCloseHook = function() {
8460
+ if (r._tokuiStreamActive) {
8461
+ var e = r.querySelector("input[data-index=\"0\"]");
8462
+ e && (e.checked = !0);
8463
+ }
7991
8464
  }, r;
7992
8465
  });
7993
8466
  function a(e, n, r, i, a) {
@@ -8030,7 +8503,9 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8030
8503
  var r = t("div", { class: "tokui-accordion" });
8031
8504
  return n(e.children || []).forEach((e) => {
8032
8505
  e && e.nodeType && r.appendChild(e);
8033
- }), r._slot = r, r._tokuiType = "accordion", r;
8506
+ }), r._slot = r, r._tokuiType = "accordion", r._streamCloseHook = function() {
8507
+ if (r._tokuiStreamActive) for (var e = r.querySelectorAll(".tokui-collapse"), t = 0; t < e.length; t++) t === 0 ? (e[t].setAttribute("open", ""), e[t].setAttribute("aria-expanded", "true")) : (e[t].removeAttribute("open"), e[t].setAttribute("aria-expanded", "false"));
8508
+ }, r;
8034
8509
  }), e.register("collapse", (e, n) => {
8035
8510
  var r = {
8036
8511
  class: "tokui-collapse",
@@ -8264,19 +8739,46 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8264
8739
  n.textContent = e.content, a.appendChild(n);
8265
8740
  }
8266
8741
  return r.appendChild(a), r;
8267
- }), e.register("desc", (e, n) => {
8742
+ });
8743
+ function o(e) {
8744
+ 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");
8745
+ var r = e.querySelectorAll(".tokui-desc__item");
8746
+ if (r.length) {
8747
+ var i = r[r.length - 1];
8748
+ if (i.getBoundingClientRect) for (var a = i.getBoundingClientRect().top, o = r.length - 1; o >= 0 && Math.abs(r[o].getBoundingClientRect().top - a) < 1; o--) r[o].classList.add("tokui-desc__item--last-row");
8749
+ }
8750
+ }
8751
+ function s(e) {
8752
+ if (typeof MutationObserver > "u") {
8753
+ o(e);
8754
+ return;
8755
+ }
8756
+ var t = new MutationObserver(function() {
8757
+ if (!e.isConnected) {
8758
+ t.disconnect();
8759
+ return;
8760
+ }
8761
+ o(e);
8762
+ });
8763
+ t.observe(e, { childList: !0 });
8764
+ var n = function() {
8765
+ e.isConnected && o(e);
8766
+ };
8767
+ typeof requestAnimationFrame == "function" ? requestAnimationFrame(n) : setTimeout(n, 0);
8768
+ }
8769
+ e.register("desc", (e, n) => {
8268
8770
  var r = e.attrs || {}, a = parseInt(r.cols) || 3, o = ["tokui-desc"];
8269
8771
  r.stripe !== void 0 && o.push("tokui-desc--stripe"), r.bordered !== void 0 && o.push("tokui-desc--bordered"), (r.v === "horizontal" || r.v === "h") && o.push("tokui-desc--horizontal");
8270
- var s = t("div", { class: o.join(" ") });
8271
- s.style.setProperty("--tokui-desc-cols", String(a)), r.lw && s.style.setProperty("--tokui-desc-label-w", r.lw);
8272
- var c = (e.children || []).filter(function(e) {
8772
+ var c = t("div", { class: o.join(" ") });
8773
+ c.style.setProperty("--tokui-desc-cols", String(a)), r.lw && c.style.setProperty("--tokui-desc-label-w", r.lw);
8774
+ var l = (e.children || []).filter(function(e) {
8273
8775
  return e.type === "desc-item" || e.type === "item";
8274
8776
  });
8275
- return c.length > 0 && c.forEach(function(e) {
8276
- s.appendChild(i(e, a));
8277
- }), s._slot = s, s._tokuiType = "desc", s;
8777
+ return l.length > 0 && l.forEach(function(e) {
8778
+ c.appendChild(i(e, a));
8779
+ }), s(c), c._slot = c, c._tokuiType = "desc", c;
8278
8780
  }), e.register("desc-item", (e) => i(e));
8279
- function o(e, n) {
8781
+ function c(e, n) {
8280
8782
  var r = e.attrs || {}, i = t("div", {
8281
8783
  class: "tokui-carousel__slide",
8282
8784
  "data-tokui-tag": e.type
@@ -8297,99 +8799,155 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8297
8799
  return i;
8298
8800
  }
8299
8801
  e.register("carousel", (e, n) => {
8300
- var r = e.attrs || {}, i = { class: "tokui-carousel" };
8301
- r.id && (i.id = r.id), i["data-carousel"] = r.id || "carousel-" + Math.random().toString(36).slice(2, 8);
8302
- var a = t("div", i), s = t("div", { class: "tokui-carousel__track" }), c = (e.children || []).filter(function(e) {
8802
+ var r = e.attrs || {}, i = r.thumb !== void 0, a = { class: "tokui-carousel" + (i ? " tokui-carousel--thumb" : "") };
8803
+ r.id && (a.id = r.id), a["data-carousel"] = r.id || "carousel-" + Math.random().toString(36).slice(2, 8);
8804
+ var o = t("div", a), s = t("div", { class: "tokui-carousel__viewport" }), l = t("div", { class: "tokui-carousel__track" });
8805
+ function u(e) {
8806
+ return e = String(e).trim(), /^\d+(\.\d+)?$/.test(e) ? e + "px" : e;
8807
+ }
8808
+ function d(e) {
8809
+ var t = String(e).split(":");
8810
+ if (t.length === 2) {
8811
+ var n = parseFloat(t[0]), r = parseFloat(t[1]);
8812
+ return n && r ? n / r : 0;
8813
+ }
8814
+ var i = parseFloat(e);
8815
+ return i > 0 ? i : 0;
8816
+ }
8817
+ if (r.w && (o.style.width = u(r.w)), r.h) s.style.height = u(r.h), o.classList.add("tokui-carousel--sized");
8818
+ else if (r.ratio) {
8819
+ var f = d(r.ratio);
8820
+ f && (s.style.aspectRatio = String(f), o.classList.add("tokui-carousel--sized"));
8821
+ }
8822
+ var p = (e.children || []).filter(function(e) {
8303
8823
  return e.type === "carousel-item" || e.type === "item" || e.type === "img";
8304
8824
  });
8305
- c.forEach(function(e) {
8306
- if (e.type === "carousel-item" || e.type === "item") s.appendChild(o(e, n));
8825
+ p.forEach(function(e) {
8826
+ if (e.type === "carousel-item" || e.type === "item") l.appendChild(c(e, n));
8307
8827
  else if (e.type === "img") {
8308
8828
  var r = t("div", { class: "tokui-carousel__slide" });
8309
8829
  n([e]).forEach(function(e) {
8310
8830
  e && e.nodeType && r.appendChild(e);
8311
- }), s.appendChild(r);
8831
+ }), l.appendChild(r);
8312
8832
  }
8313
- }), a.appendChild(s);
8314
- var l = t("button", {
8833
+ }), s.appendChild(l);
8834
+ var m = t("button", {
8315
8835
  class: "tokui-carousel__arrow tokui-carousel__arrow--prev",
8316
8836
  "aria-label": "上一张",
8317
8837
  "data-dir": "prev"
8318
8838
  });
8319
- l.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>", a.appendChild(l);
8320
- var u = t("button", {
8839
+ m.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>", s.appendChild(m);
8840
+ var h = t("button", {
8321
8841
  class: "tokui-carousel__arrow tokui-carousel__arrow--next",
8322
8842
  "aria-label": "下一张",
8323
8843
  "data-dir": "next"
8324
8844
  });
8325
- u.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>", a.appendChild(u);
8326
- for (var d = t("div", { class: "tokui-carousel__dots" }), f = c.length, p = 0; p < f; p++) {
8327
- var m = t("button", {
8328
- class: "tokui-carousel__dot" + (p === 0 ? " tokui-carousel__dot--active" : ""),
8329
- "aria-label": "第" + (p + 1) + "",
8330
- "data-index": String(p)
8845
+ h.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>", s.appendChild(h), o.appendChild(s);
8846
+ var g = null, _ = null, v = !1;
8847
+ function y() {
8848
+ return Array.prototype.filter.call(l.children, function(e) {
8849
+ return e && e.nodeType === 1 && /\btokui-carousel__slide\b/.test(e.className || "");
8331
8850
  });
8332
- d.appendChild(m);
8333
8851
  }
8334
- a.appendChild(d), a._slot = s, a._tokuiType = "carousel";
8335
- function h() {
8336
- var e = 0, t = s.querySelectorAll(":scope > .tokui-carousel__slide"), n = d.querySelectorAll(".tokui-carousel__dot"), i = null;
8337
- function o(r) {
8338
- r < 0 && (r = t.length - 1), r >= t.length && (r = 0), e = r, s.style.transform = "translateX(-" + e * 100 + "%)", n.forEach(function(t, n) {
8852
+ function b() {
8853
+ if (!v) {
8854
+ var e = y();
8855
+ e.length && (v = !0, i ? (_ = t("div", { class: "tokui-carousel__thumbs" }), e.forEach(function(e, n) {
8856
+ var r = e.querySelector("img"), i = r ? r.getAttribute("src") : "", a = e.querySelector(".tokui-carousel__slide-title"), o = a ? (a.textContent || "").trim() : "", s = t("button", {
8857
+ class: "tokui-carousel__thumb" + (n === 0 ? " tokui-carousel__thumb--active" : ""),
8858
+ "aria-label": "第" + (n + 1) + "张",
8859
+ "data-index": String(n)
8860
+ });
8861
+ if (i) {
8862
+ var c = t("img", {
8863
+ src: i,
8864
+ alt: o
8865
+ });
8866
+ c.style.width = "100%", c.style.height = "100%", c.style.objectFit = "cover", s.appendChild(c);
8867
+ } else s.textContent = String(n + 1);
8868
+ _.appendChild(s);
8869
+ }), o.appendChild(_)) : (g = t("div", { class: "tokui-carousel__dots" }), e.forEach(function(e, n) {
8870
+ var r = t("button", {
8871
+ class: "tokui-carousel__dot" + (n === 0 ? " tokui-carousel__dot--active" : ""),
8872
+ "aria-label": "第" + (n + 1) + "张",
8873
+ "data-index": String(n)
8874
+ });
8875
+ g.appendChild(r);
8876
+ }), s.appendChild(g)));
8877
+ }
8878
+ }
8879
+ o._slot = l, o._tokuiType = "carousel";
8880
+ function x() {
8881
+ b();
8882
+ var e = 0, t = y(), n = g ? g.querySelectorAll(".tokui-carousel__dot") : [], i = _ ? _.querySelectorAll(".tokui-carousel__thumb") : [], a = null;
8883
+ function s() {
8884
+ n.forEach && n.forEach(function(t, n) {
8339
8885
  n === e ? t.classList.add("tokui-carousel__dot--active") : t.classList.remove("tokui-carousel__dot--active");
8886
+ }), i.forEach && i.forEach(function(t, n) {
8887
+ n === e ? (t.classList.add("tokui-carousel__thumb--active"), t.scrollIntoView && t.scrollIntoView({
8888
+ behavior: "smooth",
8889
+ block: "nearest",
8890
+ inline: "nearest"
8891
+ })) : t.classList.remove("tokui-carousel__thumb--active");
8340
8892
  });
8341
8893
  }
8342
- l.addEventListener("click", function() {
8343
- o(e - 1), f();
8344
- }), u.addEventListener("click", function() {
8345
- o(e + 1), f();
8346
- }), d.addEventListener("click", function(e) {
8894
+ function c(n) {
8895
+ n < 0 && (n = t.length - 1), n >= t.length && (n = 0), e = n, l.style.transform = "translateX(-" + e * 100 + "%)", s();
8896
+ }
8897
+ m.addEventListener("click", function() {
8898
+ c(e - 1), d();
8899
+ }), h.addEventListener("click", function() {
8900
+ c(e + 1), d();
8901
+ }), g && g.addEventListener("click", function(e) {
8347
8902
  var t = e.target.closest(".tokui-carousel__dot");
8348
- t && (o(parseInt(t.getAttribute("data-index"))), f());
8903
+ t && (c(parseInt(t.getAttribute("data-index"))), d());
8904
+ }), _ && _.addEventListener("click", function(e) {
8905
+ var t = e.target.closest(".tokui-carousel__thumb");
8906
+ t && (c(parseInt(t.getAttribute("data-index"))), d());
8349
8907
  });
8350
- function c() {
8908
+ function u() {
8351
8909
  var t = parseInt(r.auto);
8352
- t && t > 0 && (i = setInterval(function() {
8353
- o(e + 1);
8910
+ t && t > 0 && (a = setInterval(function() {
8911
+ c(e + 1);
8354
8912
  }, t));
8355
8913
  }
8356
- function f() {
8357
- i && clearInterval(i), c();
8914
+ function d() {
8915
+ a && clearInterval(a), u();
8358
8916
  }
8359
- c(), a.setAttribute("tabindex", "0"), a.addEventListener("keydown", function(t) {
8360
- t.key === "ArrowLeft" ? (o(e - 1), f()) : t.key === "ArrowRight" && (o(e + 1), f());
8917
+ u(), o.setAttribute("tabindex", "0"), o.addEventListener("keydown", function(t) {
8918
+ t.key === "ArrowLeft" ? (c(e - 1), d()) : t.key === "ArrowRight" && (c(e + 1), d());
8361
8919
  });
8362
- var p = 0, m = 0, h = !1;
8363
- s.addEventListener("mousedown", function(e) {
8364
- h = !0, p = e.clientX, m = 0, s.style.transition = "none", f();
8365
- }), s.addEventListener("touchstart", function(e) {
8366
- h = !0, p = e.touches[0].clientX, m = 0, s.style.transition = "none", f();
8920
+ var f = 0, p = 0, v = !1;
8921
+ l.addEventListener("mousedown", function(e) {
8922
+ v = !0, f = e.clientX, p = 0, l.style.transition = "none", d();
8923
+ }), l.addEventListener("touchstart", function(e) {
8924
+ v = !0, f = e.touches[0].clientX, p = 0, l.style.transition = "none", d();
8367
8925
  }, { passive: !0 });
8368
- function g(t) {
8369
- if (h) {
8370
- m = t - p;
8371
- var n = -(e * a.offsetWidth) + m;
8372
- s.style.transform = "translateX(" + n + "px)";
8926
+ function x(t) {
8927
+ if (v) {
8928
+ p = t - f;
8929
+ var n = -(e * o.offsetWidth) + p;
8930
+ l.style.transform = "translateX(" + n + "px)";
8373
8931
  }
8374
8932
  }
8375
8933
  typeof document < "u" && document.addEventListener && (document.addEventListener("mousemove", function(e) {
8376
- g(e.clientX);
8934
+ x(e.clientX);
8377
8935
  }), document.addEventListener("touchmove", function(e) {
8378
- g(e.touches[0].clientX);
8936
+ x(e.touches[0].clientX);
8379
8937
  }, { passive: !0 }));
8380
- function _() {
8381
- if (h) {
8382
- h = !1, s.style.transition = "";
8383
- var t = a.offsetWidth * .2;
8384
- m < -t ? o(e + 1) : o(m > t ? e - 1 : e);
8938
+ function S() {
8939
+ if (v) {
8940
+ v = !1, l.style.transition = "";
8941
+ var t = o.offsetWidth * .2;
8942
+ p < -t ? c(e + 1) : c(p > t ? e - 1 : e);
8385
8943
  }
8386
8944
  }
8387
- typeof document < "u" && document.addEventListener && (document.addEventListener("mouseup", _), document.addEventListener("touchend", _));
8945
+ typeof document < "u" && document.addEventListener && (document.addEventListener("mouseup", S), document.addEventListener("touchend", S));
8388
8946
  }
8389
- return c.length > 0 && h(), a._streamCloseHook = function() {
8390
- h();
8391
- }, a;
8392
- }), e.register("carousel-item", (e, t) => o(e, t)), e.register("tn", (e, n) => {
8947
+ return p.length > 0 && x(), o._streamCloseHook = function() {
8948
+ x();
8949
+ }, o;
8950
+ }), e.register("carousel-item", (e, t) => c(e, t)), e.register("tn", (e, n) => {
8393
8951
  var r = e.attrs.leaf !== void 0, i = e.attrs.open !== void 0, a = e.attrs.dis !== void 0, o = t("div", {
8394
8952
  class: "tokui-tree-node" + (r ? " tokui-tree-node--leaf" : "") + (i ? " tokui-tree-node--open" : "") + (a ? " tokui-tree-node--disabled" : ""),
8395
8953
  role: "treeitem",
@@ -8509,23 +9067,23 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8509
9067
  role: "menu"
8510
9068
  };
8511
9069
  r.id && (o.id = r.id);
8512
- var c = t("div", o);
8513
- r.bg && c.style.setProperty("--tokui-menu-bg", r.bg), r.fc && c.style.setProperty("--tokui-menu-fc", r.fc);
8514
- var l = r.act || "";
9070
+ var s = t("div", o);
9071
+ r.bg && s.style.setProperty("--tokui-menu-bg", r.bg), r.fc && s.style.setProperty("--tokui-menu-fc", r.fc);
9072
+ var c = r.act || "";
8515
9073
  return (e.children || []).filter(function(e) {
8516
9074
  return e.type === "menu-item";
8517
9075
  }).forEach(function(e) {
8518
- var t = s(e, l);
8519
- c.appendChild(t);
8520
- }), c._slot = c, c._tokuiType = "menu", c._activeClk = l, c.addEventListener("keydown", function(e) {
9076
+ var t = u(e, c);
9077
+ s.appendChild(t);
9078
+ }), s._slot = s, s._tokuiType = "menu", s._activeClk = c, s.addEventListener("keydown", function(e) {
8521
9079
  var t = e.target.closest(".tokui-menu__item");
8522
9080
  if (t) {
8523
- var n = Array.from(c.querySelectorAll(".tokui-menu__item:not(.tokui-menu__item--disabled)")), r = n.indexOf(t);
9081
+ var n = Array.from(s.querySelectorAll(".tokui-menu__item:not(.tokui-menu__item--disabled)")), r = n.indexOf(t);
8524
9082
  e.key === "ArrowDown" && r < n.length - 1 ? (e.preventDefault(), n[r + 1].focus()) : e.key === "ArrowUp" && r > 0 ? (e.preventDefault(), n[r - 1].focus()) : (e.key === "Enter" || e.key === " ") && (e.preventDefault(), t.click());
8525
9083
  }
8526
- }), c;
9084
+ }), s;
8527
9085
  });
8528
- function s(e, n) {
9086
+ function u(e, n) {
8529
9087
  var r = e.attrs || {}, i = ["tokui-menu__item"];
8530
9088
  r.dis !== void 0 && i.push("tokui-menu__item--disabled"), n && r.clk === n && i.push("tokui-menu__item--active");
8531
9089
  var a = t("div", {
@@ -8705,7 +9263,7 @@ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescr
8705
9263
  theme: "default",
8706
9264
  streaming: !0,
8707
9265
  onEvent: null
8708
- }, e), this.renderer = new n(i), o(this.renderer), this.parser = null, this.container = null, this.streamingContainer = null, this.options.container && typeof document < "u" && (this.container = typeof this.options.container == "string" ? document.querySelector(this.options.container) : this.options.container, a.init(this.container), this.options.theme && this.options.theme !== "default" && a.setTheme(this.options.theme)), typeof window < "u" && (window.TokUI._instance = this, window.TokUI._internal.el = r, window.TokUI.registerHandler = i.registerHandler.bind(i), window.TokUI.setTheme = a.setTheme.bind(a), window.TokUI.showNotification || (window.TokUI.showNotification = function() {}));
9266
+ }, e), this.renderer = new n(i), o(this.renderer), this.parser = null, this.container = null, this.streamingContainer = null, this.options.container && typeof document < "u" && (this.container = typeof this.options.container == "string" ? document.querySelector(this.options.container) : this.options.container, a.init(this.container), this.options.theme && a.setTheme(this.options.theme)), typeof window < "u" && (window.TokUI._instance = this, window.TokUI._internal.el = r, window.TokUI.registerHandler = i.registerHandler.bind(i), window.TokUI.setTheme = a.setTheme.bind(a), window.TokUI.showNotification || (window.TokUI.showNotification = function() {}));
8709
9267
  }
8710
9268
  render(t, n) {
8711
9269
  let r = n || this.container;