react-blockkit 0.3.3 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +13 -6
  2. package/dist/blocks/AdvancedBlocks.d.ts.map +1 -1
  3. package/dist/blocks/BasicBlocks.d.ts.map +1 -1
  4. package/dist/blocks/InteractiveBlocks.d.ts.map +1 -1
  5. package/dist/elements/Elements.d.ts.map +1 -1
  6. package/dist/index.cjs +4 -4
  7. package/dist/index.cjs.map +1 -1
  8. package/dist/index.js +252 -249
  9. package/dist/index.js.map +1 -1
  10. package/dist/validation.d.ts.map +1 -1
  11. package/package.json +3 -3
  12. package/docs/coverage-matrix.md +0 -80
  13. package/docs/parity/chart-bar-3-w580-dark.png +0 -0
  14. package/docs/parity/chart-bar-3-w580-light.png +0 -0
  15. package/docs/parity/chart-line-3-w580-light.png +0 -0
  16. package/docs/parity/chart-pie-12-w400-light.png +0 -0
  17. package/docs/parity/chart-pie-5-w580-light.png +0 -0
  18. package/docs/parity/data-table-w580-dark.png +0 -0
  19. package/docs/parity/data-table-w580-light.png +0 -0
  20. package/docs/parity/headers-levels-w580-light.png +0 -0
  21. package/docs/parity/icons-alert-info.png +0 -0
  22. package/docs/parity/icons-card-slack-icon.png +0 -0
  23. package/docs/parity/icons-context-actions.png +0 -0
  24. package/docs/parity/icons-data-table-header.png +0 -0
  25. package/docs/parity/icons-datepicker.png +0 -0
  26. package/docs/parity/icons-overflow.png +0 -0
  27. package/docs/parity/icons-pagination.png +0 -0
  28. package/docs/parity/icons-select-chevron.png +0 -0
  29. package/docs/parity/rich-text-full-w580-light.png +0 -0
  30. package/docs/parity/spacing-rhythm-w580-light.png +0 -0
  31. package/docs/parity/table-align-wrap-w580-light.png +0 -0
  32. package/docs/parity/table-basic-w580-light.png +0 -0
package/dist/index.js CHANGED
@@ -2417,9 +2417,9 @@ function ct(e) {
2417
2417
  case "url_text_input":
2418
2418
  case "number_input": return at(e);
2419
2419
  case "datepicker": return $e(e.initial_date);
2420
- case "file_input": return e.filetypes === void 0 || Array.isArray(e.filetypes);
2420
+ case "file_input": return e.filetypes === void 0 || nt(e.filetypes);
2421
+ case "timepicker": return $e(e.initial_time);
2421
2422
  case "datetimepicker":
2422
- case "timepicker":
2423
2423
  case "rich_text_input": return !0;
2424
2424
  default: return !1;
2425
2425
  }
@@ -3308,11 +3308,11 @@ function Kt(e) {
3308
3308
  return w(e) && e.type === "image";
3309
3309
  }
3310
3310
  function R({ blockId: e, blockType: t, children: n, className: r }) {
3311
- let i = g(O.block);
3311
+ let i = g(O.block), a = e;
3312
3312
  return /* @__PURE__ */ u("div", {
3313
3313
  ...i,
3314
3314
  className: A(i.className, r),
3315
- "data-block-id": e,
3315
+ "data-block-id": typeof a == "string" ? a : void 0,
3316
3316
  "data-block-type": t,
3317
3317
  children: n
3318
3318
  });
@@ -3442,7 +3442,7 @@ function tn({ block: e, className: t }) {
3442
3442
  children: /* @__PURE__ */ u(fe, { size: 20 })
3443
3443
  }), /* @__PURE__ */ d("div", { children: [/* @__PURE__ */ u("strong", { children: "Remote file" }), /* @__PURE__ */ u("div", {
3444
3444
  ...g(O.smallText),
3445
- children: e.external_id
3445
+ children: typeof e.external_id == "string" ? e.external_id : E(e, "remote file")
3446
3446
  })] })]
3447
3447
  })
3448
3448
  });
@@ -3489,7 +3489,10 @@ function nn({ block: e, className: t }) {
3489
3489
  }
3490
3490
  //#endregion
3491
3491
  //#region src/blocks/AdvancedBlocks.tsx
3492
- function rn({ align: e = "left", cell: t, className: n, firstColumn: r = !1, header: i = !1, path: a = "cell", scope: o = "col", wrapped: s = !1 }) {
3492
+ function rn(e) {
3493
+ return typeof e == "string" ? e : typeof e == "number" || typeof e == "boolean" ? String(e) : void 0;
3494
+ }
3495
+ function an({ align: e = "left", cell: t, className: n, firstColumn: r = !1, header: i = !1, path: a = "cell", scope: o = "col", wrapped: s = !1 }) {
3493
3496
  let c = g(O.tableCell, i && O.tableHeader, r && O.tableCellFirstColumn, s && O.tableCellWrapped), l;
3494
3497
  if (!w(t)) l = E(t, "table cell");
3495
3498
  else switch (t.type) {
@@ -3500,10 +3503,10 @@ function rn({ align: e = "left", cell: t, className: n, firstColumn: r = !1, hea
3500
3503
  });
3501
3504
  break;
3502
3505
  case "raw_number":
3503
- l = t.text ?? String(t.value);
3506
+ l = rn(t.text) ?? rn(t.value) ?? E(t, "table cell");
3504
3507
  break;
3505
3508
  case "raw_text":
3506
- l = t.text;
3509
+ l = rn(t.text) ?? E(t, "table cell");
3507
3510
  break;
3508
3511
  default: l = E(t, "table cell");
3509
3512
  }
@@ -3520,11 +3523,11 @@ function rn({ align: e = "left", cell: t, className: n, firstColumn: r = !1, hea
3520
3523
  children: l
3521
3524
  });
3522
3525
  }
3523
- function an(e) {
3526
+ function on(e) {
3524
3527
  return Array.isArray(e);
3525
3528
  }
3526
- function on({ block: e, className: t, path: n = "block" }) {
3527
- let r = Array.isArray(e.rows) ? e.rows.filter(an) : [], i = e.column_settings;
3529
+ function sn({ block: e, className: t, path: n = "block" }) {
3530
+ let r = Array.isArray(e.rows) ? e.rows.filter(on) : [], i = e.column_settings;
3528
3531
  return /* @__PURE__ */ u(R, {
3529
3532
  blockId: e.block_id,
3530
3533
  blockType: e.type,
@@ -3533,14 +3536,14 @@ function on({ block: e, className: t, path: n = "block" }) {
3533
3536
  ...g(O.tableScroller),
3534
3537
  children: /* @__PURE__ */ d("table", {
3535
3538
  ...g(O.table),
3536
- children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: (r[0] ?? []).map((e, t) => /* @__PURE__ */ u(rn, {
3539
+ children: [/* @__PURE__ */ u("thead", { children: /* @__PURE__ */ u("tr", { children: (r[0] ?? []).map((e, t) => /* @__PURE__ */ u(an, {
3537
3540
  align: i?.[t]?.align,
3538
3541
  cell: e,
3539
3542
  firstColumn: t === 0,
3540
3543
  header: !0,
3541
3544
  path: `${n}.rows[0][${String(t)}]`,
3542
3545
  wrapped: i?.[t]?.is_wrapped
3543
- }, `header-${String(t)}`)) }) }), /* @__PURE__ */ u("tbody", { children: r.slice(1).map((e, t) => /* @__PURE__ */ u("tr", { children: e.map((e, r) => /* @__PURE__ */ u(rn, {
3546
+ }, `header-${String(t)}`)) }) }), /* @__PURE__ */ u("tbody", { children: r.slice(1).map((e, t) => /* @__PURE__ */ u("tr", { children: e.map((e, r) => /* @__PURE__ */ u(an, {
3544
3547
  align: i?.[r]?.align,
3545
3548
  cell: e,
3546
3549
  firstColumn: r === 0,
@@ -3551,19 +3554,19 @@ function on({ block: e, className: t, path: n = "block" }) {
3551
3554
  })
3552
3555
  });
3553
3556
  }
3554
- function sn({ cell: e, path: t }) {
3557
+ function cn({ cell: e, path: t }) {
3555
3558
  if (!w(e)) return E(e, "table cell");
3556
3559
  switch (e.type) {
3557
3560
  case "rich_text": return /* @__PURE__ */ u(N, {
3558
3561
  block: e,
3559
3562
  path: t
3560
3563
  });
3561
- case "raw_number": return e.text ?? String(e.value);
3562
- case "raw_text": return e.text;
3564
+ case "raw_number": return rn(e.text) ?? rn(e.value) ?? E(e, "table cell");
3565
+ case "raw_text": return rn(e.text) ?? E(e, "table cell");
3563
3566
  default: return E(e, "table cell");
3564
3567
  }
3565
3568
  }
3566
- function cn(e) {
3569
+ function ln(e) {
3567
3570
  let t = e;
3568
3571
  if (!w(t)) return "";
3569
3572
  if (e.type === "raw_text") {
@@ -3582,8 +3585,8 @@ function cn(e) {
3582
3585
  }
3583
3586
  return "";
3584
3587
  }
3585
- function ln({ block: e, className: n, path: r = "block" }) {
3586
- let i = e.page_size ?? 5, a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.trunc(i)) : 5, o = Array.isArray(e.rows) ? e.rows.filter(an) : [], s = e.row_header_column_index ?? 0, l = typeof e.caption == "string" ? e.caption : void 0, [f, p] = c(0), [m, h] = c(""), _ = o[0] ?? [], v = m.trim().toLowerCase(), y = v === "" ? o.slice(1) : o.slice(1).filter((e) => e.some((e) => cn(e).toLowerCase().includes(v))), b = Math.max(1, Math.ceil(y.length / a)), x = Math.min(f, b - 1), S = y.slice(x * a, (x + 1) * a), C = S.length - 1;
3588
+ function un({ block: e, className: n, path: r = "block" }) {
3589
+ let i = e.page_size ?? 5, a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.trunc(i)) : 5, o = Array.isArray(e.rows) ? e.rows.filter(on) : [], s = e.row_header_column_index ?? 0, l = typeof e.caption == "string" ? e.caption : void 0, [f, p] = c(0), [m, h] = c(""), _ = o[0] ?? [], v = m.trim().toLowerCase(), y = v === "" ? o.slice(1) : o.slice(1).filter((e) => e.some((e) => ln(e).toLowerCase().includes(v))), b = Math.max(1, Math.ceil(y.length / a)), x = Math.min(f, b - 1), S = y.slice(x * a, (x + 1) * a), C = S.length - 1;
3587
3590
  return /* @__PURE__ */ u(R, {
3588
3591
  blockId: e.block_id,
3589
3592
  blockType: e.type,
@@ -3640,14 +3643,14 @@ function ln({ block: e, className: n, path: r = "block" }) {
3640
3643
  ...g(O.dataTableTh),
3641
3644
  key: `header-${String(n)}`,
3642
3645
  scope: "col"
3643
- }, /* @__PURE__ */ u(sn, {
3646
+ }, /* @__PURE__ */ u(cn, {
3644
3647
  cell: e,
3645
3648
  path: `${r}.rows[0][${String(n)}]`
3646
3649
  }))) }) }),
3647
3650
  /* @__PURE__ */ u("tbody", { children: S.map((e, n) => {
3648
3651
  let i = x * a + n + 1, o = e.length - 1;
3649
3652
  return /* @__PURE__ */ u("tr", { children: e.map((e, a) => {
3650
- let c = g(O.dataTableTd, n === 0 && a === 0 && O.dataTableRadiusTopStart, n === 0 && a === o && O.dataTableRadiusTopEnd, n === C && a === 0 && O.dataTableRadiusBottomStart, n === C && a === o && O.dataTableRadiusBottomEnd), l = /* @__PURE__ */ u(sn, {
3653
+ let c = g(O.dataTableTd, n === 0 && a === 0 && O.dataTableRadiusTopStart, n === 0 && a === o && O.dataTableRadiusTopEnd, n === C && a === 0 && O.dataTableRadiusBottomStart, n === C && a === o && O.dataTableRadiusBottomEnd), l = /* @__PURE__ */ u(cn, {
3651
3654
  cell: e,
3652
3655
  path: `${r}.rows[${String(i)}][${String(a)}]`
3653
3656
  });
@@ -3700,7 +3703,7 @@ function ln({ block: e, className: n, path: r = "block" }) {
3700
3703
  })
3701
3704
  });
3702
3705
  }
3703
- function un({ name: e }) {
3706
+ function dn({ name: e }) {
3704
3707
  let t = typeof e == "string" ? be[e] : void 0;
3705
3708
  return /* @__PURE__ */ u("span", {
3706
3709
  ...g(O.iconSlot),
@@ -3709,7 +3712,7 @@ function un({ name: e }) {
3709
3712
  children: u(t === void 0 ? le : t, { size: 24 })
3710
3713
  });
3711
3714
  }
3712
- function dn({ block: e, className: t }) {
3715
+ function fn({ block: e, className: t }) {
3713
3716
  let n = Array.isArray(e.actions) ? e.actions : void 0;
3714
3717
  return /* @__PURE__ */ u(R, {
3715
3718
  blockId: e.block_id,
@@ -3727,7 +3730,7 @@ function dn({ block: e, className: t }) {
3727
3730
  children: [
3728
3731
  e.icon === void 0 && e.slack_icon === void 0 && e.title === void 0 && e.subtitle === void 0 ? null : /* @__PURE__ */ d("div", {
3729
3732
  ...g(O.cardHeading),
3730
- children: [e.icon === void 0 ? e.slack_icon === void 0 ? null : /* @__PURE__ */ u(un, { name: w(e.slack_icon) ? e.slack_icon.name : void 0 }) : /* @__PURE__ */ u(F, {
3733
+ children: [e.icon === void 0 ? e.slack_icon === void 0 ? null : /* @__PURE__ */ u(dn, { name: w(e.slack_icon) ? e.slack_icon.name : void 0 }) : /* @__PURE__ */ u(F, {
3731
3734
  element: e.icon,
3732
3735
  variant: "cardIcon"
3733
3736
  }), /* @__PURE__ */ d("div", { children: [e.title === void 0 ? null : /* @__PURE__ */ u(L, {
@@ -3756,10 +3759,10 @@ function dn({ block: e, className: t }) {
3756
3759
  })
3757
3760
  });
3758
3761
  }
3759
- function fn(e) {
3762
+ function pn(e) {
3760
3763
  return w(e) && e.type === "card";
3761
3764
  }
3762
- function pn({ block: e, className: n, path: r = "block" }) {
3765
+ function mn({ block: e, className: n, path: r = "block" }) {
3763
3766
  let i = e.elements;
3764
3767
  return /* @__PURE__ */ u(R, {
3765
3768
  blockId: e.block_id,
@@ -3767,7 +3770,7 @@ function pn({ block: e, className: n, path: r = "block" }) {
3767
3770
  className: n,
3768
3771
  children: /* @__PURE__ */ u("div", {
3769
3772
  ...g(O.carousel),
3770
- children: Array.isArray(i) ? i.map((e, n) => fn(e) ? /* @__PURE__ */ u(dn, {
3773
+ children: Array.isArray(i) ? i.map((e, n) => pn(e) ? /* @__PURE__ */ u(fn, {
3771
3774
  block: e,
3772
3775
  className: g(O.carouselCard).className,
3773
3776
  path: `${r}.elements[${String(n)}]`
@@ -3779,7 +3782,7 @@ function pn({ block: e, className: n, path: r = "block" }) {
3779
3782
  })
3780
3783
  });
3781
3784
  }
3782
- function mn({ block: e, className: t }) {
3785
+ function hn({ block: e, className: t }) {
3783
3786
  let n = e.level ?? "default";
3784
3787
  return /* @__PURE__ */ u(R, {
3785
3788
  blockId: e.block_id,
@@ -3795,7 +3798,7 @@ function mn({ block: e, className: t }) {
3795
3798
  })
3796
3799
  });
3797
3800
  }
3798
- function hn({ block: e, className: n, path: r = "block" }) {
3801
+ function gn({ block: e, className: n, path: r = "block" }) {
3799
3802
  let i = e.sources, a = typeof e.status == "string" ? e.status : "unknown", o = typeof e.title == "string" ? e.title : E(e, "task");
3800
3803
  return /* @__PURE__ */ u(R, {
3801
3804
  blockId: e.block_id,
@@ -3847,10 +3850,10 @@ function hn({ block: e, className: n, path: r = "block" }) {
3847
3850
  })
3848
3851
  });
3849
3852
  }
3850
- function gn(e) {
3853
+ function _n(e) {
3851
3854
  return w(e) && e.type === "task_card";
3852
3855
  }
3853
- function _n({ block: e, className: n, path: r = "block" }) {
3856
+ function vn({ block: e, className: n, path: r = "block" }) {
3854
3857
  let i = e.tasks, a = typeof e.title == "string" ? e.title : E(e, "plan");
3855
3858
  return /* @__PURE__ */ u(R, {
3856
3859
  blockId: e.block_id,
@@ -3858,7 +3861,7 @@ function _n({ block: e, className: n, path: r = "block" }) {
3858
3861
  className: n,
3859
3862
  children: /* @__PURE__ */ d("div", {
3860
3863
  ...g(O.plan),
3861
- children: [/* @__PURE__ */ u("strong", { children: a }), Array.isArray(i) ? i.map((e, n) => gn(e) ? /* @__PURE__ */ u(hn, {
3864
+ children: [/* @__PURE__ */ u("strong", { children: a }), Array.isArray(i) ? i.map((e, n) => _n(e) ? /* @__PURE__ */ u(gn, {
3862
3865
  block: e,
3863
3866
  path: `${r}.tasks[${String(n)}]`
3864
3867
  }, `${typeof e.task_id == "string" ? e.task_id : "task"}-${String(n)}`) : /* @__PURE__ */ t("div", {
@@ -3871,7 +3874,7 @@ function _n({ block: e, className: n, path: r = "block" }) {
3871
3874
  }
3872
3875
  //#endregion
3873
3876
  //#region src/constants.ts
3874
- var vn = 3e3, yn = 3e3, bn = 2e3, xn = 3e3, Sn = 2e3, Cn = 2e3, wn = 12e3, Tn = 3e3, En = 2e3, Dn = 1e4, On = 2e4, kn = [
3877
+ var yn = 3e3, bn = 3e3, xn = 2e3, Sn = 3e3, Cn = 2e3, wn = 2e3, Tn = 12e3, En = 3e3, Dn = 2e3, On = 1e4, kn = 2e4, An = [
3875
3878
  "actions",
3876
3879
  "alert",
3877
3880
  "card",
@@ -3893,9 +3896,9 @@ var vn = 3e3, yn = 3e3, bn = 2e3, xn = 3e3, Sn = 2e3, Cn = 2e3, wn = 12e3, Tn =
3893
3896
  "table",
3894
3897
  "task_card",
3895
3898
  "video"
3896
- ], An = 554;
3897
- function jn() {
3898
- let [e, t] = c(An + 26), r = s(void 0), a = n((e) => {
3899
+ ], jn = 554;
3900
+ function Mn() {
3901
+ let [e, t] = c(jn + 26), r = s(void 0), a = n((e) => {
3899
3902
  if (r.current?.disconnect(), r.current = void 0, e === null) return;
3900
3903
  let n = () => {
3901
3904
  let n = e.getBoundingClientRect().width;
@@ -3910,22 +3913,22 @@ function jn() {
3910
3913
  width: e
3911
3914
  };
3912
3915
  }
3913
- function Mn(e, t) {
3916
+ function Nn(e, t) {
3914
3917
  let n = e / Math.max(1, t), r = 10 ** Math.floor(Math.log10(n)), i = n / r;
3915
3918
  return i >= Math.sqrt(50) ? r * 10 : i >= Math.sqrt(10) ? r * 5 : i >= Math.SQRT2 ? r * 2 : r;
3916
3919
  }
3917
- function Nn(e, t) {
3918
- let n = Math.min(0, e), r = t > n ? t : n + 1, i = Mn(r - n, 4), a = Math.floor(n / i), o = Math.ceil(r / i), s = [];
3920
+ function Pn(e, t) {
3921
+ let n = Math.min(0, e), r = t > n ? t : n + 1, i = Nn(r - n, 4), a = Math.floor(n / i), o = Math.ceil(r / i), s = [];
3919
3922
  for (let e = a; e <= o; e += 1) s.push(e * i);
3920
3923
  return s;
3921
3924
  }
3922
- function Pn(e) {
3925
+ function Fn(e) {
3923
3926
  return Math.ceil(e - .5) + .5;
3924
3927
  }
3925
- function Fn(e, t) {
3928
+ function In(e, t) {
3926
3929
  let n = 0, r = 0;
3927
3930
  for (let e of t) n = Math.min(n, e), r = Math.max(r, e);
3928
- let i = Nn(n, r), a = i[0] ?? 0, o = (i[i.length - 1] ?? 1) - a || 1;
3931
+ let i = Pn(n, r), a = i[0] ?? 0, o = (i[i.length - 1] ?? 1) - a || 1;
3929
3932
  return {
3930
3933
  plotLeft: 74,
3931
3934
  plotRight: e,
@@ -3934,14 +3937,14 @@ function Fn(e, t) {
3934
3937
  y: (e) => 334 - (e - a) / o * 325
3935
3938
  };
3936
3939
  }
3937
- function In(e) {
3940
+ function Ln(e) {
3938
3941
  return Ee[e % Ee.length] ?? Te;
3939
3942
  }
3940
- function Ln(e, t) {
3943
+ function Rn(e, t) {
3941
3944
  let n = new Map(e.data.map((e) => [e.label, e]));
3942
3945
  return t.map((e) => n.get(e));
3943
3946
  }
3944
- function Rn(e, t, n, r) {
3947
+ function zn(e, t, n, r) {
3945
3948
  let i = Math.min(4, t / 2, Math.abs(r - n)), a = e, o = e + t;
3946
3949
  return [
3947
3950
  `M${String(a + i)} ${String(n)}`,
@@ -3954,7 +3957,7 @@ function Rn(e, t, n, r) {
3954
3957
  "Z"
3955
3958
  ].join("");
3956
3959
  }
3957
- function zn(e) {
3960
+ function Bn(e) {
3958
3961
  if (e.length === 0) return "";
3959
3962
  let t = e[0];
3960
3963
  if (t === void 0) return "";
@@ -3981,10 +3984,10 @@ function zn(e) {
3981
3984
  }
3982
3985
  return r.join("");
3983
3986
  }
3984
- function Bn({ geometry: e }) {
3987
+ function Vn({ geometry: e }) {
3985
3988
  let { plotLeft: n, plotRight: r, ticks: i, y: a } = e;
3986
3989
  return /* @__PURE__ */ d(l, { children: [i.map((e) => {
3987
- let i = Pn(a(e));
3990
+ let i = Fn(a(e));
3988
3991
  return /* @__PURE__ */ t("path", {
3989
3992
  ...g(O.chartGridline),
3990
3993
  d: `M${String(n)} ${String(i)}L${String(r)} ${String(i)}`,
@@ -4000,7 +4003,7 @@ function Bn({ geometry: e }) {
4000
4003
  y: a(e)
4001
4004
  }, e))] });
4002
4005
  }
4003
- function Vn({ categories: e, tickX: n }) {
4006
+ function Hn({ categories: e, tickX: n }) {
4004
4007
  return /* @__PURE__ */ u(l, { children: e.map((e, r) => /* @__PURE__ */ t("text", {
4005
4008
  ...g(O.chartTickText),
4006
4009
  key: `${e}-${String(r)}`,
@@ -4009,26 +4012,26 @@ function Vn({ categories: e, tickX: n }) {
4009
4012
  y: 351
4010
4013
  }, e)) });
4011
4014
  }
4012
- function Hn(e, t) {
4015
+ function Un(e, t) {
4013
4016
  let n = e * Math.min(.155, Math.max(.075, .175 - .02 * t));
4014
4017
  return {
4015
4018
  barWidth: (e - 2 * n) / (1.1 * t - .1),
4016
4019
  outer: n
4017
4020
  };
4018
4021
  }
4019
- function Un({ chart: e, svgWidth: n, title: r }) {
4022
+ function Wn({ chart: e, svgWidth: n, title: r }) {
4020
4023
  let i = e.axis_config.categories, a = e.series.map((e) => ({
4021
- points: Ln(e, i),
4024
+ points: Rn(e, i),
4022
4025
  series: e
4023
- })), o = Fn(n, a.flatMap(({ points: e }) => e.flatMap((e) => e === void 0 ? [] : [e.value]))), { plotLeft: s, plotRight: c, y: l } = o, f, p;
4026
+ })), o = In(n, a.flatMap(({ points: e }) => e.flatMap((e) => e === void 0 ? [] : [e.value]))), { plotLeft: s, plotRight: c, y: l } = o, f, p;
4024
4027
  if (e.type === "bar") {
4025
- let n = (c - s) / Math.max(1, i.length), { barWidth: r, outer: o } = Hn(n, Math.max(1, e.series.length));
4028
+ let n = (c - s) / Math.max(1, i.length), { barWidth: r, outer: o } = Un(n, Math.max(1, e.series.length));
4026
4029
  p = (e) => s + n * (e + .5), f = a.map(({ points: e, series: i }, a) => e.map((e, c) => {
4027
4030
  if (e === void 0) return null;
4028
4031
  let u = s + c * n + o + 1.1 * r * a;
4029
4032
  return /* @__PURE__ */ t("path", {
4030
- ...g(In(a).fill),
4031
- d: Rn(u, r, l(e.value), 334),
4033
+ ...g(Ln(a).fill),
4034
+ d: zn(u, r, l(e.value), 334),
4032
4035
  "data-category": e.label,
4033
4036
  "data-series": i.name,
4034
4037
  key: `${i.name}-${String(a)}-${e.label}-${String(c)}`
@@ -4040,15 +4043,15 @@ function Un({ chart: e, svgWidth: n, title: r }) {
4040
4043
  let a = t.flatMap((e, t) => e === void 0 ? [] : [{
4041
4044
  x: n(t),
4042
4045
  y: l(e.value)
4043
- }]), o = zn(a);
4046
+ }]), o = Bn(a);
4044
4047
  if (o === "") return null;
4045
4048
  let s = a[a.length - 1], c = a[0];
4046
4049
  return /* @__PURE__ */ d("g", { children: [e.type === "area" && c !== void 0 && s !== void 0 ? /* @__PURE__ */ u("path", {
4047
- ...g(In(i).tint, O.chartAreaFill, i >= 6 && O.chartAreaFallbackFill),
4050
+ ...g(Ln(i).tint, O.chartAreaFill, i >= 6 && O.chartAreaFallbackFill),
4048
4051
  d: `${o}L${String(s.x)} 334L${String(c.x)} 334Z`,
4049
4052
  "data-series-area": r.name
4050
4053
  }) : null, /* @__PURE__ */ u("path", {
4051
- ...g(In(i).stroke, O.chartLinePath),
4054
+ ...g(Ln(i).stroke, O.chartLinePath),
4052
4055
  d: o,
4053
4056
  "data-series": r.name,
4054
4057
  fill: "none"
@@ -4062,22 +4065,22 @@ function Un({ chart: e, svgWidth: n, title: r }) {
4062
4065
  role: "img",
4063
4066
  width: n,
4064
4067
  children: [
4065
- /* @__PURE__ */ u(Bn, { geometry: o }),
4068
+ /* @__PURE__ */ u(Vn, { geometry: o }),
4066
4069
  f,
4067
- /* @__PURE__ */ u(Vn, {
4070
+ /* @__PURE__ */ u(Hn, {
4068
4071
  categories: i,
4069
4072
  tickX: p
4070
4073
  })
4071
4074
  ]
4072
4075
  });
4073
4076
  }
4074
- function Wn(e, t, n, r) {
4077
+ function Gn(e, t, n, r) {
4075
4078
  return {
4076
4079
  x: e + n * Math.sin(r),
4077
4080
  y: t - n * Math.cos(r)
4078
4081
  };
4079
4082
  }
4080
- function Gn({ chart: e, svgWidth: n, title: r }) {
4083
+ function Kn({ chart: e, svgWidth: n, title: r }) {
4081
4084
  let i = e.segments.map((e) => Number.isFinite(e.value) ? Math.max(0, e.value) : 0), a = i.reduce((e, t) => e + t, 0);
4082
4085
  if (a <= 0) return /* @__PURE__ */ u("div", {
4083
4086
  ...g(O.unhandled),
@@ -4089,9 +4092,9 @@ function Gn({ chart: e, svgWidth: n, title: r }) {
4089
4092
  let o = n / 2, s = 0, c = e.segments.map((e, n) => {
4090
4093
  let r = (i[n] ?? 0) / a, c = s * 2 * Math.PI;
4091
4094
  s += r;
4092
- let l = s * 2 * Math.PI, u = Wn(o, 180, 144, c), d = Wn(o, 180, 144, l), f = +(l - c > Math.PI), p = r >= 1 ? `M${String(o)} 36A144 144 0 1 1 ${String(o)} 324A144 144 0 1 1 ${String(o)} 36Z` : `M${String(u.x)} ${String(u.y)}A144 144 0 ${String(f)} 1 ${String(d.x)} ${String(d.y)}L${String(o)} 180Z`;
4095
+ let l = s * 2 * Math.PI, u = Gn(o, 180, 144, c), d = Gn(o, 180, 144, l), f = +(l - c > Math.PI), p = r >= 1 ? `M${String(o)} 36A144 144 0 1 1 ${String(o)} 324A144 144 0 1 1 ${String(o)} 36Z` : `M${String(u.x)} ${String(u.y)}A144 144 0 ${String(f)} 1 ${String(d.x)} ${String(d.y)}L${String(o)} 180Z`;
4093
4096
  return r <= 0 ? null : /* @__PURE__ */ t("path", {
4094
- ...g(In(n).fill, O.pieSlice),
4097
+ ...g(Ln(n).fill, O.pieSlice),
4095
4098
  d: p,
4096
4099
  "data-segment": e.label,
4097
4100
  key: `${e.label}-${String(n)}`
@@ -4106,41 +4109,41 @@ function Gn({ chart: e, svgWidth: n, title: r }) {
4106
4109
  children: c
4107
4110
  });
4108
4111
  }
4109
- var Kn = {
4112
+ var qn = {
4110
4113
  area: !0,
4111
4114
  bar: !0,
4112
4115
  line: !0
4113
4116
  };
4114
- function qn(e) {
4115
- return w(e) && typeof e.label == "string" && typeof e.value == "number" && Number.isFinite(e.value);
4116
- }
4117
4117
  function Jn(e) {
4118
4118
  return w(e) && typeof e.label == "string" && typeof e.value == "number" && Number.isFinite(e.value);
4119
4119
  }
4120
4120
  function Yn(e) {
4121
- return w(e) && typeof e.name == "string" && Array.isArray(e.data) && e.data.every(Jn);
4121
+ return w(e) && typeof e.label == "string" && typeof e.value == "number" && Number.isFinite(e.value);
4122
4122
  }
4123
4123
  function Xn(e) {
4124
- return w(e) && e.type === "pie" && Array.isArray(e.segments) && e.segments.every(qn);
4124
+ return w(e) && typeof e.name == "string" && Array.isArray(e.data) && e.data.every(Yn);
4125
4125
  }
4126
4126
  function Zn(e) {
4127
+ return w(e) && e.type === "pie" && Array.isArray(e.segments) && e.segments.every(Jn);
4128
+ }
4129
+ function Qn(e) {
4127
4130
  if (!w(e)) return !1;
4128
4131
  let t = e.type;
4129
- if (typeof t != "string" || !(t in Kn)) return !1;
4132
+ if (typeof t != "string" || !(t in qn)) return !1;
4130
4133
  let n = e.axis_config;
4131
- return Array.isArray(e.series) && e.series.every(Yn) && w(n) && Array.isArray(n.categories) && n.categories.every((e) => typeof e == "string");
4134
+ return Array.isArray(e.series) && e.series.every(Xn) && w(n) && Array.isArray(n.categories) && n.categories.every((e) => typeof e == "string");
4132
4135
  }
4133
- function Qn({ block: e, className: n }) {
4134
- let r = e.chart, i = typeof e.title == "string" ? e.title : E(e, "chart"), { ref: a, width: o } = jn(), s = Math.min(624, Math.max(400, o)) - 26, c = Zn(r) ? r : void 0, l = c === void 0 && Xn(r) ? r : void 0, f, p;
4136
+ function $n({ block: e, className: n }) {
4137
+ let r = e.chart, i = typeof e.title == "string" ? e.title : E(e, "chart"), { ref: a, width: o } = Mn(), s = Math.min(624, Math.max(400, o)) - 26, c = Qn(r) ? r : void 0, l = c === void 0 && Zn(r) ? r : void 0, f, p;
4135
4138
  l === void 0 ? c === void 0 ? (f = /* @__PURE__ */ u("div", {
4136
4139
  ...g(O.unhandled),
4137
4140
  "data-unhandled-chart-type": T(r) ?? "unknown",
4138
4141
  children: E(r, "chart")
4139
- }), p = []) : (f = /* @__PURE__ */ u(Un, {
4142
+ }), p = []) : (f = /* @__PURE__ */ u(Wn, {
4140
4143
  chart: c,
4141
4144
  svgWidth: s,
4142
4145
  title: i
4143
- }), p = c.series.map((e) => e.name)) : (f = /* @__PURE__ */ u(Gn, {
4146
+ }), p = c.series.map((e) => e.name)) : (f = /* @__PURE__ */ u(Kn, {
4144
4147
  chart: l,
4145
4148
  svgWidth: s,
4146
4149
  title: i
@@ -4183,7 +4186,7 @@ function Qn({ block: e, className: n }) {
4183
4186
  ...g(O.chartLegendItem),
4184
4187
  key: `${e}-${String(n)}`
4185
4188
  }, /* @__PURE__ */ u("span", {
4186
- ...g(O.chartLegendSwatch, In(n).swatch),
4189
+ ...g(O.chartLegendSwatch, Ln(n).swatch),
4187
4190
  "aria-hidden": "true"
4188
4191
  }), e))
4189
4192
  })
@@ -4196,21 +4199,21 @@ function Qn({ block: e, className: n }) {
4196
4199
  }
4197
4200
  //#endregion
4198
4201
  //#region src/blocks/InteractiveBlocks.tsx
4199
- function $n(e) {
4200
- return w(e) && w(e.text) && typeof e.text.text == "string";
4201
- }
4202
4202
  function er(e) {
4203
- return w(e) && e.type === "feedback_buttons" && $n(e.positive_button) && $n(e.negative_button);
4203
+ return w(e) && w(e.text) && typeof e.text.text == "string";
4204
4204
  }
4205
4205
  function tr(e) {
4206
- return w(e) && e.type === "icon_button" && $n(e);
4206
+ return w(e) && e.type === "feedback_buttons" && er(e.positive_button) && er(e.negative_button);
4207
4207
  }
4208
- function nr({ block: e, className: t, path: n = "block" }) {
4208
+ function nr(e) {
4209
+ return w(e) && e.type === "icon_button" && er(e) && typeof e.icon == "string";
4210
+ }
4211
+ function rr({ block: e, className: t, path: n = "block" }) {
4209
4212
  let r = g(O.block, O.actions), i = Array.isArray(e.elements) ? e.elements : [];
4210
4213
  return /* @__PURE__ */ u("div", {
4211
4214
  ...r,
4212
4215
  className: A(r.className, t),
4213
- "data-block-id": e.block_id,
4216
+ "data-block-id": xe(e),
4214
4217
  "data-block-type": e.type,
4215
4218
  children: i.map((t, r) => /* @__PURE__ */ u(Dt, {
4216
4219
  blockId: e.block_id,
@@ -4219,12 +4222,12 @@ function nr({ block: e, className: t, path: n = "block" }) {
4219
4222
  }, `${T(t) ?? "unknown"}-${w(t) && typeof t.action_id == "string" ? t.action_id : "action"}-${String(r)}`))
4220
4223
  });
4221
4224
  }
4222
- function rr({ block: e, className: t, path: n = "block" }) {
4225
+ function ir({ block: e, className: t, path: n = "block" }) {
4223
4226
  let r = g(O.block, O.inputBlock), i = e.label;
4224
4227
  return /* @__PURE__ */ d("div", {
4225
4228
  ...r,
4226
4229
  className: A(r.className, t),
4227
- "data-block-id": e.block_id,
4230
+ "data-block-id": xe(e),
4228
4231
  "data-block-type": e.type,
4229
4232
  children: [
4230
4233
  /* @__PURE__ */ d("div", {
@@ -4247,18 +4250,18 @@ function rr({ block: e, className: t, path: n = "block" }) {
4247
4250
  ]
4248
4251
  });
4249
4252
  }
4250
- function ir(e, t) {
4253
+ function ar(e, t) {
4251
4254
  return t === "positive" ? e.positive_button.text.text : e.negative_button.text.text;
4252
4255
  }
4253
- function ar({ block: e, className: n }) {
4256
+ function or({ block: e, className: n }) {
4254
4257
  let { onAction: r } = x(), i = g(O.block, O.actions), a = e.elements;
4255
4258
  return /* @__PURE__ */ u("div", {
4256
4259
  ...i,
4257
4260
  className: A(i.className, n),
4258
- "data-block-id": e.block_id,
4261
+ "data-block-id": xe(e),
4259
4262
  "data-block-type": e.type,
4260
4263
  children: Array.isArray(a) ? a.map((n, i) => {
4261
- if (tr(n)) {
4264
+ if (nr(n)) {
4262
4265
  let a = g(O.button, O.iconButton), o = be[n.icon];
4263
4266
  return /* @__PURE__ */ t("button", {
4264
4267
  ...a,
@@ -4276,12 +4279,12 @@ function ar({ block: e, className: n }) {
4276
4279
  type: "button"
4277
4280
  }, o === void 0 ? n.icon : /* @__PURE__ */ u(o, { size: 16 }));
4278
4281
  }
4279
- return er(n) ? /* @__PURE__ */ t("div", {
4282
+ return tr(n) ? /* @__PURE__ */ t("div", {
4280
4283
  ...g(O.actions),
4281
4284
  key: `${n.type}-${n.action_id ?? "feedback"}-${String(i)}`
4282
4285
  }, /* @__PURE__ */ u("button", {
4283
4286
  ...g(O.button, O.iconButton),
4284
- "aria-label": ir(n, "positive"),
4287
+ "aria-label": ar(n, "positive"),
4285
4288
  onClick: () => {
4286
4289
  n.action_id !== void 0 && r?.({
4287
4290
  actionId: n.action_id,
@@ -4294,7 +4297,7 @@ function ar({ block: e, className: n }) {
4294
4297
  children: /* @__PURE__ */ u(_e, { size: 16 })
4295
4298
  }), /* @__PURE__ */ u("button", {
4296
4299
  ...g(O.button, O.iconButton),
4297
- "aria-label": ir(n, "negative"),
4300
+ "aria-label": ar(n, "negative"),
4298
4301
  onClick: () => {
4299
4302
  n.action_id !== void 0 && r?.({
4300
4303
  actionId: n.action_id,
@@ -4319,14 +4322,14 @@ function ar({ block: e, className: n }) {
4319
4322
  }
4320
4323
  //#endregion
4321
4324
  //#region src/Block.tsx
4322
- var or = new Set(kn);
4323
- function sr(e) {
4325
+ var sr = new Set(An);
4326
+ function cr(e) {
4324
4327
  let t = T(e);
4325
- return t !== void 0 && or.has(t);
4328
+ return t !== void 0 && sr.has(t);
4326
4329
  }
4327
- function cr({ block: e, className: t, path: n = "block" }) {
4330
+ function lr({ block: e, className: t, path: n = "block" }) {
4328
4331
  let r = T(e);
4329
- if (!sr(e)) {
4332
+ if (!cr(e)) {
4330
4333
  let n = g(O.block, O.unhandled);
4331
4334
  return /* @__PURE__ */ u("div", {
4332
4335
  ...n,
@@ -4338,27 +4341,27 @@ function cr({ block: e, className: t, path: n = "block" }) {
4338
4341
  });
4339
4342
  }
4340
4343
  switch (e.type) {
4341
- case "actions": return /* @__PURE__ */ u(nr, {
4344
+ case "actions": return /* @__PURE__ */ u(rr, {
4342
4345
  block: e,
4343
4346
  className: t,
4344
4347
  path: n
4345
4348
  });
4346
- case "alert": return /* @__PURE__ */ u(mn, {
4349
+ case "alert": return /* @__PURE__ */ u(hn, {
4347
4350
  block: e,
4348
4351
  className: t,
4349
4352
  path: n
4350
4353
  });
4351
- case "card": return /* @__PURE__ */ u(dn, {
4354
+ case "card": return /* @__PURE__ */ u(fn, {
4352
4355
  block: e,
4353
4356
  className: t,
4354
4357
  path: n
4355
4358
  });
4356
- case "carousel": return /* @__PURE__ */ u(pn, {
4359
+ case "carousel": return /* @__PURE__ */ u(mn, {
4357
4360
  block: e,
4358
4361
  className: t,
4359
4362
  path: n
4360
4363
  });
4361
- case "container": return /* @__PURE__ */ u(mr, {
4364
+ case "container": return /* @__PURE__ */ u(hr, {
4362
4365
  block: e,
4363
4366
  className: t,
4364
4367
  path: n
@@ -4368,17 +4371,17 @@ function cr({ block: e, className: t, path: n = "block" }) {
4368
4371
  className: t,
4369
4372
  path: n
4370
4373
  });
4371
- case "context_actions": return /* @__PURE__ */ u(ar, {
4374
+ case "context_actions": return /* @__PURE__ */ u(or, {
4372
4375
  block: e,
4373
4376
  className: t,
4374
4377
  path: n
4375
4378
  });
4376
- case "data_table": return /* @__PURE__ */ u(ln, {
4379
+ case "data_table": return /* @__PURE__ */ u(un, {
4377
4380
  block: e,
4378
4381
  className: t,
4379
4382
  path: n
4380
4383
  });
4381
- case "data_visualization": return /* @__PURE__ */ u(Qn, {
4384
+ case "data_visualization": return /* @__PURE__ */ u($n, {
4382
4385
  block: e,
4383
4386
  className: t,
4384
4387
  path: n
@@ -4403,7 +4406,7 @@ function cr({ block: e, className: t, path: n = "block" }) {
4403
4406
  className: t,
4404
4407
  path: n
4405
4408
  });
4406
- case "input": return /* @__PURE__ */ u(rr, {
4409
+ case "input": return /* @__PURE__ */ u(ir, {
4407
4410
  block: e,
4408
4411
  className: t,
4409
4412
  path: n
@@ -4413,7 +4416,7 @@ function cr({ block: e, className: t, path: n = "block" }) {
4413
4416
  className: t,
4414
4417
  path: n
4415
4418
  });
4416
- case "plan": return /* @__PURE__ */ u(_n, {
4419
+ case "plan": return /* @__PURE__ */ u(vn, {
4417
4420
  block: e,
4418
4421
  className: t,
4419
4422
  path: n
@@ -4428,12 +4431,12 @@ function cr({ block: e, className: t, path: n = "block" }) {
4428
4431
  className: t,
4429
4432
  path: n
4430
4433
  });
4431
- case "table": return /* @__PURE__ */ u(on, {
4434
+ case "table": return /* @__PURE__ */ u(sn, {
4432
4435
  block: e,
4433
4436
  className: t,
4434
4437
  path: n
4435
4438
  });
4436
- case "task_card": return /* @__PURE__ */ u(hn, {
4439
+ case "task_card": return /* @__PURE__ */ u(gn, {
4437
4440
  block: e,
4438
4441
  className: t,
4439
4442
  path: n
@@ -4446,10 +4449,10 @@ function cr({ block: e, className: t, path: n = "block" }) {
4446
4449
  default: return _(e);
4447
4450
  }
4448
4451
  }
4449
- function lr(e) {
4450
- return /* @__PURE__ */ u(cr, { ...e });
4452
+ function ur(e) {
4453
+ return /* @__PURE__ */ u(lr, { ...e });
4451
4454
  }
4452
- var ur = {
4455
+ var dr = {
4453
4456
  actions: !0,
4454
4457
  context: !0,
4455
4458
  divider: !0,
@@ -4462,11 +4465,11 @@ var ur = {
4462
4465
  table: !0,
4463
4466
  video: !0
4464
4467
  };
4465
- function dr(e) {
4468
+ function fr(e) {
4466
4469
  let t = T(e);
4467
- return t !== void 0 && t in ur;
4470
+ return t !== void 0 && t in dr;
4468
4471
  }
4469
- function fr({ block: e, path: t }) {
4472
+ function pr({ block: e, path: t }) {
4470
4473
  let n = e.title, r = e.subtitle;
4471
4474
  return /* @__PURE__ */ d(l, { children: [e.icon === void 0 ? null : /* @__PURE__ */ u(F, {
4472
4475
  element: e.icon,
@@ -4479,11 +4482,11 @@ function fr({ block: e, path: t }) {
4479
4482
  children: w(r) && typeof r.text == "string" ? r.text : E(r, "container subtitle")
4480
4483
  })] })] });
4481
4484
  }
4482
- function pr({ block: e, path: n }) {
4485
+ function mr({ block: e, path: n }) {
4483
4486
  let r = e.child_blocks;
4484
4487
  return /* @__PURE__ */ u("div", {
4485
4488
  ...g(O.containerBody),
4486
- children: Array.isArray(r) ? r.map((e, r) => dr(e) ? /* @__PURE__ */ u(cr, {
4489
+ children: Array.isArray(r) ? r.map((e, r) => fr(e) ? /* @__PURE__ */ u(lr, {
4487
4490
  block: e,
4488
4491
  path: `${n}.child_blocks[${String(r)}]`
4489
4492
  }, `${T(e) ?? "unknown"}-${xe(e) ?? "block"}-${String(r)}`) : /* @__PURE__ */ t("div", {
@@ -4494,7 +4497,7 @@ function pr({ block: e, path: n }) {
4494
4497
  }, E(e, "Slack block"))) : null
4495
4498
  });
4496
4499
  }
4497
- function mr({ block: e, className: t, path: n = "block" }) {
4500
+ function hr({ block: e, className: t, path: n = "block" }) {
4498
4501
  return /* @__PURE__ */ u(R, {
4499
4502
  blockId: e.block_id,
4500
4503
  blockType: e.type,
@@ -4509,11 +4512,11 @@ function mr({ block: e, className: t, path: n = "block" }) {
4509
4512
  "aria-hidden": "true",
4510
4513
  "data-container-chevron": !0,
4511
4514
  children: /* @__PURE__ */ u(ne, { size: 16 })
4512
- }), /* @__PURE__ */ u(fr, {
4515
+ }), /* @__PURE__ */ u(pr, {
4513
4516
  block: e,
4514
4517
  path: n
4515
4518
  })]
4516
- }), /* @__PURE__ */ u(pr, {
4519
+ }), /* @__PURE__ */ u(mr, {
4517
4520
  block: e,
4518
4521
  path: n
4519
4522
  })]
@@ -4521,11 +4524,11 @@ function mr({ block: e, className: t, path: n = "block" }) {
4521
4524
  ...g(O.container),
4522
4525
  children: [/* @__PURE__ */ u("div", {
4523
4526
  ...g(O.containerHeader, e.has_header_divider === !0 && O.containerHeaderDivider),
4524
- children: /* @__PURE__ */ u(fr, {
4527
+ children: /* @__PURE__ */ u(pr, {
4525
4528
  block: e,
4526
4529
  path: n
4527
4530
  })
4528
- }), /* @__PURE__ */ u(pr, {
4531
+ }), /* @__PURE__ */ u(mr, {
4529
4532
  block: e,
4530
4533
  path: n
4531
4534
  })]
@@ -4534,7 +4537,7 @@ function mr({ block: e, className: t, path: n = "block" }) {
4534
4537
  }
4535
4538
  //#endregion
4536
4539
  //#region src/errors.ts
4537
- var hr = class extends Error {
4540
+ var gr = class extends Error {
4538
4541
  code;
4539
4542
  path;
4540
4543
  name;
@@ -4544,12 +4547,12 @@ var hr = class extends Error {
4544
4547
  };
4545
4548
  //#endregion
4546
4549
  //#region src/BlockKit.tsx
4547
- function gr(e) {
4550
+ function _r(e) {
4548
4551
  let t = e;
4549
4552
  if (typeof e == "string") try {
4550
4553
  t = JSON.parse(e);
4551
4554
  } catch {
4552
- throw new hr("data: expected valid JSON", {
4555
+ throw new gr("data: expected valid JSON", {
4553
4556
  code: "invalid_json",
4554
4557
  path: "data"
4555
4558
  });
@@ -4565,8 +4568,8 @@ function gr(e) {
4565
4568
  blocks: [t]
4566
4569
  };
4567
4570
  }
4568
- function _r({ "aria-label": e = "Slack Block Kit preview", className: t, data: n, onAction: r, resolvers: i, surface: a = "message", theme: s = "light" }) {
4569
- let c = o(() => gr(n), [n]), l = g(s === "dark" ? we : Ce, O.root, s === "dark" ? O.rootDark : O.rootLight);
4571
+ function vr({ "aria-label": e = "Slack Block Kit preview", className: t, data: n, onAction: r, resolvers: i, surface: a = "message", theme: s = "light" }) {
4572
+ let c = o(() => _r(n), [n]), l = g(s === "dark" ? we : Ce, O.root, s === "dark" ? O.rootDark : O.rootLight);
4570
4573
  return /* @__PURE__ */ u(b, {
4571
4574
  onAction: r,
4572
4575
  resolvers: i,
@@ -4579,7 +4582,7 @@ function _r({ "aria-label": e = "Slack Block Kit preview", className: t, data: n
4579
4582
  "data-surface": a,
4580
4583
  "data-theme": s,
4581
4584
  role: "article",
4582
- children: c.blocks.map((e, t) => /* @__PURE__ */ u(cr, {
4585
+ children: c.blocks.map((e, t) => /* @__PURE__ */ u(lr, {
4583
4586
  block: e,
4584
4587
  path: `${c.blockListPath}[${String(t)}]`
4585
4588
  }, `${T(e) ?? "unknown"}-${xe(e) ?? "block"}-${String(t)}`))
@@ -4588,14 +4591,14 @@ function _r({ "aria-label": e = "Slack Block Kit preview", className: t, data: n
4588
4591
  }
4589
4592
  //#endregion
4590
4593
  //#region src/validation.ts
4591
- function vr(e, t, n) {
4592
- throw new hr(n, {
4594
+ function yr(e, t, n) {
4595
+ throw new gr(n, {
4593
4596
  code: e,
4594
4597
  path: t
4595
4598
  });
4596
4599
  }
4597
4600
  function z(e, t, n, r) {
4598
- e || vr(t, n, r);
4601
+ e || yr(t, n, r);
4599
4602
  }
4600
4603
  function B(e, t) {
4601
4604
  z(w(e), "invalid_type", t, "expected an object");
@@ -4624,67 +4627,67 @@ function q(e, t, n) {
4624
4627
  function J(e, t) {
4625
4628
  H(e.type, `${t}.type`), U(e.block_id, `${t}.block_id`, { max: 255 });
4626
4629
  }
4627
- function Y(e, t, n = vn) {
4630
+ function Y(e, t, n = yn) {
4628
4631
  B(e, t), q(e.type, ["plain_text", "mrkdwn"], `${t}.type`), H(e.text, `${t}.text`, { max: n }), e.type === "plain_text" ? (G(e.emoji, `${t}.emoji`), z(e.verbatim === void 0, "invalid_value", `${t}.verbatim`, "verbatim is only legal on mrkdwn text")) : (G(e.verbatim, `${t}.verbatim`), z(e.emoji === void 0, "invalid_value", `${t}.emoji`, "emoji is only legal on plain_text"));
4629
4632
  }
4630
- function yr(e, t = "text", n = vn) {
4633
+ function br(e, t = "text", n = yn) {
4631
4634
  Y(e, t, n);
4632
4635
  }
4633
- function X(e, t, n = vn) {
4636
+ function X(e, t, n = yn) {
4634
4637
  Y(e, t, n), z(w(e) && e.type === "plain_text", "invalid_value", `${t}.type`, "expected \"plain_text\"");
4635
4638
  }
4636
- function br(e, t) {
4639
+ function xr(e, t) {
4637
4640
  B(e, t);
4638
4641
  let n = e.id !== void 0, r = e.url !== void 0;
4639
- z(n !== r, "invalid_value", t, "must contain exactly one of id or url"), n && H(e.id, `${t}.id`), r && H(e.url, `${t}.url`, { max: xn });
4642
+ z(n !== r, "invalid_value", t, "must contain exactly one of id or url"), n && H(e.id, `${t}.id`), r && H(e.url, `${t}.url`, { max: Sn });
4640
4643
  }
4641
4644
  function Z(e, t) {
4642
- B(e, t), K(e, "image", t), H(e.alt_text, `${t}.alt_text`, { max: Sn });
4645
+ B(e, t), K(e, "image", t), H(e.alt_text, `${t}.alt_text`, { max: Cn });
4643
4646
  let n = e.image_url !== void 0, r = e.slack_file !== void 0;
4644
- z(n !== r, "invalid_value", t, "must contain exactly one of image_url or slack_file"), n && H(e.image_url, `${t}.image_url`, { max: xn }), r && br(e.slack_file, `${t}.slack_file`);
4647
+ z(n !== r, "invalid_value", t, "must contain exactly one of image_url or slack_file"), n && H(e.image_url, `${t}.image_url`, { max: Sn }), r && xr(e.slack_file, `${t}.slack_file`);
4645
4648
  }
4646
- function xr(e, t = "element") {
4649
+ function Sr(e, t = "element") {
4647
4650
  Z(e, t);
4648
4651
  }
4649
- function Sr(e, t) {
4650
- B(e, t), Y(e.text, `${t}.text`, 75), U(e.value, `${t}.value`, { max: 75 }), U(e.url, `${t}.url`, { max: Tn }), e.description !== void 0 && X(e.description, `${t}.description`, 75);
4652
+ function Cr(e, t) {
4653
+ B(e, t), Y(e.text, `${t}.text`, 75), U(e.value, `${t}.value`, { max: 75 }), U(e.url, `${t}.url`, { max: En }), e.description !== void 0 && X(e.description, `${t}.description`, 75);
4651
4654
  }
4652
- function Cr(e, t, n) {
4655
+ function wr(e, t, n) {
4653
4656
  V(e, t), z(e.length > 0, "missing_field", t, "must contain at least one option"), z(e.length <= n, "limit_exceeded", t, `must contain at most ${String(n)} options`), e.forEach((e, n) => {
4654
- Sr(e, `${t}[${String(n)}]`);
4657
+ Cr(e, `${t}[${String(n)}]`);
4655
4658
  });
4656
4659
  }
4657
- function wr(e, t) {
4658
- U(e.action_id, `${t}.action_id`, { max: 255 });
4659
- }
4660
4660
  function Tr(e, t) {
4661
- e.placeholder !== void 0 && X(e.placeholder, `${t}.placeholder`, 150);
4661
+ U(e.action_id, `${t}.action_id`, { max: 255 });
4662
4662
  }
4663
4663
  function Er(e, t) {
4664
- B(e, t), K(e, "button", t), wr(e, t), X(e.text, `${t}.text`, 75), U(e.url, `${t}.url`, { max: Tn }), U(e.value, `${t}.value`, { max: En }), U(e.accessibility_label, `${t}.accessibility_label`, { max: 75 }), e.style !== void 0 && q(e.style, ["primary", "danger"], `${t}.style`);
4664
+ e.placeholder !== void 0 && X(e.placeholder, `${t}.placeholder`, 150);
4665
4665
  }
4666
4666
  function Dr(e, t) {
4667
+ B(e, t), K(e, "button", t), Tr(e, t), X(e.text, `${t}.text`, 75), U(e.url, `${t}.url`, { max: En }), U(e.value, `${t}.value`, { max: Dn }), U(e.accessibility_label, `${t}.accessibility_label`, { max: 75 }), e.style !== void 0 && q(e.style, ["primary", "danger"], `${t}.style`);
4668
+ }
4669
+ function Or(e, t) {
4667
4670
  let n = e.options !== void 0, r = e.option_groups !== void 0;
4668
- z(n !== r, "invalid_value", t, "must contain exactly one of options or option_groups"), n && Cr(e.options, `${t}.options`, 100), r && (V(e.option_groups, `${t}.option_groups`), z(e.option_groups.length <= 100, "limit_exceeded", `${t}.option_groups`, "must contain at most 100 groups"), e.option_groups.forEach((e, n) => {
4671
+ z(n !== r, "invalid_value", t, "must contain exactly one of options or option_groups"), n && wr(e.options, `${t}.options`, 100), r && (V(e.option_groups, `${t}.option_groups`), z(e.option_groups.length <= 100, "limit_exceeded", `${t}.option_groups`, "must contain at most 100 groups"), e.option_groups.forEach((e, n) => {
4669
4672
  let r = `${t}.option_groups[${String(n)}]`;
4670
- B(e, r), X(e.label, `${r}.label`, 75), Cr(e.options, `${r}.options`, 100);
4673
+ B(e, r), X(e.label, `${r}.label`, 75), wr(e.options, `${r}.options`, 100);
4671
4674
  }));
4672
4675
  }
4673
- function Or(e, t) {
4674
- switch (B(e, t), H(e.type, `${t}.type`), wr(e, t), Tr(e, t), e.type) {
4676
+ function kr(e, t) {
4677
+ switch (B(e, t), H(e.type, `${t}.type`), Tr(e, t), Er(e, t), e.type) {
4675
4678
  case "button":
4676
- Er(e, t);
4679
+ Dr(e, t);
4677
4680
  return;
4678
4681
  case "checkboxes":
4679
4682
  case "radio_buttons":
4680
- Cr(e.options, `${t}.options`, 10);
4683
+ wr(e.options, `${t}.options`, 10);
4681
4684
  return;
4682
4685
  case "overflow":
4683
- Cr(e.options, `${t}.options`, 5);
4686
+ wr(e.options, `${t}.options`, 5);
4684
4687
  return;
4685
4688
  case "static_select":
4686
4689
  case "multi_static_select":
4687
- Dr(e, t);
4690
+ Or(e, t);
4688
4691
  return;
4689
4692
  case "external_select":
4690
4693
  case "multi_external_select":
@@ -4730,13 +4733,13 @@ function Or(e, t) {
4730
4733
  case "workflow_button":
4731
4734
  X(e.text, `${t}.text`, 75), B(e.workflow, `${t}.workflow`), B(e.workflow.trigger, `${t}.workflow.trigger`), H(e.workflow.trigger.url, `${t}.workflow.trigger.url`);
4732
4735
  return;
4733
- default: vr("unsupported_element", `${t}.type`, `unsupported element "${e.type}"`);
4736
+ default: yr("unsupported_element", `${t}.type`, `unsupported element "${e.type}"`);
4734
4737
  }
4735
4738
  }
4736
- function kr(e, t = "element") {
4737
- Or(e, t);
4739
+ function Ar(e, t = "element") {
4740
+ kr(e, t);
4738
4741
  }
4739
- function Ar(e, t) {
4742
+ function jr(e, t) {
4740
4743
  if (e !== void 0) {
4741
4744
  B(e, t);
4742
4745
  for (let n of [
@@ -4748,8 +4751,8 @@ function Ar(e, t) {
4748
4751
  ]) G(e[n], `${t}.${n}`);
4749
4752
  }
4750
4753
  }
4751
- function jr(e, t) {
4752
- switch (B(e, t), H(e.type, `${t}.type`), Ar(e.style, `${t}.style`), e.type) {
4754
+ function Mr(e, t) {
4755
+ switch (B(e, t), H(e.type, `${t}.type`), jr(e.style, `${t}.style`), e.type) {
4753
4756
  case "text":
4754
4757
  H(e.text, `${t}.text`, { allowEmpty: !0 });
4755
4758
  return;
@@ -4803,12 +4806,12 @@ function jr(e, t) {
4803
4806
  case "workflow_mention":
4804
4807
  z(Object.keys(e).length > 1, "missing_field", t, `${e.type} must contain its reference fields`);
4805
4808
  return;
4806
- default: vr("unsupported_element", `${t}.type`, `unsupported rich text element "${e.type}"`);
4809
+ default: yr("unsupported_element", `${t}.type`, `unsupported rich text element "${e.type}"`);
4807
4810
  }
4808
4811
  }
4809
- function Mr(e, t) {
4812
+ function Nr(e, t) {
4810
4813
  V(e, t), e.forEach((e, n) => {
4811
- jr(e, `${t}[${String(n)}]`);
4814
+ Mr(e, `${t}[${String(n)}]`);
4812
4815
  });
4813
4816
  }
4814
4817
  function Q(e, t) {
@@ -4817,7 +4820,7 @@ function Q(e, t) {
4817
4820
  switch (B(e, r), H(e.type, `${r}.type`), e.type) {
4818
4821
  case "rich_text_section":
4819
4822
  case "rich_text_quote":
4820
- Mr(e.elements, `${r}.elements`);
4823
+ Nr(e.elements, `${r}.elements`);
4821
4824
  return;
4822
4825
  case "rich_text_list":
4823
4826
  q(e.style, ["bullet", "ordered"], `${r}.style`), e.indent !== void 0 && W(e.indent, `${r}.indent`, {
@@ -4829,25 +4832,25 @@ function Q(e, t) {
4829
4832
  min: 0
4830
4833
  }), V(e.elements, `${r}.elements`), e.elements.forEach((e, t) => {
4831
4834
  let n = `${r}.elements[${String(t)}]`;
4832
- B(e, n), K(e, "rich_text_section", n), Mr(e.elements, `${n}.elements`);
4835
+ B(e, n), K(e, "rich_text_section", n), Nr(e.elements, `${n}.elements`);
4833
4836
  });
4834
4837
  return;
4835
4838
  case "rich_text_preformatted":
4836
- Mr(e.elements, `${r}.elements`), U(e.language, `${r}.language`);
4839
+ Nr(e.elements, `${r}.elements`), U(e.language, `${r}.language`);
4837
4840
  return;
4838
- default: vr("unsupported_element", `${r}.type`, `unsupported rich text container "${e.type}"`);
4841
+ default: yr("unsupported_element", `${r}.type`, `unsupported rich text container "${e.type}"`);
4839
4842
  }
4840
4843
  });
4841
4844
  }
4842
- function Nr(e, t = "block") {
4845
+ function Pr(e, t = "block") {
4843
4846
  Q(e, t);
4844
4847
  }
4845
- function Pr(e, t) {
4848
+ function Fr(e, t) {
4846
4849
  B(e, t), K(e, "section", t), J(e, t);
4847
4850
  let n = e.text !== void 0, r = e.fields !== void 0;
4848
- z(n || r, "missing_field", t, "requires text or fields"), n && Y(e.text, `${t}.text`, yn), r && (V(e.fields, `${t}.fields`), z(e.fields.length > 0 && e.fields.length <= 10, "limit_exceeded", `${t}.fields`, "must contain 1–10 text objects"), e.fields.forEach((e, n) => {
4849
- Y(e, `${t}.fields[${String(n)}]`, bn);
4850
- })), e.accessory !== void 0 && (B(e.accessory, `${t}.accessory`), e.accessory.type === "image" ? Z(e.accessory, `${t}.accessory`) : (Or(e.accessory, `${t}.accessory`), z(![
4851
+ z(n || r, "missing_field", t, "requires text or fields"), n && Y(e.text, `${t}.text`, bn), r && (V(e.fields, `${t}.fields`), z(e.fields.length > 0 && e.fields.length <= 10, "limit_exceeded", `${t}.fields`, "must contain 1–10 text objects"), e.fields.forEach((e, n) => {
4852
+ Y(e, `${t}.fields[${String(n)}]`, xn);
4853
+ })), e.accessory !== void 0 && (B(e.accessory, `${t}.accessory`), e.accessory.type === "image" ? Z(e.accessory, `${t}.accessory`) : (kr(e.accessory, `${t}.accessory`), z(![
4851
4854
  "datetimepicker",
4852
4855
  "file_input",
4853
4856
  "plain_text_input",
@@ -4857,26 +4860,26 @@ function Pr(e, t) {
4857
4860
  "rich_text_input"
4858
4861
  ].includes(String(e.accessory.type)), "invalid_value", `${t}.accessory.type`, "element is not legal as a section accessory"))), G(e.expand, `${t}.expand`);
4859
4862
  }
4860
- function Fr(e, t) {
4863
+ function Ir(e, t) {
4861
4864
  B(e, t), K(e, "header", t), J(e, t), X(e.text, `${t}.text`, 150), e.level !== void 0 && W(e.level, `${t}.level`, {
4862
4865
  integer: !0,
4863
4866
  min: 1,
4864
4867
  max: 4
4865
4868
  });
4866
4869
  }
4867
- function Ir(e, t) {
4868
- Z(e, t), B(e, t), J(e, t), e.title !== void 0 && X(e.title, `${t}.title`, Cn);
4869
- }
4870
4870
  function Lr(e, t) {
4871
+ Z(e, t), B(e, t), J(e, t), e.title !== void 0 && X(e.title, `${t}.title`, wn);
4872
+ }
4873
+ function Rr(e, t) {
4871
4874
  B(e, t), K(e, "context", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 10, "limit_exceeded", `${t}.elements`, "must contain 1–10 elements"), e.elements.forEach((e, n) => {
4872
4875
  let r = `${t}.elements[${String(n)}]`;
4873
4876
  B(e, r), e.type === "image" ? Z(e, r) : Y(e, r);
4874
4877
  });
4875
4878
  }
4876
- function Rr(e, t) {
4879
+ function zr(e, t) {
4877
4880
  B(e, t), K(e, "actions", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 25, "limit_exceeded", `${t}.elements`, "must contain 1–25 elements"), e.elements.forEach((e, n) => {
4878
4881
  let r = `${t}.elements[${String(n)}]`;
4879
- Or(e, r), B(e, r), z([
4882
+ kr(e, r), B(e, r), z([
4880
4883
  "button",
4881
4884
  "checkboxes",
4882
4885
  "datepicker",
@@ -4899,16 +4902,16 @@ function Rr(e, t) {
4899
4902
  ].includes(String(e.type)), "invalid_value", `${r}.type`, "element is not legal inside an actions block");
4900
4903
  });
4901
4904
  }
4902
- function zr(e, t) {
4903
- B(e, t), K(e, "input", t), J(e, t), X(e.label, `${t}.label`, 2e3), e.hint !== void 0 && X(e.hint, `${t}.hint`, 2e3), G(e.optional, `${t}.optional`), G(e.dispatch_action, `${t}.dispatch_action`), Or(e.element, `${t}.element`), B(e.element, `${t}.element`), z(![
4905
+ function Br(e, t, n) {
4906
+ B(e, n), K(e, "input", n), J(e, n), z(t !== "message", "surface_mismatch", n, "input blocks are only legal on modal and home surfaces"), X(e.label, `${n}.label`, 2e3), e.hint !== void 0 && X(e.hint, `${n}.hint`, 2e3), G(e.optional, `${n}.optional`), G(e.dispatch_action, `${n}.dispatch_action`), kr(e.element, `${n}.element`), B(e.element, `${n}.element`), z(![
4904
4907
  "button",
4905
4908
  "overflow",
4906
4909
  "workflow_button",
4907
4910
  "icon_button",
4908
4911
  "feedback_buttons"
4909
- ].includes(String(e.element.type)), "invalid_value", `${t}.element.type`, "element is not legal inside an input block"), z(!(e.dispatch_action === !0 && e.element.type === "file_input"), "invalid_value", `${t}.dispatch_action`, "dispatch_action is incompatible with file_input");
4912
+ ].includes(String(e.element.type)), "invalid_value", `${n}.element.type`, "element is not legal inside an input block"), z(!(e.dispatch_action === !0 && e.element.type === "file_input"), "invalid_value", `${n}.dispatch_action`, "dispatch_action is incompatible with file_input");
4910
4913
  }
4911
- function Br(e) {
4914
+ function Vr(e) {
4912
4915
  if (!w(e)) return 0;
4913
4916
  if (e.type === "raw_text") return typeof e.text == "string" ? e.text.length : 0;
4914
4917
  if (e.type === "raw_number") return typeof e.text == "string" ? e.text.length : typeof e.value == "number" ? String(e.value).length : 0;
@@ -4919,7 +4922,7 @@ function Br(e) {
4919
4922
  }
4920
4923
  return 0;
4921
4924
  }
4922
- function Vr(e, t, n) {
4925
+ function Hr(e, t, n) {
4923
4926
  switch (B(e, t), H(e.type, `${t}.type`), e.type) {
4924
4927
  case "raw_text":
4925
4928
  H(e.text, `${t}.text`);
@@ -4930,21 +4933,21 @@ function Vr(e, t, n) {
4930
4933
  case "rich_text":
4931
4934
  z(n, "invalid_value", t, "rich_text is not legal in this row"), Q(e, t);
4932
4935
  return;
4933
- default: vr("invalid_value", `${t}.type`, `unsupported table cell "${e.type}"`);
4936
+ default: yr("invalid_value", `${t}.type`, `unsupported table cell "${e.type}"`);
4934
4937
  }
4935
4938
  }
4936
- function Hr(e, t, n, r, i) {
4939
+ function Ur(e, t, n, r, i) {
4937
4940
  V(e, t), z(e.length > 0, "missing_field", t, "must contain at least one row"), z(e.length <= n, "limit_exceeded", t, `must contain at most ${String(n)} rows`);
4938
4941
  let a, o = 0;
4939
4942
  return e.forEach((e, n) => {
4940
4943
  let r = `${t}[${String(n)}]`;
4941
4944
  V(e, r), z(e.length > 0 && e.length <= 20, "limit_exceeded", r, "must contain 1–20 cells"), a === void 0 ? a = e.length : z(e.length === a, "invalid_value", r, "all table rows must contain the same number of cells"), e.forEach((e, t) => {
4942
- Vr(e, `${r}[${String(t)}]`, i || n !== 0), o += Br(e);
4945
+ Hr(e, `${r}[${String(t)}]`, i || n !== 0), o += Vr(e);
4943
4946
  });
4944
4947
  }), z(o <= r, "limit_exceeded", t, `cell content must contain at most ${String(r)} characters`), a ?? 0;
4945
4948
  }
4946
- function Ur(e, t) {
4947
- B(e, t), K(e, "table", t), J(e, t), Hr(e.rows, `${t}.rows`, 100, Dn, !0), e.column_settings !== void 0 && (V(e.column_settings, `${t}.column_settings`), z(e.column_settings.length <= 20, "limit_exceeded", `${t}.column_settings`, "must contain at most 20 entries"), e.column_settings.forEach((e, n) => {
4949
+ function Wr(e, t) {
4950
+ B(e, t), K(e, "table", t), J(e, t), Ur(e.rows, `${t}.rows`, 100, On, !0), e.column_settings !== void 0 && (V(e.column_settings, `${t}.column_settings`), z(e.column_settings.length <= 20, "limit_exceeded", `${t}.column_settings`, "must contain at most 20 entries"), e.column_settings.forEach((e, n) => {
4948
4951
  if (e === null) return;
4949
4952
  let r = `${t}.column_settings[${String(n)}]`;
4950
4953
  B(e, r), e.align !== void 0 && q(e.align, [
@@ -4954,9 +4957,9 @@ function Ur(e, t) {
4954
4957
  ], `${r}.align`), G(e.is_wrapped, `${r}.is_wrapped`);
4955
4958
  }));
4956
4959
  }
4957
- function Wr(e, t) {
4960
+ function Gr(e, t) {
4958
4961
  B(e, t), K(e, "data_table", t), J(e, t), H(e.caption, `${t}.caption`);
4959
- let n = Hr(e.rows, `${t}.rows`, 201, On, !1);
4962
+ let n = Ur(e.rows, `${t}.rows`, 201, kn, !1);
4960
4963
  V(e.rows, `${t}.rows`), z(e.rows.length >= 2, "invalid_value", `${t}.rows`, "requires a header row and at least one data row"), e.page_size !== void 0 && W(e.page_size, `${t}.page_size`, {
4961
4964
  integer: !0,
4962
4965
  min: 1,
@@ -4967,7 +4970,7 @@ function Wr(e, t) {
4967
4970
  max: n - 1
4968
4971
  });
4969
4972
  }
4970
- function Gr(e, t) {
4973
+ function Kr(e, t) {
4971
4974
  if (B(e, t), K(e, "data_visualization", t), J(e, t), H(e.title, `${t}.title`, { max: 50 }), B(e.chart, `${t}.chart`), H(e.chart.type, `${t}.chart.type`), e.chart.type === "pie") {
4972
4975
  V(e.chart.segments, `${t}.chart.segments`), z(e.chart.segments.length > 0 && e.chart.segments.length <= 12, "limit_exceeded", `${t}.chart.segments`, "must contain 1–12 segments"), e.chart.segments.forEach((e, n) => {
4973
4976
  let r = `${t}.chart.segments[${String(n)}]`;
@@ -4996,20 +4999,20 @@ function Gr(e, t) {
4996
4999
  });
4997
5000
  });
4998
5001
  }
4999
- function Kr(e, t) {
5002
+ function qr(e, t) {
5000
5003
  B(e, t), K(e, "card", t), J(e, t), z(e.hero_image !== void 0 || e.title !== void 0 || e.actions !== void 0 || e.body !== void 0, "missing_field", t, "requires at least one of hero_image, title, actions, or body"), e.hero_image !== void 0 && Z(e.hero_image, `${t}.hero_image`), e.icon !== void 0 && Z(e.icon, `${t}.icon`), z(!(e.icon !== void 0 && e.slack_icon !== void 0), "invalid_value", t, "icon and slack_icon are mutually exclusive"), e.slack_icon !== void 0 && (B(e.slack_icon, `${t}.slack_icon`), K(e.slack_icon, "icon", `${t}.slack_icon`), H(e.slack_icon.name, `${t}.slack_icon.name`));
5001
5004
  for (let n of ["title", "subtitle"]) e[n] !== void 0 && Y(e[n], `${t}.${n}`, 150);
5002
5005
  for (let n of ["body", "subtext"]) e[n] !== void 0 && Y(e[n], `${t}.${n}`, 200);
5003
5006
  e.actions !== void 0 && (V(e.actions, `${t}.actions`), z(e.actions.length > 0 && e.actions.length <= 3, "limit_exceeded", `${t}.actions`, "must contain 1–3 buttons"), e.actions.forEach((e, n) => {
5004
- Er(e, `${t}.actions[${String(n)}]`);
5007
+ Dr(e, `${t}.actions[${String(n)}]`);
5005
5008
  }));
5006
5009
  }
5007
- function qr(e, t) {
5010
+ function Jr(e, t) {
5008
5011
  B(e, t), K(e, "carousel", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 10, "limit_exceeded", `${t}.elements`, "must contain 1–10 cards"), e.elements.forEach((e, n) => {
5009
- Kr(e, `${t}.elements[${String(n)}]`);
5012
+ qr(e, `${t}.elements[${String(n)}]`);
5010
5013
  });
5011
5014
  }
5012
- function Jr(e, t, n) {
5015
+ function Yr(e, t, n) {
5013
5016
  B(e, n), K(e, "alert", n), J(e, n), z(t === "modal", "surface_mismatch", n, "alert blocks are only legal on modal surfaces"), Y(e.text, `${n}.text`, 200), e.level !== void 0 && q(e.level, [
5014
5017
  "default",
5015
5018
  "info",
@@ -5018,21 +5021,21 @@ function Jr(e, t, n) {
5018
5021
  "success"
5019
5022
  ], `${n}.level`);
5020
5023
  }
5021
- function Yr(e, t) {
5024
+ function Xr(e, t) {
5022
5025
  B(e, t), K(e, "context_actions", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 5, "limit_exceeded", `${t}.elements`, "must contain 1–5 elements"), e.elements.forEach((e, n) => {
5023
5026
  let r = `${t}.elements[${String(n)}]`;
5024
- if (B(e, r), wr(e, r), e.type === "icon_button") {
5025
- q(e.icon, ["trash"], `${r}.icon`), X(e.text, `${r}.text`, 75), U(e.value, `${r}.value`, { max: En });
5027
+ if (B(e, r), Tr(e, r), e.type === "icon_button") {
5028
+ q(e.icon, ["trash"], `${r}.icon`), X(e.text, `${r}.text`, 75), U(e.value, `${r}.value`, { max: Dn });
5026
5029
  return;
5027
5030
  }
5028
5031
  z(e.type === "feedback_buttons", "unsupported_element", `${r}.type`, "context_actions only accepts icon_button or feedback_buttons");
5029
5032
  for (let t of ["positive_button", "negative_button"]) {
5030
5033
  let n = `${r}.${t}`;
5031
- B(e[t], n), X(e[t].text, `${n}.text`, 75), H(e[t].value, `${n}.value`, { max: En });
5034
+ B(e[t], n), X(e[t].text, `${n}.text`, 75), H(e[t].value, `${n}.value`, { max: Dn });
5032
5035
  }
5033
5036
  });
5034
5037
  }
5035
- function Xr(e, t) {
5038
+ function Zr(e, t) {
5036
5039
  B(e, t), K(e, "task_card", t), J(e, t), H(e.task_id, `${t}.task_id`), H(e.title, `${t}.title`), q(e.status, [
5037
5040
  "pending",
5038
5041
  "in_progress",
@@ -5043,12 +5046,12 @@ function Xr(e, t) {
5043
5046
  B(e, r), K(e, "url", r), H(e.url, `${r}.url`), H(e.text, `${r}.text`);
5044
5047
  }));
5045
5048
  }
5046
- function Zr(e, t) {
5049
+ function Qr(e, t) {
5047
5050
  B(e, t), K(e, "plan", t), J(e, t), H(e.title, `${t}.title`), e.tasks !== void 0 && (V(e.tasks, `${t}.tasks`), e.tasks.forEach((e, n) => {
5048
- Xr(e, `${t}.tasks[${String(n)}]`);
5051
+ Zr(e, `${t}.tasks[${String(n)}]`);
5049
5052
  }));
5050
5053
  }
5051
- function Qr(e, t) {
5054
+ function $r(e, t) {
5052
5055
  B(e, t), K(e, "container", t), J(e, t), z(e.title !== void 0 || e.rich_text_title !== void 0, "missing_field", t, "requires title or rich_text_title"), e.title !== void 0 && X(e.title, `${t}.title`, 150), e.rich_text_title !== void 0 && Q(e.rich_text_title, `${t}.rich_text_title`), e.subtitle !== void 0 && X(e.subtitle, `${t}.subtitle`, 150), e.icon !== void 0 && Z(e.icon, `${t}.icon`), e.width !== void 0 && q(e.width, [
5053
5056
  "narrow",
5054
5057
  "standard",
@@ -5070,122 +5073,122 @@ function Qr(e, t) {
5070
5073
  ];
5071
5074
  e.child_blocks.forEach((e, r) => {
5072
5075
  let i = `${t}.child_blocks[${String(r)}]`;
5073
- B(e, i), H(e.type, `${i}.type`), z(n.includes(e.type), "invalid_value", `${i}.type`, `"${e.type}" is not legal inside a container`), ti(e, "message", i);
5076
+ B(e, i), H(e.type, `${i}.type`), z(n.includes(e.type), "invalid_value", `${i}.type`, `"${e.type}" is not legal inside a container`), ni(e, "message", i);
5074
5077
  });
5075
5078
  }
5076
- function $r(e, t) {
5079
+ function ei(e, t) {
5077
5080
  B(e, t), K(e, "file", t), J(e, t), z(e.source === "remote", "invalid_value", `${t}.source`, "expected \"remote\""), H(e.external_id, `${t}.external_id`);
5078
5081
  }
5079
- function ei(e, t) {
5080
- B(e, t), K(e, "video", t), J(e, t), H(e.video_url, `${t}.video_url`), H(e.thumbnail_url, `${t}.thumbnail_url`), H(e.alt_text, `${t}.alt_text`, { max: Sn }), X(e.title, `${t}.title`, 199), e.description !== void 0 && X(e.description, `${t}.description`, 199), U(e.author_name, `${t}.author_name`, { max: 49 });
5082
+ function ti(e, t) {
5083
+ B(e, t), K(e, "video", t), J(e, t), H(e.video_url, `${t}.video_url`), H(e.thumbnail_url, `${t}.thumbnail_url`), H(e.alt_text, `${t}.alt_text`, { max: Cn }), X(e.title, `${t}.title`, 199), e.description !== void 0 && X(e.description, `${t}.description`, 199), U(e.author_name, `${t}.author_name`, { max: 49 });
5081
5084
  }
5082
5085
  function $(e, t, n) {
5083
5086
  z(e === "message", "surface_mismatch", t, `${n} blocks are only documented for message surfaces`);
5084
5087
  }
5085
- function ti(e, t = "message", n = "block") {
5088
+ function ni(e, t = "message", n = "block") {
5086
5089
  switch (B(e, n), J(e, n), e.type) {
5087
5090
  case "actions":
5088
- Rr(e, n);
5091
+ zr(e, n);
5089
5092
  return;
5090
5093
  case "alert":
5091
- Jr(e, t, n);
5094
+ Yr(e, t, n);
5092
5095
  return;
5093
5096
  case "card":
5094
- $(t, n, e.type), Kr(e, n);
5097
+ $(t, n, e.type), qr(e, n);
5095
5098
  return;
5096
5099
  case "carousel":
5097
- $(t, n, e.type), qr(e, n);
5100
+ $(t, n, e.type), Jr(e, n);
5098
5101
  return;
5099
5102
  case "container":
5100
- $(t, n, e.type), Qr(e, n);
5103
+ $(t, n, e.type), $r(e, n);
5101
5104
  return;
5102
5105
  case "context":
5103
- Lr(e, n);
5106
+ Rr(e, n);
5104
5107
  return;
5105
5108
  case "context_actions":
5106
- $(t, n, e.type), Yr(e, n);
5109
+ $(t, n, e.type), Xr(e, n);
5107
5110
  return;
5108
5111
  case "data_table":
5109
- $(t, n, e.type), Wr(e, n);
5112
+ $(t, n, e.type), Gr(e, n);
5110
5113
  return;
5111
5114
  case "data_visualization":
5112
- $(t, n, e.type), Gr(e, n);
5115
+ $(t, n, e.type), Kr(e, n);
5113
5116
  return;
5114
5117
  case "divider":
5115
5118
  K(e, "divider", n);
5116
5119
  return;
5117
5120
  case "file":
5118
- $(t, n, e.type), $r(e, n);
5121
+ $(t, n, e.type), ei(e, n);
5119
5122
  return;
5120
5123
  case "header":
5121
- Fr(e, n);
5124
+ Ir(e, n);
5122
5125
  return;
5123
5126
  case "image":
5124
- Ir(e, n);
5127
+ Lr(e, n);
5125
5128
  return;
5126
5129
  case "input":
5127
- zr(e, n);
5130
+ Br(e, t, n);
5128
5131
  return;
5129
5132
  case "markdown":
5130
- $(t, n, e.type), H(e.text, `${n}.text`, { max: wn });
5133
+ $(t, n, e.type), H(e.text, `${n}.text`, { max: Tn });
5131
5134
  return;
5132
5135
  case "plan":
5133
- $(t, n, e.type), Zr(e, n);
5136
+ $(t, n, e.type), Qr(e, n);
5134
5137
  return;
5135
5138
  case "rich_text":
5136
5139
  Q(e, n);
5137
5140
  return;
5138
5141
  case "section":
5139
- Pr(e, n);
5142
+ Fr(e, n);
5140
5143
  return;
5141
5144
  case "table":
5142
- $(t, n, e.type), Ur(e, n);
5145
+ $(t, n, e.type), Wr(e, n);
5143
5146
  return;
5144
5147
  case "task_card":
5145
- $(t, n, e.type), Xr(e, n);
5148
+ $(t, n, e.type), Zr(e, n);
5146
5149
  return;
5147
5150
  case "video":
5148
- ei(e, n);
5151
+ ti(e, n);
5149
5152
  return;
5150
- default: vr("unsupported_block", `${n}.type`, `unsupported block "${String(e.type)}"`);
5153
+ default: yr("unsupported_block", `${n}.type`, `unsupported block "${String(e.type)}"`);
5151
5154
  }
5152
5155
  }
5153
- function ni(e, t, n = "message", r = "block") {
5154
- ti(e, n, r), z(e.type === t, "invalid_value", `${r}.type`, `expected "${t}"`);
5156
+ function ri(e, t, n = "message", r = "block") {
5157
+ ni(e, n, r), z(e.type === t, "invalid_value", `${r}.type`, `expected "${t}"`);
5155
5158
  }
5156
- function ri(e, t) {
5159
+ function ii(e, t) {
5157
5160
  return Array.isArray(e) ? e : (B(e, t), V(e.blocks, `${t}.blocks`), e.blocks);
5158
5161
  }
5159
- function ii(e, t = "message", n = "data") {
5160
- let r = Array.isArray(e) ? n : `${n}.blocks`, i = ri(e, n), a = t === "message" ? 50 : 100;
5162
+ function ai(e, t = "message", n = "data") {
5163
+ let r = Array.isArray(e) ? n : `${n}.blocks`, i = ii(e, n), a = t === "message" ? 50 : 100;
5161
5164
  z(i.length <= a, "limit_exceeded", r, `${t} surfaces accept at most ${String(a)} blocks`);
5162
5165
  let o = 0, s = 0, c = 0, l = /* @__PURE__ */ new Set();
5163
5166
  i.forEach((e, n) => {
5164
5167
  let i = `${r}[${String(n)}]`;
5165
- if (ti(e, t, i), e.block_id !== void 0 && (z(!l.has(e.block_id), "duplicate_id", `${i}.block_id`, `"${e.block_id}" is already used in this payload`), l.add(e.block_id)), e.type === "markdown") o += e.text.length;
5166
- else if (e.type === "table") for (let t of e.rows) for (let e of t) s += Br(e);
5167
- else if (e.type === "data_table") for (let t of e.rows) for (let e of t) c += Br(e);
5168
- }), z(o <= wn, "limit_exceeded", r, `markdown blocks exceed the cumulative ${String(wn)} character limit`), z(s <= Dn, "limit_exceeded", r, `table cells exceed the cumulative ${String(Dn)} character limit`), z(c <= On, "limit_exceeded", r, `data_table cells exceed the cumulative ${String(On)} character limit`);
5168
+ if (ni(e, t, i), e.block_id !== void 0 && (z(!l.has(e.block_id), "duplicate_id", `${i}.block_id`, `"${e.block_id}" is already used in this payload`), l.add(e.block_id)), e.type === "markdown") o += e.text.length;
5169
+ else if (e.type === "table") for (let t of e.rows) for (let e of t) s += Vr(e);
5170
+ else if (e.type === "data_table") for (let t of e.rows) for (let e of t) c += Vr(e);
5171
+ }), z(o <= Tn, "limit_exceeded", r, `markdown blocks exceed the cumulative ${String(Tn)} character limit`), z(s <= On, "limit_exceeded", r, `table cells exceed the cumulative ${String(On)} character limit`), z(c <= kn, "limit_exceeded", r, `data_table cells exceed the cumulative ${String(kn)} character limit`);
5169
5172
  }
5170
- function ai(e, t = "message") {
5173
+ function oi(e, t = "message") {
5171
5174
  let n = e;
5172
5175
  if (typeof e == "string") try {
5173
5176
  n = JSON.parse(e);
5174
5177
  } catch {
5175
- throw new hr("expected valid JSON", {
5178
+ throw new gr("expected valid JSON", {
5176
5179
  code: "invalid_json",
5177
5180
  path: "data"
5178
5181
  });
5179
5182
  }
5180
- return ii(n, t), n;
5181
- }
5182
- function oi(e) {
5183
- return si(e) ? e.blocks : e;
5183
+ return ai(n, t), n;
5184
5184
  }
5185
5185
  function si(e) {
5186
+ return ci(e) ? e.blocks : e;
5187
+ }
5188
+ function ci(e) {
5186
5189
  return !Array.isArray(e);
5187
5190
  }
5188
5191
  //#endregion
5189
- export { nr as ActionsBlock, mn as AlertBlock, lr as Block, _r as BlockKit, hr as BlockKitInvariantError, b as BlockKitProvider, lt as ButtonElement, dn as CardBlock, pn as CarouselBlock, pt as ChoiceGroup, mr as ContainerBlock, ar as ContextActionsBlock, Qt as ContextBlock, ln as DataTableBlock, Qn as DataVisualizationBlock, Yt as DividerBlock, tn as FileBlock, Jt as HeaderBlock, Xt as ImageBlock, F as ImageElement, rr as InputBlock, Et as InputElement, Dt as InteractiveElement, Gt as Markdown, en as MarkdownBlock, I as Mrkdwn, ut as OverflowElement, _n as PlanBlock, N as RichText, $t as RichTextBlock, qt as SectionBlock, xt as SelectElement, on as TableBlock, rn as TableCell, hn as TaskCardBlock, L as Text, nn as VideoBlock, ii as assertBlockKitData, ni as assertBlockType, xr as assertImageElementData, kr as assertInteractiveElementData, ti as assertRenderableBlock, Nr as assertRichTextBlockData, yr as assertTextObjectData, oi as blocksOf, we as darkTheme, Ce as lightTheme, ai as parseBlockKitData, Vt as tokenizeMarkdown, Ft as tokenizeMrkdwn, Se as tokens, x as useBlockKitContext };
5192
+ export { rr as ActionsBlock, hn as AlertBlock, ur as Block, vr as BlockKit, gr as BlockKitInvariantError, b as BlockKitProvider, lt as ButtonElement, fn as CardBlock, mn as CarouselBlock, pt as ChoiceGroup, hr as ContainerBlock, or as ContextActionsBlock, Qt as ContextBlock, un as DataTableBlock, $n as DataVisualizationBlock, Yt as DividerBlock, tn as FileBlock, Jt as HeaderBlock, Xt as ImageBlock, F as ImageElement, ir as InputBlock, Et as InputElement, Dt as InteractiveElement, Gt as Markdown, en as MarkdownBlock, I as Mrkdwn, ut as OverflowElement, vn as PlanBlock, N as RichText, $t as RichTextBlock, qt as SectionBlock, xt as SelectElement, sn as TableBlock, an as TableCell, gn as TaskCardBlock, L as Text, nn as VideoBlock, ai as assertBlockKitData, ri as assertBlockType, Sr as assertImageElementData, Ar as assertInteractiveElementData, ni as assertRenderableBlock, Pr as assertRichTextBlockData, br as assertTextObjectData, si as blocksOf, we as darkTheme, Ce as lightTheme, oi as parseBlockKitData, Vt as tokenizeMarkdown, Ft as tokenizeMrkdwn, Se as tokens, x as useBlockKitContext };
5190
5193
 
5191
5194
  //# sourceMappingURL=index.js.map